@blockrun/clawrouter 0.12.27 → 0.12.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3621,13 +3621,6 @@ function deriveSolanaKeyBytes(mnemonic) {
3621
3621
  }
3622
3622
  return new Uint8Array(key);
3623
3623
  }
3624
- function deriveSolanaKeyBytesLegacy(mnemonic) {
3625
- const seed = mnemonicToSeedSync(mnemonic);
3626
- const hdKey = HDKey.fromMasterSeed(seed);
3627
- const derived = hdKey.derive("m/44'/501'/0'/0'");
3628
- if (!derived.privateKey) throw new Error("Failed to derive legacy Solana private key");
3629
- return new Uint8Array(derived.privateKey);
3630
- }
3631
3624
  function deriveAllKeys(mnemonic) {
3632
3625
  const { privateKey: evmPrivateKey, address: evmAddress } = deriveEvmKey(mnemonic);
3633
3626
  const solanaPrivateKeyBytes = deriveSolanaKeyBytes(mnemonic);
@@ -3753,32 +3746,6 @@ Then run: npx @blockrun/clawrouter`
3753
3746
  solanaPrivateKeyBytes: derived.solanaPrivateKeyBytes
3754
3747
  };
3755
3748
  }
3756
- async function logMigrationWarning(legacyKeyBytes, newKeyBytes) {
3757
- try {
3758
- const { createKeyPairSignerFromPrivateKeyBytes } = await import("@solana/kit");
3759
- const [oldSigner, newSigner] = await Promise.all([
3760
- createKeyPairSignerFromPrivateKeyBytes(legacyKeyBytes),
3761
- createKeyPairSignerFromPrivateKeyBytes(newKeyBytes)
3762
- ]);
3763
- console.log(`[ClawRouter]`);
3764
- console.log(`[ClawRouter] \u26A0 SOLANA WALLET MIGRATION DETECTED`);
3765
- console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
3766
- console.log(`[ClawRouter] Old address (secp256k1): ${oldSigner.address}`);
3767
- console.log(`[ClawRouter] New address (SLIP-10): ${newSigner.address}`);
3768
- console.log(`[ClawRouter]`);
3769
- console.log(`[ClawRouter] Your Solana wallet derivation has been fixed to use`);
3770
- console.log(`[ClawRouter] SLIP-10 Ed25519 (Phantom/Solflare compatible).`);
3771
- console.log(`[ClawRouter]`);
3772
- console.log(`[ClawRouter] If you had funds in the old wallet, run:`);
3773
- console.log(`[ClawRouter] /wallet migrate-solana`);
3774
- console.log(`[ClawRouter]`);
3775
- console.log(`[ClawRouter] The new wallet pays gas. Send ~0.005 SOL to:`);
3776
- console.log(`[ClawRouter] ${newSigner.address}`);
3777
- console.log(`[ClawRouter] \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`);
3778
- console.log(`[ClawRouter]`);
3779
- } catch {
3780
- }
3781
- }
3782
3749
  async function resolveOrGenerateWalletKey() {
3783
3750
  const saved = await loadSavedWallet();
3784
3751
  if (saved) {
@@ -3786,19 +3753,13 @@ async function resolveOrGenerateWalletKey() {
3786
3753
  const mnemonic = await loadMnemonic();
3787
3754
  if (mnemonic) {
3788
3755
  const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
3789
- const result2 = {
3756
+ return {
3790
3757
  key: saved,
3791
3758
  address: account.address,
3792
3759
  source: "saved",
3793
3760
  mnemonic,
3794
3761
  solanaPrivateKeyBytes: solanaKeyBytes
3795
3762
  };
3796
- const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
3797
- if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
3798
- result2.legacySolanaKeyBytes = legacyKeyBytes;
3799
- await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
3800
- }
3801
- return result2;
3802
3763
  }
3803
3764
  return { key: saved, address: account.address, source: "saved" };
3804
3765
  }
@@ -3808,19 +3769,13 @@ async function resolveOrGenerateWalletKey() {
3808
3769
  const mnemonic = await loadMnemonic();
3809
3770
  if (mnemonic) {
3810
3771
  const solanaKeyBytes = deriveSolanaKeyBytes(mnemonic);
3811
- const result2 = {
3772
+ return {
3812
3773
  key: envKey,
3813
3774
  address: account.address,
3814
3775
  source: "env",
3815
3776
  mnemonic,
3816
3777
  solanaPrivateKeyBytes: solanaKeyBytes
3817
3778
  };
3818
- const legacyKeyBytes = deriveSolanaKeyBytesLegacy(mnemonic);
3819
- if (Buffer.from(legacyKeyBytes).toString("hex") !== Buffer.from(solanaKeyBytes).toString("hex")) {
3820
- result2.legacySolanaKeyBytes = legacyKeyBytes;
3821
- await logMigrationWarning(legacyKeyBytes, solanaKeyBytes);
3822
- }
3823
- return result2;
3824
3779
  }
3825
3780
  return { key: envKey, address: account.address, source: "env" };
3826
3781
  }
@@ -5755,7 +5710,7 @@ async function startProxy(options) {
5755
5710
  const solanaSigner = await createKeyPairSignerFromPrivateKeyBytes(solanaPrivateKeyBytes);
5756
5711
  solanaAddress = solanaSigner.address;
5757
5712
  registerExactSvmScheme(x402, { signer: solanaSigner });
5758
- console.log(`[ClawRouter] Solana x402 scheme registered: ${solanaAddress}`);
5713
+ console.log(`[ClawRouter] Solana wallet: ${solanaAddress}`);
5759
5714
  }
5760
5715
  x402.onAfterPaymentCreation(async (context) => {
5761
5716
  const network = context.selectedRequirements.network;