zoa-wallet 0.2.7 → 0.2.8
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/index.mjs +80 -30
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -48183,21 +48183,66 @@ function registerHistoryCommand(program2) {
|
|
|
48183
48183
|
}
|
|
48184
48184
|
|
|
48185
48185
|
// dist/commands/init.js
|
|
48186
|
+
import chalk3 from "chalk";
|
|
48186
48187
|
import inquirer4 from "inquirer";
|
|
48188
|
+
var COLOR_PRESETS = [
|
|
48189
|
+
{ name: "Cyan", hex: "#00bbf9" },
|
|
48190
|
+
{ name: "Orange", hex: "#ff6b35" },
|
|
48191
|
+
{ name: "Purple", hex: "#7b2ff7" },
|
|
48192
|
+
{ name: "Green", hex: "#10b981" },
|
|
48193
|
+
{ name: "Pink", hex: "#ec4899" },
|
|
48194
|
+
{ name: "Yellow", hex: "#f59e0b" },
|
|
48195
|
+
{ name: "Red", hex: "#ef4444" },
|
|
48196
|
+
{ name: "Teal", hex: "#14b8a6" }
|
|
48197
|
+
];
|
|
48187
48198
|
function registerInitCommand(program2) {
|
|
48188
|
-
program2.command("init").description("Create a new wallet or import an existing one").option("--mnemonic <phrase>", "Provide a mnemonic phrase (non-interactive)").option("--password <password>", "Set wallet password (non-interactive)").option("--word-count <count>", "Word count for new mnemonic: 12 or 24", "12").action(async (opts) => {
|
|
48199
|
+
program2.command("init").description("Create a new wallet or import an existing one").option("--mnemonic <phrase>", "Provide a mnemonic phrase (non-interactive)").option("--password <password>", "Set wallet password (non-interactive)").option("--label <label>", "Wallet label (non-interactive)").option("--color <hex>", "Wallet color hex (non-interactive)").option("--word-count <count>", "Word count for new mnemonic: 12 or 24", "12").action(async (opts) => {
|
|
48189
48200
|
try {
|
|
48190
48201
|
let mnemonic;
|
|
48191
48202
|
let password;
|
|
48203
|
+
let label;
|
|
48204
|
+
let walletColor;
|
|
48192
48205
|
let isNew = false;
|
|
48193
48206
|
if (opts.mnemonic && opts.password) {
|
|
48194
48207
|
mnemonic = opts.mnemonic;
|
|
48195
48208
|
password = opts.password;
|
|
48209
|
+
label = opts.label || "Default Wallet";
|
|
48210
|
+
walletColor = opts.color || "#00bbf9";
|
|
48196
48211
|
} else {
|
|
48197
48212
|
if (!isJsonMode()) {
|
|
48198
48213
|
console.log(colors.brandBold(" Create or Import Wallet"));
|
|
48199
48214
|
console.log();
|
|
48200
48215
|
}
|
|
48216
|
+
const { walletLabel } = await inquirer4.prompt([{
|
|
48217
|
+
type: "input",
|
|
48218
|
+
name: "walletLabel",
|
|
48219
|
+
message: "Wallet name:",
|
|
48220
|
+
default: "My Wallet",
|
|
48221
|
+
validate: (input) => input.trim().length > 0 || "Label is required"
|
|
48222
|
+
}]);
|
|
48223
|
+
label = walletLabel;
|
|
48224
|
+
const colorChoices = COLOR_PRESETS.map((c) => ({
|
|
48225
|
+
name: `${chalk3.hex(c.hex)("\u25CF")} ${c.name}`,
|
|
48226
|
+
value: c.hex
|
|
48227
|
+
}));
|
|
48228
|
+
colorChoices.push({ name: "Custom hex...", value: "custom" });
|
|
48229
|
+
const { selectedColor } = await inquirer4.prompt([{
|
|
48230
|
+
type: "list",
|
|
48231
|
+
name: "selectedColor",
|
|
48232
|
+
message: "Choose a color:",
|
|
48233
|
+
choices: colorChoices
|
|
48234
|
+
}]);
|
|
48235
|
+
if (selectedColor === "custom") {
|
|
48236
|
+
const { customHex } = await inquirer4.prompt([{
|
|
48237
|
+
type: "input",
|
|
48238
|
+
name: "customHex",
|
|
48239
|
+
message: "Enter hex color (e.g. #ff6b35):",
|
|
48240
|
+
validate: (input) => /^#[0-9a-fA-F]{6}$/.test(input) || "Enter a valid hex color"
|
|
48241
|
+
}]);
|
|
48242
|
+
walletColor = customHex;
|
|
48243
|
+
} else {
|
|
48244
|
+
walletColor = selectedColor;
|
|
48245
|
+
}
|
|
48201
48246
|
const { action } = await inquirer4.prompt([
|
|
48202
48247
|
{
|
|
48203
48248
|
type: "list",
|
|
@@ -48245,7 +48290,7 @@ function registerInitCommand(program2) {
|
|
|
48245
48290
|
validate: (input) => input.length >= 8 || "Password must be at least 8 characters"
|
|
48246
48291
|
}
|
|
48247
48292
|
]);
|
|
48248
|
-
|
|
48293
|
+
await inquirer4.prompt([
|
|
48249
48294
|
{
|
|
48250
48295
|
type: "password",
|
|
48251
48296
|
name: "confirmPwd",
|
|
@@ -48254,7 +48299,7 @@ function registerInitCommand(program2) {
|
|
|
48254
48299
|
validate: (input) => input === pwd || "Passwords do not match"
|
|
48255
48300
|
}
|
|
48256
48301
|
]);
|
|
48257
|
-
password =
|
|
48302
|
+
password = pwd;
|
|
48258
48303
|
}
|
|
48259
48304
|
const spinner = createSpinner("Deriving keys and encrypting vault...");
|
|
48260
48305
|
if (!isJsonMode())
|
|
@@ -48268,8 +48313,8 @@ function registerInitCommand(program2) {
|
|
|
48268
48313
|
const firstAccount = accounts[0];
|
|
48269
48314
|
await addWallet({
|
|
48270
48315
|
id: walletId,
|
|
48271
|
-
label
|
|
48272
|
-
color:
|
|
48316
|
+
label,
|
|
48317
|
+
color: walletColor,
|
|
48273
48318
|
vaultKey,
|
|
48274
48319
|
createdAt: Date.now(),
|
|
48275
48320
|
evmAddress: firstAccount?.evmAddress,
|
|
@@ -48282,6 +48327,9 @@ function registerInitCommand(program2) {
|
|
|
48282
48327
|
output({
|
|
48283
48328
|
success: true,
|
|
48284
48329
|
isNew,
|
|
48330
|
+
walletId,
|
|
48331
|
+
label,
|
|
48332
|
+
color: walletColor,
|
|
48285
48333
|
account: {
|
|
48286
48334
|
index: firstAccount.index,
|
|
48287
48335
|
label: firstAccount.label,
|
|
@@ -48291,7 +48339,9 @@ function registerInitCommand(program2) {
|
|
|
48291
48339
|
...isNew ? { mnemonic } : {}
|
|
48292
48340
|
}, () => {
|
|
48293
48341
|
console.log();
|
|
48294
|
-
console.log(successBox(
|
|
48342
|
+
console.log(successBox(`Wallet: ${label}`, [
|
|
48343
|
+
kvLine("Wallet ID", walletId),
|
|
48344
|
+
kvLine("Color", chalk3.hex(walletColor)("\u25CF ") + walletColor),
|
|
48295
48345
|
kvLine("EVM Address", firstAccount.evmAddress),
|
|
48296
48346
|
kvLine("Solana", firstAccount.solanaAddress),
|
|
48297
48347
|
"",
|
|
@@ -48576,9 +48626,9 @@ function registerSendCommand(program2) {
|
|
|
48576
48626
|
}
|
|
48577
48627
|
|
|
48578
48628
|
// dist/commands/wallet.js
|
|
48579
|
-
import
|
|
48629
|
+
import chalk4 from "chalk";
|
|
48580
48630
|
import inquirer7 from "inquirer";
|
|
48581
|
-
var
|
|
48631
|
+
var COLOR_PRESETS2 = [
|
|
48582
48632
|
{ name: "Cyan", hex: "#00bbf9" },
|
|
48583
48633
|
{ name: "Orange", hex: "#ff6b35" },
|
|
48584
48634
|
{ name: "Purple", hex: "#7b2ff7" },
|
|
@@ -48645,9 +48695,9 @@ function registerWalletCommand(program2) {
|
|
|
48645
48695
|
const table = createTable(["", "Label", "ID", "EVM Address", "Solana Address", "Created", "Last Used"], [4, 22, 14, 14, 14, 14, 14]);
|
|
48646
48696
|
for (const w of wallets) {
|
|
48647
48697
|
const isActive = w.id === active?.id;
|
|
48648
|
-
const dot =
|
|
48649
|
-
const indicator = isActive ? ` ${
|
|
48650
|
-
const label = isActive ?
|
|
48698
|
+
const dot = chalk4.hex(w.color)("\u25CF");
|
|
48699
|
+
const indicator = isActive ? ` ${chalk4.hex("#f59e0b")("\u2605")}` : "";
|
|
48700
|
+
const label = isActive ? chalk4.bold(w.label) : w.label;
|
|
48651
48701
|
const created = new Date(w.createdAt).toLocaleDateString();
|
|
48652
48702
|
const lastUsed = w.lastUsedAt ? new Date(w.lastUsedAt).toLocaleDateString() : colors.muted("never");
|
|
48653
48703
|
table.push([
|
|
@@ -48703,8 +48753,8 @@ function registerWalletCommand(program2) {
|
|
|
48703
48753
|
validate: (input) => input.trim().length > 0 || "Label is required"
|
|
48704
48754
|
}]);
|
|
48705
48755
|
label = walletLabel;
|
|
48706
|
-
const colorChoices =
|
|
48707
|
-
name: `${
|
|
48756
|
+
const colorChoices = COLOR_PRESETS2.map((c) => ({
|
|
48757
|
+
name: `${chalk4.hex(c.hex)("\u25CF")} ${c.name}`,
|
|
48708
48758
|
value: c.hex
|
|
48709
48759
|
}));
|
|
48710
48760
|
colorChoices.push({ name: "Custom hex...", value: "custom" });
|
|
@@ -48851,7 +48901,7 @@ function registerWalletCommand(program2) {
|
|
|
48851
48901
|
name: "selected",
|
|
48852
48902
|
message: "Select wallet:",
|
|
48853
48903
|
choices: wallets.map((w) => ({
|
|
48854
|
-
name: `${
|
|
48904
|
+
name: `${chalk4.hex(w.color)("\u25CF")} ${w.label}${w.id === active?.id ? chalk4.hex("#f59e0b")(" \u2605 active") : ""} ${colors.muted(`(${w.id})`)}`,
|
|
48855
48905
|
value: w.id
|
|
48856
48906
|
}))
|
|
48857
48907
|
}]);
|
|
@@ -48861,7 +48911,7 @@ function registerWalletCommand(program2) {
|
|
|
48861
48911
|
const switched = wallets.find((w) => w.id === targetId);
|
|
48862
48912
|
output({ success: true, activeWalletId: targetId, label: switched.label }, () => {
|
|
48863
48913
|
console.log(`
|
|
48864
|
-
${
|
|
48914
|
+
${chalk4.hex(switched.color)("\u25CF")} Switched to ${chalk4.bold(switched.label)} ${colors.muted(`(${switched.id})`)}
|
|
48865
48915
|
`);
|
|
48866
48916
|
});
|
|
48867
48917
|
} catch (error) {
|
|
@@ -48882,7 +48932,7 @@ function registerWalletCommand(program2) {
|
|
|
48882
48932
|
await updateWallet(match.id, { label: newLabel });
|
|
48883
48933
|
output({ success: true, id: match.id, label: newLabel }, () => {
|
|
48884
48934
|
console.log(`
|
|
48885
|
-
${
|
|
48935
|
+
${chalk4.hex(match.color)("\u25CF")} Renamed to ${chalk4.bold(newLabel)} ${colors.muted(`(${match.id})`)}
|
|
48886
48936
|
`);
|
|
48887
48937
|
});
|
|
48888
48938
|
} catch (error) {
|
|
@@ -48906,7 +48956,7 @@ function registerWalletCommand(program2) {
|
|
|
48906
48956
|
await updateWallet(match.id, { color: hex });
|
|
48907
48957
|
output({ success: true, id: match.id, color: hex }, () => {
|
|
48908
48958
|
console.log(`
|
|
48909
|
-
${
|
|
48959
|
+
${chalk4.hex(hex)("\u25CF")} Updated color for ${chalk4.bold(match.label)}
|
|
48910
48960
|
`);
|
|
48911
48961
|
});
|
|
48912
48962
|
} catch (error) {
|
|
@@ -48941,7 +48991,7 @@ function registerWalletCommand(program2) {
|
|
|
48941
48991
|
await removeWallet(match.id);
|
|
48942
48992
|
output({ success: true, removed: match.id }, () => {
|
|
48943
48993
|
console.log(`
|
|
48944
|
-
${colors.error("\u2716")} Removed wallet ${
|
|
48994
|
+
${colors.error("\u2716")} Removed wallet ${chalk4.bold(match.label)} ${colors.muted(`(${match.id})`)}
|
|
48945
48995
|
`);
|
|
48946
48996
|
});
|
|
48947
48997
|
} catch (error) {
|
|
@@ -48995,9 +49045,9 @@ function registerWalletCommand(program2) {
|
|
|
48995
49045
|
solanaAddress: a.solanaAddress
|
|
48996
49046
|
}))
|
|
48997
49047
|
}, () => {
|
|
48998
|
-
console.log(sectionHeader(`${
|
|
49048
|
+
console.log(sectionHeader(`${chalk4.hex(active.color)("\u25CF")} ${active.label}`));
|
|
48999
49049
|
console.log(kvLine("ID", active.id));
|
|
49000
|
-
console.log(kvLine("Color",
|
|
49050
|
+
console.log(kvLine("Color", chalk4.hex(active.color)(active.color)));
|
|
49001
49051
|
console.log(kvLine("Created", new Date(active.createdAt).toLocaleString()));
|
|
49002
49052
|
if (active.lastUsedAt) {
|
|
49003
49053
|
console.log(kvLine("Last Used", new Date(active.lastUsedAt).toLocaleString()));
|
|
@@ -49021,7 +49071,7 @@ function registerWalletCommand(program2) {
|
|
|
49021
49071
|
}
|
|
49022
49072
|
|
|
49023
49073
|
// dist/ui/banner.js
|
|
49024
|
-
import
|
|
49074
|
+
import chalk5 from "chalk";
|
|
49025
49075
|
import figlet from "figlet";
|
|
49026
49076
|
import gradient2 from "gradient-string";
|
|
49027
49077
|
var zoaGradient2 = gradient2([
|
|
@@ -49032,7 +49082,7 @@ var zoaGradient2 = gradient2([
|
|
|
49032
49082
|
"#c77dff"
|
|
49033
49083
|
]);
|
|
49034
49084
|
var subtleGradient = gradient2(["#6b7280", "#9ca3af", "#6b7280"]);
|
|
49035
|
-
var VERSION = "0.2.
|
|
49085
|
+
var VERSION = "0.2.8";
|
|
49036
49086
|
async function displayBanner() {
|
|
49037
49087
|
const banner = figlet.textSync("ZOA-wallet", { font: "ANSI Shadow" });
|
|
49038
49088
|
console.log();
|
|
@@ -49040,20 +49090,20 @@ async function displayBanner() {
|
|
|
49040
49090
|
const tagline = " API-First Crypto Wallet for Power-traders, Developers, & AI Agents";
|
|
49041
49091
|
console.log(subtleGradient(tagline));
|
|
49042
49092
|
console.log();
|
|
49043
|
-
const versionBadge =
|
|
49044
|
-
const siteLink =
|
|
49045
|
-
const npmBadge =
|
|
49093
|
+
const versionBadge = chalk5.bgHex("#5e60ce").white.bold(` v${VERSION} `);
|
|
49094
|
+
const siteLink = chalk5.hex("#9ca3af")("https://") + chalk5.hex("#ff6b35")("wallet") + chalk5.hex("#00bbf9")(".zoa.fun");
|
|
49095
|
+
const npmBadge = chalk5.hex("#cb3837")("npm") + chalk5.hex("#6b7280")(" zoa-wallet");
|
|
49046
49096
|
let walletIndicator = "";
|
|
49047
49097
|
try {
|
|
49048
49098
|
const active = await getActiveWallet();
|
|
49049
49099
|
if (active) {
|
|
49050
|
-
walletIndicator = ` ${
|
|
49100
|
+
walletIndicator = ` ${chalk5.hex("#3b3b3b")("\u2502")} ${chalk5.hex(active.color)("\u25CF")} ${chalk5.bold(active.label)}`;
|
|
49051
49101
|
}
|
|
49052
49102
|
} catch {
|
|
49053
49103
|
}
|
|
49054
|
-
console.log(` ${versionBadge} ${
|
|
49104
|
+
console.log(` ${versionBadge} ${chalk5.hex("#3b3b3b")("\u2502")} ${siteLink} ${chalk5.hex("#3b3b3b")("\u2502")} ${npmBadge}${walletIndicator}`);
|
|
49055
49105
|
console.log();
|
|
49056
|
-
console.log(
|
|
49106
|
+
console.log(chalk5.hex("#2d2d2d")(" " + "\u2500".repeat(58)));
|
|
49057
49107
|
console.log();
|
|
49058
49108
|
}
|
|
49059
49109
|
|
|
@@ -49070,8 +49120,9 @@ program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
49070
49120
|
}
|
|
49071
49121
|
}
|
|
49072
49122
|
});
|
|
49073
|
-
program.name("zoa").description("ZOA Wallet \u2014 API-First Crypto Wallet for Power-traders, Developers, & AI Agents").version("0.2.
|
|
49123
|
+
program.name("zoa").description("ZOA Wallet \u2014 API-First Crypto Wallet for Power-traders, Developers, & AI Agents").version("0.2.8");
|
|
49074
49124
|
registerInitCommand(program);
|
|
49125
|
+
registerWalletCommand(program);
|
|
49075
49126
|
registerBalanceCommand(program);
|
|
49076
49127
|
registerSendCommand(program);
|
|
49077
49128
|
registerReceiveCommand(program);
|
|
@@ -49081,7 +49132,6 @@ registerChainsCommand(program);
|
|
|
49081
49132
|
registerPricesCommand(program);
|
|
49082
49133
|
registerConfigCommand(program);
|
|
49083
49134
|
registerApiCommand(program);
|
|
49084
|
-
registerWalletCommand(program);
|
|
49085
49135
|
if (!process.argv.slice(2).length) {
|
|
49086
49136
|
await displayBanner();
|
|
49087
49137
|
}
|
package/package.json
CHANGED