Skip to content

Commit

Permalink
refactor and export interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
khancode committed Jul 27, 2023
1 parent 34b667d commit 70d180c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
6 changes: 6 additions & 0 deletions packages/xrpl/src/models/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ export interface NFToken {
nft_serial: number
uri: string
}

export interface AuthAccount {
AuthAccount: {
account: string
}
}
10 changes: 2 additions & 8 deletions packages/xrpl/src/models/ledger/AMM.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { Currency } from '../common'
import { AuthAccount, Currency } from '../common'

import BaseLedgerEntry from './BaseLedgerEntry'

interface AuthAccount {
AuthAccount: {
account: string
}
}

interface VoteSlot {
export interface VoteSlot {
VoteEntry: {
Account: string
TradingFee: number
Expand Down
20 changes: 8 additions & 12 deletions packages/xrpl/src/models/methods/ammInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ export interface AMMInfoRequest extends BaseRequest {
asset2: Currency
}

interface AuthAccount {
account: string
}

interface VoteSlot {
account: string
trading_fee: number
vote_weight: number
}

/**
* Response expected from an {@link AMMInfoRequest}.
*
Expand Down Expand Up @@ -81,7 +71,9 @@ export interface AMMInfoResponse extends BaseResponse {
* of the discounted trading fee.
* Each member of this array is an object with one field, account, containing the address of the designated account.
*/
auth_accounts: AuthAccount[]
auth_accounts: Array<{
account: string
}>

/**
* The discounted trading fee that applies to the auction slot holder, and any eligible accounts
Expand Down Expand Up @@ -124,7 +116,11 @@ export interface AMMInfoResponse extends BaseResponse {
/**
* (May be omitted) The current votes for the AMM's trading fee, as Vote Slot Objects.
*/
vote_slots?: VoteSlot[]
vote_slots?: Array<{
account: string
trading_fee: number
vote_weight: number
}>
}

/**
Expand Down
8 changes: 1 addition & 7 deletions packages/xrpl/src/models/transactions/AMMBid.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable complexity -- required for validateAMMBid */
import { ValidationError } from '../../errors'
import { Amount, Currency } from '../common'
import { Amount, AuthAccount, Currency } from '../common'

import {
BaseTransaction,
Expand All @@ -11,12 +11,6 @@ import {

const MAX_AUTH_ACCOUNTS = 4

interface AuthAccount {
AuthAccount: {
Account: string
}
}

/**
* Bid on an Automated Market Maker's (AMM's) auction slot.
*
Expand Down

0 comments on commit 70d180c

Please sign in to comment.