@bgd-labs/toolbox 0.0.23 → 0.0.25

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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StandardJsonInput } from './index-DEnxlBVO.mjs';
2
- export { be as AggregatorInterface_ABI, a0 as Aip, aG as BundleParams, aq as ChainId, ar as ChainList, b2 as Change, af as ContractObject, ap as EVENT_DB, a2 as ExplorerConfig, aW as GenericIndexerArgs, X as GovernanceContract, u as HALF_RAY, H as HALF_WAD, I as HUMAN_READABLE_PAYLOAD_STATE, V as HUMAN_READABLE_PROPOSAL_STATE, b6 as IAToken_ABI, bb as IAaveOracle_ABI, bf as IAaveV3ConfigEngine_ABI, bl as IAuthorizedForwarder_ABI, bc as ICollector_ABI, ba as IDualAggregator_ABI, bi as IERC20Metadata_ABI, bk as IERC20_ABI, bg as IEmissionManager_ABI, b8 as IPoolAddressesProvider_ABI, bj as IPoolConfigurator_ABI, bd as IPool_ABI, b4 as IReserveInterestRateStrategy_ABI, bh as IRewardsController_ABI, b5 as IStataTokenFactory_ABI, b9 as IStataTokenV2_ABI, b7 as IWrappedTokenGatewayV3_ABI, aV as IndexerTopicState, ah as Input, L as LTV_PRECISION, P as Payload, G as PayloadState, J as PayloadsControllerContract, T as Proposal, U as ProposalState, t as RAY, R as ReserveConfiguration, e as SECONDS_PER_YEAR, aZ as SelfdestuctCheckState, ac as SoltypeElement, ad as StateDiff, ae as StateObject, as as SupportedChainIds, ak as TenderlyLog, aj as TenderlyLogRaw, ag as TenderlySimRequest, ao as TenderlySimulationResponse, an as TenderlySimulationResponseObject, al as TenderlyStackTrace, a6 as Tenderly_createVnetParamsResponse, ai as Trace, am as TransactionInfo, W as WAD, v as WAD_RAY_RATIO, f as aaveAddressesProvider_IncentivesControllerSlot, aL as alchemyNetworkMap, au as alchemySupportedChainIds, q as assetToBase, b as bitmapToIndexes, aP as blockscoutExplorers, o as calculateAvailableBorrowsMarketReferenceCurrency, h as calculateCompoundedInterest, r as calculateHealthFactor, n as calculateHealthFactorFromBalances, i as calculateLinearInterest, aQ as chainlinkFeeds, a_ as checkForSelfdestruct, a as decodeReserveConfiguration, c as decodeReserveConfigurationV2, d as decodeUserConfiguration, aU as diffCode, aT as erc1967_AdminSlot, aS as erc1967_ImplementationSlot, aN as etherscanExplorers, B as fetchImmutablePoolAddresses, C as fetchMutablePoolAddresses, D as fetchPoolAddresses, aI as flashbotsClientExtension, aH as flashbotsOnFetchRequest, aX as genericIndexer, ax as getAlchemyRPC, g as getBits, aC as getClient, aF as getContractDeploymentBlock, m as getCurrentDebtBalance, l as getCurrentLiquidityBalance, aw as getExplicitRPC, a3 as getExplorer, Y as getGovernance, az as getHyperRPC, aD as getImplementationSlot, aE as getLogsRecursive, p as getMarketReferenceCurrencyAndUsdBalance, av as getNetworkEnv, Q as getNonFinalizedPayloads, $ as getNonFinalizedProposals, k as getNormalizedDebt, j as getNormalizedIncome, M as getPayloadStorageOverrides, K as getPayloadsController, ay as getPublicRpc, aA as getQuicknodeRpc, aB as getRPCUrl, F as getReserveConfigurations, E as getReserveTokens, a4 as getSourceCode, b1 as getVerificationStatus, aR as hyperRPCSupportedNetworks, O as isPayloadFinal, _ as isProposalFinal, N as makePayloadExecutableOnTestClient, Z as makeProposalExecutableOnTestClient, aJ as onMevHandler, a5 as parseEtherscanStyleSourceCode, aY as parseLogs, aK as priceUpdateDecoder, at as publicRPCs, aM as quicknodeNetworkMap, x as rayDiv, w as rayMul, y as rayToWad, a$ as renderTenderlyReport, aO as routescanExplorers, s as setBits, aa as tenderly_createVnet, a7 as tenderly_deleteVnet, a9 as tenderly_getVnet, ab as tenderly_sim, a8 as tenderly_simVnet, b0 as toTxLink, b3 as transformTenderlyStateDiff, a1 as validateAip, A as wadDiv, z as wadToRay } from './index-DEnxlBVO.mjs';
1
+ import { StandardJsonInput } from './index.mjs';
2
+ export { AggregatorInterface_ABI, Aip, BlockscoutStyleSourceCode, BundleParams, ChainId, ChainList, Change, ContractObject, EVENT_DB, EtherscanStyleSourceCode, ExplorerConfig, GenericIndexerArgs, GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, IAToken_ABI, IAaveOracle_ABI, IAaveV3ConfigEngine_ABI, IAuthorizedForwarder_ABI, ICollector_ABI, IDualAggregator_ABI, IERC20Metadata_ABI, IERC20_ABI, IEmissionManager_ABI, IPoolAddressesProvider_ABI, IPoolConfigurator_ABI, IPool_ABI, IReserveInterestRateStrategy_ABI, IRewardsController_ABI, IStataTokenFactory_ABI, IStataTokenV2_ABI, IWrappedTokenGatewayV3_ABI, IndexerTopicState, Input, LTV_PRECISION, Payload, PayloadState, PayloadsControllerContract, Proposal, ProposalState, RAY, ReserveConfiguration, SECONDS_PER_YEAR, SelfdestuctCheckState, SoltypeElement, StateDiff, StateObject, SupportedChainIds, TenderlyLog, TenderlyLogRaw, TenderlySimRequest, TenderlySimulationResponse, TenderlySimulationResponseObject, TenderlyStackTrace, Tenderly_createVnetParamsResponse, Trace, TransactionInfo, WAD, WAD_RAY_RATIO, aaveAddressesProvider_IncentivesControllerSlot, alchemyNetworkMap, alchemySupportedChainIds, assetToBase, bitmapToIndexes, blockscoutExplorers, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactor, calculateHealthFactorFromBalances, calculateLinearInterest, chainlinkFeeds, checkForSelfdestruct, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, erc1967_AdminSlot, erc1967_ImplementationSlot, etherscanExplorers, fetchImmutablePoolAddresses, fetchMutablePoolAddresses, fetchPoolAddresses, flashbotsClientExtension, flashbotsOnFetchRequest, genericIndexer, getAlchemyRPC, getBits, getClient, getContractDeploymentBlock, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplicitRPC, getExplorer, getGovernance, getHyperRPC, getImplementationSlot, getLogsRecursive, getMarketReferenceCurrencyAndUsdBalance, getNetworkEnv, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadStorageOverrides, getPayloadsController, getPublicRpc, getQuicknodeRpc, getRPCUrl, getReserveConfigurations, getReserveTokens, getSourceCode, getVerificationStatus, hyperRPCSupportedNetworks, isPayloadFinal, isProposalFinal, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, onMevHandler, parseBlockscoutStyleSourceCode, parseEtherscanStyleSourceCode, parseLogs, priceUpdateDecoder, publicRPCs, quicknodeNetworkMap, rayDiv, rayMul, rayToWad, renderTenderlyReport, routescanExplorers, setBits, tenderly_createVnet, tenderly_deleteVnet, tenderly_getVnet, tenderly_sim, tenderly_simVnet, toTxLink, transformTenderlyStateDiff, validateAip, wadDiv, wadToRay } from './index.mjs';
3
3
  import 'viem';
