π§° JavaScript SDK
Tatum offers JavaScript/TypeScript SDK which helps developers to build dApps.
The Tatum SDK is designed to simplify blockchain application development. Whether you're monitoring blockchain addresses, making RPC calls, managing NFTs, or querying wallet balances and transactions, Tatum SDK streamlines the process with its robust features.
Engineered with a developer-first approach, Tatum SDK accelerates your blockchain application development, regardless of your experience level.
Prerequisites
Before diving into TatumSDK, ensure that you have the following prerequisites installed:
- Node.js: Ensure you have the latest LTS version installed.
- npm: npm is bundled with Node.js, so installing Node.js should automatically install npm.
Installation of Tatum SDK
To install SDK, simply run the following command in your terminal or command prompt.
This will install the Tatum SDK package and its dependencies:
npm install @tatumio/tatum
yarn add @tatumio/tatum
pnpm install @tatumio/tatum
bun install @tatumio/tatum
Examples:
Fetch the native balance of wallet
Now that you have installed Tatum SDk, lets make your first call in which we will fetch the native balance of wallet in just 3 steps. Here's the code snippet:
import { TatumSDK, Network } from '@tatumio/tatum'
const tatum = await TatumSDK.init({ network: Network.ETHEREUM });
const balance = await tatum.address.getBalance({
addresses: [addressInput.value],
});
console.log(balance.data[0]);
Try the first call in the Codepen below:
RPC call to get latest block
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
// Init chain of your choice
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
// Use our interfaces to make the call
const latestBlock = await tatum.rpc.blockNumber()
console.log(`Latest block is ${latestBlock}`)
Updated 6 months ago