@scallop-io/sui-scallop-sdk 1.3.0-alpha.4 → 1.3.0-alpha.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.
@@ -9,6 +9,7 @@ import { ScallopIndexer } from './scallopIndexer';
9
9
  import { ScallopCache } from './scallopCache';
10
10
  import { QueryClientConfig } from '@tanstack/query-core';
11
11
  import { TokenBucket } from 'src/utils';
12
+ import type { QueryClient } from '@tanstack/query-core';
12
13
  /**
13
14
  * @argument params - The parameters for the Scallop instance.
14
15
  * @argument cacheOptions - The cache options for the QueryClient.
@@ -31,7 +32,7 @@ export declare class Scallop {
31
32
  suiKit: SuiKit;
32
33
  cache: ScallopCache;
33
34
  private address;
34
- constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket);
35
+ constructor(params: ScallopParams, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
35
36
  /**
36
37
  * Get a scallop address instance that already has read addresses.
37
38
  *
@@ -1,5 +1,5 @@
1
1
  import { QueryClient, QueryClientConfig } from '@tanstack/query-core';
2
- import { SuiObjectArg, SuiTxBlock } from '@scallop-io/sui-kit';
2
+ import { SuiObjectArg } from '@scallop-io/sui-kit';
3
3
  import { SuiKit } from '@scallop-io/sui-kit';
4
4
  import type { SuiObjectResponse, SuiObjectDataOptions, SuiObjectData, GetOwnedObjectsParams, DevInspectResults, GetDynamicFieldsParams, DynamicFieldPage, GetDynamicFieldObjectParams, GetBalanceParams } from '@mysten/sui/client';
5
5
  import { TokenBucket } from 'src/utils';
@@ -25,7 +25,7 @@ export declare class ScallopCache {
25
25
  readonly _suiKit: SuiKit;
26
26
  private tokenBucket;
27
27
  walletAddress: string;
28
- constructor(suiKit: SuiKit, walletAddress?: string, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket);
28
+ constructor(suiKit: SuiKit, walletAddress?: string, cacheOptions?: QueryClientConfig, tokenBucket?: TokenBucket, queryClient?: QueryClient);
29
29
  private get suiKit();
30
30
  private get client();
31
31
  /**
@@ -38,7 +38,6 @@ export declare class ScallopCache {
38
38
  * - `none`: No queries will be refetched. Queries that match the refetch predicate will only be marked as invalid.
39
39
  */
40
40
  invalidateAndRefetchAllCache(refetchType: 'all' | 'active' | 'inactive' | 'none'): Promise<void>;
