nansen-cli 1.10.0 → 1.11.0

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/src/wallet.js CHANGED
@@ -519,7 +519,7 @@ export function buildWalletCommands(deps = {}) {
519
519
  log(` Base (recommended, lower fees): send USDC to ${result.evm}`);
520
520
  log(` Solana: send USDC to ${result.solana}`);
521
521
  log('');
522
- return result;
522
+ return;
523
523
  } catch (err) {
524
524
  log(`❌ ${err.message}`);
525
525
  exit(1);
@@ -530,7 +530,7 @@ export function buildWalletCommands(deps = {}) {
530
530
  const result = listWallets();
531
531
  if (result.wallets.length === 0) {
532
532
  log('No wallets found. Create one with: nansen wallet create');
533
- return result;
533
+ return;
534
534
  }
535
535
  log('');
536
536
  for (const w of result.wallets) {
@@ -540,7 +540,6 @@ export function buildWalletCommands(deps = {}) {
540
540
  log(` Solana: ${w.solana}`);
541
541
  log('');
542
542
  }
543
- return result;
544
543
  },
545
544
 
546
545
  'show': async () => {
@@ -557,7 +556,7 @@ export function buildWalletCommands(deps = {}) {
557
556
  log(` EVM: ${result.evm}`);
558
557
  log(` Solana: ${result.solana}`);
559
558
  log(` Created: ${result.createdAt}\n`);
560
- return result;
559
+ return;
561
560
  } catch (err) {
562
561
  log(`❌ ${err.message}`);
563
562
  exit(1);
@@ -582,7 +581,7 @@ export function buildWalletCommands(deps = {}) {
582
581
  log(` Address: ${result.solana.address}`);
583
582
  log(` Private Key: ${result.solana.privateKey}`);
584
583
  log('');
585
- return result;
584
+ return;
586
585
  } catch (err) {
587
586
  log(`❌ ${err.message}`);
588
587
  exit(1);
@@ -599,7 +598,7 @@ export function buildWalletCommands(deps = {}) {
599
598
  try {
600
599
  const result = setDefaultWallet(name);
601
600
  log(`✓ Default wallet set to "${result.defaultWallet}"`);
602
- return result;
601
+ return;
603
602
  } catch (err) {
604
603
  log(`❌ ${err.message}`);
605
604
  exit(1);
@@ -620,7 +619,7 @@ export function buildWalletCommands(deps = {}) {
620
619
  if (result.newDefault) {
621
620
  log(` New default: ${result.newDefault}`);
622
621
  }
623
- return result;
622
+ return;
624
623
  } catch (err) {
625
624
  log(`❌ ${err.message}`);
626
625
  exit(1);
@@ -675,37 +674,32 @@ export function buildWalletCommands(deps = {}) {
675
674
  if (dryRun) {
676
675
  // Build the transaction but don't broadcast
677
676
  const result = await sendTokens(sendOpts);
678
- const output = {
679
- dryRun: true,
680
- from: result.from,
681
- to: options.to,
682
- amount: result.amount || (isMax ? 'max' : String(options.amount)),
683
- token: options.token || '(native)',
684
- chain: options.chain,
685
- ...(result.estimatedFee ? { estimatedFee: result.estimatedFee } : {}),
686
- };
687
- log(JSON.stringify(output, null, 2));
688
- return output;
677
+ log(`\nDry run transaction not broadcast\n`);
678
+ log(` From: ${result.from}`);
679
+ log(` To: ${options.to}`);
680
+ log(` Amount: ${result.amount || (isMax ? 'max' : String(options.amount))}`);
681
+ log(` Token: ${options.token || '(native)'}`);
682
+ log(` Chain: ${options.chain}`);
683
+ if (result.estimatedFee) log(` Fee: ${result.estimatedFee}`);
684
+ log('');
685
+ return;
689
686
  }
690
687
 
691
688
  const result = await sendTokens(sendOpts);
692
-
693
- const output = {
694
- success: true,
695
- transactionHash: result.transactionHash,
696
- confirmed: result.confirmed,
697
- ...(result.blockNumber ? { blockNumber: result.blockNumber } : {}),
698
- from: result.from,
699
- to: result.to,
700
- amount: result.amount,
701
- token: result.token,
702
- chain: result.chain,
703
- explorer: result.explorer,
704
- };
705
- log(JSON.stringify(output, null, 2));
706
- return output;
689
+ log(`\n✓ Transaction sent\n`);
690
+ log(` Tx Hash: ${result.transactionHash}`);
691
+ log(` Chain: ${result.chain}`);
692
+ log(` From: ${result.from}`);
693
+ log(` To: ${result.to}`);
694
+ log(` Amount: ${result.amount}`);
695
+ log(` Token: ${result.token}`);
696
+ if (result.blockNumber) log(` Block: ${result.blockNumber}`);
697
+ log(` Status: ${result.confirmed ? 'confirmed' : 'pending'}`);
698
+ log(` Explorer: ${result.explorer}`);
699
+ log('');
700
+ return;
707
701
  } catch (err) {
708
- log(JSON.stringify({ success: false, error: err.message }));
702
+ log(`Error: ${err.message}`);
709
703
  exit(1);
710
704
  }
711
705
  },
@@ -749,15 +743,14 @@ EXAMPLES:
749
743
  nansen wallet send --to 0x742d35Cc... --amount 1.5 --chain evm
750
744
  nansen wallet send --to 9WzDXw... --amount 0.1 --chain solana --token So11...
751
745
  `);
752
- return {
753
- commands: ['create', 'list', 'show', 'export', 'default', 'delete', 'send'],
754
- description: 'Local wallet management for EVM and Solana',
755
- };
746
+ return;
756
747
  },
757
748
  };
758
749
 
759
750
  if (!handlers[subcommand]) {
760
- return { error: `Unknown subcommand: ${subcommand}`, available: Object.keys(handlers) };
751
+ log(`Unknown subcommand: ${subcommand}. Available: ${Object.keys(handlers).join(', ')}`);
752
+ exit(1);
753
+ return;
761
754
  }
762
755
 
763
756
  return handlers[subcommand]();