Log in

How to use the API CLI

Use the API CLI to simplify and streamline common requests, accessible from the command line.

The CLI offers a convenient way to access all of the features of the API directly from the command line. This guide walks through setting up the CLI and demonstrates how you can use it to manage your account and mint and redeem stablecoins.

Install the CLI and configure your API credentials

npm install -g @brale/cli

Next, configure the CLI with your client ID and client secret. If you haven't created API credentials yet, log in to your account and create an API application on the Settings page.

brale configure --client-id $CLIENT_ID --client-secret $CLIENT_SECRET

View Tokens and Addresses

You can view all stablecoins you can mint and redeem with the following command:

brale tokens

You'll see Stable Coin (SBC) and Glo Dollar (USDGLO) in addition to any additional stablecoins you've already deployed.

┌─────────┬───────────────────────────────┬──────────────────────────────┬─────────────────────────────────┬──────────┐
│ (index) │ id                            │ created                      │ name                            │ ticker   │
├─────────┼───────────────────────────────┼──────────────────────────────┼─────────────────────────────────┼──────────┤
│ 0       │ '2CoiPeFVmUCiLcsEVo7YfH9CccI' │ '"2022-08-02T21:21:55.000Z"' │ 'Stable Coin'                   │ 'SBC'    │
│ 1       │ '2RQzPSJkhMIXk3SIUGGNatXsnxd' │ '"2023-06-19T23:44:23.661Z"' │ 'Glo Dollar'                    │ 'USDGLO' │
└─────────┴───────────────────────────────┴──────────────────────────────┴─────────────────────────────────┴──────────┘

To view all the chain-specific deployments for a given stablecoin, use the following command with the stablecoin's ticker:

brale tokens deployments SBC

We'll see all the testnet blockchains where SBC is deployed.

┌─────────┬───────────────────────────────┬────────────────────────────────────────────────────────────────┬───────────────────┬──────────────────────────────┐
│ (index) │ id                            │ address                                                        │ chain             │ created                      │
├─────────┼───────────────────────────────┼────────────────────────────────────────────────────────────────┼───────────────────┼──────────────────────────────┤
│ 0       │ '2L6IPorwQ7MlydwdBvt7S058bNq' │ '0x4b7EaEa49c58b9e7D41502C817A6055fFF90944E'                   │ 'fuji'            │ '"2023-01-31T17:11:23.491Z"' │
│ 1       │ '2g6VKHO1hhR0HfGxJGrzocx8e4t' │ '0xfdcC3dd6671eaB0709A4C0f3F53De9a333d80798'                   │ 'amoy'            │ '"2024-05-06T12:52:36.640Z"' │
│ 2       │ '2U4oHQjKuz0hujyIS42JOPWwv3B' │ 'SBC-GCQCNWT22JDLENQAVIE6DRJGHWAQ6EX2H5ABGPV55EJUPPZM5UA7KHZR' │ 'stellar_testnet' │ '"2023-08-16T17:48:45.019Z"' │
│ 3       │ '2SNrnFJhsQVE1WXR9qbRe5J0dGL' │ '0x2456490b46C2428cec4989842416d202461a6CFC'                   │ 'alfajores'       │ '"2023-07-10T14:07:24.341Z"' │
│ 4       │ '2Wa13w3UpCu4134i7VT9XeRVVrj' │ '8vnThy8iZjjzxXg1dRagzqp6QZHVqfHT9swUBp5cYsuE'                 │ 'solana_devnet'   │ '"2023-10-10T16:34:40.009Z"' │
└─────────┴───────────────────────────────┴────────────────────────────────────────────────────────────────┴───────────────────┴──────────────────────────────┘

You can also view all the wallet addresses associated with your account. You'll see three custodial wallets by default, corresponding to EVM chains, Solana, and Stellar, along with any external wallets you've created.

brale addresses

Mint SBC on Stellar Testnet

We can leverage the CLI to simplify the process of minting and redeeming stablecoins. Here's the command to mint 10 SBC on Stellar Testnet to the Stellar custodial wallet already setup in our account.

brale mint SBC -a 10 -c stellar_testnet  -d 2aPmo522PmgHvELrMTDOIn3z4Be

We'll see the mint order returned in a pending state. The mint will then be completed within 30 seconds.

┌─────────┬───────────────────────────────┬──────────────────────────────┬───────────┬────────┬──────────────────────────────┐
│ (index) │ id                            │ created                      │ status    │ type   │ updated                      │
├─────────┼───────────────────────────────┼──────────────────────────────┼───────────┼────────┼──────────────────────────────┤
│ 0       │ '2bKcWJeHw6Z1fVhZx1HyD7DN1sv' │ '"2024-01-22T23:47:20.738Z"' │ 'pending' │ 'mint' │ '"2024-01-22T23:47:20.738Z"' │
└─────────┴───────────────────────────────┴──────────────────────────────┴───────────┴────────┴──────────────────────────────

We can monitor the status of the mint through the Orderscommand:

brale orders get 2bKcWJeHw6Z1fVhZx1HyD7DN1sv

This confirms the mint has been completed.

┌─────────┬───────────────────────────────┬──────────────────────────────┬────────────┬────────┬──────────────────────────────┐
│ (index) │ id                            │ created                      │ status     │ type   │ updated                      │
├─────────┼───────────────────────────────┼──────────────────────────────┼────────────┼────────┼──────────────────────────────┤
│ 0       │ '2bKcWJeHw6Z1fVhZx1HyD7DN1sv' │ '"2024-01-22T23:47:20.738Z"' │ 'complete' │ 'mint' │ '"2024-01-22T23:47:20.738Z"' │
└─────────┴───────────────────────────────┴──────────────────────────────┴────────────┴────────┴──────────────────────────────┘

Continue to explore the CLI

Follow the CLI Docs to see the full list of supported commands.

When you're ready, you can create mainnet API credentials and use the CLI to fund mints on any supported blockchain with USD or USDC.