For the complete documentation index, see llms.txt. This page is also available as Markdown.

Deposit Methods

DepositClient communicates directly with on-chain contracts through the configured RPC URL.

Use it to read deposit state, inspect token balances and allowances, submit approvals, sign permits, and deposit settlement tokens.

import { createDepositClient } from "@gammaswap/v2-exchange-sdk";
import { Wallet } from "ethers";

const wallet = new Wallet(process.env.PRIVATE_KEY!);

const deposit = createDepositClient({
  rpcUrl: process.env.RPC_URL!,
  wallet,
  chainId: "84532",
});

The client verifies that the RPC network matches the configured chainId before performing contract reads or transactions.

On-chain integers are returned as TypeScript bigint values rather than JSON numbers.

getSettlementToken

Returns the settlement-token contract address.

const settlementToken =
  await deposit.getSettlementToken();

SDK response:

getPermit2

Returns the Permit2 contract address used by the deposit system.

SDK response:

getAccountLedger

Returns the account-ledger contract address.

SDK response:

getPendingBalance

Returns the connected account’s pending deposit balance.

SDK response:

With six settlement-token decimals, this represents 100.25 tokens.

getProcessedBalance

Returns the connected account’s processed deposit balance.

SDK response:

With six settlement-token decimals, this represents 50 tokens.

getPendingDepositCount

Returns the number of pending deposits.

SDK response:

getNextPendingDepositId

Returns the next pending deposit ID.

SDK response:

getProcessedDepositIndex

Returns the processed-deposit index.

SDK response:

getMinBlockWait

Returns the minimum number of blocks that must pass before the next deposit can be processed.

SDK response:

canProcessNext

Checks whether the next pending deposit can be processed.

SDK response:

If processing requirements have not been met:

getSettlementTokenBalance

Returns a settlement-token balance.

When no owner is supplied, the configured wallet address is used.

SDK response:

With six settlement-token decimals, this represents 250 tokens.

An owner address can also be supplied:

SDK response:

getSettlementTokenAllowance

Returns the settlement-token allowance for a spender.

SDK response:

Optional spender and owner addresses can be supplied:

SDK response:

approveDepositLedger

Approves the deposit ledger to spend settlement tokens.

This method submits an on-chain transaction.

The supplied SDK documentation does not publish its complete input fields or return type. The exact response object should be copied from the SDK’s exported TypeScript definition before publishing a response example.

approvePermit2

Approves Permit2 to spend settlement tokens.

This method submits an on-chain transaction.

deposit

Submits an on-chain deposit transaction.

The method logs the deposit transaction ID by default.

To suppress the log:

The SDK confirms that the method submits the transaction and logs the deposit txId by default.

signDepositPermit

Creates a signed Permit2 deposit authorization without submitting an on-chain transaction.

depositWithPermit

Submits an on-chain deposit using a signed Permit2 authorization.

parseAmount

Converts a human decimal amount into settlement-token base units.

SDK response:

The settlement token uses six decimals.

Additional examples:

Response:

Response:

Invalid precision, zero amounts, negative values, and out-of-range values are rejected before a transaction is submitted.

Available methods

Method
Operation

getSettlementToken

Read settlement-token address

getPermit2

Read Permit2 address

getAccountLedger

Read account-ledger address

getPendingBalance

Read pending deposit balance

getProcessedBalance

Read processed deposit balance

getPendingDepositCount

Read pending-deposit count

getNextPendingDepositId

Read next pending deposit ID

getProcessedDepositIndex

Read processed-deposit index

getMinBlockWait

Read minimum block wait

canProcessNext

Check whether the next deposit is processable

getSettlementTokenBalance

Read settlement-token balance

getSettlementTokenAllowance

Read token allowance

approveDepositLedger

Approve the deposit ledger

approvePermit2

Approve Permit2

deposit

Submit a deposit

signDepositPermit

Sign a deposit permit

depositWithPermit

Deposit using a permit

parseAmount

Convert a human amount into base units

Last updated