Coder Social home page Coder Social logo

chaineasy-com / tatum-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tatumio/tatum-js

0.0 0.0 0.0 53.26 MB

Tatum API client to access Tatum blockchain infrastructure

Home Page: https://tatum.io

License: MIT License

Shell 0.01% JavaScript 0.14% TypeScript 99.83% Solidity 0.02%

tatum-js's Introduction

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
Offchain ethSDK.offchain.storeTokenAddress Tatum Offchain
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).

tatum-js's People

Contributors

hathoriel avatar sceri avatar jakcinmarina avatar isra67 avatar npwork avatar alexloiko avatar vlnevyhosteny avatar rachitgod avatar samuelsramko avatar jeydev310 avatar jdckl avatar dependabot[bot] avatar opefago avatar pedrodbaptista avatar von-drc avatar snyk-bot avatar ruckim avatar yocontra avatar ncodes avatar jirijanecek777 avatar chrto avatar evanvtatum avatar turinglabsorg avatar evgeniabogranskaya avatar florindumitru avatar kk-hainq avatar krgizdov avatar marty19 avatar prokopsimek avatar aanandmishra1804 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.