tx-manager/src/utils.js

18 lines
435 B
JavaScript
Raw Normal View History

2020-10-17 04:22:55 +02:00
const BN = require('bn.js')
const { BigNumber } = require('ethers')
2020-10-01 06:56:47 +02:00
/**
* A promise that resolves after `ms` milliseconds
*/
2020-10-02 11:55:44 +02:00
const sleep = ms => new Promise(res => setTimeout(res, ms))
2020-10-01 06:56:47 +02:00
2020-10-17 04:22:55 +02:00
const max = (a, b) => BigNumber.from(BN.max(new BN(a.toString()), new BN(b.toString())).toString())
const min = (a, b) => BigNumber.from(BN.min(new BN(a.toString()), new BN(b.toString())).toString())
2020-10-01 06:56:47 +02:00
module.exports = {
sleep,
2020-10-17 04:22:55 +02:00
max,
min,
2020-10-01 06:56:47 +02:00
}