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

Add runtime-api call to get OmniAccount #3148

Conversation

Kailai-Wang
Copy link
Collaborator

Context

As topic, locally tested OK

Copy link

linear bot commented Oct 28, 2024

Copy link
Contributor

@silva-fj silva-fj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

parachain/pallets/omni-account/runtime-api/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@jonalvarezz jonalvarezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Kai! 🚀

I can see it locally from the p-js explorer:
Screenshot 2024-10-28 at 11 31 01

However, I can't reach it programmatically. It should be on api.call, shouldn't it?
Screenshot 2024-10-28 at 11 32 51

I also tried forcing a client-api update off your branch to get the latest types, but i can't see it either:
Screenshot 2024-10-28 at 11 33 48

I'm not sure if this is really part of the scope of this PR, but wanted to bring it up in case we are missing anything.

@Kailai-Wang
Copy link
Collaborator Author

@jonalvarezz api.rpc requires integration in the client (node), runtime-api has/should have the advantage that it's exposed automatically by substrate-based node.

Can you try JSON-RPC with state_call or api.rpc.state.call? Method should be something like OmniAccountApi_omni_account

@jonalvarezz
Copy link
Contributor

@jonalvarezz api.rpc requires integration in the client (node), runtime-api has/should have the advantage that it's exposed automatically by substrate-based node.

Yeh exactly, I was expecting it to be exposed automatically, but I can't find it. I'm not sure what I'm missing.

Can you try JSON-RPC with state_call or api.rpc.state.call? Method should be something like OmniAccountApi_omni_account

Sweet, this one worked:

Screenshot 2024-10-28 at 18 20 01

const account = await api.rpc.state.call('OmniAccountApi_omni_account', api.createType('CorePrimitivesIdentity', {
  Substrate:
    '0x3a2647fe0ecd1fe0d450fd8650cd8bf3536ecac77b6e8ec2df1b5f5fc9d62931',
}).toHex());

I guess we can live without this types meanwhile 🤔

@Kailai-Wang
Copy link
Collaborator Author

Cool then I'll merge it

@Kailai-Wang Kailai-Wang enabled auto-merge (squash) October 29, 2024 08:14
@Kailai-Wang Kailai-Wang disabled auto-merge October 29, 2024 08:14
@Kailai-Wang Kailai-Wang enabled auto-merge (squash) October 29, 2024 08:14
@Kailai-Wang Kailai-Wang merged commit 17a8a94 into dev Oct 29, 2024
21 checks passed
@Kailai-Wang Kailai-Wang deleted the p-1118-add-an-rpc-getter-to-get-the-derived-omniaccount-address branch October 29, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants