@bgd-labs/toolbox 0.0.37 → 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
@@ -33694,44 +33694,6 @@ async function renderTenderlyReport({
33694
33694
  config,
33695
33695
  getContractName = (sim2, address) => getMdContractName(sim2.contracts, address)
33696
33696
  }) {
33697
- const events = sim.transaction.transaction_info?.logs ? tenderly_logsToAbiLogs(sim.transaction.transaction_info?.logs) : [];
33698
- events.map((e) => {
33699
- if (!eventCache.find((eC) => JSON.stringify(eC) === JSON.stringify(e))) {
33700
- eventCache.push(e);
33701
- }
33702
- });
33703
- const logs = await enhanceLogs(
33704
- client,
33705
- parseLogs({
33706
- logs: (sim.transaction.transaction_info.logs || []).map(
33707
- (l) => l.raw
33708
- ),
33709
- eventDb: eventCache
33710
- })
33711
- );
33712
- const selfDestruct = await checkForSelfdestruct(
33713
- client,
33714
- sim.transaction.addresses,
33715
- []
33716
- // trusted addresses
33717
- );
33718
- const verified = await getVerificationStatus({
33719
- client,
33720
- addresses: sim.transaction.addresses,
33721
- // 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.
33722
- contractDb: sim.contracts.reduce(
33723
- (acc, val) => {
33724
- acc[val.address] = val.contract_name;
33725
- return acc;
33726
- },
33727
- {}
33728
- ),
33729
- apiKey: config.etherscanApiKey
33730
- });
33731
- const stateDiff = await enhanceStateDiff(
33732
- client,
33733
- transformTenderlyStateDiff(sim.transaction.transaction_info.state_diff)
33734
- );
33735
33697
  let report = `## Payload ${payloadId} on ${client.chain.name}
33736
33698
 
33737
33699
  - creator: ${payload.creator}
@@ -33772,6 +33734,49 @@ ${payload.actions.map(
33772
33734
  }
33773
33735
  }
33774
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
+ );
33775
33780
  if (verified.find((contract) => contract.status === 2 /* ERROR */)) {
33776
33781
  report += `:sos: Found unverified contracts!
33777
33782