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

feat: implement Ethereum, Polygon and Bitcoin with phantom #677

Merged
merged 55 commits into from
Sep 20, 2024

Conversation

NeOMakinG
Copy link
Contributor

@NeOMakinG NeOMakinG commented Sep 6, 2024

Issue

gomes notes:

neo notes:

First of all, I was thinking that the concept was pretty similar to metamask with snap at some point, so I started from this package.

The EVM part is following the EIP-1193 standard as stated in https://docs.phantom.app/ethereum-and-polygon/getting-started , so the implementation is very similar to any wallets as MetaMask.

Providers

Phantom as multiple providers, this is kinda why I had to store them all in memory, to communicate with the bitcoin part, we need to use the bitcoin provider. We only have a single provider for every EVM supporteds.

BTC TX

Phantom require to build the TX using PSBT, the logic is kinda like Native

Copy link

vercel bot commented Sep 6, 2024

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

Name Status Preview Comments Updated (UTC)
hdwallet ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 9:59pm

@NeOMakinG NeOMakinG changed the title feat: implement phantom feat: implement Ethereum, Polygon and Bitcoin with phantom Sep 9, 2024
@NeOMakinG NeOMakinG marked this pull request as ready for review September 9, 2024 09:40
@NeOMakinG NeOMakinG requested a review from a team as a code owner September 9, 2024 09:40
packages/hdwallet-phantom/src/adapter.ts Outdated Show resolved Hide resolved
}

public async pairDevice(): Promise<PhantomHDWallet | undefined> {
const evmProvider = window.phantom?.ethereum;
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: checkIsMetaMaskImpersonator will fail in web, which we may or may not have to accommodate: https://github.com/MetaMask/detect-provider/blob/4b85b3445c746b40d4a52a5679dfe357f29238c4/src/detect-ethereum-provider.ts#L31 (notably, handleSend and useStakingAction use it for MM with snaps detection

packages/hdwallet-phantom/package.json Outdated Show resolved Hide resolved
packages/hdwallet-phantom/package.json Show resolved Hide resolved
packages/hdwallet-phantom/src/adapter.ts Show resolved Hide resolved
packages/hdwallet-phantom/src/phantom.ts Outdated Show resolved Hide resolved
packages/hdwallet-phantom/src/phantom.ts Outdated Show resolved Hide resolved
packages/hdwallet-phantom/src/phantom.ts Outdated Show resolved Hide resolved
packages/hdwallet-phantom/src/phantom.ts Outdated Show resolved Hide resolved
packages/hdwallet-phantom/src/phantom.test.ts Show resolved Hide resolved
@NeOMakinG NeOMakinG marked this pull request as draft September 9, 2024 16:55
tsconfig.json Outdated Show resolved Hide resolved
@gomesalexandre gomesalexandre self-assigned this Sep 20, 2024
kaladinlight
kaladinlight previously approved these changes Sep 20, 2024
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.

Phantom Wallet Support for BTC, ETH, Poly
3 participants