From cea3dc255e26176b93e8de86753a35798e250a6e Mon Sep 17 00:00:00 2001 From: banasa44 Date: Wed, 16 Jul 2025 10:45:52 +0200 Subject: [PATCH 1/4] refactor(xrpl): remove unused SubmitBatchOptions struct from client_options.go --- xrpl/rpc/types/client_options.go | 7 ------- xrpl/websocket/types/client_options.go | 7 ------- 2 files changed, 14 deletions(-) diff --git a/xrpl/rpc/types/client_options.go b/xrpl/rpc/types/client_options.go index ca842ce9..1da09549 100644 --- a/xrpl/rpc/types/client_options.go +++ b/xrpl/rpc/types/client_options.go @@ -9,10 +9,3 @@ type SubmitOptions struct { Wallet *wallet.Wallet FailHard bool } - -type SubmitBatchOptions struct { - Autofill bool - Wallet *wallet.Wallet - FailHard bool - NSigners uint64 -} diff --git a/xrpl/websocket/types/client_options.go b/xrpl/websocket/types/client_options.go index ca842ce9..1da09549 100644 --- a/xrpl/websocket/types/client_options.go +++ b/xrpl/websocket/types/client_options.go @@ -9,10 +9,3 @@ type SubmitOptions struct { Wallet *wallet.Wallet FailHard bool } - -type SubmitBatchOptions struct { - Autofill bool - Wallet *wallet.Wallet - FailHard bool - NSigners uint64 -} From 808df05f202b9c04afddae00a1bb8320533e91d3 Mon Sep 17 00:00:00 2001 From: banasa44 Date: Wed, 16 Jul 2025 11:52:31 +0200 Subject: [PATCH 2/4] feat(xrpl): add PermissionedDomain ledger entry type --- xrpl/ledger-entry-types/ledger_object.go | 5 ++ .../ledger-entry-types/permissioned_domain.go | 63 ++++++++++++++++ .../permissioned_domain_test.go | 72 +++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 xrpl/ledger-entry-types/permissioned_domain.go create mode 100644 xrpl/ledger-entry-types/permissioned_domain_test.go diff --git a/xrpl/ledger-entry-types/ledger_object.go b/xrpl/ledger-entry-types/ledger_object.go index 143f6abb..28d379b0 100644 --- a/xrpl/ledger-entry-types/ledger_object.go +++ b/xrpl/ledger-entry-types/ledger_object.go @@ -27,6 +27,7 @@ const ( OfferEntry EntryType = "Offer" OracleEntry EntryType = "Oracle" PayChannelEntry EntryType = "PayChannel" + PermissionedDomainEntry EntryType = "PermissionedDomain" RippleStateEntry EntryType = "RippleState" SignerListEntry EntryType = "SignerList" TicketEntry EntryType = "Ticket" @@ -84,6 +85,8 @@ func EmptyLedgerObject(t string) (Object, error) { return &Oracle{}, nil case PayChannelEntry: return &PayChannel{}, nil + case PermissionedDomainEntry: + return &PermissionedDomain{}, nil case RippleStateEntry: return &RippleState{}, nil case SignerListEntry: @@ -147,6 +150,8 @@ func UnmarshalLedgerObject(data []byte) (Object, error) { o = &Oracle{} case PayChannelEntry: o = &PayChannel{} + case PermissionedDomainEntry: + o = &PermissionedDomain{} case RippleStateEntry: o = &RippleState{} case SignerListEntry: diff --git a/xrpl/ledger-entry-types/permissioned_domain.go b/xrpl/ledger-entry-types/permissioned_domain.go new file mode 100644 index 00000000..e0d9de2d --- /dev/null +++ b/xrpl/ledger-entry-types/permissioned_domain.go @@ -0,0 +1,63 @@ +package ledger + +import "github.com/Peersyst/xrpl-go/xrpl/transaction/types" + +// A PermissionedDomain ledger entry describes a single permissioned domain instance. +// You can create a permissioned domain by sending a PermissionedDomainSet transaction. +// +// ```json +// +// { +// "LedgerEntryType": "PermissionedDomain", +// "Fee": "10", +// "Flags": 0, +// "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", +// "OwnerNode": "0000000000000000", +// "Sequence": 390, +// "AcceptedCredentials": [ +// { +// "Credential": { +// "Issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", +// "CredentialType": "6D795F63726564656E7469616C" +// } +// } +// ], +// "PreviousTxnID": "E7E3F2BBAAF48CF893896E48DC4A02BDA0C747B198D5AE18BC3D7567EE64B904", +// "PreviousTxnLgrSeq": 8734523, +// "index": "3DFA1DDEA27AF7E466DE395CCB16158E07ECA6BC4EB5580F75EBD39DE833645F" +// } +// +// ``` + +type PermissionedDomain struct { + // The unique ID for this ledger entry. + // In JSON, this field is represented with different names depending on the context and API method. + // (Note, even though this is specified as "optional" in the code, every ledger entry should have one unless it's legacy data from very early in the XRP Ledger's history.) + Index types.Hash256 `json:"index,omitempty"` + // The value 0x0082, mapped to the string PermissionedDomain, indicates that this is a PermissionedDomain ledger entry. + LedgerEntryType EntryType + // Fee is the transaction cost, in drops of XRP, that was paid by the + // PermissionedDomainSet transaction which created or most recently modified + // this PermissionedDomain ledger entry. + Fee types.XRPCurrencyAmount + // Set of bit-flags for this ledger entry. + Flags uint32 + // The address of the account that owns this domain. + Owner types.Address + // A hint indicating which page of the owner directory links to this entry, + // in case the directory consists of multiple pages. + OwnerNode string + // The Sequence value of the transaction that created this entry. + Sequence uint32 + // A list of 1 to 10 Credential objects that grant access to this domain. + // The array is stored sorted by issuer. + AcceptedCredentials types.AuthorizeCredentialList + // The identifying hash of the transaction that most recently modified this entry. + PreviousTxnID types.Hash256 + // The index of the ledger that contains the transaction that most recently modified this object. + PreviousTxnLgrSeq uint32 +} + +func (*PermissionedDomain) EntryType() EntryType { + return PermissionedDomainEntry +} diff --git a/xrpl/ledger-entry-types/permissioned_domain_test.go b/xrpl/ledger-entry-types/permissioned_domain_test.go new file mode 100644 index 00000000..f4f49747 --- /dev/null +++ b/xrpl/ledger-entry-types/permissioned_domain_test.go @@ -0,0 +1,72 @@ +package ledger + +import ( + "testing" + + "github.com/Peersyst/xrpl-go/xrpl/testutil" + "github.com/Peersyst/xrpl-go/xrpl/transaction/types" + "github.com/stretchr/testify/require" +) + +func TestPermissionedDomain_EntryType(t *testing.T) { + permissionedDomain := &PermissionedDomain{} + require.Equal(t, permissionedDomain.EntryType(), PermissionedDomainEntry) +} + +func TestPermissionedDomain(t *testing.T) { + + tests := []struct { + name string + permissionedDomain *PermissionedDomain + expected string + }{ + { + name: "pass - valid PermissionedDomain", + permissionedDomain: &PermissionedDomain{ + Index: types.Hash256("3DFA1DDEA27AF7E466DE395CCB16158E07ECA6BC4EB5580F75EBD39DE833645F"), + LedgerEntryType: PermissionedDomainEntry, + Fee: types.XRPCurrencyAmount(10), + Flags: 0, + Owner: types.Address("rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"), + OwnerNode: "0000000000000000", + Sequence: 390, + AcceptedCredentials: types.AuthorizeCredentialList{ + { + Credential: types.Credential{ + Issuer: types.Address("ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"), + CredentialType: types.CredentialType("6D795F63726564656E7469616C"), + }, + }, + }, + PreviousTxnID: types.Hash256("E7E3F2BBAAF48CF893896E48DC4A02BDA0C747B198D5AE18BC3D7567EE64B904"), + PreviousTxnLgrSeq: 8734523, + }, + expected: `{ + "index": "3DFA1DDEA27AF7E466DE395CCB16158E07ECA6BC4EB5580F75EBD39DE833645F", + "LedgerEntryType": "PermissionedDomain", + "Fee": "10", + "Flags": 0, + "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "OwnerNode": "0000000000000000", + "Sequence": 390, + "AcceptedCredentials": [ + { + "Credential": { + "Issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "CredentialType": "6D795F63726564656E7469616C" + } + } + ], + "PreviousTxnID": "E7E3F2BBAAF48CF893896E48DC4A02BDA0C747B198D5AE18BC3D7567EE64B904", + "PreviousTxnLgrSeq": 8734523 +}`, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if err := testutil.SerializeAndDeserialize(t, test.permissionedDomain, test.expected); err != nil { + t.Error(err) + } + }) + } +} From f0f6598c03203ab0899a9d34515d67783ba23abd Mon Sep 17 00:00:00 2001 From: banasa44 Date: Wed, 16 Jul 2025 12:02:26 +0200 Subject: [PATCH 3/4] chore(changelog): add PermissionedDomain ledger entry type --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3c8b633..d27abef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +#### xrpl + +- Adds `PermissionedDomain` ledger entry type (XLS-80d). + ## [v0.1.11] ### BREAKING CHANGES From 207d9c2d6e9edbdbed6e7ac3dfc78e0e4de25c26 Mon Sep 17 00:00:00 2001 From: banasa44 Date: Thu, 17 Jul 2025 11:16:00 +0200 Subject: [PATCH 4/4] feat(xrpl): add Flatten method and corresponding tests for PermissionedDomain --- .../ledger-entry-types/permissioned_domain.go | 18 ++++++ .../permissioned_domain_test.go | 57 +++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/xrpl/ledger-entry-types/permissioned_domain.go b/xrpl/ledger-entry-types/permissioned_domain.go index e0d9de2d..a7178022 100644 --- a/xrpl/ledger-entry-types/permissioned_domain.go +++ b/xrpl/ledger-entry-types/permissioned_domain.go @@ -61,3 +61,21 @@ type PermissionedDomain struct { func (*PermissionedDomain) EntryType() EntryType { return PermissionedDomainEntry } + +func (p *PermissionedDomain) Flatten() FlatLedgerObject { + flattened := make(FlatLedgerObject) + if p.Index.String() != "" { + flattened["index"] = p.Index.String() + } + flattened["LedgerEntryType"] = p.LedgerEntryType + flattened["Fee"] = p.Fee.Flatten() + flattened["Flags"] = p.Flags + flattened["Owner"] = p.Owner.String() + flattened["OwnerNode"] = p.OwnerNode + flattened["Sequence"] = p.Sequence + flattened["AcceptedCredentials"] = p.AcceptedCredentials.Flatten() + flattened["PreviousTxnID"] = p.PreviousTxnID.String() + flattened["PreviousTxnLgrSeq"] = p.PreviousTxnLgrSeq + + return flattened +} diff --git a/xrpl/ledger-entry-types/permissioned_domain_test.go b/xrpl/ledger-entry-types/permissioned_domain_test.go index f4f49747..c5346fd5 100644 --- a/xrpl/ledger-entry-types/permissioned_domain_test.go +++ b/xrpl/ledger-entry-types/permissioned_domain_test.go @@ -70,3 +70,60 @@ func TestPermissionedDomain(t *testing.T) { }) } } + +func TestPermissionedDomain_Flatten(t *testing.T) { + tests := []struct { + name string + permissionedDomain *PermissionedDomain + expected string + }{ + { + name: "pass - valid PermissionedDomain", + permissionedDomain: &PermissionedDomain{ + Index: types.Hash256("3DFA1DDEA27AF7E466DE395CCB16158E07ECA6BC4EB5580F75EBD39DE833645F"), + LedgerEntryType: PermissionedDomainEntry, + Fee: types.XRPCurrencyAmount(10), + Flags: 0, + Owner: types.Address("rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"), + OwnerNode: "0000000000000000", + Sequence: 390, + AcceptedCredentials: types.AuthorizeCredentialList{ + { + Credential: types.Credential{ + Issuer: types.Address("ra5nK24KXen9AHvsdFTKHSANinZseWnPcX"), + CredentialType: types.CredentialType("6D795F63726564656E7469616C"), + }, + }, + }, + PreviousTxnID: types.Hash256("E7E3F2BBAAF48CF893896E48DC4A02BDA0C747B198D5AE18BC3D7567EE64B904"), + PreviousTxnLgrSeq: 8734523, + }, + expected: `{ + "index": "3DFA1DDEA27AF7E466DE395CCB16158E07ECA6BC4EB5580F75EBD39DE833645F", + "LedgerEntryType": "PermissionedDomain", + "Fee": "10", + "Flags": 0, + "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", + "OwnerNode": "0000000000000000", + "Sequence": 390, + "AcceptedCredentials": [ + { + "Credential": { + "Issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX", + "CredentialType": "6D795F63726564656E7469616C" + } + } + ], + "PreviousTxnID": "E7E3F2BBAAF48CF893896E48DC4A02BDA0C747B198D5AE18BC3D7567EE64B904", + "PreviousTxnLgrSeq": 8734523 + }`, + }, + } + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + if err := testutil.CompareFlattenAndExpected(test.permissionedDomain.Flatten(), []byte(test.expected)); err != nil { + t.Error(err) + } + }) + } +}