Skip to content

Commit

Permalink
sell test
Browse files Browse the repository at this point in the history
  • Loading branch information
CreatureDev committed Apr 11, 2023
1 parent 6e944eb commit bfd248f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
6 changes: 6 additions & 0 deletions model/client/path/nftoken_sell_offers_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
53 changes: 53 additions & 0 deletions model/client/path/nftoken_sell_offers_test.go
Original file line number Diff line number Diff line change
@@ -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)
}
}

0 comments on commit bfd248f

Please sign in to comment.