@net-protocol/cli 0.1.32 → 0.1.34

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.
@@ -2,10 +2,10 @@ import { Command } from 'commander';
2
2
  import chalk3 from 'chalk';
3
3
  import { StorageClient, chunkDataForStorage, CHUNKED_STORAGE_CONTRACT } from '@net-protocol/storage';
4
4
  import { PROFILE_PICTURE_STORAGE_KEY, PROFILE_METADATA_STORAGE_KEY, parseProfileMetadata, PROFILE_CANVAS_STORAGE_KEY, PROFILE_CSS_STORAGE_KEY, isValidUrl, getProfilePictureStorageArgs, STORAGE_CONTRACT, isValidXUsername, getProfileMetadataStorageArgs, isValidBio, isValidDisplayName, isValidTokenAddress, DEMO_THEMES, MAX_CSS_SIZE, isValidCSS, getProfileCSSStorageArgs, buildCSSPrompt } from '@net-protocol/profiles';
5
- import { createWalletClient, http, publicActions, encodeFunctionData } from 'viem';
5
+ import { createWalletClient, http, publicActions, encodeFunctionData, concat } from 'viem';
6
6
  import { privateKeyToAccount } from 'viem/accounts';
7
7
  import { base } from 'viem/chains';
8
- import { getChainRpcUrls, toBytes32 } from '@net-protocol/core';
8
+ import { getChainRpcUrls, getBaseDataSuffix, toBytes32 } from '@net-protocol/core';
9
9
  import * as fs from 'fs';
10
10
  import * as path from 'path';
11
11
 
@@ -199,9 +199,11 @@ function encodeTransaction(config, chainId) {
199
199
  functionName: config.functionName,
200
200
  args: config.args
201
201
  });
202
+ const suffix = getBaseDataSuffix(chainId);
203
+ const data = suffix ? concat([calldata, suffix]) : calldata;
202
204
  return {
203
205
  to: config.to,
204
- data: calldata,
206
+ data,
205
207
  chainId,
206
208
  value: config.value?.toString() ?? "0"
207
209
  };
@@ -251,7 +253,8 @@ async function executeProfileSetPicture(options) {
251
253
  account,
252
254
  chain: base,
253
255
  // TODO: Support other chains
254
- transport: http(rpcUrls[0])
256
+ transport: http(rpcUrls[0]),
257
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
255
258
  }).extend(publicActions);
256
259
  console.log(chalk3.blue(`\u{1F4F7} Setting profile picture...`));
257
260
  console.log(chalk3.gray(` URL: ${options.url}`));
@@ -365,7 +368,8 @@ async function executeProfileSetUsername(options) {
365
368
  account,
366
369
  chain: base,
367
370
  // TODO: Support other chains
368
- transport: http(rpcUrls[0])
371
+ transport: http(rpcUrls[0]),
372
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
369
373
  }).extend(publicActions);
370
374
  console.log(chalk3.blue(`Setting X username...`));
371
375
  console.log(chalk3.gray(` Username: ${displayUsername}`));
@@ -466,7 +470,8 @@ async function executeProfileSetBio(options) {
466
470
  account,
467
471
  chain: base,
468
472
  // TODO: Support other chains
469
- transport: http(rpcUrls[0])
473
+ transport: http(rpcUrls[0]),
474
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
470
475
  }).extend(publicActions);
471
476
  console.log(chalk3.blue(`Setting profile bio...`));
472
477
  console.log(chalk3.gray(` Bio: ${options.bio}`));
@@ -567,7 +572,8 @@ async function executeProfileSetDisplayName(options) {
567
572
  account,
568
573
  chain: base,
569
574
  // TODO: Support other chains
570
- transport: http(rpcUrls[0])
575
+ transport: http(rpcUrls[0]),
576
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
571
577
  }).extend(publicActions);
572
578
  console.log(chalk3.blue(`Setting display name...`));
573
579
  console.log(chalk3.gray(` Name: ${options.name}`));
@@ -669,7 +675,8 @@ async function executeProfileSetTokenAddress(options) {
669
675
  account,
670
676
  chain: base,
671
677
  // TODO: Support other chains
672
- transport: http(rpcUrls[0])
678
+ transport: http(rpcUrls[0]),
679
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
673
680
  }).extend(publicActions);
674
681
  console.log(chalk3.blue(`Setting profile token address...`));
675
682
  console.log(chalk3.gray(` Token Address: ${normalizedAddress}`));
@@ -822,7 +829,8 @@ async function executeProfileSetCanvas(options) {
822
829
  account,
823
830
  chain: base,
824
831
  // TODO: Support other chains
825
- transport: http(rpcUrls[0])
832
+ transport: http(rpcUrls[0]),
833
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
826
834
  }).extend(publicActions);
827
835
  console.log(chalk3.blue(`Setting profile canvas...`));
828
836
  console.log(
@@ -1046,7 +1054,8 @@ ${available}`
1046
1054
  const client = createWalletClient({
1047
1055
  account,
1048
1056
  chain: base,
1049
- transport: http(rpcUrls[0])
1057
+ transport: http(rpcUrls[0]),
1058
+ dataSuffix: getBaseDataSuffix(commonOptions.chainId)
1050
1059
  }).extend(publicActions);
1051
1060
  console.log(chalk3.blue(`Setting profile CSS...`));
1052
1061
  console.log(