aftermath-ts-sdk - v3.3.3
    Preparing search index...

    The GasPools class provides methods for interacting with shared gas pool endpoints on the Aftermath platform. This includes querying pool details and building transactions for creating, depositing into, withdrawing from, sponsoring, granting access to, and revoking access from gas pools.

    const gasPools = new GasPools({ network: "MAINNET" });

    // Get gas pool details
    const pool = await gasPools.getPool({
    walletAddress: "0x..."
    });

    // Build a deposit transaction
    const { tx } = await gasPools.getDepositTx({
    walletAddress: "0x...",
    depositAmount: 100_000_000n
    });

    Hierarchy (View Summary)

    Index

    Optional provider used to serialize transactions supplied to gas-pool endpoints.

    config: CallerConfig

    The mutable configuration used for subsequent requests.

    • Builds a transaction to create a new gas pool for the given wallet.

      When deferShare is true, the response includes gasPoolArg and sharePolicyArg so you can compose additional commands (e.g. deposit, grant) before calling getShareTx to finalize.

      Parameters

      • inputs: Omit<ApiGasPoolCreateBody, "txKind"> & { tx?: Transaction }
        • walletAddress

          Wallet address to create the gas pool for.

        • initialDepositAmount

          Optional initial deposit amount in MIST.

        • deferShare

          When true, returns args without sharing yet.

        • tx

          Optional transaction to extend.

        • Optionaltx?: Transaction

          Optional transaction to extend.

      Returns Promise<Omit<ApiGasPoolCreateResponse, "txKind"> & { tx: Transaction }>

      tx plus optional gasPoolArg and sharePolicyArg when deferred.

    • Builds a transaction to deposit into the gas pool.

      Supports SUI and non-SUI deposits. For non-SUI deposits, the input coin is swapped into SUI via the Aftermath router before depositing.

      Parameters

      • inputs: Omit<ApiGasPoolDepositBody, "txKind"> & { tx?: Transaction }
        • walletAddress

          Wallet address submitting the deposit.

        • isSponsoredTx

          Whether to build the transaction for sponsored gas. Defaults to false.

        • coinType

          Coin type to deposit. Defaults to SUI.

        • amount

          Amount to deposit (required when sourcing from wallet or for non-SUI).

        • coinArg

          PTB coin argument to use as input (if omitted, sourced from wallet).

        • slippage

          Slippage tolerance for non-SUI swaps (defaults to 0.01).

        • gasPoolArg

          Optional gas pool argument from a previously-built PTB command.

        • tx

          Optional transaction to extend.

        • Optionaltx?: Transaction

          Optional transaction to extend.

      Returns Promise<SdkTransactionResponse>

      SdkTransactionResponse with tx.

    • Builds a transaction to grant another wallet access to the gas pool.

      Parameters

      • inputs: Omit<ApiGasPoolGrantBody, "txKind"> & { tx?: Transaction }
        • walletAddress

          Owner wallet address.

        • targetWalletAddress

          Wallet address to grant access to.

        • gasPoolArg

          Optional gas pool argument from a previously-built PTB command.

        • tx

          Optional transaction to extend.

        • Optionaltx?: Transaction

          Optional transaction to extend.

      Returns Promise<SdkTransactionResponse>

      SdkTransactionResponse with tx.

    • Builds a transaction to share a gas pool that was created with deferShare: true.

      Use this after composing additional commands (deposit, grant, etc.) with the gasPoolArg returned by getCreateTx.

      Parameters

      • inputs: Omit<ApiGasPoolShareBody, "txKind"> & { tx?: Transaction }
        • gasPoolArg

          Gas pool argument from a deferred create.

        • sharePolicyArg

          Share policy argument from a deferred create.

        • tx

          Optional transaction to extend.

        • Optionaltx?: Transaction

          Optional transaction to extend.

      Returns Promise<SdkTransactionResponse>

      SdkTransactionResponse with tx.

    • Requests a gas-pool-sponsored transaction. Returns a complete transaction with the gas payment and epoch bound attached, the sponsor's signature, and the digest both signatures commit to — the caller signs transaction as the sender and submits it together with sponsorSignature.

      Parameters

      • inputs: Omit<ApiGasPoolSponsorBody, "txKind"> & { tx?: Transaction }
        • walletAddress

          Wallet address requesting the sponsorship.

        • bytes

          Base64 of the signed SPONSOR_GAS auth message.

        • signature

          Signature over bytes.

        • tx

          Optional transaction to sponsor (appended as a tx kind).

        • Optionaltx?: Transaction

          Optional transaction to sponsor (appended as a tx kind).

      Returns Promise<ApiGasPoolSponsorResponse>

      ApiGasPoolSponsorResponse.

    • Builds a transaction to withdraw SUI from the gas pool.

      When deferTransfer is true, the withdrawn coin is not transferred. Instead, withdrawnCoinArg is returned for further PTB composition.

      Parameters

      • inputs: Omit<ApiGasPoolWithdrawBody, "txKind"> & { tx?: Transaction }
        • walletAddress

          Wallet address submitting the withdrawal.

        • amount

          Amount of SUI to withdraw in MIST.

        • recipientAddress

          Optional recipient (defaults to walletAddress).

        • deferTransfer

          When true, returns the withdrawn coin arg instead of transferring.

        • gasPoolArg

          Optional gas pool argument from a previously-built PTB command.

        • tx

          Optional transaction to extend.

        • Optionaltx?: Transaction

          Optional transaction to extend.

      Returns Promise<Omit<ApiGasPoolWithdrawResponse, "txKind"> & { tx: Transaction }>

      tx plus optional withdrawnCoinArg when deferred.

    • Returns the canonical Aftermath API host for a Sui network.

      To target a custom or local host, pass baseUrl in CallerConfig to the constructor instead.

      Parameters

      • network: SuiNetwork

        The Sui network whose host to return.

      Returns string

      The network's HTTPS or local HTTP API host.