@net-protocol/cli 0.1.31 → 0.1.33

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.
@@ -9,7 +9,7 @@ import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
9
9
  import { OPTIMAL_CHUNK_SIZE, StorageClient, detectFileTypeFromBase64, base64ToDataUri, shouldSuggestXmlStorage, getStorageKeyBytes, encodeStorageKeyForUrl, chunkDataForStorage, CHUNKED_STORAGE_CONTRACT, STORAGE_CONTRACT as STORAGE_CONTRACT$1 } from '@net-protocol/storage';
10
10
  import { stringToHex, createWalletClient, http, hexToString, parseEther, encodeFunctionData, publicActions, defineChain, createPublicClient } from 'viem';
11
11
  import { privateKeyToAccount } from 'viem/accounts';
12
- import { getNetContract, getChainName, getPublicClient, getChainRpcUrls, NetClient, getBaseDataSuffix, toBytes32, NULL_ADDRESS } from '@net-protocol/core';
12
+ import { getNetContract, getChainName, getPublicClient, getChainRpcUrls, getBaseDataSuffix, 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
14
  import { FeedRegistryClient, FeedClient, AgentRegistryClient } from '@net-protocol/feeds';
15
15
  import { isNetrSupportedChain, NetrClient } from '@net-protocol/netr';
@@ -746,8 +746,9 @@ async function uploadFileWithRelay(options) {
746
746
  const userWalletClient = createWalletClient({
747
747
  account: userAccount,
748
748
  chain: publicClient.chain,
749
- transport: http(rpcUrls[0])
749
+ transport: http(rpcUrls[0]),
750
750
  // Use first RPC URL
751
+ dataSuffix: getBaseDataSuffix(options.chainId)
751
752
  });
752
753
  const { fetchWithPayment, httpClient } = createRelayX402Client(
753
754
  userAccount,
@@ -1689,7 +1690,8 @@ async function executeSend(options) {
1689
1690
  });
1690
1691
  const walletClient = createWalletClient({
1691
1692
  account,
1692
- transport: http(rpcUrls[0])
1693
+ transport: http(rpcUrls[0]),
1694
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
1693
1695
  });
1694
1696
  console.log(chalk4.blue("Sending message..."));
1695
1697
  try {
@@ -2504,7 +2506,8 @@ async function executeProfileSetPicture(options) {
2504
2506
  account,
2505
2507
  chain: base,
2506
2508
  // TODO: Support other chains
2507
- transport: http(rpcUrls[0])
2509
+ transport: http(rpcUrls[0]),
2510
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
2508
2511
  }).extend(publicActions);
2509
2512
  console.log(chalk4.blue(`\u{1F4F7} Setting profile picture...`));
2510
2513
  console.log(chalk4.gray(` URL: ${options.url}`));
@@ -2618,7 +2621,8 @@ async function executeProfileSetUsername(options) {
2618
2621
  account,
2619
2622
  chain: base,
2620
2623
  // TODO: Support other chains
2621
- transport: http(rpcUrls[0])
2624
+ transport: http(rpcUrls[0]),
2625
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
2622
2626
  }).extend(publicActions);
2623
2627
  console.log(chalk4.blue(`Setting X username...`));
2624
2628
  console.log(chalk4.gray(` Username: ${displayUsername}`));
@@ -2719,7 +2723,8 @@ async function executeProfileSetBio(options) {
2719
2723
  account,
2720
2724
  chain: base,
2721
2725
  // TODO: Support other chains
2722
- transport: http(rpcUrls[0])
2726
+ transport: http(rpcUrls[0]),
2727
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
2723
2728
  }).extend(publicActions);
2724
2729
  console.log(chalk4.blue(`Setting profile bio...`));
2725
2730
  console.log(chalk4.gray(` Bio: ${options.bio}`));
@@ -2820,7 +2825,8 @@ async function executeProfileSetDisplayName(options) {
2820
2825
  account,
2821
2826
  chain: base,
2822
2827
  // TODO: Support other chains
2823
- transport: http(rpcUrls[0])
2828
+ transport: http(rpcUrls[0]),
2829
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
2824
2830
  }).extend(publicActions);
2825
2831
  console.log(chalk4.blue(`Setting display name...`));
2826
2832
  console.log(chalk4.gray(` Name: ${options.name}`));
@@ -2922,7 +2928,8 @@ async function executeProfileSetTokenAddress(options) {
2922
2928
  account,
2923
2929
  chain: base,
2924
2930
  // TODO: Support other chains
2925
- transport: http(rpcUrls[0])
2931
+ transport: http(rpcUrls[0]),
2932
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
2926
2933
  }).extend(publicActions);
2927
2934
  console.log(chalk4.blue(`Setting profile token address...`));
2928
2935
  console.log(chalk4.gray(` Token Address: ${normalizedAddress}`));
@@ -3075,7 +3082,8 @@ async function executeProfileSetCanvas(options) {
3075
3082
  account,
3076
3083
  chain: base,
3077
3084
  // TODO: Support other chains
3078
- transport: http(rpcUrls[0])
3085
+ transport: http(rpcUrls[0]),
3086
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
3079
3087
  }).extend(publicActions);
3080
3088
  console.log(chalk4.blue(`Setting profile canvas...`));
