Deposits & Withdrawals

Learn how to simulate depositing crypto into accounts and withdrawing crypto from them.

Before You Begin

Make sure you have a wallet address and id noted down for an account. If you don't have an account, check out the creating an account guide.

Deposit Crypto

Simulate Outside Deposits

Depositing USDC into your account for this guide requires using our Sandbox Management API to simulate it since external wallets cannot be managed by our API.

Depositing 500 USDC

1. Make a POST request to https://sandbox.conduit.financial/sandbox/transactions with the following body but replace the destination wallet address with the one you noted down:

Copy
Copied
{
  "data": {
    "type": "ethereum-transaction",
    "attributes": {
      "assetType": "asset:eth:USDC",
      "amount": "500000000",
      "source": "0x0000000000000000000000000000000000000000",
      "destination": "0x274ed96d9c5c612dc6bcd36150e3ab7c87de7425"
    }
  }
}
Note

The assetType attribute indicates both the specific asset and the broader family of assets that the quantity is denominated in. For example, "asset:eth:USDC" indicates that the asset is USDC on the Ethereum network.

The amount attribute is a string and represents an integer indicating the number of the smallest unit of the corresponding asset type. For example, USDC is divided into millionths of a unit so the quantity 500 USDC is represented as "500000000"


2. If successful, you will see a similar response from the API:

Copy
Copied
{
  "data": {
    "id": "id:sandbox-trxn:2J8hJUxB5whE6I0yKCbP59t0qI0",
    "type": "ethereum-transaction",
    "attributes": {
      "createdAt": "2022-12-19T15:59:05.920Z",
      "assetType": "asset:eth:USDC",
      "amount": "500000000",
      "source": "0x0000000000000000000000000000000000000000",
      "destination": "0x274ed96d9c5c612dc6bcd36150e3ab7c87de7425",
      "status": "completed"
    }
  }
}

Check Balance

Now that your deposit is confirmed, the deposited USDC should be available in your account. Let's verify this by querying the account and looking at the balance.

1. Make a GET request to https://sandbox.conduit.financial/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE but make sure to replace the account id with yours.

2. If successful, you will see a response from the API that shows the balance increased by the deposited amount:

Copy
Copied
{
  "data": {
    "id": "id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE",
    "type": "account",
    "attributes": {
      "balances": {
        "available": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "500000000"
          }
        ],
        "pending": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "0"
          }
        ]
      },
      "wallets": [
        {
          "assetType": "asset:eth:USDC",
          "networkId": "net:eth:ropsten",
          "address": "wlt:eth:0x274ed96d9c5c612dc6bcd36150e3ab7c87de7425"
        }
      ]
    },
    "relationships": {
      "account-holders": {
        "links": {
          "self": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/relationships/account-holders",
          "related": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/account-holders"
        },
        "data": [
          {
            "id": "id:ahl:2J8Ocs7KFZJt3CMPi9f0x8UCCQ0",
            "type": "account-holder"
          }
        ]
      },
      "allocations": {
        "links": {
          "next": null,
          "self": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/relationships/allocations",
          "related": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/allocations"
        },
        "data": [
          {
            "id": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
            "type": "allocation"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
      "poolName": "default_pool_usdc",
      "balances": {
        "available": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "500000000"
          }
        ],
        "pending": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "0"
          }
        ],
        "accruedYield": [
          {
            "assetType": "asset:eth:USDC",
            "amount": "0"
          }
        ]
      }
    }
  ]
}

Withdraw Crypto

Withdraw 200 USDC

1. Make a POST request to https://sandbox.conduit.financial/transactions with the following body but replace the source with the account wallet address you want to withdraw from (we'll use the one from the example above) and the destination with the wallet address you want to withdraw to:

Copy
Copied
{
  "data": {
    "attributes": {
      "assetType": "asset:eth:USDC",
      "amount": "200000000",
      "source": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
      "destination": "wlt:eth:0x0000000000000000000000000000000000000000"
    }
  }
}

2. If successful, you will see a similar response from the API:

Copy
Copied
{
  "data": {
    "id": "id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7",
    "type": "transaction",
    "attributes": {
      "createdAt": "2022-12-21T19:41:29.771Z",
      "createdBy": "client",
      "effectiveDate": "2022-12-21",
      "amount": "200000000",
      "source": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
      "destination": "wlt:eth:0x0000000000000000000000000000000000000000",
      "status": "pending",
      "assetType": "asset:eth:USDC"
    },
    "relationships": {
      "source": {
        "links": {
          "self": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/relationships/source",
          "related": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/source"
        },
        "data": {
          "id": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
          "type": "id"
        }
      },
      "destination": {
        "links": {
          "self": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/relationships/destination",
          "related": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/destination"
        },
        "data": {
          "id": "wlt:eth:0x0000000000000000000000000000000000000000",
          "type": "wallet"
        }
      },
      "quote": {
        "links": {
          "self": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/relationships/quote",
          "related": "/transactions/id:trxn:2JEmbbAXZ2TgNNNuchmSW916Bw7/quote"
        },
        "data": null
      }
    }
  }
}

Check Balance

Now that your withdrawal is confirmed, the withdrawn USDC should be deducted from your account. Let's verify this by querying the account and looking at the balance.

1. Make a GET request to https://sandbox.conduit.financial/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE but make sure to replace the account id with yours.

2. If successful, you will see a response from the API that shows the balance decreased by the withdrawn amount:

Copy
Copied
{
  "data": {
    "id": "id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE",
    "type": "account",
    "attributes": {
      "balances": {
        "available": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "300000000"
          }
        ],
        "pending": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "200000000"
          }
        ]
      },
      "wallets": [
        {
          "assetType": "asset:eth:USDC",
          "networkId": "net:eth:ropsten",
          "address": "wlt:eth:0x274ed96d9c5c612dc6bcd36150e3ab7c87de7425"
        }
      ]
    },
    "relationships": {
      "account-holders": {
        "links": {
          "self": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/relationships/account-holders",
          "related": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/account-holders"
        },
        "data": [
          {
            "id": "id:ahl:2J8Ocs7KFZJt3CMPi9f0x8UCCQ0",
            "type": "account-holder"
          }
        ]
      },
      "allocations": {
        "links": {
          "next": null,
          "self": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/relationships/allocations",
          "related": "/accounts/id:acct:2J8Ok1bfIrvpNcX2V8QwDMigUKE/allocations"
        },
        "data": [
          {
            "id": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
            "type": "allocation"
          }
        ]
      }
    }
  },
  "included": [
    {
      "id": "id:allc:2J8OkA50iEKCUdAP64xbgU14Irf",
      "poolName": "default_pool_usdc",
      "balances": {
        "available": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "300000000"
          }
        ],
        "pending": [
          {
            "assetType": "asset:eth:ETH",
            "amount": "0"
          },
          {
            "assetType": "asset:eth:USDC",
            "amount": "0"
          }
        ],
        "accruedYield": [
          {
            "assetType": "asset:eth:USDC",
            "amount": "0"
          }
        ]
      }
    }
  ]
}

Next Steps

Now that you know how to deposit and withdraw crypto, let's try getting crypto with local fiat.