diff --git a/arguments/arguments_test.go b/arguments/arguments_test.go index 7d0f1cb6..d7988f33 100644 --- a/arguments/arguments_test.go +++ b/arguments/arguments_test.go @@ -134,22 +134,23 @@ func Test_ParseWithoutType(t *testing.T) { Type: cadence.StringType, }, }, - // TODO: depends on https://github.com/onflow/cadence/pull/2469 - //{ - // Name: "doubly optional String, nil", - // Value: cadence.NewOptional( - // cadence.NewOptional(nil), - // ), - // Type: &cadence.OptionalType{ - // Type: &cadence.OptionalType{ - // Type: cadence.StringType{}, - // }, - // }, - //}, + { + Name: "doubly optional String, nil", + Value: cadence.NewOptional( + cadence.NewOptional(nil), + ), + Type: &cadence.OptionalType{ + Type: &cadence.OptionalType{ + Type: cadence.StringType, + }, + }, + }, { Name: "variable-sized array", Value: cadence.NewArray([]cadence.Value{ cadence.String("42"), + }).WithType(&cadence.VariableSizedArrayType{ + ElementType: cadence.StringType, }), Type: &cadence.VariableSizedArrayType{ ElementType: cadence.StringType, @@ -159,6 +160,9 @@ func Test_ParseWithoutType(t *testing.T) { Name: "constant-sized array", Value: cadence.NewArray([]cadence.Value{ cadence.String("42"), + }).WithType(&cadence.ConstantSizedArrayType{ + ElementType: cadence.StringType, + Size: 1, }), Type: &cadence.ConstantSizedArrayType{ ElementType: cadence.StringType, diff --git a/go.mod b/go.mod index 9f3f4f95..b404dd74 100644 --- a/go.mod +++ b/go.mod @@ -137,8 +137,8 @@ require ( github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.6.1-0.20230711151834-86040b30171f // indirect github.com/onflow/crypto v0.25.0 // indirect - github.com/onflow/flow-core-contracts/lib/go/contracts v1.2.4-0.20231016154253-a00dbf7c061f // indirect - github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f // indirect + github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d // indirect + github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d // indirect github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240125205519-2e80d9b4bd01 // indirect github.com/onflow/flow-nft/lib/go/contracts v1.1.1-0.20240125205553-d2b571fb3fad // indirect github.com/onflow/flow/protobuf/go/flow v0.3.2-0.20231213135419-ae911cc351a2 // indirect @@ -217,3 +217,7 @@ require ( modernc.org/sqlite v1.28.0 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) + +replace github.com/onflow/flow-core-contracts/lib/go/contracts => github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d + +replace github.com/onflow/flow-core-contracts/lib/go/templates => github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d diff --git a/go.sum b/go.sum index cf76b0bd..32206a88 100644 --- a/go.sum +++ b/go.sum @@ -1839,10 +1839,10 @@ github.com/onflow/cadence v1.0.0-M4 h1:/nt3j7vpYDxuI0ghIgAJrb2R01ijvJYZLAkKt+zbp github.com/onflow/cadence v1.0.0-M4/go.mod h1:odXGZZ/wGNA5mwT8bC9v8u8EXACHllB2ABSZK65TGL8= github.com/onflow/crypto v0.25.0 h1:BeWbLsh3ZD13Ej+Uky6kg1PL1ZIVBDVX+2MVBNwqddg= github.com/onflow/crypto v0.25.0/go.mod h1:C8FbaX0x8y+FxWjbkHy0Q4EASCDR9bSPWZqlpCLYyVI= -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= -github.com/onflow/flow-core-contracts/lib/go/templates v1.2.4-0.20231016154253-a00dbf7c061f/go.mod h1:ZeLxwaBkzuSInESGjL8/IPZWezF+YOYsYbMrZlhN+q4= +github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d h1:Afcfk/9jAQZ1v5PLGdP68FG/0yPPM60fn9Eq8ChBGS0= +github.com/onflow/flow-core-contracts/lib/go/contracts v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:Ts/HN+N0RaYJ6oPCqR1JPaMVFiVaMdKTSUH4OdSjjs0= +github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d h1:IQJpP3VLLjT4R8ItBpr+Mmp0IOnC/8iBcM0/67JNB9c= +github.com/onflow/flow-core-contracts/lib/go/templates v0.15.1-0.20240125214229-b7a95136dd0d/go.mod h1:MZ2j5YVTQiSE0B99zuaYhxvGG5GcvimWpQK1Fw/1QBg= github.com/onflow/flow-emulator v1.0.0-M1 h1:0hBEmvm73F+5HhN5ugkOP3UyN+Ea9yGWflEmoeGzgdw= github.com/onflow/flow-emulator v1.0.0-M1/go.mod h1:JFJCeQVyhCQVD2Tq4QhctIXK6j5U6aU15yoEwMJt5AQ= github.com/onflow/flow-ft/lib/go/contracts v0.7.1-0.20240125205519-2e80d9b4bd01 h1:8iKk5RuFvhe7NQyAO3c+xiVvv38RB/yopHdWxp4AbL8= diff --git a/tests/testnet_test.go b/tests/testnet_test.go index 757ab782..194d45f5 100644 --- a/tests/testnet_test.go +++ b/tests/testnet_test.go @@ -95,10 +95,10 @@ func initTestnet(t *testing.T) (gateway.Gateway, *flowkit.State, flowkit.Service // The Vault resource that holds the tokens that are being transferred let sentVault: @FungibleToken.Vault - prepare(signer: AuthAccount) { + prepare(signer: auth(BorrowValue) &Account) { // Get a reference to the signer's stored vault - let vaultRef = signer.borrow<&FlowToken.Vault>(from: /storage/flowTokenVault) + let vaultRef = signer.storage.borrow(from: /storage/flowTokenVault) ?? panic("Could not borrow reference to the owner's Vault!") // Withdraw tokens from the signer's stored vault @@ -109,8 +109,7 @@ func initTestnet(t *testing.T) (gateway.Gateway, *flowkit.State, flowkit.Service // Get a reference to the recipient's Receiver let receiverRef = getAccount(to) - .getCapability(/public/flowTokenReceiver) - .borrow<&{FungibleToken.Receiver}>() + .capabilities..borrow<&{FungibleToken.Receiver}>(/public/flowTokenReceiver) ?? panic("Could not borrow receiver reference to the recipient's Vault") // Deposit the withdrawn tokens in the recipient's receiver @@ -136,6 +135,12 @@ func initTestnet(t *testing.T) (gateway.Gateway, *flowkit.State, flowkit.Service var testnet = config.TestnetNetwork.Name func Test_Foo(t *testing.T) { + + // This test relies on a contract deployed on testnet, + // written in old cadence version, which no longer valid. + // TODO: enable once the testnet contract is updated. + t.SkipNow() + _, st, _, rw, _ := initTestnet(t) rw.WriteFile("test", []byte("foo"), 0644) @@ -149,6 +154,12 @@ func Test_Foo(t *testing.T) { } func Test_Testnet_ProjectDeploy(t *testing.T) { + + // This test relies on a contract deployed on testnet, + // written in old cadence version, which no longer valid. + // TODO: enable once the testnet contract is updated. + t.SkipNow() + _, state, flow, rw, _ := initTestnet(t) state.Contracts().AddOrUpdate(config.Contract{ @@ -202,4 +213,4 @@ func Test_Testnet_ProjectDeploy(t *testing.T) { assert.Equal(t, ContractB.Name, contracts[1].Name) assert.Equal(t, ContractB.Source, updated) assert.Equal(t, ContractC.Name, contracts[2].Name) -} +} \ No newline at end of file diff --git a/transactions/transaction_test.go b/transactions/transaction_test.go index e0dbab68..104ac0f3 100644 --- a/transactions/transaction_test.go +++ b/transactions/transaction_test.go @@ -53,7 +53,7 @@ func TestNew(t *testing.T) { script := []byte(` transaction (arg: Int) { - prepare(auth: AuthAccount) {} + prepare(signer: &Account) {} execute {} } `)