@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.js
CHANGED
|
@@ -473,7 +473,8 @@ var import_sui_kit = require("@scallop-io/sui-kit");
|
|
|
473
473
|
var DEFAULT_CACHE_OPTIONS = {
|
|
474
474
|
defaultOptions: {
|
|
475
475
|
queries: {
|
|
476
|
-
staleTime:
|
|
476
|
+
staleTime: 5e3,
|
|
477
|
+
gcTime: 5e3
|
|
477
478
|
}
|
|
478
479
|
}
|
|
479
480
|
};
|
|
@@ -1124,6 +1125,10 @@ function withIndexerFallback(method) {
|
|
|
1124
1125
|
var ScallopCache = class {
|
|
1125
1126
|
constructor(suiKit, walletAddress, cacheOptions, tokenBucket, queryClient) {
|
|
1126
1127
|
this.queryClient = queryClient ?? new import_query_core.QueryClient(cacheOptions ?? DEFAULT_CACHE_OPTIONS);
|
|
1128
|
+
if (queryClient && cacheOptions) {
|
|
1129
|
+
if (cacheOptions.defaultOptions)
|
|
1130
|
+
this.queryClient.setDefaultOptions(cacheOptions.defaultOptions);
|
|
1131
|
+
}
|
|
1127
1132
|
this._suiKit = suiKit;
|
|
1128
1133
|
this.tokenBucket = tokenBucket ?? new TokenBucket(DEFAULT_TOKENS_PER_INTERVAL, DEFAULT_INTERVAL_IN_MS);
|
|
1129
1134
|
this.walletAddress = walletAddress ?? suiKit.currentAddress();
|
|
@@ -4903,14 +4908,13 @@ var import_utils24 = require("@mysten/sui/utils");
|
|
|
4903
4908
|
var import_sui_kit14 = require("@scallop-io/sui-kit");
|
|
4904
4909
|
|
|
4905
4910
|
// src/builders/coreBuilder.ts
|
|
4906
|
-
var
|
|
4911
|
+
var import_transactions = require("@mysten/sui/transactions");
|
|
4907
4912
|
var import_utils13 = require("@mysten/sui/utils");
|
|
4908
4913
|
var import_sui_kit5 = require("@scallop-io/sui-kit");
|
|
4909
4914
|
|
|
4910
4915
|
// src/builders/oracle.ts
|
|
4911
4916
|
var import_utils12 = require("@mysten/sui/utils");
|
|
4912
4917
|
var import_pyth_sui_js2 = require("@pythnetwork/pyth-sui-js");
|
|
4913
|
-
var import_transactions = require("@mysten/sui.js/transactions");
|
|
4914
4918
|
var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
|
|
4915
4919
|
const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
4916
4920
|
assetCoinNames = assetCoinNames ?? [
|
|
@@ -4919,7 +4923,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4919
4923
|
const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
|
|
4920
4924
|
if (usePythPullModel && rules.includes("pyth")) {
|
|
4921
4925
|
const pythClient = new import_pyth_sui_js2.SuiPythClient(
|
|
4922
|
-
builder.
|
|
4926
|
+
builder.suiKit.client(),
|
|
4923
4927
|
builder.address.get("core.oracles.pyth.state"),
|
|
4924
4928
|
builder.address.get("core.oracles.pyth.wormholeState")
|
|
4925
4929
|
);
|
|
@@ -4932,7 +4936,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4932
4936
|
const pythConnection = new import_pyth_sui_js2.SuiPriceServiceConnection(endpoint);
|
|
4933
4937
|
const priceUpdateData = await pythConnection.getPriceFeedsUpdateData(priceIds);
|
|
4934
4938
|
await pythClient.updatePriceFeeds(
|
|
4935
|
-
|
|
4939
|
+
txBlock.txBlock,
|
|
4936
4940
|
// convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
|
|
4937
4941
|
priceUpdateData,
|
|
4938
4942
|
priceIds
|
|
@@ -5416,7 +5420,7 @@ var generateCoreQuickMethod = ({
|
|
|
5416
5420
|
};
|
|
5417
5421
|
};
|
|
5418
5422
|
var newCoreTxBlock = (builder, initTxBlock) => {
|
|
5419
|
-
const txBlock = initTxBlock instanceof
|
|
5423
|
+
const txBlock = initTxBlock instanceof import_transactions.Transaction ? new import_sui_kit5.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit5.SuiTxBlock();
|
|
5420
5424
|
const normalMethod = generateCoreNormalMethod({
|
|
5421
5425
|
builder,
|
|
5422
5426
|
txBlock
|
|
@@ -5444,7 +5448,7 @@ var newCoreTxBlock = (builder, initTxBlock) => {
|
|
|
5444
5448
|
};
|
|
5445
5449
|
|
|
5446
5450
|
// src/builders/spoolBuilder.ts
|
|
5447
|
-
var
|
|
5451
|
+
var import_transactions2 = require("@mysten/sui/transactions");
|
|
5448
5452
|
var import_utils15 = require("@mysten/sui/utils");
|
|
5449
5453
|
var import_sui_kit6 = require("@scallop-io/sui-kit");
|
|
5450
5454
|
var requireStakeAccountIds = async (...params) => {
|
|
@@ -5638,7 +5642,7 @@ var generateSpoolQuickMethod = ({
|
|
|
5638
5642
|
};
|
|
5639
5643
|
};
|
|
5640
5644
|
var newSpoolTxBlock = (builder, initTxBlock) => {
|
|
5641
|
-
const txBlock = initTxBlock instanceof
|
|
5645
|
+
const txBlock = initTxBlock instanceof import_transactions2.Transaction ? new import_sui_kit6.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit6.SuiTxBlock();
|
|
5642
5646
|
const normalMethod = generateSpoolNormalMethod({
|
|
5643
5647
|
builder,
|
|
5644
5648
|
txBlock
|
|
@@ -5666,7 +5670,7 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
|
|
|
5666
5670
|
};
|
|
5667
5671
|
|
|
5668
5672
|
// src/builders/borrowIncentiveBuilder.ts
|
|
5669
|
-
var
|
|
5673
|
+
var import_transactions3 = require("@mysten/sui/transactions");
|
|
5670
5674
|
var import_utils17 = require("@mysten/sui/utils");
|
|
5671
5675
|
var import_sui_kit7 = require("@scallop-io/sui-kit");
|
|
5672
5676
|
var requireObligationInfo2 = async (...params) => {
|
|
@@ -5868,7 +5872,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
5868
5872
|
};
|
|
5869
5873
|
};
|
|
5870
5874
|
var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
|
|
5871
|
-
const txBlock = initTxBlock instanceof
|
|
5875
|
+
const txBlock = initTxBlock instanceof import_transactions3.Transaction ? new import_sui_kit7.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit7.SuiTxBlock();
|
|
5872
5876
|
const normalMethod = generateBorrowIncentiveNormalMethod({
|
|
5873
5877
|
builder,
|
|
5874
5878
|
txBlock
|
|
@@ -6306,7 +6310,7 @@ var newReferralTxBlock = (builder, initTxBlock) => {
|
|
|
6306
6310
|
};
|
|
6307
6311
|
|
|
6308
6312
|
// src/builders/loyaltyProgramBuilder.ts
|
|
6309
|
-
var
|
|
6313
|
+
var import_transactions4 = require("@mysten/sui/transactions");
|
|
6310
6314
|
var import_sui_kit10 = require("@scallop-io/sui-kit");
|
|
6311
6315
|
var generateLoyaltyProgramNormalMethod = ({ builder, txBlock }) => {
|
|
6312
6316
|
const loyaltyProgramIds = {
|
|
@@ -6347,7 +6351,7 @@ var generateLoyaltyProgramQuickMethod = ({
|
|
|
6347
6351
|
};
|
|
6348
6352
|
};
|
|
6349
6353
|
var newLoyaltyProgramTxBlock = (builder, initTxBlock) => {
|
|
6350
|
-
const txBlock = initTxBlock instanceof
|
|
6354
|
+
const txBlock = initTxBlock instanceof import_transactions4.Transaction ? new import_sui_kit10.SuiTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new import_sui_kit10.SuiTxBlock();
|
|
6351
6355
|
const normalMethod = generateLoyaltyProgramNormalMethod({
|
|
6352
6356
|
builder,
|
|
6353
6357
|
txBlock
|
|
@@ -7294,7 +7298,6 @@ var ScallopQuery = class {
|
|
|
7294
7298
|
};
|
|
7295
7299
|
|
|
7296
7300
|
// src/models/scallopBuilder.ts
|
|
7297
|
-
var import_client = require("@mysten/sui.js/client");
|
|
7298
7301
|
var ScallopBuilder = class {
|
|
7299
7302
|
constructor(params, instance) {
|
|
7300
7303
|
this.suiKit = instance?.suiKit ?? new import_sui_kit14.SuiKit(params);
|
|
@@ -7336,9 +7339,6 @@ var ScallopBuilder = class {
|
|
|
7336
7339
|
);
|
|
7337
7340
|
}
|
|
7338
7341
|
this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
|
|
7339
|
-
this.oldSuiClient = new import_client.SuiClient({
|
|
7340
|
-
url: this.suiKit.suiInteractor.currentFullNode
|
|
7341
|
-
});
|
|
7342
7342
|
}
|
|
7343
7343
|
/**
|
|
7344
7344
|
* Request the scallop API to initialize data.
|