@scallop-io/sui-scallop-sdk 0.47.3 → 1.3.0-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/builders/borrowIncentiveBuilder.d.ts +2 -2
- package/dist/builders/coreBuilder.d.ts +2 -2
- package/dist/builders/index.d.ts +2 -2
- package/dist/builders/loyaltyProgramBuilder.d.ts +2 -2
- package/dist/builders/referralBuilder.d.ts +2 -2
- package/dist/builders/sCoinBuilder.d.ts +2 -2
- package/dist/builders/spoolBuilder.d.ts +2 -2
- package/dist/builders/vescaBuilder.d.ts +2 -2
- package/dist/constants/common.d.ts +4 -4
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/vesca.d.ts +3 -3
- package/dist/index.js +87 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -77
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopBuilder.d.ts +10 -8
- package/dist/models/scallopCache.d.ts +5 -9
- package/dist/models/scallopClient.d.ts +2 -2
- package/dist/models/scallopQuery.d.ts +1 -1
- package/dist/models/scallopUtils.d.ts +2 -2
- package/dist/queries/coreQuery.d.ts +3 -3
- package/dist/queries/loyaltyProgramQuery.d.ts +1 -1
- package/dist/queries/priceQuery.d.ts +1 -1
- package/dist/queries/vescaQuery.d.ts +1 -1
- package/dist/test.d.ts +1 -0
- package/dist/types/builder/borrowIncentive.d.ts +1 -1
- package/dist/types/builder/core.d.ts +16 -16
- package/dist/types/builder/spool.d.ts +3 -3
- package/dist/types/builder/vesca.d.ts +5 -5
- package/dist/types/model.d.ts +4 -4
- package/dist/types/query/vesca.d.ts +1 -1
- package/dist/utils/query.d.ts +1 -1
- package/dist/utils/util.d.ts +1 -0
- package/package.json +13 -9
- package/src/builders/borrowIncentiveBuilder.ts +6 -6
- package/src/builders/coreBuilder.ts +15 -15
- package/src/builders/index.ts +2 -2
- package/src/builders/loyaltyProgramBuilder.ts +5 -5
- package/src/builders/oracle.ts +5 -4
- package/src/builders/referralBuilder.ts +6 -6
- package/src/builders/sCoinBuilder.ts +5 -8
- package/src/builders/spoolBuilder.ts +9 -9
- package/src/builders/vescaBuilder.ts +5 -5
- package/src/constants/common.ts +4 -4
- package/src/constants/index.ts +1 -1
- package/src/constants/vesca.ts +5 -6
- package/src/models/scallopBuilder.ts +14 -7
- package/src/models/scallopCache.ts +43 -34
- package/src/models/scallopClient.ts +8 -6
- package/src/models/scallopQuery.ts +2 -2
- package/src/models/scallopUtils.ts +3 -3
- package/src/queries/borrowIncentiveQuery.ts +1 -1
- package/src/queries/coreQuery.ts +4 -4
- package/src/queries/loyaltyProgramQuery.ts +1 -1
- package/src/queries/priceQuery.ts +1 -1
- package/src/queries/sCoinQuery.ts +2 -2
- package/src/queries/spoolQuery.ts +4 -5
- package/src/queries/vescaQuery.ts +6 -3
- package/src/test.ts +26 -0
- package/src/types/address.ts +26 -26
- package/src/types/builder/borrowIncentive.ts +1 -1
- package/src/types/builder/core.ts +26 -28
- package/src/types/builder/spool.ts +2 -3
- package/src/types/builder/vesca.ts +5 -9
- package/src/types/model.ts +4 -7
- package/src/types/query/vesca.ts +1 -1
- package/src/utils/query.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -240,13 +240,6 @@ var sCoinIds = {
|
|
|
240
240
|
swbtc: "0x2cf76a9cf5d3337961d1154283234f94da2dcff18544dfe5cbdef65f319591b5::scallop_wormhole_btc::SCALLOP_WORMHOLE_BTC"
|
|
241
241
|
};
|
|
242
242
|
|
|
243
|
-
// src/constants/vesca.ts
|
|
244
|
-
var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
|
|
245
|
-
var MAX_LOCK_ROUNDS = 1460;
|
|
246
|
-
var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
|
|
247
|
-
var MIN_INITIAL_LOCK_AMOUNT = 1e10;
|
|
248
|
-
var MIN_TOP_UP_AMOUNT = 1e9;
|
|
249
|
-
|
|
250
243
|
// src/constants/flashloan.ts
|
|
251
244
|
var FlashLoanFeeObjectMap = {
|
|
252
245
|
vsui: "0x0069cddee7a5c0b1d34beb5ef0620f978096525f1830b055f38b110f40d73fbb",
|
|
@@ -263,6 +256,13 @@ var FlashLoanFeeObjectMap = {
|
|
|
263
256
|
wsol: "0xe84bdb35b790fc7bdd1645122ac6ac0fc904531d6772c9e25904fece322c5f34"
|
|
264
257
|
};
|
|
265
258
|
|
|
259
|
+
// src/constants/vesca.ts
|
|
260
|
+
var UNLOCK_ROUND_DURATION = 60 * 60 * 24;
|
|
261
|
+
var MAX_LOCK_ROUNDS = 1460;
|
|
262
|
+
var MAX_LOCK_DURATION = MAX_LOCK_ROUNDS * UNLOCK_ROUND_DURATION;
|
|
263
|
+
var MIN_INITIAL_LOCK_AMOUNT = 1e10;
|
|
264
|
+
var MIN_TOP_UP_AMOUNT = 1e9;
|
|
265
|
+
|
|
266
266
|
// src/models/scallop.ts
|
|
267
267
|
import { SuiKit as SuiKit7 } from "@scallop-io/sui-kit";
|
|
268
268
|
|
|
@@ -391,7 +391,7 @@ var checkRenewExpiredVeSca = (scaAmount, lockPeriodInDays, prevUnlockAtInMillisT
|
|
|
391
391
|
|
|
392
392
|
// src/utils/query.ts
|
|
393
393
|
import BigNumber from "bignumber.js";
|
|
394
|
-
import { normalizeStructTag, parseStructTag } from "@mysten/sui
|
|
394
|
+
import { normalizeStructTag, parseStructTag } from "@mysten/sui/utils";
|
|
395
395
|
var parseOriginMarketPoolData = (originMarketPoolData) => {
|
|
396
396
|
return {
|
|
397
397
|
coinType: normalizeStructTag(originMarketPoolData.type.name),
|
|
@@ -928,21 +928,40 @@ var ScallopCache = class {
|
|
|
928
928
|
refetchType
|
|
929
929
|
});
|
|
930
930
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
931
|
+
async resolveArgs(txb, args) {
|
|
932
|
+
return await Promise.all(
|
|
933
|
+
args.map(async (arg) => {
|
|
934
|
+
if (typeof arg === "string") {
|
|
935
|
+
const objData = (await this.queryGetObject(arg, { showOwner: true }))?.data;
|
|
936
|
+
if (!objData)
|
|
937
|
+
return arg;
|
|
938
|
+
const owner = objData?.owner;
|
|
939
|
+
if (!owner)
|
|
940
|
+
return arg;
|
|
941
|
+
if ("Shared" in owner) {
|
|
942
|
+
return txb.sharedObjectRef({
|
|
943
|
+
objectId: objData.objectId,
|
|
944
|
+
initialSharedVersion: owner.Shared.initial_shared_version,
|
|
945
|
+
mutable: true
|
|
946
|
+
});
|
|
947
|
+
} else {
|
|
948
|
+
return txb.objectRef({
|
|
949
|
+
objectId: objData.objectId,
|
|
950
|
+
version: objData.version,
|
|
951
|
+
digest: objData.digest
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
} else if ("objectId" in arg && "version" in arg && "digest" in arg) {
|
|
955
|
+
return txb.objectRef({
|
|
956
|
+
objectId: arg.objectId,
|
|
957
|
+
version: arg.version,
|
|
958
|
+
digest: arg.digest
|
|
959
|
+
});
|
|
960
|
+
} else {
|
|
961
|
+
return arg;
|
|
962
|
+
}
|
|
963
|
+
})
|
|
964
|
+
);
|
|
946
965
|
}
|
|
947
966
|
/**
|
|
948
967
|
* @description Provides cache for inspectTxn of the SuiKit.
|
|
@@ -956,20 +975,8 @@ var ScallopCache = class {
|
|
|
956
975
|
typeArgs
|
|
957
976
|
}) {
|
|
958
977
|
const txBlock = new SuiTxBlock();
|
|
959
|
-
const resolvedArgs = await
|
|
960
|
-
args.map(async (arg) => {
|
|
961
|
-
if (typeof arg === "string") {
|
|
962
|
-
return (await this.queryGetObject(arg, { showContent: true }))?.data;
|
|
963
|
-
}
|
|
964
|
-
return arg;
|
|
965
|
-
})
|
|
966
|
-
);
|
|
978
|
+
const resolvedArgs = await this.resolveArgs(txBlock, args);
|
|
967
979
|
txBlock.moveCall(queryTarget, resolvedArgs, typeArgs);
|
|
968
|
-
const txBytes = await txBlock.txBlock.build({
|
|
969
|
-
client: this.client,
|
|
970
|
-
onlyTransactionKind: true,
|
|
971
|
-
protocolConfig: await this.getProtocolConfig() ?? void 0
|
|
972
|
-
});
|
|
973
980
|
const query = await this.queryClient.fetchQuery({
|
|
974
981
|
queryKey: typeArgs ? ["inspectTxn", queryTarget, JSON.stringify(args)] : [
|
|
975
982
|
"inspectTxn",
|
|
@@ -980,7 +987,7 @@ var ScallopCache = class {
|
|
|
980
987
|
queryFn: async () => {
|
|
981
988
|
return await callWithRateLimit(
|
|
982
989
|
this.tokenBucket,
|
|
983
|
-
() => this.suiKit.inspectTxn(
|
|
990
|
+
() => this.suiKit.inspectTxn(txBlock)
|
|
984
991
|
);
|
|
985
992
|
}
|
|
986
993
|
});
|
|
@@ -2201,16 +2208,16 @@ var ScallopAddress = class {
|
|
|
2201
2208
|
};
|
|
2202
2209
|
|
|
2203
2210
|
// src/models/scallopClient.ts
|
|
2204
|
-
import { normalizeSuiAddress as normalizeSuiAddress4 } from "@mysten/sui
|
|
2211
|
+
import { normalizeSuiAddress as normalizeSuiAddress4 } from "@mysten/sui/utils";
|
|
2205
2212
|
import { SuiKit as SuiKit6 } from "@scallop-io/sui-kit";
|
|
2206
2213
|
|
|
2207
2214
|
// src/models/scallopUtils.ts
|
|
2208
|
-
import { SUI_TYPE_ARG, normalizeStructTag as normalizeStructTag6 } from "@mysten/sui
|
|
2215
|
+
import { SUI_TYPE_ARG, normalizeStructTag as normalizeStructTag6 } from "@mysten/sui/utils";
|
|
2209
2216
|
import { SuiKit as SuiKit2 } from "@scallop-io/sui-kit";
|
|
2210
2217
|
import { SuiPriceServiceConnection } from "@pythnetwork/pyth-sui-js";
|
|
2211
2218
|
|
|
2212
2219
|
// src/queries/coreQuery.ts
|
|
2213
|
-
import { normalizeStructTag as normalizeStructTag3 } from "@mysten/sui
|
|
2220
|
+
import { normalizeStructTag as normalizeStructTag3 } from "@mysten/sui/utils";
|
|
2214
2221
|
import BigNumber2 from "bignumber.js";
|
|
2215
2222
|
|
|
2216
2223
|
// src/queries/supplyLimit.ts
|
|
@@ -2865,7 +2872,7 @@ var getFlashLoanFees = async (query, assetNames) => {
|
|
|
2865
2872
|
};
|
|
2866
2873
|
|
|
2867
2874
|
// src/queries/spoolQuery.ts
|
|
2868
|
-
import { normalizeStructTag as normalizeStructTag4 } from "@mysten/sui
|
|
2875
|
+
import { normalizeStructTag as normalizeStructTag4 } from "@mysten/sui/utils";
|
|
2869
2876
|
var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexer = false) => {
|
|
2870
2877
|
const stakeCoinNames = stakeMarketCoinNames.map(
|
|
2871
2878
|
(stakeMarketCoinName) => query.utils.parseCoinName(stakeMarketCoinName)
|
|
@@ -3261,7 +3268,7 @@ var getStakeRewardPool = async ({
|
|
|
3261
3268
|
};
|
|
3262
3269
|
|
|
3263
3270
|
// src/queries/borrowIncentiveQuery.ts
|
|
3264
|
-
import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui
|
|
3271
|
+
import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
|
|
3265
3272
|
import BigNumber3 from "bignumber.js";
|
|
3266
3273
|
var queryBorrowIncentivePools = async (address) => {
|
|
3267
3274
|
const queryPkgId = address.get("borrowIncentive.query");
|
|
@@ -4048,8 +4055,9 @@ var getTotalValueLocked = async (query, indexer = false) => {
|
|
|
4048
4055
|
// src/queries/vescaQuery.ts
|
|
4049
4056
|
import BigNumber5 from "bignumber.js";
|
|
4050
4057
|
import { SUI_CLOCK_OBJECT_ID, SuiTxBlock as SuiTxBlock2 } from "@scallop-io/sui-kit";
|
|
4051
|
-
import { bcs } from "@mysten/sui
|
|
4058
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
4052
4059
|
import { z as zod2 } from "zod";
|
|
4060
|
+
import assert from "assert";
|
|
4053
4061
|
var getVescaKeys = async (utils, ownerAddress) => {
|
|
4054
4062
|
const owner = ownerAddress || utils.suiKit.currentAddress();
|
|
4055
4063
|
const veScaObjId = utils.address.get("vesca.object");
|
|
@@ -4183,7 +4191,8 @@ var getTotalVeScaTreasuryAmount = async (utils, veScaTreasury) => {
|
|
|
4183
4191
|
if (results && results[1].returnValues) {
|
|
4184
4192
|
const value = Uint8Array.from(results[1].returnValues[0][0]);
|
|
4185
4193
|
const type = results[1].returnValues[0][1];
|
|
4186
|
-
|
|
4194
|
+
assert(type === "u64", "Result type is not u64");
|
|
4195
|
+
return bcs.u64().parse(value);
|
|
4187
4196
|
}
|
|
4188
4197
|
return "0";
|
|
4189
4198
|
};
|
|
@@ -4720,20 +4729,21 @@ var ScallopUtils = class {
|
|
|
4720
4729
|
};
|
|
4721
4730
|
|
|
4722
4731
|
// src/models/scallopBuilder.ts
|
|
4723
|
-
import { normalizeSuiAddress as normalizeSuiAddress3 } from "@mysten/sui
|
|
4732
|
+
import { normalizeSuiAddress as normalizeSuiAddress3 } from "@mysten/sui/utils";
|
|
4724
4733
|
import { SuiKit as SuiKit5 } from "@scallop-io/sui-kit";
|
|
4725
4734
|
|
|
4726
4735
|
// src/builders/coreBuilder.ts
|
|
4727
|
-
import {
|
|
4728
|
-
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID3 } from "@mysten/sui
|
|
4736
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
4737
|
+
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID3 } from "@mysten/sui/utils";
|
|
4729
4738
|
import { SuiTxBlock as SuiKitTxBlock } from "@scallop-io/sui-kit";
|
|
4730
4739
|
|
|
4731
4740
|
// src/builders/oracle.ts
|
|
4732
|
-
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID2 } from "@mysten/sui
|
|
4741
|
+
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID2 } from "@mysten/sui/utils";
|
|
4733
4742
|
import {
|
|
4734
4743
|
SuiPythClient,
|
|
4735
4744
|
SuiPriceServiceConnection as SuiPriceServiceConnection2
|
|
4736
4745
|
} from "@pythnetwork/pyth-sui-js";
|
|
4746
|
+
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
4737
4747
|
var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePythPullModel: true }) => {
|
|
4738
4748
|
const usePythPullModel = builder.params.usePythPullModel ?? options.usePythPullModel;
|
|
4739
4749
|
assetCoinNames = assetCoinNames ?? [
|
|
@@ -4742,7 +4752,7 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4742
4752
|
const rules = builder.isTestnet ? ["pyth"] : ["pyth"];
|
|
4743
4753
|
if (usePythPullModel && rules.includes("pyth")) {
|
|
4744
4754
|
const pythClient = new SuiPythClient(
|
|
4745
|
-
builder.
|
|
4755
|
+
builder.oldSuiClient,
|
|
4746
4756
|
builder.address.get("core.oracles.pyth.state"),
|
|
4747
4757
|
builder.address.get("core.oracles.pyth.wormholeState")
|
|
4748
4758
|
);
|
|
@@ -4755,7 +4765,8 @@ var updateOracles = async (builder, txBlock, assetCoinNames, options = { usePyth
|
|
|
4755
4765
|
const pythConnection = new SuiPriceServiceConnection2(endpoint);
|
|
4756
4766
|
const priceUpdateData = await pythConnection.getPriceFeedsUpdateData(priceIds);
|
|
4757
4767
|
await pythClient.updatePriceFeeds(
|
|
4758
|
-
txBlock.
|
|
4768
|
+
TransactionBlock.from(txBlock.serialize()),
|
|
4769
|
+
// convert txBlock to TransactionBlock because pyth sdk not support new @mysten/sui yet
|
|
4759
4770
|
priceUpdateData,
|
|
4760
4771
|
priceIds
|
|
4761
4772
|
);
|
|
@@ -4936,7 +4947,7 @@ var generateCoreNormalMethod = ({
|
|
|
4936
4947
|
obligationKey,
|
|
4937
4948
|
coreIds.market,
|
|
4938
4949
|
coreIds.coinDecimalsRegistry,
|
|
4939
|
-
amount,
|
|
4950
|
+
txBlock.pure.u64(amount),
|
|
4940
4951
|
coreIds.xOracle,
|
|
4941
4952
|
SUI_CLOCK_OBJECT_ID3
|
|
4942
4953
|
],
|
|
@@ -5003,7 +5014,7 @@ var generateCoreNormalMethod = ({
|
|
|
5003
5014
|
coreIds.market,
|
|
5004
5015
|
coreIds.coinDecimalsRegistry,
|
|
5005
5016
|
borrowReferral,
|
|
5006
|
-
amount,
|
|
5017
|
+
txBlock.pure.u64(amount),
|
|
5007
5018
|
coreIds.xOracle,
|
|
5008
5019
|
SUI_CLOCK_OBJECT_ID3
|
|
5009
5020
|
],
|
|
@@ -5020,7 +5031,7 @@ var generateCoreNormalMethod = ({
|
|
|
5020
5031
|
obligationKey,
|
|
5021
5032
|
coreIds.market,
|
|
5022
5033
|
coreIds.coinDecimalsRegistry,
|
|
5023
|
-
amount,
|
|
5034
|
+
txBlock.pure.u64(amount),
|
|
5024
5035
|
coreIds.xOracle,
|
|
5025
5036
|
SUI_CLOCK_OBJECT_ID3
|
|
5026
5037
|
],
|
|
@@ -5238,7 +5249,7 @@ var generateCoreQuickMethod = ({
|
|
|
5238
5249
|
};
|
|
5239
5250
|
};
|
|
5240
5251
|
var newCoreTxBlock = (builder, initTxBlock) => {
|
|
5241
|
-
const txBlock = initTxBlock instanceof
|
|
5252
|
+
const txBlock = initTxBlock instanceof Transaction ? new SuiKitTxBlock(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock();
|
|
5242
5253
|
const normalMethod = generateCoreNormalMethod({
|
|
5243
5254
|
builder,
|
|
5244
5255
|
txBlock
|
|
@@ -5266,8 +5277,8 @@ var newCoreTxBlock = (builder, initTxBlock) => {
|
|
|
5266
5277
|
};
|
|
5267
5278
|
|
|
5268
5279
|
// src/builders/spoolBuilder.ts
|
|
5269
|
-
import {
|
|
5270
|
-
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID4 } from "@mysten/sui
|
|
5280
|
+
import { Transaction as Transaction2 } from "@mysten/sui/transactions";
|
|
5281
|
+
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID4 } from "@mysten/sui/utils";
|
|
5271
5282
|
import { SuiTxBlock as SuiKitTxBlock2 } from "@scallop-io/sui-kit";
|
|
5272
5283
|
var requireStakeAccountIds = async (...params) => {
|
|
5273
5284
|
const [builder, txBlock, stakeMarketCoinName, stakeAccountId] = params;
|
|
@@ -5460,7 +5471,7 @@ var generateSpoolQuickMethod = ({
|
|
|
5460
5471
|
};
|
|
5461
5472
|
};
|
|
5462
5473
|
var newSpoolTxBlock = (builder, initTxBlock) => {
|
|
5463
|
-
const txBlock = initTxBlock instanceof
|
|
5474
|
+
const txBlock = initTxBlock instanceof Transaction2 ? new SuiKitTxBlock2(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock2();
|
|
5464
5475
|
const normalMethod = generateSpoolNormalMethod({
|
|
5465
5476
|
builder,
|
|
5466
5477
|
txBlock
|
|
@@ -5488,8 +5499,8 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
|
|
|
5488
5499
|
};
|
|
5489
5500
|
|
|
5490
5501
|
// src/builders/borrowIncentiveBuilder.ts
|
|
5491
|
-
import {
|
|
5492
|
-
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID5 } from "@mysten/sui
|
|
5502
|
+
import { Transaction as Transaction3 } from "@mysten/sui/transactions";
|
|
5503
|
+
import { SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID5 } from "@mysten/sui/utils";
|
|
5493
5504
|
import { SuiTxBlock as SuiKitTxBlock3 } from "@scallop-io/sui-kit";
|
|
5494
5505
|
var requireObligationInfo2 = async (...params) => {
|
|
5495
5506
|
const [builder, txBlock, obligationId, obligationKey] = params;
|
|
@@ -5690,7 +5701,7 @@ var generateBorrowIncentiveQuickMethod = ({ builder, txBlock }) => {
|
|
|
5690
5701
|
};
|
|
5691
5702
|
};
|
|
5692
5703
|
var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
|
|
5693
|
-
const txBlock = initTxBlock instanceof
|
|
5704
|
+
const txBlock = initTxBlock instanceof Transaction3 ? new SuiKitTxBlock3(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock3();
|
|
5694
5705
|
const normalMethod = generateBorrowIncentiveNormalMethod({
|
|
5695
5706
|
builder,
|
|
5696
5707
|
txBlock
|
|
@@ -5720,7 +5731,7 @@ var newBorrowIncentiveTxBlock = (builder, initTxBlock) => {
|
|
|
5720
5731
|
// src/builders/vescaBuilder.ts
|
|
5721
5732
|
import {
|
|
5722
5733
|
SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID6,
|
|
5723
|
-
|
|
5734
|
+
Transaction as Transaction4,
|
|
5724
5735
|
SuiTxBlock as SuiKitTxBlock4
|
|
5725
5736
|
} from "@scallop-io/sui-kit";
|
|
5726
5737
|
var requireVeSca = async (...params) => {
|
|
@@ -5970,7 +5981,7 @@ var generateQuickVeScaMethod = ({
|
|
|
5970
5981
|
};
|
|
5971
5982
|
};
|
|
5972
5983
|
var newVeScaTxBlock = (builder, initTxBlock) => {
|
|
5973
|
-
const txBlock = initTxBlock instanceof
|
|
5984
|
+
const txBlock = initTxBlock instanceof Transaction4 ? new SuiKitTxBlock4(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock4();
|
|
5974
5985
|
const normalMethod = generateNormalVeScaMethod({
|
|
5975
5986
|
builder,
|
|
5976
5987
|
txBlock
|
|
@@ -6001,7 +6012,7 @@ var newVeScaTxBlock = (builder, initTxBlock) => {
|
|
|
6001
6012
|
import {
|
|
6002
6013
|
SUI_CLOCK_OBJECT_ID as SUI_CLOCK_OBJECT_ID7,
|
|
6003
6014
|
SuiTxBlock as SuiKitTxBlock5,
|
|
6004
|
-
|
|
6015
|
+
Transaction as Transaction5
|
|
6005
6016
|
} from "@scallop-io/sui-kit";
|
|
6006
6017
|
var generateReferralNormalMethod = ({
|
|
6007
6018
|
builder,
|
|
@@ -6024,7 +6035,7 @@ var generateReferralNormalMethod = ({
|
|
|
6024
6035
|
`${referralIds.referralPgkId}::referral_bindings::bind_ve_sca_referrer`,
|
|
6025
6036
|
[
|
|
6026
6037
|
referralIds.referralBindings,
|
|
6027
|
-
txBlock.pure(veScaKeyId),
|
|
6038
|
+
txBlock.pure.id(veScaKeyId),
|
|
6028
6039
|
veScaTable,
|
|
6029
6040
|
SUI_CLOCK_OBJECT_ID7
|
|
6030
6041
|
],
|
|
@@ -6108,7 +6119,7 @@ var generateReferralQuickMethod = ({
|
|
|
6108
6119
|
};
|
|
6109
6120
|
};
|
|
6110
6121
|
var newReferralTxBlock = (builder, initTxBlock) => {
|
|
6111
|
-
const txBlock = initTxBlock instanceof
|
|
6122
|
+
const txBlock = initTxBlock instanceof Transaction5 ? new SuiKitTxBlock5(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock5();
|
|
6112
6123
|
const normalMethod = generateReferralNormalMethod({
|
|
6113
6124
|
builder,
|
|
6114
6125
|
txBlock
|
|
@@ -6136,7 +6147,7 @@ var newReferralTxBlock = (builder, initTxBlock) => {
|
|
|
6136
6147
|
};
|
|
6137
6148
|
|
|
6138
6149
|
// src/builders/loyaltyProgramBuilder.ts
|
|
6139
|
-
import {
|
|
6150
|
+
import { Transaction as Transaction6 } from "@mysten/sui/transactions";
|
|
6140
6151
|
import { SuiTxBlock as SuiKitTxBlock6 } from "@scallop-io/sui-kit";
|
|
6141
6152
|
var generateLoyaltyProgramNormalMethod = ({ builder, txBlock }) => {
|
|
6142
6153
|
const loyaltyProgramIds = {
|
|
@@ -6177,7 +6188,7 @@ var generateLoyaltyProgramQuickMethod = ({
|
|
|
6177
6188
|
};
|
|
6178
6189
|
};
|
|
6179
6190
|
var newLoyaltyProgramTxBlock = (builder, initTxBlock) => {
|
|
6180
|
-
const txBlock = initTxBlock instanceof
|
|
6191
|
+
const txBlock = initTxBlock instanceof Transaction6 ? new SuiKitTxBlock6(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock6();
|
|
6181
6192
|
const normalMethod = generateLoyaltyProgramNormalMethod({
|
|
6182
6193
|
builder,
|
|
6183
6194
|
txBlock
|
|
@@ -6205,10 +6216,7 @@ var newLoyaltyProgramTxBlock = (builder, initTxBlock) => {
|
|
|
6205
6216
|
};
|
|
6206
6217
|
|
|
6207
6218
|
// src/builders/sCoinBuilder.ts
|
|
6208
|
-
import {
|
|
6209
|
-
TransactionBlock as TransactionBlock7,
|
|
6210
|
-
SuiTxBlock as SuiKitTxBlock7
|
|
6211
|
-
} from "@scallop-io/sui-kit";
|
|
6219
|
+
import { Transaction as Transaction7, SuiTxBlock as SuiKitTxBlock7 } from "@scallop-io/sui-kit";
|
|
6212
6220
|
var generateSCoinNormalMethod = ({
|
|
6213
6221
|
builder,
|
|
6214
6222
|
txBlock
|
|
@@ -6269,7 +6277,7 @@ var generateSCoinQuickMethod = ({
|
|
|
6269
6277
|
};
|
|
6270
6278
|
};
|
|
6271
6279
|
var newSCoinTxBlock = (builder, initTxBlock) => {
|
|
6272
|
-
const txBlock = initTxBlock instanceof
|
|
6280
|
+
const txBlock = initTxBlock instanceof Transaction7 ? new SuiKitTxBlock7(initTxBlock) : initTxBlock ? initTxBlock : new SuiKitTxBlock7();
|
|
6273
6281
|
const normalMethod = generateSCoinNormalMethod({
|
|
6274
6282
|
builder,
|
|
6275
6283
|
txBlock
|
|
@@ -6501,8 +6509,8 @@ var ScallopIndexer = class {
|
|
|
6501
6509
|
};
|
|
6502
6510
|
|
|
6503
6511
|
// src/queries/sCoinQuery.ts
|
|
6504
|
-
import { bcs as bcs2 } from "@mysten/sui
|
|
6505
|
-
import
|
|
6512
|
+
import { bcs as bcs2 } from "@mysten/sui/bcs";
|
|
6513
|
+
import assert2 from "assert";
|
|
6506
6514
|
import BigNumber7 from "bignumber.js";
|
|
6507
6515
|
var getSCoinTotalSupply = async ({
|
|
6508
6516
|
utils
|
|
@@ -6523,8 +6531,8 @@ var getSCoinTotalSupply = async ({
|
|
|
6523
6531
|
if (results && results[0].returnValues) {
|
|
6524
6532
|
const value = Uint8Array.from(results[0].returnValues[0][0]);
|
|
6525
6533
|
const type = results[0].returnValues[0][1];
|
|
6526
|
-
|
|
6527
|
-
return BigNumber7(bcs2.
|
|
6534
|
+
assert2(type === "u64", "Result type is not u64");
|
|
6535
|
+
return BigNumber7(bcs2.u64().parse(value)).shiftedBy(utils.getCoinDecimal(utils.parseCoinName(sCoinName))).toNumber();
|
|
6528
6536
|
}
|
|
6529
6537
|
return 0;
|
|
6530
6538
|
};
|
|
@@ -6594,7 +6602,7 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
|
|
|
6594
6602
|
};
|
|
6595
6603
|
|
|
6596
6604
|
// src/models/scallopQuery.ts
|
|
6597
|
-
import { normalizeSuiAddress as normalizeSuiAddress2 } from "@mysten/sui
|
|
6605
|
+
import { normalizeSuiAddress as normalizeSuiAddress2 } from "@mysten/sui/utils";
|
|
6598
6606
|
var ScallopQuery = class {
|
|
6599
6607
|
constructor(params, instance) {
|
|
6600
6608
|
this.params = params;
|
|
@@ -7082,6 +7090,7 @@ var ScallopQuery = class {
|
|
|
7082
7090
|
};
|
|
7083
7091
|
|
|
7084
7092
|
// src/models/scallopBuilder.ts
|
|
7093
|
+
import { SuiClient as SuiClientV0 } from "@mysten/sui.js/client";
|
|
7085
7094
|
var ScallopBuilder = class {
|
|
7086
7095
|
constructor(params, instance) {
|
|
7087
7096
|
this.suiKit = instance?.suiKit ?? new SuiKit5(params);
|
|
@@ -7122,6 +7131,9 @@ var ScallopBuilder = class {
|
|
|
7122
7131
|
);
|
|
7123
7132
|
}
|
|
7124
7133
|
this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
|
|
7134
|
+
this.oldSuiClient = new SuiClientV0({
|
|
7135
|
+
url: this.suiKit.suiInteractor.currentFullNode
|
|
7136
|
+
});
|
|
7125
7137
|
}
|
|
7126
7138
|
/**
|
|
7127
7139
|
* Request the scallop API to initialize data.
|
|
@@ -7643,6 +7655,7 @@ var ScallopClient = class {
|
|
|
7643
7655
|
false
|
|
7644
7656
|
);
|
|
7645
7657
|
const stakeCoinName = this.utils.parseCoinName(stakeMarketCoinName);
|
|
7658
|
+
console.log(stakeMarketCoin, stakeCoinName);
|
|
7646
7659
|
if (stakeMarketCoin) {
|
|
7647
7660
|
const coin = txBlock.withdraw(stakeMarketCoin, stakeCoinName);
|
|
7648
7661
|
await this.utils.mergeSimilarCoins(
|