salt-sdk
    Preparing search index...

    Interface Transaction

    Represents a Transaction throughout its entire lifecycle.

    interface Transaction {
        getBroadcastTxResponse(): BroadcastTxResponse | null;
        getCombineResponse(): CombineTxResponse | null;
        getCurrentState(): TRANSACTION_STATES;
        getRequiredSignatures(): number;
        getSignatures(): SignTxResponse[];
        onBroadcast(handler: (data: unknown) => void | Promise<void>): void;
        onCombine(handler: (data: unknown) => void | Promise<void>): void;
        onEnd(handler: (data: unknown) => void | Promise<void>): void;
        onPropose(handler: (data: unknown) => void | Promise<void>): void;
        onSign(handler: (data: unknown) => void | Promise<void>): void;
        onTransition(
            fromState: TRANSACTION_STATES,
            toState: TRANSACTION_STATES,
            handler: (data: unknown) => void | Promise<void>,
        ): void;
        submitTransaction(): Promise<boolean>;
        transitionTo(data: unknown, newState: TRANSACTION_STATES): Promise<void>;
    }
    Index

    Methods

    • Returns number

    • Add an event handler for the Transaction Broadcast event

      Parameters

      • handler: (data: unknown) => void | Promise<void>

        the function to handle the broadcast event

      Returns void

    • Add an event handler for the Transaction Combine event

      Parameters

      • handler: (data: unknown) => void | Promise<void>

        the function to handle the broadcast event

      Returns void

    • Add an event handler for the Transaction Complete/End event

      Parameters

      • handler: (data: unknown) => void | Promise<void>

        the function to handle the complete event

      Returns void

    • Add an event handler for the Transaction Proposed event

      Parameters

      • handler: (data: unknown) => void | Promise<void>

        the function to handle the propose event

      Returns void

    • Add an event handler for the Transaction Sign event

      Parameters

      • handler: (data: unknown) => void | Promise<void>

        the function to handle the sign event

      Returns void

    • onTransition

      Parameters

      • fromState: TRANSACTION_STATES

        The current state

      • toState: TRANSACTION_STATES

        The next state

      • handler: (data: unknown) => void | Promise<void>

        The handler function to be called when transitioning from the current state to the next state

      Returns void

      InvalidTransitionError if the transition from 'fromState' to 'toState' is not allowed

    • Submits a transaction to the blockchain

      Returns Promise<boolean>

      true if it was successfully submitted