@net-protocol/cli 0.2.3 → 0.2.6

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.
@@ -7,7 +7,7 @@ import chalk4 from 'chalk';
7
7
  import * as fs6 from 'fs';
8
8
  import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
9
9
  import { OPTIMAL_CHUNK_SIZE, StorageClient, detectFileTypeFromBase64, base64ToDataUri, shouldSuggestXmlStorage, getStorageKeyBytes, chunkDataForStorage, CHUNKED_STORAGE_CONTRACT, STORAGE_CONTRACT as STORAGE_CONTRACT$1, encodeStorageKeyForUrl } from '@net-protocol/storage';
10
- import { createPublicClient, http, createWalletClient, stringToHex, hexToString, parseEther, encodeFunctionData, publicActions, concat, defineChain, decodeEventLog, formatEther, isAddress } from 'viem';
10
+ import { createPublicClient, http, createWalletClient, stringToHex, hexToString, parseEther, encodeFunctionData, publicActions, concat, defineChain, parseUnits, decodeEventLog, formatEther, isAddress } from 'viem';
11
11
  import { getSupportedChains, getNetContract, getChainName, getChainRpcUrls, getPublicClient, getBaseDataSuffix, NetClient, toBytes32, getChainBlockExplorer, NULL_ADDRESS, getChainSlug } from '@net-protocol/core';
12
12
  import { privateKeyToAccount } from 'viem/accounts';
13
13
  import { fundBackendWallet, checkBackendWalletBalance, createRelayX402Client, createRelaySession, batchTransactions, submitTransactionsViaRelay, waitForConfirmations, retryFailedTransactions as retryFailedTransactions$1 } from '@net-protocol/relay';
