diff --git a/dot/rpc/modules/state.go b/dot/rpc/modules/state.go index 33441bf24d..ee22373ca5 100644 --- a/dot/rpc/modules/state.go +++ b/dot/rpc/modules/state.go @@ -24,7 +24,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/scale" + "github.com/ChainSafe/gossamer/pkg/scale" ) // StateCallRequest holds json fields @@ -272,8 +272,9 @@ func (sm *StateModule) GetMetadata(r *http.Request, req *StateRuntimeMetadataQue return err } - decoded, err := scale.Decode(metadata, []byte{}) - *res = StateMetadataResponse(common.BytesToHex(decoded.([]byte))) + var decoded []byte + err = scale.Unmarshal(metadata, &decoded) + *res = StateMetadataResponse(common.BytesToHex(decoded)) return err } diff --git a/dot/rpc/modules/system.go b/dot/rpc/modules/system.go index a3885ad0b9..46a9b3e23a 100644 --- a/dot/rpc/modules/system.go +++ b/dot/rpc/modules/system.go @@ -24,7 +24,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/crypto" - "github.com/ChainSafe/gossamer/lib/scale" + "github.com/ChainSafe/gossamer/pkg/scale" ctypes "github.com/centrifuge/go-substrate-rpc-client/v3/types" ) @@ -196,12 +196,13 @@ func (sm *SystemModule) AccountNextIndex(r *http.Request, req *StringRequest, re if err != nil { return err } - sdMeta, err := scale.Decode(rawMeta, []byte{}) + var sdMeta []byte + err = scale.Unmarshal(rawMeta, &sdMeta) if err != nil { return err } var metadata ctypes.Metadata - err = ctypes.DecodeFromBytes(sdMeta.([]byte), &metadata) + err = ctypes.DecodeFromBytes(sdMeta, &metadata) if err != nil { return err }