-
Notifications
You must be signed in to change notification settings - Fork 89
feat: make phantom great again #771
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
Merged
Merged
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
5fa4d0a
fix: add caching to Phantom wallet to prevent rate limiting
gomesalexandre 62e99f0
chore: version packages to 1.62.29-phantom-cache.0
gomesalexandre 614aab5
chore: update package.json files after publish attempt
gomesalexandre b02f6a4
chore: version packages to 1.62.29-phantom-cache.1
gomesalexandre 4ea85c9
feat: enable Polygon, Monad, and HyperEVM support for Phantom wallet
gomesalexandre 96df786
chore: version packages to 1.62.29-phantom-cache.2
gomesalexandre 3e7cd05
chore: remove comments from Phantom support flags
gomesalexandre ac05e44
feat: add Sui support to Phantom wallet
gomesalexandre ef8fe9b
chore: version packages to 1.62.29-phantom-cache.3
gomesalexandre 0526d34
feat: add EVM chain switching support to Phantom wallet
gomesalexandre d47ef60
chore: version packages to 1.62.29-phantom-cache.4
gomesalexandre 9e50a52
chore: version packages to 1.62.29-phantom-cache.5
gomesalexandre f380d39
chore: version packages to 1.62.29-phantom-cache.6
gomesalexandre 2575d5d
chore: version packages to 1.62.29-phantom-cache.7
gomesalexandre 997cad8
fix: update Sui implementation to use requestAccount API
gomesalexandre d5301e6
chore: version packages to 1.62.29-phantom-cache.8
gomesalexandre 0a29aff
chore: version packages to 1.62.29-phantom-cache.9
gomesalexandre 7b9d940
chore: version packages to 1.62.29-phantom-cache.10
gomesalexandre 828f39b
chore: version packages to 1.62.29-phantom-cache.11
gomesalexandre f17fe9e
chore: version packages to 1.62.29-phantom-cache.12
gomesalexandre 7825741
chore: version packages to 1.62.29-phantom-cache.13
gomesalexandre eac8e34
chore: version packages to 1.62.29-phantom-cache.14
gomesalexandre 72e42d5
chore: version packages to 1.62.29-phantom-sui-fix.0
gomesalexandre e1bd42f
fix: convert Phantom base64 signature to hex for chain adapter
gomesalexandre e504288
fix: extract signature parts from Phantom's combined signature to mat…
gomesalexandre 303463c
chore: clean up Phantom Sui implementation
gomesalexandre 5ebee5b
chore: apply lint fixes
gomesalexandre bdccc68
refactor: code cleanup for Phantom Sui implementation
gomesalexandre 6907f61
fix: correct Phantom Sui provider type definition
gomesalexandre 2761527
refactor: simplify code style and improve type definitions
gomesalexandre 18a2786
revert: restore all package.json, lerna.json, and yarn.lock to origin…
gomesalexandre c618ae7
feat: trigger ci
gomesalexandre be3fb47
fix: add required transactionJson property to sui test
gomesalexandre 3d986e3
Merge remote-tracking branch 'origin/master' into fix_phantom
gomesalexandre aca13b5
chore(release): publish 1.62.30
gomesalexandre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| export * from "./adapter"; | ||
| export * from "./phantom"; | ||
| export * from "./sui"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import * as core from "@shapeshiftoss/hdwallet-core"; | ||
|
|
||
| import { PhantomSuiProvider } from "./types"; | ||
|
|
||
| export async function suiGetAddress(provider: PhantomSuiProvider): Promise<string | null> { | ||
| const account = await provider.requestAccount(); | ||
|
|
||
| if (account && account.address) return account.address; | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| export async function suiSignTx(msg: core.SuiSignTx, provider: PhantomSuiProvider): Promise<core.SuiSignedTx | null> { | ||
| const account = await provider.requestAccount(); | ||
|
|
||
| const result = await provider.signTransaction({ | ||
| transaction: msg.transactionJson, | ||
| address: account.address, | ||
| networkID: "sui:mainnet", | ||
| }); | ||
|
|
||
| const fullSignatureBuffer = Buffer.from(result.signature, "base64"); | ||
|
|
||
| // Phantom returns a 97-byte signature: 1 byte flag + 64 bytes signature + 32 bytes public key | ||
| if (fullSignatureBuffer.length !== 97) { | ||
| throw new Error(`Unexpected signature length: ${fullSignatureBuffer.length} bytes (expected 97)`); | ||
| } | ||
|
|
||
| const signatureBytes = fullSignatureBuffer.slice(1, 65); | ||
| const publicKeyBytes = fullSignatureBuffer.slice(65, 97); | ||
|
|
||
| const signatureHex = signatureBytes.toString("hex"); | ||
| const publicKeyHex = publicKeyBytes.toString("hex"); | ||
|
|
||
| return { | ||
| signature: signatureHex, | ||
| publicKey: publicKeyHex, | ||
| }; | ||
| } | ||
|
|
||
| export async function suiSignMessage(message: Uint8Array, provider: PhantomSuiProvider): Promise<string | null> { | ||
| const result = await provider.signMessage(message); | ||
| return result.signature; | ||
| } | ||
|
gomesalexandre marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.