@scallop-io/sui-scallop-sdk 1.3.0 → 1.3.1-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-alpha.2",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -9,7 +9,8 @@ import { QueryClientConfig } from '@tanstack/query-core';
9
9
  export const DEFAULT_CACHE_OPTIONS: QueryClientConfig = {
10
10
  defaultOptions: {
11
11
  queries: {
12
- staleTime: 2000,
12
+ staleTime: 5000,
13
+ gcTime: 5000,
13
14
  },
14
15
  },
15
16
  };
@@ -31,6 +31,8 @@ type QueryInspectTxnParams = {
31
31
  typeArgs?: any[];
32
32
  };
33
33
 
34
+ const DEFAULT_GC_TIME = 5 * 1000; // 5 seconds
35
+
34
36
  /**
35
37
  * @description
36
38
  * It provides caching for moveCall, RPC Request, and API Request.
@@ -60,12 +62,16 @@ export class ScallopCache {
60
62
  this.queryClient =
61
63
  queryClient ?? new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
62
64
 
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);
65
+ // handle case where there's existing queryClient and cacheOptions is also passed
66
+ // if (queryClient && cacheOptions) {
67
+ // // override the default options with the cacheOptions
68
+ // if (cacheOptions.defaultOptions)
69
+ // this.queryClient.setDefaultOptions(cacheOptions.defaultOptions);
70
+ // // if (cacheOptions.queryCache)
71
+ // // this.queryClient.defaultQueryOptions(cacheOptions.queryCache);
72
+ // // if(cacheOptions.mutations)this.queryClient.setMutationDefaults(cacheOptions.mutations);
68
73
  // }
74
+
69
75
  this._suiKit = suiKit;
70
76
  this.tokenBucket =
71
77
  tokenBucket ??
@@ -123,6 +129,7 @@ export class ScallopCache {
123
129
  this.suiKit.inspectTxn(txBlock)
124
130
  );
125
131
  },
132
+ gcTime: DEFAULT_GC_TIME,
126
133
  });
127
134
  return query;
128
135
  }
@@ -147,6 +154,7 @@ export class ScallopCache {
147
154
  })
148
155
  );
149
156
  },
157
+ gcTime: DEFAULT_GC_TIME,
150
158
  });
151
159
  }
152
160
 
@@ -175,6 +183,7 @@ export class ScallopCache {
175
183
  this.suiKit.getObjects(objectIds, options)
176
184
  );
177
185
  },
186
+ gcTime: DEFAULT_GC_TIME,
178
187
  });
179
188
  }
180
189
 
@@ -191,6 +200,7 @@ export class ScallopCache {
191
200
  this.client.getOwnedObjects(input)
192
201
  );
193
202
  },
203
+ gcTime: DEFAULT_GC_TIME,
194
204
  });
195
205
  }
196
206
 
@@ -204,6 +214,7 @@ export class ScallopCache {
204
214
  this.client.getDynamicFields(input)
205
215
  );
206
216
  },
217
+ gcTime: DEFAULT_GC_TIME,
207
218
  });
208
219
  }
209
220
 
@@ -217,6 +228,7 @@ export class ScallopCache {
217
228
  this.client.getDynamicFieldObject(input)
218
229
  );
219
230
  },
231
+ gcTime: DEFAULT_GC_TIME,
220
232
  });
221
233
  }
222
234