LogoLogo
WebsiteLoginStatus
API Reference
API Reference
  • Introduction
  • Introduction to GraphQL
    • What is GraphQL?
      • GraphQL Schema
      • Example Using GraphQL
    • Authentication
    • Queries
      • Example Query
    • Mutations
      • Example Mutation
    • Variables
    • Fields
  • Develop With inabit API
    • Getting Started
      • Authentication
      • inabit Postman Collection
    • Organizations
      • Organization Info
      • Organization ID
      • Organization Users
      • Organization Contacts
      • Organization Transactions
    • Wallets
      • Wallets Info
      • Create inabit Wallet
      • Edit Wallet Name
      • Generate Deposit Address
      • Fetch Deposit Address
      • Save Address to Whitelist
      • Archive / Unarchive Wallet
      • Disconnect Exchange Wallet
    • Contacts
      • Contact Info
      • Create New Contact
      • Update Contact
    • Transactions
      • Transaction Info
      • Create Transfer Request
      • Create Off Ramp Request
      • Create On Ramp Request
      • Create Exchange Swap
      • Create inabit Wallet Swap
      • Edit Transaction Note
    • Utilities
      • Fetch Financial Asset
      • Fetch Blockchains
  • Remote Approver App
    • Setup and Configuration
    • API Wallets Generation
    • Automate Signing Transactions
    • Webhooks
      • Notification Types
  • WHAT WE SUPPORT
    • Assets & Tokens
    • Blockchains
    • Exchanges
      • Binance
      • Kucoin
      • Kraken
  • Changelog
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. Introduction to GraphQL
  2. Mutations

Example Mutation

A breakdown of an example GraphQL mutation in inabit

GraphQL Mutation: Create Withdrawal

Mutations in GraphQL are operations used to modify data on the server. This example demonstrates how to create a withdrawal request.

Operation Name:

The operation is named CreateWithdrawal.

Operations:

1. Query to Retrieve Necessary Information:

query GetWalletAndBlockchainID {
  wallet(id: "clol7o576002oaz011mmtnvru") {
    id
  }
  financialAsset(id: "clefn78gv011olc6rcwtt0wel") {
    id
  }
  blockchain(id: "clefn78em00mslc6r3lzf3h5a") {
    id
  }
}

This query fetches the IDs of the wallet, financial asset, and blockchain associated with the withdrawal. These IDs are required for creating the withdrawal request.

2. Mutation to Create Withdrawal:

mutation CreateWithdrawal($data: WithdrawalCreateInput!, $jwtToken: String!) {
  createWithdrawal(data: $data, jwtToken: $jwtToken) {
    id
  }
}

Variables:

{
  "data": {
    "wallet": {
      "id": "clol7o576002oaz011mmtnvru"
    },
    "financialAsset": {
      "id": "clefn78gv011olc6rcwtt0wel"
    },
    "address": "0x7582f3483116105e0b7845ac1a0df5eb0c8cd062",
    "amount": 5,
    "blockchain": {
      "id": "clefn78em00mslc6r3lzf3h5a"
    },
    "note": "",
    "priority": "Medium"
  },
  "jwtToken": "***[accessToken from login response]***"
}

Explanation:

The process begins with a query to retrieve the IDs of the wallet, financial asset, and blockchain related to the withdrawal. These IDs are then passed as variables along with other necessary details (such as withdrawal amount, destination address, and priority level) to the mutation CreateWithdrawal. The mutation creates the withdrawal request using the provided data and the authorization token (jwtToken).

Response:

Upon successful execution of the mutation, the response contains the ID of the created withdrawal request.

PreviousMutationsNextVariables

Was this helpful?