paritytech / subxt

Interact with Substrate based nodes in Rust or WebAssembly
Other
391 stars 236 forks source link

WalletConnect example for substrate in wasm #1555

Open amiyatulu opened 2 months ago

amiyatulu commented 2 months ago

Can you provide a web3modal example for signing in transactions in Polkadot that also works in Android, using the WASM framework like Leptos or Yew?

A javascript example with wasmbindgen will do fine.

Examples given are for ethereum.

https://docs.walletconnect.com/web3modal/javascript/about

jsdw commented 2 months ago

We already have this example which uses Subxt in WASM to construct a transaction and pass it to a wallet to sign it:

https://github.com/paritytech/subxt/tree/master/examples/wasm-example

I suspect you could use that as inspiration for whatever it is you'd like to do, but haven't looked into web3modal before.

amiyatulu commented 2 months ago

I have already used the wasm example in my code, it uses the browser addon, but not sure what to do with the mobile wallet, like calling the mobile wallet. Ok, let me try the code of Wallet Connect, and then I will get back.

jsdw commented 2 months ago

Ah right, I see! We haven't tried using a library to connect to external wallets yet, but essentially you'd follow the same steps as in any normal JS dApp, with the only difference being that you'd be handed the relevant details to JS via your WASM based Subxt app (and that aspect of handing data to JS from Rust to sign stuff or whatever is covered in the WASM example) :)

If you do get something working, we'd love to see a link!