3081
3089
  console.log(
@@ -3299,7 +3307,8 @@ ${available}`
3299
3307
  const client = createWalletClient({
3300
3308
  account,
3301
3309
  chain: base,
3302
- transport: http(rpcUrls[0])
3310
+ transport: http(rpcUrls[0]),
3311
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
3303
3312
  }).extend(publicActions);
3304
3313
  console.log(chalk4.blue(`Setting profile CSS...`));
3305
3314
  console.log(
@@ -3844,7 +3853,8 @@ async function executeCreateListing(options) {
3844
3853
  });
3845
3854
  const walletClient = createWalletClient({
3846
3855
  account,
3847
- transport: http(rpcUrls[0])
3856
+ transport: http(rpcUrls[0]),
3857
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
3848
3858
  });
3849
3859
  for (const approval of prepared.approvals) {
3850
3860
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -3982,7 +3992,8 @@ async function executeCreateOffer(options) {
3982
3992
  });
3983
3993
  const walletClient = createWalletClient({
3984
3994
  account,
3985
- transport: http(rpcUrls[0])
3995
+ transport: http(rpcUrls[0]),
3996
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
3986
3997
  });
3987
3998
  for (const approval of prepared.approvals) {
3988
3999
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -4127,7 +4138,8 @@ async function executeSubmitListing(options) {
4127
4138
  });
4128
4139
  const walletClient = createWalletClient({
4129
4140
  account,
4130
- transport: http(rpcUrls[0])
4141
+ transport: http(rpcUrls[0]),
4142
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4131
4143
  });
4132
4144
  console.log(chalk4.blue("Submitting listing..."));
4133
4145
  const calldata = encodeFunctionData({
@@ -4208,7 +4220,8 @@ async function executeSubmitOffer(options) {
4208
4220
  });
4209
4221
  const walletClient = createWalletClient({
4210
4222
  account,
4211
- transport: http(rpcUrls[0])
4223
+ transport: http(rpcUrls[0]),
4224
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4212
4225
  });
4213
4226
  console.log(chalk4.blue("Submitting offer..."));
4214
4227
  const calldata = encodeFunctionData({
@@ -4287,7 +4300,8 @@ async function executeBuyListing(options) {
4287
4300
  });
4288
4301
  const walletClient = createWalletClient({
4289
4302
  account,
4290
- transport: http(rpcUrls[0])
4303
+ transport: http(rpcUrls[0]),
4304
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4291
4305
  });
4292
4306
  for (const approval of prepared.approvals) {
4293
4307
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -4420,7 +4434,8 @@ async function executeAcceptOffer(options) {
4420
4434
  });
4421
4435
  const walletClient = createWalletClient({
4422
4436
  account,
4423
- transport: http(rpcUrls[0])
4437
+ transport: http(rpcUrls[0]),
4438
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4424
4439
  });
4425
4440
  for (const approval of prepared.approvals) {
4426
4441
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -4701,7 +4716,8 @@ async function executeCreateErc20Listing(options) {
4701
4716
  });
4702
4717
  const walletClient = createWalletClient({
4703
4718
  account,
4704
- transport: http(rpcUrls[0])
4719
+ transport: http(rpcUrls[0]),
4720
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4705
4721
  });
4706
4722
  for (const approval of prepared.approvals) {
4707
4723
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -4842,7 +4858,8 @@ async function executeCreateErc20Offer(options) {
4842
4858
  });
4843
4859
  const walletClient = createWalletClient({
4844
4860
  account,
4845
- transport: http(rpcUrls[0])
4861
+ transport: http(rpcUrls[0]),
4862
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4846
4863
  });
4847
4864
  for (const approval of prepared.approvals) {
4848
4865
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -4990,7 +5007,8 @@ async function executeSubmitErc20Listing(options) {
4990
5007
  });
4991
5008
  const walletClient = createWalletClient({
4992
5009
  account,
4993
- transport: http(rpcUrls[0])
5010
+ transport: http(rpcUrls[0]),
5011
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
4994
5012
  });
4995
5013
  console.log(chalk4.blue("Submitting ERC-20 listing..."));
4996
5014
  const calldata = encodeFunctionData({
@@ -5071,7 +5089,8 @@ async function executeSubmitErc20Offer(options) {
5071
5089
  });
5072
5090
  const walletClient = createWalletClient({
5073
5091
  account,
5074
- transport: http(rpcUrls[0])
5092
+ transport: http(rpcUrls[0]),
5093
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
5075
5094
  });
5076
5095
  console.log(chalk4.blue("Submitting ERC-20 offer..."));
5077
5096
  const calldata = encodeFunctionData({
@@ -5150,7 +5169,8 @@ async function executeBuyErc20Listing(options) {
5150
5169
  });
5151
5170
  const walletClient = createWalletClient({
5152
5171
  account,
5153
- transport: http(rpcUrls[0])
5172
+ transport: http(rpcUrls[0]),
5173
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
5154
5174
  });
5155
5175
  for (const approval of prepared.approvals) {
5156
5176
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -5283,7 +5303,8 @@ async function executeAcceptErc20Offer(options) {
5283
5303
  });
5284
5304
  const walletClient = createWalletClient({
5285
5305
  account,
5286
- transport: http(rpcUrls[0])
5306
+ transport: http(rpcUrls[0]),
5307
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
5287
5308
  });
5288
5309
  for (const approval of prepared.approvals) {
5289
5310
  console.log(chalk4.blue("Sending approval transaction..."));
@@ -6947,7 +6968,8 @@ async function executeUpvoteToken(options) {
6947
6968
  try {
6948
6969
  poolResult = await discoverTokenPool({
6949
6970
  publicClient,
6950
- tokenAddress
6971
+ tokenAddress,
6972
+ chainId: readOnlyOptions.chainId
6951
6973
  });
6952
6974
  } catch (error) {
6953
6975
  exitWithError(