@profullstack/coinpay 0.4.1 → 0.4.3

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.
Files changed (2) hide show
  1. package/bin/coinpay.js +14 -10
  2. package/package.json +1 -1
package/bin/coinpay.js CHANGED
@@ -22,7 +22,7 @@ import { homedir } from 'os';
22
22
  import { join } from 'path';
23
23
  import { tmpdir } from 'os';
24
24
 
25
- const VERSION = '0.4.0';
25
+ const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
26
26
  const CONFIG_FILE = join(homedir(), '.coinpay.json');
27
27
  const DEFAULT_WALLET_FILE = join(homedir(), '.coinpay-wallet.gpg');
28
28
 
@@ -823,12 +823,16 @@ async function handleWallet(subcommand, args, flags) {
823
823
  print.info('Importing wallet...');
824
824
 
825
825
  try {
826
- const wallet = await WalletClient.fromSeed(mnemonic, {
827
- chains,
828
- baseUrl,
829
- });
830
-
831
- const walletId = wallet.getWalletId();
826
+ let walletId = null;
827
+ try {
828
+ const wallet = await WalletClient.fromSeed(mnemonic, {
829
+ chains,
830
+ baseUrl,
831
+ });
832
+ walletId = wallet.getWalletId();
833
+ } catch (serverErr) {
834
+ print.warn(`Server registration failed (wallet saved locally only): ${serverErr.message || serverErr}`);
835
+ }
832
836
 
833
837
  // Save encrypted locally (unless --no-save)
834
838
  if (!noSave) {
@@ -860,9 +864,9 @@ async function handleWallet(subcommand, args, flags) {
860
864
  config.walletFile = walletFile;
861
865
  saveConfig(config);
862
866
 
863
- print.success(`Wallet imported: ${walletId}`);
867
+ print.success(walletId ? `Wallet imported (ID: ${walletId})` : 'Wallet imported (local only)');
864
868
  } catch (error) {
865
- print.error(error.message);
869
+ print.error(error.message || String(error));
866
870
  }
867
871
  break;
868
872
  }
@@ -878,7 +882,7 @@ async function handleWallet(subcommand, args, flags) {
878
882
  const mnemonic = await getDecryptedMnemonic(flags);
879
883
 
880
884
  print.success('Wallet unlocked');
881
- print.info(`Wallet ID: ${config.walletId || 'unknown'}`);
885
+ print.info(`Wallet ID: ${config.walletId || '(local only)'}`);
882
886
  print.info(`Wallet file: ${walletFile}`);
883
887
 
884
888
  if (flags.show) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/coinpay",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "CoinPay SDK & CLI — Accept cryptocurrency payments (BTC, ETH, SOL, POL, BCH, USDC) with wallet and swap support",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",