IntroductionAuthenticationErrorsIdempotencyPaginationVersioningRate LimitingWebhooks
General
ChainsNetworks
Wallet
VaultsWalletsAccountsTransactionsMessages
On-Chain
AddressesContractsBlocksTxs
Off-Chain
CryptocurrenciesCollectionsExchangesMarketplacesMarketsListings

Introduction

Welcome to the Triangle API documentation.

Base URL
https://api.triangleplatform.com
Node.js Library
npm install triangle

Authentication

The Triangle API uses API keys to authenticate requests. You can view and manage your API keys in the Triangle Dashboard.

Authentication to the API can be performed via HTTP Basic or Bearer authentication scheme. For Basic auth, provide your API key as the basic auth username value (you do not need to provide a password). For Bearer auth, provide your API key as the bearer token in the Authorization header.

Authentication
import Triangle from "triangle";

const triangle = new Triangle("secret_abc123");

Errors

This is an object representing an error.

Object
interface Error {
  object: string;
  message: string;
}
Example
{
  "object": "error",
  "message": "Something went wrong."
}

Idempotency

The API supports idempotency so that requests can be safely retried without accidentally performing the same operation twice.

To perform an idemponent request, provide the Idempotency-Key header with a unique string (such as v4 UUIDs). If the request is valid, the request and response will be saved under the given idempotency key. Subsequent request with the same key will return the same response. Keys are scheduled to be removed automatically after they're at least 24 hours old.

All POST requests accept idempotency keys. Sending idempotency keys in all other HTTP methods are ignored.

Versioning

Triangle maintains backwards-compatibility in our API. When backwards-incompatible changes are made to the API, we will document our changelog here.

Rate Limiting

Sending too many requests might result in receiving error responses with status code 429.

Webhooks

You can create a webhook on the Triangle Dashboard and we'll push the event data to your endpoint.

Construct
const event = triangle.utils.webhooks.construct(
  req.body,
  req.headers["triangle-signature"],
  "whsec_abc123"
);
Verify
const isVerified = triangle.utils.webhooks.verify(
  req.body,
  req.headers["triangle-signature"],
  "whsec_abc123"
);
Example
import { buffer } from "micro";
import Triangle from "triangle";

const triangle = new Triangle("secret_abc123");

export default async (req, res) => {
  const body = await buffer(req);
  const event = triangle.utils.webhooks.construct(body, req.headers["triangle-signature"], "whsec_abc123");

  switch (event.type) {
    case "account.tx.to":
      // Do something
      break;
    case "transaction.tx.hash":
      // Do something
      break;
    case "wallet.tx.from":
      // Do something
      break;
    default:
      console.log("Unhandled event type:", event.type);
  }

  return res.status(200).json({ message: "Success." });
};

Chains

This is an object representing a chain.

Chains
  • Algorandalgorand
    The Algorand blockchain.
  • Aptosaptos
    The Aptos blockchain.
  • Arbitrumarbitrum
    The Arbitrum blockchain.
  • Astarastar
    The Astar blockchain.
  • Auroraaurora
    The Aurora blockchain.
  • Avalanche C-Chainavalanche
    The Avalanche C-Chain blockchain.
  • Basebase
    The Base blockchain.
  • Bitcoinbitcoin
    The Bitcoin blockchain.
  • BNB Smart Chainbnbsmartchain
    The BNB Smart Chain blockchain.
  • Bobaboba
    The Boba blockchain.
  • Cantocanto
    The Canto blockchain.
  • Cardanocardano
    The Cardano blockchain.
  • Celocelo
    The Celo blockchain.
  • Cronoscronos
    The Cronos blockchain.
  • Dogecoindogecoin
    The Dogecoin blockchain.
  • Ethereumethereum
    The Ethereum blockchain.
  • Evmosevmos
    The Evmos blockchain.
  • Fantomfantom
    The Fantom blockchain.
  • Filecoinfilecoin
    The Filecoin blockchain.
  • Flowflow
    The Flow blockchain.
  • Frameframe
    The Frame blockchain.
  • Fuelfuel
    The Fuel blockchain.
  • Gnosis Chaingnosis
    The Gnosis Chain blockchain.
  • Harmonyharmony
    The Harmony blockchain.
  • Klaytnklaytn
    The Klaytn blockchain.
  • Kusamakusama
    The Kusama blockchain.
  • Moonbeammoonbeam
    The Moonbeam blockchain.
  • Moonrivermoonriver
    The Moonriver blockchain.
  • NEARnear
    The NEAR blockchain.
  • Optimismoptimism
    The Optimism blockchain.
  • Polkadotpolkadot
    The Polkadot blockchain.
  • Polygonpolygon
    The Polygon blockchain.
  • Polygon zkEVMpolygonzkevm
    The Polygon zkEVM blockchain.
  • Scrollscroll
    The Scroll blockchain.
  • Seisei
    The Sei blockchain.
  • Skaleskale
    The Skale blockchain.
  • Solanasolana
    The Solana blockchain.
  • Stacksstacks
    The Stacks blockchain.
  • Stellarstellar
    The Stellar blockchain.
  • Suisui
    The Sui blockchain.
  • Terraterra
    The Terra blockchain.
  • XRPxrp
    The XRP blockchain.
  • ZetaChainzetachain
    The ZetaChain blockchain.
  • zkSynczksync
    The zkSync blockchain.

The chain object

Attributes
  • idstring
    The unique identifier for the object.
  • namestring
    The name of the chain.
  • symbolstring
    The symbol of the native token.
Object
interface Chain {
  id: string;
  object: string;
  name: string;
  symbol: string;
}
Example
{
  "id": "ethereum",
  "object": "chain",
  "name": "Ethereum",
  "symbol": "ETH"
}

Retrieve a chain

Retrieves the chain with the given ID.

GET /v1/chains/:id
const chain = await triangle.chains.retrieve(
  "ethereum"
);
Response
{
  "id": "ethereum",
  "object": "chain",
  "name": "Ethereum",
  "symbol": "ETH"
}

List all chains

Returns a list of all the chains supported on Triangle.

GET /v1/chains
const chains = await triangle.chains.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "ethereum",
      "object": "chain",
      "name": "Ethereum",
      "symbol": "ETH"
    }
  ]
}

Networks

