@zeroxyz/cli 1.18.0 → 1.19.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.
- package/dist/index.js +242 -47
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78449,7 +78449,7 @@ init_esm_shims();
|
|
|
78449
78449
|
// ../sdk/dist/index.js
|
|
78450
78450
|
init_esm_shims();
|
|
78451
78451
|
|
|
78452
|
-
// ../sdk/dist/chunk-
|
|
78452
|
+
// ../sdk/dist/chunk-CYB4Y3ID.js
|
|
78453
78453
|
init_esm_shims();
|
|
78454
78454
|
|
|
78455
78455
|
// ../../node_modules/.pnpm/viem@2.52.2_bufferutil@4.1.0_typescript@5.9.3_utf-8-validate@6.0.6_zod@4.3.6/node_modules/viem/_esm/index.js
|
|
@@ -143831,37 +143831,41 @@ config(en_default2());
|
|
|
143831
143831
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
143832
143832
|
var zod_default = external_exports3;
|
|
143833
143833
|
|
|
143834
|
-
// ../sdk/dist/chunk-
|
|
143835
|
-
var createManagedAccount = (client, address2) =>
|
|
143836
|
-
|
|
143837
|
-
|
|
143838
|
-
|
|
143839
|
-
|
|
143840
|
-
|
|
143841
|
-
|
|
143842
|
-
|
|
143843
|
-
|
|
143844
|
-
|
|
143845
|
-
|
|
143846
|
-
|
|
143847
|
-
|
|
143848
|
-
|
|
143849
|
-
|
|
143850
|
-
|
|
143851
|
-
|
|
143852
|
-
|
|
143853
|
-
|
|
143854
|
-
|
|
143855
|
-
|
|
143856
|
-
|
|
143857
|
-
|
|
143858
|
-
|
|
143859
|
-
|
|
143860
|
-
|
|
143861
|
-
|
|
143862
|
-
|
|
143863
|
-
|
|
143864
|
-
|
|
143834
|
+
// ../sdk/dist/chunk-CYB4Y3ID.js
|
|
143835
|
+
var createManagedAccount = (client, address2, opts = {}) => {
|
|
143836
|
+
const signOptions = {
|
|
143837
|
+
// expectedAddress pins verification to this adapter's frozen address.
|
|
143838
|
+
expectedAddress: address2,
|
|
143839
|
+
...opts.explicitWallet ? { walletAddress: address2 } : {}
|
|
143840
|
+
};
|
|
143841
|
+
return toAccount({
|
|
143842
|
+
address: address2,
|
|
143843
|
+
async signMessage({ message: message2 }) {
|
|
143844
|
+
return await client.auth.signMessage({ message: message2 }, signOptions);
|
|
143845
|
+
},
|
|
143846
|
+
async signTypedData(typedData) {
|
|
143847
|
+
const td = typedData;
|
|
143848
|
+
return await client.auth.signTypedData(
|
|
143849
|
+
{
|
|
143850
|
+
domain: td.domain,
|
|
143851
|
+
types: td.types,
|
|
143852
|
+
primaryType: td.primaryType,
|
|
143853
|
+
message: td.message
|
|
143854
|
+
},
|
|
143855
|
+
signOptions
|
|
143856
|
+
);
|
|
143857
|
+
},
|
|
143858
|
+
async signTransaction(transaction, options) {
|
|
143859
|
+
const serialize13 = options?.serializer ?? serializeTransaction;
|
|
143860
|
+
const unsigned = await serialize13(transaction);
|
|
143861
|
+
const signature2 = await client.auth.signTransaction(
|
|
143862
|
+
{ unsignedTransaction: unsigned },
|
|
143863
|
+
signOptions
|
|
143864
|
+
);
|
|
143865
|
+
return await serialize13(transaction, parseSignature2(signature2));
|
|
143866
|
+
}
|
|
143867
|
+
});
|
|
143868
|
+
};
|
|
143865
143869
|
var USDC_BASE = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913";
|
|
143866
143870
|
var USDC_TEMPO = "0x20c000000000000000000000b9537d11c60e8b50";
|
|
143867
143871
|
var TEMPO_CHAIN_ID = 4217;
|
|
@@ -144438,12 +144442,12 @@ var cancelBody = (response) => {
|
|
|
144438
144442
|
} catch {
|
|
144439
144443
|
}
|
|
144440
144444
|
};
|
|
144441
|
-
var resolveAccount = async (client, overrideAccount, signal) => {
|
|
144445
|
+
var resolveAccount = async (client, overrideAccount, signal, walletAddress) => {
|
|
144442
144446
|
if (overrideAccount) return overrideAccount;
|
|
144443
144447
|
const credentials = client.getCredentials();
|
|
144444
144448
|
if (credentials.kind === "account") return credentials.account;
|
|
144445
144449
|
if (credentials.kind === "session") {
|
|
144446
|
-
return await client.resolveManagedAccount(signal);
|
|
144450
|
+
return await client.resolveManagedAccount(signal, walletAddress);
|
|
144447
144451
|
}
|
|
144448
144452
|
throw new ZeroAuthError(
|
|
144449
144453
|
"auth_no_credentials",
|
|
@@ -144489,7 +144493,8 @@ var Payments = class {
|
|
|
144489
144493
|
const account = await resolveAccount(
|
|
144490
144494
|
this.client,
|
|
144491
144495
|
input.account,
|
|
144492
|
-
input.signal
|
|
144496
|
+
input.signal,
|
|
144497
|
+
input.walletAddress
|
|
144493
144498
|
);
|
|
144494
144499
|
let capturedAmount = null;
|
|
144495
144500
|
let capturedNetwork;
|
|
@@ -144624,7 +144629,8 @@ var Payments = class {
|
|
|
144624
144629
|
const account = await resolveAccount(
|
|
144625
144630
|
this.client,
|
|
144626
144631
|
input.account,
|
|
144627
|
-
input.signal
|
|
144632
|
+
input.signal,
|
|
144633
|
+
input.walletAddress
|
|
144628
144634
|
);
|
|
144629
144635
|
const configuredFetch = buildConfiguredFetch(this.client, {
|
|
144630
144636
|
timeoutMs: input.timeoutMs
|
|
@@ -145404,7 +145410,8 @@ var recordErrorFetchRun = async (client, opts, result, capabilityIdOverride) =>
|
|
|
145404
145410
|
...fetchOriginForRecord && { fetchOrigin: fetchOriginForRecord },
|
|
145405
145411
|
...result.status !== null && { status: result.status },
|
|
145406
145412
|
latencyMs: result.latencyMs,
|
|
145407
|
-
...opts.requestSchema && { requestSchema: opts.requestSchema }
|
|
145413
|
+
...opts.requestSchema && { requestSchema: opts.requestSchema },
|
|
145414
|
+
...opts.walletAddress && !opts.account && { walletAddress: opts.walletAddress }
|
|
145408
145415
|
});
|
|
145409
145416
|
result.runId = created.runId;
|
|
145410
145417
|
delete result.runTrackingSkipped;
|
|
@@ -145513,6 +145520,7 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145513
145520
|
body: requestBody,
|
|
145514
145521
|
maxPay: opts.maxPay,
|
|
145515
145522
|
account: opts.account,
|
|
145523
|
+
...opts.walletAddress && { walletAddress: opts.walletAddress },
|
|
145516
145524
|
signal: opts.signal,
|
|
145517
145525
|
timeoutMs: opts.timeoutMs,
|
|
145518
145526
|
...opts.displayCostAmount && {
|
|
@@ -145685,6 +145693,10 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145685
145693
|
...opts.capabilityId === void 0 ? { fetchOrigin: "direct_url" } : opts.fetchOrigin && { fetchOrigin: opts.fetchOrigin },
|
|
145686
145694
|
status: response.status,
|
|
145687
145695
|
latencyMs,
|
|
145696
|
+
// Attribute to the selected wallet in session mode. Skipped when a
|
|
145697
|
+
// per-call `account` override records the run — that account's own
|
|
145698
|
+
// EIP-191 identity is the attribution.
|
|
145699
|
+
...opts.walletAddress && !opts.account && { walletAddress: opts.walletAddress },
|
|
145688
145700
|
...opts.requestSchema && { requestSchema: opts.requestSchema },
|
|
145689
145701
|
...derived?.responseSchema && {
|
|
145690
145702
|
responseSchema: derived.responseSchema
|
|
@@ -145748,7 +145760,7 @@ var clientFetch = async (client, url4, opts = {}) => {
|
|
|
145748
145760
|
return result;
|
|
145749
145761
|
};
|
|
145750
145762
|
var package_default = {
|
|
145751
|
-
version: "0.
|
|
145763
|
+
version: "0.13.0"
|
|
145752
145764
|
};
|
|
145753
145765
|
var SDK_VERSION2 = package_default.version;
|
|
145754
145766
|
var agentAuthMetadataSchema = external_exports3.object({
|
|
@@ -146233,6 +146245,9 @@ var userWalletDtoSchema = external_exports3.object({
|
|
|
146233
146245
|
walletAddress: external_exports3.string(),
|
|
146234
146246
|
source: external_exports3.enum(["self_custody", "privy_embedded"]),
|
|
146235
146247
|
isPrimary: external_exports3.boolean(),
|
|
146248
|
+
// Owner-chosen display name; null/absent = unnamed (show the address).
|
|
146249
|
+
// Optional so the SDK tolerates servers that predate nicknames.
|
|
146250
|
+
nickname: external_exports3.string().nullable().optional(),
|
|
146236
146251
|
linkedAt: external_exports3.union([external_exports3.string(), external_exports3.date()]).nullable().optional(),
|
|
146237
146252
|
importedAt: external_exports3.union([external_exports3.string(), external_exports3.date()]).nullable().optional(),
|
|
146238
146253
|
delegationGranted: external_exports3.boolean(),
|
|
@@ -146446,7 +146461,10 @@ var Auth = class {
|
|
|
146446
146461
|
{
|
|
146447
146462
|
method: "POST",
|
|
146448
146463
|
path: "/v1/users/me/sign-message",
|
|
146449
|
-
body: {
|
|
146464
|
+
body: {
|
|
146465
|
+
message: normalizeMessage(input.message),
|
|
146466
|
+
...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
|
|
146467
|
+
}
|
|
146450
146468
|
},
|
|
146451
146469
|
signResponseSchema
|
|
146452
146470
|
);
|
|
@@ -146471,7 +146489,10 @@ var Auth = class {
|
|
|
146471
146489
|
{
|
|
146472
146490
|
method: "POST",
|
|
146473
146491
|
path: "/v1/users/me/sign-transaction",
|
|
146474
|
-
body: {
|
|
146492
|
+
body: {
|
|
146493
|
+
unsignedTransaction: input.unsignedTransaction,
|
|
146494
|
+
...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
|
|
146495
|
+
}
|
|
146475
146496
|
},
|
|
146476
146497
|
signResponseSchema
|
|
146477
146498
|
);
|
|
@@ -146510,7 +146531,10 @@ var Auth = class {
|
|
|
146510
146531
|
{
|
|
146511
146532
|
method: "POST",
|
|
146512
146533
|
path: "/v1/users/me/sign-typed-data",
|
|
146513
|
-
body: {
|
|
146534
|
+
body: {
|
|
146535
|
+
typedData: input,
|
|
146536
|
+
...opts.walletAddress ? { walletAddress: opts.walletAddress } : {}
|
|
146537
|
+
}
|
|
146514
146538
|
},
|
|
146515
146539
|
signResponseSchema
|
|
146516
146540
|
);
|
|
@@ -146881,6 +146905,9 @@ var Runs = class {
|
|
|
146881
146905
|
if (params.unreviewed !== void 0) query.unreviewed = params.unreviewed;
|
|
146882
146906
|
if (params.limit !== void 0) query.limit = params.limit;
|
|
146883
146907
|
if (params.cursor !== void 0) query.cursor = params.cursor;
|
|
146908
|
+
if (params.walletAddress !== void 0) {
|
|
146909
|
+
query.walletAddress = Array.isArray(params.walletAddress) ? params.walletAddress.join(",") : params.walletAddress;
|
|
146910
|
+
}
|
|
146884
146911
|
return request2(
|
|
146885
146912
|
this.client,
|
|
146886
146913
|
{
|
|
@@ -147016,6 +147043,50 @@ var Wallet = class {
|
|
|
147016
147043
|
},
|
|
147017
147044
|
userWalletDtoSchema
|
|
147018
147045
|
);
|
|
147046
|
+
// Re-stamp Zero's signing delegation on a profile wallet (default: the
|
|
147047
|
+
// primary). Session-only. Naming a wallet re-authorizes THAT wallet and
|
|
147048
|
+
// never provisions; the server 404s an address not on the profile.
|
|
147049
|
+
reauthorizeDelegation = (opts = {}) => request2(
|
|
147050
|
+
this.client,
|
|
147051
|
+
{
|
|
147052
|
+
method: "POST",
|
|
147053
|
+
path: "/v1/users/me/wallets/provision",
|
|
147054
|
+
...opts.walletAddress ? { body: { walletAddress: opts.walletAddress } } : {},
|
|
147055
|
+
signal: opts.signal
|
|
147056
|
+
},
|
|
147057
|
+
userWalletDtoSchema
|
|
147058
|
+
);
|
|
147059
|
+
// Revoke Zero's signing delegation on a profile wallet (default: the
|
|
147060
|
+
// primary). Session-only. Managed signing on that wallet 403s until it is
|
|
147061
|
+
// re-authorized. Note: this stamps the server-side gate — removing Zero's
|
|
147062
|
+
// signer cryptographically is owner-authorized and happens in the user's
|
|
147063
|
+
// Privy session (the web profile page does both).
|
|
147064
|
+
revokeDelegation = (opts = {}) => request2(
|
|
147065
|
+
this.client,
|
|
147066
|
+
{
|
|
147067
|
+
method: "DELETE",
|
|
147068
|
+
path: "/v1/users/me/wallets/delegation",
|
|
147069
|
+
...opts.walletAddress ? { query: { walletAddress: opts.walletAddress } } : {},
|
|
147070
|
+
signal: opts.signal
|
|
147071
|
+
},
|
|
147072
|
+
userWalletDtoSchema
|
|
147073
|
+
);
|
|
147074
|
+
// Set, change, or clear (null / empty string) the owner-chosen nickname on
|
|
147075
|
+
// a profile wallet. Session-only. Nicknames are private to the
|
|
147076
|
+
// authenticated user — they never appear on reviews or public surfaces.
|
|
147077
|
+
setNickname = (opts) => request2(
|
|
147078
|
+
this.client,
|
|
147079
|
+
{
|
|
147080
|
+
method: "PATCH",
|
|
147081
|
+
path: "/v1/users/me/wallets/nickname",
|
|
147082
|
+
body: {
|
|
147083
|
+
walletAddress: opts.walletAddress,
|
|
147084
|
+
nickname: opts.nickname
|
|
147085
|
+
},
|
|
147086
|
+
signal: opts.signal
|
|
147087
|
+
},
|
|
147088
|
+
userWalletDtoSchema
|
|
147089
|
+
);
|
|
147019
147090
|
// Link an existing self-custody wallet to the session user by private key.
|
|
147020
147091
|
// Session-only. 409s when the wallet is already linked (to this or another
|
|
147021
147092
|
// profile — the error message says which).
|
|
@@ -147026,7 +147097,8 @@ var Wallet = class {
|
|
|
147026
147097
|
path: "/v1/users/me/wallets/import",
|
|
147027
147098
|
body: {
|
|
147028
147099
|
privateKey: opts.privateKey,
|
|
147029
|
-
...opts.makePrimary !== void 0 ? { makePrimary: opts.makePrimary } : {}
|
|
147100
|
+
...opts.makePrimary !== void 0 ? { makePrimary: opts.makePrimary } : {},
|
|
147101
|
+
...opts.nickname !== void 0 ? { nickname: opts.nickname } : {}
|
|
147030
147102
|
},
|
|
147031
147103
|
signal: opts.signal
|
|
147032
147104
|
},
|
|
@@ -147223,6 +147295,9 @@ var ZeroClient = class _ZeroClient {
|
|
|
147223
147295
|
managedAccountInFlight = null;
|
|
147224
147296
|
managedAccountAC = null;
|
|
147225
147297
|
managedAccountGen = 0;
|
|
147298
|
+
// Explicitly-selected (non-default) managed wallets, keyed by lowercased
|
|
147299
|
+
// address. Same lifecycle as managedAccount: cleared on clearManagedAccount.
|
|
147300
|
+
managedAccountByAddress = /* @__PURE__ */ new Map();
|
|
147226
147301
|
// Multi-tenant servers calling `client.fetch(url, { account: tenantAccount })`
|
|
147227
147302
|
// on every request would otherwise construct a new ZeroClient (with
|
|
147228
147303
|
// five namespace instances) per call. Keyed by lowercased account
|
|
@@ -147444,8 +147519,16 @@ var ZeroClient = class _ZeroClient {
|
|
|
147444
147519
|
}
|
|
147445
147520
|
this.withAccountCache.clear();
|
|
147446
147521
|
};
|
|
147447
|
-
/**
|
|
147448
|
-
|
|
147522
|
+
/**
|
|
147523
|
+
* @internal — used by payments.pay() in session mode. Cached, dedupes
|
|
147524
|
+
* concurrent lookups. Pass `walletAddress` to sign as a specific profile
|
|
147525
|
+
* wallet instead of the primary; explicit wallets are cached per address
|
|
147526
|
+
* and their sign requests carry the address so intent and signer agree.
|
|
147527
|
+
*/
|
|
147528
|
+
resolveManagedAccount = (signal, walletAddress) => {
|
|
147529
|
+
if (walletAddress) {
|
|
147530
|
+
return this.resolveManagedAccountByAddress(walletAddress, signal);
|
|
147531
|
+
}
|
|
147449
147532
|
if (this.managedAccount) return Promise.resolve(this.managedAccount);
|
|
147450
147533
|
if (this.managedAccountInFlight) {
|
|
147451
147534
|
return this.raceWithSignal(this.managedAccountInFlight, signal);
|
|
@@ -147487,6 +147570,42 @@ var ZeroClient = class _ZeroClient {
|
|
|
147487
147570
|
});
|
|
147488
147571
|
return this.raceWithSignal(this.managedAccountInFlight, signal);
|
|
147489
147572
|
};
|
|
147573
|
+
// Explicit-wallet variant of resolveManagedAccount. No in-flight dedupe:
|
|
147574
|
+
// this is the rare path (per-wallet pay), the resolution is idempotent, and
|
|
147575
|
+
// the per-address cache absorbs repeat calls.
|
|
147576
|
+
resolveManagedAccountByAddress = async (walletAddress, signal) => {
|
|
147577
|
+
if (this.credentials.kind !== "session") {
|
|
147578
|
+
throw new ZeroAuthError(
|
|
147579
|
+
"auth_no_credentials",
|
|
147580
|
+
"resolveManagedAccount() requires session credentials."
|
|
147581
|
+
);
|
|
147582
|
+
}
|
|
147583
|
+
const canonical = getAddress(walletAddress);
|
|
147584
|
+
const cached2 = this.managedAccountByAddress.get(canonical.toLowerCase());
|
|
147585
|
+
if (cached2) return cached2;
|
|
147586
|
+
const startedAtGen = this.managedAccountGen;
|
|
147587
|
+
const wallets = await this.auth.wallets({ signal });
|
|
147588
|
+
const match = wallets.find(
|
|
147589
|
+
(w) => w.walletAddress.toLowerCase() === canonical.toLowerCase()
|
|
147590
|
+
);
|
|
147591
|
+
if (!match || match.source !== "privy_embedded") {
|
|
147592
|
+
throw new ZeroAuthError(
|
|
147593
|
+
"auth_error",
|
|
147594
|
+
`Wallet ${canonical} is not a Privy-embedded wallet on this profile. Managed signing can only use profile wallets (see client.wallet.list()).`
|
|
147595
|
+
);
|
|
147596
|
+
}
|
|
147597
|
+
if (this.managedAccountGen !== startedAtGen) {
|
|
147598
|
+
throw new ZeroAuthError(
|
|
147599
|
+
"auth_session_expired",
|
|
147600
|
+
"Session cleared during managed-account resolution. Retry to rebuild against the current session."
|
|
147601
|
+
);
|
|
147602
|
+
}
|
|
147603
|
+
const acc = createManagedAccount(this, canonical, {
|
|
147604
|
+
explicitWallet: true
|
|
147605
|
+
});
|
|
147606
|
+
this.managedAccountByAddress.set(canonical.toLowerCase(), acc);
|
|
147607
|
+
return acc;
|
|
147608
|
+
};
|
|
147490
147609
|
// Per-caller signal gate: each caller can reject on their own abort
|
|
147491
147610
|
// without cancelling the shared underlying promise.
|
|
147492
147611
|
raceWithSignal = (p, signal) => {
|
|
@@ -147517,6 +147636,7 @@ var ZeroClient = class _ZeroClient {
|
|
|
147517
147636
|
this.managedAccountAC?.abort();
|
|
147518
147637
|
this.managedAccountInFlight = null;
|
|
147519
147638
|
this.managedAccountAC = null;
|
|
147639
|
+
this.managedAccountByAddress.clear();
|
|
147520
147640
|
this.managedAccountGen++;
|
|
147521
147641
|
};
|
|
147522
147642
|
/** @internal — Read cached managed account without triggering resolution. */
|
|
@@ -147782,7 +147902,7 @@ var placeholderFor = (fieldName, propSchema) => String(sampleValueFor(fieldName,
|
|
|
147782
147902
|
|
|
147783
147903
|
// package.json
|
|
147784
147904
|
var package_default2 = {
|
|
147785
|
-
version: "1.
|
|
147905
|
+
version: "1.19.0"};
|
|
147786
147906
|
|
|
147787
147907
|
// src/app.ts
|
|
147788
147908
|
init_esm_shims();
|
|
@@ -149408,6 +149528,9 @@ var fetchCommand = (appContext) => new Command("fetch").description(
|
|
|
149408
149528
|
"--data-stdin",
|
|
149409
149529
|
"Read the request body from stdin (equivalent to `-d @-`)."
|
|
149410
149530
|
).option("-H, --header <header...>", "Headers in Key:Value format").option("--max-pay <amount>", "Maximum per-call spend limit (USDC)").option(
|
|
149531
|
+
"--wallet-address <address>",
|
|
149532
|
+
"Pay/sign from this profile wallet instead of the primary (managed signing; must be a delegated wallet on your profile)"
|
|
149533
|
+
).option(
|
|
149411
149534
|
"--timeout <seconds>",
|
|
149412
149535
|
"Per-request timeout in seconds, overriding the default (180). Applies to each HTTP leg of the call (probe and paid retry), not as a wall-clock deadline."
|
|
149413
149536
|
).option(
|
|
@@ -149545,6 +149668,9 @@ var fetchCommand = (appContext) => new Command("fetch").description(
|
|
|
149545
149668
|
headers,
|
|
149546
149669
|
...resolvedBody !== void 0 && { body: resolvedBody },
|
|
149547
149670
|
...options.maxPay && { maxPay: options.maxPay },
|
|
149671
|
+
...options.walletAddress && {
|
|
149672
|
+
walletAddress: options.walletAddress
|
|
149673
|
+
},
|
|
149548
149674
|
...timeoutMs !== void 0 && { timeoutMs },
|
|
149549
149675
|
// Raise the SDK's default 10 MB response cap — the CLI
|
|
149550
149676
|
// is a streaming sink for paid binary media (audio, video,
|
|
@@ -151420,9 +151546,13 @@ Examples:
|
|
|
151420
151546
|
zero runs # most recent runs
|
|
151421
151547
|
zero runs --unreviewed # filter to runs without a review
|
|
151422
151548
|
zero runs --capability translate-en # filter to one capability (uid or slug)
|
|
151549
|
+
zero runs --wallet-address 0xabc\u2026 # filter to one of your profile wallets
|
|
151423
151550
|
zero runs --json # full structured output for scripts
|
|
151424
151551
|
zero runs detail <runId> # full server-side metadata for a run`
|
|
151425
151552
|
).option("--capability <id>", "Filter by capability uid or slug").option("--unreviewed", "Only show runs without a review").option(
|
|
151553
|
+
"--wallet-address <addresses>",
|
|
151554
|
+
"Filter to specific profile wallets (comma-separated). Default: all profile wallets"
|
|
151555
|
+
).option(
|
|
151426
151556
|
"--limit <n>",
|
|
151427
151557
|
"Max rows (1-100, default 25)",
|
|
151428
151558
|
(v) => Number.parseInt(v, 10)
|
|
@@ -151436,6 +151566,7 @@ Examples:
|
|
|
151436
151566
|
const result = await client.runs.list({
|
|
151437
151567
|
capabilityId: options.capability,
|
|
151438
151568
|
unreviewed: options.unreviewed,
|
|
151569
|
+
...options.walletAddress ? { walletAddress: options.walletAddress } : {},
|
|
151439
151570
|
limit: options.limit
|
|
151440
151571
|
});
|
|
151441
151572
|
if (options.json) {
|
|
@@ -152133,7 +152264,10 @@ var walletImportCommand = (appContext) => new Command("import").description(
|
|
|
152133
152264
|
).argument("[privateKey]", "Hex-encoded private key (0x prefix optional)").option(
|
|
152134
152265
|
"--key-stdin",
|
|
152135
152266
|
"Read the private key from stdin instead of an argument"
|
|
152136
|
-
).option("--primary", "Make the imported wallet your primary payer wallet").
|
|
152267
|
+
).option("--primary", "Make the imported wallet your primary payer wallet").option(
|
|
152268
|
+
"--nickname <name>",
|
|
152269
|
+
"Nickname for the imported wallet (private to you; max 64 chars)"
|
|
152270
|
+
).action(
|
|
152137
152271
|
async (privateKeyArg, options) => {
|
|
152138
152272
|
const { analyticsService, client } = appContext.services;
|
|
152139
152273
|
if (privateKeyArg && options.keyStdin) {
|
|
@@ -152180,7 +152314,8 @@ var walletImportCommand = (appContext) => new Command("import").description(
|
|
|
152180
152314
|
try {
|
|
152181
152315
|
wallet = await client.wallet.import({
|
|
152182
152316
|
privateKey,
|
|
152183
|
-
...options.primary ? { makePrimary: true } : {}
|
|
152317
|
+
...options.primary ? { makePrimary: true } : {},
|
|
152318
|
+
...options.nickname ? { nickname: options.nickname } : {}
|
|
152184
152319
|
});
|
|
152185
152320
|
} catch (err) {
|
|
152186
152321
|
if (err instanceof ZeroApiError) {
|
|
@@ -152259,6 +152394,7 @@ var walletListCommand = (appContext) => new Command("list").description("List th
|
|
|
152259
152394
|
(wallet.isPrimary ? "PRIMARY" : "").padEnd(7),
|
|
152260
152395
|
wallet.delegationGranted ? "delegated" : "not delegated"
|
|
152261
152396
|
];
|
|
152397
|
+
if (wallet.nickname) columns.push(`"${wallet.nickname}"`);
|
|
152262
152398
|
console.log(columns.join(" ").trimEnd());
|
|
152263
152399
|
}
|
|
152264
152400
|
}
|
|
@@ -152344,6 +152480,64 @@ var walletGenerateCommand = (appContext) => new Command("generate").description(
|
|
|
152344
152480
|
});
|
|
152345
152481
|
}
|
|
152346
152482
|
);
|
|
152483
|
+
var walletNicknameCommand = (appContext) => new Command("nickname").description(
|
|
152484
|
+
"Set or clear a nickname on one of your profile wallets (private to you)"
|
|
152485
|
+
).argument("<address>", "Wallet address (0x\u2026) on your profile").argument(
|
|
152486
|
+
"[name]",
|
|
152487
|
+
"Nickname to set (max 64 chars). Omit with --clear to remove it."
|
|
152488
|
+
).option("--clear", "Clear the wallet's nickname").action(
|
|
152489
|
+
async (address2, name, options) => {
|
|
152490
|
+
const { analyticsService, client } = appContext.services;
|
|
152491
|
+
if (options.clear && name !== void 0) {
|
|
152492
|
+
console.error("Pass a nickname OR --clear, not both.");
|
|
152493
|
+
process.exitCode = 1;
|
|
152494
|
+
return;
|
|
152495
|
+
}
|
|
152496
|
+
if (!options.clear && (name === void 0 || name.trim() === "")) {
|
|
152497
|
+
console.error(
|
|
152498
|
+
"Missing nickname. Pass one as an argument, or use --clear to remove it."
|
|
152499
|
+
);
|
|
152500
|
+
process.exitCode = 1;
|
|
152501
|
+
return;
|
|
152502
|
+
}
|
|
152503
|
+
if (client.getCredentials().kind !== "session") {
|
|
152504
|
+
console.error(SIGN_IN_FIRST_MESSAGE);
|
|
152505
|
+
process.exitCode = 1;
|
|
152506
|
+
return;
|
|
152507
|
+
}
|
|
152508
|
+
let wallet;
|
|
152509
|
+
try {
|
|
152510
|
+
wallet = await client.wallet.setNickname({
|
|
152511
|
+
walletAddress: address2,
|
|
152512
|
+
nickname: options.clear ? null : name
|
|
152513
|
+
});
|
|
152514
|
+
} catch (err) {
|
|
152515
|
+
if (err instanceof ZeroApiError) {
|
|
152516
|
+
if (err.status === 401) {
|
|
152517
|
+
console.error(
|
|
152518
|
+
"Session expired. Run `zero auth login` and try again."
|
|
152519
|
+
);
|
|
152520
|
+
} else if (err.status === 404) {
|
|
152521
|
+
console.error(
|
|
152522
|
+
"Wallet not found on your profile. Run `zero wallet list` to see your wallets."
|
|
152523
|
+
);
|
|
152524
|
+
} else {
|
|
152525
|
+
console.error(`Could not update nickname: ${err.message}`);
|
|
152526
|
+
}
|
|
152527
|
+
} else {
|
|
152528
|
+
console.error("Could not update nickname: network error.");
|
|
152529
|
+
}
|
|
152530
|
+
process.exitCode = 1;
|
|
152531
|
+
return;
|
|
152532
|
+
}
|
|
152533
|
+
console.log(
|
|
152534
|
+
wallet.nickname ? `Nickname set: ${wallet.walletAddress} \u2192 "${wallet.nickname}"` : `Nickname cleared for ${wallet.walletAddress}`
|
|
152535
|
+
);
|
|
152536
|
+
analyticsService.capture("wallet_nickname_set", {
|
|
152537
|
+
cleared: Boolean(options.clear)
|
|
152538
|
+
});
|
|
152539
|
+
}
|
|
152540
|
+
);
|
|
152347
152541
|
var walletCommand = (appContext) => {
|
|
152348
152542
|
const cmd = new Command("wallet").description("Manage your wallet");
|
|
152349
152543
|
cmd.addCommand(walletBalanceCommand(appContext));
|
|
@@ -152353,6 +152547,7 @@ var walletCommand = (appContext) => {
|
|
|
152353
152547
|
cmd.addCommand(walletGenerateCommand(appContext));
|
|
152354
152548
|
cmd.addCommand(walletImportCommand(appContext));
|
|
152355
152549
|
cmd.addCommand(walletListCommand(appContext));
|
|
152550
|
+
cmd.addCommand(walletNicknameCommand(appContext));
|
|
152356
152551
|
return cmd;
|
|
152357
152552
|
};
|
|
152358
152553
|
|