@bgd-labs/toolbox 0.0.20 → 0.0.21

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/node.mjs CHANGED
@@ -26475,6 +26475,76 @@ function toTxLink(txn, client) {
26475
26475
  return `${client.chain?.blockExplorers?.default.url}/tx/${txn}`;
26476
26476
  }
26477
26477
 
26478
+ // src/seatbelt/state.ts
26479
+ import { getAddress as getAddress2 } from "viem";
26480
+ function transformTenderlyStateDiff(stateDiff) {
26481
+ const formattedDiffs = stateDiff.reduce(
26482
+ (diffs, diff) => {
26483
+ if (!diff.raw?.[0]) return diffs;
26484
+ const addr = getAddress2(diff.raw[0].address);
26485
+ if (!diffs[addr]) diffs[addr] = [diff];
26486
+ else diffs[addr].push(diff);
26487
+ return diffs;
26488
+ },
26489
+ {}
26490
+ );
26491
+ const allChanges = {};
26492
+ for (const [address, diffs] of Object.entries(formattedDiffs)) {
26493
+ const changes = [];
26494
+ for (const diff of diffs) {
26495
+ if (!diff.soltype) {
26496
+ for (const w of diff.raw) {
26497
+ const oldVal = JSON.stringify(w.original);
26498
+ const newVal = JSON.stringify(w.dirty);
26499
+ changes.push({
26500
+ before: oldVal,
26501
+ after: newVal,
26502
+ name: `Slot \`${w.key}\``
26503
+ });
26504
+ }
26505
+ } else if (diff.soltype.simple_type) {
26506
+ changes.push({
26507
+ before: diff.original,
26508
+ after: diff.dirty,
26509
+ name: diff.soltype.name,
26510
+ type: diff.soltype?.name
26511
+ });
26512
+ } else if (diff.soltype.type.startsWith("mapping")) {
26513
+ const keys = Array.from(
26514
+ /* @__PURE__ */ new Set([
26515
+ ...Object.keys(diff.original || {}),
26516
+ ...Object.keys(diff.dirty || {})
26517
+ ])
26518
+ );
26519
+ const original = diff.original || {};
26520
+ const dirty = diff.dirty || {};
26521
+ for (const k of keys) {
26522
+ if (original[k] || dirty[k])
26523
+ changes.push({
26524
+ before: original[k],
26525
+ after: dirty[k],
26526
+ name: k,
26527
+ type: diff.soltype?.name
26528
+ });
26529
+ }
26530
+ } else {
26531
+ for (const w of diff.raw) {
26532
+ const oldVal = JSON.stringify(w.original);
26533
+ const newVal = JSON.stringify(w.dirty);
26534
+ changes.push({
26535
+ before: oldVal,
26536
+ after: newVal,
26537
+ name: w.key,
26538
+ type: "slot"
26539
+ });
26540
+ }
26541
+ }
26542
+ }
26543
+ allChanges[address] = changes;
26544
+ }
26545
+ return allChanges;
26546
+ }
26547
+
26478
26548
  // src/ecosystem/foundry.ts
26479
26549
  import { execSync } from "node:child_process";
26480
26550
  import { createPatch as createPatch2 } from "diff";
@@ -26645,6 +26715,7 @@ export {
26645
26715
  tenderly_sim,
26646
26716
  tenderly_simVnet,
26647
26717
  toTxLink,
26718
+ transformTenderlyStateDiff,
26648
26719
  validateAip,
26649
26720
  wadDiv,
26650
26721
  wadToRay