This is an object representing a network on a chain.

Networks
  • Algorand Betanetalgorand_betanet
    The Betanet network on the Algorand blockchain.
  • Algorand Mainnetalgorand_mainnet
    The Mainnet network on the Algorand blockchain.
  • Algorand Testnetalgorand_testnet
    The Testnet network on the Algorand blockchain.
  • Aptos Devnetaptos_devnet
    The Devnet network on the Aptos blockchain.
  • Aptos Mainnetaptos_mainnet
    The Mainnet network on the Aptos blockchain.
  • Aptos Testnetaptos_testnet
    The Testnet network on the Aptos blockchain.
  • Arbitrum Goerliarbitrum_goerli
    The Goerli network on the Arbitrum blockchain.
  • Arbitrum Mainnetarbitrum_mainnet
    The Mainnet network on the Arbitrum blockchain.
  • Arbitrum Rinkebyarbitrum_rinkeby
    The Rinkeby network on the Arbitrum blockchain. This network has been deprecated on October 5, 2022.
  • Astar Mainnetastar_mainnet
    The Mainnet network on the Astar blockchain.
  • Astar Shibuyaastar_shibuya
    The Shibuya network on the Astar blockchain.
  • Aurora Mainnetaurora_mainnet
    The Mainnet network on the Aurora blockchain.
  • Aurora Testnetaurora_testnet
    The Testnet network on the Aurora blockchain.
  • Avalanche C-Chain Fujiavalanche_fuji
    The Fuji network on the Avalanche C-Chain blockchain.
  • Avalanche C-Chain Mainnetavalanche_mainnet
    The Mainnet network on the Avalanche C-Chain blockchain.
  • Base Goerlibase_goerli
    The Goerli network on the Base blockchain.
  • Base Mainnetbase_mainnet
    The Mainnet network on the Base blockchain.
  • Bitcoin Mainnetbitcoin_mainnet
    The Mainnet network on the Bitcoin blockchain.
  • Bitcoin Testnetbitcoin_testnet
    The Testnet network on the Bitcoin blockchain.
  • BNB Smart Chain Mainnetbnbsmartchain_mainnet
    The Mainnet network on the BNB Smart Chain blockchain.
  • BNB Smart Chain Testnetbnbsmartchain_testnet
    The Testnet network on the BNB Smart Chain blockchain.
  • Boba Mainnetboba_mainnet
    The Mainnet network on the Boba blockchain.
  • Boba Testnetboba_testnet
    The Testnet network on the Boba blockchain.
  • Canto Mainnetcanto_mainnet
    The Mainnet network on the Canto blockchain.
  • Canto Testnetcanto_testnet
    The Testnet network on the Canto blockchain.
  • Cardano Mainnetcardano_mainnet
    The Mainnet network on the Cardano blockchain.
  • Cardano Pre-Prodcardano_preprod
    The Pre-Prod network on the Cardano blockchain.
  • Cardano Previewcardano_preview
    The Preview network on the Cardano blockchain.
  • Celo Alfajorescelo_alfajores
    The Alfajores network on the Celo blockchain.
  • Celo Baklavacelo_baklava
    The Baklava network on the Celo blockchain.
  • Celo Mainnetcelo_mainnet
    The Mainnet network on the Celo blockchain.
  • Cronos Mainnetcronos_mainnet
    The Mainnet network on the Cronos blockchain.
  • Cronos Testnetcronos_testnet
    The Testnet network on the Cronos blockchain.
  • Dogecoin Mainnetdogecoin_mainnet
    The Mainnet network on the Dogecoin blockchain.
  • Dogecoin Testnetdogecoin_testnet
    The Testnet network on the Dogecoin blockchain.
  • Ethereum Goerliethereum_goerli
    The Goerli network on the Ethereum blockchain.
  • Ethereum Holeskyethereum_holesky
    The Holesky network on the Ethereum blockchain.
  • Ethereum Kovanethereum_kovan
    The Kovan network on the Ethereum blockchain. This network has been deprecated on October 5, 2022.
  • Ethereum Mainnetethereum_mainnet
    The Mainnet network on the Ethereum blockchain.
  • Ethereum Rinkebyethereum_rinkeby
    The Rinkeby network on the Ethereum blockchain. This network has been deprecated on October 5, 2022.
  • Ethereum Ropstenethereum_ropsten
    The Ropsten network on the Ethereum blockchain. This network has been deprecated on October 5, 2022.
  • Ethereum Sepoliaethereum_sepolia
    The Sepolia network on the Ethereum blockchain.
  • Evmos Mainnetevmos_mainnet
    The Mainnet network on the Evmos blockchain.
  • Evmos Testnetevmos_testnet
    The Testnet network on the Evmos blockchain.
  • Fantom Mainnetfantom_mainnet
    The Mainnet network on the Fantom blockchain.
  • Fantom Testnetfantom_testnet
    The Testnet network on the Fantom blockchain.
  • Filecoin Calibrationfilecoin_calibration
    The Calibration network on the Filecoin blockchain.
  • Filecoin Hyperspacefilecoin_hyperspace
    The Hyperspace network on the Filecoin blockchain.
  • Filecoin Mainnetfilecoin_mainnet
    The Mainnet network on the Filecoin blockchain.
  • Filecoin Wallabyfilecoin_wallaby
    The Wallaby network on the Filecoin blockchain.
  • Flow Mainnetflow_mainnet
    The Mainnet network on the Flow blockchain.
  • Flow Testnetflow_testnet
    The Testnet network on the Flow blockchain.
  • Frame Testnetframe_testnet
    The Testnet network on the Frame blockchain.
  • Fuel Beta-1fuel_beta1
    The Beta-1 network on the Fuel blockchain.
  • Fuel Beta-2fuel_beta2
    The Beta-2 network on the Fuel blockchain.
  • Fuel Beta-3fuel_beta3
    The Beta-3 network on the Fuel blockchain.
  • Fuel Beta-4fuel_beta4
    The Beta-4 network on the Fuel blockchain.
  • Gnosis Chain Chiadoharmony_chiado
    The Chiado network on the Gnosis Chain blockchain.
  • Gnosis Chain Mainnetharmony_mainnet
    The Mainnet network on the Gnosis Chain blockchain.
  • Harmony Mainnetharmony_mainnet
    The Mainnet network on the Harmony blockchain.
  • Harmony Testnetharmony_testnet
    The Testnet network on the Harmony blockchain.
  • Klaytn Baobabklaytn_baobab
    The Baobab network on the Klaytn blockchain.
  • Klaytn Mainnetklaytn_mainnet
    The Mainnet network on the Klaytn blockchain.
  • Kusama Mainnetkusama_mainnet
    The Mainnet network on the Kusama blockchain.
  • Moonbeam Mainnetmoonbeam_mainnet
    The Mainnet network on the Moonbeam blockchain.
  • Moonbeam Testnetmoonbeam_testnet
    The Testnet network on the Moonbeam blockchain.
  • Moonriver Mainnetmoonriver_mainnet
    The Mainnet network on the Moonriver blockchain.
  • Optimism Goerlioptimism_goerli
    The Goerli network on the Optimism blockchain.
  • Optimism Kovanoptimism_kovan
    The Kovan network on the Optimism blockchain. This network has been deprecated on October 5, 2022.
  • Optimism Mainnetoptimism_mainnet
    The Mainnet network on the Optimism blockchain.
  • Polkadot Mainnetpolkadot_mainnet
    The Mainnet network on the Polkadot blockchain.
  • Polkadot Rococopolkadot_rococo
    The Rococo network on the Polkadot blockchain.
  • Polkadot Westendpolkadot_westend
    The Westend network on the Polkadot blockchain.
  • Polygon Amoypolygon_amoy
    The Amoy network on the Polygon blockchain.
  • Polygon Mainnetpolygon_mainnet
    The Mainnet network on the Polygon blockchain.
  • Polygon Mumbaipolygon_mumbai
    The Mumbai network on the Polygon blockchain.
  • Polygon zkEVM Mainnetpolygonzkevm_mainnet
    The Mainnet network on the Polygon zkEVM blockchain.
  • Polygon zkEVM Testnetpolygonzkevm_testnet
    The Testnet network on the Polygon zkEVM blockchain.
  • Scroll Alphascroll_alpha
    The Alpha network on the Scroll blockchain.
  • Scroll Sepoliascroll_sepolia
    The Sepolia network on the Scroll blockchain.
  • Sei Testnetsei_testnet
    The Testnet network on the Sei blockchain.
  • Solana Devnetsolana_devnet
    The Devnet network on the Solana blockchain.
  • Solana Mainnet Betasolana_mainnet_beta
    The Mainnet Beta network on the Solana blockchain.
  • Solana Testnetsolana_testnet
    The Testnet network on the Solana blockchain.
  • Stacks Mainnetstacks_mainnet
    The Mainnet network on the Stacks blockchain.
  • Stacks Testnetstacks_testnet
    The Testnet network on the Stacks blockchain.
  • Stellar Mainnetstellar_mainnet
    The Mainnet network on the Stellar blockchain.
  • Stellar Testnetstellar_testnet
    The Testnet network on the Stellar blockchain.
  • Sui Devnetsui_devnet
    The Devnet network on the Sui blockchain.
  • Sui Testnetsui_testnet
    The Testnet network on the Sui blockchain.
  • Terra Classicterra_classic
    The Classic network on the Terra blockchain.
  • Terra Mainnetterra_mainnet
    The Mainnet network on the Terra blockchain.
  • Terra Testnetterra_testnet
    The Testnet network on the Terra blockchain.
  • XRP Mainnetxrp_mainnet
    The Mainnet network on the XRP blockchain.
  • XRP Testnetxrp_testnet
    The Testnet network on the XRP blockchain.
  • ZetaChain Athens-2zetachain_athens2
    The Athens-2 network on the ZetaChain blockchain.
  • ZetaChain Athens-3zetachain_athens3
    The Athens-3 network on the ZetaChain blockchain.
  • zkSync Mainnetzksync_mainnet
    The Mainnet network on the zkSync blockchain.
  • zkSync Testnetzksync_testnet
    The Testnet network on the zkSync blockchain.

