Search
K
Links

Configuration options

Network

Every Tatum SDK instance must be initiated with the proper blockchain network. All operations performed later using this SDK will automatically use the network from the configuration.
To see the list of all available blockchain protocols, check on GitHub.
1
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
TatumSDK is returning the correct types for the RPC submodule using generic types in the init() method. To see all the supported RPC types, check here.

API Version

Tatum SDK works with two versions of the Tatum API - version 3 and version 4. Each of the versions supports different operations, it's recommended to use version 4.
Version 4 of the API supports the most up-to-date features and is set as a default value. The SDK by default tries to perform the calls against version 4 and fallbacks to version 3
1
import {TatumSDK, Network, Ethereum, ApiVersion} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM, version: ApiVersion.V4})

API Key

Most of the operations available in the SDK don't require API Key authentication to Tatum. But, if you want to have a higher throughput or save your data for future use, you should obtain one at Tatum Dashboard. Here, you will get the API Key Version 4 for your SDK, and you can use it in your application.
Alternatively, for access to features of Api Key Version 3, you can get the API Key here.
You can use both API Keys at the same time or just one of them.
1
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({
4
network: Network.ETHEREUM,
5
apiKey: {
6
v3: 'YOUR_API_KEY_V3',
7
v4: 'YOUR_API_KEY_V4'
8
})

Verbose mode

If you want to start the verbose logging mode to see requests and responses returned from the Tatum API, just set the config verbose: true.
1
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM, verbose: true})

Custom RPC provider URL

You can use any RPC provider for interacting with a blockchain. Just add your custom node provider inside rpc.nodes array. All other features from the SDK will work as expected, only the RPC calls will point to your custom node.
1
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM, rpcUrl: 'https://YOUR_CUSTOM_RPC_PROVIDER'})
4
5
const tatum = await TatumSDK.init<BaseEvmClass>({
6
network: Network.ETHEREUM,
7
verbose: true,
8
rpc: {
9
nodes: [
10
{
11
url: 'YOUR_CUSTOM_PROVIDER_URL',
12
type: RpcNodeType.NORMAL,
13
},
14
],
15
},
16
})

Retry

There are some cases when requests fail to complete successfully. For instance, when you exceed request rate limitations or a network error occurs. To configure behavior when requests fail use
  • retryCount - specifies the maximum number of how many times the failed request is resent again until a successful response is returned, the default value is 1
  • retryDelay - specifies the number in milliseconds of how long it waits before the failed request is resent again, the default value is 1000
1
import {TatumSDK, Network, Ethereum} from '@tatumio/tatum'
2
3
const tatum = await TatumSDK.init<Ethereum>({
4
network: Network.ETHEREUM,
5
retryCount: 5,
6
retryDelay: 1500,
7
})
© Tatum Technology, LLC