@gearbox-protocol/sdk 3.0.0-vfour.78 → 3.0.0-vfour.79
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/sdk/index.cjs +17 -10
- package/dist/esm/sdk/index.mjs +17 -10
- package/package.json +1 -1
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -21204,13 +21204,13 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
21204
21204
|
var RedstoneUpdater = class extends SDKConstruct {
|
|
21205
21205
|
#logger;
|
|
21206
21206
|
#cache = /* @__PURE__ */ new Map();
|
|
21207
|
-
#
|
|
21207
|
+
#historicalTimestampMs;
|
|
21208
21208
|
constructor(sdk) {
|
|
21209
21209
|
super(sdk);
|
|
21210
21210
|
this.#logger = childLogger("RedstoneUpdater", sdk.logger);
|
|
21211
21211
|
}
|
|
21212
|
-
setHistoricalTimestamp(
|
|
21213
|
-
this.#
|
|
21212
|
+
setHistoricalTimestamp(timestampMs) {
|
|
21213
|
+
this.#historicalTimestampMs = 6e4 * Math.floor(timestampMs / 6e4);
|
|
21214
21214
|
}
|
|
21215
21215
|
async getUpdateTxs(feeds) {
|
|
21216
21216
|
this.#logger?.debug(
|
|
@@ -21275,10 +21275,10 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21275
21275
|
dataServiceId,
|
|
21276
21276
|
dataFeedId,
|
|
21277
21277
|
uniqueSignersCount,
|
|
21278
|
-
this.#
|
|
21278
|
+
this.#historicalTimestampMs
|
|
21279
21279
|
);
|
|
21280
21280
|
const cached = this.#cache.get(key);
|
|
21281
|
-
if (this.#
|
|
21281
|
+
if (this.#historicalTimestampMs && !!cached) {
|
|
21282
21282
|
fromCache.push(cached);
|
|
21283
21283
|
} else {
|
|
21284
21284
|
uncached.push(dataFeedId);
|
|
@@ -21289,13 +21289,13 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21289
21289
|
new Set(uncached),
|
|
21290
21290
|
uniqueSignersCount
|
|
21291
21291
|
);
|
|
21292
|
-
if (this.#
|
|
21292
|
+
if (this.#historicalTimestampMs) {
|
|
21293
21293
|
for (const resp of fromRedstone) {
|
|
21294
21294
|
const key = cacheKey(
|
|
21295
21295
|
dataServiceId,
|
|
21296
21296
|
resp.dataFeedId,
|
|
21297
21297
|
uniqueSignersCount,
|
|
21298
|
-
this.#
|
|
21298
|
+
this.#historicalTimestampMs
|
|
21299
21299
|
);
|
|
21300
21300
|
this.#cache.set(key, resp);
|
|
21301
21301
|
}
|
|
@@ -21318,7 +21318,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21318
21318
|
return [];
|
|
21319
21319
|
}
|
|
21320
21320
|
const dataPackagesIds = Array.from(dataFeedsIds);
|
|
21321
|
-
const tsStr = this.#
|
|
21321
|
+
const tsStr = this.#historicalTimestampMs ? ` with historical timestamp ${this.#historicalTimestampMs}` : "";
|
|
21322
21322
|
this.#logger?.debug(
|
|
21323
21323
|
`fetching redstone payloads for ${dataFeedsIds.size} data feeds in ${dataServiceId} with ${uniqueSignersCount} signers: ${dataPackagesIds.join(", ")}${tsStr}`
|
|
21324
21324
|
);
|
|
@@ -21326,7 +21326,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21326
21326
|
dataServiceId,
|
|
21327
21327
|
dataPackagesIds,
|
|
21328
21328
|
uniqueSignersCount,
|
|
21329
|
-
historicalTimestamp: this.#
|
|
21329
|
+
historicalTimestamp: this.#historicalTimestampMs
|
|
21330
21330
|
});
|
|
21331
21331
|
const dataPayload = await wrapper.prepareRedstonePayload(true);
|
|
21332
21332
|
const parsed = redstoneProtocol.RedstonePayload.parse(viem.toBytes(`0x${dataPayload}`));
|
|
@@ -23247,7 +23247,14 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
23247
23247
|
if (redstoneHistoricTimestamp) {
|
|
23248
23248
|
this.priceFeeds.setRedstoneHistoricalTimestamp(redstoneHistoricTimestamp);
|
|
23249
23249
|
}
|
|
23250
|
-
this.logger?.info(
|
|
23250
|
+
this.logger?.info(
|
|
23251
|
+
{
|
|
23252
|
+
addressProvider,
|
|
23253
|
+
blockNumber: block.number,
|
|
23254
|
+
timestamp: block.timestamp
|
|
23255
|
+
},
|
|
23256
|
+
"attaching"
|
|
23257
|
+
);
|
|
23251
23258
|
this.#addressProvider = new AddressProviderContractV3_1(
|
|
23252
23259
|
this,
|
|
23253
23260
|
addressProvider
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -21202,13 +21202,13 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
21202
21202
|
var RedstoneUpdater = class extends SDKConstruct {
|
|
21203
21203
|
#logger;
|
|
21204
21204
|
#cache = /* @__PURE__ */ new Map();
|
|
21205
|
-
#
|
|
21205
|
+
#historicalTimestampMs;
|
|
21206
21206
|
constructor(sdk) {
|
|
21207
21207
|
super(sdk);
|
|
21208
21208
|
this.#logger = childLogger("RedstoneUpdater", sdk.logger);
|
|
21209
21209
|
}
|
|
21210
|
-
setHistoricalTimestamp(
|
|
21211
|
-
this.#
|
|
21210
|
+
setHistoricalTimestamp(timestampMs) {
|
|
21211
|
+
this.#historicalTimestampMs = 6e4 * Math.floor(timestampMs / 6e4);
|
|
21212
21212
|
}
|
|
21213
21213
|
async getUpdateTxs(feeds) {
|
|
21214
21214
|
this.#logger?.debug(
|
|
@@ -21273,10 +21273,10 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21273
21273
|
dataServiceId,
|
|
21274
21274
|
dataFeedId,
|
|
21275
21275
|
uniqueSignersCount,
|
|
21276
|
-
this.#
|
|
21276
|
+
this.#historicalTimestampMs
|
|
21277
21277
|
);
|
|
21278
21278
|
const cached = this.#cache.get(key);
|
|
21279
|
-
if (this.#
|
|
21279
|
+
if (this.#historicalTimestampMs && !!cached) {
|
|
21280
21280
|
fromCache.push(cached);
|
|
21281
21281
|
} else {
|
|
21282
21282
|
uncached.push(dataFeedId);
|
|
@@ -21287,13 +21287,13 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21287
21287
|
new Set(uncached),
|
|
21288
21288
|
uniqueSignersCount
|
|
21289
21289
|
);
|
|
21290
|
-
if (this.#
|
|
21290
|
+
if (this.#historicalTimestampMs) {
|
|
21291
21291
|
for (const resp of fromRedstone) {
|
|
21292
21292
|
const key = cacheKey(
|
|
21293
21293
|
dataServiceId,
|
|
21294
21294
|
resp.dataFeedId,
|
|
21295
21295
|
uniqueSignersCount,
|
|
21296
|
-
this.#
|
|
21296
|
+
this.#historicalTimestampMs
|
|
21297
21297
|
);
|
|
21298
21298
|
this.#cache.set(key, resp);
|
|
21299
21299
|
}
|
|
@@ -21316,7 +21316,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21316
21316
|
return [];
|
|
21317
21317
|
}
|
|
21318
21318
|
const dataPackagesIds = Array.from(dataFeedsIds);
|
|
21319
|
-
const tsStr = this.#
|
|
21319
|
+
const tsStr = this.#historicalTimestampMs ? ` with historical timestamp ${this.#historicalTimestampMs}` : "";
|
|
21320
21320
|
this.#logger?.debug(
|
|
21321
21321
|
`fetching redstone payloads for ${dataFeedsIds.size} data feeds in ${dataServiceId} with ${uniqueSignersCount} signers: ${dataPackagesIds.join(", ")}${tsStr}`
|
|
21322
21322
|
);
|
|
@@ -21324,7 +21324,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
21324
21324
|
dataServiceId,
|
|
21325
21325
|
dataPackagesIds,
|
|
21326
21326
|
uniqueSignersCount,
|
|
21327
|
-
historicalTimestamp: this.#
|
|
21327
|
+
historicalTimestamp: this.#historicalTimestampMs
|
|
21328
21328
|
});
|
|
21329
21329
|
const dataPayload = await wrapper.prepareRedstonePayload(true);
|
|
21330
21330
|
const parsed = RedstonePayload.parse(toBytes(`0x${dataPayload}`));
|
|
@@ -23245,7 +23245,14 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
23245
23245
|
if (redstoneHistoricTimestamp) {
|
|
23246
23246
|
this.priceFeeds.setRedstoneHistoricalTimestamp(redstoneHistoricTimestamp);
|
|
23247
23247
|
}
|
|
23248
|
-
this.logger?.info(
|
|
23248
|
+
this.logger?.info(
|
|
23249
|
+
{
|
|
23250
|
+
addressProvider,
|
|
23251
|
+
blockNumber: block.number,
|
|
23252
|
+
timestamp: block.timestamp
|
|
23253
|
+
},
|
|
23254
|
+
"attaching"
|
|
23255
|
+
);
|
|
23249
23256
|
this.#addressProvider = new AddressProviderContractV3_1(
|
|
23250
23257
|
this,
|
|
23251
23258
|
addressProvider
|