4
4
  import '@bgd-labs/aave-address-book/abis';
5
5
  import 'arktype/internal/methods/object.ts';
@@ -43,4 +43,4 @@ declare function foundry_getStorageLayout(input: string): FoundryStorage;
43
43
  declare function foundry_format(input: string): string;
44
44
  declare function diffFoundryStorageLayout(layoutBefore: FoundryStorage, layoutAfter: FoundryStorage): string;
45
45
 
46
- export { type FoundryStorage, type Storage, type StorageType, diffFoundryStorageLayout, foundry_format, foundry_getStandardJsonInput, foundry_getStorageLayout };
46
+ export { type FoundryStorage, StandardJsonInput, type Storage, type StorageType, diffFoundryStorageLayout, foundry_format, foundry_getStandardJsonInput, foundry_getStorageLayout };
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StandardJsonInput } from './index-DEnxlBVO.js';
2
- export { be as AggregatorInterface_ABI, a0 as Aip, aG as BundleParams, aq as ChainId, ar as ChainList, b2 as Change, af as ContractObject, ap as EVENT_DB, a2 as ExplorerConfig, aW as GenericIndexerArgs, X as GovernanceContract, u as HALF_RAY, H as HALF_WAD, I as HUMAN_READABLE_PAYLOAD_STATE, V as HUMAN_READABLE_PROPOSAL_STATE, b6 as IAToken_ABI, bb as IAaveOracle_ABI, bf as IAaveV3ConfigEngine_ABI, bl as IAuthorizedForwarder_ABI, bc as ICollector_ABI, ba as IDualAggregator_ABI, bi as IERC20Metadata_ABI, bk as IERC20_ABI, bg as IEmissionManager_ABI, b8 as IPoolAddressesProvider_ABI, bj as IPoolConfigurator_ABI, bd as IPool_ABI, b4 as IReserveInterestRateStrategy_ABI, bh as IRewardsController_ABI, b5 as IStataTokenFactory_ABI, b9 as IStataTokenV2_ABI, b7 as IWrappedTokenGatewayV3_ABI, aV as IndexerTopicState, ah as Input, L as LTV_PRECISION, P as Payload, G as PayloadState, J as PayloadsControllerContract, T as Proposal, U as ProposalState, t as RAY, R as ReserveConfiguration, e as SECONDS_PER_YEAR, aZ as SelfdestuctCheckState, ac as SoltypeElement, ad as StateDiff, ae as StateObject, as as SupportedChainIds, ak as TenderlyLog, aj as TenderlyLogRaw, ag as TenderlySimRequest, ao as TenderlySimulationResponse, an as TenderlySimulationResponseObject, al as TenderlyStackTrace, a6 as Tenderly_createVnetParamsResponse, ai as Trace, am as TransactionInfo, W as WAD, v as WAD_RAY_RATIO, f as aaveAddressesProvider_IncentivesControllerSlot, aL as alchemyNetworkMap, au as alchemySupportedChainIds, q as assetToBase, b as bitmapToIndexes, aP as blockscoutExplorers, o as calculateAvailableBorrowsMarketReferenceCurrency, h as calculateCompoundedInterest, r as calculateHealthFactor, n as calculateHealthFactorFromBalances, i as calculateLinearInterest, aQ as chainlinkFeeds, a_ as checkForSelfdestruct, a as decodeReserveConfiguration, c as decodeReserveConfigurationV2, d as decodeUserConfiguration, aU as diffCode, aT as erc1967_AdminSlot, aS as erc1967_ImplementationSlot, aN as etherscanExplorers, B as fetchImmutablePoolAddresses, C as fetchMutablePoolAddresses, D as fetchPoolAddresses, aI as flashbotsClientExtension, aH as flashbotsOnFetchRequest, aX as genericIndexer, ax as getAlchemyRPC, g as getBits, aC as getClient, aF as getContractDeploymentBlock, m as getCurrentDebtBalance, l as getCurrentLiquidityBalance, aw as getExplicitRPC, a3 as getExplorer, Y as getGovernance, az as getHyperRPC, aD as getImplementationSlot, aE as getLogsRecursive, p as getMarketReferenceCurrencyAndUsdBalance, av as getNetworkEnv, Q as getNonFinalizedPayloads, $ as getNonFinalizedProposals, k as getNormalizedDebt, j as getNormalizedIncome, M as getPayloadStorageOverrides, K as getPayloadsController, ay as getPublicRpc, aA as getQuicknodeRpc, aB as getRPCUrl, F as getReserveConfigurations, E as getReserveTokens, a4 as getSourceCode, b1 as getVerificationStatus, aR as hyperRPCSupportedNetworks, O as isPayloadFinal, _ as isProposalFinal, N as makePayloadExecutableOnTestClient, Z as makeProposalExecutableOnTestClient, aJ as onMevHandler, a5 as parseEtherscanStyleSourceCode, aY as parseLogs, aK as priceUpdateDecoder, at as publicRPCs, aM as quicknodeNetworkMap, x as rayDiv, w as rayMul, y as rayToWad, a$ as renderTenderlyReport, aO as routescanExplorers, s as setBits, aa as tenderly_createVnet, a7 as tenderly_deleteVnet, a9 as tenderly_getVnet, ab as tenderly_sim, a8 as tenderly_simVnet, b0 as toTxLink, b3 as transformTenderlyStateDiff, a1 as validateAip, A as wadDiv, z as wadToRay } from './index-DEnxlBVO.js';
1
+ import { StandardJsonInput } from './index.js';
2
+ export { AggregatorInterface_ABI, Aip, BlockscoutStyleSourceCode, BundleParams, ChainId, ChainList, Change, ContractObject, EVENT_DB, EtherscanStyleSourceCode, ExplorerConfig, GenericIndexerArgs, GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, IAToken_ABI, IAaveOracle_ABI, IAaveV3ConfigEngine_ABI, IAuthorizedForwarder_ABI, ICollector_ABI, IDualAggregator_ABI, IERC20Metadata_ABI, IERC20_ABI, IEmissionManager_ABI, IPoolAddressesProvider_ABI, IPoolConfigurator_ABI, IPool_ABI, IReserveInterestRateStrategy_ABI, IRewardsController_ABI, IStataTokenFactory_ABI, IStataTokenV2_ABI, IWrappedTokenGatewayV3_ABI, IndexerTopicState, Input, LTV_PRECISION, Payload, PayloadState, PayloadsControllerContract, Proposal, ProposalState, RAY, ReserveConfiguration, SECONDS_PER_YEAR, SelfdestuctCheckState, SoltypeElement, StateDiff, StateObject, SupportedChainIds, TenderlyLog, TenderlyLogRaw, TenderlySimRequest, TenderlySimulationResponse, TenderlySimulationResponseObject, TenderlyStackTrace, Tenderly_createVnetParamsResponse, Trace, TransactionInfo, WAD, WAD_RAY_RATIO, aaveAddressesProvider_IncentivesControllerSlot, alchemyNetworkMap, alchemySupportedChainIds, assetToBase, bitmapToIndexes, blockscoutExplorers, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactor, calculateHealthFactorFromBalances, calculateLinearInterest, chainlinkFeeds, checkForSelfdestruct, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, erc1967_AdminSlot, erc1967_ImplementationSlot, etherscanExplorers, fetchImmutablePoolAddresses, fetchMutablePoolAddresses, fetchPoolAddresses, flashbotsClientExtension, flashbotsOnFetchRequest, genericIndexer, getAlchemyRPC, getBits, getClient, getContractDeploymentBlock, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplicitRPC, getExplorer, getGovernance, getHyperRPC, getImplementationSlot, getLogsRecursive, getMarketReferenceCurrencyAndUsdBalance, getNetworkEnv, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadStorageOverrides, getPayloadsController, getPublicRpc, getQuicknodeRpc, getRPCUrl, getReserveConfigurations, getReserveTokens, getSourceCode, getVerificationStatus, hyperRPCSupportedNetworks, isPayloadFinal, isProposalFinal, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, onMevHandler, parseBlockscoutStyleSourceCode, parseEtherscanStyleSourceCode, parseLogs, priceUpdateDecoder, publicRPCs, quicknodeNetworkMap, rayDiv, rayMul, rayToWad, renderTenderlyReport, routescanExplorers, setBits, tenderly_createVnet, tenderly_deleteVnet, tenderly_getVnet, tenderly_sim, tenderly_simVnet, toTxLink, transformTenderlyStateDiff, validateAip, wadDiv, wadToRay } from './index.js';
3
3
  import 'viem';
