Icon LinkClass: TransactionResponse

@fuel-ts/providers .TransactionResponse

Represents a response for a transaction.

Icon LinkConstructors

Icon Linkconstructor

new TransactionResponse(id, provider)

Constructor for TransactionResponse.

Icon LinkParameters

NameTypeDescription
idstringThe transaction ID.
providerProvider The provider.

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:106 Icon Link

Icon LinkProperties

Icon LinkfetchAttempts

fetchAttempts: number = 0

Number of attempts made to fetch the transaction

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:94 Icon Link


Icon LinkgasUsed

gasUsed: BN

Gas used on the transaction

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:92 Icon Link


Icon LinkgqlTransaction

Optional gqlTransaction: Object

The graphql Transaction with receipts object.

Icon LinkType declaration

NameType
__typename"Transaction"
gasPrice?null | string
idstring
rawPayloadstring
receipts?null | { __typename: "Receipt" ; amount?: null | string ; assetId?: null | string ; contract?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; is?: null | string ; len?: null | string ; nonce?: null | string ; param1?: null | string ; param2?: null | string ; pc?: null | string ; ptr?: null | string ; ra?: null | string ; rb?: null | string ; rc?: null | string ; rd?: null | string ; reason?: null | string ; receiptType: GqlReceiptType ; recipient?: null | string ; result?: null | string ; sender?: null | string ; subId?: null | string ; to?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; toAddress?: null | string ; val?: null | string }[]
status?null | { __typename: "FailureStatus" ; block: { __typename: "Block" ; id: string } ; reason: string ; time: any ; type: "FailureStatus" } | { __typename: "SqueezedOutStatus" ; type: "SqueezedOutStatus" } | { __typename: "SubmittedStatus" ; time: any ; type: "SubmittedStatus" } | { __typename: "SuccessStatus" ; block: { __typename: "Block" ; id: string } ; programState?: null | { __typename: "ProgramState" ; data: string ; returnType: GqlReturnType } ; time: any ; type: "SuccessStatus" }

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:98 Icon Link


Icon Linkid

id: string

Transaction ID

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:88 Icon Link


Icon Linkprovider

provider: Provider

Current provider

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:90 Icon Link


Icon LinkresultAttempts

resultAttempts: number = 0

Number of attempts made to retrieve a processed transaction.

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:96 Icon Link

Icon LinkMethods

Icon LinkdecodeTransaction

decodeTransaction<TTransactionType>(transactionWithReceipts): Transaction<TTransactionType>

Decode the raw payload of the transaction.

Icon LinkType parameters

NameType
TTransactionTypevoid

Icon LinkParameters

NameTypeDescription
transactionWithReceiptsObjectThe transaction with receipts object.
transactionWithReceipts.__typename"Transaction"-
transactionWithReceipts.gasPrice?null | string-
transactionWithReceipts.idstring-
transactionWithReceipts.rawPayloadstring-
transactionWithReceipts.receipts?null | { __typename: "Receipt" ; amount?: null | string ; assetId?: null | string ; contract?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; is?: null | string ; len?: null | string ; nonce?: null | string ; param1?: null | string ; param2?: null | string ; pc?: null | string ; ptr?: null | string ; ra?: null | string ; rb?: null | string ; rc?: null | string ; rd?: null | string ; reason?: null | string ; receiptType: GqlReceiptType ; recipient?: null | string ; result?: null | string ; sender?: null | string ; subId?: null | string ; to?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; toAddress?: null | string ; val?: null | string }[]-
transactionWithReceipts.status?null | { __typename: "FailureStatus" ; block: { __typename: "Block" ; id: string } ; reason: string ; time: any ; type: "FailureStatus" } | { __typename: "SqueezedOutStatus" ; type: "SqueezedOutStatus" } | { __typename: "SubmittedStatus" ; time: any ; type: "SubmittedStatus" } | { __typename: "SuccessStatus" ; block: { __typename: "Block" ; id: string } ; programState?: null | { __typename: "ProgramState" ; data: string ; returnType: GqlReturnType } ; time: any ; type: "SuccessStatus" }-

Icon LinkReturns

Transaction<TTransactionType>

The decoded transaction.

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:151 Icon Link


Icon Linkfetch

