@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/index.mjs CHANGED
@@ -26474,6 +26474,76 @@ function renderUnixTime(time) {
26474
26474
  function toTxLink(txn, client) {
26475
26475
  return `${client.chain?.blockExplorers?.default.url}/tx/${txn}`;
26476
26476
  }
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
+ }
26477
26547
  export {
26478
26548
  AggregatorInterface_ABI,
26479
26549
  Aip,
@@ -26584,6 +26654,7 @@ export {
26584
26654
  tenderly_sim,
26585
26655
  tenderly_simVnet,
26586
26656
  toTxLink,
26657
+ transformTenderlyStateDiff,
26587
26658
  validateAip,
26588
26659
  wadDiv,
26589
26660
  wadToRay