1.1.4 • Published 5 years ago

xtoken v1.1.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

xtoken-js

Install:

npm install xtoken-js

Instantiate:

const xToken = require('xtoken-js')

const provider = new ethers.providers.Web3Provider(window.ethereum)

OR

const provider = new ethers.providers.InfuraProvider('homestead')

OR

const provider = ....

const xtoken = new xToken({
    provider
})

Calculate Expected Quantity on Mint

This line of code is where the the npm library will be replacing code in the front end. All the logic is here: https://github.com/xtokenmarket/xtoken-market/blob/master/src/components/AssetPage/TradeBox/utils/index.js#L60

Before minting an xToken, the end user can calculate the expected minted quantity given the input quantity of ETH or ERC20 token (e.g. KNC or SNX).

Example:

const expectedQuantity = await xtoken.calculateExpectedQuantityOnMint({
    symbol: 'xKNCa',
    tradeWithEth: false,
    amount: 172.39
})

Props

symbol: xToken symbol. Build for 'xKNCa', 'xKNCb', 'xSNXa'

tradeWithEth: if true, amount value is in ETH. if false, amount value is in token (i.e., KNC to xKNC, SNX for xSNX)

amount: this is the input amount in 18 decimal notation. for example 172.39 KNC equals 172.39e18 in Solidity notation.

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago