Skip to main content

QuickNode SDK Core Overview

Updated on
Oct 3, 2023

Overview

The Core class of the SDK facilitates interaction with Core API RPC functions as well as additional RPC methods. The supported RPC functions are available as fully-typed functions with inline documentation.


Quickstart

import { Core } from '@quicknode/sdk';

const core = new Core({
endpointUrl: "https://my-endpoint-name.quiknode.pro/myauthtoken/",
});

core.client.getBlock().then((res) => console.log(res));

Configuration

Basic Configuration

The Core class requires an endpointUrl that corresponds with an endpoint URL from your QuickNode account. If you don't have a QuickNode account yet, you can sign up for one here and create an endpoint for free today!

The correct chain will be automatically determined from your endpoint URL, meaning the functions you use will communicate correctly with your endpoint's chain. If you would like to override this chain and manually specify another one, visit our Viem Integration page to learn how.

const core = new Core({
endpointUrl: "https://my-endpoint-name.ethereum-sepolia.quiknode.pro/myauthtoken/",
})

// getBlock() is communicating with ethereum sepolia network
core.client.getBlock().then((res) => console.log(res));

Add-on Configuration

Add-ons can be enabled to allow for communicating with add-on RPC methods that are available on your endpoint. Any compatible add-ons must be added to your QuickNode endpoint to be able to be used with the SDK.

For example, the following code enables the Token and NFT API v2 bundle add-on in the SDK and calls the qn_fetchNFTs function.

const core = new Core({
endpointUrl: "https://my-endpoint-name.quiknode.pro/myauthtoken/",
config: {
addOns: {
nftTokenV2: true,
},
},
});

core.client.qn_fetchNFTs({
wallet: "0xD10E24685c7CDD3cd3BaAA86b09C92Be28c834B6",
}).then((res) => console.log(res));

Configuration Arguments

The Core class takes the following arguments:

PropertyValuesRequiredDescriptionExample
endpointUrlstringThe QuickNode Endpoint URLhttps://my-endpoint-name.quiknode.pro/myauthtoken/
configobjectThe configuration object{ addOns: { nftTokenV2: true } }
chainviem Chain instancea manual override for selected chainpolygon (imported from viem/chains)

The config object:

PropertyValuesRequiredDescriptionExample
addOnsobjectAn object with add-ons that are enabled on the endpoint{ nftTokenV2: true }

Supported Chains

The following EVM-compatible chains are supported by the Core module:


  • Arbitrum
  • Arbitrum Goerli
  • Avalanche
  • Avalanche Fuji
  • Base Goerli
  • Binance Smart Chain (BSC)
  • Binance Smart Chain Testnet
  • Celo
  • Fantom
  • Gnosis (xDai)
  • Harmony One
  • Ethereum
  • Ethereum Goerli
  • Ethereum Sepolia
  • Optimism
  • Optimism Goerli
  • Polygon (Matic)
  • Polygon Mumbai (Matic testnet)
  • Polygon ZkEvm
  • Polygon ZkEvm Testnet
Share this doc