diff --git a/client/client.go b/client/client.go index 79141e1bd..53cf38aeb 100644 --- a/client/client.go +++ b/client/client.go @@ -20,9 +20,9 @@ import ( "context" "log" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) type Client interface { diff --git a/doc.go b/doc.go index d0b2953fa..e49b3dd76 100644 --- a/doc.go +++ b/doc.go @@ -36,15 +36,15 @@ In order to sign extrinsics, you need to have [subkey](https://github.com/parity Types -The package [types](https://godoc.org/github.com/centrifuge/go-substrate-rpc-client/v2/types/) exports a number +The package [types](https://godoc.org/github.com/snowfork/go-substrate-rpc-client/v2/types/) exports a number of useful basic types including functions for encoding and decoding them. To use your own custom types, you can simply create structs and arrays composing those basic types. Here are some examples using composition of a mix of these basic and builtin Go types: -1. Vectors, lists, series, sets, arrays, slices: https://godoc.org/github.com/centrifuge/go-substrate-rpc-client/v2/types/#example_Vec_simple +1. Vectors, lists, series, sets, arrays, slices: https://godoc.org/github.com/snowfork/go-substrate-rpc-client/v2/types/#example_Vec_simple -2. Structs: https://godoc.org/github.com/centrifuge/go-substrate-rpc-client/v2/types/#example_Struct_simple +2. Structs: https://godoc.org/github.com/snowfork/go-substrate-rpc-client/v2/types/#example_Struct_simple There are some caveats though that you should be aware of: @@ -56,6 +56,6 @@ methods that implement the Encodeable/Decodeable interfaces. Examples for that a types, you can find reference implementations of those here: types/enum_test.go , types/tuple_test.go and types/vec_any_test.go -For more information about the types sub-package, see https://godoc.org/github.com/centrifuge/go-substrate-rpc-client/v2/types +For more information about the types sub-package, see https://godoc.org/github.com/snowfork/go-substrate-rpc-client/v2/types */ package gsrpc diff --git a/go.mod b/go.mod index a3a423da6..35139fe86 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/centrifuge/go-substrate-rpc-client/v2 +module github.com/snowfork/go-substrate-rpc-client/v2 go 1.15 diff --git a/go.sum b/go.sum index 2ca75f764..689c8e52b 100644 --- a/go.sum +++ b/go.sum @@ -43,6 +43,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI= github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/main.go b/main.go index f7f989872..59d5f0db5 100644 --- a/main.go +++ b/main.go @@ -17,8 +17,8 @@ package gsrpc import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpc" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc" ) type SubstrateAPI struct { diff --git a/main_test.go b/main_test.go index 48be7fee8..8bd1d8546 100644 --- a/main_test.go +++ b/main_test.go @@ -21,10 +21,10 @@ import ( "math/big" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func Example_simpleConnect() { @@ -235,12 +235,12 @@ func Example_makeASimpleTransfer() { nonce := uint32(accountInfo.Nonce) o := types.SignatureOptions{ - BlockHash: genesisHash, - Era: types.ExtrinsicEra{IsMortalEra: false}, - GenesisHash: genesisHash, - Nonce: types.NewUCompactFromUInt(uint64(nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: genesisHash, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: genesisHash, + Nonce: types.NewUCompactFromUInt(uint64(nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), TransactionVersion: rv.TransactionVersion, } @@ -449,12 +449,12 @@ func Example_transactionWithEvents() { nonce := uint32(accountInfo.Nonce) o := types.SignatureOptions{ - BlockHash: genesisHash, - Era: types.ExtrinsicEra{IsMortalEra: false}, - GenesisHash: genesisHash, - Nonce: types.NewUCompactFromUInt(uint64(nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: genesisHash, + Era: types.ExtrinsicEra{IsMortalEra: false}, + GenesisHash: genesisHash, + Nonce: types.NewUCompactFromUInt(uint64(nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), TransactionVersion: rv.TransactionVersion, } diff --git a/rpc/author/author.go b/rpc/author/author.go index 6871b9ea1..1bf1b9cfb 100644 --- a/rpc/author/author.go +++ b/rpc/author/author.go @@ -16,7 +16,7 @@ package author -import "github.com/centrifuge/go-substrate-rpc-client/v2/client" +import "github.com/snowfork/go-substrate-rpc-client/v2/client" // Author exposes methods for authoring of network items type Author struct { diff --git a/rpc/author/author_test.go b/rpc/author/author_test.go index 1ee98d800..608f93414 100644 --- a/rpc/author/author_test.go +++ b/rpc/author/author_test.go @@ -20,8 +20,8 @@ import ( "os" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpcmocksrv" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpcmocksrv" ) var author *Author diff --git a/rpc/author/pending_extrinsics.go b/rpc/author/pending_extrinsics.go index 2aa5954d5..5f2b67485 100644 --- a/rpc/author/pending_extrinsics.go +++ b/rpc/author/pending_extrinsics.go @@ -17,7 +17,7 @@ package author import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // PendingExtrinsics returns all pending extrinsics, potentially grouped by sender diff --git a/rpc/author/pending_extrinsics_test.go b/rpc/author/pending_extrinsics_test.go index 9db414db2..3489b6aee 100644 --- a/rpc/author/pending_extrinsics_test.go +++ b/rpc/author/pending_extrinsics_test.go @@ -19,7 +19,7 @@ package author import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/author/submit_and_watch_extrinsic.go b/rpc/author/submit_and_watch_extrinsic.go index 6d0b8480b..176e75acc 100644 --- a/rpc/author/submit_and_watch_extrinsic.go +++ b/rpc/author/submit_and_watch_extrinsic.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // ExtrinsicStatusSubscription is a subscription established through one of the Client's subscribe methods. diff --git a/rpc/author/submit_extrinsic.go b/rpc/author/submit_extrinsic.go index 6bb7d9314..df8b60bbe 100644 --- a/rpc/author/submit_extrinsic.go +++ b/rpc/author/submit_extrinsic.go @@ -16,7 +16,7 @@ package author -import "github.com/centrifuge/go-substrate-rpc-client/v2/types" +import "github.com/snowfork/go-substrate-rpc-client/v2/types" // SubmitExtrinsic will submit a fully formatted extrinsic for block inclusion func (a *Author) SubmitExtrinsic(xt types.Extrinsic) (types.Hash, error) { diff --git a/rpc/author/submit_extrinsic_test.go b/rpc/author/submit_extrinsic_test.go index f214af54f..657fa6d1a 100644 --- a/rpc/author/submit_extrinsic_test.go +++ b/rpc/author/submit_extrinsic_test.go @@ -19,7 +19,7 @@ package author import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/chain/chain.go b/rpc/chain/chain.go index f12ca0590..bac93dba9 100644 --- a/rpc/chain/chain.go +++ b/rpc/chain/chain.go @@ -17,7 +17,7 @@ package chain import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/client" ) // Chain exposes methods for retrieval of chain data diff --git a/rpc/chain/chain_test.go b/rpc/chain/chain_test.go index 80a839bdf..dd0a48fd2 100644 --- a/rpc/chain/chain_test.go +++ b/rpc/chain/chain_test.go @@ -20,9 +20,9 @@ import ( "os" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpcmocksrv" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpcmocksrv" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var chain *Chain diff --git a/rpc/chain/get_block.go b/rpc/chain/get_block.go index bb6f787ab..827362726 100644 --- a/rpc/chain/get_block.go +++ b/rpc/chain/get_block.go @@ -17,8 +17,8 @@ package chain import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetBlock returns the header and body of the relay chain block with the given hash diff --git a/rpc/chain/get_block_hash.go b/rpc/chain/get_block_hash.go index 3089b438c..5b83e1481 100644 --- a/rpc/chain/get_block_hash.go +++ b/rpc/chain/get_block_hash.go @@ -17,7 +17,7 @@ package chain import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetBlockHash returns the block hash for a specific block height diff --git a/rpc/chain/get_block_hash_test.go b/rpc/chain/get_block_hash_test.go index fb341b5e9..c400fd1a9 100644 --- a/rpc/chain/get_block_hash_test.go +++ b/rpc/chain/get_block_hash_test.go @@ -19,7 +19,7 @@ package chain import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/chain/get_finalized_head.go b/rpc/chain/get_finalized_head.go index 71bcde007..76ec9be56 100644 --- a/rpc/chain/get_finalized_head.go +++ b/rpc/chain/get_finalized_head.go @@ -17,7 +17,7 @@ package chain import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetFinalizedHead returns the hash of the last finalized block in the canon chain diff --git a/rpc/chain/get_finalized_head_test.go b/rpc/chain/get_finalized_head_test.go index ebd03bbf5..0abcfc2c4 100644 --- a/rpc/chain/get_finalized_head_test.go +++ b/rpc/chain/get_finalized_head_test.go @@ -19,7 +19,7 @@ package chain import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/chain/get_header.go b/rpc/chain/get_header.go index 78867b85e..daf712177 100644 --- a/rpc/chain/get_header.go +++ b/rpc/chain/get_header.go @@ -17,8 +17,8 @@ package chain import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetHeader retrieves the header for the specific block diff --git a/rpc/chain/subscribe_finalized_heads.go b/rpc/chain/subscribe_finalized_heads.go index dd08895cf..4cbb5bca8 100644 --- a/rpc/chain/subscribe_finalized_heads.go +++ b/rpc/chain/subscribe_finalized_heads.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // FinalizedHeadsSubscription is a subscription established through one of the Client's subscribe methods. diff --git a/rpc/chain/subscribe_new_heads.go b/rpc/chain/subscribe_new_heads.go index c9ed0e5a9..cd7f9523c 100644 --- a/rpc/chain/subscribe_new_heads.go +++ b/rpc/chain/subscribe_new_heads.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // NewHeadsSubscription is a subscription established through one of the Client's subscribe methods. diff --git a/rpc/main.go b/rpc/main.go index 048429837..eeb9a257a 100644 --- a/rpc/main.go +++ b/rpc/main.go @@ -17,20 +17,24 @@ package rpc import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpc/author" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpc/chain" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpc/state" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpc/system" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/author" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/chain" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/mmr" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/offchain" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/state" + "github.com/snowfork/go-substrate-rpc-client/v2/rpc/system" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) type RPC struct { - Author *author.Author - Chain *chain.Chain - State *state.State - System *system.System - client client.Client + Author *author.Author + Chain *chain.Chain + MMR *mmr.MMR + Offchain *offchain.Offchain + State *state.State + System *system.System + client client.Client } func NewRPC(cl client.Client) (*RPC, error) { @@ -44,10 +48,12 @@ func NewRPC(cl client.Client) (*RPC, error) { types.SetSerDeOptions(opts) return &RPC{ - Author: author.NewAuthor(cl), - Chain: chain.NewChain(cl), - State: st, - System: system.NewSystem(cl), - client: cl, + Author: author.NewAuthor(cl), + Chain: chain.NewChain(cl), + MMR: mmr.NewMMR(cl), + Offchain: offchain.NewOffchain(cl), + State: st, + System: system.NewSystem(cl), + client: cl, }, nil } diff --git a/rpc/mmr/generate_proof.go b/rpc/mmr/generate_proof.go new file mode 100644 index 000000000..0805568b3 --- /dev/null +++ b/rpc/mmr/generate_proof.go @@ -0,0 +1,27 @@ +package mmr + +import ( + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" +) + +// GenerateProof retrieves a MMR proof and leaf for the specified leave index, at the given blockHash (useful to query a +// proof at an earlier block, likely with antoher MMR root) +func (c *MMR) GenerateProof(leafIndex uint64, blockHash types.Hash) (types.GenerateMMRProofResponse, error) { + return c.generateProof(leafIndex, &blockHash) +} + +// GenerateProofLatest retrieves the latest MMR proof and leaf for the specified leave index +func (c *MMR) GenerateProofLatest(leafIndex uint64) (types.GenerateMMRProofResponse, error) { + return c.generateProof(leafIndex, nil) +} + +func (c *MMR) generateProof(leafIndex uint64, blockHash *types.Hash) (types.GenerateMMRProofResponse, error) { + var res types.GenerateMMRProofResponse + err := client.CallWithBlockHash(c.client, &res, "mmr_generateProof", blockHash, leafIndex) + if err != nil { + return types.GenerateMMRProofResponse{}, err + } + + return res, nil +} diff --git a/rpc/mmr/mmr.go b/rpc/mmr/mmr.go new file mode 100644 index 000000000..f02bf24a7 --- /dev/null +++ b/rpc/mmr/mmr.go @@ -0,0 +1,13 @@ +package mmr + +import "github.com/snowfork/go-substrate-rpc-client/v2/client" + +// MMR exposes methods for retrieval of MMR data +type MMR struct { + client client.Client +} + +// NewMMR creates a new MMR struct +func NewMMR(c client.Client) *MMR { + return &MMR{client: c} +} diff --git a/rpc/offchain/get_local_storage.go b/rpc/offchain/get_local_storage.go new file mode 100644 index 000000000..ec2d167ff --- /dev/null +++ b/rpc/offchain/get_local_storage.go @@ -0,0 +1,51 @@ +package offchain + +import ( + "fmt" + + "github.com/snowfork/go-substrate-rpc-client/v2/types" +) + +// StorageKind ... +type StorageKind string + +const ( + // Persistent storage + Persistent StorageKind = "PERSISTENT" + // Local storage + Local StorageKind = "LOCAL" +) + +// LocalStorageGet retrieves the stored data +func (c *Offchain) LocalStorageGet(kind StorageKind, key []byte) (*types.StorageDataRaw, error) { + var res string + + err := c.client.Call(&res, "offchain_localStorageGet", kind, fmt.Sprintf("%#x", key)) + if err != nil { + return nil, err + } + + if len(res) == 0 { + return nil, nil + } + + b, err := types.HexDecodeString(res) + if err != nil { + return nil, err + } + + data := types.NewStorageDataRaw(b) + return &data, nil +} + +// LocalStorageSet saves the data +func (c *Offchain) LocalStorageSet(kind StorageKind, key []byte, value []byte) error { + var res string + + err := c.client.Call(&res, "offchain_localStorageSet", kind, fmt.Sprintf("%#x", key), value) + if err != nil { + return err + } + + return nil +} diff --git a/rpc/offchain/get_local_storage_test.go b/rpc/offchain/get_local_storage_test.go new file mode 100644 index 000000000..a73562f5c --- /dev/null +++ b/rpc/offchain/get_local_storage_test.go @@ -0,0 +1,13 @@ +package offchain + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestOffchain_LocalStorageGet(t *testing.T) { + data, err := offchain.LocalStorageGet(Persistent, []byte("foo")) + assert.NoError(t, err) + assert.Equal(t, mockSrv.storageValueHex, data.Hex()) +} diff --git a/rpc/offchain/offchain.go b/rpc/offchain/offchain.go new file mode 100644 index 000000000..58dd40a09 --- /dev/null +++ b/rpc/offchain/offchain.go @@ -0,0 +1,13 @@ +package offchain + +import "github.com/snowfork/go-substrate-rpc-client/v2/client" + +// Offchain exposes methods for retrieval of off-chain data +type Offchain struct { + client client.Client +} + +// NewOffchain creates a new Offchain struct +func NewOffchain(c client.Client) *Offchain { + return &Offchain{client: c} +} diff --git a/rpc/offchain/offchain_test.go b/rpc/offchain/offchain_test.go new file mode 100644 index 000000000..661d08aa1 --- /dev/null +++ b/rpc/offchain/offchain_test.go @@ -0,0 +1,46 @@ +package offchain + +import ( + "os" + "testing" + + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpcmocksrv" +) + +var offchain *Offchain + +func TestMain(m *testing.M) { + s := rpcmocksrv.New() + err := s.RegisterName("offchain", &mockSrv) + if err != nil { + panic(err) + } + + cl, err := client.Connect(s.URL) + // cl, err := client.Connect(config.Default().RPCURL) + if err != nil { + panic(err) + } + offchain = NewOffchain(cl) + + os.Exit(m.Run()) +} + +// MockSrv holds data and methods exposed by the RPC Mock Server used in integration tests +type MockSrv struct { + storageKeyHex string + storageValueHex string +} + +func (s *MockSrv) LocalStorageGet(kind string, key string) string { + if key != s.storageKeyHex { + return "" + } + return mockSrv.storageValueHex +} + +var mockSrv = MockSrv{ + storageKeyHex: "0x666f6f", + storageValueHex: "0xdeadbeef", //nolint:lll +} diff --git a/rpc/state/get_child_keys.go b/rpc/state/get_child_keys.go index e063ba6eb..0d99fa5ab 100644 --- a/rpc/state/get_child_keys.go +++ b/rpc/state/get_child_keys.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetChildKeys retreives the keys with the given prefix of a specific child storage diff --git a/rpc/state/get_child_keys_test.go b/rpc/state/get_child_keys_test.go index 6186f072c..6bc0231c7 100644 --- a/rpc/state/get_child_keys_test.go +++ b/rpc/state/get_child_keys_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_child_storage.go b/rpc/state/get_child_storage.go index b3af91089..81dd66915 100644 --- a/rpc/state/get_child_storage.go +++ b/rpc/state/get_child_storage.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetChildStorage retreives the child storage for a key and decodes them into the provided interface. Ok is true if the diff --git a/rpc/state/get_child_storage_hash.go b/rpc/state/get_child_storage_hash.go index 7d5e5aa19..03d8f8c34 100644 --- a/rpc/state/get_child_storage_hash.go +++ b/rpc/state/get_child_storage_hash.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetChildStorageHash retreives the child storage hash for the given key diff --git a/rpc/state/get_child_storage_hash_test.go b/rpc/state/get_child_storage_hash_test.go index cba587003..df352983e 100644 --- a/rpc/state/get_child_storage_hash_test.go +++ b/rpc/state/get_child_storage_hash_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_child_storage_size.go b/rpc/state/get_child_storage_size.go index 230478fb2..8166a09e9 100644 --- a/rpc/state/get_child_storage_size.go +++ b/rpc/state/get_child_storage_size.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetChildStorageSize retreives the child storage size for the given key diff --git a/rpc/state/get_child_storage_test.go b/rpc/state/get_child_storage_test.go index e7a626444..8be1c8148 100644 --- a/rpc/state/get_child_storage_test.go +++ b/rpc/state/get_child_storage_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_keys.go b/rpc/state/get_keys.go index b404ef23a..fb31b470c 100644 --- a/rpc/state/get_keys.go +++ b/rpc/state/get_keys.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetKeys retreives the keys with the given prefix diff --git a/rpc/state/get_keys_test.go b/rpc/state/get_keys_test.go index cb3cfabab..a9eb93c3a 100644 --- a/rpc/state/get_keys_test.go +++ b/rpc/state/get_keys_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_metadata.go b/rpc/state/get_metadata.go index 05b26b08c..0f97d2c95 100644 --- a/rpc/state/get_metadata.go +++ b/rpc/state/get_metadata.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetMetadata returns the metadata at the given block diff --git a/rpc/state/get_runtime_version.go b/rpc/state/get_runtime_version.go index 221e8649c..3c4449b0f 100644 --- a/rpc/state/get_runtime_version.go +++ b/rpc/state/get_runtime_version.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetRuntimeVersion returns the runtime version at the given block diff --git a/rpc/state/get_storage.go b/rpc/state/get_storage.go index aeb76769b..508355387 100644 --- a/rpc/state/get_storage.go +++ b/rpc/state/get_storage.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetStorage retreives the stored data and decodes them into the provided interface. Ok is true if the value is not diff --git a/rpc/state/get_storage_hash.go b/rpc/state/get_storage_hash.go index 9564de7be..93c69ea80 100644 --- a/rpc/state/get_storage_hash.go +++ b/rpc/state/get_storage_hash.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetStorageHash retreives the storage hash for the given key diff --git a/rpc/state/get_storage_hash_test.go b/rpc/state/get_storage_hash_test.go index a6fdd6233..c1bfb248e 100644 --- a/rpc/state/get_storage_hash_test.go +++ b/rpc/state/get_storage_hash_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_storage_size.go b/rpc/state/get_storage_size.go index 65ae55aeb..bfd9e1aaa 100644 --- a/rpc/state/get_storage_size.go +++ b/rpc/state/get_storage_size.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // GetStorageSize retreives the storage size for the given key diff --git a/rpc/state/get_storage_size_test.go b/rpc/state/get_storage_size_test.go index 77407017c..34ee61490 100644 --- a/rpc/state/get_storage_size_test.go +++ b/rpc/state/get_storage_size_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/get_storage_test.go b/rpc/state/get_storage_test.go index 81370cf6d..c7f17801b 100644 --- a/rpc/state/get_storage_test.go +++ b/rpc/state/get_storage_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/query_storage.go b/rpc/state/query_storage.go index ef14e2760..8fee54c99 100644 --- a/rpc/state/query_storage.go +++ b/rpc/state/query_storage.go @@ -17,8 +17,8 @@ package state import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // QueryStorage queries historical storage entries (by key) starting from a start block until an end block diff --git a/rpc/state/query_storage_test.go b/rpc/state/query_storage_test.go index c27382dd9..c6a947c04 100644 --- a/rpc/state/query_storage_test.go +++ b/rpc/state/query_storage_test.go @@ -19,7 +19,7 @@ package state import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/rpc/state/state.go b/rpc/state/state.go index 3d98c1aa4..01d8d6a96 100644 --- a/rpc/state/state.go +++ b/rpc/state/state.go @@ -16,7 +16,7 @@ package state -import "github.com/centrifuge/go-substrate-rpc-client/v2/client" +import "github.com/snowfork/go-substrate-rpc-client/v2/client" // State exposes methods for querying state type State struct { diff --git a/rpc/state/state_test.go b/rpc/state/state_test.go index 40c8d5841..81eb6ec63 100644 --- a/rpc/state/state_test.go +++ b/rpc/state/state_test.go @@ -21,9 +21,9 @@ import ( "strings" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpcmocksrv" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpcmocksrv" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var state *State diff --git a/rpc/state/subscribe_runtime_version.go b/rpc/state/subscribe_runtime_version.go index a31638b6f..996025f7c 100644 --- a/rpc/state/subscribe_runtime_version.go +++ b/rpc/state/subscribe_runtime_version.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // RuntimeVersionSubscription is a subscription established through one of the Client's subscribe methods. diff --git a/rpc/state/subscribe_storage.go b/rpc/state/subscribe_storage.go index dd1681a9f..cc96b199b 100644 --- a/rpc/state/subscribe_storage.go +++ b/rpc/state/subscribe_storage.go @@ -20,9 +20,9 @@ import ( "context" "sync" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // StorageSubscription is a subscription established through one of the Client's subscribe methods. diff --git a/rpc/system/chain.go b/rpc/system/chain.go index 72ff3dd0d..b2a516ad6 100644 --- a/rpc/system/chain.go +++ b/rpc/system/chain.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Chain retrieves the chain diff --git a/rpc/system/health.go b/rpc/system/health.go index d4aa07039..dd78437ad 100644 --- a/rpc/system/health.go +++ b/rpc/system/health.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Health retrieves the health status of the connected node diff --git a/rpc/system/name.go b/rpc/system/name.go index 57fa1f27c..c419d3968 100644 --- a/rpc/system/name.go +++ b/rpc/system/name.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Name retrieves the node name diff --git a/rpc/system/network_state.go b/rpc/system/network_state.go index fc8ac27dd..c351d025e 100644 --- a/rpc/system/network_state.go +++ b/rpc/system/network_state.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // NetworkState retrieves the current state of the network diff --git a/rpc/system/peers.go b/rpc/system/peers.go index eb357cbdf..7e6ec3157 100644 --- a/rpc/system/peers.go +++ b/rpc/system/peers.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Peers retrieves the currently connected peers diff --git a/rpc/system/properties.go b/rpc/system/properties.go index 168b0d029..b53e4c52c 100644 --- a/rpc/system/properties.go +++ b/rpc/system/properties.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Properties retrieves a custom set of properties as a JSON object, defined in the chain spec diff --git a/rpc/system/system.go b/rpc/system/system.go index 2ef0a9e53..e5c2260be 100644 --- a/rpc/system/system.go +++ b/rpc/system/system.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/client" ) // System exposes methods for retrieval of system data diff --git a/rpc/system/system_test.go b/rpc/system/system_test.go index f3b99f9be..dcb90a9ff 100644 --- a/rpc/system/system_test.go +++ b/rpc/system/system_test.go @@ -20,9 +20,9 @@ import ( "os" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/client" - "github.com/centrifuge/go-substrate-rpc-client/v2/rpcmocksrv" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/client" + "github.com/snowfork/go-substrate-rpc-client/v2/rpcmocksrv" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var system *System diff --git a/rpc/system/version.go b/rpc/system/version.go index 5ee9e48b7..89eaf085a 100644 --- a/rpc/system/version.go +++ b/rpc/system/version.go @@ -17,7 +17,7 @@ package system import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // Version retrieves the version of the node diff --git a/rpcmocksrv/server.go b/rpcmocksrv/server.go index 42573d89b..0c51b605d 100644 --- a/rpcmocksrv/server.go +++ b/rpcmocksrv/server.go @@ -21,7 +21,7 @@ import ( "strconv" "time" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" ) type Server struct { diff --git a/rpcmocksrv/server_test.go b/rpcmocksrv/server_test.go index dd67686d4..57ea69e83 100644 --- a/rpcmocksrv/server_test.go +++ b/rpcmocksrv/server_test.go @@ -19,7 +19,7 @@ package rpcmocksrv import ( "testing" - gethrpc "github.com/centrifuge/go-substrate-rpc-client/v2/gethrpc" + gethrpc "github.com/snowfork/go-substrate-rpc-client/v2/gethrpc" "github.com/stretchr/testify/assert" ) diff --git a/signature/signature_test.go b/signature/signature_test.go index 21c1e9933..cea694fcd 100644 --- a/signature/signature_test.go +++ b/signature/signature_test.go @@ -20,8 +20,8 @@ import ( "crypto/rand" "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) @@ -36,8 +36,8 @@ func TestKeyRingPairFromSecretPhrase(t *testing.T) { assert.NoError(t, err) assert.Equal(t, KeyringPair{ - URI: testSecretPhrase, - Address: testAddressSS58, + URI: testSecretPhrase, + Address: testAddressSS58, PublicKey: types.MustHexDecodeString(testPubKey), }, p) } @@ -47,8 +47,8 @@ func TestKeyringPairFromSecretSeed(t *testing.T) { assert.NoError(t, err) assert.Equal(t, KeyringPair{ - URI: testSecretSeed, - Address: testAddressSS58, + URI: testSecretSeed, + Address: testAddressSS58, PublicKey: types.MustHexDecodeString(testPubKey), }, p) } @@ -58,8 +58,8 @@ func TestKeyringPairFromSecretSeedAndNetwork(t *testing.T) { assert.NoError(t, err) assert.Equal(t, KeyringPair{ - URI: testSecretSeed, - Address: testKusamaAddressSS58, + URI: testSecretSeed, + Address: testKusamaAddressSS58, PublicKey: types.MustHexDecodeString(testPubKey), }, p) } diff --git a/teste2e/author_submit_and_watch_extrinsic_test.go b/teste2e/author_submit_and_watch_extrinsic_test.go index a8e08f672..8086ab9f7 100644 --- a/teste2e/author_submit_and_watch_extrinsic_test.go +++ b/teste2e/author_submit_and_watch_extrinsic_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) @@ -90,12 +90,12 @@ func TestAuthor_SubmitAndWatchExtrinsic(t *testing.T) { o := types.SignatureOptions{ // BlockHash: blockHash, - BlockHash: genesisHash, // BlockHash needs to == GenesisHash if era is immortal. // TODO: add an error? - Era: era, - GenesisHash: genesisHash, - Nonce: types.NewUCompactFromUInt(uint64(nonce)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: genesisHash, // BlockHash needs to == GenesisHash if era is immortal. // TODO: add an error? + Era: era, + GenesisHash: genesisHash, + Nonce: types.NewUCompactFromUInt(uint64(nonce)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), TransactionVersion: rv.TransactionVersion, } diff --git a/teste2e/author_submit_extrinsic_test.go b/teste2e/author_submit_extrinsic_test.go index 115582c7d..57a49cc78 100644 --- a/teste2e/author_submit_extrinsic_test.go +++ b/teste2e/author_submit_extrinsic_test.go @@ -21,10 +21,10 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestChain_Events(t *testing.T) { @@ -88,7 +88,7 @@ func TestChain_SubmitExtrinsic(t *testing.T) { panic(err) } - bob, err := types.NewAddressFromHexAccountID("0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48") + bob, err := types.NewMultiAddressFromHexAccountID("0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48") if err != nil { panic(err) } @@ -133,12 +133,12 @@ func TestChain_SubmitExtrinsic(t *testing.T) { for i := uint32(0); i < 4; i++ { o := types.SignatureOptions{ // BlockHash: blockHash, - BlockHash: genesisHash, // BlockHash needs to == GenesisHash if era is immortal. // TODO: add an error? - Era: era, - GenesisHash: genesisHash, - Nonce: types.NewUCompactFromUInt(uint64(nonce + i)), - SpecVersion: rv.SpecVersion, - Tip: types.NewUCompactFromUInt(0), + BlockHash: genesisHash, // BlockHash needs to == GenesisHash if era is immortal. // TODO: add an error? + Era: era, + GenesisHash: genesisHash, + Nonce: types.NewUCompactFromUInt(uint64(nonce + i)), + SpecVersion: rv.SpecVersion, + Tip: types.NewUCompactFromUInt(0), TransactionVersion: rv.TransactionVersion, } diff --git a/teste2e/chain_subscribe_beefy_justifications_test.go b/teste2e/chain_subscribe_beefy_justifications_test.go new file mode 100644 index 000000000..888e325c3 --- /dev/null +++ b/teste2e/chain_subscribe_beefy_justifications_test.go @@ -0,0 +1,74 @@ +// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls +// +// Copyright 2019 Centrifuge GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package teste2e + +import ( + "context" + "fmt" + "testing" + "time" + + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/types" + "github.com/stretchr/testify/assert" +) + +func TestChain_SubscribeBeefyJustifications(t *testing.T) { + if testing.Short() { + t.Skip("skipping end-to-end test in short mode.") + } + + api, err := gsrpc.NewSubstrateAPI(config.Default().RPCURL) + if err != nil { + panic(err) + } + + ch := make(chan interface{}) + + sub, err := api.Client.Subscribe(context.Background(), "beefy", "subscribeJustifications", "unsubscribeJustifications", "justifications", ch) + if err != nil { + panic(err) + } + defer sub.Unsubscribe() + + timeout := time.After(40 * time.Second) + received := 0 + + for { + select { + case msg := <-ch: + fmt.Printf("encoded msg: %#v\n", msg) + + s := &types.SignedCommitment{} + err := types.DecodeFromHexString(msg.(string), s) + if err != nil { + panic(err) + } + fmt.Printf("decoded msg: %#v\n", s) + + received++ + + if received >= 2 { + return + } + case <-timeout: + assert.FailNow(t, "timeout reached without getting 2 notifications from subscription") + return + } + } +} diff --git a/teste2e/chain_subscribe_finalized_heads_test.go b/teste2e/chain_subscribe_finalized_heads_test.go index f8cefc898..4db267449 100644 --- a/teste2e/chain_subscribe_finalized_heads_test.go +++ b/teste2e/chain_subscribe_finalized_heads_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" "github.com/stretchr/testify/assert" ) diff --git a/teste2e/chain_subscribe_new_heads_test.go b/teste2e/chain_subscribe_new_heads_test.go index 9ff408075..e02aad106 100644 --- a/teste2e/chain_subscribe_new_heads_test.go +++ b/teste2e/chain_subscribe_new_heads_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" "github.com/stretchr/testify/assert" ) diff --git a/teste2e/main_test.go b/teste2e/main_test.go index a527c7448..19876f2bc 100644 --- a/teste2e/main_test.go +++ b/teste2e/main_test.go @@ -20,9 +20,9 @@ import ( "fmt" "testing" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/teste2e/mmr_generate_proof_test.go b/teste2e/mmr_generate_proof_test.go new file mode 100644 index 000000000..56c300260 --- /dev/null +++ b/teste2e/mmr_generate_proof_test.go @@ -0,0 +1,43 @@ +// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls +// +// Copyright 2019 Centrifuge GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package teste2e + +import ( + "fmt" + "testing" + + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" +) + +func TestMmr_GenerateProof(t *testing.T) { + if testing.Short() { + t.Skip("skipping end-to-end test in short mode.") + } + + api, err := gsrpc.NewSubstrateAPI(config.Default().RPCURL) + if err != nil { + panic(err) + } + + res, err := api.RPC.MMR.GenerateProofLatest(2) + if err != nil { + panic(err) + } + + fmt.Printf("decoded msg: %#v\n", res) +} diff --git a/teste2e/state_subscribe_runtime_version_test.go b/teste2e/state_subscribe_runtime_version_test.go index 5cefe843e..4cc2e94be 100644 --- a/teste2e/state_subscribe_runtime_version_test.go +++ b/teste2e/state_subscribe_runtime_version_test.go @@ -21,8 +21,8 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" "github.com/stretchr/testify/assert" ) diff --git a/teste2e/state_subscribe_storage_test.go b/teste2e/state_subscribe_storage_test.go index 0015ee6d4..2b1ec5ee3 100644 --- a/teste2e/state_subscribe_storage_test.go +++ b/teste2e/state_subscribe_storage_test.go @@ -21,9 +21,9 @@ import ( "testing" "time" - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v2" - "github.com/centrifuge/go-substrate-rpc-client/v2/config" - "github.com/centrifuge/go-substrate-rpc-client/v2/types" + gsrpc "github.com/snowfork/go-substrate-rpc-client/v2" + "github.com/snowfork/go-substrate-rpc-client/v2/config" + "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/account_data.go b/types/account_data.go index 752bc96eb..5e48b5271 100644 --- a/types/account_data.go +++ b/types/account_data.go @@ -18,9 +18,10 @@ package types // AccountInfo contains information of an account type AccountInfo struct { - Nonce U32 - Refcount U8 - Data struct { + Nonce U32 + Consumers U32 + Providers U32 + Data struct { Free U128 Reserved U128 MiscFrozen U128 diff --git a/types/account_id_test.go b/types/account_id_test.go index 281a391b0..66915bde3 100644 --- a/types/account_id_test.go +++ b/types/account_id_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestAccountID_EncodeDecode(t *testing.T) { diff --git a/types/account_index_test.go b/types/account_index_test.go index fc6c5b005..fae15533a 100644 --- a/types/account_index_test.go +++ b/types/account_index_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestAccountIndex_EncodeDecode(t *testing.T) { diff --git a/types/account_info_test.go b/types/account_info_test.go index f569fb58b..973054bf9 100644 --- a/types/account_info_test.go +++ b/types/account_info_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestAccountInfoV4_EncodeDecode(t *testing.T) { diff --git a/types/address.go b/types/address.go index 17e526ed1..f5d36b7eb 100644 --- a/types/address.go +++ b/types/address.go @@ -19,7 +19,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Address is a wrapper around an AccountId or an AccountIndex. It is encoded with a prefix in case of an AccountID. diff --git a/types/address_test.go b/types/address_test.go index 262c2770d..f28bc329c 100644 --- a/types/address_test.go +++ b/types/address_test.go @@ -21,8 +21,8 @@ import ( "testing" "github.com/btcsuite/btcutil/base58" - "github.com/centrifuge/go-substrate-rpc-client/v2/hash" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/hash" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/balance_status.go b/types/balance_status.go index b88eb52a8..f4694cb83 100644 --- a/types/balance_status.go +++ b/types/balance_status.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) type BalanceStatus byte diff --git a/types/balance_status_test.go b/types/balance_status_test.go index eee4c46c9..bd084af1d 100644 --- a/types/balance_status_test.go +++ b/types/balance_status_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" "github.com/stretchr/testify/assert" ) diff --git a/types/beefy.go b/types/beefy.go new file mode 100644 index 000000000..833be2e68 --- /dev/null +++ b/types/beefy.go @@ -0,0 +1,76 @@ +// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls +// +// Copyright 2019 Centrifuge GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package types + +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" + +// Commitment is a beefy commitment +type Commitment struct { + Payload H256 + BlockNumber BlockNumber + ValidatorSetID U64 +} + +// SignedCommitment is a beefy commitment with optional signatures from the set of validators +type SignedCommitment struct { + Commitment Commitment + Signatures []OptionBeefySignature +} + +// BeefySignature is a beefy signature +type BeefySignature [65]byte + +// OptionBeefySignature is a structure that can store a BeefySignature or a missing value +type OptionBeefySignature struct { + option + value BeefySignature +} + +// NewOptionBeefySignature creates an OptionBeefySignature with a value +func NewOptionBeefySignature(value BeefySignature) OptionBeefySignature { + return OptionBeefySignature{option{true}, value} +} + +// NewOptionBeefySignatureEmpty creates an OptionBeefySignature without a value +func NewOptionBeefySignatureEmpty() OptionBeefySignature { + return OptionBeefySignature{option: option{false}} +} + +func (o OptionBeefySignature) Encode(encoder scale.Encoder) error { + return encoder.EncodeOption(o.hasValue, o.value) +} + +func (o *OptionBeefySignature) Decode(decoder scale.Decoder) error { + return decoder.DecodeOption(&o.hasValue, &o.value) +} + +// SetSome sets a value +func (o *OptionBeefySignature) SetSome(value BeefySignature) { + o.hasValue = true + o.value = value +} + +// SetNone removes a value and marks it as missing +func (o *OptionBeefySignature) SetNone() { + o.hasValue = false + o.value = BeefySignature{} +} + +// Unwrap returns a flag that indicates whether a value is present and the stored value +func (o OptionBeefySignature) Unwrap() (ok bool, value BeefySignature) { + return o.hasValue, o.value +} diff --git a/types/bool_test.go b/types/bool_test.go index e57590fde..348f623f0 100644 --- a/types/bool_test.go +++ b/types/bool_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestBool_EncodeDecode(t *testing.T) { diff --git a/types/bytes.go b/types/bytes.go index 3f3bc4f44..445748dea 100644 --- a/types/bytes.go +++ b/types/bytes.go @@ -19,7 +19,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Bytes represents byte slices. Bytes has a variable length, it is encoded with a scale prefix diff --git a/types/bytes_test.go b/types/bytes_test.go index 5ba2f17c5..fe3e15ee7 100644 --- a/types/bytes_test.go +++ b/types/bytes_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestBytes_EncodeDecode(t *testing.T) { diff --git a/types/chain_properties.go b/types/chain_properties.go index 5db853a14..9ca6c1b6e 100644 --- a/types/chain_properties.go +++ b/types/chain_properties.go @@ -17,7 +17,7 @@ package types import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // ChainProperties contains the SS58 format, the token decimals and the token symbol diff --git a/types/chain_properties_test.go b/types/chain_properties_test.go index 285b3f64a..c1a75e319 100644 --- a/types/chain_properties_test.go +++ b/types/chain_properties_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var testChainProperties1 = ChainProperties{} diff --git a/types/codec.go b/types/codec.go index 72c4a5038..4dd49f31e 100644 --- a/types/codec.go +++ b/types/codec.go @@ -23,7 +23,7 @@ import ( "reflect" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" "golang.org/x/crypto/blake2b" ) diff --git a/types/data.go b/types/data.go index 98e0c1104..9d1723df3 100644 --- a/types/data.go +++ b/types/data.go @@ -20,7 +20,7 @@ import ( "fmt" "io" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Data is a raw data structure, containing raw bytes that are not decoded/encoded (without any length encoding). diff --git a/types/data_test.go b/types/data_test.go index 5c381fac7..d82bee4ee 100644 --- a/types/data_test.go +++ b/types/data_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/digest_item.go b/types/digest_item.go index c03e4a812..4c01b787c 100644 --- a/types/digest_item.go +++ b/types/digest_item.go @@ -16,24 +16,26 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import ( + "fmt" + + "github.com/snowfork/go-substrate-rpc-client/v2/scale" +) // DigestItem specifies the item in the logs of a digest type DigestItem struct { - IsOther bool - AsOther Bytes // 0 - IsAuthoritiesChange bool - AsAuthoritiesChange []AuthorityID // 1 - IsChangesTrieRoot bool - AsChangesTrieRoot Hash // 2 - IsSealV0 bool - AsSealV0 SealV0 // 3 - IsConsensus bool - AsConsensus Consensus // 4 - IsSeal bool - AsSeal Seal // 5 - IsPreRuntime bool - AsPreRuntime PreRuntime // 6 + IsChangesTrieRoot bool // 2 + AsChangesTrieRoot Hash + IsPreRuntime bool // 6 + AsPreRuntime PreRuntime + IsConsensus bool // 4 + AsConsensus Consensus + IsSeal bool // 5 + AsSeal Seal + IsChangesTrieSignal bool // 7 + AsChangesTrieSignal ChangesTrieSignal + IsOther bool // 0 + AsOther Bytes } func (m *DigestItem) Decode(decoder scale.Decoder) error { @@ -44,27 +46,24 @@ func (m *DigestItem) Decode(decoder scale.Decoder) error { } switch b { - case 0: - m.IsOther = true - err = decoder.Decode(&m.AsOther) - case 1: - m.IsAuthoritiesChange = true - err = decoder.Decode(&m.AsAuthoritiesChange) case 2: m.IsChangesTrieRoot = true err = decoder.Decode(&m.AsChangesTrieRoot) - case 3: - m.IsSealV0 = true - err = decoder.Decode(&m.AsSealV0) + case 6: + m.IsPreRuntime = true + err = decoder.Decode(&m.AsPreRuntime) case 4: m.IsConsensus = true err = decoder.Decode(&m.AsConsensus) case 5: m.IsSeal = true err = decoder.Decode(&m.AsSeal) - case 6: - m.IsPreRuntime = true - err = decoder.Decode(&m.AsPreRuntime) + case 7: + m.IsChangesTrieSignal = true + err = decoder.Decode(&m.AsChangesTrieSignal) + case 0: + m.IsOther = true + err = decoder.Decode(&m.AsOther) } if err != nil { @@ -80,15 +79,9 @@ func (m DigestItem) Encode(encoder scale.Encoder) error { case m.IsOther: err1 = encoder.PushByte(0) err2 = encoder.Encode(m.AsOther) - case m.IsAuthoritiesChange: - err1 = encoder.PushByte(1) - err2 = encoder.Encode(m.AsAuthoritiesChange) case m.IsChangesTrieRoot: err1 = encoder.PushByte(2) err2 = encoder.Encode(m.AsChangesTrieRoot) - case m.IsSealV0: - err1 = encoder.PushByte(3) - err2 = encoder.Encode(m.AsSealV0) case m.IsConsensus: err1 = encoder.PushByte(4) err2 = encoder.Encode(m.AsConsensus) @@ -118,11 +111,6 @@ func NewAuthorityID(b [32]byte) AuthorityID { return AuthorityID(b) } -type SealV0 struct { - Signer U64 - Signature Signature -} - type Seal struct { ConsensusEngineID ConsensusEngineID Bytes Bytes @@ -141,3 +129,51 @@ type PreRuntime struct { ConsensusEngineID ConsensusEngineID Bytes Bytes } + +type ChangesTrieSignal struct { + IsNewConfiguration bool + AsNewConfiguration Bytes +} + +func (c ChangesTrieSignal) Encode(encoder scale.Encoder) error { + switch { + case c.IsNewConfiguration: + err := encoder.PushByte(0) + if err != nil { + return err + } + err = encoder.Encode(c.AsNewConfiguration) + if err != nil { + return err + } + default: + return fmt.Errorf("No such variant for ChangesTrieSignal") + } + + return nil +} + +func (c *ChangesTrieSignal) Decode(decoder scale.Decoder) error { + tag, err := decoder.ReadOneByte() + if err != nil { + return err + } + + switch tag { + case 0: + c.IsNewConfiguration = true + err = decoder.Decode(&c.AsNewConfiguration) + if err != nil { + return err + } + default: + return fmt.Errorf("No such variant for ChangesTrieSignal") + } + + return nil +} + +type ChangesTrieConfiguration struct { + DigestInterval U32 + DigestLevels U32 +} diff --git a/types/digest_item_test.go b/types/digest_item_test.go index 9ff6f387d..beed4f7ec 100644 --- a/types/digest_item_test.go +++ b/types/digest_item_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var testDigestItem1 = DigestItem{IsOther: true, AsOther: NewBytes([]byte{0xab})} diff --git a/types/digest_of_test.go b/types/digest_of_test.go index 5b59504fb..0ab514c9f 100644 --- a/types/digest_of_test.go +++ b/types/digest_of_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestDigestOf_EncodeDecode(t *testing.T) { diff --git a/types/digest_test.go b/types/digest_test.go index 4cd18a709..cf4b7bda9 100644 --- a/types/digest_test.go +++ b/types/digest_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestDigest_EncodeDecode(t *testing.T) { diff --git a/types/election_compute.go b/types/election_compute.go index 1c7112b2b..42127d7ff 100644 --- a/types/election_compute.go +++ b/types/election_compute.go @@ -3,7 +3,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) type ElectionCompute byte diff --git a/types/election_compute_test.go b/types/election_compute_test.go index 0698fad99..a5c95e941 100644 --- a/types/election_compute_test.go +++ b/types/election_compute_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" "github.com/stretchr/testify/assert" ) diff --git a/types/event_record.go b/types/event_record.go index 4cf7e78db..6b3c4f73d 100644 --- a/types/event_record.go +++ b/types/event_record.go @@ -23,8 +23,8 @@ import ( "io" "reflect" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" "github.com/ethereum/go-ethereum/log" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // EventRecordsRaw is a raw record for a set of events, represented as the raw bytes. It exists since diff --git a/types/event_record_test.go b/types/event_record_test.go index 4138e611f..dfcd6d082 100644 --- a/types/event_record_test.go +++ b/types/event_record_test.go @@ -21,7 +21,7 @@ import ( "math/big" "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) @@ -272,17 +272,17 @@ func TestEventRecordsRaw_Decode(t *testing.T) { } exp := EventRecords{ - Balances_Endowed:[]EventBalancesEndowed{EventBalancesEndowed{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance: NewU128(*big.NewInt(4586363775847)), Topics:[]Hash(nil)}}, - Balances_DustLost:[]EventBalancesDustLost{EventBalancesDustLost{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance:NewU128(*big.NewInt(4586363775847)), Topics:[]Hash(nil)}}, - Balances_Transfer:[]EventBalancesTransfer{EventBalancesTransfer{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x1, IsFinalization:false}, From:AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, To:AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Value:NewU128(*big.NewInt(6969)), Topics:[]Hash(nil)}}, - Balances_BalanceSet:[]EventBalancesBalanceSet{EventBalancesBalanceSet{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Free:NewU128(*big.NewInt(4586363775847)), Reserved:NewU128(*big.NewInt(4586363775847)), Topics:[]Hash(nil)}}, - Balances_Deposit:[]EventBalancesDeposit{EventBalancesDeposit{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance:NewU128(*big.NewInt(4586363775847)), Topics:[]Hash(nil)}}, - Balances_Reserved:[]EventBalancesReserved(nil), - Balances_Unreserved:[]EventBalancesUnreserved(nil), - Balances_ReservedRepatriated:[]EventBalancesReserveRepatriated(nil), - Grandpa_NewAuthorities:[]EventGrandpaNewAuthorities(nil), - Grandpa_Paused:[]EventGrandpaPaused(nil), - Grandpa_Resumed:[]EventGrandpaResumed(nil), ImOnline_HeartbeatReceived:[]EventImOnlineHeartbeatReceived(nil), ImOnline_AllGood:[]EventImOnlineAllGood(nil), ImOnline_SomeOffline:[]EventImOnlineSomeOffline(nil), Indices_IndexAssigned:[]EventIndicesIndexAssigned{EventIndicesIndexAssigned{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, AccountID:AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, AccountIndex:0x3039, Topics:[]Hash(nil)}}, Indices_IndexFreed:[]EventIndicesIndexFreed{EventIndicesIndexFreed{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, AccountIndex:0x3039, Topics:[]Hash(nil)}}, Indices_IndexFrozen:[]EventIndicesIndexFrozen(nil), Offences_Offence:[]EventOffencesOffence{EventOffencesOffence{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Kind:Bytes16{0x69, 0x6d, 0x2d, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e}, OpaqueTimeSlot:Bytes{0xc5, 0x0, 0x0, 0x0}, Topics:[]Hash(nil)}}, Session_NewSession:[]EventSessionNewSession{EventSessionNewSession{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, SessionIndex:0xc6, Topics:[]Hash(nil)}}, Staking_EraPayout:[]EventStakingEraPayout{EventStakingEraPayout{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, EraIndex:0xc6, ValidatorPayout:NewU128(*big.NewInt(4586363775847)), Remainder:NewU128(*big.NewInt(0)), Topics:[]Hash(nil)}}, Staking_Reward:[]EventStakingReward(nil), Staking_Slash:[]EventStakingSlash(nil), Staking_OldSlashingReportDiscarded:[]EventStakingOldSlashingReportDiscarded(nil), Staking_StakingElection:[]EventStakingStakingElection(nil), Staking_SolutionStored:[]EventStakingSolutionStored(nil), Staking_Bonded:[]EventStakingBonded(nil), Staking_Unbonded:[]EventStakingUnbonded(nil), Staking_Withdrawn:[]EventStakingWithdrawn(nil), System_ExtrinsicSuccess:[]EventSystemExtrinsicSuccess{EventSystemExtrinsicSuccess{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, DispatchInfo:DispatchInfo{Weight:0x2710, Class:DispatchClass{IsNormal:false, IsOperational:true}, PaysFee: Pays{IsYes: true}}, Topics:[]Hash(nil)}, EventSystemExtrinsicSuccess{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x1, IsFinalization:false}, DispatchInfo:DispatchInfo{Weight:0x2710, Class:DispatchClass{IsNormal:true, IsOperational:false}, PaysFee: Pays{IsYes: true}}, Topics:[]Hash(nil)}}, System_ExtrinsicFailed:[]EventSystemExtrinsicFailed{EventSystemExtrinsicFailed{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x2, IsFinalization:false}, DispatchError:DispatchError{HasModule:true, Module:0xb, Error:0x0}, DispatchInfo:DispatchInfo{Weight:0x2710, Class:DispatchClass{IsNormal:false, IsOperational:true}, PaysFee: Pays{IsYes: true}}, Topics:[]Hash(nil)}}, System_CodeUpdated:[]EventSystemCodeUpdated{EventSystemCodeUpdated{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Topics:[]Hash(nil)}}, System_NewAccount:[]EventSystemNewAccount{EventSystemNewAccount{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics:[]Hash(nil)}}, System_KilledAccount:[]EventSystemKilledAccount{EventSystemKilledAccount{Phase:Phase{IsApplyExtrinsic:true, AsApplyExtrinsic:0x0, IsFinalization:false}, Who:AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics:[]Hash(nil)}}, Assets_Issued:[]EventAssetIssued(nil), Assets_Transferred:[]EventAssetTransferred(nil), Assets_Destroyed:[]EventAssetDestroyed(nil), Democracy_Proposed:[]EventDemocracyProposed(nil), Democracy_Tabled:[]EventDemocracyTabled(nil), Democracy_ExternalTabled:[]EventDemocracyExternalTabled(nil), Democracy_Started:[]EventDemocracyStarted(nil), Democracy_Passed:[]EventDemocracyPassed(nil), Democracy_NotPassed:[]EventDemocracyNotPassed(nil), Democracy_Cancelled:[]EventDemocracyCancelled(nil), Democracy_Executed:[]EventDemocracyExecuted(nil), Democracy_Delegated:[]EventDemocracyDelegated(nil), Democracy_Undelegated:[]EventDemocracyUndelegated(nil), Democracy_Vetoed:[]EventDemocracyVetoed(nil), Democracy_PreimageNoted:[]EventDemocracyPreimageNoted(nil), Democracy_PreimageUsed:[]EventDemocracyPreimageUsed(nil), Democracy_PreimageInvalid:[]EventDemocracyPreimageInvalid(nil), Democracy_PreimageMissing:[]EventDemocracyPreimageMissing(nil), Democracy_PreimageReaped:[]EventDemocracyPreimageReaped(nil), Democracy_Unlocked:[]EventDemocracyUnlocked(nil), Council_Proposed:[]EventCollectiveProposed(nil), Council_Voted:[]EventCollectiveProposed(nil), Council_Approved:[]EventCollectiveApproved(nil), Council_Disapproved:[]EventCollectiveDisapproved(nil), Council_Executed:[]EventCollectiveExecuted(nil), Council_MemberExecuted:[]EventCollectiveMemberExecuted(nil), Council_Closed:[]EventCollectiveClosed(nil), TechnicalCommittee_Proposed:[]EventTechnicalCommitteeProposed(nil), TechnicalCommittee_Voted:[]EventTechnicalCommitteeVoted(nil), TechnicalCommittee_Approved:[]EventTechnicalCommitteeApproved(nil), TechnicalCommittee_Disapproved:[]EventTechnicalCommitteeDisapproved(nil), TechnicalCommittee_Executed:[]EventTechnicalCommitteeExecuted(nil), TechnicalCommittee_MemberExecuted:[]EventTechnicalCommitteeMemberExecuted(nil), TechnicalCommittee_Closed:[]EventTechnicalCommitteeClosed(nil), Elections_NewTerm:[]EventElectionsNewTerm(nil), Elections_EmptyTerm:[]EventElectionsEmptyTerm(nil), Elections_MemberKicked:[]EventElectionsMemberKicked(nil), Elections_MemberRenounced:[]EventElectionsMemberRenounced(nil), Elections_VoterReported:[]EventElectionsVoterReported(nil), Identity_IdentitySet:[]EventIdentitySet(nil), Identity_IdentityCleared:[]EventIdentityCleared(nil), Identity_IdentityKilled:[]EventIdentityKilled(nil), Identity_JudgementRequested:[]EventIdentityJudgementRequested(nil), Identity_JudgementUnrequested:[]EventIdentityJudgementUnrequested(nil), Identity_JudgementGiven:[]EventIdentityJudgementGiven(nil), Identity_RegistrarAdded:[]EventIdentityRegistrarAdded(nil), Identity_SubIdentityAdded:[]EventIdentitySubIdentityAdded(nil), Identity_SubIdentityRemoved:[]EventIdentitySubIdentityRemoved(nil), Identity_SubIdentityRevoked:[]EventIdentitySubIdentityRevoked(nil), Society_Founded:[]EventSocietyFounded(nil), Society_Bid:[]EventSocietyBid(nil), Society_Vouch:[]EventSocietyVouch(nil), Society_AutoUnbid:[]EventSocietyAutoUnbid(nil), Society_Unbid:[]EventSocietyUnbid(nil), Society_Unvouch:[]EventSocietyUnvouch(nil), Society_Inducted:[]EventSocietyInducted(nil), Society_SuspendedMemberJudgement:[]EventSocietySuspendedMemberJudgement(nil), Society_CandidateSuspended:[]EventSocietyCandidateSuspended(nil), Society_MemberSuspended:[]EventSocietyMemberSuspended(nil), Society_Challenged:[]EventSocietyChallenged(nil), Society_Vote:[]EventSocietyVote(nil), Society_DefenderVote:[]EventSocietyDefenderVote(nil), Society_NewMaxMembers:[]EventSocietyNewMaxMembers(nil), Society_Unfounded:[]EventSocietyUnfounded(nil), Society_Deposit:[]EventSocietyDeposit(nil), Recovery_RecoveryCreated:[]EventRecoveryCreated(nil), Recovery_RecoveryInitiated:[]EventRecoveryInitiated(nil), Recovery_RecoveryVouched:[]EventRecoveryVouched(nil), Recovery_RecoveryClosed:[]EventRecoveryClosed(nil), Recovery_AccountRecovered:[]EventRecoveryAccountRecovered(nil), Recovery_RecoveryRemoved:[]EventRecoveryRemoved(nil), Vesting_VestingUpdated:[]EventVestingVestingUpdated(nil), Vesting_VestingCompleted:[]EventVestingVestingCompleted(nil), Scheduler_Scheduled:[]EventSchedulerScheduled(nil), Scheduler_Canceled:[]EventSchedulerCanceled(nil), Scheduler_Dispatched:[]EventSchedulerDispatched(nil), Proxy_ProxyExecuted:[]EventProxyProxyExecuted(nil), Proxy_AnonymousCreated:[]EventProxyAnonymousCreated(nil), Sudo_Sudid:[]EventSudoSudid(nil), Sudo_KeyChanged:[]EventSudoKeyChanged(nil), Sudo_SudoAsDone:[]EventSudoAsDone(nil), Treasury_Proposed:[]EventTreasuryProposed(nil), Treasury_Spending:[]EventTreasurySpending(nil), Treasury_Awarded:[]EventTreasuryAwarded(nil), Treasury_Rejected:[]EventTreasuryRejected(nil), Treasury_Burnt:[]EventTreasuryBurnt(nil), Treasury_Rollover:[]EventTreasuryRollover(nil), Treasury_Deposit:[]EventTreasuryDeposit(nil), Treasury_NewTip:[]EventTreasuryNewTip(nil), Treasury_TipClosing:[]EventTreasuryTipClosing(nil), Treasury_TipClosed:[]EventTreasuryTipClosed(nil), Treasury_TipRetracted:[]EventTreasuryTipRetracted(nil), Contracts_Instantiated:[]EventContractsInstantiated(nil), Contracts_Evicted:[]EventContractsEvicted(nil), Contracts_Restored:[]EventContractsRestored(nil), Contracts_CodeStored:[]EventContractsCodeStored(nil), Contracts_ScheduleUpdated:[]EventContractsScheduleUpdated(nil), Contracts_ContractExecution:[]EventContractsContractExecution(nil), Utility_BatchInterrupted:[]EventUtilityBatchInterrupted(nil), Utility_BatchCompleted:[]EventUtilityBatchCompleted(nil), Multisig_NewMultisig:[]EventMultisigNewMultisig(nil), Multisig_MultisigApproval:[]EventMultisigApproval(nil), Multisig_MultisigExecuted:[]EventMultisigExecuted(nil), Multisig_MultisigCancelled:[]EventMultisigCancelled(nil)} + Balances_Endowed: []EventBalancesEndowed{EventBalancesEndowed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance: NewU128(*big.NewInt(4586363775847)), Topics: []Hash(nil)}}, + Balances_DustLost: []EventBalancesDustLost{EventBalancesDustLost{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance: NewU128(*big.NewInt(4586363775847)), Topics: []Hash(nil)}}, + Balances_Transfer: []EventBalancesTransfer{EventBalancesTransfer{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x1, IsFinalization: false}, From: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, To: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Value: NewU128(*big.NewInt(6969)), Topics: []Hash(nil)}}, + Balances_BalanceSet: []EventBalancesBalanceSet{EventBalancesBalanceSet{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Free: NewU128(*big.NewInt(4586363775847)), Reserved: NewU128(*big.NewInt(4586363775847)), Topics: []Hash(nil)}}, + Balances_Deposit: []EventBalancesDeposit{EventBalancesDeposit{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, Balance: NewU128(*big.NewInt(4586363775847)), Topics: []Hash(nil)}}, + Balances_Reserved: []EventBalancesReserved(nil), + Balances_Unreserved: []EventBalancesUnreserved(nil), + Balances_ReservedRepatriated: []EventBalancesReserveRepatriated(nil), + Grandpa_NewAuthorities: []EventGrandpaNewAuthorities(nil), + Grandpa_Paused: []EventGrandpaPaused(nil), + Grandpa_Resumed: []EventGrandpaResumed(nil), ImOnline_HeartbeatReceived: []EventImOnlineHeartbeatReceived(nil), ImOnline_AllGood: []EventImOnlineAllGood(nil), ImOnline_SomeOffline: []EventImOnlineSomeOffline(nil), Indices_IndexAssigned: []EventIndicesIndexAssigned{EventIndicesIndexAssigned{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountID: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFreed: []EventIndicesIndexFreed{EventIndicesIndexFreed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, AccountIndex: 0x3039, Topics: []Hash(nil)}}, Indices_IndexFrozen: []EventIndicesIndexFrozen(nil), Offences_Offence: []EventOffencesOffence{EventOffencesOffence{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Kind: Bytes16{0x69, 0x6d, 0x2d, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x6f, 0x66, 0x66, 0x6c, 0x69, 0x6e}, OpaqueTimeSlot: Bytes{0xc5, 0x0, 0x0, 0x0}, Topics: []Hash(nil)}}, Session_NewSession: []EventSessionNewSession{EventSessionNewSession{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, SessionIndex: 0xc6, Topics: []Hash(nil)}}, Staking_EraPayout: []EventStakingEraPayout{EventStakingEraPayout{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, EraIndex: 0xc6, ValidatorPayout: NewU128(*big.NewInt(4586363775847)), Remainder: NewU128(*big.NewInt(0)), Topics: []Hash(nil)}}, Staking_Reward: []EventStakingReward(nil), Staking_Slash: []EventStakingSlash(nil), Staking_OldSlashingReportDiscarded: []EventStakingOldSlashingReportDiscarded(nil), Staking_StakingElection: []EventStakingStakingElection(nil), Staking_SolutionStored: []EventStakingSolutionStored(nil), Staking_Bonded: []EventStakingBonded(nil), Staking_Unbonded: []EventStakingUnbonded(nil), Staking_Withdrawn: []EventStakingWithdrawn(nil), System_ExtrinsicSuccess: []EventSystemExtrinsicSuccess{EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}, EventSystemExtrinsicSuccess{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x1, IsFinalization: false}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: true, IsOperational: false}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_ExtrinsicFailed: []EventSystemExtrinsicFailed{EventSystemExtrinsicFailed{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x2, IsFinalization: false}, DispatchError: DispatchError{HasModule: true, Module: 0xb, Error: 0x0}, DispatchInfo: DispatchInfo{Weight: 0x2710, Class: DispatchClass{IsNormal: false, IsOperational: true}, PaysFee: Pays{IsYes: true}}, Topics: []Hash(nil)}}, System_CodeUpdated: []EventSystemCodeUpdated{EventSystemCodeUpdated{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Topics: []Hash(nil)}}, System_NewAccount: []EventSystemNewAccount{EventSystemNewAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, System_KilledAccount: []EventSystemKilledAccount{EventSystemKilledAccount{Phase: Phase{IsApplyExtrinsic: true, AsApplyExtrinsic: 0x0, IsFinalization: false}, Who: AccountID{0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48}, Topics: []Hash(nil)}}, Assets_Issued: []EventAssetIssued(nil), Assets_Transferred: []EventAssetTransferred(nil), Assets_Destroyed: []EventAssetDestroyed(nil), Democracy_Proposed: []EventDemocracyProposed(nil), Democracy_Tabled: []EventDemocracyTabled(nil), Democracy_ExternalTabled: []EventDemocracyExternalTabled(nil), Democracy_Started: []EventDemocracyStarted(nil), Democracy_Passed: []EventDemocracyPassed(nil), Democracy_NotPassed: []EventDemocracyNotPassed(nil), Democracy_Cancelled: []EventDemocracyCancelled(nil), Democracy_Executed: []EventDemocracyExecuted(nil), Democracy_Delegated: []EventDemocracyDelegated(nil), Democracy_Undelegated: []EventDemocracyUndelegated(nil), Democracy_Vetoed: []EventDemocracyVetoed(nil), Democracy_PreimageNoted: []EventDemocracyPreimageNoted(nil), Democracy_PreimageUsed: []EventDemocracyPreimageUsed(nil), Democracy_PreimageInvalid: []EventDemocracyPreimageInvalid(nil), Democracy_PreimageMissing: []EventDemocracyPreimageMissing(nil), Democracy_PreimageReaped: []EventDemocracyPreimageReaped(nil), Democracy_Unlocked: []EventDemocracyUnlocked(nil), Council_Proposed: []EventCollectiveProposed(nil), Council_Voted: []EventCollectiveProposed(nil), Council_Approved: []EventCollectiveApproved(nil), Council_Disapproved: []EventCollectiveDisapproved(nil), Council_Executed: []EventCollectiveExecuted(nil), Council_MemberExecuted: []EventCollectiveMemberExecuted(nil), Council_Closed: []EventCollectiveClosed(nil), TechnicalCommittee_Proposed: []EventTechnicalCommitteeProposed(nil), TechnicalCommittee_Voted: []EventTechnicalCommitteeVoted(nil), TechnicalCommittee_Approved: []EventTechnicalCommitteeApproved(nil), TechnicalCommittee_Disapproved: []EventTechnicalCommitteeDisapproved(nil), TechnicalCommittee_Executed: []EventTechnicalCommitteeExecuted(nil), TechnicalCommittee_MemberExecuted: []EventTechnicalCommitteeMemberExecuted(nil), TechnicalCommittee_Closed: []EventTechnicalCommitteeClosed(nil), Elections_NewTerm: []EventElectionsNewTerm(nil), Elections_EmptyTerm: []EventElectionsEmptyTerm(nil), Elections_MemberKicked: []EventElectionsMemberKicked(nil), Elections_MemberRenounced: []EventElectionsMemberRenounced(nil), Elections_VoterReported: []EventElectionsVoterReported(nil), Identity_IdentitySet: []EventIdentitySet(nil), Identity_IdentityCleared: []EventIdentityCleared(nil), Identity_IdentityKilled: []EventIdentityKilled(nil), Identity_JudgementRequested: []EventIdentityJudgementRequested(nil), Identity_JudgementUnrequested: []EventIdentityJudgementUnrequested(nil), Identity_JudgementGiven: []EventIdentityJudgementGiven(nil), Identity_RegistrarAdded: []EventIdentityRegistrarAdded(nil), Identity_SubIdentityAdded: []EventIdentitySubIdentityAdded(nil), Identity_SubIdentityRemoved: []EventIdentitySubIdentityRemoved(nil), Identity_SubIdentityRevoked: []EventIdentitySubIdentityRevoked(nil), Society_Founded: []EventSocietyFounded(nil), Society_Bid: []EventSocietyBid(nil), Society_Vouch: []EventSocietyVouch(nil), Society_AutoUnbid: []EventSocietyAutoUnbid(nil), Society_Unbid: []EventSocietyUnbid(nil), Society_Unvouch: []EventSocietyUnvouch(nil), Society_Inducted: []EventSocietyInducted(nil), Society_SuspendedMemberJudgement: []EventSocietySuspendedMemberJudgement(nil), Society_CandidateSuspended: []EventSocietyCandidateSuspended(nil), Society_MemberSuspended: []EventSocietyMemberSuspended(nil), Society_Challenged: []EventSocietyChallenged(nil), Society_Vote: []EventSocietyVote(nil), Society_DefenderVote: []EventSocietyDefenderVote(nil), Society_NewMaxMembers: []EventSocietyNewMaxMembers(nil), Society_Unfounded: []EventSocietyUnfounded(nil), Society_Deposit: []EventSocietyDeposit(nil), Recovery_RecoveryCreated: []EventRecoveryCreated(nil), Recovery_RecoveryInitiated: []EventRecoveryInitiated(nil), Recovery_RecoveryVouched: []EventRecoveryVouched(nil), Recovery_RecoveryClosed: []EventRecoveryClosed(nil), Recovery_AccountRecovered: []EventRecoveryAccountRecovered(nil), Recovery_RecoveryRemoved: []EventRecoveryRemoved(nil), Vesting_VestingUpdated: []EventVestingVestingUpdated(nil), Vesting_VestingCompleted: []EventVestingVestingCompleted(nil), Scheduler_Scheduled: []EventSchedulerScheduled(nil), Scheduler_Canceled: []EventSchedulerCanceled(nil), Scheduler_Dispatched: []EventSchedulerDispatched(nil), Proxy_ProxyExecuted: []EventProxyProxyExecuted(nil), Proxy_AnonymousCreated: []EventProxyAnonymousCreated(nil), Sudo_Sudid: []EventSudoSudid(nil), Sudo_KeyChanged: []EventSudoKeyChanged(nil), Sudo_SudoAsDone: []EventSudoAsDone(nil), Treasury_Proposed: []EventTreasuryProposed(nil), Treasury_Spending: []EventTreasurySpending(nil), Treasury_Awarded: []EventTreasuryAwarded(nil), Treasury_Rejected: []EventTreasuryRejected(nil), Treasury_Burnt: []EventTreasuryBurnt(nil), Treasury_Rollover: []EventTreasuryRollover(nil), Treasury_Deposit: []EventTreasuryDeposit(nil), Treasury_NewTip: []EventTreasuryNewTip(nil), Treasury_TipClosing: []EventTreasuryTipClosing(nil), Treasury_TipClosed: []EventTreasuryTipClosed(nil), Treasury_TipRetracted: []EventTreasuryTipRetracted(nil), Contracts_Instantiated: []EventContractsInstantiated(nil), Contracts_Evicted: []EventContractsEvicted(nil), Contracts_Restored: []EventContractsRestored(nil), Contracts_CodeStored: []EventContractsCodeStored(nil), Contracts_ScheduleUpdated: []EventContractsScheduleUpdated(nil), Contracts_ContractExecution: []EventContractsContractExecution(nil), Utility_BatchInterrupted: []EventUtilityBatchInterrupted(nil), Utility_BatchCompleted: []EventUtilityBatchCompleted(nil), Multisig_NewMultisig: []EventMultisigNewMultisig(nil), Multisig_MultisigApproval: []EventMultisigApproval(nil), Multisig_MultisigExecuted: []EventMultisigExecuted(nil), Multisig_MultisigCancelled: []EventMultisigCancelled(nil)} //nolint:lll assert.Equal(t, exp, events) diff --git a/types/events.go b/types/events.go index d22cb9231..7da4ca2e4 100644 --- a/types/events.go +++ b/types/events.go @@ -19,7 +19,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // EventBalancesEndowed is emitted when an account is created with some free balance diff --git a/types/events_test.go b/types/events_test.go index a5e2eb1c4..338c4201d 100644 --- a/types/events_test.go +++ b/types/events_test.go @@ -4,7 +4,7 @@ import ( "bytes" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" "github.com/stretchr/testify/assert" ) diff --git a/types/example_enum_test.go b/types/example_enum_test.go index 6cfe41594..8afeef23b 100644 --- a/types/example_enum_test.go +++ b/types/example_enum_test.go @@ -20,8 +20,8 @@ import ( "fmt" "reflect" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // PhaseEnum is an enum example. Since Go has no enums, it is implemented as a struct with flags for each diff --git a/types/example_struct_test.go b/types/example_struct_test.go index 5a5868053..6762b19ea 100644 --- a/types/example_struct_test.go +++ b/types/example_struct_test.go @@ -19,7 +19,7 @@ package types_test import ( "fmt" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func ExampleExampleStruct() { diff --git a/types/example_tuple_test.go b/types/example_tuple_test.go index b8b15d1a1..1f7f8271d 100644 --- a/types/example_tuple_test.go +++ b/types/example_tuple_test.go @@ -19,7 +19,7 @@ package types_test import ( "fmt" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "golang.org/x/crypto/blake2b" ) diff --git a/types/example_vec_any_test.go b/types/example_vec_any_test.go index 36941482c..627684224 100644 --- a/types/example_vec_any_test.go +++ b/types/example_vec_any_test.go @@ -20,8 +20,8 @@ import ( "fmt" "reflect" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // MyVal is a custom type that is used to hold arbitrarily encoded data. In this example, we encode uint8s with a 0x00 diff --git a/types/example_vec_test.go b/types/example_vec_test.go index bed30a544..20a7bd4f7 100644 --- a/types/example_vec_test.go +++ b/types/example_vec_test.go @@ -20,7 +20,7 @@ import ( "fmt" "reflect" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func ExampleExampleVec_simple() { diff --git a/types/extrinsic.go b/types/extrinsic.go index b62b15afd..0df209259 100644 --- a/types/extrinsic.go +++ b/types/extrinsic.go @@ -24,8 +24,8 @@ import ( "math/big" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" ) const ( @@ -148,7 +148,7 @@ func (e *Extrinsic) Sign(signer signature.KeyringPair, o SignatureOptions) error TransactionVersion: o.TransactionVersion, } - signerPubKey := NewAddressFromAccountID(signer.PublicKey) + signerPubKey := NewMultiAddressFromAccountID(signer.PublicKey) sig, err := payload.Sign(signer) if err != nil { diff --git a/types/extrinsic_era.go b/types/extrinsic_era.go index 54d67fab5..905b50ca1 100644 --- a/types/extrinsic_era.go +++ b/types/extrinsic_era.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // ExtrinsicEra indicates either a mortal or immortal extrinsic type ExtrinsicEra struct { diff --git a/types/extrinsic_era_test.go b/types/extrinsic_era_test.go index afa5b3415..1973fc127 100644 --- a/types/extrinsic_era_test.go +++ b/types/extrinsic_era_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/extrinsic_examplary.go b/types/extrinsic_examplary.go index ec54ab4ed..d39235cca 100644 --- a/types/extrinsic_examplary.go +++ b/types/extrinsic_examplary.go @@ -18,4 +18,4 @@ package types import "math/big" -var ExamplaryExtrinsic = Extrinsic{Version: 0x84, Signature: ExtrinsicSignatureV4{Signer: Address{IsAccountID: true, AsAccountID: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}, IsAccountIndex: false, AsAccountIndex: 0x0}, Signature: MultiSignature{IsSr25519: true, AsSr25519: Signature{0x5c, 0x77, 0x1d, 0xd5, 0x6a, 0xe0, 0xce, 0xed, 0x68, 0xd, 0xb3, 0xbb, 0x4c, 0x40, 0x7a, 0x38, 0x96, 0x99, 0x97, 0xae, 0xb6, 0xa, 0x2c, 0x62, 0x39, 0x1, 0x6, 0x2f, 0x7f, 0x8e, 0xbf, 0x2f, 0xe7, 0x73, 0x3a, 0x61, 0x3c, 0xf1, 0x6b, 0x78, 0xf6, 0x10, 0xc6, 0x52, 0x32, 0xa2, 0x3c, 0xc5, 0xce, 0x25, 0xda, 0x29, 0xa3, 0xd5, 0x84, 0x85, 0xd8, 0x7b, 0xd8, 0x3d, 0xb8, 0x18, 0x3f, 0x8}}, Era: ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: MortalEra{First: 0x0, Second: 0x0}}, Nonce: UCompact(*big.NewInt(1)), Tip: UCompact(*big.NewInt(2))}, Method: Call{CallIndex: CallIndex{SectionIndex: 0x3, MethodIndex: 0x0}, Args: Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll +var ExamplaryExtrinsic = Extrinsic{Version: 0x84, Signature: ExtrinsicSignatureV4{Signer: MultiAddress{IsID: true, AsID: AccountID{0xd4, 0x35, 0x93, 0xc7, 0x15, 0xfd, 0xd3, 0x1c, 0x61, 0x14, 0x1a, 0xbd, 0x4, 0xa9, 0x9f, 0xd6, 0x82, 0x2c, 0x85, 0x58, 0x85, 0x4c, 0xcd, 0xe3, 0x9a, 0x56, 0x84, 0xe7, 0xa5, 0x6d, 0xa2, 0x7d}}, Signature: MultiSignature{IsSr25519: true, AsSr25519: Signature{0x5c, 0x77, 0x1d, 0xd5, 0x6a, 0xe0, 0xce, 0xed, 0x68, 0xd, 0xb3, 0xbb, 0x4c, 0x40, 0x7a, 0x38, 0x96, 0x99, 0x97, 0xae, 0xb6, 0xa, 0x2c, 0x62, 0x39, 0x1, 0x6, 0x2f, 0x7f, 0x8e, 0xbf, 0x2f, 0xe7, 0x73, 0x3a, 0x61, 0x3c, 0xf1, 0x6b, 0x78, 0xf6, 0x10, 0xc6, 0x52, 0x32, 0xa2, 0x3c, 0xc5, 0xce, 0x25, 0xda, 0x29, 0xa3, 0xd5, 0x84, 0x85, 0xd8, 0x7b, 0xd8, 0x3d, 0xb8, 0x18, 0x3f, 0x8}}, Era: ExtrinsicEra{IsImmortalEra: true, IsMortalEra: false, AsMortalEra: MortalEra{First: 0x0, Second: 0x0}}, Nonce: UCompact(*big.NewInt(1)), Tip: UCompact(*big.NewInt(2))}, Method: Call{CallIndex: CallIndex{SectionIndex: 0x3, MethodIndex: 0x0}, Args: Args{0xff, 0x8e, 0xaf, 0x4, 0x15, 0x16, 0x87, 0x73, 0x63, 0x26, 0xc9, 0xfe, 0xa1, 0x7e, 0x25, 0xfc, 0x52, 0x87, 0x61, 0x36, 0x93, 0xc9, 0x12, 0x90, 0x9c, 0xb2, 0x26, 0xaa, 0x47, 0x94, 0xf2, 0x6a, 0x48, 0xe5, 0x6c}}} //nolint:lll diff --git a/types/extrinsic_payload.go b/types/extrinsic_payload.go index 964bad1d8..aeb484f45 100644 --- a/types/extrinsic_payload.go +++ b/types/extrinsic_payload.go @@ -19,8 +19,8 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" ) // ExtrinsicPayloadV3 is a signing payload for an Extrinsic. For the final encoding, it is variable length based on diff --git a/types/extrinsic_payload_test.go b/types/extrinsic_payload_test.go index 6e3e35210..e10e6d098 100644 --- a/types/extrinsic_payload_test.go +++ b/types/extrinsic_payload_test.go @@ -19,12 +19,12 @@ package types_test import ( "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) -var examplaryExtrinsicPayload = ExtrinsicPayloadV4{ExtrinsicPayloadV3: ExtrinsicPayloadV3{Method: BytesBare{0x6, 0x0, 0xff, 0xd7, 0x56, 0x8e, 0x5f, 0xa, 0x7e, 0xda, 0x67, 0xa8, 0x26, 0x91, 0xff, 0x37, 0x9a, 0xc4, 0xbb, 0xa4, 0xf9, 0xc9, 0xb8, 0x59, 0xfe, 0x77, 0x9b, 0x5d, 0x46, 0x36, 0x3b, 0x61, 0xad, 0x2d, 0xb9, 0xe5, 0x6c}, Era: ExtrinsicEra{IsImmortalEra: false, IsMortalEra: true, AsMortalEra: MortalEra{First: 0x7, Second: 0x3}}, Nonce: NewUCompactFromUInt(0x1234), Tip: NewUCompactFromUInt(0x5678), SpecVersion: 0x7b, GenesisHash: Hash{0xdc, 0xd1, 0x34, 0x67, 0x1, 0xca, 0x83, 0x96, 0x49, 0x6e, 0x52, 0xaa, 0x27, 0x85, 0xb1, 0x74, 0x8d, 0xeb, 0x6d, 0xb0, 0x95, 0x51, 0xb7, 0x21, 0x59, 0xdc, 0xb3, 0xe0, 0x89, 0x91, 0x2, 0x5b}, BlockHash: Hash{0xde, 0x8f, 0x69, 0xee, 0xb5, 0xe0, 0x65, 0xe1, 0x8c, 0x69, 0x50, 0xff, 0x70, 0x8d, 0x7e, 0x55, 0x1f, 0x68, 0xdc, 0x9b, 0xf5, 0x9a, 0x7, 0xc5, 0x23, 0x67, 0xc0, 0x28, 0xf, 0x80, 0x5e, 0xc7}}, TransactionVersion: 1} //nolint:lll +var examplaryExtrinsicPayload = ExtrinsicPayloadV4{ExtrinsicPayloadV3: ExtrinsicPayloadV3{Method: BytesBare{0x6, 0x0, 0xff, 0xd7, 0x56, 0x8e, 0x5f, 0xa, 0x7e, 0xda, 0x67, 0xa8, 0x26, 0x91, 0xff, 0x37, 0x9a, 0xc4, 0xbb, 0xa4, 0xf9, 0xc9, 0xb8, 0x59, 0xfe, 0x77, 0x9b, 0x5d, 0x46, 0x36, 0x3b, 0x61, 0xad, 0x2d, 0xb9, 0xe5, 0x6c}, Era: ExtrinsicEra{IsImmortalEra: false, IsMortalEra: true, AsMortalEra: MortalEra{First: 0x7, Second: 0x3}}, Nonce: NewUCompactFromUInt(0x1234), Tip: NewUCompactFromUInt(0x5678), SpecVersion: 0x7b, GenesisHash: Hash{0xdc, 0xd1, 0x34, 0x67, 0x1, 0xca, 0x83, 0x96, 0x49, 0x6e, 0x52, 0xaa, 0x27, 0x85, 0xb1, 0x74, 0x8d, 0xeb, 0x6d, 0xb0, 0x95, 0x51, 0xb7, 0x21, 0x59, 0xdc, 0xb3, 0xe0, 0x89, 0x91, 0x2, 0x5b}, BlockHash: Hash{0xde, 0x8f, 0x69, 0xee, 0xb5, 0xe0, 0x65, 0xe1, 0x8c, 0x69, 0x50, 0xff, 0x70, 0x8d, 0x7e, 0x55, 0x1f, 0x68, 0xdc, 0x9b, 0xf5, 0x9a, 0x7, 0xc5, 0x23, 0x67, 0xc0, 0x28, 0xf, 0x80, 0x5e, 0xc7}}, TransactionVersion: 1} //nolint:lll func TestExtrinsicPayload(t *testing.T) { var era ExtrinsicEra diff --git a/types/extrinsic_signature.go b/types/extrinsic_signature.go index db6a827a7..3f8cc5c3a 100644 --- a/types/extrinsic_signature.go +++ b/types/extrinsic_signature.go @@ -25,7 +25,7 @@ type ExtrinsicSignatureV3 struct { } type ExtrinsicSignatureV4 struct { - Signer Address + Signer MultiAddress Signature MultiSignature Era ExtrinsicEra // extra via system::CheckEra Nonce UCompact // extra via system::CheckNonce (Compact where Index is u32)) diff --git a/types/extrinsic_signature_test.go b/types/extrinsic_signature_test.go index 64705a9c2..a64027f25 100644 --- a/types/extrinsic_signature_test.go +++ b/types/extrinsic_signature_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/extrinsic_status.go b/types/extrinsic_status.go index b364cd4d2..a36de8f14 100644 --- a/types/extrinsic_status.go +++ b/types/extrinsic_status.go @@ -21,7 +21,7 @@ import ( "fmt" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // ExtrinsicStatus is an enum containing the result of an extrinsic submission diff --git a/types/extrinsic_status_test.go b/types/extrinsic_status_test.go index 5bef32dad..1c6d97734 100644 --- a/types/extrinsic_status_test.go +++ b/types/extrinsic_status_test.go @@ -20,7 +20,7 @@ import ( "encoding/json" "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/extrinsic_test.go b/types/extrinsic_test.go index 362f69c67..874d44aa1 100644 --- a/types/extrinsic_test.go +++ b/types/extrinsic_test.go @@ -20,8 +20,8 @@ import ( "fmt" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/signature" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/signature" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) @@ -76,10 +76,10 @@ func TestExtrinsic_Sign(t *testing.T) { o := SignatureOptions{ BlockHash: NewHash(MustHexDecodeString("0xec7afaf1cca720ce88c1d1b689d81f0583cc15a97d621cf046dd9abf605ef22f")), // Era: ExtrinsicEra{IsImmortalEra: true}, - GenesisHash: NewHash(MustHexDecodeString("0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b")), - Nonce: NewUCompactFromUInt(1), - SpecVersion: 123, - Tip: NewUCompactFromUInt(2), + GenesisHash: NewHash(MustHexDecodeString("0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b")), + Nonce: NewUCompactFromUInt(1), + SpecVersion: 123, + Tip: NewUCompactFromUInt(2), TransactionVersion: 1, } diff --git a/types/hash_test.go b/types/hash_test.go index 5b6b5c21e..7ee1c1939 100644 --- a/types/hash_test.go +++ b/types/hash_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var hash20 = []byte{ diff --git a/types/header.go b/types/header.go index 0cb0ca7f1..430d026e9 100644 --- a/types/header.go +++ b/types/header.go @@ -22,7 +22,7 @@ import ( "strconv" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) type Header struct { @@ -33,6 +33,8 @@ type Header struct { Digest Digest `json:"digest"` } +// BlockNumber is represented decoded as a U32, but will be encoded as a compact uint (which has an additinoal length +// prefix). In most cases, you should use a U32 (or another custom type depending on your chain) instead. type BlockNumber U32 // UnmarshalJSON fills BlockNumber with the JSON encoded byte array given by bz diff --git a/types/header_examplary.go b/types/header_examplary.go index 1bb318629..f8515ea16 100644 --- a/types/header_examplary.go +++ b/types/header_examplary.go @@ -14,6 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build test + package types var ExamplaryHeader = Header{ParentHash: Hash{0xf6, 0xe0, 0xf9, 0xd, 0x27, 0x57, 0x8a, 0x18, 0xfc, 0x22, 0xcf, 0x10, 0x83, 0x3d, 0x7f, 0xb2, 0x86, 0xf9, 0x78, 0xce, 0x4e, 0x41, 0x1e, 0x87, 0xb2, 0x19, 0xc1, 0xd4, 0x98, 0xf6, 0xd3, 0x2c}, Number: 0xa, StateRoot: Hash{0x2e, 0x5e, 0x1e, 0xa0, 0x5f, 0xcd, 0xec, 0xca, 0xa, 0xa, 0xf0, 0xe9, 0x8d, 0xc5, 0xc3, 0x20, 0xcb, 0x62, 0x13, 0xad, 0xc2, 0x1f, 0x4f, 0xad, 0x2c, 0xf, 0xfc, 0x74, 0x7a, 0x18, 0x64, 0xc}, ExtrinsicsRoot: Hash{0xc4, 0x5f, 0x66, 0x5d, 0x47, 0xe4, 0x8e, 0x54, 0xf, 0x1c, 0x89, 0xd8, 0x7e, 0x8, 0x79, 0xb8, 0x0, 0x53, 0x34, 0xf0, 0x6e, 0x53, 0x7d, 0xaa, 0x7c, 0xe8, 0xab, 0x51, 0xcc, 0x12, 0x39, 0x1b}, Digest: Digest{DigestItem{IsOther: false, AsOther: Bytes(nil), IsAuthoritiesChange: false, AsAuthoritiesChange: []AuthorityID(nil), IsChangesTrieRoot: false, AsChangesTrieRoot: Hash{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, IsSealV0: false, AsSealV0: SealV0{Signer: 0x0, Signature: Signature{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, IsConsensus: false, AsConsensus: Consensus{ConsensusEngineID: 0x0, Bytes: Bytes(nil)}, IsSeal: false, AsSeal: Seal{ConsensusEngineID: 0x0, Bytes: Bytes(nil)}, IsPreRuntime: true, AsPreRuntime: PreRuntime{ConsensusEngineID: 0x45424142, Bytes: Bytes{0x2, 0x0, 0x0, 0x0, 0x0, 0xd9, 0xe8, 0x33, 0x1f, 0x0, 0x0, 0x0, 0x0}}}, DigestItem{IsOther: false, AsOther: Bytes(nil), IsAuthoritiesChange: false, AsAuthoritiesChange: []AuthorityID(nil), IsChangesTrieRoot: false, AsChangesTrieRoot: Hash{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, IsSealV0: false, AsSealV0: SealV0{Signer: 0x0, Signature: Signature{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, IsConsensus: false, AsConsensus: Consensus{ConsensusEngineID: 0x0, Bytes: Bytes(nil)}, IsSeal: true, AsSeal: Seal{ConsensusEngineID: 0x45424142, Bytes: Bytes{0xaa, 0x3f, 0x2f, 0x1, 0x50, 0x15, 0x4a, 0x9a, 0x6c, 0xe6, 0xb8, 0xf5, 0x18, 0x28, 0x8b, 0xc2, 0x92, 0xb2, 0x1, 0xf8, 0x36, 0x32, 0xdc, 0xf9, 0xeb, 0xd, 0x2d, 0x0, 0x5a, 0x38, 0xde, 0x2a, 0xa3, 0x67, 0x45, 0x31, 0xc7, 0x4, 0x46, 0x4e, 0xe6, 0x76, 0x88, 0x76, 0x83, 0x68, 0xba, 0xb8, 0x40, 0x11, 0x7, 0x6a, 0x35, 0xe8, 0xe6, 0xdd, 0x4a, 0xf5, 0x9d, 0xb4, 0x15, 0x5, 0x2f, 0x8d}}, IsPreRuntime: false, AsPreRuntime: PreRuntime{ConsensusEngineID: 0x0, Bytes: Bytes(nil)}}}} //nolint:lll diff --git a/types/header_test.go b/types/header_test.go index e27f20075..a49e21122 100644 --- a/types/header_test.go +++ b/types/header_test.go @@ -14,12 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build test + package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var exampleHeader = Header{ diff --git a/types/health_test.go b/types/health_test.go index a6b772cb9..93228e322 100644 --- a/types/health_test.go +++ b/types/health_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestHealth_EncodeDecode(t *testing.T) { diff --git a/types/int.go b/types/int.go index a6611c718..3bba9fca8 100644 --- a/types/int.go +++ b/types/int.go @@ -21,7 +21,7 @@ import ( "fmt" "math/big" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // I8 is a signed 8-bit integer diff --git a/types/int_test.go b/types/int_test.go index 0d741c5d6..dc737f34a 100644 --- a/types/int_test.go +++ b/types/int_test.go @@ -20,7 +20,7 @@ import ( "math/big" "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadata.go b/types/metadata.go index 24895a5ff..8b34b54ae 100644 --- a/types/metadata.go +++ b/types/metadata.go @@ -19,7 +19,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) const MagicNumber uint32 = 0x6174656d diff --git a/types/metadataV10.go b/types/metadataV10.go index da697513b..47ff37543 100644 --- a/types/metadataV10.go +++ b/types/metadataV10.go @@ -22,9 +22,9 @@ import ( "hash" "strings" - ghash "github.com/centrifuge/go-substrate-rpc-client/v2/hash" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/xxhash" + ghash "github.com/snowfork/go-substrate-rpc-client/v2/hash" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/xxhash" ) // Modelled after packages/types/src/Metadata/v10/Metadata.ts diff --git a/types/metadataV10_test.go b/types/metadataV10_test.go index 9a728cc70..250b3cb90 100644 --- a/types/metadataV10_test.go +++ b/types/metadataV10_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadataV11.go b/types/metadataV11.go index 633aad675..a686fb85a 100644 --- a/types/metadataV11.go +++ b/types/metadataV11.go @@ -1,6 +1,6 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // Modelled after packages/types/src/Metadata/v10/toV11.ts type MetadataV11 struct { diff --git a/types/metadataV11_test.go b/types/metadataV11_test.go index fb9356d50..62202aa83 100644 --- a/types/metadataV11_test.go +++ b/types/metadataV11_test.go @@ -3,7 +3,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadataV12.go b/types/metadataV12.go index 6f3e2c5d2..fa5da97be 100644 --- a/types/metadataV12.go +++ b/types/metadataV12.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Modelled after packages/types/src/Metadata/v11/toV12.ts diff --git a/types/metadataV12_test.go b/types/metadataV12_test.go index fe454aa31..09fcc2f2a 100644 --- a/types/metadataV12_test.go +++ b/types/metadataV12_test.go @@ -3,7 +3,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadataV4.go b/types/metadataV4.go index fc3ed667c..d169b392e 100644 --- a/types/metadataV4.go +++ b/types/metadataV4.go @@ -22,8 +22,8 @@ import ( "hash" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/xxhash" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/xxhash" "golang.org/x/crypto/blake2b" ) diff --git a/types/metadataV4_test.go b/types/metadataV4_test.go index b2c2c10e7..e49c0dc44 100644 --- a/types/metadataV4_test.go +++ b/types/metadataV4_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadataV7.go b/types/metadataV7.go index ae04f15ff..600ce6c06 100644 --- a/types/metadataV7.go +++ b/types/metadataV7.go @@ -21,8 +21,8 @@ import ( "hash" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/xxhash" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/xxhash" ) // Modelled after packages/types/src/Metadata/v7/Metadata.ts diff --git a/types/metadataV7_test.go b/types/metadataV7_test.go index a8a3a4675..00bfb0e73 100644 --- a/types/metadataV7_test.go +++ b/types/metadataV7_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var exampleMetadataV7 = Metadata{ diff --git a/types/metadataV8.go b/types/metadataV8.go index b29444ee1..2e0c69c80 100644 --- a/types/metadataV8.go +++ b/types/metadataV8.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Modelled after packages/types/src/Metadata/v8/Metadata.ts diff --git a/types/metadataV8_test.go b/types/metadataV8_test.go index dbd5fd184..ea5d6fa4b 100644 --- a/types/metadataV8_test.go +++ b/types/metadataV8_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/metadataV9.go b/types/metadataV9.go index 00d9b9cef..50c18dfc1 100644 --- a/types/metadataV9.go +++ b/types/metadataV9.go @@ -20,7 +20,7 @@ import ( "fmt" "strings" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Modelled after packages/types/src/Metadata/v9/Metadata.ts diff --git a/types/metadataV9_test.go b/types/metadataV9_test.go index 8aaaa33b8..e73e00c26 100644 --- a/types/metadataV9_test.go +++ b/types/metadataV9_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/mmr.go b/types/mmr.go new file mode 100644 index 000000000..3036905df --- /dev/null +++ b/types/mmr.go @@ -0,0 +1,91 @@ +package types + +import ( + "encoding/json" +) + +// GenerateMMRProofResponse contains the generate proof rpc response +type GenerateMMRProofResponse struct { + BlockHash H256 + Leaf MMRLeaf + Proof MMRProof +} + +// UnmarshalJSON fills u with the JSON encoded byte array given by b +func (d *GenerateMMRProofResponse) UnmarshalJSON(bz []byte) error { + var tmp struct { + BlockHash string `json:"blockHash"` + Leaf string `json:"leaf"` + Proof string `json:"proof"` + } + if err := json.Unmarshal(bz, &tmp); err != nil { + return err + } + err := DecodeFromHexString(tmp.BlockHash, &d.BlockHash) + if err != nil { + return err + } + var encodedLeaf MMREncodableOpaqueLeaf + err = DecodeFromHexString(tmp.Leaf, &encodedLeaf) + if err != nil { + return err + } + err = DecodeFromBytes(encodedLeaf, &d.Leaf) + if err != nil { + return err + } + err = DecodeFromHexString(tmp.Proof, &d.Proof) + if err != nil { + return err + } + return nil +} + +// MarshalJSON returns a JSON encoded byte array of u +// func (d GenerateMMRProofResponse) MarshalJSON() ([]byte, error) { +// logs := make([]string, len(d)) +// var err error +// for i, di := range d { +// logs[i], err = EncodeToHexString(di) +// if err != nil { +// return nil, err +// } +// } +// return json.Marshal(struct { +// Logs []string `json:"logs"` +// }{ +// Logs: logs, +// }) +// } + +type MMREncodableOpaqueLeaf Bytes + +// MMRProof is a MMR proof +type MMRProof struct { + // The index of the leaf the proof is for. + LeafIndex U64 + // Number of leaves in MMR, when the proof was generated. + LeafCount U64 + // Proof elements (hashes of siblings of inner nodes on the path to the leaf). + Items []H256 +} + +type MMRLeaf struct { + ParentNumberAndHash ParentNumberAndHash + ParachainHeads H256 + BeefyNextAuthoritySet BeefyNextAuthoritySet +} + +type ParentNumberAndHash struct { + ParentNumber U32 + Hash Hash +} + +type BeefyNextAuthoritySet struct { + // ID + ID U64 + // Number of validators in the set. + Len U32 + // Merkle Root Hash build from BEEFY uncompressed AuthorityIds. + Root H256 +} diff --git a/types/mmr_test.go b/types/mmr_test.go new file mode 100644 index 000000000..3611abb07 --- /dev/null +++ b/types/mmr_test.go @@ -0,0 +1,41 @@ +// Go Substrate RPC Client (GSRPC) provides APIs and types around Polkadot and any Substrate-based chain RPC calls +// +// Copyright 2019 Centrifuge GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package types_test + +import ( + "encoding/json" + "testing" + + . "github.com/snowfork/go-substrate-rpc-client/v2/types" +) + +func TestGenerateMMRProofResponse_Unmarshal(t *testing.T) { + jsonData := map[string]interface{}{"blockHash": "0x62318380e42f2a47f3b74d63bf1d7dc245920766759661f3beb51d35f9f2450e", "leaf": "0xc10198140000264e19fe1a3795cf2aefd6b260261674c6bf642af60eb499f8a4e4d976576375480907734fe2450e32a567628c22c5374c71b69d091e4c0219c571ed932a0e5301000000000000000200000007b13d25743592825cea32c9a24ba67b50b7e90d92cbd1d0f4eab2dc94dba5c6", "proof": "0x98140000000000009a1400000000000018fcb383a3d3f35fc452db71cd423925d8c8f9d0708de71e5a22d18e2a54fea0e98efb55ea18c7bec19de2c247e9bbcd0162c7b8fed10d43d9d88add1e80bcdf35839159300b267069f62c5bc7d3c02cd4f4186eb0355f62acda9ba3a6431f75c1887f4e400eef548eba662c01bf8c7a67608d56fbbc179ef890f2d55184e42b03685b29893fe0ebe38d937027b372e6e984aee88c19c14c80512f48975244beb224f2267daabe69303850a53272e70c00592d663a12d374db22c98a63c670bffb"} + + marshalled, err := json.Marshal(jsonData) + if err != nil { + panic(err) + } + + expected := GenerateMMRProofResponse{BlockHash: H256{0x62, 0x31, 0x83, 0x80, 0xe4, 0x2f, 0x2a, 0x47, 0xf3, 0xb7, 0x4d, 0x63, 0xbf, 0x1d, 0x7d, 0xc2, 0x45, 0x92, 0x7, 0x66, 0x75, 0x96, 0x61, 0xf3, 0xbe, 0xb5, 0x1d, 0x35, 0xf9, 0xf2, 0x45, 0xe}, Leaf: MMRLeaf{ParentNumberAndHash: ParentNumberAndHash{ParentNumber: 0x1498, Hash: Hash{0x26, 0x4e, 0x19, 0xfe, 0x1a, 0x37, 0x95, 0xcf, 0x2a, 0xef, 0xd6, 0xb2, 0x60, 0x26, 0x16, 0x74, 0xc6, 0xbf, 0x64, 0x2a, 0xf6, 0xe, 0xb4, 0x99, 0xf8, 0xa4, 0xe4, 0xd9, 0x76, 0x57, 0x63, 0x75}}, ParachainHeads: H256{0x48, 0x9, 0x7, 0x73, 0x4f, 0xe2, 0x45, 0xe, 0x32, 0xa5, 0x67, 0x62, 0x8c, 0x22, 0xc5, 0x37, 0x4c, 0x71, 0xb6, 0x9d, 0x9, 0x1e, 0x4c, 0x2, 0x19, 0xc5, 0x71, 0xed, 0x93, 0x2a, 0xe, 0x53}, BeefyNextAuthoritySet: BeefyNextAuthoritySet{ID: 0x1, Len: 0x2, Root: H256{0x7, 0xb1, 0x3d, 0x25, 0x74, 0x35, 0x92, 0x82, 0x5c, 0xea, 0x32, 0xc9, 0xa2, 0x4b, 0xa6, 0x7b, 0x50, 0xb7, 0xe9, 0xd, 0x92, 0xcb, 0xd1, 0xd0, 0xf4, 0xea, 0xb2, 0xdc, 0x94, 0xdb, 0xa5, 0xc6}}}, Proof: MMRProof{LeafIndex: 0x1498, LeafCount: 0x149a, Items: []H256{H256{0xfc, 0xb3, 0x83, 0xa3, 0xd3, 0xf3, 0x5f, 0xc4, 0x52, 0xdb, 0x71, 0xcd, 0x42, 0x39, 0x25, 0xd8, 0xc8, 0xf9, 0xd0, 0x70, 0x8d, 0xe7, 0x1e, 0x5a, 0x22, 0xd1, 0x8e, 0x2a, 0x54, 0xfe, 0xa0, 0xe9}, H256{0x8e, 0xfb, 0x55, 0xea, 0x18, 0xc7, 0xbe, 0xc1, 0x9d, 0xe2, 0xc2, 0x47, 0xe9, 0xbb, 0xcd, 0x1, 0x62, 0xc7, 0xb8, 0xfe, 0xd1, 0xd, 0x43, 0xd9, 0xd8, 0x8a, 0xdd, 0x1e, 0x80, 0xbc, 0xdf, 0x35}, H256{0x83, 0x91, 0x59, 0x30, 0xb, 0x26, 0x70, 0x69, 0xf6, 0x2c, 0x5b, 0xc7, 0xd3, 0xc0, 0x2c, 0xd4, 0xf4, 0x18, 0x6e, 0xb0, 0x35, 0x5f, 0x62, 0xac, 0xda, 0x9b, 0xa3, 0xa6, 0x43, 0x1f, 0x75, 0xc1}, H256{0x88, 0x7f, 0x4e, 0x40, 0xe, 0xef, 0x54, 0x8e, 0xba, 0x66, 0x2c, 0x1, 0xbf, 0x8c, 0x7a, 0x67, 0x60, 0x8d, 0x56, 0xfb, 0xbc, 0x17, 0x9e, 0xf8, 0x90, 0xf2, 0xd5, 0x51, 0x84, 0xe4, 0x2b, 0x3}, H256{0x68, 0x5b, 0x29, 0x89, 0x3f, 0xe0, 0xeb, 0xe3, 0x8d, 0x93, 0x70, 0x27, 0xb3, 0x72, 0xe6, 0xe9, 0x84, 0xae, 0xe8, 0x8c, 0x19, 0xc1, 0x4c, 0x80, 0x51, 0x2f, 0x48, 0x97, 0x52, 0x44, 0xbe, 0xb2}, H256{0x24, 0xf2, 0x26, 0x7d, 0xaa, 0xbe, 0x69, 0x30, 0x38, 0x50, 0xa5, 0x32, 0x72, 0xe7, 0xc, 0x0, 0x59, 0x2d, 0x66, 0x3a, 0x12, 0xd3, 0x74, 0xdb, 0x22, 0xc9, 0x8a, 0x63, 0xc6, 0x70, 0xbf, 0xfb}}}} + + var unmarshalled GenerateMMRProofResponse + + json.Unmarshal(marshalled, &unmarshalled) + + assertEqual(t, unmarshalled, expected) +} diff --git a/types/moment.go b/types/moment.go index 9324eb954..8dc551c0e 100644 --- a/types/moment.go +++ b/types/moment.go @@ -21,7 +21,7 @@ import ( "math" "time" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) const ( diff --git a/types/moment_test.go b/types/moment_test.go index a30ba1e58..84320ecc6 100644 --- a/types/moment_test.go +++ b/types/moment_test.go @@ -20,7 +20,7 @@ import ( "testing" "time" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestMoment_EncodeDecode(t *testing.T) { diff --git a/types/multi_address.go b/types/multi_address.go new file mode 100644 index 000000000..618487550 --- /dev/null +++ b/types/multi_address.go @@ -0,0 +1,125 @@ +package types + +import ( + "fmt" + + "github.com/snowfork/go-substrate-rpc-client/v2/scale" +) + +type MultiAddress struct { + IsID bool + AsID AccountID + IsIndex bool + AsIndex AccountIndex + IsRaw bool + AsRaw []byte + IsAddress32 bool + AsAddress32 [32]byte + IsAddress20 bool + AsAddress20 [20]byte +} + +// NewMultiAddressFromAccountID creates an Address from the given AccountID (public key) +func NewMultiAddressFromAccountID(b []byte) MultiAddress { + return MultiAddress{ + IsID: true, + AsID: NewAccountID(b), + } +} + +// NewMultiAddressFromHexAccountID creates an Address from the given hex string that contains an AccountID (public key) +func NewMultiAddressFromHexAccountID(str string) (MultiAddress, error) { + b, err := HexDecodeString(str) + if err != nil { + return MultiAddress{}, err + } + return NewMultiAddressFromAccountID(b), nil +} + +func (m MultiAddress) Encode(encoder scale.Encoder) error { + var err error + switch { + case m.IsID: + err = encoder.PushByte(0) + if err != nil { + return err + } + err = encoder.Encode(m.AsID) + if err != nil { + return err + } + case m.IsIndex: + err = encoder.PushByte(1) + if err != nil { + return err + } + err = encoder.Encode(m.AsIndex) + if err != nil { + return err + } + case m.IsRaw: + err = encoder.PushByte(2) + if err != nil { + return err + } + err = encoder.Encode(m.AsRaw) + if err != nil { + return err + } + case m.IsAddress32: + err = encoder.PushByte(3) + if err != nil { + return err + } + err = encoder.Encode(m.AsAddress32) + if err != nil { + return err + } + case m.IsAddress20: + err = encoder.PushByte(4) + if err != nil { + return err + } + err = encoder.Encode(m.AsAddress20) + if err != nil { + return err + } + default: + return fmt.Errorf("Invalid variant for MultiAddress") + } + + return nil +} + +func (m MultiAddress) Decode(decoder scale.Decoder) error { + tag, err := decoder.ReadOneByte() + if err != nil { + return err + } + + switch tag { + case 0: + m.IsID = true + err = decoder.Decode(&m.AsID) + case 1: + m.IsIndex = true + err = decoder.Decode(&m.AsIndex) + case 2: + m.IsRaw = true + err = decoder.Decode(&m.AsRaw) + case 3: + m.IsAddress32 = true + err = decoder.Decode(&m.AsAddress32) + case 4: + m.IsAddress20 = true + err = decoder.Decode(&m.AsAddress20) + default: + return fmt.Errorf("Invalid variant for MultiAddress") + } + + if err != nil { + return err + } + + return nil +} diff --git a/types/multi_signature.go b/types/multi_signature.go index 1a81c560a..ac6a5cf6b 100644 --- a/types/multi_signature.go +++ b/types/multi_signature.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // MultiSignature type MultiSignature struct { diff --git a/types/multi_signature_test.go b/types/multi_signature_test.go index f8c620a41..898d2e351 100644 --- a/types/multi_signature_test.go +++ b/types/multi_signature_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var testMultiSig1 = MultiSignature{IsEd25519: true, AsEd25519: NewSignature(hash64)} diff --git a/types/network_state_test.go b/types/network_state_test.go index 3c6fbc2e2..6db34eb9f 100644 --- a/types/network_state_test.go +++ b/types/network_state_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestNetworkState_EncodeDecode(t *testing.T) { diff --git a/types/null.go b/types/null.go index 06ddb6f6a..65329c3a7 100644 --- a/types/null.go +++ b/types/null.go @@ -17,7 +17,7 @@ package types import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Null is a type that does not contain anything (apart from null) diff --git a/types/null_test.go b/types/null_test.go index 871aec714..0374ceab5 100644 --- a/types/null_test.go +++ b/types/null_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestNull_EncodeDecode(t *testing.T) { diff --git a/types/option_bool.go b/types/option_bool.go index 5437c4ff7..4d5be999c 100644 --- a/types/option_bool.go +++ b/types/option_bool.go @@ -19,7 +19,7 @@ package types import ( "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // OptionBool is a structure that can store a Bool or a missing value diff --git a/types/option_bool_test.go b/types/option_bool_test.go index a93cfb545..3f07e72ed 100644 --- a/types/option_bool_test.go +++ b/types/option_bool_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestOptionBool_EncodeDecode(t *testing.T) { diff --git a/types/option_bytes.go b/types/option_bytes.go index 8a05386c7..139a30e27 100644 --- a/types/option_bytes.go +++ b/types/option_bytes.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // OptionBytes is a structure that can store a Bytes or a missing value type OptionBytes struct { diff --git a/types/option_bytes_test.go b/types/option_bytes_test.go index 7c509d544..8baa62583 100644 --- a/types/option_bytes_test.go +++ b/types/option_bytes_test.go @@ -21,7 +21,7 @@ import ( "github.com/stretchr/testify/assert" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestOptionBytes8_EncodeDecode(t *testing.T) { diff --git a/types/option_hash.go b/types/option_hash.go index c1616c7f8..e72c660e9 100644 --- a/types/option_hash.go +++ b/types/option_hash.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // OptionH160 is a structure that can store a H160 or a missing value type OptionH160 struct { diff --git a/types/option_hash_test.go b/types/option_hash_test.go index 54172278c..0c6866c79 100644 --- a/types/option_hash_test.go +++ b/types/option_hash_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestOptionH160_EncodeDecode(t *testing.T) { diff --git a/types/option_int.go b/types/option_int.go index 12ba52286..d442e3337 100644 --- a/types/option_int.go +++ b/types/option_int.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // OptionI8 is a structure that can store a I8 or a missing value type OptionI8 struct { diff --git a/types/option_int_test.go b/types/option_int_test.go index 39e9758da..64221611a 100644 --- a/types/option_int_test.go +++ b/types/option_int_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestOptionI8_EncodeDecode(t *testing.T) { diff --git a/types/option_uint.go b/types/option_uint.go index 91ef915ef..1a80d27d3 100644 --- a/types/option_uint.go +++ b/types/option_uint.go @@ -16,7 +16,7 @@ package types -import "github.com/centrifuge/go-substrate-rpc-client/v2/scale" +import "github.com/snowfork/go-substrate-rpc-client/v2/scale" // OptionU8 is a structure that can store a U8 or a missing value type OptionU8 struct { diff --git a/types/option_uint_test.go b/types/option_uint_test.go index 7fab92839..ce6a4277c 100644 --- a/types/option_uint_test.go +++ b/types/option_uint_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestOptionU8_EncodeDecode(t *testing.T) { diff --git a/types/origin.go b/types/origin.go index 732f00955..5a6ab4ac1 100644 --- a/types/origin.go +++ b/types/origin.go @@ -17,7 +17,7 @@ package types import ( - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // Origin is an internal-only value that will be ignored when encoding/decoding diff --git a/types/origin_test.go b/types/origin_test.go index 4303d018e..17fdf558e 100644 --- a/types/origin_test.go +++ b/types/origin_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) // newOrigin creates a new Origin type. This function is not exported by purpose – Origin should be ignored and not be diff --git a/types/peer_info_test.go b/types/peer_info_test.go index 4190426b6..31548df94 100644 --- a/types/peer_info_test.go +++ b/types/peer_info_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) var testPeerInfo = PeerInfo{ diff --git a/types/runtime_version.go b/types/runtime_version.go index bd4dd9054..e27d9806f 100644 --- a/types/runtime_version.go +++ b/types/runtime_version.go @@ -20,7 +20,7 @@ import ( "encoding/json" "fmt" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) type RuntimeVersion struct { diff --git a/types/runtime_version_test.go b/types/runtime_version_test.go index e4da7e431..63be0e299 100644 --- a/types/runtime_version_test.go +++ b/types/runtime_version_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/signature_test.go b/types/signature_test.go index 415329e32..3ec3adeea 100644 --- a/types/signature_test.go +++ b/types/signature_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestSignature_EncodeDecode(t *testing.T) { diff --git a/types/signed_block_examplary.go b/types/signed_block_examplary.go index e8e431be9..451a75c71 100644 --- a/types/signed_block_examplary.go +++ b/types/signed_block_examplary.go @@ -14,6 +14,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build test + package types var ExamplarySignedBlock = SignedBlock{Block: Block{Header: ExamplaryHeader, Extrinsics: nil}, Justification: Justification{0xc1, 0x13}} //nolint:lll diff --git a/types/signed_block_test.go b/types/signed_block_test.go index fc713caf9..41b8ba1d3 100644 --- a/types/signed_block_test.go +++ b/types/signed_block_test.go @@ -14,12 +14,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +// +build test + package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/storage_change_set_test.go b/types/storage_change_set_test.go index d554e4609..83b7406c8 100644 --- a/types/storage_change_set_test.go +++ b/types/storage_change_set_test.go @@ -20,7 +20,7 @@ import ( "encoding/json" "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/storage_data_raw.go b/types/storage_data_raw.go index 6b32944d6..0847f671e 100644 --- a/types/storage_data_raw.go +++ b/types/storage_data_raw.go @@ -20,7 +20,7 @@ import ( "fmt" "io" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // StorageDataRaw contains raw bytes that are not decoded/encoded. diff --git a/types/storage_data_raw_test.go b/types/storage_data_raw_test.go index 845ad13bd..d263ac1c2 100644 --- a/types/storage_data_raw_test.go +++ b/types/storage_data_raw_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/storage_key.go b/types/storage_key.go index 07132fd48..51c2b8d80 100644 --- a/types/storage_key.go +++ b/types/storage_key.go @@ -20,8 +20,8 @@ import ( "fmt" "io" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - "github.com/centrifuge/go-substrate-rpc-client/v2/xxhash" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/xxhash" ) // StorageKey represents typically hashed storage keys of the system. diff --git a/types/storage_key_test.go b/types/storage_key_test.go index d36d7c487..959654ccc 100644 --- a/types/storage_key_test.go +++ b/types/storage_key_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/test_utils_test.go b/types/test_utils_test.go index c265e3793..fd21ce37a 100644 --- a/types/test_utils_test.go +++ b/types/test_utils_test.go @@ -22,8 +22,8 @@ import ( "reflect" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/text_test.go b/types/text_test.go index 8387e7d1c..3b844d69e 100644 --- a/types/text_test.go +++ b/types/text_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestString_EncodeDecode(t *testing.T) { diff --git a/types/type_test.go b/types/type_test.go index 39e5ee489..beb900aa5 100644 --- a/types/type_test.go +++ b/types/type_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestType_EncodeDecode(t *testing.T) { diff --git a/types/ucompact.go b/types/ucompact.go index b7910a039..f652591ec 100644 --- a/types/ucompact.go +++ b/types/ucompact.go @@ -19,7 +19,7 @@ package types import ( "math/big" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) type UCompact big.Int diff --git a/types/uint.go b/types/uint.go index 7498e6f78..088330f0d 100644 --- a/types/uint.go +++ b/types/uint.go @@ -21,7 +21,7 @@ import ( "fmt" "math/big" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" ) // U8 is an unsigned 8-bit integer diff --git a/types/uint_test.go b/types/uint_test.go index 047af276c..c16000e36 100644 --- a/types/uint_test.go +++ b/types/uint_test.go @@ -21,8 +21,8 @@ import ( "math/big" "testing" - "github.com/centrifuge/go-substrate-rpc-client/v2/scale" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + "github.com/snowfork/go-substrate-rpc-client/v2/scale" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" "github.com/stretchr/testify/assert" ) diff --git a/types/usize_test.go b/types/usize_test.go index 36c668e58..4a4a68997 100644 --- a/types/usize_test.go +++ b/types/usize_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestUSize_EncodeDecode(t *testing.T) { diff --git a/types/weight_multiplier_test.go b/types/weight_multiplier_test.go index e9ea9c7c2..97fffb34a 100644 --- a/types/weight_multiplier_test.go +++ b/types/weight_multiplier_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestWeightMultiplier_EncodeDecode(t *testing.T) { diff --git a/types/weight_test.go b/types/weight_test.go index c6d84702a..d44c1851d 100644 --- a/types/weight_test.go +++ b/types/weight_test.go @@ -19,7 +19,7 @@ package types_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/types" + . "github.com/snowfork/go-substrate-rpc-client/v2/types" ) func TestWeight_EncodeDecode(t *testing.T) { diff --git a/xxhash/xxhash_test.go b/xxhash/xxhash_test.go index 691bfdb34..8795bbf79 100644 --- a/xxhash/xxhash_test.go +++ b/xxhash/xxhash_test.go @@ -19,7 +19,7 @@ package xxhash_test import ( "testing" - . "github.com/centrifuge/go-substrate-rpc-client/v2/xxhash" + . "github.com/snowfork/go-substrate-rpc-client/v2/xxhash" "github.com/stretchr/testify/assert" )