API Endpoints

The backend server makes available the necessary endpoints for communication with any client application. Additionally, it exposes a webhook endpoint where Fireblocks can send asynchronous operation messages.

Authentication

Routes:

POST /api/login - is exposed for users login

Controller:

User controller is defined in:/src/controllers/user.controller.ts/UserController


Device

Routes:

  • GET /api/devices - used for returning all the devices registered in the DB
  • POST /api/devices/:deviceId/assign - used for assigning a newly generated deviceId to a walletId and userId
  • GET /api/devices/:deviceId - get a specific deviceId information

The following endpoint is used for sending NCW SDK generated messages to the backend that will forward these to Fireblocks API

  • GET /api/devices/:deviceId/rpc

Controller:

The device controller is defined in: /src/controllers/device.controller.ts/DeviceController


Messages

  • GET /api/devices/:deviceId/messages- get messages for a specific deviceId
  • DELETE /api/devices/messages/:messageId - delete a consumed message by it's unique ID

Controller:

Messages controller is defined in: /src/controllers/message.controller.ts/MessageController


Accounts

Routes:

  • GET /api/devices/:deviceId/accounts - get all the accounts for a specific deviceId

Controller:

Account controller is defined in: /src/controllers/account.controller.ts/AccountController


Assets

Routes:

  • GET /api/devices/:deviceId/accounts/:accountId/assets - Get all the existing assets for a specific account
  • GET /api/devices/:deviceId/accounts/:accountId/assets/:assetId - Get a specific asset in a specific account
  • GET /api/devices/:deviceId/accounts/:accountId/assets/:assetId/balance - Get asset balance in a specific account
  • GET /api/devices/:deviceId/accounts/:accountId/assets/:assetId/address - Get the address of a specific asset in a specific account
  • POST /api/devices/:deviceId/accounts/:accountId/assets/:assetId - Create a new asset in a specific account

Controller:

Asset controller is defined in: /src/controllers/asset.controller.ts/AssetController


Transactions

Routes:

  • GET /api/devices/:deviceId/transactions - get all transactions for a specific deviceId
  • POST /api/devices/:deviceId/transactions - create new transaction. Currently the transaction data is hard coded in the transaction controller, but can be easily modified according to your needs
  • GET /api/devices/:deviceId/transactions/:transactionId - get a specific transaction by it's unique ID
  • POST /api/devices/:deviceId/transactions/:txId/cancel - cancel a specific transaction by it's unique ID

Controller:

Transaction controller is defined in: /src/controllers/transaction.controller.ts/TransactionController