update asset pair to use Currency type

This commit is contained in:
Omar Khan
2023-02-21 13:12:14 -05:00
parent 651780fe67
commit d43fd788d4
6 changed files with 17 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
import { BaseRequest, BaseResponse } from './baseMethod'
@@ -15,13 +15,13 @@ export interface AMMInfoRequest extends BaseRequest {
* Specifies one of the pool assets (XRP or token) of the AMM instance.
* Both asset and asset2 must be defined to specify an AMM instance.
*/
asset?: IssuedCurrency
asset: Currency
/**
* Specifies the other pool asset of the AMM instance.
* Both asset and asset2 must be defined to specify an AMM instance.
*/
asset2?: IssuedCurrency
asset2: Currency
}
interface AuthAccount {

View File

@@ -1,6 +1,6 @@
/* eslint-disable complexity -- required for validateAMMBid */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency } from '../common'
import { Amount, Currency } from '../common'
import {
BaseTransaction,
@@ -29,12 +29,12 @@ export interface AMMBid extends BaseTransaction {
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
Asset: Currency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
Asset2: Currency
/**
* This field represents the minimum price that the bidder wants to pay for the slot.

View File

@@ -1,6 +1,6 @@
/* eslint-disable complexity -- required for validateAMMDeposit */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
import {
BaseTransaction,
@@ -49,12 +49,12 @@ export interface AMMDeposit extends BaseTransaction {
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
Asset: Currency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
Asset2: Currency
/**
* Specifies the amount of shares of the AMM instance pools that the trader

View File

@@ -1,5 +1,5 @@
import { ValidationError } from '../../errors'
import { IssuedCurrency } from '../common'
import { Currency } from '../common'
import { AMM_MAX_TRADING_FEE } from './AMMCreate'
import { BaseTransaction, isIssue, validateBaseTransaction } from './common'
@@ -16,12 +16,12 @@ export interface AMMVote extends BaseTransaction {
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
Asset: Currency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
Asset2: Currency
/**
* Specifies the fee, in basis point.

View File

@@ -1,6 +1,6 @@
/* eslint-disable complexity -- required for validateAMMWithdraw */
import { ValidationError } from '../../errors'
import { Amount, IssuedCurrency, IssuedCurrencyAmount } from '../common'
import { Amount, Currency, IssuedCurrencyAmount } from '../common'
import {
BaseTransaction,
@@ -54,12 +54,12 @@ export interface AMMWithdraw extends BaseTransaction {
/**
* Specifies one of the pool assets (XRP or token) of the AMM instance.
*/
Asset: IssuedCurrency
Asset: Currency
/**
* Specifies the other pool asset of the AMM instance.
*/
Asset2: IssuedCurrency
Asset2: Currency
/**
* Specifies the amount of shares of the AMM instance pools that the trader

View File

@@ -4,13 +4,7 @@
import { TRANSACTION_TYPES } from 'ripple-binary-codec'
import { ValidationError } from '../../errors'
import {
Amount,
IssuedCurrency,
IssuedCurrencyAmount,
Memo,
Signer,
} from '../common'
import { Amount, Currency, IssuedCurrencyAmount, Memo, Signer } from '../common'
import { onlyHasFields } from '../utils'
const MEMO_SIZE = 3
@@ -70,7 +64,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
* @param input - The input to check the form and type of.
* @returns Whether the IssuedCurrency is properly formed.
*/
export function isIssue(input: unknown): input is IssuedCurrency {
export function isIssue(input: unknown): input is Currency {
return (
isRecord(input) &&
((Object.keys(input).length === ISSUE_SIZE &&