Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use tx.proxy.proxy with api-cli correctly? #329

Open
hitchhooker opened this issue Jan 22, 2022 · 5 comments
Open

How to use tx.proxy.proxy with api-cli correctly? #329

hitchhooker opened this issue Jan 22, 2022 · 5 comments
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Milestone

Comments

@hitchhooker
Copy link

Receiving error when trying to commit tx.proxy commands using api-cli.

Error: Cannot find tx.proxy
    at assert (/usr/local/lib/node_modules/@polkadot/api-cli/node_modules/@polkadot/util/assert.cjs:37:11)
@jacogr
Copy link
Member

jacogr commented Jan 22, 2022

Ummm... it checks against what is on-chain in the metadata, so assuming you connected to a proxy-capable chain, it should just work. https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L188

Will try and see if I can reproduce on something like Kusama/Polkadot with proxies.

@jacogr
Copy link
Member

jacogr commented Jan 23, 2022

It indeed works as expected, i.e. tx.proxy.proxy ... args goes here... assuming the chain you are connected to has the proxy pallet. (Tested against both Kusama and Polkadot)

Which chain did you try it on?

@jacogr jacogr added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Jan 23, 2022
@jacogr
Copy link
Member

jacogr commented Jan 23, 2022

Having said all that - the nested calls (same would be the case with batch) as an issue. An example is the tx.sudo.* family that has a specific override, e.g. https://github.com/polkadot-js/tools/blob/master/packages/api-cli/src/api.ts#L138-L141 performs the wrapping.

So although it has nothing to do with your specific question (well, it is related, aka it won't work), stuff like tx.{batch, proxy, sudo}.* should actually be detected and allow wrapping, aka the CLI should know that subsequent tx.<somewhere>.<something> is a wrapped call (instead of the case with sudo where a specific flag is passed)

TL;DR Your chain may not expose tx.proxy, but as it stands it would need a lot more introspection to properly support it.

@jacogr jacogr added -size-m and removed Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. labels Jan 23, 2022
@hitchhooker
Copy link
Author

Thanks for taking time to provide support. I tried to do Kusama Democracy votes. I will post you the complete logs, perhaps it was something else wrong in transaction. Error messaging of the api-cli seems a bit tricky to understand for me still.
tx im looking to do is something like this to be able to vote using my mobile phone.

polkadot-js-api tx.proxy.proxy [ "real":"0xStashWallet", "force_proxy_type":null, "call":{ "args": { "vote": { "standard": { "vote": "0x80", "balance": 10000000000000 } }, "ref_index": 168 }, "callIndex": "0x0d02" } ] --seed "seed words"
polkadot-js-api tx.proxy.proxy [ "0xStashWallet", null, { "args": { "vote": { "standard": { "vote": "0x80", "balance": 10000000000000 } }, "ref_index": 168 }, "callIndex": "0x0d02" } ] --seed "0xPrivateKeyOfProxyWallet"

@hitchhooker
Copy link
Author

polkadot-js-api tx.proxy.proxy real:'StashWalletAddress',force_proxy_type:"Governance",call:{"args":{"ref_index":"170","vote":{"Standard":{"vote":{"conviction":"None","vote":"Aye"},"balance":1000000000000}}},"method":"vote","section":"democracy"} --seed "0xPrivateKeyOfProxy"
Error: Extrinsic proxy.proxy expects 3 arguments, got 6.

So polkadot-js-extension wallet generates following extrinsics as argument contents, but api support only 3 arguments.
I am a bit lost how should I generate this call data args correctly to be supported by api-cli?
is there cli tooling for calculating call hash data out of the call( call:{"args":{"ref_index":"170","vote":{"Standard":{"vote":{"conviction":"None","vote":"Aye"},"balance":1000000000000}}},"method":"vote","section":"democracy"})?

@hitchhooker hitchhooker changed the title add tx.proxy support to api-cli How to use tx.proxy.proxy with api-cli correctly? Jan 28, 2022
@jacogr jacogr added this to the todo milestone Mar 14, 2023
@jacogr jacogr removed the -size-m label Mar 14, 2023
@TarikGul TarikGul added the Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance. label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Projects
Development

No branches or pull requests

3 participants