@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/node.js CHANGED
@@ -33504,7 +33504,10 @@ function deepDiff({
33504
33504
 
33505
33505
  `;
33506
33506
  } else {
33507
- const allKeys = /* @__PURE__ */ new Set([...Object.keys(before), ...Object.keys(after)]);
33507
+ const allKeys = /* @__PURE__ */ new Set([
33508
+ ...Object.keys(before || {}),
33509
+ ...Object.keys(after || {})
33510
+ ]);
33508
33511
  for (const pathKey of allKeys) {
33509
33512
  diff += deepDiff({
33510
33513
  name,
@@ -33695,44 +33698,6 @@ async function renderTenderlyReport({
33695
33698
  config,
33696
33699
  getContractName = (sim2, address) => getMdContractName(sim2.contracts, address)
33697
33700
  }) {
33698
- const events = sim.transaction.transaction_info?.logs ? tenderly_logsToAbiLogs(sim.transaction.transaction_info?.logs) : [];
33699
- events.map((e) => {
33700
- if (!eventCache.find((eC) => JSON.stringify(eC) === JSON.stringify(e))) {
33701
- eventCache.push(e);
33702
- }
33703
- });
33704
- const logs = await enhanceLogs(
33705
- client,
33706
- parseLogs({
33707
- logs: (sim.transaction.transaction_info.logs || []).map(
33708
- (l) => l.raw
33709
- ),
33710
- eventDb: eventCache
33711
- })
33712
- );
33713
- const selfDestruct = await checkForSelfdestruct(
33714
- client,
33715
- sim.transaction.addresses,
33716
- []
33717
- // trusted addresses
33718
- );
33719
- const verified = await getVerificationStatus({
33720
- client,
33721
- addresses: sim.transaction.addresses,
33722
- // 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.
33723
- contractDb: sim.contracts.reduce(
33724
- (acc, val) => {
33725
- acc[val.address] = val.contract_name;
33726
- return acc;
33727
- },
33728
- {}
33729
- ),
33730
- apiKey: config.etherscanApiKey
33731
- });
33732
- const stateDiff = await enhanceStateDiff(
33733
- client,
33734
- transformTenderlyStateDiff(sim.transaction.transaction_info.state_diff)
33735
- );
33736
33701
  let report = `## Payload ${payloadId} on ${client.chain.name}
33737
33702
 
33738
33703
  - creator: ${payload.creator}
@@ -33773,6 +33738,49 @@ ${payload.actions.map(
33773
33738
  }
33774
33739
  }
33775
33740
  report += "\n";
33741
+ if (sim.simulation.status === false) {
33742
+ report += `### :sos: simulation failed: ${sim.transaction.error_message}
33743
+ `;
33744
+ return { report, eventCache };
33745
+ }
33746
+ const events = sim.transaction.transaction_info?.logs ? tenderly_logsToAbiLogs(sim.transaction.transaction_info?.logs) : [];
33747
+ events.map((e) => {
33748
+ if (!eventCache.find((eC) => JSON.stringify(eC) === JSON.stringify(e))) {
33749
+ eventCache.push(e);
33750
+ }
33751
+ });
33752
+ const logs = await enhanceLogs(
33753
+ client,
33754
+ parseLogs({
33755
+ logs: (sim.transaction.transaction_info.logs || []).map(
33756
+ (l) => l.raw
33757
+ ),
33758
+ eventDb: eventCache
33759
+ })
33760
+ );
33761
+ const selfDestruct = await checkForSelfdestruct(
33762
+ client,
33763
+ sim.transaction.addresses,
33764
+ []
33765
+ // trusted addresses
33766
+ );
33767
+ const verified = await getVerificationStatus({
33768
+ client,
33769
+ addresses: sim.transaction.addresses,
33770
+ // 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.
33771
+ contractDb: sim.contracts.reduce(
33772
+ (acc, val) => {
33773
+ acc[val.address] = val.contract_name;
33774
+ return acc;
33775
+ },
33776
+ {}
33777
+ ),
33778
+ apiKey: config.etherscanApiKey
33779
+ });
33780
+ const stateDiff = await enhanceStateDiff(
33781
+ client,
33782
+ transformTenderlyStateDiff(sim.transaction.transaction_info.state_diff)
33783
+ );
33776
33784
  if (verified.find((contract) => contract.status === 2 /* ERROR */)) {
33777
33785
  report += `:sos: Found unverified contracts!
33778
33786