Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ This skill automates the complete hdwallet local publish pipeline.

This skill runs the complete hdwallet publish pipeline:

### 0. Verify verdaccio setup (FIRST TIME ONLY)
Only needed if this is the first time setting up verdaccio in these repos.
### 0. Configure registry for Verdaccio (REQUIRED - FIRST PUBLISH IN SESSION)
**IMPORTANT:** This must be done at the START of every new Claude session before any publish.
The registry config does NOT persist between Claude sessions.

Run in both repos:
- `yarn config set npmRegistryServer http://127.0.0.1:4873 && npm set registry http://127.0.0.1:4873`
Run in BOTH repos (hdwallet AND web):
```bash
yarn config set npmRegistryServer http://127.0.0.1:4873 && npm set registry http://127.0.0.1:4873
```

Verify with: `npm config get registry` (should show `http://127.0.0.1:4873`)

Once configured, this persists across runs.
Once configured for this session, follow-up publishes don't need to run this again.

### 1. Build hdwallet
In the hdwallet repo (`../shapeshiftHdWallet`, or whichever is the path for hdwallet):
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,24 @@
"@shapeshiftoss/chain-adapters": "workspace:^",
"@shapeshiftoss/contracts": "workspace:^",
"@shapeshiftoss/errors": "workspace:^",
"@shapeshiftoss/hdwallet-coinbase": "1.62.38",
"@shapeshiftoss/hdwallet-core": "1.62.38",
"@shapeshiftoss/hdwallet-gridplus": "1.62.38",
"@shapeshiftoss/hdwallet-keepkey": "1.62.38",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.38",
"@shapeshiftoss/hdwallet-keplr": "1.62.38",
"@shapeshiftoss/hdwallet-ledger": "1.62.38",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.38",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.38",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.38",
"@shapeshiftoss/hdwallet-native": "1.62.38",
"@shapeshiftoss/hdwallet-native-vault": "1.62.38",
"@shapeshiftoss/hdwallet-phantom": "1.62.38",
"@shapeshiftoss/hdwallet-trezor": "1.62.38",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.38",
"@shapeshiftoss/hdwallet-vultisig": "1.62.38",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.38",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.38",
"@shapeshiftoss/hdwallet-coinbase": "1.62.39",
"@shapeshiftoss/hdwallet-core": "1.62.39",
"@shapeshiftoss/hdwallet-gridplus": "1.62.39",
"@shapeshiftoss/hdwallet-keepkey": "1.62.39",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.39",
"@shapeshiftoss/hdwallet-keplr": "1.62.39",
"@shapeshiftoss/hdwallet-ledger": "1.62.39",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.39",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.39",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.39",
"@shapeshiftoss/hdwallet-native": "1.62.39",
"@shapeshiftoss/hdwallet-native-vault": "1.62.39",
"@shapeshiftoss/hdwallet-phantom": "1.62.39",
"@shapeshiftoss/hdwallet-trezor": "1.62.39",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.39",
"@shapeshiftoss/hdwallet-vultisig": "1.62.39",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.39",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.39",
"@shapeshiftoss/swapper": "workspace:^",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
Expand Down
4 changes: 2 additions & 2 deletions packages/chain-adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"@near-js/transactions": "^2.5.1",
"@near-js/utils": "^2.5.1",
"@shapeshiftoss/caip": "workspace:^",
"@shapeshiftoss/hdwallet-core": "1.62.38",
"@shapeshiftoss/hdwallet-ledger": "1.62.38",
"@shapeshiftoss/hdwallet-core": "1.62.39",
"@shapeshiftoss/hdwallet-ledger": "1.62.39",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
"@shapeshiftoss/utils": "workspace:^",
Expand Down
35 changes: 26 additions & 9 deletions packages/chain-adapters/src/evm/EvmBaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
: toHex(BigInt(account.chainSpecific.nonce))

