Submodules
A quick overview of th different submodules in Tatum SDK and how they simplify blockchain development. These submodules include RPC, Notification, NFT, Address, and Wallet Provider.
TatumSDK is thoughtfully designed and organized into two primary submodules to provide a clean and efficient way of interacting with the various blockchains:
- RPC submodule -
tatum.rpc.*
: This submodule enables you to make direct Remote Procedure Call (RPC) calls to multiple blockchains, providing seamless access to various on-chain data and functionalities. With the RPC submodule, you can fetch account balances, send transactions, interact with smart contracts, and more.
1
// yarn add @tatumio/tatum
2
3
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
6
7
const latestBlock = await tatum.rpc.blockNumber()
- Notification submodule -
tatum.notification.*
: This submodule allows you to subscribe to real-time notifications for a wide range of events related to specified blockchain addresses. By leveraging the notification submodule, you can effortlessly track incoming and outgoing transactions, NFT transfers, and other events without constantly polling the blockchain.
1
// yarn add @tatumio/tatum
2
3
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
6
7
const subscription = await tatum.notification.subscribe.nativeIncomingTx({
8
"address": "0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227",
9
"url": "https://dashboard.tatum.io/webhook-handler" // REPLACE WITH YOUR URL HANDLER
10
})
- NFT submodule -
tatum.nft.*
: This submodule offers a comprehensive suite of tools for working with Non-Fungible Tokens (NFTs). With the NFT submodule, you can query the balance of NFTs on an address, retrieve NFT transactions associated with a specific address, explore NFTs within a collection, or identify the owners of a particular NFT.
1
// yarn add @tatumio/tatum
2
3
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
6
7
// Get balance of all NFTs this wallet holds
8
const balance = await tatum.nft.getBalance({
9
"addresses": ["0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227"]
10
})
- Wallet address submodule -
tatum.address.*
: This submodule simplifies wallet management across multiple blockchains by allowing you to fetch wallet balances and retrieve transactions for a given address. With the Address submodule, you can easily manage your wallets and monitor transactions, making your blockchain application development more efficient and user-friendly.
1
// yarn add @tatumio/tatum
2
3
import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Ethereum>({network: Network.ETHEREUM})
6
7
// Get balance of all assets this wallet holds
8
const balance = await tatum.address.getBalance({
9
"addresses": ["0xcb31c8B2Ce9D229b1968Ceb2516B2EB650151227"]
10
})
- Wallet Provider submodule -
tatum.walletProvider.*
: This submodule enables seamless interaction with external wallets like Metamask or Phantom within the browser. The Wallet Provider submodule allows the SDK to communicate with various wallet providers, streamlining the process of signing transactions, querying account balances, and interacting with smart contracts directly through popular browser wallets.
By dividing the library into these submodules, TatumSDK offers an organized, easy-to-use interface that makes interacting with Ethereum and other blockchains a breeze. Both beginners and advanced developers can benefit from the streamlined architecture, enabling them to focus on building powerful blockchain applications.
Last modified 2mo ago