41
- resolveArgs(txb: SuiTxBlock, args: SuiObjectArg[]): Promise<SuiObjectArg[]>;
42
41
  /**
43
42
  * @description Provides cache for inspectTxn of the SuiKit.
44
43
  * @param QueryInspectTxnParams
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.0-alpha.4",
3
+ "version": "1.3.0-alpha.6",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -48,7 +48,7 @@
48
48
  "@pythnetwork/pyth-sui-js": "2.0.0",
49
49
  "@scallop-io/sui-kit": "1.3.1-alpha.1",
50
50
  "@scure/bip39": "^1.2.1",
51
- "@tanstack/query-core": "^5.28.0",
51
+ "@tanstack/query-core": "5.51.15",
52
52
  "axios": "^1.6.0",
53
53
  "bech32": "^2.0.0",
54
54
  "bignumber.js": "^9.1.2",
@@ -1,4 +1,5 @@
1
1
  export * from './common';
2
2
  export * from './enum';
3
3
  export * from './flashloan';
4
+ export * from './queryKeys';
4
5
  export * from './vesca';
@@ -0,0 +1,111 @@
1
+ import type {
2
+ GetDynamicFieldObjectParams,
3
+ GetDynamicFieldsParams,
4
+ GetOwnedObjectsParams,
5
+ SuiObjectData,
6
+ SuiObjectDataOptions,
7
+ } from '@mysten/sui/client';
8
+ import type { SuiObjectArg } from '@scallop-io/sui-kit';
9
+
10
+ export const queryKeys = {
11
+ api: {
12
+ getAddresses: (addressesId?: string) => [
13
+ 'api',
14
+ 'getAddresses',
15
+ { addressesId },
16
+ ],
17
+ getMarket: () => ['api', 'getMarket'],
18
+ getSpools: () => ['api', 'getSpools'],
19
+ getBorrowIncentivePool: () => ['api', 'getBorrowIncentivePools'],
20
+ getTotalValueLocked: () => ['api', 'getTotalValueLocked'],
21
+ },
22
+
23
+ rpc: {
24
+ getInspectTxn: (
25
+ queryTarget?: string,
26
+ args?: SuiObjectArg[],
27
+ typeArgs?: any[]
28
+ ) => [
29
+ 'rpc',
30
+ 'getInspectTxn',
31
+ {
32
+ queryTarget,
33
+ args: JSON.stringify(args),
34
+ typeArgs: !typeArgs ? undefined : JSON.stringify(typeArgs),
35
+ },
36
+ ],
37
+ getObject: (
38
+ objectId?: string,
39
+ walletAddress?: string,
40
+ options?: SuiObjectDataOptions
41
+ ) => ['rpc', 'getObject', { walletAddress, options, objectId }],
42
+ getObjects: (
43
+ objectIds?: string[],
44
+ walletAddress?: string,
45
+ options?: SuiObjectDataOptions
46
+ ) => [
47
+ 'rpc',
48
+ 'getObjects',
49
+ {
50
+ walletAddress,
51
+ options,
52
+ objectIds: JSON.stringify(objectIds ?? []),
53
+ },
54
+ ],
55
+ getOwnedObjects: (input: Partial<GetOwnedObjectsParams>) => [
56
+ 'rpc',
57
+ 'getOwnedObjects',
58
+ {
59
+ walletAddress: input.owner,
60
+ cursor: input.cursor ?? undefined,
61
+ options: input.options ?? undefined,
62
+ filter: JSON.stringify(input.filter ?? undefined),
63
+ limit: input.limit ?? undefined,
64
+ },
65
+ ],
66
+ getDynamicFields: (input: Partial<GetDynamicFieldsParams>) => [
67
+ 'rpc',
68
+ 'getDynamicFields',
69
+ {
70
+ parentId: input.parentId,
71
+ cursor: input.cursor ?? undefined,
72
+ limit: input.limit ?? undefined,
73
+ },
74
+ ],
75
+ getDynamicFieldObject: (input: Partial<GetDynamicFieldObjectParams>) => [
76
+ 'rpc',
77
+ 'getDynamicFieldObject',
78
+ {
79
+ parentId: input.parentId,
80
+ name: {
81
+ type: input?.name?.type,
82
+ value: input?.name?.value,
83
+ },
84
+ },
85
+ ],
86
+ getTotalVeScaTreasuryAmount: (
87
+ refreshArgs?: any[],
88
+ vescaAmountArgs?: (string | SuiObjectData)[]
89
+ ) => [
90
+ 'rpc',
91
+ 'getTotalVeScaTreasuryAmount',
92
+ {
93
+ refreshArgs: JSON.stringify(refreshArgs),
94
+ vescaAmountArgs: JSON.stringify(vescaAmountArgs),
95
+ },
96
+ ],
97
+
98
+ getAllCoinBalances: (owner?: string) => [
99
+ 'rpc',
100
+ 'getAllCoinBalances',
101
+ { owner },
102
+ ],
103
+ },
104
+ oracle: {
105
+ getPythLatestPriceFeed: (pythPriceId?: string) => [
106
+ 'oracle',
107
+ 'getPythPriceId',
108
+ { pythPriceId },
109
+ ],
110
+ },
111
+ };
@@ -21,6 +21,7 @@ import {
21
21
  DEFAULT_INTERVAL_IN_MS,
22
22
  DEFAULT_TOKENS_PER_INTERVAL,
23
23
  } from 'src/constants/tokenBucket';
24
+ import type { QueryClient } from '@tanstack/query-core';
24
25
 
25
26
  /**
26
27
  * @argument params - The parameters for the Scallop instance.
@@ -49,7 +50,8 @@ export class Scallop {
49
50
  public constructor(
50
51
  params: ScallopParams,
51
52
  cacheOptions?: QueryClientConfig,
52
- tokenBucket?: TokenBucket
53
+ tokenBucket?: TokenBucket,
54
+ queryClient?: QueryClient
53
55
  ) {
54
56
  this.params = params;
55
57
  this.suiKit = new SuiKit(params);
@@ -58,7 +60,8 @@ export class Scallop {
58
60
  params.walletAddress,
59
61
  cacheOptions ?? DEFAULT_CACHE_OPTIONS,
60
62
  tokenBucket ??
61
- new TokenBucket(DEFAULT_TOKENS_PER_INTERVAL, DEFAULT_INTERVAL_IN_MS)
63
+ new TokenBucket(DEFAULT_TOKENS_PER_INTERVAL, DEFAULT_INTERVAL_IN_MS),
64
+ queryClient
62
65
  );
63
66
  this.address = new ScallopAddress(
64
67
  {
@@ -10,6 +10,7 @@ import { ScallopCache } from './scallopCache';
10
10
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
11
11
  import axios, { AxiosInstance } from 'axios';
12
12
  import { TEST_ADDRESSES } from 'src/constants/testAddress';
13
+ import { queryKeys } from 'src/constants';
13
14
 
14
15
  const EMPTY_ADDRESSES: AddressesInterface = {
15
16
  core: {
@@ -597,7 +598,7 @@ export class ScallopAddress {
597
598
  const addressesId = id || this._id || undefined;
598
599
  if (addressesId !== undefined) {
599
600
  const response = await this.cache.queryClient.fetchQuery({
600
- queryKey: ['api-getAddresses', addressesId],
601
+ queryKey: queryKeys.api.getAddresses(addressesId),
601
602
  queryFn: async () => {
602
603
  return await this._requestClient.get(`/addresses/${addressesId}`, {
603
604
  headers: {
@@ -3,7 +3,6 @@ import {
3
3
  SuiObjectArg,
4
4
  SuiTxBlock,
5
5
  normalizeStructTag,
6
- normalizeSuiAddress,
7
6
  } from '@scallop-io/sui-kit';
8
7
  import { SuiKit } from '@scallop-io/sui-kit';
9
8
  import type {
@@ -24,6 +23,7 @@ import {
24
23
  DEFAULT_INTERVAL_IN_MS,
25
24
  DEFAULT_TOKENS_PER_INTERVAL,
26
25
  } from 'src/constants/tokenBucket';
26
+ import { queryKeys } from 'src/constants';
27
27
 
28
28
  type QueryInspectTxnParams = {
29
29
  queryTarget: string;
@@ -54,9 +54,18 @@ export class ScallopCache {
54
54
  suiKit: SuiKit,
55
55
  walletAddress?: string,
56
56
  cacheOptions?: QueryClientConfig,
57
- tokenBucket?: TokenBucket
57
+ tokenBucket?: TokenBucket,
58
+ queryClient?: QueryClient
58
59
  ) {
59
- this.queryClient = new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
60
+ this.queryClient =
61
+ queryClient ?? new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
62
+
63
+ // if(queryClient && cacheOptions){
64
+ // if(cacheOptions.defaultOptions)this.queryClient.setDefaultOptions(cacheOptions.defaultOptions);
65
+ // if (cacheOptions.queryCache)
66
+ // this.queryClient.defaultQueryOptions(cacheOptions.queryCache);
67
+ // if(cacheOptions.mutations)this.queryClient.setMutationDefaults(cacheOptions.mutations);
68
+ // }
60
69
  this._suiKit = suiKit;
61
70
  this.tokenBucket =
62
71
  tokenBucket ??
@@ -92,45 +101,6 @@ export class ScallopCache {
92
101
  });
93
102
  }
94
103
 
95
- public async resolveArgs(
96
- txb: SuiTxBlock,
97
- args: SuiObjectArg[]
98
- ): Promise<SuiObjectArg[]> {
99
- return await Promise.all(
100
- args.map(async (arg) => {
101
- if (typeof arg === 'string') {
102
- const objData = (await this.queryGetObject(arg, { showOwner: true }))
103
- ?.data;
104
- if (!objData) return arg;
105
- const owner = objData?.owner as any;
106
- if (!owner) return arg;
107
-
108
- if ('Shared' in owner) {
109
- return txb.sharedObjectRef({
110
- objectId: objData.objectId,
111
- initialSharedVersion: owner.Shared.initial_shared_version,
112
- mutable: true,
113
- });
114
- } else {
115
- return txb.objectRef({
116
- objectId: objData.objectId,
117
- version: objData.version,
118
- digest: objData.digest,
119
- });
120
- }
121
- } else if ('objectId' in arg && 'version' in arg && 'digest' in arg) {
122
- return txb.objectRef({
123
- objectId: arg.objectId,
124
- version: arg.version as string,
125
- digest: arg.digest,
126
- });
127
- } else {
128
- return arg;
129
- }
130
- })
131
- );
132
- }
133
-
134
104
  /**
135
105
  * @description Provides cache for inspectTxn of the SuiKit.
136
106
  * @param QueryInspectTxnParams
@@ -144,19 +114,10 @@ export class ScallopCache {
144
114
  }: QueryInspectTxnParams): Promise<DevInspectResults | null> {
145
115
  const txBlock = new SuiTxBlock();
146
116
 
147
- const resolvedArgs = await this.resolveArgs(txBlock, args);
148
-
149
- txBlock.moveCall(queryTarget, resolvedArgs, typeArgs);
117
+ txBlock.moveCall(queryTarget, args, typeArgs);
150
118
 
151
119
  const query = await this.queryClient.fetchQuery({
152
- queryKey: typeArgs
153
- ? ['inspectTxn', queryTarget, JSON.stringify(args)]
154
- : [
155
- 'inspectTxn',
156
- queryTarget,
157
- JSON.stringify(args),
158
- JSON.stringify(typeArgs),
159
- ],
120
+ queryKey: queryKeys.rpc.getInspectTxn(queryTarget, args, typeArgs),
160
121
  queryFn: async () => {
161
122
  return await callWithRateLimit(this.tokenBucket, () =>
162
123
  this.suiKit.inspectTxn(txBlock)
@@ -176,12 +137,8 @@ export class ScallopCache {
176
137
  objectId: string,
177
138
  options?: SuiObjectDataOptions
178
139
  ): Promise<SuiObjectResponse | null> {
179
- const queryKey = ['getObject', objectId, this.walletAddress];
180
- if (options) {
181
- queryKey.push(JSON.stringify(options));
182
- }
183
140
  return this.queryClient.fetchQuery({
184
- queryKey,
141
+ queryKey: queryKeys.rpc.getObject(objectId, this.walletAddress, options),
185
142
  queryFn: async () => {
186
143
  return await callWithRateLimit(this.tokenBucket, () =>
187
144
  this.client.getObject({
@@ -205,16 +162,14 @@ export class ScallopCache {
205
162
  }
206
163
  ): Promise<SuiObjectData[]> {
207
164
  if (objectIds.length === 0) return [];
208
- const queryKey = [
209
- 'getObjects',
210
- JSON.stringify(objectIds),
211
- this.walletAddress,
212
- ];
213
- if (options) {
214
- queryKey.push(JSON.stringify(options));
215
- }
165
+ // objectIds.sort();
166
+
216
167
  return this.queryClient.fetchQuery({
217
- queryKey: queryKey,
168
+ queryKey: queryKeys.rpc.getObjects(
169
+ objectIds,
170
+ this.walletAddress,
171
+ options
172
+ ),
218
173
  queryFn: async () => {
219
174
  return await callWithRateLimit(this.tokenBucket, () =>
220
175
  this.suiKit.getObjects(objectIds, options)
@@ -229,22 +184,8 @@ export class ScallopCache {
229
184
  * @returns Promise<PaginatedObjectsResponse>
230
185
  */