const txToSign = {
addressNList: toAddressNList(this.getBip44Params({ accountNumber })),
addressNList: input.addressNList ?? toAddressNList(this.getBip44Params({ accountNumber })),
value: toHex(isTokenSend ? 0n : BigInt(value)),
to: isTokenSend ? contractAddress : to,
chainId: Number(fromChainId(this.chainId).chainReference),
Expand All @@ -368,7 +368,13 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
this.assertSupportsChain(input.wallet)

const from = await this.getAddress(input)
const txToSign = await this.buildSendApiTransaction({ ...input, from })

const addressNList = input.wallet.ethGetAccountPaths?.({
coin: 'Ethereum',
accountIdx: input.accountNumber,
})?.[0]?.addressNList

const txToSign = await this.buildSendApiTransaction({ ...input, from, addressNList })

return { txToSign }
} catch (err) {
Expand Down Expand Up @@ -587,9 +593,12 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
this.assertSupportsChain(wallet)
await verifyLedgerAppOpen(this.chainId, wallet)

const bip44Params = this.getBip44Params({ accountNumber })
const addressNList =
wallet.ethGetAccountPaths?.({ coin: 'Ethereum', accountIdx: accountNumber })?.[0]
?.addressNList ?? toAddressNList(this.getBip44Params({ accountNumber }))

const address = await wallet.ethGetAddress({
addressNList: toAddressNList(bip44Params),
addressNList,
showDisplay: showOnDevice,
})

Expand All @@ -613,9 +622,12 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
// Check if wallet supports batch address derivation (Trezor currently, but any wallet could implement ethGetAddresses)
if (wallet.ethGetAddresses) {
const msgs = accountNumbers.map(accountNumber => {
const bip44Params = this.getBip44Params({ accountNumber })
const addressNList =
wallet.ethGetAccountPaths?.({ coin: 'Ethereum', accountIdx: accountNumber })?.[0]
?.addressNList ?? toAddressNList(this.getBip44Params({ accountNumber }))

return {
addressNList: toAddressNList(bip44Params),
addressNList,
showDisplay: false,
}
})
Expand Down Expand Up @@ -696,9 +708,8 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
}
: { gasPrice: toHex(gasPrice ? BigInt(gasPrice) : 0n) }

const bip44Params = this.getBip44Params({ accountNumber })
const txToSign = {
addressNList: toAddressNList(bip44Params),
addressNList: input.addressNList ?? toAddressNList(this.getBip44Params({ accountNumber })),
value: toHex(BigInt(value)),
to,
chainId: Number(fromChainId(this.chainId).chainReference),
Expand All @@ -723,7 +734,13 @@ export abstract class EvmBaseAdapter<T extends EvmChainId> implements IChainAdap
this.assertSupportsChain(wallet)

const from = await this.getAddress({ accountNumber, wallet, pubKey })
const txToSign = await this.buildCustomApiTx({ ...input, from })

const addressNList = wallet.ethGetAccountPaths?.({
coin: 'Ethereum',
accountIdx: accountNumber,
})?.[0]?.addressNList

const txToSign = await this.buildCustomApiTx({ ...input, from, addressNList })

return { txToSign }
} catch (err) {
Expand Down
6 changes: 5 additions & 1 deletion packages/chain-adapters/src/evm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export type BuildCustomTxInput = {
pubKey?: string
} & NetworkFees

export type BuildCustomApiTxInput = Omit<BuildCustomTxInput, 'wallet'> & { from: string }
export type BuildCustomApiTxInput = Omit<BuildCustomTxInput, 'wallet'> & {
from: string
/** Optional override for wallet-specific derivation paths (e.g., BIP44 vs Ledger Live) */
addressNList?: number[]
}

export type BuildTxInput = {
gasLimit: string
Expand Down
2 changes: 2 additions & 0 deletions packages/chain-adapters/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ export type BuildSendTxInput<T extends ChainId> = {

export type BuildSendApiTxInput<T extends KnownChainIds> = Omit<BuildSendTxInput<T>, 'wallet'> & {
from: string
/** Optional override for wallet-specific derivation paths (e.g., BIP44 vs Ledger Live) */
addressNList?: number[]
}

export type UtxoBuildSendApiTxInput<T extends UtxoChainId> = Omit<BuildSendTxInput<T>, 'wallet'> & {
Expand Down
2 changes: 1 addition & 1 deletion packages/swapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@shapeshiftoss/caip": "workspace:^",
"@shapeshiftoss/chain-adapters": "workspace:^",
"@shapeshiftoss/contracts": "workspace:^",
"@shapeshiftoss/hdwallet-core": "1.62.38",
"@shapeshiftoss/hdwallet-core": "1.62.39",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
"@shapeshiftoss/utils": "workspace:^",
Expand Down