The network object

Attributes
  • idstring
    The unique identifier for the object.
  • chainChain
    The chain this network is on.
  • mainnetboolean
    Whether the network is the mainnet.
  • namestring
    The name of the network.
Object
interface Network {
  id: string;
  object: string;
  chain: Chain;
  mainnet: boolean;
  name: string;
}
Example
{
  "id": "ethereum_goerli",
  "object": "network",
  "chain": {
    "id": "ethereum"
  },
  "mainnet": false,
  "name": "Ethereum Goerli"
}

Retrieve a network

Retrieves the network with the given ID.

GET /v1/networks/:id
const network = await triangle.networks.retrieve(
  "ethereum_goerli"
);
Response
{
  "id": "ethereum_goerli",
  "object": "network",
  "chain": {
    "id": "ethereum"
  },
  "mainnet": false,
  "name": "Ethereum Goerli"
}

List all networks

Returns a list of all the networks supported on Triangle.

GET /v1/networks
const networks = await triangle.networks.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "ethereum_goerli",
      "object": "network",
      "chain": {
        "id": "ethereum"
      },
      "mainnet": false,
      "name": "Ethereum Goerli"
    }
  ]
}

Vaults

This is an object representing a vault.

A vault is used to generate keys to create a group of wallets. You can think of this just like how Ledger or any other consumer wallet generates a single key that is used to create many wallets.

The vault object

Attributes
  • idstring
    The unique identifier for the object.
  • namestring
    The name of the vault.
Object
interface Vault {
  id: string;
  object: string;
  name: string;
}
Example
{
  "id": "vlt_abc123",
  "object": "vault",
  "name": "My Vault"
}

Create a vault

Creates a new vault.

Body
  • namestring
    The name of the vault.
Returns
  • Returns the vault object.
POST /v1/vaults
const vault = await triangle.vaults.create({
  name: "My Vault",
});
Response
{
  "id": "vlt_abc123",
  "object": "vault",
  "name": "My Vault"
}

Retrieve a vault

Retrieves the vault with the given ID.

GET /v1/vaults/:id
const vault = await triangle.vaults.retrieve(
  "vlt_abc123"
);
Response
{
  "id": "vlt_abc123",
  "object": "vault",
  "name": "My Vault"
}

List all vaults

Returns a list of your vaults.

