diff --git a/CHANGELOG.md b/CHANGELOG.md index 05c8e54..9202656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] +### Added + +- `AuthorizeBody` gains `MemoTag` (`memoTag`) — a Notabene extension (TAIP-4 + defines no memo-tag carriage) for the settlement memo/destination tag, as a + fallback to embedding it as a `:tag` suffix on `settlementAddress`. + ## [0.6.0] - 2026-07-08 ### Added diff --git a/authorize.go b/authorize.go index bc89670..95c1405 100644 --- a/authorize.go +++ b/authorize.go @@ -14,6 +14,7 @@ type AuthorizeBody struct { Type string `json:"@type"` SettlementAddress string `json:"settlementAddress,omitempty"` SettlementAsset string `json:"settlementAsset,omitempty"` + MemoTag string `json:"memoTag,omitempty"` Amount string `json:"amount,omitempty"` Expiry string `json:"expiry,omitempty"` ApprovedTypes []string `json:"approvedTypes,omitempty"` diff --git a/authorize_test.go b/authorize_test.go index 128fcdb..995499a 100644 --- a/authorize_test.go +++ b/authorize_test.go @@ -43,7 +43,8 @@ func TestAuthorizeBody_JSONRoundTrip(t *testing.T) { body := AuthorizeBody{ Context: TAPContext, Type: TypeAuthorize, - SettlementAddress: "eip155:1:0x1234", + SettlementAddress: "xrpl:0:rN7n3473SaZBCG4dFL83w7a1RXtXtbk2D8", + MemoTag: "998877", Amount: "100.00", } @@ -59,6 +60,23 @@ func TestAuthorizeBody_JSONRoundTrip(t *testing.T) { if got.SettlementAddress != body.SettlementAddress { t.Errorf("mismatch: %+v", got) } + if got.MemoTag != body.MemoTag { + t.Errorf("MemoTag mismatch: %+v", got) + } +} + +func TestAuthorizeBody_MemoTagOmittedWhenEmpty(t *testing.T) { + data, err := json.Marshal(AuthorizeBody{Context: TAPContext, Type: TypeAuthorize}) + if err != nil { + t.Fatalf("marshal: %v", err) + } + var raw map[string]json.RawMessage + if err := json.Unmarshal(data, &raw); err != nil { + t.Fatalf("unmarshal: %v", err) + } + if _, ok := raw["memoTag"]; ok { + t.Errorf("memoTag should be omitted when empty: %s", data) + } } func TestAuthorize_TestVectorValid(t *testing.T) {