From bf70fb7fb02fe275b6acb6a8bdc30d1a8b7244ef Mon Sep 17 00:00:00 2001 From: Dennis Zoma Date: Thu, 2 May 2024 00:19:21 +0200 Subject: [PATCH 1/2] feat: Replace `@727-ventures/typechain-*` with `@prosopo/typechain-*` Type generation in build-all.sh works, but throws error (JSON parsing) in frontedn --- contracts/build-all.sh | 8 +- .../deployments/greeter/greeter.contract | 2 +- contracts/deployments/greeter/greeter.json | 2 +- contracts/deployments/greeter/greeter.wasm | Bin 4491 -> 4491 bytes contracts/package.json | 2 +- .../build-extrinsic/greeter.ts | 45 ++++++++ .../typed-contracts/constructors/greeter.ts | 83 ++++++++++++++ .../typed-contracts/contract-info/greeter.ts | 2 + .../typed-contracts/contracts/greeter.ts | 107 ++++++++++++++++++ contracts/typed-contracts/data/greeter.json | 76 +++++++++++++ .../typed-contracts/event-data/greeter.json | 32 ++++++ .../typed-contracts/event-types/greeter.ts | 8 ++ contracts/typed-contracts/events/greeter.ts | 59 ++++++++++ .../typed-contracts/mixed-methods/greeter.ts | 68 +++++++++++ contracts/typed-contracts/query/greeter.ts | 57 ++++++++++ contracts/typed-contracts/shared/utils.ts | 37 ++++++ .../tx-sign-and-send/greeter.ts | 58 ++++++++++ .../types-arguments/greeter.ts | 8 ++ .../typed-contracts/types-returns/greeter.ts | 9 ++ frontend/package.json | 2 +- .../web3/greeter-contract-interactions.tsx | 12 +- pnpm-lock.yaml | 39 +++---- 22 files changed, 682 insertions(+), 34 deletions(-) create mode 100644 contracts/typed-contracts/build-extrinsic/greeter.ts create mode 100644 contracts/typed-contracts/constructors/greeter.ts create mode 100644 contracts/typed-contracts/contract-info/greeter.ts create mode 100644 contracts/typed-contracts/contracts/greeter.ts create mode 100644 contracts/typed-contracts/data/greeter.json create mode 100644 contracts/typed-contracts/event-data/greeter.json create mode 100644 contracts/typed-contracts/event-types/greeter.ts create mode 100644 contracts/typed-contracts/events/greeter.ts create mode 100644 contracts/typed-contracts/mixed-methods/greeter.ts create mode 100644 contracts/typed-contracts/query/greeter.ts create mode 100644 contracts/typed-contracts/shared/utils.ts create mode 100644 contracts/typed-contracts/tx-sign-and-send/greeter.ts create mode 100644 contracts/typed-contracts/types-arguments/greeter.ts create mode 100644 contracts/typed-contracts/types-returns/greeter.ts diff --git a/contracts/build-all.sh b/contracts/build-all.sh index aa07350..9e72e57 100755 --- a/contracts/build-all.sh +++ b/contracts/build-all.sh @@ -23,11 +23,9 @@ do $CP_CMD ./target/ink/$i/$i.wasm $DIR/$i/ $CP_CMD ./target/ink/$i/$i.json $DIR/$i/ - # NOTE: Currently disabled until `typechain-polkadot` dependencies are upted to support ink! v5 if [[ "$@" != *"--skip-types"* ]]; then - echo "IMPORTANT: Type generation is currently disabled as it's not yet working with ink! v5" - # echo "Generate types via typechain into './typed-contracts'…" - # Because of an open issue, this uses the npx-installed version (https://github.com/Brushfam/typechain-polkadot/issues/115) - # npx @727-ventures/typechain-polkadot --in $DIR/$i/ --out typed-contracts --yes + echo "Generate types via @prosopo/typechain-polkadot into './typed-contracts'…" + # Using the npx-installed version because of this issue: https://github.com/Brushfam/typechain-polkadot/issues/115 + npx @prosopo/typechain-polkadot --in $DIR/$i/ --out typed-contracts --yes fi done \ No newline at end of file diff --git a/contracts/deployments/greeter/greeter.contract b/contracts/deployments/greeter/greeter.contract index abf0fdb..755a4db 100644 --- a/contracts/deployments/greeter/greeter.contract +++ b/contracts/deployments/greeter/greeter.contract @@ -1 +1 @@ -{"source":{"hash":"0x405bb1e5c253833517f814020d6299705b7ffdbb628041506d5d09aa2cf9b465","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060100000101000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021011200220002001100e0b4801027f230041106b22032400200341086a20024100101020032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011010200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051013200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71014230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1013200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101020002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101120002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510122000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10122004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101220062003200510132000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10140c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of `message`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets `message` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5} \ No newline at end of file +{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of `message`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets `message` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5} \ No newline at end of file diff --git a/contracts/deployments/greeter/greeter.json b/contracts/deployments/greeter/greeter.json index 26307c5..6ef7123 100644 --- a/contracts/deployments/greeter/greeter.json +++ b/contracts/deployments/greeter/greeter.json @@ -1,6 +1,6 @@ { "source": { - "hash": "0x405bb1e5c253833517f814020d6299705b7ffdbb628041506d5d09aa2cf9b465", + "hash": "0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68", "language": "ink! 5.0.0", "compiler": "rustc 1.77.1", "build_info": { diff --git a/contracts/deployments/greeter/greeter.wasm b/contracts/deployments/greeter/greeter.wasm index eaba357926d94042dffea757690da8858d19f8e7..c44fcafe41f9e99163bc1e26c9deb44533482171 100644 GIT binary patch delta 117 zcmV-*0E+*MBa0)D^8*0@0I~Lz0+am&7XcBI6$LS~iUVl@2@)UzAOIi%5Dv3N1vLQy z5wm*+OalQFv&ab|0s#<{>kC`~6q85{a{&>PybRm{5|fz?H~|y0(hVK~0TYw)4p0db XAO;`Bmf`- zK?rIf0zm)}5R;+0Th$#3tRyclSmA60T7eC4BP<` qlbH=T0TQ#)4ITjj5|i-`Pze$s1|S0<1rQUnN)HGD0Ti=S5I6yvv>zJ) diff --git a/contracts/package.json b/contracts/package.json index 2202af9..3eb0c6b 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -20,7 +20,7 @@ "lint:format": "prettier . --write" }, "devDependencies": { - "@727-ventures/typechain-types": "^1.1.2", + "@prosopo/typechain-types": "^1.1.15", "@polkadot/api": "^11.0.2", "@polkadot/api-contract": "^11.0.2", "@polkadot/keyring": "^12.6.2", diff --git a/contracts/typed-contracts/build-extrinsic/greeter.ts b/contracts/typed-contracts/build-extrinsic/greeter.ts new file mode 100644 index 0000000..0fc61cb --- /dev/null +++ b/contracts/typed-contracts/build-extrinsic/greeter.ts @@ -0,0 +1,45 @@ +/* This file is auto-generated */ + +import type { ContractPromise } from '@polkadot/api-contract'; +import type { GasLimit, GasLimitAndRequiredValue } from '@prosopo/typechain-types'; +import { buildSubmittableExtrinsic } from '@prosopo/typechain-types'; +import type * as ArgumentTypes from '../types-arguments/greeter'; +import type BN from 'bn.js'; +import type { ApiPromise } from '@polkadot/api'; + + + +export default class Methods { + readonly __nativeContract : ContractPromise; + readonly __apiPromise: ApiPromise; + + constructor( + nativeContract : ContractPromise, + apiPromise: ApiPromise, + ) { + this.__nativeContract = nativeContract; + this.__apiPromise = apiPromise; + } + /** + * greet + * + */ + "greet" ( + __options: GasLimit, + ){ + return buildSubmittableExtrinsic( this.__apiPromise, this.__nativeContract, "greet", [], __options); + } + + /** + * setMessage + * + * @param { string } newValue, + */ + "setMessage" ( + newValue: string, + __options: GasLimit, + ){ + return buildSubmittableExtrinsic( this.__apiPromise, this.__nativeContract, "setMessage", [newValue], __options); + } + +} \ No newline at end of file diff --git a/contracts/typed-contracts/constructors/greeter.ts b/contracts/typed-contracts/constructors/greeter.ts new file mode 100644 index 0000000..b4de1c7 --- /dev/null +++ b/contracts/typed-contracts/constructors/greeter.ts @@ -0,0 +1,83 @@ +import {CodePromise} from "@polkadot/api-contract"; +import type {KeyringPair} from "@polkadot/keyring/types"; +import type {ApiPromise} from "@polkadot/api"; +import {_genValidGasLimitAndValue, _signAndSend, SignAndSendSuccessResponse} from "@prosopo/typechain-types"; +import type {ConstructorOptions} from "@prosopo/typechain-types"; +import type {WeightV2} from "@polkadot/types/interfaces"; +import type * as ArgumentTypes from '../types-arguments/greeter'; +import { ContractFile } from '../contract-info/greeter'; +import type BN from 'bn.js'; + +export default class Constructors { + readonly nativeAPI: ApiPromise; + readonly signer: KeyringPair; + + constructor( + nativeAPI: ApiPromise, + signer: KeyringPair, + ) { + this.nativeAPI = nativeAPI; + this.signer = signer; + } + + /** + * new + * + * @param { string } initValue, + */ + async "new" ( + initValue: string, + __options ? : ConstructorOptions, + ) { + const __contract = JSON.parse(ContractFile); + const code = new CodePromise(this.nativeAPI, __contract, __contract.source.wasm); + const gasLimit = (await _genValidGasLimitAndValue(this.nativeAPI, __options)).gasLimit as WeightV2; + + const storageDepositLimit = __options?.storageDepositLimit; + const tx = code.tx["new"]!({ gasLimit, storageDepositLimit, value: __options?.value }, initValue); + let response; + + try { + response = await _signAndSend(this.nativeAPI.registry, tx, this.signer, (event: any) => event); + } + catch (error) { + console.log(error); + } + + return { + result: response as SignAndSendSuccessResponse, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + address: (response as SignAndSendSuccessResponse)!.result!.contract.address.toString(), + }; + } + /** + * default + * + */ + async "default" ( + __options ? : ConstructorOptions, + ) { + const __contract = JSON.parse(ContractFile); + const code = new CodePromise(this.nativeAPI, __contract, __contract.source.wasm); + const gasLimit = (await _genValidGasLimitAndValue(this.nativeAPI, __options)).gasLimit as WeightV2; + + const storageDepositLimit = __options?.storageDepositLimit; + const tx = code.tx["default"]!({ gasLimit, storageDepositLimit, value: __options?.value }, ); + let response; + + try { + response = await _signAndSend(this.nativeAPI.registry, tx, this.signer, (event: any) => event); + } + catch (error) { + console.log(error); + } + + return { + result: response as SignAndSendSuccessResponse, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + address: (response as SignAndSendSuccessResponse)!.result!.contract.address.toString(), + }; + } +} \ No newline at end of file diff --git a/contracts/typed-contracts/contract-info/greeter.ts b/contracts/typed-contracts/contract-info/greeter.ts new file mode 100644 index 0000000..4e63ab4 --- /dev/null +++ b/contracts/typed-contracts/contract-info/greeter.ts @@ -0,0 +1,2 @@ +export const ContractAbi = `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of \`message\`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets \`message\` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}`; +export const ContractFile = `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of \`message\`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets \`message\` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}`; \ No newline at end of file diff --git a/contracts/typed-contracts/contracts/greeter.ts b/contracts/typed-contracts/contracts/greeter.ts new file mode 100644 index 0000000..b5ac296 --- /dev/null +++ b/contracts/typed-contracts/contracts/greeter.ts @@ -0,0 +1,107 @@ +/* This file is auto-generated */ + +import type { ApiPromise } from '@polkadot/api'; +import { Abi } from '@polkadot/api-contract'; +import type { KeyringPair } from '@polkadot/keyring/types'; +import { ContractPromise } from '@polkadot/api-contract'; +import { ContractAbi } from '../contract-info/greeter'; +import QueryMethods from '../query/greeter'; +import BuildExtrinsicMethods from '../build-extrinsic/greeter'; +import TxSignAndSendMethods from '../tx-sign-and-send/greeter'; +import MixedMethods from '../mixed-methods/greeter'; +import EventsClass from '../events/greeter'; + + +export default class Contract { + readonly query : QueryMethods; + readonly buildExtrinsic : BuildExtrinsicMethods; + readonly tx : TxSignAndSendMethods; + readonly methods : MixedMethods; + readonly events: EventsClass; + + readonly address : string; + readonly signer : KeyringPair; + + readonly nativeContract : ContractPromise; + readonly nativeAPI : ApiPromise; + readonly contractAbi: Abi; + + /** + * @constructor + + * @param address - The address of the contract. + * @param signer - The signer to use for signing transactions. + * @param nativeAPI - The API instance to use for queries. + */ + constructor( + address : string, + signer : KeyringPair, + nativeAPI : ApiPromise, + ) { + this.address = address; + this.nativeContract = new ContractPromise(nativeAPI, ContractAbi, address); + this.nativeAPI = nativeAPI; + this.signer = signer; + this.contractAbi = new Abi(ContractAbi); + + this.query = new QueryMethods(this.nativeContract, this.nativeAPI, signer.address); + this.buildExtrinsic = new BuildExtrinsicMethods(this.nativeContract, this.nativeAPI); + this.tx = new TxSignAndSendMethods(nativeAPI, this.nativeContract, signer); + this.methods = new MixedMethods(nativeAPI, this.nativeContract, signer); + this.events = new EventsClass(this.nativeContract, nativeAPI); + } + + /** + * name + * + * @returns The name of the contract. + */ + get name() : string { + return this.nativeContract.abi.info.contract.name.toString(); + } + + /** + * abi + * + * @returns The abi of the contract. + */ + get abi() : Abi { + return this.contractAbi; + } + + /** + * withSigner + * + * @param signer - The signer to use for signing transactions. + * @returns New instance of the contract class with new signer. + * @example + * ```typescript + * const contract = new Contract(address, signerAlice, api); + * await contract.mint(signerBob.address, 100); + * await contract.withSigner(signerBob).transfer(signerAlice.address, 100); + * ``` + */ + withSigner(signer : KeyringPair) : Contract { + return new Contract(this.address, signer, this.nativeAPI); + } + + /** + * withAddress + * + * @param address - The address of the contract. + * @returns New instance of the contract class to interact with new contract. + */ + withAddress(address : string) : Contract { + return new Contract(address, this.signer, this.nativeAPI); + } + + /** + * withAPI + * + * @param api - The API instance to use for queries. + * @returns New instance of the contract class to interact with new API. + */ + withAPI(api : ApiPromise) : Contract { + return new Contract(this.address, this.signer, api); + } +} \ No newline at end of file diff --git a/contracts/typed-contracts/data/greeter.json b/contracts/typed-contracts/data/greeter.json new file mode 100644 index 0000000..6983787 --- /dev/null +++ b/contracts/typed-contracts/data/greeter.json @@ -0,0 +1,76 @@ +{ + "0": { "name": "string", "isResult": false, "isPrimitive": true, "isConvertable": false }, + "2": { + "name": "Result void) { + const callbackWrapper = (args: any[], event: any) => { + const _event: Record < string, any > = {}; + + for (let i = 0; i < args.length; i++) { + _event[event.args[i]!.name] = args[i]!.toJSON(); + } + + callback(handleEventReturn(_event, getEventTypeDescription('Greeted', EVENT_DATA_TYPE_DESCRIPTIONS)) as EventTypes.Greeted); + }; + + return this.__subscribeOnEvent(callbackWrapper, (eventName : string) => eventName == 'Greeted'); + } + + + private __subscribeOnEvent( + callback : (args: any[], event: any) => void, + filter : (eventName: string) => boolean = () => true + ) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + return this.__api.query.system.events((events) => { + events.forEach((record: any) => { + const { event } = record; + + if (event.method == 'ContractEmitted') { + const [address, data] = record.event.data; + + if (address.toString() === this.__nativeContract.address.toString()) { + const {args, event} = this.__nativeContract.abi.decodeEvent(record); + + if (filter(event.identifier.toString())) + callback(args, event); + } + } + }); + }); + } + +} diff --git a/contracts/typed-contracts/mixed-methods/greeter.ts b/contracts/typed-contracts/mixed-methods/greeter.ts new file mode 100644 index 0000000..9e681a3 --- /dev/null +++ b/contracts/typed-contracts/mixed-methods/greeter.ts @@ -0,0 +1,68 @@ +/* This file is auto-generated */ + +import type { ContractPromise } from '@polkadot/api-contract'; +import type { ApiPromise } from '@polkadot/api'; +import type { KeyringPair } from '@polkadot/keyring/types'; +import type { GasLimit, GasLimitAndRequiredValue, Result } from '@prosopo/typechain-types'; +import type { QueryReturnType } from '@prosopo/typechain-types'; +import { queryOkJSON, queryJSON, handleReturnType } from '@prosopo/typechain-types'; +import { txSignAndSend } from '@prosopo/typechain-types'; +import type * as ArgumentTypes from '../types-arguments/greeter'; +import type * as ReturnTypes from '../types-returns/greeter'; +import type BN from 'bn.js'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import {ReturnNumber} from '@prosopo/typechain-types'; +import {getTypeDescription} from './../shared/utils'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import type { EventRecord } from '@polkadot/types/interfaces'; +import {decodeEvents} from "../shared/utils"; +import DATA_TYPE_DESCRIPTIONS from '../data/greeter.json'; +import EVENT_DATA_TYPE_DESCRIPTIONS from '../event-data/greeter.json'; + + +export default class Methods { + readonly __nativeContract : ContractPromise; + readonly __keyringPair : KeyringPair; + readonly __callerAddress : string; + readonly __apiPromise: ApiPromise; + + constructor( + apiPromise : ApiPromise, + nativeContract : ContractPromise, + keyringPair : KeyringPair, + ) { + this.__apiPromise = apiPromise; + this.__nativeContract = nativeContract; + this.__keyringPair = keyringPair; + this.__callerAddress = keyringPair.address; + } + + /** + * greet + * + * @returns { Result } + */ + "greet" ( + __options: GasLimit, + ): Promise< QueryReturnType< Result > >{ + return queryOkJSON( this.__apiPromise, this.__nativeContract, this.__callerAddress, "greet", [], __options, (result) => { return handleReturnType(result, getTypeDescription(5, DATA_TYPE_DESCRIPTIONS)); }); + } + + /** + * setMessage + * + * @param { string } newValue, + * @returns { void } + */ + "setMessage" ( + newValue: string, + __options: GasLimit, + ){ + return txSignAndSend( this.__apiPromise, this.__nativeContract, this.__keyringPair, "setMessage", (events: EventRecord[]) => { + return decodeEvents(events, this.__nativeContract, EVENT_DATA_TYPE_DESCRIPTIONS); + }, [newValue], __options); + } + +} \ No newline at end of file diff --git a/contracts/typed-contracts/query/greeter.ts b/contracts/typed-contracts/query/greeter.ts new file mode 100644 index 0000000..d418cc8 --- /dev/null +++ b/contracts/typed-contracts/query/greeter.ts @@ -0,0 +1,57 @@ +/* This file is auto-generated */ + +import type { ContractPromise } from '@polkadot/api-contract'; +import type { ApiPromise } from '@polkadot/api'; +import type { GasLimit, GasLimitAndRequiredValue, Result } from '@prosopo/typechain-types'; +import type { QueryReturnType } from '@prosopo/typechain-types'; +import { queryJSON, queryOkJSON, handleReturnType } from '@prosopo/typechain-types'; +import type * as ArgumentTypes from '../types-arguments/greeter'; +import type * as ReturnTypes from '../types-returns/greeter'; +import type BN from 'bn.js'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import {ReturnNumber} from '@prosopo/typechain-types'; +import {getTypeDescription} from './../shared/utils'; +import DATA_TYPE_DESCRIPTIONS from '../data/greeter.json'; + + +export default class Methods { + readonly __nativeContract : ContractPromise; + readonly __apiPromise: ApiPromise; + readonly __callerAddress : string; + + constructor( + nativeContract : ContractPromise, + nativeApi : ApiPromise, + callerAddress : string, + ) { + this.__nativeContract = nativeContract; + this.__callerAddress = callerAddress; + this.__apiPromise = nativeApi; + } + + /** + * greet + * + * @returns { Result } + */ + "greet" ( + __options ? : GasLimit, + ): Promise< QueryReturnType< Result > >{ + return queryOkJSON( this.__apiPromise, this.__nativeContract, this.__callerAddress, "greet", [], __options , (result) => { return handleReturnType(result, getTypeDescription(5, DATA_TYPE_DESCRIPTIONS)); }); + } + + /** + * setMessage + * + * @param { string } newValue, + * @returns { Result } + */ + "setMessage" ( + newValue: string, + __options ? : GasLimit, + ): Promise< QueryReturnType< Result > >{ + return queryOkJSON( this.__apiPromise, this.__nativeContract, this.__callerAddress, "setMessage", [newValue], __options , (result) => { return handleReturnType(result, getTypeDescription(2, DATA_TYPE_DESCRIPTIONS)); }); + } + +} \ No newline at end of file diff --git a/contracts/typed-contracts/shared/utils.ts b/contracts/typed-contracts/shared/utils.ts new file mode 100644 index 0000000..f74c8bf --- /dev/null +++ b/contracts/typed-contracts/shared/utils.ts @@ -0,0 +1,37 @@ +import fs from "fs"; +import type {ContractPromise} from "@polkadot/api-contract"; +import {handleEventReturn} from "@prosopo/typechain-types"; + +export function getTypeDescription(id: number | string, types: any): any { + return types[id]; +} + +export function getEventTypeDescription(name: string, types: any): any { + return types[name]; +} + +export function decodeEvents(events: any[], contract: ContractPromise, types: any): any[] { + return events.filter((record: any) => { + const { event } = record; + + const [address, data] = record.event.data; + + return event.method == 'ContractEmitted' && address.toString() === contract.address.toString(); + }).map((record: any) => { + + const {args, event} = contract.abi.decodeEvent(record); + + const _event: Record < string, any > = {}; + + for (let i = 0; i < args.length; i++) { + _event[event.args[i]!.name] = args[i]!.toJSON(); + } + + handleEventReturn(_event, getEventTypeDescription(event.identifier.toString(), types)); + + return { + name: event.identifier.toString(), + args: _event, + }; + }); +} diff --git a/contracts/typed-contracts/tx-sign-and-send/greeter.ts b/contracts/typed-contracts/tx-sign-and-send/greeter.ts new file mode 100644 index 0000000..6d2eb85 --- /dev/null +++ b/contracts/typed-contracts/tx-sign-and-send/greeter.ts @@ -0,0 +1,58 @@ +/* This file is auto-generated */ + +import type { ContractPromise } from '@polkadot/api-contract'; +import type { KeyringPair } from '@polkadot/keyring/types'; +import type { ApiPromise } from '@polkadot/api'; +import type { GasLimit, GasLimitAndRequiredValue, Result } from '@prosopo/typechain-types'; +import { txSignAndSend } from '@prosopo/typechain-types'; +import type * as ArgumentTypes from '../types-arguments/greeter'; +import type BN from 'bn.js'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore +import type { EventRecord } from '@polkadot/types/interfaces'; +import {decodeEvents} from "../shared/utils"; +import EVENT_DATA_TYPE_DESCRIPTIONS from '../event-data/greeter.json'; + + +export default class Methods { + readonly __nativeContract : ContractPromise; + readonly __keyringPair : KeyringPair; + readonly __apiPromise: ApiPromise; + + constructor( + apiPromise: ApiPromise, + nativeContract : ContractPromise, + keyringPair : KeyringPair, + ) { + this.__apiPromise = apiPromise; + this.__nativeContract = nativeContract; + this.__keyringPair = keyringPair; + } + + /** + * greet + * + */ + "greet" ( + __options ? : GasLimit, + ){ + return txSignAndSend( this.__apiPromise, this.__nativeContract, this.__keyringPair, "greet", (events: EventRecord[]) => { + return decodeEvents(events, this.__nativeContract, EVENT_DATA_TYPE_DESCRIPTIONS); + }, [], __options); + } + + /** + * setMessage + * + * @param { string } newValue, + */ + "setMessage" ( + newValue: string, + __options ? : GasLimit, + ){ + return txSignAndSend( this.__apiPromise, this.__nativeContract, this.__keyringPair, "setMessage", (events: EventRecord[]) => { + return decodeEvents(events, this.__nativeContract, EVENT_DATA_TYPE_DESCRIPTIONS); + }, [newValue], __options); + } + +} \ No newline at end of file diff --git a/contracts/typed-contracts/types-arguments/greeter.ts b/contracts/typed-contracts/types-arguments/greeter.ts new file mode 100644 index 0000000..85afd9d --- /dev/null +++ b/contracts/typed-contracts/types-arguments/greeter.ts @@ -0,0 +1,8 @@ +import type BN from 'bn.js'; + +export enum LangError { + couldNotReadInput = 'CouldNotReadInput' +} + +export type AccountId = string | number[] + diff --git a/contracts/typed-contracts/types-returns/greeter.ts b/contracts/typed-contracts/types-returns/greeter.ts new file mode 100644 index 0000000..e64b167 --- /dev/null +++ b/contracts/typed-contracts/types-returns/greeter.ts @@ -0,0 +1,9 @@ +import type BN from 'bn.js'; +import type {ReturnNumber} from '@prosopo/typechain-types'; + +export enum LangError { + couldNotReadInput = 'CouldNotReadInput' +} + +export type AccountId = string | number[] + diff --git a/frontend/package.json b/frontend/package.json index 205e21d..110ae4d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,7 +16,7 @@ "lint:format": "prettier . --write" }, "dependencies": { - "@727-ventures/typechain-types": "^1.1.2", + "@prosopo/typechain-types": "^1.1.15", "@azns/resolver-core": "^1.6.0", "@azns/resolver-react": "^1.6.0", "@hookform/resolvers": "^3.3.4", diff --git a/frontend/src/components/web3/greeter-contract-interactions.tsx b/frontend/src/components/web3/greeter-contract-interactions.tsx index 6079813..3918f2e 100644 --- a/frontend/src/components/web3/greeter-contract-interactions.tsx +++ b/frontend/src/components/web3/greeter-contract-interactions.tsx @@ -4,12 +4,13 @@ import { FC, useEffect, useState } from 'react' import { ContractIds } from '@/deployments/deployments' import { zodResolver } from '@hookform/resolvers/zod' -// import GreeterContract from '@inkathon/contracts/typed-contracts/contracts/greeter' +import GreeterContract from '@inkathon/contracts/typed-contracts/contracts/greeter' import { contractQuery, decodeOutput, useInkathon, useRegisteredContract, + useRegisteredTypedContract, } from '@scio-labs/use-inkathon' import { SubmitHandler, useForm } from 'react-hook-form' import toast from 'react-hot-toast' @@ -28,7 +29,7 @@ const formSchema = z.object({ export const GreeterContractInteractions: FC = () => { const { api, activeAccount, activeSigner } = useInkathon() const { contract, address: contractAddress } = useRegisteredContract(ContractIds.Greeter) - // const { typedContract } = useRegisteredTypedContract(ContractIds.Greeter, GreeterContract) + const { typedContract } = useRegisteredTypedContract(ContractIds.Greeter, GreeterContract) const [greeterMessage, setGreeterMessage] = useState() const [fetchIsLoading, setFetchIsLoading] = useState() const form = useForm>({ @@ -39,7 +40,7 @@ export const GreeterContractInteractions: FC = () => { // Fetch Greeting const fetchGreeting = async () => { - if (!contract || !api) return + if (!contract || !typedContract || !api) return setFetchIsLoading(true) try { @@ -48,10 +49,9 @@ export const GreeterContractInteractions: FC = () => { if (isError) throw new Error(decodedOutput) setGreeterMessage(output) - // NOTE: Currently disabled until `typechain-polkadot` dependencies are upted to support ink! v5 // Alternatively: Fetch it with typed contract instance - // const typedResult = await typedContract.query.greet() - // console.log('Result from typed contract: ', typedResult.value) + const typedResult = await typedContract.query.greet() + console.log('Result from typed contract: ', typedResult.value) } catch (e) { console.error(e) toast.error('Error while fetching greeting. Try again…') diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8bf8375..2dba9a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -32,9 +32,6 @@ importers: contracts: devDependencies: - '@727-ventures/typechain-types': - specifier: ^1.1.2 - version: 1.1.2 '@polkadot/api': specifier: ^11.0.2 version: 11.0.2 @@ -53,6 +50,9 @@ importers: '@polkadot/util-crypto': specifier: ^12.6.2 version: 12.6.2(@polkadot/util@12.6.2) + '@prosopo/typechain-types': + specifier: ^1.1.15 + version: 1.1.15 '@scio-labs/use-inkathon': specifier: ^0.10.0 version: 0.10.0(@nightlylabs/wallet-selector-polkadot@0.2.5)(@polkadot/api-contract@11.0.2)(@polkadot/api@11.0.2)(@polkadot/extension-inject@0.47.3)(@polkadot/keyring@12.6.2)(@polkadot/types@11.0.2)(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2)(react-dom@18.3.1)(react@18.3.1) @@ -95,9 +95,6 @@ importers: frontend: dependencies: - '@727-ventures/typechain-types': - specifier: ^1.1.2 - version: 1.1.2 '@azns/resolver-core': specifier: ^1.6.0 version: 1.6.0(@polkadot/api-contract@11.0.2)(@polkadot/api@11.0.2)(@polkadot/types@11.0.2)(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) @@ -134,6 +131,9 @@ importers: '@polkadot/util-crypto': specifier: ^12.6.2 version: 12.6.2(@polkadot/util@12.6.2) + '@prosopo/typechain-types': + specifier: ^1.1.15 + version: 1.1.15 '@radix-ui/react-dropdown-menu': specifier: ^2.0.6 version: 2.0.6(@types/react-dom@18.3.0)(@types/react@18.3.1)(react-dom@18.3.1)(react@18.3.1) @@ -270,19 +270,6 @@ importers: packages: - /@727-ventures/typechain-types@1.1.2: - resolution: {integrity: sha512-Ed9pxucmrwl9bO8sAiWorP7fRUO+feekwN2UP9GV4/XDsgtSH5RPJSEeSooYJLpwALElinX7Imekg9MQmuXpmg==} - dependencies: - '@polkadot/api': 10.13.1 - '@polkadot/api-contract': 10.13.1 - '@types/bn.js': 5.1.5 - '@types/node': 18.19.31 - camelcase: 6.3.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@aashutoshrathi/word-wrap@1.2.6: resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==} engines: {node: '>=0.10.0'} @@ -2453,6 +2440,20 @@ packages: - bufferutil - utf-8-validate + /@prosopo/typechain-types@1.1.15: + resolution: {integrity: sha512-VZpzG/sUba6xnMsiPcFGCCDInV2o7aaJarKvGFWqaCM7I1AKIbq8hi0i6ojxKq9caMo0ZAwblSi+XR8GX+QfVg==} + dependencies: + '@polkadot/api': 10.13.1 + '@polkadot/api-contract': 10.13.1 + '@types/bn.js': 5.1.5 + '@types/node': 18.19.31 + camelcase: 6.3.0 + tslib: 2.6.2 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + /@radix-ui/primitive@1.0.1: resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==} dependencies: From cc581726820335483cc4644abb28b7b0205be378 Mon Sep 17 00:00:00 2001 From: Dennis Zoma Date: Thu, 2 May 2024 12:43:33 +0200 Subject: [PATCH 2/2] fix: Fetching greeting with `typedContract` (remove control characters from json string) --- .../deployments/greeter/greeter.contract | 2 +- contracts/deployments/greeter/greeter.json | 4 +- contracts/package.json | 4 +- contracts/src/greeter/lib.rs | 4 +- .../typed-contracts/contract-info/greeter.ts | 10 +- contracts/typed-contracts/data/greeter.json | 77 +--- .../typed-contracts/event-data/greeter.json | 33 +- frontend/package.json | 4 +- .../web3/greeter-contract-interactions.tsx | 15 +- package.json | 6 + pnpm-lock.yaml | 421 ++---------------- 11 files changed, 70 insertions(+), 510 deletions(-) diff --git a/contracts/deployments/greeter/greeter.contract b/contracts/deployments/greeter/greeter.contract index 755a4db..353a9e4 100644 --- a/contracts/deployments/greeter/greeter.contract +++ b/contracts/deployments/greeter/greeter.contract @@ -1 +1 @@ -{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of `message`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets `message` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5} \ No newline at end of file +{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of 'message'."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets 'message' to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5} \ No newline at end of file diff --git a/contracts/deployments/greeter/greeter.json b/contracts/deployments/greeter/greeter.json index 6ef7123..eace9bc 100644 --- a/contracts/deployments/greeter/greeter.json +++ b/contracts/deployments/greeter/greeter.json @@ -153,7 +153,7 @@ "args": [], "default": false, "docs": [ - " Returns the current value of `message`." + " Returns the current value of 'message'." ], "label": "greet", "mutates": false, @@ -181,7 +181,7 @@ ], "default": false, "docs": [ - " Sets `message` to the given value." + " Sets 'message' to the given value." ], "label": "set_message", "mutates": true, diff --git a/contracts/package.json b/contracts/package.json index 3eb0c6b..4c19436 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -20,18 +20,18 @@ "lint:format": "prettier . --write" }, "devDependencies": { - "@prosopo/typechain-types": "^1.1.15", "@polkadot/api": "^11.0.2", "@polkadot/api-contract": "^11.0.2", "@polkadot/keyring": "^12.6.2", "@polkadot/types": "^11.0.2", "@polkadot/util": "^12.6.2", "@polkadot/util-crypto": "^12.6.2", + "@prosopo/typechain-types": "^1.1.15", "@scio-labs/use-inkathon": "^0.10.0", "@types/bn.js": "~5.1.5", "@types/eslint": "^8.56.10", "@types/eslint-config-prettier": "^6.11.3", - "@types/node": "^20.12.7", + "@types/node": "^20.12.8", "@typescript-eslint/eslint-plugin": "^7.8.0", "@typescript-eslint/parser": "^7.8.0", "bn.js": "^5.2.1", diff --git a/contracts/src/greeter/lib.rs b/contracts/src/greeter/lib.rs index 3ebc2a4..9b9a342 100755 --- a/contracts/src/greeter/lib.rs +++ b/contracts/src/greeter/lib.rs @@ -31,13 +31,13 @@ mod greeter { Self::new(default_message) } - /// Returns the current value of `message`. + /// Returns the current value of 'message'. #[ink(message)] pub fn greet(&self) -> String { self.message.clone() } - /// Sets `message` to the given value. + /// Sets 'message' to the given value. #[ink(message)] pub fn set_message(&mut self, new_value: String) { self.message = new_value.clone(); diff --git a/contracts/typed-contracts/contract-info/greeter.ts b/contracts/typed-contracts/contract-info/greeter.ts index 4e63ab4..ade4ef2 100644 --- a/contracts/typed-contracts/contract-info/greeter.ts +++ b/contracts/typed-contracts/contract-info/greeter.ts @@ -1,2 +1,8 @@ -export const ContractAbi = `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of \`message\`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets \`message\` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}`; -export const ContractFile = `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of \`message\`."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets \`message\` to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}`; \ No newline at end of file +/* eslint-disable no-control-regex */ + +export const ContractAbi = + `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of 'message'."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets 'message' to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}`.replace( + /[\u0000-\u0019]+/g, + '', + ) +export const ContractFile = `{"source":{"hash":"0xd2a960874747af3b3da183bef32563be6cd8bc56bcc3efe53dd528f66c3a3a68","language":"ink! 5.0.0","compiler":"rustc 1.77.1","wasm":"0x0061736d0100000001290760027f7f0060037f7f7f0060037f7f7f017f60047f7f7f7f017f60000060047f7f7f7f006000017f02b10109057365616c310b6765745f73746f726167650003057365616c3005696e7075740000057365616c300d6465706f7369745f6576656e740005057365616c320b7365745f73746f726167650003057365616c300b7365616c5f72657475726e0001057365616c300663616c6c65720000057365616c301176616c75655f7472616e736665727265640000057365616c300f686173685f626c616b65325f323536000103656e76066d656d6f72790201021003151402020202020001060101000001000000000004040616037f01418080040b7f0041c082050b7f0041bc82050b0711020463616c6c001a066465706c6f79001b0aee1e142b01017f037f2002200346047f200005200020036a200120036a2d00003a0000200341016a21030c010b0b0b6f01017f0240200020014d04402000210303402002450d02200320012d00003a0000200141016a2101200341016a2103200241016b21020c000b000b200141016b2101200041016b210303402002450d01200220036a200120026a2d00003a0000200241016b21020c000b000b20000b2501017f037f2002200346047f200005200020036a20013a0000200341016a21030c010b0b0b3f01027f0340200245044041000f0b200241016b210220012d0000210320002d00002104200041016a2100200141016a210120032004460d000b200420036b0b8f0101017f20002d00042103200041003a0004027f0240200345044041012000280200220028020422032002490d021a200120002802002201200210081a0c010b2001200041056a2d00003a00004101200028020022002802042203200241016b2202490d011a200141016a20002802002201200210081a0b2000200320026b3602042000200120026a36020041000b0b2601017f230041106b220224002002200036020c20012002410c6a4104100e200241106a24000b4801027f024002402000280208220320026a22042003490d00200420002802044b0d00200420036b2002470d01200028020020036a2001200210081a200020043602080f0b000b000b5902017f027e230041206b2200240020004200370308200042003703002000411036021c20002000411c6a1006200028021c41114f0440000b2000290308210120002903002102200041206a2400410541042001200284501b0b4801027f230041106b22032400200341086a20024100101120032802082104200328020c2001200210082101200020023602082000200136020420002004360200200341106a24000be00101017f024002402001450440410121020c010b20014100480d01200245044041ac82042d00001a0b027f41b082042d0000044041b482042802000c010b3f00210341b4820441c0820536020041b0820441013a000041b88204200341107436020041c082050b2202200120026a22034b0d0141b882042802002003490440200141ffff036a220341107640002202417f460d022002411074220220034180807c716a22032002490d0241b882042003360200200120026a22032002490d020b41b4820420033602002002450d010b20002002360204200020013602000f0b000b7401017f230041106b2202240002402000413f4d04402001200041027410190c010b200041ffff004d0440200220004102744101723b010e20012002410e6a4102100e0c010b200041ffffffff034d044020004102744102722001100d0c010b20014103101920002001100d0b200241106a24000b0a00200120004120100e0b1000200120021012200220002001100e0bdb0701097f230041206b220324000240024020012802042204450d00200128020022052d000021022001200441016b3602042001200541016a36020002400240024002400240200241037141016b0e03020301000b200241027621020c030b2004410549200241034b720d03200528000121022001200441056b3602042001200541056a36020020024180808080044f0d020c030b200341196a20023a0000200341013a001820032001360214200341003b011c200341146a2003411c6a4102100c0d0220032f011c220241ff014d0d02200241027621020c010b200341196a20023a0000200341013a0018200320013602142003410036021c200341146a2003411c6a4104100c0d01200328021c220241808004490d01200241027621020b20012802042002490d00200341086a200241011011200128020422052002490d0020032802082108200328020c200128020022062002100821042001200520026b3602042001200220066a3602002008418080808078460d0002402002450d00200241076b22014100200120024d1b2109200441036a417c7120046b210a41002101034002400240024002400240024002400240024002400240200120046a2d0000220541187441187522074100480440200541ab80046a2d000041026b0e03030102080b200a20016b4103710d09200120094f0d080340200120046a220541046a280200200528020072418081828478710d092009200141086a22014b0d000b0c080b200141016a220620024f0d06200420066a2c000021060240200541e001470440200541ed01460d012007411f6a41ff0171410c490d042007417e71416e470d0820064140480d050c080b200641607141a07f460d040c070b2006419f7f4a0d060c030b200141016a220620024f0d05200420066a2c000021060240024002400240200541f0016b0e050100000002000b2007410f6a41ff017141024b0d0820064140480d020c080b200641f0006a41ff01714130490d010c070b2006418f7f4a0d060b200141026a220520024f0d05200420056a2c000041bf7f4a0d05200141036a220120024f0d05200120046a2c000041bf7f4c0d040c050b200141016a22012002490d020c040b200641404e0d030b200141026a220120024f0d02200120046a2c000041bf7f4c0d010c020b200120046a2c000041bf7f4a0d010b200141016a21010c030b20004180808080783602000c060b200120024f0d010340200120046a2c00004100480d022002200141016a2201470d000b0c030b200141016a21010b20012002490d000b0b2000200236020820002008ad2004ad422086843702000c010b20004180808080783602000b200341206a24000b3c01027f027f200145044041bc8204210141010c010b4101210241bc820441013a000041bd8204210141020b2103200120023a0000200020031018000b8e0101057f230041106b22022400200242808001370208200241bc82043602044100200241046a2205100d024020022802082206200228020c2203490d00200228020421042002410036020c2002200620036b3602082002200320046a3602042000200120051014200228020c220020022802084b0d00200420032002280204200010031a200241106a24000f0b000b0d00200041bc820420011004000b2d01017f2000280208220220002802044904402000200241016a360208200028020020026a20013a00000f0b000bdb0a02107f017e230041306b2201240002400240100f41ff01714105470d0020014180800136022041bc8204200141206a100120012802202200418180014f0d00024020004104490d00200141c0820436020c2001200041046b36021041bf82042d0000210041be82042d0000210241bd82042d00002103024041bc82042d00002204411f47044020044105472003412c4772200241da0147200041084772720d0241808080807821020c010b200341e70147200241c2004772200041ef0047720d01200141206a2001410c6a101520012802202202418080808078460d01200120012800253602182001200141286a28000036001b20012d002421060b2001200128001b36000720012001280218360204200142808001370224200141bc82043602204100200141206a2200100d2001280224220520012802282203490d01200128022021042001200520036b220536022020042003200320046a22032000100020052001280220220449720d012001200436021c200120033602182000200141186a10152001280220418080808078460d01200128021c0d012001200129022422103702102002418080808078470d0220002010a72010422088a71010230041106b22012400200141808001360208200141bc82043602040240200028020041808080807846044041bc82044181023b0100410221000c010b2001410136020c41bc820441003a000020002802042000280208200141046a1014200128020c220041818001490d00000b410020001018000b410141011016000b000b200141286a2001280007360000200120063a0024200120023602202001200128020436002523004180016b22002400200141206a2202280200210420022802042106200041086a200228020822034100101120002802082105200028020c20062003100821072001410c6a22022003360208200220073602042002200536020020004180800136021041bc8204200041106a10050240024020002802102202418180014f2002411f4d720d0041bc82042d00002102200041356a41d482042900003700002000412e6a41cd8204290000370100200041266a41c58204290000370100200041bd820429000037011e200020023a001d200041013a001c200020033602182000200636021420002004360210200042808001370264200041bc82043602604101200041e0006a2205101220002802682204418180014f0d002000410036026820004180800120046b22083602642000200441bc82046a2209360260418b8004200510132000280268220220002802644b0d0020002802602107200041d8006a220a4200370300200041d0006a220b4200370300200041c8006a220c4200370300200042003703400240200241214f0440200041f8006a220d4200370300200041f0006a220e4200370300200041e8006a220f4200370300200042003703602007200220051007200a200d290300370300200b200e290300370300200c200f290300370300200020002903603703400c010b200041406b2007200210081a0b200041f8006a200041d8006a290300370300200041f0006a200041d0006a290300370300200041e8006a200041c8006a29030037030020002000290340370360200041003602482000200836024420002009360240200041e0006a2205200041406b10132004200420002802486a22024b2002418180014f720d0020004180800120026b3602642000200241bc82046a2204360260200241808001460d00200441013a0000200041013602682000411d6a2005101320062003200510142000280268220320002802644b0d0041bc8204200220002802602003100220004180016a24000c010b000b200128021020012802141017410041001016000b8f0201057f230041206b22002400024002400240100f41ff01714105470d0020004180800136021441bc8204200041146a100120002802142201418180014f0d0020014104490d01200041c0820436020c2000200141046b36021041bf82042d0000210141be82042d0000210241bd82042d00002103024041bc82042d0000220441ed014704402004419b0147200341ae0147722002419d0147720d03200141de00460d010c030b200341cb00472002419d0147722001411b47720d02200041146a41808004410a10100c030b200041146a2000410c6a10152000280214418080808078460d010c020b000b410141011016000b2000280218200028021c101741bc820441003b0100410041021018000b0bee010200418080040bab0148656c6c6f20696e6b2101184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010041ed81040b33020202020202020202020202020202020202020202020202020202020202030303030303030303030303030303030404040404","build_info":{"build_mode":"Release","cargo_contract_version":"4.0.2","rust_toolchain":"stable-aarch64-apple-darwin","wasm_opt_settings":{"keep_debug_symbols":false,"optimization_passes":"Z"}}},"contract":{"name":"greeter","version":"0.0.1","authors":["Scio Labs "]},"image":null,"spec":{"constructors":[{"args":[{"label":"init_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":["Creates a new greeter contract initialized with the given value."],"label":"new","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0x9bae9d5e"},{"args":[],"default":false,"docs":["Creates a new greeter contract initialized to 'Hello ink!'."],"label":"default","payable":false,"returnType":{"displayName":["ink_primitives","ConstructorResult"],"type":2},"selector":"0xed4b9d1b"}],"docs":[],"environment":{"accountId":{"displayName":["AccountId"],"type":7},"balance":{"displayName":["Balance"],"type":10},"blockNumber":{"displayName":["BlockNumber"],"type":13},"chainExtension":{"displayName":["ChainExtension"],"type":14},"hash":{"displayName":["Hash"],"type":11},"maxEventTopics":4,"staticBufferSize":16384,"timestamp":{"displayName":["Timestamp"],"type":12}},"events":[{"args":[{"docs":[],"indexed":false,"label":"from","type":{"displayName":["Option"],"type":6}},{"docs":[],"indexed":false,"label":"message","type":{"displayName":["String"],"type":0}}],"docs":[],"label":"Greeted","module_path":"greeter::greeter","signature_topic":"0x184de1e97d8dba311c74fa923646f3bb4c5b0b4f747447857dbe70305dcd777e"}],"lang_error":{"displayName":["ink","LangError"],"type":4},"messages":[{"args":[],"default":false,"docs":[" Returns the current value of 'message'."],"label":"greet","mutates":false,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":5},"selector":"0x052cda08"},{"args":[{"label":"new_value","type":{"displayName":["String"],"type":0}}],"default":false,"docs":[" Sets 'message' to the given value."],"label":"set_message","mutates":true,"payable":false,"returnType":{"displayName":["ink","MessageResult"],"type":2},"selector":"0x1fe7426f"}]},"storage":{"root":{"layout":{"struct":{"fields":[{"layout":{"leaf":{"key":"0x00000000","ty":0}},"name":"message"}],"name":"Greeter"}},"root_key":"0x00000000","ty":1}},"types":[{"id":0,"type":{"def":{"primitive":"str"}}},{"id":1,"type":{"def":{"composite":{"fields":[{"name":"message","type":0,"typeName":",>>::Type"}]}},"path":["greeter","greeter","Greeter"]}},{"id":2,"type":{"def":{"variant":{"variants":[{"fields":[{"type":3}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":3},{"name":"E","type":4}],"path":["Result"]}},{"id":3,"type":{"def":{"tuple":[]}}},{"id":4,"type":{"def":{"variant":{"variants":[{"index":1,"name":"CouldNotReadInput"}]}},"path":["ink_primitives","LangError"]}},{"id":5,"type":{"def":{"variant":{"variants":[{"fields":[{"type":0}],"index":0,"name":"Ok"},{"fields":[{"type":4}],"index":1,"name":"Err"}]}},"params":[{"name":"T","type":0},{"name":"E","type":4}],"path":["Result"]}},{"id":6,"type":{"def":{"variant":{"variants":[{"index":0,"name":"None"},{"fields":[{"type":7}],"index":1,"name":"Some"}]}},"params":[{"name":"T","type":7}],"path":["Option"]}},{"id":7,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","AccountId"]}},{"id":8,"type":{"def":{"array":{"len":32,"type":9}}}},{"id":9,"type":{"def":{"primitive":"u8"}}},{"id":10,"type":{"def":{"primitive":"u128"}}},{"id":11,"type":{"def":{"composite":{"fields":[{"type":8,"typeName":"[u8; 32]"}]}},"path":["ink_primitives","types","Hash"]}},{"id":12,"type":{"def":{"primitive":"u64"}}},{"id":13,"type":{"def":{"primitive":"u32"}}},{"id":14,"type":{"def":{"variant":{}},"path":["ink_env","types","NoChainExtension"]}}],"version":5}` diff --git a/contracts/typed-contracts/data/greeter.json b/contracts/typed-contracts/data/greeter.json index 6983787..f632a8a 100644 --- a/contracts/typed-contracts/data/greeter.json +++ b/contracts/typed-contracts/data/greeter.json @@ -1,76 +1,3 @@ { - "0": { "name": "string", "isResult": false, "isPrimitive": true, "isConvertable": false }, - "2": { - "name": "Result { const { contract, address: contractAddress } = useRegisteredContract(ContractIds.Greeter) const { typedContract } = useRegisteredTypedContract(ContractIds.Greeter, GreeterContract) const [greeterMessage, setGreeterMessage] = useState() - const [fetchIsLoading, setFetchIsLoading] = useState() const form = useForm>({ resolver: zodResolver(formSchema), }) @@ -39,17 +38,19 @@ export const GreeterContractInteractions: FC = () => { const { register, reset, handleSubmit } = form // Fetch Greeting + const [fetchIsLoading, setFetchIsLoading] = useState() const fetchGreeting = async () => { if (!contract || !typedContract || !api) return setFetchIsLoading(true) try { + // Fetch via `contractQuery` const result = await contractQuery(api, '', contract, 'greet') const { output, isError, decodedOutput } = decodeOutput(result, contract, 'greet') if (isError) throw new Error(decodedOutput) setGreeterMessage(output) - // Alternatively: Fetch it with typed contract instance + // Alternatively: Fetch via `typedContract` const typedResult = await typedContract.query.greet() console.log('Result from typed contract: ', typedResult.value) } catch (e) { @@ -62,19 +63,25 @@ export const GreeterContractInteractions: FC = () => { } useEffect(() => { fetchGreeting() - }, [contract]) + }, [contract, typedContract]) // Update Greeting const updateGreeting: SubmitHandler> = async ({ newMessage }) => { - if (!activeAccount || !contract || !activeSigner || !api) { + if (!activeAccount || !contract || !typedContract || !activeSigner || !api) { toast.error('Wallet not connected. Try again…') return } try { + // Update via `contractTx` (`contractTxWithToast` respectively) await contractTxWithToast(api, activeAccount.address, contract, 'setMessage', {}, [ newMessage, ]) + + // NOTE: DOESN'T NOT WORK YET + // Alternatively: Update via `typedContract` + // await typedContract.tx.setMessage(`newMessage: ${newMessage}`) + reset() } catch (e) { console.error(e) diff --git a/package.json b/package.json index 02e745e..92e00a7 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,12 @@ "node": ">=18 <=20", "pnpm": "8" }, + "pnpm": { + "overrides": { + "@polkadot/api": ">=11", + "@polkadot/api-contract": ">=11" + } + }, "scripts": { "dev": "pnpm run -F frontend dev", "build": "pnpm run -F frontend build", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2dba9a0..5cc8720 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,10 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +overrides: + '@polkadot/api': '>=11' + '@polkadot/api-contract': '>=11' + importers: .: @@ -33,10 +37,10 @@ importers: contracts: devDependencies: '@polkadot/api': - specifier: ^11.0.2 + specifier: '>=11' version: 11.0.2 '@polkadot/api-contract': - specifier: ^11.0.2 + specifier: '>=11' version: 11.0.2 '@polkadot/keyring': specifier: ^12.6.2 @@ -66,8 +70,8 @@ importers: specifier: ^6.11.3 version: 6.11.3 '@types/node': - specifier: ^20.12.7 - version: 20.12.7 + specifier: ^20.12.8 + version: 20.12.8 '@typescript-eslint/eslint-plugin': specifier: ^7.8.0 version: 7.8.0(@typescript-eslint/parser@7.8.0)(eslint@8.57.0)(typescript@5.4.5) @@ -108,10 +112,10 @@ importers: specifier: workspace:* version: link:../contracts '@polkadot/api': - specifier: ^11.0.2 + specifier: '>=11' version: 11.0.2 '@polkadot/api-contract': - specifier: ^11.0.2 + specifier: '>=11' version: 11.0.2 '@polkadot/extension-dapp': specifier: ^0.47.3 @@ -226,8 +230,8 @@ importers: specifier: ^6.11.3 version: 6.11.3 '@types/node': - specifier: ^20.12.7 - version: 20.12.7 + specifier: ^20.12.8 + version: 20.12.8 '@types/react': specifier: ^18.3.1 version: 18.3.1 @@ -283,8 +287,8 @@ packages: resolution: {integrity: sha512-3yhZanhezcw5FZLnFb5fPJ34xEmjWy2PtYkKsqbfHrQ8Pn3xql0c0nOqrlXn2P55FzkMvnQJTqEJ5zxzUj48Cg==} engines: {node: '>=16 <=18', pnpm: '8'} peerDependencies: - '@polkadot/api': '>=10' - '@polkadot/api-contract': '>=10' + '@polkadot/api': '>=11' + '@polkadot/api-contract': '>=11' '@polkadot/types': '>=10' '@polkadot/util': '>=11.1.3' '@polkadot/util-crypto': '>=11.1.3' @@ -303,8 +307,8 @@ packages: resolution: {integrity: sha512-3eVDWMwFatpES0f9L+Ym8h5B2haC70fAkfQBOkuqjgn66dIbLV9SA97muSPJ6UhvZm32QQVYBYlQYS/MjToK8g==} engines: {node: '>=16 <=18', pnpm: '8'} peerDependencies: - '@polkadot/api': '>=10' - '@polkadot/api-contract': '>=10' + '@polkadot/api': '>=11' + '@polkadot/api-contract': '>=11' '@polkadot/types': '>=10' '@polkadot/util': '>=11.1.3' '@polkadot/util-crypto': '>=11.1.3' @@ -1379,8 +1383,8 @@ packages: resolution: {integrity: sha512-N0fOMb2Qp7ZZuGGnCzm/mHIgRL/21rv0qwW9ikHSdn8/qNkHkJ8PLJ26d8CUJU+LivkMWis41DzIY5MEHhi6Tg==} dependencies: '@nightlylabs/nightly-connect-base': 0.0.27 - '@polkadot/api': 10.13.1 - '@polkadot/extension-inject': 0.46.5(@polkadot/api@10.13.1)(@polkadot/util@12.6.2) + '@polkadot/api': 11.0.2 + '@polkadot/extension-inject': 0.46.5(@polkadot/api@11.0.2)(@polkadot/util@12.6.2) '@polkadot/types': 10.13.1 '@polkadot/util': 12.6.2 '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) @@ -1429,8 +1433,8 @@ packages: dependencies: '@nightlylabs/nightly-connect-polkadot': 0.0.16 '@nightlylabs/wallet-selector-base': 0.4.0 - '@polkadot/api': 10.10.1 - '@polkadot/extension-inject': 0.46.5(@polkadot/api@10.10.1)(@polkadot/util@12.6.2) + '@polkadot/api': 11.0.2 + '@polkadot/extension-inject': 0.46.5(@polkadot/api@11.0.2)(@polkadot/util@12.6.2) '@wallet-standard/core': 1.0.3 eventemitter3: 5.0.1 transitivePeerDependencies: @@ -1602,38 +1606,6 @@ packages: requiresBuild: true optional: true - /@polkadot/api-augment@10.10.1: - resolution: {integrity: sha512-J0r1DT1M5y75iO1iwcpUBokKD3q6b22kWlPfiHEDNFydVw5vm7OTRBk9Njjl8rOnlSzcW/Ya8qWfV/wkrqHxUQ==} - engines: {node: '>=16'} - dependencies: - '@polkadot/api-base': 10.10.1 - '@polkadot/rpc-augment': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/types-augment': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/api-augment@10.13.1: - resolution: {integrity: sha512-IAKaCp19QxgOG4HKk9RAgUgC/VNVqymZ2GXfMNOZWImZhxRIbrK+raH5vN2MbWwtVHpjxyXvGsd1RRhnohI33A==} - engines: {node: '>=18'} - dependencies: - '@polkadot/api-base': 10.13.1 - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-augment': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/api-augment@11.0.2: resolution: {integrity: sha512-Icrwk9DxcWlMxl0UFhIthYX+TzFGhxC2zwCaIgUbE5l1hoRFWl+K4BbLOtNdGTr6jkEkJizdnzbXvxWMYHZEOA==} engines: {node: '>=18'} @@ -1650,34 +1622,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/api-base@10.10.1: - resolution: {integrity: sha512-joH2Ywxnn+AStkw+JWAdF3i3WJy4NcBYp0SWJM/WqGafWR/FuHnati2pcj/MHzkHT8JkBippmSSJFvsqRhlwcQ==} - engines: {node: '>=16'} - dependencies: - '@polkadot/rpc-core': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/util': 12.6.2 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/api-base@10.13.1: - resolution: {integrity: sha512-Okrw5hjtEjqSMOG08J6qqEwlUQujTVClvY1/eZkzKwNzPelWrtV6vqfyJklB7zVhenlxfxqhZKKcY7zWSW/q5Q==} - engines: {node: '>=18'} - dependencies: - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/util': 12.6.2 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/api-base@11.0.2: resolution: {integrity: sha512-Sz1z6KHe+AyiQRxwSXU2KM0KSKZ97sc1WBEhqqkGuR3YdaV2Pt++ixSJe1FXt5/YyMI/KU0W8GSciK6Kydgxgw==} engines: {node: '>=18'} @@ -1692,24 +1636,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/api-contract@10.13.1: - resolution: {integrity: sha512-uXukO/nTyL14VkqnisaGcTfmw8UtrU3+GIwiphaOGK+Zd6BucRwBNF0Nwsx6NrhsFvFdfni5E/wCQEXD9O9VtQ==} - engines: {node: '>=18'} - dependencies: - '@polkadot/api': 10.13.1 - '@polkadot/api-augment': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/api-contract@11.0.2: resolution: {integrity: sha512-4NSwvayYfYtFKkzJmbeEO1SC8E37RA7Qp9IfuMwYL5fGd5+RTfxeh1qBgb0D2aRbAQtl3bvIvoe6GqzCLXzioQ==} engines: {node: '>=18'} @@ -1728,44 +1654,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/api-derive@10.10.1: - resolution: {integrity: sha512-Q9Ibs4eRPqdV8qnRzFPD3dlWNbLHxRqMqNTNPmNQwKPo5m6fcQbZ0UZy3yJ+PI9S4AQHGhsWtfoi5qW8006GHQ==} - engines: {node: '>=16'} - dependencies: - '@polkadot/api': 10.10.1 - '@polkadot/api-augment': 10.10.1 - '@polkadot/api-base': 10.10.1 - '@polkadot/rpc-core': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/api-derive@10.13.1: - resolution: {integrity: sha512-ef0H0GeCZ4q5Om+c61eLLLL29UxFC2/u/k8V1K2JOIU+2wD5LF7sjAoV09CBMKKHfkLenRckVk2ukm4rBqFRpg==} - engines: {node: '>=18'} - dependencies: - '@polkadot/api': 10.13.1 - '@polkadot/api-augment': 10.13.1 - '@polkadot/api-base': 10.13.1 - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/api-derive@11.0.2: resolution: {integrity: sha512-1E3alBICLBbsNJ4HvJkyIuCznuOgksS6cQ+H57K0d9NCC4xZcCqreHm+VTlZh3HZjDgw4CPDRvhgCDvDOP8KpA==} engines: {node: '>=18'} @@ -1785,58 +1673,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/api@10.10.1: - resolution: {integrity: sha512-YHVkmNvjGF4Eg3thAbVhj9UX3SXx+Yxk6yVuzsEcckEudIRHzL2ikIWGCfUprfzSeFNpUCKdJIi1tsxVHtA7Tg==} - engines: {node: '>=16'} - dependencies: - '@polkadot/api-augment': 10.10.1 - '@polkadot/api-base': 10.10.1 - '@polkadot/api-derive': 10.10.1 - '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/rpc-augment': 10.10.1 - '@polkadot/rpc-core': 10.10.1 - '@polkadot/rpc-provider': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/types-augment': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/types-create': 10.10.1 - '@polkadot/types-known': 10.10.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - eventemitter3: 5.0.1 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/api@10.13.1: - resolution: {integrity: sha512-YrKWR4TQR5CDyGkF0mloEUo7OsUA+bdtENpJGOtNavzOQUDEbxFE0PVzokzZfVfHhHX2CojPVmtzmmLxztyJkg==} - engines: {node: '>=18'} - dependencies: - '@polkadot/api-augment': 10.13.1 - '@polkadot/api-base': 10.13.1 - '@polkadot/api-derive': 10.13.1 - '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/rpc-core': 10.13.1 - '@polkadot/rpc-provider': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-augment': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 - '@polkadot/types-known': 10.13.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - eventemitter3: 5.0.1 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/api@11.0.2: resolution: {integrity: sha512-LG4gwlev+SC2WolWMX0CaUZJyZWxXbsCe5h58zFxXucQuiPAvkn0QrnSTC3hB3qywsxK6aeuQ9E2vrQYcN7EMg==} engines: {node: '>=18'} @@ -1867,7 +1703,7 @@ packages: resolution: {integrity: sha512-Ktnbb2vfaIUaVFyuajwvj18dUhRHbGzDw8Ha0K094MvfnsxDN4ntpLKRbrKzeqH/NPL2wACjiM5JmjahD5eI+Q==} engines: {node: '>=18'} peerDependencies: - '@polkadot/api': '*' + '@polkadot/api': '>=11' '@polkadot/util': '*' '@polkadot/util-crypto': '*' dependencies: @@ -1882,33 +1718,14 @@ packages: - utf-8-validate dev: false - /@polkadot/extension-inject@0.46.5(@polkadot/api@10.10.1)(@polkadot/util@12.6.2): + /@polkadot/extension-inject@0.46.5(@polkadot/api@11.0.2)(@polkadot/util@12.6.2): resolution: {integrity: sha512-QcpkCMuv7iFbWjufkw14JRozpEYFyjP0H8KOJ8IsHGfPd2DPiismQ0NXr+AS7f6U+0I+Rhv9E4dnXxtJPROVMQ==} engines: {node: '>=16'} peerDependencies: - '@polkadot/api': '*' + '@polkadot/api': '>=11' '@polkadot/util': '*' dependencies: - '@polkadot/api': 10.10.1 - '@polkadot/rpc-provider': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - '@polkadot/x-global': 12.6.2 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/extension-inject@0.46.5(@polkadot/api@10.13.1)(@polkadot/util@12.6.2): - resolution: {integrity: sha512-QcpkCMuv7iFbWjufkw14JRozpEYFyjP0H8KOJ8IsHGfPd2DPiismQ0NXr+AS7f6U+0I+Rhv9E4dnXxtJPROVMQ==} - engines: {node: '>=16'} - peerDependencies: - '@polkadot/api': '*' - '@polkadot/util': '*' - dependencies: - '@polkadot/api': 10.13.1 + '@polkadot/api': 11.0.2 '@polkadot/rpc-provider': 10.13.1 '@polkadot/types': 10.13.1 '@polkadot/util': 12.6.2 @@ -1924,7 +1741,7 @@ packages: resolution: {integrity: sha512-uIkYE/6hQall7AJ1n0S+6e5eyYWquyPr4w1Vz5p/0LScHz6rwXz9O5ogZ2SrgTrcNVeYsaikfWcjXbwbgxCxIA==} engines: {node: '>=18'} peerDependencies: - '@polkadot/api': '*' + '@polkadot/api': '>=11' '@polkadot/util': '*' dependencies: '@polkadot/api': 11.0.2 @@ -1958,34 +1775,6 @@ packages: '@substrate/ss58-registry': 1.46.0 tslib: 2.6.2 - /@polkadot/rpc-augment@10.10.1: - resolution: {integrity: sha512-PcvsX8DNV8BNDXXnY2K8F4mE7cWz7fKg8ykXNZTN8XUN6MrI4k/ohv7itYic7X5LaP25ZmQt5UiGyjKDGIELow==} - engines: {node: '>=16'} - dependencies: - '@polkadot/rpc-core': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/rpc-augment@10.13.1: - resolution: {integrity: sha512-iLsWUW4Jcx3DOdVrSHtN0biwxlHuTs4QN2hjJV0gd0jo7W08SXhWabZIf9mDmvUJIbR7Vk+9amzvegjRyIf5+A==} - engines: {node: '>=18'} - dependencies: - '@polkadot/rpc-core': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/rpc-augment@11.0.2: resolution: {integrity: sha512-QcT9U2hINcjynJhHC4AhoHNgZR5JymDkuhAIOVYsNb1BUcDzoud5lvfK+ISfw2kVPAyCdx3kHodFPhdNdPGHUg==} engines: {node: '>=18'} @@ -2000,36 +1789,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/rpc-core@10.10.1: - resolution: {integrity: sha512-awfFfJYsVF6W4DrqTj5RP00SSDRNB770FIoe1QE1Op4NcSrfeLpwh54HUJS716f4l5mOSYuvMp+zCbKzt8zKow==} - engines: {node: '>=16'} - dependencies: - '@polkadot/rpc-augment': 10.10.1 - '@polkadot/rpc-provider': 10.10.1 - '@polkadot/types': 10.10.1 - '@polkadot/util': 12.6.2 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - - /@polkadot/rpc-core@10.13.1: - resolution: {integrity: sha512-eoejSHa+/tzHm0vwic62/aptTGbph8vaBpbvLIK7gd00+rT813ROz5ckB1CqQBFB23nHRLuzzX/toY8ID3xrKw==} - engines: {node: '>=18'} - dependencies: - '@polkadot/rpc-augment': 10.13.1 - '@polkadot/rpc-provider': 10.13.1 - '@polkadot/types': 10.13.1 - '@polkadot/util': 12.6.2 - rxjs: 7.8.1 - tslib: 2.6.2 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/rpc-core@11.0.2: resolution: {integrity: sha512-kC+85+WIc/uKColIGzrnRjM47N+AjbujRkTf0n9ldwtAIYJnq+B09R3Qjmk+kXrdW5fes85L/WigqwkohMfNkw==} engines: {node: '>=18'} @@ -2045,29 +1804,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/rpc-provider@10.10.1: - resolution: {integrity: sha512-VMDWoJgx6/mPHAOT66Sq+Jf2lJABfV/ZUIXtT2k8HjOndbm6oKrFqGEOSSLvB2q4olDee3FkFFxkyW1s6k4JaQ==} - engines: {node: '>=16'} - dependencies: - '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/types': 10.10.1 - '@polkadot/types-support': 10.10.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - '@polkadot/x-fetch': 12.6.2 - '@polkadot/x-global': 12.6.2 - '@polkadot/x-ws': 12.6.2 - eventemitter3: 5.0.1 - mock-socket: 9.3.1 - nock: 13.5.4 - tslib: 2.6.2 - optionalDependencies: - '@substrate/connect': 0.7.33 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - /@polkadot/rpc-provider@10.13.1: resolution: {integrity: sha512-oJ7tatVXYJ0L7NpNiGd69D558HG5y5ZDmH2Bp9Dd4kFTQIiV8A39SlWwWUPCjSsen9lqSvvprNLnG/VHTpenbw==} engines: {node: '>=18'} @@ -2114,15 +1850,6 @@ packages: - supports-color - utf-8-validate - /@polkadot/types-augment@10.10.1: - resolution: {integrity: sha512-XRHE75IocXfFE6EADYov3pqXCyBk5SWbiHoZ0+4WYWP9SwMuzsBaAy84NlhLBlkG3+ehIqi0HpAd/qrljJGZbg==} - engines: {node: '>=16'} - dependencies: - '@polkadot/types': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - /@polkadot/types-augment@10.13.1: resolution: {integrity: sha512-TcrLhf95FNFin61qmVgOgayzQB/RqVsSg9thAso1Fh6pX4HSbvI35aGPBAn3SkA6R+9/TmtECirpSNLtIGFn0g==} engines: {node: '>=18'} @@ -2141,14 +1868,6 @@ packages: '@polkadot/util': 12.6.2 tslib: 2.6.2 - /@polkadot/types-codec@10.10.1: - resolution: {integrity: sha512-ETPG0wzWzt/bDKRQmYbO7CLe/0lUt8VrG6/bECdv+Kye+8Qedba2LZyTWm/9f2ngms8TZ82yI8mPv/mozdtfnw==} - engines: {node: '>=16'} - dependencies: - '@polkadot/util': 12.6.2 - '@polkadot/x-bigint': 12.6.2 - tslib: 2.6.2 - /@polkadot/types-codec@10.13.1: resolution: {integrity: sha512-AiQ2Vv2lbZVxEdRCN8XSERiWlOWa2cTDLnpAId78EnCtx4HLKYQSd+Jk9Y4BgO35R79mchK4iG+w6gZ+ukG2bg==} engines: {node: '>=18'} @@ -2165,14 +1884,6 @@ packages: '@polkadot/x-bigint': 12.6.2 tslib: 2.6.2 - /@polkadot/types-create@10.10.1: - resolution: {integrity: sha512-7OiLzd+Ter5zrpjP7fDwA1m89kd38VvMVixfOSv8x7ld2pDT+yyyKl14TCwRSWrKWCMtIb6M3iasPhq5cUa7cw==} - engines: {node: '>=16'} - dependencies: - '@polkadot/types-codec': 10.10.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - /@polkadot/types-create@10.13.1: resolution: {integrity: sha512-Usn1jqrz35SXgCDAqSXy7mnD6j4RvB4wyzTAZipFA6DGmhwyxxIgOzlWQWDb+1PtPKo9vtMzen5IJ+7w5chIeA==} engines: {node: '>=18'} @@ -2189,28 +1900,6 @@ packages: '@polkadot/util': 12.6.2 tslib: 2.6.2 - /@polkadot/types-known@10.10.1: - resolution: {integrity: sha512-yRa1lbDRqg3V/zoa0vSwdGOiYTIWktILW8OfkaLDExTu0GZBSbVHZlLAta52XVpA9Zww7mrUUC9+iernOwk//w==} - engines: {node: '>=16'} - dependencies: - '@polkadot/networks': 12.6.2 - '@polkadot/types': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/types-create': 10.10.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - - /@polkadot/types-known@10.13.1: - resolution: {integrity: sha512-uHjDW05EavOT5JeU8RbiFWTgPilZ+odsCcuEYIJGmK+es3lk/Qsdns9Zb7U7NJl7eJ6OWmRtyrWsLs+bU+jjIQ==} - engines: {node: '>=18'} - dependencies: - '@polkadot/networks': 12.6.2 - '@polkadot/types': 10.13.1 - '@polkadot/types-codec': 10.13.1 - '@polkadot/types-create': 10.13.1 - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - /@polkadot/types-known@11.0.2: resolution: {integrity: sha512-c89H2y2mMCjuf5X9tTadwHpJtnQvfVxlJLTlrGElfImzWNgRetIjH65Zgy/uh/I9LqTxRlk5y3ZhBMZgL/ybbg==} engines: {node: '>=18'} @@ -2222,13 +1911,6 @@ packages: '@polkadot/util': 12.6.2 tslib: 2.6.2 - /@polkadot/types-support@10.10.1: - resolution: {integrity: sha512-Cd2mwk9RG6LlX8X3H0bRY7wCTbZPqU3z38CMFhvNkFDAyjqKjtn8hpS4n8mMrZK2EwCs/MjQH1wb7rtFkaWmJw==} - engines: {node: '>=16'} - dependencies: - '@polkadot/util': 12.6.2 - tslib: 2.6.2 - /@polkadot/types-support@10.13.1: resolution: {integrity: sha512-4gEPfz36XRQIY7inKq0HXNVVhR6HvXtm7yrEmuBuhM86LE0lQQBkISUSgR358bdn2OFSLMxMoRNoh3kcDvdGDQ==} engines: {node: '>=18'} @@ -2243,19 +1925,6 @@ packages: '@polkadot/util': 12.6.2 tslib: 2.6.2 - /@polkadot/types@10.10.1: - resolution: {integrity: sha512-Ben62P1tjYEhKag34GBGcLX6NqcFR1VD5nNbWaxgr+t36Jl/tlHs6P9DlbFqQP7Tt9FmGrAYY0m3oTkhjG1NzA==} - engines: {node: '>=16'} - dependencies: - '@polkadot/keyring': 12.6.2(@polkadot/util-crypto@12.6.2)(@polkadot/util@12.6.2) - '@polkadot/types-augment': 10.10.1 - '@polkadot/types-codec': 10.10.1 - '@polkadot/types-create': 10.10.1 - '@polkadot/util': 12.6.2 - '@polkadot/util-crypto': 12.6.2(@polkadot/util@12.6.2) - rxjs: 7.8.1 - tslib: 2.6.2 - /@polkadot/types@10.13.1: resolution: {integrity: sha512-Hfvg1ZgJlYyzGSAVrDIpp3vullgxrjOlh/CSThd/PI4TTN1qHoPSFm2hs77k3mKkOzg+LrWsLE0P/LP2XddYcw==} engines: {node: '>=18'} @@ -2443,8 +2112,8 @@ packages: /@prosopo/typechain-types@1.1.15: resolution: {integrity: sha512-VZpzG/sUba6xnMsiPcFGCCDInV2o7aaJarKvGFWqaCM7I1AKIbq8hi0i6ojxKq9caMo0ZAwblSi+XR8GX+QfVg==} dependencies: - '@polkadot/api': 10.13.1 - '@polkadot/api-contract': 10.13.1 + '@polkadot/api': 11.0.2 + '@polkadot/api-contract': 11.0.2 '@types/bn.js': 5.1.5 '@types/node': 18.19.31 camelcase: 6.3.0 @@ -3004,8 +2673,8 @@ packages: engines: {node: '>=18 <=20', pnpm: '8'} peerDependencies: '@nightlylabs/wallet-selector-polkadot': '>=0.1.10' - '@polkadot/api': '>=10' - '@polkadot/api-contract': '>=10' + '@polkadot/api': '>=11' + '@polkadot/api-contract': '>=11' '@polkadot/extension-inject': '>=0.46' '@polkadot/keyring': '>=10' '@polkadot/types': '>=10' @@ -3033,11 +2702,6 @@ packages: requiresBuild: true optional: true - /@substrate/connect-extension-protocol@1.0.1: - resolution: {integrity: sha512-161JhCC1csjH3GE5mPLEd7HbWtwNSPJBg3p1Ksz9SFlTzj/bgEwudiRN2y5i0MoLGCIJRYKyKGMxVnd29PzNjg==} - requiresBuild: true - optional: true - /@substrate/connect-extension-protocol@2.0.0: resolution: {integrity: sha512-nKu8pDrE3LNCEgJjZe1iGXzaD6OSIDD4Xzz/yo4KO9mQ6LBvf49BVrt4qxBFGL6++NneLiWUZGoh+VSd4PyVIg==} requiresBuild: true @@ -3048,17 +2712,6 @@ packages: requiresBuild: true optional: true - /@substrate/connect@0.7.33: - resolution: {integrity: sha512-1B984/bmXVQvTT9oV3c3b7215lvWmulP9rfP3T3Ri+OU3uIsyCzYw0A+XG6J8/jgO2FnroeNIBWlgoLaUM1uzw==} - requiresBuild: true - dependencies: - '@substrate/connect-extension-protocol': 1.0.1 - smoldot: 2.0.1 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - optional: true - /@substrate/connect@0.8.10: resolution: {integrity: sha512-DIyQ13DDlXqVFnLV+S6/JDgiGowVRRrh18kahieJxhgvzcWicw5eLc6jpfQ0moVVLBYkO7rctB5Wreldwpva8w==} requiresBuild: true @@ -3152,7 +2805,7 @@ packages: /@types/bn.js@5.1.5: resolution: {integrity: sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==} dependencies: - '@types/node': 20.12.7 + '@types/node': 20.12.8 /@types/downloadjs@1.4.6: resolution: {integrity: sha512-mp3w70vsaiLRT9ix92fmI9Ob2yJAPZm6tShJtofo2uHbN11G2i6a0ApIEjBl/kv3e9V7Pv7jMjk1bUwYWvMHvA==} @@ -3194,8 +2847,8 @@ packages: dependencies: undici-types: 5.26.5 - /@types/node@20.12.7: - resolution: {integrity: sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==} + /@types/node@20.12.8: + resolution: {integrity: sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==} dependencies: undici-types: 5.26.5 @@ -7473,16 +7126,6 @@ packages: yargs: 15.4.1 dev: true - /smoldot@2.0.1: - resolution: {integrity: sha512-Wqw2fL/sELQByLSeeTX1Z/d0H4McmphPMx8vh6UZS/bIIDx81oU7s/drmx2iL/ME36uk++YxpRuJey8/MOyfOA==} - requiresBuild: true - dependencies: - ws: 8.17.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - optional: true - /smoldot@2.0.22: resolution: {integrity: sha512-B50vRgTY6v3baYH6uCgL15tfaag5tcS2o/P5q1OiXcKGv1axZDfz2dzzMuIkVpyMR2ug11F6EAtQlmYBQd292g==} requiresBuild: true