@scallop-io/sui-scallop-sdk 0.44.3 → 0.44.4
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 +101 -56
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +73 -28
- package/dist/index.mjs.map +1 -1
- package/dist/types/query/portfolio.d.ts +13 -0
- package/package.json +1 -1
- package/src/queries/borrowIncentiveQuery.ts +2 -1
- package/src/queries/coreQuery.ts +3 -2
- package/src/queries/portfolioQuery.ts +59 -5
- package/src/queries/spoolQuery.ts +9 -9
- package/src/types/query/portfolio.ts +16 -0
- package/src/utils/query.ts +3 -3
package/dist/index.js
CHANGED
|
@@ -705,11 +705,11 @@ var ScallopAddress = class {
|
|
|
705
705
|
};
|
|
706
706
|
|
|
707
707
|
// src/models/scallopClient.ts
|
|
708
|
-
var
|
|
708
|
+
var import_utils19 = require("@mysten/sui.js/utils");
|
|
709
709
|
var import_sui_kit9 = require("@scallop-io/sui-kit");
|
|
710
710
|
|
|
711
711
|
// src/models/scallopUtils.ts
|
|
712
|
-
var
|
|
712
|
+
var import_utils9 = require("@mysten/sui.js/utils");
|
|
713
713
|
var import_sui_kit4 = require("@scallop-io/sui-kit");
|
|
714
714
|
var import_pyth_sui_js = require("@pythnetwork/pyth-sui-js");
|
|
715
715
|
|
|
@@ -717,6 +717,7 @@ var import_pyth_sui_js = require("@pythnetwork/pyth-sui-js");
|
|
|
717
717
|
var import_sui_kit3 = require("@scallop-io/sui-kit");
|
|
718
718
|
|
|
719
719
|
// src/queries/coreQuery.ts
|
|
720
|
+
var import_utils2 = require("@mysten/sui.js/utils");
|
|
720
721
|
var import_sui_kit = require("@scallop-io/sui-kit");
|
|
721
722
|
var import_bignumber2 = __toESM(require("bignumber.js"));
|
|
722
723
|
|
|
@@ -734,7 +735,7 @@ var import_bignumber = __toESM(require("bignumber.js"));
|
|
|
734
735
|
var import_utils = require("@mysten/sui.js/utils");
|
|
735
736
|
var parseOriginMarketPoolData = (originMarketPoolData) => {
|
|
736
737
|
return {
|
|
737
|
-
coinType:
|
|
738
|
+
coinType: (0, import_utils.normalizeStructTag)(originMarketPoolData.type.name),
|
|
738
739
|
// Parse origin data required for basic calculations.
|
|
739
740
|
maxBorrowRate: Number(originMarketPoolData.maxBorrowRate.value) / 2 ** 32,
|
|
740
741
|
borrowRate: Number(originMarketPoolData.interestRate.value) / 2 ** 32,
|
|
@@ -828,7 +829,7 @@ var calculateMarketPoolData = (utils, parsedMarketPoolData) => {
|
|
|
828
829
|
};
|
|
829
830
|
var parseOriginMarketCollateralData = (originMarketCollateralData) => {
|
|
830
831
|
return {
|
|
831
|
-
coinType:
|
|
832
|
+
coinType: (0, import_utils.normalizeStructTag)(originMarketCollateralData.type.name),
|
|
832
833
|
collateralFactor: Number(originMarketCollateralData.collateralFactor.value) / 2 ** 32,
|
|
833
834
|
liquidationFactor: Number(originMarketCollateralData.liquidationFactor.value) / 2 ** 32,
|
|
834
835
|
liquidationDiscount: Number(originMarketCollateralData.liquidationDiscount.value) / 2 ** 32,
|
|
@@ -860,7 +861,7 @@ var calculateMarketCollateralData = (utils, parsedMarketCollateralData) => {
|
|
|
860
861
|
};
|
|
861
862
|
var parseOriginSpoolData = (originSpoolData) => {
|
|
862
863
|
return {
|
|
863
|
-
stakeType:
|
|
864
|
+
stakeType: (0, import_utils.normalizeStructTag)(originSpoolData.stakeType.fields.name),
|
|
864
865
|
maxPoint: Number(originSpoolData.maxDistributedPoint),
|
|
865
866
|
distributedPoint: Number(originSpoolData.distributedPoint),
|
|
866
867
|
pointPerPeriod: Number(originSpoolData.distributedPointPerPeriod),
|
|
@@ -1149,7 +1150,7 @@ var queryMarket = async (query) => {
|
|
|
1149
1150
|
const pools = {};
|
|
1150
1151
|
const collaterals = {};
|
|
1151
1152
|
for (const pool of marketData.pools) {
|
|
1152
|
-
const coinType =
|
|
1153
|
+
const coinType = (0, import_utils2.normalizeStructTag)(pool.type.name);
|
|
1153
1154
|
const poolCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
1154
1155
|
const coinPrice = (await query.utils.getCoinPrices([poolCoinName]))?.[poolCoinName] ?? 0;
|
|
1155
1156
|
if (!SUPPORT_POOLS.includes(poolCoinName)) {
|
|
@@ -1197,7 +1198,7 @@ var queryMarket = async (query) => {
|
|
|
1197
1198
|
};
|
|
1198
1199
|
}
|
|
1199
1200
|
for (const collateral of marketData.collaterals) {
|
|
1200
|
-
const coinType =
|
|
1201
|
+
const coinType = (0, import_utils2.normalizeStructTag)(collateral.type.name);
|
|
1201
1202
|
const collateralCoinName = query.utils.parseCoinNameFromType(coinType);
|
|
1202
1203
|
const coinPrice = (await query.utils.getCoinPrices([collateralCoinName]))?.[collateralCoinName] ?? 0;
|
|
1203
1204
|
if (!SUPPORT_COLLATERALS.includes(collateralCoinName)) {
|
|
@@ -1698,7 +1699,7 @@ var getMarketCoinAmount = async (query, marketCoinName, ownerAddress) => {
|
|
|
1698
1699
|
};
|
|
1699
1700
|
|
|
1700
1701
|
// src/queries/spoolQuery.ts
|
|
1701
|
-
var
|
|
1702
|
+
var import_utils4 = require("@mysten/sui.js/utils");
|
|
1702
1703
|
var getSpools = async (query, stakeMarketCoinNames) => {
|
|
1703
1704
|
stakeMarketCoinNames = stakeMarketCoinNames || [...SUPPORT_SPOOLS];
|
|
1704
1705
|
const stakeCoinNames = stakeMarketCoinNames.map(
|
|
@@ -1854,34 +1855,34 @@ var getStakeAccounts = async (query, ownerAddress) => {
|
|
|
1854
1855
|
const index = Number(fields.index);
|
|
1855
1856
|
const points = Number(fields.points);
|
|
1856
1857
|
const totalPoints = Number(fields.total_points);
|
|
1857
|
-
if ((0,
|
|
1858
|
+
if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.ssui) {
|
|
1858
1859
|
stakeAccounts.ssui.push({
|
|
1859
1860
|
id,
|
|
1860
|
-
type,
|
|
1861
|
+
type: (0, import_utils4.normalizeStructTag)(type),
|
|
1861
1862
|
stakePoolId,
|
|
1862
|
-
stakeType,
|
|
1863
|
+
stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
|
|
1863
1864
|
staked,
|
|
1864
1865
|
index,
|
|
1865
1866
|
points,
|
|
1866
1867
|
totalPoints
|
|
1867
1868
|
});
|
|
1868
|
-
} else if ((0,
|
|
1869
|
+
} else if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.susdc) {
|
|
1869
1870
|
stakeAccounts.susdc.push({
|
|
1870
1871
|
id,
|
|
1871
|
-
type,
|
|
1872
|
+
type: (0, import_utils4.normalizeStructTag)(type),
|
|
1872
1873
|
stakePoolId,
|
|
1873
|
-
stakeType,
|
|
1874
|
+
stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
|
|
1874
1875
|
staked,
|
|
1875
1876
|
index,
|
|
1876
1877
|
points,
|
|
1877
1878
|
totalPoints
|
|
1878
1879
|
});
|
|
1879
|
-
} else if ((0,
|
|
1880
|
+
} else if ((0, import_utils4.normalizeStructTag)(type) === stakeMarketCoinTypes.susdt) {
|
|
1880
1881
|
stakeAccounts.susdt.push({
|
|
1881
1882
|
id,
|
|
1882
|
-
type,
|
|
1883
|
+
type: (0, import_utils4.normalizeStructTag)(type),
|
|
1883
1884
|
stakePoolId,
|
|
1884
|
-
stakeType,
|
|
1885
|
+
stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
|
|
1885
1886
|
staked,
|
|
1886
1887
|
index,
|
|
1887
1888
|
points,
|
|
@@ -1920,13 +1921,13 @@ var getStakePool = async (query, marketCoinName) => {
|
|
|
1920
1921
|
const lastUpdate = Number(fields.last_update);
|
|
1921
1922
|
stakePool = {
|
|
1922
1923
|
id,
|
|
1923
|
-
type,
|
|
1924
|
+
type: (0, import_utils4.normalizeStructTag)(type),
|
|
1924
1925
|
maxPoint,
|
|
1925
1926
|
distributedPoint,
|
|
1926
1927
|
pointPerPeriod,
|
|
1927
1928
|
period,
|
|
1928
1929
|
maxStake,
|
|
1929
|
-
stakeType,
|
|
1930
|
+
stakeType: (0, import_utils4.normalizeStructTag)(stakeType),
|
|
1930
1931
|
totalStaked,
|
|
1931
1932
|
index,
|
|
1932
1933
|
createdAt,
|
|
@@ -1961,7 +1962,7 @@ var getStakeRewardPool = async (query, marketCoinName) => {
|
|
|
1961
1962
|
const claimedRewards = Number(fields.claimed_rewards);
|
|
1962
1963
|
stakeRewardPool = {
|
|
1963
1964
|
id,
|
|
1964
|
-
type,
|
|
1965
|
+
type: (0, import_utils4.normalizeStructTag)(type),
|
|
1965
1966
|
stakePoolId,
|
|
1966
1967
|
ratioNumerator,
|
|
1967
1968
|
ratioDenominator,
|
|
@@ -1974,6 +1975,7 @@ var getStakeRewardPool = async (query, marketCoinName) => {
|
|
|
1974
1975
|
};
|
|
1975
1976
|
|
|
1976
1977
|
// src/queries/borrowIncentiveQuery.ts
|
|
1978
|
+
var import_utils6 = require("@mysten/sui.js/utils");
|
|
1977
1979
|
var import_sui_kit2 = require("@scallop-io/sui-kit");
|
|
1978
1980
|
var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames) => {
|
|
1979
1981
|
borrowIncentiveCoinNames = borrowIncentiveCoinNames || [
|
|
@@ -1992,7 +1994,7 @@ var queryBorrowIncentivePools = async (query, borrowIncentiveCoinNames) => {
|
|
|
1992
1994
|
const rewardCoinType = parsedBorrowIncentiveRewardPoolData.rewardType;
|
|
1993
1995
|
const borrowIncentivePools = {};
|
|
1994
1996
|
for (const pool of borrowIncentivePoolsQueryData.incentive_pools) {
|
|
1995
|
-
const coinType =
|
|
1997
|
+
const coinType = (0, import_utils6.normalizeStructTag)(pool.pool_type.name);
|
|
1996
1998
|
const coinName = query.utils.parseCoinNameFromType(coinType);
|
|
1997
1999
|
const rewardCoinName = query.utils.parseCoinNameFromType(rewardCoinType);
|
|
1998
2000
|
if (!borrowIncentiveCoinNames.includes(coinName)) {
|
|
@@ -2190,15 +2192,19 @@ var getLending = async (query, poolCoinName, ownerAddress, marketPool, spool, st
|
|
|
2190
2192
|
availableUnstakeAmount = availableUnstakeAmount.plus(
|
|
2191
2193
|
accountStakedMarketCoinAmount
|
|
2192
2194
|
);
|
|
2193
|
-
availableUnstakeCoin = availableUnstakeAmount.shiftedBy(
|
|
2195
|
+
availableUnstakeCoin = availableUnstakeAmount.shiftedBy(
|
|
2196
|
+
-1 * spool.coinDecimal
|
|
2197
|
+
);
|
|
2194
2198
|
const baseIndexRate = 1e9;
|
|
2195
2199
|
const increasedPointRate = spool?.currentPointIndex ? (0, import_bignumber3.default)(spool.currentPointIndex - stakeAccount.index).dividedBy(
|
|
2196
2200
|
baseIndexRate
|
|
2197
2201
|
) : 1;
|
|
2198
2202
|
availableClaimAmount = availableClaimAmount.plus(
|
|
2199
|
-
|
|
2203
|
+
accountStakedMarketCoinAmount.multipliedBy(increasedPointRate).plus(stakeAccount.points).multipliedBy(spool.exchangeRateNumerator).dividedBy(spool.exchangeRateDenominator)
|
|
2204
|
+
);
|
|
2205
|
+
availableClaimCoin = availableClaimAmount.shiftedBy(
|
|
2206
|
+
-1 * spool.rewardCoinDecimal
|
|
2200
2207
|
);
|
|
2201
|
-
availableClaimCoin = availableClaimAmount.shiftedBy(-1 * coinDecimal);
|
|
2202
2208
|
}
|
|
2203
2209
|
}
|
|
2204
2210
|
const suppliedAmount = (0, import_bignumber3.default)(marketCoinAmount).multipliedBy(
|
|
@@ -2283,10 +2289,13 @@ var getObligationAccount = async (query, obligationId, ownerAddress, market, coi
|
|
|
2283
2289
|
])
|
|
2284
2290
|
];
|
|
2285
2291
|
const obligationQuery = await query.queryObligation(obligationId);
|
|
2292
|
+
const borrowIncentivePools = await query.getBorrowIncentivePools();
|
|
2293
|
+
const borrowIncentiveAccounts = await query.getBorrowIncentiveAccounts(obligationId);
|
|
2286
2294
|
coinPrices = coinPrices || await query.utils.getCoinPrices(assetCoinNames);
|
|
2287
2295
|
coinAmounts = coinAmounts || await query.getCoinAmounts(assetCoinNames, ownerAddress);
|
|
2288
2296
|
const collaterals = {};
|
|
2289
2297
|
const debts = {};
|
|
2298
|
+
const borrowIncentives = {};
|
|
2290
2299
|
let totalDepositedPools = 0;
|
|
2291
2300
|
let totalDepositedValue = (0, import_bignumber3.default)(0);
|
|
2292
2301
|
let totalBorrowCapacityValue = (0, import_bignumber3.default)(0);
|
|
@@ -2388,6 +2397,41 @@ var getObligationAccount = async (query, obligationId, ownerAddress, market, coi
|
|
|
2388
2397
|
};
|
|
2389
2398
|
}
|
|
2390
2399
|
}
|
|
2400
|
+
for (const [poolCoinName, borrowIncentiveAccount] of Object.entries(
|
|
2401
|
+
borrowIncentiveAccounts
|
|
2402
|
+
)) {
|
|
2403
|
+
const coinName = poolCoinName;
|
|
2404
|
+
const borrowIncentivePool = borrowIncentivePools[coinName];
|
|
2405
|
+
let availableClaimAmount = (0, import_bignumber3.default)(0);
|
|
2406
|
+
let availableClaimCoin = (0, import_bignumber3.default)(0);
|
|
2407
|
+
if (borrowIncentivePool) {
|
|
2408
|
+
const accountBorrowedAmount = (0, import_bignumber3.default)(borrowIncentiveAccount.amount);
|
|
2409
|
+
const baseIndexRate = 1e9;
|
|
2410
|
+
const increasedPointRate = borrowIncentivePool.currentPointIndex ? (0, import_bignumber3.default)(
|
|
2411
|
+
borrowIncentivePool.currentPointIndex - borrowIncentiveAccount.index
|
|
2412
|
+
).dividedBy(baseIndexRate) : 1;
|
|
2413
|
+
availableClaimAmount = availableClaimAmount.plus(
|
|
2414
|
+
accountBorrowedAmount.multipliedBy(increasedPointRate).plus(borrowIncentiveAccount.points).multipliedBy(borrowIncentivePool.exchangeRateNumerator).dividedBy(borrowIncentivePool.exchangeRateDenominator)
|
|
2415
|
+
);
|
|
2416
|
+
availableClaimCoin = availableClaimAmount.shiftedBy(
|
|
2417
|
+
-1 * borrowIncentivePool.rewardCoinDecimal
|
|
2418
|
+
);
|
|
2419
|
+
if (availableClaimAmount.isGreaterThan(0)) {
|
|
2420
|
+
borrowIncentives[coinName] = {
|
|
2421
|
+
coinName: borrowIncentivePool.coinName,
|
|
2422
|
+
coinType: borrowIncentivePool.coinType,
|
|
2423
|
+
rewardCoinType: borrowIncentivePool.rewardCoinType,
|
|
2424
|
+
symbol: borrowIncentivePool.symbol,
|
|
2425
|
+
coinDecimal: borrowIncentivePool.coinDecimal,
|
|
2426
|
+
rewardCoinDecimal: borrowIncentivePool.rewardCoinDecimal,
|
|
2427
|
+
coinPrice: borrowIncentivePool.coinPrice,
|
|
2428
|
+
rewardCoinPrice: borrowIncentivePool.rewardCoinPrice,
|
|
2429
|
+
availableClaimAmount: availableClaimAmount.toNumber(),
|
|
2430
|
+
availableClaimCoin: availableClaimCoin.toNumber()
|
|
2431
|
+
};
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2391
2435
|
let riskLevel = totalRequiredCollateralValue.isZero() && totalBorrowedValueWithWeight.isZero() ? (0, import_bignumber3.default)(0) : totalBorrowedValueWithWeight.dividedBy(totalRequiredCollateralValue);
|
|
2392
2436
|
riskLevel = riskLevel.isFinite() ? riskLevel.isLessThan(1) ? riskLevel : (0, import_bignumber3.default)(1) : (0, import_bignumber3.default)(1);
|
|
2393
2437
|
const accountBalanceValue = totalDepositedValue.minus(totalBorrowedValue).isGreaterThan(0) ? totalDepositedValue.minus(totalBorrowedValue) : (0, import_bignumber3.default)(0);
|
|
@@ -2416,7 +2460,8 @@ var getObligationAccount = async (query, obligationId, ownerAddress, market, coi
|
|
|
2416
2460
|
totalDepositedPools,
|
|
2417
2461
|
totalBorrowedPools,
|
|
2418
2462
|
collaterals,
|
|
2419
|
-
debts
|
|
2463
|
+
debts,
|
|
2464
|
+
borrowIncentives
|
|
2420
2465
|
};
|
|
2421
2466
|
for (const [collateralCoinName, obligationCollateral] of Object.entries(
|
|
2422
2467
|
obligationAccount.collaterals
|
|
@@ -2432,10 +2477,10 @@ var getObligationAccount = async (query, obligationId, ownerAddress, market, coi
|
|
|
2432
2477
|
obligationCollateral.availableWithdrawCoin = availableWithdrawAmount.shiftedBy(-1 * obligationCollateral.coinDecimal).toNumber();
|
|
2433
2478
|
}
|
|
2434
2479
|
}
|
|
2435
|
-
for (const [
|
|
2480
|
+
for (const [poolCoinName, obligationDebt] of Object.entries(
|
|
2436
2481
|
obligationAccount.debts
|
|
2437
2482
|
)) {
|
|
2438
|
-
const marketPool = market.pools[
|
|
2483
|
+
const marketPool = market.pools[poolCoinName];
|
|
2439
2484
|
if (marketPool) {
|
|
2440
2485
|
const availableRepayAmount = (0, import_bignumber3.default)(
|
|
2441
2486
|
obligationDebt.availableRepayAmount
|
|
@@ -2890,7 +2935,7 @@ var ScallopUtils = class {
|
|
|
2890
2935
|
throw Error(`Coin ${coinName} is not supported`);
|
|
2891
2936
|
}
|
|
2892
2937
|
if (coinName === "sui")
|
|
2893
|
-
return (0,
|
|
2938
|
+
return (0, import_utils9.normalizeStructTag)(`${coinPackageId}::sui::SUI`);
|
|
2894
2939
|
const wormHolePckageIds = [
|
|
2895
2940
|
this._address.get("core.coins.usdc.id") ?? wormholeCoinIds.usdc,
|
|
2896
2941
|
this._address.get("core.coins.usdt.id") ?? wormholeCoinIds.usdt,
|
|
@@ -2922,7 +2967,7 @@ var ScallopUtils = class {
|
|
|
2922
2967
|
return `${PROTOCOL_OBJECT_ID}::reserve::MarketCoin<${coinType}>`;
|
|
2923
2968
|
}
|
|
2924
2969
|
parseCoinNameFromType(coinType) {
|
|
2925
|
-
coinType = (0,
|
|
2970
|
+
coinType = (0, import_utils9.normalizeStructTag)(coinType);
|
|
2926
2971
|
const coinTypeRegex = new RegExp(`((0x[^:]+::[^:]+::[^<>]+))(?![^<>]*<)`);
|
|
2927
2972
|
const coinTypeMatch = coinType.match(coinTypeRegex);
|
|
2928
2973
|
const isMarketCoinType = coinType.includes("reserve::MarketCoin");
|
|
@@ -2986,7 +3031,7 @@ var ScallopUtils = class {
|
|
|
2986
3031
|
* @param coinType - The coin type, default is 0x2::SUI::SUI.
|
|
2987
3032
|
* @return The selected transaction coin arguments.
|
|
2988
3033
|
*/
|
|
2989
|
-
async selectCoinIds(amount, coinType =
|
|
3034
|
+
async selectCoinIds(amount, coinType = import_utils9.SUI_TYPE_ARG, ownerAddress) {
|
|
2990
3035
|
ownerAddress = ownerAddress || this._suiKit.currentAddress();
|
|
2991
3036
|
const coins = await this._suiKit.suiInteractor.selectCoins(
|
|
2992
3037
|
ownerAddress,
|
|
@@ -3106,16 +3151,16 @@ var ScallopUtils = class {
|
|
|
3106
3151
|
};
|
|
3107
3152
|
|
|
3108
3153
|
// src/models/scallopBuilder.ts
|
|
3109
|
-
var
|
|
3154
|
+
var import_utils18 = require("@mysten/sui.js/utils");
|
|
3110
3155
|
var import_sui_kit8 = require("@scallop-io/sui-kit");
|
|
3111
3156
|
|
|
3112
3157
|
// src/builders/coreBuilder.ts
|
|
3113
3158
|
var import_transactions = require("@mysten/sui.js/transactions");
|
|
3114
|
-
var
|
|
3159
|
+
var import_utils12 = require("@mysten/sui.js/utils");
|
|
3115
3160
|
var import_sui_kit5 = require("@scallop-io/sui-kit");
|
|
3116
3161
|
|
|
3117
3162
|
// src/builders/oracle.ts
|
|
3118
|
-
var
|
|
3163
|
+
var import_utils11 = require("@mysten/sui.js/utils");
|
|
3119
3164
|
var import_pyth_sui_js2 = require("@pythnetwork/pyth-sui-js");
|
|
3120
3165
|
var updateOracles = async (builder, txBlock, assetCoinNames) => {
|
|
3121
3166
|
assetCoinNames = assetCoinNames ?? [
|
|
@@ -3221,27 +3266,27 @@ var priceUpdateRequest = (txBlock, packageId, xOracleId, coinType) => {
|
|
|
3221
3266
|
var confirmPriceUpdateRequest = (txBlock, packageId, xOracleId, request, coinType) => {
|
|
3222
3267
|
const target = `${packageId}::x_oracle::confirm_price_update_request`;
|
|
3223
3268
|
const typeArgs = [coinType];
|
|
3224
|
-
txBlock.moveCall(target, [xOracleId, request,
|
|
3269
|
+
txBlock.moveCall(target, [xOracleId, request, import_utils11.SUI_CLOCK_OBJECT_ID], typeArgs);
|
|
3225
3270
|
return txBlock;
|
|
3226
3271
|
};
|
|
3227
3272
|
var updateSupraPrice = (txBlock, packageId, request, holderId, registryId, coinType) => {
|
|
3228
3273
|
txBlock.moveCall(
|
|
3229
3274
|
`${packageId}::rule::set_price`,
|
|
3230
|
-
[request, holderId, registryId,
|
|
3275
|
+
[request, holderId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
|
|
3231
3276
|
[coinType]
|
|
3232
3277
|
);
|
|
3233
3278
|
};
|
|
3234
3279
|
var updateSwitchboardPrice = (txBlock, packageId, request, aggregatorId, registryId, coinType) => {
|
|
3235
3280
|
txBlock.moveCall(
|
|
3236
3281
|
`${packageId}::rule::set_price`,
|
|
3237
|
-
[request, aggregatorId, registryId,
|
|
3282
|
+
[request, aggregatorId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
|
|
3238
3283
|
[coinType]
|
|
3239
3284
|
);
|
|
3240
3285
|
};
|
|
3241
3286
|
var updatePythPrice = (txBlock, packageId, request, stateId, feedObjectId, registryId, coinType) => {
|
|
3242
3287
|
txBlock.moveCall(
|
|
3243
3288
|
`${packageId}::rule::set_price`,
|
|
3244
|
-
[request, stateId, feedObjectId, registryId,
|
|
3289
|
+
[request, stateId, feedObjectId, registryId, import_utils11.SUI_CLOCK_OBJECT_ID],
|
|
3245
3290
|
[coinType]
|
|
3246
3291
|
);
|
|
3247
3292
|
};
|
|
@@ -3307,7 +3352,7 @@ var generateCoreNormalMethod = ({
|
|
|
3307
3352
|
coreIds.coinDecimalsRegistry,
|
|
3308
3353
|
amount,
|
|
3309
3354
|
coreIds.xOracle,
|
|
3310
|
-
|
|
3355
|
+
import_utils12.SUI_CLOCK_OBJECT_ID
|
|
3311
3356
|
],
|
|
3312
3357
|
[coinType]
|
|
3313
3358
|
);
|
|
@@ -3316,7 +3361,7 @@ var generateCoreNormalMethod = ({
|
|
|
3316
3361
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
3317
3362
|
return txBlock.moveCall(
|
|
3318
3363
|
`${coreIds.protocolPkg}::mint::mint`,
|
|
3319
|
-
[coreIds.version, coreIds.market, coin,
|
|
3364
|
+
[coreIds.version, coreIds.market, coin, import_utils12.SUI_CLOCK_OBJECT_ID],
|
|
3320
3365
|
[coinType]
|
|
3321
3366
|
);
|
|
3322
3367
|
},
|
|
@@ -3324,7 +3369,7 @@ var generateCoreNormalMethod = ({
|
|
|
3324
3369
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
3325
3370
|
return txBlock.moveCall(
|
|
3326
3371
|
`${coreIds.protocolPkg}::mint::mint_entry`,
|
|
3327
|
-
[coreIds.version, coreIds.market, coin,
|
|
3372
|
+
[coreIds.version, coreIds.market, coin, import_utils12.SUI_CLOCK_OBJECT_ID],
|
|
3328
3373
|
[coinType]
|
|
3329
3374
|
);
|
|
3330
3375
|
},
|
|
@@ -3332,7 +3377,7 @@ var generateCoreNormalMethod = ({
|
|
|
3332
3377
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
3333
3378
|
return txBlock.moveCall(
|
|
3334
3379
|
`${coreIds.protocolPkg}::redeem::redeem`,
|
|
3335
|
-
[coreIds.version, coreIds.market, marketCoin,
|
|
3380
|
+
[coreIds.version, coreIds.market, marketCoin, import_utils12.SUI_CLOCK_OBJECT_ID],
|
|
3336
3381
|
[coinType]
|
|
3337
3382
|
);
|
|
3338
3383
|
},
|
|
@@ -3340,7 +3385,7 @@ var generateCoreNormalMethod = ({
|
|
|
3340
3385
|
const coinType = builder.utils.parseCoinType(poolCoinName);
|
|
3341
3386
|
return txBlock.moveCall(
|
|
3342
3387
|
`${coreIds.protocolPkg}::redeem::redeem_entry`,
|
|
3343
|
-
[coreIds.version, coreIds.market, marketCoin,
|
|
3388
|
+
[coreIds.version, coreIds.market, marketCoin, import_utils12.SUI_CLOCK_OBJECT_ID],
|
|
3344
3389
|
[coinType]
|
|
3345
3390
|
);
|
|
3346
3391
|
},
|
|
@@ -3356,7 +3401,7 @@ var generateCoreNormalMethod = ({
|
|
|
3356
3401
|
coreIds.coinDecimalsRegistry,
|
|
3357
3402
|
amount,
|
|
3358
3403
|
coreIds.xOracle,
|
|
3359
|
-
|
|
3404
|
+
import_utils12.SUI_CLOCK_OBJECT_ID
|
|
3360
3405
|
],
|
|
3361
3406
|
[coinType]
|
|
3362
3407
|
);
|
|
@@ -3373,7 +3418,7 @@ var generateCoreNormalMethod = ({
|
|
|
3373
3418
|
coreIds.coinDecimalsRegistry,
|
|
3374
3419
|
amount,
|
|
3375
3420
|
coreIds.xOracle,
|
|
3376
|
-
|
|
3421
|
+
import_utils12.SUI_CLOCK_OBJECT_ID
|
|
3377
3422
|
],
|
|
3378
3423
|
[coinType]
|
|
3379
3424
|
);
|
|
@@ -3387,7 +3432,7 @@ var generateCoreNormalMethod = ({
|
|
|
3387
3432
|
obligation,
|
|
3388
3433
|
coreIds.market,
|
|
3389
3434
|
coin,
|
|
3390
|
-
|
|
3435
|
+
import_utils12.SUI_CLOCK_OBJECT_ID
|
|
3391
3436
|
],
|
|
3392
3437
|
[coinType]
|
|
3393
3438
|
);
|
|
@@ -3565,7 +3610,7 @@ var newCoreTxBlock = (builder, initTxBlock) => {
|
|
|
3565
3610
|
|
|
3566
3611
|
// src/builders/spoolBuilder.ts
|
|
3567
3612
|
var import_transactions2 = require("@mysten/sui.js/transactions");
|
|
3568
|
-
var
|
|
3613
|
+
var import_utils14 = require("@mysten/sui.js/utils");
|
|
3569
3614
|
var import_sui_kit6 = require("@scallop-io/sui-kit");
|
|
3570
3615
|
var requireStakeAccountIds = async (...params) => {
|
|
3571
3616
|
const [builder, txBlock, stakeMarketCoinName, stakeAccountId] = params;
|
|
@@ -3605,7 +3650,7 @@ var generateSpoolNormalMethod = ({
|
|
|
3605
3650
|
);
|
|
3606
3651
|
return txBlock.moveCall(
|
|
3607
3652
|
`${spoolIds.spoolPkg}::user::new_spool_account`,
|
|
3608
|
-
[stakePoolId,
|
|
3653
|
+
[stakePoolId, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
3609
3654
|
[marketCoinType]
|
|
3610
3655
|
);
|
|
3611
3656
|
},
|
|
@@ -3616,7 +3661,7 @@ var generateSpoolNormalMethod = ({
|
|
|
3616
3661
|
);
|
|
3617
3662
|
txBlock.moveCall(
|
|
3618
3663
|
`${spoolIds.spoolPkg}::user::stake`,
|
|
3619
|
-
[stakePoolId, stakeAccount, coin,
|
|
3664
|
+
[stakePoolId, stakeAccount, coin, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
3620
3665
|
[marketCoinType]
|
|
3621
3666
|
);
|
|
3622
3667
|
},
|
|
@@ -3627,7 +3672,7 @@ var generateSpoolNormalMethod = ({
|
|
|
3627
3672
|
);
|
|
3628
3673
|
return txBlock.moveCall(
|
|
3629
3674
|
`${spoolIds.spoolPkg}::user::unstake`,
|
|
3630
|
-
[stakePoolId, stakeAccount, amount,
|
|
3675
|
+
[stakePoolId, stakeAccount, amount, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
3631
3676
|
[marketCoinType]
|
|
3632
3677
|
);
|
|
3633
3678
|
},
|
|
@@ -3643,7 +3688,7 @@ var generateSpoolNormalMethod = ({
|
|
|
3643
3688
|
const rewardCoinType = builder.utils.parseCoinType(rewardCoinName);
|
|
3644
3689
|
return txBlock.moveCall(
|
|
3645
3690
|
`${spoolIds.spoolPkg}::user::redeem_rewards`,
|
|
3646
|
-
[stakePoolId, rewardPoolId, stakeAccount,
|
|
3691
|
+
[stakePoolId, rewardPoolId, stakeAccount, import_utils14.SUI_CLOCK_OBJECT_ID],
|
|
3647
3692
|
[marketCoinType, rewardCoinType]
|
|
3648
3693
|
);
|
|
3649
3694
|
}
|
|
@@ -3753,7 +3798,7 @@ var newSpoolTxBlock = (builder, initTxBlock) => {
|
|
|
3753
3798
|
|
|
3754
3799
|
// src/builders/borrowIncentiveBuilder.ts
|
|
3755
3800
|
var import_transactions3 = require("@mysten/sui.js/transactions");
|
|
3756
|
-
var
|
|
3801
|
+
var import_utils16 = require("@mysten/sui.js/utils");
|
|
3757
3802
|
var import_sui_kit7 = require("@scallop-io/sui-kit");
|
|
3758
3803
|
var requireObligationInfo2 = async (...params) => {
|
|
3759
3804
|
const [builder, txBlock, obligationId, obligationKey] = params;
|
|
@@ -3797,7 +3842,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
3797
3842
|
obligaionKey,
|
|
3798
3843
|
obligationId,
|
|
3799
3844
|
borrowIncentiveIds.obligationAccessStore,
|
|
3800
|
-
|
|
3845
|
+
import_utils16.SUI_CLOCK_OBJECT_ID
|
|
3801
3846
|
],
|
|
3802
3847
|
[rewardType]
|
|
3803
3848
|
);
|
|
@@ -3812,7 +3857,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
3812
3857
|
borrowIncentiveIds.incentiveAccounts,
|
|
3813
3858
|
obligaionKey,
|
|
3814
3859
|
obligationId,
|
|
3815
|
-
|
|
3860
|
+
import_utils16.SUI_CLOCK_OBJECT_ID
|
|
3816
3861
|
],
|
|
3817
3862
|
[rewardType]
|
|
3818
3863
|
);
|
|
@@ -3827,7 +3872,7 @@ var generateBorrowIncentiveNormalMethod = ({ builder, txBlock }) => {
|
|
|
3827
3872
|
borrowIncentiveIds.incentiveAccounts,
|
|
3828
3873
|
obligaionKey,
|
|
3829
3874
|
obligationId,
|
|
3830
|
-
|
|
3875
|
+
import_utils16.SUI_CLOCK_OBJECT_ID
|
|
3831
3876
|
],
|
|
3832
3877
|
[rewardType]
|
|
3833
3878
|
);
|
|
@@ -3953,7 +3998,7 @@ var ScallopBuilder = class {
|
|
|
3953
3998
|
address: this.address,
|
|
3954
3999
|
query: this.query
|
|
3955
4000
|
});
|
|
3956
|
-
this.walletAddress = (0,
|
|
4001
|
+
this.walletAddress = (0, import_utils18.normalizeSuiAddress)(
|
|
3957
4002
|
params?.walletAddress || this.suiKit.currentAddress()
|
|
3958
4003
|
);
|
|
3959
4004
|
this.isTestnet = params.networkType ? params.networkType === "testnet" : false;
|
|
@@ -4049,7 +4094,7 @@ var ScallopClient = class {
|
|
|
4049
4094
|
query: this.query,
|
|
4050
4095
|
utils: this.utils
|
|
4051
4096
|
});
|
|
4052
|
-
this.walletAddress = (0,
|
|
4097
|
+
this.walletAddress = (0, import_utils19.normalizeSuiAddress)(
|
|
4053
4098
|
params?.walletAddress || this.suiKit.currentAddress()
|
|
4054
4099
|
);
|
|
4055
4100
|
}
|