@net-protocol/cli 0.2.5 → 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.
@@ -3918,8 +3918,8 @@ Sales (${sales.length}):
3918
3918
  }
3919
3919
  async function executeCreateListing(options) {
3920
3920
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
3921
- if (!hasPrivateKey) {
3922
- await executeKeylessMode(options);
3921
+ if (!hasPrivateKey || options.encodeOnly) {
3922
+ await executeEncodeOnly3(options);
3923
3923
  return;
3924
3924
  }
3925
3925
  const commonOptions = parseCommonOptions({
@@ -4004,9 +4004,9 @@ async function executeCreateListing(options) {
4004
4004
  );
4005
4005
  }
4006
4006
  }
4007
- async function executeKeylessMode(options) {
4007
+ async function executeEncodeOnly3(options) {
4008
4008
  if (!options.offerer) {
4009
- exitWithError("--offerer is required when not providing --private-key");
4009
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4010
4010
  }
4011
4011
  const readOnlyOptions = parseReadOnlyOptions({
4012
4012
  chainId: options.chainId,
@@ -4059,8 +4059,8 @@ function bigintReplacer(_key, value) {
4059
4059
  }
4060
4060
  async function executeCreateOffer(options) {
4061
4061
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4062
- if (!hasPrivateKey) {
4063
- await executeKeylessMode2(options);
4062
+ if (!hasPrivateKey || options.encodeOnly) {
4063
+ await executeEncodeOnly4(options);
4064
4064
  return;
4065
4065
  }
4066
4066
  const commonOptions = parseCommonOptions({
@@ -4143,9 +4143,9 @@ async function executeCreateOffer(options) {
4143
4143
  );
4144
4144
  }
4145
4145
  }
4146
- async function executeKeylessMode2(options) {
4146
+ async function executeEncodeOnly4(options) {
4147
4147
  if (!options.offerer) {
4148
- exitWithError("--offerer is required when not providing --private-key");
4148
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4149
4149
  }
4150
4150
  const readOnlyOptions = parseReadOnlyOptions({
4151
4151
  chainId: options.chainId,
@@ -4205,7 +4205,7 @@ async function executeSubmitListing(options) {
4205
4205
  );
4206
4206
  }
4207
4207
  if (options.encodeOnly) {
4208
- await executeEncodeOnly3(options, orderData);
4208
+ await executeEncodeOnly5(options, orderData);
4209
4209
  return;
4210
4210
  }
4211
4211
  const commonOptions = parseCommonOptions(
@@ -4256,7 +4256,7 @@ async function executeSubmitListing(options) {
4256
4256
  );
4257
4257
  }
4258
4258
  }
4259
- async function executeEncodeOnly3(options, orderData) {
4259
+ async function executeEncodeOnly5(options, orderData) {
4260
4260
  const readOnlyOptions = parseReadOnlyOptions({
4261
4261
  chainId: options.chainId,
4262
4262
  rpcUrl: options.rpcUrl
@@ -4287,7 +4287,7 @@ async function executeSubmitOffer(options) {
4287
4287
  );
4288
4288
  }
4289
4289
  if (options.encodeOnly) {
4290
- await executeEncodeOnly4(options, orderData);
4290
+ await executeEncodeOnly6(options, orderData);
4291
4291
  return;
4292
4292
  }
4293
4293
  const commonOptions = parseCommonOptions(
@@ -4338,7 +4338,7 @@ async function executeSubmitOffer(options) {
4338
4338
  );
4339
4339
  }
4340
4340
  }
4341
- async function executeEncodeOnly4(options, orderData) {
4341
+ async function executeEncodeOnly6(options, orderData) {
4342
4342
  const readOnlyOptions = parseReadOnlyOptions({
4343
4343
  chainId: options.chainId,
4344
4344
  rpcUrl: options.rpcUrl
@@ -4360,7 +4360,7 @@ async function executeEncodeOnly4(options, orderData) {
4360
4360
  }
4361
4361
  async function executeBuyListing(options) {
4362
4362
  if (options.encodeOnly) {
4363
- await executeEncodeOnly5(options);
4363
+ await executeEncodeOnly7(options);
4364
4364
  return;
4365
4365
  }
4366
4366
  const commonOptions = parseCommonOptions(
@@ -4439,7 +4439,7 @@ async function executeBuyListing(options) {
4439
4439
  );
4440
4440
  }
4441
4441
  }
4442
- async function executeEncodeOnly5(options) {
4442
+ async function executeEncodeOnly7(options) {
4443
4443
  if (!options.buyer) {
4444
4444
  exitWithError("--buyer is required when using --encode-only without --private-key");
4445
4445
  }
@@ -4490,7 +4490,7 @@ async function executeEncodeOnly5(options) {
4490
4490
  }
4491
4491
  async function executeAcceptOffer(options) {
4492
4492
  if (options.encodeOnly) {
4493
- await executeEncodeOnly6(options);
4493
+ await executeEncodeOnly8(options);
4494
4494
  return;
4495
4495
  }
4496
4496
  const commonOptions = parseCommonOptions(
@@ -4573,7 +4573,7 @@ async function executeAcceptOffer(options) {
4573
4573
  );
4574
4574
  }
4575
4575
  }
4576
- async function executeEncodeOnly6(options) {
4576
+ async function executeEncodeOnly8(options) {
4577
4577
  if (!options.seller) {
4578
4578
  exitWithError("--seller is required when using --encode-only without --private-key");
4579
4579
  }
@@ -4781,8 +4781,8 @@ ERC-20 Offers (${offers.length}):
4781
4781
  }
4782
4782
  async function executeCreateErc20Listing(options) {
4783
4783
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4784
- if (!hasPrivateKey) {
4785
- await executeKeylessMode3(options);
4784
+ if (!hasPrivateKey || options.encodeOnly) {
4785
+ await executeEncodeOnly9(options);
4786
4786
  return;
4787
4787
  }
4788
4788
  const commonOptions = parseCommonOptions({
@@ -4872,9 +4872,9 @@ async function executeCreateErc20Listing(options) {
4872
4872
  );
4873
4873
  }
4874
4874
  }
4875
- async function executeKeylessMode3(options) {
4875
+ async function executeEncodeOnly9(options) {
4876
4876
  if (!options.offerer) {
4877
- exitWithError("--offerer is required when not providing --private-key");
4877
+ exitWithError("--offerer is required when using --encode-only without --private-key");
4878
4878
  }
4879
4879
  const readOnlyOptions = parseReadOnlyOptions({
4880
4880
  chainId: options.chainId,
@@ -4928,8 +4928,8 @@ function bigintReplacer3(_key, value) {
4928
4928
  }
4929
4929
  async function executeCreateErc20Offer(options) {
4930
4930
  const hasPrivateKey = !!(options.privateKey || process.env.NET_PRIVATE_KEY || process.env.PRIVATE_KEY);
4931
- if (!hasPrivateKey) {
4932
- await executeKeylessMode4(options);
4931
+ if (!hasPrivateKey || options.encodeOnly) {
4932
+ await executeEncodeOnly10(options);
4933
4933
  return;
4934
4934
  }
4935
4935
  const commonOptions = parseCommonOptions({
@@ -5018,9 +5018,9 @@ async function executeCreateErc20Offer(options) {
5018
5018
  );
5019
5019
  }
5020
5020
  }
5021
- async function executeKeylessMode4(options) {
5021
+ async function executeEncodeOnly10(options) {
5022
5022
  if (!options.offerer) {
5023
- exitWithError("--offerer is required when not providing --private-key");
5023
+ exitWithError("--offerer is required when using --encode-only without --private-key");
5024
5024
  }
5025
5025
  const readOnlyOptions = parseReadOnlyOptions({
5026
5026
  chainId: options.chainId,
@@ -5082,7 +5082,7 @@ async function executeSubmitErc20Listing(options) {
5082
5082
  );
5083
5083
  }
5084
5084
  if (options.encodeOnly) {
5085
- await executeEncodeOnly7(options, orderData);
5085
+ await executeEncodeOnly11(options, orderData);
5086
5086
  return;
5087
5087
  }
5088
5088
  const commonOptions = parseCommonOptions(
@@ -5133,7 +5133,7 @@ async function executeSubmitErc20Listing(options) {
5133
5133
  );
5134
5134
  }
5135
5135
  }
5136
- async function executeEncodeOnly7(options, orderData) {
5136
+ async function executeEncodeOnly11(options, orderData) {
5137
5137
  const readOnlyOptions = parseReadOnlyOptions({
5138
5138
  chainId: options.chainId,
5139
5139
  rpcUrl: options.rpcUrl
@@ -5164,7 +5164,7 @@ async function executeSubmitErc20Offer(options) {
5164
5164
  );
5165
5165
  }
5166
5166
  if (options.encodeOnly) {
5167
- await executeEncodeOnly8(options, orderData);
5167
+ await executeEncodeOnly12(options, orderData);
5168
5168
  return;
5169
5169
  }
5170
5170
  const commonOptions = parseCommonOptions(
@@ -5215,7 +5215,7 @@ async function executeSubmitErc20Offer(options) {
5215
5215
  );
5216
5216
  }
5217
5217
  }
5218
- async function executeEncodeOnly8(options, orderData) {
5218
+ async function executeEncodeOnly12(options, orderData) {
5219
5219
  const readOnlyOptions = parseReadOnlyOptions({
5220
5220
  chainId: options.chainId,
5221
5221
  rpcUrl: options.rpcUrl
@@ -5237,7 +5237,7 @@ async function executeEncodeOnly8(options, orderData) {
5237
5237
  }
5238
5238
  async function executeBuyErc20Listing(options) {
5239
5239
  if (options.encodeOnly) {
5240
- await executeEncodeOnly9(options);
5240
+ await executeEncodeOnly13(options);
5241
5241
  return;
5242
5242
  }
5243
5243
  const commonOptions = parseCommonOptions(
@@ -5317,7 +5317,7 @@ async function executeBuyErc20Listing(options) {
5317
5317
  );
5318
5318
  }
5319
5319
  }
5320
- async function executeEncodeOnly9(options) {
5320
+ async function executeEncodeOnly13(options) {
5321
5321
  if (!options.buyer) {
5322
5322
  exitWithError("--buyer is required when using --encode-only without --private-key");
5323
5323
  }
@@ -5368,7 +5368,7 @@ async function executeEncodeOnly9(options) {
5368
5368
  }
5369
5369
  async function executeAcceptErc20Offer(options) {
5370
5370
  if (options.encodeOnly) {
5371
- await executeEncodeOnly10(options);
5371
+ await executeEncodeOnly14(options);
5372
5372
  return;
5373
5373
  }
5374
5374
  const commonOptions = parseCommonOptions(
@@ -5451,7 +5451,7 @@ async function executeAcceptErc20Offer(options) {
5451
5451
  );
5452
5452
  }
5453
5453
  }
5454
- async function executeEncodeOnly10(options) {
5454
+ async function executeEncodeOnly14(options) {
5455
5455
  if (!options.seller) {
5456
5456
  exitWithError("--seller is required when using --encode-only without --private-key");
5457
5457
  }
@@ -5530,7 +5530,7 @@ async function executeTransaction(walletClient, txConfig) {
5530
5530
  // src/commands/bazaar/cancel-listing.ts
5531
5531
  async function executeCancelListing(options) {
5532
5532
  if (options.encodeOnly) {
5533
- await executeEncodeOnly11(options);
5533
+ await executeEncodeOnly15(options);
5534
5534
  return;
5535
5535
  }
5536
5536
  const commonOptions = parseCommonOptions(
@@ -5582,7 +5582,7 @@ async function executeCancelListing(options) {
5582
5582
  );
5583
5583
  }
5584
5584
  }
5585
- async function executeEncodeOnly11(options) {
5585
+ async function executeEncodeOnly15(options) {
5586
5586
  if (!options.maker) {
5587
5587
  exitWithError("--maker is required when using --encode-only without --private-key");
5588
5588
  }
@@ -5619,7 +5619,7 @@ async function executeEncodeOnly11(options) {
5619
5619
  }
5620
5620
  async function executeCancelOffer(options) {
5621
5621
  if (options.encodeOnly) {
5622
- await executeEncodeOnly12(options);
5622
+ await executeEncodeOnly16(options);
5623
5623
  return;
5624
5624
  }
5625
5625
  const commonOptions = parseCommonOptions(
@@ -5671,7 +5671,7 @@ async function executeCancelOffer(options) {
5671
5671
  );
5672
5672
  }
5673
5673
  }
5674
- async function executeEncodeOnly12(options) {
5674
+ async function executeEncodeOnly16(options) {
5675
5675
  if (!options.maker) {
5676
5676
  exitWithError("--maker is required when using --encode-only without --private-key");
5677
5677
  }
@@ -5707,7 +5707,7 @@ async function executeEncodeOnly12(options) {
5707
5707
  }
5708
5708
  async function executeCancelErc20Listing(options) {
5709
5709
  if (options.encodeOnly) {
5710
- await executeEncodeOnly13(options);
5710
+ await executeEncodeOnly17(options);
5711
5711
  return;
5712
5712
  }
5713
5713
  const commonOptions = parseCommonOptions(
@@ -5760,7 +5760,7 @@ async function executeCancelErc20Listing(options) {
5760
5760
  );
5761
5761
  }
5762
5762
  }
5763
- async function executeEncodeOnly13(options) {
5763
+ async function executeEncodeOnly17(options) {
5764
5764
  if (!options.maker) {
5765
5765
  exitWithError("--maker is required when using --encode-only without --private-key");
5766
5766
  }
@@ -5797,7 +5797,7 @@ async function executeEncodeOnly13(options) {
5797
5797
  }
5798
5798
  async function executeCancelErc20Offer(options) {
5799
5799
  if (options.encodeOnly) {
5800
- await executeEncodeOnly14(options);
5800
+ await executeEncodeOnly18(options);
5801
5801
  return;
5802
5802
  }
5803
5803
  const commonOptions = parseCommonOptions(
@@ -5849,7 +5849,7 @@ async function executeCancelErc20Offer(options) {
5849
5849
  );
5850
5850
  }
5851
5851
  }
5852
- async function executeEncodeOnly14(options) {
5852
+ async function executeEncodeOnly18(options) {
5853
5853
  if (!options.maker) {
5854
5854
  exitWithError("--maker is required when using --encode-only without --private-key");
5855
5855
  }
@@ -5924,7 +5924,7 @@ function registerBazaarCommand(program2) {
5924
5924
  json: options.json
5925
5925
  });
5926
5926
  });
5927
- 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) => {
5928
5928
  await executeCreateListing({
5929
5929
  nftAddress: options.nftAddress,
5930
5930
  tokenId: options.tokenId,
@@ -5933,17 +5933,19 @@ function registerBazaarCommand(program2) {
5933
5933
  offerer: options.offerer,
5934
5934
  privateKey: options.privateKey,
5935
5935
  chainId: options.chainId,
5936
- rpcUrl: options.rpcUrl
5936
+ rpcUrl: options.rpcUrl,
5937
+ encodeOnly: options.encodeOnly
5937
5938
  });
5938
5939
  });
5939
- 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) => {
5940
5941
  await executeCreateOffer({
5941
5942
  nftAddress: options.nftAddress,
5942
5943
  price: options.price,
5943
5944
  offerer: options.offerer,
5944
5945
  privateKey: options.privateKey,
5945
5946
  chainId: options.chainId,
5946
- rpcUrl: options.rpcUrl
5947
+ rpcUrl: options.rpcUrl,
5948
+ encodeOnly: options.encodeOnly
5947
5949
  });
5948
5950
  });
5949
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) => {
@@ -6016,7 +6018,7 @@ function registerBazaarCommand(program2) {
6016
6018
  json: options.json
6017
6019
  });
6018
6020
  });
6019
- 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) => {
6020
6022
  await executeCreateErc20Listing({
6021
6023
  tokenAddress: options.tokenAddress,
6022
6024
  tokenAmount: options.tokenAmount,
@@ -6025,10 +6027,11 @@ function registerBazaarCommand(program2) {
6025
6027
  offerer: options.offerer,
6026
6028
  privateKey: options.privateKey,
6027
6029
  chainId: options.chainId,
6028
- rpcUrl: options.rpcUrl
6030
+ rpcUrl: options.rpcUrl,
6031
+ encodeOnly: options.encodeOnly
6029
6032
  });
6030
6033
  });
6031
- 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) => {
6032
6035
  await executeCreateErc20Offer({
6033
6036
  tokenAddress: options.tokenAddress,
6034
6037
  tokenAmount: options.tokenAmount,
@@ -6036,7 +6039,8 @@ function registerBazaarCommand(program2) {
6036
6039
  offerer: options.offerer,
6037
6040
  privateKey: options.privateKey,
6038
6041
  chainId: options.chainId,
6039
- rpcUrl: options.rpcUrl
6042
+ rpcUrl: options.rpcUrl,
6043
+ encodeOnly: options.encodeOnly
6040
6044
  });
6041
6045
  });
6042
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) => {