@@ -18,7 +18,7 @@ import { PROFILE_PICTURE_STORAGE_KEY, PROFILE_METADATA_STORAGE_KEY, parseProfile
18
18
  import { baseSepolia, base } from 'viem/chains';
19
19
  import * as path from 'path';
20
20
  import { join } from 'path';
21
- import { BazaarClient } from '@net-protocol/bazaar';
21
+ import { BazaarClient, getErc20PaymentToken } from '@net-protocol/bazaar';
22
22
  import * as os from 'os';
23
23
  import { homedir } from 'os';
24
24
  import * as readline from 'readline';
@@ -3746,11 +3746,19 @@ function registerProfileCommand(program2) {
3746
3746
  profileCommand.addCommand(getCSSCommand);
3747
3747
  profileCommand.addCommand(cssPromptCommand);
3748
3748
  }
3749
-
3750
- // src/commands/bazaar/format.ts
3751
3749
  function formatEthPrice(price) {
3752
3750
  return price.toFixed(6).replace(/\.?0+$/, "");
3753
3751
  }
3752
+ function parseErc20Price(chainId, price) {
3753
+ const paymentToken = getErc20PaymentToken(chainId);
3754
+ if (!paymentToken) {
3755
+ exitWithError(`Chain ${chainId} has no ERC20 payment token configured`);
3756
+ }
3757
+ return {
3758
+ priceWei: parseUnits(price, paymentToken.decimals),
3759
+ symbol: paymentToken.symbol
3760
+ };
3761
+ }
3754
3762
 
3755
3763
  // src/commands/bazaar/list-listings.ts
3756
3764
  async function executeListListings(options) {
@@ -3910,8 +3918,8 @@ Sales (${sales.length}):
3910
3918
  }
3911
3919
  async function executeCreateListing(options) {
3912
3920
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
3913
- if (!hasPrivateKey) {
3914
- await executeKeylessMode(options);
3921
+ if (!hasPrivateKey || options.encodeOnly) {
3922
+ await executeEncodeOnly3(options);
3915
3923
  return;
3916
3924
  }
3917
3925
  const commonOptions = parseCommonOptions({
@@ -3996,9 +4004,9 @@ async function executeCreateListing(options) {
3996
4004
  );
3997
4005
  }
3998
4006
  }
3999
- async function executeKeylessMode(options) {
4007
+ async function executeEncodeOnly3(options) {
4000
4008
  if (!options.offerer) {
4001
- exitWithError("--offerer is required when not providing --private-key");
4009
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4002
4010
  }
4003
4011
  const readOnlyOptions = parseReadOnlyOptions({
4004
4012
  chainId: options.chainId,
@@ -4051,8 +4059,8 @@ function bigintReplacer(_key, value) {
4051
4059
  }
4052
4060
  async function executeCreateOffer(options) {
4053
4061
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4054
- if (!hasPrivateKey) {
4055
- await executeKeylessMode2(options);
4062
+ if (!hasPrivateKey || options.encodeOnly) {
4063
+ await executeEncodeOnly4(options);
4056
4064
  return;
4057
4065
  }
4058
4066
  const commonOptions = parseCommonOptions({
@@ -4135,9 +4143,9 @@ async function executeCreateOffer(options) {
4135
4143
  );
4136
4144
  }
4137
4145
  }
4138
- async function executeKeylessMode2(options) {
4146
+ async function executeEncodeOnly4(options) {
4139
4147
  if (!options.offerer) {
4140
- exitWithError("--offerer is required when not providing --private-key");
4148
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4141
4149
  }
4142
4150
  const readOnlyOptions = parseReadOnlyOptions({
4143
4151
  chainId: options.chainId,
@@ -4197,7 +4205,7 @@ async function executeSubmitListing(options) {
4197
4205
  );
4198
4206
  }
4199
4207
  if (options.encodeOnly) {
4200
- await executeEncodeOnly3(options, orderData);
4208
+ await executeEncodeOnly5(options, orderData);
4201
4209
  return;
4202
4210
  }
4203
4211
  const commonOptions = parseCommonOptions(
@@ -4248,7 +4256,7 @@ async function executeSubmitListing(options) {
4248
4256
  );
4249
4257
  }
4250
4258
  }
4251
- async function executeEncodeOnly3(options, orderData) {
4259
+ async function executeEncodeOnly5(options, orderData) {
4252
4260
  const readOnlyOptions = parseReadOnlyOptions({
4253
4261
  chainId: options.chainId,
4254
4262
  rpcUrl: options.rpcUrl
@@ -4279,7 +4287,7 @@ async function executeSubmitOffer(options) {
4279
4287
  );
4280
4288
  }
4281
4289
  if (options.encodeOnly) {
4282
- await executeEncodeOnly4(options, orderData);
4290
+ await executeEncodeOnly6(options, orderData);
4283
4291
  return;
4284
4292
  }
4285
4293
  const commonOptions = parseCommonOptions(
@@ -4330,7 +4338,7 @@ async function executeSubmitOffer(options) {
4330
4338
  );
4331
4339
  }
4332
4340
  }
4333
- async function executeEncodeOnly4(options, orderData) {
4341
+ async function executeEncodeOnly6(options, orderData) {
4334
4342
  const readOnlyOptions = parseReadOnlyOptions({
4335
4343
  chainId: options.chainId,
4336
4344
  rpcUrl: options.rpcUrl
@@ -4352,7 +4360,7 @@ async function executeEncodeOnly4(options, orderData) {
4352
4360
  }
4353
4361
  async function executeBuyListing(options) {
4354
4362
  if (options.encodeOnly) {
4355
- await executeEncodeOnly5(options);
4363
+ await executeEncodeOnly7(options);
4356
4364
  return;
4357
4365
  }
4358
4366
  const commonOptions = parseCommonOptions(
@@ -4431,7 +4439,7 @@ async function executeBuyListing(options) {
4431
4439
  );
4432
4440
  }
4433
4441
  }
4434
- async function executeEncodeOnly5(options) {
4442
+ async function executeEncodeOnly7(options) {
4435
4443
  if (!options.buyer) {
4436
4444
  exitWithError("--buyer is required when using --encode-only without --private-key");
4437
4445
  }
@@ -4482,7 +4490,7 @@ async function executeEncodeOnly5(options) {
4482
4490
  }
4483
4491
  async function executeAcceptOffer(options) {
4484
4492
  if (options.encodeOnly) {
4485
- await executeEncodeOnly6(options);
4493
+ await executeEncodeOnly8(options);
4486
4494
  return;
4487
4495
  }
4488
4496
  const commonOptions = parseCommonOptions(
@@ -4565,7 +4573,7 @@ async function executeAcceptOffer(options) {
4565
4573
  );
4566
4574
  }
4567
4575
  }
4568
- async function executeEncodeOnly6(options) {
4576
+ async function executeEncodeOnly8(options) {
4569
4577
  if (!options.seller) {
4570
4578
  exitWithError("--seller is required when using --encode-only without --private-key");
4571
4579
  }
@@ -4773,8 +4781,8 @@ ERC-20 Offers (${offers.length}):
4773
4781
  }
4774
4782
  async function executeCreateErc20Listing(options) {
4775
4783
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4776
- if (!hasPrivateKey) {
4777
- await executeKeylessMode3(options);
4784
+ if (!hasPrivateKey || options.encodeOnly) {
4785
+ await executeEncodeOnly9(options);
4778
4786
  return;
4779
4787
  }
4780
4788
  const commonOptions = parseCommonOptions({
@@ -4787,7 +4795,10 @@ async function executeCreateErc20Listing(options) {
4787
4795
  chainId: commonOptions.chainId,
4788
4796
  rpcUrl: commonOptions.rpcUrl
4789
4797
  });
4790
- const priceWei = parseEther(options.price);
4798
+ const { priceWei, symbol: paymentSymbol } = parseErc20Price(
4799
+ commonOptions.chainId,
4800
+ options.price
4801
+ );
4791
4802
  const tokenAmount = BigInt(options.tokenAmount);
4792
4803
  try {
4793
4804
  console.log(chalk4.blue("Preparing ERC-20 listing..."));
@@ -4852,7 +4863,7 @@ async function executeCreateErc20Listing(options) {
4852
4863
  Transaction: ${hash}
4853
4864
  Token: ${options.tokenAddress}
4854
4865
  Amount: ${options.tokenAmount}
4855
- Price: ${options.price} ETH`
4866
+ Price: ${options.price} ${paymentSymbol}`
4856
4867
  )
4857
4868
  );
4858
4869
  } catch (error) {
@@ -4861,9 +4872,9 @@ async function executeCreateErc20Listing(options) {
4861
4872
  );
4862
4873
  }
4863
4874
  }
4864
- async function executeKeylessMode3(options) {
4875
+ async function executeEncodeOnly9(options) {
4865
4876
  if (!options.offerer) {
4866
- exitWithError("--offerer is required when not providing --private-key");
4877
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4867
4878
  }
4868
4879
  const readOnlyOptions = parseReadOnlyOptions({
4869
4880
  chainId: options.chainId,
@@ -4873,7 +4884,7 @@ async function executeKeylessMode3(options) {
4873
4884
  chainId: readOnlyOptions.chainId,
4874
4885
  rpcUrl: readOnlyOptions.rpcUrl
4875
4886
  });
4876
- const priceWei = parseEther(options.price);
4887
+ const { priceWei } = parseErc20Price(readOnlyOptions.chainId, options.price);
4877
4888
  const tokenAmount = BigInt(options.tokenAmount);
4878
4889
  try {
4879
4890
  const prepared = await bazaarClient.prepareCreateErc20Listing({
@@ -4917,8 +4928,8 @@ function bigintReplacer3(_key, value) {
4917
4928
  }
4918
4929
  async function executeCreateErc20Offer(options) {
4919
4930
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4920
- if (!hasPrivateKey) {
4921
- await executeKeylessMode4(options);
4931
+ if (!hasPrivateKey || options.encodeOnly) {
4932
+ await executeEncodeOnly10(options);
4922
4933
  return;
4923
4934
  }
4924
4935
  const commonOptions = parseCommonOptions({
@@ -4931,7 +4942,10 @@ async function executeCreateErc20Offer(options) {
4931
4942
  chainId: commonOptions.chainId,
4932
4943
  rpcUrl: commonOptions.rpcUrl
4933
4944
  });
4934
- const priceWei = parseEther(options.price);
4945
+ const { priceWei, symbol: paymentSymbol } = parseErc20Price(
4946
+ commonOptions.chainId,
4947
+ options.price
4948
+ );
4935
4949
  const tokenAmount = BigInt(options.tokenAmount);
4936
4950
  try {
4937
4951
  console.log(chalk4.blue("Preparing ERC-20 offer..."));
@@ -4995,7 +5009,7 @@ async function executeCreateErc20Offer(options) {
4995
5009
  Transaction: ${hash}
4996
5010
  Token: ${options.tokenAddress}
4997
5011
  Amount: ${options.tokenAmount}
4998
- Price: ${options.price} ETH`
5012
+ Price: ${options.price} ${paymentSymbol}`
4999
5013
  )
5000
5014
  );
5001
5015
  } catch (error) {
@@ -5004,9 +5018,9 @@ async function executeCreateErc20Offer(options) {
5004
5018
  );
5005
5019
  }
5006
5020
  }
5007
- async function executeKeylessMode4(options) {
5021
+ async function executeEncodeOnly10(options) {
5008
5022
  if (!options.offerer) {
5009
- exitWithError("--offerer is required when not providing --private-key");
5023
+ exitWithError("--offerer is required when using --encode-only without --private-key");
5010
5024
  }
5011
5025
  const readOnlyOptions = parseReadOnlyOptions({
5012
5026
  chainId: options.chainId,
@@ -5016,7 +5030,7 @@ async function executeKeylessMode4(options) {
5016
5030
  chainId: readOnlyOptions.chainId,
5017
5031
  rpcUrl: readOnlyOptions.rpcUrl
5018
5032
  });
5019
- const priceWei = parseEther(options.price);
5033
+ const { priceWei } = parseErc20Price(readOnlyOptions.chainId, options.price);
5020
5034
  const tokenAmount = BigInt(options.tokenAmount);
5021
5035
  try {
5022
5036
  const prepared = await bazaarClient.prepareCreateErc20Offer({
@@ -5068,7 +5082,7 @@ async function executeSubmitErc20Listing(options) {
5068
5082
  );
5069
5083
  }
5070
5084
  if (options.encodeOnly) {
5071
- await executeEncodeOnly7(options, orderData);
5085
+ await executeEncodeOnly11(options, orderData);
5072
5086
  return;
5073
5087
  }
5074
5088
  const commonOptions = parseCommonOptions(
@@ -5119,7 +5133,7 @@ async function executeSubmitErc20Listing(options) {
5119
5133
  );
5120
5134
  }
5121
5135
  }
5122
- async function executeEncodeOnly7(options, orderData) {
5136
+ async function executeEncodeOnly11(options, orderData) {
5123
5137
  const readOnlyOptions = parseReadOnlyOptions({
5124
5138
  chainId: options.chainId,
5125
5139
  rpcUrl: options.rpcUrl
@@ -5150,7 +5164,7 @@ async function executeSubmitErc20Offer(options) {
5150
5164
  );
5151
5165
  }
5152
5166
  if (options.encodeOnly) {
5153
- await executeEncodeOnly8(options, orderData);
5167
+ await executeEncodeOnly12(options, orderData);
5154
5168
  return;
5155
5169
  }
5156
5170
  const commonOptions = parseCommonOptions(
@@ -5201,7 +5215,7 @@ async function executeSubmitErc20Offer(options) {
5201
5215
  );
5202
5216
  }
5203
5217
  }
5204
- async function executeEncodeOnly8(options, orderData) {
5218
+ async function executeEncodeOnly12(options, orderData) {
5205
5219
  const readOnlyOptions = parseReadOnlyOptions({
5206
5220
  chainId: options.chainId,
5207
5221
  rpcUrl: options.rpcUrl
@@ -5223,7 +5237,7 @@ async function executeEncodeOnly8(options, orderData) {
5223
5237
  }
5224
5238
  async function executeBuyErc20Listing(options) {
5225
5239
  if (options.encodeOnly) {
5226
- await executeEncodeOnly9(options);
5240
+ await executeEncodeOnly13(options);
5227
5241
  return;
5228
5242
  }
5229
5243
  const commonOptions = parseCommonOptions(
@@ -5303,7 +5317,7 @@ async function executeBuyErc20Listing(options) {
5303
5317
  );
5304
5318
  }
5305
5319
  }
5306
- async function executeEncodeOnly9(options) {
5320
+ async function executeEncodeOnly13(options) {
5307
5321
  if (!options.buyer) {
5308
5322
  exitWithError("--buyer is required when using --encode-only without --private-key");
5309
5323
  }
@@ -5354,7 +5368,7 @@ async function executeEncodeOnly9(options) {
5354
5368
  }
5355
5369
  async function executeAcceptErc20Offer(options) {
5356
5370
  if (options.encodeOnly) {
5357
- await executeEncodeOnly10(options);
5371
+ await executeEncodeOnly14(options);
5358
5372
  return;
5359
5373
  }
5360
5374
  const commonOptions = parseCommonOptions(
@@ -5437,7 +5451,7 @@ async function executeAcceptErc20Offer(options) {
5437
5451
  );
5438
5452
  }
5439
5453
  }
5440
- async function executeEncodeOnly10(options) {
5454
+ async function executeEncodeOnly14(options) {
5441
5455
  if (!options.seller) {
5442
5456
  exitWithError("--seller is required when using --encode-only without --private-key");
5443
5457
  }
@@ -5516,7 +5530,7 @@ async function executeTransaction(walletClient, txConfig) {
5516
5530
  // src/commands/bazaar/cancel-listing.ts
5517
5531
  async function executeCancelListing(options) {
5518
5532
  if (options.encodeOnly) {
5519
- await executeEncodeOnly11(options);
5533
+ await executeEncodeOnly15(options);
5520
5534
  return;
5521
5535
  }
5522
5536
  const commonOptions = parseCommonOptions(
@@ -5568,7 +5582,7 @@ async function executeCancelListing(options) {
5568
5582
  );
5569
5583
  }
5570
5584
  }
5571
- async function executeEncodeOnly11(options) {
5585
+ async function executeEncodeOnly15(options) {
5572
5586
  if (!options.maker) {
5573
5587
  exitWithError("--maker is required when using --encode-only without --private-key");
5574
5588
  }
@@ -5605,7 +5619,7 @@ async function executeEncodeOnly11(options) {
5605
5619
  }
5606
5620
  async function executeCancelOffer(options) {
5607
5621
  if (options.encodeOnly) {
5608
- await executeEncodeOnly12(options);
5622
+ await executeEncodeOnly16(options);
5609
5623
  return;
5610
5624
  }
5611
5625
  const commonOptions = parseCommonOptions(
@@ -5657,7 +5671,7 @@ async function executeCancelOffer(options) {
5657
5671
  );
5658
5672
  }
5659
5673
  }
5660
- async function executeEncodeOnly12(options) {
5674
+ async function executeEncodeOnly16(options) {
5661
5675
  if (!options.maker) {
5662
5676
  exitWithError("--maker is required when using --encode-only without --private-key");
5663
5677
  }
@@ -5693,7 +5707,7 @@ async function executeEncodeOnly12(options) {
5693
5707
  }
5694
5708
  async function executeCancelErc20Listing(options) {
5695
5709
  if (options.encodeOnly) {
5696
- await executeEncodeOnly13(options);
5710
+ await executeEncodeOnly17(options);
5697
5711
  return;
5698
5712
  }
5699
5713
  const commonOptions = parseCommonOptions(
@@ -5746,7 +5760,7 @@ async function executeCancelErc20Listing(options) {
5746
5760
  );
5747
5761
  }
5748
5762
  }
5749
- async function executeEncodeOnly13(options) {
5763
+ async function executeEncodeOnly17(options) {
5750
5764
  if (!options.maker) {
5751
5765
  exitWithError("--maker is required when using --encode-only without --private-key");
5752
5766
  }
@@ -5783,7 +5797,7 @@ async function executeEncodeOnly13(options) {
5783
5797
  }
5784
5798
  async function executeCancelErc20Offer(options) {
5785
5799
  if (options.encodeOnly) {
5786
- await executeEncodeOnly14(options);
5800
+ await executeEncodeOnly18(options);
5787
5801
  return;
5788
5802
  }
5789
5803
  const commonOptions = parseCommonOptions(
@@ -5835,7 +5849,7 @@ async function executeCancelErc20Offer(options) {
5835
5849
  );
5836
5850
  }
5837
5851
  }
5838
- async function executeEncodeOnly14(options) {
5852
+ async function executeEncodeOnly18(options) {
5839
5853
  if (!options.maker) {
5840
5854
  exitWithError("--maker is required when using --encode-only without --private-key");
5841
5855
  }
@@ -5910,7 +5924,7 @@ function registerBazaarCommand(program2) {
5910
5924
  json: options.json
5911
5925
  });
5912
5926
  });
5913
- const createListingCommand = new Command("create-listing").description("Create an NFT listing (with --private-key: full flow; without: output EIP-712 data)").requiredOption("--nft-address <address>", "NFT contract address").requiredOption("--token-id <id>", "Token ID to list").requiredOption("--price <eth>", "Price in ETH (e.g., 0.1)").option("--target-fulfiller <address>", "Make a private listing for this address").option("--offerer <address>", "Offerer address (required without --private-key)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).action(async (options) => {
5927
+ const createListingCommand = new Command("create-listing").description("Create an NFT listing (with --private-key: full flow; without or with --encode-only: output EIP-712 data)").requiredOption("--nft-address <address>", "NFT contract address").requiredOption("--token-id <id>", "Token ID to list").requiredOption("--price <eth>", "Price in ETH (e.g., 0.1)").option("--target-fulfiller <address>", "Make a private listing for this address").option("--offerer <address>", "Offerer address (required without --private-key or with --encode-only)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output EIP-712 data and approval calldata as JSON instead of executing").action(async (options) => {
5914
5928
  await executeCreateListing({
5915
5929
  nftAddress: options.nftAddress,
5916
5930
  tokenId: options.tokenId,
@@ -5919,17 +5933,19 @@ function registerBazaarCommand(program2) {
5919
5933
  offerer: options.offerer,
5920
5934
  privateKey: options.privateKey,
5921
5935
  chainId: options.chainId,
5922
- rpcUrl: options.rpcUrl
5936
+ rpcUrl: options.rpcUrl,
5937
+ encodeOnly: options.encodeOnly
5923
5938
  });
5924
5939
  });
5925
- const createOfferCommand = new Command("create-offer").description("Create a collection offer (with --private-key: full flow; without: output EIP-712 data)").requiredOption("--nft-address <address>", "NFT contract address").requiredOption("--price <eth>", "Offer price in ETH (e.g., 0.1)").option("--offerer <address>", "Offerer address (required without --private-key)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).action(async (options) => {
5940
+ const createOfferCommand = new Command("create-offer").description("Create a collection offer (with --private-key: full flow; without or with --encode-only: output EIP-712 data)").requiredOption("--nft-address <address>", "NFT contract address").requiredOption("--price <eth>", "Offer price in ETH (e.g., 0.1)").option("--offerer <address>", "Offerer address (required without --private-key or with --encode-only)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output EIP-712 data and approval calldata as JSON instead of executing").action(async (options) => {
5926
5941
  await executeCreateOffer({
5927
5942
  nftAddress: options.nftAddress,
5928
5943
  price: options.price,
5929
5944
  offerer: options.offerer,
5930
5945
  privateKey: options.privateKey,
5931
5946
  chainId: options.chainId,
5932
- rpcUrl: options.rpcUrl
5947
+ rpcUrl: options.rpcUrl,
5948
+ encodeOnly: options.encodeOnly
5933
5949
  });
5934
5950
  });
5935
5951
  const submitListingCommand = new Command("submit-listing").description("Submit a signed listing (follow-up to create-listing without --private-key)").requiredOption("--order-data <path>", "Path to order JSON file from create-listing output").requiredOption("--signature <sig>", "EIP-712 signature (0x-prefixed)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output transaction data as JSON instead of executing").action(async (options) => {
@@ -6002,7 +6018,7 @@ function registerBazaarCommand(program2) {
6002
6018
  json: options.json
6003
6019
  });
6004
6020
  });
6005
- const createErc20ListingCommand = new Command("create-erc20-listing").description("Create an ERC-20 token listing (with --private-key: full flow; without: output EIP-712 data)").requiredOption("--token-address <address>", "ERC-20 token contract address").requiredOption("--token-amount <amount>", "Token amount in raw units (bigint string)").requiredOption("--price <eth>", "Total price in ETH for the token amount").option("--target-fulfiller <address>", "Make a private listing for this address").option("--offerer <address>", "Offerer address (required without --private-key)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).action(async (options) => {
6021
+ const createErc20ListingCommand = new Command("create-erc20-listing").description("Create an ERC-20 token listing (with --private-key: full flow; without or with --encode-only: output EIP-712 data)").requiredOption("--token-address <address>", "ERC-20 token contract address").requiredOption("--token-amount <amount>", "Token amount in raw units (bigint string)").requiredOption("--price <amount>", "Total price in payment-token units (USDC on Base, WETH elsewhere)").option("--target-fulfiller <address>", "Make a private listing for this address").option("--offerer <address>", "Offerer address (required without --private-key or with --encode-only)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output EIP-712 data and approval calldata as JSON instead of executing").action(async (options) => {
6006
6022
  await executeCreateErc20Listing({
6007
6023
  tokenAddress: options.tokenAddress,
6008
6024
  tokenAmount: options.tokenAmount,
@@ -6011,10 +6027,11 @@ function registerBazaarCommand(program2) {
6011
6027
  offerer: options.offerer,
6012
6028
  privateKey: options.privateKey,
6013
6029
  chainId: options.chainId,
6014
- rpcUrl: options.rpcUrl
6030
+ rpcUrl: options.rpcUrl,
6031
+ encodeOnly: options.encodeOnly
6015
6032
  });
6016
6033
  });
6017
- const createErc20OfferCommand = new Command("create-erc20-offer").description("Create an ERC-20 token offer (with --private-key: full flow; without: output EIP-712 data)").requiredOption("--token-address <address>", "ERC-20 token contract address").requiredOption("--token-amount <amount>", "Token amount in raw units (bigint string)").requiredOption("--price <eth>", "Total price in ETH for the token amount").option("--offerer <address>", "Offerer address (required without --private-key)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).action(async (options) => {
6034
+ const createErc20OfferCommand = new Command("create-erc20-offer").description("Create an ERC-20 token offer (with --private-key: full flow; without or with --encode-only: output EIP-712 data)").requiredOption("--token-address <address>", "ERC-20 token contract address").requiredOption("--token-amount <amount>", "Token amount in raw units (bigint string)").requiredOption("--price <amount>", "Total price in payment-token units (USDC on Base, WETH elsewhere)").option("--offerer <address>", "Offerer address (required without --private-key or with --encode-only)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output EIP-712 data and approval calldata as JSON instead of executing").action(async (options) => {
6018
6035
  await executeCreateErc20Offer({
6019
6036
  tokenAddress: options.tokenAddress,
6020
6037
  tokenAmount: options.tokenAmount,
@@ -6022,7 +6039,8 @@ function registerBazaarCommand(program2) {
6022
6039
  offerer: options.offerer,
6023
6040
  privateKey: options.privateKey,
6024
6041
  chainId: options.chainId,
6025
- rpcUrl: options.rpcUrl
6042
+ rpcUrl: options.rpcUrl,
6043
+ encodeOnly: options.encodeOnly
6026
6044
  });
6027
6045
  });
6028
6046
  const submitErc20ListingCommand = new Command("submit-erc20-listing").description("Submit a signed ERC-20 listing (follow-up to create-erc20-listing without --private-key)").requiredOption("--order-data <path>", "Path to order JSON file from create-erc20-listing output").requiredOption("--signature <sig>", "EIP-712 signature (0x-prefixed)").option(...privateKeyOption).option(...chainIdOption).option(...rpcUrlOption).option("--encode-only", "Output transaction data as JSON instead of executing").action(async (options) => {