diff --git a/go.mod b/go.mod index bb23b5972..6d39983ff 100644 --- a/go.mod +++ b/go.mod @@ -10,16 +10,16 @@ require ( github.com/logrusorgru/aurora/v4 v4.0.0 github.com/manifoldco/promptui v0.9.0 github.com/onflow/cadence v0.42.10 - github.com/onflow/cadence-tools/languageserver v0.33.5 + github.com/onflow/cadence-tools/languageserver v0.33.6 github.com/onflow/cadence-tools/lint v0.14.2 github.com/onflow/cadence-tools/test v0.14.7 github.com/onflow/fcl-dev-wallet v0.7.4 - github.com/onflow/flixkit-go v1.1.3 + github.com/onflow/flixkit-go v1.2.0 github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f github.com/onflow/flow-emulator v0.62.1 github.com/onflow/flow-go v0.33.2-0.20240412174857-015156b297b5 github.com/onflow/flow-go-sdk v0.46.3 - github.com/onflow/flowkit v1.17.3 + github.com/onflow/flowkit v1.18.0 github.com/onflowser/flowser/v3 v3.1.3 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index a27e91811..051bc2618 100644 --- a/go.sum +++ b/go.sum @@ -901,8 +901,8 @@ github.com/onflow/atree v0.6.0/go.mod h1:gBHU0M05qCbv9NN0kijLWMgC47gHVNBIp4KmsVF github.com/onflow/cadence v0.20.1/go.mod h1:7mzUvPZUIJztIbr9eTvs+fQjWWHTF8veC+yk4ihcNIA= github.com/onflow/cadence v0.42.10 h1:3oC5ceeXhdCrhHcf9H0yYXQKW3Tw/vkSXLe+PUZa4i0= github.com/onflow/cadence v0.42.10/go.mod h1:1wFd+LiNiN6qoZXof3MBdpM6d8BsxbVIxOA77LbIYmE= -github.com/onflow/cadence-tools/languageserver v0.33.5 h1:Tg2YniU+ZJPI9RlTOuguqkLriUaFXue6FNXM+Ewijgo= -github.com/onflow/cadence-tools/languageserver v0.33.5/go.mod h1:euGucPAVixPrlTyYGnsZTHg65u7C6zdmfRJlVwRgMaI= +github.com/onflow/cadence-tools/languageserver v0.33.6 h1:BN26zUk+nBDMOX/VuTNYj6AjHUSeDfz4Ee5fnE1aeJY= +github.com/onflow/cadence-tools/languageserver v0.33.6/go.mod h1:QTsSKm+w5NrwEE7g51NMMqanVV0BZzocGh5PQDTuolQ= github.com/onflow/cadence-tools/lint v0.14.2 h1:WGh6ARN9MRVeYID3OnlalPtDTeYkliteHHR+ITCh/J4= github.com/onflow/cadence-tools/lint v0.14.2/go.mod h1:PlYwSF4wwpCtQJKs1cQAb80AG90a4rhADTitCogQ4UE= github.com/onflow/cadence-tools/test v0.14.7 h1:o4tHQLvxLGlG6mFyDl2vFYFtoTLCFJVxuJQ16ab+3u4= @@ -911,8 +911,8 @@ github.com/onflow/crypto v0.25.1 h1:0txy2PKPMM873JbpxQNbJmuOJtD56bfs48RQfm0ts5A= github.com/onflow/crypto v0.25.1/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= github.com/onflow/fcl-dev-wallet v0.7.4 h1:vI6t3U0AO88R/Iitn5KsnniSpbN9Lqsqwvi9EJT4C0k= github.com/onflow/fcl-dev-wallet v0.7.4/go.mod h1:kc42jkiuoPJmxMRFjfbRO9XvnR/3XLheaOerxVMDTiw= -github.com/onflow/flixkit-go v1.1.3 h1:td94mkklIwXvDP075D0eofPE04oKse24PxvFTyOvMJI= -github.com/onflow/flixkit-go v1.1.3/go.mod h1:qOYI1l7r3gSPk6luTnk95ni020UeTY+E48GuB3Tl0xk= +github.com/onflow/flixkit-go v1.2.0 h1:JCT0g+amG+j3JjuT4lMkIp1FSpCfiI9xM5CmwXuYVZ8= +github.com/onflow/flixkit-go v1.2.0/go.mod h1:gtQu0C3U/8t6gN8jgdSJLYEytIcq788pKHA2XNr/uRQ= github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20231016154253-a00dbf7c061f h1:S8yIZw9LFXfYD1V5H9BiixihHw3GrXVPrmfplSzYaww= github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20231016154253-a00dbf7c061f/go.mod h1:jM6GMAL+m0hjusUgiYDNrixPQ6b9s8xjoJQoEu5bHQI= github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f h1:Ep+Mpo2miWMe4pjPGIaEvEzshRep30dvNgxqk+//FrQ= @@ -932,8 +932,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.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= diff --git a/internal/accounts/create-interactive.go b/internal/accounts/create-interactive.go index a173ebf7a..77f6e625d 100644 --- a/internal/accounts/create-interactive.go +++ b/internal/accounts/create-interactive.go @@ -52,7 +52,7 @@ func createInteractive(state *flowkit.State) (*accountResult, error) { log := output.NewStdoutLogger(output.InfoLog) name := util.AccountNamePrompt(state.Accounts().Names()) networkName, selectedNetwork := util.CreateAccountNetworkPrompt() - privateFile := accounts.PrivateKeyFile(name) + privateFile := accounts.PrivateKeyFile(name, "") // create new gateway based on chosen network gw, err := gateway.NewGrpcGateway(selectedNetwork) diff --git a/internal/cadence/lint_test.go b/internal/cadence/lint_test.go index 99d025b55..d8f4c79dd 100644 --- a/internal/cadence/lint_test.go +++ b/internal/cadence/lint_test.go @@ -24,7 +24,6 @@ import ( "github.com/onflow/cadence/runtime/ast" "github.com/onflow/cadence/runtime/common" "github.com/onflow/cadence/tools/analysis" - "github.com/onflow/flow-go-sdk/crypto" "github.com/onflow/flowkit" "github.com/onflow/flowkit/config" "github.com/spf13/afero" @@ -311,7 +310,7 @@ func setupMockState(t *testing.T) *flowkit.State { }`), 0644) rw := afero.Afero{Fs: mockFs} - state, err := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256) + state, err := flowkit.Init(rw) require.NoError(t, err) // Mock flowkit contracts diff --git a/internal/config/init.go b/internal/config/init.go index 68dda9f0c..0bd9e0824 100644 --- a/internal/config/init.go +++ b/internal/config/init.go @@ -22,10 +22,12 @@ import ( "bytes" "fmt" + "github.com/onflow/flowkit" + "github.com/onflow/flowkit/accounts" + "github.com/onflow/flow-go-sdk/crypto" "github.com/spf13/cobra" - "github.com/onflow/flowkit" "github.com/onflow/flowkit/config" "github.com/onflow/flowkit/output" @@ -71,11 +73,18 @@ func Initialise( return nil, fmt.Errorf("invalid hash algorithm: %s", InitFlag.ServiceKeyHashAlgo) } - state, err := flowkit.Init(readerWriter, sigAlgo, hashAlgo) + state, err := flowkit.Init(readerWriter) + if err != nil { + return nil, err + } + + emulatorAccount, err := accounts.NewEmulatorAccount(readerWriter, crypto.ECDSA_P256, crypto.SHA3_256, "") if err != nil { return nil, err } + state.Accounts().AddOrUpdate(emulatorAccount) + if InitFlag.ServicePrivateKey != "" { privateKey, err := crypto.DecodePrivateKeyHex(sigAlgo, InitFlag.ServicePrivateKey) if err != nil { diff --git a/internal/emulator/start.go b/internal/emulator/start.go index 1608d42c5..dce19ff7d 100644 --- a/internal/emulator/start.go +++ b/internal/emulator/start.go @@ -62,7 +62,7 @@ func configuredServiceKey( hashAlgo = emulator.DefaultServiceKeyHashAlgo } - state, err = flowkit.Init(loader, sigAlgo, hashAlgo) + state, err = flowkit.Init(loader) if err != nil { exitf(1, err.Error()) } else { diff --git a/internal/super/flix_test.go b/internal/super/flix_test.go index b8215c140..ca1b5729f 100644 --- a/internal/super/flix_test.go +++ b/internal/super/flix_test.go @@ -27,8 +27,6 @@ import ( "github.com/stretchr/testify/mock" "github.com/onflow/flixkit-go/flixkit" - "github.com/onflow/flow-go-sdk/crypto" - "github.com/onflow/flowkit" "github.com/onflow/flowkit/config" "github.com/onflow/flowkit/mocks" @@ -221,7 +219,7 @@ func Test_GenerateFlixPrefill(t *testing.T) { var rw = afero.Afero{Fs: mockFS} err := rw.WriteFile(cadenceFile, []byte(CADENCE_SCRIPT), 0644) assert.NoError(t, err) - state, _ := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256) + state, _ := flowkit.Init(rw) mockFlixService := new(MockFlixService) ctx := context.Background() diff --git a/internal/util/test.go b/internal/util/test.go index 9f5be3727..4eba15d75 100644 --- a/internal/util/test.go +++ b/internal/util/test.go @@ -21,8 +21,10 @@ package util import ( "testing" - "github.com/onflow/flow-go-sdk" "github.com/onflow/flow-go-sdk/crypto" + "github.com/onflow/flowkit/accounts" + + "github.com/onflow/flow-go-sdk" "github.com/stretchr/testify/require" "github.com/onflow/flowkit" @@ -39,8 +41,11 @@ var TestID = flow.HexToID("24993fc99f81641c45c0afa307e683b4f08d407d90041aa9439f4 func TestMocks(t *testing.T) (*mocks.MockServices, *flowkit.State, flowkit.ReaderWriter) { services := mocks.DefaultMockServices() rw, _ := tests.ReaderWriter() - state, err := flowkit.Init(rw, crypto.ECDSA_P256, crypto.SHA3_256) + state, err := flowkit.Init(rw) require.NoError(t, err) + emulatorAccount, _ := accounts.NewEmulatorAccount(rw, crypto.ECDSA_P256, crypto.SHA3_256, "") + state.Accounts().AddOrUpdate(emulatorAccount) + return services, state, rw }