You are participating in Ironforge Public Beta 

    Usage

    A step-by-step guide to work with Ironforge SDK


    To start with our SDK, you must install it as a dependency using your favorite package manager.

    npm install @ironforge/sdk

    Next, create a new instance of Ironforge SDK, passing your API Key as a parameter.

    const { IronforgeSdk } = require("@ironforge/sdk")
    const apiKey = "API_KEY"
     
    const sdk = new IronforgeSdk(apiKey)

    You can get the API Key from settings.

    Next, let’s make an Async function, which will be used to execute our API request. This function will craft our API request. For the example, we'll query the Candy Machine on the Devnet cluster, retrieving records with a size value of 1000 or more. Our query will be limited to 10 records, starting from an offset of 3.

    const { IronforgeSdk } = require("@ironforge/sdk")
    const apiKey = "API_KEY"
     
    const sdk = new IronforgeSdk(apiKey)
     
    async function sdkAccountsFilter() {
      return await sdk.accounts.filter({
        cluster: "devnet",
        program: "cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ",
        body: {
          filter: {
            size: {
              $gte: 1000,
            },
          },
        },
        limit: 10,
        offset: 3,
      })
    }

    To execute this, we'll call the function and log the response.

    try {
      const response = await sdkAccountsFilter()
     
      console.log(response.status)
      console.log(response.result)
    } catch (e) {
      process.exit(1)
    }

    Exporting Requests

    You can quickly export a request from the Accounts API Playground by clicking the 'Export' button in the top right corner