Represents a response for a transaction.

Constructors

  • Creates a new TransactionResponse instance.

    Parameters

    • transactionRequestOrId: string | TransactionRequest

      The transaction ID or TransactionRequest.

    • provider: Provider

      The provider.

    • chainId: number

      The chain ID.

    • Optionalabis: JsonAbisFromAllCalls

      The ABIs.

    • OptionalsubmitAndAwaitSubscription: AsyncIterable<GqlSubmitAndAwaitStatusSubscription, any, any>

      The submit and await subscription.

    Returns TransactionResponse

    Use the object-style constructor instead: new TransactionResponse({ ... })

  • Creates a new TransactionResponse instance.

    Parameters

    Returns TransactionResponse

Properties

gasUsed: BN = ...

Gas used on the transaction

gqlTransaction?: GqlTransaction

The graphql Transaction with receipts object.

id: string

Transaction ID

preConfirmationStatus?:
    | {
        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;
        transaction: {
            inputs?: null | ({
                txPointer: string;
                type: "InputCoin";
            } | {
                txPointer: string;
                type: "InputContract";
            } | {
                type: "InputMessage";
            })[];
            outputs: (
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                })[];
            receiptsRoot?: null | string;
        };
        type: "FailureStatus";
    }
    | {
        preconfirmationReceipts?: null | {
            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;
        }[];
        reason: string;
        resolvedOutputs?: null | {
            output:
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                };
            utxoId: string;
        }[];
        totalFee: string;
        totalGas: string;
        type: "PreconfirmationFailureStatus";
    }
    | {
        preconfirmationReceipts?: null | {
            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;
        }[];
        resolvedOutputs?: null | {
            output:
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                };
            utxoId: string;
        }[];
        totalFee: string;
        totalGas: string;
        type: "PreconfirmationSuccessStatus";
    }
    | {
        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;
        transaction: {
            inputs?: null | ({
                txPointer: string;
                type: "InputCoin";
            } | {
                txPointer: string;
                type: "InputContract";
            } | {
                type: "InputMessage";
            })[];
            outputs: (
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                })[];
            receiptsRoot?: null | string;
        };
        type: "SuccessStatus";
    }
provider: Provider

Current provider

status?:
    | {
        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;
        transaction: {
            inputs?: null | ({
                txPointer: string;
                type: "InputCoin";
            } | {
                txPointer: string;
                type: "InputContract";
            } | {
                type: "InputMessage";
            })[];
            outputs: (
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                })[];
            receiptsRoot?: null | string;
        };
        type: "FailureStatus";
    }
    | {
        preconfirmationReceipts?: null | {
            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;
        }[];
        reason: string;
        resolvedOutputs?: null | {
            output:
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                };
            utxoId: string;
        }[];
        totalFee: string;
        totalGas: string;
        type: "PreconfirmationFailureStatus";
    }
    | {
        preconfirmationReceipts?: null | {
            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;
        }[];
        resolvedOutputs?: null | {
            output:
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                };
            utxoId: string;
        }[];
        totalFee: string;
        totalGas: string;
        type: "PreconfirmationSuccessStatus";
    }
    | {
        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;
        transaction: {
            inputs?: null | ({
                txPointer: string;
                type: "InputCoin";
            } | {
                txPointer: string;
                type: "InputContract";
            } | {
                type: "InputMessage";
            })[];
            outputs: (
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "ChangeOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "CoinOutput";
                }
                | {
                    contract: string;
                    stateRoot: string;
                    type: "ContractCreated";
                }
                | {
                    balanceRoot: string;
                    inputIndex: string;
                    stateRoot: string;
                    type: "ContractOutput";
                }
                | {
                    amount: string;
                    assetId: string;
                    to: string;
                    type: "VariableOutput";
                })[];
            receiptsRoot?: null | string;
        };
        type: "SuccessStatus";
    }

Methods

  • 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.

    Type Parameters

    • TTransactionType = void

      The type of the transaction.

    Parameters

    • OptionalcontractsAbiMap: AbiMap

      The map of contract ABIs.

    Returns Promise<TransactionResult<TTransactionType>>

    • The assembled transaction result.

    If the transaction status is a failure.

  • Fetch the transaction with receipts from the provider.

    Returns Promise<GqlTransaction>

    Transaction with receipts query result.

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

    Type Parameters

    • TTransactionType = void

    Parameters

    • OptionalcontractsAbiMap: AbiMap

      The contracts ABI map.

    Returns Promise<TransactionSummary<TTransactionType>>

  • Waits for transaction to complete and returns the result.

    Type Parameters

    • TTransactionType = void

    Parameters

    • OptionalcontractsAbiMap: AbiMap

      The contracts ABI map.

    Returns Promise<TransactionResult<TTransactionType>>

  • Waits for the transaction's pre-confirmation and returns the result.

    Parameters

    • OptionalcontractsAbiMap: AbiMap

      The contracts ABI map.

    Returns Promise<PreConfirmationTransactionResult>

    The pre-confirmed transaction result

  • Waits for transaction to complete and returns the result.

    Type Parameters

    • TTransactionType = void

    Parameters

    • OptionalcontractsAbiMap: AbiMap

    Returns Promise<TransactionResult<TTransactionType>>

    The completed transaction result

  • 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

    Returns Promise<TransactionResponse>