Skip to navigation

Quickstart

From an API key to a settled testnet mint in about five minutes.
← Switch to the Production API

This is the sandbox. It runs on testnets only. Never send real money or real tokens to an address or bank account the sandbox returns.

The sandbox is subject to the Beta Features section of our Terms of Use.

This walkthrough mints testnet AUSD from CTK on Avalanche Fuji. You need:

  • A sandbox API key. See Get access.
  • An EVM wallet with a little Fuji AVAX for gas. See Testnet Tokens for a faucet.
  • curl and jq. The deposit step uses Foundry’s cast, but any wallet works.
1

Get a session JWT

export SANDBOX=https://api.sandbox.agora.finance
export JWT=$(curl -s -X POST $SANDBOX/v0/auth/token \
-H "Authorization: Bearer $AGORA_SANDBOX_API_KEY" | jq -r .sessionJwt)

The JWT lasts 15 minutes. See Authentication.

2

Register your wallet

export WALLET=0xYourFujiAddress
export ACCOUNT_ID=$(curl -s -X POST $SANDBOX/v0/accounts \
-H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
-d "{\"kind\":\"wallet\",\"address\":\"$WALLET\",\"name\":\"Sandbox wallet\",\"networks\":[\"avalanche-fuji\"]}" \
| jq -r .id)

The wallet’s mint entitlement comes back conditionally_approved, which is enough to create routes. It becomes approved within about a minute.

3

Create a CTK to AUSD route

export DEPOSIT=$(curl -s -X POST $SANDBOX/v0/routes \
-H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
-d "{\"from\":{\"currency\":\"ctk\"},\"to\":{\"currency\":\"ausd\",\"accountId\":\"$ACCOUNT_ID\",\"chain\":\"avalanche-fuji\"}}" \
| jq -r '.instructions[] | select(.chain == "avalanche-fuji") | .depositAddress')

The deposit address starts with 0xdead. It is reusable, and no one holds its key.

4

Get testnet CTK

The faucet sends 1,000 CTK to your wallet, usually within a minute.

curl -s -X POST $SANDBOX/v0/sandbox/faucet \
-H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
-d "{\"address\":\"$WALLET\",\"network\":\"avalanche-fuji\"}"

Send it to your wallet, not the deposit address. Faucet CTK sent straight to a deposit address is not paid out. See Testnet Tokens.

5

Send CTK to the deposit address

Send 100 CTK. CTK has 18 decimals.

export FUJI_RPC=https://api.avax-test.network/ext/bc/C/rpc
cast send 0x7beb5d9db0d85cbea543c04f0de8c23c2176cd9d "transfer(address,uint256)" $DEPOSIT 100000000000000000000 \
--rpc-url $FUJI_RPC --private-key $PRIVATE_KEY
6

See the mint

The sandbox detects the deposit and sends 100 AUSD to your wallet, usually within a minute.

curl -s "$SANDBOX/v0/transactions?type=mint" -H "Authorization: Bearer $JWT" | jq '.data[0]'

The transaction is settled, with one leg for your deposit and one for the payout.

Next steps