fetch(): Promise<{ __typename: "Transaction" ; gasPrice?: null | string ; id: string ; rawPayload: string ; receipts?: null | { __typename: "Receipt" ; amount?: null | string ; assetId?: null | string ; contract?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; is?: null | string ; len?: null | string ; nonce?: null | string ; param1?: null | string ; param2?: null | string ; pc?: null | string ; ptr?: null | string ; ra?: null | string ; rb?: null | string ; rc?: null | string ; rd?: null | string ; reason?: null | string ; receiptType: GqlReceiptType ; recipient?: null | string ; result?: null | string ; sender?: null | string ; subId?: null | string ; to?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; toAddress?: null | string ; val?: null | string }[] ; status?: null | { __typename: "FailureStatus" ; block: { __typename: "Block" ; id: string } ; reason: string ; time: any ; type: "FailureStatus" } | { __typename: "SqueezedOutStatus" ; type: "SqueezedOutStatus" } | { __typename: "SubmittedStatus" ; time: any ; type: "SubmittedStatus" } | { __typename: "SuccessStatus" ; block: { __typename: "Block" ; id: string } ; programState?: null | { __typename: "ProgramState" ; data: string ; returnType: GqlReturnType } ; time: any ; type: "SuccessStatus" } }>

Fetch the transaction with receipts from the provider.

Icon LinkReturns

Promise<{ __typename: "Transaction" ; gasPrice?: null | string ; id: string ; rawPayload: string ; receipts?: null | { __typename: "Receipt" ; amount?: null | string ; assetId?: null | string ; contract?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; is?: null | string ; len?: null | string ; nonce?: null | string ; param1?: null | string ; param2?: null | string ; pc?: null | string ; ptr?: null | string ; ra?: null | string ; rb?: null | string ; rc?: null | string ; rd?: null | string ; reason?: null | string ; receiptType: GqlReceiptType ; recipient?: null | string ; result?: null | string ; sender?: null | string ; subId?: null | string ; to?: null | { __typename: "Contract" ; bytecode: string ; id: string ; salt: string } ; toAddress?: null | string ; val?: null | string }[] ; status?: null | { __typename: "FailureStatus" ; block: { __typename: "Block" ; id: string } ; reason: string ; time: any ; type: "FailureStatus" } | { __typename: "SqueezedOutStatus" ; type: "SqueezedOutStatus" } | { __typename: "SubmittedStatus" ; time: any ; type: "SubmittedStatus" } | { __typename: "SuccessStatus" ; block: { __typename: "Block" ; id: string } ; programState?: null | { __typename: "ProgramState" ; data: string ; returnType: GqlReturnType } ; time: any ; type: "SuccessStatus" } }>

Transaction with receipts query result.

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:130 Icon Link


Icon LinkgetTransactionSummary

getTransactionSummary<TTransactionType>(contractsAbiMap?): Promise<TransactionSummary <TTransactionType>>

Retrieves the TransactionSummary. If the gqlTransaction is not set, it will fetch it from the provider

Icon LinkType parameters

NameType
TTransactionTypevoid

Icon LinkParameters

NameTypeDescription
contractsAbiMap?AbiMap The contracts ABI map.

Icon LinkReturns

Promise<TransactionSummary <TTransactionType>>

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:165 Icon Link


Icon LinksleepBasedOnAttempts

Private sleepBasedOnAttempts(attempts): Promise<void>

Introduces a delay based on the number of previous attempts made.

Icon LinkParameters

NameTypeDescription
attemptsnumberThe number of attempts.

Icon LinkReturns

Promise<void>

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:249 Icon Link


Icon Linkwait

wait<TTransactionType>(contractsAbiMap?): Promise<TransactionResult<TTransactionType>>

Waits for transaction to complete and returns the result.

Icon LinkType parameters

NameType
TTransactionTypevoid

Icon LinkParameters

NameTypeDescription
contractsAbiMap?AbiMap The contracts ABI map.

Icon LinkReturns

Promise<TransactionResult<TTransactionType>>

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:229 Icon Link


Icon LinkwaitForResult

waitForResult<TTransactionType>(contractsAbiMap?): Promise<TransactionResult<TTransactionType>>

Waits for transaction to complete and returns the result.

Icon LinkType parameters

NameType
TTransactionTypevoid

Icon LinkParameters

NameType
contractsAbiMap?AbiMap

Icon LinkReturns

Promise<TransactionResult<TTransactionType>>

The completed transaction result

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:203 Icon Link


Icon Linkcreate

Static create(id, provider): Promise<TransactionResponse >

Async constructor for TransactionResponse. This method can be used to create an instance of TransactionResponse and wait for the transaction to be fetched from the chain, ensuring that the gqlTransaction property is set.

Icon LinkParameters

NameTypeDescription
idstringThe transaction ID.
providerProvider The provider.

Icon LinkReturns

Promise<TransactionResponse >

Icon LinkDefined in

packages/providers/src/transaction-response/transaction-response.ts:119 Icon Link

Was this page helpful?