Skip to content

Commit

Permalink
Merge pull request #1408 from onflow/update-flixkit-ver
Browse files Browse the repository at this point in the history
Updated flixkit version, Added processing to create contract dependency structure for flix generation
  • Loading branch information
bthaile authored Feb 13, 2024
2 parents 6215b02 + 6a4b840 commit 64dfc4b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/onflow/cadence-tools/languageserver v0.33.3
github.com/onflow/cadence-tools/test v0.14.5
github.com/onflow/fcl-dev-wallet v0.7.4
github.com/onflow/flixkit-go v1.1.1
github.com/onflow/flixkit-go v1.1.2
github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f
github.com/onflow/flow-emulator v0.59.0
github.com/onflow/flow-go-sdk v0.41.17
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -875,8 +875,8 @@ github.com/onflow/cadence-tools/test v0.14.5 h1:u1kYkotKdwKEf9c3h65mI3VMevBkHY+7
github.com/onflow/cadence-tools/test v0.14.5/go.mod h1:ix09Bb3GQ/fZMNpSR8E+vSFItGF54fzP9gFxU7AsOIw=
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.1 h1:ARgLsfWxc3LjgUHUAELildY5lxJ6kA4gVfAS2+ZRaCE=
github.com/onflow/flixkit-go v1.1.1/go.mod h1:XkbRPv6drM8uQpvdKgZ5stShtOlOMiQ6Fy86D0EsW5U=
github.com/onflow/flixkit-go v1.1.2 h1:pn8CtUr1qpHrZF+xbl6FXU+nVGtUgFKYm3XGaX0yKj8=
github.com/onflow/flixkit-go v1.1.2/go.mod h1:XkbRPv6drM8uQpvdKgZ5stShtOlOMiQ6Fy86D0EsW5U=
github.com/onflow/flow-cli/flowkit v1.11.0 h1:RSfKlla/l+ZJwqAmlvA5HPFbQ6ia2wzKSG0kJ8fqVa0=
github.com/onflow/flow-cli/flowkit v1.11.0/go.mod h1:aH4shan7Ggxd0GIXZD2S4kYMemNfzP1rLWvzKnb6K3g=
github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20231016154253-a00dbf7c061f h1:S8yIZw9LFXfYD1V5H9BiixihHw3GrXVPrmfplSzYaww=
Expand Down
22 changes: 20 additions & 2 deletions internal/super/flix.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,31 @@ func (fr *flixResult) Oneliner() string {
func getDeployedContracts(state *flowkit.State) flixkit.ContractInfos {
allContracts := make(flixkit.ContractInfos)
depNetworks := make([]string, 0)
accountAddresses := make(map[string]string)
// get all configured networks in flow.json
for _, n := range *state.Networks() {
depNetworks = append(depNetworks, n.Name)
}

// get account addresses
for _, a := range *state.Accounts() {
accountAddresses[a.Name] = a.Address.Hex()
}

for _, d := range *state.Deployments() {
addr := accountAddresses[d.Account]
for _, c := range d.Contracts {
if _, ok := allContracts[c.Name]; !ok {
allContracts[c.Name] = make(flixkit.NetworkAddressMap)
}
allContracts[c.Name][d.Network] = addr
}
}

// get all deployed and alias contracts for configured networks
for _, network := range depNetworks {
contracts, err := state.DeploymentContractsByNetwork(config.Network{Name: network})
cfg := config.Network{Name: network}
contracts, err := state.DeploymentContractsByNetwork(cfg)
if err != nil {
continue
}
Expand All @@ -278,7 +295,7 @@ func getDeployedContracts(state *flowkit.State) flixkit.ContractInfos {
}
allContracts[c.Name][network] = c.AccountAddress.Hex()
}
locAliases := state.AliasesForNetwork(config.Network{Name: network})
locAliases := state.AliasesForNetwork(cfg)
for name, addr := range locAliases {
address := flow.BytesToAddress([]byte(addr))
if isPath(name) {
Expand All @@ -290,6 +307,7 @@ func getDeployedContracts(state *flowkit.State) flixkit.ContractInfos {
allContracts[name][network] = address.Hex()
}
}

return allContracts
}

Expand Down

0 comments on commit 64dfc4b

Please sign in to comment.