@gearbox-protocol/deploy-tools 5.30.0 → 5.30.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/index.mjs +296 -264
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -4276,7 +4276,7 @@ var init_size = __esm({
|
|
|
4276
4276
|
var version2;
|
|
4277
4277
|
var init_version2 = __esm({
|
|
4278
4278
|
"../../node_modules/viem/_esm/errors/version.js"() {
|
|
4279
|
-
version2 = "2.29.
|
|
4279
|
+
version2 = "2.29.3";
|
|
4280
4280
|
}
|
|
4281
4281
|
});
|
|
4282
4282
|
|
|
@@ -5568,9 +5568,9 @@ var init_getAddress = __esm({
|
|
|
5568
5568
|
// ../../node_modules/viem/_esm/utils/address/isAddress.js
|
|
5569
5569
|
function isAddress(address, options) {
|
|
5570
5570
|
const { strict = true } = options ?? {};
|
|
5571
|
-
const
|
|
5572
|
-
if (isAddressCache.has(
|
|
5573
|
-
return isAddressCache.get(
|
|
5571
|
+
const cacheKey2 = `${address}.${strict}`;
|
|
5572
|
+
if (isAddressCache.has(cacheKey2))
|
|
5573
|
+
return isAddressCache.get(cacheKey2);
|
|
5574
5574
|
const result = (() => {
|
|
5575
5575
|
if (!addressRegex.test(address))
|
|
5576
5576
|
return false;
|
|
@@ -5580,7 +5580,7 @@ function isAddress(address, options) {
|
|
|
5580
5580
|
return checksumAddress(address) === address;
|
|
5581
5581
|
return true;
|
|
5582
5582
|
})();
|
|
5583
|
-
isAddressCache.set(
|
|
5583
|
+
isAddressCache.set(cacheKey2, result);
|
|
5584
5584
|
return result;
|
|
5585
5585
|
}
|
|
5586
5586
|
var addressRegex, isAddressCache;
|
|
@@ -24329,7 +24329,7 @@ var require_common = __commonJS({
|
|
|
24329
24329
|
createDebug.namespaces = namespaces;
|
|
24330
24330
|
createDebug.names = [];
|
|
24331
24331
|
createDebug.skips = [];
|
|
24332
|
-
const split3 = (typeof namespaces === "string" ? namespaces : "").trim().replace(
|
|
24332
|
+
const split3 = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
24333
24333
|
for (const ns of split3) {
|
|
24334
24334
|
if (ns[0] === "-") {
|
|
24335
24335
|
createDebug.skips.push(ns.slice(1));
|
|
@@ -24547,7 +24547,7 @@ var require_browser = __commonJS({
|
|
|
24547
24547
|
function load() {
|
|
24548
24548
|
let r;
|
|
24549
24549
|
try {
|
|
24550
|
-
r = exports2.storage.getItem("debug");
|
|
24550
|
+
r = exports2.storage.getItem("debug") || exports2.storage.getItem("DEBUG");
|
|
24551
24551
|
} catch (error) {
|
|
24552
24552
|
}
|
|
24553
24553
|
if (!r && typeof process !== "undefined" && "env" in process) {
|
|
@@ -75247,24 +75247,24 @@ var require_memoize = __commonJS({
|
|
|
75247
75247
|
const cache = {};
|
|
75248
75248
|
let iterationCounter = 0;
|
|
75249
75249
|
return async (...args) => {
|
|
75250
|
-
const
|
|
75251
|
-
(0, errors_1.assertWithLog)(
|
|
75250
|
+
const cacheKey2 = await cacheKeyBuilder(...args);
|
|
75251
|
+
(0, errors_1.assertWithLog)(cacheKey2.length < EXPECTED_MAX_CACHE_KEY_LENGTH_PER_FN, `Assumed cache key will not be longer than ${EXPECTED_MAX_CACHE_KEY_LENGTH_PER_FN}. Suspicious key ${cacheKey2}`);
|
|
75252
75252
|
iterationCounter = (iterationCounter + 1) % cleanEveryNIteration;
|
|
75253
75253
|
if (iterationCounter == 0) {
|
|
75254
75254
|
cleanStaleCacheEntries(cache, ttl);
|
|
75255
75255
|
}
|
|
75256
|
-
const isMiss = !cache[
|
|
75256
|
+
const isMiss = !cache[cacheKey2] || Date.now() - cache[cacheKey2].lastSet > ttl;
|
|
75257
75257
|
if (isMiss) {
|
|
75258
|
-
cache[
|
|
75258
|
+
cache[cacheKey2] = {
|
|
75259
75259
|
lastSet: Date.now(),
|
|
75260
75260
|
promise: functionToMemoize(...args).catch((err) => {
|
|
75261
|
-
delete cache[
|
|
75261
|
+
delete cache[cacheKey2];
|
|
75262
75262
|
throw err;
|
|
75263
75263
|
})
|
|
75264
75264
|
};
|
|
75265
75265
|
}
|
|
75266
75266
|
cacheReporter(isMiss);
|
|
75267
|
-
return await cache[
|
|
75267
|
+
return await cache[cacheKey2].promise;
|
|
75268
75268
|
};
|
|
75269
75269
|
}
|
|
75270
75270
|
var cleanStaleCacheEntries = (cache, ttl) => {
|
|
@@ -163871,7 +163871,7 @@ var require_version28 = __commonJS({
|
|
|
163871
163871
|
"use strict";
|
|
163872
163872
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
163873
163873
|
exports2.version = void 0;
|
|
163874
|
-
exports2.version = "2.29.
|
|
163874
|
+
exports2.version = "2.29.3";
|
|
163875
163875
|
}
|
|
163876
163876
|
});
|
|
163877
163877
|
|
|
@@ -165512,9 +165512,9 @@ var require_isAddress = __commonJS({
|
|
|
165512
165512
|
exports2.isAddressCache = new lru_js_1.LruMap(8192);
|
|
165513
165513
|
function isAddress2(address, options) {
|
|
165514
165514
|
const { strict = true } = options ?? {};
|
|
165515
|
-
const
|
|
165516
|
-
if (exports2.isAddressCache.has(
|
|
165517
|
-
return exports2.isAddressCache.get(
|
|
165515
|
+
const cacheKey2 = `${address}.${strict}`;
|
|
165516
|
+
if (exports2.isAddressCache.has(cacheKey2))
|
|
165517
|
+
return exports2.isAddressCache.get(cacheKey2);
|
|
165518
165518
|
const result = (() => {
|
|
165519
165519
|
if (!addressRegex3.test(address))
|
|
165520
165520
|
return false;
|
|
@@ -165524,7 +165524,7 @@ var require_isAddress = __commonJS({
|
|
|
165524
165524
|
return (0, getAddress_js_1.checksumAddress)(address) === address;
|
|
165525
165525
|
return true;
|
|
165526
165526
|
})();
|
|
165527
|
-
exports2.isAddressCache.set(
|
|
165527
|
+
exports2.isAddressCache.set(cacheKey2, result);
|
|
165528
165528
|
return result;
|
|
165529
165529
|
}
|
|
165530
165530
|
}
|
|
@@ -177259,14 +177259,14 @@ var require_withCache = __commonJS({
|
|
|
177259
177259
|
exports2.withCache = withCache2;
|
|
177260
177260
|
exports2.promiseCache = /* @__PURE__ */ new Map();
|
|
177261
177261
|
exports2.responseCache = /* @__PURE__ */ new Map();
|
|
177262
|
-
function getCache2(
|
|
177263
|
-
const buildCache = (
|
|
177264
|
-
clear: () => cache.delete(
|
|
177265
|
-
get: () => cache.get(
|
|
177266
|
-
set: (data) => cache.set(
|
|
177262
|
+
function getCache2(cacheKey2) {
|
|
177263
|
+
const buildCache = (cacheKey3, cache) => ({
|
|
177264
|
+
clear: () => cache.delete(cacheKey3),
|
|
177265
|
+
get: () => cache.get(cacheKey3),
|
|
177266
|
+
set: (data) => cache.set(cacheKey3, data)
|
|
177267
177267
|
});
|
|
177268
|
-
const promise = buildCache(
|
|
177269
|
-
const response = buildCache(
|
|
177268
|
+
const promise = buildCache(cacheKey2, exports2.promiseCache);
|
|
177269
|
+
const response = buildCache(cacheKey2, exports2.responseCache);
|
|
177270
177270
|
return {
|
|
177271
177271
|
clear: () => {
|
|
177272
177272
|
promise.clear();
|
|
@@ -177276,8 +177276,8 @@ var require_withCache = __commonJS({
|
|
|
177276
177276
|
response
|
|
177277
177277
|
};
|
|
177278
177278
|
}
|
|
177279
|
-
async function withCache2(fn, { cacheKey:
|
|
177280
|
-
const cache = getCache2(
|
|
177279
|
+
async function withCache2(fn, { cacheKey: cacheKey2, cacheTime = Number.POSITIVE_INFINITY }) {
|
|
177280
|
+
const cache = getCache2(cacheKey2);
|
|
177281
177281
|
const response = cache.response.get();
|
|
177282
177282
|
if (response && cacheTime > 0) {
|
|
177283
177283
|
const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
|
|
@@ -177308,14 +177308,14 @@ var require_getBlockNumber = __commonJS({
|
|
|
177308
177308
|
exports2.getBlockNumberCache = getBlockNumberCache;
|
|
177309
177309
|
exports2.getBlockNumber = getBlockNumber2;
|
|
177310
177310
|
var withCache_js_1 = require_withCache();
|
|
177311
|
-
var
|
|
177311
|
+
var cacheKey2 = (id) => `blockNumber.${id}`;
|
|
177312
177312
|
function getBlockNumberCache(id) {
|
|
177313
|
-
return (0, withCache_js_1.getCache)(
|
|
177313
|
+
return (0, withCache_js_1.getCache)(cacheKey2(id));
|
|
177314
177314
|
}
|
|
177315
177315
|
async function getBlockNumber2(client, { cacheTime = client.cacheTime } = {}) {
|
|
177316
177316
|
const blockNumberHex = await (0, withCache_js_1.withCache)(() => client.request({
|
|
177317
177317
|
method: "eth_blockNumber"
|
|
177318
|
-
}), { cacheKey:
|
|
177318
|
+
}), { cacheKey: cacheKey2(client.uid), cacheTime });
|
|
177319
177319
|
return BigInt(blockNumberHex);
|
|
177320
177320
|
}
|
|
177321
177321
|
}
|
|
@@ -186406,7 +186406,7 @@ var require_multicall2 = __commonJS({
|
|
|
186406
186406
|
var getAction_js_1 = require_getAction();
|
|
186407
186407
|
var readContract_js_1 = require_readContract();
|
|
186408
186408
|
async function multicall2(client, parameters) {
|
|
186409
|
-
const { allowFailure = true, batchSize: batchSize_, blockNumber, blockTag, multicallAddress: multicallAddress_, stateOverride } = parameters;
|
|
186409
|
+
const { account, allowFailure = true, batchSize: batchSize_, blockNumber, blockTag, multicallAddress: multicallAddress_, stateOverride } = parameters;
|
|
186410
186410
|
const contracts2 = parameters.contracts;
|
|
186411
186411
|
const batchSize = batchSize_ ?? (typeof client.batch?.multicall === "object" && client.batch.multicall.batchSize || 1024);
|
|
186412
186412
|
let multicallAddress = multicallAddress_;
|
|
@@ -186446,7 +186446,8 @@ var require_multicall2 = __commonJS({
|
|
|
186446
186446
|
address,
|
|
186447
186447
|
args,
|
|
186448
186448
|
docsPath: "/docs/contract/multicall",
|
|
186449
|
-
functionName
|
|
186449
|
+
functionName,
|
|
186450
|
+
sender: account
|
|
186450
186451
|
});
|
|
186451
186452
|
if (!allowFailure)
|
|
186452
186453
|
throw error;
|
|
@@ -186462,6 +186463,7 @@ var require_multicall2 = __commonJS({
|
|
|
186462
186463
|
}
|
|
186463
186464
|
const aggregate3Results = await Promise.allSettled(chunkedCalls.map((calls) => (0, getAction_js_1.getAction)(client, readContract_js_1.readContract, "readContract")({
|
|
186464
186465
|
abi: abis_js_1.multicall3Abi,
|
|
186466
|
+
account,
|
|
186465
186467
|
address: multicallAddress,
|
|
186466
186468
|
args: [calls],
|
|
186467
186469
|
blockNumber,
|
|
@@ -191957,7 +191959,7 @@ var require_sendCalls = __commonJS({
|
|
|
191957
191959
|
var toHex_js_1 = require_toHex();
|
|
191958
191960
|
var getTransactionError_js_1 = require_getTransactionError();
|
|
191959
191961
|
async function sendCalls2(client, parameters) {
|
|
191960
|
-
const { account: account_ = client.account, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
|
|
191962
|
+
const { account: account_ = client.account, capabilities, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
|
|
191961
191963
|
if (typeof account_ === "undefined")
|
|
191962
191964
|
throw new account_js_1.AccountNotFoundError({
|
|
191963
191965
|
docsPath: "/docs/actions/wallet/sendCalls"
|
|
@@ -191983,7 +191985,7 @@ var require_sendCalls = __commonJS({
|
|
|
191983
191985
|
{
|
|
191984
191986
|
atomicRequired: forceAtomic,
|
|
191985
191987
|
calls,
|
|
191986
|
-
capabilities
|
|
191988
|
+
capabilities,
|
|
191987
191989
|
chainId: (0, toHex_js_1.numberToHex)(chain.id),
|
|
191988
191990
|
from: account?.address,
|
|
191989
191991
|
id,
|
|
@@ -192002,18 +192004,6 @@ var require_sendCalls = __commonJS({
|
|
|
192002
192004
|
});
|
|
192003
192005
|
}
|
|
192004
192006
|
}
|
|
192005
|
-
function formatRequestCapabilities2(capabilities) {
|
|
192006
|
-
const paymasterService = capabilities?.paymasterService ? Object.entries(capabilities.paymasterService).reduce((paymasterService2, [chainId, value]) => ({
|
|
192007
|
-
...paymasterService2 ?? {},
|
|
192008
|
-
[(0, toHex_js_1.numberToHex)(Number(chainId))]: value
|
|
192009
|
-
}), {}) : void 0;
|
|
192010
|
-
return {
|
|
192011
|
-
...capabilities,
|
|
192012
|
-
...paymasterService ? {
|
|
192013
|
-
paymasterService
|
|
192014
|
-
} : {}
|
|
192015
|
-
};
|
|
192016
|
-
}
|
|
192017
192007
|
}
|
|
192018
192008
|
});
|
|
192019
192009
|
|
|
@@ -243395,27 +243385,12 @@ var require_modular3 = __commonJS({
|
|
|
243395
243385
|
var _4n3 = /* @__PURE__ */ BigInt(4);
|
|
243396
243386
|
var _5n2 = /* @__PURE__ */ BigInt(5);
|
|
243397
243387
|
var _8n2 = /* @__PURE__ */ BigInt(8);
|
|
243398
|
-
var _9n2 = /* @__PURE__ */ BigInt(9);
|
|
243399
|
-
var _16n2 = /* @__PURE__ */ BigInt(16);
|
|
243400
243388
|
function mod2(a, b) {
|
|
243401
243389
|
const result = a % b;
|
|
243402
243390
|
return result >= _0n8 ? result : b + result;
|
|
243403
243391
|
}
|
|
243404
243392
|
function pow3(num2, power, modulo) {
|
|
243405
|
-
|
|
243406
|
-
throw new Error("invalid exponent, negatives unsupported");
|
|
243407
|
-
if (modulo <= _0n8)
|
|
243408
|
-
throw new Error("invalid modulus");
|
|
243409
|
-
if (modulo === _1n8)
|
|
243410
|
-
return _0n8;
|
|
243411
|
-
let res = _1n8;
|
|
243412
|
-
while (power > _0n8) {
|
|
243413
|
-
if (power & _1n8)
|
|
243414
|
-
res = res * num2 % modulo;
|
|
243415
|
-
num2 = num2 * num2 % modulo;
|
|
243416
|
-
power >>= _1n8;
|
|
243417
|
-
}
|
|
243418
|
-
return res;
|
|
243393
|
+
return FpPow2(Field2(modulo), num2, power);
|
|
243419
243394
|
}
|
|
243420
243395
|
function pow22(x, power, modulo) {
|
|
243421
243396
|
let res = x;
|
|
@@ -243445,7 +243420,27 @@ var require_modular3 = __commonJS({
|
|
|
243445
243420
|
throw new Error("invert: does not exist");
|
|
243446
243421
|
return mod2(x, modulo);
|
|
243447
243422
|
}
|
|
243423
|
+
function sqrt3mod4(Fp, n) {
|
|
243424
|
+
const p1div4 = (Fp.ORDER + _1n8) / _4n3;
|
|
243425
|
+
const root2 = Fp.pow(n, p1div4);
|
|
243426
|
+
if (!Fp.eql(Fp.sqr(root2), n))
|
|
243427
|
+
throw new Error("Cannot find square root");
|
|
243428
|
+
return root2;
|
|
243429
|
+
}
|
|
243430
|
+
function sqrt5mod8(Fp, n) {
|
|
243431
|
+
const p5div8 = (Fp.ORDER - _5n2) / _8n2;
|
|
243432
|
+
const n2 = Fp.mul(n, _2n6);
|
|
243433
|
+
const v = Fp.pow(n2, p5div8);
|
|
243434
|
+
const nv = Fp.mul(n, v);
|
|
243435
|
+
const i = Fp.mul(Fp.mul(nv, _2n6), v);
|
|
243436
|
+
const root2 = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
243437
|
+
if (!Fp.eql(Fp.sqr(root2), n))
|
|
243438
|
+
throw new Error("Cannot find square root");
|
|
243439
|
+
return root2;
|
|
243440
|
+
}
|
|
243448
243441
|
function tonelliShanks2(P) {
|
|
243442
|
+
if (P < BigInt(3))
|
|
243443
|
+
throw new Error("sqrt is not defined for small field");
|
|
243449
243444
|
let Q = P - _1n8;
|
|
243450
243445
|
let S = 0;
|
|
243451
243446
|
while (Q % _2n6 === _0n8) {
|
|
@@ -243454,70 +243449,49 @@ var require_modular3 = __commonJS({
|
|
|
243454
243449
|
}
|
|
243455
243450
|
let Z = _2n6;
|
|
243456
243451
|
const _Fp = Field2(P);
|
|
243457
|
-
while (
|
|
243452
|
+
while (FpLegendre(_Fp, Z) === 1) {
|
|
243458
243453
|
if (Z++ > 1e3)
|
|
243459
243454
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
243460
243455
|
}
|
|
243461
|
-
if (S === 1)
|
|
243462
|
-
|
|
243463
|
-
|
|
243464
|
-
const root2 = Fp.pow(n, p1div4);
|
|
243465
|
-
if (!Fp.eql(Fp.sqr(root2), n))
|
|
243466
|
-
throw new Error("Cannot find square root");
|
|
243467
|
-
return root2;
|
|
243468
|
-
};
|
|
243469
|
-
}
|
|
243456
|
+
if (S === 1)
|
|
243457
|
+
return sqrt3mod4;
|
|
243458
|
+
let cc = _Fp.pow(Z, Q);
|
|
243470
243459
|
const Q1div2 = (Q + _1n8) / _2n6;
|
|
243471
243460
|
return function tonelliSlow(Fp, n) {
|
|
243472
|
-
if (
|
|
243461
|
+
if (Fp.is0(n))
|
|
243462
|
+
return n;
|
|
243463
|
+
if (FpLegendre(Fp, n) !== 1)
|
|
243473
243464
|
throw new Error("Cannot find square root");
|
|
243474
|
-
let
|
|
243475
|
-
let
|
|
243476
|
-
let
|
|
243477
|
-
let
|
|
243478
|
-
while (!Fp.eql(
|
|
243479
|
-
if (Fp.
|
|
243465
|
+
let M = S;
|
|
243466
|
+
let c = Fp.mul(Fp.ONE, cc);
|
|
243467
|
+
let t = Fp.pow(n, Q);
|
|
243468
|
+
let R = Fp.pow(n, Q1div2);
|
|
243469
|
+
while (!Fp.eql(t, Fp.ONE)) {
|
|
243470
|
+
if (Fp.is0(t))
|
|
243480
243471
|
return Fp.ZERO;
|
|
243481
|
-
let
|
|
243482
|
-
|
|
243483
|
-
|
|
243484
|
-
|
|
243485
|
-
|
|
243472
|
+
let i = 1;
|
|
243473
|
+
let t_tmp = Fp.sqr(t);
|
|
243474
|
+
while (!Fp.eql(t_tmp, Fp.ONE)) {
|
|
243475
|
+
i++;
|
|
243476
|
+
t_tmp = Fp.sqr(t_tmp);
|
|
243477
|
+
if (i === M)
|
|
243478
|
+
throw new Error("Cannot find square root");
|
|
243486
243479
|
}
|
|
243487
|
-
const
|
|
243488
|
-
|
|
243489
|
-
|
|
243490
|
-
|
|
243491
|
-
|
|
243480
|
+
const exponent = _1n8 << BigInt(M - i - 1);
|
|
243481
|
+
const b = Fp.pow(c, exponent);
|
|
243482
|
+
M = i;
|
|
243483
|
+
c = Fp.sqr(b);
|
|
243484
|
+
t = Fp.mul(t, c);
|
|
243485
|
+
R = Fp.mul(R, b);
|
|
243492
243486
|
}
|
|
243493
|
-
return
|
|
243487
|
+
return R;
|
|
243494
243488
|
};
|
|
243495
243489
|
}
|
|
243496
243490
|
function FpSqrt2(P) {
|
|
243497
|
-
if (P % _4n3 === _3n3)
|
|
243498
|
-
return
|
|
243499
|
-
|
|
243500
|
-
|
|
243501
|
-
if (!Fp.eql(Fp.sqr(root2), n))
|
|
243502
|
-
throw new Error("Cannot find square root");
|
|
243503
|
-
return root2;
|
|
243504
|
-
};
|
|
243505
|
-
}
|
|
243506
|
-
if (P % _8n2 === _5n2) {
|
|
243507
|
-
return function sqrt5mod8(Fp, n) {
|
|
243508
|
-
const n2 = Fp.mul(n, _2n6);
|
|
243509
|
-
const c1 = (P - _5n2) / _8n2;
|
|
243510
|
-
const v = Fp.pow(n2, c1);
|
|
243511
|
-
const nv = Fp.mul(n, v);
|
|
243512
|
-
const i = Fp.mul(Fp.mul(nv, _2n6), v);
|
|
243513
|
-
const root2 = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
243514
|
-
if (!Fp.eql(Fp.sqr(root2), n))
|
|
243515
|
-
throw new Error("Cannot find square root");
|
|
243516
|
-
return root2;
|
|
243517
|
-
};
|
|
243518
|
-
}
|
|
243519
|
-
if (P % _16n2 === _9n2) {
|
|
243520
|
-
}
|
|
243491
|
+
if (P % _4n3 === _3n3)
|
|
243492
|
+
return sqrt3mod4;
|
|
243493
|
+
if (P % _8n2 === _5n2)
|
|
243494
|
+
return sqrt5mod8;
|
|
243521
243495
|
return tonelliShanks2(P);
|
|
243522
243496
|
}
|
|
243523
243497
|
var isNegativeLE = (num2, modulo) => (mod2(num2, modulo) & _1n8) === _1n8;
|
|
@@ -243592,18 +243566,18 @@ var require_modular3 = __commonJS({
|
|
|
243592
243566
|
return Fp.mul(lhs, typeof rhs === "bigint" ? invert2(rhs, Fp.ORDER) : Fp.inv(rhs));
|
|
243593
243567
|
}
|
|
243594
243568
|
function FpLegendre(Fp, n) {
|
|
243595
|
-
const
|
|
243596
|
-
const powered = Fp.pow(n,
|
|
243569
|
+
const p1mod2 = (Fp.ORDER - _1n8) / _2n6;
|
|
243570
|
+
const powered = Fp.pow(n, p1mod2);
|
|
243597
243571
|
const yes = Fp.eql(powered, Fp.ONE);
|
|
243598
243572
|
const zero = Fp.eql(powered, Fp.ZERO);
|
|
243599
243573
|
const no = Fp.eql(powered, Fp.neg(Fp.ONE));
|
|
243600
243574
|
if (!yes && !zero && !no)
|
|
243601
|
-
throw new Error("
|
|
243575
|
+
throw new Error("invalid Legendre symbol result");
|
|
243602
243576
|
return yes ? 1 : zero ? 0 : -1;
|
|
243603
243577
|
}
|
|
243604
243578
|
function FpIsSquare(Fp, n) {
|
|
243605
243579
|
const l = FpLegendre(Fp, n);
|
|
243606
|
-
return l ===
|
|
243580
|
+
return l === 1;
|
|
243607
243581
|
}
|
|
243608
243582
|
function nLength2(n, nBitLength) {
|
|
243609
243583
|
if (nBitLength !== void 0)
|
|
@@ -243902,18 +243876,26 @@ var require_curve4 = __commonJS({
|
|
|
243902
243876
|
function pippenger2(c, fieldN, points, scalars) {
|
|
243903
243877
|
validateMSMPoints2(points, c);
|
|
243904
243878
|
validateMSMScalars2(scalars, fieldN);
|
|
243905
|
-
|
|
243879
|
+
const plength = points.length;
|
|
243880
|
+
const slength = scalars.length;
|
|
243881
|
+
if (plength !== slength)
|
|
243906
243882
|
throw new Error("arrays of points and scalars must have equal length");
|
|
243907
243883
|
const zero = c.ZERO;
|
|
243908
|
-
const wbits = (0, utils_ts_1.bitLen)(BigInt(
|
|
243909
|
-
|
|
243884
|
+
const wbits = (0, utils_ts_1.bitLen)(BigInt(plength));
|
|
243885
|
+
let windowSize = 1;
|
|
243886
|
+
if (wbits > 12)
|
|
243887
|
+
windowSize = wbits - 3;
|
|
243888
|
+
else if (wbits > 4)
|
|
243889
|
+
windowSize = wbits - 2;
|
|
243890
|
+
else if (wbits > 0)
|
|
243891
|
+
windowSize = 2;
|
|
243910
243892
|
const MASK = (0, utils_ts_1.bitMask)(windowSize);
|
|
243911
243893
|
const buckets = new Array(Number(MASK) + 1).fill(zero);
|
|
243912
243894
|
const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;
|
|
243913
243895
|
let sum = zero;
|
|
243914
243896
|
for (let i = lastBits; i >= 0; i -= windowSize) {
|
|
243915
243897
|
buckets.fill(zero);
|
|
243916
|
-
for (let j = 0; j <
|
|
243898
|
+
for (let j = 0; j < slength; j++) {
|
|
243917
243899
|
const scalar = scalars[j];
|
|
243918
243900
|
const wbits2 = Number(scalar >> BigInt(i) & MASK);
|
|
243919
243901
|
buckets[wbits2] = buckets[wbits2].add(points[j]);
|
|
@@ -244011,21 +243993,21 @@ var require_weierstrass3 = __commonJS({
|
|
|
244011
243993
|
a: "field",
|
|
244012
243994
|
b: "field"
|
|
244013
243995
|
}, {
|
|
243996
|
+
allowInfinityPoint: "boolean",
|
|
244014
243997
|
allowedPrivateKeyLengths: "array",
|
|
244015
|
-
wrapPrivateKey: "boolean",
|
|
244016
|
-
isTorsionFree: "function",
|
|
244017
243998
|
clearCofactor: "function",
|
|
244018
|
-
allowInfinityPoint: "boolean",
|
|
244019
243999
|
fromBytes: "function",
|
|
244020
|
-
|
|
244000
|
+
isTorsionFree: "function",
|
|
244001
|
+
toBytes: "function",
|
|
244002
|
+
wrapPrivateKey: "boolean"
|
|
244021
244003
|
});
|
|
244022
244004
|
const { endo, Fp, a } = opts;
|
|
244023
244005
|
if (endo) {
|
|
244024
244006
|
if (!Fp.eql(a, Fp.ZERO)) {
|
|
244025
|
-
throw new Error("invalid
|
|
244007
|
+
throw new Error("invalid endo: CURVE.a must be 0");
|
|
244026
244008
|
}
|
|
244027
244009
|
if (typeof endo !== "object" || typeof endo.beta !== "bigint" || typeof endo.splitScalar !== "function") {
|
|
244028
|
-
throw new Error(
|
|
244010
|
+
throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');
|
|
244029
244011
|
}
|
|
244030
244012
|
}
|
|
244031
244013
|
return Object.freeze({ ...opts });
|
|
@@ -244136,6 +244118,9 @@ var require_weierstrass3 = __commonJS({
|
|
|
244136
244118
|
return tlv.encode(48, seq);
|
|
244137
244119
|
}
|
|
244138
244120
|
};
|
|
244121
|
+
function numToSizedHex(num2, size5) {
|
|
244122
|
+
return (0, utils_ts_1.bytesToHex)((0, utils_ts_1.numberToBytesBE)(num2, size5));
|
|
244123
|
+
}
|
|
244139
244124
|
var _0n8 = BigInt(0);
|
|
244140
244125
|
var _1n8 = BigInt(1);
|
|
244141
244126
|
var _2n6 = BigInt(2);
|
|
@@ -244161,8 +244146,17 @@ var require_weierstrass3 = __commonJS({
|
|
|
244161
244146
|
const x3 = Fp.mul(x2, x);
|
|
244162
244147
|
return Fp.add(Fp.add(x3, Fp.mul(x, a)), b);
|
|
244163
244148
|
}
|
|
244164
|
-
|
|
244165
|
-
|
|
244149
|
+
function isValidXY(x, y) {
|
|
244150
|
+
const left = Fp.sqr(y);
|
|
244151
|
+
const right = weierstrassEquation(x);
|
|
244152
|
+
return Fp.eql(left, right);
|
|
244153
|
+
}
|
|
244154
|
+
if (!isValidXY(CURVE.Gx, CURVE.Gy))
|
|
244155
|
+
throw new Error("bad curve params: generator point");
|
|
244156
|
+
const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n3), _4n3);
|
|
244157
|
+
const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));
|
|
244158
|
+
if (Fp.is0(Fp.add(_4a3, _27b2)))
|
|
244159
|
+
throw new Error("bad curve params: a or b");
|
|
244166
244160
|
function isWithinCurveOrder(num2) {
|
|
244167
244161
|
return (0, utils_ts_1.inRange)(num2, _1n8, CURVE.n);
|
|
244168
244162
|
}
|
|
@@ -244215,9 +244209,7 @@ var require_weierstrass3 = __commonJS({
|
|
|
244215
244209
|
const { x, y } = p.toAffine();
|
|
244216
244210
|
if (!Fp.isValid(x) || !Fp.isValid(y))
|
|
244217
244211
|
throw new Error("bad point: x or y not FE");
|
|
244218
|
-
|
|
244219
|
-
const right = weierstrassEquation(x);
|
|
244220
|
-
if (!Fp.eql(left, right))
|
|
244212
|
+
if (!isValidXY(x, y))
|
|
244221
244213
|
throw new Error("bad point: equation left != right");
|
|
244222
244214
|
if (!p.isTorsionFree())
|
|
244223
244215
|
throw new Error("bad point: not in prime-order subgroup");
|
|
@@ -244423,16 +244415,16 @@ var require_weierstrass3 = __commonJS({
|
|
|
244423
244415
|
* an exposed private key e.g. sig verification, which works over *public* keys.
|
|
244424
244416
|
*/
|
|
244425
244417
|
multiplyUnsafe(sc) {
|
|
244426
|
-
const { endo, n: N } = CURVE;
|
|
244418
|
+
const { endo: endo2, n: N } = CURVE;
|
|
244427
244419
|
(0, utils_ts_1.aInRange)("scalar", sc, _0n8, N);
|
|
244428
244420
|
const I = Point2.ZERO;
|
|
244429
244421
|
if (sc === _0n8)
|
|
244430
244422
|
return I;
|
|
244431
244423
|
if (this.is0() || sc === _1n8)
|
|
244432
244424
|
return this;
|
|
244433
|
-
if (!
|
|
244425
|
+
if (!endo2 || wnaf.hasPrecomputes(this))
|
|
244434
244426
|
return wnaf.wNAFCachedUnsafe(this, sc, Point2.normalizeZ);
|
|
244435
|
-
let { k1neg, k1, k2neg, k2 } =
|
|
244427
|
+
let { k1neg, k1, k2neg, k2 } = endo2.splitScalar(sc);
|
|
244436
244428
|
let k1p = I;
|
|
244437
244429
|
let k2p = I;
|
|
244438
244430
|
let d = this;
|
|
@@ -244449,7 +244441,7 @@ var require_weierstrass3 = __commonJS({
|
|
|
244449
244441
|
k1p = k1p.negate();
|
|
244450
244442
|
if (k2neg)
|
|
244451
244443
|
k2p = k2p.negate();
|
|
244452
|
-
k2p = new Point2(Fp.mul(k2p.px,
|
|
244444
|
+
k2p = new Point2(Fp.mul(k2p.px, endo2.beta), k2p.py, k2p.pz);
|
|
244453
244445
|
return k1p.add(k2p);
|
|
244454
244446
|
}
|
|
244455
244447
|
/**
|
|
@@ -244462,16 +244454,16 @@ var require_weierstrass3 = __commonJS({
|
|
|
244462
244454
|
* @returns New point
|
|
244463
244455
|
*/
|
|
244464
244456
|
multiply(scalar) {
|
|
244465
|
-
const { endo, n: N } = CURVE;
|
|
244457
|
+
const { endo: endo2, n: N } = CURVE;
|
|
244466
244458
|
(0, utils_ts_1.aInRange)("scalar", scalar, _1n8, N);
|
|
244467
244459
|
let point, fake;
|
|
244468
|
-
if (
|
|
244469
|
-
const { k1neg, k1, k2neg, k2 } =
|
|
244460
|
+
if (endo2) {
|
|
244461
|
+
const { k1neg, k1, k2neg, k2 } = endo2.splitScalar(scalar);
|
|
244470
244462
|
let { p: k1p, f: f1p } = this.wNAF(k1);
|
|
244471
244463
|
let { p: k2p, f: f2p } = this.wNAF(k2);
|
|
244472
244464
|
k1p = wnaf.constTimeNegate(k1neg, k1p);
|
|
244473
244465
|
k2p = wnaf.constTimeNegate(k2neg, k2p);
|
|
244474
|
-
k2p = new Point2(Fp.mul(k2p.px,
|
|
244466
|
+
k2p = new Point2(Fp.mul(k2p.px, endo2.beta), k2p.py, k2p.pz);
|
|
244475
244467
|
point = k1p.add(k2p);
|
|
244476
244468
|
fake = f1p.add(f2p);
|
|
244477
244469
|
} else {
|
|
@@ -244527,8 +244519,8 @@ var require_weierstrass3 = __commonJS({
|
|
|
244527
244519
|
}
|
|
244528
244520
|
Point2.BASE = new Point2(CURVE.Gx, CURVE.Gy, Fp.ONE);
|
|
244529
244521
|
Point2.ZERO = new Point2(Fp.ZERO, Fp.ONE, Fp.ZERO);
|
|
244530
|
-
const
|
|
244531
|
-
const wnaf = (0, curve_ts_1.wNAF)(Point2,
|
|
244522
|
+
const { endo, nBitLength } = CURVE;
|
|
244523
|
+
const wnaf = (0, curve_ts_1.wNAF)(Point2, endo ? Math.ceil(nBitLength / 2) : nBitLength);
|
|
244532
244524
|
return {
|
|
244533
244525
|
CURVE,
|
|
244534
244526
|
ProjectivePoint: Point2,
|
|
@@ -244552,7 +244544,7 @@ var require_weierstrass3 = __commonJS({
|
|
|
244552
244544
|
}
|
|
244553
244545
|
function weierstrass2(curveDef) {
|
|
244554
244546
|
const CURVE = validateOpts2(curveDef);
|
|
244555
|
-
const { Fp, n: CURVE_ORDER } = CURVE;
|
|
244547
|
+
const { Fp, n: CURVE_ORDER, nByteLength, nBitLength } = CURVE;
|
|
244556
244548
|
const compressedLen = Fp.BYTES + 1;
|
|
244557
244549
|
const uncompressedLen = 2 * Fp.BYTES + 1;
|
|
244558
244550
|
function modN2(a) {
|
|
@@ -244606,7 +244598,6 @@ var require_weierstrass3 = __commonJS({
|
|
|
244606
244598
|
}
|
|
244607
244599
|
}
|
|
244608
244600
|
});
|
|
244609
|
-
const numToNByteHex = (num2) => (0, utils_ts_1.bytesToHex)((0, utils_ts_1.numberToBytesBE)(num2, CURVE.nByteLength));
|
|
244610
244601
|
function isBiggerThanHalfOrder(number) {
|
|
244611
244602
|
const HALF = CURVE_ORDER >> _1n8;
|
|
244612
244603
|
return number > HALF;
|
|
@@ -244627,7 +244618,7 @@ var require_weierstrass3 = __commonJS({
|
|
|
244627
244618
|
}
|
|
244628
244619
|
// pair (bytes of r, bytes of s)
|
|
244629
244620
|
static fromCompact(hex) {
|
|
244630
|
-
const l =
|
|
244621
|
+
const l = nByteLength;
|
|
244631
244622
|
hex = (0, utils_ts_1.ensureBytes)("compactSignature", hex, l * 2);
|
|
244632
244623
|
return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
|
|
244633
244624
|
}
|
|
@@ -244655,7 +244646,7 @@ var require_weierstrass3 = __commonJS({
|
|
|
244655
244646
|
if (radj >= Fp.ORDER)
|
|
244656
244647
|
throw new Error("recovery id 2 or 3 invalid");
|
|
244657
244648
|
const prefix = (rec & 1) === 0 ? "02" : "03";
|
|
244658
|
-
const R = Point2.fromHex(prefix +
|
|
244649
|
+
const R = Point2.fromHex(prefix + numToSizedHex(radj, Fp.BYTES));
|
|
244659
244650
|
const ir = invN(radj);
|
|
244660
244651
|
const u1 = modN2(-h * ir);
|
|
244661
244652
|
const u2 = modN2(s * ir);
|
|
@@ -244684,7 +244675,8 @@ var require_weierstrass3 = __commonJS({
|
|
|
244684
244675
|
return (0, utils_ts_1.hexToBytes)(this.toCompactHex());
|
|
244685
244676
|
}
|
|
244686
244677
|
toCompactHex() {
|
|
244687
|
-
|
|
244678
|
+
const l = nByteLength;
|
|
244679
|
+
return numToSizedHex(this.r, l) + numToSizedHex(this.s, l);
|
|
244688
244680
|
}
|
|
244689
244681
|
}
|
|
244690
244682
|
const utils = {
|
|
@@ -244723,21 +244715,25 @@ var require_weierstrass3 = __commonJS({
|
|
|
244723
244715
|
return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
|
|
244724
244716
|
}
|
|
244725
244717
|
function isProbPub(item) {
|
|
244726
|
-
|
|
244727
|
-
|
|
244728
|
-
const len = (arr || str) && item.length;
|
|
244729
|
-
if (arr)
|
|
244730
|
-
return len === compressedLen || len === uncompressedLen;
|
|
244731
|
-
if (str)
|
|
244732
|
-
return len === 2 * compressedLen || len === 2 * uncompressedLen;
|
|
244718
|
+
if (typeof item === "bigint")
|
|
244719
|
+
return false;
|
|
244733
244720
|
if (item instanceof Point2)
|
|
244734
244721
|
return true;
|
|
244735
|
-
|
|
244722
|
+
const arr = (0, utils_ts_1.ensureBytes)("key", item);
|
|
244723
|
+
const len = arr.length;
|
|
244724
|
+
const fpl = Fp.BYTES;
|
|
244725
|
+
const compLen = fpl + 1;
|
|
244726
|
+
const uncompLen = 2 * fpl + 1;
|
|
244727
|
+
if (CURVE.allowedPrivateKeyLengths || nByteLength === compLen) {
|
|
244728
|
+
return void 0;
|
|
244729
|
+
} else {
|
|
244730
|
+
return len === compLen || len === uncompLen;
|
|
244731
|
+
}
|
|
244736
244732
|
}
|
|
244737
244733
|
function getSharedSecret(privateA, publicB, isCompressed = true) {
|
|
244738
|
-
if (isProbPub(privateA))
|
|
244734
|
+
if (isProbPub(privateA) === true)
|
|
244739
244735
|
throw new Error("first arg must be private key");
|
|
244740
|
-
if (
|
|
244736
|
+
if (isProbPub(publicB) === false)
|
|
244741
244737
|
throw new Error("second arg must be public key");
|
|
244742
244738
|
const b = Point2.fromHex(publicB);
|
|
244743
244739
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
|
@@ -244746,16 +244742,16 @@ var require_weierstrass3 = __commonJS({
|
|
|
244746
244742
|
if (bytes.length > 8192)
|
|
244747
244743
|
throw new Error("input is too large");
|
|
244748
244744
|
const num2 = (0, utils_ts_1.bytesToNumberBE)(bytes);
|
|
244749
|
-
const delta = bytes.length * 8 -
|
|
244745
|
+
const delta = bytes.length * 8 - nBitLength;
|
|
244750
244746
|
return delta > 0 ? num2 >> BigInt(delta) : num2;
|
|
244751
244747
|
};
|
|
244752
244748
|
const bits2int_modN = CURVE.bits2int_modN || function(bytes) {
|
|
244753
244749
|
return modN2(bits2int(bytes));
|
|
244754
244750
|
};
|
|
244755
|
-
const ORDER_MASK = (0, utils_ts_1.bitMask)(
|
|
244751
|
+
const ORDER_MASK = (0, utils_ts_1.bitMask)(nBitLength);
|
|
244756
244752
|
function int2octets(num2) {
|
|
244757
|
-
(0, utils_ts_1.aInRange)("num < 2^" +
|
|
244758
|
-
return (0, utils_ts_1.numberToBytesBE)(num2,
|
|
244753
|
+
(0, utils_ts_1.aInRange)("num < 2^" + nBitLength, num2, _0n8, ORDER_MASK);
|
|
244754
|
+
return (0, utils_ts_1.numberToBytesBE)(num2, nByteLength);
|
|
244759
244755
|
}
|
|
244760
244756
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
|
244761
244757
|
if (["recovered", "canonical"].some((k) => k in opts))
|
|
@@ -362126,14 +362122,14 @@ init_stringify();
|
|
|
362126
362122
|
// ../../node_modules/viem/_esm/utils/promise/withCache.js
|
|
362127
362123
|
var promiseCache = /* @__PURE__ */ new Map();
|
|
362128
362124
|
var responseCache = /* @__PURE__ */ new Map();
|
|
362129
|
-
function getCache(
|
|
362130
|
-
const buildCache = (
|
|
362131
|
-
clear: () => cache.delete(
|
|
362132
|
-
get: () => cache.get(
|
|
362133
|
-
set: (data) => cache.set(
|
|
362125
|
+
function getCache(cacheKey2) {
|
|
362126
|
+
const buildCache = (cacheKey3, cache) => ({
|
|
362127
|
+
clear: () => cache.delete(cacheKey3),
|
|
362128
|
+
get: () => cache.get(cacheKey3),
|
|
362129
|
+
set: (data) => cache.set(cacheKey3, data)
|
|
362134
362130
|
});
|
|
362135
|
-
const promise = buildCache(
|
|
362136
|
-
const response = buildCache(
|
|
362131
|
+
const promise = buildCache(cacheKey2, promiseCache);
|
|
362132
|
+
const response = buildCache(cacheKey2, responseCache);
|
|
362137
362133
|
return {
|
|
362138
362134
|
clear: () => {
|
|
362139
362135
|
promise.clear();
|
|
@@ -362143,8 +362139,8 @@ function getCache(cacheKey3) {
|
|
|
362143
362139
|
response
|
|
362144
362140
|
};
|
|
362145
362141
|
}
|
|
362146
|
-
async function withCache(fn, { cacheKey:
|
|
362147
|
-
const cache = getCache(
|
|
362142
|
+
async function withCache(fn, { cacheKey: cacheKey2, cacheTime = Number.POSITIVE_INFINITY }) {
|
|
362143
|
+
const cache = getCache(cacheKey2);
|
|
362148
362144
|
const response = cache.response.get();
|
|
362149
362145
|
if (response && cacheTime > 0) {
|
|
362150
362146
|
const age = (/* @__PURE__ */ new Date()).getTime() - response.created.getTime();
|
|
@@ -365201,7 +365197,7 @@ init_decodeFunctionResult();
|
|
|
365201
365197
|
init_encodeFunctionData();
|
|
365202
365198
|
init_getChainContractAddress();
|
|
365203
365199
|
async function multicall(client, parameters) {
|
|
365204
|
-
const { allowFailure = true, batchSize: batchSize_, blockNumber, blockTag, multicallAddress: multicallAddress_, stateOverride } = parameters;
|
|
365200
|
+
const { account, allowFailure = true, batchSize: batchSize_, blockNumber, blockTag, multicallAddress: multicallAddress_, stateOverride } = parameters;
|
|
365205
365201
|
const contracts2 = parameters.contracts;
|
|
365206
365202
|
const batchSize = batchSize_ ?? (typeof client.batch?.multicall === "object" && client.batch.multicall.batchSize || 1024);
|
|
365207
365203
|
let multicallAddress = multicallAddress_;
|
|
@@ -365246,7 +365242,8 @@ async function multicall(client, parameters) {
|
|
|
365246
365242
|
address,
|
|
365247
365243
|
args,
|
|
365248
365244
|
docsPath: "/docs/contract/multicall",
|
|
365249
|
-
functionName
|
|
365245
|
+
functionName,
|
|
365246
|
+
sender: account
|
|
365250
365247
|
});
|
|
365251
365248
|
if (!allowFailure)
|
|
365252
365249
|
throw error;
|
|
@@ -365262,6 +365259,7 @@ async function multicall(client, parameters) {
|
|
|
365262
365259
|
}
|
|
365263
365260
|
const aggregate3Results = await Promise.allSettled(chunkedCalls.map((calls) => getAction(client, readContract, "readContract")({
|
|
365264
365261
|
abi: multicall3Abi,
|
|
365262
|
+
account,
|
|
365265
365263
|
address: multicallAddress,
|
|
365266
365264
|
args: [calls],
|
|
365267
365265
|
blockNumber,
|
|
@@ -368103,7 +368101,7 @@ init_parseAccount();
|
|
|
368103
368101
|
init_encodeFunctionData();
|
|
368104
368102
|
init_toHex();
|
|
368105
368103
|
async function sendCalls(client, parameters) {
|
|
368106
|
-
const { account: account_ = client.account, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
|
|
368104
|
+
const { account: account_ = client.account, capabilities, chain = client.chain, forceAtomic = false, id, version: version4 = "2.0.0" } = parameters;
|
|
368107
368105
|
if (typeof account_ === "undefined")
|
|
368108
368106
|
throw new AccountNotFoundError({
|
|
368109
368107
|
docsPath: "/docs/actions/wallet/sendCalls"
|
|
@@ -368129,7 +368127,7 @@ async function sendCalls(client, parameters) {
|
|
|
368129
368127
|
{
|
|
368130
368128
|
atomicRequired: forceAtomic,
|
|
368131
368129
|
calls,
|
|
368132
|
-
capabilities
|
|
368130
|
+
capabilities,
|
|
368133
368131
|
chainId: numberToHex(chain.id),
|
|
368134
368132
|
from: account?.address,
|
|
368135
368133
|
id,
|
|
@@ -368148,18 +368146,6 @@ async function sendCalls(client, parameters) {
|
|
|
368148
368146
|
});
|
|
368149
368147
|
}
|
|
368150
368148
|
}
|
|
368151
|
-
function formatRequestCapabilities(capabilities) {
|
|
368152
|
-
const paymasterService = capabilities?.paymasterService ? Object.entries(capabilities.paymasterService).reduce((paymasterService2, [chainId, value]) => ({
|
|
368153
|
-
...paymasterService2 ?? {},
|
|
368154
|
-
[numberToHex(Number(chainId))]: value
|
|
368155
|
-
}), {}) : void 0;
|
|
368156
|
-
return {
|
|
368157
|
-
...capabilities,
|
|
368158
|
-
...paymasterService ? {
|
|
368159
|
-
paymasterService
|
|
368160
|
-
} : {}
|
|
368161
|
-
};
|
|
368162
|
-
}
|
|
368163
368149
|
|
|
368164
368150
|
// ../../node_modules/viem/_esm/actions/wallet/showCallsStatus.js
|
|
368165
368151
|
async function showCallsStatus(client, parameters) {
|
|
@@ -409255,6 +409241,44 @@ function isRedstone(pf) {
|
|
|
409255
409241
|
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/RedstoneUpdater.js
|
|
409256
409242
|
var import_evm_connector = __toESM(require_src5(), 1);
|
|
409257
409243
|
var import_protocol = __toESM(require_src2(), 1);
|
|
409244
|
+
|
|
409245
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/RedstoneCache.js
|
|
409246
|
+
var RedstoneCache = class {
|
|
409247
|
+
#cache = /* @__PURE__ */ new Map();
|
|
409248
|
+
#ttlMs;
|
|
409249
|
+
#historical;
|
|
409250
|
+
constructor(opts) {
|
|
409251
|
+
this.#ttlMs = opts.ttl;
|
|
409252
|
+
this.#historical = opts.historical;
|
|
409253
|
+
}
|
|
409254
|
+
get(dataServiceId, dataFeedId, uniqueSignersCount) {
|
|
409255
|
+
const key = this.#cacheKey(dataServiceId, dataFeedId, uniqueSignersCount);
|
|
409256
|
+
const data = this.#cache.get(key);
|
|
409257
|
+
if (!data) {
|
|
409258
|
+
return void 0;
|
|
409259
|
+
}
|
|
409260
|
+
if (this.#expired(data)) {
|
|
409261
|
+
this.#cache.delete(key);
|
|
409262
|
+
return void 0;
|
|
409263
|
+
}
|
|
409264
|
+
return data;
|
|
409265
|
+
}
|
|
409266
|
+
set(dataServiceId, dataFeedId, uniqueSignersCount, value) {
|
|
409267
|
+
const key = this.#cacheKey(dataServiceId, dataFeedId, uniqueSignersCount);
|
|
409268
|
+
this.#cache.set(key, value);
|
|
409269
|
+
}
|
|
409270
|
+
#expired(value) {
|
|
409271
|
+
if (this.#historical) {
|
|
409272
|
+
return false;
|
|
409273
|
+
}
|
|
409274
|
+
return value.timestamp * 1e3 + this.#ttlMs < Date.now();
|
|
409275
|
+
}
|
|
409276
|
+
#cacheKey(dataServiceId, dataFeedId, uniqueSignersCount) {
|
|
409277
|
+
return `${dataServiceId}:${dataFeedId}:${uniqueSignersCount}`;
|
|
409278
|
+
}
|
|
409279
|
+
};
|
|
409280
|
+
|
|
409281
|
+
// ../../node_modules/@gearbox-protocol/sdk/dist/esm/sdk/market/pricefeeds/RedstoneUpdater.js
|
|
409258
409282
|
var MAX_DATA_TIMESTAMP_DELAY_SECONDS = 10n * 60n;
|
|
409259
409283
|
var MAX_DATA_TIMESTAMP_AHEAD_SECONDS = 60n;
|
|
409260
409284
|
var RedstoneUpdateTx = class {
|
|
@@ -409282,24 +409306,29 @@ var RedstoneUpdateTx = class {
|
|
|
409282
409306
|
};
|
|
409283
409307
|
var RedstoneUpdater = class extends SDKConstruct {
|
|
409284
409308
|
#logger;
|
|
409285
|
-
#cache
|
|
409309
|
+
#cache;
|
|
409286
409310
|
#historicalTimestampMs;
|
|
409287
409311
|
#gateways;
|
|
409288
|
-
|
|
409312
|
+
#ignoreMissingFeeds;
|
|
409313
|
+
#enableLogging;
|
|
409314
|
+
constructor(sdk, opts = {}) {
|
|
409289
409315
|
super(sdk);
|
|
409290
409316
|
this.#logger = childLogger("RedstoneUpdater", sdk.logger);
|
|
409291
|
-
|
|
409292
|
-
|
|
409293
|
-
|
|
409294
|
-
|
|
409295
|
-
|
|
409296
|
-
|
|
409297
|
-
|
|
409298
|
-
|
|
409299
|
-
|
|
409300
|
-
|
|
409301
|
-
|
|
409302
|
-
|
|
409317
|
+
this.#ignoreMissingFeeds = opts.ignoreMissingFeeds;
|
|
409318
|
+
this.#enableLogging = opts.enableLogging;
|
|
409319
|
+
this.#gateways = opts.gateways?.length ? opts.gateways : void 0;
|
|
409320
|
+
let ts = opts.historicTimestamp;
|
|
409321
|
+
if (ts) {
|
|
409322
|
+
ts = ts === true ? Number(this.sdk.timestamp) * 1e3 : ts;
|
|
409323
|
+
this.#historicalTimestampMs = 6e4 * Math.floor(ts / 6e4);
|
|
409324
|
+
}
|
|
409325
|
+
this.#cache = new RedstoneCache({
|
|
409326
|
+
// currently staleness period is 240 seconds on all networks, add some buffer
|
|
409327
|
+
// this period of 4 minutes is selected based on time that is required for user to sign transaction with wallet
|
|
409328
|
+
// so it's unlikely to decrease
|
|
409329
|
+
ttl: opts.cacheTTL ?? 225 * 1e3,
|
|
409330
|
+
historical: !!ts
|
|
409331
|
+
});
|
|
409303
409332
|
}
|
|
409304
409333
|
async getUpdateTxs(feeds, logContext = {}) {
|
|
409305
409334
|
this.#logger?.debug(
|
|
@@ -409373,14 +409402,12 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
409373
409402
|
const fromCache = [];
|
|
409374
409403
|
const uncached = [];
|
|
409375
409404
|
for (const dataFeedId of dataFeedsIds) {
|
|
409376
|
-
const
|
|
409405
|
+
const cached = this.#cache.get(
|
|
409377
409406
|
dataServiceId,
|
|
409378
409407
|
dataFeedId,
|
|
409379
|
-
uniqueSignersCount
|
|
409380
|
-
this.#historicalTimestampMs
|
|
409408
|
+
uniqueSignersCount
|
|
409381
409409
|
);
|
|
409382
|
-
|
|
409383
|
-
if (this.#historicalTimestampMs && !!cached) {
|
|
409410
|
+
if (cached) {
|
|
409384
409411
|
fromCache.push({ ...cached, cached: true });
|
|
409385
409412
|
} else {
|
|
409386
409413
|
uncached.push(dataFeedId);
|
|
@@ -409391,16 +409418,8 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
409391
409418
|
new Set(uncached),
|
|
409392
409419
|
uniqueSignersCount
|
|
409393
409420
|
);
|
|
409394
|
-
|
|
409395
|
-
|
|
409396
|
-
const key = cacheKey2(
|
|
409397
|
-
dataServiceId,
|
|
409398
|
-
resp.dataFeedId,
|
|
409399
|
-
uniqueSignersCount,
|
|
409400
|
-
this.#historicalTimestampMs
|
|
409401
|
-
);
|
|
409402
|
-
this.#cache.set(key, resp);
|
|
409403
|
-
}
|
|
409421
|
+
for (const resp of fromRedstone) {
|
|
409422
|
+
this.#cache.set(dataServiceId, resp.dataFeedId, uniqueSignersCount, resp);
|
|
409404
409423
|
}
|
|
409405
409424
|
this.#logger?.debug(
|
|
409406
409425
|
`got ${fromRedstone.length} new redstone updates and ${fromCache.length} from cache`
|
|
@@ -409429,7 +409448,9 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
409429
409448
|
dataPackagesIds,
|
|
409430
409449
|
uniqueSignersCount,
|
|
409431
409450
|
historicalTimestamp: this.#historicalTimestampMs,
|
|
409432
|
-
urls: this.#gateways
|
|
409451
|
+
urls: this.#gateways,
|
|
409452
|
+
ignoreMissingFeed: this.#ignoreMissingFeeds,
|
|
409453
|
+
enableEnhancedLogs: this.#enableLogging
|
|
409433
409454
|
});
|
|
409434
409455
|
const dataPayload = await retry(
|
|
409435
409456
|
() => wrapper.prepareRedstonePayload(true),
|
|
@@ -409455,9 +409476,6 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
409455
409476
|
});
|
|
409456
409477
|
}
|
|
409457
409478
|
};
|
|
409458
|
-
function cacheKey2(dataServiceId, dataFeedId, uniqueSignersCount, historicalTimestamp = 0) {
|
|
409459
|
-
return `${dataServiceId}:${dataFeedId}:${uniqueSignersCount}:${historicalTimestamp}`;
|
|
409460
|
-
}
|
|
409461
409479
|
function groupDataPackages(signedDataPackages) {
|
|
409462
409480
|
const packagesByDataFeedId = {};
|
|
409463
409481
|
for (const p of signedDataPackages) {
|
|
@@ -409558,10 +409576,10 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
409558
409576
|
#feeds = new AddressMap(void 0, "priceFeeds");
|
|
409559
409577
|
#latestUpdate;
|
|
409560
409578
|
redstoneUpdater;
|
|
409561
|
-
constructor(sdk) {
|
|
409579
|
+
constructor(sdk, opts = {}) {
|
|
409562
409580
|
super(sdk);
|
|
409563
409581
|
this.logger = childLogger("PriceFeedRegister", sdk.logger);
|
|
409564
|
-
this.redstoneUpdater = new RedstoneUpdater(sdk);
|
|
409582
|
+
this.redstoneUpdater = new RedstoneUpdater(sdk, opts?.redstone);
|
|
409565
409583
|
}
|
|
409566
409584
|
addHook = this.#hooks.addHook.bind(this.#hooks);
|
|
409567
409585
|
removeHook = this.#hooks.removeHook.bind(this.#hooks);
|
|
@@ -409634,12 +409652,11 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
409634
409652
|
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
409635
409653
|
* This is not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
409636
409654
|
*/
|
|
409637
|
-
async getPartialUpdatablePriceFeeds(
|
|
409655
|
+
async getPartialUpdatablePriceFeeds(configurators, pools) {
|
|
409638
409656
|
const [priceFeedCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
|
|
409639
409657
|
AP_PRICE_FEED_COMPRESSOR,
|
|
409640
409658
|
VERSION_RANGE_310
|
|
409641
409659
|
);
|
|
409642
|
-
const configurators = marketConfigurators ?? this.sdk.marketRegister.marketConfigurators.map((mc) => mc.address);
|
|
409643
409660
|
this.logger?.debug(
|
|
409644
409661
|
{ configurators, pools },
|
|
409645
409662
|
`calling getUpdatablePriceFeeds in block ${this.sdk.currentBlock}`
|
|
@@ -409999,9 +410016,7 @@ var PriceOracleBaseContract = class extends BaseContract {
|
|
|
409999
410016
|
}
|
|
410000
410017
|
this.#labelPriceFeed(priceFeed, reserve ? "Reserve" : "Main", token);
|
|
410001
410018
|
}
|
|
410002
|
-
this.
|
|
410003
|
-
`Got ${this.mainPriceFeeds.size} main and ${this.reservePriceFeeds.size} reserve price feeds`
|
|
410004
|
-
);
|
|
410019
|
+
this.dirty = false;
|
|
410005
410020
|
}
|
|
410006
410021
|
#labelPriceFeed(address, usage, token) {
|
|
410007
410022
|
this.sdk.provider.addressLabels.set(address, (oldLabel) => {
|
|
@@ -410781,6 +410796,7 @@ var PoolSuite = class extends SDKConstruct {
|
|
|
410781
410796
|
pqk;
|
|
410782
410797
|
rateKeeper;
|
|
410783
410798
|
interestRateModel;
|
|
410799
|
+
#marketConfigurator;
|
|
410784
410800
|
constructor(sdk, data) {
|
|
410785
410801
|
super(sdk);
|
|
410786
410802
|
this.pool = createPool(sdk, data.pool);
|
|
@@ -410790,6 +410806,7 @@ var PoolSuite = class extends SDKConstruct {
|
|
|
410790
410806
|
sdk,
|
|
410791
410807
|
data.interestRateModel
|
|
410792
410808
|
);
|
|
410809
|
+
this.#marketConfigurator = data.configurator;
|
|
410793
410810
|
}
|
|
410794
410811
|
get gauge() {
|
|
410795
410812
|
if (this.rateKeeper instanceof GaugeContract) {
|
|
@@ -410815,6 +410832,11 @@ var PoolSuite = class extends SDKConstruct {
|
|
|
410815
410832
|
`Interest rate model is not a linear model, but a ${this.interestRateModel.contractType}`
|
|
410816
410833
|
);
|
|
410817
410834
|
}
|
|
410835
|
+
get marketConfigurator() {
|
|
410836
|
+
return this.sdk.contracts.mustGet(
|
|
410837
|
+
this.#marketConfigurator
|
|
410838
|
+
);
|
|
410839
|
+
}
|
|
410818
410840
|
get underlying() {
|
|
410819
410841
|
return this.pool.underlying;
|
|
410820
410842
|
}
|
|
@@ -410873,6 +410895,9 @@ var MarketSuite = class extends SDKConstruct {
|
|
|
410873
410895
|
this.creditManagers.push(new CreditSuite(sdk, marketData, i));
|
|
410874
410896
|
}
|
|
410875
410897
|
this.priceOracle = getOrCreatePriceOracle(sdk, marketData.priceOracle);
|
|
410898
|
+
sdk.logger?.debug(
|
|
410899
|
+
`oracle ${this.labelAddress(this.priceOracle.address)} has ${this.priceOracle.mainPriceFeeds.size} main and ${this.priceOracle.reservePriceFeeds.size} reserve price feeds`
|
|
410900
|
+
);
|
|
410876
410901
|
}
|
|
410877
410902
|
get dirty() {
|
|
410878
410903
|
return this.configurator.dirty || this.pool.dirty || this.priceOracle.dirty || this.creditManagers.some((cm) => cm.dirty);
|
|
@@ -410941,14 +410966,17 @@ var MarketRegister = class extends SDKConstruct {
|
|
|
410941
410966
|
const nonDirtyOracles = [];
|
|
410942
410967
|
for (const m of this.markets) {
|
|
410943
410968
|
if (m.dirty) {
|
|
410944
|
-
dirtyPools.push(m.pool
|
|
410969
|
+
dirtyPools.push(m.pool);
|
|
410945
410970
|
} else {
|
|
410946
410971
|
nonDirtyOracles.push(m.priceOracle.address);
|
|
410947
410972
|
}
|
|
410948
410973
|
}
|
|
410949
410974
|
if (dirtyPools.length) {
|
|
410950
410975
|
this.#logger?.debug(`need to reload ${dirtyPools.length} markets`);
|
|
410951
|
-
await this.#loadMarkets(
|
|
410976
|
+
await this.#loadMarkets(
|
|
410977
|
+
Array.from(new Set(dirtyPools.map((p) => p.marketConfigurator.address))),
|
|
410978
|
+
dirtyPools.map((p) => p.pool.address)
|
|
410979
|
+
);
|
|
410952
410980
|
} else if (!skipPriceUpdate && nonDirtyOracles.length) {
|
|
410953
410981
|
this.#logger?.debug(
|
|
410954
410982
|
`syncing prices on ${nonDirtyOracles.length} oracles`
|
|
@@ -411236,16 +411264,13 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411236
411264
|
#attachConfig;
|
|
411237
411265
|
// Collection of markets
|
|
411238
411266
|
#marketRegister;
|
|
411267
|
+
#priceFeeds;
|
|
411239
411268
|
logger;
|
|
411240
411269
|
/**
|
|
411241
411270
|
* Interest rate models can be reused across chain (and SDK operates on chain level)
|
|
411242
411271
|
* TODO: use whatever interface is necessary for InterestRateModels
|
|
411243
411272
|
*/
|
|
411244
411273
|
interestRateModels = new AddressMap();
|
|
411245
|
-
/**
|
|
411246
|
-
* All price feeds known to sdk, without oracle-related data (stalenessPeriod, main/reserve, etc.)
|
|
411247
|
-
*/
|
|
411248
|
-
priceFeeds;
|
|
411249
411274
|
/**
|
|
411250
411275
|
* Will throw an error if contract type is not supported, otherwise will try to use generic contract first, if possible
|
|
411251
411276
|
*/
|
|
@@ -411268,9 +411293,10 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411268
411293
|
logger: logger2,
|
|
411269
411294
|
plugins,
|
|
411270
411295
|
blockNumber,
|
|
411271
|
-
|
|
411296
|
+
redstone,
|
|
411272
411297
|
ignoreUpdateablePrices,
|
|
411273
|
-
marketConfigurators: mcs
|
|
411298
|
+
marketConfigurators: mcs,
|
|
411299
|
+
strictContractTypes
|
|
411274
411300
|
} = options;
|
|
411275
411301
|
let { networkType, addressProvider, chainId } = options;
|
|
411276
411302
|
const attachClient = createPublicClient({
|
|
@@ -411294,28 +411320,33 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411294
411320
|
return new _GearboxSDK({
|
|
411295
411321
|
provider,
|
|
411296
411322
|
logger: logger2,
|
|
411297
|
-
plugins
|
|
411323
|
+
plugins,
|
|
411324
|
+
strictContractTypes
|
|
411298
411325
|
}).#attach({
|
|
411299
411326
|
addressProvider,
|
|
411300
411327
|
blockNumber,
|
|
411301
|
-
redstoneHistoricTimestamp,
|
|
411302
411328
|
ignoreUpdateablePrices,
|
|
411303
|
-
marketConfigurators
|
|
411329
|
+
marketConfigurators,
|
|
411330
|
+
redstone
|
|
411304
411331
|
});
|
|
411305
411332
|
}
|
|
411306
411333
|
static hydrate(options, state) {
|
|
411307
|
-
const { logger: logger2, plugins, ...rest } = options;
|
|
411334
|
+
const { logger: logger2, plugins, strictContractTypes, ...rest } = options;
|
|
411308
411335
|
const provider = new Provider({
|
|
411309
411336
|
...rest,
|
|
411310
411337
|
chainId: state.chainId,
|
|
411311
411338
|
networkType: state.network
|
|
411312
411339
|
});
|
|
411313
|
-
return new _GearboxSDK({
|
|
411340
|
+
return new _GearboxSDK({
|
|
411341
|
+
provider,
|
|
411342
|
+
plugins,
|
|
411343
|
+
logger: logger2,
|
|
411344
|
+
strictContractTypes
|
|
411345
|
+
}).#hydrate(rest, state);
|
|
411314
411346
|
}
|
|
411315
411347
|
constructor(options) {
|
|
411316
411348
|
this.#provider = options.provider;
|
|
411317
411349
|
this.logger = options.logger;
|
|
411318
|
-
this.priceFeeds = new PriceFeedRegister(this);
|
|
411319
411350
|
this.strictContractTypes = options.strictContractTypes ?? false;
|
|
411320
411351
|
const pluginsInstances = {};
|
|
411321
411352
|
for (const [name, Plugin] of TypedObjectUtils.entries(
|
|
@@ -411329,9 +411360,9 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411329
411360
|
const {
|
|
411330
411361
|
addressProvider,
|
|
411331
411362
|
blockNumber,
|
|
411332
|
-
redstoneHistoricTimestamp,
|
|
411333
411363
|
ignoreUpdateablePrices,
|
|
411334
|
-
marketConfigurators
|
|
411364
|
+
marketConfigurators,
|
|
411365
|
+
redstone
|
|
411335
411366
|
} = opts;
|
|
411336
411367
|
const re = this.#attachConfig ? "re" : "";
|
|
411337
411368
|
this.logger?.info(
|
|
@@ -411343,7 +411374,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411343
411374
|
},
|
|
411344
411375
|
`${re}attaching gearbox sdk`
|
|
411345
411376
|
);
|
|
411346
|
-
if (!!blockNumber && !
|
|
411377
|
+
if (!!blockNumber && !opts.redstone?.historicTimestamp) {
|
|
411347
411378
|
this.logger?.warn(
|
|
411348
411379
|
`${re}attaching to fixed block number, but redstoneHistoricTimestamp is not set. price updates might fail`
|
|
411349
411380
|
);
|
|
@@ -411357,7 +411388,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411357
411388
|
);
|
|
411358
411389
|
this.#currentBlock = block.number;
|
|
411359
411390
|
this.#timestamp = block.timestamp;
|
|
411360
|
-
this.#
|
|
411391
|
+
this.#priceFeeds = new PriceFeedRegister(this, { redstone });
|
|
411361
411392
|
this.logger?.debug(
|
|
411362
411393
|
`${re}attach block number ${this.currentBlock} timestamp ${this.timestamp}`
|
|
411363
411394
|
);
|
|
@@ -411393,7 +411424,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411393
411424
|
return this;
|
|
411394
411425
|
}
|
|
411395
411426
|
#hydrate(options, state) {
|
|
411396
|
-
const { logger: _logger, ...opts } = options;
|
|
411427
|
+
const { logger: _logger, redstone, ...opts } = options;
|
|
411397
411428
|
if (state.version !== STATE_VERSION) {
|
|
411398
411429
|
throw new Error(
|
|
411399
411430
|
`hydrated state version is ${state.version}, but expected ${STATE_VERSION}`
|
|
@@ -411401,7 +411432,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411401
411432
|
}
|
|
411402
411433
|
this.#currentBlock = state.currentBlock;
|
|
411403
411434
|
this.#timestamp = state.timestamp;
|
|
411404
|
-
this.#
|
|
411435
|
+
this.#priceFeeds = new PriceFeedRegister(this, { redstone });
|
|
411405
411436
|
this.#addressProvider = hydrateAddressProvider(this, state.addressProvider);
|
|
411406
411437
|
this.logger?.debug(
|
|
411407
411438
|
`address provider version: ${this.#addressProvider.version}`
|
|
@@ -411427,15 +411458,6 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411427
411458
|
}
|
|
411428
411459
|
return this;
|
|
411429
411460
|
}
|
|
411430
|
-
#confugureRedstone(opts) {
|
|
411431
|
-
const { redstoneGateways, redstoneHistoricTimestamp } = opts;
|
|
411432
|
-
if (redstoneHistoricTimestamp) {
|
|
411433
|
-
this.priceFeeds.redstoneUpdater.historicalTimestamp = redstoneHistoricTimestamp === true ? Number(this.timestamp) * 1e3 : redstoneHistoricTimestamp;
|
|
411434
|
-
}
|
|
411435
|
-
if (redstoneGateways?.length) {
|
|
411436
|
-
this.priceFeeds.redstoneUpdater.gateways = redstoneGateways;
|
|
411437
|
-
}
|
|
411438
|
-
}
|
|
411439
411461
|
/**
|
|
411440
411462
|
* Reattach SDK with the same config as before, without re-creating instance. Will load all state from scratch
|
|
411441
411463
|
* Be mindful of block number, for example
|
|
@@ -411537,7 +411559,7 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411537
411559
|
*/
|
|
411538
411560
|
async syncState(opts) {
|
|
411539
411561
|
let { blockNumber, timestamp, skipPriceUpdate } = opts ?? {};
|
|
411540
|
-
if (this.#attachConfig?.
|
|
411562
|
+
if (this.#attachConfig?.redstone?.historicTimestamp) {
|
|
411541
411563
|
throw new Error(
|
|
411542
411564
|
"syncState is not supported with redstoneHistoricTimestamp"
|
|
411543
411565
|
);
|
|
@@ -411562,11 +411584,12 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411562
411584
|
...Array.from(this.marketRegister.watchAddresses),
|
|
411563
411585
|
this.addressProvider.address
|
|
411564
411586
|
];
|
|
411587
|
+
const fromBlock = this.currentBlock + 1n;
|
|
411565
411588
|
this.logger?.debug(
|
|
411566
|
-
`getting logs from ${watchAddresses.length} addresses in [${
|
|
411589
|
+
`getting logs from ${watchAddresses.length} addresses in [${fromBlock}:${blockNumber}]`
|
|
411567
411590
|
);
|
|
411568
411591
|
const logs = await getLogsSafe(this.provider.publicClient, {
|
|
411569
|
-
fromBlock
|
|
411592
|
+
fromBlock,
|
|
411570
411593
|
toBlock: blockNumber,
|
|
411571
411594
|
address: watchAddresses
|
|
411572
411595
|
});
|
|
@@ -411620,6 +411643,15 @@ var GearboxSDK = class _GearboxSDK {
|
|
|
411620
411643
|
}
|
|
411621
411644
|
return this.#timestamp;
|
|
411622
411645
|
}
|
|
411646
|
+
/**
|
|
411647
|
+
* All price feeds known to sdk, without oracle-related data (stalenessPeriod, main/reserve, etc.)
|
|
411648
|
+
*/
|
|
411649
|
+
get priceFeeds() {
|
|
411650
|
+
if (this.#priceFeeds === void 0) {
|
|
411651
|
+
throw ERR_NOT_ATTACHED;
|
|
411652
|
+
}
|
|
411653
|
+
return this.#priceFeeds;
|
|
411654
|
+
}
|
|
411623
411655
|
get gear() {
|
|
411624
411656
|
try {
|
|
411625
411657
|
const g = this.addressProvider.getAddress(AP_GEAR_TOKEN, NO_VERSION);
|
|
@@ -439829,7 +439861,7 @@ function getRenderer(opts) {
|
|
|
439829
439861
|
var package_default = {
|
|
439830
439862
|
name: "@gearbox-protocol/deploy-tools",
|
|
439831
439863
|
description: "Gearbox deploy tools",
|
|
439832
|
-
version: "5.30.
|
|
439864
|
+
version: "5.30.1",
|
|
439833
439865
|
homepage: "https://gearbox.fi",
|
|
439834
439866
|
keywords: [
|
|
439835
439867
|
"gearbox"
|
|
@@ -439872,10 +439904,10 @@ var package_default = {
|
|
|
439872
439904
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
439873
439905
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
439874
439906
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
439875
|
-
"@gearbox-protocol/sdk": "
|
|
439907
|
+
"@gearbox-protocol/sdk": "7.0.0",
|
|
439876
439908
|
"@gearbox-protocol/sdk-gov": "^2.37.0",
|
|
439877
439909
|
"@types/lodash-es": "^4.17.12",
|
|
439878
|
-
"@types/node": "^22.15.
|
|
439910
|
+
"@types/node": "^22.15.18",
|
|
439879
439911
|
"@types/react": "^19.1.4",
|
|
439880
439912
|
"@types/react-dom": "^19.1.5",
|
|
439881
439913
|
abitype: "^1.0.8",
|
|
@@ -439894,8 +439926,8 @@ var package_default = {
|
|
|
439894
439926
|
"react-dom": "^19.1.0",
|
|
439895
439927
|
table: "^6.9.0",
|
|
439896
439928
|
tsx: "^4.19.4",
|
|
439897
|
-
viem: "^2.29.
|
|
439898
|
-
yaml: "^2.
|
|
439929
|
+
viem: "^2.29.3",
|
|
439930
|
+
yaml: "^2.8.0",
|
|
439899
439931
|
zod: "^3.24.4"
|
|
439900
439932
|
},
|
|
439901
439933
|
prettier: "@gearbox-protocol/prettier-config",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/deploy-tools",
|
|
3
3
|
"description": "Gearbox deploy tools",
|
|
4
|
-
"version": "5.30.
|
|
4
|
+
"version": "5.30.1",
|
|
5
5
|
"homepage": "https://gearbox.fi",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"gearbox"
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@gearbox-protocol/deploy-tools-node": "0.0.0",
|
|
45
45
|
"@gearbox-protocol/deploy-tools-shared": "0.0.0",
|
|
46
46
|
"@gearbox-protocol/deploy-tools-types": "0.0.0",
|
|
47
|
-
"@gearbox-protocol/sdk": "
|
|
47
|
+
"@gearbox-protocol/sdk": "7.0.0",
|
|
48
48
|
"@gearbox-protocol/sdk-gov": "^2.37.0",
|
|
49
49
|
"@types/lodash-es": "^4.17.12",
|
|
50
|
-
"@types/node": "^22.15.
|
|
50
|
+
"@types/node": "^22.15.18",
|
|
51
51
|
"@types/react": "^19.1.4",
|
|
52
52
|
"@types/react-dom": "^19.1.5",
|
|
53
53
|
"abitype": "^1.0.8",
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
"react-dom": "^19.1.0",
|
|
67
67
|
"table": "^6.9.0",
|
|
68
68
|
"tsx": "^4.19.4",
|
|
69
|
-
"viem": "^2.29.
|
|
70
|
-
"yaml": "^2.
|
|
69
|
+
"viem": "^2.29.3",
|
|
70
|
+
"yaml": "^2.8.0",
|
|
71
71
|
"zod": "^3.24.4"
|
|
72
72
|
},
|
|
73
73
|
"prettier": "@gearbox-protocol/prettier-config",
|