@fuel-ts/providers .TransactionResponse
Represents a response for a transaction.
• new TransactionResponse(id
, provider
): TransactionResponse
Constructor for TransactionResponse
.
Name | Type | Description |
---|---|---|
id | string | The transaction ID. |
provider | Provider | The provider. |
packages/providers/src/transaction-response/transaction-response.ts:98
• gasUsed: BN
Gas used on the transaction
packages/providers/src/transaction-response/transaction-response.ts:88
• Optional
gqlTransaction: Object
The graphql Transaction with receipts object.
Name | Type |
---|---|
__typename | "Transaction" |
gasPrice? | null | string |
id | string |
rawPayload | string |
receipts? | null | { __typename : "Receipt" ; amount? : null | string ; assetId? : null | string ; contract? : null | { __typename : "Contract" ; id : 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" ; id : 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" } |
packages/providers/src/transaction-response/transaction-response.ts:90
• id: string
Transaction ID
packages/providers/src/transaction-response/transaction-response.ts:84
• provider: Provider
Current provider
packages/providers/src/transaction-response/transaction-response.ts:86
▸ decodeTransaction<TTransactionType
>(transactionWithReceipts
): Transaction
<TTransactionType
>
Decode the raw payload of the transaction.
Name | Type |
---|---|
TTransactionType | void |
Name | Type | Description |
---|---|---|
transactionWithReceipts | Object | The transaction with receipts object. |
transactionWithReceipts.__typename | "Transaction" | - |
transactionWithReceipts.gasPrice? | null | string | - |
transactionWithReceipts.id | string | - |
transactionWithReceipts.rawPayload | string | - |
transactionWithReceipts.receipts? | null | { __typename : "Receipt" ; amount? : null | string ; assetId? : null | string ; contract? : null | { __typename : "Contract" ; id : 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" ; id : 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" } | - |
Transaction
<TTransactionType
>
The decoded transaction.
packages/providers/src/transaction-response/transaction-response.ts:152
▸ 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"
; id
: 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"
; id
: 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.
Promise
<{ __typename
: "Transaction"
; gasPrice?
: null
| string
; id
: string
; rawPayload
: string
; receipts?
: null
| { __typename
: "Receipt"
; amount?
: null
| string
; assetId?
: null
| string
; contract?
: null
| { __typename
: "Contract"
; id
: 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"
; id
: 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.
packages/providers/src/transaction-response/transaction-response.ts:122
▸ getTransactionSummary<TTransactionType
>(contractsAbiMap?
): Promise
<TransactionSummary
<TTransactionType
>>
Retrieves the TransactionSummary. If the gqlTransaction
is not set, it will
fetch it from the provider
Name | Type |
---|---|
TTransactionType | void |
Name | Type | Description |
---|---|---|
contractsAbiMap? | AbiMap | The contracts ABI map. |
Promise
<TransactionSummary
<TTransactionType
>>
packages/providers/src/transaction-response/transaction-response.ts:166
▸ wait<TTransactionType
>(contractsAbiMap?
): Promise
<TransactionResult
<TTransactionType
>>
Waits for transaction to complete and returns the result.
Name | Type |
---|---|
TTransactionType | void |
Name | Type | Description |
---|---|---|
contractsAbiMap? | AbiMap | The contracts ABI map. |
Promise
<TransactionResult
<TTransactionType
>>
packages/providers/src/transaction-response/transaction-response.ts:244
▸ waitForResult<TTransactionType
>(contractsAbiMap?
): Promise
<TransactionResult
<TTransactionType
>>
Waits for transaction to complete and returns the result.
Name | Type |
---|---|
TTransactionType | void |
Name | Type |
---|---|
contractsAbiMap? | AbiMap |
Promise
<TransactionResult
<TTransactionType
>>
The completed transaction result
packages/providers/src/transaction-response/transaction-response.ts:224
▸ waitForStatusChange(): Promise
<void
>
Promise
<void
>
packages/providers/src/transaction-response/transaction-response.ts:200
▸ 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.
Name | Type | Description |
---|---|---|
id | string | The transaction ID. |
provider | Provider | The provider. |
Promise
<TransactionResponse
>
packages/providers/src/transaction-response/transaction-response.ts:111