mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-04 21:15:47 +00:00
Merge branch 'amm' into beta3
This commit is contained in:
90
packages/xrpl/src/models/ledger/AMM.ts
Normal file
90
packages/xrpl/src/models/ledger/AMM.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
import { Currency } from '../common'
|
||||
|
||||
import BaseLedgerEntry from './BaseLedgerEntry'
|
||||
|
||||
interface AuthAccount {
|
||||
AuthAccount: {
|
||||
account: string
|
||||
}
|
||||
}
|
||||
|
||||
interface VoteSlot {
|
||||
VoteEntry: {
|
||||
Account: string
|
||||
TradingFee: number
|
||||
VoteWeight: number
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The AMM object type describes a single Automated Market Maker (AMM) instance.
|
||||
*
|
||||
* @category Ledger Entries
|
||||
*/
|
||||
export default interface AMM extends BaseLedgerEntry {
|
||||
LedgerEntryType: 'AMM'
|
||||
/**
|
||||
* The address of the special account that holds this AMM's assets.
|
||||
*/
|
||||
AMMAccount: string
|
||||
/**
|
||||
* The definition for one of the two assets this AMM holds.
|
||||
*/
|
||||
Asset: {
|
||||
currency: string
|
||||
issuer?: string
|
||||
}
|
||||
/**
|
||||
* The definition for the other asset this AMM holds.
|
||||
*/
|
||||
Asset2: {
|
||||
currency: string
|
||||
issuer?: string
|
||||
}
|
||||
/**
|
||||
* Details of the current owner of the auction slot.
|
||||
*/
|
||||
AuctionSlot?: {
|
||||
/**
|
||||
* The current owner of this auction slot.
|
||||
*/
|
||||
Account: string
|
||||
/**
|
||||
* A list of at most 4 additional accounts that are authorized to trade at the discounted fee for this AMM instance.
|
||||
*/
|
||||
AuthAccounts?: AuthAccount[]
|
||||
/**
|
||||
* The trading fee to be charged to the auction owner, in the same format as TradingFee.
|
||||
* By default this is 0, meaning that the auction owner can trade at no fee instead of the standard fee for this AMM.
|
||||
*/
|
||||
DiscountedFee: number
|
||||
/**
|
||||
* The time when this slot expires, in seconds since the Ripple Epoch.
|
||||
*/
|
||||
Expiration: number
|
||||
/**
|
||||
* The amount the auction owner paid to win this slot, in LP Tokens.
|
||||
*/
|
||||
Price: Currency
|
||||
}
|
||||
/**
|
||||
* The total outstanding balance of liquidity provider tokens from this AMM instance.
|
||||
* The holders of these tokens can vote on the AMM's trading fee in proportion to their holdings,
|
||||
* or redeem the tokens for a share of the AMM's assets which grows with the trading fees collected.
|
||||
*/
|
||||
LPTokenBalance: Currency
|
||||
/**
|
||||
* The percentage fee to be charged for trades against this AMM instance, in units of 1/100,000.
|
||||
* The maximum value is 1000, for a 1% fee.
|
||||
*/
|
||||
TradingFee: number
|
||||
/**
|
||||
* A list of vote objects, representing votes on the pool's trading fee.
|
||||
*/
|
||||
VoteSlots?: VoteSlot[]
|
||||
/**
|
||||
* A bit-map of boolean flags. No flags are defined for the AMM object
|
||||
* type, so this value is always 0.
|
||||
*/
|
||||
Flags: 0
|
||||
}
|
||||
@@ -116,6 +116,10 @@ export interface AccountRootFlagsInterface {
|
||||
* (It has DepositAuth enabled.)
|
||||
*/
|
||||
lsfDepositAuth?: boolean
|
||||
/**
|
||||
* This account is an Automated Market Maker (AMM) instance.
|
||||
*/
|
||||
lsfAMM?: boolean
|
||||
/**
|
||||
* Disallow incoming NFTOffers from other accounts.
|
||||
*/
|
||||
@@ -172,6 +176,10 @@ export enum AccountRootFlags {
|
||||
* (It has DepositAuth enabled.)
|
||||
*/
|
||||
lsfDepositAuth = 0x01000000,
|
||||
/**
|
||||
* This account is an Automated Market Maker (AMM) instance.
|
||||
*/
|
||||
lsfAMM = 0x02000000,
|
||||
/**
|
||||
* Disallow incoming NFTOffers from other accounts.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import AccountRoot from './AccountRoot'
|
||||
import Amendments from './Amendments'
|
||||
import AMM from './AMM'
|
||||
import Bridge from './Bridge'
|
||||
import Check from './Check'
|
||||
import DepositPreauth from './DepositPreauth'
|
||||
@@ -19,6 +20,7 @@ import XChainOwnedCreateAccountClaimID from './XChainOwnedCreateAccountClaimID'
|
||||
type LedgerEntry =
|
||||
| AccountRoot
|
||||
| Amendments
|
||||
| AMM
|
||||
| Bridge
|
||||
| Check
|
||||
| DepositPreauth
|
||||
|
||||
@@ -28,7 +28,7 @@ interface AuthAccount {
|
||||
account: string
|
||||
}
|
||||
|
||||
interface VoteEntry {
|
||||
interface VoteSlot {
|
||||
account: string
|
||||
trading_fee: number
|
||||
vote_weight: number
|
||||
@@ -122,7 +122,7 @@ export interface AMMInfoResponse extends BaseResponse {
|
||||
/**
|
||||
* Keeps a track of up to eight active votes for the instance.
|
||||
*/
|
||||
vote_slots?: VoteEntry[]
|
||||
vote_slots?: VoteSlot[]
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,21 @@ import { BaseRequest, BaseResponse } from './baseMethod'
|
||||
*/
|
||||
export interface LedgerEntryRequest extends BaseRequest {
|
||||
command: 'ledger_entry'
|
||||
/**
|
||||
* Retrieve an Automated Market Maker (AMM) object from the ledger.
|
||||
* This is similar to amm_info method, but the ledger_entry version returns only the ledger entry as stored.
|
||||
*/
|
||||
amm?: {
|
||||
asset: {
|
||||
currency: string
|
||||
issuer?: string
|
||||
}
|
||||
asset2: {
|
||||
currency: string
|
||||
issuer?: string
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, return the requested ledger object's contents as a hex string in
|
||||
* the XRP Ledger's binary format. Otherwise, return data in JSON format. The
|
||||
|
||||
Reference in New Issue
Block a user