@scallop-io/sui-scallop-sdk 1.3.0-alpha.6 → 1.3.1-alpha.1
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 +16 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopBuilder.d.ts +0 -2
- package/dist/models/scallopQuery.d.ts +1 -1
- package/dist/queries/loyaltyProgramQuery.d.ts +1 -1
- package/dist/types/builder/core.d.ts +3 -3
- package/package.json +2 -3
- package/src/builders/oracle.ts +2 -3
- package/src/constants/cache.ts +2 -1
- package/src/models/scallopBuilder.ts +0 -9
- package/src/models/scallopCache.ts +10 -6
- package/src/models/scallopQuery.ts +1 -1
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/types/builder/core.ts +2 -8
package/dist/index.mjs
CHANGED
|
@@ -394,7 +394,8 @@ import {
|
|
|
394
394
|
var DEFAULT_CACHE_OPTIONS = {
|
|
395
395
|
defaultOptions: {
|
|
396
396
|
queries: {
|
|
397
|
-
staleTime:
|
|
397
|
+
staleTime: 5e3,
|
|
398
|
+
gcTime: 5e3
|
|
398
399
|
}
|
|
399
400
|
}
|
|
400
401
|
};
|
|
@@ -1045,6 +1046,10 @@ function withIndexerFallback(method) {
|
|
|
1045
1046
|
var ScallopCache = class {
|
|
1046
1047
|
constructor(suiKit, walletAddress, cacheOptions, tokenBucket, queryClient) {
|
|
1047
1048
|
this.queryClient = queryClient ?? new QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
|
|
1049
|
+
if (queryClient && cacheOptions) {
|
|
1050
|
+
if (cacheOptions.defaultOptions)
|
|
1051
|
+
this.queryClient.setDefaultOptions(cacheOptions.defaultOptions);
|
|
1052
|
+
}
|
|
1048
1053
|
this._suiKit = suiKit;
|
|
1049
1054
|
this.tokenBucket = tokenBucket ?? new TokenBucket(DEFAULT_TOKENS_PER_INTERVAL, DEFAULT_INTERVAL_IN_MS);
|
|
1050
1055
|
this.walletAddress = walletAddress ?? suiKit.currentAddress();
|
|
@@ -4834,7 +4839,6 @@ import {
|
|
|
4834
4839
|
SuiPythClient,
|
|
4835
4840
|
SuiPriceServiceConnection as SuiPriceServiceConnection2
|
|
4836
4841
|
} from "@pythnetwork/pyth-sui-js";
|
|
4837
|
-
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
4838
4842
|
var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
|
|
4839
4843
|
const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
4840
4844
|
assetCoinNames = assetCoinNames ?? [
|
|
@@ -4843,7 +4847,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4843
4847
|
const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
|
|
4844
4848
|
if (usePythPullModel && rules.includes("pyth")) {
|
|
4845
4849
|
const pythClient = new SuiPythClient(
|
|
4846
|
-
builder.
|
|
4850
|
+
builder.suiKit.client(),
|
|
4847
4851
|
builder.address.get("core.oracles.pyth.state"),
|
|
4848
4852
|
builder.address.get("core.oracles.pyth.wormholeState")
|
|
4849
4853
|
);
|
|
@@ -4856,7 +4860,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4856
4860
|
const pythConnection = new SuiPriceServiceConnection2(endpoint);
|
|
4857
4861
|
const priceUpdateData = await pythConnection.getPriceFeedsUpdateData(priceIds);
|
|
4858
4862
|
await pythClient.updatePriceFeeds(
|
|
4859
|
-
|
|
4863
|
+
txBlock.txBlock,
|
|
4860
4864
|
// convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
|
|
4861
4865
|
priceUpdateData,
|
|
4862
4866
|
priceIds
|
|
@@ -7226,7 +7230,6 @@ var ScallopQuery = class {
|
|
|
7226
7230
|
};
|
|
7227
7231
|
|
|
7228
7232
|
// src/models/scallopBuilder.ts
|
|
7229
|
-
import { SuiClient as SuiClientV0 } from "@mysten/sui.js/client";
|
|
7230
7233
|
var ScallopBuilder = class {
|
|
7231
7234
|
constructor(params, instance) {
|
|
7232
7235
|
this.suiKit = instance?.suiKit ?? new SuiKit5(params);
|
|
@@ -7268,9 +7271,6 @@ var ScallopBuilder = class {
|
|
|
7268
7271
|
);
|
|
7269
7272
|
}
|
|
7270
7273
|
this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
|
|
7271
|
-
this.oldSuiClient = new SuiClientV0({
|
|
7272
|
-
url: this.suiKit.suiInteractor.currentFullNode
|
|
7273
|
-
});
|
|
7274
7274
|
}
|
|
7275
7275
|
/**
|
|
7276
7276
|
* Request the scallop API to initialize data.
|