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