@gearbox-protocol/sdk 8.26.3 → 8.26.4
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/market/pricefeeds/updates/PythUpdater.js +19 -9
- package/dist/cjs/sdk/market/pricefeeds/updates/RedstoneUpdater.js +8 -1
- package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +19 -9
- package/dist/esm/sdk/market/pricefeeds/updates/RedstoneUpdater.js +8 -1
- package/package.json +1 -1
|
@@ -91,22 +91,32 @@ class PythUpdater extends import_base.SDKConstruct {
|
|
|
91
91
|
feeds.filter(isPyth).map((f) => [f.priceFeedId, f])
|
|
92
92
|
);
|
|
93
93
|
const payloads = await this.#getPayloads(new Set(pythFeeds.keys()));
|
|
94
|
-
|
|
94
|
+
let [minTimestamp, maxTimestamp] = [Number.POSITIVE_INFINITY, 0];
|
|
95
|
+
const results = [];
|
|
96
|
+
for (const p of payloads) {
|
|
95
97
|
const priceFeed = pythFeeds.get(p.dataFeedId);
|
|
96
98
|
if (!priceFeed) {
|
|
97
99
|
throw new Error(`cannot find price feed for ${p.dataFeedId}`);
|
|
98
100
|
}
|
|
99
101
|
const { dataFeedId, timestamp, cached, data } = p;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
minTimestamp = Math.min(minTimestamp, timestamp);
|
|
103
|
+
maxTimestamp = Math.max(maxTimestamp, timestamp);
|
|
104
|
+
results.push(
|
|
105
|
+
new PythUpdateTx(priceFeed.createPriceUpdateTx(data), {
|
|
106
|
+
dataFeedId,
|
|
107
|
+
priceFeed: priceFeed.address,
|
|
108
|
+
timestamp,
|
|
109
|
+
cached
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
let tsRange = "";
|
|
114
|
+
if (results.length) {
|
|
115
|
+
tsRange = `, timestamp range: ${minTimestamp} - ${maxTimestamp}`;
|
|
116
|
+
}
|
|
107
117
|
this.#logger?.debug(
|
|
108
118
|
logContext,
|
|
109
|
-
`generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}`
|
|
119
|
+
`generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}${tsRange}`
|
|
110
120
|
);
|
|
111
121
|
return results;
|
|
112
122
|
}
|
|
@@ -109,6 +109,7 @@ class RedstoneUpdater extends import_base.SDKConstruct {
|
|
|
109
109
|
priceFeeds.set(feed.dataId, pfsForDataId);
|
|
110
110
|
}
|
|
111
111
|
const results = [];
|
|
112
|
+
let [minTimestamp, maxTimestamp] = [Number.POSITIVE_INFINITY, 0];
|
|
112
113
|
for (const [key, group] of Object.entries(groupedFeeds)) {
|
|
113
114
|
const [dataServiceId, signersStr] = key.split(":");
|
|
114
115
|
const uniqueSignersCount = parseInt(signersStr, 10);
|
|
@@ -123,6 +124,8 @@ class RedstoneUpdater extends import_base.SDKConstruct {
|
|
|
123
124
|
throw new Error(`cannot get price feed addresses for ${dataFeedId}`);
|
|
124
125
|
}
|
|
125
126
|
for (const priceFeed of pfsForDataId.values()) {
|
|
127
|
+
minTimestamp = Math.min(minTimestamp, timestamp);
|
|
128
|
+
maxTimestamp = Math.max(maxTimestamp, timestamp);
|
|
126
129
|
results.push(
|
|
127
130
|
new RedstoneUpdateTx(priceFeed.createPriceUpdateTx(data), {
|
|
128
131
|
dataFeedId,
|
|
@@ -135,9 +138,13 @@ class RedstoneUpdater extends import_base.SDKConstruct {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
}
|
|
141
|
+
let tsRange = "";
|
|
142
|
+
if (results.length) {
|
|
143
|
+
tsRange = `, timestamp range: ${minTimestamp} - ${maxTimestamp}`;
|
|
144
|
+
}
|
|
138
145
|
this.#logger?.debug(
|
|
139
146
|
logContext,
|
|
140
|
-
`generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}`
|
|
147
|
+
`generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}${tsRange}`
|
|
141
148
|
);
|
|
142
149
|
return results;
|
|
143
150
|
}
|
|
@@ -71,22 +71,32 @@ class PythUpdater extends SDKConstruct {
|
|
|
71
71
|
feeds.filter(isPyth).map((f) => [f.priceFeedId, f])
|
|
72
72
|
);
|
|
73
73
|
const payloads = await this.#getPayloads(new Set(pythFeeds.keys()));
|
|
74
|
-
|
|
74
|
+
let [minTimestamp, maxTimestamp] = [Number.POSITIVE_INFINITY, 0];
|
|
75
|
+
const results = [];
|
|
76
|
+
for (const p of payloads) {
|
|
75
77
|
const priceFeed = pythFeeds.get(p.dataFeedId);
|
|
76
78
|
if (!priceFeed) {
|
|
77
79
|
throw new Error(`cannot find price feed for ${p.dataFeedId}`);
|
|
78
80
|
}
|
|
79
81
|
const { dataFeedId, timestamp, cached, data } = p;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
minTimestamp = Math.min(minTimestamp, timestamp);
|
|
83
|
+
maxTimestamp = Math.max(maxTimestamp, timestamp);
|
|
84
|
+
results.push(
|
|
85
|
+
new PythUpdateTx(priceFeed.createPriceUpdateTx(data), {
|
|
86
|
+
dataFeedId,
|
|
87
|
+
priceFeed: priceFeed.address,
|
|
88
|
+
timestamp,
|
|
89
|
+
cached
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
let tsRange = "";
|
|
94
|
+
if (results.length) {
|
|
95
|
+
tsRange = `, timestamp range: ${minTimestamp} - ${maxTimestamp}`;
|
|
96
|
+
}
|
|
87
97
|
this.#logger?.debug(
|
|
88
98
|
logContext,
|
|
89
|
-
`generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}`
|
|
99
|
+
`generated ${results.length} update transactions for pyth price feeds: ${Array.from(pythFeeds.keys()).join(", ")}${tsRange}`
|
|
90
100
|
);
|
|
91
101
|
return results;
|
|
92
102
|
}
|
|
@@ -85,6 +85,7 @@ class RedstoneUpdater extends SDKConstruct {
|
|
|
85
85
|
priceFeeds.set(feed.dataId, pfsForDataId);
|
|
86
86
|
}
|
|
87
87
|
const results = [];
|
|
88
|
+
let [minTimestamp, maxTimestamp] = [Number.POSITIVE_INFINITY, 0];
|
|
88
89
|
for (const [key, group] of Object.entries(groupedFeeds)) {
|
|
89
90
|
const [dataServiceId, signersStr] = key.split(":");
|
|
90
91
|
const uniqueSignersCount = parseInt(signersStr, 10);
|
|
@@ -99,6 +100,8 @@ class RedstoneUpdater extends SDKConstruct {
|
|
|
99
100
|
throw new Error(`cannot get price feed addresses for ${dataFeedId}`);
|
|
100
101
|
}
|
|
101
102
|
for (const priceFeed of pfsForDataId.values()) {
|
|
103
|
+
minTimestamp = Math.min(minTimestamp, timestamp);
|
|
104
|
+
maxTimestamp = Math.max(maxTimestamp, timestamp);
|
|
102
105
|
results.push(
|
|
103
106
|
new RedstoneUpdateTx(priceFeed.createPriceUpdateTx(data), {
|
|
104
107
|
dataFeedId,
|
|
@@ -111,9 +114,13 @@ class RedstoneUpdater extends SDKConstruct {
|
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
}
|
|
117
|
+
let tsRange = "";
|
|
118
|
+
if (results.length) {
|
|
119
|
+
tsRange = `, timestamp range: ${minTimestamp} - ${maxTimestamp}`;
|
|
120
|
+
}
|
|
114
121
|
this.#logger?.debug(
|
|
115
122
|
logContext,
|
|
116
|
-
`generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}`
|
|
123
|
+
`generated ${results.length} update transactions for redstone price feeds: ${Array.from(priceFeeds.keys()).join(", ")}${tsRange}`
|
|
117
124
|
);
|
|
118
125
|
return results;
|
|
119
126
|
}
|