Overview

The general workflow for crypto trades will look like the following:

  1. Pull the market price for the crypto your end user is looking to swap from our API.
  2. Give the end user the ability to confirm a trade after looking at the market price.
  3. Call the Fortress API to initiate a Swap
  4. Monitor the webhooks sent for a change in the status of a trade.
  5. Once completed, update your front end with the new balance for the end user.

❗️

Testnet Tokens

When testing trades in sandbox, please keep amounts low (greater than $15 but less than $30) as testnet tokens are in limited supply. Once finished testing, please "sell" the tokens so we can maintain a steady supply for all integrators in sandbox. - can be deleted as trat as real tokens FLRNS and POL

Lets review each step a bit more.

1. Pull the market price

GET  /api/trust/v1/crypto-currency/crypto-swap-price/{CryptoAssetFrom}/{CryptoAssetTo}
{
"price": {
   "buy": 1903.76613566,
   "sell": 1866.53214000
    }
}

Note: The API can return zero values for buy or sell market prices. Zero dollar value trades ($0.00) will not be executed.

2. Allow the end user to confirm that they want the trade after presenting them the market price.

3. Initiate a swap with the tradeendpoint using the API

POST /api/trust/v1/trades

//Sample Request
{
  "accountId": "A3CA08AB-3058-4C3C-81E7-51DA24B171F",
  "type": "swap",
  "from": {
    "asset": "usdc",
    "network": "solanaMainnent"
    "amount": 1000
  },
  "to": {
    "asset": "usdc",
    "network": "mainnet"
  },
  "comment": "Insert comment"
}

👍

All in one

The trades endpoint facilitates buys, sells, and swaps by designating the from and to fields.

4. Monitor webhooks

An integrator will receive one webhook when the buy/sell crypto transaction is moved to the Processing status and another webhook when the settlement process is completed.

5. Once a trade is completed, update your front end with the new balance

GET /custodial-accounts/{custodialAccountId}/balances

//Sample Response

{ 
"data": [ 
   {
   "assetType": "cryptoCurrency",
   "assetFiatType": "eth",
   "network": "mainnet",
   "disbursable": .001,
   "locked": 0,
   "pending": 0,
   "total": .001 
   } 
 ]
}

📘

Crypto Trading Settlement Times

Trades are executed almost immediately, but settlement for those trades take up to one business day. Contact