@gearbox-protocol/sdk 3.0.1-next.4 → 3.0.1-next.6

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.
@@ -44,6 +44,9 @@ class CreditAccountsService extends import_base.SDKConstruct {
44
44
  );
45
45
  this.#batchSize = options?.batchSize;
46
46
  this.#logger = (0, import_utils.childLogger)("CreditAccountsService", sdk.logger);
47
+ this.#logger?.debug(
48
+ `credit account compressor address: ${this.#compressor}`
49
+ );
47
50
  }
48
51
  /**
49
52
  * Returns single credit account data, or undefined if it's not found
@@ -722,31 +725,37 @@ class CreditAccountsService extends import_base.SDKConstruct {
722
725
  { args: (0, import_utils2.stringifyGetCreditAccountsArgs)(args) },
723
726
  "getting credit accounts"
724
727
  );
728
+ let resp;
725
729
  if (priceUpdateTxs?.length) {
726
- const [resp] = await (0, import_viem2.simulateWithPriceUpdates)(
727
- this.provider.publicClient,
728
- {
729
- priceUpdates: priceUpdateTxs,
730
- contracts: [
731
- {
732
- abi: import_compressors.iCreditAccountCompressorAbi,
733
- address: this.#compressor,
734
- functionName: "getCreditAccounts",
735
- args
736
- }
737
- ],
738
- blockNumber
739
- }
740
- );
741
- return resp;
730
+ [resp] = await (0, import_viem2.simulateWithPriceUpdates)(this.provider.publicClient, {
731
+ priceUpdates: priceUpdateTxs,
732
+ contracts: [
733
+ {
734
+ abi: import_compressors.iCreditAccountCompressorAbi,
735
+ address: this.#compressor,
736
+ functionName: "getCreditAccounts",
737
+ args
738
+ }
739
+ ],
740
+ blockNumber
741
+ });
742
+ } else {
743
+ resp = await this.provider.publicClient.readContract({
744
+ abi: import_compressors.iCreditAccountCompressorAbi,
745
+ address: this.#compressor,
746
+ functionName: "getCreditAccounts",
747
+ args,
748
+ blockNumber
749
+ });
742
750
  }
743
- return this.provider.publicClient.readContract({
744
- abi: import_compressors.iCreditAccountCompressorAbi,
745
- address: this.#compressor,
746
- functionName: "getCreditAccounts",
747
- args,
748
- blockNumber
749
- });
751
+ this.#logger?.debug(
752
+ {
753
+ accounts: resp[0]?.length ?? 0,
754
+ nextOffset: Number(resp[1])
755
+ },
756
+ "got credit accounts"
757
+ );
758
+ return resp;
750
759
  }
751
760
  /**
752
761
  * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
@@ -80,7 +80,7 @@ const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
80
80
  const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
81
81
  const AP_PRICE_ORACLE = "PRICE_ORACLE";
82
82
  const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
83
- const AP_ROUTER = "LOCAL::ROUTER";
83
+ const AP_ROUTER = "GLOBAL::ROUTER";
84
84
  const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
85
85
  const AP_TREASURY = "TREASURY";
86
86
  const AP_WETH_GATEWAY = "WETH_GATEWAY";
@@ -48,6 +48,9 @@ class CreditAccountsService extends SDKConstruct {
48
48
  );
49
49
  this.#batchSize = options?.batchSize;
50
50
  this.#logger = childLogger("CreditAccountsService", sdk.logger);
51
+ this.#logger?.debug(
52
+ `credit account compressor address: ${this.#compressor}`
53
+ );
51
54
  }
52
55
  /**
53
56
  * Returns single credit account data, or undefined if it's not found
@@ -726,31 +729,37 @@ class CreditAccountsService extends SDKConstruct {
726
729
  { args: stringifyGetCreditAccountsArgs(args) },
727
730
  "getting credit accounts"
728
731
  );
732
+ let resp;
729
733
  if (priceUpdateTxs?.length) {
730
- const [resp] = await simulateWithPriceUpdates(
731
- this.provider.publicClient,
732
- {
733
- priceUpdates: priceUpdateTxs,
734
- contracts: [
735
- {
736
- abi: iCreditAccountCompressorAbi,
737
- address: this.#compressor,
738
- functionName: "getCreditAccounts",
739
- args
740
- }
741
- ],
742
- blockNumber
743
- }
744
- );
745
- return resp;
734
+ [resp] = await simulateWithPriceUpdates(this.provider.publicClient, {
735
+ priceUpdates: priceUpdateTxs,
736
+ contracts: [
737
+ {
738
+ abi: iCreditAccountCompressorAbi,
739
+ address: this.#compressor,
740
+ functionName: "getCreditAccounts",
741
+ args
742
+ }
743
+ ],
744
+ blockNumber
745
+ });
746
+ } else {
747
+ resp = await this.provider.publicClient.readContract({
748
+ abi: iCreditAccountCompressorAbi,
749
+ address: this.#compressor,
750
+ functionName: "getCreditAccounts",
751
+ args,
752
+ blockNumber
753
+ });
746
754
  }
747
- return this.provider.publicClient.readContract({
748
- abi: iCreditAccountCompressorAbi,
749
- address: this.#compressor,
750
- functionName: "getCreditAccounts",
751
- args,
752
- blockNumber
753
- });
755
+ this.#logger?.debug(
756
+ {
757
+ accounts: resp[0]?.length ?? 0,
758
+ nextOffset: Number(resp[1])
759
+ },
760
+ "got credit accounts"
761
+ );
762
+ return resp;
754
763
  }
755
764
  /**
756
765
  * Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
@@ -24,7 +24,7 @@ const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
24
24
  const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
25
25
  const AP_PRICE_ORACLE = "PRICE_ORACLE";
26
26
  const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
27
- const AP_ROUTER = "LOCAL::ROUTER";
27
+ const AP_ROUTER = "GLOBAL::ROUTER";
28
28
  const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
29
29
  const AP_TREASURY = "TREASURY";
30
30
  const AP_WETH_GATEWAY = "WETH_GATEWAY";
@@ -25,7 +25,7 @@ export declare const AP_PERIPHERY_COMPRESSOR = "GLOBAL::PERIPHERY_COMPRESSOR";
25
25
  export declare const AP_PRICE_FEED_COMPRESSOR = "GLOBAL::PRICE_FEED_COMPRESSOR";
26
26
  export declare const AP_PRICE_ORACLE = "PRICE_ORACLE";
27
27
  export declare const AP_REWARDS_COMPRESSOR = "GLOBAL::REWARDS_COMPRESSOR";
28
- export declare const AP_ROUTER = "LOCAL::ROUTER";
28
+ export declare const AP_ROUTER = "GLOBAL::ROUTER";
29
29
  export declare const AP_TOKEN_COMPRESSOR = "GLOBAL::TOKEN_COMPRESSOR";
30
30
  export declare const AP_TREASURY = "TREASURY";
31
31
  export declare const AP_WETH_GATEWAY = "WETH_GATEWAY";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "3.0.1-next.4",
3
+ "version": "3.0.1-next.6",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",