@trustwallet/cli 0.12.0 → 0.12.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/dist/commands/wallet.d.ts.map +1 -1
- package/dist/index.js +229 -106
- package/dist/password.d.ts +12 -0
- package/dist/password.d.ts.map +1 -0
- package/dist/setup/phase-harnesses.d.ts +2 -0
- package/dist/setup/phase-harnesses.d.ts.map +1 -1
- package/dist/setup/phase-wallet.d.ts +1 -1
- package/dist/setup/phase-wallet.d.ts.map +1 -1
- package/dist/setup/skills.d.ts +7 -0
- package/dist/setup/skills.d.ts.map +1 -0
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6CpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAktB5D"}
|
package/dist/index.js
CHANGED
|
@@ -4366,12 +4366,12 @@ var init_dist = __esm({
|
|
|
4366
4366
|
});
|
|
4367
4367
|
|
|
4368
4368
|
// ../storage/dist/index.mjs
|
|
4369
|
-
function deriveKey(
|
|
4370
|
-
return crypto22.pbkdf2Sync(
|
|
4369
|
+
function deriveKey(password3, salt) {
|
|
4370
|
+
return crypto22.pbkdf2Sync(password3, salt, ITERATIONS, KEY_LENGTH, "sha256");
|
|
4371
4371
|
}
|
|
4372
|
-
function encrypt(plaintext,
|
|
4372
|
+
function encrypt(plaintext, password3) {
|
|
4373
4373
|
const salt = crypto22.randomBytes(SALT_LENGTH);
|
|
4374
|
-
const key = deriveKey(
|
|
4374
|
+
const key = deriveKey(password3, salt);
|
|
4375
4375
|
const iv = crypto22.randomBytes(IV_LENGTH);
|
|
4376
4376
|
const cipher = crypto22.createCipheriv(ALGORITHM, key, iv);
|
|
4377
4377
|
let encrypted = cipher.update(plaintext, "utf-8", "hex");
|
|
@@ -4383,9 +4383,9 @@ function encrypt(plaintext, password2) {
|
|
|
4383
4383
|
salt: salt.toString("hex")
|
|
4384
4384
|
};
|
|
4385
4385
|
}
|
|
4386
|
-
function decrypt(data,
|
|
4386
|
+
function decrypt(data, password3) {
|
|
4387
4387
|
const salt = Buffer.from(data.salt, "hex");
|
|
4388
|
-
const key = deriveKey(
|
|
4388
|
+
const key = deriveKey(password3, salt);
|
|
4389
4389
|
const iv = Buffer.from(data.iv, "hex");
|
|
4390
4390
|
const decipher = crypto22.createDecipheriv(ALGORITHM, key, iv);
|
|
4391
4391
|
decipher.setAuthTag(Buffer.from(data.authTag, "hex"));
|
|
@@ -4489,8 +4489,8 @@ var init_dist2 = __esm({
|
|
|
4489
4489
|
async getWalletPassword() {
|
|
4490
4490
|
return getPassword(SERVICE, WALLET_ACCOUNT);
|
|
4491
4491
|
}
|
|
4492
|
-
async saveWalletPassword(
|
|
4493
|
-
new import_keyring.Entry(SERVICE, WALLET_ACCOUNT).setPassword(
|
|
4492
|
+
async saveWalletPassword(password3) {
|
|
4493
|
+
new import_keyring.Entry(SERVICE, WALLET_ACCOUNT).setPassword(password3);
|
|
4494
4494
|
}
|
|
4495
4495
|
async deleteWalletPassword() {
|
|
4496
4496
|
new import_keyring.Entry(SERVICE, WALLET_ACCOUNT).deletePassword();
|
|
@@ -4582,8 +4582,8 @@ var init_dist2 = __esm({
|
|
|
4582
4582
|
constructor(config2) {
|
|
4583
4583
|
this.store = new FileStore(config2);
|
|
4584
4584
|
}
|
|
4585
|
-
async saveMnemonic(mnemonic,
|
|
4586
|
-
const encrypted = encrypt(mnemonic,
|
|
4585
|
+
async saveMnemonic(mnemonic, password3, chains) {
|
|
4586
|
+
const encrypted = encrypt(mnemonic, password3);
|
|
4587
4587
|
const config2 = {
|
|
4588
4588
|
encryptedMnemonic: encrypted.ciphertext,
|
|
4589
4589
|
iv: encrypted.iv,
|
|
@@ -4594,7 +4594,7 @@ var init_dist2 = __esm({
|
|
|
4594
4594
|
};
|
|
4595
4595
|
await this.store.write(WALLET_FILE, config2);
|
|
4596
4596
|
}
|
|
4597
|
-
async loadMnemonic(
|
|
4597
|
+
async loadMnemonic(password3) {
|
|
4598
4598
|
const config2 = await this.store.read(WALLET_FILE);
|
|
4599
4599
|
if (!config2) {
|
|
4600
4600
|
throw new Error("No wallet configuration found");
|
|
@@ -4605,7 +4605,7 @@ var init_dist2 = __esm({
|
|
|
4605
4605
|
authTag: config2.authTag,
|
|
4606
4606
|
salt: config2.salt
|
|
4607
4607
|
};
|
|
4608
|
-
return decrypt(encrypted,
|
|
4608
|
+
return decrypt(encrypted, password3);
|
|
4609
4609
|
}
|
|
4610
4610
|
async exists() {
|
|
4611
4611
|
return this.store.exists(WALLET_FILE);
|
|
@@ -7723,9 +7723,9 @@ var init_dist3 = __esm({
|
|
|
7723
7723
|
throw new Error("Wallet is locked. Re-authenticate to continue.");
|
|
7724
7724
|
}
|
|
7725
7725
|
this.reconnecting = (async () => {
|
|
7726
|
-
const
|
|
7726
|
+
const password3 = await this.passwordResolver();
|
|
7727
7727
|
const store = new WalletConfigStore();
|
|
7728
|
-
const mnemonic = await store.loadMnemonic(
|
|
7728
|
+
const mnemonic = await store.loadMnemonic(password3);
|
|
7729
7729
|
this.signer = await WalletCoreSigner.fromMnemonic(mnemonic);
|
|
7730
7730
|
this.blockchainClient = new BlockchainClient(this.signer);
|
|
7731
7731
|
this.connected = true;
|
|
@@ -7736,26 +7736,26 @@ var init_dist3 = __esm({
|
|
|
7736
7736
|
this.reconnecting = null;
|
|
7737
7737
|
}
|
|
7738
7738
|
}
|
|
7739
|
-
static async create(
|
|
7739
|
+
static async create(password3) {
|
|
7740
7740
|
const walletCore2 = getWalletCore();
|
|
7741
7741
|
const hdWallet = walletCore2.HDWallet.create(128, "");
|
|
7742
7742
|
const mnemonic = hdWallet.mnemonic();
|
|
7743
7743
|
const store = new WalletConfigStore();
|
|
7744
|
-
await store.saveMnemonic(mnemonic,
|
|
7744
|
+
await store.saveMnemonic(mnemonic, password3, Object.keys(CHAINS));
|
|
7745
7745
|
const signer = WalletCoreSigner.fromHDWallet(hdWallet);
|
|
7746
7746
|
const client = new BlockchainClient(signer);
|
|
7747
7747
|
return new _AgentWalletProvider(signer, client);
|
|
7748
7748
|
}
|
|
7749
|
-
static async fromStorage(
|
|
7749
|
+
static async fromStorage(password3) {
|
|
7750
7750
|
const store = new WalletConfigStore();
|
|
7751
|
-
const mnemonic = await store.loadMnemonic(
|
|
7751
|
+
const mnemonic = await store.loadMnemonic(password3);
|
|
7752
7752
|
const signer = await WalletCoreSigner.fromMnemonic(mnemonic);
|
|
7753
7753
|
const client = new BlockchainClient(signer);
|
|
7754
7754
|
return new _AgentWalletProvider(signer, client);
|
|
7755
7755
|
}
|
|
7756
|
-
static async fromMnemonic(mnemonic,
|
|
7756
|
+
static async fromMnemonic(mnemonic, password3) {
|
|
7757
7757
|
const store = new WalletConfigStore();
|
|
7758
|
-
await store.saveMnemonic(mnemonic,
|
|
7758
|
+
await store.saveMnemonic(mnemonic, password3, Object.keys(CHAINS));
|
|
7759
7759
|
const signer = await WalletCoreSigner.fromMnemonic(mnemonic);
|
|
7760
7760
|
const client = new BlockchainClient(signer);
|
|
7761
7761
|
return new _AgentWalletProvider(signer, client);
|
|
@@ -14441,11 +14441,11 @@ var require_util3 = __commonJS({
|
|
|
14441
14441
|
return false;
|
|
14442
14442
|
}
|
|
14443
14443
|
exports2.schemaHasRules = schemaHasRules;
|
|
14444
|
-
function schemaHasRulesButRef(schema,
|
|
14444
|
+
function schemaHasRulesButRef(schema, RULES2) {
|
|
14445
14445
|
if (typeof schema == "boolean")
|
|
14446
14446
|
return !schema;
|
|
14447
14447
|
for (const key in schema)
|
|
14448
|
-
if (key !== "$ref" &&
|
|
14448
|
+
if (key !== "$ref" && RULES2.all[key])
|
|
14449
14449
|
return true;
|
|
14450
14450
|
return false;
|
|
14451
14451
|
}
|
|
@@ -15839,17 +15839,17 @@ var require_validate = __commonJS({
|
|
|
15839
15839
|
}
|
|
15840
15840
|
function schemaKeywords(it4, types, typeErrors, errsCount) {
|
|
15841
15841
|
const { gen: gen2, schema, data, allErrors, opts, self: self2 } = it4;
|
|
15842
|
-
const { RULES } = self2;
|
|
15843
|
-
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema,
|
|
15844
|
-
gen2.block(() => keywordCode(it4, "$ref",
|
|
15842
|
+
const { RULES: RULES2 } = self2;
|
|
15843
|
+
if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES2))) {
|
|
15844
|
+
gen2.block(() => keywordCode(it4, "$ref", RULES2.all.$ref.definition));
|
|
15845
15845
|
return;
|
|
15846
15846
|
}
|
|
15847
15847
|
if (!opts.jtd)
|
|
15848
15848
|
checkStrictTypes(it4, types);
|
|
15849
15849
|
gen2.block(() => {
|
|
15850
|
-
for (const group of
|
|
15850
|
+
for (const group of RULES2.rules)
|
|
15851
15851
|
groupKeywords(group);
|
|
15852
|
-
groupKeywords(
|
|
15852
|
+
groupKeywords(RULES2.post);
|
|
15853
15853
|
});
|
|
15854
15854
|
function groupKeywords(group) {
|
|
15855
15855
|
if (!(0, applicability_1.shouldUseGroup)(schema, group))
|
|
@@ -17551,10 +17551,10 @@ var require_core = __commonJS({
|
|
|
17551
17551
|
}
|
|
17552
17552
|
// Remove keyword
|
|
17553
17553
|
removeKeyword(keyword) {
|
|
17554
|
-
const { RULES } = this;
|
|
17555
|
-
delete
|
|
17556
|
-
delete
|
|
17557
|
-
for (const group of
|
|
17554
|
+
const { RULES: RULES2 } = this;
|
|
17555
|
+
delete RULES2.keywords[keyword];
|
|
17556
|
+
delete RULES2.all[keyword];
|
|
17557
|
+
for (const group of RULES2.rules) {
|
|
17558
17558
|
const i2 = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
17559
17559
|
if (i2 >= 0)
|
|
17560
17560
|
group.rules.splice(i2, 1);
|
|
@@ -17722,9 +17722,9 @@ var require_core = __commonJS({
|
|
|
17722
17722
|
}
|
|
17723
17723
|
var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
17724
17724
|
function checkKeyword(keyword, def) {
|
|
17725
|
-
const { RULES } = this;
|
|
17725
|
+
const { RULES: RULES2 } = this;
|
|
17726
17726
|
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
17727
|
-
if (
|
|
17727
|
+
if (RULES2.keywords[kwd])
|
|
17728
17728
|
throw new Error(`Keyword ${kwd} is already defined`);
|
|
17729
17729
|
if (!KEYWORD_NAME.test(kwd))
|
|
17730
17730
|
throw new Error(`Keyword ${kwd} has invalid name`);
|
|
@@ -17740,13 +17740,13 @@ var require_core = __commonJS({
|
|
|
17740
17740
|
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
17741
17741
|
if (dataType && post)
|
|
17742
17742
|
throw new Error('keyword with "post" flag cannot have "type"');
|
|
17743
|
-
const { RULES } = this;
|
|
17744
|
-
let ruleGroup = post ?
|
|
17743
|
+
const { RULES: RULES2 } = this;
|
|
17744
|
+
let ruleGroup = post ? RULES2.post : RULES2.rules.find(({ type: t }) => t === dataType);
|
|
17745
17745
|
if (!ruleGroup) {
|
|
17746
17746
|
ruleGroup = { type: dataType, rules: [] };
|
|
17747
|
-
|
|
17747
|
+
RULES2.rules.push(ruleGroup);
|
|
17748
17748
|
}
|
|
17749
|
-
|
|
17749
|
+
RULES2.keywords[keyword] = true;
|
|
17750
17750
|
if (!definition)
|
|
17751
17751
|
return;
|
|
17752
17752
|
const rule = {
|
|
@@ -17761,7 +17761,7 @@ var require_core = __commonJS({
|
|
|
17761
17761
|
addBeforeRule.call(this, ruleGroup, rule, definition.before);
|
|
17762
17762
|
else
|
|
17763
17763
|
ruleGroup.rules.push(rule);
|
|
17764
|
-
|
|
17764
|
+
RULES2.all[keyword] = rule;
|
|
17765
17765
|
(_a2 = definition.implements) === null || _a2 === void 0 ? void 0 : _a2.forEach((kwd) => this.addKeyword(kwd));
|
|
17766
17766
|
}
|
|
17767
17767
|
function addBeforeRule(ruleGroup, rule, before) {
|
|
@@ -38944,8 +38944,8 @@ async function tryRegisterWallet() {
|
|
|
38944
38944
|
if (!await store.exists()) return;
|
|
38945
38945
|
try {
|
|
38946
38946
|
const creds = await ensureTrustSDK();
|
|
38947
|
-
const
|
|
38948
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
38947
|
+
const password3 = await resolvePassword();
|
|
38948
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
38949
38949
|
await registerWalletWithBackend(creds, provider);
|
|
38950
38950
|
info("Wallet registered with backend");
|
|
38951
38951
|
} catch {
|
|
@@ -39312,6 +39312,56 @@ function storageLocation(keychain) {
|
|
|
39312
39312
|
// src/setup/phase-harnesses.ts
|
|
39313
39313
|
var import_prompts2 = require("@inquirer/prompts");
|
|
39314
39314
|
init_dist();
|
|
39315
|
+
|
|
39316
|
+
// src/setup/skills.ts
|
|
39317
|
+
var import_node_child_process = require("child_process");
|
|
39318
|
+
function skillsAgentFor(harness) {
|
|
39319
|
+
switch (harness) {
|
|
39320
|
+
case "claude-code":
|
|
39321
|
+
return "claude-code";
|
|
39322
|
+
case "cursor":
|
|
39323
|
+
return "cursor";
|
|
39324
|
+
case "codex":
|
|
39325
|
+
return "codex";
|
|
39326
|
+
case "claude-desktop":
|
|
39327
|
+
return null;
|
|
39328
|
+
}
|
|
39329
|
+
const _exhaustive = harness;
|
|
39330
|
+
return _exhaustive;
|
|
39331
|
+
}
|
|
39332
|
+
var SKILLS_TIMEOUT_MS = 12e4;
|
|
39333
|
+
var defaultSkillsInstaller = {
|
|
39334
|
+
install: (agent) => new Promise((resolve2, reject) => {
|
|
39335
|
+
const child = (0, import_node_child_process.spawn)(
|
|
39336
|
+
"npx",
|
|
39337
|
+
["-y", "skills", "add", "trustwallet/tw-agent-skills", "-a", agent],
|
|
39338
|
+
{ stdio: "inherit" }
|
|
39339
|
+
);
|
|
39340
|
+
let settled = false;
|
|
39341
|
+
const settle = (fn2) => {
|
|
39342
|
+
if (settled) return;
|
|
39343
|
+
settled = true;
|
|
39344
|
+
clearTimeout(timer);
|
|
39345
|
+
fn2();
|
|
39346
|
+
};
|
|
39347
|
+
const timer = setTimeout(() => {
|
|
39348
|
+
try {
|
|
39349
|
+
child.kill("SIGTERM");
|
|
39350
|
+
} catch {
|
|
39351
|
+
}
|
|
39352
|
+
settle(() => reject(new Error(`npx skills timed out after ${SKILLS_TIMEOUT_MS / 1e3}s`)));
|
|
39353
|
+
}, SKILLS_TIMEOUT_MS);
|
|
39354
|
+
child.on("error", (err) => settle(() => reject(err)));
|
|
39355
|
+
child.on(
|
|
39356
|
+
"exit",
|
|
39357
|
+
(code2) => settle(
|
|
39358
|
+
() => code2 === 0 ? resolve2() : reject(new Error(`npx skills exited with code ${code2}`))
|
|
39359
|
+
)
|
|
39360
|
+
);
|
|
39361
|
+
})
|
|
39362
|
+
};
|
|
39363
|
+
|
|
39364
|
+
// src/setup/phase-harnesses.ts
|
|
39315
39365
|
function indent(s2, spaces) {
|
|
39316
39366
|
const prefix = " ".repeat(spaces);
|
|
39317
39367
|
return s2.split("\n").map((line) => prefix + line).join("\n");
|
|
@@ -39349,6 +39399,7 @@ function makeDefaultDeps2() {
|
|
|
39349
39399
|
return {
|
|
39350
39400
|
harnesses: ALL_HARNESSES,
|
|
39351
39401
|
prompter: defaultPrompter2,
|
|
39402
|
+
skillsInstaller: defaultSkillsInstaller,
|
|
39352
39403
|
env: process.env
|
|
39353
39404
|
};
|
|
39354
39405
|
}
|
|
@@ -39405,6 +39456,7 @@ async function processHarness(writer, deps, verbose) {
|
|
|
39405
39456
|
if (current === null && raw === null) {
|
|
39406
39457
|
info(`Wiring ${writer.displayName} \u2192 ${writer.configPath()}`);
|
|
39407
39458
|
await writer.writeEntry();
|
|
39459
|
+
await runSkillsInstall(writer.name, deps);
|
|
39408
39460
|
return "wrote";
|
|
39409
39461
|
}
|
|
39410
39462
|
if (current !== null && entriesEqual(current, TARGET_ENTRY) && !entryHasExtras(raw)) {
|
|
@@ -39420,6 +39472,7 @@ async function processHarness(writer, deps, verbose) {
|
|
|
39420
39472
|
if (action === "update") {
|
|
39421
39473
|
info(`Updating ${writer.displayName} \u2192 ${writer.configPath()}`);
|
|
39422
39474
|
await writer.writeEntry();
|
|
39475
|
+
await runSkillsInstall(writer.name, deps);
|
|
39423
39476
|
return "wrote";
|
|
39424
39477
|
}
|
|
39425
39478
|
if (action === "remove") {
|
|
@@ -39430,6 +39483,23 @@ async function processHarness(writer, deps, verbose) {
|
|
|
39430
39483
|
info(`Keeping existing ${writer.displayName} entry`);
|
|
39431
39484
|
return null;
|
|
39432
39485
|
}
|
|
39486
|
+
async function runSkillsInstall(harness, deps) {
|
|
39487
|
+
if (deps.env.TWAK_SETUP_SKIP_SKILLS === "1") return;
|
|
39488
|
+
const agent = skillsAgentFor(harness);
|
|
39489
|
+
if (agent === null) return;
|
|
39490
|
+
info(
|
|
39491
|
+
` Installing agent skills for ${harness} (npx skills add trustwallet/tw-agent-skills -a ${agent})...`
|
|
39492
|
+
);
|
|
39493
|
+
try {
|
|
39494
|
+
await deps.skillsInstaller.install(agent);
|
|
39495
|
+
success(` Skills installed for ${harness}.`);
|
|
39496
|
+
} catch (err) {
|
|
39497
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
39498
|
+
warn(
|
|
39499
|
+
` Skills install for ${harness} failed (${msg}). The MCP wiring is in place; you can re-run \`npx skills add trustwallet/tw-agent-skills -a ${agent}\` manually.`
|
|
39500
|
+
);
|
|
39501
|
+
}
|
|
39502
|
+
}
|
|
39433
39503
|
async function runNonInteractive2(opts, deps) {
|
|
39434
39504
|
const envList = deps.env.TWAK_SETUP_HARNESSES;
|
|
39435
39505
|
const fromEnv = envList ? envList.split(",").map((s2) => s2.trim()).filter(Boolean) : [];
|
|
@@ -39465,6 +39535,7 @@ async function runNonInteractive2(opts, deps) {
|
|
|
39465
39535
|
if (current === null && raw === null) {
|
|
39466
39536
|
info(`Wiring ${writer.displayName} \u2192 ${writer.configPath()}`);
|
|
39467
39537
|
await writer.writeEntry();
|
|
39538
|
+
await runSkillsInstall(writer.name, deps);
|
|
39468
39539
|
continue;
|
|
39469
39540
|
}
|
|
39470
39541
|
if (current !== null && entriesEqual(current, TARGET_ENTRY) && !entryHasExtras(raw)) {
|
|
@@ -39482,6 +39553,7 @@ async function runNonInteractive2(opts, deps) {
|
|
|
39482
39553
|
);
|
|
39483
39554
|
}
|
|
39484
39555
|
await writer.writeEntry();
|
|
39556
|
+
await runSkillsInstall(writer.name, deps);
|
|
39485
39557
|
continue;
|
|
39486
39558
|
}
|
|
39487
39559
|
info(
|
|
@@ -39505,6 +39577,21 @@ var import_node_crypto2 = require("crypto");
|
|
|
39505
39577
|
var import_prompts3 = require("@inquirer/prompts");
|
|
39506
39578
|
init_dist2();
|
|
39507
39579
|
init_dist();
|
|
39580
|
+
|
|
39581
|
+
// src/password.ts
|
|
39582
|
+
var RULES = [
|
|
39583
|
+
[(pw) => pw.length >= 8, "be at least 8 characters long"],
|
|
39584
|
+
[(pw) => /[a-z]/.test(pw), "include a lowercase letter"],
|
|
39585
|
+
[(pw) => /[A-Z]/.test(pw), "include an uppercase letter"],
|
|
39586
|
+
[(pw) => /[0-9]/.test(pw), "include a number"]
|
|
39587
|
+
];
|
|
39588
|
+
function getPasswordWeaknesses(pw) {
|
|
39589
|
+
const failed = RULES.filter(([test]) => !test(pw)).map(([, label]) => label);
|
|
39590
|
+
return failed.length > 0 ? failed.join(", ") : null;
|
|
39591
|
+
}
|
|
39592
|
+
|
|
39593
|
+
// src/setup/phase-wallet.ts
|
|
39594
|
+
var MAX_PASSWORD_CONFIRM_ATTEMPTS = 3;
|
|
39508
39595
|
var defaultPrompter3 = {
|
|
39509
39596
|
selectWalletOption: () => (0, import_prompts3.select)({
|
|
39510
39597
|
message: "Pick one:",
|
|
@@ -39525,24 +39612,49 @@ var defaultPrompter3 = {
|
|
|
39525
39612
|
description: "Read-only operations work without a wallet."
|
|
39526
39613
|
}
|
|
39527
39614
|
]
|
|
39528
|
-
})
|
|
39615
|
+
}),
|
|
39616
|
+
promptWalletPassword: async () => {
|
|
39617
|
+
for (let attempt = 1; attempt <= MAX_PASSWORD_CONFIRM_ATTEMPTS; attempt++) {
|
|
39618
|
+
const pw = await (0, import_prompts3.password)({
|
|
39619
|
+
message: "Choose a wallet password (min 8 chars, mixed case + digit):",
|
|
39620
|
+
mask: "\u25CF",
|
|
39621
|
+
validate: (s2) => {
|
|
39622
|
+
const w4 = getPasswordWeaknesses(s2);
|
|
39623
|
+
return w4 === null ? true : `Password must ${w4}.`;
|
|
39624
|
+
}
|
|
39625
|
+
});
|
|
39626
|
+
const confirm = await (0, import_prompts3.password)({
|
|
39627
|
+
message: "Confirm password:",
|
|
39628
|
+
mask: "\u25CF"
|
|
39629
|
+
});
|
|
39630
|
+
if (pw === confirm) return pw;
|
|
39631
|
+
const remaining = MAX_PASSWORD_CONFIRM_ATTEMPTS - attempt;
|
|
39632
|
+
if (remaining > 0) {
|
|
39633
|
+
error(`Passwords don't match. ${remaining} attempt(s) left.`);
|
|
39634
|
+
}
|
|
39635
|
+
}
|
|
39636
|
+
throw new CommandError(
|
|
39637
|
+
"VALIDATION_ERROR",
|
|
39638
|
+
`Could not capture a matching wallet password after ${MAX_PASSWORD_CONFIRM_ATTEMPTS} attempts.`
|
|
39639
|
+
);
|
|
39640
|
+
}
|
|
39529
39641
|
};
|
|
39530
39642
|
function makeDefaultDeps3() {
|
|
39531
39643
|
return {
|
|
39532
39644
|
prompter: defaultPrompter3,
|
|
39533
39645
|
storage: new WalletConfigStore(),
|
|
39534
39646
|
walletCreator: {
|
|
39535
|
-
async create(
|
|
39647
|
+
async create(pw) {
|
|
39536
39648
|
await ensureTrustSDK();
|
|
39537
|
-
const provider = await AgentWalletProvider.create(
|
|
39649
|
+
const provider = await AgentWalletProvider.create(pw);
|
|
39538
39650
|
const primaryAddress = await provider.getAddress("ethereum") ?? "<unknown>";
|
|
39539
39651
|
return { primaryAddress };
|
|
39540
39652
|
}
|
|
39541
39653
|
},
|
|
39542
39654
|
keychain: {
|
|
39543
39655
|
isAvailable: () => new KeychainManager().isAvailable(),
|
|
39544
|
-
async saveWalletPassword(
|
|
39545
|
-
await new KeychainManager().saveWalletPassword(
|
|
39656
|
+
async saveWalletPassword(pw) {
|
|
39657
|
+
await new KeychainManager().saveWalletPassword(pw);
|
|
39546
39658
|
},
|
|
39547
39659
|
async saveProbe(value) {
|
|
39548
39660
|
await new KeychainManager().saveProbe(value);
|
|
@@ -39554,8 +39666,7 @@ function makeDefaultDeps3() {
|
|
|
39554
39666
|
await new KeychainManager().deleteProbe();
|
|
39555
39667
|
}
|
|
39556
39668
|
},
|
|
39557
|
-
env: process.env
|
|
39558
|
-
generatePassword: () => (0, import_node_crypto2.randomBytes)(32).toString("hex")
|
|
39669
|
+
env: process.env
|
|
39559
39670
|
};
|
|
39560
39671
|
}
|
|
39561
39672
|
async function runWalletPhase(opts, deps = makeDefaultDeps3()) {
|
|
@@ -39580,6 +39691,14 @@ async function runWalletPhase(opts, deps = makeDefaultDeps3()) {
|
|
|
39580
39691
|
}
|
|
39581
39692
|
}
|
|
39582
39693
|
async function createAgentWallet(deps) {
|
|
39694
|
+
await preflightWalletCreate(deps);
|
|
39695
|
+
info(
|
|
39696
|
+
"Choose a password to encrypt your wallet. twak stores it in your local OS keychain so day-to-day commands don't re-prompt \u2014 nothing leaves your machine. Still: write it down somewhere safe (password manager) too. If the keychain ever fails, that's your only recovery path.\n"
|
|
39697
|
+
);
|
|
39698
|
+
const pw = await deps.prompter.promptWalletPassword();
|
|
39699
|
+
await writeNewWallet(deps, pw);
|
|
39700
|
+
}
|
|
39701
|
+
async function preflightWalletCreate(deps) {
|
|
39583
39702
|
if (await deps.storage.exists()) {
|
|
39584
39703
|
throw new WalletError(
|
|
39585
39704
|
"WALLET_EXISTS",
|
|
@@ -39593,10 +39712,11 @@ async function createAgentWallet(deps) {
|
|
|
39593
39712
|
);
|
|
39594
39713
|
}
|
|
39595
39714
|
await assertKeychainCanPersist(deps);
|
|
39715
|
+
}
|
|
39716
|
+
async function writeNewWallet(deps, pw) {
|
|
39596
39717
|
info("Creating agent wallet...");
|
|
39597
|
-
const
|
|
39598
|
-
|
|
39599
|
-
await deps.keychain.saveWalletPassword(password2);
|
|
39718
|
+
const { primaryAddress } = await deps.walletCreator.create(pw);
|
|
39719
|
+
await deps.keychain.saveWalletPassword(pw);
|
|
39600
39720
|
success("Wallet created.");
|
|
39601
39721
|
info(` Primary ETH address: ${primaryAddress}`);
|
|
39602
39722
|
success("Password saved to OS keychain.");
|
|
@@ -39626,18 +39746,29 @@ async function assertKeychainCanPersist(deps) {
|
|
|
39626
39746
|
}
|
|
39627
39747
|
async function runNonInteractive3(deps) {
|
|
39628
39748
|
const mode = deps.env.TWAK_SETUP_WALLET ?? "skip";
|
|
39629
|
-
if (mode === "create") {
|
|
39630
|
-
await createAgentWallet(deps);
|
|
39631
|
-
return;
|
|
39632
|
-
}
|
|
39633
39749
|
if (mode === "skip") {
|
|
39634
39750
|
info("Wallet creation skipped (set TWAK_SETUP_WALLET=create to opt in).");
|
|
39635
39751
|
return;
|
|
39636
39752
|
}
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
39640
|
-
|
|
39753
|
+
if (mode !== "create") {
|
|
39754
|
+
throw new CommandError(
|
|
39755
|
+
"VALIDATION_ERROR",
|
|
39756
|
+
`Unknown TWAK_SETUP_WALLET value: ${mode}. Use 'create' or 'skip'.`
|
|
39757
|
+
);
|
|
39758
|
+
}
|
|
39759
|
+
const envPassword = deps.env.TWAK_WALLET_PASSWORD?.trim();
|
|
39760
|
+
if (!envPassword) {
|
|
39761
|
+
throw new CommandError(
|
|
39762
|
+
"VALIDATION_ERROR",
|
|
39763
|
+
"TWAK_WALLET_PASSWORD must be set when TWAK_SETUP_WALLET=create. Choose a strong password (min 8 chars, mixed case + digit) and pass it via the env var before re-running setup."
|
|
39764
|
+
);
|
|
39765
|
+
}
|
|
39766
|
+
const weakness = getPasswordWeaknesses(envPassword);
|
|
39767
|
+
if (weakness) {
|
|
39768
|
+
throw new CommandError("VALIDATION_ERROR", `TWAK_WALLET_PASSWORD too weak: must ${weakness}.`);
|
|
39769
|
+
}
|
|
39770
|
+
await preflightWalletCreate(deps);
|
|
39771
|
+
await writeNewWallet(deps, envPassword);
|
|
39641
39772
|
}
|
|
39642
39773
|
|
|
39643
39774
|
// src/commands/setup.ts
|
|
@@ -39789,17 +39920,9 @@ function registerWalletCommand(program3) {
|
|
|
39789
39920
|
wallet.command("create").description("Create a new agent wallet").requiredOption("--password <password>", "Password to encrypt the wallet").option("--no-keychain", "Do not save password to OS keychain").option("--skip-password-check", "Skip password strength validation").option("--json", "JSON output").action(async (opts) => {
|
|
39790
39921
|
try {
|
|
39791
39922
|
if (!opts.skipPasswordCheck) {
|
|
39792
|
-
const
|
|
39793
|
-
|
|
39794
|
-
|
|
39795
|
-
if (!/[a-z]/.test(pw)) issues.push("include a lowercase letter");
|
|
39796
|
-
if (!/[A-Z]/.test(pw)) issues.push("include an uppercase letter");
|
|
39797
|
-
if (!/[0-9]/.test(pw)) issues.push("include a number");
|
|
39798
|
-
if (issues.length > 0) {
|
|
39799
|
-
throw new WalletError(
|
|
39800
|
-
"VALIDATION_ERROR",
|
|
39801
|
-
`Password too weak: must ${issues.join(", ")}.`
|
|
39802
|
-
);
|
|
39923
|
+
const weakness = getPasswordWeaknesses(opts.password);
|
|
39924
|
+
if (weakness) {
|
|
39925
|
+
throw new WalletError("VALIDATION_ERROR", `Password too weak: must ${weakness}.`);
|
|
39803
39926
|
}
|
|
39804
39927
|
}
|
|
39805
39928
|
await ensureTrustSDK();
|
|
@@ -39846,8 +39969,8 @@ function registerWalletCommand(program3) {
|
|
|
39846
39969
|
throw new WalletError("CHAIN_UNSUPPORTED", `Unknown chain: ${opts.chain}`);
|
|
39847
39970
|
}
|
|
39848
39971
|
await ensureTrustSDK();
|
|
39849
|
-
const
|
|
39850
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
39972
|
+
const password3 = await resolvePassword(opts);
|
|
39973
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
39851
39974
|
const address = await provider.getAddress(opts.chain);
|
|
39852
39975
|
if (opts.json) {
|
|
39853
39976
|
output({ chain: opts.chain, address }, true);
|
|
@@ -39870,8 +39993,8 @@ ${qr3}`;
|
|
|
39870
39993
|
).option("--json", "JSON output").action(async (opts) => {
|
|
39871
39994
|
try {
|
|
39872
39995
|
await ensureTrustSDK();
|
|
39873
|
-
const
|
|
39874
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
39996
|
+
const password3 = await resolvePassword(opts);
|
|
39997
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
39875
39998
|
const addresses = await provider.getAddresses();
|
|
39876
39999
|
if (opts.json) {
|
|
39877
40000
|
output({ addresses }, true);
|
|
@@ -39924,8 +40047,8 @@ ${qr3}`;
|
|
|
39924
40047
|
throw new WalletError("VALIDATION_ERROR", "Provide --chain <key> or --all");
|
|
39925
40048
|
}
|
|
39926
40049
|
await ensureTrustSDK();
|
|
39927
|
-
const
|
|
39928
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
40050
|
+
const password3 = await resolvePassword(opts);
|
|
40051
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
39929
40052
|
const httpClient = await getClient();
|
|
39930
40053
|
if (!opts.all) {
|
|
39931
40054
|
const chain2 = getChainById(opts.chain);
|
|
@@ -40206,8 +40329,8 @@ ${qr3}`;
|
|
|
40206
40329
|
).option("--json", "JSON output").action(async (opts) => {
|
|
40207
40330
|
try {
|
|
40208
40331
|
await ensureTrustSDK();
|
|
40209
|
-
const
|
|
40210
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
40332
|
+
const password3 = await resolvePassword(opts);
|
|
40333
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
40211
40334
|
const httpClient = await getClient();
|
|
40212
40335
|
const allAddresses = await provider.getAddresses();
|
|
40213
40336
|
const chainsArg = opts.chains ?? Object.keys(CHAINS).join(",");
|
|
@@ -40321,8 +40444,8 @@ ${qr3}`;
|
|
|
40321
40444
|
throw new WalletError("CHAIN_UNSUPPORTED", `Unknown chain: ${opts.chain}`);
|
|
40322
40445
|
}
|
|
40323
40446
|
await ensureTrustSDK();
|
|
40324
|
-
const
|
|
40325
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
40447
|
+
const password3 = await resolvePassword(opts);
|
|
40448
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
40326
40449
|
const address = await provider.getAddress(opts.chain);
|
|
40327
40450
|
const signature = await provider.signMessage(opts.chain, opts.message);
|
|
40328
40451
|
output({ chain: opts.chain, address, message: opts.message, signature }, opts.json);
|
|
@@ -40334,8 +40457,8 @@ ${qr3}`;
|
|
|
40334
40457
|
wallet.command("register").description("Register wallet addresses with Trust Wallet backend (enables token holdings)").option("--password <password>", "Wallet password").option("--json", "JSON output").action(async (opts) => {
|
|
40335
40458
|
try {
|
|
40336
40459
|
const creds = await ensureTrustSDK();
|
|
40337
|
-
const
|
|
40338
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
40460
|
+
const password3 = await resolvePassword(opts);
|
|
40461
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
40339
40462
|
await registerWalletWithBackend(creds, provider);
|
|
40340
40463
|
if (!opts.json) success("Wallet registered with backend");
|
|
40341
40464
|
const addresses = await provider.getAddresses();
|
|
@@ -40937,8 +41060,8 @@ function registerTransferCommand(program3) {
|
|
|
40937
41060
|
).option("--json", "JSON output").action(async (opts) => {
|
|
40938
41061
|
try {
|
|
40939
41062
|
await ensureTrustSDK();
|
|
40940
|
-
const
|
|
40941
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
41063
|
+
const password3 = await resolvePassword2(opts);
|
|
41064
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
40942
41065
|
let coinId;
|
|
40943
41066
|
try {
|
|
40944
41067
|
({ coinId } = parseTokenId(opts.token));
|
|
@@ -41164,8 +41287,8 @@ function registerSwapCommand(program3) {
|
|
|
41164
41287
|
let amberDomains = /* @__PURE__ */ new Map();
|
|
41165
41288
|
if (needsWallet) {
|
|
41166
41289
|
await ensureTrustSDK();
|
|
41167
|
-
const
|
|
41168
|
-
provider = await AgentWalletProvider.fromStorage(
|
|
41290
|
+
const password3 = await resolvePassword(opts);
|
|
41291
|
+
provider = await AgentWalletProvider.fromStorage(password3);
|
|
41169
41292
|
walletAddress = await provider.getAddress(fromChain);
|
|
41170
41293
|
if (toChain !== fromChain) {
|
|
41171
41294
|
destinationAddress = await provider.getAddress(toChain);
|
|
@@ -41375,8 +41498,8 @@ function registerErc20Command(program3) {
|
|
|
41375
41498
|
).option("--json", "JSON output").action(async (opts) => {
|
|
41376
41499
|
try {
|
|
41377
41500
|
await ensureTrustSDK();
|
|
41378
|
-
const
|
|
41379
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
41501
|
+
const password3 = await resolvePassword(opts);
|
|
41502
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
41380
41503
|
let coinId;
|
|
41381
41504
|
let contractAddress;
|
|
41382
41505
|
try {
|
|
@@ -41442,8 +41565,8 @@ function registerErc20Command(program3) {
|
|
|
41442
41565
|
).option("--json", "JSON output").action(async (opts) => {
|
|
41443
41566
|
try {
|
|
41444
41567
|
await ensureTrustSDK();
|
|
41445
|
-
const
|
|
41446
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
41568
|
+
const password3 = await resolvePassword(opts);
|
|
41569
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
41447
41570
|
let coinId;
|
|
41448
41571
|
let contractAddress;
|
|
41449
41572
|
try {
|
|
@@ -42018,8 +42141,8 @@ function registerQueryCommand(program3) {
|
|
|
42018
42141
|
}
|
|
42019
42142
|
if (!opts.chain) {
|
|
42020
42143
|
await ensureTrustSDK();
|
|
42021
|
-
const
|
|
42022
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
42144
|
+
const password3 = await resolvePassword(opts);
|
|
42145
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
42023
42146
|
const allAddresses = await provider.getAddresses();
|
|
42024
42147
|
const addresses = allAddresses.map((wa2) => ({
|
|
42025
42148
|
chain: wa2.chainId,
|
|
@@ -42043,8 +42166,8 @@ function registerQueryCommand(program3) {
|
|
|
42043
42166
|
let address = opts.address;
|
|
42044
42167
|
if (!address) {
|
|
42045
42168
|
await ensureTrustSDK();
|
|
42046
|
-
const
|
|
42047
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
42169
|
+
const password3 = await resolvePassword(opts);
|
|
42170
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
42048
42171
|
address = await provider.getAddress(opts.chain);
|
|
42049
42172
|
}
|
|
42050
42173
|
const result = await service.getHistory({
|
|
@@ -42105,8 +42228,8 @@ function registerQueryCommand(program3) {
|
|
|
42105
42228
|
if (!address) {
|
|
42106
42229
|
try {
|
|
42107
42230
|
await ensureTrustSDK();
|
|
42108
|
-
const
|
|
42109
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
42231
|
+
const password3 = await resolvePassword(opts);
|
|
42232
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
42110
42233
|
address = await provider.getAddress(opts.chain);
|
|
42111
42234
|
} catch {
|
|
42112
42235
|
}
|
|
@@ -56835,8 +56958,8 @@ function registerServeCommand(program3) {
|
|
|
56835
56958
|
const blockchainClient = new BlockchainClient();
|
|
56836
56959
|
let agentWallet;
|
|
56837
56960
|
try {
|
|
56838
|
-
const
|
|
56839
|
-
if (
|
|
56961
|
+
const password3 = opts.password || process.env.TWAK_WALLET_PASSWORD || await new KeychainManager().getWalletPassword();
|
|
56962
|
+
if (password3) agentWallet = await AgentWalletProvider.fromStorage(password3);
|
|
56840
56963
|
} catch {
|
|
56841
56964
|
}
|
|
56842
56965
|
let wallet;
|
|
@@ -57008,8 +57131,8 @@ async function resolveWalletAddress(opts, context) {
|
|
|
57008
57131
|
);
|
|
57009
57132
|
}
|
|
57010
57133
|
await ensureTrustSDK();
|
|
57011
|
-
const
|
|
57012
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
57134
|
+
const password3 = await resolvePassword({ password: opts.password });
|
|
57135
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
57013
57136
|
const address = await provider.getAddress(chainKey);
|
|
57014
57137
|
info(`Using ${context} address ${address} on ${chainKey} (derived from your stored wallet).`);
|
|
57015
57138
|
return address;
|
|
@@ -57229,8 +57352,8 @@ ${url}`);
|
|
|
57229
57352
|
).option("--json", "JSON output").action(async (opts) => {
|
|
57230
57353
|
try {
|
|
57231
57354
|
await ensureTrustSDK();
|
|
57232
|
-
const
|
|
57233
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
57355
|
+
const password3 = await resolvePassword({ password: opts.password });
|
|
57356
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
57234
57357
|
let coinId;
|
|
57235
57358
|
try {
|
|
57236
57359
|
({ coinId } = parseTokenId(opts.asset));
|
|
@@ -57629,8 +57752,8 @@ function registerX402Command(program3) {
|
|
|
57629
57752
|
try {
|
|
57630
57753
|
await validateX402Url(url);
|
|
57631
57754
|
await ensureTrustSDK();
|
|
57632
|
-
const
|
|
57633
|
-
const provider = await AgentWalletProvider.fromStorage(
|
|
57755
|
+
const password3 = await resolvePassword3(opts);
|
|
57756
|
+
const provider = await AgentWalletProvider.fromStorage(password3);
|
|
57634
57757
|
const init3 = {
|
|
57635
57758
|
method: opts.method.toUpperCase(),
|
|
57636
57759
|
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
|
@@ -57754,7 +57877,7 @@ var crypto7 = __toESM(require("crypto"));
|
|
|
57754
57877
|
// package.json
|
|
57755
57878
|
var package_default = {
|
|
57756
57879
|
name: "@trustwallet/cli",
|
|
57757
|
-
version: "0.12.
|
|
57880
|
+
version: "0.12.2",
|
|
57758
57881
|
description: "TWAK CLI \u2014 command-line interface for Trust Wallet Agent Kit",
|
|
57759
57882
|
main: "dist/index.js",
|
|
57760
57883
|
types: "dist/index.d.ts",
|
|
@@ -57962,8 +58085,8 @@ function registerWatchCommand(program3) {
|
|
|
57962
58085
|
swapClient = new SwapClient(client);
|
|
57963
58086
|
if (!opts.dryRun) {
|
|
57964
58087
|
await ensureTrustSDK();
|
|
57965
|
-
const
|
|
57966
|
-
provider = await AgentWalletProvider.fromStorage(
|
|
58088
|
+
const password3 = await resolvePassword(opts);
|
|
58089
|
+
provider = await AgentWalletProvider.fromStorage(password3);
|
|
57967
58090
|
if (opts.autoLock) {
|
|
57968
58091
|
const minutes = parseInt(opts.autoLock, 10);
|
|
57969
58092
|
if (isNaN(minutes) || minutes <= 0) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the comma-separated list of password-strength requirements that
|
|
3
|
+
* `pw` fails to meet (e.g. "include an uppercase letter, include a number"),
|
|
4
|
+
* or null if the password meets every rule.
|
|
5
|
+
*
|
|
6
|
+
* Callers prefix their own framing — e.g. "Password too weak: must <…>.",
|
|
7
|
+
* "Password must <…>.", "TWAK_WALLET_PASSWORD too weak: must <…>." — so each
|
|
8
|
+
* entry point keeps its own user-visible error wording while sharing the
|
|
9
|
+
* rule set.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getPasswordWeaknesses(pw: string): string | null;
|
|
12
|
+
//# sourceMappingURL=password.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../src/password.ts"],"names":[],"mappings":"AAaA;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG/D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HarnessName, type HarnessWriter, type TwakEntry } from './harnesses';
|
|
2
|
+
import { type SkillsInstaller } from './skills';
|
|
2
3
|
import type { SetupOptions } from './types';
|
|
3
4
|
export type ConflictAction = 'update' | 'keep' | 'remove';
|
|
4
5
|
export interface HarnessPrompter {
|
|
@@ -11,6 +12,7 @@ export interface HarnessPrompter {
|
|
|
11
12
|
export interface HarnessPhaseDeps {
|
|
12
13
|
harnesses: HarnessWriter[];
|
|
13
14
|
prompter: HarnessPrompter;
|
|
15
|
+
skillsInstaller: SkillsInstaller;
|
|
14
16
|
env: NodeJS.ProcessEnv;
|
|
15
17
|
}
|
|
16
18
|
export declare function runHarnessesPhase(opts: SetupOptions, deps?: HarnessPhaseDeps): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase-harnesses.d.ts","sourceRoot":"","sources":["../../src/setup/phase-harnesses.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAkC1D,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9F,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"phase-harnesses.d.ts","sourceRoot":"","sources":["../../src/setup/phase-harnesses.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAA0C,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AACxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAkC1D,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9F,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,QAAQ,EAAE,eAAe,CAAC;IAQ1B,eAAe,EAAE,eAAe,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AAmCD,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,gBAAoC,GACzC,OAAO,CAAC,IAAI,CAAC,CAaf;AAmCD,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;AAK7D,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,mBAAmB,CAAC,CA2D9B"}
|
|
@@ -2,6 +2,7 @@ import type { SetupOptions } from './types';
|
|
|
2
2
|
export type WalletChoice = '1' | '2' | '3';
|
|
3
3
|
export interface WalletPrompter {
|
|
4
4
|
selectWalletOption(): Promise<WalletChoice>;
|
|
5
|
+
promptWalletPassword(): Promise<string>;
|
|
5
6
|
}
|
|
6
7
|
export interface WalletCreator {
|
|
7
8
|
create(password: string): Promise<{
|
|
@@ -22,7 +23,6 @@ export interface WalletPhaseDeps {
|
|
|
22
23
|
deleteProbe(): Promise<void>;
|
|
23
24
|
};
|
|
24
25
|
env: NodeJS.ProcessEnv;
|
|
25
|
-
generatePassword: () => string;
|
|
26
26
|
}
|
|
27
27
|
export declare function runWalletPhase(opts: SetupOptions, deps?: WalletPhaseDeps): Promise<void>;
|
|
28
28
|
//# sourceMappingURL=phase-wallet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase-wallet.d.ts","sourceRoot":"","sources":["../../src/setup/phase-wallet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"phase-wallet.d.ts","sourceRoot":"","sources":["../../src/setup/phase-wallet.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAI3C,MAAM,WAAW,cAAc;IAC7B,kBAAkB,IAAI,OAAO,CAAC,YAAY,CAAC,CAAC;IAM5C,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE;QAAE,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE;QACR,WAAW,IAAI,OAAO,CAAC;QACvB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAMpD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACxC,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;QACnC,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9B,CAAC;IACF,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB;AAwFD,wBAAsB,cAAc,CAClC,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,eAAmC,GACxC,OAAO,CAAC,IAAI,CAAC,CAyBf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HarnessName } from './harnesses/types';
|
|
2
|
+
export declare function skillsAgentFor(harness: HarnessName): string | null;
|
|
3
|
+
export interface SkillsInstaller {
|
|
4
|
+
install(agent: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare const defaultSkillsInstaller: SkillsInstaller;
|
|
7
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/setup/skills.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,wBAAgB,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI,CAgBlE;AAQD,MAAM,WAAW,eAAe;IAK9B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,eAAO,MAAM,sBAAsB,EAAE,eAsCpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustwallet/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.2",
|
|
4
4
|
"description": "TWAK CLI — command-line interface for Trust Wallet Agent Kit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"tsup": "8.5.1",
|
|
33
33
|
"typescript": "5.7.3",
|
|
34
34
|
"vitest": "4.1.2",
|
|
35
|
-
"@twak/actions": "0.12.
|
|
36
|
-
"@twak/core": "0.12.
|
|
37
|
-
"@twak/
|
|
38
|
-
"@twak/
|
|
39
|
-
"@twak/
|
|
40
|
-
"@twak/
|
|
41
|
-
"@twak/
|
|
42
|
-
"@twak/
|
|
43
|
-
"@twak/
|
|
44
|
-
"@twak/
|
|
45
|
-
"@twak/
|
|
35
|
+
"@twak/actions": "0.12.2",
|
|
36
|
+
"@twak/core": "0.12.2",
|
|
37
|
+
"@twak/blockchain": "0.12.2",
|
|
38
|
+
"@twak/mcp": "0.12.2",
|
|
39
|
+
"@twak/swap": "0.12.2",
|
|
40
|
+
"@twak/wallet": "0.12.2",
|
|
41
|
+
"@twak/transactions": "0.12.2",
|
|
42
|
+
"@twak/wallet-core": "0.12.2",
|
|
43
|
+
"@twak/walletconnect": "0.12.2",
|
|
44
|
+
"@twak/storage": "0.12.2",
|
|
45
|
+
"@twak/security": "0.12.2"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|