@bgd-labs/toolbox 0.0.24 → 0.0.26

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.
package/dist/index.mjs CHANGED
@@ -14009,6 +14009,72 @@ async function tenderly_sim({ accountSlug, projectSlug, accessToken }, body) {
14009
14009
  );
14010
14010
  return response.json();
14011
14011
  }
14012
+ function unwrapComponents(input) {
14013
+ return input.map((input2) => {
14014
+ if (input2.type === "tuple") {
14015
+ return {
14016
+ name: input2.name,
14017
+ type: input2.type,
14018
+ internalType: input2.type,
14019
+ indexed: input2.indexed,
14020
+ components: unwrapComponents(input2.components)
14021
+ };
14022
+ }
14023
+ return {
14024
+ name: input2.name,
14025
+ type: input2.type,
14026
+ internalType: input2.type,
14027
+ indexed: input2.indexed
14028
+ };
14029
+ });
14030
+ }
14031
+ function unwrapLogInputs(inputs) {
14032
+ return inputs.map((input) => {
14033
+ if (input.soltype?.type === "tuple") {
14034
+ return {
14035
+ name: input.soltype?.name,
14036
+ type: input.soltype?.type,
14037
+ indexed: input.soltype?.indexed,
14038
+ internalType: input.soltype?.type,
14039
+ components: unwrapComponents(input.soltype?.components)
14040
+ };
14041
+ }
14042
+ return {
14043
+ name: input.soltype?.name,
14044
+ type: input.soltype?.type,
14045
+ indexed: input.soltype?.indexed,
14046
+ internalType: input.soltype?.type
14047
+ };
14048
+ });
14049
+ }
14050
+ function tenderly_logsToAbiLogs(logs) {
14051
+ return logs.map((log) => {
14052
+ return {
14053
+ type: "event",
14054
+ name: log.name,
14055
+ ...log.inputs ? { inputs: unwrapLogInputs(log.inputs) } : {}
14056
+ };
14057
+ });
14058
+ }
14059
+
14060
+ // src/ecosystem/tenderly.types.ts
14061
+ var SoltypeType = /* @__PURE__ */ ((SoltypeType2) => {
14062
+ SoltypeType2["Address"] = "address";
14063
+ SoltypeType2["Bool"] = "bool";
14064
+ SoltypeType2["Bytes32"] = "bytes32";
14065
+ SoltypeType2["MappingAddressUint256"] = "mapping (address => uint256)";
14066
+ SoltypeType2["MappingUint256Uint256"] = "mapping (uint256 => uint256)";
14067
+ SoltypeType2["String"] = "string";
14068
+ SoltypeType2["Tuple"] = "tuple";
14069
+ SoltypeType2["TypeAddress"] = "address[]";
14070
+ SoltypeType2["TypeTuple"] = "tuple[]";
14071
+ SoltypeType2["Uint16"] = "uint16";
14072
+ SoltypeType2["Uint256"] = "uint256";
14073
+ SoltypeType2["Uint48"] = "uint48";
14074
+ SoltypeType2["Uint56"] = "uint56";
14075
+ SoltypeType2["Uint8"] = "uint8";
14076
+ return SoltypeType2;
14077
+ })(SoltypeType || {});
14012
14078
 
14013
14079
  // src/ecosystem/event-db.ts
14014
14080
  var EVENT_DB = [];
@@ -28465,7 +28531,7 @@ var hyperRPCSupportedNetworks = [
28465
28531
  ];
28466
28532
 
28467
28533
  // src/operations/diffCode.ts
28468
- import { createPatch, createTwoFilesPatch } from "diff";
28534
+ import { createPatch, createTwoFilesPatch, diffChars } from "diff";
28469
28535
  import { format } from "prettier/standalone";
28470
28536
  import solidityPlugin from "prettier-plugin-solidity/standalone";
28471
28537
  var prettierOptions = { parser: "solidity-parse", plugins: [solidityPlugin] };
@@ -28490,7 +28556,25 @@ async function diffCode(before, after) {
28490
28556
  ])
28491
28557
  );
28492
28558
  for (const [name, path, source] of contractsBefore) {
28493
- const indexAfter = contractsAfter.findIndex(([_name]) => _name === name);
28559
+ const matchingIndexes = contractsAfter.reduce((acc, val, i) => {
28560
+ if (val[0] === name) acc.push(i);
28561
+ return acc;
28562
+ }, []);
28563
+ let indexAfter = -1;
28564
+ if (matchingIndexes.length === 1) {
28565
+ indexAfter = matchingIndexes[0];
28566
+ } else if (matchingIndexes.length > 1) {
28567
+ let maxSimilarity = -1;
28568
+ for (const idx of matchingIndexes) {
28569
+ const afterSource = contractsAfter[idx][2];
28570
+ const diff = diffChars(source, afterSource);
28571
+ const similarity = diff.reduce((acc, part) => acc + (part.added || part.removed ? 0 : part.count || part.value.length), 0);
28572
+ if (similarity > maxSimilarity) {
28573
+ maxSimilarity = similarity;
28574
+ indexAfter = idx;
28575
+ }
28576
+ }
28577
+ }
28494
28578
  if (indexAfter === -1) {
28495
28579
  changes[name] = createPatch(path, source, "");
28496
28580
  } else {
@@ -28669,6 +28753,22 @@ function checkCode(bytecode) {
28669
28753
 
28670
28754
  // src/seatbelt/verified.ts
28671
28755
  import { getCode } from "viem/actions";
28756
+ var VerificationStatus = /* @__PURE__ */ ((VerificationStatus2) => {
28757
+ VerificationStatus2[VerificationStatus2["EOA"] = 0] = "EOA";
28758
+ VerificationStatus2[VerificationStatus2["CONTRACT"] = 1] = "CONTRACT";
28759
+ VerificationStatus2[VerificationStatus2["ERROR"] = 2] = "ERROR";
28760
+ return VerificationStatus2;
28761
+ })(VerificationStatus || {});
28762
+ function verificationStatusToString(status) {
28763
+ switch (status) {
28764
+ case 0 /* EOA */:
28765
+ return "EOA";
28766
+ case 1 /* CONTRACT */:
28767
+ return "Contract";
28768
+ case 2 /* ERROR */:
28769
+ return "Error";
28770
+ }
28771
+ }
28672
28772
  async function getVerificationStatus({
28673
28773
  client,
28674
28774
  addresses,
@@ -28886,6 +28986,8 @@ export {
28886
28986
  RAY,
28887
28987
  SECONDS_PER_YEAR,
28888
28988
  SelfdestuctCheckState,
28989
+ SoltypeType,
28990
+ VerificationStatus,
28889
28991
  WAD,
28890
28992
  WAD_RAY_RATIO,
28891
28993
  aaveAddressesProvider_IncentivesControllerSlot,
@@ -28962,11 +29064,13 @@ export {
28962
29064
  tenderly_createVnet,
28963
29065
  tenderly_deleteVnet,
28964
29066
  tenderly_getVnet,
29067
+ tenderly_logsToAbiLogs,
28965
29068
  tenderly_sim,
28966
29069
  tenderly_simVnet,
28967
29070
  toTxLink,
28968
29071
  transformTenderlyStateDiff,
28969
29072
  validateAip,
29073
+ verificationStatusToString,
28970
29074
  wadDiv,
28971
29075
  wadToRay
28972
29076
  };