@bgd-labs/toolbox 0.0.36 → 0.0.38

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
@@ -33400,7 +33400,10 @@ function deepDiff({
33400
33400
 
33401
33401
  `;
33402
33402
  } else {
33403
- const allKeys = /* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)]);
33403
+ const allKeys = /* @__PURE__ */ new Set([
33404
+ ...Object.keys(before || {}),
33405
+ ...Object.keys(after || {})
33406
+ ]);
33404
33407
  for (const pathKey of allKeys) {
33405
33408
  diff += deepDiff({
33406
33409
  name,
@@ -33591,44 +33594,6 @@ async function renderTenderlyReport({
33591
33594
  config,
33592
33595
  getContractName = (sim2, address) => getMdContractName(sim2.contracts, address)
33593
33596
  }) {
33594
- const events = sim.transaction.transaction_info?.logs ? tenderly_logsToAbiLogs(sim.transaction.transaction_info?.logs) : [];
33595
- events.map((e) => {
33596
- if (!eventCache.find((eC) => JSON.stringify(eC) === JSON.stringify(e))) {
33597
- eventCache.push(e);
33598
- }
33599
- });
33600
- const logs = await enhanceLogs(
33601
- client,
33602
- parseLogs({
33603
- logs: (sim.transaction.transaction_info.logs || []).map(
33604
- (l) => l.raw
33605
- ),
33606
- eventDb: eventCache
33607
- })
33608
- );
33609
- const selfDestruct = await checkForSelfdestruct(
33610
- client,
33611
- sim.transaction.addresses,
33612
- []
33613
- // trusted addresses
33614
- );
33615
- const verified = await getVerificationStatus({
33616
- client,
33617
- addresses: sim.transaction.addresses,
33618
- // In the future we might want to maintain our own db, so we do not need to rely on tenderly so much for contract name lookup.
33619
- contractDb: sim.contracts.reduce(
33620
- (acc, val) => {
33621
- acc[val.address] = val.contract_name;
33622
- return acc;
33623
- },
33624
- {}
33625
- ),
33626
- apiKey: config.etherscanApiKey
33627
- });
33628
- const stateDiff = await enhanceStateDiff(
33629
- client,
33630
- transformTenderlyStateDiff(sim.transaction.transaction_info.state_diff)
33631
- );
33632
33597
  let report = `## Payload ${payloadId} on ${client.chain.name}
33633
33598
 
33634
33599
  - creator: ${payload.creator}
@@ -33669,6 +33634,49 @@ ${payload.actions.map(
33669
33634
  }
33670
33635
  }
33671
33636
  report += "\n";
33637
+ if (sim.simulation.status === false) {
33638
+ report += `### :sos: simulation failed: ${sim.transaction.error_message}
33639
+ `;
33640
+ return { report, eventCache };
33641
+ }
33642
+ const events = sim.transaction.transaction_info?.logs ? tenderly_logsToAbiLogs(sim.transaction.transaction_info?.logs) : [];
33643
+ events.map((e) => {
33644
+ if (!eventCache.find((eC) => JSON.stringify(eC) === JSON.stringify(e))) {
33645
+ eventCache.push(e);
33646
+ }
33647
+ });
33648
+ const logs = await enhanceLogs(
33649
+ client,
33650
+ parseLogs({
33651
+ logs: (sim.transaction.transaction_info.logs || []).map(
33652
+ (l) => l.raw
33653
+ ),
33654
+ eventDb: eventCache
33655
+ })
33656
+ );
33657
+ const selfDestruct = await checkForSelfdestruct(
33658
+ client,
33659
+ sim.transaction.addresses,
33660
+ []
33661
+ // trusted addresses
33662
+ );
33663
+ const verified = await getVerificationStatus({
33664
+ client,
33665
+ addresses: sim.transaction.addresses,
33666
+ // In the future we might want to maintain our own db, so we do not need to rely on tenderly so much for contract name lookup.
33667
+ contractDb: sim.contracts.reduce(
33668
+ (acc, val) => {
33669
+ acc[val.address] = val.contract_name;
33670
+ return acc;
33671
+ },
33672
+ {}
33673
+ ),
33674
+ apiKey: config.etherscanApiKey
33675
+ });
33676
+ const stateDiff = await enhanceStateDiff(
33677
+ client,
33678
+ transformTenderlyStateDiff(sim.transaction.transaction_info.state_diff)
33679
+ );
33672
33680
  if (verified.find((contract) => contract.status === 2 /* ERROR */)) {
33673
33681
  report += `:sos: Found unverified contracts!
33674
33682