mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-18 19:25:48 +00:00
- See https://github.com/ripple/rippled/pull/2245 * Add support for depositAuth flag * Upgrade ripple-binary-codec to 0.1.13
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
import * as assert from 'assert'
|
|
import {removeUndefined} from '../../common'
|
|
import parseAmount from './amount'
|
|
import {Amount} from '../../common/types/objects'
|
|
|
|
export type FormattedCheckCash = {
|
|
|
|
// ID of the Check ledger object to cash.
|
|
checkID: string,
|
|
|
|
// (Optional) redeem the Check for exactly this amount, if possible.
|
|
// The currency must match that of the `SendMax` of the corresponding
|
|
// `CheckCreate` transaction.
|
|
amount: Amount,
|
|
|
|
// (Optional) redeem the Check for at least this amount and
|
|
// for as much as possible.
|
|
// The currency must match that of the `SendMax` of the corresponding
|
|
// `CheckCreate` transaction.
|
|
deliverMin: Amount
|
|
|
|
// *must* include either Amount or DeliverMin, but not both.
|
|
}
|
|
|
|
function parseCheckCash(tx: any): FormattedCheckCash {
|
|
assert(tx.TransactionType === 'CheckCash')
|
|
|
|
return removeUndefined({
|
|
checkID: tx.CheckID,
|
|
amount: tx.Amount && parseAmount(tx.Amount),
|
|
deliverMin: tx.DeliverMin && parseAmount(tx.DeliverMin)
|
|
})
|
|
}
|
|
|
|
export default parseCheckCash
|