trustwallet-assets/script/generic/numbers.ts
Viktor Radchenko 9b41a52182
Add token list support for pairs on binance chain (#4428)
* Add token list support for pairs on binance chain

* Update tokenlists.ts

* Update tokenlists.ts

* Update tokenlists.ts

* Fix asset for bnb pair

* Update package-lock.json

* Add models for token list

* Add BinanceMarket
2020-10-13 18:20:42 -07:00

9 lines
382 B
TypeScript

import BigNumber from "bignumber.js";
export function toSatoshis(value: string, decimals: number): string {
return new BigNumber(value).multipliedBy(new BigNumber(10).exponentiatedBy(decimals)).toFixed()
}
export function fromSatoshis(value: string, decimals: number): string {
return new BigNumber(value).dividedBy(new BigNumber(10).exponentiatedBy(decimals)).toFixed()
}