GET /v1/vaults
const vaults = await triangle.vaults.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "vlt_abc123",
      "object": "vault",
      "name": "My Vault"
    }
  ]
}

Export a vault

Exports the vault with the given ID.

POST /v1/vaults/:id/export
const data = await triangle.vaults.export(
  "vlt_abc123"
);
Response
{
  "mnemonic": "..."
}

Wallets

This is an object representing a wallet in a vault.

A wallet is an just like an externally-owned account (EOA). You can use it just like any other wallet to sign and send any transaction to the network.

The wallet object

Attributes
  • idstring
    The unique identifier for the object.
  • addressstring
    The address of the wallet.
  • namestring
    The name of the wallet.
  • networkNetwork
    The network the wallet is on.
  • vaultVault
    The vault this wallet is in.
Object
interface Wallet {
  id: string;
  object: string;
  address: string;
  name: string;
  network: Network;
  vault: Vault;
}
Example
{
  "id": "wlt_abc123",
  "object": "wallet",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Wallet",
  "network": {
    "id": "ethereum_goerli"
  },
  "vault": {
    "id": "vlt_abc123"
  }
}

Create a wallet

Creates a new wallet in the given vault.

Body
  • namestring
    The name of the wallet.
  • networkstring
    The ID of the network to create this wallet is on.
  • vaultstring
    The ID of the vault to create this wallet is in.
Returns
  • Returns the wallet object.
POST /v1/wallets
const wallet = await triangle.wallets.create({
  name: "My Wallet",
  network: "ethereum_goerli",
  vault: "vlt_abc123",
});
Response
{
  "id": "wlt_abc123",
  "object": "wallet",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Wallet",
  "network": {
    "id": "ethereum_goerli"
  },
  "vault": {
    "id": "vlt_abc123"
  }
}

Retrieve a wallet

Retrieves the wallet with the given ID.

GET /v1/wallets/:id
const wallet = await triangle.wallets.retrieve(
  "wlt_abc123"
);
Response
{
  "id": "wlt_abc123",
  "object": "wallet",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Wallet",
  "network": {
    "id": "ethereum_goerli"
  },
  "vault": {
    "id": "vlt_abc123"
  }
}

List all wallets

Returns a list of your wallets.

Parameters
  • vaultstring, optional
    Only return wallets for the vault specified by this vault ID.
GET /v1/wallets
const wallets = await triangle.wallets.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "wlt_abc123",
      "object": "wallet",
      "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
      "name": "My Wallet",
      "network": {
        "id": "ethereum_goerli"
      },
      "vault": {
        "id": "vlt_abc123"
      }
    }
  ]
}

Retrieve a wallet's balance

Retrieves the balance of the native currency in the wallet.

GET /v1/wallets/:id/balance
const balance = await triangle.wallets.balance(
  "wlt_abc123"
);
Response
{
  "balance": "1.23",
  "logo_url": "https://...",
  "name": "Ethereum",
  "symbol": "ETH"
}

List a wallet's NFTs

Returns a list of the NFTs in the wallet.

GET /v1/wallets/:id/nfts
const nfts = await triangle.wallets.nfts(
  "wlt_abc123"
);
Response
{
  "object": "list",
  "items": [
    {
      "contract": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
      "image_url": "https://...",
      "name": "Bored Ape Yacht Club #123",
      "symbol": "BAYC",
      "token_id": "123",
      "type": "erc721"
    }
  ]
}

List a wallet's tokens

Returns a list of the tokens in the wallet.

GET /v1/wallets/:id/tokens
const tokens = await triangle.wallets.tokens(
  "wlt_abc123"
);
Response
{
  "object": "list",
  "items": [
    {
      "contract": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
      "balance": "1.23",
      "logo_url": "https://...",
      "name": "Dai",
      "symbol": "DAI"
    }
  ]
}

Send native currency

Sends the native currency.

Body
  • amountstring
    The amount of the native currency.
  • tostring
    The address to send the native currency to.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/send
