From 1e111e232ec0d09bf56d9c5c67f03bcaec1d23d1 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Tue, 10 Sep 2024 13:54:33 +0300 Subject: [PATCH 01/11] Add locker execution summary test --- ...cker_claim_fungibles_and_non_fungibles.dat | 1 + ...cker_claim_fungibles_and_non_fungibles.rtm | 34 +++++++++ .../transaction_manifest_execution_summary.rs | 69 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.dat create mode 100644 crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.rtm diff --git a/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.dat b/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.dat new file mode 100644 index 000000000..67b8e9d32 --- /dev/null +++ b/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.dat @@ -0,0 +1 @@ +5c22000121062108a000743ba40b000000000000000000000000000000000000000900e1f5050900093d00a000743ba40b000000000000000000000000000000000000000980f0fa02a0aaaa829007e54be700000000000000000000000000000000a080cdc975bc56000000000000000000000000000000000000a080cdc975bc560000000000000000000000000000000000002102080000a0000000a1edccce1bc2d30000000000000000000000000000210709329f510009590d1600a000a8a8b41634b60300000000000000000000000000000000a000548f157fb8000100000000000000000000000000000000a0000000000000000000000000000000000000000000000000a00028cff1e677b00200000000000000000000000000000000a00000000000000000000000000000000000000000000000002201012102230c09290b4166746572496e766f6b651a0500000e416c6c6f636174654e6f64654964bf0b00000c4265666f7265496e766f6b658c0e00000d436c6f73655375627374617465fe0001000a4372656174654e6f64654c6a00000e447261696e537562737461746573547602000844726f704e6f6465ceb7000009456d69744576656e7490150000174d61726b537562737461746541735472616e7369656e7437000000214f70656e53756273746174653a3a476c6f62616c4163636f756e744c6f636b657298bd00002b4f70656e53756273746174653a3a476c6f62616c46756e6769626c655265736f757263654d616e616765727d8e02002e4f70656e53756273746174653a3a476c6f62616c4e6f6e46756e6769626c655265736f757263654d616e61676572431702001b4f70656e53756273746174653a3a476c6f62616c5061636b616765822f2600294f70656e53756273746174653a3a476c6f62616c5669727475616c456432353531394163636f756e7400fa0600234f70656e53756273746174653a3a496e7465726e616c46756e6769626c655661756c7495970200264f70656e53756273746174653a3a496e7465726e616c47656e65726963436f6d706f6e656e74c1ca0100234f70656e53756273746174653a3a496e7465726e616c4b657956616c756553746f72656f790200264f70656e53756273746174653a3a496e7465726e616c4e6f6e46756e6769626c655661756c74386e01000750696e4e6f6465680100000a51756572794163746f72941100000c5265616453756273746174651604040008526566436865636ba03801002a52756e4e6174697665436f64653a3a417574685a6f6e655f6173736572745f6163636573735f72756c65286700001b52756e4e6174697665436f64653a3a576f726b746f705f64726f70fe4500001a52756e4e6174697665436f64653a3a576f726b746f705f707574d2e200001b52756e4e6174697665436f64653a3a576f726b746f705f74616b655c8c00002352756e4e6174697665436f64653a3a636c61696d5f6163636f756e745f6c6f636b6572d02002003c52756e4e6174697665436f64653a3a6372656174655f656d7074795f7661756c745f4e6f6e46756e6769626c655265736f757263654d616e61676572072101001652756e4e6174697665436f64653a3a6465706f736974f61002002852756e4e6174697665436f64653a3a6765745f616d6f756e745f46756e6769626c654275636b657420ac00002b52756e4e6174697665436f64653a3a6765745f616d6f756e745f4e6f6e46756e6769626c654275636b65741a6a00003b52756e4e6174697665436f64653a3a6765745f6e6f6e5f66756e6769626c655f6c6f63616c5f6964735f4e6f6e46756e6769626c654275636b65744e5d00001d52756e4e6174697665436f64653a3a6765745f6f776e65725f726f6c6570a000002052756e4e6174697665436f64653a3a7075745f46756e6769626c655661756c74ea5f00002352756e4e6174697665436f64653a3a7075745f4e6f6e46756e6769626c655661756c741a8a00002152756e4e6174697665436f64653a3a74616b655f46756e6769626c655661756c74d9a500002452756e4e6174697665436f64653a3a74616b655f4e6f6e46756e6769626c655661756c74e1fc00000b53657453756273746174655c0200001156616c696461746554785061796c6f6164d05700001256657269667954785369676e617475726573000000000d577269746553756273746174650e400000230c09050c436f6d6d69744576656e747345b000000a436f6d6d69744c6f6773000000002f436f6d6d69745374617465557064617465733a3a476c6f62616c5669727475616c456432353531394163636f756e74ab86010029436f6d6d69745374617465557064617465733a3a496e7465726e616c46756e6769626c655661756c74520d03002c436f6d6d69745374617465557064617465733a3a496e7465726e616c4e6f6e46756e6769626c655661756c7417c910002200012109210123202212071e860c6318c6318c6c4e1b40cc6318c6318cf7bca52eb54a6a86318c6318c60001230722014000012322220100010702000120077c5c220001210222000121022307a0030020a40eb90df68003000000000000000000000000000000000440acc9cf530213020000000000000000000000000000000002e05931d070a2c40a000000000000000000000000000000009058619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed7220000071e82cc6318c6318c659963ed8c6318c6318cf7e8f5ae8f4a96a6318c6318c6000123072202400001232222010001070000012007265c220001210222000121050a098400000000000007d4074107ff0a6400000000000000220000d400012322220101012007245c200720aec61927284a8afca56f1b65c0bb28bf8405f49c0bd1b28512ac6dfb1b40041d00012007125c2200012102220101220001220000220000071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57820001230722020000012322220040000123222200071e9a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e430001230722020000012322220006000123222200071e0d906318c6318c659a6130cc6318c6318cf7a8ba5295eabf46318c6318c6000123072206440001232222004200012322220041000123222200010001232222004500012322220046000123222200071e0d906318c6318c6fe2d9198c6318c6318cf7bd4f3bf55557c6318c6318c600012307220744000123222200000001232222004200012322220041000123222200010001232222004500012322220046000123222200071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd0001230722040000012322220005000123222200060001232222004100012322220101012007205c809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e43000120072e5c22000121022201012200019098f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb65220000071e0d906318c6318c6e8f9fcc0c6318c6318cf7aa2fad74a29e26318c6318c60001230722054200012322220041000123222200010001232222004500012322220046000123222200071e9a4c6318c6318c6cb554820c6318c6318cf7a951d7a9e547c6318c6318c600012307220100000123222200071e0d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c600012307220741000123222200440001232222000000012322220042000123222200010001232222004500012322220046000123222200071eb0339b9b6ca003943c0e30e2d2174095f5194528310be73f1bf11fba1c38000123072203000001232222000100012322220040000123222200071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc00012307220300000123222200400001232222010001070000012007255c2200012102220001a000000000000000000000000000000000000000000000000022000041000123222204010120070b5cc00100000000000000030100010120070b5cc00100000000000000050100010120070b5cc00100000000000000040100010120070b5cc00100000000000000060100071e0d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c60001230722084400012322220000000123222200430001232222004200012322220041000123222200010001232222004500012322220046000123222200071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb65000123072204000001232222010001070000012007775c220001210221052102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c104e6f6e46756e6769626c655661756c742103090100000009000000000900000000220001809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e43200c0020220022010001000123222200400001232222010001070000012007255c2200012102220001a00000909dceda82370000000000000000000000000000000022000041000123222204010120070b5cc001000000000000000300012007095c2200012200012100010120070b5cc001000000000000000500012007095c2200012200012100010120070b5cc001000000000000000400012007095c2200012200012100010120070b5cc001000000000000000600012007095c2200012200012100071e5da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6000123072203000001232222000600012322220040000123222200071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef0450600012307220200000123222200400001232222010001070000012007255c2200012102220001a0000000000000000000000000000000000000000000000000220000071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d21800012307220200000123222200400001232222010001070000012007255c2200012102220001a000062f8c86c543ab1f020000000000000000000000000000220000071e58619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed7000123072201400001232222010001070000012007255c2200012102220001a0bae98f5aa535b12000000000000000000000000000000000220000210520800020800020800020800198f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb6523202105071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc02809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4322010220c00020c004010000000000000003010000000000000004010000000000000005010000000000000006071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb6502809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4322010220c00401000000000000000301000000000000000401000000000000000501000000000000000620c000071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef0450602805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6220001a000004862f296aa5ffeffffffffffffffffffffffffffffff071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d21802805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6220001a00000b89d0d6955a001000000000000000000000000000000071e58619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed702805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6220001a00092035e3eb2b3030000000000000000000000000000000021012320a0002104a000c9012f1fd9d90100000000000000000000000000000000a000c9012f1fd9d90100000000000000000000000000000000a00092035e3eb2b303000000000000000000000000000000002322a00022000120220600012007205c90f89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf010000012007035c210000012007205c90f805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc010000012007035c210020210b02210222010220071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc2200000c0d57697468647261774576656e7420072a5c210120c00401000000000000000301000000000000000501000000000000000401000000000000000602210222010220071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57822200000c0a436c61696d4576656e7420076b5c21038051bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4322010120c00401000000000000000301000000000000000501000000000000000401000000000000000602210222010220071e9a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e432200000c125661756c744372656174696f6e4576656e742007245c210120071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb6502210222010220071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb652200000c0c4465706f7369744576656e7420072a5c210120c00401000000000000000301000000000000000501000000000000000401000000000000000602210222010220071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd2200000c0c4465706f7369744576656e7420074a5c220102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c00401000000000000000301000000000000000501000000000000000401000000000000000602210222010220071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef045062200000c0d57697468647261774576656e7420071c5c2101a00000b89d0d6955a00100000000000000000000000000000002210222010220071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57822200000c0a436c61696d4576656e7420075d5c21038051bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6220001a00000b89d0d6955a00100000000000000000000000000000002210222010220071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d2182200000c0c4465706f7369744576656e7420071c5c2101a00000b89d0d6955a00100000000000000000000000000000002210222010220071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd2200000c0c4465706f7369744576656e7420073c5c220002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a00100000000000000000000000000000002210222010220071e58619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed72200000c0c4465706f7369744576656e7420071c5c2101a00092035e3eb2b3030000000000000000000000000000000002210222010220071e5da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c62200000c194275726e46756e6769626c655265736f757263654576656e7420071c5c2101a00092035e3eb2b30300000000000000000000000000000000202100210223202308071e860c6318c6318c6c4e1b40cc6318c6318cf7bca52eb54a6a86318c6318c607230140222201000107020301210122000121012103800d906318c6318c6c4e1b40cc6318c6318cf7bfd5d45f48c686318c6318c6200720d8510877df1d820f4752b3c033baf656f62e0e612731718865d048b9d16300b32201010a0900000000000000071e82cc6318c6318c659963ed8c6318c6318cf7e8f5ae8f4a96a6318c6318c607230240222201000107000301210122000121012103800d906318c6318c659963ed8c6318c6318cf7be85a17d48bca6318c6318c6200720bd71c021e525c608eaf7291c8c0eb2519993241a8e8d6d58c62e3ae0565355922201010a0300000000000000d422220101012007245c200720aec61927284a8afca56f1b65c0bb28bf8405f49c0bd1b28512ac6dfb1b40041d0401210222000121012103800d906318c6318c659963ed8c6318c6318cf7be85a17d48bca6318c6318c6200720bd71c021e525c608eaf7291c8c0eb2519993241a8e8d6d58c62e3ae0565355922201010a000000000000000022000121012103800d906318c6318c659963ed8c6318c6318cf7be85a17d48bca6318c6318c6200720bd71c021e525c608eaf7291c8c0eb2519993241a8e8d6d58c62e3ae0565355922201010a0100000000000000071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd0723014122220101012007205c809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e430401210222000121012103800d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c6200720a54510264dbd13e03ea7d6e3112d5f3a88c9bddae66b9569d5de381ba9447a8a220001078522000121012103800d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c6200720a54510264dbd13e03ea7d6e3112d5f3a88c9bddae66b9569d5de381ba9447a8a2201010a0300000000000000071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc07230240222201000107000301210122000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a000000000000000041222204010120070b5cc00100000000000000030501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000050501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000040501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000060501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb6507230300222201000107000001210122000040222201000107000301210122000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a000000000000000041222204010120070b5cc00100000000000000030501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000050501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000040501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000010120070b5cc00100000000000000060501210222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b22000107c222000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a0700000000000000071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef0450607230140222201000107000301210122000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a0000000000000000071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d21807230140222201000107000301210122000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a0000000000000000071e58619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed707230140222201000107000301210122000121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a0000000000000000232121090222010220071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc2200000c0d57697468647261774576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a1c000000000000000222010220071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57822200000c0a436c61696d4576656e740121012103800d906318c6318c6fe2d9198c6318c6318cf7bd4f3bf55557c6318c6318c6200720caf5a7b927b93cca065e8e834bcb66bb408ce4f03a54198af766e66e404142e82201010a15000000000000000222010220071e9a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e432200000c125661756c744372656174696f6e4576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c620072013bcc1e1d055e469936948b51d3621e05f8130901231a0847b8ff16eee0587592201010a73000000000000000222010220071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb652200000c0c4465706f7369744576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720aa18e25a2222655fec8fdce11d9951f8258ce83b17e18cdfe52debea86b8419b2201010a1d000000000000000222010220071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd2200000c0c4465706f7369744576656e740121012103800d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c6200720a54510264dbd13e03ea7d6e3112d5f3a88c9bddae66b9569d5de381ba9447a8a2201010a28000000000000000222010220071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef045062200000c0d57697468647261774576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a18000000000000000222010220071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d2182200000c0c4465706f7369744576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a19000000000000000222010220071e58619833de031de3aad69cad02a22656e083e307fb617b28e1b275bd7ed72200000c0c4465706f7369744576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720462a3fea283117aab2b01c297812bdc0fa9060b29eb5e68b847f361bc12019332201010a19000000000000000222010220071e5da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c62200000c194275726e46756e6769626c655265736f757263654576656e740121012103800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c6200720ba27cc155884d6e1aa7a41346fd8c11f18cc99775653caef1fd3455d625fd1472201010a3a0000000000000022010121032021010822000121022102800d906318c6318c659a6130cc6318c6318cf7a8ba5295eabf46318c6318c60c145472616e73616374696f6e50726f636573736f720c0372756e0a00000000000000002201000a01000000000000000a000000000000000021022320220023202200210223202200232022002021080822010121022102800d906318c6318c6fe2d9198c6318c6318cf7bd4f3bf55557c6318c6318c60c0d4163636f756e744c6f636b65720c05636c61696d0a010000000000000022000120071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57820a02000000000000000a000000000000000021022320220023202200210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c004010000000000000003010000000000000005010000000000000004010000000000000006232022002021010822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c104e6f6e46756e6769626c655661756c740c0474616b650a020000000000000022000120071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc0a03000000000000000a000000000000000021022320220023202200210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c00401000000000000000301000000000000000501000000000000000401000000000000000623202200202101082202000a030000000000000022000120071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc0a03000000000000000a000000000000000021022320220023202200210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c004010000000000000003010000000000000005010000000000000004010000000000000006232022002021000822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c07576f726b746f700c0b576f726b746f705f7075740a010000000000000022000120071ef83cc4e63f992a3f7a3284c0f40ce3e15a0b726f83aa8af713bb13b4757b0a02000000000000000a0000000000000000210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c00401000000000000000301000000000000000501000000000000000401000000000000000623202200210223202200232022002021000822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c07576f726b746f700c0c576f726b746f705f74616b650a010000000000000022000120071ef83cc4e63f992a3f7a3284c0f40ce3e15a0b726f83aa8af713bb13b4757b0a02000000000000000a010000000000000021022320220023202200210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c004010000000000000003010000000000000005010000000000000004010000000000000006232022002021000822010121022102800d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c60c074163636f756e740c076465706f7369740a010000000000000022000120071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd0a02000000000000000a0200000000000000210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c00401000000000000000301000000000000000501000000000000000401000000000000000623202200210223202200232022002021010822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c104e6f6e46756e6769626c655661756c740c037075740a020000000000000022000120071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb650a03000000000000000a0200000000000000210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c0040100000000000000030100000000000000050100000000000000040100000000000000062320220021022320220023202200202101082203000a030000000000000022000120071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb650a03000000000000000a0200000000000000210223202201071ef89cebb4b61888dba8e46210352c1cf21e181f9d970c1c743baf348badcf0102809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e4320c00401000000000000000301000000000000000501000000000000000401000000000000000623202200210223202200232022002021000822010121022102800d906318c6318c6fe2d9198c6318c6318cf7bd4f3bf55557c6318c6318c60c0d4163636f756e744c6f636b65720c05636c61696d0a010000000000000022000120071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f57820a02000000000000000a030000000000000021022320220023202200210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a001000000000000000000000000000000232022002021010822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c0d46756e6769626c655661756c740c0474616b650a020000000000000022000120071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef045060a03000000000000000a030000000000000021022320220023202200210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a00100000000000000000000000000000023202200202101082202000a030000000000000022000120071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef045060a03000000000000000a030000000000000021022320220023202200210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a001000000000000000000000000000000232022002021000822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c07576f726b746f700c0b576f726b746f705f7075740a010000000000000022000120071ef83cc4e63f992a3f7a3284c0f40ce3e15a0b726f83aa8af713bb13b4757b0a02000000000000000a0300000000000000210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a00100000000000000000000000000000023202200210223202200232022002021000822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c07576f726b746f700c0c576f726b746f705f74616b650a010000000000000022000120071ef83cc4e63f992a3f7a3284c0f40ce3e15a0b726f83aa8af713bb13b4757b0a02000000000000000a040000000000000021022320220023202200210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a001000000000000000000000000000000232022002021000822010121022102800d906318c6318c6ee313598c6318c6318cf7bcaa2e954a9626318c6318c60c074163636f756e740c076465706f7369740a010000000000000022000120071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd0a02000000000000000a0500000000000000210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a00100000000000000000000000000000023202200210223202200232022002021010822010121022102800d906318c6318c61e603c64c6318c6318cf7be913d63aafbc6318c6318c60c0d46756e6769626c655661756c740c037075740a020000000000000022000120071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d2180a03000000000000000a0500000000000000210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a0010000000000000000000000000000002320220021022320220023202200202101082203000a030000000000000022000120071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d2180a03000000000000000a0500000000000000210223202201071ef805ad7c3821d6b161b944fee85e8c67bbde951c10ff1ca986fea9db50dc0002805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a0010000000000000000000000000000002320220021022320220023202200202100230a2004000000000000000021010420071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f578220071e98d992190238b3ad13853382769e750f986b5dfd013ac031060e9ce8e8fc809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e43a00000706231257dc8ffffffffffffffffffffffffffffffff020000000000000021010420071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd20071e98f5a456c0a5ff88ab24c3040c13b770bbb89af8edc055aa48cba098eb65809a7e61f9ac0a8b735e520d23058e0d43156615a6f9b448515fea46827e43a00000909dceda823700000000000000000000000000000000030000000000000021010420071e68d01abdc1e531278bad2560f0e71a1fda7df1197c946314dc73b15f578220071e58ed949d03be36c72f3214fef07d201922304f593f4550c3561f5ef04506805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a000004862f296aa5ffeffffffffffffffffffffffffffffff050000000000000021010420071e51bfcd18a58406e1c0f89f536e9ebed7070324896e636492de6d605c52cd20071e58f7de931588523cc2caa77fc949c9ee07d21be4119a2367a272a4b2d218805da66318c6318c61f5a61b4c6318c6318cf794aa8d295f14e6318c6318c6a00000b89d0d6955a0010000000000000000000000000000002102a0000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000220000 \ No newline at end of file diff --git a/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.rtm b/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.rtm new file mode 100644 index 000000000..92c194e4e --- /dev/null +++ b/crates/sargon/fixtures/transaction/account_locker_claim_fungibles_and_non_fungibles.rtm @@ -0,0 +1,34 @@ +CALL_METHOD + Address("locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a") + "claim" + Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x") + Address("resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27") + Decimal("4") +; +TAKE_FROM_WORKTOP + Address("resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27") + Decimal("4") + Bucket("bucket1") +; +CALL_METHOD + Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x") + "deposit" + Bucket("bucket1") +; +CALL_METHOD + Address("locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a") + "claim" + Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x") + Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc") + Decimal("30") +; +TAKE_FROM_WORKTOP + Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc") + Decimal("30") + Bucket("bucket2") +; +CALL_METHOD + Address("account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x") + "deposit" + Bucket("bucket2") +; \ No newline at end of file diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs index 6d845aed4..d2e00617d 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs @@ -1089,4 +1089,73 @@ mod tests { ) ); } + + #[test] + fn account_locker_claim_fungibles_and_non_fungibles() { + let encoded_receipt_hex = include_str!(concat!( + env!("FIXTURES_TX"), + "account_locker_claim_fungibles_and_non_fungibles.dat" + )); + let instructions_string = include_str!(concat!( + env!("FIXTURES_TX"), + "account_locker_claim_fungibles_and_non_fungibles.rtm" + )); + + let transaction_manifest = TransactionManifest::new( + instructions_string, + NetworkID::Stokenet, + Blobs::default(), + ) + .unwrap(); + + let sut = transaction_manifest + .execution_summary( + BagOfBytes::from_hex(encoded_receipt_hex).unwrap(), + ) + .unwrap(); + + let acc: AccountAddress = "account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x".into(); + let fungible_address: ResourceAddress = "resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc".into(); + let non_fungible_address: ResourceAddress = "resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27".into(); + + // let test = "locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a".parse::().unwrap(); + + pretty_assertions::assert_eq!( + sut, + SUT::new( + [], + [( + acc, + vec![ + ResourceIndicator::non_fungible( + non_fungible_address, + NonFungibleResourceIndicator::by_amount(4, PredictedNonFungibleLocalIds::new( + [ + NonFungibleLocalId::integer(3), + NonFungibleLocalId::integer(5), + NonFungibleLocalId::integer(4), + NonFungibleLocalId::integer(6) + ], + 1 + )) + ), + ResourceIndicator::fungible( + fungible_address, + FungibleResourceIndicator::guaranteed(30) + ), + ] + )], + vec!["account_tdx_2_12xlu6x99ssrwrs8cnafka8476ursxfyfde3kfyk7d4s9c5kdvcs77x".into()], // addresses_of_accounts_requiring_auth + [], // addresses_of_identities_requiring_auth + [], // newly_created_non_fungibles + [], // reserved_instructions + [], // presented_proofs + [], // encountered_component_addresses + [DetailedManifestClass::General], + FeeLocks::default(), + FeeSummary::new("0.2674585", "0.07226045", "0.19378661776", 0,), + NewEntities::default() + ) + ); + } } From 5789df33a9b9be0b62ad7c801a38f829dd2e6d71 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 09:16:07 +0300 Subject: [PATCH 02/11] Add locker address to manifest encountered entities --- crates/sargon/src/core/error/common_error.rs | 6 ++ .../manifest_encountered_address.rs | 95 +++++++++++++++++++ .../high_level/sargon_specific_types/mod.rs | 2 + .../execution_summary/execution_summary.rs | 8 +- .../transaction_manifest_execution_summary.rs | 8 +- .../sargon/TransactionManifestTest.kt | 5 +- 6 files changed, 112 insertions(+), 12 deletions(-) create mode 100644 crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs diff --git a/crates/sargon/src/core/error/common_error.rs b/crates/sargon/src/core/error/common_error.rs index 27824ca0c..54bcc199d 100644 --- a/crates/sargon/src/core/error/common_error.rs +++ b/crates/sargon/src/core/error/common_error.rs @@ -638,6 +638,12 @@ pub enum CommonError { #[error("No Profile is yet loaded. Current state is: {current_state}")] ProfileStateNotLoaded { current_state: String } = 10180, + + #[error("Failed to create Address from global_address (hex): {global_address_as_hex}, network_id: {network_id}")] + FailedToCreateAddressFromGlobalAddressAndNetworkID { + global_address_as_hex: String, + network_id: NetworkID, + } = 10181, } #[uniffi::export] diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs new file mode 100644 index 000000000..9cae0c1a3 --- /dev/null +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs @@ -0,0 +1,95 @@ +use crate::prelude::*; + +address_union!( + /// A tagged union of all the encountered addresses in the manifest. + /// This is to be primarily used for the "using dApps" section of the wallet's tx review screen. + enum ManifestEncounteredAddress: component, locker +); + +macro_rules! impl_try_from_for_manifest_encountered_address { + ($($variant:ident => $address_type:ty),*) => { + impl TryFrom<(ScryptoGlobalAddress, NetworkID)> for ManifestEncounteredAddress { + type Error = CommonError; + + fn try_from(value: (ScryptoGlobalAddress, NetworkID)) -> Result { + let (global_address, network_id) = value; + + $( + if let Ok(address) = <$address_type>::try_from((global_address, network_id)) { + return Ok(ManifestEncounteredAddress::$variant(address)); + } + )* + + Err(CommonError::FailedToCreateAddressFromGlobalAddressAndNetworkID { + global_address_as_hex: global_address.to_hex(), + network_id, + }) + } + } + }; +} + +impl_try_from_for_manifest_encountered_address!( + Component => ComponentAddress, + Locker => LockerAddress +); + +#[cfg(test)] +mod tests { + use super::*; + + #[allow(clippy::upper_case_acronyms)] + type SUT = ManifestEncounteredAddress; + + #[test] + fn sample_values_count() { + let mut set = HashSet::::new(); + set.extend(SUT::sample_values_all()); + // Duplicates should be removed + set.extend(SUT::sample_values_all()); + + assert_eq!(set.len(), 8); + } + + #[test] + fn try_from_failure() { + let global_address = ScryptoGlobalAddress::new_or_panic( + ResourceAddress::sample_stokenet() + .scrypto() + .into_node_id() + .0, + ); + let network_id = NetworkID::Stokenet; + + let result = SUT::try_from((global_address, network_id)); + assert_eq!( + result.unwrap_err(), + CommonError::FailedToCreateAddressFromGlobalAddressAndNetworkID { + global_address_as_hex: global_address.to_hex(), + network_id, + } + ); + } + + macro_rules! generate_try_from_tests { + ($($variant:ident => $address_type:ty),*) => { + $( + #[test] + fn $variant() { + let global_address = ScryptoGlobalAddress::new_or_panic( + <$address_type>::sample_stokenet().scrypto().into_node_id().0 + ); + let network_id = NetworkID::Stokenet; + + let result = SUT::try_from((global_address, network_id)); + assert!(result.is_ok()); + } + )* + }; +} + + generate_try_from_tests!( + component => ComponentAddress, + locker => LockerAddress + ); +} diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs index 1feb8bac1..800b62400 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs @@ -5,6 +5,7 @@ mod account_locker; mod address_of_account_or_persona; mod assets_transfers; mod build_information; +mod manifest_encountered_address; mod stake_claim; mod stake_claim_uniffi_fn; mod transaction_guarantee; @@ -20,3 +21,4 @@ pub use stake_claim_uniffi_fn::*; pub use transaction_guarantee::*; pub use account_locker::*; +pub use manifest_encountered_address::*; diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs index 4b5f7d223..ba65c00cd 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs @@ -41,10 +41,10 @@ pub struct ExecutionSummary { /// The list of the resources of proofs that were presented in the manifest. pub presented_proofs: Vec, - /// The set of all the encountered `ComponentAddress`es` in the manifest. This is + /// The set of all the encountered `ManifestEncounteredAddress`es` in the manifest. This is /// to be primarily used for the "using dApps" section of the wallet's tx /// review screen. - pub encountered_component_addresses: Vec, + pub encountered_addresses: Vec, /// Information on how much fees were contingent and how much were not. pub fee_locks: FeeLocks, @@ -71,7 +71,7 @@ impl ExecutionSummary { newly_created_non_fungibles: impl IntoIterator, reserved_instructions: impl IntoIterator, presented_proofs: impl IntoIterator, - encountered_component_addresses: impl IntoIterator, + encountered_addresses: impl IntoIterator, detailed_classification: impl IntoIterator, fee_locks: impl Into, fee_summary: impl Into, @@ -95,7 +95,7 @@ impl ExecutionSummary { .into_iter() .collect_vec(), presented_proofs: presented_proofs.into_iter().collect_vec(), - encountered_component_addresses: encountered_component_addresses + encountered_addresses: encountered_addresses .into_iter() .collect_vec(), detailed_classification: detailed_classification diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs index d2e00617d..da6b05af3 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs @@ -474,7 +474,7 @@ mod tests { ["resource_tdx_2_1ng88qk08hrgmad30rzdxpyx779yuta4cwcjc3gstk60jhachsv94g9:".parse::().unwrap()], // newly_created_non_fungibles [], // reserved_instructions [], // presented_proofs - ["component_tdx_2_1czg6rq9vms7t402fedtpzkjah25hh7snyu3ysgxk3pwlz4d3tugm7j".parse::().unwrap()], // encountered_component_addresses + ["component_tdx_2_1czg6rq9vms7t402fedtpzkjah25hh7snyu3ysgxk3pwlz4d3tugm7j".parse::().unwrap()], // encountered_component_addresses [ DetailedManifestClass::General ], @@ -546,7 +546,7 @@ mod tests { [], // newly_created_non_fungibles [], // reserved_instructions [ResourceSpecifier::non_fungible("resource_tdx_2_1ng88qk08hrgmad30rzdxpyx779yuta4cwcjc3gstk60jhachsv94g9", vec!["".parse().unwrap()])], // presented_proofs - ["component_tdx_2_1crje3en7zsrna9t5vyywn3z3t9ht34l9udxjcpjvdhpcw9v6vlzru8".parse::().unwrap()], // encountered_component_addresses + ["component_tdx_2_1crje3en7zsrna9t5vyywn3z3t9ht34l9udxjcpjvdhpcw9v6vlzru8".parse::().unwrap()], // encountered_component_addresses [ DetailedManifestClass::General ], @@ -1118,8 +1118,6 @@ mod tests { let fungible_address: ResourceAddress = "resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc".into(); let non_fungible_address: ResourceAddress = "resource_tdx_2_1nflxr7dvp29hxhjjp53strsdgv2kv9dxlx6ys52lafrgyljrhwkt27".into(); - // let test = "locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a".parse::().unwrap(); - pretty_assertions::assert_eq!( sut, SUT::new( @@ -1150,7 +1148,7 @@ mod tests { [], // newly_created_non_fungibles [], // reserved_instructions [], // presented_proofs - [], // encountered_component_addresses + ["locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a".parse::().unwrap()], [DetailedManifestClass::General], FeeLocks::default(), FeeSummary::new("0.2674585", "0.07226045", "0.19378661776", 0,), diff --git a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/TransactionManifestTest.kt b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/TransactionManifestTest.kt index d49e30f55..36d8c0e14 100644 --- a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/TransactionManifestTest.kt +++ b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/TransactionManifestTest.kt @@ -615,7 +615,7 @@ class TransactionManifestTest : SampleTestable { ), AccountLockerClaimableResource.NonFungible( resourceAddress = ResourceAddress.init("resource_rdx1nfyg2f68jw7hfdlg5hzvd8ylsa7e0kjl68t5t62v3ttamtejc9wlxa"), - ids = listOf(NonFungibleLocalId.intId(1.toULong())) + numberOfItems = 10.toULong() ), AccountLockerClaimableResource.Fungible( resourceAddress = ResourceAddress.init("resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd"), @@ -623,7 +623,7 @@ class TransactionManifestTest : SampleTestable { ), AccountLockerClaimableResource.NonFungible( resourceAddress = ResourceAddress.init("resource_rdx1n2ekdd2m0jsxjt9wasmu3p49twy2yfalpaa6wf08md46sk8dfmldnd"), - ids = listOf(NonFungibleLocalId.stringId("foobar")) + numberOfItems = 1.toULong() ) ) ) @@ -632,7 +632,6 @@ class TransactionManifestTest : SampleTestable { with(actualManifest.instructionsString) { assertTrue(contains("claim")) - assertTrue(contains("claim_non_fungibles")) assertTrue(contains("account_rdx128y6j78mt0aqv6372evz28hrxp8mn06ccddkr7xppc88hyvynvjdwr")) } From 816bc9c797a044f5b63f4991452d1c91e96e7d54 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 09:22:16 +0300 Subject: [PATCH 03/11] Version bump --- Cargo.lock | 2 +- crates/sargon/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 59545954c..489c9a6a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2602,7 +2602,7 @@ dependencies = [ [[package]] name = "sargon" -version = "1.1.12" +version = "1.1.13" dependencies = [ "actix-rt", "aes-gcm", diff --git a/crates/sargon/Cargo.toml b/crates/sargon/Cargo.toml index f3d24f1a7..4b61ceac6 100644 --- a/crates/sargon/Cargo.toml +++ b/crates/sargon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sargon" -version = "1.1.12" +version = "1.1.13" edition = "2021" build = "build.rs" From 6e73c14197fb6a91db0b714f140c52257e2ddf72 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 10:55:12 +0300 Subject: [PATCH 04/11] Add kotlin and swift --- ...estEncounteredAddress+Wrap+Functions.swift | 34 +++++++++++++ ...ifestEncounteredAddress+SampleValues.swift | 12 +++++ ...anifestEncounteredAddress+Swiftified.swift | 10 ++++ .../extensions/ManifestEncounteredAddress.kt | 23 +++++++++ .../ManifestEncounteredAddressSample.kt | 29 +++++++++++ .../sargon/ManifestEncounteredAddressTest.kt | 49 +++++++++++++++++++ 6 files changed, 157 insertions(+) create mode 100644 apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift create mode 100644 apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift create mode 100644 apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift create mode 100644 jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt create mode 100644 jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt create mode 100644 jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt diff --git a/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift b/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift new file mode 100644 index 000000000..6a65ac3d2 --- /dev/null +++ b/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift @@ -0,0 +1,34 @@ +import SargonUniFFI + +extension ManifestEncounteredAddress { + public init(validatingAddress bech32String: String) throws { + self = try newManifestEncounteredAddressFromBech32(string: bech32String) + } + + /// The bech32 encoded string for this address. + public var address: String { + manifestEncounteredAddressToString(address: self) + } + + public var networkID: NetworkId { + manifestEncounteredAddressNetworkId(address: self) + } + + public func formatted(_ format: AddressFormat) -> String { + manifestEncounteredAddressFormatted(address: self, format: format) + } + + +} + +#if DEBUG +extension ManifestEncounteredAddress { + public static func random(networkID: NetworkID) -> Self { + .component(newComponentAddressRandom(networkId: networkID)) + } + + public func mapTo(networkID: NetworkID) -> Self { + manifestEncounteredAddressMapToNetwork(address: self, networkId: networkID) + } +} +#endif // DEBUG diff --git a/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift b/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift new file mode 100644 index 000000000..d72918b09 --- /dev/null +++ b/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift @@ -0,0 +1,12 @@ +import Foundation +import SargonUniFFI + +#if DEBUG +extension ManifestEncounteredAddress { + public static let sampleMainnet: Self = newManifestEncounteredAddressSampleMainnet() + public static let sampleMainnetOther: Self = newManifestEncounteredAddressSampleMainnetOther() + + public static let sampleStokenet: Self = newManifestEncounteredAddressSampleStokenet() + public static let sampleStokenetOther: Self = newManifestEncounteredAddressSampleStokenetOther() +} +#endif diff --git a/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift b/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift new file mode 100644 index 000000000..dd7d0692c --- /dev/null +++ b/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift @@ -0,0 +1,10 @@ +import SargonUniFFI + +extension ManifestEncounteredAddress: AddressProtocol { + public var asGeneral: Address { + switch self { + case let .component(componentAddress): Address.component(componentAddress) + case let .locker(lockerAddress): Address.locker(lockerAddress) + } + } +} diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt new file mode 100644 index 000000000..b57cef063 --- /dev/null +++ b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt @@ -0,0 +1,23 @@ +package com.radixdlt.sargon.extensions + +import com.radixdlt.sargon.AddressFormat +import com.radixdlt.sargon.ManifestEncounteredAddress +import com.radixdlt.sargon.NetworkId +import com.radixdlt.sargon.manifestEncounteredAddressFormatted +import com.radixdlt.sargon.manifestEncounteredAddressNetworkId +import com.radixdlt.sargon.manifestEncounteredAddressToString +import com.radixdlt.sargon.newManifestEncounteredAddressFromBech32 + +@Throws(SargonException::class) +fun ManifestEncounteredAddress.Companion.init(validating: String) = + newManifestEncounteredAddressFromBech32(string = validating) + +val ManifestEncounteredAddress.string: String + get() = manifestEncounteredAddressToString(address = this) + +val ManifestEncounteredAddress.networkId: NetworkId + get() = manifestEncounteredAddressNetworkId(address = this) + +fun ManifestEncounteredAddress.formatted( + format: AddressFormat = AddressFormat.DEFAULT +): String = manifestEncounteredAddressFormatted(address = this, format = format) \ No newline at end of file diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt new file mode 100644 index 000000000..66bb77739 --- /dev/null +++ b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt @@ -0,0 +1,29 @@ +package com.radixdlt.sargon.samples + +import com.radixdlt.sargon.annotation.UsesSampleValues +import com.radixdlt.sargon.AddressOfAccountOrPersona +import com.radixdlt.sargon.ManifestEncounteredAddress +import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleMainnet +import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleMainnetOther +import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleStokenet +import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleStokenetOther +import com.radixdlt.sargon.newManifestEncounteredAddressSampleMainnet +import com.radixdlt.sargon.newManifestEncounteredAddressSampleMainnetOther +import com.radixdlt.sargon.newManifestEncounteredAddressSampleStokenet +import com.radixdlt.sargon.newManifestEncounteredAddressSampleStokenetOther + +@UsesSampleValues +val ManifestEncounteredAddress.Companion.sampleMainnet: Sample + get() = object : Sample { + override fun invoke(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleMainnet() + + override fun other(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleMainnetOther() + } + +@UsesSampleValues +val ManifestEncounteredAddress.Companion.sampleStokenet: Sample + get() = object : Sample { + override fun invoke(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleStokenet() + + override fun other(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleStokenetOther() + } \ No newline at end of file diff --git a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt new file mode 100644 index 000000000..7f99cacfa --- /dev/null +++ b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt @@ -0,0 +1,49 @@ +package com.radixdlt.sargon + +import com.radixdlt.sargon.extensions.formatted +import com.radixdlt.sargon.extensions.init +import com.radixdlt.sargon.extensions.networkId +import com.radixdlt.sargon.extensions.string +import com.radixdlt.sargon.samples.Sample +import com.radixdlt.sargon.samples.sampleMainnet +import com.radixdlt.sargon.samples.sampleStokenet +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows + +class ManifestEncounteredAddressTest: SampleTestable { + + override val samples: List> + get() = listOf(ManifestEncounteredAddress.sampleMainnet, ManifestEncounteredAddress.sampleStokenet) + + @Test + fun testInit() { + val componentAddress = "component_rdx1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxfaucet" + + with(ManifestEncounteredAddress.init(validating = componentAddress)) { + assertEquals(componentAddress, string) + assertEquals(NetworkId.MAINNET, networkId) + } + + assertThrows { + ManifestEncounteredAddress.init(validating = PackageAddress.sampleMainnet().string) + } + } + + @Test + fun testFormat() { + val addressString = "locker_rdx1dqeryv3jxgeryv3jxgeryv3jxgeryv3jxgeryv3jxgeryv3jjs0l6p" + val address = ManifestEncounteredAddress.init(validating = addressString) + + assertEquals("lock...js0l6p", address.formatted()) + assertEquals( + addressString, + address.formatted(format = AddressFormat.FULL) + ) + assertEquals( + addressString, + address.formatted(format = AddressFormat.RAW) + ) + } + +} \ No newline at end of file From 591b4cfa7a98151d309810b20d5c9cb301c91466 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 11:10:22 +0300 Subject: [PATCH 05/11] Add swift tests --- .../Address/ManifestEncounteredAddressTests.swift | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift diff --git a/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift b/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift new file mode 100644 index 000000000..c3d7a802b --- /dev/null +++ b/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift @@ -0,0 +1,9 @@ +import CustomDump +import Foundation +import Sargon +import SargonUniFFI +import XCTest + +final class ManifestEncounteredAddressTests: AddressTest { + +} From 9e402dc83d2ee3c1a06db30b0414b2ea89c2e893 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 11:58:55 +0300 Subject: [PATCH 06/11] Potential fix for disk space issue in kotlin tests workflow --- .github/workflows/test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f58421057..8442962d4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,6 +139,15 @@ jobs: steps: - uses: RDXWorks-actions/checkout@main + - name: Remove old xcode versions + run: | + echo "Searching for Xcode versions:" + find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 + echo "Removing old Xcode versions..." + find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf + echo "Available Xcode versions after removal:" + find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 + - name: Install Rust Toolchain for aarch64-linux-android uses: RDXWorks-actions/toolchain@master with: From 41f6b7a432bd66bf1c21d4e2e42fdf1504457cb7 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 12:09:19 +0300 Subject: [PATCH 07/11] Update kotlin workflow --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8442962d4..0eb9bb2a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -141,10 +141,8 @@ jobs: - name: Remove old xcode versions run: | - echo "Searching for Xcode versions:" - find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 echo "Removing old Xcode versions..." - find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf + find /Applications/ -name "Xcode*" | sort -r | tail --lines=+2 | xargs rm -rf echo "Available Xcode versions after removal:" find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 From a22a112b28301107c4730926479f33b9ef51f69f Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 12:59:11 +0300 Subject: [PATCH 08/11] Update kotlin test workflow --- .github/workflows/test.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0eb9bb2a4..78867124e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,12 +139,23 @@ jobs: steps: - uses: RDXWorks-actions/checkout@main - - name: Remove old xcode versions + - name: Remove unused software run: | - echo "Removing old Xcode versions..." - find /Applications/ -name "Xcode*" | sort -r | tail --lines=+2 | xargs rm -rf - echo "Available Xcode versions after removal:" - find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 + sudo rm -rf \ + "$AGENT_TOOLSDIRECTORY" \ + /opt/google/chrome \ + /opt/microsoft/msedge \ + /opt/microsoft/powershell \ + /opt/pipx \ + /usr/lib/mono \ + /usr/local/julia* \ + /usr/local/lib/node_modules \ + /usr/local/share/chromium \ + /usr/local/share/powershell \ + /usr/share/dotnet \ + /usr/local/share/boost \ + /opt/ghc \ + df -h / - name: Install Rust Toolchain for aarch64-linux-android uses: RDXWorks-actions/toolchain@master From ce241d605bf5d9ea3262f6ccc7768612483864b9 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 13:19:01 +0300 Subject: [PATCH 09/11] Revert "Update kotlin test workflow" This reverts commit a22a112b28301107c4730926479f33b9ef51f69f. --- .github/workflows/test.yml | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 78867124e..0eb9bb2a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -139,23 +139,12 @@ jobs: steps: - uses: RDXWorks-actions/checkout@main - - name: Remove unused software + - name: Remove old xcode versions run: | - sudo rm -rf \ - "$AGENT_TOOLSDIRECTORY" \ - /opt/google/chrome \ - /opt/microsoft/msedge \ - /opt/microsoft/powershell \ - /opt/pipx \ - /usr/lib/mono \ - /usr/local/julia* \ - /usr/local/lib/node_modules \ - /usr/local/share/chromium \ - /usr/local/share/powershell \ - /usr/share/dotnet \ - /usr/local/share/boost \ - /opt/ghc \ - df -h / + echo "Removing old Xcode versions..." + find /Applications/ -name "Xcode*" | sort -r | tail --lines=+2 | xargs rm -rf + echo "Available Xcode versions after removal:" + find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 - name: Install Rust Toolchain for aarch64-linux-android uses: RDXWorks-actions/toolchain@master From e42b281af320945c640d2b30b5920961add1b57d Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 15:42:08 +0300 Subject: [PATCH 10/11] Name refactoring --- ...estEncounteredAddress+Wrap+Functions.swift | 14 ++++---- ...ifestEncounteredAddress+SampleValues.swift | 10 +++--- ...anifestEncounteredAddress+Swiftified.swift | 2 +- .../ManifestEncounteredAddressTests.swift | 2 +- ...manifest_encountered_component_address.rs} | 8 ++--- .../high_level/sargon_specific_types/mod.rs | 4 +-- .../execution_summary/execution_summary.rs | 8 +++-- .../transaction_manifest_execution_summary.rs | 6 ++-- .../extensions/ManifestEncounteredAddress.kt | 32 +++++++++++-------- .../ManifestEncounteredAddressSample.kt | 31 ++++++++---------- ...anifestEncounteredComponentAddressTest.kt} | 12 +++---- 11 files changed, 66 insertions(+), 63 deletions(-) rename crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/{manifest_encountered_address.rs => manifest_encountered_component_address.rs} (91%) rename jvm/sargon-android/src/test/java/com/radixdlt/sargon/{ManifestEncounteredAddressTest.kt => ManifestEncounteredComponentAddressTest.kt} (68%) diff --git a/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift b/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift index 6a65ac3d2..0eb51f42c 100644 --- a/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift +++ b/apple/Sources/Sargon/Extensions/Methods/Address/ManifestEncounteredAddress+Wrap+Functions.swift @@ -1,34 +1,34 @@ import SargonUniFFI -extension ManifestEncounteredAddress { +extension ManifestEncounteredComponentAddress { public init(validatingAddress bech32String: String) throws { - self = try newManifestEncounteredAddressFromBech32(string: bech32String) + self = try newManifestEncounteredComponentAddressFromBech32(string: bech32String) } /// The bech32 encoded string for this address. public var address: String { - manifestEncounteredAddressToString(address: self) + manifestEncounteredComponentAddressToString(address: self) } public var networkID: NetworkId { - manifestEncounteredAddressNetworkId(address: self) + manifestEncounteredComponentAddressNetworkId(address: self) } public func formatted(_ format: AddressFormat) -> String { - manifestEncounteredAddressFormatted(address: self, format: format) + manifestEncounteredComponentAddressFormatted(address: self, format: format) } } #if DEBUG -extension ManifestEncounteredAddress { +extension ManifestEncounteredComponentAddress { public static func random(networkID: NetworkID) -> Self { .component(newComponentAddressRandom(networkId: networkID)) } public func mapTo(networkID: NetworkID) -> Self { - manifestEncounteredAddressMapToNetwork(address: self, networkId: networkID) + manifestEncounteredComponentAddressMapToNetwork(address: self, networkId: networkID) } } #endif // DEBUG diff --git a/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift b/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift index d72918b09..df77fa15d 100644 --- a/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift +++ b/apple/Sources/Sargon/Extensions/SampleValues/Profile+Supporting+Types/ManifestEncounteredAddress+SampleValues.swift @@ -2,11 +2,11 @@ import Foundation import SargonUniFFI #if DEBUG -extension ManifestEncounteredAddress { - public static let sampleMainnet: Self = newManifestEncounteredAddressSampleMainnet() - public static let sampleMainnetOther: Self = newManifestEncounteredAddressSampleMainnetOther() +extension ManifestEncounteredComponentAddress { + public static let sampleMainnet: Self = newManifestEncounteredComponentAddressSampleMainnet() + public static let sampleMainnetOther: Self = newManifestEncounteredComponentAddressSampleMainnetOther() - public static let sampleStokenet: Self = newManifestEncounteredAddressSampleStokenet() - public static let sampleStokenetOther: Self = newManifestEncounteredAddressSampleStokenetOther() + public static let sampleStokenet: Self = newManifestEncounteredComponentAddressSampleStokenet() + public static let sampleStokenetOther: Self = newManifestEncounteredComponentAddressSampleStokenetOther() } #endif diff --git a/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift b/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift index dd7d0692c..fe8ab73e0 100644 --- a/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift +++ b/apple/Sources/Sargon/Extensions/Swiftified/Address/ManifestEncounteredAddress+Swiftified.swift @@ -1,6 +1,6 @@ import SargonUniFFI -extension ManifestEncounteredAddress: AddressProtocol { +extension ManifestEncounteredComponentAddress: AddressProtocol { public var asGeneral: Address { switch self { case let .component(componentAddress): Address.component(componentAddress) diff --git a/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift b/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift index c3d7a802b..860b63ec4 100644 --- a/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift +++ b/apple/Tests/TestCases/Address/ManifestEncounteredAddressTests.swift @@ -4,6 +4,6 @@ import Sargon import SargonUniFFI import XCTest -final class ManifestEncounteredAddressTests: AddressTest { +final class ManifestEncounteredComponentAddressTests: AddressTest { } diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_component_address.rs similarity index 91% rename from crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs rename to crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_component_address.rs index 9cae0c1a3..019393ea6 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_address.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/manifest_encountered_component_address.rs @@ -3,12 +3,12 @@ use crate::prelude::*; address_union!( /// A tagged union of all the encountered addresses in the manifest. /// This is to be primarily used for the "using dApps" section of the wallet's tx review screen. - enum ManifestEncounteredAddress: component, locker + enum ManifestEncounteredComponentAddress: component, locker ); macro_rules! impl_try_from_for_manifest_encountered_address { ($($variant:ident => $address_type:ty),*) => { - impl TryFrom<(ScryptoGlobalAddress, NetworkID)> for ManifestEncounteredAddress { + impl TryFrom<(ScryptoGlobalAddress, NetworkID)> for ManifestEncounteredComponentAddress { type Error = CommonError; fn try_from(value: (ScryptoGlobalAddress, NetworkID)) -> Result { @@ -16,7 +16,7 @@ macro_rules! impl_try_from_for_manifest_encountered_address { $( if let Ok(address) = <$address_type>::try_from((global_address, network_id)) { - return Ok(ManifestEncounteredAddress::$variant(address)); + return Ok(ManifestEncounteredComponentAddress::$variant(address)); } )* @@ -39,7 +39,7 @@ mod tests { use super::*; #[allow(clippy::upper_case_acronyms)] - type SUT = ManifestEncounteredAddress; + type SUT = ManifestEncounteredComponentAddress; #[test] fn sample_values_count() { diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs index 800b62400..65fb7fe9d 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/high_level/sargon_specific_types/mod.rs @@ -5,7 +5,7 @@ mod account_locker; mod address_of_account_or_persona; mod assets_transfers; mod build_information; -mod manifest_encountered_address; +mod manifest_encountered_component_address; mod stake_claim; mod stake_claim_uniffi_fn; mod transaction_guarantee; @@ -21,4 +21,4 @@ pub use stake_claim_uniffi_fn::*; pub use transaction_guarantee::*; pub use account_locker::*; -pub use manifest_encountered_address::*; +pub use manifest_encountered_component_address::*; diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs index ba65c00cd..83ce14c8e 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/execution_summary/execution_summary.rs @@ -41,10 +41,10 @@ pub struct ExecutionSummary { /// The list of the resources of proofs that were presented in the manifest. pub presented_proofs: Vec, - /// The set of all the encountered `ManifestEncounteredAddress`es` in the manifest. This is + /// The set of all the encountered `ManifestEncounteredComponentAddress`es` in the manifest. This is /// to be primarily used for the "using dApps" section of the wallet's tx /// review screen. - pub encountered_addresses: Vec, + pub encountered_addresses: Vec, /// Information on how much fees were contingent and how much were not. pub fee_locks: FeeLocks, @@ -71,7 +71,9 @@ impl ExecutionSummary { newly_created_non_fungibles: impl IntoIterator, reserved_instructions: impl IntoIterator, presented_proofs: impl IntoIterator, - encountered_addresses: impl IntoIterator, + encountered_addresses: impl IntoIterator< + Item = ManifestEncounteredComponentAddress, + >, detailed_classification: impl IntoIterator, fee_locks: impl Into, fee_summary: impl Into, diff --git a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs index da6b05af3..ad2ea82b9 100644 --- a/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs +++ b/crates/sargon/src/wrapped_radix_engine_toolkit/low_level/transaction_manifest/execution_summary/transaction_manifest_execution_summary.rs @@ -474,7 +474,7 @@ mod tests { ["resource_tdx_2_1ng88qk08hrgmad30rzdxpyx779yuta4cwcjc3gstk60jhachsv94g9:".parse::().unwrap()], // newly_created_non_fungibles [], // reserved_instructions [], // presented_proofs - ["component_tdx_2_1czg6rq9vms7t402fedtpzkjah25hh7snyu3ysgxk3pwlz4d3tugm7j".parse::().unwrap()], // encountered_component_addresses + ["component_tdx_2_1czg6rq9vms7t402fedtpzkjah25hh7snyu3ysgxk3pwlz4d3tugm7j".parse::().unwrap()], // encountered_component_addresses [ DetailedManifestClass::General ], @@ -546,7 +546,7 @@ mod tests { [], // newly_created_non_fungibles [], // reserved_instructions [ResourceSpecifier::non_fungible("resource_tdx_2_1ng88qk08hrgmad30rzdxpyx779yuta4cwcjc3gstk60jhachsv94g9", vec!["".parse().unwrap()])], // presented_proofs - ["component_tdx_2_1crje3en7zsrna9t5vyywn3z3t9ht34l9udxjcpjvdhpcw9v6vlzru8".parse::().unwrap()], // encountered_component_addresses + ["component_tdx_2_1crje3en7zsrna9t5vyywn3z3t9ht34l9udxjcpjvdhpcw9v6vlzru8".parse::().unwrap()], // encountered_component_addresses [ DetailedManifestClass::General ], @@ -1148,7 +1148,7 @@ mod tests { [], // newly_created_non_fungibles [], // reserved_instructions [], // presented_proofs - ["locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a".parse::().unwrap()], + ["locker_tdx_2_1drgp40wpu5cj0zady4s0pec6rld8muge0j2xx9xuwwc474uzlgja6a".parse::().unwrap()], [DetailedManifestClass::General], FeeLocks::default(), FeeSummary::new("0.2674585", "0.07226045", "0.19378661776", 0,), diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt index b57cef063..db1d8ac1e 100644 --- a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt +++ b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt @@ -1,23 +1,29 @@ package com.radixdlt.sargon.extensions +import com.radixdlt.sargon.Address import com.radixdlt.sargon.AddressFormat -import com.radixdlt.sargon.ManifestEncounteredAddress +import com.radixdlt.sargon.ManifestEncounteredComponentAddress import com.radixdlt.sargon.NetworkId -import com.radixdlt.sargon.manifestEncounteredAddressFormatted -import com.radixdlt.sargon.manifestEncounteredAddressNetworkId -import com.radixdlt.sargon.manifestEncounteredAddressToString -import com.radixdlt.sargon.newManifestEncounteredAddressFromBech32 +import com.radixdlt.sargon.manifestEncounteredComponentAddressFormatted +import com.radixdlt.sargon.manifestEncounteredComponentAddressNetworkId +import com.radixdlt.sargon.manifestEncounteredComponentAddressToString +import com.radixdlt.sargon.newManifestEncounteredComponentAddressFromBech32 @Throws(SargonException::class) -fun ManifestEncounteredAddress.Companion.init(validating: String) = - newManifestEncounteredAddressFromBech32(string = validating) +fun ManifestEncounteredComponentAddress.Companion.init(validating: String) = + newManifestEncounteredComponentAddressFromBech32(string = validating) -val ManifestEncounteredAddress.string: String - get() = manifestEncounteredAddressToString(address = this) +val ManifestEncounteredComponentAddress.string: String + get() = manifestEncounteredComponentAddressToString(address = this) -val ManifestEncounteredAddress.networkId: NetworkId - get() = manifestEncounteredAddressNetworkId(address = this) +val ManifestEncounteredComponentAddress.networkId: NetworkId + get() = manifestEncounteredComponentAddressNetworkId(address = this) -fun ManifestEncounteredAddress.formatted( +fun ManifestEncounteredComponentAddress.formatted( format: AddressFormat = AddressFormat.DEFAULT -): String = manifestEncounteredAddressFormatted(address = this, format = format) \ No newline at end of file +): String = manifestEncounteredComponentAddressFormatted(address = this, format = format) + +fun ManifestEncounteredComponentAddress.asGeneral() = when (this) { + is ManifestEncounteredComponentAddress.Component -> Address.Component(v1) + is ManifestEncounteredComponentAddress.Locker -> Address.Locker(v1) +} \ No newline at end of file diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt index 66bb77739..7faff250c 100644 --- a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt +++ b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt @@ -1,29 +1,24 @@ package com.radixdlt.sargon.samples +import com.radixdlt.sargon.ManifestEncounteredComponentAddress import com.radixdlt.sargon.annotation.UsesSampleValues -import com.radixdlt.sargon.AddressOfAccountOrPersona -import com.radixdlt.sargon.ManifestEncounteredAddress -import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleMainnet -import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleMainnetOther -import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleStokenet -import com.radixdlt.sargon.newAddressOfAccountOrPersonaSampleStokenetOther -import com.radixdlt.sargon.newManifestEncounteredAddressSampleMainnet -import com.radixdlt.sargon.newManifestEncounteredAddressSampleMainnetOther -import com.radixdlt.sargon.newManifestEncounteredAddressSampleStokenet -import com.radixdlt.sargon.newManifestEncounteredAddressSampleStokenetOther +import com.radixdlt.sargon.newManifestEncounteredComponentAddressSampleMainnet +import com.radixdlt.sargon.newManifestEncounteredComponentAddressSampleMainnetOther +import com.radixdlt.sargon.newManifestEncounteredComponentAddressSampleStokenet +import com.radixdlt.sargon.newManifestEncounteredComponentAddressSampleStokenetOther @UsesSampleValues -val ManifestEncounteredAddress.Companion.sampleMainnet: Sample - get() = object : Sample { - override fun invoke(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleMainnet() +val ManifestEncounteredComponentAddress.Companion.sampleMainnet: Sample + get() = object : Sample { + override fun invoke(): ManifestEncounteredComponentAddress = newManifestEncounteredComponentAddressSampleMainnet() - override fun other(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleMainnetOther() + override fun other(): ManifestEncounteredComponentAddress = newManifestEncounteredComponentAddressSampleMainnetOther() } @UsesSampleValues -val ManifestEncounteredAddress.Companion.sampleStokenet: Sample - get() = object : Sample { - override fun invoke(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleStokenet() +val ManifestEncounteredComponentAddress.Companion.sampleStokenet: Sample + get() = object : Sample { + override fun invoke(): ManifestEncounteredComponentAddress = newManifestEncounteredComponentAddressSampleStokenet() - override fun other(): ManifestEncounteredAddress = newManifestEncounteredAddressSampleStokenetOther() + override fun other(): ManifestEncounteredComponentAddress = newManifestEncounteredComponentAddressSampleStokenetOther() } \ No newline at end of file diff --git a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt similarity index 68% rename from jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt rename to jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt index 7f99cacfa..2b126ac47 100644 --- a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredAddressTest.kt +++ b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt @@ -11,29 +11,29 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -class ManifestEncounteredAddressTest: SampleTestable { +class ManifestEncounteredComponentAddressTest: SampleTestable { - override val samples: List> - get() = listOf(ManifestEncounteredAddress.sampleMainnet, ManifestEncounteredAddress.sampleStokenet) + override val samples: List> + get() = listOf(ManifestEncounteredComponentAddress.sampleMainnet, ManifestEncounteredComponentAddress.sampleStokenet) @Test fun testInit() { val componentAddress = "component_rdx1cptxxxxxxxxxfaucetxxxxxxxxx000527798379xxxxxxxxxfaucet" - with(ManifestEncounteredAddress.init(validating = componentAddress)) { + with(ManifestEncounteredComponentAddress.init(validating = componentAddress)) { assertEquals(componentAddress, string) assertEquals(NetworkId.MAINNET, networkId) } assertThrows { - ManifestEncounteredAddress.init(validating = PackageAddress.sampleMainnet().string) + ManifestEncounteredComponentAddress.init(validating = PackageAddress.sampleMainnet().string) } } @Test fun testFormat() { val addressString = "locker_rdx1dqeryv3jxgeryv3jxgeryv3jxgeryv3jxgeryv3jxgeryv3jjs0l6p" - val address = ManifestEncounteredAddress.init(validating = addressString) + val address = ManifestEncounteredComponentAddress.init(validating = addressString) assertEquals("lock...js0l6p", address.formatted()) assertEquals( From 354e5197d275b3c1a49d1150b5def46ce93edc31 Mon Sep 17 00:00:00 2001 From: Sergiu Puhalschi Date: Wed, 11 Sep 2024 16:29:41 +0300 Subject: [PATCH 11/11] Improve kotlin coverage --- ...t => ManifestEncounteredComponentAddress.kt} | 0 ...anifestEncounteredComponentAddressSample.kt} | 0 .../ManifestEncounteredComponentAddressTest.kt | 17 ++++++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) rename jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/{ManifestEncounteredAddress.kt => ManifestEncounteredComponentAddress.kt} (100%) rename jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/{ManifestEncounteredAddressSample.kt => ManifestEncounteredComponentAddressSample.kt} (100%) diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredComponentAddress.kt similarity index 100% rename from jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredAddress.kt rename to jvm/sargon-android/src/main/java/com/radixdlt/sargon/extensions/ManifestEncounteredComponentAddress.kt diff --git a/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt b/jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredComponentAddressSample.kt similarity index 100% rename from jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredAddressSample.kt rename to jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/ManifestEncounteredComponentAddressSample.kt diff --git a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt index 2b126ac47..76801155e 100644 --- a/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt +++ b/jvm/sargon-android/src/test/java/com/radixdlt/sargon/ManifestEncounteredComponentAddressTest.kt @@ -1,17 +1,19 @@ package com.radixdlt.sargon +import com.radixdlt.sargon.extensions.asGeneral import com.radixdlt.sargon.extensions.formatted import com.radixdlt.sargon.extensions.init import com.radixdlt.sargon.extensions.networkId import com.radixdlt.sargon.extensions.string import com.radixdlt.sargon.samples.Sample +import com.radixdlt.sargon.samples.sample import com.radixdlt.sargon.samples.sampleMainnet import com.radixdlt.sargon.samples.sampleStokenet import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -class ManifestEncounteredComponentAddressTest: SampleTestable { +class ManifestEncounteredComponentAddressTest : SampleTestable { override val samples: List> get() = listOf(ManifestEncounteredComponentAddress.sampleMainnet, ManifestEncounteredComponentAddress.sampleStokenet) @@ -19,12 +21,18 @@ class ManifestEncounteredComponentAddressTest: SampleTestable { ManifestEncounteredComponentAddress.init(validating = PackageAddress.sampleMainnet().string) } @@ -46,4 +54,11 @@ class ManifestEncounteredComponentAddressTest: SampleTestable