@bgd-labs/toolbox 0.0.3 → 0.0.5
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 +190 -19
- package/dist/index.d.ts +190 -19
- package/dist/index.js +701 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +710 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IPayloadsControllerCore_ABI, IGovernanceCore_ABI } from '@bgd-labs/aave-address-book/abis';
|
|
2
|
-
import
|
|
2
|
+
import * as viem from 'viem';
|
|
3
|
+
import { GetContractReturnType, Client, Hex, TestClient, Address, WalletClient, HttpTransportConfig, ClientConfig, Abi } from 'viem';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* In solidity it is a quite common practice to encode bit variables in bitmaps opposed to bool structs.
|
|
@@ -170,6 +171,7 @@ declare const HUMAN_READABLE_PAYLOAD_STATE: {
|
|
|
170
171
|
type PayloadsControllerContract = GetContractReturnType<typeof IPayloadsControllerCore_ABI, Client>;
|
|
171
172
|
declare function getPayloadsController<T extends Client>(client: T, address: Hex): PayloadsControllerContract;
|
|
172
173
|
declare function makePayloadExecutableOnTestClient(client: TestClient, payloadsController: Address, payloadId: number): Promise<void>;
|
|
174
|
+
declare function isPayloadFinal(state: PayloadState): boolean;
|
|
173
175
|
declare function getNonFinalizedPayloads<T extends Client>(client: T, payloadsController: Address): Promise<number[]>;
|
|
174
176
|
|
|
175
177
|
declare enum ProposalState {
|
|
@@ -195,8 +197,24 @@ declare const HUMAN_READABLE_PROPOSAL_STATE: {
|
|
|
195
197
|
type GovernanceContract = GetContractReturnType<typeof IGovernanceCore_ABI, Client>;
|
|
196
198
|
declare function getGovernance<T extends Client>(client: T, address: Hex): GovernanceContract;
|
|
197
199
|
declare function makeProposalExecutableOnTestClient(client: TestClient, governance: Address, proposalId: bigint): Promise<void>;
|
|
200
|
+
declare function isProposalFinal(state: ProposalState): boolean;
|
|
198
201
|
declare function getNonFinalizedProposals<T extends Client>(client: T, governanceAddress: Address): Promise<bigint[]>;
|
|
199
202
|
|
|
203
|
+
type StandardJsonInput = {
|
|
204
|
+
language: string;
|
|
205
|
+
libraries: any;
|
|
206
|
+
settings: {
|
|
207
|
+
evmVersion: string;
|
|
208
|
+
optimizer: {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
runs: number;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
sources: Record<string, {
|
|
214
|
+
content: string;
|
|
215
|
+
}>;
|
|
216
|
+
};
|
|
217
|
+
|
|
200
218
|
type ExplorerConfig = {
|
|
201
219
|
api: string;
|
|
202
220
|
explorer: string;
|
|
@@ -231,20 +249,7 @@ declare function getSourceCode(params: GetSourceCodeParams): Promise<{
|
|
|
231
249
|
SimilarMatch: string;
|
|
232
250
|
SourceCode: string;
|
|
233
251
|
}>;
|
|
234
|
-
declare function parseEtherscanStyleSourceCode(sourceCode: string):
|
|
235
|
-
language: string;
|
|
236
|
-
libraries: any;
|
|
237
|
-
settings: {
|
|
238
|
-
evmVersion: string;
|
|
239
|
-
optimizer: {
|
|
240
|
-
enabled: boolean;
|
|
241
|
-
runs: number;
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
sources: Record<string, {
|
|
245
|
-
content: string;
|
|
246
|
-
}>;
|
|
247
|
-
};
|
|
252
|
+
declare function parseEtherscanStyleSourceCode(sourceCode: string): StandardJsonInput;
|
|
248
253
|
|
|
249
254
|
/**
|
|
250
255
|
* While tenderly is a fenomanal tool for testing, it is not always easy to use as there are minor bugs and small nuances to consider everywhere.
|
|
@@ -262,6 +267,7 @@ type Tenderly_createVnetParams = {
|
|
|
262
267
|
baseChainId: number;
|
|
263
268
|
forkChainId: number;
|
|
264
269
|
blockNumber?: Hex;
|
|
270
|
+
force?: boolean;
|
|
265
271
|
};
|
|
266
272
|
type Tenderly_createVnetParamsResponse = {
|
|
267
273
|
id: string;
|
|
@@ -290,17 +296,182 @@ type Tenderly_createVnetParamsResponse = {
|
|
|
290
296
|
}
|
|
291
297
|
];
|
|
292
298
|
};
|
|
293
|
-
declare function
|
|
299
|
+
declare function tenderly_deleteVnet(vnetId: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig): Promise<Response>;
|
|
300
|
+
declare function tenderly_simVnet(vnetId: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig, body: any): Promise<any>;
|
|
301
|
+
declare function tenderly_getVnet(slug: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig): Promise<{
|
|
302
|
+
id: string;
|
|
303
|
+
slug: string;
|
|
304
|
+
}[]>;
|
|
305
|
+
declare function tenderly_createVnet({ slug, displayName, baseChainId, forkChainId, blockNumber, force, }: Tenderly_createVnetParams, { accessToken, accountSlug, projectSlug }: TenderlyConfig): Promise<{
|
|
294
306
|
vnet: Tenderly_createVnetParamsResponse;
|
|
295
307
|
testClient: TestClient;
|
|
296
308
|
walletClient: WalletClient;
|
|
297
|
-
simulate: (body: any) => Promise<
|
|
309
|
+
simulate: (body: any) => Promise<any>;
|
|
298
310
|
delete: () => Promise<Response>;
|
|
299
311
|
}>;
|
|
300
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Returns the standardJsonInput format as consumed by most explorers
|
|
315
|
+
* @param input Contract or path:Contract if contract is not unique.
|
|
316
|
+
*/
|
|
317
|
+
declare function foundry_getStandardJsonInput(input: string): StandardJsonInput;
|
|
318
|
+
type Storage = {
|
|
319
|
+
astId: string;
|
|
320
|
+
contract: string;
|
|
321
|
+
label: string;
|
|
322
|
+
offset: number;
|
|
323
|
+
slot: number;
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
type StorageType = {
|
|
327
|
+
encoding: string;
|
|
328
|
+
label: string;
|
|
329
|
+
numberOfBytes: number;
|
|
330
|
+
base?: string;
|
|
331
|
+
key?: string;
|
|
332
|
+
value?: string;
|
|
333
|
+
members?: {
|
|
334
|
+
astId: string;
|
|
335
|
+
contract: string;
|
|
336
|
+
offset: number;
|
|
337
|
+
slot: number;
|
|
338
|
+
type: string;
|
|
339
|
+
label: string;
|
|
340
|
+
}[];
|
|
341
|
+
};
|
|
342
|
+
type FoundryStorage = {
|
|
343
|
+
storage: Storage[];
|
|
344
|
+
types: Record<string, StorageType>;
|
|
345
|
+
};
|
|
346
|
+
declare function foundry_getStorageLayout(input: string): FoundryStorage;
|
|
347
|
+
declare function diffFoundryStorageLayout(layoutBefore: FoundryStorage, layoutAfter: FoundryStorage): string;
|
|
348
|
+
|
|
349
|
+
declare const EVENT_DB: readonly [];
|
|
350
|
+
|
|
351
|
+
declare const ChainId: {
|
|
352
|
+
readonly celo: 42220;
|
|
353
|
+
readonly mainnet: 1;
|
|
354
|
+
readonly polygon: 137;
|
|
355
|
+
readonly polygon_amoy: 80002;
|
|
356
|
+
readonly avalanche: 43114;
|
|
357
|
+
readonly avalanche_fuji: 43113;
|
|
358
|
+
readonly arbitrum: 42161;
|
|
359
|
+
readonly arbitrum_sepolia: 421614;
|
|
360
|
+
readonly fantom: 250;
|
|
361
|
+
readonly fantom_testnet: 4002;
|
|
362
|
+
readonly optimism: 10;
|
|
363
|
+
readonly optimism_sepolia: 11155420;
|
|
364
|
+
readonly harmony: 1666600000;
|
|
365
|
+
readonly sepolia: 11155111;
|
|
366
|
+
readonly scroll: 534352;
|
|
367
|
+
readonly scroll_sepolia: 534351;
|
|
368
|
+
readonly sonic: 146;
|
|
369
|
+
readonly mantle: 5000;
|
|
370
|
+
readonly metis: 1088;
|
|
371
|
+
readonly base: 8453;
|
|
372
|
+
readonly base_sepolia: 84532;
|
|
373
|
+
readonly bnb: 56;
|
|
374
|
+
readonly gnosis: 100;
|
|
375
|
+
readonly zkEVM: 1101;
|
|
376
|
+
readonly zksync: 324;
|
|
377
|
+
readonly linea: 59144;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type SupportedChainIds = (typeof ChainId)[keyof typeof ChainId];
|
|
381
|
+
/**
|
|
382
|
+
* A manually maintained list of public rpcs.
|
|
383
|
+
* These should only be used for prs coming from forks, which should not access secrets like the alchemy api key.
|
|
384
|
+
*/
|
|
385
|
+
declare const publicRPCs: {
|
|
386
|
+
readonly 1: "https://eth.llamarpc.com";
|
|
387
|
+
readonly 137: "https://polygon.llamarpc.com";
|
|
388
|
+
readonly 42161: "https://polygon.llamarpc.com";
|
|
389
|
+
readonly 8453: "https://base.llamarpc.com";
|
|
390
|
+
readonly 56: "https://binance.llamarpc.com";
|
|
391
|
+
readonly 1088: "https://andromeda.metis.io/?owner=1088";
|
|
392
|
+
readonly 100: "https://rpc.ankr.com/gnosis";
|
|
393
|
+
readonly 534352: "https://rpc.scroll.io";
|
|
394
|
+
readonly 324: "https://mainnet.era.zksync.io";
|
|
395
|
+
readonly 250: "https://rpc.ftm.tools";
|
|
396
|
+
readonly 43114: "https://api.avax.network/ext/bc/C/rpc";
|
|
397
|
+
readonly 59144: "https://rpc.linea.build";
|
|
398
|
+
};
|
|
399
|
+
declare const alchemySupportedChainIds: (1 | 10 | 56 | 100 | 137 | 146 | 250 | 324 | 1101 | 4002 | 5000 | 8453 | 42161 | 42220 | 43113 | 43114 | 59144 | 80002 | 84532 | 421614 | 534351 | 534352 | 11155111 | 11155420 | 1088 | 1666600000)[];
|
|
400
|
+
declare const getNetworkEnv: (chainId: SupportedChainIds) => "RPC_MAINNET" | "RPC_OPTIMISM" | "RPC_FANTOM" | "RPC_CELO" | "RPC_POLYGON" | "RPC_POLYGON_AMOY" | "RPC_AVALANCHE" | "RPC_AVALANCHE_FUJI" | "RPC_ARBITRUM" | "RPC_ARBITRUM_SEPOLIA" | "RPC_FANTOM_TESTNET" | "RPC_OPTIMISM_SEPOLIA" | "RPC_HARMONY" | "RPC_SEPOLIA" | "RPC_SCROLL" | "RPC_SCROLL_SEPOLIA" | "RPC_SONIC" | "RPC_MANTLE" | "RPC_METIS" | "RPC_BASE" | "RPC_BASE_SEPOLIA" | "RPC_BNB" | "RPC_GNOSIS" | "RPC_ZKEVM" | "RPC_ZKSYNC" | "RPC_LINEA";
|
|
401
|
+
declare function getExplicitRPC(chainId: SupportedChainIds): string;
|
|
402
|
+
declare function getAlchemyRPC(chainId: SupportedChainIds, alchemyKey: string): string;
|
|
403
|
+
declare function getPublicRpc(chainId: SupportedChainIds): "https://eth.llamarpc.com" | "https://polygon.llamarpc.com" | "https://base.llamarpc.com" | "https://binance.llamarpc.com" | "https://andromeda.metis.io/?owner=1088" | "https://rpc.ankr.com/gnosis" | "https://rpc.scroll.io" | "https://mainnet.era.zksync.io" | "https://rpc.ftm.tools" | "https://api.avax.network/ext/bc/C/rpc" | "https://rpc.linea.build";
|
|
404
|
+
declare function getQuickNodeRpc(chainId: SupportedChainIds, options: {
|
|
405
|
+
quicknodeEndpointName: string;
|
|
406
|
+
quicknodeToken: string;
|
|
407
|
+
}): string;
|
|
408
|
+
type GetRPCUrlOptions = {
|
|
409
|
+
alchemyKey?: string;
|
|
410
|
+
quicknodeEndpointName?: string;
|
|
411
|
+
quicknodeToken?: string;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Return a RPC_URL for supported chains.
|
|
415
|
+
* If the RPC_URL environment variable is set, it will be used.
|
|
416
|
+
* Otherwise will construct the URL based on the chain ID and Alchemy API key.
|
|
417
|
+
*
|
|
418
|
+
* @notice This method acts as fall-through and will only revert if the ChainId is strictly not supported.
|
|
419
|
+
* If no RPC_URL is set, and non of the private rpc providers supports the chain, it will return undefined.
|
|
420
|
+
* @param chainId
|
|
421
|
+
* @param alchemyKey
|
|
422
|
+
* @returns the RPC_URL for the given chain ID
|
|
423
|
+
*/
|
|
424
|
+
declare const getRPCUrl: (chainId: SupportedChainIds, options?: GetRPCUrlOptions) => string | undefined;
|
|
425
|
+
/**
|
|
426
|
+
* Returns a viem client for the given chain with the supplied config.
|
|
427
|
+
* @param chainId
|
|
428
|
+
* @param param1
|
|
429
|
+
* @returns A viem Client
|
|
430
|
+
*/
|
|
431
|
+
declare function getClient(chainId: number, { httpConfig, clientConfig, providerConfig, forceRebuildClient, }: {
|
|
432
|
+
httpConfig?: Partial<HttpTransportConfig>;
|
|
433
|
+
clientConfig?: Partial<ClientConfig>;
|
|
434
|
+
providerConfig: GetRPCUrlOptions;
|
|
435
|
+
forceRebuildClient?: boolean;
|
|
436
|
+
}): Client;
|
|
437
|
+
|
|
301
438
|
declare const erc1967_ImplementationSlot = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
|
|
302
439
|
declare const erc1967_AdminSlot = "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
|
|
303
440
|
|
|
304
|
-
declare function diffCode(
|
|
441
|
+
declare function diffCode(before: StandardJsonInput, after: StandardJsonInput): Promise<Record<string, string>>;
|
|
442
|
+
|
|
443
|
+
type LogType = {
|
|
444
|
+
topics: [Hex];
|
|
445
|
+
data: Hex;
|
|
446
|
+
emitter: Address;
|
|
447
|
+
};
|
|
448
|
+
interface ParseLogsArgs {
|
|
449
|
+
logs: LogType[];
|
|
450
|
+
eventDb: Abi;
|
|
451
|
+
}
|
|
452
|
+
declare function parseLogs({ logs, eventDb }: ParseLogsArgs): LogType[];
|
|
453
|
+
|
|
454
|
+
declare enum SelfdestuctCheckState {
|
|
455
|
+
TRUSTED = 0,
|
|
456
|
+
EOA = 1,
|
|
457
|
+
EMPTY = 2,
|
|
458
|
+
DELEGATECALL = 3,
|
|
459
|
+
SAFE = 4,
|
|
460
|
+
SELF_DESTRUCT = 5
|
|
461
|
+
}
|
|
462
|
+
declare function checkForSelfdestruct(client: Client, addresses: Address[], trustedAddresses: Address[]): Promise<{
|
|
463
|
+
address: Address;
|
|
464
|
+
state: SelfdestuctCheckState;
|
|
465
|
+
}[]>;
|
|
466
|
+
|
|
467
|
+
type RenderTenderlyReportParams = {
|
|
468
|
+
client: Client;
|
|
469
|
+
sim: any;
|
|
470
|
+
};
|
|
471
|
+
declare function renderTenderlyReport({ client, sim, }: RenderTenderlyReportParams): Promise<{
|
|
472
|
+
topics: [viem.Hex];
|
|
473
|
+
data: viem.Hex;
|
|
474
|
+
emitter: viem.Address;
|
|
475
|
+
}[]>;
|
|
305
476
|
|
|
306
|
-
export { type ExplorerConfig, type GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, LTV_PRECISION, PayloadState, type PayloadsControllerContract, ProposalState, RAY, type ReserveConfiguration, SECONDS_PER_YEAR, type Tenderly_createVnetParamsResponse, WAD, WAD_RAY_RATIO, bitmapToIndexes, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactorFromBalances, calculateLinearInterest, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, erc1967_AdminSlot, erc1967_ImplementationSlot, getBits, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplorer, getGovernance, getMarketReferenceCurrencyAndUsdBalance, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadsController, getSourceCode, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, parseEtherscanStyleSourceCode, rayDiv, rayMul, rayToWad, setBits, tenderly_createVnet, wadDiv, wadToRay };
|
|
477
|
+
export { EVENT_DB, type ExplorerConfig, type FoundryStorage, type GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, LTV_PRECISION, PayloadState, type PayloadsControllerContract, ProposalState, RAY, type ReserveConfiguration, SECONDS_PER_YEAR, SelfdestuctCheckState, type Storage, type StorageType, type Tenderly_createVnetParamsResponse, WAD, WAD_RAY_RATIO, alchemySupportedChainIds, bitmapToIndexes, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactorFromBalances, calculateLinearInterest, checkForSelfdestruct, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, diffFoundryStorageLayout, erc1967_AdminSlot, erc1967_ImplementationSlot, foundry_getStandardJsonInput, foundry_getStorageLayout, getAlchemyRPC, getBits, getClient, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplicitRPC, getExplorer, getGovernance, getMarketReferenceCurrencyAndUsdBalance, getNetworkEnv, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadsController, getPublicRpc, getQuickNodeRpc, getRPCUrl, getSourceCode, isPayloadFinal, isProposalFinal, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, parseEtherscanStyleSourceCode, parseLogs, publicRPCs, rayDiv, rayMul, rayToWad, renderTenderlyReport, setBits, tenderly_createVnet, tenderly_deleteVnet, tenderly_getVnet, tenderly_simVnet, wadDiv, wadToRay };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IPayloadsControllerCore_ABI, IGovernanceCore_ABI } from '@bgd-labs/aave-address-book/abis';
|
|
2
|
-
import
|
|
2
|
+
import * as viem from 'viem';
|
|
3
|
+
import { GetContractReturnType, Client, Hex, TestClient, Address, WalletClient, HttpTransportConfig, ClientConfig, Abi } from 'viem';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* In solidity it is a quite common practice to encode bit variables in bitmaps opposed to bool structs.
|
|
@@ -170,6 +171,7 @@ declare const HUMAN_READABLE_PAYLOAD_STATE: {
|
|
|
170
171
|
type PayloadsControllerContract = GetContractReturnType<typeof IPayloadsControllerCore_ABI, Client>;
|
|
171
172
|
declare function getPayloadsController<T extends Client>(client: T, address: Hex): PayloadsControllerContract;
|
|
172
173
|
declare function makePayloadExecutableOnTestClient(client: TestClient, payloadsController: Address, payloadId: number): Promise<void>;
|
|
174
|
+
declare function isPayloadFinal(state: PayloadState): boolean;
|
|
173
175
|
declare function getNonFinalizedPayloads<T extends Client>(client: T, payloadsController: Address): Promise<number[]>;
|
|
174
176
|
|
|
175
177
|
declare enum ProposalState {
|
|
@@ -195,8 +197,24 @@ declare const HUMAN_READABLE_PROPOSAL_STATE: {
|
|
|
195
197
|
type GovernanceContract = GetContractReturnType<typeof IGovernanceCore_ABI, Client>;
|
|
196
198
|
declare function getGovernance<T extends Client>(client: T, address: Hex): GovernanceContract;
|
|
197
199
|
declare function makeProposalExecutableOnTestClient(client: TestClient, governance: Address, proposalId: bigint): Promise<void>;
|
|
200
|
+
declare function isProposalFinal(state: ProposalState): boolean;
|
|
198
201
|
declare function getNonFinalizedProposals<T extends Client>(client: T, governanceAddress: Address): Promise<bigint[]>;
|
|
199
202
|
|
|
203
|
+
type StandardJsonInput = {
|
|
204
|
+
language: string;
|
|
205
|
+
libraries: any;
|
|
206
|
+
settings: {
|
|
207
|
+
evmVersion: string;
|
|
208
|
+
optimizer: {
|
|
209
|
+
enabled: boolean;
|
|
210
|
+
runs: number;
|
|
211
|
+
};
|
|
212
|
+
};
|
|
213
|
+
sources: Record<string, {
|
|
214
|
+
content: string;
|
|
215
|
+
}>;
|
|
216
|
+
};
|
|
217
|
+
|
|
200
218
|
type ExplorerConfig = {
|
|
201
219
|
api: string;
|
|
202
220
|
explorer: string;
|
|
@@ -231,20 +249,7 @@ declare function getSourceCode(params: GetSourceCodeParams): Promise<{
|
|
|
231
249
|
SimilarMatch: string;
|
|
232
250
|
SourceCode: string;
|
|
233
251
|
}>;
|
|
234
|
-
declare function parseEtherscanStyleSourceCode(sourceCode: string):
|
|
235
|
-
language: string;
|
|
236
|
-
libraries: any;
|
|
237
|
-
settings: {
|
|
238
|
-
evmVersion: string;
|
|
239
|
-
optimizer: {
|
|
240
|
-
enabled: boolean;
|
|
241
|
-
runs: number;
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
sources: Record<string, {
|
|
245
|
-
content: string;
|
|
246
|
-
}>;
|
|
247
|
-
};
|
|
252
|
+
declare function parseEtherscanStyleSourceCode(sourceCode: string): StandardJsonInput;
|
|
248
253
|
|
|
249
254
|
/**
|
|
250
255
|
* While tenderly is a fenomanal tool for testing, it is not always easy to use as there are minor bugs and small nuances to consider everywhere.
|
|
@@ -262,6 +267,7 @@ type Tenderly_createVnetParams = {
|
|
|
262
267
|
baseChainId: number;
|
|
263
268
|
forkChainId: number;
|
|
264
269
|
blockNumber?: Hex;
|
|
270
|
+
force?: boolean;
|
|
265
271
|
};
|
|
266
272
|
type Tenderly_createVnetParamsResponse = {
|
|
267
273
|
id: string;
|
|
@@ -290,17 +296,182 @@ type Tenderly_createVnetParamsResponse = {
|
|
|
290
296
|
}
|
|
291
297
|
];
|
|
292
298
|
};
|
|
293
|
-
declare function
|
|
299
|
+
declare function tenderly_deleteVnet(vnetId: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig): Promise<Response>;
|
|
300
|
+
declare function tenderly_simVnet(vnetId: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig, body: any): Promise<any>;
|
|
301
|
+
declare function tenderly_getVnet(slug: string, { accountSlug, projectSlug, accessToken }: TenderlyConfig): Promise<{
|
|
302
|
+
id: string;
|
|
303
|
+
slug: string;
|
|
304
|
+
}[]>;
|
|
305
|
+
declare function tenderly_createVnet({ slug, displayName, baseChainId, forkChainId, blockNumber, force, }: Tenderly_createVnetParams, { accessToken, accountSlug, projectSlug }: TenderlyConfig): Promise<{
|
|
294
306
|
vnet: Tenderly_createVnetParamsResponse;
|
|
295
307
|
testClient: TestClient;
|
|
296
308
|
walletClient: WalletClient;
|
|
297
|
-
simulate: (body: any) => Promise<
|
|
309
|
+
simulate: (body: any) => Promise<any>;
|
|
298
310
|
delete: () => Promise<Response>;
|
|
299
311
|
}>;
|
|
300
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Returns the standardJsonInput format as consumed by most explorers
|
|
315
|
+
* @param input Contract or path:Contract if contract is not unique.
|
|
316
|
+
*/
|
|
317
|
+
declare function foundry_getStandardJsonInput(input: string): StandardJsonInput;
|
|
318
|
+
type Storage = {
|
|
319
|
+
astId: string;
|
|
320
|
+
contract: string;
|
|
321
|
+
label: string;
|
|
322
|
+
offset: number;
|
|
323
|
+
slot: number;
|
|
324
|
+
type: string;
|
|
325
|
+
};
|
|
326
|
+
type StorageType = {
|
|
327
|
+
encoding: string;
|
|
328
|
+
label: string;
|
|
329
|
+
numberOfBytes: number;
|
|
330
|
+
base?: string;
|
|
331
|
+
key?: string;
|
|
332
|
+
value?: string;
|
|
333
|
+
members?: {
|
|
334
|
+
astId: string;
|
|
335
|
+
contract: string;
|
|
336
|
+
offset: number;
|
|
337
|
+
slot: number;
|
|
338
|
+
type: string;
|
|
339
|
+
label: string;
|
|
340
|
+
}[];
|
|
341
|
+
};
|
|
342
|
+
type FoundryStorage = {
|
|
343
|
+
storage: Storage[];
|
|
344
|
+
types: Record<string, StorageType>;
|
|
345
|
+
};
|
|
346
|
+
declare function foundry_getStorageLayout(input: string): FoundryStorage;
|
|
347
|
+
declare function diffFoundryStorageLayout(layoutBefore: FoundryStorage, layoutAfter: FoundryStorage): string;
|
|
348
|
+
|
|
349
|
+
declare const EVENT_DB: readonly [];
|
|
350
|
+
|
|
351
|
+
declare const ChainId: {
|
|
352
|
+
readonly celo: 42220;
|
|
353
|
+
readonly mainnet: 1;
|
|
354
|
+
readonly polygon: 137;
|
|
355
|
+
readonly polygon_amoy: 80002;
|
|
356
|
+
readonly avalanche: 43114;
|
|
357
|
+
readonly avalanche_fuji: 43113;
|
|
358
|
+
readonly arbitrum: 42161;
|
|
359
|
+
readonly arbitrum_sepolia: 421614;
|
|
360
|
+
readonly fantom: 250;
|
|
361
|
+
readonly fantom_testnet: 4002;
|
|
362
|
+
readonly optimism: 10;
|
|
363
|
+
readonly optimism_sepolia: 11155420;
|
|
364
|
+
readonly harmony: 1666600000;
|
|
365
|
+
readonly sepolia: 11155111;
|
|
366
|
+
readonly scroll: 534352;
|
|
367
|
+
readonly scroll_sepolia: 534351;
|
|
368
|
+
readonly sonic: 146;
|
|
369
|
+
readonly mantle: 5000;
|
|
370
|
+
readonly metis: 1088;
|
|
371
|
+
readonly base: 8453;
|
|
372
|
+
readonly base_sepolia: 84532;
|
|
373
|
+
readonly bnb: 56;
|
|
374
|
+
readonly gnosis: 100;
|
|
375
|
+
readonly zkEVM: 1101;
|
|
376
|
+
readonly zksync: 324;
|
|
377
|
+
readonly linea: 59144;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
type SupportedChainIds = (typeof ChainId)[keyof typeof ChainId];
|
|
381
|
+
/**
|
|
382
|
+
* A manually maintained list of public rpcs.
|
|
383
|
+
* These should only be used for prs coming from forks, which should not access secrets like the alchemy api key.
|
|
384
|
+
*/
|
|
385
|
+
declare const publicRPCs: {
|
|
386
|
+
readonly 1: "https://eth.llamarpc.com";
|
|
387
|
+
readonly 137: "https://polygon.llamarpc.com";
|
|
388
|
+
readonly 42161: "https://polygon.llamarpc.com";
|
|
389
|
+
readonly 8453: "https://base.llamarpc.com";
|
|
390
|
+
readonly 56: "https://binance.llamarpc.com";
|
|
391
|
+
readonly 1088: "https://andromeda.metis.io/?owner=1088";
|
|
392
|
+
readonly 100: "https://rpc.ankr.com/gnosis";
|
|
393
|
+
readonly 534352: "https://rpc.scroll.io";
|
|
394
|
+
readonly 324: "https://mainnet.era.zksync.io";
|
|
395
|
+
readonly 250: "https://rpc.ftm.tools";
|
|
396
|
+
readonly 43114: "https://api.avax.network/ext/bc/C/rpc";
|
|
397
|
+
readonly 59144: "https://rpc.linea.build";
|
|
398
|
+
};
|
|
399
|
+
declare const alchemySupportedChainIds: (1 | 10 | 56 | 100 | 137 | 146 | 250 | 324 | 1101 | 4002 | 5000 | 8453 | 42161 | 42220 | 43113 | 43114 | 59144 | 80002 | 84532 | 421614 | 534351 | 534352 | 11155111 | 11155420 | 1088 | 1666600000)[];
|
|
400
|
+
declare const getNetworkEnv: (chainId: SupportedChainIds) => "RPC_MAINNET" | "RPC_OPTIMISM" | "RPC_FANTOM" | "RPC_CELO" | "RPC_POLYGON" | "RPC_POLYGON_AMOY" | "RPC_AVALANCHE" | "RPC_AVALANCHE_FUJI" | "RPC_ARBITRUM" | "RPC_ARBITRUM_SEPOLIA" | "RPC_FANTOM_TESTNET" | "RPC_OPTIMISM_SEPOLIA" | "RPC_HARMONY" | "RPC_SEPOLIA" | "RPC_SCROLL" | "RPC_SCROLL_SEPOLIA" | "RPC_SONIC" | "RPC_MANTLE" | "RPC_METIS" | "RPC_BASE" | "RPC_BASE_SEPOLIA" | "RPC_BNB" | "RPC_GNOSIS" | "RPC_ZKEVM" | "RPC_ZKSYNC" | "RPC_LINEA";
|
|
401
|
+
declare function getExplicitRPC(chainId: SupportedChainIds): string;
|
|
402
|
+
declare function getAlchemyRPC(chainId: SupportedChainIds, alchemyKey: string): string;
|
|
403
|
+
declare function getPublicRpc(chainId: SupportedChainIds): "https://eth.llamarpc.com" | "https://polygon.llamarpc.com" | "https://base.llamarpc.com" | "https://binance.llamarpc.com" | "https://andromeda.metis.io/?owner=1088" | "https://rpc.ankr.com/gnosis" | "https://rpc.scroll.io" | "https://mainnet.era.zksync.io" | "https://rpc.ftm.tools" | "https://api.avax.network/ext/bc/C/rpc" | "https://rpc.linea.build";
|
|
404
|
+
declare function getQuickNodeRpc(chainId: SupportedChainIds, options: {
|
|
405
|
+
quicknodeEndpointName: string;
|
|
406
|
+
quicknodeToken: string;
|
|
407
|
+
}): string;
|
|
408
|
+
type GetRPCUrlOptions = {
|
|
409
|
+
alchemyKey?: string;
|
|
410
|
+
quicknodeEndpointName?: string;
|
|
411
|
+
quicknodeToken?: string;
|
|
412
|
+
};
|
|
413
|
+
/**
|
|
414
|
+
* Return a RPC_URL for supported chains.
|
|
415
|
+
* If the RPC_URL environment variable is set, it will be used.
|
|
416
|
+
* Otherwise will construct the URL based on the chain ID and Alchemy API key.
|
|
417
|
+
*
|
|
418
|
+
* @notice This method acts as fall-through and will only revert if the ChainId is strictly not supported.
|
|
419
|
+
* If no RPC_URL is set, and non of the private rpc providers supports the chain, it will return undefined.
|
|
420
|
+
* @param chainId
|
|
421
|
+
* @param alchemyKey
|
|
422
|
+
* @returns the RPC_URL for the given chain ID
|
|
423
|
+
*/
|
|
424
|
+
declare const getRPCUrl: (chainId: SupportedChainIds, options?: GetRPCUrlOptions) => string | undefined;
|
|
425
|
+
/**
|
|
426
|
+
* Returns a viem client for the given chain with the supplied config.
|
|
427
|
+
* @param chainId
|
|
428
|
+
* @param param1
|
|
429
|
+
* @returns A viem Client
|
|
430
|
+
*/
|
|
431
|
+
declare function getClient(chainId: number, { httpConfig, clientConfig, providerConfig, forceRebuildClient, }: {
|
|
432
|
+
httpConfig?: Partial<HttpTransportConfig>;
|
|
433
|
+
clientConfig?: Partial<ClientConfig>;
|
|
434
|
+
providerConfig: GetRPCUrlOptions;
|
|
435
|
+
forceRebuildClient?: boolean;
|
|
436
|
+
}): Client;
|
|
437
|
+
|
|
301
438
|
declare const erc1967_ImplementationSlot = "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc";
|
|
302
439
|
declare const erc1967_AdminSlot = "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103";
|
|
303
440
|
|
|
304
|
-
declare function diffCode(
|
|
441
|
+
declare function diffCode(before: StandardJsonInput, after: StandardJsonInput): Promise<Record<string, string>>;
|
|
442
|
+
|
|
443
|
+
type LogType = {
|
|
444
|
+
topics: [Hex];
|
|
445
|
+
data: Hex;
|
|
446
|
+
emitter: Address;
|
|
447
|
+
};
|
|
448
|
+
interface ParseLogsArgs {
|
|
449
|
+
logs: LogType[];
|
|
450
|
+
eventDb: Abi;
|
|
451
|
+
}
|
|
452
|
+
declare function parseLogs({ logs, eventDb }: ParseLogsArgs): LogType[];
|
|
453
|
+
|
|
454
|
+
declare enum SelfdestuctCheckState {
|
|
455
|
+
TRUSTED = 0,
|
|
456
|
+
EOA = 1,
|
|
457
|
+
EMPTY = 2,
|
|
458
|
+
DELEGATECALL = 3,
|
|
459
|
+
SAFE = 4,
|
|
460
|
+
SELF_DESTRUCT = 5
|
|
461
|
+
}
|
|
462
|
+
declare function checkForSelfdestruct(client: Client, addresses: Address[], trustedAddresses: Address[]): Promise<{
|
|
463
|
+
address: Address;
|
|
464
|
+
state: SelfdestuctCheckState;
|
|
465
|
+
}[]>;
|
|
466
|
+
|
|
467
|
+
type RenderTenderlyReportParams = {
|
|
468
|
+
client: Client;
|
|
469
|
+
sim: any;
|
|
470
|
+
};
|
|
471
|
+
declare function renderTenderlyReport({ client, sim, }: RenderTenderlyReportParams): Promise<{
|
|
472
|
+
topics: [viem.Hex];
|
|
473
|
+
data: viem.Hex;
|
|
474
|
+
emitter: viem.Address;
|
|
475
|
+
}[]>;
|
|
305
476
|
|
|
306
|
-
export { type ExplorerConfig, type GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, LTV_PRECISION, PayloadState, type PayloadsControllerContract, ProposalState, RAY, type ReserveConfiguration, SECONDS_PER_YEAR, type Tenderly_createVnetParamsResponse, WAD, WAD_RAY_RATIO, bitmapToIndexes, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactorFromBalances, calculateLinearInterest, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, erc1967_AdminSlot, erc1967_ImplementationSlot, getBits, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplorer, getGovernance, getMarketReferenceCurrencyAndUsdBalance, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadsController, getSourceCode, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, parseEtherscanStyleSourceCode, rayDiv, rayMul, rayToWad, setBits, tenderly_createVnet, wadDiv, wadToRay };
|
|
477
|
+
export { EVENT_DB, type ExplorerConfig, type FoundryStorage, type GovernanceContract, HALF_RAY, HALF_WAD, HUMAN_READABLE_PAYLOAD_STATE, HUMAN_READABLE_PROPOSAL_STATE, LTV_PRECISION, PayloadState, type PayloadsControllerContract, ProposalState, RAY, type ReserveConfiguration, SECONDS_PER_YEAR, SelfdestuctCheckState, type Storage, type StorageType, type Tenderly_createVnetParamsResponse, WAD, WAD_RAY_RATIO, alchemySupportedChainIds, bitmapToIndexes, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateHealthFactorFromBalances, calculateLinearInterest, checkForSelfdestruct, decodeReserveConfiguration, decodeReserveConfigurationV2, decodeUserConfiguration, diffCode, diffFoundryStorageLayout, erc1967_AdminSlot, erc1967_ImplementationSlot, foundry_getStandardJsonInput, foundry_getStorageLayout, getAlchemyRPC, getBits, getClient, getCurrentDebtBalance, getCurrentLiquidityBalance, getExplicitRPC, getExplorer, getGovernance, getMarketReferenceCurrencyAndUsdBalance, getNetworkEnv, getNonFinalizedPayloads, getNonFinalizedProposals, getNormalizedDebt, getNormalizedIncome, getPayloadsController, getPublicRpc, getQuickNodeRpc, getRPCUrl, getSourceCode, isPayloadFinal, isProposalFinal, makePayloadExecutableOnTestClient, makeProposalExecutableOnTestClient, parseEtherscanStyleSourceCode, parseLogs, publicRPCs, rayDiv, rayMul, rayToWad, renderTenderlyReport, setBits, tenderly_createVnet, tenderly_deleteVnet, tenderly_getVnet, tenderly_simVnet, wadDiv, wadToRay };
|