Skip to content

Commit

Permalink
rpcsrv: add NEP24 test
Browse files Browse the repository at this point in the history
Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Nov 8, 2024
1 parent 5d74df7 commit b49d9b6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/services/rpcsrv/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/rpcclient/neo"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep11"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep17"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nep24"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/neptoken"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/nns"
"github.com/nspcc-dev/neo-go/pkg/rpcclient/notary"
Expand Down Expand Up @@ -2460,3 +2461,26 @@ func TestClient_GetVersion_Hardforks(t *testing.T) {
}
require.InDeltaMapValues(t, expected, v.Protocol.Hardforks, 0)
}

func TestClient_NEP24(t *testing.T) {
_, _, httpSrv := initServerWithInMemoryChain(t)

c, err := rpcclient.New(context.Background(), httpSrv.URL, rpcclient.Options{})
require.NoError(t, err)
t.Cleanup(c.Close)
require.NoError(t, c.Init())

h, err := util.Uint160DecodeStringLE(nfsoContractHash)
require.NoError(t, err)
id, err := util.Uint160DecodeStringLE(nfsoToken1ID)
require.NoError(t, err)
reader := nep24.RoyaltyReader{Invoker: invoker.New(c, nil), Hash: h}

t.Run("RoyaltyInfo", func(t *testing.T) {
info, err := reader.RoyaltyInfo(id.BytesBE(), h, big.NewInt(1000))
require.NoError(t, err)
for _, r := range info {
require.Equal(t, big.NewInt(100), r.Amount)
}
})
}

0 comments on commit b49d9b6

Please sign in to comment.