const transaction = await triangle.wallets.send(
  "wlt_abc123",
  {
    amount: "0.123",
    to: "0x...",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Send an NFT

Sends an NFT.

Body
  • amountstring, optional, default "1"
    The amount of the NFT. This is only applicable to ERC-1155 NFTs as described in the EIP-1155 specification.
  • contractstring
    The contract address of the NFT.
  • tostring
    The address to send the NFT to.
  • token_idstring
    The token ID of the NFT.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/send_nft
const transaction = await triangle.wallets.sendNft(
  "wlt_abc123",
  {
    contract: "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
    to: "0x...",
    token_id: "123",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Send a token

Sends a token.

Body
  • amountstring
    The amount of the token.
  • contractstring
    The contract address of the token.
  • tostring
    The address to send the token to.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/send_token
const transaction = await triangle.wallets.sendToken(
  "wlt_abc123",
  {
    amount: "0.123",
    contract: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    to: "0x...",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Check token approval

Check token approval.

Body
  • contract_addressstring
    The contract address or symbol of the token.
  • tostring
    The address to check token approval for.
Returns
  • Returns boolean.
POST /v1/wallets/:id/is_token_approved
const transaction = await triangle.wallets.is_token_approved(
  "wlt_abc123",
  {
    contract_address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    to: "0x...",
  }
);
Response
true

Approve a token

Approves a token.

Body
  • contract_addressstring
    The contract address or symbol of the token.
  • tostring
    The address to give token approval to.
  • amountstring
    The amount of the token.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/approve_token
const transaction = await triangle.wallets.approve_token(
  "wlt_abc123",
  {
    contract_address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    to: "0x...",
    amount: "1",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Approves all a token

Approves all a token.

Body
  • contract_addressstring
    The contract address or symbol of the token.
  • tostring
    The address to give token approval to.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/approve_token_all
const transaction = await triangle.wallets.approve_token_all(
  "wlt_abc123",
  {
    contract_address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    to: "0x...",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Swap a token

Swaps a token.

Body
  • from_tokenstring
    The contract address or symbol of the token to swap from.
  • to_tokenstring
    The contract address or symbol of the token to swap to.
  • amountstring
    The amount of the token.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/swap
const transaction = await triangle.wallets.swap(
  "wlt_abc123",
  {
    from_token: "ETH",
    to_token: "USDC",
    amount: "1",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Bridge a token

Bridges a token.

Body
  • contract_addressstring
    The contract address or symbol of the token.
  • from_tokenstring
    The contract address or symbol of the token to bridge from.
  • to_tokenstring
    The contract address or symbol of the token to bridge to.
  • to_networkstring
    The target network to bridge to.
  • amountstring
    The amount of the token.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/bridge
const transaction = await triangle.wallets.bridge(
  "wlt_abc123",
  {
    contract_address: "0x6B175474E89094C44Da98b954EedeAC495271d0F",
    from_token: "ETH",
    to_token: "USDC",
    to_network: "polygon_mainnet",
    amount="1",
  }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Send a transaction

Signs a transaction using the wallet and broadcasts it to the blockchain.

Body
  • serializedstring
    The serialized transaction to send using this wallet.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/send_transaction
const transaction = await triangle.wallets.sendTransaction(
  "wlt_abc123",
  { serialized: "..." }
);
Response
{
  "id": "vlt_abc123",
  "object": "vault",
  "name": "My Vault"
}

Sign a transaction

Signs a transaction using the wallet.

Body
  • serializedstring
    The serialized transaction to sign using this wallet.
Returns
  • Returns an object containing the raw transaction.
POST /v1/wallets/:id/sign_transaction
const transaction = await triangle.wallets.signTransaction(
  "wlt_abc123",
  { serialized: "..." }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "raw": "...",
  "serialized": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Send a raw transaction

Broadcasts a signed transaction to the blockchain.

Body
  • transactionstring
    The ID of the signed transaction to send.
Returns
  • Returns an object containing the transaction hash.
POST /v1/wallets/:id/send_raw_transaction
const transaction = await triangle.wallets.sendRawTransaction(
  "wlt_abc123",
  { transaction: "txn_abc123" }
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "raw": "...",
  "serialized": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Sign a message

Signs a message using the wallet.

Signing messages can be used for various methods of authentication and off-chain operations (can be put on-chain if necessary). It allows you to verify that a piece of data was signed by a specific wallet and is used as a way to prove that a wallet approved a message. Signing a message does not require interacting with the blockchain network.

Body
  • messagestring
    The message to sign using this wallet.
Returns
  • Returns an object containing the signature.
POST /v1/wallets/:id/sign_message
const message = await triangle.wallets.signMessage(
  "wlt_abc123",
  { message: "hello world" }
);
Response
{
  "id": "msg_abc123",
  "object": "message",
  "message": "hello world",
  "signature": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Sign typed data

Signs typed data using the wallet.

This follows the EIP-712 specification and is only supported on EVM-compatible chains.

Body
  • encodedstring
    The encoded typed data to sign.
Returns
  • Returns an object containing the signature.
POST /v1/wallets/:id/sign_typed_data
const message = await triangle.wallets.signTypedData(
  "wlt_abc123",
  { encoded: "0x..." }
);
Response
{
  "id": "msg_abc123",
  "object": "message",
  "encoded": "0x...",
  "signature": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Export a wallet

Exports the wallet with the given ID.

POST /v1/wallets/:id/export
const data = await triangle.wallets.export(
  "wlt_abc123"
);
Response
{
  "format": "hex",
  "private_key": "..."
}

Accounts

This is an object representing an account.

An account is a way to reference a wallet that was created outside of Triangle. This gives you read-only controls to make it easy for you to request and receive data about any address on any blockchain.

The account object

Attributes
  • idstring
    The unique identifier for the object.
  • addressstring
    The address of the account.
  • namestring
    The name of the account.
  • networkNetwork
    The network the account is on.
Object
interface Account {
  id: string;
  object: string;
  address: string;
  name: string;
  network: Network;
}
Example
{
  "id": "acct_abc123",
  "object": "account",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Account",
  "network": {
    "id": "ethereum_goerli"
  }
}

Add an account

Adds a new account.

Body
  • addressstring
    The address of the account.
  • namestring
    The name of the account.
  • networkstring
    The ID of the network the account is on.
Returns
  • Returns the account object.
POST /v1/accounts
const account = await triangle.accounts.add({
  address: "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  name: "My Account",
  network: "ethereum_goerli",
});
Response
{
  "id": "acct_abc123",
  "object": "account",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Account",
  "network": {
    "id": "ethereum_goerli"
  }
}

Retrieve an account

Retrieves the account with the given ID.

GET /v1/accounts/:id
const account = await triangle.accounts.retrieve(
  "acct_abc123"
);
Response
{
  "id": "acct_abc123",
  "object": "account",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "name": "My Account",
  "network": {
    "id": "ethereum_goerli"
  }
}

List all accounts

Returns a list of your accounts.

GET /v1/accounts
const accounts = await triangle.accounts.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "acct_abc123",
      "object": "account",
      "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
      "name": "My Account",
      "network": {
        "id": "ethereum_goerli"
      }
    }
  ]
}

Retrieve an account's balance

Retrieves the balance of the native currency in the account.

GET /v1/accounts/:id/balance
const balance = await triangle.accounts.balance(
  "acct_abc123"
);
Response
{
  "balance": "1.23",
  "logo_url": "https://...",
  "name": "Ethereum",
  "symbol": "ETH"
}

List an account's NFTs

Returns a list of the NFTs in the account.

GET /v1/accounts/:id/nfts
const nfts = await triangle.accounts.nfts(
  "acct_abc123"
);
Response
{
  "object": "list",
  "items": [
    {
      "contract": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
      "image_url": "https://...",
      "name": "Bored Ape Yacht Club #123",
      "symbol": "BAYC",
      "token_id": "123",
      "type": "erc721"
    }
  ]
}

List an account's tokens

Returns a list of the tokens in the account.

GET /v1/accounts/:id/tokens
const tokens = await triangle.accounts.tokens(
  "acct_abc123"
);
Response
{
  "object": "list",
  "items": [
    {
      "contract": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
      "balance": "1.23",
      "logo_url": "https://...",
      "name": "Dai",
      "symbol": "DAI"
    }
  ]
}

List an account's txs

Returns a list of txs from and to the account.

GET /v1/accounts/:id/txs
const txs = await triangle.accounts.txs(
  "acct_abc123"
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "tx",
      "block": 123,
      "hash": "0x..."
    }
  ]
}

Transactions

This is an object representing a transaction from a wallet.

The transaction object

Attributes
  • idstring
    The unique identifier for the object.
  • hashstring
    The transaction hash.
  • serializedstring
    The serialized transaction.
  • walletWallet
    The wallet this transaction was from.
Object
interface Transaction {
  id: string;
  object: string;
  hash: string;
  serialized: string;
  wallet: Wallet;
}
Example
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "raw": "...",
  "serialized": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Retrieve a transaction

Retrieves the transaction with the given ID.

GET /v1/transactions/:id
const transaction = await triangle.transactions.retrieve(
  "txn_abc123"
);
Response
{
  "id": "txn_abc123",
  "object": "transaction",
  "hash": "...",
  "raw": "...",
  "serialized": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

List all transactions

Returns a list of your transactions.

Parameters
  • walletstring, optional
    Only return transactions for the wallet specified by this wallet ID.
GET /v1/transactions
const transactions = await triangle.transactions.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "txn_abc123",
      "object": "transaction",
      "hash": "...",
      "raw": "...",
      "serialized": "...",
      "wallet": {
        "id": "wlt_abc123"
      }
    }
  ]
}

Messages

This is an object representing a message from a wallet.

The message object

Attributes
  • idstring
    The unique identifier for the object.
  • messagestring
    The message.
  • signaturestring
    The signature of the message.
  • walletWallet
    The wallet this transaction was from.
Object
interface Message {
  id: string;
  object: string;
  message: string;
  signature: string;
  wallet: Wallet;
}
Example
{
  "id": "msg_abc123",
  "object": "message",
  "message": "hello world",
  "signature": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

Retrieve a message

Retrieves the message with the given ID.

GET /v1/messages/:id
const message = await triangle.messages.retrieve(
  "msg_abc123"
);
Response
{
  "id": "msg_abc123",
  "object": "message",
  "message": "hello world",
  "signature": "...",
  "wallet": {
    "id": "wlt_abc123"
  }
}

List all messages

Returns a list of your messages.

Parameters
  • walletstring, optional
    Only return messages for the wallet specified by this wallet ID.
GET /v1/messages
const messages = await triangle.messages.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "msg_abc123",
      "object": "message",
      "message": "hello world",
      "signature": "...",
      "wallet": {
        "id": "wlt_abc123"
      }
    }
  ]
}

Addresses

This is an object representing an address.

The address object

Attributes
  • addressstring
    The address.
  • networkNetwork
    The network the address is on.
Object
interface Address {
  object: string;
  address: string;
  network: Network;
}
Example
{
  "object": "address",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "network": {
    "id": "ethereum_goerli"
  }
}

Retrieve an address

Retrieves the address with the given address.

Parameters
  • networkstring
    The ID of the network the address is on.
GET /v1/addresses/:address
const address = await triangle.addresses.retrieve(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "address",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "network": {
    "id": "ethereum_goerli"
  }
}

Retrieve an address's balance

Retrieves the balance of the native currency in the address.

Parameters
  • networkstring
    The ID of the network the balance is on.
GET /v1/addresses/:address/balance
const balance = await triangle.addresses.balance(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "balance",
  "balance": "1.23",
  "logo_url": "https://...",
  "name": "Ethereum",
  "symbol": "ETH"
}

List an address's NFTs

Returns a list of the NFTs in the address.

Parameters
  • networkstring
    The ID of the network the NFTs are on.
GET /v1/addresses/:address/nfts
const nfts = await triangle.addresses.nfts(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "nft",
      "contract": "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D",
      "image_url": "https://...",
      "name": "Bored Ape Yacht Club #123",
      "symbol": "BAYC",
      "token_id": "123",
      "type": "erc721"
    }
  ]
}

List an address's tokens

Returns a list of the tokens in the address.

Parameters
  • networkstring
    The ID of the network the tokens are on.
GET /v1/addresses/:address/tokens
const tokens = await triangle.addresses.tokens(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "token",
      "contract": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
      "balance": "1.23",
      "logo_url": "https://...",
      "name": "Dai",
      "symbol": "DAI"
    }
  ]
}

List an address's txs

Returns a list of the txs from and to the address.

Parameters
  • networkstring
    The ID of the network the txs are on.
GET /v1/addresses/:address/txs
const txs = await triangle.addresses.txs(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "tx",
      "block": {
        "number": 123
      },
      "hash": "..."
    }
  ]
}

List an address's transfers

Returns a list of the transfers from and to the address.

Parameters
  • networkstring
    The ID of the network the transfers are on.
GET /v1/addresses/:address/transfers
const transfers = await triangle.addresses.transfers(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "transfer",
      "amount": "...",
      "from": "...",
      "to": "...",
      "tx": {
        "hash": "..."
      }
    }
  ]
}

