rename MinBidPrice -> BidMin and MaxBidPrice -> BidMax

This commit is contained in:
Omar Khan
2022-11-09 15:09:33 -05:00
parent bcdd8fe2cf
commit eba8bd2ec1
3 changed files with 17 additions and 17 deletions

View File

@@ -1454,7 +1454,7 @@
}
],
[
"MinBidPrice",
"BidMin",
{
"nth": 12,
"isVLEncoded": false,
@@ -1464,7 +1464,7 @@
}
],
[
"MaxBidPrice",
"BidMax",
{
"nth": 13,
"isVLEncoded": false,

View File

@@ -32,17 +32,17 @@ export interface AMMBid extends BaseTransaction {
/**
* This field represents the minimum price that the bidder wants to pay for the slot.
* It is specified in units of LPToken. If specified let MinBidPrice be X and let
* It is specified in units of LPToken. If specified let BidMin be X and let
* the slot-price computed by price scheduling algorithm be Y, then bidder always pays
* the max(X, Y).
*/
MinBidPrice?: Amount
BidMin?: Amount
/**
* This field represents the maximum price that the bidder wants to pay for the slot.
* It is specified in units of LPToken.
*/
MaxBidPrice?: Amount
BidMax?: Amount
/**
* This field represents an array of XRPL account IDs that are authorized to trade
@@ -61,12 +61,12 @@ export interface AMMBid extends BaseTransaction {
export function validateAMMBid(tx: Record<string, unknown>): void {
validateBaseTransaction(tx)
if (tx.MinBidPrice != null && !isAmount(tx.MinBidPrice)) {
throw new ValidationError('AMMBid: MinBidPrice must be an Amount')
if (tx.BidMin != null && !isAmount(tx.BidMin)) {
throw new ValidationError('AMMBid: BidMin must be an Amount')
}
if (tx.MaxBidPrice != null && !isAmount(tx.MaxBidPrice)) {
throw new ValidationError('AMMBid: MaxBidPrice must be an Amount')
if (tx.BidMax != null && !isAmount(tx.BidMax)) {
throw new ValidationError('AMMBid: BidMax must be an Amount')
}
if (tx.AuthAccounts != null) {

View File

@@ -13,8 +13,8 @@ describe('AMMBid', function () {
bid = {
TransactionType: 'AMMBid',
Account: 'rWYkbWkCeg8dP6rXALnjgZSjjLyih5NXm',
MinBidPrice: '5',
MaxBidPrice: '10',
BidMin: '5',
BidMax: '10',
AuthAccounts: [
{
AuthAccount: {
@@ -45,21 +45,21 @@ describe('AMMBid', function () {
assert.doesNotThrow(() => validate(bid))
})
it(`throws w/ MinBidPrice must be an Amount`, function () {
bid.MinBidPrice = 5
it(`throws w/ BidMin must be an Amount`, function () {
bid.BidMin = 5
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: MinBidPrice must be an Amount',
'AMMBid: BidMin must be an Amount',
)
})
it(`throws w/ MaxBidPrice must be an Amount`, function () {
bid.MaxBidPrice = 10
it(`throws w/ BidMax must be an Amount`, function () {
bid.BidMax = 10
assert.throws(
() => validate(bid),
ValidationError,
'AMMBid: MaxBidPrice must be an Amount',
'AMMBid: BidMax must be an Amount',
)
})