diff --git a/data/factory.go b/data/factory.go index e4e469e..7f6109b 100644 --- a/data/factory.go +++ b/data/factory.go @@ -24,6 +24,7 @@ const ( NEGATIVE_UNL LedgerEntryType = 0x4e // 'N' NFTOKEN_PAGE LedgerEntryType = 0x50 // 'P' NFTOKEN_OFFER LedgerEntryType = 0x37 // '7' + AMM_LT LedgerEntryType = 0x79 // TransactionType values come from rippled's "TxFormats.h" PAYMENT TransactionType = 0 @@ -45,11 +46,18 @@ const ( SET_DEPOSIT_PREAUTH TransactionType = 19 TRUST_SET TransactionType = 20 ACCOUNT_DELETE TransactionType = 21 + HOOK_SET TransactionType = 22 NFTOKEN_MINT TransactionType = 25 NFTOKEN_BURN TransactionType = 26 NFTOKEN_CREATE_OFFER TransactionType = 27 NFTOKEN_CANCEL_OFFER TransactionType = 28 NFTOKEN_ACCEPT_OFFER TransactionType = 29 + AMM_CREATE TransactionType = 35 + AMM_DEPOSIT TransactionType = 36 + AMM_WITHDRAW TransactionType = 37 + AMM_VOTE TransactionType = 38 + AMM_BID TransactionType = 39 + AMM_DELETE TransactionType = 40 AMENDMENT TransactionType = 100 SET_FEE TransactionType = 101 @@ -77,6 +85,7 @@ var LedgerEntryFactory = [...]func() LedgerEntry{ NEGATIVE_UNL: func() LedgerEntry { return &NegativeUNL{leBase: leBase{LedgerEntryType: NEGATIVE_UNL}} }, NFTOKEN_PAGE: func() LedgerEntry { return &NFTokenPage{leBase: leBase{LedgerEntryType: NFTOKEN_PAGE}} }, NFTOKEN_OFFER: func() LedgerEntry { return &NFTokenOffer{leBase: leBase{LedgerEntryType: NFTOKEN_OFFER}} }, + AMM_LT: func() LedgerEntry { return &AMM{leBase: leBase{LedgerEntryType: AMM_LT}} }, } var TxFactory = [...]func() Transaction{ @@ -107,6 +116,12 @@ var TxFactory = [...]func() Transaction{ NFTOKEN_CREATE_OFFER: func() Transaction { return &NFTokenCreateOffer{TxBase: TxBase{TransactionType: NFTOKEN_CREATE_OFFER}} }, NFTOKEN_CANCEL_OFFER: func() Transaction { return &NFTCancelOffer{TxBase: TxBase{TransactionType: NFTOKEN_CANCEL_OFFER}} }, NFTOKEN_ACCEPT_OFFER: func() Transaction { return &NFTAcceptOffer{TxBase: TxBase{TransactionType: NFTOKEN_ACCEPT_OFFER}} }, + AMM_CREATE: func() Transaction { return &AMMCreate{TxBase: TxBase{TransactionType: AMM_CREATE}} }, + AMM_DEPOSIT: func() Transaction { return &AMMDeposit{TxBase: TxBase{TransactionType: AMM_DEPOSIT}} }, + AMM_WITHDRAW: func() Transaction { return &AMMWithdraw{TxBase: TxBase{TransactionType: AMM_WITHDRAW}} }, + AMM_VOTE: func() Transaction { return &AMMVote{TxBase: TxBase{TransactionType: AMM_VOTE}} }, + AMM_BID: func() Transaction { return &AMMBid{TxBase: TxBase{TransactionType: AMM_BID}} }, + AMM_DELETE: func() Transaction { return &AMMDelete{TxBase: TxBase{TransactionType: AMM_DELETE}} }, } var ledgerEntryNames = [...]string{ @@ -126,6 +141,7 @@ var ledgerEntryNames = [...]string{ NEGATIVE_UNL: "NegativeUNL", NFTOKEN_PAGE: "NFTokenPage", NFTOKEN_OFFER: "NFTokenOffer", + AMM_LT: "AMM", } var ledgerEntryTypes = map[string]LedgerEntryType{ @@ -145,6 +161,7 @@ var ledgerEntryTypes = map[string]LedgerEntryType{ "NegativeUNL": NEGATIVE_UNL, "NFTokenPage": NFTOKEN_PAGE, "NFTokenOffer": NFTOKEN_OFFER, + "AMM": AMM_LT, } var txNames = [...]string{ @@ -175,6 +192,12 @@ var txNames = [...]string{ NFTOKEN_CREATE_OFFER: "NFTokenCreateOffer", NFTOKEN_CANCEL_OFFER: "NFTokenCancelOffer", NFTOKEN_ACCEPT_OFFER: "NFTokenAcceptOffer", + AMM_CREATE: "AMMCreate", + AMM_DEPOSIT: "AMMDeposit", + AMM_WITHDRAW: "AMMWithdraw", + AMM_VOTE: "AMMVote", + AMM_BID: "AMMBid", + AMM_DELETE: "AMMDelete", } var txTypes = map[string]TransactionType{ @@ -205,6 +228,12 @@ var txTypes = map[string]TransactionType{ "NFTokenCreateOffer": NFTOKEN_CREATE_OFFER, "NFTokenCancelOffer": NFTOKEN_CANCEL_OFFER, "NFTokenAcceptOffer": NFTOKEN_ACCEPT_OFFER, + "AMMCreate": AMM_CREATE, + "AMMDeposit": AMM_DEPOSIT, + "AMMWithdraw": AMM_WITHDRAW, + "AMMVote": AMM_VOTE, + "AMMBid": AMM_BID, + "AMMDelete": AMM_DELETE, } var HashableTypes []string diff --git a/data/flags.go b/data/flags.go index f6e69a2..e6dfcff 100644 --- a/data/flags.go +++ b/data/flags.go @@ -56,33 +56,6 @@ const ( TxClose TransactionFlag = 0x00020000 ) -// Ledger entry flags -const ( - // AccountRoot flags - LsPasswordSpent LedgerEntryFlag = 0x00010000 - LsRequireDestTag LedgerEntryFlag = 0x00020000 - LsRequireAuth LedgerEntryFlag = 0x00040000 - LsDisallowXRP LedgerEntryFlag = 0x00080000 - LsDisableMaster LedgerEntryFlag = 0x00100000 - LsNoFreeze LedgerEntryFlag = 0x00200000 - LsGlobalFreeze LedgerEntryFlag = 0x00400000 - LsDefaultRipple LedgerEntryFlag = 0x00800000 - - // Offer flags - LsPassive LedgerEntryFlag = 0x00010000 - LsSell LedgerEntryFlag = 0x00020000 - - // RippleState flags - LsLowReserve LedgerEntryFlag = 0x00010000 - LsHighReserve LedgerEntryFlag = 0x00020000 - LsLowAuth LedgerEntryFlag = 0x00040000 - LsHighAuth LedgerEntryFlag = 0x00080000 - LsLowNoRipple LedgerEntryFlag = 0x00100000 - LsHighNoRipple LedgerEntryFlag = 0x00200000 - LsLowFreeze LedgerEntryFlag = 0x00400000 - LsHighFreeze LedgerEntryFlag = 0x00800000 -) - var txFlagNames = map[TransactionType][]struct { Flag TransactionFlag Name string @@ -121,6 +94,43 @@ var txFlagNames = map[TransactionType][]struct { }, } +// Ledger entry flags +const ( + // AccountRoot flags + LsPasswordSpent LedgerEntryFlag = 0x00010000 + LsRequireDestTag LedgerEntryFlag = 0x00020000 + LsRequireAuth LedgerEntryFlag = 0x00040000 + LsDisallowXRP LedgerEntryFlag = 0x00080000 + LsDisableMaster LedgerEntryFlag = 0x00100000 + LsNoFreeze LedgerEntryFlag = 0x00200000 + LsGlobalFreeze LedgerEntryFlag = 0x00400000 + LsDefaultRipple LedgerEntryFlag = 0x00800000 + + // Offer flags + LsPassive LedgerEntryFlag = 0x00010000 + LsSell LedgerEntryFlag = 0x00020000 + + // RippleState flags + LsLowReserve LedgerEntryFlag = 0x00010000 + LsHighReserve LedgerEntryFlag = 0x00020000 + LsLowAuth LedgerEntryFlag = 0x00040000 + LsHighAuth LedgerEntryFlag = 0x00080000 + LsLowNoRipple LedgerEntryFlag = 0x00100000 + LsHighNoRipple LedgerEntryFlag = 0x00200000 + LsLowFreeze LedgerEntryFlag = 0x00400000 + LsHighFreeze LedgerEntryFlag = 0x00800000 + + // SignerList flags + LsOneOwnerCount LedgerEntryFlag = 0x00010000 + + // DirNode flags + LsNFTokenBuyOffers LedgerEntryFlag = 0x00000001 + LsNFTokenSellOffers LedgerEntryFlag = 0x00000002 + + // TokenOffer flags + LsSellNFToken LedgerEntryFlag = 0x00000001 +) + var leFlagNames = map[LedgerEntryType][]struct { Flag LedgerEntryFlag Name string @@ -147,6 +157,16 @@ var leFlagNames = map[LedgerEntryType][]struct { {LsLowFreeze, "LowFreeze"}, {LsHighFreeze, "HighFreeze"}, }, + SIGNER_LIST: { + {LsOneOwnerCount, "OneOwnerCount"}, + }, + DIRECTORY: { + {LsNFTokenBuyOffers, "NFTokenBuyOffers"}, + {LsNFTokenSellOffers, "NFTokenSellOffers"}, + }, + NFTOKEN_OFFER: { + {LsSellNFToken, "SellNFToken"}, + }, } func (f TransactionFlag) String() string { diff --git a/data/format.go b/data/format.go index 9f48124..6b94aec 100644 --- a/data/format.go +++ b/data/format.go @@ -53,6 +53,7 @@ const ( NS_CHECK LedgerNamespace = 'C' NS_DEPOSIT_PREAUTH LedgerNamespace = 'p' NS_NEGATIVE_UNL LedgerNamespace = 'N' + NS_AMM LedgerNamespace = 'A' ) var nodeTypes = [...]string{ @@ -74,36 +75,53 @@ type enc struct { } const ( - ST_UINT16 uint8 = 1 - ST_UINT32 uint8 = 2 - ST_UINT64 uint8 = 3 - ST_HASH128 uint8 = 4 - ST_HASH256 uint8 = 5 - ST_AMOUNT uint8 = 6 - ST_VL uint8 = 7 - ST_ACCOUNT uint8 = 8 - ST_OBJECT uint8 = 14 - ST_ARRAY uint8 = 15 - ST_UINT8 uint8 = 16 - ST_HASH160 uint8 = 17 - ST_PATHSET uint8 = 18 - ST_VECTOR256 uint8 = 19 - ST_HASH96 uint8 = 20 - ST_HASH192 uint8 = 21 - ST_HASH384 uint8 = 22 - ST_HASH512 uint8 = 23 + ST_UINT16 uint8 = 1 + ST_UINT32 uint8 = 2 + ST_UINT64 uint8 = 3 + ST_HASH128 uint8 = 4 + ST_HASH256 uint8 = 5 + ST_AMOUNT uint8 = 6 + ST_VL uint8 = 7 + ST_ACCOUNT uint8 = 8 + ST_OBJECT uint8 = 14 + ST_ARRAY uint8 = 15 + ST_UINT8 uint8 = 16 + ST_HASH160 uint8 = 17 + ST_PATHSET uint8 = 18 + ST_VECTOR256 uint8 = 19 + ST_HASH96 uint8 = 20 + ST_HASH192 uint8 = 21 + ST_HASH384 uint8 = 22 + ST_HASH512 uint8 = 23 + ST_ISSUE uint8 = 24 + ST_XCHAIN_BRIDGE uint8 = 25 ) // See rippled's SField.cpp for the strings and corresponding encoding values. var encodings = map[enc]string{ + // 8-bit unsigned integers (common) + {ST_UINT8, 1}: "CloseResolution", + {ST_UINT8, 2}: "Method", + {ST_UINT8, 3}: "TransactionResult", + // 8-bit unsigned integers (uncommon) + {ST_UINT8, 16}: "TickSize", + {ST_UINT8, 17}: "UNLModifyDisabling", + {ST_UINT8, 18}: "HookResult", // 16-bit unsigned integers (common) {ST_UINT16, 1}: "LedgerEntryType", {ST_UINT16, 2}: "TransactionType", {ST_UINT16, 3}: "SignerWeight", {ST_UINT16, 4}: "TransferFee", + {ST_UINT16, 5}: "TradingFee", + {ST_UINT16, 6}: "DiscountedFee", // 16-bit unsigned integers (uncommon) {ST_UINT16, 16}: "Version", + {ST_UINT16, 17}: "HookStateChangeCount", + {ST_UINT16, 18}: "HookEmitCount", + {ST_UINT16, 19}: "HookExecutionIndex", + {ST_UINT16, 20}: "HookApiVersion", // 32-bit unsigned integers (common) + {ST_UINT32, 1}: "NetworkID", {ST_UINT32, 2}: "Flags", {ST_UINT32, 3}: "SourceTag", {ST_UINT32, 4}: "Sequence", @@ -147,6 +165,10 @@ var encodings = map[enc]string{ {ST_UINT32, 42}: "NFTokenTaxon", {ST_UINT32, 43}: "MintedNFTokens", {ST_UINT32, 44}: "BurnedNFTokens", + {ST_UINT32, 45}: "HookStateCount", + {ST_UINT32, 46}: "EmitGeneration", + {ST_UINT32, 48}: "VoteWeight", + {ST_UINT32, 50}: "FirstNFTokenSequence", // 64-bit unsigned integers (common) {ST_UINT64, 1}: "IndexNext", {ST_UINT64, 2}: "IndexPrevious", @@ -160,8 +182,21 @@ var encodings = map[enc]string{ {ST_UINT64, 10}: "Cookie", {ST_UINT64, 11}: "ServerVersion", {ST_UINT64, 12}: "NFTokenOfferNode", + {ST_UINT64, 13}: "EmitBurden", + // 64-bit unsigned integers (uncommon) + {ST_UINT64, 16}: "HookOn", + {ST_UINT64, 17}: "HookInstructionCount", + {ST_UINT64, 18}: "HookReturnCode", + {ST_UINT64, 19}: "ReferenceCount", // 128-bit (common) {ST_HASH128, 1}: "EmailHash", + + // 160-bit (common) + {ST_HASH160, 1}: "TakerPaysCurrency", + {ST_HASH160, 2}: "TakerPaysIssuer", + {ST_HASH160, 3}: "TakerGetsCurrency", + {ST_HASH160, 4}: "TakerGetsIssuer", + // 256-bit (common) {ST_HASH256, 1}: "LedgerHash", {ST_HASH256, 2}: "ParentHash", @@ -173,20 +208,30 @@ var encodings = map[enc]string{ {ST_HASH256, 8}: "RootIndex", {ST_HASH256, 9}: "AccountTxnID", {ST_HASH256, 10}: "NFTokenID", + {ST_HASH256, 11}: "EmitParentTxnID", + {ST_HASH256, 12}: "EmitNonce", + {ST_HASH256, 13}: "EmitHookHash", + {ST_HASH256, 14}: "AMMID", + // 256-bit (uncommon) {ST_HASH256, 16}: "BookDirectory", {ST_HASH256, 17}: "InvoiceID", {ST_HASH256, 18}: "Nickname", {ST_HASH256, 19}: "Amendment", - {ST_HASH256, 20}: "TicketID", + // {ST_HASH256, 20}: "TicketID", {ST_HASH256, 21}: "Digest", {ST_HASH256, 22}: "Channel", + {ST_HASH256, 22}: "ConsensusHash", {ST_HASH256, 24}: "CheckID", {ST_HASH256, 25}: "ValidatedHash", {ST_HASH256, 26}: "PreviousPageMin", {ST_HASH256, 27}: "NextPageMin", {ST_HASH256, 28}: "NFTokenBuyOffer", {ST_HASH256, 29}: "NFTokenSellOffer", + {ST_HASH256, 30}: "HookStateKey", + {ST_HASH256, 31}: "HookHash", + {ST_HASH256, 32}: "HookNamespace", + {ST_HASH256, 33}: "HookSetTxnID", // currency amount (common) {ST_AMOUNT, 1}: "Amount", {ST_AMOUNT, 2}: "Balance", @@ -198,11 +243,23 @@ var encodings = map[enc]string{ {ST_AMOUNT, 8}: "Fee", {ST_AMOUNT, 9}: "SendMax", {ST_AMOUNT, 10}: "DeliverMin", + {ST_AMOUNT, 11}: "Amount2", + {ST_AMOUNT, 12}: "BidMin", + {ST_AMOUNT, 13}: "BidMax", // currency amount (uncommon) {ST_AMOUNT, 16}: "MinimumOffer", {ST_AMOUNT, 17}: "RippleEscrow", {ST_AMOUNT, 18}: "DeliveredAmount", {ST_AMOUNT, 19}: "NFTokenBrokerFee", + {ST_AMOUNT, 22}: "BaseFeeDrops", + {ST_AMOUNT, 23}: "ReserveBaseDrops", + {ST_AMOUNT, 24}: "ReserveIncrementDrops", + {ST_AMOUNT, 25}: "LPTokenOut", + {ST_AMOUNT, 26}: "LPTokenIn", + {ST_AMOUNT, 27}: "EPrice", + {ST_AMOUNT, 28}: "Price", + {ST_AMOUNT, 31}: "LPTokenBalance", + // variable length (common) {ST_VL, 1}: "PublicKey", {ST_VL, 2}: "MessageKey", @@ -225,16 +282,33 @@ var encodings = map[enc]string{ {ST_VL, 19}: "UNLModifyValidator", {ST_VL, 20}: "ValidatorToDisable", {ST_VL, 21}: "ValidatorToReEnable", - // account - {ST_ACCOUNT, 1}: "Account", - {ST_ACCOUNT, 2}: "Owner", - {ST_ACCOUNT, 3}: "Destination", - {ST_ACCOUNT, 4}: "Issuer", - {ST_ACCOUNT, 5}: "Authorize", - {ST_ACCOUNT, 6}: "Unauthorize", - {ST_ACCOUNT, 7}: "Target", - {ST_ACCOUNT, 8}: "RegularKey", - {ST_ACCOUNT, 9}: "NFTokenMinter", + {ST_VL, 22}: "HookStateData", + {ST_VL, 23}: "HookReturnString", + {ST_VL, 24}: "HookParameterName", + {ST_VL, 25}: "HookParameterValue", + // account (common) + {ST_ACCOUNT, 1}: "Account", + {ST_ACCOUNT, 2}: "Owner", + {ST_ACCOUNT, 3}: "Destination", + {ST_ACCOUNT, 4}: "Issuer", + {ST_ACCOUNT, 5}: "Authorize", + {ST_ACCOUNT, 6}: "Unauthorize", + {ST_ACCOUNT, 7}: "Target", + {ST_ACCOUNT, 8}: "RegularKey", + {ST_ACCOUNT, 9}: "NFTokenMinter", + {ST_ACCOUNT, 10}: "EmitCallback", + // account (uncommon) + {ST_ACCOUNT, 16}: "HookAccount", + // vector of 256-bit + {ST_VECTOR256, 1}: "Indexes", + {ST_VECTOR256, 2}: "Hashes", + {ST_VECTOR256, 3}: "Amendments", + {ST_VECTOR256, 4}: "NFTokenOffers", + // path set + {ST_PATHSET, 1}: "Paths", + // issue + {ST_ISSUE, 3}: "Asset", + {ST_ISSUE, 4}: "Asset2", // inner object {ST_OBJECT, 1}: "EndOfObject", {ST_OBJECT, 2}: "TransactionMetaData", @@ -248,10 +322,20 @@ var encodings = map[enc]string{ {ST_OBJECT, 10}: "Memo", {ST_OBJECT, 11}: "SignerEntry", {ST_OBJECT, 12}: "NFToken", + {ST_OBJECT, 13}: "EmitDetails", + {ST_OBJECT, 14}: "Hook", // inner object (uncommon) {ST_OBJECT, 16}: "Signer", {ST_OBJECT, 18}: "Majority", {ST_OBJECT, 19}: "DisabledValidator", + {ST_OBJECT, 20}: "EmittedTxn", + {ST_OBJECT, 21}: "HookExecution", + {ST_OBJECT, 22}: "HookDefinition", + {ST_OBJECT, 23}: "HookParameter", + {ST_OBJECT, 24}: "HookGrant", + {ST_OBJECT, 25}: "VoteEntry", + {ST_OBJECT, 26}: "AuctionSlot", + {ST_OBJECT, 27}: "AuthAccount", // array of objects {ST_ARRAY, 1}: "EndOfArray", {ST_ARRAY, 2}: "SigningAccounts", @@ -263,28 +347,15 @@ var encodings = map[enc]string{ {ST_ARRAY, 8}: "AffectedNodes", {ST_ARRAY, 9}: "Memos", {ST_ARRAY, 10}: "NFTokens", + {ST_ARRAY, 11}: "Hooks", + {ST_ARRAY, 12}: "VoteSlots", // array of objects (uncommon) {ST_ARRAY, 16}: "Majorities", {ST_ARRAY, 17}: "DisabledValidators", - // 8-bit unsigned integers (common) - {ST_UINT8, 1}: "CloseResolution", - {ST_UINT8, 2}: "Method", - {ST_UINT8, 3}: "TransactionResult", - // 8-bit unsigned integers (uncommon) - {ST_UINT8, 16}: "TickSize", - {ST_UINT8, 17}: "UNLModifyDisabling", - // 160-bit (common) - {ST_HASH160, 1}: "TakerPaysCurrency", - {ST_HASH160, 2}: "TakerPaysIssuer", - {ST_HASH160, 3}: "TakerGetsCurrency", - {ST_HASH160, 4}: "TakerGetsIssuer", - // path set - {ST_PATHSET, 1}: "Paths", - // vector of 256-bit - {ST_VECTOR256, 1}: "Indexes", - {ST_VECTOR256, 2}: "Hashes", - {ST_VECTOR256, 3}: "Amendments", - {ST_VECTOR256, 4}: "NFTokenOffers", + {ST_ARRAY, 18}: "HookExecutions", + {ST_ARRAY, 19}: "HookParameters", + {ST_ARRAY, 20}: "HookGrants", + {ST_ARRAY, 25}: "AuthAccounts", } var reverseEncodings map[string]enc diff --git a/data/ledgerentry.go b/data/ledgerentry.go index 1fc9373..0af13b2 100644 --- a/data/ledgerentry.go +++ b/data/ledgerentry.go @@ -13,24 +13,25 @@ type leBase struct { type AccountRoot struct { leBase - Flags *LedgerEntryFlag `json:",omitempty"` - Account *Account `json:",omitempty"` - Sequence *uint32 `json:",omitempty"` - Balance *Value `json:",omitempty"` - OwnerCount *uint32 `json:",omitempty"` - AccountTxnID *Hash256 `json:",omitempty"` - RegularKey *RegularKey `json:",omitempty"` - EmailHash *Hash128 `json:",omitempty"` - WalletLocator *Hash256 `json:",omitempty"` - WalletSize *uint32 `json:",omitempty"` - MessageKey *VariableLength `json:",omitempty"` - TransferRate *uint32 `json:",omitempty"` - Domain *VariableLength `json:",omitempty"` - TickSize *uint8 `json:",omitempty"` - TicketCount *uint32 `json:",omitempty"` - NFTokenMinter *Account `json:",omitempty"` - MintedNFTokens *uint32 `json:",omitempty"` - BurnedNFTokens *uint32 `json:",omitempty"` + Flags *LedgerEntryFlag `json:",omitempty"` + Account *Account `json:",omitempty"` + Sequence *uint32 `json:",omitempty"` + Balance *Value `json:",omitempty"` + OwnerCount *uint32 `json:",omitempty"` + AccountTxnID *Hash256 `json:",omitempty"` + RegularKey *RegularKey `json:",omitempty"` + EmailHash *Hash128 `json:",omitempty"` + WalletLocator *Hash256 `json:",omitempty"` + WalletSize *uint32 `json:",omitempty"` + MessageKey *VariableLength `json:",omitempty"` + TransferRate *uint32 `json:",omitempty"` + Domain *VariableLength `json:",omitempty"` + TickSize *uint8 `json:",omitempty"` + TicketCount *uint32 `json:",omitempty"` + NFTokenMinter *Account `json:",omitempty"` + MintedNFTokens *uint32 `json:",omitempty"` + BurnedNFTokens *uint32 `json:",omitempty"` + FirstNFTokenSequence *uint32 `json:",omitempty"` } type RippleState struct { @@ -98,11 +99,14 @@ type Amendments struct { type FeeSettings struct { leBase - Flags *LedgerEntryFlag `json:",omitempty"` - BaseFee *Uint64Hex `json:",omitempty"` - ReferenceFeeUnits *uint32 `json:",omitempty"` - ReserveBase *uint32 `json:",omitempty"` - ReserveIncrement *uint32 `json:",omitempty"` + Flags *LedgerEntryFlag `json:",omitempty"` + BaseFee *Uint64Hex `json:",omitempty"` + ReferenceFeeUnits *uint32 `json:",omitempty"` + ReserveBase *uint32 `json:",omitempty"` + ReserveIncrement *uint32 `json:",omitempty"` + BaseFeeDrops *Amount `json:",omitempty"` + ReserveBaseDrops *Amount `json:",omitempty"` + ReserveIncrementDrops *Amount `json:",omitempty"` } type DisabledValidator struct { @@ -169,12 +173,12 @@ type PayChannel struct { Balance *Amount `json:",omitempty"` PublicKey *PublicKey `json:",omitempty"` SettleDelay *uint32 `json:",omitempty"` - OwnerNode *NodeIndex `json:",omitempty"` - DestinationNode *NodeIndex `json:",omitempty"` Expiration *uint32 `json:",omitempty"` CancelAfter *uint32 `json:",omitempty"` - DestinationTag *uint32 `json:",omitempty"` SourceTag *uint32 `json:",omitempty"` + DestinationTag *uint32 `json:",omitempty"` + OwnerNode *NodeIndex `json:",omitempty"` + DestinationNode *NodeIndex `json:",omitempty"` } type Check struct { @@ -182,14 +186,14 @@ type Check struct { Flags *LedgerEntryFlag `json:",omitempty"` Account *Account `json:",omitempty"` Destination *Account `json:",omitempty"` - OwnerNode *NodeIndex `json:",omitempty"` SendMax *Amount `json:",omitempty"` Sequence *uint32 `json:",omitempty"` + OwnerNode *NodeIndex `json:",omitempty"` DestinationNode *NodeIndex `json:",omitempty"` - DestinationTag *uint32 `json:",omitempty"` Expiration *uint32 `json:",omitempty"` - SourceTag *uint32 `json:",omitempty"` InvoiceID *Hash256 `json:",omitempty"` + SourceTag *uint32 `json:",omitempty"` + DestinationTag *uint32 `json:",omitempty"` } type DepositPreAuth struct { @@ -220,6 +224,31 @@ type NFTokenOffer struct { Expiration *uint32 `json:",omitempty"` } +type VoteEntry struct { + Account *Account `json:",omitempty"` + TradingFee *uint16 `json:",omitempty"` + VoteWeight *uint32 `json:",omitempty"` +} + +type AuctionSlot struct { + Account *Account `json:",omitempty"` + AuthAccounts []Account `json:",omitempty"` + DiscountedFee *uint32 `json:",omitempty"` + Price *Amount `json:",omitempty"` + Expiration *uint32 `json:",omitempty"` +} + +type AMM struct { + leBase + Account *Account `json:",omitempty"` + TradingFee *uint16 `json:",omitempty"` + VoteSlots []VoteEntry `json:",omitempty"` + AuctionSlot *AuctionSlot `json:",omitempty"` + Asset *Hash160 `json:",omitempty"` + Asset2 *Hash160 `json:",omitempty"` + OwnerNode *NodeIndex `json:",omitempty"` +} + func (a *AccountRoot) Affects(account Account) bool { return a.Account != nil && a.Account.Equals(account) } @@ -263,6 +292,10 @@ func (to *NFTokenOffer) Affects(account Account) bool { return (to.Owner != nil && to.Owner.Equals(account)) || (to.Destination != nil && to.Destination.Equals(account)) } +func (a *AMM) Affects(account Account) bool { + return a.Account.Equals(account) +} + func (le *leBase) GetType() string { return ledgerEntryNames[le.LedgerEntryType] } func (le *leBase) GetLedgerEntryType() LedgerEntryType { return le.LedgerEntryType } func (le *leBase) Prefix() HashPrefix { return HP_LEAF_NODE } diff --git a/data/transaction.go b/data/transaction.go index ca9fdf5..39b4435 100644 --- a/data/transaction.go +++ b/data/transaction.go @@ -81,6 +81,56 @@ type OfferCancel struct { TicketSequence *uint32 `json:",omitempty"` } +type AMMCreate struct { + TxBase + Amount Amount + Amount2 Amount + TradingFee uint16 +} + +type AMMDeposit struct { + TxBase + Asset Hash160 + Asset2 Hash160 + Amount *Amount `json:",omitempty"` + Amount2 *Amount `json:",omitempty"` + EPrice *Amount `json:",omitempty"` + LPTokenOut *Amount `json:",omitempty"` + TradingFee *uint16 `json:",omitempty"` +} + +type AMMWithdraw struct { + TxBase + Asset Hash160 + Asset2 Hash160 + Amount *Amount `json:",omitempty"` + Amount2 *Amount `json:",omitempty"` + EPrice *Amount `json:",omitempty"` + LPTokenIn *Amount `json:",omitempty"` +} + +type AMMVote struct { + TxBase + Asset Hash160 + Asset2 Hash160 + TradingFee uint16 +} + +type AMMBid struct { + TxBase + Asset Hash160 + Asset2 Hash160 + BidMin *Amount `json:",omitempty"` + BidMax *Amount `json:",omitempty"` + AuthAccounts []Account `json:",omitempty"` +} + +type AMMDelete struct { + TxBase + Asset Hash160 + Asset2 Hash160 +} + type TrustSet struct { TxBase LimitAmount Amount @@ -91,10 +141,13 @@ type TrustSet struct { type SetFee struct { TxBase - BaseFee Uint64Hex - ReferenceFeeUnits uint32 - ReserveBase uint32 - ReserveIncrement uint32 + BaseFee Uint64Hex + ReferenceFeeUnits uint32 + ReserveBase uint32 + ReserveIncrement uint32 + BaseFeeDrops *Amount `json:",omitempty"` + ReserveBaseDrops *Amount `json:",omitempty"` + ReserveIncrementDrops *Amount `json:",omitempty"` } type Amendment struct { diff --git a/websockets/remote.go b/websockets/remote.go index 07de57f..3f1aeee 100644 --- a/websockets/remote.go +++ b/websockets/remote.go @@ -23,7 +23,7 @@ const ( writeWait = 10 * time.Second // Time allowed to read the next pong message from the peer. - pongWait = 60 * time.Second + pongWait = 90 * time.Second // Send pings to peer with this period. Must be less than pongWait. pingPeriod = (pongWait * 9) / 10