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 Brave Wallet #445

Merged
merged 3 commits into from
Jun 27, 2022
Merged

Add Brave Wallet #445

merged 3 commits into from
Jun 27, 2022

Conversation

darkdh
Copy link
Contributor

@darkdh darkdh commented Jun 21, 2022

Resolve brave/brave-browser#19468

Brave has both solana.isPhantom and solana.isBraveWallet set to true for maximum compatibility
Screen Shot 2022-06-21 at 14 27 46

Brave Wallet for Solana dApp support is only available in Nightly

Copy link
Collaborator

@jordaaash jordaaash left a comment

Choose a reason for hiding this comment

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

Thanks for this! Please don't copy the Phantom adapter's behavior though.

I also want to mention that we're working on an actual wallet standard, which will be introduced soon. More context on that here and here.

When that's ready for review, I'd love to get your feedback and work on a migration plan.

packages/wallets/bravewallet/package.json Outdated Show resolved Hide resolved
packages/wallets/bravewallet/package.json Outdated Show resolved Hide resolved
packages/wallets/bravewallet/src/adapter.ts Outdated Show resolved Hide resolved
packages/wallets/bravewallet/src/adapter.ts Outdated Show resolved Hide resolved
packages/wallets/bravewallet/src/adapter.ts Outdated Show resolved Hide resolved
packages/wallets/bravewallet/src/adapter.ts Outdated Show resolved Hide resolved
@darkdh darkdh force-pushed the brave-wallet branch 2 times, most recently from 86ddf28 to 94a6cae Compare June 22, 2022 22:59
@jordaaash
Copy link
Collaborator

I'd love to review this again but the new force pushes caused the context of the review comments to all be lost. Please don't do that!

Copy link
Collaborator

@jordaaash jordaaash left a comment

Choose a reason for hiding this comment

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

LGTM, last issue is something I just discovered -- signMessage throws the wrong error type.

packages/wallets/brave/src/adapter.ts Outdated Show resolved Hide resolved
@jordaaash jordaaash merged commit dd230b8 into anza-xyz:master Jun 27, 2022
@jordaaash
Copy link
Collaborator

Thanks so much! I'll plan to release this tomorrow.

@darkdh darkdh deleted the brave-wallet branch June 28, 2022 00:31
@jordaaash
Copy link
Collaborator

Published! https://twitter.com/jordaaash/status/1541927694786600961

if (!wallet) throw new WalletNotConnectedError();

try {
return (await wallet.signTransaction(transaction)) || transaction;
Copy link
Collaborator

Choose a reason for hiding this comment

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

When would you want to return the original transaction? Is this in cases where it's already signed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That shouldn't never happen even when input transaction is signed.
Note that most of the code is inherited from Phantom adapter including this part.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool! If Brave's wallet.signTransaction can never return null, you should uninherit this part :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed here

@darkdh darkdh mentioned this pull request Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a Solana wallet adapter for Brave Wallet
5 participants