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

refactor: solana sign and send transaction #2646

Merged
merged 9 commits into from
Aug 7, 2024

Conversation

zoruka
Copy link
Contributor

@zoruka zoruka commented Aug 2, 2024

Description

This PR changes the logic for Solana WalletConnect connector to send the transaction for the wallet to sign and send instead of sending in the dapp. It goes alongside with reown-com/web-examples#664.

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Associated Issues

For Linear issues: Closes APKT-xxx
For GH issues: closes #...

Showcase (Optional)

Screen.Recording.2024-08-02.at.18.32.46.mov

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections

Copy link

vercel bot commented Aug 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
web3modal-gallery ✅ Ready (Inspect) Visit Preview Aug 6, 2024 10:58pm
web3modal-laboratory ✅ Ready (Inspect) Visit Preview Aug 6, 2024 10:58pm

@enesozturk
Copy link
Contributor

enesozturk commented Aug 5, 2024

eGetting the following error while calling SIGN AND SEND TRANSACTION (WALLET) example

s.signAndSendTransaction is not a function

Steps to repro:

  • Connect with Phantom extension
  • Make sure Phantom in test mode and you're in Solana Testnet in the extension
  • Switch to Solana Testnet
  • Try SIGN AND SEND TRANSACTION (WALLET) example

The SIGN AND SEND TRANSACTION (DAPP) example works.

@zoruka
Copy link
Contributor Author

zoruka commented Aug 5, 2024

eGetting the following error while calling SIGN AND SEND TRANSACTION (WALLET) example

s.signAndSendTransaction is not a function

Steps to repro:

  • Connect with Phantom extension
  • Make sure Phantom in test mode and you're in Solana Testnet in the extension
  • Switch to Solana Testnet
  • Try SIGN AND SEND TRANSACTION (WALLET) example

The SIGN AND SEND TRANSACTION (DAPP) example works.

Good catch @enesozturk, thanks! I have added it with c741a8e

Screen.Recording.2024-08-05.at.15.17.10.mov

Comment on lines 51 to +61
<Heading size="xs" textTransform="uppercase" pb="2">
Sign and Send Transaction
Sign and Send Transaction (dApp)
</Heading>
<SolanaSendTransactionTest />
</Box>
<Box>
<Heading size="xs" textTransform="uppercase" pb="2">
Sign and Send Transaction (Wallet)
</Heading>
<SolanaSignAndSendTransaction />
</Box>
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the difference between Dapp and Wallet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dapp: the dapp request to wallet sign transaction and sends to blockchain
Wallet: the dapp request to wallet sign and send the transaction

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm I feel this is confusing, so you are doing basically

Request wallet to sign transaction => Manually send it from lab
Request wallet to sign and send transaction directly

Why send the tx from lab in the first place? isn't just requesting the signing enough?

Just a nit tho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is the two ways of doing it and both are valid: the first case is testing the signTransaction and sendTransaction functions, the second is testing signAndSendTransaction which sends for wallet handle the blockchain connection.

@tomiir
Copy link
Collaborator

tomiir commented Aug 7, 2024

Could sign a versioned tx with Phantom, but not a regular tx

@enesozturk enesozturk merged commit 2bd1578 into main Aug 7, 2024
11 checks passed
@enesozturk enesozturk deleted the refactor/solana-sign-and-send-transaction branch August 7, 2024 14:54
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.

3 participants