@gearbox-protocol/sdk 3.0.0-vfour.17 → 3.0.0-vfour.19
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 +81 -63
- package/dist/cjs/sdk/index.d.ts +58 -30
- package/dist/esm/sdk/index.d.mts +58 -30
- package/dist/esm/sdk/index.mjs +82 -65
- package/package.json +2 -3
package/dist/cjs/sdk/index.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var utils = require('viem/utils');
|
|
|
5
5
|
var dateFns = require('date-fns');
|
|
6
6
|
var chains$1 = require('viem/chains');
|
|
7
7
|
var actions = require('viem/actions');
|
|
8
|
-
var eventemitter3 = require('eventemitter3');
|
|
9
8
|
var evmConnector = require('@redstone-finance/evm-connector');
|
|
10
9
|
var redstoneProtocol = require('redstone-protocol');
|
|
11
10
|
var sdkGov = require('@gearbox-protocol/sdk-gov');
|
|
@@ -13038,7 +13037,8 @@ function createAnvilClient({
|
|
|
13038
13037
|
}
|
|
13039
13038
|
).extend(viem.publicActions).extend(viem.walletActions).extend((client) => ({
|
|
13040
13039
|
isAnvil: () => isAnvil(client),
|
|
13041
|
-
detectNetwork: () => detectNetwork(client)
|
|
13040
|
+
detectNetwork: () => detectNetwork(client),
|
|
13041
|
+
evmMineDetailed: (timestamp) => evmMineDetailed(client, timestamp)
|
|
13042
13042
|
}));
|
|
13043
13043
|
}
|
|
13044
13044
|
async function isAnvil(client) {
|
|
@@ -13052,6 +13052,17 @@ async function isAnvil(client) {
|
|
|
13052
13052
|
return false;
|
|
13053
13053
|
}
|
|
13054
13054
|
}
|
|
13055
|
+
async function evmMineDetailed(client, timestamp) {
|
|
13056
|
+
try {
|
|
13057
|
+
const [block] = await client.request({
|
|
13058
|
+
method: "evm_mine_detailed",
|
|
13059
|
+
params: [viem.toHex(timestamp)]
|
|
13060
|
+
});
|
|
13061
|
+
return block;
|
|
13062
|
+
} catch {
|
|
13063
|
+
return void 0;
|
|
13064
|
+
}
|
|
13065
|
+
}
|
|
13055
13066
|
async function simulateMulticall(client, parameters) {
|
|
13056
13067
|
const {
|
|
13057
13068
|
account,
|
|
@@ -13224,10 +13235,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13224
13235
|
if (raw.success) {
|
|
13225
13236
|
return raw;
|
|
13226
13237
|
}
|
|
13227
|
-
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13228
|
-
void 0,
|
|
13229
|
-
options?.blockNumber
|
|
13230
|
-
);
|
|
13238
|
+
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
13231
13239
|
const resp = await simulateMulticall(this.provider.publicClient, {
|
|
13232
13240
|
account: this.provider.account,
|
|
13233
13241
|
contracts: [
|
|
@@ -13278,10 +13286,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13278
13286
|
minHealthFactor,
|
|
13279
13287
|
maxHealthFactor
|
|
13280
13288
|
};
|
|
13281
|
-
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13282
|
-
void 0,
|
|
13283
|
-
options?.blockNumber
|
|
13284
|
-
);
|
|
13289
|
+
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
13285
13290
|
const allCAs = [];
|
|
13286
13291
|
for (const reverting of [false, true]) {
|
|
13287
13292
|
let offset = 0n;
|
|
@@ -13414,10 +13419,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13414
13419
|
const tokens = Array.from(tokensByPool.get(pool) ?? []);
|
|
13415
13420
|
priceFeeds.push(...priceFeedFactory.priceFeedsForTokens(tokens));
|
|
13416
13421
|
}
|
|
13417
|
-
return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13418
|
-
priceFeeds,
|
|
13419
|
-
blockNumber
|
|
13420
|
-
);
|
|
13422
|
+
return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(priceFeeds);
|
|
13421
13423
|
}
|
|
13422
13424
|
/**
|
|
13423
13425
|
* Returns account price updates in a non-encoded format
|
|
@@ -14540,6 +14542,31 @@ var MellowLRTPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
14540
14542
|
return stack.totalValue * BigInt(1e18) / stack.totalSupply;
|
|
14541
14543
|
}
|
|
14542
14544
|
};
|
|
14545
|
+
|
|
14546
|
+
// src/sdk/utils/internal/Hooks.ts
|
|
14547
|
+
var Hooks = class {
|
|
14548
|
+
#reg = {};
|
|
14549
|
+
addHook(hookName, fn) {
|
|
14550
|
+
if (!this.#reg[hookName]) {
|
|
14551
|
+
this.#reg[hookName] = [];
|
|
14552
|
+
}
|
|
14553
|
+
this.#reg[hookName].push(fn);
|
|
14554
|
+
}
|
|
14555
|
+
removeHook(hookName, fn) {
|
|
14556
|
+
if (!this.#reg[hookName]) {
|
|
14557
|
+
return;
|
|
14558
|
+
}
|
|
14559
|
+
this.#reg[hookName] = this.#reg[hookName]?.filter((hookFn) => hookFn !== fn) ?? [];
|
|
14560
|
+
}
|
|
14561
|
+
async triggerHooks(hookName, ...args) {
|
|
14562
|
+
if (!this.#reg[hookName]) {
|
|
14563
|
+
return;
|
|
14564
|
+
}
|
|
14565
|
+
for (const fn of this.#reg[hookName]) {
|
|
14566
|
+
await fn(...args);
|
|
14567
|
+
}
|
|
14568
|
+
}
|
|
14569
|
+
};
|
|
14543
14570
|
var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
14544
14571
|
decimals = 8;
|
|
14545
14572
|
dataServiceId;
|
|
@@ -14606,37 +14633,18 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
14606
14633
|
var RedstoneUpdater = class extends SDKConstruct {
|
|
14607
14634
|
#logger;
|
|
14608
14635
|
#cache = /* @__PURE__ */ new Map();
|
|
14636
|
+
#historicalTimestamp;
|
|
14609
14637
|
constructor(sdk) {
|
|
14610
14638
|
super(sdk);
|
|
14611
14639
|
this.#logger = childLogger("RedstoneUpdater", sdk.logger);
|
|
14612
14640
|
}
|
|
14613
|
-
|
|
14641
|
+
setHistoricalTimestamp(timestamp) {
|
|
14642
|
+
this.#historicalTimestamp = timestamp;
|
|
14643
|
+
}
|
|
14644
|
+
async getUpdateTxs(feeds) {
|
|
14614
14645
|
this.#logger?.debug(
|
|
14615
14646
|
`Redstone: generating update transactions for ${feeds.length} redstone price feeds`
|
|
14616
14647
|
);
|
|
14617
|
-
let historicalTimestamp;
|
|
14618
|
-
if (blockNumber) {
|
|
14619
|
-
const block = await this.sdk.provider.publicClient.getBlock({
|
|
14620
|
-
blockNumber
|
|
14621
|
-
});
|
|
14622
|
-
if (!block) {
|
|
14623
|
-
throw new Error(`cannot get block ${blockNumber}`);
|
|
14624
|
-
}
|
|
14625
|
-
this.#logger?.debug(
|
|
14626
|
-
{ tag: "timing" },
|
|
14627
|
-
`block ${block.number} ${new Date(Number(block.timestamp) * 1e3)}`
|
|
14628
|
-
);
|
|
14629
|
-
const nowMs = (/* @__PURE__ */ new Date()).getTime();
|
|
14630
|
-
const redstoneIntervalMs = 6e4;
|
|
14631
|
-
const anvilTsMs = redstoneIntervalMs * Math.floor(Number(block.timestamp) * 1e3 / redstoneIntervalMs);
|
|
14632
|
-
const fromNowTsMs = redstoneIntervalMs * Math.floor(nowMs / redstoneIntervalMs - 1);
|
|
14633
|
-
historicalTimestamp = Math.min(anvilTsMs, fromNowTsMs);
|
|
14634
|
-
const deltaS = Math.floor((nowMs - historicalTimestamp) / 1e3);
|
|
14635
|
-
this.#logger?.debug(
|
|
14636
|
-
{ tag: "timing" },
|
|
14637
|
-
`will use optimistic timestamp: ${new Date(historicalTimestamp)} (${historicalTimestamp}, delta: ${deltaS}s)`
|
|
14638
|
-
);
|
|
14639
|
-
}
|
|
14640
14648
|
const groupedFeeds = {};
|
|
14641
14649
|
const priceFeeds = /* @__PURE__ */ new Map();
|
|
14642
14650
|
for (const feed of feeds) {
|
|
@@ -14657,8 +14665,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14657
14665
|
const payloads = await this.#getPayloads(
|
|
14658
14666
|
dataServiceId,
|
|
14659
14667
|
group,
|
|
14660
|
-
uniqueSignersCount
|
|
14661
|
-
historicalTimestamp
|
|
14668
|
+
uniqueSignersCount
|
|
14662
14669
|
);
|
|
14663
14670
|
for (const { dataFeedId, data, timestamp } of payloads) {
|
|
14664
14671
|
const priceFeed = priceFeeds.get(dataFeedId);
|
|
@@ -14687,10 +14694,9 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14687
14694
|
* @param dataServiceId
|
|
14688
14695
|
* @param dataFeedsIds
|
|
14689
14696
|
* @param uniqueSignersCount
|
|
14690
|
-
* @param historicalTimestamp
|
|
14691
14697
|
* @returns
|
|
14692
14698
|
*/
|
|
14693
|
-
async #getPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount
|
|
14699
|
+
async #getPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount) {
|
|
14694
14700
|
const fromCache = [];
|
|
14695
14701
|
const uncached = [];
|
|
14696
14702
|
for (const dataFeedId of dataFeedsIds) {
|
|
@@ -14698,10 +14704,10 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14698
14704
|
dataServiceId,
|
|
14699
14705
|
dataFeedId,
|
|
14700
14706
|
uniqueSignersCount,
|
|
14701
|
-
historicalTimestamp
|
|
14707
|
+
this.#historicalTimestamp
|
|
14702
14708
|
);
|
|
14703
14709
|
const cached = this.#cache.get(key);
|
|
14704
|
-
if (historicalTimestamp && !!cached) {
|
|
14710
|
+
if (this.#historicalTimestamp && !!cached) {
|
|
14705
14711
|
fromCache.push(cached);
|
|
14706
14712
|
} else {
|
|
14707
14713
|
uncached.push(dataFeedId);
|
|
@@ -14710,16 +14716,15 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14710
14716
|
const fromRedstone = await this.#fetchPayloads(
|
|
14711
14717
|
dataServiceId,
|
|
14712
14718
|
new Set(uncached),
|
|
14713
|
-
uniqueSignersCount
|
|
14714
|
-
historicalTimestamp
|
|
14719
|
+
uniqueSignersCount
|
|
14715
14720
|
);
|
|
14716
|
-
if (historicalTimestamp) {
|
|
14721
|
+
if (this.#historicalTimestamp) {
|
|
14717
14722
|
for (const resp of fromRedstone) {
|
|
14718
14723
|
const key = cacheKey(
|
|
14719
14724
|
dataServiceId,
|
|
14720
14725
|
resp.dataFeedId,
|
|
14721
14726
|
uniqueSignersCount,
|
|
14722
|
-
historicalTimestamp
|
|
14727
|
+
this.#historicalTimestamp
|
|
14723
14728
|
);
|
|
14724
14729
|
this.#cache.set(key, resp);
|
|
14725
14730
|
}
|
|
@@ -14732,10 +14737,9 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14732
14737
|
* @param dataServiceId
|
|
14733
14738
|
* @param dataFeedsIds
|
|
14734
14739
|
* @param uniqueSignersCount
|
|
14735
|
-
* @param historicalTimestamp
|
|
14736
14740
|
* @returns
|
|
14737
14741
|
*/
|
|
14738
|
-
async #fetchPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount
|
|
14742
|
+
async #fetchPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount) {
|
|
14739
14743
|
if (dataFeedsIds.size === 0) {
|
|
14740
14744
|
return [];
|
|
14741
14745
|
}
|
|
@@ -14744,7 +14748,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14744
14748
|
dataServiceId,
|
|
14745
14749
|
dataPackagesIds,
|
|
14746
14750
|
uniqueSignersCount,
|
|
14747
|
-
historicalTimestamp
|
|
14751
|
+
historicalTimestamp: this.#historicalTimestamp
|
|
14748
14752
|
});
|
|
14749
14753
|
const dataPayload = await wrapper.prepareRedstonePayload(true);
|
|
14750
14754
|
const parsed = redstoneProtocol.RedstonePayload.parse(viem.toBytes(`0x${dataPayload}`));
|
|
@@ -14890,6 +14894,7 @@ var ZeroPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
14890
14894
|
// src/sdk/market/pricefeeds/PriceFeedsRegister.ts
|
|
14891
14895
|
var PriceFeedRegister = class extends SDKConstruct {
|
|
14892
14896
|
logger;
|
|
14897
|
+
#hooks = new Hooks();
|
|
14893
14898
|
#feeds = new AddressMap();
|
|
14894
14899
|
#redstoneUpdater;
|
|
14895
14900
|
// public readonly zeroPriceFeed: ZeroPriceFeedContract;
|
|
@@ -14898,13 +14903,14 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14898
14903
|
this.logger = childLogger("PriceFeedRegister", sdk.logger);
|
|
14899
14904
|
this.#redstoneUpdater = new RedstoneUpdater(sdk);
|
|
14900
14905
|
}
|
|
14906
|
+
addHook = this.#hooks.addHook.bind(this);
|
|
14907
|
+
removeHook = this.#hooks.removeHook.bind(this);
|
|
14901
14908
|
/**
|
|
14902
14909
|
* Returns RawTxs to update price feeds
|
|
14903
14910
|
* @param priceFeeds top-level price feeds, actual updatable price feeds will be derived. If not provided will use all price feeds that are attached
|
|
14904
|
-
* @param blockNumber Block number, set to use historical data
|
|
14905
14911
|
* @returns
|
|
14906
14912
|
*/
|
|
14907
|
-
async generatePriceFeedsUpdateTxs(priceFeeds
|
|
14913
|
+
async generatePriceFeedsUpdateTxs(priceFeeds) {
|
|
14908
14914
|
const priceFeedz = priceFeeds ?? Object.values(this.#feeds);
|
|
14909
14915
|
const updateables = priceFeedz.flatMap((pf) => pf.updatableDependencies());
|
|
14910
14916
|
const txs = [];
|
|
@@ -14916,10 +14922,7 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14916
14922
|
}
|
|
14917
14923
|
let maxTimestamp = 0;
|
|
14918
14924
|
if (redstonePFs.length > 0) {
|
|
14919
|
-
const redstoneUpdates = await this.#redstoneUpdater.getUpdateTxs(
|
|
14920
|
-
redstonePFs,
|
|
14921
|
-
blockNumber
|
|
14922
|
-
);
|
|
14925
|
+
const redstoneUpdates = await this.#redstoneUpdater.getUpdateTxs(redstonePFs);
|
|
14923
14926
|
for (const { tx, timestamp } of redstoneUpdates) {
|
|
14924
14927
|
if (timestamp > maxTimestamp) {
|
|
14925
14928
|
maxTimestamp = timestamp;
|
|
@@ -14927,7 +14930,9 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14927
14930
|
txs.push(tx);
|
|
14928
14931
|
}
|
|
14929
14932
|
}
|
|
14930
|
-
|
|
14933
|
+
const result = { txs, timestamp: maxTimestamp };
|
|
14934
|
+
await this.#hooks.triggerHooks("updatesGenerated", result);
|
|
14935
|
+
return result;
|
|
14931
14936
|
}
|
|
14932
14937
|
get(address) {
|
|
14933
14938
|
return this.#feeds.get(address);
|
|
@@ -14940,6 +14945,13 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14940
14945
|
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
14941
14946
|
return feed;
|
|
14942
14947
|
}
|
|
14948
|
+
/**
|
|
14949
|
+
* Set redstone historical timestamp
|
|
14950
|
+
* @param timestampMs in milliseconds
|
|
14951
|
+
*/
|
|
14952
|
+
setRedstoneHistoricalTimestamp(timestampMs) {
|
|
14953
|
+
this.#redstoneUpdater.setHistoricalTimestamp(timestampMs);
|
|
14954
|
+
}
|
|
14943
14955
|
#create(data) {
|
|
14944
14956
|
const contractType = bytes32ToString(
|
|
14945
14957
|
data.baseParams.contractType
|
|
@@ -15055,7 +15067,7 @@ var PriceOracleContract = class extends BaseContract {
|
|
|
15055
15067
|
* Generates updates for all updateable price feeds in this oracle (including dependencies)
|
|
15056
15068
|
* @returns
|
|
15057
15069
|
*/
|
|
15058
|
-
async
|
|
15070
|
+
async updatePriceFeeds() {
|
|
15059
15071
|
const updatables = [];
|
|
15060
15072
|
for (const node of this.#priceFeedTree) {
|
|
15061
15073
|
if (node.updatable) {
|
|
@@ -15451,6 +15463,7 @@ var SWAP_OPERATIONS = {
|
|
|
15451
15463
|
};
|
|
15452
15464
|
var RouterV3Contract = class extends BaseContract {
|
|
15453
15465
|
#connectors;
|
|
15466
|
+
#hooks = new Hooks();
|
|
15454
15467
|
constructor(sdk, address) {
|
|
15455
15468
|
super(sdk, {
|
|
15456
15469
|
addr: address,
|
|
@@ -15459,6 +15472,8 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15459
15472
|
});
|
|
15460
15473
|
this.#connectors = sdkGov.getConnectors(sdk.provider.networkType);
|
|
15461
15474
|
}
|
|
15475
|
+
addHook = this.#hooks.addHook.bind(this);
|
|
15476
|
+
removeHook = this.#hooks.removeHook.bind(this);
|
|
15462
15477
|
/**
|
|
15463
15478
|
* Finds all available swaps for NORMAL tokens
|
|
15464
15479
|
* @param ca
|
|
@@ -15592,7 +15607,10 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15592
15607
|
*/
|
|
15593
15608
|
async findBestClosePath(ca, cm, slippage) {
|
|
15594
15609
|
const { pathOptions, expected, leftover, connectors } = this.getFindClosePathInput(ca, cm);
|
|
15595
|
-
this.
|
|
15610
|
+
await this.#hooks.triggerHooks("foundPathOptions", {
|
|
15611
|
+
creditAccount: ca.creditAccount,
|
|
15612
|
+
pathOptions
|
|
15613
|
+
});
|
|
15596
15614
|
let results = [];
|
|
15597
15615
|
for (const po of pathOptions) {
|
|
15598
15616
|
const { result: result2 } = await this.contract.simulate.findBestClosePath(
|
|
@@ -15627,7 +15645,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15627
15645
|
})),
|
|
15628
15646
|
underlyingBalance: underlyingBalance + bestResult.minAmount
|
|
15629
15647
|
};
|
|
15630
|
-
this.
|
|
15648
|
+
await this.#hooks.triggerHooks("foundBestClosePath", {
|
|
15631
15649
|
creditAccount: ca.creditAccount,
|
|
15632
15650
|
...result
|
|
15633
15651
|
});
|
|
@@ -15687,7 +15705,7 @@ function assetsMap(assets) {
|
|
|
15687
15705
|
}
|
|
15688
15706
|
|
|
15689
15707
|
// src/sdk/GearboxSDK.ts
|
|
15690
|
-
var GearboxSDK = class _GearboxSDK
|
|
15708
|
+
var GearboxSDK = class _GearboxSDK {
|
|
15691
15709
|
// Represents chain object
|
|
15692
15710
|
#provider;
|
|
15693
15711
|
// Block which was use for data query
|
|
@@ -15750,7 +15768,6 @@ var GearboxSDK = class _GearboxSDK extends eventemitter3.EventEmitter {
|
|
|
15750
15768
|
}).#attach(addressProvider, riskCurators);
|
|
15751
15769
|
}
|
|
15752
15770
|
constructor(options) {
|
|
15753
|
-
super();
|
|
15754
15771
|
this.#provider = options.provider;
|
|
15755
15772
|
this.logger = options.logger;
|
|
15756
15773
|
this.priceFeeds = new PriceFeedRegister(this);
|
|
@@ -16388,6 +16405,7 @@ exports.createAnvilClient = createAnvilClient;
|
|
|
16388
16405
|
exports.createRawTx = createRawTx;
|
|
16389
16406
|
exports.detectNetwork = detectNetwork;
|
|
16390
16407
|
exports.etherscanUrl = etherscanUrl;
|
|
16408
|
+
exports.evmMineDetailed = evmMineDetailed;
|
|
16391
16409
|
exports.filterDust = filterDust;
|
|
16392
16410
|
exports.fmtBinaryMask = fmtBinaryMask;
|
|
16393
16411
|
exports.formatBN = formatBN;
|
package/dist/cjs/sdk/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Address, Chain, PublicClient, Transport, Hex, Abi, DecodeFunctionDataReturnType, Log, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, GetContractReturnType, Client, Prettify, TestActions, WalletClient, TestRpcSchema,
|
|
2
|
-
import { EventEmitter } from 'eventemitter3';
|
|
1
|
+
import { Address, Chain, PublicClient, Transport, Hex, Abi, DecodeFunctionDataReturnType, Log, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, GetContractReturnType, Client, Block, Prettify, TestActions, WalletClient, TestRpcSchema, ContractFunctionParameters, CallParameters, MulticallContracts, Narrow, AbiStateMutability, MulticallResults, GetChainContractAddressErrorType, ReadContractErrorType, GetContractErrorReturnType, EncodeFunctionDataErrorType, DecodeFunctionResultErrorType } from 'viem';
|
|
3
2
|
import { RouterComponentRegister, TokenTypeToResolver } from '@gearbox-protocol/sdk-gov';
|
|
4
3
|
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
|
5
4
|
|
|
@@ -14867,25 +14866,42 @@ declare class MellowLRTPriceFeedContract extends AbstractLPPriceFeedContract<abi
|
|
|
14867
14866
|
getValue(): Promise<bigint>;
|
|
14868
14867
|
}
|
|
14869
14868
|
|
|
14869
|
+
interface IHooks<HookMap extends Record<string, any[]>> {
|
|
14870
|
+
addHook: <K extends keyof HookMap>(hookName: K, fn: (...args: HookMap[K]) => void | Promise<void>) => void;
|
|
14871
|
+
removeHook: <K extends keyof HookMap>(hookName: K, fn: (...args: HookMap[K]) => void | Promise<void>) => void;
|
|
14872
|
+
}
|
|
14873
|
+
|
|
14874
|
+
type PriceFeedRegisterHooks = {
|
|
14875
|
+
/**
|
|
14876
|
+
* Emitted when transactions to update price feeds have been generated, but before they're used anywhere
|
|
14877
|
+
*/
|
|
14878
|
+
updatesGenerated: [UpdatePriceFeedsResult];
|
|
14879
|
+
};
|
|
14870
14880
|
/**
|
|
14871
14881
|
* PriceFeedRegister acts as a chain-level cache to avoid creating multiple contract instances.
|
|
14872
14882
|
* It's reused by PriceFeedFactory belonging to different markets
|
|
14873
14883
|
*
|
|
14874
14884
|
**/
|
|
14875
|
-
declare class PriceFeedRegister extends SDKConstruct {
|
|
14885
|
+
declare class PriceFeedRegister extends SDKConstruct implements IHooks<PriceFeedRegisterHooks> {
|
|
14876
14886
|
#private;
|
|
14877
14887
|
readonly logger?: ILogger;
|
|
14878
14888
|
constructor(sdk: GearboxSDK);
|
|
14889
|
+
addHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
14890
|
+
removeHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
14879
14891
|
/**
|
|
14880
14892
|
* Returns RawTxs to update price feeds
|
|
14881
14893
|
* @param priceFeeds top-level price feeds, actual updatable price feeds will be derived. If not provided will use all price feeds that are attached
|
|
14882
|
-
* @param blockNumber Block number, set to use historical data
|
|
14883
14894
|
* @returns
|
|
14884
14895
|
*/
|
|
14885
|
-
generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[]
|
|
14896
|
+
generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[]): Promise<UpdatePriceFeedsResult>;
|
|
14886
14897
|
get(address: Address): IPriceFeedContract | undefined;
|
|
14887
14898
|
mustGet(address: Address): IPriceFeedContract;
|
|
14888
14899
|
create(data: PriceFeedTreeNode): IPriceFeedContract;
|
|
14900
|
+
/**
|
|
14901
|
+
* Set redstone historical timestamp
|
|
14902
|
+
* @param timestampMs in milliseconds
|
|
14903
|
+
*/
|
|
14904
|
+
setRedstoneHistoricalTimestamp(timestampMs: number): void;
|
|
14889
14905
|
}
|
|
14890
14906
|
|
|
14891
14907
|
type abi$f = typeof redstonePriceFeedAbi;
|
|
@@ -16869,7 +16885,7 @@ declare class PriceOracleContract extends BaseContract<abi$1> {
|
|
|
16869
16885
|
* Generates updates for all updateable price feeds in this oracle (including dependencies)
|
|
16870
16886
|
* @returns
|
|
16871
16887
|
*/
|
|
16872
|
-
|
|
16888
|
+
updatePriceFeeds(): Promise<UpdatePriceFeedsResult>;
|
|
16873
16889
|
/**
|
|
16874
16890
|
* Converts previously obtained price updates into CreditFacade multicall entries
|
|
16875
16891
|
* @param creditFacade
|
|
@@ -16968,6 +16984,29 @@ interface FindClosePathInput {
|
|
|
16968
16984
|
leftover: Asset[];
|
|
16969
16985
|
connectors: Address[];
|
|
16970
16986
|
}
|
|
16987
|
+
type RouterHooks = {
|
|
16988
|
+
/**
|
|
16989
|
+
* Internal router event
|
|
16990
|
+
*/
|
|
16991
|
+
foundPathOptions: [
|
|
16992
|
+
{
|
|
16993
|
+
creditAccount: Address;
|
|
16994
|
+
pathOptions: PathOptionSerie[];
|
|
16995
|
+
}
|
|
16996
|
+
];
|
|
16997
|
+
/**
|
|
16998
|
+
* Internal router event
|
|
16999
|
+
*/
|
|
17000
|
+
foundBestClosePath: [
|
|
17001
|
+
{
|
|
17002
|
+
creditAccount: Address;
|
|
17003
|
+
amount: bigint;
|
|
17004
|
+
minAmount: bigint;
|
|
17005
|
+
calls: MultiCall[];
|
|
17006
|
+
underlyingBalance: bigint;
|
|
17007
|
+
}
|
|
17008
|
+
];
|
|
17009
|
+
};
|
|
16971
17010
|
/**
|
|
16972
17011
|
* Slice of credit manager data required for router operations
|
|
16973
17012
|
*/
|
|
@@ -16975,9 +17014,11 @@ interface CreditManagerSlice {
|
|
|
16975
17014
|
address: Address;
|
|
16976
17015
|
collateralTokens: Address[];
|
|
16977
17016
|
}
|
|
16978
|
-
declare class RouterV3Contract extends BaseContract<abi> {
|
|
17017
|
+
declare class RouterV3Contract extends BaseContract<abi> implements IHooks<RouterHooks> {
|
|
16979
17018
|
#private;
|
|
16980
17019
|
constructor(sdk: GearboxSDK, address: Address);
|
|
17020
|
+
addHook: <K extends keyof RouterHooks>(hookName: K, fn: (...args: RouterHooks[K]) => void | Promise<void>) => void;
|
|
17021
|
+
removeHook: <K extends keyof RouterHooks>(hookName: K, fn: (...args: RouterHooks[K]) => void | Promise<void>) => void;
|
|
16981
17022
|
/**
|
|
16982
17023
|
* Finds all available swaps for NORMAL tokens
|
|
16983
17024
|
* @param ca
|
|
@@ -17035,27 +17076,6 @@ declare class RouterV3Contract extends BaseContract<abi> {
|
|
|
17035
17076
|
getAvailableConnectors(collateralTokens: Address[]): Address[];
|
|
17036
17077
|
}
|
|
17037
17078
|
|
|
17038
|
-
interface SDKEventsMap {
|
|
17039
|
-
/**
|
|
17040
|
-
* Emitted by router
|
|
17041
|
-
*/
|
|
17042
|
-
foundPathOptions: [{
|
|
17043
|
-
pathOptions: PathOptionSerie[];
|
|
17044
|
-
}];
|
|
17045
|
-
/**
|
|
17046
|
-
* Emitted by router
|
|
17047
|
-
*/
|
|
17048
|
-
foundBestClosePath: [
|
|
17049
|
-
{
|
|
17050
|
-
creditAccount: Address;
|
|
17051
|
-
amount: bigint;
|
|
17052
|
-
minAmount: bigint;
|
|
17053
|
-
calls: MultiCall[];
|
|
17054
|
-
underlyingBalance: bigint;
|
|
17055
|
-
}
|
|
17056
|
-
];
|
|
17057
|
-
}
|
|
17058
|
-
|
|
17059
17079
|
interface SDKAttachOptions {
|
|
17060
17080
|
/**
|
|
17061
17081
|
* Account address for contract write simulations
|
|
@@ -17090,7 +17110,7 @@ interface SDKAttachOptions {
|
|
|
17090
17110
|
*/
|
|
17091
17111
|
logger?: ILogger;
|
|
17092
17112
|
}
|
|
17093
|
-
declare class GearboxSDK
|
|
17113
|
+
declare class GearboxSDK {
|
|
17094
17114
|
#private;
|
|
17095
17115
|
readonly logger?: ILogger;
|
|
17096
17116
|
/**
|
|
@@ -17362,6 +17382,7 @@ type AnvilRPCSchema = [
|
|
|
17362
17382
|
type AnvilActions = {
|
|
17363
17383
|
isAnvil: () => Promise<boolean>;
|
|
17364
17384
|
detectNetwork: () => Promise<NetworkType>;
|
|
17385
|
+
evmMineDetailed: (timestamp: bigint) => Promise<Block<Hex> | undefined>;
|
|
17365
17386
|
};
|
|
17366
17387
|
type AnvilClient = Prettify<{
|
|
17367
17388
|
mode: "anvil";
|
|
@@ -17377,6 +17398,13 @@ declare function createAnvilClient({ chain, transport, }: AnvilClientConfig): An
|
|
|
17377
17398
|
* @returns
|
|
17378
17399
|
*/
|
|
17379
17400
|
declare function isAnvil(client: Client<any, any, any, AnvilRPCSchema, any>): Promise<boolean>;
|
|
17401
|
+
/**
|
|
17402
|
+
* Safely tries to mine block with given timestamp
|
|
17403
|
+
* @param client
|
|
17404
|
+
* @param timestamp in seconds
|
|
17405
|
+
* @returns
|
|
17406
|
+
*/
|
|
17407
|
+
declare function evmMineDetailed(client: Client<any, any, any, AnvilRPCSchema, any>, timestamp: bigint): Promise<Block<Hex> | undefined>;
|
|
17380
17408
|
|
|
17381
17409
|
declare function detectNetwork(client: PublicClient): Promise<NetworkType>;
|
|
17382
17410
|
|
|
@@ -17407,4 +17435,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
17407
17435
|
*/
|
|
17408
17436
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
17409
17437
|
|
|
17410
|
-
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type AnvilActions, type AnvilClient, type AnvilClientConfig, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, type ReadContractOptions, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct,
|
|
17438
|
+
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type AnvilActions, type AnvilClient, type AnvilClientConfig, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, type ReadContractOptions, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterHooks, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, TIMELOCK, type TVL, type TokenMetaData, type TokenTypeToResolverHuman, USDC, type UpdatePriceFeedsResult, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, type ZapperInfo, type ZapperInfoHuman, type ZapperRegisterState, type ZapperRegisterStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createAnvilClient, createRawTx, detectNetwork, etherscanUrl, evmMineDetailed, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, isAnvil, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Address, Chain, PublicClient, Transport, Hex, Abi, DecodeFunctionDataReturnType, Log, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, GetContractReturnType, Client, Prettify, TestActions, WalletClient, TestRpcSchema,
|
|
2
|
-
import { EventEmitter } from 'eventemitter3';
|
|
1
|
+
import { Address, Chain, PublicClient, Transport, Hex, Abi, DecodeFunctionDataReturnType, Log, ContractFunctionName, EncodeFunctionDataParameters, TransactionReceipt, GetContractReturnType, Client, Block, Prettify, TestActions, WalletClient, TestRpcSchema, ContractFunctionParameters, CallParameters, MulticallContracts, Narrow, AbiStateMutability, MulticallResults, GetChainContractAddressErrorType, ReadContractErrorType, GetContractErrorReturnType, EncodeFunctionDataErrorType, DecodeFunctionResultErrorType } from 'viem';
|
|
3
2
|
import { RouterComponentRegister, TokenTypeToResolver } from '@gearbox-protocol/sdk-gov';
|
|
4
3
|
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
|
5
4
|
|
|
@@ -14867,25 +14866,42 @@ declare class MellowLRTPriceFeedContract extends AbstractLPPriceFeedContract<abi
|
|
|
14867
14866
|
getValue(): Promise<bigint>;
|
|
14868
14867
|
}
|
|
14869
14868
|
|
|
14869
|
+
interface IHooks<HookMap extends Record<string, any[]>> {
|
|
14870
|
+
addHook: <K extends keyof HookMap>(hookName: K, fn: (...args: HookMap[K]) => void | Promise<void>) => void;
|
|
14871
|
+
removeHook: <K extends keyof HookMap>(hookName: K, fn: (...args: HookMap[K]) => void | Promise<void>) => void;
|
|
14872
|
+
}
|
|
14873
|
+
|
|
14874
|
+
type PriceFeedRegisterHooks = {
|
|
14875
|
+
/**
|
|
14876
|
+
* Emitted when transactions to update price feeds have been generated, but before they're used anywhere
|
|
14877
|
+
*/
|
|
14878
|
+
updatesGenerated: [UpdatePriceFeedsResult];
|
|
14879
|
+
};
|
|
14870
14880
|
/**
|
|
14871
14881
|
* PriceFeedRegister acts as a chain-level cache to avoid creating multiple contract instances.
|
|
14872
14882
|
* It's reused by PriceFeedFactory belonging to different markets
|
|
14873
14883
|
*
|
|
14874
14884
|
**/
|
|
14875
|
-
declare class PriceFeedRegister extends SDKConstruct {
|
|
14885
|
+
declare class PriceFeedRegister extends SDKConstruct implements IHooks<PriceFeedRegisterHooks> {
|
|
14876
14886
|
#private;
|
|
14877
14887
|
readonly logger?: ILogger;
|
|
14878
14888
|
constructor(sdk: GearboxSDK);
|
|
14889
|
+
addHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
14890
|
+
removeHook: <K extends "updatesGenerated">(hookName: K, fn: (...args: PriceFeedRegisterHooks[K]) => void | Promise<void>) => void;
|
|
14879
14891
|
/**
|
|
14880
14892
|
* Returns RawTxs to update price feeds
|
|
14881
14893
|
* @param priceFeeds top-level price feeds, actual updatable price feeds will be derived. If not provided will use all price feeds that are attached
|
|
14882
|
-
* @param blockNumber Block number, set to use historical data
|
|
14883
14894
|
* @returns
|
|
14884
14895
|
*/
|
|
14885
|
-
generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[]
|
|
14896
|
+
generatePriceFeedsUpdateTxs(priceFeeds?: IPriceFeedContract[]): Promise<UpdatePriceFeedsResult>;
|
|
14886
14897
|
get(address: Address): IPriceFeedContract | undefined;
|
|
14887
14898
|
mustGet(address: Address): IPriceFeedContract;
|
|
14888
14899
|
create(data: PriceFeedTreeNode): IPriceFeedContract;
|
|
14900
|
+
/**
|
|
14901
|
+
* Set redstone historical timestamp
|
|
14902
|
+
* @param timestampMs in milliseconds
|
|
14903
|
+
*/
|
|
14904
|
+
setRedstoneHistoricalTimestamp(timestampMs: number): void;
|
|
14889
14905
|
}
|
|
14890
14906
|
|
|
14891
14907
|
type abi$f = typeof redstonePriceFeedAbi;
|
|
@@ -16869,7 +16885,7 @@ declare class PriceOracleContract extends BaseContract<abi$1> {
|
|
|
16869
16885
|
* Generates updates for all updateable price feeds in this oracle (including dependencies)
|
|
16870
16886
|
* @returns
|
|
16871
16887
|
*/
|
|
16872
|
-
|
|
16888
|
+
updatePriceFeeds(): Promise<UpdatePriceFeedsResult>;
|
|
16873
16889
|
/**
|
|
16874
16890
|
* Converts previously obtained price updates into CreditFacade multicall entries
|
|
16875
16891
|
* @param creditFacade
|
|
@@ -16968,6 +16984,29 @@ interface FindClosePathInput {
|
|
|
16968
16984
|
leftover: Asset[];
|
|
16969
16985
|
connectors: Address[];
|
|
16970
16986
|
}
|
|
16987
|
+
type RouterHooks = {
|
|
16988
|
+
/**
|
|
16989
|
+
* Internal router event
|
|
16990
|
+
*/
|
|
16991
|
+
foundPathOptions: [
|
|
16992
|
+
{
|
|
16993
|
+
creditAccount: Address;
|
|
16994
|
+
pathOptions: PathOptionSerie[];
|
|
16995
|
+
}
|
|
16996
|
+
];
|
|
16997
|
+
/**
|
|
16998
|
+
* Internal router event
|
|
16999
|
+
*/
|
|
17000
|
+
foundBestClosePath: [
|
|
17001
|
+
{
|
|
17002
|
+
creditAccount: Address;
|
|
17003
|
+
amount: bigint;
|
|
17004
|
+
minAmount: bigint;
|
|
17005
|
+
calls: MultiCall[];
|
|
17006
|
+
underlyingBalance: bigint;
|
|
17007
|
+
}
|
|
17008
|
+
];
|
|
17009
|
+
};
|
|
16971
17010
|
/**
|
|
16972
17011
|
* Slice of credit manager data required for router operations
|
|
16973
17012
|
*/
|
|
@@ -16975,9 +17014,11 @@ interface CreditManagerSlice {
|
|
|
16975
17014
|
address: Address;
|
|
16976
17015
|
collateralTokens: Address[];
|
|
16977
17016
|
}
|
|
16978
|
-
declare class RouterV3Contract extends BaseContract<abi> {
|
|
17017
|
+
declare class RouterV3Contract extends BaseContract<abi> implements IHooks<RouterHooks> {
|
|
16979
17018
|
#private;
|
|
16980
17019
|
constructor(sdk: GearboxSDK, address: Address);
|
|
17020
|
+
addHook: <K extends keyof RouterHooks>(hookName: K, fn: (...args: RouterHooks[K]) => void | Promise<void>) => void;
|
|
17021
|
+
removeHook: <K extends keyof RouterHooks>(hookName: K, fn: (...args: RouterHooks[K]) => void | Promise<void>) => void;
|
|
16981
17022
|
/**
|
|
16982
17023
|
* Finds all available swaps for NORMAL tokens
|
|
16983
17024
|
* @param ca
|
|
@@ -17035,27 +17076,6 @@ declare class RouterV3Contract extends BaseContract<abi> {
|
|
|
17035
17076
|
getAvailableConnectors(collateralTokens: Address[]): Address[];
|
|
17036
17077
|
}
|
|
17037
17078
|
|
|
17038
|
-
interface SDKEventsMap {
|
|
17039
|
-
/**
|
|
17040
|
-
* Emitted by router
|
|
17041
|
-
*/
|
|
17042
|
-
foundPathOptions: [{
|
|
17043
|
-
pathOptions: PathOptionSerie[];
|
|
17044
|
-
}];
|
|
17045
|
-
/**
|
|
17046
|
-
* Emitted by router
|
|
17047
|
-
*/
|
|
17048
|
-
foundBestClosePath: [
|
|
17049
|
-
{
|
|
17050
|
-
creditAccount: Address;
|
|
17051
|
-
amount: bigint;
|
|
17052
|
-
minAmount: bigint;
|
|
17053
|
-
calls: MultiCall[];
|
|
17054
|
-
underlyingBalance: bigint;
|
|
17055
|
-
}
|
|
17056
|
-
];
|
|
17057
|
-
}
|
|
17058
|
-
|
|
17059
17079
|
interface SDKAttachOptions {
|
|
17060
17080
|
/**
|
|
17061
17081
|
* Account address for contract write simulations
|
|
@@ -17090,7 +17110,7 @@ interface SDKAttachOptions {
|
|
|
17090
17110
|
*/
|
|
17091
17111
|
logger?: ILogger;
|
|
17092
17112
|
}
|
|
17093
|
-
declare class GearboxSDK
|
|
17113
|
+
declare class GearboxSDK {
|
|
17094
17114
|
#private;
|
|
17095
17115
|
readonly logger?: ILogger;
|
|
17096
17116
|
/**
|
|
@@ -17362,6 +17382,7 @@ type AnvilRPCSchema = [
|
|
|
17362
17382
|
type AnvilActions = {
|
|
17363
17383
|
isAnvil: () => Promise<boolean>;
|
|
17364
17384
|
detectNetwork: () => Promise<NetworkType>;
|
|
17385
|
+
evmMineDetailed: (timestamp: bigint) => Promise<Block<Hex> | undefined>;
|
|
17365
17386
|
};
|
|
17366
17387
|
type AnvilClient = Prettify<{
|
|
17367
17388
|
mode: "anvil";
|
|
@@ -17377,6 +17398,13 @@ declare function createAnvilClient({ chain, transport, }: AnvilClientConfig): An
|
|
|
17377
17398
|
* @returns
|
|
17378
17399
|
*/
|
|
17379
17400
|
declare function isAnvil(client: Client<any, any, any, AnvilRPCSchema, any>): Promise<boolean>;
|
|
17401
|
+
/**
|
|
17402
|
+
* Safely tries to mine block with given timestamp
|
|
17403
|
+
* @param client
|
|
17404
|
+
* @param timestamp in seconds
|
|
17405
|
+
* @returns
|
|
17406
|
+
*/
|
|
17407
|
+
declare function evmMineDetailed(client: Client<any, any, any, AnvilRPCSchema, any>, timestamp: bigint): Promise<Block<Hex> | undefined>;
|
|
17380
17408
|
|
|
17381
17409
|
declare function detectNetwork(client: PublicClient): Promise<NetworkType>;
|
|
17382
17410
|
|
|
@@ -17407,4 +17435,4 @@ type MulticallErrorType = GetChainContractAddressErrorType | ReadContractErrorTy
|
|
|
17407
17435
|
*/
|
|
17408
17436
|
declare function simulateMulticall<const contracts extends readonly unknown[], chain extends Chain | undefined, allowFailure extends boolean = true>(client: Client<Transport, chain>, parameters: MulticallParameters<contracts, allowFailure>): Promise<MulticallReturnType<contracts, allowFailure>>;
|
|
17409
17437
|
|
|
17410
|
-
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type AnvilActions, type AnvilClient, type AnvilClientConfig, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, type ReadContractOptions, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct,
|
|
17438
|
+
export { type ACLState, type ACLStateHuman, ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, type AccountFactoryStateHuman, AddressLabeller, AddressMap, AddressProviderContractV3_1, type AddressProviderV3State, type AddressProviderV3StateHuman, type AnvilActions, type AnvilClient, type AnvilClientConfig, type Asset, type AssetPriceFeedState, type AssetPriceFeedStateHuman, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, type BaseContractOptions, type BaseContractState, type BaseContractStateHuman, type BasePriceFeedState, type BasePriceFeedStateHuman, BotListContract, type BotListState, type BotListStateHuman, BotPermissions, type BoundedOracleState, type BoundedOracleStateHuman, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, type ContractMethod, type ContractsRegisterState, type ContractsRegisterStateHuman, type ControllerTimelockV3State, type ControllerTimelockV3StateHuman, type CoreState, type CoreStateHuman, type CreditAccountData, type CreditAccountFilter, CreditAccountsService, CreditConfiguratorContract, type CreditConfiguratorState, type CreditConfiguratorStateHuman, CreditFacadeContract, type CreditFacadeState, type CreditFacadeStateHuman, CreditFactory, type CreditFactoryState, type CreditFactoryStateHuman, CreditManagerContract, type CreditManagerData, type CreditManagerDebtParams, type CreditManagerDebtParamsHuman, type CreditManagerDebtParamsStruct, type CreditManagerState, type CreditManagerStateHuman, CurveCryptoPriceFeedContract, type CurvePoolStruct, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, type DataCompressorV3State, type DegenDistributorState, type DegenDistributorStateHuman, type DegenNFT2State, type DegenNFT2StateHuman, Erc4626PriceFeedContract, type EtherscanURLParam, type FindClosePathInput, GaugeContract, type GaugeParams, type GaugeParamsHuman, type GaugeState, type GaugeStateHuman, GearStakingContract, type GearStakingV3State, type GearStakingV3StateHuman, GearboxSDK, type GearboxState, type GearboxStateHuman, type ILPPriceFeedContract, type ILogger, type IPriceFeedContract, LinearModelContract, type LinearModelState, type LinearModelStateHuman, type LogFn, MAX_UINT256, MIN_INT96, type MarketData, MarketFactory, MarketRegister, type MarketState, type MarketStateHuman, MellowLRTPriceFeedContract, type MultiCall, type MultiPauseState, type MulticallErrorType, type MulticallParameters, type MulticallReturnType, NOT_DEPLOYED, NO_VERSION, type NetworkType, type OnDemandPriceUpdate, type OpenStrategyResult, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, type PathOption, type PathOptionSerie, type PeripheryState, type PeripheryStateHuman, type PolicyStruct, type PolicyStructHuman, PoolContract, type PoolData, PoolFactory, type PoolFactoryState, type PoolFactoryStateHuman, PoolQuotaKeeperContract, type PoolQuotaKeeperData, type PoolQuotaKeeperState, type PoolQuotaKeeperStateHuman, type PoolState, type PoolStateHuman, type PriceFactoryStateHuman, type PriceFeedConstructorArgs, type PriceFeedContractType, type PriceFeedMapEntry, PriceFeedRef, PriceFeedRegister, type PriceFeedRegisterHooks, type PriceFeedState, type PriceFeedStateHuman, type PriceFeedTreeNode, type PriceFeedUsageType, PriceOracleContract, type PriceOracleData, type PriceOracleState, type PriceOracleV3State, type PriceOracleV3StateHuman, Provider, type ProviderOptions, type QuotaParams, type QuotaParamsHuman, RAY, RAY_DECIMALS_POW, type RateKeeperData, type RawTx, type ReadContractOptions, RedstonePriceFeedContract, type RedstonePriceFeedState, type RedstonePriceFeedStateHuman, type RouterCloseResult, type RouterComponentRegisterHuman, type RouterHooks, type RouterResult, type RouterState, type RouterStateHuman, RouterV3Contract, type RouterV3ContractState, type RouterV3ContractStateHuman, type SDKAttachOptions, SDKConstruct, SUPPORTED_CHAINS, type SwapOperation, type SwapTask, TIMELOCK, type TVL, type TokenMetaData, type TokenTypeToResolverHuman, USDC, type UpdatePriceFeedsResult, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, type ZapperInfo, type ZapperInfoHuman, type ZapperRegisterState, type ZapperRegisterStateHuman, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createAnvilClient, createRawTx, detectNetwork, etherscanUrl, evmMineDetailed, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, isAnvil, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
package/dist/esm/sdk/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { isAddress, bytesToString, toBytes, prepareEncodeFunctionData, encodeAbiParameters, concatHex, getContract, isHex, decodeFunctionData, defineChain, http, fallback, createPublicClient, createTestClient, publicActions, walletActions, getChainContractAddress, encodeFunctionData, getContractError, multicall3Abi, AbiDecodingZeroDataError, RawContractError, decodeFunctionResult, BaseError, parseEventLogs, decodeAbiParameters, erc4626Abi, hexToBytes } from 'viem';
|
|
1
|
+
import { isAddress, bytesToString, toBytes, prepareEncodeFunctionData, encodeAbiParameters, concatHex, getContract, isHex, decodeFunctionData, defineChain, http, fallback, createPublicClient, createTestClient, publicActions, walletActions, toHex, getChainContractAddress, encodeFunctionData, getContractError, multicall3Abi, AbiDecodingZeroDataError, RawContractError, decodeFunctionResult, BaseError, parseEventLogs, decodeAbiParameters, erc4626Abi, hexToBytes } from 'viem';
|
|
2
2
|
import { formatAbiItem, getAction } from 'viem/utils';
|
|
3
3
|
import { intervalToDuration, formatDuration as formatDuration$1 } from 'date-fns';
|
|
4
4
|
import { mainnet, arbitrum, optimism, base } from 'viem/chains';
|
|
5
5
|
import { simulateContract } from 'viem/actions';
|
|
6
|
-
import { EventEmitter } from 'eventemitter3';
|
|
7
6
|
import { DataServiceWrapper } from '@redstone-finance/evm-connector';
|
|
8
7
|
import { RedstonePayload } from 'redstone-protocol';
|
|
9
8
|
import { getConnectors, decimals, getTokenSymbol, RouterComponent, TokenType, tokenDataByNetwork, contractParams, curveTokens, balancerLpTokens, isCurveLPToken, yearnTokens, convexTokens, isBalancerLPToken } from '@gearbox-protocol/sdk-gov';
|
|
@@ -13036,7 +13035,8 @@ function createAnvilClient({
|
|
|
13036
13035
|
}
|
|
13037
13036
|
).extend(publicActions).extend(walletActions).extend((client) => ({
|
|
13038
13037
|
isAnvil: () => isAnvil(client),
|
|
13039
|
-
detectNetwork: () => detectNetwork(client)
|
|
13038
|
+
detectNetwork: () => detectNetwork(client),
|
|
13039
|
+
evmMineDetailed: (timestamp) => evmMineDetailed(client, timestamp)
|
|
13040
13040
|
}));
|
|
13041
13041
|
}
|
|
13042
13042
|
async function isAnvil(client) {
|
|
@@ -13050,6 +13050,17 @@ async function isAnvil(client) {
|
|
|
13050
13050
|
return false;
|
|
13051
13051
|
}
|
|
13052
13052
|
}
|
|
13053
|
+
async function evmMineDetailed(client, timestamp) {
|
|
13054
|
+
try {
|
|
13055
|
+
const [block] = await client.request({
|
|
13056
|
+
method: "evm_mine_detailed",
|
|
13057
|
+
params: [toHex(timestamp)]
|
|
13058
|
+
});
|
|
13059
|
+
return block;
|
|
13060
|
+
} catch {
|
|
13061
|
+
return void 0;
|
|
13062
|
+
}
|
|
13063
|
+
}
|
|
13053
13064
|
async function simulateMulticall(client, parameters) {
|
|
13054
13065
|
const {
|
|
13055
13066
|
account,
|
|
@@ -13222,10 +13233,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13222
13233
|
if (raw.success) {
|
|
13223
13234
|
return raw;
|
|
13224
13235
|
}
|
|
13225
|
-
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13226
|
-
void 0,
|
|
13227
|
-
options?.blockNumber
|
|
13228
|
-
);
|
|
13236
|
+
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
13229
13237
|
const resp = await simulateMulticall(this.provider.publicClient, {
|
|
13230
13238
|
account: this.provider.account,
|
|
13231
13239
|
contracts: [
|
|
@@ -13276,10 +13284,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13276
13284
|
minHealthFactor,
|
|
13277
13285
|
maxHealthFactor
|
|
13278
13286
|
};
|
|
13279
|
-
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13280
|
-
void 0,
|
|
13281
|
-
options?.blockNumber
|
|
13282
|
-
);
|
|
13287
|
+
const { txs: priceUpdateTxs, timestamp: _ } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
|
|
13283
13288
|
const allCAs = [];
|
|
13284
13289
|
for (const reverting of [false, true]) {
|
|
13285
13290
|
let offset = 0n;
|
|
@@ -13412,10 +13417,7 @@ var CreditAccountsService = class extends SDKConstruct {
|
|
|
13412
13417
|
const tokens = Array.from(tokensByPool.get(pool) ?? []);
|
|
13413
13418
|
priceFeeds.push(...priceFeedFactory.priceFeedsForTokens(tokens));
|
|
13414
13419
|
}
|
|
13415
|
-
return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(
|
|
13416
|
-
priceFeeds,
|
|
13417
|
-
blockNumber
|
|
13418
|
-
);
|
|
13420
|
+
return this.sdk.priceFeeds.generatePriceFeedsUpdateTxs(priceFeeds);
|
|
13419
13421
|
}
|
|
13420
13422
|
/**
|
|
13421
13423
|
* Returns account price updates in a non-encoded format
|
|
@@ -14538,6 +14540,31 @@ var MellowLRTPriceFeedContract = class extends AbstractLPPriceFeedContract {
|
|
|
14538
14540
|
return stack.totalValue * BigInt(1e18) / stack.totalSupply;
|
|
14539
14541
|
}
|
|
14540
14542
|
};
|
|
14543
|
+
|
|
14544
|
+
// src/sdk/utils/internal/Hooks.ts
|
|
14545
|
+
var Hooks = class {
|
|
14546
|
+
#reg = {};
|
|
14547
|
+
addHook(hookName, fn) {
|
|
14548
|
+
if (!this.#reg[hookName]) {
|
|
14549
|
+
this.#reg[hookName] = [];
|
|
14550
|
+
}
|
|
14551
|
+
this.#reg[hookName].push(fn);
|
|
14552
|
+
}
|
|
14553
|
+
removeHook(hookName, fn) {
|
|
14554
|
+
if (!this.#reg[hookName]) {
|
|
14555
|
+
return;
|
|
14556
|
+
}
|
|
14557
|
+
this.#reg[hookName] = this.#reg[hookName]?.filter((hookFn) => hookFn !== fn) ?? [];
|
|
14558
|
+
}
|
|
14559
|
+
async triggerHooks(hookName, ...args) {
|
|
14560
|
+
if (!this.#reg[hookName]) {
|
|
14561
|
+
return;
|
|
14562
|
+
}
|
|
14563
|
+
for (const fn of this.#reg[hookName]) {
|
|
14564
|
+
await fn(...args);
|
|
14565
|
+
}
|
|
14566
|
+
}
|
|
14567
|
+
};
|
|
14541
14568
|
var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
14542
14569
|
decimals = 8;
|
|
14543
14570
|
dataServiceId;
|
|
@@ -14604,37 +14631,18 @@ var RedstonePriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
14604
14631
|
var RedstoneUpdater = class extends SDKConstruct {
|
|
14605
14632
|
#logger;
|
|
14606
14633
|
#cache = /* @__PURE__ */ new Map();
|
|
14634
|
+
#historicalTimestamp;
|
|
14607
14635
|
constructor(sdk) {
|
|
14608
14636
|
super(sdk);
|
|
14609
14637
|
this.#logger = childLogger("RedstoneUpdater", sdk.logger);
|
|
14610
14638
|
}
|
|
14611
|
-
|
|
14639
|
+
setHistoricalTimestamp(timestamp) {
|
|
14640
|
+
this.#historicalTimestamp = timestamp;
|
|
14641
|
+
}
|
|
14642
|
+
async getUpdateTxs(feeds) {
|
|
14612
14643
|
this.#logger?.debug(
|
|
14613
14644
|
`Redstone: generating update transactions for ${feeds.length} redstone price feeds`
|
|
14614
14645
|
);
|
|
14615
|
-
let historicalTimestamp;
|
|
14616
|
-
if (blockNumber) {
|
|
14617
|
-
const block = await this.sdk.provider.publicClient.getBlock({
|
|
14618
|
-
blockNumber
|
|
14619
|
-
});
|
|
14620
|
-
if (!block) {
|
|
14621
|
-
throw new Error(`cannot get block ${blockNumber}`);
|
|
14622
|
-
}
|
|
14623
|
-
this.#logger?.debug(
|
|
14624
|
-
{ tag: "timing" },
|
|
14625
|
-
`block ${block.number} ${new Date(Number(block.timestamp) * 1e3)}`
|
|
14626
|
-
);
|
|
14627
|
-
const nowMs = (/* @__PURE__ */ new Date()).getTime();
|
|
14628
|
-
const redstoneIntervalMs = 6e4;
|
|
14629
|
-
const anvilTsMs = redstoneIntervalMs * Math.floor(Number(block.timestamp) * 1e3 / redstoneIntervalMs);
|
|
14630
|
-
const fromNowTsMs = redstoneIntervalMs * Math.floor(nowMs / redstoneIntervalMs - 1);
|
|
14631
|
-
historicalTimestamp = Math.min(anvilTsMs, fromNowTsMs);
|
|
14632
|
-
const deltaS = Math.floor((nowMs - historicalTimestamp) / 1e3);
|
|
14633
|
-
this.#logger?.debug(
|
|
14634
|
-
{ tag: "timing" },
|
|
14635
|
-
`will use optimistic timestamp: ${new Date(historicalTimestamp)} (${historicalTimestamp}, delta: ${deltaS}s)`
|
|
14636
|
-
);
|
|
14637
|
-
}
|
|
14638
14646
|
const groupedFeeds = {};
|
|
14639
14647
|
const priceFeeds = /* @__PURE__ */ new Map();
|
|
14640
14648
|
for (const feed of feeds) {
|
|
@@ -14655,8 +14663,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14655
14663
|
const payloads = await this.#getPayloads(
|
|
14656
14664
|
dataServiceId,
|
|
14657
14665
|
group,
|
|
14658
|
-
uniqueSignersCount
|
|
14659
|
-
historicalTimestamp
|
|
14666
|
+
uniqueSignersCount
|
|
14660
14667
|
);
|
|
14661
14668
|
for (const { dataFeedId, data, timestamp } of payloads) {
|
|
14662
14669
|
const priceFeed = priceFeeds.get(dataFeedId);
|
|
@@ -14685,10 +14692,9 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14685
14692
|
* @param dataServiceId
|
|
14686
14693
|
* @param dataFeedsIds
|
|
14687
14694
|
* @param uniqueSignersCount
|
|
14688
|
-
* @param historicalTimestamp
|
|
14689
14695
|
* @returns
|
|
14690
14696
|
*/
|
|
14691
|
-
async #getPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount
|
|
14697
|
+
async #getPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount) {
|
|
14692
14698
|
const fromCache = [];
|
|
14693
14699
|
const uncached = [];
|
|
14694
14700
|
for (const dataFeedId of dataFeedsIds) {
|
|
@@ -14696,10 +14702,10 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14696
14702
|
dataServiceId,
|
|
14697
14703
|
dataFeedId,
|
|
14698
14704
|
uniqueSignersCount,
|
|
14699
|
-
historicalTimestamp
|
|
14705
|
+
this.#historicalTimestamp
|
|
14700
14706
|
);
|
|
14701
14707
|
const cached = this.#cache.get(key);
|
|
14702
|
-
if (historicalTimestamp && !!cached) {
|
|
14708
|
+
if (this.#historicalTimestamp && !!cached) {
|
|
14703
14709
|
fromCache.push(cached);
|
|
14704
14710
|
} else {
|
|
14705
14711
|
uncached.push(dataFeedId);
|
|
@@ -14708,16 +14714,15 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14708
14714
|
const fromRedstone = await this.#fetchPayloads(
|
|
14709
14715
|
dataServiceId,
|
|
14710
14716
|
new Set(uncached),
|
|
14711
|
-
uniqueSignersCount
|
|
14712
|
-
historicalTimestamp
|
|
14717
|
+
uniqueSignersCount
|
|
14713
14718
|
);
|
|
14714
|
-
if (historicalTimestamp) {
|
|
14719
|
+
if (this.#historicalTimestamp) {
|
|
14715
14720
|
for (const resp of fromRedstone) {
|
|
14716
14721
|
const key = cacheKey(
|
|
14717
14722
|
dataServiceId,
|
|
14718
14723
|
resp.dataFeedId,
|
|
14719
14724
|
uniqueSignersCount,
|
|
14720
|
-
historicalTimestamp
|
|
14725
|
+
this.#historicalTimestamp
|
|
14721
14726
|
);
|
|
14722
14727
|
this.#cache.set(key, resp);
|
|
14723
14728
|
}
|
|
@@ -14730,10 +14735,9 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14730
14735
|
* @param dataServiceId
|
|
14731
14736
|
* @param dataFeedsIds
|
|
14732
14737
|
* @param uniqueSignersCount
|
|
14733
|
-
* @param historicalTimestamp
|
|
14734
14738
|
* @returns
|
|
14735
14739
|
*/
|
|
14736
|
-
async #fetchPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount
|
|
14740
|
+
async #fetchPayloads(dataServiceId, dataFeedsIds, uniqueSignersCount) {
|
|
14737
14741
|
if (dataFeedsIds.size === 0) {
|
|
14738
14742
|
return [];
|
|
14739
14743
|
}
|
|
@@ -14742,7 +14746,7 @@ var RedstoneUpdater = class extends SDKConstruct {
|
|
|
14742
14746
|
dataServiceId,
|
|
14743
14747
|
dataPackagesIds,
|
|
14744
14748
|
uniqueSignersCount,
|
|
14745
|
-
historicalTimestamp
|
|
14749
|
+
historicalTimestamp: this.#historicalTimestamp
|
|
14746
14750
|
});
|
|
14747
14751
|
const dataPayload = await wrapper.prepareRedstonePayload(true);
|
|
14748
14752
|
const parsed = RedstonePayload.parse(toBytes(`0x${dataPayload}`));
|
|
@@ -14888,6 +14892,7 @@ var ZeroPriceFeedContract = class extends AbstractPriceFeedContract {
|
|
|
14888
14892
|
// src/sdk/market/pricefeeds/PriceFeedsRegister.ts
|
|
14889
14893
|
var PriceFeedRegister = class extends SDKConstruct {
|
|
14890
14894
|
logger;
|
|
14895
|
+
#hooks = new Hooks();
|
|
14891
14896
|
#feeds = new AddressMap();
|
|
14892
14897
|
#redstoneUpdater;
|
|
14893
14898
|
// public readonly zeroPriceFeed: ZeroPriceFeedContract;
|
|
@@ -14896,13 +14901,14 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14896
14901
|
this.logger = childLogger("PriceFeedRegister", sdk.logger);
|
|
14897
14902
|
this.#redstoneUpdater = new RedstoneUpdater(sdk);
|
|
14898
14903
|
}
|
|
14904
|
+
addHook = this.#hooks.addHook.bind(this);
|
|
14905
|
+
removeHook = this.#hooks.removeHook.bind(this);
|
|
14899
14906
|
/**
|
|
14900
14907
|
* Returns RawTxs to update price feeds
|
|
14901
14908
|
* @param priceFeeds top-level price feeds, actual updatable price feeds will be derived. If not provided will use all price feeds that are attached
|
|
14902
|
-
* @param blockNumber Block number, set to use historical data
|
|
14903
14909
|
* @returns
|
|
14904
14910
|
*/
|
|
14905
|
-
async generatePriceFeedsUpdateTxs(priceFeeds
|
|
14911
|
+
async generatePriceFeedsUpdateTxs(priceFeeds) {
|
|
14906
14912
|
const priceFeedz = priceFeeds ?? Object.values(this.#feeds);
|
|
14907
14913
|
const updateables = priceFeedz.flatMap((pf) => pf.updatableDependencies());
|
|
14908
14914
|
const txs = [];
|
|
@@ -14914,10 +14920,7 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14914
14920
|
}
|
|
14915
14921
|
let maxTimestamp = 0;
|
|
14916
14922
|
if (redstonePFs.length > 0) {
|
|
14917
|
-
const redstoneUpdates = await this.#redstoneUpdater.getUpdateTxs(
|
|
14918
|
-
redstonePFs,
|
|
14919
|
-
blockNumber
|
|
14920
|
-
);
|
|
14923
|
+
const redstoneUpdates = await this.#redstoneUpdater.getUpdateTxs(redstonePFs);
|
|
14921
14924
|
for (const { tx, timestamp } of redstoneUpdates) {
|
|
14922
14925
|
if (timestamp > maxTimestamp) {
|
|
14923
14926
|
maxTimestamp = timestamp;
|
|
@@ -14925,7 +14928,9 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14925
14928
|
txs.push(tx);
|
|
14926
14929
|
}
|
|
14927
14930
|
}
|
|
14928
|
-
|
|
14931
|
+
const result = { txs, timestamp: maxTimestamp };
|
|
14932
|
+
await this.#hooks.triggerHooks("updatesGenerated", result);
|
|
14933
|
+
return result;
|
|
14929
14934
|
}
|
|
14930
14935
|
get(address) {
|
|
14931
14936
|
return this.#feeds.get(address);
|
|
@@ -14938,6 +14943,13 @@ var PriceFeedRegister = class extends SDKConstruct {
|
|
|
14938
14943
|
this.#feeds.upsert(data.baseParams.addr, feed);
|
|
14939
14944
|
return feed;
|
|
14940
14945
|
}
|
|
14946
|
+
/**
|
|
14947
|
+
* Set redstone historical timestamp
|
|
14948
|
+
* @param timestampMs in milliseconds
|
|
14949
|
+
*/
|
|
14950
|
+
setRedstoneHistoricalTimestamp(timestampMs) {
|
|
14951
|
+
this.#redstoneUpdater.setHistoricalTimestamp(timestampMs);
|
|
14952
|
+
}
|
|
14941
14953
|
#create(data) {
|
|
14942
14954
|
const contractType = bytes32ToString(
|
|
14943
14955
|
data.baseParams.contractType
|
|
@@ -15053,7 +15065,7 @@ var PriceOracleContract = class extends BaseContract {
|
|
|
15053
15065
|
* Generates updates for all updateable price feeds in this oracle (including dependencies)
|
|
15054
15066
|
* @returns
|
|
15055
15067
|
*/
|
|
15056
|
-
async
|
|
15068
|
+
async updatePriceFeeds() {
|
|
15057
15069
|
const updatables = [];
|
|
15058
15070
|
for (const node of this.#priceFeedTree) {
|
|
15059
15071
|
if (node.updatable) {
|
|
@@ -15449,6 +15461,7 @@ var SWAP_OPERATIONS = {
|
|
|
15449
15461
|
};
|
|
15450
15462
|
var RouterV3Contract = class extends BaseContract {
|
|
15451
15463
|
#connectors;
|
|
15464
|
+
#hooks = new Hooks();
|
|
15452
15465
|
constructor(sdk, address) {
|
|
15453
15466
|
super(sdk, {
|
|
15454
15467
|
addr: address,
|
|
@@ -15457,6 +15470,8 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15457
15470
|
});
|
|
15458
15471
|
this.#connectors = getConnectors(sdk.provider.networkType);
|
|
15459
15472
|
}
|
|
15473
|
+
addHook = this.#hooks.addHook.bind(this);
|
|
15474
|
+
removeHook = this.#hooks.removeHook.bind(this);
|
|
15460
15475
|
/**
|
|
15461
15476
|
* Finds all available swaps for NORMAL tokens
|
|
15462
15477
|
* @param ca
|
|
@@ -15590,7 +15605,10 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15590
15605
|
*/
|
|
15591
15606
|
async findBestClosePath(ca, cm, slippage) {
|
|
15592
15607
|
const { pathOptions, expected, leftover, connectors } = this.getFindClosePathInput(ca, cm);
|
|
15593
|
-
this.
|
|
15608
|
+
await this.#hooks.triggerHooks("foundPathOptions", {
|
|
15609
|
+
creditAccount: ca.creditAccount,
|
|
15610
|
+
pathOptions
|
|
15611
|
+
});
|
|
15594
15612
|
let results = [];
|
|
15595
15613
|
for (const po of pathOptions) {
|
|
15596
15614
|
const { result: result2 } = await this.contract.simulate.findBestClosePath(
|
|
@@ -15625,7 +15643,7 @@ var RouterV3Contract = class extends BaseContract {
|
|
|
15625
15643
|
})),
|
|
15626
15644
|
underlyingBalance: underlyingBalance + bestResult.minAmount
|
|
15627
15645
|
};
|
|
15628
|
-
this.
|
|
15646
|
+
await this.#hooks.triggerHooks("foundBestClosePath", {
|
|
15629
15647
|
creditAccount: ca.creditAccount,
|
|
15630
15648
|
...result
|
|
15631
15649
|
});
|
|
@@ -15685,7 +15703,7 @@ function assetsMap(assets) {
|
|
|
15685
15703
|
}
|
|
15686
15704
|
|
|
15687
15705
|
// src/sdk/GearboxSDK.ts
|
|
15688
|
-
var GearboxSDK = class _GearboxSDK
|
|
15706
|
+
var GearboxSDK = class _GearboxSDK {
|
|
15689
15707
|
// Represents chain object
|
|
15690
15708
|
#provider;
|
|
15691
15709
|
// Block which was use for data query
|
|
@@ -15748,7 +15766,6 @@ var GearboxSDK = class _GearboxSDK extends EventEmitter {
|
|
|
15748
15766
|
}).#attach(addressProvider, riskCurators);
|
|
15749
15767
|
}
|
|
15750
15768
|
constructor(options) {
|
|
15751
|
-
super();
|
|
15752
15769
|
this.#provider = options.provider;
|
|
15753
15770
|
this.logger = options.logger;
|
|
15754
15771
|
this.priceFeeds = new PriceFeedRegister(this);
|
|
@@ -16277,4 +16294,4 @@ function convertZapperRegisterStateToHuman(state, labelAddress, _raw = true) {
|
|
|
16277
16294
|
};
|
|
16278
16295
|
}
|
|
16279
16296
|
|
|
16280
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, CreditAccountsService, CreditConfiguratorContract, CreditFacadeContract, CreditFactory, CreditManagerContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, GaugeContract, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleContract, Provider, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, USDC, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createAnvilClient, createRawTx, detectNetwork, etherscanUrl, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, isAnvil, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
|
16297
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DEGEN_DISTRIBUTOR, AP_DEGEN_NFT, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MULTI_PAUSE, AP_PARTIAL_LIQUIDATION_BOT, AP_PRICE_ORACLE, AP_ROUTER, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractPriceFeedContract, AddressLabeller, AddressMap, AddressProviderContractV3_1, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BotListContract, BotPermissions, BoundedPriceFeedContract, ChainlinkPriceFeedContract, CompositePriceFeedContract, CreditAccountsService, CreditConfiguratorContract, CreditFacadeContract, CreditFactory, CreditManagerContract, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, Erc4626PriceFeedContract, GaugeContract, GearStakingContract, GearboxSDK, LinearModelContract, MAX_UINT256, MIN_INT96, MarketFactory, MarketRegister, MellowLRTPriceFeedContract, NOT_DEPLOYED, NO_VERSION, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PRICE_DECIMALS, PRICE_DECIMALS_POW, PoolContract, PoolFactory, PoolQuotaKeeperContract, PriceFeedRef, PriceFeedRegister, PriceOracleContract, Provider, RAY, RAY_DECIMALS_POW, RedstonePriceFeedContract, RouterV3Contract, SDKConstruct, SUPPORTED_CHAINS, TIMELOCK, USDC, VotingContractStatus, WAD, WAD_DECIMALS_POW, WstETHPriceFeedContract, YearnPriceFeedContract, ZeroPriceFeedContract, botPermissionsToString, bytes32ToString, chains, childLogger, convertBaseContractState, convertCoreStateToHuman, convertCreditFactoryStateToHuman, convertGaugeStateToHuman, convertGearboxStateToHuman, convertGearboxStateToHumanLA, convertLinearModelStateToHuman, convertPeripheryStateToHuman, convertPoolFactoryStateToHuman, convertPoolQuotaKeeperStateToHuman, convertPoolStateToHuman, convertPriceFeedStateToHuman, convertPriceOracleStateToHuman, convertRouterStateToHuman, convertRouterV3StateToHuman, convertZapperRegisterStateToHuman, createAnvilClient, createRawTx, detectNetwork, etherscanUrl, evmMineDetailed, filterDust, fmtBinaryMask, formatBN, formatBNvalue, formatBn4dig, formatDuration, formatNumberToString_, halfRAY, isAnvil, json_parse, json_stringify, numberWithCommas, percentFmt, simulateMulticall, toHumanFormat };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "3.0.0-vfour.
|
|
3
|
+
"version": "3.0.0-vfour.19",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -46,9 +46,8 @@
|
|
|
46
46
|
"@redstone-finance/evm-connector": "^0.6.2",
|
|
47
47
|
"abitype": "^1.0.6",
|
|
48
48
|
"date-fns": "^4.1.0",
|
|
49
|
-
"eventemitter3": "^5.0.1",
|
|
50
49
|
"redstone-protocol": "^1.0.5",
|
|
51
|
-
"viem": "
|
|
50
|
+
"viem": ">=2.21.0 <3.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
53
|
"@commitlint/cli": "^19.5.0",
|