API Examples: Other Useful Queries

View vault balances (filterable by asset)

Query

query ViewVaultsBalances {
  vaults {
    id
    usdBalance: balance(asFiat: USD)
    btcBalance: balance(asAsset: "BTC")
    visibleAssets {
      asset {
        id
        symbol
      }
      usdBalance: balance(asFiat: USD)
      btcBalance: balance(asAsset: "BTC")
    }
  }
}

View deposit address per asset per vault

Query

query ViewDepositAddressPerAssetPerVault {
  vaults {
    id
    visibleAssets {
      asset {
        id
        symbol
      }
      depositAddress: publicKey
    }
  }
}

View pending transaction requests by vault or asset

Query

query PendingTransactionRequests($where: RequestsQueryWhereArg!) {
  requests(where: $where) {
    edges {
      node {
        ... on TransactionRequest {
          id
          amount
        }
      }
    }
  }
}

Variables

{
  "where": {
    "deviceId": "…",
    "status": ["TO_SIGN", "TO_VOTE"],
    "type": "TRANSACTION_REQUESTS"
  }
}

View past transactions (including incoming) by vault or asset

Query

query TransactionHistory($where: TransactionHistoryQueryWhereArg) {
  transactionHistory(where: $where) {
    edges {
      node {
        ... on Transaction {
          id
          amount
        }
        ... on TransactionRequest {
          id
          amount
        }
      }
    }
  }
}

Variables

{
  "where": { "vaultId": "…", "assetId": "…" }
}

Create transaction request

Mutation

mutation CreateTransactioRequest(
  $assetId: ID!
  $receivingAddress: String!
  $sendAmount: Decimal!
  $vaultId: ID!
) {
  createTransactionRequest(
    assetId: $assetId
    receivingAddress: $receivingAddress
    sendAmount: $sendAmount
    vaultId: $vaultId
  ) {
    id
    amount
  }
}

Variables

{
  "assetId": "…",
  "receivingAddress": "…",
  "sendAmount": "…",
  "vaultId": "…"
}