@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/dist/index.js +15 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants/cache.ts +2 -1
- package/src/models/scallopCache.ts +17 -5
package/package.json
CHANGED
package/src/constants/cache.ts
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.
|
|
@@ -60,12 +62,16 @@ export class ScallopCache {
|
|
|
60
62
|
this.queryClient =
|
|
61
63
|
queryClient ?? new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
|
|
62
64
|
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
//
|
|
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
|
|