本文整理汇总了TypeScript中bignumber.js.BigNumber.greaterThan方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.BigNumber.greaterThan方法的具体用法?TypeScript js.BigNumber.greaterThan怎么用?TypeScript js.BigNumber.greaterThan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bignumber.js.BigNumber
的用法示例。
在下文中一共展示了js.BigNumber.greaterThan方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: formatted
formatted(): string {
let s: string = Utils.bigFormat(this.amount);
if (this.amount.greaterThan(0.0)) {
s = '+' + s;
}
return s;
}
示例2: cssClass
cssClass(): string {
if (this.amount.greaterThan(0.0)) {
return 'positive';
} else if (this.amount.lessThan(0.0)) {
return 'negative';
} else {
return 'zero';
}
}
示例3: signWithKeypair
function signWithKeypair(
api: RippleAPI,
txJSON: string,
keypair: KeyPair,
options: SignOptions = {
signAs: ''
}
): { signedTransaction: string; id: string } {
validate.sign({txJSON, keypair})
const tx = JSON.parse(txJSON)
if (tx.TxnSignature || tx.Signers) {
throw new utils.common.errors.ValidationError(
'txJSON must not contain "TxnSignature" or "Signers" properties'
)
}
const fee = new BigNumber(tx.Fee)
const maxFeeDrops = xrpToDrops(api._maxFeeXRP)
if (fee.greaterThan(maxFeeDrops)) {
throw new utils.common.errors.ValidationError(
`"Fee" should not exceed "${maxFeeDrops}". ` +
'To use a higher fee, set `maxFeeXRP` in the RippleAPI constructor.'
)
}
tx.SigningPubKey = options.signAs ? '' : keypair.publicKey
if (options.signAs) {
const signer = {
Account: options.signAs,
SigningPubKey: keypair.publicKey,
TxnSignature: computeSignature(tx, keypair.privateKey, options.signAs)
}
tx.Signers = [{Signer: signer}]
} else {
tx.TxnSignature = computeSignature(tx, keypair.privateKey)
}
const serialized = binary.encode(tx)
return {
signedTransaction: serialized,
id: computeBinaryTransactionHash(serialized)
}
}