Repository: onflow/flow-cli
Pull request #1421 (2024-02-20 22:17:52)

Update to flow-go v0.34.0-crescendo-preview.1

## Description

Automatically update to:
- [onflow/cadence v1.0.0-M7](https://github.com/onflow/cadence/releases/tag/v1.0.0-M7)
- [onflow/flow-go-sdk v1.0.0-M4](https://github.com/onflow/flow-go-sdk/releases/tag/v1.0.0-M4)
- [onflow/flow-go 6b0ce48](https://github.com/onflow/flow-go/commit/6b0ce48)
- [onflow/flow-emulator v1.0.0-M6](https://github.com/onflow/flow-emulator/releases/tag/v1.0.0-M6)
- [onflow/cadence-tools/test v1.0.0-M4](https://github.com/onflow/cadence-tools/test/releases/tag/v1.0.0-M4)
- [onflow/cadence-tools/lint v1.0.0-M4](https://github.com/onflow/cadence-tools/lint/releases/tag/v1.0.0-M4)
- [onflow/cadence-tools/languageserver v1.0.0-M3](https://github.com/onflow/cadence-tools/languageserver/releases/tag/v1.0.0-M3)
- [onflow/flixkit-go eaab0d6](https://github.com/onflow/flixkit-go/commit/eaab0d6)
- [onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.4](https://github.com/onflow/flowkit/v2/releases/tag/v2.0.0-stable-cadence-alpha.4)




Patch:
diff --git a/go.mod b/go.mod
index 4407c1a1..8b666847 100644
--- a/go.mod
+++ b/go.mod
@@ -9,15 +9,15 @@ require (
 	github.com/gosuri/uilive v0.0.4
 	github.com/manifoldco/promptui v0.9.0
 	github.com/onflow/cadence v1.0.0-M7
-	github.com/onflow/cadence-tools/languageserver v1.0.0-M2
-	github.com/onflow/cadence-tools/test v1.0.0-M3
+	github.com/onflow/cadence-tools/languageserver v1.0.0-M3
+	github.com/onflow/cadence-tools/test v1.0.0-M4
 	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.1.1-0.20240214222351-03b90f7d32ef
+	github.com/onflow/flixkit-go v1.2.1-cadence-v1-M2
 	github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7
-	github.com/onflow/flow-emulator v1.0.0-M5
+	github.com/onflow/flow-emulator v1.0.0-M6
 	github.com/onflow/flow-go-sdk v1.0.0-M4
-	github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.2.0.20240214213743-ee40994a815f
+	github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.4
 	github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48
 	github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c
 	github.com/pkg/errors v0.9.1
@@ -178,11 +178,11 @@ require (
 	github.com/onflow/crypto v0.25.0 // indirect
 	github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7 // indirect
 	github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0 // indirect
-	github.com/onflow/flow-go v0.33.2-0.20240214203221-b11eeaa896bd // indirect
+	github.com/onflow/flow-go v0.34.0-crescendo-preview.1 // indirect
 	github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240205233530-86ee8c352fa6 // indirect
 	github.com/onflow/flow/protobuf/go/flow v0.3.7 // indirect
 	github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba // indirect
-	github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d // indirect
+	github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b // indirect
 	github.com/opentracing/opentracing-go v1.2.0 // indirect
 	github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
 	github.com/pelletier/go-toml/v2 v2.0.8 // indirect
diff --git a/go.sum b/go.sum
index 9fa6bc63..afa52e8f 100644
--- a/go.sum
+++ b/go.sum
@@ -2049,30 +2049,30 @@ github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f/go.mod h1:xvP61FoOs
 github.com/onflow/cadence v1.0.0-M3/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8=
 github.com/onflow/cadence v1.0.0-M7 h1:hb4LK9lUbFdnDdfU8oqJGSVJtmkOzxwKomhmDcP/Faw=
 github.com/onflow/cadence v1.0.0-M7/go.mod h1:a4mccDU90hmuxCLUFzs9J/ANG/rYbFa36h4Z0bBAqNU=
-github.com/onflow/cadence-tools/languageserver v1.0.0-M2 h1:LOZQ6y+RzAwTF6DIrMWoaRhbECHZFqbsKrUp1TjORGE=
-github.com/onflow/cadence-tools/languageserver v1.0.0-M2/go.mod h1:m3ZnSxAUqY3CSCP1Okp7zAwIUToUtlskihEkac4Ecc4=
+github.com/onflow/cadence-tools/languageserver v1.0.0-M3 h1:QiB/uAEgH6EHKmzS0FQsSqfaySXO+0HFAuWiXvmP8HM=
+github.com/onflow/cadence-tools/languageserver v1.0.0-M3/go.mod h1:wopJrxR2m+bmXRO2W1V+3Kp9+yS0SiIZL9f2tV+P3Xs=
 github.com/onflow/cadence-tools/lint v1.0.0-M4 h1:XeBX+/2TKbe04nyMjUbSD9aHcF5+H6UOAgsuLTmo1DA=
 github.com/onflow/cadence-tools/lint v1.0.0-M4/go.mod h1:vgKOF14/NwWktjsRKHlWEz8z/3uQu5nuqDzQOm+u2qY=
-github.com/onflow/cadence-tools/test v1.0.0-M3 h1:ZbKoMhXsvafJIOO/MVE7lV5INXfq2IL0Z+W2MsJnKwY=
-github.com/onflow/cadence-tools/test v1.0.0-M3/go.mod h1:Yk6OyiRMNseM6C13FpNUxTJ7GekYZMzdX5D2B10y4N8=
+github.com/onflow/cadence-tools/test v1.0.0-M4 h1:KyfDTBvFWGfuoxdzUDxVw1MadPo+OPiuXoJo+2si7pM=
+github.com/onflow/cadence-tools/test v1.0.0-M4/go.mod h1:n5dtyDe8IooyqK6A74CY4kEyV+Ja7JLYYfc0eCdmzP8=
 github.com/onflow/contract-updater/lib/go/templates v1.0.1 h1:xPj898Y8OgLLbXH8+JeKVBV6J+nqPZjiLgGM3Abucto=
 github.com/onflow/contract-updater/lib/go/templates v1.0.1/go.mod h1:OXO6s0X7OW4Q6QTfAfnjoOmibEPgs0psOfMi+tPyzQE=
 github.com/onflow/crypto v0.24.9 h1:jYP1qdwid0qCineFzBFlxBchg710A7RuSWpTqxaOdog=
 github.com/onflow/crypto v0.24.9/go.mod h1:J/V7IEVaqjDajvF8K0B/SJPJDgAOP2G+LVLeb0hgmbg=
 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.1.1-0.20240214222351-03b90f7d32ef h1:nPtuUuIMBcsl9T15qWzat8hYo6lU6ip2WKoYT2p9H4w=
-github.com/onflow/flixkit-go v1.1.1-0.20240214222351-03b90f7d32ef/go.mod h1:mKbeBFAmwjQfLZZrwNqJAfTI9zi7VDXzc5swaX49wKQ=
+github.com/onflow/flixkit-go v1.2.1-cadence-v1-M2 h1:3EyshjXInYW41cBgHtrwbAYOIQG3FPtZXm1uC4uocA4=
+github.com/onflow/flixkit-go v1.2.1-cadence-v1-M2/go.mod h1:h360b4Xth0RPJ9q18+Sm6V3hT5giP1Fszq6xR3kjI38=
 github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7 h1:OI/4F2NK/X/4x3dTUFFDGtuOsSa9pX+jjBeSEcBrY/M=
 github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.2-0.20240206003101-928bf99024d7/go.mod h1:GK+Ik1K3L3v8xmHmRQv5yxJz81lYhdYSNm0PQ63Xrws=
 github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7 h1:WAx8ftVz1BeXiKvQ9gLKEf1J3NBWK26Pbczd0iH4C6I=
 github.com/onflow/flow-core-contracts/lib/go/templates v0.15.2-0.20240206003101-928bf99024d7/go.mod h1:MZ2j5YVTQiSE0B99zuaYhxvGG5GcvimWpQK1Fw/1QBg=
-github.com/onflow/flow-emulator v1.0.0-M5 h1:yPx6je/ahdYvd4b80bMXJ0AT4k2eogEGsQCOI+83V2I=
-github.com/onflow/flow-emulator v1.0.0-M5/go.mod h1:CBp/YrgR2PeOdqhQMbfAiznGayNoJuFQTfLV9EJFtEc=
+github.com/onflow/flow-emulator v1.0.0-M6 h1:UQpDbaBVs/4yx6zDcnqtsVhQVCNDeW5DnrpduMr7utI=
+github.com/onflow/flow-emulator v1.0.0-M6/go.mod h1:8B/xTcOkp9JTdBYversiuDcEkcjI+f9NK/mJPVQ/3tQ=
 github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0 h1:u6/YcUvO8jU0f3Evb/6agzXqeOo+VbL2a3mmj/5ifRs=
 github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240205224107-320aa3cf09e0/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A=
-github.com/onflow/flow-go v0.33.2-0.20240214203221-b11eeaa896bd h1:x9eOt5rdDSr00aKwoyUWyJ4m8WlUwgYoV94oSEWPhiM=
-github.com/onflow/flow-go v0.33.2-0.20240214203221-b11eeaa896bd/go.mod h1:45DIkRx5a+qiV83fpJ+fra9WtRiF4bTqd7XMxahRdnc=
+github.com/onflow/flow-go v0.34.0-crescendo-preview.1 h1:fjl5hzpgxQWqCtpAohtdIV5enF9L/Oh407HpeS4vjnk=
+github.com/onflow/flow-go v0.34.0-crescendo-preview.1/go.mod h1:ClmIYh0WtY5Ait0en/F4p/Ha9s3DyFryu7AdpN0aoM0=
 github.com/onflow/flow-go-sdk v1.0.0-M1/go.mod h1:TDW0MNuCs4SvqYRUzkbRnRmHQL1h4X8wURsCw9P9beo=
 github.com/onflow/flow-go-sdk v1.0.0-M4 h1:dGtgZvaIfBR5/9I9nm5nLm69V5pLcSz9vXmzCb1lyzM=
 github.com/onflow/flow-go-sdk v1.0.0-M4/go.mod h1:HIGOKJVR47QNs81sPHmZDVcLr+syNkmbgEMLQGDmmEo=
@@ -2081,12 +2081,12 @@ github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240205233530-86ee8c352fa6
 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.3.7 h1:+6sBdlE/u4ZMTVB9U1lA6Xn2Bd48lOOX96Bv9dNubsk=
 github.com/onflow/flow/protobuf/go/flow v0.3.7/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk=
-github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.2.0.20240214213743-ee40994a815f h1:GjStQGlfhxbZiOZy8vFRSNUrNoD1u3Q8f5mhfyZ1vhc=
-github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.2.0.20240214213743-ee40994a815f/go.mod h1:Ck+iZGJYerviTQ3SyqoUNLNXdRUJiI5iMxfM9YugtK0=
+github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.4 h1:PgKrXUcObYu6yPLHx9Wl4ikvZMEl6NXaRWllZatyZyk=
+github.com/onflow/flowkit/v2 v2.0.0-stable-cadence-alpha.4/go.mod h1:s0MTlpOWscHiKVsynlw83cREjlmVFoBszQNgcP2RzPQ=
 github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba h1:rIehuhO6bj4FkwE4VzwEjX7MoAlOhUJENBJLqDqVxAo=
 github.com/onflow/sdks v0.5.1-0.20230912225508-b35402f12bba/go.mod h1:F0dj0EyHC55kknLkeD10js4mo14yTdMotnWMslPirrU=
-github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d h1:gAEqYPn3DS83rHIKEpsajnppVD1+zwuYPFyeDVFaQvg=
-github.com/onflow/wal v0.0.0-20230529184820-bc9f8244608d/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
+github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b h1:6O/BEmA99PDT5QVjoJgrYlGsWnpxGJTAMmsC+V9gyds=
+github.com/onflow/wal v0.0.0-20240208022732-d756cd497d3b/go.mod h1:iMC8gkLqu4nkbkAla5HkSBb+FGyQOZiWz3DYm2wSXCk=
 github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48 h1:eBS8Rm1V9TTGpj9lcpoCi6MIwWgYQZ8crJ7cSrS39Y4=
 github.com/onflowser/flowser/v3 v3.2.1-0.20240131200229-7d4d22715f48/go.mod h1:Pvw+OkV3eqLGMpHWu38rJYE30N9G3VgQ2MRQQnRr4to=
 github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
diff --git a/internal/dependencymanager/dependencyinstaller.go b/internal/dependencymanager/dependencyinstaller.go
index c142bf51..09d6280b 100644
--- a/internal/dependencymanager/dependencyinstaller.go
+++ b/internal/dependencymanager/dependencyinstaller.go
@@ -19,6 +19,7 @@
 package dependencymanager
 
 import (
+	"context"
 	"crypto/sha256"
 	"encoding/hex"
 	"fmt"
@@ -123,7 +124,8 @@ func (di *DependencyInstaller) processDependency(dependency config.Dependency) e
 }
 
 func (di *DependencyInstaller) fetchDependencies(networkName string, address flowsdk.Address, assignedName, contractName string) error {
-	account, err := di.Gateways[networkName].GetAccount(address)
+	ctx := context.Background()
+	account, err := di.Gateways[networkName].GetAccount(ctx, address)
 	if err != nil {
 		return fmt.Errorf("failed to get account: %w", err)
 	}
diff --git a/internal/snapshot/save.go b/internal/snapshot/save.go
index ee19b01a..d148553d 100644
--- a/internal/snapshot/save.go
+++ b/internal/snapshot/save.go
@@ -19,6 +19,7 @@
 package snapshot
 
 import (
+	"context"
 	"fmt"
 	"path/filepath"
 
@@ -55,8 +56,8 @@ func save(
 	if !flow.Gateway().SecureConnection() {
 		logger.Info(fmt.Sprintf("%s warning: using insecure client connection to download snapshot, you should use a secure network configuration...", output.WarningEmoji()))
 	}
-
-	snapshotBytes, err := flow.Gateway().GetLatestProtocolStateSnapshot()
+	ctx := context.Background()
+	snapshotBytes, err := flow.Gateway().GetLatestProtocolStateSnapshot(ctx)
 	if err != nil {
 		return nil, fmt.Errorf("failed to get latest finalized protocol snapshot from gateway: %w", err)
 	}
diff --git a/internal/super/flix.go b/internal/super/flix.go
index 18d7b01c..9b63a6d3 100644
--- a/internal/super/flix.go
+++ b/internal/super/flix.go
@@ -25,7 +25,6 @@ import (
 
 	"github.com/onflow/flixkit-go/flixkit"
 
-	"github.com/onflow/flow-go-sdk"
 	"github.com/spf13/cobra"
 
 	"github.com/onflow/flowkit/v2"
@@ -152,7 +151,8 @@ func executeFlixCmd(
 		Exclude:     flags.Exclude,
 		GasLimit:    flags.GasLimit,
 	}
-	return transactions.SendTransaction([]byte(cadenceWithImportsReplaced.Cadence), args[1:], "", flow, state, transactionFlags)
+	// some reason sendTransaction clips the first argument
+	return transactions.SendTransaction([]byte(cadenceWithImportsReplaced.Cadence), args, "", flow, state, transactionFlags)
 }
 
 func packageCmd(
@@ -217,6 +217,7 @@ func generateFlixCmd(
 ) (result command.Result, err error) {
 	cadenceFile := args[0]
 	depContracts := getDeployedContracts(state)
+
 	if cadenceFile == "" {
 		return nil, fmt.Errorf("no cadence code found")
 	}
@@ -230,8 +231,11 @@ func generateFlixCmd(
 		return nil, fmt.Errorf("could not create flix generator %w", err)
 	}
 
+	// get user's configured networks
+	depNetworks := getNetworks(state)
 	ctx := context.Background()
-	prettyJSON, err := flixService.CreateTemplate(ctx, depContracts, string(code), flags.PreFill)
+
+	prettyJSON, err := flixService.CreateTemplate(ctx, depContracts, string(code), flags.PreFill, depNetworks)
 	if err != nil {
 		return nil, fmt.Errorf("could not generate flix %w", err)
 	}
@@ -269,7 +273,7 @@ func getDeployedContracts(state *flowkit.State) flixkit.ContractInfos {
 
 	// get account addresses
 	for _, a := range *state.Accounts() {
-		accountAddresses[a.Name] = a.Address.Hex()
+		accountAddresses[a.Name] = a.Address.HexWithPrefix()
 	}
 
 	for _, d := range *state.Deployments() {
@@ -293,24 +297,31 @@ func getDeployedContracts(state *flowkit.State) flixkit.ContractInfos {
 			if _, ok := allContracts[c.Name]; !ok {
 				allContracts[c.Name] = make(flixkit.NetworkAddressMap)
 			}
-			allContracts[c.Name][network] = c.AccountAddress.Hex()
+			allContracts[c.Name][network] = c.AccountAddress.HexWithPrefix()
 		}
 		locAliases := state.AliasesForNetwork(cfg)
 		for name, addr := range locAliases {
-			address := flow.BytesToAddress([]byte(addr))
 			if isPath(name) {
 				continue
 			}
 			if _, ok := allContracts[name]; !ok {
 				allContracts[name] = make(flixkit.NetworkAddressMap)
 			}
-			allContracts[name][network] = address.Hex()
+			allContracts[name][network] = addr
 		}
 	}
 
 	return allContracts
 }
 
+func getNetworks(state *flowkit.State) []config.Network {
+	networks := make([]config.Network, 0)
+	for _, n := range *state.Networks() {
+		networks = append(networks, n)
+	}
+	return networks
+}
+
 func isPath(path string) bool {
 	_, err := os.Stat(path)
 	return err == nil


Test patch:
diff --git a/internal/dependencymanager/dependencyinstaller_test.go b/internal/dependencymanager/dependencyinstaller_test.go
index 23f6e662..cd63691f 100644
--- a/internal/dependencymanager/dependencyinstaller_test.go
+++ b/internal/dependencymanager/dependencyinstaller_test.go
@@ -58,7 +58,7 @@ func TestDependencyInstallerInstall(t *testing.T) {
 		gw := mocks.DefaultMockGateway()
 
 		gw.GetAccount.Run(func(args mock.Arguments) {
-			addr := args.Get(0).(flow.Address)
+			addr := args.Get(1).(flow.Address)
 			assert.Equal(t, addr.String(), serviceAcc.Address.String())
 			acc := tests.NewAccountWithAddress(addr.String())
 			acc.Contracts = map[string][]byte{
@@ -100,7 +100,7 @@ func TestDependencyInstallerAdd(t *testing.T) {
 		gw := mocks.DefaultMockGateway()
 
 		gw.GetAccount.Run(func(args mock.Arguments) {
-			addr := args.Get(0).(flow.Address)
+			addr := args.Get(1).(flow.Address)
 			assert.Equal(t, addr.String(), serviceAcc.Address.String())
 			acc := tests.NewAccountWithAddress(addr.String())
 			acc.Contracts = map[string][]byte{
diff --git a/internal/super/flix_test.go b/internal/super/flix_test.go
index d283ee8c..ac9acc8a 100644
--- a/internal/super/flix_test.go
+++ b/internal/super/flix_test.go
@@ -62,7 +62,7 @@ func (m *MockFlixService) GetTemplateAndReplaceImports(ctx context.Context, temp
 	return result, nil
 }
 
-func (m *MockFlixService) CreateTemplate(ctx context.Context, contractInfos flixkit.ContractInfos, code string, preFill string) (string, error) {
+func (m *MockFlixService) CreateTemplate(ctx context.Context, contractInfos flixkit.ContractInfos, code string, preFill string, networks []config.Network) (string, error) {
 	args := m.Called(ctx, contractInfos, code, preFill)
 	return TEMPLATE_STR, args.Error(1)
 }
@@ -156,7 +156,7 @@ func Test_GenerateFlix(t *testing.T) {
 		"contracts": {},
 		"accounts": {
 			"emulator-account": {
-				"address": "f8d6e0586b0a20c7",
+				"address": "0xf8d6e0586b0a20c7",
 				"key": "dd72967fd2bd75234ae9037dd4694c1f00baad63a10c35172bf65fbb8ad74b47"
 			}
 		},
@@ -200,7 +200,7 @@ func Test_GenerateFlix(t *testing.T) {
 	logger := output.NewStdoutLogger(output.NoneLog)
 	contractInfos := make(flixkit.ContractInfos)
 	contractInfos[tests.ContractHelloString.Name] = make(flixkit.NetworkAddressMap)
-	contractInfos[tests.ContractHelloString.Name]["emulator"] = "f8d6e0586b0a20c7"
+	contractInfos[tests.ContractHelloString.Name]["emulator"] = "0xf8d6e0586b0a20c7"
 
 	ctx := context.Background()
 	mockFlixService.On("CreateTemplate", ctx, contractInfos, cadenceCode, "").Return(TEMPLATE_STR, nil)