4
4
  import '@bgd-labs/aave-address-book/abis';
5
5
  import 'arktype/internal/methods/object.ts';
@@ -43,4 +43,4 @@ declare function foundry_getStorageLayout(input: string): FoundryStorage;
43
43
  declare function foundry_format(input: string): string;
44
44
  declare function diffFoundryStorageLayout(layoutBefore: FoundryStorage, layoutAfter: FoundryStorage): string;
45
45
 
46
- export { type FoundryStorage, type Storage, type StorageType, diffFoundryStorageLayout, foundry_format, foundry_getStandardJsonInput, foundry_getStorageLayout };
46
+ export { type FoundryStorage, StandardJsonInput, type Storage, type StorageType, diffFoundryStorageLayout, foundry_format, foundry_getStandardJsonInput, foundry_getStorageLayout };
package/dist/node.js CHANGED
@@ -127,6 +127,7 @@ __export(node_exports, {
127
127
  makePayloadExecutableOnTestClient: () => makePayloadExecutableOnTestClient,
128
128
  makeProposalExecutableOnTestClient: () => makeProposalExecutableOnTestClient,
129
129
  onMevHandler: () => onMevHandler,
130
+ parseBlockscoutStyleSourceCode: () => parseBlockscoutStyleSourceCode,
130
131
  parseEtherscanStyleSourceCode: () => parseEtherscanStyleSourceCode,
131
132
  parseLogs: () => parseLogs,
132
133
  priceUpdateDecoder: () => priceUpdateDecoder,
@@ -13940,6 +13941,7 @@ async function getSourceCode(params) {
13940
13941
  if (params.apiKey) payload.apikey = params.apiKey;
13941
13942
  const formattedPayload = new URLSearchParams(payload).toString();
13942
13943
  const url = `${params.apiUrl ? params.apiUrl : getExplorer(params.chainId).api}?${formattedPayload}`;
13944
+ console.log(url);
13943
13945
  const request = await fetch(url);
13944
13946
  const { status, message, result } = await request.json();
13945
13947
  if (status != "1") {
@@ -13953,6 +13955,24 @@ function parseEtherscanStyleSourceCode(sourceCode) {
13953
13955
  }
13954
13956
  return JSON.parse(sourceCode);
13955
13957
  }
13958
+ function parseBlockscoutStyleSourceCode(sourceCode) {
13959
+ const result = {
13960
+ language: "unknown",
13961
+ settings: sourceCode.CompilerSettings,
13962
+ libraries: sourceCode.CompilerSettings.libraries,
13963
+ sources: {
13964
+ [sourceCode.FileName]: { content: sourceCode.SourceCode },
13965
+ ...sourceCode.AdditionalSources.reduce(
13966
+ (acc, code) => {
13967
+ acc[code.Filename] = { content: code.SourceCode };
13968
+ return acc;
13969
+ },
13970
+ {}
13971
+ )
13972
+ }
13973
+ };
13974
+ return result;
13975
+ }
13956
13976
 
13957
13977
  // src/ecosystem/tenderly.ts
13958
13978
  var import_viem5 = require("viem");
@@ -28560,7 +28580,25 @@ async function diffCode(before, after) {
28560
28580
  ])
28561
28581
  );
28562
28582
  for (const [name, path, source] of contractsBefore) {
28563
- const indexAfter = contractsAfter.findIndex(([_name]) => _name === name);
28583
+ const matchingIndexes = contractsAfter.reduce((acc, val, i) => {
28584
+ if (val[0] === name) acc.push(i);
28585
+ return acc;
28586
+ }, []);
28587
+ let indexAfter = -1;
28588
+ if (matchingIndexes.length === 1) {
28589
+ indexAfter = matchingIndexes[0];
28590
+ } else if (matchingIndexes.length > 1) {
28591
+ let maxSimilarity = -1;
28592
+ for (const idx of matchingIndexes) {
28593
+ const afterSource = contractsAfter[idx][2];
28594
+ const diff = (0, import_diff.diffChars)(source, afterSource);
28595
+ const similarity = diff.reduce((acc, part) => acc + (part.added || part.removed ? 0 : part.count || part.value.length), 0);
28596
+ if (similarity > maxSimilarity) {
28597
+ maxSimilarity = similarity;
28598
+ indexAfter = idx;
28599
+ }
28600
+ }
28601
+ }
28564
28602
  if (indexAfter === -1) {
28565
28603
  changes[name] = (0, import_diff.createPatch)(path, source, "");
28566
28604
  } else {
@@ -29079,6 +29117,7 @@ function diffFoundryStorageLayout(layoutBefore, layoutAfter) {
29079
29117
  makePayloadExecutableOnTestClient,
29080
29118
  makeProposalExecutableOnTestClient,
29081
29119
  onMevHandler,
29120
+ parseBlockscoutStyleSourceCode,
29082
29121
  parseEtherscanStyleSourceCode,
29083
29122
  parseLogs,
29084
29123
  priceUpdateDecoder,