本文整理汇总了TypeScript中bignumber.js.BigNumber类的典型用法代码示例。如果您正苦于以下问题:TypeScript js.BigNumber类的具体用法?TypeScript js.BigNumber怎么用?TypeScript js.BigNumber使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了js.BigNumber类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test("equals, should return same value as BigNumber", () => {
const input = new BigNumber(Number.MAX_VALUE);
const output = new JavaBigDecimal(input.toString(10)).get();
expect(output).toEqual(new BigNumber(Number.MAX_VALUE));
});
示例2: BigNumber
const volumes = _.reduce(marketOutcomes, (acc, trade) => {
const tradeAmount = new BigNumber(trade.amount);
const tradePrice = new BigNumber(trade.price);
const price = tradePrice.minus(minPrice);
return {
shareVolume: acc.shareVolume.plus(tradeAmount),
volume: acc.volume.plus(tradeAmount.multipliedBy(price)),
};
}, { shareVolume: ZERO, volume: ZERO });
示例3: increaseApprovalTx
public increaseApprovalTx(
_spender: BigNumber | string,
_addedValue: BigNumber | number
): DeferredTransactionWrapper<ITxParams> {
return new DeferredTransactionWrapper<ITxParams>(this, "increaseApproval", [
_spender.toString(),
_addedValue.toString()
]);
}
示例4: allowanceTx
public allowanceTx(
owner: BigNumber | string,
spender: BigNumber | string
): DeferredTransactionWrapper<ITxParams> {
return new DeferredTransactionWrapper<ITxParams>(this, "allowance", [
owner.toString(),
spender.toString()
]);
}
示例5: mintTx
public mintTx(
_to: BigNumber | string,
_amount: BigNumber | number
): DeferredTransactionWrapper<ITxParams> {
return new DeferredTransactionWrapper<ITxParams>(this, "mint", [
_to.toString(),
_amount.toString()
]);
}
示例6: approveTx
public approveTx(
_spender: BigNumber | string,
_value: BigNumber | number
): DeferredTransactionWrapper<ITxParams> {
return new DeferredTransactionWrapper<ITxParams>(this, "approve", [
_spender.toString(),
_value.toString()
]);
}
示例7: allowance
public allowance(
_owner: BigNumber | string,
_spender: BigNumber | string
): Promise<BigNumber> {
return promisify(this.rawWeb3Contract.allowance, [
_owner.toString(),
_spender.toString()
]);
}
示例8: transferTx
public transferTx(
_to: BigNumber | string,
_value: BigNumber | number
): DeferredTransactionWrapper<ITxParams> {
return new DeferredTransactionWrapper<ITxParams>(this, "transfer", [
_to.toString(),
_value.toString()
]);
}
示例9: getDidClaimBooty
public getDidClaimBooty(
stakerAddress: BigNumber | string,
period: BigNumber | number
): Promise<boolean> {
return promisify(this.rawWeb3Contract.getDidClaimBooty, [
stakerAddress.toString(),
period.toString()
]);
}
示例10: cssClass
cssClass(): string {
if (this.amount.greaterThan(0.0)) {
return 'positive';
} else if (this.amount.lessThan(0.0)) {
return 'negative';
} else {
return 'zero';
}
}