Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: document hidden tx summary methods #3408

Merged
merged 7 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/tasty-pumas-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

docs: document hidden tx summary methods
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ export interface GetTransactionsSummariesReturns {
pageInfo: PageInfo;
}

/** @hidden */
/**
* Gets transaction summaries for a given owner/address.
danielbate marked this conversation as resolved.
Show resolved Hide resolved
* @param params - The filters to apply to the query.
danielbate marked this conversation as resolved.
Show resolved Hide resolved
*/
export async function getTransactionsSummaries(
params: GetTransactionsSummariesParams
): Promise<GetTransactionsSummariesReturns> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,24 @@ import type {
AbiMap,
} from './types';

/** @hidden */
/**
* Extracts a specific type of receipts from a list of receipts.
petertonysmith94 marked this conversation as resolved.
Show resolved Hide resolved
* @param receipts - The list of receipts to filter.
* @param type - The type of receipt to filter for.
* @returns The filtered list of receipts.
*/
export function getReceiptsByType<T = TransactionResultReceipt>(
receipts: TransactionResultReceipt[],
type: ReceiptType
) {
return (receipts ?? []).filter((r) => r.type === type) as T[];
}

/** @hidden */
/**
* Returns the transaction type's name based on the transaction type enum value.
danielbate marked this conversation as resolved.
Show resolved Hide resolved
* @param transactionType - The transaction type enum value.
* @returns The transaction type's name.
*/
export function getTransactionTypeName(transactionType: TransactionType): TransactionTypeName {
switch (transactionType) {
case TransactionType.Mint:
Expand Down Expand Up @@ -204,7 +213,14 @@ export function getReceiptsTransferOut(receipts: TransactionResultReceipt[]) {
return getReceiptsByType<TransactionResultTransferOutReceipt>(receipts, ReceiptType.TransferOut);
}

/** @hidden */
/**
* Creates withdrawal operations from Fuel to Ethereum based on message out receipts
*
* @param inputs - Transaction inputs containing account information
* @param receipts - Transaction receipts containing withdrawal details
* @param baseAssetId - The ID of the asset being withdrawn
* @returns Array of withdrawal operations with sender, recipient, and asset details
Dhaiwat10 marked this conversation as resolved.
Show resolved Hide resolved
*/
export function getWithdrawFromFuelOperations({
inputs,
receipts,
Expand Down Expand Up @@ -356,7 +372,14 @@ export function getContractCallOperations({
});
}

/** @hidden */
/**
* Extracts a transfer operation from a transaction receipt, determining the addresses and types
danielbate marked this conversation as resolved.
Show resolved Hide resolved
* of the sender and receiver, along with the transferred asset details.
Dhaiwat10 marked this conversation as resolved.
Show resolved Hide resolved
* @param receipt - The transaction receipt containing transfer information
* @param contractInputs - Array of contract inputs to determine address types
* @param changeOutputs - Array of change outputs to resolve zero addresses
* @returns A transfer operation object with sender, receiver and asset details
*/
function extractTransferOperationFromReceipt(
receipt: TransactionResultTransferReceipt | TransactionResultTransferOutReceipt,
contractInputs: InputContract[],
Expand Down