From 7a1de7bbf70f60b065660ece212fa32af7a69d5a Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 7 May 2024 10:49:33 -0700 Subject: [PATCH 1/7] Update flowkit --- go.mod | 2 +- go.sum | 2 ++ internal/v1_1/generator.go | 2 +- internal/v1_1/generator_test.go | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index ee98ad0..ce08b96 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hexops/autogold/v2 v2.2.1 github.com/onflow/cadence v0.42.10 github.com/onflow/flow-go-sdk v0.46.2 - github.com/onflow/flowkit v1.17.3 + github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd github.com/onflow/go-ethereum v1.13.4 github.com/spf13/afero v1.10.0 github.com/stoewer/go-strcase v1.3.0 diff --git a/go.sum b/go.sum index 9777da9..01eba42 100644 --- a/go.sum +++ b/go.sum @@ -749,6 +749,8 @@ github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9 github.com/onflow/flow/protobuf/go/flow v0.4.0/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/flowkit v1.17.3 h1:0Fi3tLnieWOYq95A3ySk3TZ0GUPtKaX8ofssgve9e58= github.com/onflow/flowkit v1.17.3/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= +github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd h1:JiU0WwZkHtbX1oYq4X6sC0xFnfSa1OWfmMBJrYoZ2VE= +github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc= github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY= github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead h1:2j1Unqs76Z1b95Gu4C3Y28hzNUHBix7wL490e61SMSw= diff --git a/internal/v1_1/generator.go b/internal/v1_1/generator.go index 7280881..94efd7f 100644 --- a/internal/v1_1/generator.go +++ b/internal/v1_1/generator.go @@ -50,7 +50,7 @@ func NewTemplateGenerator(contractInfos ContractInfos, logger output.Logger) (*G return nil, fmt.Errorf("could not create grpc gateway for mainnet %w", err) } - state, err := flowkit.Init(loader, crypto.ECDSA_P256, crypto.SHA3_256) + state, err := flowkit.Init(loader, crypto.ECDSA_P256, crypto.SHA3_256, "") if err != nil { return nil, fmt.Errorf("could not initialize flowkit state %w", err) } diff --git a/internal/v1_1/generator_test.go b/internal/v1_1/generator_test.go index 5a29d53..ee003ce 100644 --- a/internal/v1_1/generator_test.go +++ b/internal/v1_1/generator_test.go @@ -418,7 +418,7 @@ func newAccount(name string, address string, seed string) *accounts.Account { } func setup(rw flowkit.ReaderWriter) (*flowkit.State, *flowkit.Flowkit, *mocks.TestGateway) { - state, err := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256) + state, err := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") if err != nil { panic(err) } From c85261935c2ea4f9f92286d500800d2e9a7afcdb Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 7 May 2024 11:05:20 -0700 Subject: [PATCH 2/7] Update flowkit --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index ce08b96..755d5a6 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hexops/autogold/v2 v2.2.1 github.com/onflow/cadence v0.42.10 github.com/onflow/flow-go-sdk v0.46.2 - github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd + github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8 github.com/onflow/go-ethereum v1.13.4 github.com/spf13/afero v1.10.0 github.com/stoewer/go-strcase v1.3.0 diff --git a/go.sum b/go.sum index 01eba42..9737958 100644 --- a/go.sum +++ b/go.sum @@ -747,10 +747,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9j github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9Cy9LVoAiU9t/E= github.com/onflow/flow/protobuf/go/flow v0.4.0/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flowkit v1.17.3 h1:0Fi3tLnieWOYq95A3ySk3TZ0GUPtKaX8ofssgve9e58= -github.com/onflow/flowkit v1.17.3/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= -github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd h1:JiU0WwZkHtbX1oYq4X6sC0xFnfSa1OWfmMBJrYoZ2VE= -github.com/onflow/flowkit v1.17.4-0.20240507174444-8cbf41738efd/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= +github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8 h1:59gqw1cXdvyV+jYbItoqULLxcA1MWrTSzcSsgRIXEto= +github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc= github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY= github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead h1:2j1Unqs76Z1b95Gu4C3Y28hzNUHBix7wL490e61SMSw= From 13c7ba46c111c8dc5496c5ddcff4a162a33fe2c4 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Mon, 13 May 2024 16:35:52 -0700 Subject: [PATCH 3/7] Update flowkit --- go.mod | 2 +- go.sum | 2 ++ internal/v1_1/generator.go | 12 ++++++++++-- internal/v1_1/generator_test.go | 4 +++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 755d5a6..88e9a78 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hexops/autogold/v2 v2.2.1 github.com/onflow/cadence v0.42.10 github.com/onflow/flow-go-sdk v0.46.2 - github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8 + github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081 github.com/onflow/go-ethereum v1.13.4 github.com/spf13/afero v1.10.0 github.com/stoewer/go-strcase v1.3.0 diff --git a/go.sum b/go.sum index 9737958..5689333 100644 --- a/go.sum +++ b/go.sum @@ -749,6 +749,8 @@ github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9 github.com/onflow/flow/protobuf/go/flow v0.4.0/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8 h1:59gqw1cXdvyV+jYbItoqULLxcA1MWrTSzcSsgRIXEto= github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= +github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081 h1:WrJKL0bBQXOiggqjjdhBJNriC9glMSACjWRKZK4Xe9o= +github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc= github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY= github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead h1:2j1Unqs76Z1b95Gu4C3Y28hzNUHBix7wL490e61SMSw= diff --git a/internal/v1_1/generator.go b/internal/v1_1/generator.go index 94efd7f..92f3dac 100644 --- a/internal/v1_1/generator.go +++ b/internal/v1_1/generator.go @@ -4,6 +4,8 @@ import ( "context" "encoding/json" "fmt" + "github.com/onflow/flow-go-sdk/crypto" + "github.com/onflow/flowkit/accounts" "strings" "github.com/onflow/cadence/runtime/ast" @@ -12,7 +14,6 @@ import ( "github.com/onflow/cadence/runtime/parser" "github.com/onflow/flixkit-go/internal/contracts" "github.com/onflow/flow-go-sdk" - "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flowkit" "github.com/onflow/flowkit/config" "github.com/onflow/flowkit/gateway" @@ -50,10 +51,17 @@ func NewTemplateGenerator(contractInfos ContractInfos, logger output.Logger) (*G return nil, fmt.Errorf("could not create grpc gateway for mainnet %w", err) } - state, err := flowkit.Init(loader, crypto.ECDSA_P256, crypto.SHA3_256, "") + state, err := flowkit.Init(loader) if err != nil { return nil, fmt.Errorf("could not initialize flowkit state %w", err) } + + emulatorAccount, err := accounts.NewEmulatorAccount(loader, crypto.ECDSA_P256, crypto.SHA3_256, "") + if err != nil { + return nil, fmt.Errorf("could not create emulator account %w", err) + } + state.Accounts().AddOrUpdate(emulatorAccount) + testnetClient := flowkit.NewFlowkit(state, config.TestnetNetwork, gwt, logger) mainnetClient := flowkit.NewFlowkit(state, config.MainnetNetwork, gwm, logger) // add core contracts to deployed contracts diff --git a/internal/v1_1/generator_test.go b/internal/v1_1/generator_test.go index ee003ce..addf9eb 100644 --- a/internal/v1_1/generator_test.go +++ b/internal/v1_1/generator_test.go @@ -418,10 +418,12 @@ func newAccount(name string, address string, seed string) *accounts.Account { } func setup(rw flowkit.ReaderWriter) (*flowkit.State, *flowkit.Flowkit, *mocks.TestGateway) { - state, err := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") + state, err := flowkit.Init(rw) if err != nil { panic(err) } + emulatorServiceAccount, err := accounts.NewEmulatorAccount(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") + state.Accounts().AddOrUpdate(emulatorServiceAccount) gw := mocks.DefaultMockGateway() logger := output.NewStdoutLogger(output.NoneLog) flowkit := flowkit.NewFlowkit(state, config.TestnetNetwork, gw.Mock, logger) From 6818bc6329578c4ac3fd0adc655dd6e3443140a2 Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Mon, 13 May 2024 16:39:08 -0700 Subject: [PATCH 4/7] Run lintfix --- internal/v1_1/generator.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/v1_1/generator.go b/internal/v1_1/generator.go index 92f3dac..9b6faea 100644 --- a/internal/v1_1/generator.go +++ b/internal/v1_1/generator.go @@ -4,9 +4,10 @@ import ( "context" "encoding/json" "fmt" + "strings" + "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flowkit/accounts" - "strings" "github.com/onflow/cadence/runtime/ast" "github.com/onflow/cadence/runtime/cmd" From 9a795bdd39d789afa6598e49cc8bd14df7e0909a Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Mon, 13 May 2024 16:40:14 -0700 Subject: [PATCH 5/7] Run go mod tidy --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 5689333..020a126 100644 --- a/go.sum +++ b/go.sum @@ -747,8 +747,6 @@ github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9j github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9Cy9LVoAiU9t/E= github.com/onflow/flow/protobuf/go/flow v0.4.0/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8 h1:59gqw1cXdvyV+jYbItoqULLxcA1MWrTSzcSsgRIXEto= -github.com/onflow/flowkit v1.17.4-0.20240507180449-b565ca87f6b8/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081 h1:WrJKL0bBQXOiggqjjdhBJNriC9glMSACjWRKZK4Xe9o= github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc= From dc422b1c1713379cff689a7fe0a6d4f475ac7e3d Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 14 May 2024 09:21:41 -0700 Subject: [PATCH 6/7] Up to flowkit 1.18.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 88e9a78..7b7526c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/hexops/autogold/v2 v2.2.1 github.com/onflow/cadence v0.42.10 github.com/onflow/flow-go-sdk v0.46.2 - github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081 + github.com/onflow/flowkit v1.18.0 github.com/onflow/go-ethereum v1.13.4 github.com/spf13/afero v1.10.0 github.com/stoewer/go-strcase v1.3.0 diff --git a/go.sum b/go.sum index 020a126..d117f94 100644 --- a/go.sum +++ b/go.sum @@ -747,8 +747,8 @@ github.com/onflow/flow-nft/lib/go/contracts v1.1.0/go.mod h1:YsvzYng4htDgRB9sa9j github.com/onflow/flow/protobuf/go/flow v0.2.2/go.mod h1:gQxYqCfkI8lpnKsmIjwtN2mV/N2PIwc1I+RUK4HPIc8= github.com/onflow/flow/protobuf/go/flow v0.4.0 h1:5TGmPwRmnSt7aawgtPGF9ehoGHHir9Cy9LVoAiU9t/E= github.com/onflow/flow/protobuf/go/flow v0.4.0/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= -github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081 h1:WrJKL0bBQXOiggqjjdhBJNriC9glMSACjWRKZK4Xe9o= -github.com/onflow/flowkit v1.17.4-0.20240513233317-826a7fca2081/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= +github.com/onflow/flowkit v1.18.0 h1:8FmnLcfc5lUuUrKPHr9Z1YQVh50P33l+Ac7DhUNbiaw= +github.com/onflow/flowkit v1.18.0/go.mod h1:laapt1diM4Pbqt0dotKMH+LbUAOEqgugpH1p4+sPhcw= github.com/onflow/go-ethereum v1.13.4 h1:iNO86fm8RbBbhZ87ZulblInqCdHnAQVY8okBrNsTevc= github.com/onflow/go-ethereum v1.13.4/go.mod h1:cE/gEUkAffhwbVmMJYz+t1dAfVNHNwZCgc3BWtZxBGY= github.com/onflow/nft-storefront/lib/go/contracts v0.0.0-20221222181731-14b90207cead h1:2j1Unqs76Z1b95Gu4C3Y28hzNUHBix7wL490e61SMSw= From 535662146e87eab48c0e2befdb44de447d640cef Mon Sep 17 00:00:00 2001 From: Chase Fleming <1666730+chasefleming@users.noreply.github.com> Date: Tue, 14 May 2024 09:53:57 -0700 Subject: [PATCH 7/7] Fix lint error --- internal/v1_1/generator_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/v1_1/generator_test.go b/internal/v1_1/generator_test.go index addf9eb..49296d2 100644 --- a/internal/v1_1/generator_test.go +++ b/internal/v1_1/generator_test.go @@ -422,7 +422,7 @@ func setup(rw flowkit.ReaderWriter) (*flowkit.State, *flowkit.Flowkit, *mocks.Te if err != nil { panic(err) } - emulatorServiceAccount, err := accounts.NewEmulatorAccount(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") + emulatorServiceAccount, _ := accounts.NewEmulatorAccount(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") state.Accounts().AddOrUpdate(emulatorServiceAccount) gw := mocks.DefaultMockGateway() logger := output.NewStdoutLogger(output.NoneLog)