Skip to content

tatumio/tatum-js

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.

Logo

Tatum SDK v2

Tatum SDK allows browsers and Node.js clients to interact with Tatum API. You can find API documentation at
API docs »

Report bug

Build all packages GitHub license npm version code style: prettier


Are you looking for Tatum SDK v1? It has been moved to long living branch Tatum SDK V1.

Status

V2 is currently under active development and considered alpha version. (you can still use LTS version v1)

Installation

This repository is a monorepo with multiple packages for each blockchain.

Blockchain subpackage

You can select one or more blockchain packages that you want to use in your project and install them separately.

Install using npm

npm install @tatumio/eth

Install using yarn

yarn add @tatumio/eth

Currently supported blockchain sdks

Blockchain

Package

Examples

Algo @tatumio/algo algo examples
Bitcoin cash @tatumio/bch bcash examples
Bitcoin @tatumio/btc btc examples
Binance smart chain @tatumio/bsc bsc examples
Celo @tatumio/celo celo examples
Dogecoin @tatumio/dog doge examples
Ethereum @tatumio/eth eth examples
Flow @tatumio/flow flow examples
KuCoin @tatumio/kcs kcs examples
Klaytn @tatumio/klaytn klaytn examples
Litecoin @tatumio/ltc ltc examples
Polygon @tatumio/polygon polygon examples
Solana @tatumio/solana solana examples
Tron @tatumio/tron tron examples
Stellar @tatumio/xlm xlm examples
XRP @tatumio/xrp xrp examples

Full package

It is possible to install the full package with all supported blockchain modules, although this is not recommended for browser environments due to the size of the dependencies.

npm install @tatumio/sdk

Node.JS & Browser support

Installing package you also need to check if selected package is supported in your environment. Not all packages are supported both in node and browser environments.

Library is written in TypeScript with ES2017 as the target JS version. Library should work in Node.JS (current LTS) and in web.

Configuration and setup

Variable Required Default value Description
TESTNET_TYPE - ethereum-sepolia For Ethereum, there are 2 testnet chains supported - Sepolia and Goerli. To enable Goerli, you need to use ethereum-goerli.
TATUM_GAS_STATION_API_KEY - - In the library, there are functions for estimating the Ethereum transaction fee. For the estimation of the transaction fee, we are using https://ethgasstation.info. If you have your API key from https://ethgasstation.info you can use it.
YOUR_TRON_PRO_API_KEY - - If you want to work with TRON locally, you need to enter API Key for [Trongrid] (https://trongrid.io).

Usage

// es6
// import blockchain subpackage or full sdk package
import { TatumEthSDK } from '@tatumio/eth'

// pass API key from Tatum account available for free at https://dashboard.tatum.io/
const ethSDK = TatumEthSDK({ apiKey: '<Your API Key>' })

// pick Tatum service available from API docs
const generatedWallet = await ethSDK.api.ethGenerateWallet('<mnemonic phrase>')
console.log(generatedWallet)

Examples

Service type Path example Description
Api ethSDK.api.ethGenerateAddress Blockchain native services
Custodial ethSDK.custodial.prepare.generateCustodialWalletSignedTransaction Custodial wallet services
Fungible tokens ethSDK.fungible.deployToken ERC20, TRC20, etc.
NFT ethSDK.nft.deployToken ERC721, TRC721, etc.
NFT Marketplace ethSDK.auction.bid NFT Marketplaces services
NFT Auctions ethSDK.marketplace.getMarketplaceListing NFT Auctions services
Multi tokens ethSDK.multiToken.deployToken ERC-1155 services
httpDriver ethSDK.httpDriver Connect directly to Node
KMS ethSDK.kms.getAllPending Tatum KMS
Ledger ethSDK.ledger.orderBook.newTrade Tatum private Ledger
Virtual accounts ethSDK.virtualAccount.storeTokenAddress Tatum Virtual Account services
Record ethSDK.record.storeLog Blockchain log
Security ethSDK.security.checkMaliciousAddress Security utilities
Subscriptions ethSDK.subscriptions.createSubscription Notification services
Tatum ethSDK.tatum.freezeApiKey Tatum Ledger custody services
Transaction ethSDK.transaction.prepare.transferSignedTransaction Blockchain native transfer
Wallet ethSDK.wallet.generateWallet Create blockchain wallet and address

All examples of SDK usage will be found after completion at https://github.com/tatumio/tatum-js/tree/master/examples

Usage with create-react-app (which uses Webpack 5)

Webpack v5 introduced breaking changes to Web3 library used in Tatum blockchain services. To enable Tatum SDK in React apps you need to follow workaround as per stackoverflow discussion

1. Install additional dependencies

yarn add -D node-polyfill-webpack-plugin
yarn add -D react-app-rewired

2. Copy config-overrides.js to your project (next to package.json)

3. Add browserify dependencies to package.json

"assert": "npm:assert",
"crypto": "npm:crypto-browserify",
"http": "npm:http-browserify",
"https": "npm:https-browserify",
"os": "npm:os-browserify",
"stream": "npm:stream-browserify",
"url": "npm:url",
...

4. Replace scripts block in your package.json

"scripts": {
    "start": "react-app-rewired start",
    "build": "react-app-rewired build",
    "test": "react-app-rewired test",
    "eject": "react-app-rewired eject"
},

Contributing

Contributions to the Tatum SDK are welcome. Please ensure that you have tested your changes with a local client and have added unit test coverage for your code.

Bugs and feature requests

Have a bug or a feature request? Please first read the issue guidelines and search for existing and closed issues. If your problem or idea is not addressed yet, please open a [new issue]( please open a new issue).