Class: TransactionResponse
@fuel-ts/account.TransactionResponse
Represents a response for a transaction.
Constructors
constructor
• new TransactionResponse(id, provider, abis?): TransactionResponse
Constructor for TransactionResponse.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The transaction ID. |
provider | Provider | The provider. |
abis? | JsonAbisFromAllCalls | - |
Returns
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:101
Properties
abis
• Optional abis: JsonAbisFromAllCalls
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:93
gasUsed
• gasUsed: BN
Gas used on the transaction
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:89
gqlTransaction
• Optional gqlTransaction: Object
The graphql Transaction with receipts object.
Type declaration
| Name | Type |
|---|---|
id | string |
rawPayload | string |
status? | null | { block: { id: string } ; reason: string ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "FailureStatus" } | { reason: string ; type: "SqueezedOutStatus" } | { time: string ; type: "SubmittedStatus" } | { block: { id: string } ; programState?: null | { data: string ; returnType: GqlReturnType } ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "SuccessStatus" } |
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:91
id
• id: string
Transaction ID
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:85
provider
• provider: Provider
Current provider
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:87
Methods
assembleResult
▸ assembleResult<TTransactionType>(contractsAbiMap?): Promise<TransactionResult<TTransactionType>>
Assembles the result of a transaction by retrieving the transaction summary, decoding logs (if available), and handling transaction failure.
This method can be used to obtain the result of a transaction that has just been submitted or one that has already been processed.
Throws
If the transaction status is a failure.
Type parameters
| Name | Type | Description |
|---|---|---|
TTransactionType | void | The type of the transaction. |
Parameters
| Name | Type | Description |
|---|---|---|
contractsAbiMap? | AbiMap | The map of contract ABIs. |
Returns
Promise<TransactionResult<TTransactionType>>
- The assembled transaction result.
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:256
decodeTransaction
▸ decodeTransaction<TTransactionType>(transactionWithReceipts): Transaction<TTransactionType>
Decode the raw payload of the transaction.
Type parameters
| Name | Type |
|---|---|
TTransactionType | void |
Parameters
| Name | Type | Description |
|---|---|---|
transactionWithReceipts | Object | The transaction with receipts object. |
transactionWithReceipts.id | string | - |
transactionWithReceipts.rawPayload | string | - |
transactionWithReceipts.status? | null | { block: { id: string } ; reason: string ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "FailureStatus" } | { reason: string ; type: "SqueezedOutStatus" } | { time: string ; type: "SubmittedStatus" } | { block: { id: string } ; programState?: null | { data: string ; returnType: GqlReturnType } ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "SuccessStatus" } | - |
Returns
Transaction<TTransactionType>
The decoded transaction.
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:160
fetch
▸ fetch(): Promise<{ id: string ; rawPayload: string ; status?: null | { block: { id: string } ; reason: string ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "FailureStatus" } | { reason: string ; type: "SqueezedOutStatus" } | { time: string ; type: "SubmittedStatus" } | { block: { id: string } ; programState?: null | { data: string ; returnType: GqlReturnType } ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "SuccessStatus" } }>
Fetch the transaction with receipts from the provider.
Returns
Promise<{ id: string ; rawPayload: string ; status?: null | { block: { id: string } ; reason: string ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "FailureStatus" } | { reason: string ; type: "SqueezedOutStatus" } | { time: string ; type: "SubmittedStatus" } | { block: { id: string } ; programState?: null | { data: string ; returnType: GqlReturnType } ; receipts: { amount?: null | string ; assetId?: null | string ; contractId?: null | string ; data?: null | string ; digest?: null | string ; gas?: null | string ; gasUsed?: null | string ; id?: 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 | string ; toAddress?: null | string ; val?: null | string }[] ; time: string ; totalFee: string ; totalGas: string ; type: "SuccessStatus" } }>
Transaction with receipts query result.
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:130
getTransactionSummary
▸ getTransactionSummary<TTransactionType>(contractsAbiMap?): Promise<TransactionSummary<TTransactionType>>
Retrieves the TransactionSummary. If the gqlTransaction is not set, it will fetch it from the provider
Type parameters
| Name | Type |
|---|---|
TTransactionType | void |
Parameters
| Name | Type | Description |
|---|---|---|
contractsAbiMap? | AbiMap | The contracts ABI map. |
Returns
Promise<TransactionSummary<TTransactionType>>
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:174
wait
▸ wait<TTransactionType>(contractsAbiMap?): Promise<TransactionResult<TTransactionType>>
Waits for transaction to complete and returns the result.
Type parameters
| Name | Type |
|---|---|
TTransactionType | void |
Parameters
| Name | Type | Description |
|---|---|---|
contractsAbiMap? | AbiMap | The contracts ABI map. |
Returns
Promise<TransactionResult<TTransactionType>>
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:309
waitForResult
▸ waitForResult<TTransactionType>(contractsAbiMap?): Promise<TransactionResult<TTransactionType>>
Waits for transaction to complete and returns the result.
Type parameters
| Name | Type |
|---|---|
TTransactionType | void |
Parameters
| Name | Type |
|---|---|
contractsAbiMap? | AbiMap |
Returns
Promise<TransactionResult<TTransactionType>>
The completed transaction result
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:297
waitForStatusChange
▸ waitForStatusChange(): Promise<void>
Returns
Promise<void>
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:219
create
▸ create(id, provider, abis?): 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.
Parameters
| Name | Type | Description |
|---|---|---|
id | string | The transaction ID. |
provider | Provider | The provider. |
abis? | JsonAbisFromAllCalls | - |
Returns
Promise<TransactionResponse>
Defined in
packages/account/src/providers/transaction-response/transaction-response.ts:115