Contracts

This is an object representing a contract.

The contract object

Attributes
  • addressstring
    The address of the contract.
  • networkNetwork
    The network the contract is on.
  • typestring
    The type of the contract.
Object
interface Contract {
  object: string;
  address: string;
  network: Network;
  type: string;
}
Example
{
  "object": "contract",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "network": {
    "id": "ethereum_goerli"
  },
  "type": "erc20"
}

Retrieve a contract

Retrieves the contract with the given address.

Parameters
  • networkstring
    The ID of the network the contract is on.
GET /v1/contracts/:address
const contract = await triangle.contracts.retrieve(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "contract",
  "address": "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  "network": {
    "id": "ethereum_goerli"
  },
  "type": "erc20"
}

List a contract's holders

Returns a list of the holders of the contract.

Parameters
  • networkstring
    The ID of the network the holders are on.
GET /v1/contracts/:address/holders
const holders = await triangle.contracts.holders(
  "0xA1B2c3d4e5F6A7B8c9D0E1F2A3b4C5D6E7f8A9B0",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      ...
    }
  ]
}

Blocks

This is an object representing a block.

The block object

Attributes
  • hashstring
    The block hash.
  • networkNetwork
    The network the block is on.
  • numbernumber
    The block number.
  • timestampstring
    The timestamp of the block.
Object
interface Block {
  object: string;
  hash: string;
  network: Network;
  number: number;
  timestamp: string;
}
Example
{
  "object": "block",
  "hash": "...",
  "network": {
    "id": "ethereum_goerli"
  },
  "number": 12345678,
  "timestamp": "2021-05-01T02:46:17.000Z"
}

