github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/cmd/util/ledger/migrations/test-data/cadence_values_migration/store_transaction.cdc (about) 1 import Test from 0x01cf0e2f2f715450 2 3 transaction { 4 5 prepare(acct: AuthAccount) { 6 acct.save("Cafe\u{0301}", to: /storage/string_value_1) 7 acct.save("Caf\u{00E9}", to: /storage/string_value_2) 8 acct.save(Type<AuthAccount>(), to: /storage/type_value) 9 10 // String keys in dictionary 11 acct.save( 12 { 13 "Cafe\u{0301}": 1, 14 "H\u{00E9}llo": 2 15 }, 16 to: /storage/dictionary_with_string_keys, 17 ) 18 19 // Restricted typed keys in dictionary 20 acct.save( 21 { 22 Type<AnyStruct{Test.Bar, Test.Foo}>(): 1, 23 Type<AnyStruct{Test.Foo, Test.Bar, Test.Baz}>(): 2 24 }, 25 to: /storage/dictionary_with_restricted_typed_keys, 26 ) 27 28 // Capabilities and links 29 acct.save(<- Test.createR(), to: /storage/r) 30 31 // Typed capability 32 var cap1: Capability<&Test.R>? = acct.link<&Test.R>(/public/linkR, target: /storage/r) 33 acct.save(cap1, to: /storage/capability) 34 35 // Untyped capability 36 var cap2: Capability = acct.getCapability(/public/linkR) 37 acct.save(cap2, to: /storage/untyped_capability) 38 39 // account-typed keys in dictionary 40 acct.save( 41 { 42 Type<AuthAccount>(): 1, 43 Type<AuthAccount.Capabilities>(): 2, 44 Type<AuthAccount.AccountCapabilities>(): 3, 45 Type<AuthAccount.StorageCapabilities>(): 4, 46 Type<AuthAccount.Contracts>(): 5, 47 Type<AuthAccount.Keys>(): 6, 48 Type<AuthAccount.Inbox>(): 7, 49 50 Type<PublicAccount>(): 8, 51 52 Type<AccountKey>(): 9 53 }, 54 to: /storage/dictionary_with_account_type_keys, 55 ) 56 57 // Entitlements. Both keys produces the same result, 58 // so having them both in the same dictionary will replace one from the other. 59 // Therefore use two separate dictionaries. 60 acct.save( 61 { Type<&Test.R>(): "non_auth_ref" }, 62 to: /storage/dictionary_with_reference_typed_key 63 ) 64 acct.save( 65 { Type<auth &Test.R>(): "auth_ref" }, 66 to: /storage/dictionary_with_auth_reference_typed_key 67 ) 68 } 69 70 execute { 71 log("Values successfully saved in storage") 72 } 73 }