Deposit Address API

For more information on managing deposit addresses, please refer to Deposit Addresses: Introduction. The Deposit Address API allows you to create, and also to query WalletDepositAddresses for a specific wallet.

Create

You can create a deposit address for a wallet using the createWalletDepositAddress mutation. The createWalletDepositAddress mutation will reserve an address for the wallet, and return the walletDepositAddressId of the deposit address. Refer to Deposit Addresses: Introduction on the behaviour of deposit addresses on different blockchains.

You can toggle between TypeScript for the SDK code example and GraphQL for the mutation code example.

Depending on the blockchain, additional steps may be required to deploy and activate the deposit address. For example, Bitcoin does not require deployment and activation, while Ethereum does. Refer to Deposit Addresses: Introduction for more information.

  • createWalletDepositAddress generates an address for you
  • deployWalletDepositAddress deploys the address to the blockchain, and is optional for certain chains
  • activateWalletDepositAddress activates the address for use, and is optional for certain chains
SDKTypeScript
const { walletDepositAddressId } = await client.createWalletDepositAddress({
  walletId: '22cf4347-405a-47df-8267-26bfecac7b11',
  label: 'My deposit address',
});

// These additional steps are required for certain chains
await client.deployWalletDepositAddress({ walletDepositAddressId });
await client.activateWalletDepositAddress({ walletDepositAddressId });

Retrieve

Deposit Address by Deposit Address ID

The following query allows you to retrieve a deposit address by its walletDepositAddressId, you can specify any additional fields you want to retrieve from the WalletDepositAddress object.

QueryGraphQL
query GetDepositAddressById($walletId: ID!, $walletDepositAddressId: ID!) {
  wallet(walletId: $walletId) {
    depositAddress(walletDepositAddressId: $walletDepositAddressId) {
      balances {
        items {
          caip19Id
          balanceBase
          symbol
          decimals
          name
          contractAddress
        }
      }
    }
  }
}
VariablesJSON
{
  "walletId": "be72b153-0b22-4467-80b1-d03e8f63c17c",
  "walletDepositAddressId": "f1ec2fa5-20ef-4da3-b2e7-2df0bb56ca8d"
}
ResponseJSON
{
  "data": {
    "wallet": {
      "depositAddress": {
        "balances": {
          "items": [
            {
              "caip19Id": "caip19:eip155:11155111/slip44:60",
              "balanceBase": "0",
              "symbol": "ETH",
              "decimals": 18,
              "name": "Ether",
              "contractAddress": null
            },
            {
              "caip19Id": "caip19:eip155:11155111/erc20:0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0",
              "balanceBase": "10000000",
              "symbol": "USDT",
              "decimals": 6,
              "name": "USDT",
              "contractAddress": "0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0"
            }
          ]
        }
      }
    }
  }
}

Update

MutationGraphQL
mutation UpdateWalletDepositAddress {
  updateWalletDepositAddress(
    input: {
      orgId: "868202983161"
      walletId: "22cf4347-405a-47df-8267-26bfecac7b11"
      walletDepositAddressId: "01234abc-e382-4d2f-bcea-0b789c00c18b"
      label: "Updated Address Label"
    }
  )
}

Delete

Due to the immutable nature of the blockchain, deposit addresses cannot be deleted once they are created. If there are changes or updates needed, consider updating the label of the deposit address for better identification and management. For any other concerns or requirements, please reach out to Levain support for assistance.