Retrieve a block

Retrieves the block with the given number on the given network.

Parameters
  • networkstring
    The ID of the network the block is on.
GET /v1/blocks/:number
const block = await triangle.blocks.retrieve(
  12345678,
  { network: "ethereum_goerli" }
);
Response
{
  "object": "block",
  "hash": "...",
  "network": {
    "id": "ethereum_goerli"
  },
  "number": 12345678,
  "timestamp": "2021-05-01T02:46:17.000Z"
}

List all blocks

Returns a list of the latest blocks on the given network.

Parameters
  • networkstring
    The ID of the network the blocks are on.
GET /v1/blocks
const blocks = await triangle.blocks.list({
  network: "ethereum_goerli",
});
Response
{
  "object": "list",
  "items": [
    {
      "object": "block",
      "hash": "...",
      "network": {
        "id": "ethereum_goerli"
      },
      "number": 12345678,
      "timestamp": "2021-05-01T02:46:17.000Z"
    }
  ]
}

List a block's txs

Returns a list of the txs in the block.

Parameters
  • networkstring
    The ID of the network the block is on.
GET /v1/blocks/:number/txs
const txs = await triangle.blocks.txs(
  12345678,
  { network: "ethereum_goerli" }
);
Response
{
  "object": "list",
  "items": [
    {
      "object": "tx",
      "block": {
        "number": 12345678
      },
      "hash": "..."
    }
  ]
}

Txs

This is an object representing a tx.

The tx object

Attributes
  • blockBlock
    The block the transaction is in.
  • hashstring
    The transaction hash.
Object
interface Tx {
  object: string;
  block: Block;
  hash: string;
}
Example
{
  "object": "tx",
  "block": {
    "number": 12345678
  },
  "hash": "..."
}

Retrieve a tx

Retrieves the tx with the given hash.

Parameters
  • networkstring
    The ID of the network the tx is on.
GET /v1/txs/:hash
const tx = await triangle.txs.retrieve(
  "...",
  { network: "ethereum_goerli" }
);
Response
{
  "object": "tx",
  "block": {
    "number": 12345678
  },
  "hash": "..."
}

List all txs

Returns a list of the latest txs.

Parameters
  • addressstring, optional
    Only return txs for the address specified by this address.
  • blockstring, optional
    Only return txs for the block specified by this block number.
  • networkstring
    The ID of the network the txs are on.
GET /v1/txs
const txs = await triangle.txs.list({
  network: "ethereum_goerli",
});
Response
{
  "object": "list",
  "items": [
    {
      "object": "tx",
      "block": {
        "number": 12345678
      },
      "hash": "..."
    }
  ]
}

Cryptocurrencies

This is an object representing a cryptocurrency.

The cryptocurrency object

Attributes
  • idstring
    The unique identifier for the object.
  • delta_1dstring
    The change in price over the last day (24 hours).
  • delta_1hstring
    The change in price over the last hour (60 minutes).
  • delta_1wstring
    The change in price over the last week (7 days).
  • laststring
    The last price volume-weighted across all markets.
  • logo_urlstring
    The url to the logo of the cryptocurrency.
  • market_capstring
    The market capitalization based on circulating supply.
  • namestring
    The name of the cryptocurrency.
  • symbolstring
    The symbol of the cryptocurrency.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Cryptocurrency {
  id: string;
  object: string;
  delta_1d: string;
  delta_1h: string;
  delta_1w: string;
  last: string;
  logo_url: string;
  market_cap: string;
  name: string;
  symbol: string;
  volume: string;
}
Example
{
  "id": "bitcoin",
  "object": "cryptocurrency",
  "delta_1d": "0.01",
  "delta_1h": "0.001",
  "delta_1w": "0.1",
  "last": "23456.78",
  "logo_url": "https://cdn.triangleplatform.com/img/128/bitcoin.png",
  "market_cap": "321654987210.12",
  "name": "Bitcoin",
  "symbol": "BTC",
  "volume": "123456789012.34"
}

Retrieve a cryptocurrency

Retrieves the cryptocurrency with the given ID.

GET /v1/cryptocurrencies/:id
const cryptocurrency = await triangle.cryptocurrencies.retrieve(
  "bitcoin"
);
Response
{
  "id": "bitcoin",
  "object": "cryptocurrency",
  "delta_1d": "0.01",
  "delta_1h": "0.001",
  "delta_1w": "0.1",
  "last": "23456.78",
  "logo_url": "https://cdn.triangleplatform.com/img/128/bitcoin.png",
  "market_cap": "321654987210.12",
  "name": "Bitcoin",
  "symbol": "BTC",
  "volume": "123456789012.34"
}

List all cryptocurrencies

Returns a list of all the cryptocurrencies.

GET /v1/cryptocurrencies
const cryptocurrencies = await triangle.cryptocurrencies.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "bitcoin",
      "object": "cryptocurrency",
      "delta_1d": "0.01",
      "delta_1h": "0.001",
      "delta_1w": "0.1",
      "last": "23456.78",
      "logo_url": "https://cdn.triangleplatform.com/img/128/bitcoin.png",
      "market_cap": "321654987210.12",
      "name": "Bitcoin",
      "symbol": "BTC",
      "volume": "123456789012.34"
    }
  ]
}

Collections

This is an object representing a collection.

The collection object

Attributes
  • idstring
    The unique identifier for the object.
  • floorstring
    The floor price across all listings.
  • logo_urlstring
    The url to the logo of the collection.
  • market_capstring
    The market capitalization based on total items.
  • namestring
    The name of the collection.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Collection {
  id: string;
  object: string;
  floor: string;
  logo_url: string;
  market_cap: string;
  name: string;
  volume: string;
}
Example
{
  "id": "cryptopunks",
  "object": "collection",
  "floor": "...",
  "logo_url": "https://cdn.triangleplatform.com/img/128/cryptopunks.png",
  "market_cap": "...",
  "name": "CryptoPunks",
  "volume": "..."
}

Retrieve a collection

Retrieves the collection with the given ID.

GET /v1/collections/:id
const collection = await triangle.collections.retrieve(
  "cryptopunks"
);
Response
{
  "id": "cryptopunks",
  "object": "collection",
  "floor": "...",
  "logo_url": "https://cdn.triangleplatform.com/img/128/cryptopunks.png",
  "market_cap": "...",
  "name": "CryptoPunks",
  "volume": "..."
}

