lorisleiva / solana-wallets-vue

Solana wallet integration for Vue 3
https://solana-wallets-vue-demo.netlify.app/
173 stars 65 forks source link

chore: update dependencies #33

Closed Aanhane closed 2 years ago

Aanhane commented 2 years ago

This is to tackle some recent issues with the wallet adapter package. Works on the demo site but I'm struggling to test it properly as a package. Any guidance on that would be appreciated, then I will also add it to a CONTRIBUTE.md if that's ok :).

dependencies updated:

devDepencies updated:

peerDepencies updated:

netlify[bot] commented 2 years ago

Deploy Preview for solana-wallets-vue-demo ready!

Name Link
Latest commit ceecbed26904604610f1c5d5b9fadc303a6f3c75
Latest deploy log https://app.netlify.com/sites/solana-wallets-vue-demo/deploys/630caa60de6fed00089a6289
Deploy Preview https://deploy-preview-33--solana-wallets-vue-demo.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

lorisleiva commented 2 years ago

Hi there 👋

Thanks for that! This is a very difficult library to create automated tests for by nature so sadly I use the example app all the time to ensure everything still works.

One thing I've noticed is that the auto-connect feature doesn't seem to work here. Might not have anything to do with this PR but when refreshing the page after connecting a wallet, it should automatically reconnect to it.

DjilanoS commented 2 years ago

Hi there 👋

Thanks for that! This is a very difficult library to create automated tests for by nature so sadly I use the example app all the time to ensure everything still works.

One thing I've noticed is that the auto-connect feature doesn't seem to work here. Might not have anything to do with this PR but when refreshing the page after connecting a wallet, it should automatically reconnect to it.

Hi @lorisleiva, I do think however that most of us would like to have a working SignTransaction rather than a working auto-connect upon page refresh.

For example; Your example of sending 1 lamport doesn't work as the Sign Transaction stopped working.

lorisleiva commented 2 years ago

Fair point! I wanted to make sure this was not caused by this dependency bump. Thanks for that.

lorisleiva commented 2 years ago

@DjilanoS I've published a new version with this change, would you be able to let me know if that fixed the SignTransaction issues?

DjilanoS commented 2 years ago

@DjilanoS I've published a new version with this change, would you be able to let me know if that fixed the SignTransaction issues?

Just updated the package and tried calling a signTransaction function:

image

  const sendOneLamport = async () => {
    const connection = new Connection(clusterApiUrl('devnet'))
    const { publicKey, sendTransaction } = useWallet();
    const randomAddr = Keypair.generate().publicKey
    if (!publicKey.value) return;

    console.log('pubkey ', publicKey.value)
    console.log('randomAddr ', randomAddr)

    const transaction = new Transaction().add(
      SystemProgram.transfer({
        fromPubkey: publicKey.value,
        toPubkey: randomAddr,
        lamports: 1,
      })
    );

    const latestBlockHash = await connection.getLatestBlockhash();

    const signature = await sendTransaction(transaction, connection);
    await connection.confirmTransaction({
      blockhash: latestBlockHash.blockhash,
      lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
      signature: signature
    });
  };
DjilanoS commented 2 years ago

@lorisleiva by the looks of it, it seems to be narrowed down to Phantom Wallet Adapter only. Solflare for example works just fine image

lorisleiva commented 2 years ago

It's strange though because the demo seems to be working with the latest version using Phantom. 🤔

https://solana-wallets-vue-demo.netlify.app/

Aanhane commented 2 years ago

I think the auto-connect broke upon updating wallet-adapter-base. I would like to debug this.

~@lorisleiva any tips on where I can find information on how to test my forked version? I tried using my git repo url and that works to some extent; but I get a 'cannot resolve Buffer' error. I think it's due to the fact I'm missing some steps that npm prepublish does for example? Testing my forked version will allow me to test this by hand and fix any bugs that come out of it.~

Figured out that after updating @solana/wallet-adapter-wallet the LedgerWalletAdapter requires you to provide 'Buffer' via e.g. webpack.

For now, maybe we can add a sign transaction button to the demo? Then we can open a PR and test by making changes and have at least a test-setup that also includes the sign transaction functionality?

Aanhane commented 2 years ago

@lorisleiva by the looks of it, it seems to be narrowed down to Phantom Wallet Adapter only. Solflare for example works just fine

@DjilanoS did you also update the @solana/wallet-adapter-wallets package in your project?

For me, SignTransaction works with Phantom and the new package.

Aanhane commented 2 years ago

For the auto-reconnect, maybe we need a fix like this one that was done on the Svelte Package? https://github.com/svelte-on-solana/wallet-adapter/commit/69e4ee893d3073d4c774a9af2e1674c6fcfa6fda

mdurao commented 1 year ago

I'm getting the autoConnect issue with Phantom for Android. Strangely, same codebase works ok with IOS and Web Extension.

If I disable the autoConnect, everything works ok.

@lorisleiva , is there anything I can do on my side to fix this?