From e890c32dccf352623b06292151e7bbf6302d997f Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Tue, 25 Jan 2022 12:40:19 +0300 Subject: [PATCH] rpc/client: remove dependency on `examples` Duplicate necessary structures in a dedicated micropackage. Signed-off-by: Evgeniy Stratonikov --- go.mod | 1 - go.sum | 4 +--- pkg/core/helper_test.go | 2 +- pkg/rpc/client/helper.go | 2 +- pkg/rpc/client/native.go | 2 +- pkg/rpc/client/nns/record.go | 27 +++++++++++++++++++++++++++ pkg/rpc/server/client_test.go | 2 +- 7 files changed, 32 insertions(+), 8 deletions(-) create mode 100644 pkg/rpc/client/nns/record.go diff --git a/go.mod b/go.mod index 711caa4aa..6ebabedb2 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/mr-tron/base58 v1.2.0 github.com/nspcc-dev/dbft v0.0.0-20210721160347-1b03241391ac github.com/nspcc-dev/go-ordered-json v0.0.0-20220111165707-25110be27d22 - github.com/nspcc-dev/neo-go/examples/nft-nd-nns v0.0.0-20220121072229-d19c0492d4d7 github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220120102126-25583f9aeb13 github.com/nspcc-dev/neofs-sdk-go v0.0.0-20220113123743-7f3162110659 github.com/nspcc-dev/rfc6979 v0.2.0 diff --git a/go.sum b/go.sum index 603070743..92c126018 100644 --- a/go.sum +++ b/go.sum @@ -186,11 +186,9 @@ github.com/nspcc-dev/hrw v1.0.9 h1:17VcAuTtrstmFppBjfRiia4K2wA/ukXZhLFS8Y8rz5Y= github.com/nspcc-dev/hrw v1.0.9/go.mod h1:l/W2vx83vMQo6aStyx2AuZrJ+07lGv2JQGlVkPG06MU= github.com/nspcc-dev/neo-go v0.73.1-pre.0.20200303142215-f5a1b928ce09/go.mod h1:pPYwPZ2ks+uMnlRLUyXOpLieaDQSEaf4NM3zHVbRjmg= github.com/nspcc-dev/neo-go v0.98.0/go.mod h1:E3cc1x6RXSXrJb2nDWXTXjnXk3rIqVN8YdFyWv+FrqM= -github.com/nspcc-dev/neo-go/examples/nft-nd-nns v0.0.0-20220121072229-d19c0492d4d7 h1:HJmUeYeJqLw4whSLXD4AINb0vJ+DcGSy6HYMIc3Bjs4= -github.com/nspcc-dev/neo-go/examples/nft-nd-nns v0.0.0-20220121072229-d19c0492d4d7/go.mod h1:yBgKeBQfR+2aKuBMn2owA6de6a2kvZ76odotquBcA4M= -github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220120102126-25583f9aeb13/go.mod h1:/zA6GVDzpSkwq8/HQJxPWDcvfn2BbZnahUO9A1wAevM= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220120102126-25583f9aeb13 h1:BxsNxxydtTVG8CsD5vc+h5w+ir0YMmoNOjX0MpvmAy8= github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220120102126-25583f9aeb13/go.mod h1:/zA6GVDzpSkwq8/HQJxPWDcvfn2BbZnahUO9A1wAevM= +github.com/nspcc-dev/neo-go/pkg/interop v0.0.0-20220120102126-25583f9aeb13/go.mod h1:/zA6GVDzpSkwq8/HQJxPWDcvfn2BbZnahUO9A1wAevM= github.com/nspcc-dev/neofs-api-go/v2 v2.11.0-pre.0.20211201134523-3604d96f3fe1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1 h1:SVqc523pZsSaS9vnPS1mm3VV6b6xY0gvdA0uYJ/GWZQ= github.com/nspcc-dev/neofs-api-go/v2 v2.11.1/go.mod h1:oS8dycEh8PPf2Jjp6+8dlwWyEv2Dy77h/XhhcdxYEFs= diff --git a/pkg/core/helper_test.go b/pkg/core/helper_test.go index e254dc3dc..f915d9264 100644 --- a/pkg/core/helper_test.go +++ b/pkg/core/helper_test.go @@ -13,7 +13,6 @@ import ( "testing" "time" - nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" "github.com/nspcc-dev/neo-go/internal/testchain" "github.com/nspcc-dev/neo-go/pkg/compiler" "github.com/nspcc-dev/neo-go/pkg/config" @@ -30,6 +29,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/encoding/fixedn" "github.com/nspcc-dev/neo-go/pkg/io" + "github.com/nspcc-dev/neo-go/pkg/rpc/client/nns" "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" "github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" diff --git a/pkg/rpc/client/helper.go b/pkg/rpc/client/helper.go index 0a7b0c0fa..ed0674786 100644 --- a/pkg/rpc/client/helper.go +++ b/pkg/rpc/client/helper.go @@ -5,8 +5,8 @@ import ( "errors" "fmt" - nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/rpc/client/nns" "github.com/nspcc-dev/neo-go/pkg/rpc/response/result" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/vm/stackitem" diff --git a/pkg/rpc/client/native.go b/pkg/rpc/client/native.go index ab36030c0..badab2a5a 100644 --- a/pkg/rpc/client/native.go +++ b/pkg/rpc/client/native.go @@ -6,10 +6,10 @@ import ( "errors" "fmt" - nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" "github.com/nspcc-dev/neo-go/pkg/core/native/noderoles" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" + "github.com/nspcc-dev/neo-go/pkg/rpc/client/nns" "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/util" ) diff --git a/pkg/rpc/client/nns/record.go b/pkg/rpc/client/nns/record.go new file mode 100644 index 000000000..8482e4ba9 --- /dev/null +++ b/pkg/rpc/client/nns/record.go @@ -0,0 +1,27 @@ +package nns + +// RecordState is a type that registered entities are saved to. +type RecordState struct { + Name string + Type RecordType + Data string +} + +// RecordType is domain name service record types. +type RecordType byte + +// Record types defined in [RFC 1035](https://tools.ietf.org/html/rfc1035) +const ( + // A represents address record type. + A RecordType = 1 + // CNAME represents canonical name record type. + CNAME RecordType = 5 + // TXT represents text record type. + TXT RecordType = 16 +) + +// Record types defined in [RFC 3596](https://tools.ietf.org/html/rfc3596) +const ( + // AAAA represents IPv6 address record type. + AAAA RecordType = 28 +) diff --git a/pkg/rpc/server/client_test.go b/pkg/rpc/server/client_test.go index 7b92eccac..8cc48633c 100644 --- a/pkg/rpc/server/client_test.go +++ b/pkg/rpc/server/client_test.go @@ -5,7 +5,6 @@ import ( "encoding/base64" "testing" - nns "github.com/nspcc-dev/neo-go/examples/nft-nd-nns" "github.com/nspcc-dev/neo-go/internal/testchain" "github.com/nspcc-dev/neo-go/pkg/core/fee" "github.com/nspcc-dev/neo-go/pkg/core/native/nativenames" @@ -15,6 +14,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/encoding/address" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/rpc/client" + "github.com/nspcc-dev/neo-go/pkg/rpc/client/nns" "github.com/nspcc-dev/neo-go/pkg/smartcontract" "github.com/nspcc-dev/neo-go/pkg/smartcontract/callflag" "github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"