github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/rpcclient/nep11/nondivisible.go (about) 1 package nep11 2 3 import ( 4 "github.com/nspcc-dev/neo-go/pkg/rpcclient/unwrap" 5 "github.com/nspcc-dev/neo-go/pkg/util" 6 ) 7 8 // NonDivisibleReader is a reader interface for non-divisble NEP-11 contract. 9 type NonDivisibleReader struct { 10 BaseReader 11 } 12 13 // NonDivisible is a state-changing interface for non-divisble NEP-11 contract. 14 type NonDivisible struct { 15 NonDivisibleReader 16 BaseWriter 17 } 18 19 // NewNonDivisibleReader creates an instance of NonDivisibleReader for a contract 20 // with the given hash using the given invoker. 21 func NewNonDivisibleReader(invoker Invoker, hash util.Uint160) *NonDivisibleReader { 22 return &NonDivisibleReader{*NewBaseReader(invoker, hash)} 23 } 24 25 // NewNonDivisible creates an instance of NonDivisible for a contract 26 // with the given hash using the given actor. 27 func NewNonDivisible(actor Actor, hash util.Uint160) *NonDivisible { 28 return &NonDivisible{*NewNonDivisibleReader(actor, hash), BaseWriter{hash, actor}} 29 } 30 31 // OwnerOf returns the owner of the given NFT. 32 func (t *NonDivisibleReader) OwnerOf(token []byte) (util.Uint160, error) { 33 return unwrap.Uint160(t.invoker.Call(t.hash, "ownerOf", token)) 34 }