@etransfer/utils
v1.11.0
Published
![ES Version](https://img.shields.io/badge/ES-2020-yellow) ![Node Version](https://img.shields.io/badge/node-18.x-green) [![NPM Package Version][npm-image-version]][npm-url]
Downloads
2,346
Keywords
Readme
@etransfer/utils
This package provides common methods about etransfer services.
Including obtaining contracts, operating contracts, formatting amounts, address judgment, etc.
Installation
Using NPM
npm install @etransfer/utils
Using Yarn
yarn add @etransfer/utils
Prerequisites
Package.json Scripts
| Script | Description |
| -------- | -------------------------------------------------- |
| clean | Uses rm
to remove dist/
|
| build | Uses tsc
to build package and dependent packages |
| lint | Uses eslint
to lint package |
| lint:fix | Uses eslint
to check and fix any warnings |
| format | Uses prettier
to format the code |
How to use
See more Developer Documentation.
import { checkTokenAllowanceAndApprove } from '@etransfer/utils'
// Get the token contract.
const tokenContract = await getTokenContract('node address', 'token contract address');
// Check whether the account balance is sufficient. If not, trigger setting allowance.
const result = await checkTokenAllowanceAndApprove()