@gearbox-protocol/sdk 3.0.0-vfour.100 → 3.0.0-vfour.101

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.
@@ -22381,9 +22381,9 @@ var MarketRegister = class extends SDKConstruct {
22381
22381
  this.#logger?.warn(e);
22382
22382
  }
22383
22383
  }
22384
- async loadMarkets(curators) {
22384
+ async loadMarkets(curators, ignoreUpdateablePrices) {
22385
22385
  this.#curators = curators;
22386
- await this.#loadMarkets(curators, []);
22386
+ await this.#loadMarkets(curators, [], ignoreUpdateablePrices);
22387
22387
  }
22388
22388
  async syncState() {
22389
22389
  if (this.marketConfigurator?.dirty) {
@@ -22397,13 +22397,17 @@ var MarketRegister = class extends SDKConstruct {
22397
22397
  await this.#loadMarkets([], pools);
22398
22398
  }
22399
22399
  }
22400
- async #loadMarkets(curators, pools) {
22400
+ async #loadMarkets(curators, pools, ignoreUpdateablePrices) {
22401
22401
  const marketCompressorAddress = this.sdk.addressProvider.getAddress(
22402
22402
  AP_MARKET_COMPRESSOR,
22403
22403
  310
22404
22404
  );
22405
- await this.sdk.priceFeeds.loadUpdatablePriceFeeds(curators, pools);
22406
- const { txs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
22405
+ let txs = [];
22406
+ if (!ignoreUpdateablePrices) {
22407
+ await this.sdk.priceFeeds.loadUpdatablePriceFeeds(curators, pools);
22408
+ const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
22409
+ txs = updates.txs;
22410
+ }
22407
22411
  const resp = await simulateMulticall(this.provider.publicClient, {
22408
22412
  contracts: [
22409
22413
  ...txs.map(rawTxToMulticallPriceUpdate),
@@ -23835,7 +23839,13 @@ var GearboxSDK = class _GearboxSDK {
23835
23839
  addHook = this.#hooks.addHook.bind(this.#hooks);
23836
23840
  removeHook = this.#hooks.removeHook.bind(this.#hooks);
23837
23841
  static async attach(options) {
23838
- const { logger, riskCurators, blockNumber, redstoneHistoricTimestamp } = options;
23842
+ const {
23843
+ logger,
23844
+ riskCurators,
23845
+ blockNumber,
23846
+ redstoneHistoricTimestamp,
23847
+ ignoreUpdateablePrices
23848
+ } = options;
23839
23849
  let { networkType, addressProvider, chainId } = options;
23840
23850
  const attachClient = viem.createPublicClient({
23841
23851
  transport: createTransport(options)
@@ -23865,7 +23875,8 @@ var GearboxSDK = class _GearboxSDK {
23865
23875
  addressProvider,
23866
23876
  riskCurators,
23867
23877
  blockNumber,
23868
- redstoneHistoricTimestamp
23878
+ redstoneHistoricTimestamp,
23879
+ ignoreUpdateablePrices
23869
23880
  });
23870
23881
  }
23871
23882
  constructor(options) {
@@ -23878,7 +23889,8 @@ var GearboxSDK = class _GearboxSDK {
23878
23889
  addressProvider,
23879
23890
  blockNumber,
23880
23891
  redstoneHistoricTimestamp,
23881
- riskCurators
23892
+ riskCurators,
23893
+ ignoreUpdateablePrices
23882
23894
  } = opts;
23883
23895
  const time = Date.now();
23884
23896
  const block = await this.provider.publicClient.getBlock(
@@ -23917,7 +23929,8 @@ var GearboxSDK = class _GearboxSDK {
23917
23929
  );
23918
23930
  this.#marketRegister = new MarketRegister(this);
23919
23931
  await this.#marketRegister.loadMarkets(
23920
- riskCurators ?? [TIMELOCK[this.provider.networkType]]
23932
+ riskCurators ?? [TIMELOCK[this.provider.networkType]],
23933
+ ignoreUpdateablePrices
23921
23934
  );
23922
23935
  try {
23923
23936
  const router = this.#addressProvider.getLatestVersion(AP_ROUTER);
@@ -25588,7 +25588,7 @@ declare class MarketRegister extends SDKConstruct {
25588
25588
  #private;
25589
25589
  readonly marketConfigurator?: MarketConfiguratorContract;
25590
25590
  constructor(sdk: GearboxSDK);
25591
- loadMarkets(curators: Address[]): Promise<void>;
25591
+ loadMarkets(curators: Address[], ignoreUpdateablePrices?: boolean): Promise<void>;
25592
25592
  syncState(): Promise<void>;
25593
25593
  /**
25594
25594
  * Loads new prices and price feeds for given oracles from PriceFeedCompressor, defaults to all oracles
@@ -26040,6 +26040,11 @@ interface SDKOptions {
26040
26040
  * Set to true to enable redstone historical mode using timestamp from attach block
26041
26041
  */
26042
26042
  redstoneHistoricTimestamp?: number | true;
26043
+ /**
26044
+ * Will skip updateable prices on attach and sync
26045
+ * Makes things faster when your service is not intereseted in prices
26046
+ */
26047
+ ignoreUpdateablePrices?: boolean;
26043
26048
  /**
26044
26049
  * Bring your own logger
26045
26050
  */
@@ -25588,7 +25588,7 @@ declare class MarketRegister extends SDKConstruct {
25588
25588
  #private;
25589
25589
  readonly marketConfigurator?: MarketConfiguratorContract;
25590
25590
  constructor(sdk: GearboxSDK);
25591
- loadMarkets(curators: Address[]): Promise<void>;
25591
+ loadMarkets(curators: Address[], ignoreUpdateablePrices?: boolean): Promise<void>;
25592
25592
  syncState(): Promise<void>;
25593
25593
  /**
25594
25594
  * Loads new prices and price feeds for given oracles from PriceFeedCompressor, defaults to all oracles
@@ -26040,6 +26040,11 @@ interface SDKOptions {
26040
26040
  * Set to true to enable redstone historical mode using timestamp from attach block
26041
26041
  */
26042
26042
  redstoneHistoricTimestamp?: number | true;
26043
+ /**
26044
+ * Will skip updateable prices on attach and sync
26045
+ * Makes things faster when your service is not intereseted in prices
26046
+ */
26047
+ ignoreUpdateablePrices?: boolean;
26043
26048
  /**
26044
26049
  * Bring your own logger
26045
26050
  */
@@ -22379,9 +22379,9 @@ var MarketRegister = class extends SDKConstruct {
22379
22379
  this.#logger?.warn(e);
22380
22380
  }
22381
22381
  }
22382
- async loadMarkets(curators) {
22382
+ async loadMarkets(curators, ignoreUpdateablePrices) {
22383
22383
  this.#curators = curators;
22384
- await this.#loadMarkets(curators, []);
22384
+ await this.#loadMarkets(curators, [], ignoreUpdateablePrices);
22385
22385
  }
22386
22386
  async syncState() {
22387
22387
  if (this.marketConfigurator?.dirty) {
@@ -22395,13 +22395,17 @@ var MarketRegister = class extends SDKConstruct {
22395
22395
  await this.#loadMarkets([], pools);
22396
22396
  }
22397
22397
  }
22398
- async #loadMarkets(curators, pools) {
22398
+ async #loadMarkets(curators, pools, ignoreUpdateablePrices) {
22399
22399
  const marketCompressorAddress = this.sdk.addressProvider.getAddress(
22400
22400
  AP_MARKET_COMPRESSOR,
22401
22401
  310
22402
22402
  );
22403
- await this.sdk.priceFeeds.loadUpdatablePriceFeeds(curators, pools);
22404
- const { txs } = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
22403
+ let txs = [];
22404
+ if (!ignoreUpdateablePrices) {
22405
+ await this.sdk.priceFeeds.loadUpdatablePriceFeeds(curators, pools);
22406
+ const updates = await this.sdk.priceFeeds.generatePriceFeedsUpdateTxs();
22407
+ txs = updates.txs;
22408
+ }
22405
22409
  const resp = await simulateMulticall(this.provider.publicClient, {
22406
22410
  contracts: [
22407
22411
  ...txs.map(rawTxToMulticallPriceUpdate),
@@ -23833,7 +23837,13 @@ var GearboxSDK = class _GearboxSDK {
23833
23837
  addHook = this.#hooks.addHook.bind(this.#hooks);
23834
23838
  removeHook = this.#hooks.removeHook.bind(this.#hooks);
23835
23839
  static async attach(options) {
23836
- const { logger, riskCurators, blockNumber, redstoneHistoricTimestamp } = options;
23840
+ const {
23841
+ logger,
23842
+ riskCurators,
23843
+ blockNumber,
23844
+ redstoneHistoricTimestamp,
23845
+ ignoreUpdateablePrices
23846
+ } = options;
23837
23847
  let { networkType, addressProvider, chainId } = options;
23838
23848
  const attachClient = createPublicClient({
23839
23849
  transport: createTransport(options)
@@ -23863,7 +23873,8 @@ var GearboxSDK = class _GearboxSDK {
23863
23873
  addressProvider,
23864
23874
  riskCurators,
23865
23875
  blockNumber,
23866
- redstoneHistoricTimestamp
23876
+ redstoneHistoricTimestamp,
23877
+ ignoreUpdateablePrices
23867
23878
  });
23868
23879
  }
23869
23880
  constructor(options) {
@@ -23876,7 +23887,8 @@ var GearboxSDK = class _GearboxSDK {
23876
23887
  addressProvider,
23877
23888
  blockNumber,
23878
23889
  redstoneHistoricTimestamp,
23879
- riskCurators
23890
+ riskCurators,
23891
+ ignoreUpdateablePrices
23880
23892
  } = opts;
23881
23893
  const time = Date.now();
23882
23894
  const block = await this.provider.publicClient.getBlock(
@@ -23915,7 +23927,8 @@ var GearboxSDK = class _GearboxSDK {
23915
23927
  );
23916
23928
  this.#marketRegister = new MarketRegister(this);
23917
23929
  await this.#marketRegister.loadMarkets(
23918
- riskCurators ?? [TIMELOCK[this.provider.networkType]]
23930
+ riskCurators ?? [TIMELOCK[this.provider.networkType]],
23931
+ ignoreUpdateablePrices
23919
23932
  );
23920
23933
  try {
23921
23934
  const router = this.#addressProvider.getLatestVersion(AP_ROUTER);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.0-vfour.100",
3
+ "version": "3.0.0-vfour.101",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.cjs",