@zoralabs/cli 1.4.2 → 1.5.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 +358 -146
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-WF24B44I.js";
|
|
6
6
|
|
|
7
7
|
// src/index.tsx
|
|
8
|
-
import { Command as
|
|
8
|
+
import { Command as Command18 } from "commander";
|
|
9
9
|
import { ExitPromptError } from "@inquirer/core";
|
|
10
10
|
import "fs";
|
|
11
11
|
import { setApiBaseUrl } from "@zoralabs/coins-sdk";
|
|
@@ -1551,7 +1551,7 @@ var getWalletAddresses = () => {
|
|
|
1551
1551
|
var commonProperties = () => {
|
|
1552
1552
|
const addresses = getWalletAddresses();
|
|
1553
1553
|
return {
|
|
1554
|
-
cli_version: true ? "1.
|
|
1554
|
+
cli_version: true ? "1.5.0" : "development",
|
|
1555
1555
|
os: process.platform,
|
|
1556
1556
|
arch: process.arch,
|
|
1557
1557
|
node_version: process.version,
|
|
@@ -1902,6 +1902,42 @@ import { createPublicClient as createPublicClient3, http as http3 } from "viem";
|
|
|
1902
1902
|
import { base as base6 } from "viem/chains";
|
|
1903
1903
|
import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
|
|
1904
1904
|
|
|
1905
|
+
// src/lib/agent-harness.ts
|
|
1906
|
+
import { existsSync as existsSync2 } from "fs";
|
|
1907
|
+
import { join as join2 } from "path";
|
|
1908
|
+
var AGENT_HARNESS_ORDER = [
|
|
1909
|
+
"claude",
|
|
1910
|
+
"cursor",
|
|
1911
|
+
"windsurf",
|
|
1912
|
+
"openclaw",
|
|
1913
|
+
"hermes"
|
|
1914
|
+
];
|
|
1915
|
+
var AGENT_HARNESS_SKILLS_DIRS = {
|
|
1916
|
+
claude: ".claude/skills",
|
|
1917
|
+
cursor: ".cursor/skills",
|
|
1918
|
+
windsurf: ".windsurf/skills",
|
|
1919
|
+
openclaw: ".openclaw/skills",
|
|
1920
|
+
hermes: ".hermes/skills"
|
|
1921
|
+
};
|
|
1922
|
+
var AGENT_HARNESS_ROOT_DIRS = {
|
|
1923
|
+
claude: ".claude",
|
|
1924
|
+
cursor: ".cursor",
|
|
1925
|
+
windsurf: ".windsurf",
|
|
1926
|
+
openclaw: ".openclaw",
|
|
1927
|
+
hermes: ".hermes"
|
|
1928
|
+
};
|
|
1929
|
+
var AGENT_HARNESS_TO_UAPI = {
|
|
1930
|
+
claude: "CLAUDE",
|
|
1931
|
+
cursor: "CURSOR",
|
|
1932
|
+
windsurf: "WINDSURF",
|
|
1933
|
+
openclaw: "OPENCLAW",
|
|
1934
|
+
hermes: "HERMES"
|
|
1935
|
+
};
|
|
1936
|
+
var detectAgentHarness = (cwd) => AGENT_HARNESS_ORDER.find(
|
|
1937
|
+
(agent) => existsSync2(join2(cwd, AGENT_HARNESS_ROOT_DIRS[agent]))
|
|
1938
|
+
);
|
|
1939
|
+
var mapAgentHarnessToUapi = (harness) => AGENT_HARNESS_TO_UAPI[harness];
|
|
1940
|
+
|
|
1905
1941
|
// src/lib/privy-session.ts
|
|
1906
1942
|
import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
|
|
1907
1943
|
var EXPIRY_SKEW_MS = 6e4;
|
|
@@ -2899,20 +2935,22 @@ async function onboardAgent(opts) {
|
|
|
2899
2935
|
`Failed to save API key: ${fsErrorMessage(err, getConfigPath())}`
|
|
2900
2936
|
);
|
|
2901
2937
|
}
|
|
2902
|
-
if (opts.username !== void 0 || opts.bio !== void 0 || opts.avatar !== void 0) {
|
|
2938
|
+
if (opts.username !== void 0 || opts.bio !== void 0 || opts.avatar !== void 0 || opts.agentHarness !== void 0) {
|
|
2903
2939
|
const chosen = [
|
|
2904
2940
|
opts.username !== void 0 ? "username" : void 0,
|
|
2905
2941
|
opts.bio !== void 0 ? "bio" : void 0,
|
|
2906
|
-
opts.avatar ? "avatar" : void 0
|
|
2942
|
+
opts.avatar ? "avatar" : void 0,
|
|
2943
|
+
opts.agentHarness !== void 0 ? "agent harness" : void 0
|
|
2907
2944
|
].filter((field) => field !== void 0);
|
|
2908
2945
|
progress(
|
|
2909
2946
|
"profile",
|
|
2910
2947
|
`applying the chosen ${new Intl.ListFormat("en", { type: "conjunction" }).format(chosen)}`
|
|
2911
2948
|
);
|
|
2912
|
-
if (opts.username !== void 0 || opts.bio !== void 0) {
|
|
2949
|
+
if (opts.username !== void 0 || opts.bio !== void 0 || opts.agentHarness !== void 0) {
|
|
2913
2950
|
profile = await updateAgentProfile(session.accessToken, {
|
|
2914
2951
|
username: opts.username,
|
|
2915
|
-
bio: opts.bio
|
|
2952
|
+
bio: opts.bio,
|
|
2953
|
+
...opts.agentHarness ? { agentHarness: mapAgentHarnessToUapi(opts.agentHarness) } : {}
|
|
2916
2954
|
});
|
|
2917
2955
|
}
|
|
2918
2956
|
if (opts.avatar) {
|
|
@@ -3313,6 +3351,7 @@ Re-running 'agent create' will mint another ${what} for it.`;
|
|
|
3313
3351
|
appId: options.appId,
|
|
3314
3352
|
origin: options.origin,
|
|
3315
3353
|
chainId,
|
|
3354
|
+
agentHarness: detectAgentHarness(process.cwd()),
|
|
3316
3355
|
rpcUrl: options.rpcUrl,
|
|
3317
3356
|
dryRun: Boolean(options.dryRun),
|
|
3318
3357
|
skipCoin: Boolean(options.skipCoin),
|
|
@@ -6112,11 +6151,10 @@ ${err instanceof Error ? err.stack || err.message : String(err)}
|
|
|
6112
6151
|
});
|
|
6113
6152
|
});
|
|
6114
6153
|
|
|
6115
|
-
// src/commands/
|
|
6154
|
+
// src/commands/claim.ts
|
|
6116
6155
|
import confirm4 from "@inquirer/confirm";
|
|
6117
6156
|
import {
|
|
6118
|
-
|
|
6119
|
-
getCoinComments,
|
|
6157
|
+
getProfile as getProfile2,
|
|
6120
6158
|
prepareUserOperation,
|
|
6121
6159
|
setApiKey as setApiKey3,
|
|
6122
6160
|
submitUserOperation,
|
|
@@ -6124,7 +6162,207 @@ import {
|
|
|
6124
6162
|
toUserOperationCalls
|
|
6125
6163
|
} from "@zoralabs/coins-sdk";
|
|
6126
6164
|
import { Command as Command5 } from "commander";
|
|
6127
|
-
import { isAddress as isAddress4 } from "viem";
|
|
6165
|
+
import { formatUnits as formatUnits5, isAddress as isAddress4 } from "viem";
|
|
6166
|
+
var CREATOR_COIN_DECIMALS = 18;
|
|
6167
|
+
var CREATOR_COIN_VESTING_ABI = [
|
|
6168
|
+
{
|
|
6169
|
+
type: "function",
|
|
6170
|
+
name: "claimVesting",
|
|
6171
|
+
stateMutability: "nonpayable",
|
|
6172
|
+
inputs: [],
|
|
6173
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
6174
|
+
},
|
|
6175
|
+
{
|
|
6176
|
+
type: "function",
|
|
6177
|
+
name: "getClaimableAmount",
|
|
6178
|
+
stateMutability: "view",
|
|
6179
|
+
inputs: [],
|
|
6180
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
6181
|
+
}
|
|
6182
|
+
];
|
|
6183
|
+
var claimCommand = new Command5("claim").description("Claim vested rewards from your creator coin").option(
|
|
6184
|
+
"--coin <address>",
|
|
6185
|
+
"Creator coin address to claim from (defaults to your own)"
|
|
6186
|
+
).option("--yes", "Skip confirmation and execute directly").action(async function(opts) {
|
|
6187
|
+
const json = getJson(this);
|
|
6188
|
+
const apiKey = getApiKey();
|
|
6189
|
+
if (apiKey) {
|
|
6190
|
+
setApiKey3(apiKey);
|
|
6191
|
+
}
|
|
6192
|
+
const { privateKeyAccount, smartWalletAccount } = await resolveAccounts();
|
|
6193
|
+
const { publicClient, walletClient, bundlerClient } = createClients(
|
|
6194
|
+
privateKeyAccount,
|
|
6195
|
+
smartWalletAccount
|
|
6196
|
+
);
|
|
6197
|
+
if (!!smartWalletAccount && !bundlerClient) {
|
|
6198
|
+
return outputErrorAndExit(
|
|
6199
|
+
json,
|
|
6200
|
+
"Failed to obtain bundler client for your smart wallet. Please try again. If the problem persists, ensure your smart wallet is setup correctly."
|
|
6201
|
+
);
|
|
6202
|
+
}
|
|
6203
|
+
const walletAddress = smartWalletAccount?.address ?? privateKeyAccount.address;
|
|
6204
|
+
let coinAddress;
|
|
6205
|
+
if (opts.coin) {
|
|
6206
|
+
if (!isAddress4(opts.coin)) {
|
|
6207
|
+
return outputErrorAndExit(json, `Invalid --coin address: ${opts.coin}`);
|
|
6208
|
+
}
|
|
6209
|
+
coinAddress = opts.coin;
|
|
6210
|
+
} else {
|
|
6211
|
+
let resolved;
|
|
6212
|
+
try {
|
|
6213
|
+
const response = await getProfile2({ identifier: walletAddress });
|
|
6214
|
+
resolved = response?.data?.profile?.creatorCoin?.address;
|
|
6215
|
+
} catch (err) {
|
|
6216
|
+
return outputErrorAndExit(
|
|
6217
|
+
json,
|
|
6218
|
+
`Failed to look up your creator coin: ${err instanceof Error ? err.message : String(err)}`
|
|
6219
|
+
);
|
|
6220
|
+
}
|
|
6221
|
+
if (!resolved || !isAddress4(resolved)) {
|
|
6222
|
+
return outputErrorAndExit(
|
|
6223
|
+
json,
|
|
6224
|
+
"No creator coin found for your wallet.",
|
|
6225
|
+
"Create your creator coin on Zora first, or pass one with --coin <address>."
|
|
6226
|
+
);
|
|
6227
|
+
}
|
|
6228
|
+
coinAddress = resolved;
|
|
6229
|
+
}
|
|
6230
|
+
let claimable;
|
|
6231
|
+
try {
|
|
6232
|
+
claimable = await publicClient.readContract({
|
|
6233
|
+
abi: CREATOR_COIN_VESTING_ABI,
|
|
6234
|
+
address: coinAddress,
|
|
6235
|
+
functionName: "getClaimableAmount"
|
|
6236
|
+
});
|
|
6237
|
+
} catch (err) {
|
|
6238
|
+
return outputErrorAndExit(
|
|
6239
|
+
json,
|
|
6240
|
+
`Failed to read claimable rewards: ${err instanceof Error ? err.message : String(err)}`,
|
|
6241
|
+
"Make sure --coin points to a Zora creator coin."
|
|
6242
|
+
);
|
|
6243
|
+
}
|
|
6244
|
+
if (claimable === 0n) {
|
|
6245
|
+
track("cli_claim", {
|
|
6246
|
+
action: "nothing_to_claim",
|
|
6247
|
+
coin_address: coinAddress,
|
|
6248
|
+
output_format: json ? "json" : "static",
|
|
6249
|
+
success: true
|
|
6250
|
+
});
|
|
6251
|
+
if (json) {
|
|
6252
|
+
return outputJson({
|
|
6253
|
+
action: "claim",
|
|
6254
|
+
coin: coinAddress,
|
|
6255
|
+
claimable: "0",
|
|
6256
|
+
claimed: false
|
|
6257
|
+
});
|
|
6258
|
+
}
|
|
6259
|
+
console.log(`
|
|
6260
|
+
Nothing to claim yet for ${coinAddress}.`);
|
|
6261
|
+
console.log(" Vested rewards accrue over time \u2014 check back later.\n");
|
|
6262
|
+
return;
|
|
6263
|
+
}
|
|
6264
|
+
const claimableFormatted = formatAmountDisplay(
|
|
6265
|
+
claimable,
|
|
6266
|
+
CREATOR_COIN_DECIMALS
|
|
6267
|
+
);
|
|
6268
|
+
if (!opts.yes) {
|
|
6269
|
+
console.log("\n Claim creator coin rewards\n");
|
|
6270
|
+
console.log(` Coin ${coinAddress}`);
|
|
6271
|
+
console.log(` Claimable ${claimableFormatted}
|
|
6272
|
+
`);
|
|
6273
|
+
const ok = await confirm4({ message: "Confirm?", default: false });
|
|
6274
|
+
if (!ok) {
|
|
6275
|
+
console.error("Aborted.");
|
|
6276
|
+
return safeExit(SUCCESS);
|
|
6277
|
+
}
|
|
6278
|
+
}
|
|
6279
|
+
let txHash;
|
|
6280
|
+
try {
|
|
6281
|
+
if (smartWalletAccount) {
|
|
6282
|
+
const userOperation = await prepareUserOperation({
|
|
6283
|
+
bundlerClient,
|
|
6284
|
+
account: smartWalletAccount,
|
|
6285
|
+
calls: toUserOperationCalls([
|
|
6286
|
+
toGenericCall({
|
|
6287
|
+
abi: CREATOR_COIN_VESTING_ABI,
|
|
6288
|
+
address: coinAddress,
|
|
6289
|
+
functionName: "claimVesting"
|
|
6290
|
+
})
|
|
6291
|
+
])
|
|
6292
|
+
});
|
|
6293
|
+
const receipt = await submitUserOperation({
|
|
6294
|
+
bundlerClient,
|
|
6295
|
+
account: smartWalletAccount,
|
|
6296
|
+
userOperation
|
|
6297
|
+
});
|
|
6298
|
+
if (!receipt.success) {
|
|
6299
|
+
throw new Error(
|
|
6300
|
+
`User operation reverted${receipt.reason ? `: ${receipt.reason}` : ""}`
|
|
6301
|
+
);
|
|
6302
|
+
}
|
|
6303
|
+
txHash = receipt.receipt.transactionHash;
|
|
6304
|
+
} else {
|
|
6305
|
+
txHash = await walletClient.writeContract({
|
|
6306
|
+
abi: CREATOR_COIN_VESTING_ABI,
|
|
6307
|
+
address: coinAddress,
|
|
6308
|
+
functionName: "claimVesting"
|
|
6309
|
+
});
|
|
6310
|
+
await publicClient.waitForTransactionReceipt({ hash: txHash });
|
|
6311
|
+
}
|
|
6312
|
+
} catch (err) {
|
|
6313
|
+
track("cli_claim", {
|
|
6314
|
+
coin_address: coinAddress,
|
|
6315
|
+
output_format: json ? "json" : "static",
|
|
6316
|
+
success: false,
|
|
6317
|
+
error_type: err instanceof Error ? err.constructor.name : "unknown"
|
|
6318
|
+
});
|
|
6319
|
+
await shutdownAnalytics();
|
|
6320
|
+
return outputErrorAndExit(
|
|
6321
|
+
json,
|
|
6322
|
+
`Claim failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
6323
|
+
gasErrorSuggestion(err, smartWalletAccount ?? privateKeyAccount)
|
|
6324
|
+
);
|
|
6325
|
+
}
|
|
6326
|
+
if (json) {
|
|
6327
|
+
outputJson({
|
|
6328
|
+
action: "claim",
|
|
6329
|
+
coin: coinAddress,
|
|
6330
|
+
claimed: {
|
|
6331
|
+
amount: formatUnits5(claimable, CREATOR_COIN_DECIMALS),
|
|
6332
|
+
raw: claimable.toString()
|
|
6333
|
+
},
|
|
6334
|
+
tx: txHash
|
|
6335
|
+
});
|
|
6336
|
+
} else {
|
|
6337
|
+
console.log("\n Claimed creator coin rewards\n");
|
|
6338
|
+
console.log(` Coin ${coinAddress}`);
|
|
6339
|
+
console.log(` Claimed ${claimableFormatted}`);
|
|
6340
|
+
console.log(` Tx ${txHash}
|
|
6341
|
+
`);
|
|
6342
|
+
}
|
|
6343
|
+
track("cli_claim", {
|
|
6344
|
+
coin_address: coinAddress,
|
|
6345
|
+
amount: claimableFormatted,
|
|
6346
|
+
transactionHash: txHash,
|
|
6347
|
+
output_format: json ? "json" : "static",
|
|
6348
|
+
success: true,
|
|
6349
|
+
tx_hash: txHash
|
|
6350
|
+
});
|
|
6351
|
+
});
|
|
6352
|
+
|
|
6353
|
+
// src/commands/comment.ts
|
|
6354
|
+
import confirm5 from "@inquirer/confirm";
|
|
6355
|
+
import {
|
|
6356
|
+
getCoin as getCoin3,
|
|
6357
|
+
getCoinComments,
|
|
6358
|
+
prepareUserOperation as prepareUserOperation2,
|
|
6359
|
+
setApiKey as setApiKey4,
|
|
6360
|
+
submitUserOperation as submitUserOperation2,
|
|
6361
|
+
toGenericCall as toGenericCall2,
|
|
6362
|
+
toUserOperationCalls as toUserOperationCalls2
|
|
6363
|
+
} from "@zoralabs/coins-sdk";
|
|
6364
|
+
import { Command as Command6 } from "commander";
|
|
6365
|
+
import { isAddress as isAddress5 } from "viem";
|
|
6128
6366
|
|
|
6129
6367
|
// src/lib/comments.ts
|
|
6130
6368
|
var COMMENTS_ADDRESS = "0x7777777C2B3132e03a65721a41745C07170a5877";
|
|
@@ -6201,7 +6439,7 @@ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
|
6201
6439
|
var resolveApiKey = () => {
|
|
6202
6440
|
const apiKey = getApiKey();
|
|
6203
6441
|
if (apiKey) {
|
|
6204
|
-
|
|
6442
|
+
setApiKey4(apiKey);
|
|
6205
6443
|
}
|
|
6206
6444
|
};
|
|
6207
6445
|
async function resolveCoinTarget(json, typeOrId, identifier, command) {
|
|
@@ -6223,7 +6461,7 @@ async function resolveCoinTarget(json, typeOrId, identifier, command) {
|
|
|
6223
6461
|
}
|
|
6224
6462
|
resolveApiKey();
|
|
6225
6463
|
if (parsed.kind === "address") {
|
|
6226
|
-
if (!
|
|
6464
|
+
if (!isAddress5(parsed.address)) {
|
|
6227
6465
|
return outputErrorAndExit(json, `Invalid address: ${parsed.address}`);
|
|
6228
6466
|
}
|
|
6229
6467
|
let name = parsed.address;
|
|
@@ -6278,12 +6516,12 @@ async function resolveCoinTarget(json, typeOrId, identifier, command) {
|
|
|
6278
6516
|
}
|
|
6279
6517
|
}
|
|
6280
6518
|
async function commentViaSmartWallet(call, bundlerClient, account) {
|
|
6281
|
-
const userOperation = await
|
|
6519
|
+
const userOperation = await prepareUserOperation2({
|
|
6282
6520
|
bundlerClient,
|
|
6283
6521
|
account,
|
|
6284
|
-
calls:
|
|
6522
|
+
calls: toUserOperationCalls2([toGenericCall2(call)])
|
|
6285
6523
|
});
|
|
6286
|
-
const receipt = await
|
|
6524
|
+
const receipt = await submitUserOperation2({
|
|
6287
6525
|
bundlerClient,
|
|
6288
6526
|
account,
|
|
6289
6527
|
userOperation
|
|
@@ -6295,7 +6533,7 @@ async function commentViaSmartWallet(call, bundlerClient, account) {
|
|
|
6295
6533
|
}
|
|
6296
6534
|
return receipt.receipt.transactionHash;
|
|
6297
6535
|
}
|
|
6298
|
-
var commentCommand = new
|
|
6536
|
+
var commentCommand = new Command6("comment").description("Comment on a coin you hold").argument(
|
|
6299
6537
|
"[typeOrId]",
|
|
6300
6538
|
"Type prefix (creator-coin, trend) or coin address/name"
|
|
6301
6539
|
).argument("[nameOrText]", "Coin name (with a type prefix) or comment text").argument("[text]", "Comment text when a type prefix is used").option("--referrer <address>", "Referrer address for spark rewards").option("--yes", "Skip confirmation and post directly").action(async function(typeOrId, nameOrText, text, opts) {
|
|
@@ -6310,7 +6548,7 @@ var commentCommand = new Command5("comment").description("Comment on a coin you
|
|
|
6310
6548
|
'Usage: zora comment <coin> "your comment"'
|
|
6311
6549
|
);
|
|
6312
6550
|
}
|
|
6313
|
-
if (opts.referrer && !
|
|
6551
|
+
if (opts.referrer && !isAddress5(opts.referrer)) {
|
|
6314
6552
|
return outputErrorAndExit(json, `Invalid --referrer: ${opts.referrer}`);
|
|
6315
6553
|
}
|
|
6316
6554
|
const coin = await resolveCoinTarget(
|
|
@@ -6396,7 +6634,7 @@ var commentCommand = new Command5("comment").description("Comment on a coin you
|
|
|
6396
6634
|
console.log(` Cost ${isOwner ? "free (coin owner)" : "1 spark"}`);
|
|
6397
6635
|
console.log(` Text ${commentText}
|
|
6398
6636
|
`);
|
|
6399
|
-
const ok = await
|
|
6637
|
+
const ok = await confirm5({ message: "Post comment?", default: false });
|
|
6400
6638
|
if (!ok) {
|
|
6401
6639
|
console.error("Aborted.");
|
|
6402
6640
|
return safeExit(SUCCESS);
|
|
@@ -6554,11 +6792,11 @@ No comments yet on ${coin.name}.
|
|
|
6554
6792
|
});
|
|
6555
6793
|
|
|
6556
6794
|
// src/commands/create.ts
|
|
6557
|
-
import { Command as
|
|
6558
|
-
import
|
|
6795
|
+
import { Command as Command7 } from "commander";
|
|
6796
|
+
import confirm6 from "@inquirer/confirm";
|
|
6559
6797
|
import input2 from "@inquirer/input";
|
|
6560
6798
|
import select2 from "@inquirer/select";
|
|
6561
|
-
import { existsSync as
|
|
6799
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
6562
6800
|
import { basename as basename2, extname as extname2 } from "path";
|
|
6563
6801
|
import { base as base7 } from "viem/chains";
|
|
6564
6802
|
import {
|
|
@@ -6567,7 +6805,7 @@ import {
|
|
|
6567
6805
|
createMetadataBuilder,
|
|
6568
6806
|
createZoraUploaderForCreator,
|
|
6569
6807
|
CreateConstants,
|
|
6570
|
-
setApiKey as
|
|
6808
|
+
setApiKey as setApiKey5
|
|
6571
6809
|
} from "@zoralabs/coins-sdk";
|
|
6572
6810
|
var IMAGE_MIME_BY_EXT = {
|
|
6573
6811
|
".png": "image/png",
|
|
@@ -6623,7 +6861,7 @@ async function resolveField(value, {
|
|
|
6623
6861
|
}
|
|
6624
6862
|
return input2({ message, required });
|
|
6625
6863
|
}
|
|
6626
|
-
var createCommand = new
|
|
6864
|
+
var createCommand = new Command7("create").description("Create a coin (post)").option("--name <name>", "Coin name").option("--symbol <symbol>", "Coin symbol (ticker)").option("--description <description>", "Coin description").option("--image <path>", "Path to a local image file to upload").option(
|
|
6627
6865
|
"--currency <currency>",
|
|
6628
6866
|
"Backing currency: ZORA, ETH, CREATOR_COIN, CREATOR_COIN_OR_ZORA (prompts if omitted)"
|
|
6629
6867
|
).option("--yes", "Skip confirmation and create directly").action(async function(opts) {
|
|
@@ -6636,7 +6874,7 @@ var createCommand = new Command6("create").description("Create a coin (post)").o
|
|
|
6636
6874
|
"Run 'zora auth configure' to set your API key."
|
|
6637
6875
|
);
|
|
6638
6876
|
}
|
|
6639
|
-
|
|
6877
|
+
setApiKey5(apiKey);
|
|
6640
6878
|
const name = await resolveField(opts.name, {
|
|
6641
6879
|
json,
|
|
6642
6880
|
message: "Coin name:",
|
|
@@ -6663,7 +6901,7 @@ var createCommand = new Command6("create").description("Create a coin (post)").o
|
|
|
6663
6901
|
flag: "--image"
|
|
6664
6902
|
});
|
|
6665
6903
|
const currency = await resolveCurrency(opts.currency, json);
|
|
6666
|
-
if (!
|
|
6904
|
+
if (!existsSync3(imagePath)) {
|
|
6667
6905
|
return outputErrorAndExit(
|
|
6668
6906
|
json,
|
|
6669
6907
|
`Image file not found: ${imagePath}`,
|
|
@@ -6707,7 +6945,7 @@ var createCommand = new Command6("create").description("Create a coin (post)").o
|
|
|
6707
6945
|
` Creator ${creator} (${usingSmartWallet ? "smart wallet" : "EOA"})`
|
|
6708
6946
|
);
|
|
6709
6947
|
console.log("");
|
|
6710
|
-
const ok = await
|
|
6948
|
+
const ok = await confirm6({ message: "Confirm?", default: false });
|
|
6711
6949
|
if (!ok) {
|
|
6712
6950
|
console.error("Aborted.");
|
|
6713
6951
|
return safeExit(SUCCESS);
|
|
@@ -6820,8 +7058,8 @@ var createCommand = new Command6("create").description("Create a coin (post)").o
|
|
|
6820
7058
|
});
|
|
6821
7059
|
|
|
6822
7060
|
// src/commands/dm.ts
|
|
6823
|
-
import { Command as
|
|
6824
|
-
import { isAddress as
|
|
7061
|
+
import { Command as Command8 } from "commander";
|
|
7062
|
+
import { isAddress as isAddress7 } from "viem";
|
|
6825
7063
|
|
|
6826
7064
|
// src/messaging/identity.ts
|
|
6827
7065
|
import { hashMessage, toBytes } from "viem";
|
|
@@ -6963,24 +7201,24 @@ var createCliSmartWalletProvider = async (opts) => {
|
|
|
6963
7201
|
};
|
|
6964
7202
|
|
|
6965
7203
|
// src/messaging/uapi.ts
|
|
6966
|
-
import { getAddress as getAddress4, isAddress as
|
|
7204
|
+
import { getAddress as getAddress4, isAddress as isAddress6 } from "viem";
|
|
6967
7205
|
|
|
6968
7206
|
// src/lib/profile-cache.ts
|
|
6969
|
-
import { existsSync as
|
|
7207
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
6970
7208
|
import { homedir as homedir2, platform as platform3 } from "os";
|
|
6971
|
-
import { dirname, join as
|
|
7209
|
+
import { dirname, join as join3 } from "path";
|
|
6972
7210
|
var MAX_ENTRIES = 5e3;
|
|
6973
7211
|
function cacheFile() {
|
|
6974
|
-
const dir = platform3() === "win32" ?
|
|
6975
|
-
process.env.APPDATA ??
|
|
7212
|
+
const dir = platform3() === "win32" ? join3(
|
|
7213
|
+
process.env.APPDATA ?? join3(homedir2(), "AppData", "Roaming"),
|
|
6976
7214
|
"zora"
|
|
6977
|
-
) :
|
|
6978
|
-
return
|
|
7215
|
+
) : join3(homedir2(), ".config", "zora");
|
|
7216
|
+
return join3(dir, "profiles.json");
|
|
6979
7217
|
}
|
|
6980
7218
|
function readProfileCache() {
|
|
6981
7219
|
try {
|
|
6982
7220
|
const file = cacheFile();
|
|
6983
|
-
if (!
|
|
7221
|
+
if (!existsSync4(file)) return {};
|
|
6984
7222
|
const parsed = JSON.parse(readFileSync4(file, "utf-8"));
|
|
6985
7223
|
return parsed?.profiles ?? {};
|
|
6986
7224
|
} catch {
|
|
@@ -7051,7 +7289,7 @@ var resolveHandleToAddress = async (handle) => {
|
|
|
7051
7289
|
const wallet = profile.linkedWallets?.edges?.find(
|
|
7052
7290
|
(e) => e.node?.walletType === "SMART_WALLET"
|
|
7053
7291
|
)?.node?.walletAddress;
|
|
7054
|
-
if (!wallet || !
|
|
7292
|
+
if (!wallet || !isAddress6(wallet)) return { ok: false, reason: "no-inbox" };
|
|
7055
7293
|
return { ok: true, address: getAddress4(wallet) };
|
|
7056
7294
|
};
|
|
7057
7295
|
var PROFILE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
@@ -7278,7 +7516,7 @@ var peerLabel = async (peer) => {
|
|
|
7278
7516
|
}
|
|
7279
7517
|
};
|
|
7280
7518
|
var resolvePeer = async (json, value) => {
|
|
7281
|
-
if (
|
|
7519
|
+
if (isAddress7(value)) return value;
|
|
7282
7520
|
const result = await resolveHandleToAddress(value);
|
|
7283
7521
|
if (result.ok) return result.address;
|
|
7284
7522
|
const messages = {
|
|
@@ -7368,7 +7606,7 @@ var renderSummaries = (summaries, empty) => {
|
|
|
7368
7606
|
${preview}`);
|
|
7369
7607
|
}
|
|
7370
7608
|
};
|
|
7371
|
-
var dmCommand = new
|
|
7609
|
+
var dmCommand = new Command8("dm").description("Read and respond to your Zora DMs").action(function() {
|
|
7372
7610
|
this.outputHelp();
|
|
7373
7611
|
});
|
|
7374
7612
|
dmCommand.command("list").description("List active conversations").action(async function() {
|
|
@@ -7599,9 +7837,9 @@ consentSubcommand("approve", "allowed", "Approve an inbound request");
|
|
|
7599
7837
|
consentSubcommand("deny", "denied", "Deny an inbound request");
|
|
7600
7838
|
|
|
7601
7839
|
// src/commands/explore.tsx
|
|
7602
|
-
import { Command as
|
|
7840
|
+
import { Command as Command9 } from "commander";
|
|
7603
7841
|
import {
|
|
7604
|
-
setApiKey as
|
|
7842
|
+
setApiKey as setApiKey6,
|
|
7605
7843
|
getCoinsTopVolume24h,
|
|
7606
7844
|
getCoinsMostValuable,
|
|
7607
7845
|
getCoinsNew,
|
|
@@ -7800,7 +8038,7 @@ var STATIC_COLUMNS = [
|
|
|
7800
8038
|
}
|
|
7801
8039
|
];
|
|
7802
8040
|
var SORT_OPTIONS2 = Object.keys(SORT_LABELS).join(", ");
|
|
7803
|
-
var exploreCommand = new
|
|
8041
|
+
var exploreCommand = new Command9("explore").description("Browse top, new, and highest volume coins").option("--sort <sort>", `Sort by: ${SORT_OPTIONS2}`, "mcap").option(
|
|
7804
8042
|
"--type <type>",
|
|
7805
8043
|
"Filter by type: all, trend, creator-coin, post (availability varies by sort)",
|
|
7806
8044
|
"creator-coin"
|
|
@@ -7839,7 +8077,7 @@ var exploreCommand = new Command8("explore").description("Browse top, new, and h
|
|
|
7839
8077
|
}
|
|
7840
8078
|
const apiKey = getApiKey();
|
|
7841
8079
|
if (apiKey) {
|
|
7842
|
-
|
|
8080
|
+
setApiKey6(apiKey);
|
|
7843
8081
|
}
|
|
7844
8082
|
const queryFn = QUERY_MAP[sort][type];
|
|
7845
8083
|
if (json) {
|
|
@@ -7934,9 +8172,9 @@ var exploreCommand = new Command8("explore").description("Browse top, new, and h
|
|
|
7934
8172
|
});
|
|
7935
8173
|
|
|
7936
8174
|
// src/commands/follow.ts
|
|
7937
|
-
import { getProfile as
|
|
7938
|
-
import { Command as
|
|
7939
|
-
import { erc20Abi as erc20Abi3, isAddress as
|
|
8175
|
+
import { getProfile as getProfile3, setApiKey as setApiKey7 } from "@zoralabs/coins-sdk";
|
|
8176
|
+
import { Command as Command10 } from "commander";
|
|
8177
|
+
import { erc20Abi as erc20Abi3, isAddress as isAddress8 } from "viem";
|
|
7940
8178
|
|
|
7941
8179
|
// src/lib/follow.ts
|
|
7942
8180
|
var FOLLOW_MUTATION = "mutation CliFollow($followeeId: String!) { follow(followeeId: $followeeId) { handle profileId vcFollowingStatus } }";
|
|
@@ -7994,10 +8232,10 @@ function relationshipNote(status) {
|
|
|
7994
8232
|
}
|
|
7995
8233
|
async function requireCreatorCoinHolding(json, identifier) {
|
|
7996
8234
|
const apiKey = getApiKey();
|
|
7997
|
-
if (apiKey)
|
|
8235
|
+
if (apiKey) setApiKey7(apiKey);
|
|
7998
8236
|
let profile;
|
|
7999
8237
|
try {
|
|
8000
|
-
const response = await
|
|
8238
|
+
const response = await getProfile3({ identifier });
|
|
8001
8239
|
profile = response?.data?.profile;
|
|
8002
8240
|
} catch (err) {
|
|
8003
8241
|
return outputErrorAndExit(
|
|
@@ -8014,7 +8252,7 @@ async function requireCreatorCoinHolding(json, identifier) {
|
|
|
8014
8252
|
}
|
|
8015
8253
|
const label = profile.handle && !isPlaceholderName(profile.handle) ? `@${profile.handle}` : identifier;
|
|
8016
8254
|
const coinAddress = profile.creatorCoin?.address;
|
|
8017
|
-
if (!coinAddress || !
|
|
8255
|
+
if (!coinAddress || !isAddress8(coinAddress)) {
|
|
8018
8256
|
return outputErrorAndExit(
|
|
8019
8257
|
json,
|
|
8020
8258
|
`${label} doesn't have a creator coin yet, so there's nothing to buy.`,
|
|
@@ -8136,17 +8374,17 @@ async function runFollow(command, action, identifierArg) {
|
|
|
8136
8374
|
}
|
|
8137
8375
|
});
|
|
8138
8376
|
}
|
|
8139
|
-
var followCommand = new
|
|
8377
|
+
var followCommand = new Command10("follow").description("Follow a Zora user whose creator coin you hold").argument("[identifier]", "Username (@handle), wallet address, or account id").action(async function(identifier) {
|
|
8140
8378
|
await runFollow(this, "follow", identifier);
|
|
8141
8379
|
});
|
|
8142
|
-
var unfollowCommand = new
|
|
8380
|
+
var unfollowCommand = new Command10("unfollow").description("Unfollow a Zora user by username or address").argument("[identifier]", "Username (@handle), wallet address, or account id").action(async function(identifier) {
|
|
8143
8381
|
await runFollow(this, "unfollow", identifier);
|
|
8144
8382
|
});
|
|
8145
8383
|
|
|
8146
8384
|
// src/commands/get.tsx
|
|
8147
|
-
import { Command as
|
|
8385
|
+
import { Command as Command11 } from "commander";
|
|
8148
8386
|
import { Box as Box12, Text as Text12 } from "ink";
|
|
8149
|
-
import { setApiKey as
|
|
8387
|
+
import { setApiKey as setApiKey8, getCoinHolders, getCoinSwaps } from "@zoralabs/coins-sdk";
|
|
8150
8388
|
|
|
8151
8389
|
// src/components/CoinDetail.tsx
|
|
8152
8390
|
import { Box as Box7, Text as Text7 } from "ink";
|
|
@@ -8641,7 +8879,7 @@ function formatCoinJson(coin) {
|
|
|
8641
8879
|
var resolveApiKey2 = () => {
|
|
8642
8880
|
const apiKey = getApiKey();
|
|
8643
8881
|
if (apiKey) {
|
|
8644
|
-
|
|
8882
|
+
setApiKey8(apiKey);
|
|
8645
8883
|
}
|
|
8646
8884
|
};
|
|
8647
8885
|
var CoinResolutionError = class extends Error {
|
|
@@ -8770,7 +9008,7 @@ async function fetchRecentTrades(address) {
|
|
|
8770
9008
|
return [];
|
|
8771
9009
|
}
|
|
8772
9010
|
}
|
|
8773
|
-
var getCommand = new
|
|
9011
|
+
var getCommand = new Command11("get").description("Look up a coin by address or name").argument("[typeOrId]", "Type prefix (creator-coin, trend) or identifier").argument(
|
|
8774
9012
|
"[identifier]",
|
|
8775
9013
|
"Coin address (0x...) or name (when type prefix is given)"
|
|
8776
9014
|
).option("--live", "Interactive live-updating display (default)").option("--static", "Static snapshot").option(
|
|
@@ -9296,19 +9534,19 @@ getCommand.command("holders").description("Show top holders of a coin").argument
|
|
|
9296
9534
|
});
|
|
9297
9535
|
|
|
9298
9536
|
// src/commands/sell.ts
|
|
9299
|
-
import
|
|
9537
|
+
import confirm7 from "@inquirer/confirm";
|
|
9300
9538
|
import {
|
|
9301
9539
|
createQuote as createQuote2,
|
|
9302
9540
|
getCoin as getCoin4,
|
|
9303
|
-
setApiKey as
|
|
9541
|
+
setApiKey as setApiKey9,
|
|
9304
9542
|
tradeCoin as tradeCoin2,
|
|
9305
9543
|
tradeCoinSmartWallet as tradeCoinSmartWallet2
|
|
9306
9544
|
} from "@zoralabs/coins-sdk";
|
|
9307
|
-
import { Command as
|
|
9545
|
+
import { Command as Command12 } from "commander";
|
|
9308
9546
|
import {
|
|
9309
9547
|
erc20Abi as erc20Abi4,
|
|
9310
|
-
formatUnits as
|
|
9311
|
-
isAddress as
|
|
9548
|
+
formatUnits as formatUnits6,
|
|
9549
|
+
isAddress as isAddress9,
|
|
9312
9550
|
parseUnits as parseUnits2
|
|
9313
9551
|
} from "viem";
|
|
9314
9552
|
function printSellQuote(output, info) {
|
|
@@ -9318,12 +9556,12 @@ function printSellQuote(output, info) {
|
|
|
9318
9556
|
coin: info.coinSymbol,
|
|
9319
9557
|
address: info.address,
|
|
9320
9558
|
sell: {
|
|
9321
|
-
amount:
|
|
9559
|
+
amount: formatUnits6(info.amountIn, info.coinDecimals),
|
|
9322
9560
|
raw: info.amountIn.toString(),
|
|
9323
9561
|
symbol: info.coinSymbol
|
|
9324
9562
|
},
|
|
9325
9563
|
estimated: {
|
|
9326
|
-
amount:
|
|
9564
|
+
amount: formatUnits6(BigInt(info.quoteAmountOut), info.outputDecimals),
|
|
9327
9565
|
raw: info.quoteAmountOut,
|
|
9328
9566
|
symbol: info.outputSymbol
|
|
9329
9567
|
},
|
|
@@ -9343,7 +9581,7 @@ function printSellQuote(output, info) {
|
|
|
9343
9581
|
`);
|
|
9344
9582
|
}
|
|
9345
9583
|
function printSellResult(output, info) {
|
|
9346
|
-
const receivedAmount =
|
|
9584
|
+
const receivedAmount = formatUnits6(
|
|
9347
9585
|
info.receivedAmountOut,
|
|
9348
9586
|
info.outputDecimals
|
|
9349
9587
|
);
|
|
@@ -9357,7 +9595,7 @@ function printSellResult(output, info) {
|
|
|
9357
9595
|
coin: info.coinSymbol,
|
|
9358
9596
|
address: info.address,
|
|
9359
9597
|
sold: {
|
|
9360
|
-
amount:
|
|
9598
|
+
amount: formatUnits6(info.amountIn, info.coinDecimals),
|
|
9361
9599
|
raw: info.amountIn.toString(),
|
|
9362
9600
|
symbol: info.coinSymbol
|
|
9363
9601
|
},
|
|
@@ -9385,7 +9623,7 @@ function printSellResult(output, info) {
|
|
|
9385
9623
|
console.log(` Tx ${info.txHash}
|
|
9386
9624
|
`);
|
|
9387
9625
|
}
|
|
9388
|
-
var sellCommand = new
|
|
9626
|
+
var sellCommand = new Command12("sell").description("Sell a coin").argument(
|
|
9389
9627
|
"[typeOrId]",
|
|
9390
9628
|
"Type prefix (creator-coin, trend) or coin address/name"
|
|
9391
9629
|
).argument("[identifier]", "Coin name (when type prefix is given)").option("--amount <value>", "Sell specific number of coins").option("--usd <value>", "Sell USD equivalent worth of coins").option("--percent <value>", "Sell percentage of coin balance").option("--all", "Sell entire coin balance").option("--to <asset>", "Receive asset: eth, usdc, zora", "eth").option("--token <asset>", "Receive asset: eth, usdc, zora (alias for --to)").option("--quote", "Print quote and exit without trading").option("--yes", "Skip confirmation and execute directly").option("--slippage <pct>", "Slippage tolerance percent", "1").option("--debug", "Print full quote request/response JSON").action(async function(typeOrId, identifier, opts) {
|
|
@@ -9402,12 +9640,12 @@ var sellCommand = new Command11("sell").description("Sell a coin").argument(
|
|
|
9402
9640
|
}
|
|
9403
9641
|
const apiKey = getApiKey();
|
|
9404
9642
|
if (apiKey) {
|
|
9405
|
-
|
|
9643
|
+
setApiKey9(apiKey);
|
|
9406
9644
|
}
|
|
9407
9645
|
let coinAddress;
|
|
9408
9646
|
let earlyAccounts;
|
|
9409
9647
|
if (parsed.kind === "address") {
|
|
9410
|
-
if (!
|
|
9648
|
+
if (!isAddress9(parsed.address)) {
|
|
9411
9649
|
return outputErrorAndExit(json, `Invalid address: ${parsed.address}`);
|
|
9412
9650
|
}
|
|
9413
9651
|
coinAddress = parsed.address;
|
|
@@ -9546,7 +9784,7 @@ var sellCommand = new Command11("sell").description("Sell a coin").argument(
|
|
|
9546
9784
|
}
|
|
9547
9785
|
if (debug) {
|
|
9548
9786
|
console.error(
|
|
9549
|
-
`[debug] $${usdVal} USD = ${
|
|
9787
|
+
`[debug] $${usdVal} USD = ${formatUnits6(amountIn, coinDecimals)} ${coinSymbol} (coin price: $${coinPriceUsd2})`
|
|
9550
9788
|
);
|
|
9551
9789
|
}
|
|
9552
9790
|
} else if (amountMode === "amount") {
|
|
@@ -9608,7 +9846,7 @@ var sellCommand = new Command11("sell").description("Sell a coin").argument(
|
|
|
9608
9846
|
swapAmountUsd = parsePercentageLikeValue(opts.usd);
|
|
9609
9847
|
} else if (coinPriceUsd !== null && coinPriceUsd > 0) {
|
|
9610
9848
|
swapAmountUsd = Number(
|
|
9611
|
-
(Number(
|
|
9849
|
+
(Number(formatUnits6(amountIn, coinDecimals)) * coinPriceUsd).toFixed(2)
|
|
9612
9850
|
);
|
|
9613
9851
|
}
|
|
9614
9852
|
const tradeParameters = {
|
|
@@ -9670,7 +9908,7 @@ ${err instanceof Error ? err.stack || err.message : String(err)}
|
|
|
9670
9908
|
let receivedUsd;
|
|
9671
9909
|
if (outputPriceUsd != null) {
|
|
9672
9910
|
const outAmount = Number(
|
|
9673
|
-
|
|
9911
|
+
formatUnits6(BigInt(quoteAmountOut), outputToken.decimals)
|
|
9674
9912
|
);
|
|
9675
9913
|
receivedUsd = `~${formatUsd(outAmount * outputPriceUsd)}`;
|
|
9676
9914
|
}
|
|
@@ -9721,7 +9959,7 @@ ${err instanceof Error ? err.stack || err.message : String(err)}
|
|
|
9721
9959
|
slippagePct,
|
|
9722
9960
|
receivedUsd
|
|
9723
9961
|
});
|
|
9724
|
-
const ok = await
|
|
9962
|
+
const ok = await confirm7({
|
|
9725
9963
|
message: "Confirm?",
|
|
9726
9964
|
default: false
|
|
9727
9965
|
});
|
|
@@ -9791,7 +10029,7 @@ ${err instanceof Error ? err.stack || err.message : String(err)}
|
|
|
9791
10029
|
}
|
|
9792
10030
|
if (outputPriceUsd != null) {
|
|
9793
10031
|
const actualAmount = Number(
|
|
9794
|
-
|
|
10032
|
+
formatUnits6(receivedAmountOut, outputToken.decimals)
|
|
9795
10033
|
);
|
|
9796
10034
|
receivedUsd = `~${formatUsd(actualAmount * outputPriceUsd)}`;
|
|
9797
10035
|
}
|
|
@@ -9830,13 +10068,13 @@ ${err instanceof Error ? err.stack || err.message : String(err)}
|
|
|
9830
10068
|
});
|
|
9831
10069
|
|
|
9832
10070
|
// src/commands/profile.tsx
|
|
9833
|
-
import { Command as
|
|
10071
|
+
import { Command as Command13 } from "commander";
|
|
9834
10072
|
import { Box as Box17, Text as Text17 } from "ink";
|
|
9835
10073
|
import {
|
|
9836
10074
|
getProfileCoins,
|
|
9837
10075
|
getProfileBalances as getProfileBalances2,
|
|
9838
10076
|
getWalletTradeActivity,
|
|
9839
|
-
setApiKey as
|
|
10077
|
+
setApiKey as setApiKey10
|
|
9840
10078
|
} from "@zoralabs/coins-sdk";
|
|
9841
10079
|
import { privateKeyToAccount as privateKeyToAccount8 } from "viem/accounts";
|
|
9842
10080
|
|
|
@@ -10218,7 +10456,7 @@ import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
|
10218
10456
|
var resolveApiKey3 = () => {
|
|
10219
10457
|
const apiKey = getApiKey();
|
|
10220
10458
|
if (apiKey) {
|
|
10221
|
-
|
|
10459
|
+
setApiKey10(apiKey);
|
|
10222
10460
|
}
|
|
10223
10461
|
};
|
|
10224
10462
|
var formatTradeJson2 = (trade, rank) => ({
|
|
@@ -10341,7 +10579,7 @@ var resolveIdentifier = (identifierArg, json) => {
|
|
|
10341
10579
|
);
|
|
10342
10580
|
}
|
|
10343
10581
|
};
|
|
10344
|
-
var profileCommand = new
|
|
10582
|
+
var profileCommand = new Command13("profile").description("View profile activity (posts, holdings, and trades)").argument(
|
|
10345
10583
|
"[identifier]",
|
|
10346
10584
|
"Wallet address or profile handle (defaults to your wallet)"
|
|
10347
10585
|
).option("--live", "Interactive live-updating display (default)").option("--static", "Static snapshot").option(
|
|
@@ -10883,20 +11121,20 @@ profileCommand.command("trades").description("View profile trade activity (buys
|
|
|
10883
11121
|
});
|
|
10884
11122
|
|
|
10885
11123
|
// src/commands/send.ts
|
|
10886
|
-
import
|
|
11124
|
+
import confirm8 from "@inquirer/confirm";
|
|
10887
11125
|
import {
|
|
10888
|
-
getProfile as
|
|
10889
|
-
prepareUserOperation as
|
|
10890
|
-
setApiKey as
|
|
10891
|
-
submitUserOperation as
|
|
10892
|
-
toGenericCall as
|
|
10893
|
-
toUserOperationCalls as
|
|
11126
|
+
getProfile as getProfile4,
|
|
11127
|
+
prepareUserOperation as prepareUserOperation3,
|
|
11128
|
+
setApiKey as setApiKey11,
|
|
11129
|
+
submitUserOperation as submitUserOperation3,
|
|
11130
|
+
toGenericCall as toGenericCall3,
|
|
11131
|
+
toUserOperationCalls as toUserOperationCalls3
|
|
10894
11132
|
} from "@zoralabs/coins-sdk";
|
|
10895
|
-
import { Command as
|
|
11133
|
+
import { Command as Command14 } from "commander";
|
|
10896
11134
|
import {
|
|
10897
11135
|
erc20Abi as erc20Abi5,
|
|
10898
|
-
formatUnits as
|
|
10899
|
-
isAddress as
|
|
11136
|
+
formatUnits as formatUnits7,
|
|
11137
|
+
isAddress as isAddress10,
|
|
10900
11138
|
parseUnits as parseUnits3
|
|
10901
11139
|
} from "viem";
|
|
10902
11140
|
var SEND_AMOUNT_CHECKS = {
|
|
@@ -10909,12 +11147,12 @@ function isPlaceholderName2(name) {
|
|
|
10909
11147
|
return name.startsWith("0x") || name.includes("\u2026") || name.includes("...");
|
|
10910
11148
|
}
|
|
10911
11149
|
async function resolveRecipient(identifier, json = false) {
|
|
10912
|
-
const isIdentifierAddress =
|
|
11150
|
+
const isIdentifierAddress = isAddress10(identifier);
|
|
10913
11151
|
try {
|
|
10914
|
-
const response = await
|
|
11152
|
+
const response = await getProfile4({ identifier });
|
|
10915
11153
|
const profile = response?.data?.profile;
|
|
10916
11154
|
const address = isIdentifierAddress ? identifier : profile?.publicWallet?.walletAddress;
|
|
10917
|
-
if (!address || !
|
|
11155
|
+
if (!address || !isAddress10(address)) {
|
|
10918
11156
|
return outputErrorAndExit(
|
|
10919
11157
|
json,
|
|
10920
11158
|
!address ? `No Zora profile or wallet found for "${identifier}".` : "Provide a valid 0x address or an existing Zora profile name."
|
|
@@ -10965,7 +11203,7 @@ function printSendResult(json, info) {
|
|
|
10965
11203
|
coin: info.symbol,
|
|
10966
11204
|
address: info.address,
|
|
10967
11205
|
sent: {
|
|
10968
|
-
amount:
|
|
11206
|
+
amount: formatUnits7(info.amount, info.decimals),
|
|
10969
11207
|
raw: info.amount.toString(),
|
|
10970
11208
|
symbol: info.symbol,
|
|
10971
11209
|
amountUsd: info.amountUsd
|
|
@@ -10987,12 +11225,12 @@ function printSendResult(json, info) {
|
|
|
10987
11225
|
`);
|
|
10988
11226
|
}
|
|
10989
11227
|
async function sendCallViaSmartWallet(call, bundlerClient, account) {
|
|
10990
|
-
const userOperation = await
|
|
11228
|
+
const userOperation = await prepareUserOperation3({
|
|
10991
11229
|
bundlerClient,
|
|
10992
11230
|
account,
|
|
10993
|
-
calls:
|
|
11231
|
+
calls: toUserOperationCalls3([toGenericCall3(call)])
|
|
10994
11232
|
});
|
|
10995
|
-
const receipt = await
|
|
11233
|
+
const receipt = await submitUserOperation3({
|
|
10996
11234
|
bundlerClient,
|
|
10997
11235
|
account,
|
|
10998
11236
|
userOperation
|
|
@@ -11004,7 +11242,7 @@ async function sendCallViaSmartWallet(call, bundlerClient, account) {
|
|
|
11004
11242
|
}
|
|
11005
11243
|
return receipt.receipt.transactionHash;
|
|
11006
11244
|
}
|
|
11007
|
-
var sendCommand = new
|
|
11245
|
+
var sendCommand = new Command14("send").description("Send coins or ETH to an address or Zora profile").argument(
|
|
11008
11246
|
"[typeOrId]",
|
|
11009
11247
|
"Token (eth, usdc, zora), type prefix (creator-coin, trend), or coin address/name"
|
|
11010
11248
|
).argument("[identifier]", "Coin name (when type prefix is given)").option("--to <recipient>", "Recipient: address (0x...) or Zora profile name").option("--amount <value>", "Send specific amount").option("--percent <value>", "Send percentage of balance (1-100)").option("--all", "Send entire balance").option("--yes", "Skip confirmation").action(async function(firstArg, secondArg, opts) {
|
|
@@ -11018,7 +11256,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11018
11256
|
}
|
|
11019
11257
|
const apiKey = getApiKey();
|
|
11020
11258
|
if (apiKey) {
|
|
11021
|
-
|
|
11259
|
+
setApiKey11(apiKey);
|
|
11022
11260
|
}
|
|
11023
11261
|
const resolvedRecipient = await resolveRecipient(opts.to, json);
|
|
11024
11262
|
if (resolvedRecipient.platformBlocked) {
|
|
@@ -11126,7 +11364,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11126
11364
|
const ethPriceUsd = await fetchTokenPriceUsd(WETH_ADDRESS);
|
|
11127
11365
|
if (ethPriceUsd != null) {
|
|
11128
11366
|
amountUsd = Number(
|
|
11129
|
-
(Number(
|
|
11367
|
+
(Number(formatUnits7(amount, 18)) * ethPriceUsd).toFixed(2)
|
|
11130
11368
|
);
|
|
11131
11369
|
}
|
|
11132
11370
|
if (!opts.yes) {
|
|
@@ -11137,7 +11375,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11137
11375
|
amountUsd,
|
|
11138
11376
|
recipient: resolvedRecipient
|
|
11139
11377
|
});
|
|
11140
|
-
const ok = await
|
|
11378
|
+
const ok = await confirm8({ message: "Confirm?", default: false });
|
|
11141
11379
|
if (!ok) {
|
|
11142
11380
|
console.error("Aborted.");
|
|
11143
11381
|
return safeExit(SUCCESS);
|
|
@@ -11384,7 +11622,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11384
11622
|
const priceUsd = knownToken?.fixedPriceUsd ?? await fetchTokenPriceUsd(priceAddress);
|
|
11385
11623
|
if (priceUsd != null) {
|
|
11386
11624
|
amountUsd = Number(
|
|
11387
|
-
(Number(
|
|
11625
|
+
(Number(formatUnits7(amount, decimals)) * priceUsd).toFixed(2)
|
|
11388
11626
|
);
|
|
11389
11627
|
}
|
|
11390
11628
|
if (!opts.yes) {
|
|
@@ -11395,7 +11633,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11395
11633
|
amountUsd,
|
|
11396
11634
|
recipient: resolvedRecipient
|
|
11397
11635
|
});
|
|
11398
|
-
const ok = await
|
|
11636
|
+
const ok = await confirm8({ message: "Confirm?", default: false });
|
|
11399
11637
|
if (!ok) {
|
|
11400
11638
|
console.error("Aborted.");
|
|
11401
11639
|
return safeExit(SUCCESS);
|
|
@@ -11500,7 +11738,7 @@ var sendCommand = new Command13("send").description("Send coins or ETH to an add
|
|
|
11500
11738
|
});
|
|
11501
11739
|
|
|
11502
11740
|
// src/commands/setup.tsx
|
|
11503
|
-
import { Command as
|
|
11741
|
+
import { Command as Command15 } from "commander";
|
|
11504
11742
|
import { Text as Text18, Box as Box18 } from "ink";
|
|
11505
11743
|
|
|
11506
11744
|
// src/lib/strings.ts
|
|
@@ -11668,7 +11906,7 @@ ${BOLD}${DIM}[${step}/${total}]${RESET} ${BOLD}${title}${RESET}`
|
|
|
11668
11906
|
console.log(`${DIM}${"\u2500".repeat(Math.max(cols, 20))}${RESET}
|
|
11669
11907
|
`);
|
|
11670
11908
|
}
|
|
11671
|
-
var setupCommand = new
|
|
11909
|
+
var setupCommand = new Command15("setup").description("Guided first-time setup").option("--create", "Create a new wallet without prompting").option("--force", "Overwrite existing wallet without prompting").option("--yes", "Skip interactive prompt and execute directly").action(async function(options) {
|
|
11672
11910
|
const json = getJson(this);
|
|
11673
11911
|
const nonInteractive = getYes(this);
|
|
11674
11912
|
if (!json) stepLine(1, 3, "Set up wallet");
|
|
@@ -11805,9 +12043,9 @@ async function promptAndSaveApiKey(json, nonInteractive = false) {
|
|
|
11805
12043
|
}
|
|
11806
12044
|
|
|
11807
12045
|
// src/commands/skills.ts
|
|
11808
|
-
import { Command as
|
|
11809
|
-
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3
|
|
11810
|
-
import { resolve, join as
|
|
12046
|
+
import { Command as Command16 } from "commander";
|
|
12047
|
+
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
12048
|
+
import { resolve, join as join4 } from "path";
|
|
11811
12049
|
|
|
11812
12050
|
// src/generated/skill-content.ts
|
|
11813
12051
|
var SKILL_CONTENT = {
|
|
@@ -11919,34 +12157,7 @@ var SKILLS = [
|
|
|
11919
12157
|
description: "Read-only periodic portfolio and PnL digest, optionally delivered to the operator by DM"
|
|
11920
12158
|
}
|
|
11921
12159
|
];
|
|
11922
|
-
var AGENT_ORDER = [
|
|
11923
|
-
"claude",
|
|
11924
|
-
"cursor",
|
|
11925
|
-
"windsurf",
|
|
11926
|
-
"openclaw",
|
|
11927
|
-
"hermes"
|
|
11928
|
-
];
|
|
11929
12160
|
var SKILL_PREFIX = "zora-";
|
|
11930
|
-
var AGENT_SKILLS_DIRS = {
|
|
11931
|
-
claude: ".claude/skills",
|
|
11932
|
-
cursor: ".cursor/skills",
|
|
11933
|
-
windsurf: ".windsurf/skills",
|
|
11934
|
-
openclaw: ".openclaw/skills",
|
|
11935
|
-
hermes: ".hermes/skills"
|
|
11936
|
-
};
|
|
11937
|
-
var AGENT_ROOT_DIRS = {
|
|
11938
|
-
claude: ".claude",
|
|
11939
|
-
cursor: ".cursor",
|
|
11940
|
-
windsurf: ".windsurf",
|
|
11941
|
-
openclaw: ".openclaw",
|
|
11942
|
-
hermes: ".hermes"
|
|
11943
|
-
};
|
|
11944
|
-
var detectAgent = (cwd) => {
|
|
11945
|
-
for (const agent of AGENT_ORDER) {
|
|
11946
|
-
if (existsSync4(join3(cwd, AGENT_ROOT_DIRS[agent]))) return agent;
|
|
11947
|
-
}
|
|
11948
|
-
return null;
|
|
11949
|
-
};
|
|
11950
12161
|
var getSkillContent = (name) => {
|
|
11951
12162
|
const content = SKILL_CONTENT[name];
|
|
11952
12163
|
if (content === void 0) {
|
|
@@ -11957,13 +12168,13 @@ var getSkillContent = (name) => {
|
|
|
11957
12168
|
return content;
|
|
11958
12169
|
};
|
|
11959
12170
|
var writeSkill = (outDir, name) => {
|
|
11960
|
-
const skillDir =
|
|
12171
|
+
const skillDir = join4(outDir, `${SKILL_PREFIX}${name}`);
|
|
11961
12172
|
mkdirSync3(skillDir, { recursive: true });
|
|
11962
|
-
const outPath =
|
|
12173
|
+
const outPath = join4(skillDir, "SKILL.md");
|
|
11963
12174
|
writeFileSync3(outPath, getSkillContent(name));
|
|
11964
12175
|
return outPath;
|
|
11965
12176
|
};
|
|
11966
|
-
var skillsCommand = new
|
|
12177
|
+
var skillsCommand = new Command16("skills").description(
|
|
11967
12178
|
"Install pre-built agent skills \u2014 onboarding plus discovery, social, risk, and reporting strategies (run `skills list` to see them all)"
|
|
11968
12179
|
).action(function() {
|
|
11969
12180
|
this.outputHelp();
|
|
@@ -12014,19 +12225,19 @@ skillsCommand.command("add [name]").description(
|
|
|
12014
12225
|
outDir = resolve(dirFlag);
|
|
12015
12226
|
resolvedAgent = "custom";
|
|
12016
12227
|
} else if (agentFlag) {
|
|
12017
|
-
if (!
|
|
12228
|
+
if (!AGENT_HARNESS_SKILLS_DIRS[agentFlag]) {
|
|
12018
12229
|
return outputErrorAndExit(
|
|
12019
12230
|
json,
|
|
12020
12231
|
`Unknown agent: ${agentFlag}`,
|
|
12021
|
-
`Supported: ${
|
|
12232
|
+
`Supported: ${AGENT_HARNESS_ORDER.join(", ")}`
|
|
12022
12233
|
);
|
|
12023
12234
|
}
|
|
12024
|
-
outDir = resolve(process.cwd(),
|
|
12235
|
+
outDir = resolve(process.cwd(), AGENT_HARNESS_SKILLS_DIRS[agentFlag]);
|
|
12025
12236
|
resolvedAgent = agentFlag;
|
|
12026
12237
|
} else {
|
|
12027
|
-
const detected =
|
|
12238
|
+
const detected = detectAgentHarness(process.cwd());
|
|
12028
12239
|
resolvedAgent = detected ?? "claude";
|
|
12029
|
-
outDir = resolve(process.cwd(),
|
|
12240
|
+
outDir = resolve(process.cwd(), AGENT_HARNESS_SKILLS_DIRS[resolvedAgent]);
|
|
12030
12241
|
}
|
|
12031
12242
|
const requested = installAll ? SKILLS.map((s) => s.name) : [name];
|
|
12032
12243
|
const invalid = requested.filter((n) => !SKILLS.some((s) => s.name === n));
|
|
@@ -12105,8 +12316,8 @@ Invoke by typing /${SKILL_PREFIX}${firstRequested} in your agent to get started.
|
|
|
12105
12316
|
});
|
|
12106
12317
|
|
|
12107
12318
|
// src/commands/wallet.ts
|
|
12108
|
-
import { Command as
|
|
12109
|
-
import { isAddress as
|
|
12319
|
+
import { Command as Command17 } from "commander";
|
|
12320
|
+
import { isAddress as isAddress11 } from "viem";
|
|
12110
12321
|
import { privateKeyToAccount as privateKeyToAccount10 } from "viem/accounts";
|
|
12111
12322
|
var resolvePrivateKey2 = () => {
|
|
12112
12323
|
const envKey = process.env.ZORA_PRIVATE_KEY;
|
|
@@ -12122,15 +12333,15 @@ var resolvePrivateKey2 = () => {
|
|
|
12122
12333
|
var resolveSmartWalletAddress3 = () => {
|
|
12123
12334
|
const envAddress = process.env.ZORA_SMART_WALLET_ADDRESS;
|
|
12124
12335
|
if (envAddress) {
|
|
12125
|
-
return
|
|
12336
|
+
return isAddress11(envAddress) ? { address: envAddress, source: "env" } : { invalid: true, source: "env" };
|
|
12126
12337
|
}
|
|
12127
12338
|
const fileAddress = getSmartWalletAddress();
|
|
12128
12339
|
if (fileAddress !== void 0) {
|
|
12129
|
-
return
|
|
12340
|
+
return isAddress11(fileAddress) ? { address: fileAddress, source: "file" } : { invalid: true, source: "file" };
|
|
12130
12341
|
}
|
|
12131
12342
|
return void 0;
|
|
12132
12343
|
};
|
|
12133
|
-
var walletCommand = new
|
|
12344
|
+
var walletCommand = new Command17("wallet").description("Manage your Zora wallet").action(function() {
|
|
12134
12345
|
this.outputHelp();
|
|
12135
12346
|
});
|
|
12136
12347
|
walletCommand.command("info").description("Show wallet address and storage location").action(function() {
|
|
@@ -12667,7 +12878,7 @@ import { jsx as jsx24 } from "react/jsx-runtime";
|
|
|
12667
12878
|
if (process.env.ZORA_API_TARGET) {
|
|
12668
12879
|
setApiBaseUrl(process.env.ZORA_API_TARGET);
|
|
12669
12880
|
}
|
|
12670
|
-
var version = true ? "1.
|
|
12881
|
+
var version = true ? "1.5.0" : JSON.parse(
|
|
12671
12882
|
readFileSync5(new URL("../package.json", import.meta.url), "utf-8")
|
|
12672
12883
|
).version;
|
|
12673
12884
|
function styledHelpWriteOut(showHeader) {
|
|
@@ -12687,7 +12898,7 @@ function styledHelpWriteOut(showHeader) {
|
|
|
12687
12898
|
};
|
|
12688
12899
|
}
|
|
12689
12900
|
var buildProgram = () => {
|
|
12690
|
-
const program2 = new
|
|
12901
|
+
const program2 = new Command18().name("zora").description("Trade what's trending. Run `zora setup` to get started.").version(version).option("--json", "Output as JSON (for scripts and automation)", false);
|
|
12691
12902
|
const helpWidth = (process.stdout.columns || 80) - 4;
|
|
12692
12903
|
program2.configureHelp({
|
|
12693
12904
|
helpWidth,
|
|
@@ -12704,6 +12915,7 @@ var buildProgram = () => {
|
|
|
12704
12915
|
program2.addCommand(authCommand);
|
|
12705
12916
|
program2.addCommand(balanceCommand);
|
|
12706
12917
|
program2.addCommand(buyCommand);
|
|
12918
|
+
program2.addCommand(claimCommand);
|
|
12707
12919
|
program2.addCommand(commentCommand);
|
|
12708
12920
|
program2.addCommand(createCommand);
|
|
12709
12921
|
program2.addCommand(dmCommand);
|