From a65d7bfa95964a8ef0df20214133fc8bb232da90 Mon Sep 17 00:00:00 2001 From: Eduard Voiculescu Date: Thu, 1 Aug 2024 14:15:25 -0400 Subject: [PATCH] bump substrate sf lib --- go.mod | 2 -- go.sum | 4 --- main.go | 93 --------------------------------------------------------- 3 files changed, 99 deletions(-) delete mode 100644 main.go diff --git a/go.mod b/go.mod index 5ef986e..bf7bbdb 100644 --- a/go.mod +++ b/go.mod @@ -10,8 +10,6 @@ replace github.com/centrifuge/go-substrate-rpc-client/v4 => github.com/streaming require ( github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1 - github.com/gobeam/stringy v0.0.7 - github.com/planetscale/vtprotobuf v0.6.0 github.com/spf13/cobra v1.7.0 github.com/streamingfast/bstream v0.0.2-0.20240619142813-9d23840859bf github.com/streamingfast/cli v0.0.4-0.20240412191021-5f81842cb71d diff --git a/go.sum b/go.sum index 5e35907..9738838 100644 --- a/go.sum +++ b/go.sum @@ -239,8 +239,6 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= -github.com/gobeam/stringy v0.0.7 h1:TD8SfhedUoiANhW88JlJqfrMsihskIRpU/VTsHGnAps= -github.com/gobeam/stringy v0.0.7/go.mod h1:W3620X9dJHf2FSZF5fRnWekHcHQjwmCz8ZQ2d1qloqE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -480,8 +478,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/planetscale/vtprotobuf v0.6.0 h1:nBeETjudeJ5ZgBHUz1fVHvbqUKnYOXNhsIEabROxmNA= -github.com/planetscale/vtprotobuf v0.6.0/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= diff --git a/main.go b/main.go deleted file mode 100644 index ec28db5..0000000 --- a/main.go +++ /dev/null @@ -1,93 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "reflect" - "strings" - - gsrpc "github.com/centrifuge/go-substrate-rpc-client/v4" - "github.com/centrifuge/go-substrate-rpc-client/v4/registry" - exec "github.com/centrifuge/go-substrate-rpc-client/v4/registry/exec" - "github.com/centrifuge/go-substrate-rpc-client/v4/registry/parser" - retriever "github.com/centrifuge/go-substrate-rpc-client/v4/registry/retriever" - "github.com/centrifuge/go-substrate-rpc-client/v4/rpc/chain/generic" - "github.com/centrifuge/go-substrate-rpc-client/v4/types" - "github.com/gobeam/stringy" - gen_types "github.com/streamingfast/firehose-gear/templates" -) - -func main() { - //blockHash, err := types.NewHashFromHexString("0xdacec8ff307e047ff4dfa08a1a59dea0326b12902658e52de310a4214c04686c") - blockHash, err := types.NewHashFromHexString("0xce88000c2153e31e367b800723aa3d78c537834e20439b2eb4c5db3870cd8e4c") - //blockHash, err := types.NewHashFromHexString("0xafd423f4bebb20864e535197b732c343ba72bb446574c9ceb117bf4f721098da") - if err != nil { - log.Fatalf("Failed to create block hash: %v", err) - } - - url := "https://vara-mainnet.public.blastapi.io" // Replace with the actual URL of your Gear Tech node - api, err := gsrpc.NewSubstrateAPI(url) - if err != nil { - log.Fatal("Error creating API instance") - } - - block, err := api.RPC.Chain.GetBlock(blockHash) - if err != nil { - log.Fatalf("Failed to get block: %v", err) - } - - j, err := json.MarshalIndent(block, "", " ") - if err != nil { - log.Fatalf("Failed to marshal block: %v", err) - } - _ = j - // fmt.Println("block: ", string(j)) - - chain := generic.NewDefaultChain(api.Client) - factory := registry.NewFactory() - - extrinsicParser := parser.NewDefaultExtrinsicParser() - extrinsicRetriever, err := retriever.NewDefaultExtrinsicRetriever( - extrinsicParser, - chain, - api.RPC.State, - factory, - exec.NewRetryableExecutor[*generic.DefaultGenericSignedBlock](), - exec.NewRetryableExecutor[[]*parser.DefaultExtrinsic](), - ) - - if err != nil { - log.Fatalf("Error creating extrinsic retriever: %v", err) - } - - extrinsics, err := extrinsicRetriever.GetExtrinsics(blockHash) - if err != nil { - log.Fatalf("Failed to get extrinsics: %v", err) - } - - metadata, err := api.RPC.State.GetMetadata(blockHash) - if err != nil { - log.Fatalf("Failed to get metadata: %v", err) - } - _ = metadata - - for _, extrinsic := range extrinsics { - parts := strings.Split(extrinsic.Name, ".") - pallet := parts[0] - call := parts[1] - call = stringy.New(call).PascalCase().Get() - - structName := pallet + "_" + call + "Call" - funcName := "To_" + structName - - if fn, found := gen_types.FuncMap[funcName]; found { - o := fn.Call([]reflect.Value{reflect.ValueOf(extrinsic.CallFields)}) - fmt.Println(funcName+":", o) - continue - } - - fmt.Println("WTF:", funcName) - - } -}