Skip to content

Commit

Permalink
Merge branch 'db/chore/remove-legacy-api-docs' of https://github.com/…
Browse files Browse the repository at this point in the history
…FuelLabs/fuels-ts into db/chore/remove-legacy-api-docs
  • Loading branch information
danielbate committed Nov 26, 2024
2 parents fd9ac01 + 846d4ec commit c7ef3c6
Show file tree
Hide file tree
Showing 15 changed files with 4,600 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .changeset/long-ducks-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
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,12 @@ export interface GetTransactionsSummariesReturns {
pageInfo: PageInfo;
}

/** @hidden */
/**
* Gets transaction summaries for a given owner/address.
*
* @param params - The filters to apply to the query.
* @returns The transaction summaries.
*/
export async function getTransactionsSummaries(
params: GetTransactionsSummariesParams
): Promise<GetTransactionsSummariesReturns> {
Expand Down
34 changes: 30 additions & 4 deletions packages/account/src/providers/transaction-summary/operations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,26 @@ import type {
AbiMap,
} from './types';

/** @hidden */
/**
* Extracts a specific type of receipt from a list of receipts.
*
* @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.
*
* @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 +215,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 id.
*/
export function getWithdrawFromFuelOperations({
inputs,
receipts,
Expand Down Expand Up @@ -356,7 +374,15 @@ export function getContractCallOperations({
});
}

/** @hidden */
/**
* Extracts a transfer operation from a transaction receipt, determining the addresses and types
* of the sender and receiver, along with the transferred asset details.
*
* @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
Loading

0 comments on commit c7ef3c6

Please sign in to comment.