diff --git a/.project.json b/.project.json index 0869f08f9..c9413a9e1 100644 --- a/.project.json +++ b/.project.json @@ -1,5 +1,5 @@ { - "fullNodeVersion": "v3.12.7", + "fullNodeVersion": "v3.14.0", "compilerOptionsUsed": { "ignoreUnusedConstantsWarnings": false, "ignoreUnusedVariablesWarnings": false, diff --git a/artifacts/add/Add.ral.json b/artifacts/add/Add.ral.json index 2b84df4af..ad6d0c37d 100644 --- a/artifacts/add/Add.ral.json +++ b/artifacts/add/Add.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Add", "bytecode": "0206124024404f407440a140af010002020205d34fbb20db1600160100020201000c0c0205d36a51f82d1600160100020200000202021805160016015f06160016015f075da00016002a16012aa100a000160016010e0dce00010002010304060011d319adf50e1300641600130164170517041603d1a21601160216041605c118010104060015d3f6ce55a6130064160013016417051704160316021340c8ac1603d1a21601160216041605c118010201010003d320f98f621600b0", "codeHash": "630de1d7741f1c7f5727b26fc099111ff2b96ca85388f013eb5e3ec1cb3cfcf9", diff --git a/artifacts/add/AddMain.ral.json b/artifacts/add/AddMain.ral.json index 8f2a02101..aeb3883db 100644 --- a/artifacts/add/AddMain.ral.json +++ b/artifacts/add/AddMain.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "AddMain", "bytecodeTemplate": "0101030002000c{1}{2}17011700160016010e0e{0}01001818", "fieldsSig": { diff --git a/artifacts/add/DestroyAdd.ral.json b/artifacts/add/DestroyAdd.ral.json index 6789b9242..d934672fe 100644 --- a/artifacts/add/DestroyAdd.ral.json +++ b/artifacts/add/DestroyAdd.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DestroyAdd", "bytecodeTemplate": "01010300000005{1}0d0c{0}0105", "fieldsSig": { diff --git a/artifacts/greeter/Greeter.ral.json b/artifacts/greeter/Greeter.ral.json index 09f0c779d..fdb780401 100644 --- a/artifacts/greeter/Greeter.ral.json +++ b/artifacts/greeter/Greeter.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Greeter", "bytecode": "190111010000000106d3952f757b030c7bce0002", "codeHash": "4bbf82c83dcb0a3df905c290fbc12a19ce5160a7b655c1a347913481da12d747", diff --git a/artifacts/greeter/GreeterMain.ral.json b/artifacts/greeter/GreeterMain.ral.json index bbd9c8397..6b10c4f7f 100644 --- a/artifacts/greeter/GreeterMain.ral.json +++ b/artifacts/greeter/GreeterMain.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "GreeterMain", "bytecodeTemplate": "01010300020014{0}17000c0d160001000d2f0c7b{0}17010c0d1601d4952f757b0d2f0c7b", "fieldsSig": { diff --git a/artifacts/nft/DeprecatedNFTTest1.ral.json b/artifacts/nft/DeprecatedNFTTest1.ral.json index 73735a4ac..af94a733f 100644 --- a/artifacts/nft/DeprecatedNFTTest1.ral.json +++ b/artifacts/nft/DeprecatedNFTTest1.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest1", "bytecode": "02010e010000000103d3ee6a5cd5ce0102", "codeHash": "cc6928c9c6777077abcb5b9c4f7c5d620d6cae07ec6f00f5e8b0efe6a7b913c4", diff --git a/artifacts/nft/DeprecatedNFTTest2.ral.json b/artifacts/nft/DeprecatedNFTTest2.ral.json index 3f4cd076d..b975c16f1 100644 --- a/artifacts/nft/DeprecatedNFTTest2.ral.json +++ b/artifacts/nft/DeprecatedNFTTest2.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest2", "bytecode": "02020e1c010000000103d3ee6a5cd5ce0102010000000103d33e65d93dce0002", "codeHash": "ade9aee476ee752050a1e9e1b19039f05261cb3f53941152617174faf9eae572", diff --git a/artifacts/nft/DeprecatedNFTTest3.ral.json b/artifacts/nft/DeprecatedNFTTest3.ral.json index 757390909..f55530042 100644 --- a/artifacts/nft/DeprecatedNFTTest3.ral.json +++ b/artifacts/nft/DeprecatedNFTTest3.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest3", "bytecode": "02020e19010000000103d3ee6a5cd5ce0102010000000001d34d12f529", "codeHash": "465bc3739cd1649e58e0470971bd2fabf21363ab9fc2c15052fb2440dd06ada5", diff --git a/artifacts/nft/DeprecatedNFTTest4.ral.json b/artifacts/nft/DeprecatedNFTTest4.ral.json index e8d1f2ac7..5fa29a24f 100644 --- a/artifacts/nft/DeprecatedNFTTest4.ral.json +++ b/artifacts/nft/DeprecatedNFTTest4.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest4", "bytecode": "02020e1b010000000103d3ee6a5cd5ce0102010000000103d35f9a418a0402", "codeHash": "a5de0fa0b3580303ac63423f09ce5ed95fccbf789679b32130a53c26fef182e9", diff --git a/artifacts/nft/DeprecatedNFTTest5.ral.json b/artifacts/nft/DeprecatedNFTTest5.ral.json index 02f306e41..cb4bf38c3 100644 --- a/artifacts/nft/DeprecatedNFTTest5.ral.json +++ b/artifacts/nft/DeprecatedNFTTest5.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest5", "bytecode": "02020e1e010000000103d3ee6a5cd5ce0102010000000305d35c9ec8a3ce000c0c02", "codeHash": "8b1374f39db98c485af3dd05d0b0ce861e9528f290ca9dc0d7108e8b48b50161", diff --git a/artifacts/nft/DeprecatedNFTTest6.ral.json b/artifacts/nft/DeprecatedNFTTest6.ral.json index 5f136de00..4f20c6d90 100644 --- a/artifacts/nft/DeprecatedNFTTest6.ral.json +++ b/artifacts/nft/DeprecatedNFTTest6.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest6", "bytecode": "02020e1c010000000103d3ee6a5cd5ce0102010000000204d30e0a3ac10c0d02", "codeHash": "8bc0d39f0607d4a771ec70ae1057b71dbcde404177cb3b25fd7d93d553a2b8cd", diff --git a/artifacts/nft/DeprecatedNFTTest7.ral.json b/artifacts/nft/DeprecatedNFTTest7.ral.json index 7755e877a..a9d2a46b8 100644 --- a/artifacts/nft/DeprecatedNFTTest7.ral.json +++ b/artifacts/nft/DeprecatedNFTTest7.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DeprecatedNFTTest7", "bytecode": "02020e1d010000000103d3ee6a5cd5ce0102010000000204d3289dd321ce000b02", "codeHash": "b95c9acf088b090f5d9d34f28ab079cf22b9e53af8ae6864113c71172231ef4c", diff --git a/artifacts/nft/MintNFTTest.ral.json b/artifacts/nft/MintNFTTest.ral.json index cf51567d9..165ecd6e9 100644 --- a/artifacts/nft/MintNFTTest.ral.json +++ b/artifacts/nft/MintNFTTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MintNFTTest", "bytecodeTemplate": "01010300000015{2}4c0ab413c40de0b6b3a7640000a2{1}0d0d{0}0107184a09b413c40de0b6b3a7640000a2{1}0d0d{0}010418", "fieldsSig": { diff --git a/artifacts/nft/NFTCollectionTest.ral.json b/artifacts/nft/NFTCollectionTest.ral.json index 9593427ab..f52f2e7a0 100644 --- a/artifacts/nft/NFTCollectionTest.ral.json +++ b/artifacts/nft/NFTCollectionTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "NFTCollectionTest", "bytecode": "04050912402d4040408a010000000102ce0102010000000102a0000201000102010f16000001310c7b160040cb17011601c50d7b16010201000203000816010002170216001602410e7b01030105011fd3b8b591eeb41701b1a00016001406414c5048000313046413006417031702160113c40de0b6b3a7640000a2a00040ce00160216030d1601c91704a0000d2aa100160402", "codeHash": "087f9292bb326a4d39a6fac09928cb25edf2837718f830f3a166a937f8724779", diff --git a/artifacts/nft/NFTCollectionWithRoyaltyTest.ral.json b/artifacts/nft/NFTCollectionWithRoyaltyTest.ral.json index c641d8db5..02cd99d1a 100644 --- a/artifacts/nft/NFTCollectionWithRoyaltyTest.ral.json +++ b/artifacts/nft/NFTCollectionWithRoyaltyTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "NFTCollectionWithRoyaltyTest", "bytecode": "06080912402d40404050405b406c40b6010000000102ce0102010000000102a0000201000102010f16000001310c7b160040cb17011601c50d7b16010201000203000816010002170216001602410e7b0100020201061601ce032c1367102d0201010202000316001601a9010202020008b4ce02450f7b16001601a801030105011fd3b8b591eeb41701b1a00016001406414c5048000313046413006417031702160113c40de0b6b3a7640000a2a00040ce00160216030d1601c91704a0000d2aa100160402", "codeHash": "3b64d5e360566a4e4f568f773536a3ea74e66d12231aa44f19d2214ba87b38d6", diff --git a/artifacts/nft/NFTTest.ral.json b/artifacts/nft/NFTTest.ral.json index 41aa7c1ac..bfa5e342b 100644 --- a/artifacts/nft/NFTTest.ral.json +++ b/artifacts/nft/NFTTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "NFTTest", "bytecode": "04020914010000000102ce0202010000000203ce00ce0102", "codeHash": "4897086210869e612d82995b765a447c5319a55a56e8a0c3c07b4d9ca81e15b1", diff --git a/artifacts/nft/NFTTestStd.ral.json b/artifacts/nft/NFTTestStd.ral.json index f9a492e1a..00d906ad7 100644 --- a/artifacts/nft/NFTTestStd.ral.json +++ b/artifacts/nft/NFTTestStd.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "NFTTestStd", "bytecode": "040309144020010000000102ce0202010000000203ce00ce0102010000000002d36811cfdd02", "codeHash": "b7ff3fa8dfacc7ae5edbabd6573d0699dffc5a0f07ad14023f682a201b7bce55", diff --git a/artifacts/nft/WithdrawNFTCollectionTest.ral.json b/artifacts/nft/WithdrawNFTCollectionTest.ral.json index 37f1f3fcf..d94865035 100644 --- a/artifacts/nft/WithdrawNFTCollectionTest.ral.json +++ b/artifacts/nft/WithdrawNFTCollectionTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "WithdrawNFTCollectionTest", "bytecodeTemplate": "01010300000006b4{1}0e0c{0}0106", "fieldsSig": { diff --git a/artifacts/nft/WrongNFTTest.ral.json b/artifacts/nft/WrongNFTTest.ral.json index 1e30151bf..549cad53c 100644 --- a/artifacts/nft/WrongNFTTest.ral.json +++ b/artifacts/nft/WrongNFTTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "WrongNFTTest", "bytecode": "04020917010000000102ce0202010000000206040c7bce00ce0102", "codeHash": "7dd2ed643a98b2a1a52a9b9e536fcdae60d961b583b8109f777d846bfdfcae8d", diff --git a/artifacts/sub/Sub.ral.json b/artifacts/sub/Sub.ral.json index 330437fb1..976eab825 100644 --- a/artifacts/sub/Sub.ral.json +++ b/artifacts/sub/Sub.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Sub", "bytecode": "01011e01000202010dd321939f9e05160016015fa00016002a16012ba100a00002", "codeHash": "3461ebfaca02ad0a3f587a5b67a461c0cbd82d14261407b1d9277ed4ad129234", diff --git a/artifacts/test/Assert.ral.json b/artifacts/test/Assert.ral.json index ea9f565e0..36d2426fd 100644 --- a/artifacts/test/Assert.ral.json +++ b/artifacts/test/Assert.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Assert", "bytecode": "000110010000000006d362d460120d0e2f0f7b", "codeHash": "46dc5e3835be6551dacbf81565912ec67575aa77522312ceed88472817735d6b", diff --git a/artifacts/test/AutoFund.ral.json b/artifacts/test/AutoFund.ral.json index f1f9adf55..b892db9c4 100644 --- a/artifacts/test/AutoFund.ral.json +++ b/artifacts/test/AutoFund.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "AutoFund", "bytecode": "00014040010101020017d3f59c1e39b413c4016345785d8a0000a90c170116011600314c0dca140a5f5f6d61705f5f305f5f16014044b11601d2010116010d2a17014a2f", "codeHash": "a151f4b64bd66f02b83826d4aa26a0d1030f959f88fc8cb7579a55feaeee5869", diff --git a/artifacts/test/CallScript0.ral.json b/artifacts/test/CallScript0.ral.json index 9a18ecec1..aa595fa00 100644 --- a/artifacts/test/CallScript0.ral.json +++ b/artifacts/test/CallScript0.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "CallScript0", "bytecodeTemplate": "01010000000206{1}0d0e{0}010302", "fieldsSig": { diff --git a/artifacts/test/CallScript1.ral.json b/artifacts/test/CallScript1.ral.json index 958274477..fcf6c5233 100644 --- a/artifacts/test/CallScript1.ral.json +++ b/artifacts/test/CallScript1.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "CallScript1", "bytecodeTemplate": "0101000000070a{1}0d0e{0}01030c11{2}010202", "fieldsSig": { diff --git a/artifacts/test/Debug.ral.json b/artifacts/test/Debug.ral.json index df849f3e5..8b16fb6e4 100644 --- a/artifacts/test/Debug.ral.json +++ b/artifacts/test/Debug.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Debug", "bytecode": "00010b010000000001d38681d619", "codeHash": "cc0e1966e6847f2c03384e78df1dcd9a0c2b5db1b7c1e901d66e26e2b000eb2c", diff --git a/artifacts/test/Deposit.ral.json b/artifacts/test/Deposit.ral.json index 591b2d4c9..6124a7a8f 100644 --- a/artifacts/test/Deposit.ral.json +++ b/artifacts/test/Deposit.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Deposit", "bytecodeTemplate": "01010300000007b413c40de0b6b3a7640000a20c0c{0}0100", "fieldsSig": { diff --git a/artifacts/test/DepositToken.ral.json b/artifacts/test/DepositToken.ral.json index 49ba8d73e..e1a2d4d66 100644 --- a/artifacts/test/DepositToken.ral.json +++ b/artifacts/test/DepositToken.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "DepositToken", "bytecodeTemplate": "01010300000009b4{1}{2}a3{2}0d0c{0}0102", "fieldsSig": { diff --git a/artifacts/test/InlineTest.ral.json b/artifacts/test/InlineTest.ral.json index 93dc88e10..2d35e274f 100644 --- a/artifacts/test/InlineTest.ral.json +++ b/artifacts/test/InlineTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "InlineTest", "bytecode": "0101402b010100000112d3811965ccb413c32386f26fc10000a9a0000d2aa100a00018a0000d2aa100a00018a00002", "codeHash": "5ce5376e13ecf0b46e03923f50782b844e8bb099c8d3ab2cf6d8d3484c9150ed", diff --git a/artifacts/test/InsertIntoMap.ral.json b/artifacts/test/InsertIntoMap.ral.json index da285bd7d..958319a4a 100644 --- a/artifacts/test/InsertIntoMap.ral.json +++ b/artifacts/test/InsertIntoMap.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "InsertIntoMap", "bytecodeTemplate": "01010300020010{2}{3}17011700{1}d10f2ca2{1}160016010f0c{0}0100", "fieldsSig": { diff --git a/artifacts/test/MapTest.ral.json b/artifacts/test/MapTest.ral.json index 5969091e7..ebaf55081 100644 --- a/artifacts/test/MapTest.ral.json +++ b/artifacts/test/MapTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MapTest", "bytecode": "0004405c40dc4153418001030303001fd3a9cdcc691600d1a2140a5f5f6d61705f5f305f5f160047441601b11602d202011600d1a2140a5f5f6d61705f5f315f5f16014044b11602d201011600d1a2140a5f5f6d61705f5f325f5f1402001144b11602d2010101000104004036d3c50ed2bb0c0d0d140a5f5f6d61705f5f305f5f16004744cb1703160301000c0d0d160301011702170116020d2a0c0e0c140a5f5f6d61705f5f305f5f16004744cb010216020d2a0c0e0c140a5f5f6d61705f5f315f5f16014044cb010216020d2a0c0e0c140a5f5f6d61705f5f325f5f1402001144cb01020100010400402dd392ac08660c0d0d140a5f5f6d61705f5f305f5f16004744cb1703160301000c0d0d160301011702170116000d0c140a5f5f6d61705f5f305f5f16004744cb010316000d0c140a5f5f6d61705f5f315f5f16014044cb010316000d0c140a5f5f6d61705f5f325f5f1402001144cb0103010001020212d3143f7dc50c0d0d140a5f5f6d61705f5f305f5f16004744cb1701160101000c0d0d1601010102", "codeHash": "9c0dad73dd47255270a366794f84539f06816e30c68b1f1cca767707fa8db596", diff --git a/artifacts/test/MapTestSub.ral.json b/artifacts/test/MapTestSub.ral.json index 92d515a91..c0ab51f0b 100644 --- a/artifacts/test/MapTestSub.ral.json +++ b/artifacts/test/MapTestSub.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MapTestSub", "bytecode": "0101404601030307014023d3cef11f5a14046d61703a160047441703130064130064170517041600d1a21603ce0016041605c117061600d10f2ca21600160116020f0c16060100160602", "codeHash": "755ebb4ca4c436991cc8363fedb6840abf16857a6c326983376db9e68fe8c985", diff --git a/artifacts/test/MapTestWrapper.ral.json b/artifacts/test/MapTestWrapper.ral.json index c7987d8eb..4258a5a57 100644 --- a/artifacts/test/MapTestWrapper.ral.json +++ b/artifacts/test/MapTestWrapper.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MapTestWrapper", "bytecode": "01031d4030404301030303000dd3a9cdcc691600d10f2ca21600160116020f0cce000100010001010006d3c50ed2bb16000d0cce000101010001010006d392ac086616000d0cce000102", "codeHash": "1d525d3e4cbd1c8f4c0431bf6881e888eeebae012a14532530097f62dd766e9a", diff --git a/artifacts/test/MetaData.ral.json b/artifacts/test/MetaData.ral.json index e9f77f34b..c27374158 100644 --- a/artifacts/test/MetaData.ral.json +++ b/artifacts/test/MetaData.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MetaData", "bytecode": "000319402c4033010300000006d38d0b3636b4b413c40de0b6b3a7640000a702000200000004b413c40de0b6b3a7640000a80200000000000102", "codeHash": "5b113459525557465f1cc5aeee453dfd5823d1a6094372cee6067f7466b40896", diff --git a/artifacts/test/MultiDeposit.ral.json b/artifacts/test/MultiDeposit.ral.json index 86adb6ac1..15d2d0f84 100644 --- a/artifacts/test/MultiDeposit.ral.json +++ b/artifacts/test/MultiDeposit.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MultiDeposit", "bytecodeTemplate": "0101030002004024{0}{1}17011700b413c40de0b6b3a7640000a20c0c16000100b413c40de0b6b3a7640000a20c0c16010100b4{2}13c40de0b6b3a7640000a313c40de0b6b3a76400000d0c16000102b4{2}13c40de0b6b3a7640000a313c40de0b6b3a76400000d0c16010102", "fieldsSig": { diff --git a/artifacts/test/MultiWithdraw.ral.json b/artifacts/test/MultiWithdraw.ral.json index 1a1699346..8f8107aa6 100644 --- a/artifacts/test/MultiWithdraw.ral.json +++ b/artifacts/test/MultiWithdraw.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "MultiWithdraw", "bytecodeTemplate": "01010300020016{0}{1}170117000c0c160001010c0c1601010113c40de0b6b3a76400000d0c1600010313c40de0b6b3a76400000d0c16010103", "fieldsSig": { diff --git a/artifacts/test/OwnerOnly.ral.json b/artifacts/test/OwnerOnly.ral.json index 7fb82a993..43a21e703 100644 --- a/artifacts/test/OwnerOnly.ral.json +++ b/artifacts/test/OwnerOnly.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "OwnerOnly", "bytecode": "010111010000000006d3bf853dbdb4ce00450c7b", "codeHash": "c8ecfd7b7e1f3d0169d80e0abb59702516eeff301d47e0e7be70a631bd9414ca", diff --git a/artifacts/test/RemoveFromMap.ral.json b/artifacts/test/RemoveFromMap.ral.json index 8c67711c8..884e45132 100644 --- a/artifacts/test/RemoveFromMap.ral.json +++ b/artifacts/test/RemoveFromMap.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "RemoveFromMap", "bytecodeTemplate": "01010300000005{1}0d0c{0}0102", "fieldsSig": { diff --git a/artifacts/test/TemplateArrayVar.ral.json b/artifacts/test/TemplateArrayVar.ral.json index 1c58919a2..21ab56ba4 100644 --- a/artifacts/test/TemplateArrayVar.ral.json +++ b/artifacts/test/TemplateArrayVar.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "TemplateArrayVar", "bytecodeTemplate": "010103000e00408d{1}{2}{3}{4}1703170217011700{6}{7}{8}170617051704{0}18{5}1816030f2f16020e2f1a16010d2f1a16000c2f1a0c7b160016011708170716070c2f16080d2f1a0c7b16021603170a170916090e2f160a0f2f1a0c7b16060e2f16050d2f1a16040c2f1a0c7b0c170b160b0e314c40260c170c160c0e314c1b160b7a0e314d0e2c160c7a0e314d2a78160b0e2c160c2a2f0c7b160c0d2a170c4a21160b0d2a170b4a7fd60c170d160d0f314c11160d7a0f314d102a78160d2f0c7b160d0d2a170d4a2b", "fieldsSig": { diff --git a/artifacts/test/TestAssert.ral.json b/artifacts/test/TestAssert.ral.json index 4b50ff178..508d2eb3e 100644 --- a/artifacts/test/TestAssert.ral.json +++ b/artifacts/test/TestAssert.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "TestAssert", "bytecodeTemplate": "010103000000040c0c{0}0100", "fieldsSig": { diff --git a/artifacts/test/Transact.ral.json b/artifacts/test/Transact.ral.json index 10312cec4..5373d8409 100644 --- a/artifacts/test/Transact.ral.json +++ b/artifacts/test/Transact.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Transact", "bytecode": "03064027404e40674080408e409c010100000009d353dbb7aab413c40de0b6b3a7640000a9a00013c40de0b6b3a76400002aa10002010200000009d3a248861cb413c40de0b6b3a7640000a8a00013c40de0b6b3a76400002ba1000201010101000ad3bf2d01bdb4ce001600aca00116002aa1010201020101000ad35496306fb4ce001600aba00116002ba10102010000000103d3815a8d0da00002010000000103d3a51b051ca00102", "codeHash": "0b6427253638fa8f32b04e7c5915d41d51b0148a8e219e4881eba5548a42ae41", diff --git a/artifacts/test/UpdateMapValue.ral.json b/artifacts/test/UpdateMapValue.ral.json index b5142b21f..2070ad938 100644 --- a/artifacts/test/UpdateMapValue.ral.json +++ b/artifacts/test/UpdateMapValue.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "UpdateMapValue", "bytecodeTemplate": "01010300000005{1}0d0c{0}0101", "fieldsSig": { diff --git a/artifacts/test/UpdateUserAccount.ral.json b/artifacts/test/UpdateUserAccount.ral.json index bb43bac43..f8640f897 100644 --- a/artifacts/test/UpdateUserAccount.ral.json +++ b/artifacts/test/UpdateUserAccount.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "UpdateUserAccount", "bytecodeTemplate": "01010300040015{1}{2}{3}{4}17031702170117001600160116021603100c{0}0100{5}0d0c{0}0101", "fieldsSig": { diff --git a/artifacts/test/UserAccount.ral.json b/artifacts/test/UserAccount.ral.json index e09f22df9..666b68742 100644 --- a/artifacts/test/UserAccount.ral.json +++ b/artifacts/test/UserAccount.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "UserAccount", "bytecode": "080340284037404d010004040013d388b067e71600ce01410c7b1602ce02410c7b1601a1021603a103160116032aa101010001010003d3185a39e11600a100010000000507d384cc0995a001ce01a002ce02a00302", "codeHash": "4e9f7eac1b76eaa2268b5af6ebb5640252892dc170aad6c1ee7b639131a55816", diff --git a/artifacts/test/Warnings.ral.json b/artifacts/test/Warnings.ral.json index 71fb4d6d2..93d6f5a43 100644 --- a/artifacts/test/Warnings.ral.json +++ b/artifacts/test/Warnings.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Warnings", "bytecode": "02010c010002020002d31bbce4a602", "codeHash": "873e095edb39cdb4b11b1157003daeacad06d259a938cd270e22b8e89b75feea", diff --git a/artifacts/test/Withdraw.ral.json b/artifacts/test/Withdraw.ral.json index a44afaf54..a37b5f4a2 100644 --- a/artifacts/test/Withdraw.ral.json +++ b/artifacts/test/Withdraw.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "Withdraw", "bytecodeTemplate": "010103000000040c0c{0}0101", "fieldsSig": { diff --git a/artifacts/token/FakeTokenTest.ral.json b/artifacts/token/FakeTokenTest.ral.json index b295bb63d..af64dd705 100644 --- a/artifacts/token/FakeTokenTest.ral.json +++ b/artifacts/token/FakeTokenTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "FakeTokenTest", "bytecode": "010509121b4024402f010000000103044d18010000000103044d18010000000103044d18010000000103044d18010000000001d38d0b3636", "codeHash": "52f971cb44d54a5353e94dc8db991d2726f76760af782e79bd8a66a9b5b294b7", diff --git a/artifacts/token/TokenTest.ral.json b/artifacts/token/TokenTest.ral.json index 5288117b8..325e7cfda 100644 --- a/artifacts/token/TokenTest.ral.json +++ b/artifacts/token/TokenTest.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "TokenTest", "bytecode": "050409121b4024010000000102ce0002010000000102ce0102010000000102ce0202010000000102ce0302", "codeHash": "a2800413eb2c5c23d48068db23df5f8eeaba04653e12c8ed59d589720d96dadd", diff --git a/artifacts/token/TokenTestStd.ral.json b/artifacts/token/TokenTestStd.ral.json index 03e8fb892..5a67bdc52 100644 --- a/artifacts/token/TokenTestStd.ral.json +++ b/artifacts/token/TokenTestStd.ral.json @@ -1,5 +1,5 @@ { - "version": "v3.12.7", + "version": "v3.14.0", "name": "TokenTestStd", "bytecode": "050509121b40244030010000000102ce0002010000000102ce0102010000000102ce0202010000000102ce0302010000000002d36811cfdd02", "codeHash": "4aa5c769148cada8eeb1cd3791f6e793ed92009ac79ebb64dc79d4d7f2969c8b", diff --git a/artifacts/ts/Add.ts b/artifacts/ts/Add.ts index 50b277267..0eb907ef6 100644 --- a/artifacts/ts/Add.ts +++ b/artifacts/ts/Add.ts @@ -33,6 +33,12 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; +import { + WsSubscribeOptions, + WsSubscription, + subscribeContractEventWS, + subscribeContractEventsWS, +} from "@alephium/web3"; import { default as AddContractJson } from "../add/Add.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { @@ -284,6 +290,11 @@ export class AddInstance extends ContractInstance { fromCount ); } + subscribeAddEventWS( + options: WsSubscribeOptions + ): Promise { + return subscribeContractEventWS(Add.contract, this, options, "Add"); + } subscribeAdd1Event( options: EventSubscribeOptions, @@ -297,6 +308,11 @@ export class AddInstance extends ContractInstance { fromCount ); } + subscribeAdd1EventWS( + options: WsSubscribeOptions + ): Promise { + return subscribeContractEventWS(Add.contract, this, options, "Add1"); + } subscribeEmptyEvent( options: EventSubscribeOptions, @@ -310,6 +326,11 @@ export class AddInstance extends ContractInstance { fromCount ); } + subscribeEmptyEventWS( + options: WsSubscribeOptions + ): Promise { + return subscribeContractEventWS(Add.contract, this, options, "Empty"); + } subscribeAllEvents( options: EventSubscribeOptions< @@ -319,6 +340,13 @@ export class AddInstance extends ContractInstance { ): EventSubscription { return subscribeContractEvents(Add.contract, this, options, fromCount); } + subscribeAllEventsWS( + options: WsSubscribeOptions< + AddTypes.AddEvent | AddTypes.Add1Event | AddTypes.EmptyEvent + > + ): Promise { + return subscribeContractEventsWS(Add.contract, this, options); + } view = { add: async ( diff --git a/artifacts/ts/Assert.ts b/artifacts/ts/Assert.ts index 359a5df61..8b6f07fd5 100644 --- a/artifacts/ts/Assert.ts +++ b/artifacts/ts/Assert.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as AssertContractJson } from "../test/Assert.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/AutoFund.ts b/artifacts/ts/AutoFund.ts index 39e0cacd9..6a9a47c51 100644 --- a/artifacts/ts/AutoFund.ts +++ b/artifacts/ts/AutoFund.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as AutoFundContractJson } from "../test/AutoFund.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/Debug.ts b/artifacts/ts/Debug.ts index ffe8f7bd5..382925f09 100644 --- a/artifacts/ts/Debug.ts +++ b/artifacts/ts/Debug.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DebugContractJson } from "../test/Debug.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest1.ts b/artifacts/ts/DeprecatedNFTTest1.ts index b03d94216..03f713a5a 100644 --- a/artifacts/ts/DeprecatedNFTTest1.ts +++ b/artifacts/ts/DeprecatedNFTTest1.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest1ContractJson } from "../nft/DeprecatedNFTTest1.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest2.ts b/artifacts/ts/DeprecatedNFTTest2.ts index f5a7c89bb..907e9a1c3 100644 --- a/artifacts/ts/DeprecatedNFTTest2.ts +++ b/artifacts/ts/DeprecatedNFTTest2.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest2ContractJson } from "../nft/DeprecatedNFTTest2.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest3.ts b/artifacts/ts/DeprecatedNFTTest3.ts index 27a92c9b8..511d2a3de 100644 --- a/artifacts/ts/DeprecatedNFTTest3.ts +++ b/artifacts/ts/DeprecatedNFTTest3.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest3ContractJson } from "../nft/DeprecatedNFTTest3.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest4.ts b/artifacts/ts/DeprecatedNFTTest4.ts index dc6e02a0d..6000cdc09 100644 --- a/artifacts/ts/DeprecatedNFTTest4.ts +++ b/artifacts/ts/DeprecatedNFTTest4.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest4ContractJson } from "../nft/DeprecatedNFTTest4.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest5.ts b/artifacts/ts/DeprecatedNFTTest5.ts index dd800f040..fca4b577d 100644 --- a/artifacts/ts/DeprecatedNFTTest5.ts +++ b/artifacts/ts/DeprecatedNFTTest5.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest5ContractJson } from "../nft/DeprecatedNFTTest5.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest6.ts b/artifacts/ts/DeprecatedNFTTest6.ts index 9d4062b03..a30477b19 100644 --- a/artifacts/ts/DeprecatedNFTTest6.ts +++ b/artifacts/ts/DeprecatedNFTTest6.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest6ContractJson } from "../nft/DeprecatedNFTTest6.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/DeprecatedNFTTest7.ts b/artifacts/ts/DeprecatedNFTTest7.ts index 8bff0b3e6..6c00e87db 100644 --- a/artifacts/ts/DeprecatedNFTTest7.ts +++ b/artifacts/ts/DeprecatedNFTTest7.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as DeprecatedNFTTest7ContractJson } from "../nft/DeprecatedNFTTest7.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/FakeTokenTest.ts b/artifacts/ts/FakeTokenTest.ts index f05d519c5..7ed66d19d 100644 --- a/artifacts/ts/FakeTokenTest.ts +++ b/artifacts/ts/FakeTokenTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as FakeTokenTestContractJson } from "../token/FakeTokenTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/Greeter.ts b/artifacts/ts/Greeter.ts index 89a05d6da..eb5c4aa6f 100644 --- a/artifacts/ts/Greeter.ts +++ b/artifacts/ts/Greeter.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as GreeterContractJson } from "../greeter/Greeter.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/InlineTest.ts b/artifacts/ts/InlineTest.ts index 5f1cdc776..0bc633248 100644 --- a/artifacts/ts/InlineTest.ts +++ b/artifacts/ts/InlineTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as InlineTestContractJson } from "../test/InlineTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/MapTest.ts b/artifacts/ts/MapTest.ts index 3b047ca62..38efe3074 100644 --- a/artifacts/ts/MapTest.ts +++ b/artifacts/ts/MapTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as MapTestContractJson } from "../test/MapTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/MapTestSub.ts b/artifacts/ts/MapTestSub.ts index b56414c5b..35a7d9492 100644 --- a/artifacts/ts/MapTestSub.ts +++ b/artifacts/ts/MapTestSub.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as MapTestSubContractJson } from "../test/MapTestSub.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/MapTestWrapper.ts b/artifacts/ts/MapTestWrapper.ts index 51511cc15..483add892 100644 --- a/artifacts/ts/MapTestWrapper.ts +++ b/artifacts/ts/MapTestWrapper.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as MapTestWrapperContractJson } from "../test/MapTestWrapper.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/MetaData.ts b/artifacts/ts/MetaData.ts index ae76e7a5e..6266feab9 100644 --- a/artifacts/ts/MetaData.ts +++ b/artifacts/ts/MetaData.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as MetaDataContractJson } from "../test/MetaData.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/NFTCollectionTest.ts b/artifacts/ts/NFTCollectionTest.ts index 2935bf7f3..c9d03f987 100644 --- a/artifacts/ts/NFTCollectionTest.ts +++ b/artifacts/ts/NFTCollectionTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as NFTCollectionTestContractJson } from "../nft/NFTCollectionTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/NFTCollectionWithRoyaltyTest.ts b/artifacts/ts/NFTCollectionWithRoyaltyTest.ts index 8e285229c..1efc60319 100644 --- a/artifacts/ts/NFTCollectionWithRoyaltyTest.ts +++ b/artifacts/ts/NFTCollectionWithRoyaltyTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as NFTCollectionWithRoyaltyTestContractJson } from "../nft/NFTCollectionWithRoyaltyTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/NFTTest.ts b/artifacts/ts/NFTTest.ts index 81c7ee525..53707d46b 100644 --- a/artifacts/ts/NFTTest.ts +++ b/artifacts/ts/NFTTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as NFTTestContractJson } from "../nft/NFTTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/NFTTestStd.ts b/artifacts/ts/NFTTestStd.ts index 7ee305331..2baf955c5 100644 --- a/artifacts/ts/NFTTestStd.ts +++ b/artifacts/ts/NFTTestStd.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as NFTTestStdContractJson } from "../nft/NFTTestStd.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/OwnerOnly.ts b/artifacts/ts/OwnerOnly.ts index cfe52e6c3..8973a7a19 100644 --- a/artifacts/ts/OwnerOnly.ts +++ b/artifacts/ts/OwnerOnly.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as OwnerOnlyContractJson } from "../test/OwnerOnly.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/Sub.ts b/artifacts/ts/Sub.ts index 6819e04ef..5de3cfffb 100644 --- a/artifacts/ts/Sub.ts +++ b/artifacts/ts/Sub.ts @@ -33,6 +33,12 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; +import { + WsSubscribeOptions, + WsSubscription, + subscribeContractEventWS, + subscribeContractEventsWS, +} from "@alephium/web3"; import { default as SubContractJson } from "../sub/Sub.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { @@ -156,6 +162,11 @@ export class SubInstance extends ContractInstance { fromCount ); } + subscribeSubEventWS( + options: WsSubscribeOptions + ): Promise { + return subscribeContractEventWS(Sub.contract, this, options, "Sub"); + } view = { sub: async ( diff --git a/artifacts/ts/TokenTest.ts b/artifacts/ts/TokenTest.ts index d5fa4544e..69bb1578d 100644 --- a/artifacts/ts/TokenTest.ts +++ b/artifacts/ts/TokenTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as TokenTestContractJson } from "../token/TokenTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/TokenTestStd.ts b/artifacts/ts/TokenTestStd.ts index e30fe4377..aee06e6b9 100644 --- a/artifacts/ts/TokenTestStd.ts +++ b/artifacts/ts/TokenTestStd.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as TokenTestStdContractJson } from "../token/TokenTestStd.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/Transact.ts b/artifacts/ts/Transact.ts index 9b643d468..ffe5df64c 100644 --- a/artifacts/ts/Transact.ts +++ b/artifacts/ts/Transact.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as TransactContractJson } from "../test/Transact.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/UserAccount.ts b/artifacts/ts/UserAccount.ts index 6de80abba..b959b049f 100644 --- a/artifacts/ts/UserAccount.ts +++ b/artifacts/ts/UserAccount.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as UserAccountContractJson } from "../test/UserAccount.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/Warnings.ts b/artifacts/ts/Warnings.ts index 898a7f6e2..c266f1ec2 100644 --- a/artifacts/ts/Warnings.ts +++ b/artifacts/ts/Warnings.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as WarningsContractJson } from "../test/Warnings.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/artifacts/ts/WrongNFTTest.ts b/artifacts/ts/WrongNFTTest.ts index 1ac8efa51..87769a7a9 100644 --- a/artifacts/ts/WrongNFTTest.ts +++ b/artifacts/ts/WrongNFTTest.ts @@ -33,6 +33,7 @@ import { encodeContractFields, Narrow, } from "@alephium/web3"; + import { default as WrongNFTTestContractJson } from "../nft/WrongNFTTest.ral.json"; import { getContractByCodeHash, registerContract } from "./contracts"; import { diff --git a/packages/cli/src/codegen.ts b/packages/cli/src/codegen.ts index df3ee1174..e8a4b39f8 100644 --- a/packages/cli/src/codegen.ts +++ b/packages/cli/src/codegen.ts @@ -273,6 +273,9 @@ function genSubscribeEvent(contractName: string, event: EventSig): string { subscribe${eventType}(options: EventSubscribeOptions<${scopedEventType}>, fromCount?: number): EventSubscription { return subscribeContractEvent(${contractName}.contract, this, options, "${event.name}", fromCount) } + subscribe${eventType}WS(options: WsSubscribeOptions<${scopedEventType}>): Promise { + return subscribeContractEventWS(${contractName}.contract, this, options, "${event.name}") + } ` } @@ -285,6 +288,9 @@ function genSubscribeAllEvents(contract: Contract): string { subscribeAllEvents(options: EventSubscribeOptions<${eventTypes}>, fromCount?: number): EventSubscription { return subscribeContractEvents(${contract.name}.contract, this, options, fromCount) } + subscribeAllEventsWS(options: WsSubscribeOptions<${eventTypes}>): Promise { + return subscribeContractEventsWS(${contract.name}.contract, this, options) + } ` } @@ -520,6 +526,11 @@ function genContract(contract: Contract, artifactRelativePath: string): string { TestContractParamsWithoutMaps, TestContractResultWithoutMaps, SignExecuteContractMethodParams, SignExecuteScriptTxResult, signExecuteMethod, addStdIdToFields, encodeContractFields, Narrow } from '@alephium/web3' + ${ + contract.eventsSig.length > 0 + ? `import { WsSubscribeOptions, WsSubscription, subscribeContractEventWS, subscribeContractEventsWS } from '@alephium/web3'` + : '' + } import { default as ${contract.name}ContractJson } from '../${toUnixPath(artifactRelativePath)}' import { getContractByCodeHash, registerContract } from './contracts' ${importStructs()} diff --git a/packages/web3/package.json b/packages/web3/package.json index b46661af5..25edfe9ae 100644 --- a/packages/web3/package.json +++ b/packages/web3/package.json @@ -56,7 +56,8 @@ "elliptic": "6.6.1", "eventemitter3": "^4.0.7", "path-browserify": "^1.0.1", - "stream-browserify": "^3.0.0" + "stream-browserify": "^3.0.0", + "isows": "^1.0.6" }, "devDependencies": { "@babel/eslint-parser": "^7.21.3", diff --git a/packages/web3/src/contract/contract.ts b/packages/web3/src/contract/contract.ts index 0106db3d8..083e4eeee 100644 --- a/packages/web3/src/contract/contract.ts +++ b/packages/web3/src/contract/contract.ts @@ -97,6 +97,7 @@ import { } from '../codec' import { TraceableError } from '../error' import { SimulationResult } from '../api/api-alephium' +import { wsSubscribeEvent, WsSubscribeOptions, WsSubscription } from '../ws' const crypto = new WebCrypto() @@ -1338,6 +1339,22 @@ export function subscribeEventsFromContract>( + options: WsSubscribeOptions, + address: string, + eventIndex: number, + decodeFunc: (event: node.ContractEvent) => M +): Promise { + const messageCallback = (event: node.ContractEvent) => { + if (event.eventIndex !== eventIndex) { + return Promise.resolve() + } + return options.messageCallback(decodeFunc(event)) + } + + return wsSubscribeEvent({ ...options, messageCallback }, address, eventIndex) +} + export function addStdIdToFields( contract: Contract, fields: F @@ -1825,6 +1842,20 @@ export function subscribeContractCreatedEvent( ) } +export function subscribeContractCreatedEventWS( + options: WsSubscribeOptions, + fromGroup: number +): Promise { + checkGroupIndex(fromGroup) + const contractAddress = CreateContractEventAddresses[`${fromGroup}`] + return subscribeEventsFromContractWS(options, contractAddress, Contract.ContractCreatedEventIndex, (event) => { + return { + ...decodeContractCreatedEvent(event), + contractAddress: contractAddress + } + }) +} + export function subscribeContractDestroyedEvent( options: EventSubscribeOptions, fromGroup: number, @@ -1846,6 +1877,20 @@ export function subscribeContractDestroyedEvent( ) } +export function subscribeContractDestroyedEventWS( + options: WsSubscribeOptions, + fromGroup: number +): Promise { + checkGroupIndex(fromGroup) + const contractAddress = DestroyContractEventAddresses[`${fromGroup}`] + return subscribeEventsFromContractWS(options, contractAddress, Contract.ContractDestroyedEventIndex, (event) => { + return { + ...decodeContractDestroyedEvent(event), + contractAddress: contractAddress + } + }) +} + export function decodeEvent>( contract: Contract, instance: ContractInstance, @@ -1887,6 +1932,18 @@ export function subscribeContractEvent>( + contract: Contract, + instance: ContractInstance, + options: WsSubscribeOptions, + eventName: string +): Promise { + const eventIndex = contract.eventsSig.findIndex((sig) => sig.name === eventName) + return subscribeEventsFromContractWS(options, instance.address, eventIndex, (event) => + decodeEvent(contract, instance, event, eventIndex) + ) +} + export function subscribeContractEvents( contract: Contract, instance: ContractInstance, @@ -1911,6 +1968,22 @@ export function subscribeContractEvents( return subscribeToEvents(opt, instance.address, fromCount) } +export function subscribeContractEventsWS( + contract: Contract, + instance: ContractInstance, + options: WsSubscribeOptions> +): Promise { + const messageCallback = (event: node.ContractEvent) => { + if (event.eventIndex != Contract.DebugEventIndex) { + return options.messageCallback({ + ...decodeEvent(contract, instance, event, event.eventIndex), + contractAddress: instance.address + }) + } + } + return wsSubscribeEvent({ ...options, messageCallback }, instance.address) +} + export async function callMethod( contract: ContractFactory, instance: ContractInstance, diff --git a/packages/web3/src/index.ts b/packages/web3/src/index.ts index f1883aac3..240bc85cf 100644 --- a/packages/web3/src/index.ts +++ b/packages/web3/src/index.ts @@ -36,3 +36,4 @@ export * from './block' export * from './address' export * from './exchange' export * from './error' +export * from './ws' diff --git a/packages/web3/src/ws/index.ts b/packages/web3/src/ws/index.ts new file mode 100644 index 000000000..dbd2a171e --- /dev/null +++ b/packages/web3/src/ws/index.ts @@ -0,0 +1,19 @@ +/* +Copyright 2018 - 2022 The Alephium Authors +This file is part of the alephium project. + +The library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +The library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the library. If not, see . +*/ + +export * from './ws' diff --git a/packages/web3/src/ws/ws.ts b/packages/web3/src/ws/ws.ts new file mode 100644 index 000000000..13760540c --- /dev/null +++ b/packages/web3/src/ws/ws.ts @@ -0,0 +1,178 @@ +/* +Copyright 2018 - 2022 The Alephium Authors +This file is part of the alephium project. + +The library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +The library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the library. If not, see . +*/ + +import { node } from '../api' +import { WebSocket } from 'isows' + +let _ws: WS | undefined = undefined + +export async function getWS(nodeUrl: string): Promise { + if (_ws !== undefined) return _ws + const url = nodeUrl.endsWith('/ws') ? nodeUrl : `${nodeUrl}/ws` + _ws = await WS.from(url) + return _ws +} + +export interface WsSubscribeOptions { + nodeUrl: string + messageCallback: (message: T) => Promise | void + errorCallback: (error: any) => void +} + +export interface WsSubscription { + id: string + unsubscribe: () => Promise +} + +export async function wsSubscribeEvent( + options: WsSubscribeOptions, + contractAddress: string, + eventIndex?: number +) { + const ws = await getWS(options.nodeUrl) + return ws.subscribeEvent(options, contractAddress, eventIndex) +} + +export class WS { + private subscriptions: Map> + private requests: Map void> + private currentId: number + + private nextId(): number { + this.currentId += 1 + return this.currentId + } + + private constructor(private readonly socket: WebSocket) { + this.subscriptions = new Map() + this.requests = new Map() + this.currentId = 0 + } + + static async from(nodeUrl: string): Promise { + const socket = new WebSocket(nodeUrl) + const ws = new WS(socket) + + const onError = (error: any) => { + ws.subscriptions.forEach((options) => options.errorCallback(error)) + ws.subscriptions.clear() + ws.requests.clear() + socket.close() + } + + const onMessage = ({ data }: MessageEvent) => { + try { + const response = JSON.parse(data) + if (response?.method === 'subscription') { + const options = ws.subscriptions.get(response?.params?.subscription) + if (options !== undefined && response?.params?.result) { + options.messageCallback(response.params.result) + } + return + } + + const request = ws.requests.get(response?.id) + if (request !== undefined) { + ws.requests.delete(response?.id) + request(response?.result) + } + return + } catch (error) { + onError(error) + } + } + + socket.addEventListener('message', onMessage) + socket.addEventListener('error', onError) + + if (socket.readyState === WebSocket.CONNECTING) { + await new Promise((resolve, reject) => { + if (!socket) return + socket.onopen = resolve + socket.onerror = reject + }) + } + return ws + } + + async subscribeEvent( + options: WsSubscribeOptions, + contractAddress: string, + eventIndex?: number + ): Promise { + const request = buildSubscribeRequest(contractAddress, eventIndex, this.nextId()) + const { promise, resolve, reject } = createDeferred() + this.requests.set(request.id, (subscriptionId) => { + this.subscriptions.set(subscriptionId, options) + const subscription: WsSubscription = { + id: subscriptionId, + unsubscribe: () => this.unsubscribe(subscriptionId) + } + resolve(subscription) + }) + try { + this.socket.send(JSON.stringify(request)) + } catch (error) { + reject(error) + } + return await promise + } + + async unsubscribe(subscriptionId: string): Promise { + const request = buildUnsubscribeRequest(subscriptionId, this.nextId()) + const { promise, resolve, reject } = createDeferred() + this.requests.set(request.id, () => { + this.subscriptions.delete(subscriptionId) + resolve() + }) + try { + this.socket.send(JSON.stringify(request)) + } catch (error) { + reject(error) + } + return await promise + } +} + +type Deferred = { + promise: Promise + resolve: (value: T | PromiseLike) => void + reject: (reason?: any) => void +} + +function createDeferred(): Deferred { + let resolve!: (value: T | PromiseLike) => void + let reject!: (reason?: any) => void + + const promise = new Promise((res, rej) => { + resolve = res + reject = rej + }) + + return { promise, resolve, reject } +} + +function buildSubscribeRequest(contractAddress: string, eventIndex: number | undefined, id: number) { + const args = + eventIndex === undefined ? { addresses: [contractAddress] } : { addresses: [contractAddress], eventIndex } + return { jsonrpc: '2.0', method: 'subscribe', params: ['contract', args], id } +} + +function buildUnsubscribeRequest(subscriptionId: string, id: number) { + return { jsonrpc: '2.0', method: 'unsubscribe', params: [subscriptionId], id } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a840b0221..89fb4c134 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -359,6 +359,9 @@ importers: eventemitter3: specifier: ^4.0.7 version: 4.0.7 + isows: + specifier: ^1.0.6 + version: 1.0.6(ws@7.5.10) path-browserify: specifier: ^1.0.1 version: 1.0.1 @@ -398,7 +401,7 @@ importers: version: 5.59.0(eslint@8.38.0)(typescript@4.9.5) clean-webpack-plugin: specifier: 4.0.0 - version: 4.0.0(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)) + version: 4.0.0(webpack@5.94.0) eslint: specifier: ^8.37.0 version: 8.38.0 @@ -416,7 +419,7 @@ importers: version: 1.6.0 html-webpack-plugin: specifier: 5.5.0 - version: 5.5.0(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)) + version: 5.5.0(webpack@5.94.0) jest: specifier: ^28.1.3 version: 28.1.3(@types/node@16.18.24)(ts-node@10.9.1(@swc/core@1.4.1)(@types/node@16.18.24)(typescript@4.9.5)) @@ -449,7 +452,7 @@ importers: version: 12.0.3 terser-webpack-plugin: specifier: ^5.3.7 - version: 5.3.7(@swc/core@1.4.1)(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)) + version: 5.3.7(@swc/core@1.4.1)(webpack@5.94.0) ts-jest: specifier: ^28.0.8 version: 28.0.8(@babel/core@7.21.4)(@jest/types@28.1.3)(babel-jest@28.1.3(@babel/core@7.21.4))(jest@28.1.3(@types/node@16.18.24)(ts-node@10.9.1(@swc/core@1.4.1)(@types/node@16.18.24)(typescript@4.9.5)))(typescript@4.9.5) @@ -4098,6 +4101,11 @@ packages: resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} engines: {node: '>=0.10.0'} + isows@1.0.6: + resolution: {integrity: sha512-lPHCayd40oW98/I0uvgaHKWCSvkzY27LjWLbtzOm64yQ+G3Q5npjjbdppU65iZXkK1Zt+kH9pfegli0AYfwYYw==} + peerDependencies: + ws: ^7.5.10 + istanbul-lib-coverage@3.2.0: resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} engines: {node: '>=8'} @@ -8679,17 +8687,17 @@ snapshots: '@webassemblyjs/ast': 1.12.1 '@xtuc/long': 4.2.2 - '@webpack-cli/configtest@1.2.0(webpack-cli@4.10.0(webpack@5.94.0))(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0))': + '@webpack-cli/configtest@1.2.0(webpack-cli@4.10.0)(webpack@5.94.0)': dependencies: webpack: 5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0) webpack-cli: 4.10.0(webpack@5.94.0) - '@webpack-cli/info@1.5.0(webpack-cli@4.10.0(webpack@5.94.0))': + '@webpack-cli/info@1.5.0(webpack-cli@4.10.0)': dependencies: envinfo: 7.8.1 webpack-cli: 4.10.0(webpack@5.94.0) - '@webpack-cli/serve@1.7.0(webpack-cli@4.10.0(webpack@5.94.0))': + '@webpack-cli/serve@1.7.0(webpack-cli@4.10.0)': dependencies: webpack-cli: 4.10.0(webpack@5.94.0) @@ -9194,7 +9202,7 @@ snapshots: clean-stack@2.2.0: {} - clean-webpack-plugin@4.0.0(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)): + clean-webpack-plugin@4.0.0(webpack@5.94.0): dependencies: del: 4.1.1 webpack: 5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0) @@ -10430,7 +10438,7 @@ snapshots: relateurl: 0.2.7 terser: 5.17.1 - html-webpack-plugin@5.5.0(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)): + html-webpack-plugin@5.5.0(webpack@5.94.0): dependencies: '@types/html-minifier-terser': 6.1.0 html-minifier-terser: 6.1.0 @@ -10641,6 +10649,10 @@ snapshots: isobject@3.0.1: {} + isows@1.0.6(ws@7.5.10): + dependencies: + ws: 7.5.10 + istanbul-lib-coverage@3.2.0: {} istanbul-lib-instrument@5.2.1: @@ -12746,7 +12758,7 @@ snapshots: ansi-escapes: 4.3.2 supports-hyperlinks: 2.3.0 - terser-webpack-plugin@5.3.10(@swc/core@1.4.1)(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)): + terser-webpack-plugin@5.3.10(@swc/core@1.4.1)(webpack@5.94.0): dependencies: '@jridgewell/trace-mapping': 0.3.25 jest-worker: 27.5.1 @@ -12757,7 +12769,7 @@ snapshots: optionalDependencies: '@swc/core': 1.4.1 - terser-webpack-plugin@5.3.7(@swc/core@1.4.1)(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)): + terser-webpack-plugin@5.3.7(@swc/core@1.4.1)(webpack@5.94.0): dependencies: '@jridgewell/trace-mapping': 0.3.18 jest-worker: 27.5.1 @@ -13081,9 +13093,9 @@ snapshots: webpack-cli@4.10.0(webpack@5.94.0): dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 1.2.0(webpack-cli@4.10.0(webpack@5.94.0))(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)) - '@webpack-cli/info': 1.5.0(webpack-cli@4.10.0(webpack@5.94.0)) - '@webpack-cli/serve': 1.7.0(webpack-cli@4.10.0(webpack@5.94.0)) + '@webpack-cli/configtest': 1.2.0(webpack-cli@4.10.0)(webpack@5.94.0) + '@webpack-cli/info': 1.5.0(webpack-cli@4.10.0) + '@webpack-cli/serve': 1.7.0(webpack-cli@4.10.0) colorette: 2.0.20 commander: 7.2.0 cross-spawn: 7.0.3 @@ -13123,7 +13135,7 @@ snapshots: neo-async: 2.6.2 schema-utils: 3.3.0 tapable: 2.2.1 - terser-webpack-plugin: 5.3.10(@swc/core@1.4.1)(webpack@5.94.0(@swc/core@1.4.1)(webpack-cli@4.10.0)) + terser-webpack-plugin: 5.3.10(@swc/core@1.4.1)(webpack@5.94.0) watchpack: 2.4.2 webpack-sources: 3.2.3 optionalDependencies: diff --git a/test/ws.test.ts b/test/ws.test.ts new file mode 100644 index 000000000..bf0b7019d --- /dev/null +++ b/test/ws.test.ts @@ -0,0 +1,224 @@ +/* +Copyright 2018 - 2022 The Alephium Authors +This file is part of the alephium project. + +The library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +The library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with the library. If not, see . +*/ + +import { + Contract, + getContractEventsCurrentCount, + subscribeContractCreatedEventWS, + subscribeContractDestroyedEventWS, + TOTAL_NUMBER_OF_GROUPS +} from '../packages/web3' +import { WsSubscribeOptions, sleep } from '../packages/web3' +import { web3 } from '../packages/web3' +import { Sub } from '../artifacts/ts/Sub' +import { Add, AddTypes, AddInstance } from '../artifacts/ts/Add' +import { AddMain, DestroyAdd } from '../artifacts/ts/scripts' +import { CreateContractEventAddresses, DestroyContractEventAddresses } from '../packages/web3' +import { ContractCreatedEvent } from '../packages/web3' +import { ContractDestroyedEvent } from '../packages/web3' +import { PrivateKeyWallet } from '@alephium/web3-wallet' +import { getSigner } from '@alephium/web3-test' + +describe('events', function () { + const nodeUrl = 'http://127.0.0.1:22973' + let signer: PrivateKeyWallet + + beforeAll(async () => { + web3.setCurrentNodeProvider(nodeUrl, undefined, fetch) + signer = await getSigner() + }) + + async function deployContract(signer: PrivateKeyWallet): Promise { + const sub = await Sub.deploy(signer, { initialFields: { result: 0n } }) + return (await Add.deploy(signer, { initialFields: { sub: sub.contractInstance.contractId, result: 0n } })) + .contractInstance + } + + function createSubscribeOptions(events: Array): WsSubscribeOptions { + return { + nodeUrl, + messageCallback: (event: T) => { + events.push(event) + }, + errorCallback: (error: any) => { + console.log(error) + } + } + } + + it('should subscribe contract events', async () => { + const add = await deployContract(signer) + const addEvents: Array = [] + const subscribeOptions = createSubscribeOptions(addEvents) + const subscription = await add.subscribeAddEventWS(subscribeOptions) + for (let i = 0; i < 3; i++) { + await AddMain.execute({ signer, initialFields: { add: add.contractId, array: [2n, 1n] } }) + } + await sleep(3000) + + expect(addEvents.length).toEqual(3) + addEvents.forEach((event) => { + expect(event.fields.x).toEqual(2n) + expect(event.fields.y).toEqual(1n) + }) + const currentContractEventsCount = await add.getContractEventsCurrentCount() + expect(currentContractEventsCount).toEqual(addEvents.length) + await subscription.unsubscribe() + }, 15000) + + it('should subscribe all events', async () => { + const add = await deployContract(signer) + type EventTypes = AddTypes.AddEvent | AddTypes.Add1Event | AddTypes.EmptyEvent + const addEvents: Array = [] + const subscribeOptions = createSubscribeOptions(addEvents) + const subscription = await add.subscribeAllEventsWS(subscribeOptions) + for (let i = 0; i < 3; i++) { + await AddMain.execute({ signer, initialFields: { add: add.contractId, array: [2n, 1n] } }) + } + await sleep(3000) + + const isAdd = (event: EventTypes): event is AddTypes.AddEvent => { + return (event).fields.x !== undefined + } + + const isAdd1 = (event: EventTypes): event is AddTypes.Add1Event => { + return (event).fields.a !== undefined + } + + const isEmpty = (event: EventTypes): event is AddTypes.EmptyEvent => { + return Object.keys((event).fields).length === 0 + } + + expect(addEvents.length).toEqual(9) + addEvents.forEach((event) => { + if (isAdd(event)) { + expect(event.fields.x).toEqual(2n) + expect(event.fields.y).toEqual(1n) + expect(event.name).toEqual('Add') + expect(event.eventIndex).toEqual(0) + } else if (isAdd1(event)) { + expect(event.fields.a).toEqual(2n) + expect(event.fields.b).toEqual(1n) + expect(event.name).toEqual('Add1') + expect(event.eventIndex).toEqual(1) + } else if (isEmpty(event)) { + expect(event.fields).toEqual({}) + expect(event.name).toEqual('Empty') + expect(event.eventIndex).toEqual(2) + } else { + expect(false).toEqual(true) + } + }) + await subscription.unsubscribe() + }) + + it('should cancel event subscription', async () => { + const add = await deployContract(signer) + const addEvents: Array = [] + const subscribeOptions = createSubscribeOptions(addEvents) + const subscription = await add.subscribeAddEventWS(subscribeOptions) + const scriptTx0 = await AddMain.execute({ signer, initialFields: { add: add.contractId, array: [2n, 1n] } }) + await sleep(1500) + await subscription.unsubscribe() + + expect(addEvents.length).toEqual(1) + expect(addEvents[0].txId).toEqual(scriptTx0.txId) + expect(addEvents[0].fields.x).toEqual(2n) + expect(addEvents[0].fields.y).toEqual(1n) + + await AddMain.execute({ signer, initialFields: { add: add.contractId, array: [2n, 1n] } }) + await sleep(1500) + expect(addEvents.length).toEqual(1) + }) + + it('should subscribe contract created events', async () => { + const events: Array = [] + const subscribeOptions = createSubscribeOptions(events) + const groups = Array.from(Array(TOTAL_NUMBER_OF_GROUPS).keys()) + const contractEvents0 = await Promise.all( + groups.map((g) => { + const createContractEventAddress = CreateContractEventAddresses[`${g}`] + return getContractEventsCurrentCount(createContractEventAddress) + }) + ) + const subscription = await subscribeContractCreatedEventWS(subscribeOptions, signer.group) + const sub = await Sub.deploy(signer, { initialFields: { result: 0n } }) + await sleep(1500) + await subscription.unsubscribe() + + expect(events.length).toEqual(1) + expect(events[0].eventIndex).toEqual(Contract.ContractCreatedEventIndex) + expect(events[0].name).toEqual(Contract.ContractCreatedEvent.name) + expect(events[0].fields.address).toEqual(sub.contractInstance.address) + expect(events[0].fields.parentAddress).toEqual(undefined) + expect(events[0].fields.stdInterfaceIdGuessed).toEqual(undefined) + + const contractEvents1 = await Promise.all( + groups.map((g) => { + const createContractEventAddress = CreateContractEventAddresses[`${g}`] + return getContractEventsCurrentCount(createContractEventAddress) + }) + ) + contractEvents1.forEach((count, groupIndex) => { + if (groupIndex === signer.group) { + expect(count).toEqual(contractEvents0[`${groupIndex}`] + 1) + } else { + expect(count).toEqual(contractEvents0[`${groupIndex}`]) + } + }) + }) + + it('should subscribe contract destroyed events', async () => { + const add = await deployContract(signer) + const events: Array = [] + const subscribeOptions = createSubscribeOptions(events) + const groups = Array.from(Array(TOTAL_NUMBER_OF_GROUPS).keys()) + const contractEvents0 = await Promise.all( + groups.map((g) => { + const destroyContractEventAddress = DestroyContractEventAddresses[`${g}`] + return getContractEventsCurrentCount(destroyContractEventAddress) + }) + ) + const subscription = await subscribeContractDestroyedEventWS(subscribeOptions, signer.group) + + const caller = (await signer.getSelectedAccount()).address + await DestroyAdd.execute({ signer, initialFields: { add: add.contractId, caller } }) + + await sleep(1500) + subscription.unsubscribe() + + expect(events.length).toEqual(1) + expect(events[0].eventIndex).toEqual(Contract.ContractDestroyedEventIndex) + expect(events[0].name).toEqual(Contract.ContractDestroyedEvent.name) + expect(events[0].fields.address).toEqual(add.address) + + const contractEvents1 = await Promise.all( + groups.map((g) => { + const destroyContractEventAddress = DestroyContractEventAddresses[`${g}`] + return getContractEventsCurrentCount(destroyContractEventAddress) + }) + ) + contractEvents1.forEach((count, groupIndex) => { + if (groupIndex === signer.group) { + expect(count).toEqual(contractEvents0[`${groupIndex}`] + 1) + } else { + expect(count).toEqual(contractEvents0[`${groupIndex}`]) + } + }) + }) +})