diff --git a/model/client/path/nftoken_sell_offers_request.go b/model/client/path/nftoken_sell_offers_request.go index ed0790aa..38393581 100644 --- a/model/client/path/nftoken_sell_offers_request.go +++ b/model/client/path/nftoken_sell_offers_request.go @@ -32,6 +32,12 @@ func (r *NFTokenSellOffersRequest) UnmarshalJSON(data []byte) error { if err != nil { return err } + *r = NFTokenSellOffersRequest{ + NFTokenID: h.NFTokenID, + LedgerHash: h.LedgerHash, + Limit: h.Limit, + Marker: h.Marker, + } var i common.LedgerSpecifier i, err = common.UnmarshalLedgerSpecifier(h.LedgerIndex) if err != nil { diff --git a/model/client/path/nftoken_sell_offers_test.go b/model/client/path/nftoken_sell_offers_test.go new file mode 100644 index 00000000..024b6aa7 --- /dev/null +++ b/model/client/path/nftoken_sell_offers_test.go @@ -0,0 +1,53 @@ +package path + +import ( + "testing" + + "github.com/xyield/xrpl-go/model/client/common" + "github.com/xyield/xrpl-go/model/transactions/types" + "github.com/xyield/xrpl-go/test" +) + +func TestNFTokenSellOffersRequest(t *testing.T) { + s := NFTokenSellOffersRequest{ + NFTokenID: "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + LedgerIndex: common.VALIDATED, + } + + j := `{ + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + "ledger_index": "validated" +}` + if err := test.SerializeAndDeserialize(t, s, j); err != nil { + t.Error(err) + } +} + +func TestNFTokenSellOffersResponse(t *testing.T) { + s := NFTokenSellOffersResponse{ + NFTokenID: "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + Offers: []NFTokenOffer{ + { + Amount: types.XRPCurrencyAmount(1000), + Flags: 1, + NFTokenOfferIndex: "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1", + Owner: "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt", + }, + }, + } + + j := `{ + "nft_id": "00090000D0B007439B080E9B05BF62403911301A7B1F0CFAA048C0A200000007", + "offers": [ + { + "amount": "1000", + "flags": 1, + "nft_offer_index": "9E28E366573187F8E5B85CE301F229E061A619EE5A589EF740088F8843BF10A1", + "owner": "rLpSRZ1E8JHyNDZeHYsQs1R5cwDCB3uuZt" + } + ] +}` + if err := test.SerializeAndDeserialize(t, s, j); err != nil { + t.Error(err) + } +}