@scallop-io/sui-scallop-sdk 1.3.2-alpha.1 → 1.3.2-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 CHANGED
@@ -1147,10 +1147,11 @@ var ScallopCache = class {
1147
1147
  * - `all`: All queries that match the refetch predicate will be refetched in the background.
1148
1148
  * - `none`: No queries will be refetched. Queries that match the refetch predicate will only be marked as invalid.
1149
1149
  */
1150
- invalidateAllCache() {
1150
+ async invalidateAllCache() {
1151
1151
  return Object.values(queryKeys.rpc).map(
1152
1152
  (t) => this.queryClient.invalidateQueries({
1153
- queryKey: t()
1153
+ queryKey: t(),
1154
+ type: "all"
1154
1155
  })
1155
1156
  );
1156
1157
  }
@@ -1174,8 +1175,7 @@ var ScallopCache = class {
1174
1175
  this.tokenBucket,
1175
1176
  () => this.suiKit.inspectTxn(txBlock)
1176
1177
  );
1177
- },
1178
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1178
+ }
1179
1179
  });
1180
1180
  return query;
1181
1181
  }
@@ -1196,8 +1196,7 @@ var ScallopCache = class {
1196
1196
  options
1197
1197
  })
1198
1198
  );
1199
- },
1200
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1199
+ }
1201
1200
  });
1202
1201
  }
1203
1202
  /**
@@ -1221,8 +1220,7 @@ var ScallopCache = class {
1221
1220
  this.tokenBucket,
1222
1221
  () => this.suiKit.getObjects(objectIds, options)
1223
1222
  );
1224
- },
1225
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1223
+ }
1226
1224
  });
1227
1225
  }
1228
1226
  /**
@@ -1238,8 +1236,7 @@ var ScallopCache = class {
1238
1236
  this.tokenBucket,
1239
1237
  () => this.client.getOwnedObjects(input)
1240
1238
  );
1241
- },
1242
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1239
+ }
1243
1240
  });
1244
1241
  }
1245
1242
  async queryGetDynamicFields(input) {
@@ -1250,8 +1247,7 @@ var ScallopCache = class {
1250
1247
  this.tokenBucket,
1251
1248
  () => this.client.getDynamicFields(input)
1252
1249
  );
1253
- },
1254
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1250
+ }
1255
1251
  });
1256
1252
  }
1257
1253
  async queryGetDynamicFieldObject(input) {
@@ -1262,8 +1258,7 @@ var ScallopCache = class {
1262
1258
  this.tokenBucket,
1263
1259
  () => this.client.getDynamicFieldObject(input)
1264
1260
  );
1265
- },
1266
- ...DEFAULT_CACHE_OPTIONS.defaultOptions.queries
1261
+ }
1267
1262
  });
1268
1263
  }
1269
1264
  async queryGetAllCoinBalances(owner) {
@@ -3253,7 +3248,8 @@ var getStakeAccounts = async ({
3253
3248
  owner,
3254
3249
  filter: { StructType: stakeAccountType },
3255
3250
  options: {
3256
- showContent: true
3251
+ showContent: true,
3252
+ showType: true
3257
3253
  },
3258
3254
  cursor: nextCursor,
3259
3255
  limit: 10
@@ -3291,15 +3287,10 @@ var getStakeAccounts = async ({
3291
3287
  },
3292
3288
  {}
3293
3289
  );
3294
- const stakeObjectIds = stakeObjectsResponse.map((ref) => ref?.data?.objectId).filter((id) => id !== void 0);
3295
- const stakeObjects = await utils.cache.queryGetObjects(stakeObjectIds, {
3296
- showContent: true,
3297
- showType: true
3298
- });
3299
- for (const stakeObject of stakeObjects) {
3300
- const id = stakeObject.objectId;
3301
- const type = stakeObject.type;
3302
- if (stakeObject.content && "fields" in stakeObject.content) {
3290
+ for (const stakeObject of stakeObjectsResponse.map((ref) => ref.data)) {
3291
+ const id = stakeObject?.objectId;
3292
+ const type = stakeObject?.type;
3293
+ if (id && stakeObject?.content && "fields" in stakeObject.content) {
3303
3294
  const fields = stakeObject.content.fields;
3304
3295
  const stakePoolId = String(fields.spool_id);
3305
3296
  const stakeType = String(fields.stake_type.fields.name);
@@ -4796,6 +4787,11 @@ var ScallopUtils = class {
4796
4787
  existPricesCoinNames.push(assetCoinName);
4797
4788
  } else {
4798
4789
  lackPricesCoinNames.push(assetCoinName);
4790
+ this.cache.queryClient.invalidateQueries({
4791
+ queryKey: queryKeys.oracle.getPythLatestPriceFeed(
4792
+ this.address.get(`core.coins.${assetCoinName}.oracle.pyth.feed`)
4793
+ )
4794
+ });
4799
4795
  }
4800
4796
  });
4801
4797
  if (existPricesCoinNames.length > 0) {
@@ -4823,7 +4819,7 @@ var ScallopUtils = class {
4823
4819
  Object.entries(priceIds).map(async ([coinName, priceId]) => {
4824
4820
  const pythConnection = new import_pyth_sui_js.SuiPriceServiceConnection(endpoint);
4825
4821
  try {
4826
- const feed = await this.address.cache.queryClient.fetchQuery({
4822
+ const feed = await this.cache.queryClient.fetchQuery({
4827
4823
  queryKey: queryKeys.oracle.getPythLatestPriceFeed(priceId),
4828
4824
  queryFn: async () => {
4829
4825
  return await pythConnection.getLatestPriceFeeds([priceId]);