List all collections

Returns a list of all the collections.

GET /v1/collections
const collections = await triangle.collections.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "cryptopunks",
      "object": "collection",
      "floor": "...",
      "logo_url": "https://cdn.triangleplatform.com/img/128/bitcoin.png",
      "market_cap": "...",
      "name": "CryptoPunks",
      "volume": "..."
    }
  ]
}

Exchanges

This is an object representing an exchange.

The exchange object

Attributes
  • idstring
    The unique identifier for the object.
  • logo_urlstring
    The url to the logo of the exchange.
  • namestring
    The name of the exchange.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Exchange {
  id: string;
  object: string;
  logo_url: string;
  name: string;
  volume: string;
}
Example
{
  "id": "coinbase",
  "object": "exchange",
  "logo_url": "https://cdn.triangleplatform.com/img/128/coinbase.png",
  "name": "Coinbase",
  "volume": "..."
}

Retrieve an exchange

Retrieves the exchange with the given ID.

GET /v1/exchanges/:id
const exchange = await triangle.exchanges.retrieve(
  "coinbase"
);
Response
{
  "id": "coinbase",
  "object": "exchange",
  "logo_url": "https://cdn.triangleplatform.com/img/128/coinbase.png",
  "name": "Coinbase",
  "volume": "..."
}

List all exchanges

Returns a list of all the exchanges.

GET /v1/exchanges
const exchanges = await triangle.exchanges.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "coinbase",
      "object": "exchange",
      "logo_url": "https://cdn.triangleplatform.com/img/128/coinbase.png",
      "name": "Coinbase",
      "volume": "..."
    }
  ]
}

Marketplaces

This is an object representing a marketplace.

The marketplace object

Attributes
  • idstring
    The unique identifier for the object.
  • logo_urlstring
    The url to the logo of the marketplace.
  • namestring
    The name of the marketplace.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Marketplace {
  id: string;
  object: string;
  logo_url: string;
  name: string;
  volume: string;
}
Example
{
  "id": "opensea",
  "object": "marketplace",
  "logo_url": "https://cdn.triangleplatform.com/img/128/opensea.png",
  "name": "OpenSea",
  "volume": "..."
}

Retrieve a marketplace

Retrieves the marketplace with the given ID.

GET /v1/marketplaces/:id
const marketplace = await triangle.marketplaces.retrieve(
  "opensea"
);
Response
{
  "id": "opensea",
  "object": "marketplace",
  "logo_url": "https://cdn.triangleplatform.com/img/128/opensea.png",
  "name": "OpenSea",
  "volume": "..."
}

List all marketplaces

Returns a list of all the marketplaces.

GET /v1/marketplaces
const marketplaces = await triangle.marketplaces.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "opensea",
      "object": "marketplace",
      "logo_url": "https://cdn.triangleplatform.com/img/128/opensea.png",
      "name": "OpenSea",
      "volume": "..."
    }
  ]
}

Markets

This is an object representing a market.

The market object

Attributes
  • idstring
    The unique identifier for the object.
  • baseCryptocurrency
    The base asset of the market.
  • exchangeExchange
    The exchange the market is on.
  • laststring
    The last price of the market.
  • quoteCryptocurrency | Fiat
    The quote asset of the market.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Market {
  id: string;
  object: string;
  base: Cryptocurrency;
  exchange: Exchange;
  last: string;
  quote: Cryptocurrency | Fiat;
  volume: string;
}
Example
{
  "id": "coinbase_bitcoin_usdc",
  "object": "market",
  "base": {
    "id": "bitcoin"
  },
  "exchange": {
    "id": "coinbase"
  },
  "last": "23456.78",
  "quote": {
    "id": "usdc"
  },
  "volume": "..."
}

Retrieve a market

Retrieves the market with the given ID.

GET /v1/markets/:id
const market = await triangle.markets.retrieve(
  "coinbase_bitcoin_usdc"
);
Response
{
  "id": "coinbase_bitcoin_usdc",
  "object": "market",
  "base": {
    "id": "bitcoin"
  },
  "exchange": {
    "id": "coinbase"
  },
  "last": "23456.78",
  "quote": {
    "id": "usdc"
  },
  "volume": "..."
}

List all markets

Returns a list of all the markets.

GET /v1/markets
const markets = await triangle.markets.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "coinbase_bitcoin_usdc",
      "object": "market",
      "base": {
        "id": "bitcoin"
      },
      "exchange": {
        "id": "coinbase"
      },
      "last": "23456.78",
      "quote": {
        "id": "usdc"
      },
      "volume": "..."
    }
  ]
}

Listings

This is an object representing a listing.

The listing object

Attributes
  • idstring
    The unique identifier for the object.
  • collectionCollection
    The collection of the listing.
  • floorstring
    The floor price of the listing.
  • marketplaceMarketplace
    The marketplace the listing is on.
  • volumestring
    The volume traded over the last 24 hours.
Object
interface Listing {
  id: string;
  object: string;
  collection: Collection;
  floor: string;
  marketplace: Marketplace;
  volume: string;
}
Example
{
  "id": "opensea_cryptopunks",
  "object": "listing",
  "collection": {
    "id": "cryptopunks"
  },
  "floor": "...",
  "marketplace": {
    "id": "opensea"
  },
  "volume": "..."
}

Retrieve a listing

Retrieves the listing with the given ID.

GET /v1/listings/:id
const listing = await triangle.listings.retrieve(
  "opensea_cryptopunks"
);
Response
{
  "id": "opensea_cryptopunks",
  "object": "listing",
  "collection": {
    "id": "cryptopunks"
  },
  "floor": "...",
  "marketplace": {
    "id": "opensea"
  },
  "volume": "..."
}

List all listings

Returns a list of all the listings.

GET /v1/listings
const listings = await triangle.listings.list();
Response
{
  "object": "list",
  "items": [
    {
      "id": "opensea_cryptopunks",
      "object": "listing",
      "collection": {
        "id": "cryptopunks"
      },
      "floor": "...",
      "marketplace": {
        "id": "opensea"
      },
      "volume": "..."
    }
  ]
}