@trustwallet/cli 0.21.0 → 0.22.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+C1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqG1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/commands/wallet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiFpC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAymB5D"}
|
package/dist/index.js
CHANGED
|
@@ -41715,10 +41715,10 @@ var FileKeyValueStorage = class {
|
|
|
41715
41715
|
}
|
|
41716
41716
|
};
|
|
41717
41717
|
var DEFAULT_METADATA = {
|
|
41718
|
-
name: "TWAK
|
|
41719
|
-
description: "
|
|
41718
|
+
name: "TWAK",
|
|
41719
|
+
description: "Trust Wallet Agent Kit",
|
|
41720
41720
|
url: "https://portal.trustwallet.com",
|
|
41721
|
-
icons: ["https://avatars.githubusercontent.com/u/
|
|
41721
|
+
icons: ["https://avatars.githubusercontent.com/u/32179889"]
|
|
41722
41722
|
};
|
|
41723
41723
|
var SESSION_CLEARED_REASON = { code: 6e3, message: "Session cleared" };
|
|
41724
41724
|
var PEER_NOTIFY_TIMEOUT_MS = 5e3;
|
|
@@ -42193,7 +42193,10 @@ async function tryRegisterWallet() {
|
|
|
42193
42193
|
}
|
|
42194
42194
|
}
|
|
42195
42195
|
function registerInitCommand(program3) {
|
|
42196
|
-
program3.command("init").description("Initialize twak configuration").option("--api-key <key>", "TWAK API access ID (prefer TWAK_ACCESS_ID env var)").option("--api-secret <secret>", "TWAK HMAC secret (prefer TWAK_HMAC_SECRET env var)").option(
|
|
42196
|
+
program3.command("init").description("Initialize twak configuration").option("--api-key <key>", "TWAK API access ID (prefer TWAK_ACCESS_ID env var)").option("--api-secret <secret>", "TWAK HMAC secret (prefer TWAK_HMAC_SECRET env var)").option(
|
|
42197
|
+
"--wc-project-id <id>",
|
|
42198
|
+
"WalletConnect project ID override (default: Trust Wallet project)"
|
|
42199
|
+
).option("--json", "JSON output").action(async (opts) => {
|
|
42197
42200
|
try {
|
|
42198
42201
|
const credManager = new CredentialManager();
|
|
42199
42202
|
if (opts.apiKey && opts.apiSecret) {
|
|
@@ -42558,8 +42561,8 @@ async function runInteractive(deps) {
|
|
|
42558
42561
|
const hmacSecret = (await deps.prompter.promptHmacSecret()).trim();
|
|
42559
42562
|
info(
|
|
42560
42563
|
`
|
|
42561
|
-
WalletConnect Project ID is
|
|
42562
|
-
|
|
42564
|
+
WalletConnect Project ID is optional: twak uses Trust Wallet's project by default.
|
|
42565
|
+
Set one only to use your own project. Get one at: ${WC_DASHBOARD_URL}
|
|
42563
42566
|
`
|
|
42564
42567
|
);
|
|
42565
42568
|
const walletConnectProjectId = (await deps.prompter.promptWalletConnectProjectId())?.trim() || void 0;
|
|
@@ -43107,7 +43110,10 @@ var import_chalk4 = __toESM(require_source());
|
|
|
43107
43110
|
init_dist2();
|
|
43108
43111
|
function registerAuthCommand(program3) {
|
|
43109
43112
|
const auth = program3.command("auth").description("Manage authentication");
|
|
43110
|
-
auth.command("setup").description("Set up API credentials").requiredOption("--api-key <key>", "TWAK API access ID").requiredOption("--api-secret <secret>", "TWAK HMAC secret").option(
|
|
43113
|
+
auth.command("setup").description("Set up API credentials").requiredOption("--api-key <key>", "TWAK API access ID").requiredOption("--api-secret <secret>", "TWAK HMAC secret").option(
|
|
43114
|
+
"--wc-project-id <id>",
|
|
43115
|
+
"WalletConnect project ID override (default: Trust Wallet project)"
|
|
43116
|
+
).action(async (opts) => {
|
|
43111
43117
|
const credManager = new CredentialManager();
|
|
43112
43118
|
await credManager.save({
|
|
43113
43119
|
accessId: opts.apiKey,
|
|
@@ -43126,7 +43132,9 @@ function registerAuthCommand(program3) {
|
|
|
43126
43132
|
if (opts.json) {
|
|
43127
43133
|
output({ configured, source, accessId }, true);
|
|
43128
43134
|
} else {
|
|
43129
|
-
console.log(
|
|
43135
|
+
console.log(
|
|
43136
|
+
` ${import_chalk4.default.dim("Status")} ${configured ? import_chalk4.default.green("configured") : import_chalk4.default.yellow("not configured")}`
|
|
43137
|
+
);
|
|
43130
43138
|
console.log(` ${import_chalk4.default.dim("Source")} ${source}`);
|
|
43131
43139
|
if (accessId) console.log(` ${import_chalk4.default.dim("Access ID")} ${accessId}...`);
|
|
43132
43140
|
if (!configured) info("\nRun `twak init` to set up credentials.");
|
|
@@ -43813,14 +43821,15 @@ var RESTORE_TIMEOUT_MS = 1e4;
|
|
|
43813
43821
|
function wcStoragePath() {
|
|
43814
43822
|
return path4.join(new FileStore().getDataDir(), "walletconnect.json");
|
|
43815
43823
|
}
|
|
43824
|
+
var DEFAULT_WC_PROJECT_ID = "a863b78b54c4222603c8db4d6d880172";
|
|
43816
43825
|
async function resolveWcProjectId(flag) {
|
|
43817
43826
|
const fromFlagOrEnv = flag || process.env.WALLETCONNECT_PROJECT_ID;
|
|
43818
43827
|
if (fromFlagOrEnv) return fromFlagOrEnv;
|
|
43819
43828
|
try {
|
|
43820
43829
|
const creds = await new CredentialManager().load();
|
|
43821
|
-
return creds?.walletConnectProjectId ||
|
|
43830
|
+
return creds?.walletConnectProjectId || DEFAULT_WC_PROJECT_ID;
|
|
43822
43831
|
} catch {
|
|
43823
|
-
return
|
|
43832
|
+
return DEFAULT_WC_PROJECT_ID;
|
|
43824
43833
|
}
|
|
43825
43834
|
}
|
|
43826
43835
|
function createWalletConnectProvider(projectId) {
|
|
@@ -43858,16 +43867,9 @@ function getQRString(address) {
|
|
|
43858
43867
|
return "";
|
|
43859
43868
|
}
|
|
43860
43869
|
}
|
|
43861
|
-
var WC_PROJECT_ID_HINT = "Use --project-id, set WALLETCONNECT_PROJECT_ID, or run `twak init --wc-project-id <id>`";
|
|
43862
43870
|
async function openStoredWalletConnect(projectIdFlag) {
|
|
43863
43871
|
if (!fs6.existsSync(wcStoragePath())) return null;
|
|
43864
43872
|
const projectId = await resolveWcProjectId(projectIdFlag);
|
|
43865
|
-
if (!projectId) {
|
|
43866
|
-
throw new WalletError(
|
|
43867
|
-
"VALIDATION_ERROR",
|
|
43868
|
-
`A WalletConnect session is stored but no project ID is configured. ${WC_PROJECT_ID_HINT}`
|
|
43869
|
-
);
|
|
43870
|
-
}
|
|
43871
43873
|
const provider = createWalletConnectProvider(projectId);
|
|
43872
43874
|
const session = await withTimeout(provider.restore(), RESTORE_TIMEOUT_MS);
|
|
43873
43875
|
return { provider, session };
|
|
@@ -44169,19 +44171,13 @@ ${qr3}`;
|
|
|
44169
44171
|
});
|
|
44170
44172
|
wallet.command("connect").description("Connect external wallet via WalletConnect").option(
|
|
44171
44173
|
"--project-id <id>",
|
|
44172
|
-
"WalletConnect project ID (or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44174
|
+
"WalletConnect project ID override (default: Trust Wallet project; or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44173
44175
|
).option(
|
|
44174
44176
|
"--chains <list>",
|
|
44175
44177
|
"Comma-separated CAIP-2 chain IDs (default: all supported EVM chains)"
|
|
44176
44178
|
).option("--timeout <seconds>", "Connection timeout in seconds", "300").option("--json", "JSON output").action(async (opts) => {
|
|
44177
44179
|
try {
|
|
44178
44180
|
const projectId = await resolveWcProjectId(opts.projectId);
|
|
44179
|
-
if (!projectId) {
|
|
44180
|
-
throw new WalletError(
|
|
44181
|
-
"VALIDATION_ERROR",
|
|
44182
|
-
`WalletConnect project ID required. ${WC_PROJECT_ID_HINT}`
|
|
44183
|
-
);
|
|
44184
|
-
}
|
|
44185
44181
|
const provider = createWalletConnectProvider(projectId);
|
|
44186
44182
|
const chains = opts.chains ? opts.chains.split(",").map((s2) => s2.trim()).filter(Boolean) : getDefaultWcChains();
|
|
44187
44183
|
info("Connecting via WalletConnect...");
|
|
@@ -44217,7 +44213,7 @@ ${qr3}`;
|
|
|
44217
44213
|
});
|
|
44218
44214
|
wallet.command("disconnect").description("Revoke the stored WalletConnect session").option(
|
|
44219
44215
|
"--project-id <id>",
|
|
44220
|
-
"WalletConnect project ID (or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44216
|
+
"WalletConnect project ID override (default: Trust Wallet project; or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44221
44217
|
).option("--json", "JSON output").action(async (opts) => {
|
|
44222
44218
|
try {
|
|
44223
44219
|
const stored = await openStoredWalletConnect(opts.projectId);
|
|
@@ -44239,7 +44235,7 @@ ${qr3}`;
|
|
|
44239
44235
|
});
|
|
44240
44236
|
wallet.command("status").description("Check wallet configuration status").option(
|
|
44241
44237
|
"--project-id <id>",
|
|
44242
|
-
"WalletConnect project ID used to check the stored session (or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44238
|
+
"WalletConnect project ID override used to check the stored session (or WALLETCONNECT_PROJECT_ID / twak init --wc-project-id)"
|
|
44243
44239
|
).option("--json", "JSON output").action(async (opts) => {
|
|
44244
44240
|
try {
|
|
44245
44241
|
const store = new WalletConfigStore();
|
|
@@ -55132,7 +55128,10 @@ function registerServeCommand(program3) {
|
|
|
55132
55128
|
program3.command("serve").description("Start MCP server (stdio) or REST API server for AI agent connection").option("--rest", "Start REST HTTP server instead of MCP stdio server").option("--port <n>", "Port for REST server", "3000").option(
|
|
55133
55129
|
"--host <host>",
|
|
55134
55130
|
"Host to bind REST server (default: 127.0.0.1; use 0.0.0.0 to expose externally)"
|
|
55135
|
-
).option("--password <password>", "Wallet password (falls back to keychain)").option("--auto-lock <minutes>", "Auto-lock wallet after N minutes of inactivity").option(
|
|
55131
|
+
).option("--password <password>", "Wallet password (falls back to keychain)").option("--auto-lock <minutes>", "Auto-lock wallet after N minutes of inactivity").option(
|
|
55132
|
+
"--wc-project-id <id>",
|
|
55133
|
+
"WalletConnect project ID override (default: Trust Wallet project; or set WALLETCONNECT_PROJECT_ID)"
|
|
55134
|
+
).option(
|
|
55136
55135
|
"--watch",
|
|
55137
55136
|
"Run a background watcher that fires DCA/limit automations (created via CLI or the create_automation MCP action); requires the local agent wallet"
|
|
55138
55137
|
).option(
|
|
@@ -55165,10 +55164,10 @@ function registerServeCommand(program3) {
|
|
|
55165
55164
|
}
|
|
55166
55165
|
const wcProjectId = await resolveWcProjectId(opts.wcProjectId);
|
|
55167
55166
|
const walletContext = new WalletContext({
|
|
55168
|
-
walletConnectFactory:
|
|
55167
|
+
walletConnectFactory: () => createWalletConnectProvider(wcProjectId)
|
|
55169
55168
|
});
|
|
55170
55169
|
let resumeOutcome = "none";
|
|
55171
|
-
if (
|
|
55170
|
+
if (fs8.existsSync(wcStoragePath())) {
|
|
55172
55171
|
try {
|
|
55173
55172
|
const resumed = await withTimeout(
|
|
55174
55173
|
walletContext.restoreWalletConnect(),
|
|
@@ -56182,7 +56181,7 @@ var crypto8 = __toESM(require("crypto"));
|
|
|
56182
56181
|
// package.json
|
|
56183
56182
|
var package_default = {
|
|
56184
56183
|
name: "@trustwallet/cli",
|
|
56185
|
-
version: "0.
|
|
56184
|
+
version: "0.22.0",
|
|
56186
56185
|
description: "TWAK CLI \u2014 command-line interface for Trust Wallet Agent Kit",
|
|
56187
56186
|
main: "dist/index.js",
|
|
56188
56187
|
types: "dist/index.d.ts",
|
|
@@ -3,12 +3,15 @@ import { WalletConnectProvider } from '@twak/wallet';
|
|
|
3
3
|
export declare const RESTORE_TIMEOUT_MS = 10000;
|
|
4
4
|
/** The single WalletConnect session file shared by every twak command. */
|
|
5
5
|
export declare function wcStoragePath(): string;
|
|
6
|
+
/** Trust Wallet's WalletConnect project, used when none is configured.
|
|
7
|
+
* Project IDs are public identifiers (every web dApp ships one), not secrets. */
|
|
8
|
+
export declare const DEFAULT_WC_PROJECT_ID = "a863b78b54c4222603c8db4d6d880172";
|
|
6
9
|
/**
|
|
7
10
|
* Project ID resolution shared by `serve` and `wallet` commands:
|
|
8
11
|
* CLI flag, then WALLETCONNECT_PROJECT_ID, then ~/.twak/credentials.json
|
|
9
|
-
* (set by `twak init --wc-project-id`).
|
|
12
|
+
* (set by `twak init --wc-project-id`), then the built-in Trust Wallet project.
|
|
10
13
|
*/
|
|
11
|
-
export declare function resolveWcProjectId(flag?: string): Promise<string
|
|
14
|
+
export declare function resolveWcProjectId(flag?: string): Promise<string>;
|
|
12
15
|
/** A provider bound to the shared session file. */
|
|
13
16
|
export declare function createWalletConnectProvider(projectId: string): WalletConnectProvider;
|
|
14
17
|
/** Rejects with NETWORK_ERROR when `promise` does not settle within `ms`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletconnect-config.d.ts","sourceRoot":"","sources":["../src/walletconnect-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC,0EAA0E;AAC1E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"walletconnect-config.d.ts","sourceRoot":"","sources":["../src/walletconnect-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,QAAS,CAAC;AAEzC,0EAA0E;AAC1E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;iFACiF;AACjF,eAAO,MAAM,qBAAqB,qCAAqC,CAAC;AAExE;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CASvE;AAED,mDAAmD;AACnD,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,CAMpF;AAED,6EAA6E;AAC7E,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAahF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustwallet/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
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",
|
|
@@ -33,19 +33,19 @@
|
|
|
33
33
|
"tsup": "8.5.1",
|
|
34
34
|
"typescript": "5.7.3",
|
|
35
35
|
"vitest": "4.1.2",
|
|
36
|
-
"@twak/
|
|
37
|
-
"@twak/
|
|
38
|
-
"@twak/
|
|
39
|
-
"@twak/operations": "0.
|
|
40
|
-
"@twak/
|
|
41
|
-
"@twak/
|
|
42
|
-
"@twak/
|
|
43
|
-
"@twak/
|
|
44
|
-
"@twak/
|
|
45
|
-
"@twak/
|
|
46
|
-
"@twak/wallet
|
|
47
|
-
"@twak/
|
|
48
|
-
"@twak/
|
|
36
|
+
"@twak/actions": "0.22.0",
|
|
37
|
+
"@twak/contracts": "0.22.0",
|
|
38
|
+
"@twak/security": "0.22.0",
|
|
39
|
+
"@twak/operations": "0.22.0",
|
|
40
|
+
"@twak/transactions": "0.22.0",
|
|
41
|
+
"@twak/swap": "0.22.0",
|
|
42
|
+
"@twak/storage": "0.22.0",
|
|
43
|
+
"@twak/wallet-core": "0.22.0",
|
|
44
|
+
"@twak/walletconnect": "0.22.0",
|
|
45
|
+
"@twak/x402": "0.22.0",
|
|
46
|
+
"@twak/wallet": "0.22.0",
|
|
47
|
+
"@twak/core": "0.22.0",
|
|
48
|
+
"@twak/mcp": "0.22.0"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|