@tokemak/queries 0.6.0 → 0.7.0

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.
@@ -1,4 +1,4 @@
1
- import type { PublicClient } from "viem";
1
+ import type { Address, PublicClient } from "viem";
2
2
  import { SupportedChainIds } from "@tokemak/config";
3
3
  import { IProtocol, IToken } from "@tokemak/tokenlist";
4
4
  import { TokenPrices } from "./getTokenPrices";
@@ -9,9 +9,11 @@ export type Currencies = TokenPrices & {
9
9
  export type ExtraReward = IToken & {
10
10
  apr: number;
11
11
  };
12
- export declare const getChainAutopools: (client: PublicClient, { chainId, prices }: {
12
+ export declare const getChainAutopools: (client: PublicClient, { chainId, prices, account, blockNumber }: {
13
13
  chainId: SupportedChainIds;
14
14
  prices: TokenPrices;
15
+ account?: Address;
16
+ blockNumber?: bigint;
15
17
  }) => Promise<{
16
18
  isShutdown: boolean;
17
19
  symbol: string;
@@ -50,7 +52,7 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
50
52
  underlyingTokens: {
51
53
  valueUsd: number;
52
54
  value: number;
53
- address: import("abitype").Address;
55
+ address: Address;
54
56
  chainId: number;
55
57
  decimals: number;
56
58
  logoURI: string;
@@ -58,10 +60,10 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
58
60
  symbol: string;
59
61
  audits?: string;
60
62
  extensions?: {
61
- bridgeMainnetAdapter?: import("abitype").Address;
63
+ bridgeMainnetAdapter?: Address;
62
64
  bridgeInfo?: {
63
65
  [chainId: number]: {
64
- tokenAddress: import("abitype").Address;
66
+ tokenAddress: Address;
65
67
  };
66
68
  };
67
69
  rebasing?: boolean;
@@ -136,7 +138,7 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
136
138
  createdAt: Date;
137
139
  baseAsset: {
138
140
  price: number;
139
- address: import("abitype").Address;
141
+ address: Address;
140
142
  chainId: number;
141
143
  decimals: number;
142
144
  logoURI: string;
@@ -144,10 +146,10 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
144
146
  symbol: string;
145
147
  audits?: string;
146
148
  extensions?: {
147
- bridgeMainnetAdapter?: import("abitype").Address;
149
+ bridgeMainnetAdapter?: Address;
148
150
  bridgeInfo?: {
149
151
  [chainId: number]: {
150
- tokenAddress: import("abitype").Address;
152
+ tokenAddress: Address;
151
153
  };
152
154
  };
153
155
  rebasing?: boolean;
@@ -156,7 +158,7 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
156
158
  };
157
159
  denomination: {
158
160
  price: number;
159
- address: import("abitype").Address;
161
+ address: Address;
160
162
  chainId: number;
161
163
  decimals: number;
162
164
  logoURI: string;
@@ -164,10 +166,10 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
164
166
  symbol: string;
165
167
  audits?: string;
166
168
  extensions?: {
167
- bridgeMainnetAdapter?: import("abitype").Address;
169
+ bridgeMainnetAdapter?: Address;
168
170
  bridgeInfo?: {
169
171
  [chainId: number]: {
170
- tokenAddress: import("abitype").Address;
172
+ tokenAddress: Address;
171
173
  };
172
174
  };
173
175
  rebasing?: boolean;
@@ -180,7 +182,7 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
180
182
  valueUsd: number;
181
183
  value: number;
182
184
  allocation: number;
183
- address: import("abitype").Address;
185
+ address: Address;
184
186
  chainId: number;
185
187
  decimals: number;
186
188
  logoURI: string;
@@ -188,10 +190,10 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
188
190
  symbol: string;
189
191
  audits?: string;
190
192
  extensions?: {
191
- bridgeMainnetAdapter?: import("abitype").Address;
193
+ bridgeMainnetAdapter?: Address;
192
194
  bridgeInfo?: {
193
195
  [chainId: number]: {
194
- tokenAddress: import("abitype").Address;
196
+ tokenAddress: Address;
195
197
  };
196
198
  };
197
199
  rebasing?: boolean;
@@ -211,7 +213,7 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
211
213
  valueUsd: number;
212
214
  value: number;
213
215
  allocation: number;
214
- address: import("abitype").Address;
216
+ address: Address;
215
217
  chainId: number;
216
218
  decimals: number;
217
219
  logoURI: string;
@@ -219,10 +221,10 @@ export declare const getChainAutopools: (client: PublicClient, { chainId, prices
219
221
  symbol: string;
220
222
  audits?: string;
221
223
  extensions?: {
222
- bridgeMainnetAdapter?: import("abitype").Address;
224
+ bridgeMainnetAdapter?: Address;
223
225
  bridgeInfo?: {
224
226
  [chainId: number]: {
225
- tokenAddress: import("abitype").Address;
227
+ tokenAddress: Address;
226
228
  };
227
229
  };
228
230
  rebasing?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"getChainAutopools.d.ts","sourceRoot":"","sources":["../../functions/getChainAutopools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAqBpD,OAAO,EAIL,SAAS,EACT,MAAM,EAMP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW/C,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,YAAY,EACpB,qBAGG;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAdU,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;;;oCA7BqB,CAAC;0BACxB,CAAC;;;;;wBAIJ,CAAC;2BAEF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAgiBwvhiD,CAAC;kBAAwC,CAAC;;;;;;;;;;;;;;;;gCAviBxwhiD,CAAC;sBACxB,CAAC;;;;;oBAIJ,CAAC;uBAEF,CAAC;;;;;;;;;;;;;gCAP0B,CAAC;sBACxB,CAAC;;;;;oBAIJ,CAAC;uBAEF,CAAC;;;;;;;;;;;;;;;;;gCAP0B,CAAC;sBACxB,CAAC;;;;;oBAIJ,CAAC;uBAEF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;gCAP0B,CAAC;sBACxB,CAAC;;;;;oBAIJ,CAAC;uBAEF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAqBK,MAAM;iBACZ,MAAM;;;;;;;;;;;;;;;;;;;;;uBADA,MAAM;iBACZ,MAAM;;;;;;;;;;;;;;;;;;;;;;mBADA,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;;;;;;;;mBADA,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;IAygBZ,CAAC"}
1
+ {"version":3,"file":"getChainAutopools.d.ts","sourceRoot":"","sources":["../../functions/getChainAutopools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAqBpD,OAAO,EAIL,SAAS,EACT,MAAM,EAMP,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW/C,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,YAAY,EACpB,2CAKG;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;IAGpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;mBApBU,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;;;oCA7BY,CAAC;0BACxB,CAAC;;;;;wBAID,CAAF;2BACgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAyiBighiD,CAAC;kBAAwC,CAAC;;;;;;;;;;;;;;;;gCA/iBnihiD,CAAC;sBACxB,CAAC;;;;;oBAID,CAAF;uBACgB,CAAC;;;;;;;;;;;;;gCANQ,CAAC;sBACxB,CAAC;;;;;oBAID,CAAF;uBACgB,CAAC;;;;;;;;;;;;;;;;;gCANQ,CAAC;sBACxB,CAAC;;;;;oBAID,CAAF;uBACgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;gCANQ,CAAC;sBACxB,CAAC;;;;;oBAID,CAAF;uBACgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAsBJ,MAAM;iBACZ,MAAM;;;;;;;;;;;;;;;;;;;;;uBADA,MAAM;iBACZ,MAAM;;;;;;;;;;;;;;;;;;;;;;mBADA,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;;;;;;;;mBADA,MAAM;aACZ,MAAM;;;;;;;;;;;;;;;;IAihBZ,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { SupportedChainIds } from "@tokemak/config";
2
- import type { PublicClient } from "viem";
3
- export declare const getEthPriceAtBlock: (client: PublicClient, blockNumber: bigint, chainId: SupportedChainIds) => Promise<bigint>;
2
+ import type { Address, PublicClient } from "viem";
3
+ export declare const getEthPriceAtBlock: (client: PublicClient, blockNumber: bigint, chainId: SupportedChainIds, account?: Address) => Promise<bigint>;
4
4
  //# sourceMappingURL=getEthPriceAtBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEthPriceAtBlock.d.ts","sourceRoot":"","sources":["../../functions/getEthPriceAtBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIzC,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,YAAY,EACpB,aAAa,MAAM,EACnB,SAAS,iBAAiB,oBAoB3B,CAAC"}
1
+ {"version":3,"file":"getEthPriceAtBlock.d.ts","sourceRoot":"","sources":["../../functions/getEthPriceAtBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIlD,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,YAAY,EACpB,aAAa,MAAM,EACnB,SAAS,iBAAiB,EAG1B,UAAU,OAAO,oBAqBlB,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { SupportedChainIds } from "@tokemak/config";
2
- import type { PublicClient } from "viem";
3
- export declare const getPoolsAndDestinations: (client: PublicClient, { chainId }: {
2
+ import type { Address, PublicClient } from "viem";
3
+ export declare const getPoolsAndDestinations: (client: PublicClient, { chainId, account, blockNumber }: {
4
4
  chainId: SupportedChainIds;
5
+ account?: Address;
6
+ blockNumber?: bigint;
5
7
  }) => Promise<({
6
8
  poolAddress: `0x${string}`;
7
9
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getPoolsAndDestinations.d.ts","sourceRoot":"","sources":["../../functions/getPoolsAndDestinations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIzC,eAAO,MAAM,uBAAuB,GAClC,QAAQ,YAAY,EACpB,aAAa;IAAE,OAAO,EAAE,iBAAiB,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAuB5C,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CACrD,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAC3C,CAAC"}
1
+ {"version":3,"file":"getPoolsAndDestinations.d.ts","sourceRoot":"","sources":["../../functions/getPoolsAndDestinations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIlD,eAAO,MAAM,uBAAuB,GAClC,QAAQ,YAAY,EACpB,mCAIG;IACD,OAAO,EAAE,iBAAiB,CAAC;IAK3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAyBF,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CACrD,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAC3C,CAAC"}
@@ -23,16 +23,17 @@ export type RawRebalance = {
23
23
  autopool: string;
24
24
  };
25
25
  export declare const fetchChainRebalances: (chainId: number) => Promise<RawRebalance[]>;
26
- export declare const getRebalanceValueUsd: (rebalance: RawRebalance, chainId: number, client: PublicClient) => Promise<number | null>;
27
- export declare const processRebalance: (rebalance: RawRebalance, chainId: number, client: PublicClient) => Promise<IRebalance>;
28
- export declare const processRebalancesInBatches: (rebalances: RawRebalance[], chainId: number, client: PublicClient) => Promise<IRebalance[]>;
26
+ export declare const getRebalanceValueUsd: (rebalance: RawRebalance, chainId: number, client: PublicClient, account?: Address) => Promise<number | null>;
27
+ export declare const processRebalance: (rebalance: RawRebalance, chainId: number, client: PublicClient, account?: Address) => Promise<IRebalance>;
28
+ export declare const processRebalancesInBatches: (rebalances: RawRebalance[], chainId: number, client: PublicClient, account?: Address) => Promise<IRebalance[]>;
29
29
  export declare const calculateRebalanceStats: (rebalances: IRebalance[]) => {
30
30
  totalRebalances: number;
31
31
  totalRebalanceVolume: number;
32
32
  rebalances: IRebalance[];
33
33
  };
34
- export declare const getRebalanceStats: (getClient: ChainClientGetter, { includeTestnet }: {
34
+ export declare const getRebalanceStats: (getClient: ChainClientGetter, { includeTestnet, account }: {
35
35
  includeTestnet?: boolean;
36
+ account?: Address;
36
37
  }) => Promise<{
37
38
  totalRebalances: number;
38
39
  totalRebalanceVolume: number;
@@ -1 +1 @@
1
- {"version":3,"file":"getRebalanceStats.d.ts","sourceRoot":"","sources":["../../functions/getRebalanceStats.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKpD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAKlD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,YAAY,CAAC;AAG7E,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACR,EAAE,EAAE,OAAO,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,KACd,OAAO,CAAC,YAAY,EAAE,CAaxB,CAAC;AAuBF,eAAO,MAAM,oBAAoB,GAC/B,WAAW,YAAY,EACvB,SAAS,MAAM,EACf,QAAQ,YAAY,KACnB,OAAO,CAAC,MAAM,GAAG,IAAI,CAoBvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,WAAW,YAAY,EACvB,SAAS,MAAM,EACf,QAAQ,YAAY,KACnB,OAAO,CAAC,UAAU,CAgCpB,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,YAAY,YAAY,EAAE,EAC1B,SAAS,MAAM,EACf,QAAQ,YAAY,KACnB,OAAO,CAAC,UAAU,EAAE,CAwBtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU,EAAE;;;;CAY/D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,WAAW,iBAAiB,EAC5B,oBAEG;IACD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;;;;EAeF,CAAC"}
1
+ {"version":3,"file":"getRebalanceStats.d.ts","sourceRoot":"","sources":["../../functions/getRebalanceStats.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAKpD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAKlD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,iBAAiB,KAAK,YAAY,CAAC;AAG7E,eAAO,MAAM,UAAU,MAAM,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE;QACR,EAAE,EAAE,OAAO,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,KACd,OAAO,CAAC,YAAY,EAAE,CAaxB,CAAC;AAuBF,eAAO,MAAM,oBAAoB,GAC/B,WAAW,YAAY,EACvB,SAAS,MAAM,EACf,QAAQ,YAAY,EACpB,UAAU,OAAO,KAChB,OAAO,CAAC,MAAM,GAAG,IAAI,CAqBvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,WAAW,YAAY,EACvB,SAAS,MAAM,EACf,QAAQ,YAAY,EACpB,UAAU,OAAO,KAChB,OAAO,CAAC,UAAU,CAqCpB,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,YAAY,YAAY,EAAE,EAC1B,SAAS,MAAM,EACf,QAAQ,YAAY,EACpB,UAAU,OAAO,KAChB,OAAO,CAAC,UAAU,EAAE,CAwBtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,YAAY,UAAU,EAAE;;;;CAY/D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,WAAW,iBAAiB,EAC5B,6BAGG;IACD,cAAc,CAAC,EAAE,OAAO,CAAC;IAGzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;;;;EAoBF,CAAC"}
package/dist/index.js CHANGED
@@ -731,13 +731,19 @@ var import_chains2 = require("viem/chains");
731
731
  // functions/getPoolsAndDestinations.ts
732
732
  var import_config = require("@tokemak/config");
733
733
  var import_abis = require("@tokemak/abis");
734
- var getPoolsAndDestinations = async (client, { chainId }) => {
734
+ var getPoolsAndDestinations = async (client, {
735
+ chainId,
736
+ account,
737
+ blockNumber
738
+ }) => {
735
739
  try {
736
740
  const { lens } = (0, import_config.getCoreConfig)(chainId);
737
741
  const { autoPools, destinations } = await client.readContract({
738
742
  address: lens,
739
743
  abi: import_abis.lensAbi,
740
- functionName: "getPoolsAndDestinations"
744
+ functionName: "getPoolsAndDestinations",
745
+ account,
746
+ blockNumber
741
747
  });
742
748
  const autopoolsAndDestinations = mergeArraysWithKey(
743
749
  autoPools,
@@ -754,7 +760,9 @@ var getPoolsAndDestinations = async (client, { chainId }) => {
754
760
  var import_constants6 = require("@tokemak/constants");
755
761
  var getChainAutopools = async (client, {
756
762
  chainId,
757
- prices
763
+ prices,
764
+ account,
765
+ blockNumber
758
766
  }) => {
759
767
  const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = (0, import_graph_cli.getSdkByChainId)(chainId);
760
768
  try {
@@ -767,7 +775,9 @@ var getChainAutopools = async (client, {
767
775
  chainId
768
776
  });
769
777
  const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
770
- chainId
778
+ chainId,
779
+ account,
780
+ blockNumber
771
781
  });
772
782
  if (!autopoolsAndDestinations) {
773
783
  throw new Error(`No autopools and destinations found for ${chainId}`);
@@ -5612,7 +5622,7 @@ var import_graph_cli17 = require("@tokemak/graph-cli");
5612
5622
  var import_config18 = require("@tokemak/config");
5613
5623
  var import_abis22 = require("@tokemak/abis");
5614
5624
  var import_tokenlist13 = require("@tokemak/tokenlist");
5615
- var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
5625
+ var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
5616
5626
  const config = (0, import_config18.getCoreConfig)(chainId);
5617
5627
  const rootPriceOracle = config.rootPriceOracle;
5618
5628
  const weth = config.weth;
@@ -5622,7 +5632,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
5622
5632
  abi: import_abis22.rootPriceOracleAbi,
5623
5633
  functionName: "getPriceInQuote",
5624
5634
  args: [weth, usdc],
5625
- blockNumber
5635
+ blockNumber,
5636
+ account
5626
5637
  });
5627
5638
  return priceAtBlock;
5628
5639
  };
@@ -5652,14 +5663,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
5652
5663
  }
5653
5664
  return import_tokenlist14.USDC_TOKEN.decimals;
5654
5665
  }
5655
- var getRebalanceValueUsd = async (rebalance, chainId, client) => {
5666
+ var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
5656
5667
  const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
5657
5668
  if (ethWei === 0n) return null;
5658
5669
  try {
5659
5670
  const price = await getEthPriceAtBlock(
5660
5671
  client,
5661
5672
  BigInt(rebalance.blockNumber),
5662
- chainId
5673
+ chainId,
5674
+ account
5663
5675
  );
5664
5676
  const ethUsd = Number((0, import_utils47.formatUnitsNum)(price, import_tokenlist14.USDC_TOKEN.decimals));
5665
5677
  const ethAmt = Number((0, import_utils47.formatEtherNum)(ethWei));
@@ -5670,7 +5682,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
5670
5682
  return null;
5671
5683
  }
5672
5684
  };
5673
- var processRebalance = async (rebalance, chainId, client) => {
5685
+ var processRebalance = async (rebalance, chainId, client, account) => {
5674
5686
  const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
5675
5687
  const baseAssetAmount = Number(
5676
5688
  (0, import_utils47.formatUnitsNum)(
@@ -5678,7 +5690,12 @@ var processRebalance = async (rebalance, chainId, client) => {
5678
5690
  baseDecimals
5679
5691
  )
5680
5692
  );
5681
- const ethPathUsd = await getRebalanceValueUsd(rebalance, chainId, client);
5693
+ const ethPathUsd = await getRebalanceValueUsd(
5694
+ rebalance,
5695
+ chainId,
5696
+ client,
5697
+ account
5698
+ );
5682
5699
  if (ethPathUsd != null) {
5683
5700
  return {
5684
5701
  autopool: rebalance.autopool,
@@ -5698,12 +5715,12 @@ var processRebalance = async (rebalance, chainId, client) => {
5698
5715
  valueInAsset: baseAssetAmount
5699
5716
  };
5700
5717
  };
5701
- var processRebalancesInBatches = async (rebalances, chainId, client) => {
5718
+ var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
5702
5719
  const processedRebalances = [];
5703
5720
  for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
5704
5721
  const batch = rebalances.slice(i, i + BATCH_SIZE);
5705
5722
  const batchPromises = batch.map(
5706
- async (rebalance) => processRebalance(rebalance, chainId, client)
5723
+ async (rebalance) => processRebalance(rebalance, chainId, client, account)
5707
5724
  );
5708
5725
  const batchResults = await Promise.all(batchPromises);
5709
5726
  processedRebalances.push(...batchResults);
@@ -5729,14 +5746,20 @@ var calculateRebalanceStats = (rebalances) => {
5729
5746
  };
5730
5747
  };
5731
5748
  var getRebalanceStats = async (getClient, {
5732
- includeTestnet = false
5749
+ includeTestnet = false,
5750
+ account
5733
5751
  }) => {
5734
5752
  const chains = getChainsForEnv({ includeTestnet });
5735
5753
  const rebalances = await Promise.all(
5736
5754
  chains.map(async (chain) => {
5737
5755
  const rawRebalances = await fetchChainRebalances(chain.chainId);
5738
5756
  const client = getClient(chain.chainId);
5739
- return processRebalancesInBatches(rawRebalances, chain.chainId, client);
5757
+ return processRebalancesInBatches(
5758
+ rawRebalances,
5759
+ chain.chainId,
5760
+ client,
5761
+ account
5762
+ );
5740
5763
  })
5741
5764
  );
5742
5765
  const allRebalances = rebalances.flat();
package/dist/index.mjs CHANGED
@@ -610,13 +610,19 @@ import { sonic } from "viem/chains";
610
610
  // functions/getPoolsAndDestinations.ts
611
611
  import { getCoreConfig } from "@tokemak/config";
612
612
  import { lensAbi } from "@tokemak/abis";
613
- var getPoolsAndDestinations = async (client, { chainId }) => {
613
+ var getPoolsAndDestinations = async (client, {
614
+ chainId,
615
+ account,
616
+ blockNumber
617
+ }) => {
614
618
  try {
615
619
  const { lens } = getCoreConfig(chainId);
616
620
  const { autoPools, destinations } = await client.readContract({
617
621
  address: lens,
618
622
  abi: lensAbi,
619
- functionName: "getPoolsAndDestinations"
623
+ functionName: "getPoolsAndDestinations",
624
+ account,
625
+ blockNumber
620
626
  });
621
627
  const autopoolsAndDestinations = mergeArraysWithKey(
622
628
  autoPools,
@@ -638,7 +644,9 @@ import {
638
644
  } from "@tokemak/constants";
639
645
  var getChainAutopools = async (client, {
640
646
  chainId,
641
- prices
647
+ prices,
648
+ account,
649
+ blockNumber
642
650
  }) => {
643
651
  const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = getSdkByChainId(chainId);
644
652
  try {
@@ -651,7 +659,9 @@ var getChainAutopools = async (client, {
651
659
  chainId
652
660
  });
653
661
  const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
654
- chainId
662
+ chainId,
663
+ account,
664
+ blockNumber
655
665
  });
656
666
  if (!autopoolsAndDestinations) {
657
667
  throw new Error(`No autopools and destinations found for ${chainId}`);
@@ -5550,7 +5560,7 @@ import { getSdkByChainId as getSdkByChainId17 } from "@tokemak/graph-cli";
5550
5560
  import { getCoreConfig as getCoreConfig10 } from "@tokemak/config";
5551
5561
  import { rootPriceOracleAbi } from "@tokemak/abis";
5552
5562
  import { USDC_TOKEN } from "@tokemak/tokenlist";
5553
- var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
5563
+ var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
5554
5564
  const config = getCoreConfig10(chainId);
5555
5565
  const rootPriceOracle = config.rootPriceOracle;
5556
5566
  const weth = config.weth;
@@ -5560,7 +5570,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
5560
5570
  abi: rootPriceOracleAbi,
5561
5571
  functionName: "getPriceInQuote",
5562
5572
  args: [weth, usdc],
5563
- blockNumber
5573
+ blockNumber,
5574
+ account
5564
5575
  });
5565
5576
  return priceAtBlock;
5566
5577
  };
@@ -5590,14 +5601,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
5590
5601
  }
5591
5602
  return USDC_TOKEN2.decimals;
5592
5603
  }
5593
- var getRebalanceValueUsd = async (rebalance, chainId, client) => {
5604
+ var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
5594
5605
  const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
5595
5606
  if (ethWei === 0n) return null;
5596
5607
  try {
5597
5608
  const price = await getEthPriceAtBlock(
5598
5609
  client,
5599
5610
  BigInt(rebalance.blockNumber),
5600
- chainId
5611
+ chainId,
5612
+ account
5601
5613
  );
5602
5614
  const ethUsd = Number(formatUnitsNum8(price, USDC_TOKEN2.decimals));
5603
5615
  const ethAmt = Number(formatEtherNum15(ethWei));
@@ -5608,7 +5620,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
5608
5620
  return null;
5609
5621
  }
5610
5622
  };
5611
- var processRebalance = async (rebalance, chainId, client) => {
5623
+ var processRebalance = async (rebalance, chainId, client, account) => {
5612
5624
  const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
5613
5625
  const baseAssetAmount = Number(
5614
5626
  formatUnitsNum8(
@@ -5616,7 +5628,12 @@ var processRebalance = async (rebalance, chainId, client) => {
5616
5628
  baseDecimals
5617
5629
  )
5618
5630
  );
5619
- const ethPathUsd = await getRebalanceValueUsd(rebalance, chainId, client);
5631
+ const ethPathUsd = await getRebalanceValueUsd(
5632
+ rebalance,
5633
+ chainId,
5634
+ client,
5635
+ account
5636
+ );
5620
5637
  if (ethPathUsd != null) {
5621
5638
  return {
5622
5639
  autopool: rebalance.autopool,
@@ -5636,12 +5653,12 @@ var processRebalance = async (rebalance, chainId, client) => {
5636
5653
  valueInAsset: baseAssetAmount
5637
5654
  };
5638
5655
  };
5639
- var processRebalancesInBatches = async (rebalances, chainId, client) => {
5656
+ var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
5640
5657
  const processedRebalances = [];
5641
5658
  for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
5642
5659
  const batch = rebalances.slice(i, i + BATCH_SIZE);
5643
5660
  const batchPromises = batch.map(
5644
- async (rebalance) => processRebalance(rebalance, chainId, client)
5661
+ async (rebalance) => processRebalance(rebalance, chainId, client, account)
5645
5662
  );
5646
5663
  const batchResults = await Promise.all(batchPromises);
5647
5664
  processedRebalances.push(...batchResults);
@@ -5667,14 +5684,20 @@ var calculateRebalanceStats = (rebalances) => {
5667
5684
  };
5668
5685
  };
5669
5686
  var getRebalanceStats = async (getClient, {
5670
- includeTestnet = false
5687
+ includeTestnet = false,
5688
+ account
5671
5689
  }) => {
5672
5690
  const chains = getChainsForEnv({ includeTestnet });
5673
5691
  const rebalances = await Promise.all(
5674
5692
  chains.map(async (chain) => {
5675
5693
  const rawRebalances = await fetchChainRebalances(chain.chainId);
5676
5694
  const client = getClient(chain.chainId);
5677
- return processRebalancesInBatches(rawRebalances, chain.chainId, client);
5695
+ return processRebalancesInBatches(
5696
+ rawRebalances,
5697
+ chain.chainId,
5698
+ client,
5699
+ account
5700
+ );
5678
5701
  })
5679
5702
  );
5680
5703
  const allRebalances = rebalances.flat();
package/dist/safe.js CHANGED
@@ -293,13 +293,19 @@ var import_chains = require("viem/chains");
293
293
  // functions/getPoolsAndDestinations.ts
294
294
  var import_config = require("@tokemak/config");
295
295
  var import_abis = require("@tokemak/abis");
296
- var getPoolsAndDestinations = async (client, { chainId }) => {
296
+ var getPoolsAndDestinations = async (client, {
297
+ chainId,
298
+ account,
299
+ blockNumber
300
+ }) => {
297
301
  try {
298
302
  const { lens } = (0, import_config.getCoreConfig)(chainId);
299
303
  const { autoPools, destinations } = await client.readContract({
300
304
  address: lens,
301
305
  abi: import_abis.lensAbi,
302
- functionName: "getPoolsAndDestinations"
306
+ functionName: "getPoolsAndDestinations",
307
+ account,
308
+ blockNumber
303
309
  });
304
310
  const autopoolsAndDestinations = mergeArraysWithKey(
305
311
  autoPools,
@@ -316,7 +322,9 @@ var getPoolsAndDestinations = async (client, { chainId }) => {
316
322
  var import_constants5 = require("@tokemak/constants");
317
323
  var getChainAutopools = async (client, {
318
324
  chainId,
319
- prices
325
+ prices,
326
+ account,
327
+ blockNumber
320
328
  }) => {
321
329
  const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = (0, import_graph_cli.getSdkByChainId)(chainId);
322
330
  try {
@@ -329,7 +337,9 @@ var getChainAutopools = async (client, {
329
337
  chainId
330
338
  });
331
339
  const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
332
- chainId
340
+ chainId,
341
+ account,
342
+ blockNumber
333
343
  });
334
344
  if (!autopoolsAndDestinations) {
335
345
  throw new Error(`No autopools and destinations found for ${chainId}`);
@@ -714,7 +724,7 @@ var getChainAutopools = async (client, {
714
724
  var import_config2 = require("@tokemak/config");
715
725
  var import_abis2 = require("@tokemak/abis");
716
726
  var import_tokenlist3 = require("@tokemak/tokenlist");
717
- var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
727
+ var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
718
728
  const config = (0, import_config2.getCoreConfig)(chainId);
719
729
  const rootPriceOracle = config.rootPriceOracle;
720
730
  const weth = config.weth;
@@ -724,7 +734,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
724
734
  abi: import_abis2.rootPriceOracleAbi,
725
735
  functionName: "getPriceInQuote",
726
736
  args: [weth, usdc],
727
- blockNumber
737
+ blockNumber,
738
+ account
728
739
  });
729
740
  return priceAtBlock;
730
741
  };
@@ -755,14 +766,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
755
766
  }
756
767
  return import_tokenlist4.USDC_TOKEN.decimals;
757
768
  }
758
- var getRebalanceValueUsd = async (rebalance, chainId, client) => {
769
+ var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
759
770
  const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
760
771
  if (ethWei === 0n) return null;
761
772
  try {
762
773
  const price = await getEthPriceAtBlock(
763
774
  client,
764
775
  BigInt(rebalance.blockNumber),
765
- chainId
776
+ chainId,
777
+ account
766
778
  );
767
779
  const ethUsd = Number((0, import_utils5.formatUnitsNum)(price, import_tokenlist4.USDC_TOKEN.decimals));
768
780
  const ethAmt = Number((0, import_utils5.formatEtherNum)(ethWei));
@@ -773,7 +785,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
773
785
  return null;
774
786
  }
775
787
  };
776
- var processRebalance = async (rebalance, chainId, client) => {
788
+ var processRebalance = async (rebalance, chainId, client, account) => {
777
789
  const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
778
790
  const baseAssetAmount = Number(
779
791
  (0, import_utils5.formatUnitsNum)(
@@ -781,7 +793,12 @@ var processRebalance = async (rebalance, chainId, client) => {
781
793
  baseDecimals
782
794
  )
783
795
  );
784
- const ethPathUsd = await getRebalanceValueUsd(rebalance, chainId, client);
796
+ const ethPathUsd = await getRebalanceValueUsd(
797
+ rebalance,
798
+ chainId,
799
+ client,
800
+ account
801
+ );
785
802
  if (ethPathUsd != null) {
786
803
  return {
787
804
  autopool: rebalance.autopool,
@@ -801,12 +818,12 @@ var processRebalance = async (rebalance, chainId, client) => {
801
818
  valueInAsset: baseAssetAmount
802
819
  };
803
820
  };
804
- var processRebalancesInBatches = async (rebalances, chainId, client) => {
821
+ var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
805
822
  const processedRebalances = [];
806
823
  for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
807
824
  const batch = rebalances.slice(i, i + BATCH_SIZE);
808
825
  const batchPromises = batch.map(
809
- async (rebalance) => processRebalance(rebalance, chainId, client)
826
+ async (rebalance) => processRebalance(rebalance, chainId, client, account)
810
827
  );
811
828
  const batchResults = await Promise.all(batchPromises);
812
829
  processedRebalances.push(...batchResults);
@@ -832,14 +849,20 @@ var calculateRebalanceStats = (rebalances) => {
832
849
  };
833
850
  };
834
851
  var getRebalanceStats = async (getClient, {
835
- includeTestnet = false
852
+ includeTestnet = false,
853
+ account
836
854
  }) => {
837
855
  const chains = getChainsForEnv({ includeTestnet });
838
856
  const rebalances = await Promise.all(
839
857
  chains.map(async (chain) => {
840
858
  const rawRebalances = await fetchChainRebalances(chain.chainId);
841
859
  const client = getClient(chain.chainId);
842
- return processRebalancesInBatches(rawRebalances, chain.chainId, client);
860
+ return processRebalancesInBatches(
861
+ rawRebalances,
862
+ chain.chainId,
863
+ client,
864
+ account
865
+ );
843
866
  })
844
867
  );
845
868
  const allRebalances = rebalances.flat();
package/dist/safe.mjs CHANGED
@@ -277,13 +277,19 @@ import { sonic } from "viem/chains";
277
277
  // functions/getPoolsAndDestinations.ts
278
278
  import { getCoreConfig } from "@tokemak/config";
279
279
  import { lensAbi } from "@tokemak/abis";
280
- var getPoolsAndDestinations = async (client, { chainId }) => {
280
+ var getPoolsAndDestinations = async (client, {
281
+ chainId,
282
+ account,
283
+ blockNumber
284
+ }) => {
281
285
  try {
282
286
  const { lens } = getCoreConfig(chainId);
283
287
  const { autoPools, destinations } = await client.readContract({
284
288
  address: lens,
285
289
  abi: lensAbi,
286
- functionName: "getPoolsAndDestinations"
290
+ functionName: "getPoolsAndDestinations",
291
+ account,
292
+ blockNumber
287
293
  });
288
294
  const autopoolsAndDestinations = mergeArraysWithKey(
289
295
  autoPools,
@@ -305,7 +311,9 @@ import {
305
311
  } from "@tokemak/constants";
306
312
  var getChainAutopools = async (client, {
307
313
  chainId,
308
- prices
314
+ prices,
315
+ account,
316
+ blockNumber
309
317
  }) => {
310
318
  const { GetVaultAddeds, GetAutopoolsInactiveDestinations } = getSdkByChainId(chainId);
311
319
  try {
@@ -318,7 +326,9 @@ var getChainAutopools = async (client, {
318
326
  chainId
319
327
  });
320
328
  const autopoolsAndDestinations = await getPoolsAndDestinations(client, {
321
- chainId
329
+ chainId,
330
+ account,
331
+ blockNumber
322
332
  });
323
333
  if (!autopoolsAndDestinations) {
324
334
  throw new Error(`No autopools and destinations found for ${chainId}`);
@@ -703,7 +713,7 @@ var getChainAutopools = async (client, {
703
713
  import { getCoreConfig as getCoreConfig2 } from "@tokemak/config";
704
714
  import { rootPriceOracleAbi } from "@tokemak/abis";
705
715
  import { USDC_TOKEN } from "@tokemak/tokenlist";
706
- var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
716
+ var getEthPriceAtBlock = async (client, blockNumber, chainId, account) => {
707
717
  const config = getCoreConfig2(chainId);
708
718
  const rootPriceOracle = config.rootPriceOracle;
709
719
  const weth = config.weth;
@@ -713,7 +723,8 @@ var getEthPriceAtBlock = async (client, blockNumber, chainId) => {
713
723
  abi: rootPriceOracleAbi,
714
724
  functionName: "getPriceInQuote",
715
725
  args: [weth, usdc],
716
- blockNumber
726
+ blockNumber,
727
+ account
717
728
  });
718
729
  return priceAtBlock;
719
730
  };
@@ -744,14 +755,15 @@ function inferBaseAssetDecimals(rebalance, chainId) {
744
755
  }
745
756
  return USDC_TOKEN2.decimals;
746
757
  }
747
- var getRebalanceValueUsd = async (rebalance, chainId, client) => {
758
+ var getRebalanceValueUsd = async (rebalance, chainId, client, account) => {
748
759
  const ethWei = BigInt(rebalance.tokenOutValueInEth || "0");
749
760
  if (ethWei === 0n) return null;
750
761
  try {
751
762
  const price = await getEthPriceAtBlock(
752
763
  client,
753
764
  BigInt(rebalance.blockNumber),
754
- chainId
765
+ chainId,
766
+ account
755
767
  );
756
768
  const ethUsd = Number(formatUnitsNum2(price, USDC_TOKEN2.decimals));
757
769
  const ethAmt = Number(formatEtherNum2(ethWei));
@@ -762,7 +774,7 @@ var getRebalanceValueUsd = async (rebalance, chainId, client) => {
762
774
  return null;
763
775
  }
764
776
  };
765
- var processRebalance = async (rebalance, chainId, client) => {
777
+ var processRebalance = async (rebalance, chainId, client, account) => {
766
778
  const baseDecimals = inferBaseAssetDecimals(rebalance, chainId);
767
779
  const baseAssetAmount = Number(
768
780
  formatUnitsNum2(
@@ -770,7 +782,12 @@ var processRebalance = async (rebalance, chainId, client) => {
770
782
  baseDecimals
771
783
  )
772
784
  );
773
- const ethPathUsd = await getRebalanceValueUsd(rebalance, chainId, client);
785
+ const ethPathUsd = await getRebalanceValueUsd(
786
+ rebalance,
787
+ chainId,
788
+ client,
789
+ account
790
+ );
774
791
  if (ethPathUsd != null) {
775
792
  return {
776
793
  autopool: rebalance.autopool,
@@ -790,12 +807,12 @@ var processRebalance = async (rebalance, chainId, client) => {
790
807
  valueInAsset: baseAssetAmount
791
808
  };
792
809
  };
793
- var processRebalancesInBatches = async (rebalances, chainId, client) => {
810
+ var processRebalancesInBatches = async (rebalances, chainId, client, account) => {
794
811
  const processedRebalances = [];
795
812
  for (let i = 0; i < rebalances.length; i += BATCH_SIZE) {
796
813
  const batch = rebalances.slice(i, i + BATCH_SIZE);
797
814
  const batchPromises = batch.map(
798
- async (rebalance) => processRebalance(rebalance, chainId, client)
815
+ async (rebalance) => processRebalance(rebalance, chainId, client, account)
799
816
  );
800
817
  const batchResults = await Promise.all(batchPromises);
801
818
  processedRebalances.push(...batchResults);
@@ -821,14 +838,20 @@ var calculateRebalanceStats = (rebalances) => {
821
838
  };
822
839
  };
823
840
  var getRebalanceStats = async (getClient, {
824
- includeTestnet = false
841
+ includeTestnet = false,
842
+ account
825
843
  }) => {
826
844
  const chains = getChainsForEnv({ includeTestnet });
827
845
  const rebalances = await Promise.all(
828
846
  chains.map(async (chain) => {
829
847
  const rawRebalances = await fetchChainRebalances(chain.chainId);
830
848
  const client = getClient(chain.chainId);
831
- return processRebalancesInBatches(rawRebalances, chain.chainId, client);
849
+ return processRebalancesInBatches(
850
+ rawRebalances,
851
+ chain.chainId,
852
+ client,
853
+ account
854
+ );
832
855
  })
833
856
  );
834
857
  const allRebalances = rebalances.flat();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokemak/queries",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -42,12 +42,12 @@
42
42
  "@layerzerolabs/lz-v2-utilities": "3.0.4",
43
43
  "@merkl/api": "1.17.4",
44
44
  "graphql-request": "6.1.0",
45
- "@tokemak/utils": "0.2.1",
46
- "@tokemak/constants": "0.3.0",
47
45
  "@tokemak/graph-cli": "0.4.0",
48
46
  "@tokemak/config": "0.4.0",
49
- "@tokemak/tokenlist": "0.4.0",
50
- "@tokemak/abis": "0.2.0"
47
+ "@tokemak/constants": "0.3.0",
48
+ "@tokemak/utils": "0.2.1",
49
+ "@tokemak/abis": "0.2.0",
50
+ "@tokemak/tokenlist": "0.4.0"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "@wagmi/core": ">=2.9.0",