2

I am trying to interact with an Anchor project on the solana mobile stack. I have gotten the example app working and have messed around with the fakewallet/fakedapp. I want to use the AnchorWallet in order to sign transactions, but it requires the signTransaction field, which is missing on mobile.

I just used the wallet: WalletContextState and wallet.provider to do this for web. I also don't exactly understand all the caching done on the example.

This is the mobile code. The web code is exactly the same, but wallet is of type Web3MobileWallet.

enter image description here

We need the getProvider() function so that we can make getProgram() to find the Anchor Program. This is the web function here: enter image description here

3
  • Can you hone your question down to 1) what you’ve tried, and 2) where you got stuck (ie. where you expected signTransaction to be available but it wasn’t)? Specifics and code samples will help here. Commented Aug 14, 2022 at 3:19
  • @steveluscher Hey, just added the exact code snippets for the implementation. Thank you.
    – Varun Siva
    Commented Aug 14, 2022 at 3:45
  • Is my answer below what you needed, @Varun? If so, click that ‘accept’ checkmark, when you have a chance. Commented Nov 14 at 17:30

1 Answer 1

2

The raw mobile-wallet-adapter-protocol-web3js module that you’ve imported does not export a signTransactions method. The only method that it exports is a transact method. See more on how to use the raw protocol here.

You might be interested, instead, in the wallet adapter plugin @solana-mobile/wallet-adapter-mobile which does offer an interface closer to what you expect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.