@gearbox-protocol/sdk 18.1.0-next.1 → 18.2.0-next.1
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/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 +69 -0
- package/dist/cjs/permissionless/api/oracles/schemas.js +36 -0
- package/dist/cjs/permissionless/index.js +2 -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 +70 -1
- package/dist/esm/permissionless/api/oracles/schemas.js +33 -1
- package/dist/esm/permissionless/index.js +2 -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 +55 -1
- package/dist/types/permissionless/api/oracles/index.d.ts +2 -2
- package/dist/types/permissionless/api/oracles/schemas.d.ts +55 -0
- package/dist/types/permissionless/api/oracles/types.d.ts +92 -0
- package/dist/types/permissionless/index.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_permissionless_api_analytics_PermissionlessAnalytics = require("./analytics/PermissionlessAnalytics.js");
|
|
2
3
|
const require_permissionless_api_chains_ChainsNamespace = require("./chains/ChainsNamespace.js");
|
|
3
4
|
const require_permissionless_api_deploy_PermissionlessDeploy = require("./deploy/PermissionlessDeploy.js");
|
|
4
5
|
const require_permissionless_api_oracles_PermissionlessOracles = require("./oracles/PermissionlessOracles.js");
|
|
@@ -25,11 +26,11 @@ const require_permissionless_api_transactions_InstanceOwnerTransactions = requir
|
|
|
25
26
|
* const store = await permissionless.oracles.store({ chainId: chain.chainId });
|
|
26
27
|
* ```
|
|
27
28
|
*
|
|
28
|
-
* Only what needs a server goes to one. {@link chains}
|
|
29
|
-
* are the backend's reads; {@link deploy} and
|
|
30
|
-
* target chain directly, because everything
|
|
31
|
-
* and a round trip would only move the
|
|
32
|
-
* that has to sign for it.
|
|
29
|
+
* Only what needs a server goes to one. {@link chains}, {@link oracles} and
|
|
30
|
+
* {@link analytics} are the backend's reads; {@link deploy} and
|
|
31
|
+
* {@link transactions} read the target chain directly, because everything
|
|
32
|
+
* they answer is derived from there and a round trip would only move the
|
|
33
|
+
* derivation further from the wallet that has to sign for it.
|
|
33
34
|
**/
|
|
34
35
|
var GearboxPermissionless = class {
|
|
35
36
|
/**
|
|
@@ -42,6 +43,11 @@ var GearboxPermissionless = class {
|
|
|
42
43
|
**/
|
|
43
44
|
oracles;
|
|
44
45
|
/**
|
|
46
|
+
* Namespace for history: what a feed's price did over a window, see
|
|
47
|
+
* {@link PermissionlessAnalytics}.
|
|
48
|
+
**/
|
|
49
|
+
analytics;
|
|
50
|
+
/**
|
|
45
51
|
* Namespace for the Safe batches an instance owner executes. Backend-free,
|
|
46
52
|
* see {@link InstanceOwnerTransactions}.
|
|
47
53
|
**/
|
|
@@ -54,6 +60,7 @@ var GearboxPermissionless = class {
|
|
|
54
60
|
constructor(options = {}) {
|
|
55
61
|
this.chains = new require_permissionless_api_chains_ChainsNamespace.ChainsNamespace(options);
|
|
56
62
|
this.oracles = new require_permissionless_api_oracles_PermissionlessOracles.PermissionlessOracles(options, this.chains);
|
|
63
|
+
this.analytics = new require_permissionless_api_analytics_PermissionlessAnalytics.PermissionlessAnalytics(options);
|
|
57
64
|
this.transactions = new require_permissionless_api_transactions_InstanceOwnerTransactions.InstanceOwnerTransactions(this.chains, this.oracles);
|
|
58
65
|
this.deploy = new require_permissionless_api_deploy_PermissionlessDeploy.PermissionlessDeploy(this.chains);
|
|
59
66
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_offchain_AbstractOffchainNamespace = require("../../../offchain/AbstractOffchainNamespace.js");
|
|
3
|
+
const require_permissionless_api_analytics_schemas = require("./schemas.js");
|
|
4
|
+
//#region src/permissionless/api/analytics/PermissionlessAnalytics.ts
|
|
5
|
+
/**
|
|
6
|
+
* History of the permissionless stack: what a thing did, rather than what it
|
|
7
|
+
* is.
|
|
8
|
+
*
|
|
9
|
+
* Separate from {@link PermissionlessOracles} because the two are read on
|
|
10
|
+
* different clocks. A feed's identity settles when a curator uploads it and
|
|
11
|
+
* is read once per page; its price moves every block and is re-read whenever
|
|
12
|
+
* a window changes. Folding the series into the feed would make every range
|
|
13
|
+
* switch re-fetch the identity, and every identity read carry a series the
|
|
14
|
+
* caller may never draw.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const chart = await permissionless.analytics.priceChart({
|
|
18
|
+
* chainId: 1,
|
|
19
|
+
* address: feed,
|
|
20
|
+
* range: "1w",
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
**/
|
|
24
|
+
var PermissionlessAnalytics = class extends require_offchain_AbstractOffchainNamespace.AbstractOffchainNamespace {
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super("PermissionlessAnalytics", {
|
|
27
|
+
...options,
|
|
28
|
+
chainIds: []
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The price one feed reported over a window.
|
|
33
|
+
*
|
|
34
|
+
* Backend-only by construction: the chain serves the present, and
|
|
35
|
+
* reconstructing a series from it would mean an archive read per point.
|
|
36
|
+
*
|
|
37
|
+
* @throws When the PriceFeedStore does not carry the feed. An address the
|
|
38
|
+
* store never held has no indexed history, and answering an empty series
|
|
39
|
+
* would read as "no price yet" rather than as the mistake it is.
|
|
40
|
+
**/
|
|
41
|
+
async priceChart({ chainId, address, range }) {
|
|
42
|
+
return this.getData({
|
|
43
|
+
path: `/pfs/${chainId}/price-feed/${address}/chart`,
|
|
44
|
+
query: { range },
|
|
45
|
+
schema: require_permissionless_api_analytics_schemas.priceFeedChartSchema
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.PermissionlessAnalytics = PermissionlessAnalytics;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_permissionless_api_analytics_PermissionlessAnalytics = require("./PermissionlessAnalytics.js");
|
|
3
|
+
require("./types.js");
|
|
4
|
+
exports.PermissionlessAnalytics = require_permissionless_api_analytics_PermissionlessAnalytics.PermissionlessAnalytics;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_charts = require("../../../model/charts.js");
|
|
3
|
+
let zod_v4 = require("zod/v4");
|
|
4
|
+
//#region src/permissionless/api/analytics/schemas.ts
|
|
5
|
+
/**
|
|
6
|
+
* Runtime schemas for {@link ./types.js}.
|
|
7
|
+
*
|
|
8
|
+
* Loose for the same reason the oracles schemas are: the backend assembles
|
|
9
|
+
* these rows from its own indexes and may report more about a window than the
|
|
10
|
+
* hand-written types declare.
|
|
11
|
+
**/
|
|
12
|
+
/** {@link PriceFeedChartPoint} */
|
|
13
|
+
const priceFeedChartPointSchema = zod_v4.z.looseObject({
|
|
14
|
+
timestamp: zod_v4.z.number(),
|
|
15
|
+
value: zod_v4.z.number()
|
|
16
|
+
});
|
|
17
|
+
/** {@link PriceFeedPriceChart} */
|
|
18
|
+
const priceFeedChartSchema = zod_v4.z.looseObject({
|
|
19
|
+
range: zod_v4.z.enum(require_model_charts.CHART_RANGES),
|
|
20
|
+
from: zod_v4.z.number(),
|
|
21
|
+
to: zod_v4.z.number(),
|
|
22
|
+
intervalSeconds: zod_v4.z.number(),
|
|
23
|
+
points: zod_v4.z.array(priceFeedChartPointSchema)
|
|
24
|
+
});
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.priceFeedChartPointSchema = priceFeedChartPointSchema;
|
|
27
|
+
exports.priceFeedChartSchema = priceFeedChartSchema;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_permissionless_api_analytics_PermissionlessAnalytics = require("./analytics/PermissionlessAnalytics.js");
|
|
3
|
+
require("./analytics/index.js");
|
|
2
4
|
const require_permissionless_api_errors = require("./errors.js");
|
|
3
5
|
const require_permissionless_api_chains_ChainsNamespace = require("./chains/ChainsNamespace.js");
|
|
4
6
|
require("./chains/index.js");
|
|
@@ -17,6 +19,7 @@ exports.GET_PRICES_CHUNK_SIZE = require_permissionless_api_oracles_Permissionles
|
|
|
17
19
|
exports.GET_PRICES_GAS_LIMIT_BY_CHAIN_ID = require_permissionless_api_oracles_PermissionlessOracles.GET_PRICES_GAS_LIMIT_BY_CHAIN_ID;
|
|
18
20
|
exports.GearboxPermissionless = require_permissionless_api_GearboxPermissionless.GearboxPermissionless;
|
|
19
21
|
exports.InstanceOwnerTransactions = require_permissionless_api_transactions_InstanceOwnerTransactions.InstanceOwnerTransactions;
|
|
22
|
+
exports.PermissionlessAnalytics = require_permissionless_api_analytics_PermissionlessAnalytics.PermissionlessAnalytics;
|
|
20
23
|
exports.PermissionlessChainUnreachableError = require_permissionless_api_errors.PermissionlessChainUnreachableError;
|
|
21
24
|
exports.PermissionlessDeploy = require_permissionless_api_deploy_PermissionlessDeploy.PermissionlessDeploy;
|
|
22
25
|
exports.PermissionlessNotAttachedError = require_permissionless_api_errors.PermissionlessNotAttachedError;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_model_opportunities_schema = require("../../../model/opportunities.schema.js");
|
|
2
3
|
const require_offchain_AbstractOffchainNamespace = require("../../../offchain/AbstractOffchainNamespace.js");
|
|
3
4
|
const require_permissionless_utils_price_update_get_prices = require("../../utils/price-update/get-prices.js");
|
|
4
5
|
const require_permissionless_api_oracles_schemas = require("./schemas.js");
|
|
@@ -37,9 +38,77 @@ var PermissionlessOracles = class extends require_offchain_AbstractOffchainNames
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
41
|
+
* One feed of the store: what it is, which assets it may price, and which
|
|
42
|
+
* market slots it currently fills.
|
|
43
|
+
*
|
|
44
|
+
* Singular where {@link store} is plural, and not a filter over it: the
|
|
45
|
+
* store answers what a list renders, while this answers what a feed is used
|
|
46
|
+
* for, which the store does not carry at all.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* const { priceFeed, markets } = await permissionless.oracles.feed({
|
|
50
|
+
* chainId: 1,
|
|
51
|
+
* address: feed,
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @throws When the store does not carry the feed. A private draft is not
|
|
56
|
+
* here — it lives in whichever app wrote it.
|
|
57
|
+
**/
|
|
58
|
+
async feed({ chainId, address }) {
|
|
59
|
+
return this.getData({
|
|
60
|
+
path: `/pfs/${chainId}/price-feed/${address}`,
|
|
61
|
+
schema: require_permissionless_api_oracles_schemas.priceFeedDetailsSchema
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The feeds one feed reads from, recursively.
|
|
66
|
+
*
|
|
67
|
+
* Answers for any feed the chain has indexed, store member or not: a
|
|
68
|
+
* composite feed's children are rarely in the store themselves, and a tree
|
|
69
|
+
* that stopped at the first of them would not be one.
|
|
70
|
+
*
|
|
71
|
+
* ```ts
|
|
72
|
+
* const tree = await permissionless.oracles.dependencies({
|
|
73
|
+
* chainId: 1,
|
|
74
|
+
* address: feed,
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
**/
|
|
78
|
+
async dependencies({ chainId, address }) {
|
|
79
|
+
return this.getData({
|
|
80
|
+
path: `/pfs/${chainId}/price-feed/${address}/graph`,
|
|
81
|
+
schema: require_model_opportunities_schema.priceFeedDataSchema
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* What the market values each of one feed's assets at.
|
|
86
|
+
*
|
|
87
|
+
* Prefer this over {@link prices} whenever the caller is looking at a single
|
|
88
|
+
* feed. That one prices the whole store, which costs the backend one
|
|
89
|
+
* `totalSupply` call per asset of every market on the chain; this costs it
|
|
90
|
+
* one price lookup and one multicall over the feed's own assets.
|
|
91
|
+
*
|
|
92
|
+
* ```ts
|
|
93
|
+
* const { marketCaps } = await permissionless.oracles.feedMarketCaps({
|
|
94
|
+
* chainId: 1,
|
|
95
|
+
* address: feed,
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
**/
|
|
99
|
+
async feedMarketCaps({ chainId, address }) {
|
|
100
|
+
return this.getData({
|
|
101
|
+
path: `/pfs/${chainId}/price-feed/${address}/market-caps`,
|
|
102
|
+
schema: require_permissionless_api_oracles_schemas.priceFeedMarketCapsSchema
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
40
106
|
* A price per feed, and a market cap per feed and asset. The feeds the
|
|
41
107
|
* indexer has not seen are read off the chain by the backend, so the store
|
|
42
108
|
* is priced whole.
|
|
109
|
+
*
|
|
110
|
+
* Chain-wide, and priced accordingly — see {@link feedMarketCaps} for one
|
|
111
|
+
* feed.
|
|
43
112
|
**/
|
|
44
113
|
async prices({ chainId }) {
|
|
45
114
|
return this.getData({
|
|
@@ -44,8 +44,44 @@ const pricesSchema = zod_v4.z.looseObject({
|
|
|
44
44
|
marketCaps: require_permissionless_api_schemas.addressRecord(require_permissionless_api_schemas.addressRecord(zod_v4.z.string().nullable())),
|
|
45
45
|
time: zod_v4.z.number()
|
|
46
46
|
});
|
|
47
|
+
/** {@link PermissionlessPriceFeedAsset} */
|
|
48
|
+
const priceFeedAssetSchema = zod_v4.z.looseObject({
|
|
49
|
+
address: require_permissionless_api_schemas.addressSchema,
|
|
50
|
+
symbol: zod_v4.z.string(),
|
|
51
|
+
name: zod_v4.z.string(),
|
|
52
|
+
decimals: zod_v4.z.number()
|
|
53
|
+
});
|
|
54
|
+
/** {@link PermissionlessPriceFeedMarket} */
|
|
55
|
+
const priceFeedMarketSchema = zod_v4.z.looseObject({
|
|
56
|
+
market: require_permissionless_api_schemas.addressSchema,
|
|
57
|
+
marketConfigurator: require_permissionless_api_schemas.addressSchema,
|
|
58
|
+
curatorName: zod_v4.z.string().nullable(),
|
|
59
|
+
marketName: zod_v4.z.string().nullable(),
|
|
60
|
+
token: require_permissionless_api_schemas.addressSchema,
|
|
61
|
+
tokenSymbol: zod_v4.z.string().nullable(),
|
|
62
|
+
underlyingSymbol: zod_v4.z.string().nullable(),
|
|
63
|
+
reserve: zod_v4.z.boolean(),
|
|
64
|
+
isUnderlying: zod_v4.z.boolean(),
|
|
65
|
+
quotaLimit: zod_v4.z.number().nullable()
|
|
66
|
+
});
|
|
67
|
+
/** {@link PermissionlessPriceFeedDetails} */
|
|
68
|
+
const priceFeedDetailsSchema = zod_v4.z.looseObject({
|
|
69
|
+
chainId: zod_v4.z.number(),
|
|
70
|
+
priceFeed: priceFeedSchema,
|
|
71
|
+
assets: zod_v4.z.array(priceFeedAssetSchema),
|
|
72
|
+
markets: zod_v4.z.array(priceFeedMarketSchema)
|
|
73
|
+
});
|
|
74
|
+
/** {@link PermissionlessPriceFeedMarketCaps} */
|
|
75
|
+
const priceFeedMarketCapsSchema = zod_v4.z.looseObject({
|
|
76
|
+
marketCaps: require_permissionless_api_schemas.addressRecord(zod_v4.z.string().nullable()),
|
|
77
|
+
time: zod_v4.z.number()
|
|
78
|
+
});
|
|
47
79
|
//#endregion
|
|
48
80
|
exports.assetSchema = assetSchema;
|
|
81
|
+
exports.priceFeedAssetSchema = priceFeedAssetSchema;
|
|
82
|
+
exports.priceFeedDetailsSchema = priceFeedDetailsSchema;
|
|
83
|
+
exports.priceFeedMarketCapsSchema = priceFeedMarketCapsSchema;
|
|
84
|
+
exports.priceFeedMarketSchema = priceFeedMarketSchema;
|
|
49
85
|
exports.priceFeedSchema = priceFeedSchema;
|
|
50
86
|
exports.priceFeedStoreSchema = priceFeedStoreSchema;
|
|
51
87
|
exports.pricesSchema = pricesSchema;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_permissionless_api_analytics_PermissionlessAnalytics = require("./api/analytics/PermissionlessAnalytics.js");
|
|
2
3
|
const require_permissionless_api_errors = require("./api/errors.js");
|
|
3
4
|
const require_permissionless_api_chains_ChainsNamespace = require("./api/chains/ChainsNamespace.js");
|
|
4
5
|
const require_permissionless_api_deploy_effective_staleness = require("./api/deploy/effective-staleness.js");
|
|
@@ -68,6 +69,7 @@ exports.MarketConfiguratorContract = require_permissionless_bindings_market_conf
|
|
|
68
69
|
exports.MarketConfiguratorFactoryContract = require_permissionless_bindings_market_configurator_factory.MarketConfiguratorFactoryContract;
|
|
69
70
|
exports.PRICE_FEED_STORE = require_permissionless_utils_literals.PRICE_FEED_STORE;
|
|
70
71
|
exports.PUBLIC_CREATE2_FACTORY = require_permissionless_utils_create2.PUBLIC_CREATE2_FACTORY;
|
|
72
|
+
exports.PermissionlessAnalytics = require_permissionless_api_analytics_PermissionlessAnalytics.PermissionlessAnalytics;
|
|
71
73
|
exports.PermissionlessChainUnreachableError = require_permissionless_api_errors.PermissionlessChainUnreachableError;
|
|
72
74
|
exports.PermissionlessDeploy = require_permissionless_api_deploy_PermissionlessDeploy.PermissionlessDeploy;
|
|
73
75
|
exports.PermissionlessNotAttachedError = require_permissionless_api_errors.PermissionlessNotAttachedError;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PermissionlessAnalytics } from "./analytics/PermissionlessAnalytics.js";
|
|
1
2
|
import { ChainsNamespace } from "./chains/ChainsNamespace.js";
|
|
2
3
|
import { PermissionlessDeploy } from "./deploy/PermissionlessDeploy.js";
|
|
3
4
|
import { PermissionlessOracles } from "./oracles/PermissionlessOracles.js";
|
|
@@ -24,11 +25,11 @@ import { InstanceOwnerTransactions } from "./transactions/InstanceOwnerTransacti
|
|
|
24
25
|
* const store = await permissionless.oracles.store({ chainId: chain.chainId });
|
|
25
26
|
* ```
|
|
26
27
|
*
|
|
27
|
-
* Only what needs a server goes to one. {@link chains}
|
|
28
|
-
* are the backend's reads; {@link deploy} and
|
|
29
|
-
* target chain directly, because everything
|
|
30
|
-
* and a round trip would only move the
|
|
31
|
-
* that has to sign for it.
|
|
28
|
+
* Only what needs a server goes to one. {@link chains}, {@link oracles} and
|
|
29
|
+
* {@link analytics} are the backend's reads; {@link deploy} and
|
|
30
|
+
* {@link transactions} read the target chain directly, because everything
|
|
31
|
+
* they answer is derived from there and a round trip would only move the
|
|
32
|
+
* derivation further from the wallet that has to sign for it.
|
|
32
33
|
**/
|
|
33
34
|
var GearboxPermissionless = class {
|
|
34
35
|
/**
|
|
@@ -41,6 +42,11 @@ var GearboxPermissionless = class {
|
|
|
41
42
|
**/
|
|
42
43
|
oracles;
|
|
43
44
|
/**
|
|
45
|
+
* Namespace for history: what a feed's price did over a window, see
|
|
46
|
+
* {@link PermissionlessAnalytics}.
|
|
47
|
+
**/
|
|
48
|
+
analytics;
|
|
49
|
+
/**
|
|
44
50
|
* Namespace for the Safe batches an instance owner executes. Backend-free,
|
|
45
51
|
* see {@link InstanceOwnerTransactions}.
|
|
46
52
|
**/
|
|
@@ -53,6 +59,7 @@ var GearboxPermissionless = class {
|
|
|
53
59
|
constructor(options = {}) {
|
|
54
60
|
this.chains = new ChainsNamespace(options);
|
|
55
61
|
this.oracles = new PermissionlessOracles(options, this.chains);
|
|
62
|
+
this.analytics = new PermissionlessAnalytics(options);
|
|
56
63
|
this.transactions = new InstanceOwnerTransactions(this.chains, this.oracles);
|
|
57
64
|
this.deploy = new PermissionlessDeploy(this.chains);
|
|
58
65
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
|
|
2
|
+
import { priceFeedChartSchema } from "./schemas.js";
|
|
3
|
+
//#region src/permissionless/api/analytics/PermissionlessAnalytics.ts
|
|
4
|
+
/**
|
|
5
|
+
* History of the permissionless stack: what a thing did, rather than what it
|
|
6
|
+
* is.
|
|
7
|
+
*
|
|
8
|
+
* Separate from {@link PermissionlessOracles} because the two are read on
|
|
9
|
+
* different clocks. A feed's identity settles when a curator uploads it and
|
|
10
|
+
* is read once per page; its price moves every block and is re-read whenever
|
|
11
|
+
* a window changes. Folding the series into the feed would make every range
|
|
12
|
+
* switch re-fetch the identity, and every identity read carry a series the
|
|
13
|
+
* caller may never draw.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const chart = await permissionless.analytics.priceChart({
|
|
17
|
+
* chainId: 1,
|
|
18
|
+
* address: feed,
|
|
19
|
+
* range: "1w",
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
**/
|
|
23
|
+
var PermissionlessAnalytics = class extends AbstractOffchainNamespace {
|
|
24
|
+
constructor(options) {
|
|
25
|
+
super("PermissionlessAnalytics", {
|
|
26
|
+
...options,
|
|
27
|
+
chainIds: []
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The price one feed reported over a window.
|
|
32
|
+
*
|
|
33
|
+
* Backend-only by construction: the chain serves the present, and
|
|
34
|
+
* reconstructing a series from it would mean an archive read per point.
|
|
35
|
+
*
|
|
36
|
+
* @throws When the PriceFeedStore does not carry the feed. An address the
|
|
37
|
+
* store never held has no indexed history, and answering an empty series
|
|
38
|
+
* would read as "no price yet" rather than as the mistake it is.
|
|
39
|
+
**/
|
|
40
|
+
async priceChart({ chainId, address, range }) {
|
|
41
|
+
return this.getData({
|
|
42
|
+
path: `/pfs/${chainId}/price-feed/${address}/chart`,
|
|
43
|
+
query: { range },
|
|
44
|
+
schema: priceFeedChartSchema
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { PermissionlessAnalytics };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CHART_RANGES } from "../../../model/charts.js";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/permissionless/api/analytics/schemas.ts
|
|
4
|
+
/**
|
|
5
|
+
* Runtime schemas for {@link ./types.js}.
|
|
6
|
+
*
|
|
7
|
+
* Loose for the same reason the oracles schemas are: the backend assembles
|
|
8
|
+
* these rows from its own indexes and may report more about a window than the
|
|
9
|
+
* hand-written types declare.
|
|
10
|
+
**/
|
|
11
|
+
/** {@link PriceFeedChartPoint} */
|
|
12
|
+
const priceFeedChartPointSchema = z.looseObject({
|
|
13
|
+
timestamp: z.number(),
|
|
14
|
+
value: z.number()
|
|
15
|
+
});
|
|
16
|
+
/** {@link PriceFeedPriceChart} */
|
|
17
|
+
const priceFeedChartSchema = z.looseObject({
|
|
18
|
+
range: z.enum(CHART_RANGES),
|
|
19
|
+
from: z.number(),
|
|
20
|
+
to: z.number(),
|
|
21
|
+
intervalSeconds: z.number(),
|
|
22
|
+
points: z.array(priceFeedChartPointSchema)
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { priceFeedChartPointSchema, priceFeedChartSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PermissionlessAnalytics } from "./analytics/PermissionlessAnalytics.js";
|
|
2
|
+
import "./analytics/index.js";
|
|
1
3
|
import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./errors.js";
|
|
2
4
|
import { ChainsNamespace } from "./chains/ChainsNamespace.js";
|
|
3
5
|
import "./chains/index.js";
|
|
@@ -10,4 +12,4 @@ import { GearboxPermissionless } from "./GearboxPermissionless.js";
|
|
|
10
12
|
import "./oracles/index.js";
|
|
11
13
|
import "./transactions/index.js";
|
|
12
14
|
import "./types.js";
|
|
13
|
-
export { ChainsNamespace, DEFAULT_DEPLOY_SALT, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, InstanceOwnerTransactions, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
|
|
15
|
+
export { ChainsNamespace, DEFAULT_DEPLOY_SALT, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, InstanceOwnerTransactions, PermissionlessAnalytics, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { priceFeedDataSchema } from "../../../model/opportunities.schema.js";
|
|
1
2
|
import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
|
|
2
3
|
import { getPrices } from "../../utils/price-update/get-prices.js";
|
|
3
|
-
import { priceFeedStoreSchema, pricesSchema } from "./schemas.js";
|
|
4
|
+
import { priceFeedDetailsSchema, priceFeedMarketCapsSchema, priceFeedStoreSchema, pricesSchema } from "./schemas.js";
|
|
4
5
|
//#region src/permissionless/api/oracles/PermissionlessOracles.ts
|
|
5
6
|
const GET_PRICES_GAS_LIMIT_BY_CHAIN_ID = { 143: 100000000n };
|
|
6
7
|
const GET_PRICES_CHUNK_SIZE = 200;
|
|
@@ -36,9 +37,77 @@ var PermissionlessOracles = class extends AbstractOffchainNamespace {
|
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
40
|
+
* One feed of the store: what it is, which assets it may price, and which
|
|
41
|
+
* market slots it currently fills.
|
|
42
|
+
*
|
|
43
|
+
* Singular where {@link store} is plural, and not a filter over it: the
|
|
44
|
+
* store answers what a list renders, while this answers what a feed is used
|
|
45
|
+
* for, which the store does not carry at all.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const { priceFeed, markets } = await permissionless.oracles.feed({
|
|
49
|
+
* chainId: 1,
|
|
50
|
+
* address: feed,
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @throws When the store does not carry the feed. A private draft is not
|
|
55
|
+
* here — it lives in whichever app wrote it.
|
|
56
|
+
**/
|
|
57
|
+
async feed({ chainId, address }) {
|
|
58
|
+
return this.getData({
|
|
59
|
+
path: `/pfs/${chainId}/price-feed/${address}`,
|
|
60
|
+
schema: priceFeedDetailsSchema
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The feeds one feed reads from, recursively.
|
|
65
|
+
*
|
|
66
|
+
* Answers for any feed the chain has indexed, store member or not: a
|
|
67
|
+
* composite feed's children are rarely in the store themselves, and a tree
|
|
68
|
+
* that stopped at the first of them would not be one.
|
|
69
|
+
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* const tree = await permissionless.oracles.dependencies({
|
|
72
|
+
* chainId: 1,
|
|
73
|
+
* address: feed,
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
**/
|
|
77
|
+
async dependencies({ chainId, address }) {
|
|
78
|
+
return this.getData({
|
|
79
|
+
path: `/pfs/${chainId}/price-feed/${address}/graph`,
|
|
80
|
+
schema: priceFeedDataSchema
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* What the market values each of one feed's assets at.
|
|
85
|
+
*
|
|
86
|
+
* Prefer this over {@link prices} whenever the caller is looking at a single
|
|
87
|
+
* feed. That one prices the whole store, which costs the backend one
|
|
88
|
+
* `totalSupply` call per asset of every market on the chain; this costs it
|
|
89
|
+
* one price lookup and one multicall over the feed's own assets.
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* const { marketCaps } = await permissionless.oracles.feedMarketCaps({
|
|
93
|
+
* chainId: 1,
|
|
94
|
+
* address: feed,
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
**/
|
|
98
|
+
async feedMarketCaps({ chainId, address }) {
|
|
99
|
+
return this.getData({
|
|
100
|
+
path: `/pfs/${chainId}/price-feed/${address}/market-caps`,
|
|
101
|
+
schema: priceFeedMarketCapsSchema
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
39
105
|
* A price per feed, and a market cap per feed and asset. The feeds the
|
|
40
106
|
* indexer has not seen are read off the chain by the backend, so the store
|
|
41
107
|
* is priced whole.
|
|
108
|
+
*
|
|
109
|
+
* Chain-wide, and priced accordingly — see {@link feedMarketCaps} for one
|
|
110
|
+
* feed.
|
|
42
111
|
**/
|
|
43
112
|
async prices({ chainId }) {
|
|
44
113
|
return this.getData({
|
|
@@ -43,5 +43,37 @@ const pricesSchema = z.looseObject({
|
|
|
43
43
|
marketCaps: addressRecord(addressRecord(z.string().nullable())),
|
|
44
44
|
time: z.number()
|
|
45
45
|
});
|
|
46
|
+
/** {@link PermissionlessPriceFeedAsset} */
|
|
47
|
+
const priceFeedAssetSchema = z.looseObject({
|
|
48
|
+
address: addressSchema,
|
|
49
|
+
symbol: z.string(),
|
|
50
|
+
name: z.string(),
|
|
51
|
+
decimals: z.number()
|
|
52
|
+
});
|
|
53
|
+
/** {@link PermissionlessPriceFeedMarket} */
|
|
54
|
+
const priceFeedMarketSchema = z.looseObject({
|
|
55
|
+
market: addressSchema,
|
|
56
|
+
marketConfigurator: addressSchema,
|
|
57
|
+
curatorName: z.string().nullable(),
|
|
58
|
+
marketName: z.string().nullable(),
|
|
59
|
+
token: addressSchema,
|
|
60
|
+
tokenSymbol: z.string().nullable(),
|
|
61
|
+
underlyingSymbol: z.string().nullable(),
|
|
62
|
+
reserve: z.boolean(),
|
|
63
|
+
isUnderlying: z.boolean(),
|
|
64
|
+
quotaLimit: z.number().nullable()
|
|
65
|
+
});
|
|
66
|
+
/** {@link PermissionlessPriceFeedDetails} */
|
|
67
|
+
const priceFeedDetailsSchema = z.looseObject({
|
|
68
|
+
chainId: z.number(),
|
|
69
|
+
priceFeed: priceFeedSchema,
|
|
70
|
+
assets: z.array(priceFeedAssetSchema),
|
|
71
|
+
markets: z.array(priceFeedMarketSchema)
|
|
72
|
+
});
|
|
73
|
+
/** {@link PermissionlessPriceFeedMarketCaps} */
|
|
74
|
+
const priceFeedMarketCapsSchema = z.looseObject({
|
|
75
|
+
marketCaps: addressRecord(z.string().nullable()),
|
|
76
|
+
time: z.number()
|
|
77
|
+
});
|
|
46
78
|
//#endregion
|
|
47
|
-
export { assetSchema, priceFeedSchema, priceFeedStoreSchema, pricesSchema };
|
|
79
|
+
export { assetSchema, priceFeedAssetSchema, priceFeedDetailsSchema, priceFeedMarketCapsSchema, priceFeedMarketSchema, priceFeedSchema, priceFeedStoreSchema, pricesSchema };
|
|
@@ -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";
|
|
@@ -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, getPriceUpdateTx, getPrices, getSafeBatch, getSafeBatches, getUpdatablePriceFeeds, handleSalt, normalizeSignature, priceFeedSalt, priceFeedSetupParams, shortenHash, significantTrunc };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GearboxPermissionlessOptions } from "./types.js";
|
|
2
|
+
import { PermissionlessAnalytics } from "./analytics/PermissionlessAnalytics.js";
|
|
2
3
|
import { AttachChainsArgs } from "./chains/types.js";
|
|
3
4
|
import { ChainsNamespace } from "./chains/ChainsNamespace.js";
|
|
4
5
|
import { PermissionlessDeploy } from "./deploy/PermissionlessDeploy.js";
|
|
@@ -26,11 +27,11 @@ import { InstanceOwnerTransactions } from "./transactions/InstanceOwnerTransacti
|
|
|
26
27
|
* const store = await permissionless.oracles.store({ chainId: chain.chainId });
|
|
27
28
|
* ```
|
|
28
29
|
*
|
|
29
|
-
* Only what needs a server goes to one. {@link chains}
|
|
30
|
-
* are the backend's reads; {@link deploy} and
|
|
31
|
-
* target chain directly, because everything
|
|
32
|
-
* and a round trip would only move the
|
|
33
|
-
* that has to sign for it.
|
|
30
|
+
* Only what needs a server goes to one. {@link chains}, {@link oracles} and
|
|
31
|
+
* {@link analytics} are the backend's reads; {@link deploy} and
|
|
32
|
+
* {@link transactions} read the target chain directly, because everything
|
|
33
|
+
* they answer is derived from there and a round trip would only move the
|
|
34
|
+
* derivation further from the wallet that has to sign for it.
|
|
34
35
|
**/
|
|
35
36
|
export declare class GearboxPermissionless {
|
|
36
37
|
/**
|
|
@@ -42,6 +43,11 @@ export declare class GearboxPermissionless {
|
|
|
42
43
|
* Namespace for price feeds: the store and its prices.
|
|
43
44
|
**/
|
|
44
45
|
readonly oracles: PermissionlessOracles;
|
|
46
|
+
/**
|
|
47
|
+
* Namespace for history: what a feed's price did over a window, see
|
|
48
|
+
* {@link PermissionlessAnalytics}.
|
|
49
|
+
**/
|
|
50
|
+
readonly analytics: PermissionlessAnalytics;
|
|
45
51
|
/**
|
|
46
52
|
* Namespace for the Safe batches an instance owner executes. Backend-free,
|
|
47
53
|
* see {@link InstanceOwnerTransactions}.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
|
|
2
|
+
import { GearboxPermissionlessOptions } from "../types.js";
|
|
3
|
+
import { PriceChartArgs, PriceFeedPriceChart } from "./types.js";
|
|
4
|
+
//#region src/permissionless/api/analytics/PermissionlessAnalytics.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* History of the permissionless stack: what a thing did, rather than what it
|
|
7
|
+
* is.
|
|
8
|
+
*
|
|
9
|
+
* Separate from {@link PermissionlessOracles} because the two are read on
|
|
10
|
+
* different clocks. A feed's identity settles when a curator uploads it and
|
|
11
|
+
* is read once per page; its price moves every block and is re-read whenever
|
|
12
|
+
* a window changes. Folding the series into the feed would make every range
|
|
13
|
+
* switch re-fetch the identity, and every identity read carry a series the
|
|
14
|
+
* caller may never draw.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const chart = await permissionless.analytics.priceChart({
|
|
18
|
+
* chainId: 1,
|
|
19
|
+
* address: feed,
|
|
20
|
+
* range: "1w",
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
**/
|
|
24
|
+
export declare class PermissionlessAnalytics extends AbstractOffchainNamespace {
|
|
25
|
+
constructor(options: GearboxPermissionlessOptions);
|
|
26
|
+
/**
|
|
27
|
+
* The price one feed reported over a window.
|
|
28
|
+
*
|
|
29
|
+
* Backend-only by construction: the chain serves the present, and
|
|
30
|
+
* reconstructing a series from it would mean an archive read per point.
|
|
31
|
+
*
|
|
32
|
+
* @throws When the PriceFeedStore does not carry the feed. An address the
|
|
33
|
+
* store never held has no indexed history, and answering an empty series
|
|
34
|
+
* would read as "no price yet" rather than as the mistake it is.
|
|
35
|
+
**/
|
|
36
|
+
priceChart({ chainId, address, range }: PriceChartArgs): Promise<PriceFeedPriceChart>;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
//#region src/permissionless/api/analytics/schemas.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Runtime schemas for {@link ./types.js}.
|
|
5
|
+
*
|
|
6
|
+
* Loose for the same reason the oracles schemas are: the backend assembles
|
|
7
|
+
* these rows from its own indexes and may report more about a window than the
|
|
8
|
+
* hand-written types declare.
|
|
9
|
+
**/
|
|
10
|
+
/** {@link PriceFeedChartPoint} */
|
|
11
|
+
export declare const priceFeedChartPointSchema: z.ZodObject<{
|
|
12
|
+
timestamp: z.ZodNumber;
|
|
13
|
+
value: z.ZodNumber;
|
|
14
|
+
}, z.core.$loose>;
|
|
15
|
+
/** {@link PriceFeedPriceChart} */
|
|
16
|
+
export declare const priceFeedChartSchema: z.ZodObject<{
|
|
17
|
+
range: z.ZodEnum<{
|
|
18
|
+
"1d": "1d";
|
|
19
|
+
"1m": "1m";
|
|
20
|
+
"1w": "1w";
|
|
21
|
+
"1y": "1y";
|
|
22
|
+
max: "max";
|
|
23
|
+
}>;
|
|
24
|
+
from: z.ZodNumber;
|
|
25
|
+
to: z.ZodNumber;
|
|
26
|
+
intervalSeconds: z.ZodNumber;
|
|
27
|
+
points: z.ZodArray<z.ZodObject<{
|
|
28
|
+
timestamp: z.ZodNumber;
|
|
29
|
+
value: z.ZodNumber;
|
|
30
|
+
}, z.core.$loose>>;
|
|
31
|
+
}, z.core.$loose>;
|
|
32
|
+
//#endregion
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Timestamp } from "../../../model/primitives.js";
|
|
2
|
+
import { ChartRange } from "../../../model/charts.js";
|
|
3
|
+
import { Address } from "viem";
|
|
4
|
+
//#region src/permissionless/api/analytics/types.d.ts
|
|
5
|
+
/** One sampled price, in whole US dollars. */
|
|
6
|
+
export interface PriceFeedChartPoint {
|
|
7
|
+
timestamp: Timestamp;
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A feed's price over one window, sampled onto an epoch-aligned grid.
|
|
12
|
+
*
|
|
13
|
+
* Only the buckets with an observation are present: a gap is an absent point,
|
|
14
|
+
* never a zero and never a value carried over from a neighbour. The window is
|
|
15
|
+
* echoed back because `max` resolves against the feed's own first observation
|
|
16
|
+
* and is therefore not derivable from the range alone.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately not a {@link ChartBundle}. A bundle carries one series per
|
|
19
|
+
* {@link ChartMetric}, and that union is closed over what the read model
|
|
20
|
+
* charts — a price feed's own price is not one of them, and widening it would
|
|
21
|
+
* reach every chart the protocol serves to add a series only this page draws.
|
|
22
|
+
**/
|
|
23
|
+
export interface PriceFeedPriceChart {
|
|
24
|
+
range: ChartRange;
|
|
25
|
+
from: Timestamp;
|
|
26
|
+
to: Timestamp;
|
|
27
|
+
/** Distance between two consecutive buckets. */
|
|
28
|
+
intervalSeconds: number;
|
|
29
|
+
points: PriceFeedChartPoint[];
|
|
30
|
+
}
|
|
31
|
+
/** Args of {@link PermissionlessAnalytics.priceChart}. */
|
|
32
|
+
export interface PriceChartArgs {
|
|
33
|
+
chainId: number;
|
|
34
|
+
address: Address;
|
|
35
|
+
/** Window to cover. The same set every other Gearbox chart offers. */
|
|
36
|
+
range: ChartRange;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { GearboxPermissionlessOptions } from "./types.js";
|
|
2
|
+
import { PriceChartArgs, PriceFeedChartPoint, PriceFeedPriceChart } from "./analytics/types.js";
|
|
3
|
+
import { PermissionlessAnalytics } from "./analytics/PermissionlessAnalytics.js";
|
|
2
4
|
import { AttachChainsArgs, ChainScope, ChainSummaryArgs, PermissionlessChain, PermissionlessChainSummary } from "./chains/types.js";
|
|
3
5
|
import { ChainsNamespace } from "./chains/ChainsNamespace.js";
|
|
4
6
|
import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./deploy/types.js";
|
|
5
7
|
import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./deploy/PermissionlessDeploy.js";
|
|
6
|
-
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./oracles/types.js";
|
|
8
|
+
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs } from "./oracles/types.js";
|
|
7
9
|
import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./oracles/PermissionlessOracles.js";
|
|
8
10
|
import { AddFeedsArgs, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ForbidFeedsArgs, InstanceTxsArgs, PriceFeedPair } from "./transactions/types.js";
|
|
9
11
|
import { InstanceOwnerTransactions } from "./transactions/InstanceOwnerTransactions.js";
|
|
10
12
|
import { GearboxPermissionless } from "./GearboxPermissionless.js";
|
|
13
|
+
import "./analytics/index.js";
|
|
11
14
|
import "./chains/index.js";
|
|
12
15
|
import { deriveEffectiveStalenessPeriod } from "./deploy/effective-staleness.js";
|
|
13
16
|
import "./deploy/index.js";
|
|
14
17
|
import { PermissionlessChainUnreachableError, PermissionlessNotAttachedError, PriceFeedNotInStoreError, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError } from "./errors.js";
|
|
15
18
|
import "./oracles/index.js";
|
|
16
19
|
import "./transactions/index.js";
|
|
17
|
-
export { AddFeedsArgs, AttachChainsArgs, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, InstanceOwnerTransactions, InstanceTxsArgs, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
|
|
20
|
+
export { AddFeedsArgs, AttachChainsArgs, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployPriceFeedArgs, ForbidFeedsArgs, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, InstanceOwnerTransactions, InstanceTxsArgs, PermissionlessAnalytics, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeedArgs, PriceFeedChartPoint, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedPriceChart, PriceFeedSaltMissingError, PriceFeedStalenessUnknownError, deriveEffectiveStalenessPeriod, priceFeedSalt };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { PriceFeedData } from "../../../model/opportunities.js";
|
|
1
2
|
import { AbstractOffchainNamespace } from "../../../offchain/AbstractOffchainNamespace.js";
|
|
2
3
|
import { GearboxPermissionlessOptions } from "../types.js";
|
|
3
4
|
import { ChainsNamespace } from "../chains/ChainsNamespace.js";
|
|
4
|
-
import { GetPricesArgs, PermissionlessPriceFeedStore, PermissionlessPrices } from "./types.js";
|
|
5
|
+
import { GetPricesArgs, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs } from "./types.js";
|
|
5
6
|
import { Address } from "viem";
|
|
6
7
|
//#region src/permissionless/api/oracles/PermissionlessOracles.d.ts
|
|
7
8
|
export declare const GET_PRICES_GAS_LIMIT_BY_CHAIN_ID: Record<number, bigint>;
|
|
@@ -28,10 +29,63 @@ export declare class PermissionlessOracles extends AbstractOffchainNamespace {
|
|
|
28
29
|
store({ chainId }: {
|
|
29
30
|
chainId: number;
|
|
30
31
|
}): Promise<PermissionlessPriceFeedStore>;
|
|
32
|
+
/**
|
|
33
|
+
* One feed of the store: what it is, which assets it may price, and which
|
|
34
|
+
* market slots it currently fills.
|
|
35
|
+
*
|
|
36
|
+
* Singular where {@link store} is plural, and not a filter over it: the
|
|
37
|
+
* store answers what a list renders, while this answers what a feed is used
|
|
38
|
+
* for, which the store does not carry at all.
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* const { priceFeed, markets } = await permissionless.oracles.feed({
|
|
42
|
+
* chainId: 1,
|
|
43
|
+
* address: feed,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @throws When the store does not carry the feed. A private draft is not
|
|
48
|
+
* here — it lives in whichever app wrote it.
|
|
49
|
+
**/
|
|
50
|
+
feed({ chainId, address }: PriceFeedArgs): Promise<PermissionlessPriceFeedDetails>;
|
|
51
|
+
/**
|
|
52
|
+
* The feeds one feed reads from, recursively.
|
|
53
|
+
*
|
|
54
|
+
* Answers for any feed the chain has indexed, store member or not: a
|
|
55
|
+
* composite feed's children are rarely in the store themselves, and a tree
|
|
56
|
+
* that stopped at the first of them would not be one.
|
|
57
|
+
*
|
|
58
|
+
* ```ts
|
|
59
|
+
* const tree = await permissionless.oracles.dependencies({
|
|
60
|
+
* chainId: 1,
|
|
61
|
+
* address: feed,
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
**/
|
|
65
|
+
dependencies({ chainId, address }: PriceFeedArgs): Promise<PriceFeedData>;
|
|
66
|
+
/**
|
|
67
|
+
* What the market values each of one feed's assets at.
|
|
68
|
+
*
|
|
69
|
+
* Prefer this over {@link prices} whenever the caller is looking at a single
|
|
70
|
+
* feed. That one prices the whole store, which costs the backend one
|
|
71
|
+
* `totalSupply` call per asset of every market on the chain; this costs it
|
|
72
|
+
* one price lookup and one multicall over the feed's own assets.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* const { marketCaps } = await permissionless.oracles.feedMarketCaps({
|
|
76
|
+
* chainId: 1,
|
|
77
|
+
* address: feed,
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
**/
|
|
81
|
+
feedMarketCaps({ chainId, address }: PriceFeedArgs): Promise<PermissionlessPriceFeedMarketCaps>;
|
|
31
82
|
/**
|
|
32
83
|
* A price per feed, and a market cap per feed and asset. The feeds the
|
|
33
84
|
* indexer has not seen are read off the chain by the backend, so the store
|
|
34
85
|
* is priced whole.
|
|
86
|
+
*
|
|
87
|
+
* Chain-wide, and priced accordingly — see {@link feedMarketCaps} for one
|
|
88
|
+
* feed.
|
|
35
89
|
**/
|
|
36
90
|
prices({ chainId }: {
|
|
37
91
|
chainId: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./types.js";
|
|
1
|
+
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs } from "./types.js";
|
|
2
2
|
import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./PermissionlessOracles.js";
|
|
3
|
-
export { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GetPricesArgs, PermissionlessAsset, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices };
|
|
3
|
+
export { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GetPricesArgs, PermissionlessAsset, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs };
|
|
@@ -70,4 +70,59 @@ export declare const pricesSchema: z.ZodObject<{
|
|
|
70
70
|
marketCaps: z.ZodType<Record<`0x${string}`, Record<`0x${string}`, string | null>>, unknown, z.core.$ZodTypeInternals<Record<`0x${string}`, Record<`0x${string}`, string | null>>, unknown>>;
|
|
71
71
|
time: z.ZodNumber;
|
|
72
72
|
}, z.core.$loose>;
|
|
73
|
+
/** {@link PermissionlessPriceFeedAsset} */
|
|
74
|
+
export declare const priceFeedAssetSchema: z.ZodObject<{
|
|
75
|
+
address: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
76
|
+
symbol: z.ZodString;
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
decimals: z.ZodNumber;
|
|
79
|
+
}, z.core.$loose>;
|
|
80
|
+
/** {@link PermissionlessPriceFeedMarket} */
|
|
81
|
+
export declare const priceFeedMarketSchema: z.ZodObject<{
|
|
82
|
+
market: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
83
|
+
marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
84
|
+
curatorName: z.ZodNullable<z.ZodString>;
|
|
85
|
+
marketName: z.ZodNullable<z.ZodString>;
|
|
86
|
+
token: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
87
|
+
tokenSymbol: z.ZodNullable<z.ZodString>;
|
|
88
|
+
underlyingSymbol: z.ZodNullable<z.ZodString>;
|
|
89
|
+
reserve: z.ZodBoolean;
|
|
90
|
+
isUnderlying: z.ZodBoolean;
|
|
91
|
+
quotaLimit: z.ZodNullable<z.ZodNumber>;
|
|
92
|
+
}, z.core.$loose>;
|
|
93
|
+
/** {@link PermissionlessPriceFeedDetails} */
|
|
94
|
+
export declare const priceFeedDetailsSchema: z.ZodObject<{
|
|
95
|
+
chainId: z.ZodNumber;
|
|
96
|
+
priceFeed: z.ZodObject<{
|
|
97
|
+
address: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
98
|
+
contractType: z.ZodString;
|
|
99
|
+
version: z.ZodNumber;
|
|
100
|
+
deployedBy: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
101
|
+
stalenessPeriod: z.ZodNumber;
|
|
102
|
+
name: z.ZodString;
|
|
103
|
+
}, z.core.$loose>;
|
|
104
|
+
assets: z.ZodArray<z.ZodObject<{
|
|
105
|
+
address: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
106
|
+
symbol: z.ZodString;
|
|
107
|
+
name: z.ZodString;
|
|
108
|
+
decimals: z.ZodNumber;
|
|
109
|
+
}, z.core.$loose>>;
|
|
110
|
+
markets: z.ZodArray<z.ZodObject<{
|
|
111
|
+
market: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
112
|
+
marketConfigurator: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
113
|
+
curatorName: z.ZodNullable<z.ZodString>;
|
|
114
|
+
marketName: z.ZodNullable<z.ZodString>;
|
|
115
|
+
token: z.ZodCustom<`0x${string}`, `0x${string}`>;
|
|
116
|
+
tokenSymbol: z.ZodNullable<z.ZodString>;
|
|
117
|
+
underlyingSymbol: z.ZodNullable<z.ZodString>;
|
|
118
|
+
reserve: z.ZodBoolean;
|
|
119
|
+
isUnderlying: z.ZodBoolean;
|
|
120
|
+
quotaLimit: z.ZodNullable<z.ZodNumber>;
|
|
121
|
+
}, z.core.$loose>>;
|
|
122
|
+
}, z.core.$loose>;
|
|
123
|
+
/** {@link PermissionlessPriceFeedMarketCaps} */
|
|
124
|
+
export declare const priceFeedMarketCapsSchema: z.ZodObject<{
|
|
125
|
+
marketCaps: z.ZodType<Record<`0x${string}`, string | null>, unknown, z.core.$ZodTypeInternals<Record<`0x${string}`, string | null>, unknown>>;
|
|
126
|
+
time: z.ZodNumber;
|
|
127
|
+
}, z.core.$loose>;
|
|
73
128
|
//#endregion
|
|
@@ -37,6 +37,98 @@ export interface PermissionlessPrices {
|
|
|
37
37
|
marketCaps: Record<Address, Record<Address, string | null>>;
|
|
38
38
|
time: number;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* An asset the PriceFeedStore currently allows one feed to price.
|
|
42
|
+
*
|
|
43
|
+
* Narrower than {@link PermissionlessAsset} on purpose: this hangs off the
|
|
44
|
+
* feed, so listing the feeds allowed for it would just name the feed back.
|
|
45
|
+
**/
|
|
46
|
+
export interface PermissionlessPriceFeedAsset {
|
|
47
|
+
address: Address;
|
|
48
|
+
symbol: string;
|
|
49
|
+
name: string;
|
|
50
|
+
decimals: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* One token a market prices with the feed.
|
|
54
|
+
*
|
|
55
|
+
* A row per `(market, token, role)` rather than per market: the same feed can
|
|
56
|
+
* be the main feed of one token and the reserve feed of another in the very
|
|
57
|
+
* same market, and both are reported.
|
|
58
|
+
**/
|
|
59
|
+
export interface PermissionlessPriceFeedMarket {
|
|
60
|
+
market: Address;
|
|
61
|
+
marketConfigurator: Address;
|
|
62
|
+
/** The configurator's own name, as the backend's sync recorded it. */
|
|
63
|
+
curatorName: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* The market's own name, which is the name of its pool token — what the rest
|
|
66
|
+
* of the backend calls a market by as well.
|
|
67
|
+
*/
|
|
68
|
+
marketName: string | null;
|
|
69
|
+
token: Address;
|
|
70
|
+
/** `null` for a token the backend has no metadata row for. */
|
|
71
|
+
tokenSymbol: string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Symbol of the market's underlying, which is both what the market is
|
|
74
|
+
* pictured by and what its quota limit is denominated in.
|
|
75
|
+
*/
|
|
76
|
+
underlyingSymbol: string | null;
|
|
77
|
+
/** The feed is the market's reserve feed for this token, not its main one. */
|
|
78
|
+
reserve: boolean;
|
|
79
|
+
/** The token is the market's underlying. */
|
|
80
|
+
isUnderlying: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* What the pool will take of this token, in units of the market's
|
|
83
|
+
* underlying.
|
|
84
|
+
*
|
|
85
|
+
* `null` for a token the quota keeper was never told a limit for, which the
|
|
86
|
+
* market's own underlying always is — it is not quota-managed. A zero is a
|
|
87
|
+
* limit the curator has actually set to zero, and the two are different
|
|
88
|
+
* answers.
|
|
89
|
+
*/
|
|
90
|
+
quotaLimit: number | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* One feed of the store, with everywhere the store lets it be used.
|
|
94
|
+
*
|
|
95
|
+
* Feeds a tree carries but the store never added have no identity to report —
|
|
96
|
+
* no status history, hence no name or staleness — so the read throws for them
|
|
97
|
+
* rather than answering a half-filled row.
|
|
98
|
+
**/
|
|
99
|
+
export interface PermissionlessPriceFeedDetails {
|
|
100
|
+
chainId: number;
|
|
101
|
+
priceFeed: PriceFeed;
|
|
102
|
+
assets: PermissionlessPriceFeedAsset[];
|
|
103
|
+
/**
|
|
104
|
+
* Ordered by curator, then by market, then by role with the main feeds
|
|
105
|
+
* ahead of the reserve ones — the grouping a reader wants, so a caller
|
|
106
|
+
* rendering a table does not have to sort it again.
|
|
107
|
+
*/
|
|
108
|
+
markets: PermissionlessPriceFeedMarket[];
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Market caps of one feed's assets, keyed by the lowercased asset address.
|
|
112
|
+
*
|
|
113
|
+
* Scoped to the feed rather than to the chain, which is what
|
|
114
|
+
* {@link PermissionlessOracles.prices} answers. A cap is
|
|
115
|
+
* `price × totalSupply`, so the chain-wide read pays for one `totalSupply` per
|
|
116
|
+
* asset of every market on it; a screen showing one feed's handful of rows
|
|
117
|
+
* should not.
|
|
118
|
+
*
|
|
119
|
+
* `null` for an asset whose price or supply could not be read — not a zero,
|
|
120
|
+
* since an asset nobody could price is not an asset worth nothing.
|
|
121
|
+
*/
|
|
122
|
+
export interface PermissionlessPriceFeedMarketCaps {
|
|
123
|
+
marketCaps: Record<Address, string | null>;
|
|
124
|
+
/** When the backend computed the figures; they are read live, not indexed. */
|
|
125
|
+
time: number;
|
|
126
|
+
}
|
|
127
|
+
/** Args of a read scoped to one feed. */
|
|
128
|
+
export interface PriceFeedArgs {
|
|
129
|
+
chainId: number;
|
|
130
|
+
address: Address;
|
|
131
|
+
}
|
|
40
132
|
/** Args of {@link PermissionlessOracles.getPrices}. */
|
|
41
133
|
export interface GetPricesArgs {
|
|
42
134
|
chainId: number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { GearboxPermissionlessOptions } from "./api/types.js";
|
|
2
|
+
import { PriceChartArgs, PriceFeedChartPoint, PriceFeedPriceChart } from "./api/analytics/types.js";
|
|
3
|
+
import { PermissionlessAnalytics } from "./api/analytics/PermissionlessAnalytics.js";
|
|
2
4
|
import { AttachChainsArgs, ChainScope, ChainSummaryArgs, PermissionlessChain, PermissionlessChainSummary } from "./api/chains/types.js";
|
|
3
5
|
import { ChainsNamespace } from "./api/chains/ChainsNamespace.js";
|
|
4
6
|
import { Auditor } from "./core/auditor.js";
|
|
@@ -11,7 +13,7 @@ import "./core/index.js";
|
|
|
11
13
|
import { FunctionParams, ValueParams, encodeFunctionParams } from "./utils/abi-encoder.js";
|
|
12
14
|
import { DeployArgs, DeployContractArgs, DeployPriceFeedArgs, PreparedDeployment, PreparedPriceFeedDeployment } from "./api/deploy/types.js";
|
|
13
15
|
import { DEFAULT_DEPLOY_SALT, PermissionlessDeploy, priceFeedSalt } from "./api/deploy/PermissionlessDeploy.js";
|
|
14
|
-
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedStore, PermissionlessPrices } from "./api/oracles/types.js";
|
|
16
|
+
import { GetPricesArgs, PermissionlessAsset, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PriceFeedArgs } from "./api/oracles/types.js";
|
|
15
17
|
import { GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, PermissionlessOracles } from "./api/oracles/PermissionlessOracles.js";
|
|
16
18
|
import { AddressProviderContract } from "./bindings/address-provider.js";
|
|
17
19
|
import { BytecodeRepositoryContract } from "./bindings/bytecode-repository.js";
|
|
@@ -52,4 +54,4 @@ import { getPrices } from "./utils/price-update/get-prices.js";
|
|
|
52
54
|
import { GetUpdatablePriceFeedsArgs, getUpdatablePriceFeeds } from "./utils/price-update/get-updatable-feeds.js";
|
|
53
55
|
import { normalizeSignature } from "./utils/signature.js";
|
|
54
56
|
import "./utils/index.js";
|
|
55
|
-
export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, GetUpdatablePriceFeedsArgs, GovernorContract, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceFeed, PriceFeedConstructorParam, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, ValueParams, 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 };
|
|
57
|
+
export { AccessMode, AddAssetParams, AddFeedsArgs, AddressProviderContract, Addresses, AllowTokenParams, ArchiveTransport, ArchiveTransportConfig, AttachChainsArgs, AuditEvent, Auditor, BYTECODE_REPOSITORY, Batch, Bytecode, BytecodeRepositoryContract, CCMConstructorParams, CROSS_CHAIN_GOVERNANCE, CROSS_CHAIN_MULTISIG, ChainScope, ChainSummaryArgs, ChainsNamespace, ChangeNamesArgs, ChangeStalenessPeriodsArgs, ConstructorParams, CreditManagerFees, CrossChainCall, CrossChainMultisigContract, DEFAULT_DEPLOY_SALT, DeployArgs, DeployContractArgs, DeployParams, DeployPriceFeedArgs, Deployment, DeploymentExtended, ForbidAdapterParams, ForbidFeedsArgs, ForbidTokenParams, FunctionParams, GET_PRICES_CHUNK_SIZE, GET_PRICES_GAS_LIMIT_BY_CHAIN_ID, GearboxPermissionless, GearboxPermissionlessOptions, GetPricesArgs, GetUpdatablePriceFeedsArgs, GovernorContract, INSTANCE_MANAGER, InputValueParams, InstanceManagerContract, InstanceOwnerTransactions, InstanceTxs, InstanceTxsArgs, MAINNET_CCM_CONSTRUCTOR_PARAMS, MAINNET_DEPLOYMENT_BLOCK, MAINNET_DEPLOYMENT_CCM_SALT, MAINNET_DEPLOYMENT_IM_SALT, MARKET_CONFIGURATOR_FACTORY, Market, MarketConfiguratorContract, MarketConfiguratorFactoryContract, PRICE_FEED_STORE, PUBLIC_CREATE2_FACTORY, PauseCreditManagerParams, PeripheryDomain, PermissionlessAnalytics, PermissionlessAsset, PermissionlessChain, PermissionlessChainSummary, PermissionlessChainUnreachableError, PermissionlessDeploy, PermissionlessNotAttachedError, PermissionlessOracles, PermissionlessPriceFeedAsset, PermissionlessPriceFeedDetails, PermissionlessPriceFeedMarket, PermissionlessPriceFeedMarketCaps, PermissionlessPriceFeedStore, PermissionlessPrices, PreparedDeployment, PreparedPriceFeedDeployment, PriceChartArgs, PriceFeed, PriceFeedArgs, PriceFeedChartPoint, PriceFeedConstructorParam, PriceFeedNotInStoreError, PriceFeedPair, PriceFeedParamType, PriceFeedParams, PriceFeedPriceChart, PriceFeedSaltMissingError, PriceFeedSetupParams, PriceFeedStalenessUnknownError, PriceFeedStoreContract, Proposal, QueuedAndExecutedTransaction, RecoveryMessage, RoutingManagerContract, SafeBatch, SafeMeta, SafeTx, SetExpirationDateParams, SetFeesParams, SetPriceFeedParams, SetReservePriceFeedParams, SetTokenQuotaIncreaseFeeParams, Signature, TOKEN_COMPRESSOR, TimeLockContract, TimelockTransaction, TimelockTxParams, TimelockTxs, TokenCompressorContract, TreasurySplitterContract, UnpauseCreditManagerParams, ValueParams, 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 };
|