Skip to content

Commit

Permalink
Merge pull request #1595 from onflow/cf/upgrade-flowkit
Browse files Browse the repository at this point in the history
Upgrade flowkit
  • Loading branch information
chasefleming authored May 15, 2024
2 parents b12cc0a + a83b77f commit 300d082
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 18 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ require (
github.com/logrusorgru/aurora/v4 v4.0.0
github.com/manifoldco/promptui v0.9.0
github.com/onflow/cadence v1.0.0-preview.25
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.14
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.15
github.com/onflow/cadence-tools/lint v1.0.0-preview.17
github.com/onflow/cadence-tools/test v1.0.0-preview.15
github.com/onflow/contract-updater/lib/go/templates v1.0.1
github.com/onflow/fcl-dev-wallet v0.8.0-stable-cadence.1
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.13
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.14
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5
github.com/onflow/flow-emulator v1.0.0-preview.22
github.com/onflow/flow-evm-gateway v0.9.0
github.com/onflow/flow-go v0.34.0-crescendo-preview.18
github.com/onflow/flow-go-sdk v1.0.0-preview.25
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.19
github.com/onflow/go-ethereum v1.13.4
github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2062,8 +2062,8 @@ github.com/onflow/atree v0.7.0-rc.1/go.mod h1:xvP61FoOs95K7IYdIYRnNcYQGf4nbF/uuJ
github.com/onflow/cadence v1.0.0-M3/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8=
github.com/onflow/cadence v1.0.0-preview.25 h1:kSmWjxmg9PS+bsk8C3j1NUTkFAl/jNrintVhlh6miM0=
github.com/onflow/cadence v1.0.0-preview.25/go.mod h1:fGhLBbuEmv5rh48qv0ZS0tUz53gxWsHpB4dPsF09h6E=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.14 h1:bG9ecxcEDkiO7EpTo6DVDrGZhVuSVgyoEFdW1aJmHPY=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.14/go.mod h1:36/d7Znj05df08Gu0wsOTzLS+DeBQ4/8cD6kORKchZ4=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.15 h1:h653h3MxWyH2ZrB40FPMuXUn1a8pwi6PCwOGlenEdu8=
github.com/onflow/cadence-tools/languageserver v1.0.0-preview.15/go.mod h1:yMyhrH0p/BuDm6xLY1MzOPAECjNot6PpPCOB4lpj/cc=
github.com/onflow/cadence-tools/lint v1.0.0-preview.17 h1:ERfb0IeO0vrT2Gs7p9jPeDUYIf8P9wa1foyBQCLz1Bs=
github.com/onflow/cadence-tools/lint v1.0.0-preview.17/go.mod h1:li3nUOoTFQDvqsGlJxu7CPvyeBbV6PQTrZ8T0UROiwM=
github.com/onflow/cadence-tools/test v1.0.0-preview.15 h1:hBDDNBz3V3VntriqokY+/GqYb1/Iw/9+pRhiOQ39tEc=
Expand All @@ -2075,8 +2075,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.8.0-stable-cadence.1 h1:IqdUzdqFCSW0klWmA3J9c17ZyQTab9SWcWSLouX6o0Q=
github.com/onflow/fcl-dev-wallet v0.8.0-stable-cadence.1/go.mod h1:kc42jkiuoPJmxMRFjfbRO9XvnR/3XLheaOerxVMDTiw=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.13 h1:/3oNbdEsi98SWlSzmabe1DXfy4OCUSC1Gwe9vFX6anY=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.13/go.mod h1:C820Ndv7HLTnn4q+fBvg/i6at8bmIyQK6V81Pzuo4b4=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.14 h1:Q0MEdGnWAOt8tZXCbLvX4LW5aWka1FsTEh0ZxG8tJCc=
github.com/onflow/flixkit-go v1.2.1-cadence-v1-preview.14/go.mod h1:e5v8Mjec2fPjpNSMx1Yt3kRvAfLWIjAguWt2Rpyrevs=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5 h1:by3a+8p2kUUjnxfbRYRd78bDEeXAc3PK2LzyBEQqkV4=
github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240429192223-e696a8e439b5/go.mod h1:+4JWLclBOT+emyBh6NAZSEbqEwzHcWHpIbfsXmRASgY=
github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240429192223-e696a8e439b5 h1:6Cg0h+8Iyy/Nnefk5j0gdeVoMTNpUooAMjyV8sk6zoA=
Expand All @@ -2101,8 +2101,8 @@ github.com/onflow/flow-nft/lib/go/templates v0.0.0-20240429184308-40c3de711140/g
github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231121210617-52ee94b830c2/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flow/protobuf/go/flow v0.4.1-0.20240412170550-911321113030 h1:I+aosSiJny88O4p3nPbCiUcp/UqN6AepvO6uj82bjH0=
github.com/onflow/flow/protobuf/go/flow v0.4.1-0.20240412170550-911321113030/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18 h1:vgQ1SpQ9mpTX+c6x1hm71DmaLnHoMr3kIG479Ye0ll4=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.18/go.mod h1:uQiVIHhm6dXrXDM9SQG00FIaEQgh+TdVvM+ortvpF+M=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.19 h1:oKiXykcwVvs/J5CTtKkdzaieTitCYDXdoBPMBBe1Mb0=
github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.19/go.mod h1:uQiVIHhm6dXrXDM9SQG00FIaEQgh+TdVvM+ortvpF+M=
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/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo=
Expand Down
2 changes: 1 addition & 1 deletion internal/accounts/create-interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions internal/cadence/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/v2"
"github.com/onflow/flowkit/v2/config"
"github.com/spf13/afero"
Expand Down Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion internal/config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"bytes"
"fmt"

"github.com/onflow/flowkit/v2/accounts"

"github.com/onflow/flow-go-sdk/crypto"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions internal/dependencymanager/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package dependencymanager

import (
"fmt"

"github.com/onflow/flow-cli/internal/util"

"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion internal/emulator/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 1 addition & 2 deletions internal/super/flix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +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/v2"
"github.com/onflow/flowkit/v2/config"
Expand Down Expand Up @@ -221,7 +220,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()
Expand Down
9 changes: 7 additions & 2 deletions internal/util/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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/v2/accounts"

"github.com/onflow/flow-go-sdk"
"github.com/stretchr/testify/require"

"github.com/onflow/flowkit/v2"
Expand All @@ -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
}

0 comments on commit 300d082

Please sign in to comment.