-
Notifications
You must be signed in to change notification settings - Fork 90
feat: near chain #777
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: near chain #777
Conversation
- Add NEAR core interfaces (NearGetAddress, NearSignTx, NearSignedTx) - Add NEAR SLIP-0044 coin type 397 - Add NearAdapter for Ed25519 key derivation and signing - Add native wallet mixins (MixinNativeNearWalletInfo, MixinNativeNearWallet) - Integrate NEAR into NativeHDWallet class NEAR uses Ed25519 curve with derivation path m/44'/397'/account'/0'/0' Implicit accounts are 64-char hex of the Ed25519 public key 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdds NEAR support across the monorepo: core types and SLIP‑44 entry, native Ed25519 isolation adapter and mixins, Ledger app/transport integration, and coordinated package/version bumps to expose NEAR address and signing flows. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant NativeWallet as Native Wallet
participant NearAdapter
participant Ed25519Node as Ed25519 Node
participant Crypto as SHA-256 / Ed25519
rect rgba(200,230,255,0.20)
Note over Client,NativeWallet: Native NEAR signing flow
Client->>NativeWallet: nearSignTx(msg)
NativeWallet->>NearAdapter: signTransaction(txBytes, addressNList)
NearAdapter->>Ed25519Node: derive node for BIP32 path
NearAdapter->>Crypto: sha256(txBytes)
NearAdapter->>Crypto: ed25519.sign(hash, node)
Crypto-->>NearAdapter: signature
NearAdapter-->>NativeWallet: { signature, publicKey }
NativeWallet-->>Client: NearSignedTx
end
sequenceDiagram
participant Client
participant LedgerWallet as Ledger Wallet
participant Transport
participant LedgerApp as Ledger Device (NEAR App)
rect rgba(220,255,220,0.20)
Note over Client,LedgerApp: Ledger NEAR signing flow
Client->>LedgerWallet: nearSignTx(msg)
LedgerWallet->>Transport: nearSignTx(transport, msg)
Transport->>LedgerApp: getAddress(BIP32Path) / signTransaction(BIP32Path, txBytes)
LedgerApp-->>Transport: publicKey / signature
Transport-->>LedgerWallet: { signature, publicKey }
LedgerWallet-->>Client: NearSignedTx
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
⛔ Files ignored due to path filters (1)
📒 Files selected for processing (28)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (16)
🧰 Additional context used🧠 Learnings (7)📚 Learning: 2025-08-07T15:23:54.858ZApplied to files:
📚 Learning: 2025-08-07T15:27:03.179ZApplied to files:
📚 Learning: 2025-08-07T15:24:19.530ZApplied to files:
📚 Learning: 2025-12-09T13:48:55.139ZApplied to files:
📚 Learning: 2025-08-07T15:47:29.207ZApplied to files:
📚 Learning: 2025-08-07T15:47:26.835ZApplied to files:
📚 Learning: 2025-12-12T11:20:00.907ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (12)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/hdwallet-core/src/near.ts (1)
51-74: Prefer strict equality operators.The path validation logic is correct and properly enforces SLIP-0010 hardened derivation for Ed25519. However, use strict equality (
!==) instead of loose equality (!=) for type safety and consistency with modern JavaScript best practices.🔎 Proposed fix using strict equality
- if (path.length != 5) return unknown; - if (path[0] != 0x80000000 + 44) return unknown; - if (path[1] != 0x80000000 + slip44ByCoin("Near")) return unknown; + if (path.length !== 5) return unknown; + if (path[0] !== 0x80000000 + 44) return unknown; + if (path[1] !== 0x80000000 + slip44ByCoin("Near")) return unknown;packages/hdwallet-native/src/crypto/isolation/adapters/near.ts (1)
50-68: Consider using static import forcryptomodule.The dynamic
import("crypto")on line 56 incurs overhead on every transaction signing. Sincecryptois a Node.js built-in module always available in this context, a static import at the top of the file would be more efficient.Additionally, accessing
nodeAdapter.node.sign()directly on line 60 reaches into the internal structure. Verify this is the intended API pattern, as other adapters may use a different method signature.🔎 Proposed refactor for static crypto import
import * as core from "@shapeshiftoss/hdwallet-core"; +import { createHash } from "crypto"; import { Isolation } from "../..";Then update the usage:
- const crypto = await import("crypto"); - const messageHash = crypto.createHash("sha256").update(txBytes).digest(); + const messageHash = createHash("sha256").update(txBytes).digest();
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (34)
examples/sandbox/package.jsonintegration/package.jsonlerna.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-core/package.jsonpackages/hdwallet-core/src/index.tspackages/hdwallet-core/src/near.tspackages/hdwallet-core/src/utils.tspackages/hdwallet-gridplus/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-ledger/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-native/src/crypto/isolation/adapters/index.tspackages/hdwallet-native/src/crypto/isolation/adapters/near.tspackages/hdwallet-native/src/native.tspackages/hdwallet-native/src/near.tspackages/hdwallet-phantom/package.jsonpackages/hdwallet-portis/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-walletconnectV2/package.json
🧰 Additional context used
🧠 Learnings (13)
📓 Common learnings
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 774
File: packages/hdwallet-native/src/starknet.ts:16-18
Timestamp: 2025-12-24T17:35:53.100Z
Learning: In packages/hdwallet-native/src/ chain implementation files (e.g., tron.ts, sui.ts, solana.ts, starknet.ts), the `NextAccountPath()` methods in WalletInfo mixins conventionally throw `new Error("Method not implemented")`. This is an intentional pattern across chain families and these methods are unused.
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.
📚 Learning: 2025-12-12T11:19:53.263Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:19:53.263Z
Learning: In the shapeshift/hdwallet monorepo, remove reliance on ethSupportsNetwork() across wallet implementations. This legacy method is no longer used to determine chain support. Instead, rely on the wallet class flags like _supportsMonad, _supportsPlasma, _supportsHyperEvm. Review all wallet implementations for ethSupportsNetwork() usage and migrate checks to the corresponding _supports* flags, updating tests and any affected logic accordingly.
Applied to files:
packages/hdwallet-native/src/crypto/isolation/adapters/index.tspackages/hdwallet-core/src/index.tspackages/hdwallet-core/src/utils.tspackages/hdwallet-native/src/near.tspackages/hdwallet-core/src/near.tspackages/hdwallet-native/src/native.tspackages/hdwallet-native/src/crypto/isolation/adapters/near.ts
📚 Learning: 2025-08-07T15:47:29.207Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger/src/transport.ts:10-10
Timestamp: 2025-08-07T15:47:29.207Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the code works locally without TypeScript errors but has issues in CI environment. Using ts-expect-error would fail locally since there are no actual errors to suppress.
Applied to files:
packages/hdwallet-core/src/index.tspackages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-phantom/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-08-07T15:47:26.835Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger-webusb/src/transport.ts:12-12
Timestamp: 2025-08-07T15:47:26.835Z
Learning: In the shapeshiftoss/hdwallet monorepo, ts-ignore is used instead of ts-expect-error for Ledger transport imports because the CI environment has different type checking behavior than local development. The code works locally without errors, but CI reports type issues, so ts-ignore is necessary to suppress the inconsistent type checking across environments.
Applied to files:
packages/hdwallet-core/src/index.tspackages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-08-07T15:27:03.179Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger/package.json:36-36
Timestamp: 2025-08-07T15:27:03.179Z
Learning: In the shapeshiftoss/hdwallet monorepo, the ledgerhq/hw-transport dependency in packages/hdwallet-ledger/package.json is pinned to an exact version (without caret) due to type mismatches that occur with newer versions. Other Ledger dependencies can safely use caret ranges.
Applied to files:
packages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-core/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-phantom/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-08-07T15:23:54.858Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-coinbase/package.json:18-18
Timestamp: 2025-08-07T15:23:54.858Z
Learning: In the shapeshiftoss/hdwallet monorepo, package version bumps are done in PRs before publishing. The packages are published after the PR is merged, so dependency versions may reference unpublished versions during the PR review phase. This is expected behavior in their release workflow.
Applied to files:
packages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-core/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-phantom/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonlerna.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-08-07T15:24:19.530Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: packages/hdwallet-ledger-webusb/package.json:3-3
Timestamp: 2025-08-07T15:24:19.530Z
Learning: In the shapeshiftoss/hdwallet monorepo, the team runs `yarn build` before bumping versions and also before publishing packages. This ensures that dist/ artifacts (including UMD bundles) are properly regenerated after dependency updates.
Applied to files:
packages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-core/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-phantom/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonlerna.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-12-09T13:48:55.139Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 764
File: packages/hdwallet-gridplus/package.json:0-0
Timestamp: 2025-12-09T13:48:55.139Z
Learning: In the shapeshiftoss/hdwallet monorepo, the dist/ directory is not version controlled (not tracked in git). Build artifacts are generated during the build/publish workflow, not committed to the repository.
Applied to files:
packages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-keepkey-tcp/package.jsonpackages/hdwallet-keepkey-chromeusb/package.jsonpackages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-keepkey-electron/package.jsonpackages/hdwallet-native-vault/package.jsonpackages/hdwallet-core/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-vultisig/package.jsonpackages/hdwallet-ledger-webusb/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-trezor-connect/package.jsonpackages/hdwallet-keepkey-nodewebusb/package.jsonpackages/hdwallet-keepkey-nodehid/package.jsonpackages/hdwallet-keepkey-webusb/package.jsonpackages/hdwallet-ledger/package.jsonintegration/package.jsonpackages/hdwallet-phantom/package.jsonpackages/hdwallet-keplr/package.jsonpackages/hdwallet-keepkey/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-trezor/package.jsonpackages/hdwallet-portis/package.json
📚 Learning: 2025-12-12T11:19:53.179Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-ledger/src/ledger.ts:403-405
Timestamp: 2025-12-12T11:19:53.179Z
Learning: In packages/hdwallet-ledger/src/ethereum.ts, the ethSupportsNetwork function is a legacy/unused function that only returns true for chainId === 1. The Ledger ETH module does not call ethSupportsNetwork to validate chain support during signing operations - it accepts any chainId passed in the ETHSignTx message directly, so chain support flags can be enabled without needing to update ethSupportsNetwork.
Applied to files:
packages/hdwallet-ledger-webhid/package.jsonpackages/hdwallet-gridplus/package.json
📚 Learning: 2025-12-12T11:20:00.907Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 769
File: packages/hdwallet-walletconnectV2/src/walletconnectV2.ts:150-152
Timestamp: 2025-12-12T11:20:00.907Z
Learning: In the shapeshift/hdwallet monorepo, the `ethSupportsNetwork()` method in wallet implementations is a legacy/relic method that is no longer used. Chain support is determined by the `_supports*` flags (e.g., `_supportsMonad`, `_supportsPlasma`, `_supportsHyperEvm`) on the wallet classes, not by the `ethSupportsNetwork()` method.
Applied to files:
packages/hdwallet-native/package.jsonpackages/hdwallet-metamask-multichain/package.jsonpackages/hdwallet-walletconnect/package.jsonpackages/hdwallet-walletconnectV2/package.jsonpackages/hdwallet-gridplus/package.jsonexamples/sandbox/package.jsonpackages/hdwallet-coinbase/package.jsonpackages/hdwallet-trezor/package.json
📚 Learning: 2025-12-24T17:35:44.759Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 774
File: packages/hdwallet-native/src/starknet.ts:16-18
Timestamp: 2025-12-24T17:35:44.759Z
Learning: In the files under packages/hdwallet-native/src (e.g., tron.ts, sui.ts, solana.ts, starknet.ts), the NextAccountPath() methods in WalletInfo mixins intentionally throw new Error("Method not implemented"). These methods exist as placeholders and are not used by the chain implementations. Treat these methods as intentionally non-operational: do not call them, and consider removing or documenting them to avoid confusion. This guideline applies broadly to all chain implementation files in this directory.
Applied to files:
packages/hdwallet-native/src/near.tspackages/hdwallet-native/src/native.ts
📚 Learning: 2025-12-24T17:35:53.100Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 774
File: packages/hdwallet-native/src/starknet.ts:16-18
Timestamp: 2025-12-24T17:35:53.100Z
Learning: In packages/hdwallet-native/src/ chain implementation files (e.g., tron.ts, sui.ts, solana.ts, starknet.ts), the `NextAccountPath()` methods in WalletInfo mixins conventionally throw `new Error("Method not implemented")`. This is an intentional pattern across chain families and these methods are unused.
Applied to files:
packages/hdwallet-core/src/near.tspackages/hdwallet-native/src/crypto/isolation/adapters/near.ts
📚 Learning: 2025-08-07T15:24:34.076Z
Learnt from: gomesalexandre
Repo: shapeshift/hdwallet PR: 726
File: examples/sandbox/package.json:15-31
Timestamp: 2025-08-07T15:24:34.076Z
Learning: Lerna v6+ supports workspace protocol syntax (workspace:*) but does not automatically convert exact versions to workspace protocol during version bumps. It only preserves existing workspace protocol syntax. Teams using Lerna for automated version bumps would need manual conversion to use workspace protocol, which negates automation benefits.
Applied to files:
lerna.json
🧬 Code graph analysis (2)
packages/hdwallet-core/src/near.ts (2)
packages/hdwallet-core/src/wallet.ts (4)
BIP32Path(23-23)HDWalletInfo(303-359)HDWallet(361-476)PathDescription(88-98)packages/hdwallet-core/src/utils.ts (2)
addressNListToBIP32(96-98)slip44ByCoin(180-182)
packages/hdwallet-native/src/native.ts (2)
packages/hdwallet-native/src/near.ts (2)
MixinNativeNearWalletInfo(7-21)MixinNativeNearWallet(23-57)packages/hdwallet-core/src/near.ts (2)
NearWalletInfo(28-41)NearWallet(43-49)
🔇 Additional comments (46)
lerna.json (2)
3-3: LGTM on version bump to near-chain prerelease.The version bump to
1.62.35-near-chain.1appropriately uses prerelease versioning for the NEAR chain feature branch.
11-16: Nice formatting improvement.The multi-line array format improves readability while maintaining identical ignore patterns.
packages/hdwallet-native/src/crypto/isolation/adapters/index.ts (1)
12-12: LGTM on Near adapter export.The Near adapter export follows the established pattern and maintains alphabetical ordering.
packages/hdwallet-core/package.json (1)
3-3: LGTM on core package version bump.The version bump aligns with the monorepo-wide update for NEAR support.
packages/hdwallet-trezor/package.json (1)
3-3: LGTM on version bump and dependency update.Both the package version and
hdwallet-coredependency are correctly updated to the near-chain prerelease with appropriate caret range.Also applies to: 20-20
packages/hdwallet-trezor-connect/package.json (1)
3-3: LGTM on version bump and dependency updates.The package version and both internal dependencies are consistently updated to the near-chain prerelease with appropriate caret ranges.
Also applies to: 17-18
packages/hdwallet-coinbase/package.json (1)
3-3: LGTM on version bump and dependency update.The package version and
hdwallet-coredependency are correctly updated with appropriate caret range.Also applies to: 18-18
packages/hdwallet-keepkey-tcp/package.json (1)
3-3: LGTM on version bump and dependency updates.Consistent updates to package version and internal dependencies with appropriate caret ranges.
Also applies to: 17-18
packages/hdwallet-vultisig/package.json (1)
3-3: LGTM on version bump and dependency update.The package version and
hdwallet-coredependency are correctly updated to match the monorepo-wide near-chain prerelease.Also applies to: 20-20
packages/hdwallet-walletconnect/package.json (1)
3-3: LGTM! Consistent version coordination for NEAR chain prerelease.The version bump and dependency update align with the PR-wide near-chain prerelease versioning strategy. The caret range for the prerelease dependency is appropriate.
Also applies to: 18-18
packages/hdwallet-walletconnectV2/package.json (1)
3-3: LGTM! Version coordination matches PR-wide near-chain prerelease.The version and dependency updates are consistent with the broader prerelease strategy.
Also applies to: 18-18
packages/hdwallet-keplr/package.json (1)
3-3: LGTM! Consistent near-chain prerelease versioning.Version and dependency updates follow the established pattern across the monorepo.
Also applies to: 20-20
packages/hdwallet-ledger/package.json (1)
3-3: LGTM! Near-chain prerelease versioning applied correctly.Version bump and hdwallet-core dependency update are consistent with the PR-wide strategy. The existing hw-transport pinning strategy (without caret) remains unchanged, which is correct per established practices.
Also applies to: 31-31
packages/hdwallet-ledger-webhid/package.json (1)
3-3: LGTM! Consistent multi-dependency version coordination.Version bump and both hdwallet-core and hdwallet-ledger dependency updates are correctly aligned with the near-chain prerelease versioning.
Also applies to: 21-22
packages/hdwallet-phantom/package.json (1)
3-3: LGTM! Standard near-chain prerelease version coordination.Version and dependency updates follow the established pattern.
Also applies to: 18-18
packages/hdwallet-metamask-multichain/package.json (1)
3-3: LGTM! Near-chain prerelease versioning correctly applied.Version bump and dependency update are consistent with the monorepo-wide near-chain prerelease strategy.
Also applies to: 20-20
packages/hdwallet-core/src/index.ts (1)
22-22: LGTM! NEAR module export follows established pattern.The new NEAR export is correctly placed and follows the existing pattern for chain integrations in the core package.
packages/hdwallet-keepkey-chromeusb/package.json (1)
3-3: LGTM! Consistent version bump and dependency updates.The version bump to
1.62.35-near-chain.1and the dependency updates to use caret ranges are consistent with the broader NEAR chain integration across the monorepo.Also applies to: 17-18
packages/hdwallet-portis/package.json (1)
3-3: LGTM! Consistent version bump and dependency update.The version bump and dependency update align with the NEAR chain integration pattern across the monorepo.
Also applies to: 19-19
packages/hdwallet-native/package.json (1)
3-3: LGTM! Consistent version bump for NEAR support.The version bump and dependency update are consistent with the NEAR chain integration. This package is central to the native NEAR wallet implementation.
Also applies to: 21-21
packages/hdwallet-core/src/utils.ts (1)
163-163: LGTM! Correct SLIP-44 coin type for NEAR Protocol.The SLIP-44 standard confirms that NEAR_PROTOCOL has coin type 397, making this entry correct for NEAR blockchain support.
packages/hdwallet-ledger-webusb/package.json (1)
3-3: LGTM! Consistent version bump and dependency updates.The version bump and dependency updates are consistent with the NEAR chain integration across the monorepo.
Also applies to: 23-24
packages/hdwallet-gridplus/package.json (1)
3-3: LGTM! Consistent version bump and dependency update.The version bump and dependency update align with the broader NEAR chain integration.
Also applies to: 23-23
packages/hdwallet-native-vault/package.json (1)
3-3: LGTM! Consistent version bump and dependency update.The version bump and dependency update are consistent with the NEAR chain integration pattern.
Also applies to: 18-18
packages/hdwallet-keepkey-nodehid/package.json (1)
3-3: LGTM! Consistent version bump and dependency update.The version bump and dependency update align with the NEAR chain integration across the monorepo.
Also applies to: 17-17
packages/hdwallet-keepkey/package.json (1)
3-3: LGTM - Version bump aligns with NEAR integration.The prerelease version bump and dependency update to
^1.62.35-near-chain.1are consistent with the broader monorepo NEAR integration. Based on learnings, these unpublished version references are expected in the PR workflow, as packages are published after merge.Also applies to: 24-24
packages/hdwallet-keepkey-electron/package.json (1)
3-3: LGTM - Version bump is consistent.Version and dependency updates align with the NEAR integration prerelease across the monorepo.
Also applies to: 17-17
examples/sandbox/package.json (1)
3-3: LGTM - Comprehensive version alignment for sandbox.All hdwallet dependencies updated consistently to the NEAR prerelease version range.
Also applies to: 15-33
packages/hdwallet-keepkey-nodewebusb/package.json (1)
3-3: LGTM - Version bump is consistent.Version and dependency updates align with the broader NEAR integration.
Also applies to: 17-18
packages/hdwallet-keepkey-webusb/package.json (1)
3-3: LGTM - Version bump is consistent.Version and dependency updates align with the broader NEAR integration.
Also applies to: 17-18
packages/hdwallet-core/src/near.ts (2)
1-49: LGTM - Well-structured NEAR integration interfaces.The interfaces and type definitions follow established patterns in the hdwallet-core module. The NearWalletInfo and NearWallet interfaces properly extend HDWalletInfo and HDWallet with NEAR-specific capabilities using the
_supportsNearand_supportsNearInfoflags pattern.
76-86: LGTM - Correct NEAR derivation path implementation.The function properly implements the standard NEAR derivation path
m/44'/397'/<account>'/0'/0'with all indices hardened as required by SLIP-0010 for Ed25519. The documentation clearly explains the rationale.integration/package.json (1)
3-3: LGTM - Integration package aligned with NEAR prerelease.Version and dependency updates are consistent with the broader monorepo NEAR integration.
Also applies to: 15-24
packages/hdwallet-native/src/near.ts (2)
7-21: LGTM - NearWalletInfo mixin follows established patterns.The mixin correctly implements the NearWalletInfo interface by delegating to core helpers. The
nearNextAccountPathmethod intentionally throws "Method not implemented" as per the established pattern in chain implementation files (based on learnings from starknet.ts, solana.ts, etc.).
23-57: LGTM - NearWallet implementation is well-structured.The mixin properly implements NEAR wallet operations:
nearInitializeWalletcorrectly initializes the Ed25519 adapter and wraps it in NearAdapternearWipecleans up resources appropriatelynearGetAddressandnearSignTxproperly useneedsMnemonicguards to ensure the wallet has a mnemonic before proceeding- Async operations are handled correctly with proper error propagation
The implementation follows established patterns from other chain integrations in the native wallet.
packages/hdwallet-native/src/native.ts (8)
16-16: LGTM!Import follows the established alphabetical ordering pattern for chain imports.
138-150: LGTM!The mixin composition correctly integrates
MixinNativeNearWalletInfointo the chain, maintaining consistency with the existing pattern for Ed25519-based chains.
169-169: LGTM!Interface implementation correctly declares
core.NearWalletInfosupport.
208-209: LGTM!The
describePathcase for NEAR follows the established pattern. Other chains like Solana and Sui also use single identifiers, so this is consistent.
249-260: LGTM!The
NativeHDWalletmixin composition mirrors theNativeHDWalletInfopattern correctly, maintaining consistent ordering.
278-278: LGTM!Interface declaration is correctly placed in the implements list.
424-424: LGTM!
nearInitializeWalletcorrectly usesed25519MasterKey, consistent with NEAR's Ed25519 cryptography requirements and other Ed25519-based chains (Solana, Sui).
468-468: LGTM!
nearWipe()is correctly added to the cleanup sequence, properly grouped with other Ed25519-based chain wipes.packages/hdwallet-native/src/crypto/isolation/adapters/near.ts (3)
1-12: LGTM!Class structure follows established patterns with appropriate visibility modifiers.
23-37: LGTM!The address derivation correctly implements NEAR's implicit account format (64-character lowercase hex of Ed25519 public key) per the NEAR documentation.
86-87: LGTM!Providing both named and default exports is a common pattern for import flexibility.
- Add hw-app-near dependency to hdwallet-ledger - Implement nearGetAddress and nearSignTx for Ledger - Implement nearGetAddress, nearGetAddresses, and nearSignTx for Trezor - Add NearWalletInfo and NearWallet interface implementations - Add nearAddressNListToBIP32 utility to hdwallet-core - Add SLIP-44 397 mapping for NEAR in Ledger utils 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…Connect) Trezor Connect doesn't have nearGetAddress or nearSignTransaction methods. Their marketing page was misleading - Trezor doesn't actually support NEAR. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a1bb377 to
39b1095
Compare
NeOMakinG
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://jam.dev/c/189478c6-5174-43b8-a684-ef223c589126
Had to fix derivations paths to be equal to trust addresses but looks good with it!
8f793b8 to
fe01b0b
Compare
Implements Near chain support in hdwallet for native and Ledger.
Test me with web fren
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.