Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
bece7ef
feat: implement NEAR Protocol support for native wallet
gomesalexandre Dec 26, 2025
7b7a6bb
chore: version packages to 1.62.35-near-chain.0
gomesalexandre Dec 26, 2025
fdee55c
chore: version packages to 1.62.35-near-chain.1
gomesalexandre Dec 26, 2025
987189a
[skip ci] feat: skip ci
gomesalexandre Dec 27, 2025
c87c0ff
feat: add NEAR support for Ledger and Trezor hardware wallets
gomesalexandre Dec 27, 2025
82a7755
chore: version packages to 1.62.35-near-chain.2
gomesalexandre Dec 27, 2025
a5f8a8b
chore: version packages to 1.62.35-near-chain.3
gomesalexandre Dec 27, 2025
9d5b3fb
chore: version packages to 1.62.35-near-chain.4
gomesalexandre Dec 27, 2025
c8b9ef4
fix: remove NEAR support from hdwallet-trezor (unsupported by Trezor …
gomesalexandre Dec 27, 2025
e67fca4
chore: reset package.json files and npm registry to npmjs
gomesalexandre Dec 27, 2025
53ba869
chore: reset all package.json files to origin/master
gomesalexandre Dec 27, 2025
768292f
chore: reset lerna.json to origin/master
gomesalexandre Dec 27, 2025
63d04d4
chore: add @ledgerhq/hw-app-near dependency for NEAR Ledger support
gomesalexandre Dec 27, 2025
7a4a47a
fix: correct JSDoc for getPublicKey - returns hex, not ed25519:base58
gomesalexandre Dec 27, 2025
36d3cb5
chore: version packages to 1.62.35-near-implem.0
NeOMakinG Dec 30, 2025
540a1dd
fix(near): use 3-level derivation path to match Trust Wallet and othe…
NeOMakinG Dec 30, 2025
7152153
feat: revert versions
NeOMakinG Dec 30, 2025
ce3bbc7
fix: ledger derivation path
NeOMakinG Dec 30, 2025
39b1095
Merge remote-tracking branch 'origin/master' into near_chain
NeOMakinG Dec 30, 2025
66b2c76
fix: lint
NeOMakinG Dec 30, 2025
fe01b0b
chore(release): publish 1.62.36
NeOMakinG Dec 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions examples/sandbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-sandbox",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"private": true,
"browserslist": "> 0.5%, last 2 versions, not dead",
Expand All @@ -12,25 +12,25 @@
"dependencies": {
"@esm2cjs/p-queue": "^7.3.0",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-coinbase": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-gridplus": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.35",
"@shapeshiftoss/hdwallet-keplr": "1.62.35",
"@shapeshiftoss/hdwallet-ledger": "1.62.35",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.35",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.35",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.35",
"@shapeshiftoss/hdwallet-native": "1.62.35",
"@shapeshiftoss/hdwallet-phantom": "1.62.35",
"@shapeshiftoss/hdwallet-portis": "1.62.35",
"@shapeshiftoss/hdwallet-trezor": "1.62.35",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.35",
"@shapeshiftoss/hdwallet-vultisig": "1.62.35",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.35",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.35",
"@shapeshiftoss/hdwallet-coinbase": "1.62.36",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-gridplus": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.36",
"@shapeshiftoss/hdwallet-keplr": "1.62.36",
"@shapeshiftoss/hdwallet-ledger": "1.62.36",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.36",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.36",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.36",
"@shapeshiftoss/hdwallet-native": "1.62.36",
"@shapeshiftoss/hdwallet-phantom": "1.62.36",
"@shapeshiftoss/hdwallet-portis": "1.62.36",
"@shapeshiftoss/hdwallet-trezor": "1.62.36",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.36",
"@shapeshiftoss/hdwallet-vultisig": "1.62.36",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.36",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.36",
"bip32": "^2.0.4",
"eip-712": "^1.0.0",
"jquery": "^3.7.1",
Expand Down
22 changes: 11 additions & 11 deletions integration/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/integration",
"version": "1.62.35",
"version": "1.62.36",
"main": "index.js",
"license": "MIT",
"private": true,
Expand All @@ -11,16 +11,16 @@
},
"dependencies": {
"@bitcoinerlab/secp256k1": "^1.1.1",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.35",
"@shapeshiftoss/hdwallet-ledger": "1.62.35",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.35",
"@shapeshiftoss/hdwallet-native": "1.62.35",
"@shapeshiftoss/hdwallet-portis": "1.62.35",
"@shapeshiftoss/hdwallet-trezor": "1.62.35",
"@shapeshiftoss/hdwallet-vultisig": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey-nodewebusb": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey-tcp": "1.62.36",
"@shapeshiftoss/hdwallet-ledger": "1.62.36",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.36",
"@shapeshiftoss/hdwallet-native": "1.62.36",
"@shapeshiftoss/hdwallet-portis": "1.62.36",
"@shapeshiftoss/hdwallet-trezor": "1.62.36",
"@shapeshiftoss/hdwallet-vultisig": "1.62.36",
"fast-json-stable-stringify": "^2.1.0",
"msw": "^0.27.1",
"whatwg-fetch": "^3.6.2"
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "5.2.0",
"version": "1.62.35",
"version": "1.62.36",
"npmClient": "yarn",
"useWorkspaces": true,
"command": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-coinbase/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-coinbase",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -15,7 +15,7 @@
},
"dependencies": {
"@coinbase/wallet-sdk": "^3.6.6",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"eth-rpc-errors": "^4.0.3",
"lodash": "^4.17.21"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hdwallet-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-core",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand Down
1 change: 1 addition & 0 deletions packages/hdwallet-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from "./thorchain";
export * from "./solana";
export * from "./starknet";
export * from "./sui";
export * from "./near";
export * from "./transport";
export * from "./tron";
export * from "./utils";
Expand Down
91 changes: 91 additions & 0 deletions packages/hdwallet-core/src/near.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { addressNListToBIP32, ed25519Path, slip44ByCoin } from "./utils";
import { BIP32Path, HDWallet, HDWalletInfo, PathDescription } from "./wallet";

export interface NearGetAddress {
addressNList: BIP32Path;
showDisplay?: boolean;
}

export interface NearSignTx {
addressNList: BIP32Path;
/** Borsh-serialized transaction bytes to sign */
txBytes: Uint8Array;
}

export interface NearSignedTx {
signature: string;
publicKey: string;
}

export interface NearGetAccountPaths {
accountIdx: number;
}

export interface NearAccountPath {
addressNList: BIP32Path;
}

export interface NearWalletInfo extends HDWalletInfo {
readonly _supportsNearInfo: boolean;

/**
* Returns a list of bip32 paths for a given account index in preferred order
* from most to least preferred.
*/
nearGetAccountPaths(msg: NearGetAccountPaths): Array<NearAccountPath>;

/**
* Returns the "next" account path, if any.
*/
nearNextAccountPath(msg: NearAccountPath): NearAccountPath | undefined;
}

export interface NearWallet extends NearWalletInfo, HDWallet {
readonly _supportsNear: boolean;

nearGetAddress(msg: NearGetAddress): Promise<string | null>;
nearGetAddresses?(msgs: NearGetAddress[]): Promise<string[]>;
nearSignTx(msg: NearSignTx): Promise<NearSignedTx | null>;
}

export function nearDescribePath(path: BIP32Path): PathDescription {
const pathStr = addressNListToBIP32(path);
const unknown: PathDescription = {
verbose: pathStr,
coin: "Near",
isKnown: false,
};

if (path.length != 3) return unknown;
if (path[0] != 0x80000000 + 44) return unknown;
if (path[1] != 0x80000000 + slip44ByCoin("Near")) return unknown;
if ((path[2] & 0x80000000) >>> 0 !== 0x80000000) return unknown;

const index = path[2] & 0x7fffffff;
return {
verbose: `Near Account #${index}`,
accountIdx: index,
wholeAccount: true,
coin: "Near",
isKnown: true,
};
}

// The standard derivation path for NEAR is: m/44'/397'/<account>'
// This 3-level path matches Trust Wallet and other standard NEAR wallets
// NEAR uses SLIP-0010 which requires all derivation to be hardened for Ed25519
// https://docs.near.org/integrations/implicit-accounts
// https://github.com/trustwallet/wallet-core/blob/master/registry.json
export function nearGetAccountPaths(msg: NearGetAccountPaths): Array<NearAccountPath> {
const slip44 = slip44ByCoin("Near");
return [
{
addressNList: [0x80000000 + 44, 0x80000000 + slip44, 0x80000000 + msg.accountIdx],
},
];
}

// NEAR uses the Ed25519 elliptic curve for cryptographic operations, which requires all levels of the derivation path to be hardened.
export function nearAddressNListToBIP32(addressNList: BIP32Path): string {
return addressNListToBIP32(ed25519Path(addressNList));
}
1 change: 1 addition & 0 deletions packages/hdwallet-core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const slip44Table = Object.freeze({
Starknet: 9004,
Tron: 195,
Sui: 784,
Near: 397,
// EVM chains all use the same SLIP44
Ethereum: 60,
Avalanche: 60,
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-gridplus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-gridplus",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -20,7 +20,7 @@
"@ethereumjs/rlp": "5.0.2",
"@ethereumjs/tx": "5.4.0",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"bech32": "^1.1.4",
"bs58": "^5.0.0",
"bs58check": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-chromeusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-chromeusb",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35"
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36"
}
}
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey-electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-electron",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36",
"uuid": "^8.3.2"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey-nodehid/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-nodehid",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,7 +14,7 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-keepkey": "1.62.35"
"@shapeshiftoss/hdwallet-keepkey": "1.62.36"
},
"peerDependencies": {
"node-hid": "^2.1.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-nodewebusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-nodewebusb",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35"
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36"
},
"peerDependencies": {
"usb": "^2.3.1"
Expand Down
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-tcp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-tcp",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36",
"axios": "^0.21.1"
}
}
6 changes: 3 additions & 3 deletions packages/hdwallet-keepkey-webusb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey-webusb",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -14,8 +14,8 @@
"prepublishOnly": "yarn clean && yarn build"
},
"dependencies": {
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-keepkey": "1.62.35"
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/hdwallet-keepkey": "1.62.36"
},
"devDependencies": {
"@types/w3c-web-usb": "^1.0.4"
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keepkey/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keepkey",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -21,7 +21,7 @@
"@keepkey/device-protocol": "7.13.4",
"@metamask/eth-sig-util": "^7.0.0",
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.2",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/proto-tx-builder": "0.10.0",
"bignumber.js": "^9.0.1",
"bnb-javascript-sdk-nobroadcast": "2.16.15",
Expand Down
4 changes: 2 additions & 2 deletions packages/hdwallet-keplr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@shapeshiftoss/hdwallet-keplr",
"version": "1.62.35",
"version": "1.62.36",
"license": "MIT",
"publishConfig": {
"access": "public"
Expand All @@ -17,7 +17,7 @@
"@cosmjs/amino": "^0.28.13",
"@cosmjs/stargate": "^0.28.13",
"@shapeshiftoss/caip": "8.15.0",
"@shapeshiftoss/hdwallet-core": "1.62.35",
"@shapeshiftoss/hdwallet-core": "1.62.36",
"@shapeshiftoss/proto-tx-builder": "0.10.0",
"@shapeshiftoss/types": "3.1.3",
"base64-js": "^1.5.1",
Expand Down
Loading