@gearbox-protocol/sdk 18.1.0 → 18.2.0-next.10
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/cjs/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +179 -0
- package/dist/cjs/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +534 -0
- package/dist/cjs/abi/router/treehouseWorker.js +885 -0
- package/dist/cjs/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/cjs/onchain/market/adapters/abi/conctructorAbi.js +3 -0
- package/dist/cjs/onchain/market/adapters/types.js +3 -0
- package/dist/cjs/permissionless/api/GearboxPermissionless.js +12 -5
- package/dist/cjs/permissionless/api/analytics/PermissionlessAnalytics.js +50 -0
- package/dist/cjs/permissionless/api/analytics/index.js +4 -0
- package/dist/cjs/permissionless/api/analytics/schemas.js +27 -0
- package/dist/cjs/permissionless/api/analytics/types.js +1 -0
- package/dist/cjs/permissionless/api/index.js +3 -0
- package/dist/cjs/permissionless/api/oracles/PermissionlessOracles.js +444 -28
- package/dist/cjs/permissionless/api/oracles/enrich.js +99 -0
- package/dist/cjs/permissionless/api/oracles/schemas.js +102 -16
- package/dist/cjs/permissionless/api/schemas.js +0 -3
- package/dist/cjs/permissionless/bindings/index.js +1 -1
- package/dist/cjs/permissionless/index.js +4 -1
- package/dist/cjs/permissionless/utils/index.js +1 -0
- package/dist/cjs/permissionless/utils/price-update/get-prices.js +25 -0
- package/dist/cjs/permissionless/utils/price-update/index.js +1 -0
- package/dist/cjs/testnets/TestnetsAPI.js +179 -0
- package/dist/cjs/testnets/errors/TestnetNotFoundError.js +15 -0
- package/dist/cjs/testnets/errors/TestnetRequestFailedError.js +24 -0
- package/dist/cjs/testnets/errors/TestnetStatusError.js +19 -0
- package/dist/cjs/testnets/errors/TestnetValidationError.js +24 -0
- package/dist/cjs/testnets/errors/TestnetWaitTimeoutError.js +30 -0
- package/dist/cjs/testnets/errors/TestnetsError.js +34 -0
- package/dist/cjs/testnets/errors/index.js +13 -0
- package/dist/cjs/testnets/index.js +32 -0
- package/dist/cjs/testnets/package.json +1 -0
- package/dist/cjs/testnets/schemas.js +242 -0
- package/dist/cjs/testnets/types.js +1 -0
- package/dist/esm/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.js +178 -0
- package/dist/esm/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.js +533 -0
- package/dist/esm/abi/router/treehouseWorker.js +884 -0
- package/dist/esm/onchain/market/adapters/abi/actionAbi.js +1 -0
- package/dist/esm/onchain/market/adapters/abi/conctructorAbi.js +3 -0
- package/dist/esm/onchain/market/adapters/types.js +3 -0
- package/dist/esm/permissionless/api/GearboxPermissionless.js +12 -5
- package/dist/esm/permissionless/api/analytics/PermissionlessAnalytics.js +49 -0
- package/dist/esm/permissionless/api/analytics/index.js +2 -0
- package/dist/esm/permissionless/api/analytics/schemas.js +25 -0
- package/dist/esm/permissionless/api/analytics/types.js +1 -0
- package/dist/esm/permissionless/api/index.js +3 -1
- package/dist/esm/permissionless/api/oracles/PermissionlessOracles.js +446 -30
- package/dist/esm/permissionless/api/oracles/enrich.js +94 -0
- package/dist/esm/permissionless/api/oracles/schemas.js +94 -17
- package/dist/esm/permissionless/api/schemas.js +2 -4
- package/dist/esm/permissionless/bindings/index.js +1 -1
- package/dist/esm/permissionless/index.js +4 -3
- package/dist/esm/permissionless/utils/index.js +2 -2
- package/dist/esm/permissionless/utils/price-update/get-prices.js +25 -1
- package/dist/esm/permissionless/utils/price-update/index.js +2 -2
- package/dist/esm/testnets/TestnetsAPI.js +178 -0
- package/dist/esm/testnets/errors/TestnetNotFoundError.js +14 -0
- package/dist/esm/testnets/errors/TestnetRequestFailedError.js +23 -0
- package/dist/esm/testnets/errors/TestnetStatusError.js +18 -0
- package/dist/esm/testnets/errors/TestnetValidationError.js +23 -0
- package/dist/esm/testnets/errors/TestnetWaitTimeoutError.js +29 -0
- package/dist/esm/testnets/errors/TestnetsError.js +33 -0
- package/dist/esm/testnets/errors/index.js +7 -0
- package/dist/esm/testnets/index.js +11 -0
- package/dist/esm/testnets/package.json +1 -0
- package/dist/esm/testnets/schemas.js +228 -0
- package/dist/esm/testnets/types.js +1 -0
- package/dist/types/abi/compressors/subcompressors/liquidation/treehouseLiquidationSubcompressor.d.ts +148 -0
- package/dist/types/abi/compressors/subcompressors/withdrawal/treehouseWithdrawalSubcompressor.d.ts +440 -0
- package/dist/types/abi/router/treehouseWorker.d.ts +728 -0
- package/dist/types/onchain/market/adapters/types.d.ts +4 -1
- package/dist/types/permissionless/api/GearboxPermissionless.d.ts +11 -5
- package/dist/types/permissionless/api/analytics/PermissionlessAnalytics.d.ts +38 -0
- package/dist/types/permissionless/api/analytics/index.d.ts +3 -0
- package/dist/types/permissionless/api/analytics/schemas.d.ts +32 -0
- package/dist/types/permissionless/api/analytics/types.d.ts +38 -0
- package/dist/types/permissionless/api/index.d.ts +5 -2
- package/dist/types/permissionless/api/oracles/PermissionlessOracles.d.ts +159 -22
- package/dist/types/permissionless/api/oracles/enrich.d.ts +59 -0
- package/dist/types/permissionless/api/oracles/index.d.ts +2 -2
- package/dist/types/permissionless/api/oracles/schemas.d.ts +202 -7
- package/dist/types/permissionless/api/oracles/types.d.ts +401 -22
- package/dist/types/permissionless/api/schemas.d.ts +0 -2
- package/dist/types/permissionless/index.d.ts +5 -3
- package/dist/types/permissionless/utils/index.d.ts +2 -2
- package/dist/types/permissionless/utils/price-update/get-prices.d.ts +17 -0
- package/dist/types/permissionless/utils/price-update/index.d.ts +2 -2
- package/dist/types/testnets/TestnetsAPI.d.ts +108 -0
- package/dist/types/testnets/errors/TestnetNotFoundError.d.ts +12 -0
- package/dist/types/testnets/errors/TestnetRequestFailedError.d.ts +11 -0
- package/dist/types/testnets/errors/TestnetStatusError.d.ts +15 -0
- package/dist/types/testnets/errors/TestnetValidationError.d.ts +16 -0
- package/dist/types/testnets/errors/TestnetWaitTimeoutError.d.ts +21 -0
- package/dist/types/testnets/errors/TestnetsError.d.ts +47 -0
- package/dist/types/testnets/errors/index.d.ts +7 -0
- package/dist/types/testnets/index.d.ts +11 -0
- package/dist/types/testnets/schemas.d.ts +554 -0
- package/dist/types/testnets/types.d.ts +717 -0
- package/package.json +9 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { chainSchema } from "../chains/schemas.js";
|
|
2
|
+
import { addressSchema } from "../schemas.js";
|
|
2
3
|
import { z } from "zod/v4";
|
|
3
4
|
//#region src/permissionless/api/oracles/schemas.ts
|
|
4
5
|
/**
|
|
@@ -18,30 +19,106 @@ const priceFeedSchema = z.looseObject({
|
|
|
18
19
|
stalenessPeriod: z.number(),
|
|
19
20
|
name: z.string()
|
|
20
21
|
});
|
|
21
|
-
/**
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* {@link PermissionlessPriceFeedAsset}
|
|
24
|
+
*
|
|
25
|
+
* What identifies an asset, which is all a feed's own listing of one says.
|
|
26
|
+
**/
|
|
27
|
+
const priceFeedAssetSchema = z.looseObject({
|
|
23
28
|
address: addressSchema,
|
|
24
29
|
symbol: z.string(),
|
|
25
30
|
name: z.string(),
|
|
26
|
-
decimals: z.number()
|
|
31
|
+
decimals: z.number()
|
|
32
|
+
});
|
|
33
|
+
/** {@link PermissionlessAsset} — identified as above, plus what prices it. */
|
|
34
|
+
const assetSchema = priceFeedAssetSchema.extend({
|
|
27
35
|
owner: addressSchema,
|
|
28
36
|
priceFeeds: z.array(priceFeedSchema)
|
|
29
37
|
});
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
/**
|
|
39
|
+
* {@link PermissionlessPriceFeedStore}
|
|
40
|
+
*
|
|
41
|
+
* A store is a chain's, and is described by the same five fields the chain
|
|
42
|
+
* list answers with, so those are extended rather than restated.
|
|
43
|
+
**/
|
|
44
|
+
const priceFeedStoreSchema = chainSchema.extend({
|
|
37
45
|
assets: z.array(assetSchema),
|
|
38
46
|
priceFeeds: z.array(priceFeedSchema)
|
|
39
47
|
});
|
|
40
|
-
/** {@link
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
/** Every chain's {@link PermissionlessPriceFeedStore}, one per chain. */
|
|
49
|
+
const priceFeedStoresSchema = z.array(priceFeedStoreSchema);
|
|
50
|
+
/**
|
|
51
|
+
* What names a market, whichever side it is being listed from.
|
|
52
|
+
*
|
|
53
|
+
* A feed's markets and an asset's markets are different reads, but they
|
|
54
|
+
* answer with the same market: who curates it, what it is denominated in and
|
|
55
|
+
* how much of the quota is taken. Only what the read is about differs, which
|
|
56
|
+
* is what each of the two below adds.
|
|
57
|
+
**/
|
|
58
|
+
const marketSchema = z.looseObject({
|
|
59
|
+
market: addressSchema,
|
|
60
|
+
marketConfigurator: addressSchema,
|
|
61
|
+
curatorName: z.string().nullable(),
|
|
62
|
+
marketName: z.string().nullable(),
|
|
63
|
+
underlyingSymbol: z.string().nullable(),
|
|
64
|
+
isUnderlying: z.boolean(),
|
|
65
|
+
quotaLimit: z.number().nullable(),
|
|
66
|
+
quotaUsed: z.number().nullable()
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* {@link PermissionlessIndexedPriceFeedMarket} — the market as the feed's slot
|
|
70
|
+
* in it, before the oracle is asked what period it holds for the slot.
|
|
71
|
+
**/
|
|
72
|
+
const priceFeedMarketSchema = marketSchema.extend({
|
|
73
|
+
token: addressSchema,
|
|
74
|
+
tokenSymbol: z.string().nullable(),
|
|
75
|
+
reserve: z.boolean(),
|
|
76
|
+
priceOracle: addressSchema
|
|
77
|
+
});
|
|
78
|
+
/** {@link PermissionlessIndexedPriceFeedDetails} */
|
|
79
|
+
const priceFeedDetailsSchema = z.looseObject({
|
|
80
|
+
chainId: z.number(),
|
|
81
|
+
priceFeed: priceFeedSchema,
|
|
82
|
+
assets: z.array(priceFeedAssetSchema),
|
|
83
|
+
markets: z.array(priceFeedMarketSchema)
|
|
84
|
+
});
|
|
85
|
+
/** {@link PermissionlessAssetMarketFeed} */
|
|
86
|
+
const assetMarketFeedSchema = z.looseObject({
|
|
87
|
+
address: addressSchema,
|
|
88
|
+
name: z.string().nullable(),
|
|
89
|
+
inStore: z.boolean()
|
|
90
|
+
});
|
|
91
|
+
/** {@link PermissionlessAssetMarket} — the market as what prices the asset in it. */
|
|
92
|
+
const assetMarketSchema = marketSchema.extend({
|
|
93
|
+
underlyingToken: addressSchema,
|
|
94
|
+
underlyingPriceFeed: addressSchema.nullable(),
|
|
95
|
+
isShutdown: z.boolean(),
|
|
96
|
+
mainFeed: assetMarketFeedSchema.nullable(),
|
|
97
|
+
reserveFeed: assetMarketFeedSchema.nullable()
|
|
98
|
+
});
|
|
99
|
+
/** {@link PermissionlessIndexedAssetDetails} */
|
|
100
|
+
const assetDetailsSchema = z.looseObject({
|
|
101
|
+
chainId: z.number(),
|
|
102
|
+
asset: priceFeedAssetSchema,
|
|
103
|
+
priceFeeds: z.array(priceFeedSchema),
|
|
104
|
+
markets: z.array(assetMarketSchema)
|
|
105
|
+
});
|
|
106
|
+
/** {@link PermissionlessAssetQuota} */
|
|
107
|
+
const assetQuotaSchema = z.looseObject({
|
|
108
|
+
quotaLimit: z.number().nullable(),
|
|
109
|
+
quotaUsed: z.number().nullable(),
|
|
110
|
+
isShutdown: z.boolean(),
|
|
111
|
+
underlyingPriceFeed: addressSchema.nullable()
|
|
112
|
+
});
|
|
113
|
+
/** {@link PermissionlessIndexedAssetSummary} */
|
|
114
|
+
const assetSummarySchema = z.looseObject({
|
|
115
|
+
chainId: z.number(),
|
|
116
|
+
address: addressSchema,
|
|
117
|
+
symbol: z.string(),
|
|
118
|
+
underlyingMarketCount: z.number(),
|
|
119
|
+
marketQuotas: z.array(assetQuotaSchema)
|
|
45
120
|
});
|
|
121
|
+
/** The list of {@link PermissionlessAssetSummary}, already ordered. */
|
|
122
|
+
const assetSummariesSchema = z.array(assetSummarySchema);
|
|
46
123
|
//#endregion
|
|
47
|
-
export { assetSchema, priceFeedSchema, priceFeedStoreSchema,
|
|
124
|
+
export { assetDetailsSchema, assetMarketFeedSchema, assetMarketSchema, assetQuotaSchema, assetSchema, assetSummariesSchema, assetSummarySchema, priceFeedAssetSchema, priceFeedDetailsSchema, priceFeedMarketSchema, priceFeedSchema, priceFeedStoreSchema, priceFeedStoresSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isAddress
|
|
1
|
+
import { isAddress } from "viem";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
//#region src/permissionless/api/schemas.ts
|
|
4
4
|
/**
|
|
@@ -11,8 +11,6 @@ import { z } from "zod/v4";
|
|
|
11
11
|
**/
|
|
12
12
|
/** An address, in whatever case the backend serves it. */
|
|
13
13
|
const addressSchema = z.custom((value) => typeof value === "string" && isAddress(value, { strict: false }), { message: "invalid address" });
|
|
14
|
-
/** A `0x`-prefixed hex string, as viem's `Hex`. */
|
|
15
|
-
const hexSchema = z.custom((value) => typeof value === "string" && isHex(value), { message: "invalid hex string" });
|
|
16
14
|
/**
|
|
17
15
|
* A record keyed by address. Spelled out here because zod types a record key
|
|
18
16
|
* by the schema's output, which the branded `Address` is not inferred as.
|
|
@@ -22,4 +20,4 @@ function addressRecord(value) {
|
|
|
22
20
|
return z.record(key, value);
|
|
23
21
|
}
|
|
24
22
|
//#endregion
|
|
25
|
-
export { addressRecord, addressSchema
|
|
23
|
+
export { addressRecord, addressSchema };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BytecodeRepositoryContract } from "./bytecode-repository.js";
|
|
2
2
|
import { priceFeedSetupParams } from "./pricefeeds/index.js";
|
|
3
3
|
import { PriceFeedStoreContract } from "./price-feed-store.js";
|
|
4
|
+
import { AddressProviderContract } from "./address-provider.js";
|
|
4
5
|
import { TokenCompressorContract } from "./compressors/token-compressor.js";
|
|
5
6
|
import { WithdrawalCompressorContract } from "./compressors/withdrawal-compressor.js";
|
|
6
7
|
import "./compressors/index.js";
|
|
@@ -8,7 +9,6 @@ import { RoutingManagerContract } from "./router/routing-manager.js";
|
|
|
8
9
|
import "./router/index.js";
|
|
9
10
|
import { TreasurySplitterContract } from "./treasury-splitter.js";
|
|
10
11
|
import { InstanceManagerContract } from "./instance-manager.js";
|
|
11
|
-
import { AddressProviderContract } from "./address-provider.js";
|
|
12
12
|
import { MarketConfiguratorFactoryContract } from "./market-configurator-factory.js";
|
|
13
13
|
import { CrossChainMultisigContract } from "./cross-chain-multisig.js";
|
|
14
14
|
import { AccessMode } from "./types.js";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionlessAnalytics } from "./api/analytics/PermissionlessAnalytics.js";
|
|
1
2
|
import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./api/errors.js";
|
|
2
3
|
import { ChainsNamespace } from "./api/chains/ChainsNamespace.js";
|
|
3
4
|
import { deriveEffectiveStalenessPeriod } from "./api/deploy/effective-staleness.js";
|
|
@@ -9,7 +10,8 @@ import { PriceFeedStoreContract } from "./bindings/price-feed-store.js";
|
|
|
9
10
|
import { Addresses } from "./deployment/addresses.js";
|
|
10
11
|
import { encodeFunctionParams } from "./utils/abi-encoder.js";
|
|
11
12
|
import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./api/deploy/PermissionlessDeploy.js";
|
|
12
|
-
import {
|
|
13
|
+
import { AddressProviderContract } from "./bindings/address-provider.js";
|
|
14
|
+
import { getLatestPrices, getPrices } from "./utils/price-update/get-prices.js";
|
|
13
15
|
import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
|
|
14
16
|
import { TokenCompressorContract } from "./bindings/compressors/token-compressor.js";
|
|
15
17
|
import { WithdrawalCompressorContract } from "./bindings/compressors/withdrawal-compressor.js";
|
|
@@ -21,7 +23,6 @@ import { getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds
|
|
|
21
23
|
import { InstanceOwnerTransactions } from "./api/transactions/InstanceOwnerTransactions.js";
|
|
22
24
|
import { GearboxPermissionless } from "./api/GearboxPermissionless.js";
|
|
23
25
|
import "./api/index.js";
|
|
24
|
-
import { AddressProviderContract } from "./bindings/address-provider.js";
|
|
25
26
|
import { MarketConfiguratorFactoryContract } from "./bindings/market-configurator-factory.js";
|
|
26
27
|
import { CrossChainMultisigContract } from "./bindings/cross-chain-multisig.js";
|
|
27
28
|
import { PUBLIC_CREATE2_FACTORY, checkCreate2Deployment, checkCreate2DeploymentAddress, createCreate2DeployRawTx, deployUsingPublicCreate2, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, handleSalt } from "./utils/create2.js";
|
|
@@ -40,4 +41,4 @@ import { getBlockNumberByTimestamp } from "./utils/block-utils.js";
|
|
|
40
41
|
import { convertQueueBatchToExecuteTx } from "./utils/governance/timelock-txs.js";
|
|
41
42
|
import { getPriceUpdateTx } from "./utils/price-update/get-price-update-tx.js";
|
|
42
43
|
import "./utils/index.js";
|
|
43
|
-
export { AccessMode, AddressProviderContract, Addresses, ArchiveTransport, BYTECODE_REPOSITORY, BytecodeRepositoryContract, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainsNamespace, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GovernorContract, INSTANCE_MANAGER, InstanceManagerContract, InstanceOwnerTransactions, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, PriceFeedStoreContract, RoutingManagerContract, TOKEN_COMPRESSOR, TimeLockContract, TokenCompressorContract, TreasurySplitterContract, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
|
|
44
|
+
export { AccessMode, AddressProviderContract, Addresses, ArchiveTransport, BYTECODE_REPOSITORY, BytecodeRepositoryContract, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainsNamespace, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GovernorContract, INSTANCE_MANAGER, InstanceManagerContract, InstanceOwnerTransactions, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PermissionlessAnalytics, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, PriceFeedStoreContract, RoutingManagerContract, TOKEN_COMPRESSOR, TimeLockContract, TokenCompressorContract, TreasurySplitterContract, WithdrawalCompressorContract, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, chunkedLogsTransport, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCallData, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, deriveEffectiveStalenessPeriod, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, TOKEN_COMPRESSOR } from "./literals.js";
|
|
2
2
|
import { normalizeSignature } from "./signature.js";
|
|
3
3
|
import { encodeFunctionParams } from "./abi-encoder.js";
|
|
4
|
-
import { getPrices } from "./price-update/get-prices.js";
|
|
4
|
+
import { getLatestPrices, getPrices } from "./price-update/get-prices.js";
|
|
5
5
|
import { calculateChecksum, convertRawTxToSafeMultisigTx, getSafeBatch, getSafeBatches } from "./governance/batch.js";
|
|
6
6
|
import { getUpdatablePriceFeeds } from "./price-update/get-updatable-feeds.js";
|
|
7
7
|
import { PUBLIC_CREATE2_FACTORY, checkCreate2Deployment, checkCreate2DeploymentAddress, createCreate2DeployRawTx, deployUsingPublicCreate2, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, handleSalt } from "./create2.js";
|
|
@@ -11,4 +11,4 @@ import { convertQueueBatchToExecuteTx } from "./governance/timelock-txs.js";
|
|
|
11
11
|
import "./governance/index.js";
|
|
12
12
|
import { getPriceUpdateTx } from "./price-update/get-price-update-tx.js";
|
|
13
13
|
import "./price-update/index.js";
|
|
14
|
-
export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
|
|
14
|
+
export { BYTECODE_REPOSITORY, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, INSTANCE_MANAGER, MARKET_CONFIGURATOR_FACTORY, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, TOKEN_COMPRESSOR, calculateChecksum, checkCreate2Deployment, checkCreate2DeploymentAddress, convertPercent, convertQueueBatchToExecuteTx, convertRawTxToSafeMultisigTx, createCreate2DeployRawTx, deepJsonParse, deployUsingPublicCreate2, encodeFunctionParams, formatBytecodeSize, formatBytecodeVersion, getBlockNumberByTimestamp, getCreate2AddressPublicFactory, getCreate2DeploymentAddress, getLatestPrices, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, shortenHash, significantTrunc };
|
|
@@ -39,6 +39,30 @@ function getLatestRoundDataCall(priceFeed) {
|
|
|
39
39
|
args: []
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* What the feeds report as they stand, in one multicall.
|
|
44
|
+
*
|
|
45
|
+
* What {@link getPrices} does without the part that makes it expensive: no
|
|
46
|
+
* `OnchainSDK` to attach and no update transactions to assemble, which is the
|
|
47
|
+
* whole cost of that call and is wasted on a feed that answers already. A feed
|
|
48
|
+
* that needs a fresh answer before it will be read comes back `null` here, so
|
|
49
|
+
* a caller that must price those falls back to {@link getPrices} for them and
|
|
50
|
+
* pays once for the few rather than once for all.
|
|
51
|
+
*
|
|
52
|
+
* `null` is also a feed whose read reverted for any other reason, which is not
|
|
53
|
+
* a zero.
|
|
54
|
+
*/
|
|
55
|
+
async function getLatestPrices({ client, priceFeeds }) {
|
|
56
|
+
if (priceFeeds.length === 0) return {};
|
|
57
|
+
const results = await client.multicall({
|
|
58
|
+
contracts: priceFeeds.map(getLatestRoundDataCall),
|
|
59
|
+
allowFailure: true
|
|
60
|
+
});
|
|
61
|
+
return Object.fromEntries(priceFeeds.map((priceFeed, index) => {
|
|
62
|
+
const result = results[index];
|
|
63
|
+
return [priceFeed, result?.status === "success" ? result.result[1] : null];
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
42
66
|
async function getPricesChunk({ client, priceFeeds, sdk }) {
|
|
43
67
|
const updateCall = priceFeeds.map((priceFeed) => getLatestRoundDataCall(priceFeed));
|
|
44
68
|
const multicallCalls = (await sdk.priceFeeds.generateExternalPriceFeedsUpdateTxs(priceFeeds)).txs.map((tx) => ({
|
|
@@ -82,4 +106,4 @@ async function getPrices({ client, priceFeeds, chunkSize = 10, gasLimit }) {
|
|
|
82
106
|
}), {});
|
|
83
107
|
}
|
|
84
108
|
//#endregion
|
|
85
|
-
export { getPrices };
|
|
109
|
+
export { getLatestPrices, getPrices };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getPrices } from "./get-prices.js";
|
|
1
|
+
import { getLatestPrices, getPrices } from "./get-prices.js";
|
|
2
2
|
import { getUpdatablePriceFeeds } from "./get-updatable-feeds.js";
|
|
3
3
|
import { getPriceUpdateTx } from "./get-price-update-tx.js";
|
|
4
|
-
export { getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };
|
|
4
|
+
export { getLatestPrices, getPriceUpdateTx, getPrices, getUpdatablePriceFeeds };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { TestnetStatusError } from "./errors/TestnetStatusError.js";
|
|
2
|
+
import { TestnetNotFoundError } from "./errors/TestnetNotFoundError.js";
|
|
3
|
+
import { TestnetRequestFailedError } from "./errors/TestnetRequestFailedError.js";
|
|
4
|
+
import { TestnetValidationError } from "./errors/TestnetValidationError.js";
|
|
5
|
+
import { TestnetWaitTimeoutError } from "./errors/TestnetWaitTimeoutError.js";
|
|
6
|
+
import "./errors/index.js";
|
|
7
|
+
import { testnetSchema, testnetStatusSchema } from "./schemas.js";
|
|
8
|
+
import { z } from "zod/v4";
|
|
9
|
+
//#region src/testnets/TestnetsAPI.ts
|
|
10
|
+
const DEFAULT_BASE_URL = "https://anvil.gearbox.foundation";
|
|
11
|
+
const DEFAULT_TIMEOUT = 3e4;
|
|
12
|
+
const DEFAULT_WAIT_TIMEOUT = 6e5;
|
|
13
|
+
const DEFAULT_WAIT_INTERVAL = 5e3;
|
|
14
|
+
const errorBodySchema = z.object({ error: z.string() });
|
|
15
|
+
/**
|
|
16
|
+
* Client for anvil-manager, which runs the anvil forks Gearbox calls
|
|
17
|
+
* testnets. It manages non-persistent testnets only, addressed by their
|
|
18
|
+
* execution id.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const testnets = new TestnetsAPI({ apiKey: process.env.ANVIL_MANAGER_API_KEY });
|
|
22
|
+
* const { executionId } = await testnets.create({ network: "Mainnet", timeout: "2h" });
|
|
23
|
+
* const status = await testnets.waitUntilReady(executionId);
|
|
24
|
+
* // ... use status.rpcUrl ...
|
|
25
|
+
* await testnets.kill(executionId);
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Every method throws a {@link TestnetsError} subclass when it fails, except
|
|
29
|
+
* when a response body is not JSON: then it rejects with the error of
|
|
30
|
+
* `response.json()`.
|
|
31
|
+
**/
|
|
32
|
+
var TestnetsAPI = class {
|
|
33
|
+
logger;
|
|
34
|
+
#baseUrl;
|
|
35
|
+
#apiKey;
|
|
36
|
+
#timeout;
|
|
37
|
+
constructor(options = {}) {
|
|
38
|
+
this.#baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
|
|
39
|
+
this.#apiKey = options.apiKey;
|
|
40
|
+
this.#timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
41
|
+
this.logger = options.logger?.child?.({ name: "TestnetsAPI" }) ?? options.logger;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Base URL every request of this client is sent to.
|
|
45
|
+
**/
|
|
46
|
+
get baseUrl() {
|
|
47
|
+
return this.#baseUrl;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Every testnet anvil-manager knows of, persistent ones included.
|
|
51
|
+
**/
|
|
52
|
+
async list() {
|
|
53
|
+
const url = this.#url("/api/v1/forks");
|
|
54
|
+
const response = await this.#fetch(url, { method: "GET" });
|
|
55
|
+
return this.#decode(url, response, z.array(testnetSchema));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Status of one testnet.
|
|
59
|
+
*
|
|
60
|
+
* @param id - Execution id of the testnet.
|
|
61
|
+
* @throws {@link TestnetNotFoundError} when there is no such testnet.
|
|
62
|
+
**/
|
|
63
|
+
async get(id) {
|
|
64
|
+
const url = this.#forkUrl(id);
|
|
65
|
+
const response = await this.#fetch(url, { method: "GET" });
|
|
66
|
+
return this.#decode(url, response, testnetStatusSchema);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Starts a testnet. It answers as soon as the testnet is created, long
|
|
70
|
+
* before it is {@link TestnetStatus.ready}.
|
|
71
|
+
*
|
|
72
|
+
* @param files - Saved in the testnet's shared dir, where scripts and tasks
|
|
73
|
+
* can read them.
|
|
74
|
+
**/
|
|
75
|
+
async create(request, files) {
|
|
76
|
+
const url = this.#url("/api/v1/forks");
|
|
77
|
+
const response = await this.#fetch(url, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
...createBody(request, files)
|
|
80
|
+
});
|
|
81
|
+
return this.#decode(url, response, testnetStatusSchema);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Stops a testnet. Stopping one that is already stopped succeeds.
|
|
85
|
+
*
|
|
86
|
+
* @param id - Execution id of the testnet.
|
|
87
|
+
* @throws {@link TestnetNotFoundError} when there is no such testnet.
|
|
88
|
+
* @throws {@link TestnetStatusError} with status 400 when the testnet is
|
|
89
|
+
* persistent.
|
|
90
|
+
**/
|
|
91
|
+
async kill(id) {
|
|
92
|
+
await this.#fetch(this.#forkUrl(id), { method: "DELETE" });
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Polls a testnet's status until it is {@link TestnetStatus.ready}.
|
|
96
|
+
*
|
|
97
|
+
* @param id - Execution id of the testnet.
|
|
98
|
+
* @returns The first status that is ready.
|
|
99
|
+
* @throws {@link TestnetWaitTimeoutError} when the testnet is not ready in
|
|
100
|
+
* time. Any error of a poll is thrown as is, without retrying.
|
|
101
|
+
**/
|
|
102
|
+
async waitUntilReady(id, options = {}) {
|
|
103
|
+
const { timeout = DEFAULT_WAIT_TIMEOUT, interval = DEFAULT_WAIT_INTERVAL } = options;
|
|
104
|
+
const deadline = Date.now() + timeout;
|
|
105
|
+
while (true) {
|
|
106
|
+
const status = await this.get(id);
|
|
107
|
+
if (status.ready) return status;
|
|
108
|
+
const remaining = deadline - Date.now();
|
|
109
|
+
if (remaining <= 0) throw new TestnetWaitTimeoutError(this.#forkUrl(id), id, timeout);
|
|
110
|
+
this.logger?.debug(`testnet ${id} is not ready yet`);
|
|
111
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(interval, remaining)));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
#url(path) {
|
|
115
|
+
return `${this.#baseUrl}${path}`;
|
|
116
|
+
}
|
|
117
|
+
#forkUrl(id) {
|
|
118
|
+
return this.#url(`/api/v1/forks/${encodeURIComponent(id)}`);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Sends one request and returns its response once it is known to be 2xx.
|
|
122
|
+
**/
|
|
123
|
+
async #fetch(url, init) {
|
|
124
|
+
const headers = new Headers(init.headers);
|
|
125
|
+
headers.set("accept", "application/json");
|
|
126
|
+
if (this.#apiKey) headers.set("authorization", `Bearer ${this.#apiKey}`);
|
|
127
|
+
let response;
|
|
128
|
+
try {
|
|
129
|
+
response = await fetch(url, {
|
|
130
|
+
...init,
|
|
131
|
+
headers,
|
|
132
|
+
signal: AbortSignal.timeout(this.#timeout)
|
|
133
|
+
});
|
|
134
|
+
} catch (error) {
|
|
135
|
+
throw new TestnetRequestFailedError(url, error);
|
|
136
|
+
}
|
|
137
|
+
if (!response.ok) {
|
|
138
|
+
const responseBody = await response.text();
|
|
139
|
+
const details = errorBodySchema.safeParse(responseBody).data?.error;
|
|
140
|
+
throw response.status === 404 ? new TestnetNotFoundError(url, details) : new TestnetStatusError(url, response.status, details);
|
|
141
|
+
}
|
|
142
|
+
return response;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Body of a 2xx response, decoded.
|
|
146
|
+
**/
|
|
147
|
+
async #decode(url, response, schema) {
|
|
148
|
+
const payload = await response.json();
|
|
149
|
+
const parsed = schema.safeParse(payload);
|
|
150
|
+
if (!parsed.success) {
|
|
151
|
+
const error = new TestnetValidationError(url, parsed.error);
|
|
152
|
+
this.logger?.error(error, "anvil-manager response does not match the testnet schemas");
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
return parsed.data;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Body and content type of a create request: JSON alone, or a multipart form
|
|
160
|
+
* with the JSON in its `json` field when there are files to upload.
|
|
161
|
+
**/
|
|
162
|
+
function createBody(request, files) {
|
|
163
|
+
const json = JSON.stringify(request);
|
|
164
|
+
if (!files || Object.keys(files).length === 0) return {
|
|
165
|
+
body: json,
|
|
166
|
+
headers: { "content-type": "application/json" }
|
|
167
|
+
};
|
|
168
|
+
const form = new FormData();
|
|
169
|
+
form.append("json", json);
|
|
170
|
+
for (const [name, contents] of Object.entries(files)) form.append("file", toBlob(contents), name);
|
|
171
|
+
return { body: form };
|
|
172
|
+
}
|
|
173
|
+
function toBlob(contents) {
|
|
174
|
+
if (contents instanceof Blob) return contents;
|
|
175
|
+
return new Blob([typeof contents === "string" ? contents : new Uint8Array(contents)]);
|
|
176
|
+
}
|
|
177
|
+
//#endregion
|
|
178
|
+
export { TestnetsAPI };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TestnetStatusError } from "./TestnetStatusError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetNotFoundError.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when anvil-manager answered 404: there is no testnet with that
|
|
5
|
+
* execution id.
|
|
6
|
+
**/
|
|
7
|
+
var TestnetNotFoundError = class extends TestnetStatusError {
|
|
8
|
+
name = "TestnetNotFoundError";
|
|
9
|
+
constructor(url, details) {
|
|
10
|
+
super(url, 404, details);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TestnetNotFoundError };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetRequestFailedError.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a request to anvil-manager never completed: the network was
|
|
5
|
+
* down, or it took longer than the client's timeout.
|
|
6
|
+
**/
|
|
7
|
+
var TestnetRequestFailedError = class extends TestnetsError {
|
|
8
|
+
name = "TestnetRequestFailedError";
|
|
9
|
+
constructor(url, cause) {
|
|
10
|
+
super(timedOut(cause) ? "The request to anvil-manager timed out." : "The request to anvil-manager failed.", {
|
|
11
|
+
url,
|
|
12
|
+
cause
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Whether a caught value is the rejection `AbortSignal.timeout` produces.
|
|
18
|
+
**/
|
|
19
|
+
function timedOut(error) {
|
|
20
|
+
return error instanceof Error && error.name === "TimeoutError";
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { TestnetRequestFailedError };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetStatusError.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when anvil-manager answered with a status outside the 2xx range. What
|
|
5
|
+
* it said about it, when it said anything, is the `details` of the error.
|
|
6
|
+
**/
|
|
7
|
+
var TestnetStatusError = class extends TestnetsError {
|
|
8
|
+
name = "TestnetStatusError";
|
|
9
|
+
constructor(url, status, details) {
|
|
10
|
+
super(`anvil-manager answered ${status}.`, {
|
|
11
|
+
url,
|
|
12
|
+
status,
|
|
13
|
+
details
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TestnetStatusError };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/testnets/errors/TestnetValidationError.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when anvil-manager answered, but with a payload the testnet schemas
|
|
6
|
+
* do not describe, i.e. the two are of different versions.
|
|
7
|
+
**/
|
|
8
|
+
var TestnetValidationError = class extends TestnetsError {
|
|
9
|
+
name = "TestnetValidationError";
|
|
10
|
+
/**
|
|
11
|
+
* The zod failure itself, e.g. for `z.treeifyError(error.zodError)`.
|
|
12
|
+
**/
|
|
13
|
+
zodError;
|
|
14
|
+
constructor(url, zodError) {
|
|
15
|
+
super("The anvil-manager response does not match the testnet schemas.", {
|
|
16
|
+
url,
|
|
17
|
+
metaMessages: z.prettifyError(zodError).split("\n")
|
|
18
|
+
});
|
|
19
|
+
this.zodError = zodError;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { TestnetValidationError };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
//#region src/testnets/errors/TestnetWaitTimeoutError.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a testnet did not become ready before the wait for it ran out.
|
|
5
|
+
**/
|
|
6
|
+
var TestnetWaitTimeoutError = class extends TestnetsError {
|
|
7
|
+
name = "TestnetWaitTimeoutError";
|
|
8
|
+
/**
|
|
9
|
+
* Execution id of the testnet that was waited for.
|
|
10
|
+
**/
|
|
11
|
+
id;
|
|
12
|
+
/**
|
|
13
|
+
* How long the wait lasted, in milliseconds.
|
|
14
|
+
**/
|
|
15
|
+
timeout;
|
|
16
|
+
/**
|
|
17
|
+
* @param url - Status URL that was polled.
|
|
18
|
+
**/
|
|
19
|
+
constructor(url, id, timeout) {
|
|
20
|
+
super(`Testnet ${id} did not become ready within ${timeout} ms.`, {
|
|
21
|
+
url,
|
|
22
|
+
metaMessages: [`Execution id: ${id}`, `Timeout: ${timeout} ms`]
|
|
23
|
+
});
|
|
24
|
+
this.id = id;
|
|
25
|
+
this.timeout = timeout;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { TestnetWaitTimeoutError };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
//#region src/testnets/errors/TestnetsError.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown by every testnet API call that fails. Its subclasses say how it
|
|
5
|
+
* failed; catch this one to catch all of them.
|
|
6
|
+
**/
|
|
7
|
+
var TestnetsError = class extends BaseError {
|
|
8
|
+
/**
|
|
9
|
+
* URL that was requested.
|
|
10
|
+
**/
|
|
11
|
+
url;
|
|
12
|
+
/**
|
|
13
|
+
* Status anvil-manager answered with, absent when the request never
|
|
14
|
+
* completed.
|
|
15
|
+
**/
|
|
16
|
+
status;
|
|
17
|
+
constructor(summary, params) {
|
|
18
|
+
const { cause, details } = params;
|
|
19
|
+
super(summary, {
|
|
20
|
+
cause: cause instanceof Error ? cause : void 0,
|
|
21
|
+
details: cause === void 0 || cause instanceof Error ? details : String(cause),
|
|
22
|
+
metaMessages: [
|
|
23
|
+
`URL: ${params.url}`,
|
|
24
|
+
...params.status === void 0 ? [] : [`Status: ${params.status}`],
|
|
25
|
+
...params.metaMessages ?? []
|
|
26
|
+
]
|
|
27
|
+
});
|
|
28
|
+
this.url = params.url;
|
|
29
|
+
this.status = params.status;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { TestnetsError };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TestnetsError } from "./TestnetsError.js";
|
|
2
|
+
import { TestnetStatusError } from "./TestnetStatusError.js";
|
|
3
|
+
import { TestnetNotFoundError } from "./TestnetNotFoundError.js";
|
|
4
|
+
import { TestnetRequestFailedError } from "./TestnetRequestFailedError.js";
|
|
5
|
+
import { TestnetValidationError } from "./TestnetValidationError.js";
|
|
6
|
+
import { TestnetWaitTimeoutError } from "./TestnetWaitTimeoutError.js";
|
|
7
|
+
export { TestnetNotFoundError, TestnetRequestFailedError, TestnetStatusError, TestnetValidationError, TestnetWaitTimeoutError, TestnetsError };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TestnetsError } from "./errors/TestnetsError.js";
|
|
2
|
+
import { TestnetStatusError } from "./errors/TestnetStatusError.js";
|
|
3
|
+
import { TestnetNotFoundError } from "./errors/TestnetNotFoundError.js";
|
|
4
|
+
import { TestnetRequestFailedError } from "./errors/TestnetRequestFailedError.js";
|
|
5
|
+
import { TestnetValidationError } from "./errors/TestnetValidationError.js";
|
|
6
|
+
import { TestnetWaitTimeoutError } from "./errors/TestnetWaitTimeoutError.js";
|
|
7
|
+
import "./errors/index.js";
|
|
8
|
+
import { testnetBackendOptionsSchema, testnetBackendStateSchema, testnetBackendStatusSchema, testnetBlockSchema, testnetOptionsSchema, testnetSchema, testnetScriptBlockSchema, testnetScriptOptionsSchema, testnetScriptSchema, testnetStageStatusSchema, testnetStatusSchema, testnetTaskDefinitionSchema, testnetTaskProgressSchema, testnetTaskSchema } from "./schemas.js";
|
|
9
|
+
import { TestnetsAPI } from "./TestnetsAPI.js";
|
|
10
|
+
import "./types.js";
|
|
11
|
+
export { TestnetNotFoundError, TestnetRequestFailedError, TestnetStatusError, TestnetValidationError, TestnetWaitTimeoutError, TestnetsAPI, TestnetsError, testnetBackendOptionsSchema, testnetBackendStateSchema, testnetBackendStatusSchema, testnetBlockSchema, testnetOptionsSchema, testnetSchema, testnetScriptBlockSchema, testnetScriptOptionsSchema, testnetScriptSchema, testnetStageStatusSchema, testnetStatusSchema, testnetTaskDefinitionSchema, testnetTaskProgressSchema, testnetTaskSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module","sideEffects":false}
|