@profullstack/coinpay 0.4.1 → 0.4.2
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/bin/coinpay.js +13 -9
- package/package.json +1 -1
package/bin/coinpay.js
CHANGED
|
@@ -823,12 +823,16 @@ async function handleWallet(subcommand, args, flags) {
|
|
|
823
823
|
print.info('Importing wallet...');
|
|
824
824
|
|
|
825
825
|
try {
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
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 || '
|
|
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