@scallop-io/sui-scallop-sdk 1.3.1-alpha.1 → 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/dist/index.js +13 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/scallopCache.ts +16 -8
package/package.json
CHANGED
|
@@ -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.
|
|
@@ -61,14 +63,14 @@ export class ScallopCache {
|
|
|
61
63
|
queryClient ?? new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
|
|
62
64
|
|
|
63
65
|
// handle case where there's existing queryClient and cacheOptions is also passed
|
|
64
|
-
if (queryClient && cacheOptions) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
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);
|
|
73
|
+
// }
|
|
72
74
|
|
|
73
75
|
this._suiKit = suiKit;
|
|
74
76
|
this.tokenBucket =
|
|
@@ -127,6 +129,7 @@ export class ScallopCache {
|
|
|
127
129
|
this.suiKit.inspectTxn(txBlock)
|
|
128
130
|
);
|
|
129
131
|
},
|
|
132
|
+
gcTime: DEFAULT_GC_TIME,
|
|
130
133
|
});
|
|
131
134
|
return query;
|
|
132
135
|
}
|
|
@@ -151,6 +154,7 @@ export class ScallopCache {
|
|
|
151
154
|
})
|
|
152
155
|
);
|
|
153
156
|
},
|
|
157
|
+
gcTime: DEFAULT_GC_TIME,
|
|
154
158
|
});
|
|
155
159
|
}
|
|
156
160
|
|
|
@@ -179,6 +183,7 @@ export class ScallopCache {
|
|
|
179
183
|
this.suiKit.getObjects(objectIds, options)
|
|
180
184
|
);
|
|
181
185
|
},
|
|
186
|
+
gcTime: DEFAULT_GC_TIME,
|
|
182
187
|
});
|
|
183
188
|
}
|
|
184
189
|
|
|
@@ -195,6 +200,7 @@ export class ScallopCache {
|
|
|
195
200
|
this.client.getOwnedObjects(input)
|
|
196
201
|
);
|
|
197
202
|
},
|
|
203
|
+
gcTime: DEFAULT_GC_TIME,
|
|
198
204
|
});
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -208,6 +214,7 @@ export class ScallopCache {
|
|
|
208
214
|
this.client.getDynamicFields(input)
|
|
209
215
|
);
|
|
210
216
|
},
|
|
217
|
+
gcTime: DEFAULT_GC_TIME,
|
|
211
218
|
});
|
|
212
219
|
}
|
|
213
220
|
|
|
@@ -221,6 +228,7 @@ export class ScallopCache {
|
|
|
221
228
|
this.client.getDynamicFieldObject(input)
|
|
222
229
|
);
|
|
223
230
|
},
|
|
231
|
+
gcTime: DEFAULT_GC_TIME,
|
|
224
232
|
});
|
|
225
233
|
}
|
|
226
234
|
|