@net-protocol/cli 0.1.19 → 0.1.20

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.
@@ -11,7 +11,7 @@ import { stringToHex, createWalletClient, http, hexToString, parseEther, encodeF
11
11
  import { privateKeyToAccount } from 'viem/accounts';
12
12
  import { getNetContract, getChainName, getPublicClient, getChainRpcUrls, NetClient, toBytes32, NULL_ADDRESS } from '@net-protocol/core';
13
13
  import { createRelayX402Client, createRelaySession, checkBackendWalletBalance, fundBackendWallet, batchTransactions, submitTransactionsViaRelay, waitForConfirmations, retryFailedTransactions as retryFailedTransactions$1 } from '@net-protocol/relay';
14
- import { FeedRegistryClient, FeedClient, AgentRegistryClient } from '@net-protocol/feeds';
14
+ import { FeedRegistryClient, FeedClient } from '@net-protocol/feeds';
15
15
  import { isNetrSupportedChain, NetrClient } from '@net-protocol/netr';
16
16
  import { PROFILE_PICTURE_STORAGE_KEY, PROFILE_METADATA_STORAGE_KEY, parseProfileMetadata, PROFILE_CANVAS_STORAGE_KEY, isValidUrl, getProfilePictureStorageArgs, STORAGE_CONTRACT, isValidXUsername, getProfileMetadataStorageArgs, isValidBio, isValidTokenAddress } from '@net-protocol/profiles';
17
17
  import { base } from 'viem/chains';
@@ -1250,6 +1250,8 @@ async function encodeStorageUpload(options) {
1250
1250
  if (options.privateKey) {
1251
1251
  const account = privateKeyToAccount(options.privateKey);
1252
1252
  operatorAddress = account.address;
1253
+ } else if (options.address) {
1254
+ operatorAddress = options.address;
1253
1255
  } else {
1254
1256
  operatorAddress = "0x0000000000000000000000000000000000000000";
1255
1257
  }
@@ -1310,6 +1312,9 @@ function registerStorageCommand(program2) {
1310
1312
  ).option(
1311
1313
  "--encode-only",
1312
1314
  "Output transaction data as JSON instead of executing"
1315
+ ).option(
1316
+ "--address <address>",
1317
+ "Operator address (0x-prefixed). Used with --encode-only when no private key is provided"
1313
1318
  ).option(
1314
1319
  "--chunk-size <bytes>",
1315
1320
  `Max chunk size in bytes for splitting large files (default: ${OPTIMAL_CHUNK_SIZE})`,
@@ -1322,6 +1327,7 @@ function registerStorageCommand(program2) {
1322
1327
  storageKey: options.key,
1323
1328
  text: options.text,
1324
1329
  privateKey: options.privateKey,
1330
+ address: options.address,
1325
1331
  chainId: options.chainId,
1326
1332
  rpcUrl: options.rpcUrl,
1327
1333
  chunkSize: options.chunkSize
@@ -1641,12 +1647,6 @@ function createNetClient(options) {
1641
1647
  overrides: options.rpcUrl ? { rpcUrls: [options.rpcUrl] } : void 0
1642
1648
  });
1643
1649
  }
1644
- function createAgentRegistryClient(options) {
1645
- return new AgentRegistryClient({
1646
- chainId: options.chainId,
1647
- overrides: options.rpcUrl ? { rpcUrls: [options.rpcUrl] } : void 0
1648
- });
1649
- }
1650
1650
 
1651
1651
  // src/commands/message/send.ts
1652
1652
  function prepareMessageConfig(client, options) {
@@ -6390,73 +6390,6 @@ function registerFeedHistoryCommand(parent) {
6390
6390
  await executeFeedHistory(options);
6391
6391
  });
6392
6392
  }
6393
- async function executeRegisterAgent(options) {
6394
- if (options.encodeOnly) {
6395
- const readOnlyOptions = parseReadOnlyOptionsWithDefault({
6396
- chainId: options.chainId,
6397
- rpcUrl: options.rpcUrl
6398
- });
6399
- const client2 = createAgentRegistryClient(readOnlyOptions);
6400
- const txConfig2 = client2.prepareRegisterAgent();
6401
- const encoded = encodeTransaction(txConfig2, readOnlyOptions.chainId);
6402
- printJson(encoded);
6403
- return;
6404
- }
6405
- const commonOptions = parseCommonOptionsWithDefault(
6406
- {
6407
- privateKey: options.privateKey,
6408
- chainId: options.chainId,
6409
- rpcUrl: options.rpcUrl
6410
- },
6411
- true
6412
- // supports --encode-only
6413
- );
6414
- const client = createAgentRegistryClient(commonOptions);
6415
- const walletClient = createWallet(
6416
- commonOptions.privateKey,
6417
- commonOptions.chainId,
6418
- commonOptions.rpcUrl
6419
- );
6420
- const isRegistered = await client.isAgentRegistered(walletClient.account.address);
6421
- if (isRegistered) {
6422
- exitWithError(`Address ${walletClient.account.address} is already registered as an agent`);
6423
- }
6424
- console.log(chalk4.blue(`Registering agent ${walletClient.account.address}...`));
6425
- const txConfig = client.prepareRegisterAgent();
6426
- try {
6427
- const hash = await executeTransaction(walletClient, txConfig);
6428
- addHistoryEntry({
6429
- type: "register",
6430
- txHash: hash,
6431
- chainId: commonOptions.chainId,
6432
- feed: "agent-registry",
6433
- sender: walletClient.account.address
6434
- });
6435
- console.log(
6436
- chalk4.green(
6437
- `Agent registered successfully!
6438
- Transaction: ${hash}
6439
- Address: ${walletClient.account.address}`
6440
- )
6441
- );
6442
- } catch (error) {
6443
- exitWithError(
6444
- `Failed to register agent: ${error instanceof Error ? error.message : String(error)}`
6445
- );
6446
- }
6447
- }
6448
- function registerAgentRegisterCommand(parent) {
6449
- parent.command("register-agent").description("Register your address on the agent leaderboard").option(
6450
- "--chain-id <id>",
6451
- "Chain ID (default: 8453 for Base)",
6452
- (value) => parseInt(value, 10)
6453
- ).option("--rpc-url <url>", "Custom RPC URL").option("--private-key <key>", "Private key (0x-prefixed)").option(
6454
- "--encode-only",
6455
- "Output transaction data as JSON instead of executing"
6456
- ).action(async (options) => {
6457
- await executeRegisterAgent(options);
6458
- });
6459
- }
6460
6393
 
6461
6394
  // src/commands/feed/index.ts
6462
6395
  function registerFeedCommand(program2) {
@@ -6471,7 +6404,6 @@ function registerFeedCommand(program2) {
6471
6404
  registerFeedPostsCommand(feedCommand);
6472
6405
  registerFeedConfigCommand(feedCommand);
6473
6406
  registerFeedHistoryCommand(feedCommand);
6474
- registerAgentRegisterCommand(feedCommand);
6475
6407
  }
6476
6408
 
6477
6409
  // src/cli/index.ts