231
186
  public async queryGetOwnedObjects(input: GetOwnedObjectsParams) {
232
- const queryKey = ['getOwnedObjects', input.owner];
233
- if (input.cursor) {
234
- queryKey.push(JSON.stringify(input.cursor));
235
- }
236
- if (input.options) {
237
- queryKey.push(JSON.stringify(input.options));
238
- }
239
- if (input.filter) {
240
- queryKey.push(JSON.stringify(input.filter));
241
- }
242
- if (input.limit) {
243
- queryKey.push(JSON.stringify(input.limit));
244
- }
245
-
246
187
  return this.queryClient.fetchQuery({
247
- queryKey,
188
+ queryKey: queryKeys.rpc.getOwnedObjects(input),
248
189
  queryFn: async () => {
249
190
  return await callWithRateLimit(this.tokenBucket, () =>
250
191
  this.client.getOwnedObjects(input)
@@ -256,16 +197,8 @@ export class ScallopCache {
256
197
  public async queryGetDynamicFields(
257
198
  input: GetDynamicFieldsParams
258
199
  ): Promise<DynamicFieldPage | null> {
259
- const queryKey = ['getDynamicFields', input.parentId];
260
- if (input.cursor) {
261
- queryKey.push(JSON.stringify(input.cursor));
262
- }
263
- if (input.limit) {
264
- queryKey.push(JSON.stringify(input.limit));
265
- }
266
-
267
200
  return this.queryClient.fetchQuery({
268
- queryKey,
201
+ queryKey: queryKeys.rpc.getDynamicFields(input),
269
202
  queryFn: async () => {
270
203
  return await callWithRateLimit(this.tokenBucket, () =>
271
204
  this.client.getDynamicFields(input)
@@ -277,14 +210,8 @@ export class ScallopCache {
277
210
  public async queryGetDynamicFieldObject(
278
211
  input: GetDynamicFieldObjectParams
279
212
  ): Promise<SuiObjectResponse | null> {
280
- const queryKey = [
281
- 'getDynamicFieldObject',
282
- input.parentId,
283
- input.name.type,
284
- input.name.value,
285
- ];
286
213
  return this.queryClient.fetchQuery({
287
- queryKey,
214
+ queryKey: queryKeys.rpc.getDynamicFieldObject(input),
288
215
  queryFn: async () => {
289
216
  return await callWithRateLimit(this.tokenBucket, () =>
290
217
  this.client.getDynamicFieldObject(input)
@@ -296,9 +223,8 @@ export class ScallopCache {
296
223
  public async queryGetAllCoinBalances(
297
224
  owner: string
298
225
  ): Promise<{ [k: string]: string }> {
299
- const queryKey = ['getAllCoinBalances', owner];
300
226
  return this.queryClient.fetchQuery({
301
- queryKey,
227
+ queryKey: queryKeys.rpc.getAllCoinBalances(owner),
302
228
  queryFn: async () => {
303
229
  const allBalances = await callWithRateLimit(this.tokenBucket, () =>
304
230
  this.client.getAllBalances({ owner })
@@ -315,19 +241,6 @@ export class ScallopCache {
315
241
  {} as { [k: string]: string }
316
242
  );
317
243
 
318
- // Set query data for each coin balance
319
- for (const coinType in balances) {
320
- const coinBalanceQueryKey = [
321
- 'getCoinBalance',
322
- normalizeSuiAddress(owner),
323
- normalizeStructTag(coinType),
324
- ];
325
- this.queryClient.setQueryData(
326
- coinBalanceQueryKey,
327
- balances[coinType]
328
- );
329
- }
330
-
331
244
  return balances;
332
245
  },
333
246
  });
@@ -336,21 +249,10 @@ export class ScallopCache {
336
249
  public async queryGetCoinBalance(input: GetBalanceParams): Promise<string> {
337
250
  if (!input.coinType) return '0';
338
251
 
339
- const queryKey = [
340
- 'getCoinBalance',
341
- normalizeSuiAddress(input.owner),
342
- normalizeStructTag(input.coinType),
343
- ];
344
- return this.queryClient.fetchQuery({
345
- queryKey,
346
- queryFn: async () => {
347
- if (!input.coinType) return '0';
348
- return (
349
- (await this.queryGetAllCoinBalances(input.owner))[
350
- normalizeStructTag(input.coinType)
351
- ] ?? '0'
352
- );
353
- },
354
- });
252
+ return (
253
+ ((await this.queryGetAllCoinBalances(input.owner)) || {})[
254
+ normalizeStructTag(input.coinType)
255
+ ] ?? '0'
256
+ );
355
257
  }
356
258
  }
@@ -24,6 +24,7 @@ import type {
24
24
  import { ScallopCache } from './scallopCache';
25
25
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
26
26
  import { SuiKit } from '@scallop-io/sui-kit';
27
+ import { queryKeys } from 'src/constants';
27
28
 
28
29
  /**
29
30
  * @description
@@ -67,7 +68,7 @@ export class ScallopIndexer {
67
68
  */
68
69
  public async getMarket(): Promise<Pick<Market, 'pools' | 'collaterals'>> {
69
70
  const response = await this.cache.queryClient.fetchQuery({
70
- queryKey: ['market'],
71
+ queryKey: queryKeys.api.getMarket(),
71
72
  queryFn: async () => {
72
73
  return await this._requestClient.get<{
73
74
  pools: MarketPool[];
@@ -145,7 +146,7 @@ export class ScallopIndexer {
145
146
  */
146
147
  public async getSpools(): Promise<Required<Spools>> {
147
148
  const response = await this.cache.queryClient.fetchQuery({
148
- queryKey: ['spools'],
149
+ queryKey: queryKeys.api.getSpools(),
149
150
  queryFn: async () => {
150
151
  return await this._requestClient.get<{
151
152
  spools: Spool[];
@@ -183,7 +184,7 @@ export class ScallopIndexer {
183
184
  Required<BorrowIncentivePools>
184
185
  > {
185
186
  const response = await this.cache.queryClient.fetchQuery({
186
- queryKey: ['borrowIncentivePools'],
187
+ queryKey: queryKeys.api.getBorrowIncentivePool(),
187
188
  queryFn: async () => {
188
189
  return await this._requestClient.get<{
189
190
  borrowIncentivePools: BorrowIncentivePool[];
@@ -245,7 +246,7 @@ export class ScallopIndexer {
245
246
  }
246
247
  > {
247
248
  const response = await this.cache.queryClient.fetchQuery({
248
- queryKey: ['totalValueLocked'],
249
+ queryKey: queryKeys.api.getTotalValueLocked(),
249
250
  queryFn: async () => {
250
251
  return await this._requestClient.get<
251
252
  TotalValueLocked & {
@@ -46,6 +46,7 @@ import type {
46
46
  SupportSuiBridgeCoins,
47
47
  SupportWormholeCoins,
48
48
  } from '../types';
49
+ import { queryKeys } from 'src/constants';
49
50
  import type { SuiObjectArg, SuiTxArg, SuiTxBlock } from '@scallop-io/sui-kit';
50
51
 
51
52
  /**
@@ -558,7 +559,7 @@ export class ScallopUtils {
558
559
  const pythConnection = new SuiPriceServiceConnection(endpoint);
559
560
  try {
560
561
  const feed = await this.address.cache.queryClient.fetchQuery({
561
- queryKey: [priceId],
562
+ queryKey: queryKeys.oracle.getPythLatestPriceFeed(priceId),
562
563
  queryFn: async () => {
563
564
  return await pythConnection.getLatestPriceFeeds([priceId]);
564
565
  },
@@ -10,6 +10,7 @@ import { MAX_LOCK_DURATION } from 'src/constants';
10
10
  import { SUI_CLOCK_OBJECT_ID, SuiTxBlock } from '@scallop-io/sui-kit';
11
11
  import { bcs } from '@mysten/sui/bcs';
12
12
  import { z as zod } from 'zod';
13
+ import { queryKeys } from 'src/constants';
13
14
  import assert from 'assert';
14
15
  /**
15
16
  * Query all owned veSca key.
@@ -226,10 +227,10 @@ const getTotalVeScaTreasuryAmount = async (
226
227
 
227
228
  // return result
228
229
  const res = await utils.cache.queryClient.fetchQuery<DevInspectResults>({
229
- queryKey: [
230
- 'getTotalVeScaTreasuryAmount',
231
- JSON.stringify([...refreshArgs, ...veScaAmountArgs]),
232
- ],
230
+ queryKey: queryKeys.rpc.getTotalVeScaTreasuryAmount(
231
+ refreshArgs,
232
+ veScaAmountArgs
233
+ ),
233
234
  queryFn: async () => {
234
235
  return await utils.suiKit.inspectTxn(txBytes);
235
236
  },
@@ -16,8 +16,8 @@ export async function callMethodWithIndexerFallback(
16
16
  if (indexer) {
17
17
  try {
18
18
  return await method.apply(context, args);
19
- } catch (_e) {
20
- console.warn('Indexer requests failed. Retrying without indexer..');
19
+ } catch (e: any) {
20
+ console.warn(`Indexer requests failed: ${e}. Retrying without indexer..`);
21
21
  return await method.apply(context, [...args.slice(0, -1), false]);
22
22
  }
23
23
  }