@msafe/sui3-sdk 0.0.53-pre-caa8db0.0 → 0.0.53-pre-b691ff1.0
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.cjs +1211 -514
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +979 -282
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -9245,6 +9245,7 @@ function v4(options, buf, offset2) {
|
|
|
9245
9245
|
var v4_default = v4;
|
|
9246
9246
|
|
|
9247
9247
|
// node_modules/@cetusprotocol/cetus-sui-clmm-sdk/dist/index.mjs
|
|
9248
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
9248
9249
|
var import_utils6 = require("@mysten/sui.js/utils");
|
|
9249
9250
|
var import_transactions10 = require("@mysten/sui.js/transactions");
|
|
9250
9251
|
var import_client = require("@mysten/sui.js/client");
|
|
@@ -13655,6 +13656,23 @@ var PositionModule = class {
|
|
|
13655
13656
|
});
|
|
13656
13657
|
return tx;
|
|
13657
13658
|
}
|
|
13659
|
+
createCollectFeeNoSendPaylod(params, published_at, tx, primaryCoinAInput, primaryCoinBInput) {
|
|
13660
|
+
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
13661
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
13662
|
+
const args = [
|
|
13663
|
+
tx.object(getPackagerConfigs(clmm_pool).global_config_id),
|
|
13664
|
+
tx.object(params.pool_id),
|
|
13665
|
+
tx.object(params.pos_id),
|
|
13666
|
+
primaryCoinAInput,
|
|
13667
|
+
primaryCoinBInput
|
|
13668
|
+
];
|
|
13669
|
+
tx.moveCall({
|
|
13670
|
+
target: `${published_at}::${ClmmIntegratePoolModule}::collect_fee`,
|
|
13671
|
+
typeArguments,
|
|
13672
|
+
arguments: args
|
|
13673
|
+
});
|
|
13674
|
+
return tx;
|
|
13675
|
+
}
|
|
13658
13676
|
/**
|
|
13659
13677
|
* calculate fee
|
|
13660
13678
|
* @param {CollectFeeParams} params
|
|
@@ -14119,6 +14137,71 @@ var RewarderModule = class {
|
|
|
14119
14137
|
tx = TransactionUtil.createCollectRewarderAndFeeParams(this._sdk, tx, params, allCoinAsset);
|
|
14120
14138
|
return tx;
|
|
14121
14139
|
}
|
|
14140
|
+
/**
|
|
14141
|
+
* batech Collect rewards from Position.
|
|
14142
|
+
* @param params
|
|
14143
|
+
* @param published_at
|
|
14144
|
+
* @param tx
|
|
14145
|
+
* @returns
|
|
14146
|
+
*/
|
|
14147
|
+
async batchCollectRewardePayload(params, published_at, tx) {
|
|
14148
|
+
if (!checkInvalidSuiAddress(this._sdk.senderAddress)) {
|
|
14149
|
+
throw new ClmmpoolsError(
|
|
14150
|
+
"this config sdk senderAddress is not set right",
|
|
14151
|
+
"InvalidSendAddress"
|
|
14152
|
+
/* InvalidSendAddress */
|
|
14153
|
+
);
|
|
14154
|
+
}
|
|
14155
|
+
const allCoinAsset = await this._sdk.getOwnerCoinAssets(this._sdk.senderAddress, null);
|
|
14156
|
+
tx = tx || new import_transactions6.TransactionBlock();
|
|
14157
|
+
const coinIdMaps = {};
|
|
14158
|
+
params.forEach((item) => {
|
|
14159
|
+
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
14160
|
+
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
14161
|
+
if (item.collect_fee) {
|
|
14162
|
+
let coinAInput = coinIdMaps[coinTypeA];
|
|
14163
|
+
if (coinAInput === void 0) {
|
|
14164
|
+
coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false);
|
|
14165
|
+
coinIdMaps[coinTypeA] = coinAInput;
|
|
14166
|
+
}
|
|
14167
|
+
let coinBInput = coinIdMaps[coinTypeB];
|
|
14168
|
+
if (coinBInput === void 0) {
|
|
14169
|
+
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false);
|
|
14170
|
+
coinIdMaps[coinTypeB] = coinBInput;
|
|
14171
|
+
}
|
|
14172
|
+
tx = this._sdk.Position.createCollectFeeNoSendPaylod(
|
|
14173
|
+
{
|
|
14174
|
+
pool_id: item.pool_id,
|
|
14175
|
+
pos_id: item.pos_id,
|
|
14176
|
+
coinTypeA: item.coinTypeA,
|
|
14177
|
+
coinTypeB: item.coinTypeB
|
|
14178
|
+
},
|
|
14179
|
+
published_at,
|
|
14180
|
+
tx,
|
|
14181
|
+
coinAInput.targetCoin,
|
|
14182
|
+
coinBInput.targetCoin
|
|
14183
|
+
);
|
|
14184
|
+
}
|
|
14185
|
+
const primaryCoinInputs = [];
|
|
14186
|
+
item.rewarder_coin_types.forEach((type) => {
|
|
14187
|
+
const coinType = normalizeCoinType(type);
|
|
14188
|
+
let coinInput = coinIdMaps[type];
|
|
14189
|
+
if (coinInput === void 0) {
|
|
14190
|
+
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false);
|
|
14191
|
+
coinIdMaps[coinType] = coinInput;
|
|
14192
|
+
}
|
|
14193
|
+
primaryCoinInputs.push(coinInput.targetCoin);
|
|
14194
|
+
});
|
|
14195
|
+
tx = this.createCollectRewarderNoSendPaylod(item, published_at, tx, primaryCoinInputs);
|
|
14196
|
+
});
|
|
14197
|
+
Object.keys(coinIdMaps).forEach((key) => {
|
|
14198
|
+
const value = coinIdMaps[key];
|
|
14199
|
+
if (value.isMintZeroCoin) {
|
|
14200
|
+
TransactionUtil.buildTransferCoin(this._sdk, tx, value.targetCoin, key, this._sdk.senderAddress);
|
|
14201
|
+
}
|
|
14202
|
+
});
|
|
14203
|
+
return tx;
|
|
14204
|
+
}
|
|
14122
14205
|
createCollectRewarderPaylod(params, tx, primaryCoinInputs) {
|
|
14123
14206
|
const { clmm_pool, integrate } = this.sdk.sdkOptions;
|
|
14124
14207
|
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
@@ -14141,6 +14224,28 @@ var RewarderModule = class {
|
|
|
14141
14224
|
});
|
|
14142
14225
|
return tx;
|
|
14143
14226
|
}
|
|
14227
|
+
createCollectRewarderNoSendPaylod(params, published_at, tx, primaryCoinInputs) {
|
|
14228
|
+
const { clmm_pool } = this.sdk.sdkOptions;
|
|
14229
|
+
const clmmConfigs = getPackagerConfigs(clmm_pool);
|
|
14230
|
+
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
14231
|
+
params.rewarder_coin_types.forEach((type, index) => {
|
|
14232
|
+
if (tx) {
|
|
14233
|
+
tx.moveCall({
|
|
14234
|
+
target: `${published_at}::${ClmmIntegratePoolModule}::collect_reward`,
|
|
14235
|
+
typeArguments: [...typeArguments, type],
|
|
14236
|
+
arguments: [
|
|
14237
|
+
tx.object(clmmConfigs.global_config_id),
|
|
14238
|
+
tx.object(params.pool_id),
|
|
14239
|
+
tx.object(params.pos_id),
|
|
14240
|
+
tx.object(clmmConfigs.global_vault_id),
|
|
14241
|
+
primaryCoinInputs[index],
|
|
14242
|
+
tx.object(CLOCK_ADDRESS)
|
|
14243
|
+
]
|
|
14244
|
+
});
|
|
14245
|
+
}
|
|
14246
|
+
});
|
|
14247
|
+
return tx;
|
|
14248
|
+
}
|
|
14144
14249
|
};
|
|
14145
14250
|
function _pairSymbol(base, quote) {
|
|
14146
14251
|
return {
|
|
@@ -14562,6 +14667,46 @@ var RouterModule = class {
|
|
|
14562
14667
|
};
|
|
14563
14668
|
return result;
|
|
14564
14669
|
}
|
|
14670
|
+
async priceUseV1(from, to2, _amount, byAmountIn, priceSlippagePoint, partner, swapWithMultiPoolParams) {
|
|
14671
|
+
if (swapWithMultiPoolParams != null) {
|
|
14672
|
+
const preSwapResult = await this.sdk.Swap.preSwapWithMultiPool(swapWithMultiPoolParams);
|
|
14673
|
+
const onePath = {
|
|
14674
|
+
amountIn: new import_bn17.default(preSwapResult.estimatedAmountIn),
|
|
14675
|
+
amountOut: new import_bn17.default(preSwapResult.estimatedAmountOut),
|
|
14676
|
+
poolAddress: [preSwapResult.poolAddress],
|
|
14677
|
+
a2b: [preSwapResult.aToB],
|
|
14678
|
+
rawAmountLimit: byAmountIn ? [preSwapResult.estimatedAmountOut] : [preSwapResult.estimatedAmountIn],
|
|
14679
|
+
isExceed: preSwapResult.isExceed,
|
|
14680
|
+
coinType: [from, to2]
|
|
14681
|
+
};
|
|
14682
|
+
const swapWithRouterParams = {
|
|
14683
|
+
paths: [onePath],
|
|
14684
|
+
partner,
|
|
14685
|
+
priceSlippagePoint
|
|
14686
|
+
};
|
|
14687
|
+
const result = {
|
|
14688
|
+
amountIn: new import_bn17.default(preSwapResult.estimatedAmountIn),
|
|
14689
|
+
amountOut: new import_bn17.default(preSwapResult.estimatedAmountOut),
|
|
14690
|
+
paths: [onePath],
|
|
14691
|
+
a2b: preSwapResult.aToB,
|
|
14692
|
+
b2c: void 0,
|
|
14693
|
+
byAmountIn,
|
|
14694
|
+
isExceed: preSwapResult.isExceed,
|
|
14695
|
+
targetSqrtPrice: [preSwapResult.estimatedEndSqrtPrice],
|
|
14696
|
+
currentSqrtPrice: [preSwapResult.estimatedStartSqrtPrice],
|
|
14697
|
+
coinTypeA: from,
|
|
14698
|
+
coinTypeB: to2,
|
|
14699
|
+
coinTypeC: void 0,
|
|
14700
|
+
createTxParams: swapWithRouterParams
|
|
14701
|
+
};
|
|
14702
|
+
return result;
|
|
14703
|
+
}
|
|
14704
|
+
throw new ClmmpoolsError(
|
|
14705
|
+
"No parameters available for service downgrade",
|
|
14706
|
+
"NoDowngradeNeedParams"
|
|
14707
|
+
/* NoDowngradeNeedParams */
|
|
14708
|
+
);
|
|
14709
|
+
}
|
|
14565
14710
|
async preRouterSwapA2B2C(params) {
|
|
14566
14711
|
if (params.length === 0) {
|
|
14567
14712
|
return null;
|
|
@@ -14910,13 +15055,14 @@ var SwapModule = class {
|
|
|
14910
15055
|
}
|
|
14911
15056
|
transformSwapWithMultiPoolData(params, jsonData) {
|
|
14912
15057
|
const { data } = jsonData;
|
|
15058
|
+
console.log("json data. ", data);
|
|
14913
15059
|
const estimatedAmountIn = data.amount_in && data.fee_amount ? new import_bn18.default(data.amount_in).add(new import_bn18.default(data.fee_amount)).toString() : "";
|
|
14914
15060
|
return {
|
|
14915
15061
|
poolAddress: params.poolAddress,
|
|
14916
15062
|
estimatedAmountIn,
|
|
14917
15063
|
estimatedAmountOut: data.amount_out,
|
|
14918
15064
|
estimatedEndSqrtPrice: data.after_sqrt_price,
|
|
14919
|
-
estimatedStartSqrtPrice:
|
|
15065
|
+
estimatedStartSqrtPrice: data.step_results[0].current_sqrt_price,
|
|
14920
15066
|
estimatedFeeAmount: data.fee_amount,
|
|
14921
15067
|
isExceed: data.is_exceed,
|
|
14922
15068
|
amount: params.amount,
|
|
@@ -15393,11 +15539,9 @@ var RouterModuleV2 = class {
|
|
|
15393
15539
|
const decimalA = a2b ? fromDecimals : toDecimals;
|
|
15394
15540
|
const decimalB = a2b ? toDecimals : fromDecimals;
|
|
15395
15541
|
if (label === "Cetus") {
|
|
15396
|
-
|
|
15397
|
-
return price2;
|
|
15542
|
+
return TickMath.sqrtPriceX64ToPrice(currentSqrtPrice, decimalA, decimalB);
|
|
15398
15543
|
}
|
|
15399
|
-
|
|
15400
|
-
return price;
|
|
15544
|
+
return new decimal_default(currentSqrtPrice.toString()).div(new decimal_default(10).pow(new decimal_default(decimalB + 9 - decimalA)));
|
|
15401
15545
|
}
|
|
15402
15546
|
parseJsonResult(data) {
|
|
15403
15547
|
const result = {
|
|
@@ -15444,29 +15588,20 @@ var RouterModuleV2 = class {
|
|
|
15444
15588
|
};
|
|
15445
15589
|
return result;
|
|
15446
15590
|
}
|
|
15447
|
-
async
|
|
15448
|
-
const controller = new AbortController();
|
|
15449
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
15591
|
+
async fetchDataWithAxios(apiUrl, _options, timeoutDuration) {
|
|
15450
15592
|
try {
|
|
15451
|
-
const
|
|
15593
|
+
const config2 = {
|
|
15452
15594
|
..._options,
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
} catch (err) {
|
|
15458
|
-
return null;
|
|
15459
|
-
}
|
|
15460
|
-
}
|
|
15461
|
-
async fetchAndParseData(apiUrl, _options) {
|
|
15462
|
-
try {
|
|
15463
|
-
const timeoutDuration = 1500;
|
|
15464
|
-
const response = await this.fetchWithTimeout(apiUrl, _options, timeoutDuration);
|
|
15595
|
+
timeout: timeoutDuration
|
|
15596
|
+
// 设置超时时间
|
|
15597
|
+
};
|
|
15598
|
+
const response = await (0, import_axios.default)(apiUrl, config2);
|
|
15465
15599
|
if (response.status === 200) {
|
|
15466
|
-
return this.parseJsonResult(
|
|
15600
|
+
return this.parseJsonResult(response.data);
|
|
15467
15601
|
}
|
|
15468
15602
|
return null;
|
|
15469
15603
|
} catch (error) {
|
|
15604
|
+
console.error(error);
|
|
15470
15605
|
return null;
|
|
15471
15606
|
}
|
|
15472
15607
|
}
|
|
@@ -15516,9 +15651,9 @@ var RouterModuleV2 = class {
|
|
|
15516
15651
|
)}&sender_address=''&request_id=${encodeURIComponent(v4_default())}
|
|
15517
15652
|
`;
|
|
15518
15653
|
}
|
|
15519
|
-
result = await this.
|
|
15520
|
-
if (result
|
|
15521
|
-
const priceResult = await this.sdk.Router.
|
|
15654
|
+
result = await this.fetchDataWithAxios(apiUrl, { method: "get" }, 6e3);
|
|
15655
|
+
if (result == null) {
|
|
15656
|
+
const priceResult = await this.sdk.Router.priceUseV1(
|
|
15522
15657
|
from,
|
|
15523
15658
|
to2,
|
|
15524
15659
|
new import_bn19.default(amount),
|
|
@@ -15611,6 +15746,122 @@ var RouterModuleV2 = class {
|
|
|
15611
15746
|
}
|
|
15612
15747
|
return { result, version: version2 };
|
|
15613
15748
|
}
|
|
15749
|
+
async getBestRouterByServer(from, to2, amount, byAmountIn, _senderAddress, orderSplit = false, externalRouter = false, lpChanges = []) {
|
|
15750
|
+
let result = null;
|
|
15751
|
+
let apiUrl = this.sdk.sdkOptions.aggregatorUrl;
|
|
15752
|
+
if (lpChanges.length > 0) {
|
|
15753
|
+
const url = new URL(apiUrl);
|
|
15754
|
+
apiUrl = `${url.protocol}//${url.hostname}/router_with_lp_changes`;
|
|
15755
|
+
} else {
|
|
15756
|
+
apiUrl = `
|
|
15757
|
+
${apiUrl}?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to2)}&amount=${encodeURIComponent(
|
|
15758
|
+
amount
|
|
15759
|
+
)}&by_amount_in=${encodeURIComponent(byAmountIn)}&order_split=${encodeURIComponent(orderSplit)}&external_router=${encodeURIComponent(
|
|
15760
|
+
externalRouter
|
|
15761
|
+
)}&sender_address=''&request_id=${encodeURIComponent(v4_default())}
|
|
15762
|
+
`;
|
|
15763
|
+
}
|
|
15764
|
+
result = await this.fetchDataWithAxios(apiUrl, { method: "get" }, 6e3);
|
|
15765
|
+
if (result == null) {
|
|
15766
|
+
throw new ClmmpoolsError(
|
|
15767
|
+
"Invalid server response",
|
|
15768
|
+
"InvalidServerResponse"
|
|
15769
|
+
/* InvalidServerResponse */
|
|
15770
|
+
);
|
|
15771
|
+
}
|
|
15772
|
+
return result;
|
|
15773
|
+
}
|
|
15774
|
+
async getBestRouterByRpc(from, to2, amount, byAmountIn, priceSplitPoint, partner, swapWithMultiPoolParams) {
|
|
15775
|
+
const priceResult = await this.sdk.Router.priceUseV1(
|
|
15776
|
+
from,
|
|
15777
|
+
to2,
|
|
15778
|
+
new import_bn19.default(amount),
|
|
15779
|
+
byAmountIn,
|
|
15780
|
+
priceSplitPoint,
|
|
15781
|
+
partner,
|
|
15782
|
+
swapWithMultiPoolParams
|
|
15783
|
+
);
|
|
15784
|
+
const splitPaths = [];
|
|
15785
|
+
for (const path of priceResult.paths) {
|
|
15786
|
+
const basePaths = [];
|
|
15787
|
+
if (path.poolAddress.length > 1) {
|
|
15788
|
+
const fromDecimal0 = this.sdk.Router.tokenInfo(path.coinType[0]).decimals;
|
|
15789
|
+
const toDecimal0 = this.sdk.Router.tokenInfo(path.coinType[1]).decimals;
|
|
15790
|
+
const currentPrice = path.a2b[0] ? TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[0]), fromDecimal0, toDecimal0) : TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[0]), toDecimal0, fromDecimal0);
|
|
15791
|
+
const path0 = {
|
|
15792
|
+
direction: path.a2b[0],
|
|
15793
|
+
label: "Cetus",
|
|
15794
|
+
poolAddress: path.poolAddress[0],
|
|
15795
|
+
fromCoin: path.coinType[0],
|
|
15796
|
+
toCoin: path.coinType[1],
|
|
15797
|
+
feeRate: this.sdk.Router.getFeeRate(path.coinType[0], path.coinType[1], path.poolAddress[0]),
|
|
15798
|
+
outputAmount: priceResult.byAmountIn ? path.rawAmountLimit[0].toString() : path.rawAmountLimit[1].toString(),
|
|
15799
|
+
inputAmount: path.amountIn.toString(),
|
|
15800
|
+
currentSqrtPrice: priceResult.currentSqrtPrice[0],
|
|
15801
|
+
currentPrice,
|
|
15802
|
+
fromDecimal: fromDecimal0,
|
|
15803
|
+
toDecimal: toDecimal0
|
|
15804
|
+
};
|
|
15805
|
+
const fromDecimal1 = this.sdk.Router.tokenInfo(path.coinType[1]).decimals;
|
|
15806
|
+
const toDecimal1 = this.sdk.Router.tokenInfo(path.coinType[2]).decimals;
|
|
15807
|
+
const currentPrice1 = path.a2b[1] ? TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[1]), fromDecimal1, toDecimal1) : TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[1]), toDecimal1, fromDecimal1);
|
|
15808
|
+
const path1 = {
|
|
15809
|
+
direction: path.a2b[1],
|
|
15810
|
+
label: "Cetus",
|
|
15811
|
+
poolAddress: path.poolAddress[1],
|
|
15812
|
+
fromCoin: path.coinType[1],
|
|
15813
|
+
toCoin: path.coinType[2],
|
|
15814
|
+
feeRate: this.sdk.Router.getFeeRate(path.coinType[1], path.coinType[2], path.poolAddress[1]),
|
|
15815
|
+
outputAmount: path.amountOut.toString(),
|
|
15816
|
+
inputAmount: priceResult.byAmountIn ? path.rawAmountLimit[0].toString() : path.rawAmountLimit[1].toString(),
|
|
15817
|
+
currentSqrtPrice: priceResult.currentSqrtPrice[1],
|
|
15818
|
+
currentPrice: currentPrice1,
|
|
15819
|
+
fromDecimal: fromDecimal1,
|
|
15820
|
+
toDecimal: toDecimal1
|
|
15821
|
+
};
|
|
15822
|
+
basePaths.push(path0, path1);
|
|
15823
|
+
} else {
|
|
15824
|
+
const fromDecimal = this.sdk.Router.tokenInfo(path.coinType[0]).decimals;
|
|
15825
|
+
const toDecimal = this.sdk.Router.tokenInfo(path.coinType[1]).decimals;
|
|
15826
|
+
const currentPrice = path.a2b[0] ? TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[0]), fromDecimal, toDecimal) : TickMath.sqrtPriceX64ToPrice(new import_bn19.default(priceResult.currentSqrtPrice[0]), toDecimal, fromDecimal);
|
|
15827
|
+
const path0 = {
|
|
15828
|
+
direction: path.a2b[0],
|
|
15829
|
+
label: "Cetus",
|
|
15830
|
+
poolAddress: path.poolAddress[0],
|
|
15831
|
+
fromCoin: path.coinType[0],
|
|
15832
|
+
toCoin: path.coinType[1],
|
|
15833
|
+
feeRate: this.sdk.Router.getFeeRate(path.coinType[0], path.coinType[1], path.poolAddress[0]),
|
|
15834
|
+
outputAmount: path.amountOut.toString(),
|
|
15835
|
+
inputAmount: path.amountIn.toString(),
|
|
15836
|
+
currentSqrtPrice: priceResult.currentSqrtPrice[0],
|
|
15837
|
+
currentPrice,
|
|
15838
|
+
fromDecimal,
|
|
15839
|
+
toDecimal
|
|
15840
|
+
};
|
|
15841
|
+
basePaths.push(path0);
|
|
15842
|
+
}
|
|
15843
|
+
const splitPath = {
|
|
15844
|
+
percent: Number(path.amountIn) / Number(priceResult.amountIn) * 100,
|
|
15845
|
+
inputAmount: Number(path.amountIn.toString()),
|
|
15846
|
+
outputAmount: Number(path.amountOut.toString()),
|
|
15847
|
+
pathIndex: 0,
|
|
15848
|
+
lastQuoteOutput: 0,
|
|
15849
|
+
basePaths
|
|
15850
|
+
};
|
|
15851
|
+
splitPaths.push(splitPath);
|
|
15852
|
+
}
|
|
15853
|
+
const aggregatorResult = {
|
|
15854
|
+
isExceed: priceResult.isExceed,
|
|
15855
|
+
isTimeout: true,
|
|
15856
|
+
inputAmount: Number(priceResult.amountIn.toString()),
|
|
15857
|
+
outputAmount: Number(priceResult.amountOut.toString()),
|
|
15858
|
+
fromCoin: priceResult.coinTypeA,
|
|
15859
|
+
toCoin: priceResult.coinTypeC != null ? priceResult.coinTypeC : priceResult.coinTypeB,
|
|
15860
|
+
byAmountIn: priceResult.byAmountIn,
|
|
15861
|
+
splitPaths
|
|
15862
|
+
};
|
|
15863
|
+
return aggregatorResult;
|
|
15864
|
+
}
|
|
15614
15865
|
};
|
|
15615
15866
|
var ConfigModule = class {
|
|
15616
15867
|
_sdk;
|
|
@@ -16514,16 +16765,24 @@ var import_transactions15 = require("@mysten/sui.js/transactions");
|
|
|
16514
16765
|
var import_utils11 = require("@mysten/sui.js/utils");
|
|
16515
16766
|
var import_utils12 = require("@mysten/sui.js/utils");
|
|
16516
16767
|
var import_bn21 = __toESM(require_bn(), 1);
|
|
16768
|
+
var import_transactions16 = require("@mysten/sui.js/transactions");
|
|
16517
16769
|
var import_bn22 = __toESM(require_bn(), 1);
|
|
16518
16770
|
var import_bn23 = __toESM(require_bn(), 1);
|
|
16519
|
-
var import_transactions16 = require("@mysten/sui.js/transactions");
|
|
16520
16771
|
var import_transactions17 = require("@mysten/sui.js/transactions");
|
|
16521
|
-
var import_transactions18 = require("@mysten/sui.js/transactions");
|
|
16522
|
-
var import_bn24 = __toESM(require_bn(), 1);
|
|
16523
16772
|
var import_bcs3 = require("@mysten/sui.js/bcs");
|
|
16524
16773
|
var import_utils13 = require("@mysten/sui.js/utils");
|
|
16774
|
+
var import_transactions18 = require("@mysten/sui.js/transactions");
|
|
16775
|
+
var import_bcs4 = require("@mysten/sui.js/bcs");
|
|
16776
|
+
var import_utils14 = require("@mysten/sui.js/utils");
|
|
16525
16777
|
var import_transactions19 = require("@mysten/sui.js/transactions");
|
|
16778
|
+
var import_bcs5 = require("@mysten/sui.js/bcs");
|
|
16779
|
+
var import_utils15 = require("@mysten/sui.js/utils");
|
|
16526
16780
|
var import_transactions20 = require("@mysten/sui.js/transactions");
|
|
16781
|
+
var import_transactions21 = require("@mysten/sui.js/transactions");
|
|
16782
|
+
var import_transactions22 = require("@mysten/sui.js/transactions");
|
|
16783
|
+
var import_bn24 = __toESM(require_bn(), 1);
|
|
16784
|
+
var import_transactions23 = require("@mysten/sui.js/transactions");
|
|
16785
|
+
var import_transactions24 = require("@mysten/sui.js/transactions");
|
|
16527
16786
|
var BoosterRouterModule = "router";
|
|
16528
16787
|
var CONFIG_PERCENT_MULTIPER = 1e4;
|
|
16529
16788
|
var BoosterUtil = class {
|
|
@@ -20261,6 +20520,24 @@ var VaultsUtils = class {
|
|
|
20261
20520
|
}
|
|
20262
20521
|
return void 0;
|
|
20263
20522
|
}
|
|
20523
|
+
static async getSuiCoin(sdk, amount, tx) {
|
|
20524
|
+
const allCoinAsset = await sdk.ClmmSDK.getOwnerCoinAssets(sdk.getVerifySenderAddress(), GAS_TYPE_ARG);
|
|
20525
|
+
tx = tx || new import_transactions16.TransactionBlock();
|
|
20526
|
+
let suiCoin;
|
|
20527
|
+
if (amount > 95e10) {
|
|
20528
|
+
const [fisrtCoin, ...otherCoins] = allCoinAsset;
|
|
20529
|
+
if (otherCoins.length > 0) {
|
|
20530
|
+
tx.mergeCoins(
|
|
20531
|
+
tx.object(fisrtCoin.coinObjectId),
|
|
20532
|
+
otherCoins.map((coin) => tx.object(coin.coinObjectId))
|
|
20533
|
+
);
|
|
20534
|
+
}
|
|
20535
|
+
suiCoin = tx.splitCoins(tx.object(fisrtCoin.coinObjectId), [amount]);
|
|
20536
|
+
} else {
|
|
20537
|
+
suiCoin = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(amount), GAS_TYPE_ARG, false, true).targetCoin;
|
|
20538
|
+
}
|
|
20539
|
+
return suiCoin;
|
|
20540
|
+
}
|
|
20264
20541
|
};
|
|
20265
20542
|
var FramsUtils = class {
|
|
20266
20543
|
static calculatePositionShare(tick_lower, tick_upper, liquidity, price, effective_tick_lower, effective_tick_upper, current_sqrt_price) {
|
|
@@ -20348,6 +20625,315 @@ var FramsUtils = class {
|
|
|
20348
20625
|
return void 0;
|
|
20349
20626
|
}
|
|
20350
20627
|
};
|
|
20628
|
+
var LimitOrderUtils = class {
|
|
20629
|
+
static buildOrderLimitEvent(item, filterTypes) {
|
|
20630
|
+
const { events } = item;
|
|
20631
|
+
const list = [];
|
|
20632
|
+
if (events) {
|
|
20633
|
+
events.forEach((event) => {
|
|
20634
|
+
const type = extractStructTagFromType(event.type).name;
|
|
20635
|
+
if (filterTypes.includes(type)) {
|
|
20636
|
+
const info = {
|
|
20637
|
+
digest: item.digest,
|
|
20638
|
+
type,
|
|
20639
|
+
timestampMs: item.timestampMs,
|
|
20640
|
+
parsedJson: event.parsedJson
|
|
20641
|
+
};
|
|
20642
|
+
list.push(info);
|
|
20643
|
+
}
|
|
20644
|
+
});
|
|
20645
|
+
}
|
|
20646
|
+
return list;
|
|
20647
|
+
}
|
|
20648
|
+
static buildLimitOrderInfo(info) {
|
|
20649
|
+
const fields = getObjectFields(info);
|
|
20650
|
+
const type = getObjectType(info);
|
|
20651
|
+
if (fields && type) {
|
|
20652
|
+
try {
|
|
20653
|
+
const typeStruct = extractStructTagFromType(type);
|
|
20654
|
+
const info2 = {
|
|
20655
|
+
pay_coin_type: typeStruct.type_arguments[0],
|
|
20656
|
+
target_coin_type: typeStruct.type_arguments[1],
|
|
20657
|
+
canceled_ts: fields.canceled_ts === "18446744073709551615" ? 0 : Number(fields.canceled_ts),
|
|
20658
|
+
id: fields.id.id,
|
|
20659
|
+
obtained_amount: fields.obtained_amount,
|
|
20660
|
+
owner: fields.owner,
|
|
20661
|
+
rate: fields.rate,
|
|
20662
|
+
rate_order_indexer_id: fields.rate_order_indexer_id,
|
|
20663
|
+
expire_ts: Number(fields.expire_ts),
|
|
20664
|
+
total_pay_amount: fields.total_pay_amount,
|
|
20665
|
+
pay_balance: fields.pay_balance,
|
|
20666
|
+
target_balance: fields.target_balance,
|
|
20667
|
+
claimed_amount: fields.claimed_amount,
|
|
20668
|
+
status: "Running",
|
|
20669
|
+
created_ts: Number(fields.created_ts)
|
|
20670
|
+
};
|
|
20671
|
+
if (info2.canceled_ts === 0) {
|
|
20672
|
+
info2.status = "Running";
|
|
20673
|
+
if (d(info2.pay_balance).eq(0)) {
|
|
20674
|
+
info2.status = "Completed";
|
|
20675
|
+
} else if (d(info2.pay_balance).lessThan(info2.total_pay_amount)) {
|
|
20676
|
+
info2.status = "PartialCompleted";
|
|
20677
|
+
}
|
|
20678
|
+
} else {
|
|
20679
|
+
info2.status = "Cancelled";
|
|
20680
|
+
}
|
|
20681
|
+
return info2;
|
|
20682
|
+
} catch (error) {
|
|
20683
|
+
console.log(error);
|
|
20684
|
+
}
|
|
20685
|
+
}
|
|
20686
|
+
return void 0;
|
|
20687
|
+
}
|
|
20688
|
+
// static priceToRate(price: string): string {
|
|
20689
|
+
// const exponent = 20
|
|
20690
|
+
// return d(10).pow(exponent).div(price).toFixed(0).toString()
|
|
20691
|
+
// }
|
|
20692
|
+
// static rateToPrice(rate: string): string {
|
|
20693
|
+
// const exponent = 20
|
|
20694
|
+
// const price = d(10).pow(exponent).div(rate)
|
|
20695
|
+
// return price.toString()
|
|
20696
|
+
// }
|
|
20697
|
+
static rateToPrice(formatRate, payDecimal, targetDecimal) {
|
|
20698
|
+
const exponent = 18 + payDecimal - targetDecimal;
|
|
20699
|
+
return d(10 ** exponent).div(formatRate).toString();
|
|
20700
|
+
}
|
|
20701
|
+
static priceToRate(price, payDecimal, targetDecimal) {
|
|
20702
|
+
const exponent = 18 + payDecimal - targetDecimal;
|
|
20703
|
+
return d(10).pow(exponent).div(d(price)).toFixed(0).toString();
|
|
20704
|
+
}
|
|
20705
|
+
};
|
|
20706
|
+
var HaedalUtils = class {
|
|
20707
|
+
static async getExchangeRateForStake(sdk, shouldRequestStake, swapAmount) {
|
|
20708
|
+
const { vaults } = sdk.sdkOptions;
|
|
20709
|
+
const { haedal } = getPackagerConfigs(vaults);
|
|
20710
|
+
if (haedal === void 0) {
|
|
20711
|
+
throw Error("the haedal config is undefined");
|
|
20712
|
+
}
|
|
20713
|
+
const { simulationAccount } = sdk.ClmmSDK.sdkOptions;
|
|
20714
|
+
const { staking_id } = getPackagerConfigs(haedal);
|
|
20715
|
+
try {
|
|
20716
|
+
const tx = new import_transactions17.TransactionBlock();
|
|
20717
|
+
if (shouldRequestStake) {
|
|
20718
|
+
await this.requestStake(sdk, swapAmount || 1e9, tx);
|
|
20719
|
+
} else {
|
|
20720
|
+
tx.moveCall({
|
|
20721
|
+
target: `${haedal.published_at}::staking::get_exchange_rate`,
|
|
20722
|
+
typeArguments: [],
|
|
20723
|
+
arguments: [tx.object(staking_id)]
|
|
20724
|
+
});
|
|
20725
|
+
}
|
|
20726
|
+
const res = await sdk.ClmmSDK.fullClient.devInspectTransactionBlock({
|
|
20727
|
+
transactionBlock: tx,
|
|
20728
|
+
sender: shouldRequestStake ? sdk.ClmmSDK.senderAddress : simulationAccount.address
|
|
20729
|
+
});
|
|
20730
|
+
console.log("getExchangeRateForStake res: ", res);
|
|
20731
|
+
if (shouldRequestStake) {
|
|
20732
|
+
const findItem = res.events.find((item) => {
|
|
20733
|
+
return item.type.includes("UserStaked");
|
|
20734
|
+
});
|
|
20735
|
+
const { sui_amount, st_amount } = findItem.parsedJson;
|
|
20736
|
+
const rate2 = d(sui_amount).div(st_amount).toString();
|
|
20737
|
+
console.log({ st_amount, sui_amount, rate: rate2 });
|
|
20738
|
+
return rate2;
|
|
20739
|
+
}
|
|
20740
|
+
const returnValues = res.results[0].returnValues[0][0];
|
|
20741
|
+
const rate = import_bcs3.bcs.de("u64", Uint8Array.from(returnValues)) / 1e6;
|
|
20742
|
+
console.log("rate ", import_bcs3.bcs.de("u64", Uint8Array.from(returnValues)));
|
|
20743
|
+
return rate.toString();
|
|
20744
|
+
} catch (error) {
|
|
20745
|
+
console.log("getExchangeRateForHaedal", error);
|
|
20746
|
+
}
|
|
20747
|
+
return "0";
|
|
20748
|
+
}
|
|
20749
|
+
static async requestStake(sdk, amount, tx) {
|
|
20750
|
+
const { vaults } = sdk.sdkOptions;
|
|
20751
|
+
tx = tx || new import_transactions17.TransactionBlock();
|
|
20752
|
+
const suiCoin = await VaultsUtils.getSuiCoin(sdk, amount, tx);
|
|
20753
|
+
tx.moveCall({
|
|
20754
|
+
target: `${vaults.config?.haedal?.published_at}::interface::request_stake`,
|
|
20755
|
+
typeArguments: [],
|
|
20756
|
+
arguments: [
|
|
20757
|
+
tx.object((0, import_utils13.normalizeSuiObjectId)("0x5")),
|
|
20758
|
+
tx.object(vaults.config.haedal.config.staking_id),
|
|
20759
|
+
suiCoin,
|
|
20760
|
+
tx.pure((0, import_utils13.normalizeSuiObjectId)("0x0"))
|
|
20761
|
+
]
|
|
20762
|
+
});
|
|
20763
|
+
return tx;
|
|
20764
|
+
}
|
|
20765
|
+
static requestStakeCoin(sdk, tx, suiCoin) {
|
|
20766
|
+
const { haedal } = sdk.sdkOptions.vaults.config;
|
|
20767
|
+
const haSuiCoin = tx.moveCall({
|
|
20768
|
+
target: `${haedal.published_at}::staking::request_stake_coin`,
|
|
20769
|
+
typeArguments: [],
|
|
20770
|
+
arguments: [
|
|
20771
|
+
tx.object((0, import_utils13.normalizeSuiObjectId)("0x5")),
|
|
20772
|
+
tx.object(haedal.config.staking_id),
|
|
20773
|
+
suiCoin,
|
|
20774
|
+
tx.pure((0, import_utils13.normalizeSuiObjectId)("0x0"))
|
|
20775
|
+
]
|
|
20776
|
+
});
|
|
20777
|
+
return haSuiCoin;
|
|
20778
|
+
}
|
|
20779
|
+
};
|
|
20780
|
+
var VoloUtils = class {
|
|
20781
|
+
static async getExchangeRateForStake(sdk, shouldRequestStake, swapAmount) {
|
|
20782
|
+
const { vaults } = sdk.sdkOptions;
|
|
20783
|
+
const { volo } = getPackagerConfigs(vaults);
|
|
20784
|
+
if (volo === void 0) {
|
|
20785
|
+
throw Error("the volo config is undefined");
|
|
20786
|
+
}
|
|
20787
|
+
const { simulationAccount } = sdk.ClmmSDK.sdkOptions;
|
|
20788
|
+
const { native_pool, vsui_metadata } = getPackagerConfigs(volo);
|
|
20789
|
+
try {
|
|
20790
|
+
const tx = new import_transactions18.TransactionBlock();
|
|
20791
|
+
if (shouldRequestStake) {
|
|
20792
|
+
await this.requestStake(sdk, swapAmount || 1e9, tx);
|
|
20793
|
+
} else {
|
|
20794
|
+
tx.moveCall({
|
|
20795
|
+
target: `${volo.published_at}::native_pool::get_ratio`,
|
|
20796
|
+
typeArguments: [],
|
|
20797
|
+
arguments: [tx.object(native_pool), tx.object(vsui_metadata)]
|
|
20798
|
+
});
|
|
20799
|
+
}
|
|
20800
|
+
const res = await sdk.ClmmSDK.fullClient.devInspectTransactionBlock({
|
|
20801
|
+
transactionBlock: tx,
|
|
20802
|
+
sender: shouldRequestStake ? sdk.ClmmSDK.senderAddress : simulationAccount.address
|
|
20803
|
+
});
|
|
20804
|
+
if (shouldRequestStake) {
|
|
20805
|
+
const findItem = res.events.find((item) => {
|
|
20806
|
+
return item.type.includes("StakedEvent");
|
|
20807
|
+
});
|
|
20808
|
+
const { cert_amount, sui_amount } = findItem.parsedJson;
|
|
20809
|
+
return d(sui_amount).div(cert_amount).toString();
|
|
20810
|
+
}
|
|
20811
|
+
const returnValues = res.results[0].returnValues[0][0];
|
|
20812
|
+
console.log({ returnValues });
|
|
20813
|
+
const rate = import_bcs4.bcs.de("u256", Uint8Array.from(returnValues)) / 1e18;
|
|
20814
|
+
return d(1).div(rate).toString();
|
|
20815
|
+
} catch (error) {
|
|
20816
|
+
console.log("getExchangeRateForHaedal", error);
|
|
20817
|
+
}
|
|
20818
|
+
return "0";
|
|
20819
|
+
}
|
|
20820
|
+
static async requestStake(sdk, amount, tx) {
|
|
20821
|
+
const { vaults } = sdk.sdkOptions;
|
|
20822
|
+
const { volo } = getPackagerConfigs(vaults);
|
|
20823
|
+
if (volo === void 0) {
|
|
20824
|
+
throw Error("the volo config is undefined");
|
|
20825
|
+
}
|
|
20826
|
+
tx = tx || new import_transactions18.TransactionBlock();
|
|
20827
|
+
const { native_pool, vsui_metadata } = getPackagerConfigs(volo);
|
|
20828
|
+
const suiCoin = await VaultsUtils.getSuiCoin(sdk, amount, tx);
|
|
20829
|
+
tx.moveCall({
|
|
20830
|
+
target: `${volo.published_at}::native_pool::stake`,
|
|
20831
|
+
typeArguments: [],
|
|
20832
|
+
arguments: [tx.object(native_pool), tx.object(vsui_metadata), tx.object((0, import_utils14.normalizeSuiObjectId)("0x5")), suiCoin]
|
|
20833
|
+
});
|
|
20834
|
+
return tx;
|
|
20835
|
+
}
|
|
20836
|
+
static requestStakeCoin(sdk, tx, suiCoin) {
|
|
20837
|
+
const { vaults } = sdk.sdkOptions;
|
|
20838
|
+
const { volo } = getPackagerConfigs(vaults);
|
|
20839
|
+
if (volo === void 0) {
|
|
20840
|
+
throw Error("the volo config is undefined");
|
|
20841
|
+
}
|
|
20842
|
+
tx = tx || new import_transactions18.TransactionBlock();
|
|
20843
|
+
const { native_pool, vsui_metadata } = getPackagerConfigs(volo);
|
|
20844
|
+
const haSuiCoin = tx.moveCall({
|
|
20845
|
+
target: `${volo.published_at}::native_pool::stake_non_entry`,
|
|
20846
|
+
typeArguments: [],
|
|
20847
|
+
arguments: [tx.object(native_pool), tx.object(vsui_metadata), tx.object((0, import_utils14.normalizeSuiObjectId)("0x5")), suiCoin]
|
|
20848
|
+
});
|
|
20849
|
+
return haSuiCoin;
|
|
20850
|
+
}
|
|
20851
|
+
};
|
|
20852
|
+
var AftermathoUtils = class {
|
|
20853
|
+
static async getExchangeRateForStake(sdk, shouldRequestStake, swapAmount) {
|
|
20854
|
+
const { vaults } = sdk.sdkOptions;
|
|
20855
|
+
const { aftermath } = getPackagerConfigs(vaults);
|
|
20856
|
+
if (aftermath === void 0) {
|
|
20857
|
+
throw Error("the aftermath config is undefined");
|
|
20858
|
+
}
|
|
20859
|
+
const { simulationAccount } = sdk.ClmmSDK.sdkOptions;
|
|
20860
|
+
const { staked_sui_vault, safe } = getPackagerConfigs(aftermath);
|
|
20861
|
+
try {
|
|
20862
|
+
const tx = new import_transactions19.TransactionBlock();
|
|
20863
|
+
if (shouldRequestStake) {
|
|
20864
|
+
await this.requestStake(sdk, swapAmount || 1e9, tx);
|
|
20865
|
+
} else {
|
|
20866
|
+
tx.moveCall({
|
|
20867
|
+
target: `${aftermath.published_at}::staked_sui_vault::afsui_to_sui_exchange_rate`,
|
|
20868
|
+
typeArguments: [],
|
|
20869
|
+
arguments: [tx.object(staked_sui_vault), tx.object(safe)]
|
|
20870
|
+
});
|
|
20871
|
+
}
|
|
20872
|
+
const res = await sdk.ClmmSDK.fullClient.devInspectTransactionBlock({
|
|
20873
|
+
transactionBlock: tx,
|
|
20874
|
+
sender: shouldRequestStake ? sdk.ClmmSDK.senderAddress : simulationAccount.address
|
|
20875
|
+
});
|
|
20876
|
+
if (shouldRequestStake) {
|
|
20877
|
+
const findItem = res.events.find((item) => {
|
|
20878
|
+
return item.type.includes("StakedEvent");
|
|
20879
|
+
});
|
|
20880
|
+
const { afsui_amount, sui_amount } = findItem.parsedJson;
|
|
20881
|
+
return d(sui_amount).div(afsui_amount).toString();
|
|
20882
|
+
}
|
|
20883
|
+
const returnValues = res.results[0].returnValues[0][0];
|
|
20884
|
+
const rate = import_bcs5.bcs.de("u128", Uint8Array.from(returnValues)) / 1e18;
|
|
20885
|
+
return rate.toString();
|
|
20886
|
+
} catch (error) {
|
|
20887
|
+
console.log("getExchangeRateForHaedal", error);
|
|
20888
|
+
}
|
|
20889
|
+
return "0";
|
|
20890
|
+
}
|
|
20891
|
+
static async requestStake(sdk, amount, tx) {
|
|
20892
|
+
const { vaults } = sdk.sdkOptions;
|
|
20893
|
+
const { aftermath } = getPackagerConfigs(vaults);
|
|
20894
|
+
if (aftermath === void 0) {
|
|
20895
|
+
throw Error("the aftermath config is undefined");
|
|
20896
|
+
}
|
|
20897
|
+
tx = tx || new import_transactions19.TransactionBlock();
|
|
20898
|
+
const { staked_sui_vault, referral_vault, safe, validator_address } = getPackagerConfigs(aftermath);
|
|
20899
|
+
const suiCoin = await VaultsUtils.getSuiCoin(sdk, amount, tx);
|
|
20900
|
+
tx.moveCall({
|
|
20901
|
+
target: `${aftermath.published_at}::staked_sui_vault::request_stake_and_keep`,
|
|
20902
|
+
typeArguments: [],
|
|
20903
|
+
arguments: [
|
|
20904
|
+
tx.object(staked_sui_vault),
|
|
20905
|
+
tx.object(safe),
|
|
20906
|
+
tx.object((0, import_utils15.normalizeSuiObjectId)("0x5")),
|
|
20907
|
+
tx.object(referral_vault),
|
|
20908
|
+
suiCoin,
|
|
20909
|
+
tx.pure((0, import_utils15.normalizeSuiObjectId)(validator_address))
|
|
20910
|
+
]
|
|
20911
|
+
});
|
|
20912
|
+
return tx;
|
|
20913
|
+
}
|
|
20914
|
+
static requestStakeCoin(sdk, tx, suiCoin) {
|
|
20915
|
+
const { vaults } = sdk.sdkOptions;
|
|
20916
|
+
const { aftermath } = getPackagerConfigs(vaults);
|
|
20917
|
+
if (aftermath === void 0) {
|
|
20918
|
+
throw Error("the aftermath config is undefined");
|
|
20919
|
+
}
|
|
20920
|
+
tx = tx || new import_transactions19.TransactionBlock();
|
|
20921
|
+
const { staked_sui_vault, referral_vault, safe, validator_address } = getPackagerConfigs(aftermath);
|
|
20922
|
+
const haSuiCoin = tx.moveCall({
|
|
20923
|
+
target: `${aftermath.published_at}::staked_sui_vault::request_stake`,
|
|
20924
|
+
typeArguments: [],
|
|
20925
|
+
arguments: [
|
|
20926
|
+
tx.object(staked_sui_vault),
|
|
20927
|
+
tx.object(safe),
|
|
20928
|
+
tx.object((0, import_utils15.normalizeSuiObjectId)("0x5")),
|
|
20929
|
+
tx.object(referral_vault),
|
|
20930
|
+
suiCoin,
|
|
20931
|
+
tx.pure((0, import_utils15.normalizeSuiObjectId)(validator_address))
|
|
20932
|
+
]
|
|
20933
|
+
});
|
|
20934
|
+
return haSuiCoin;
|
|
20935
|
+
}
|
|
20936
|
+
};
|
|
20351
20937
|
var IdoModule = class {
|
|
20352
20938
|
_sdk;
|
|
20353
20939
|
_cache = {};
|
|
@@ -21186,7 +21772,7 @@ var XTokenModule = class {
|
|
|
21186
21772
|
*/
|
|
21187
21773
|
mintVeNFTPayload() {
|
|
21188
21774
|
const { xtoken } = this.sdk.sdkOptions;
|
|
21189
|
-
const tx = new
|
|
21775
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21190
21776
|
tx.moveCall({
|
|
21191
21777
|
target: `${xtoken.published_at}::${XTokenRouterModule}::mint_venft`,
|
|
21192
21778
|
typeArguments: [],
|
|
@@ -21201,7 +21787,7 @@ var XTokenModule = class {
|
|
|
21201
21787
|
*/
|
|
21202
21788
|
async convertPayload(params) {
|
|
21203
21789
|
const { xtoken } = this.sdk.sdkOptions;
|
|
21204
|
-
const tx = new
|
|
21790
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21205
21791
|
const coin_type = this.buileTokenCoinType();
|
|
21206
21792
|
const primaryCoinInputs = await TransactionUtil.syncBuildCoinInputForAmount(
|
|
21207
21793
|
this._sdk.ClmmSDK,
|
|
@@ -21243,7 +21829,7 @@ var XTokenModule = class {
|
|
|
21243
21829
|
*/
|
|
21244
21830
|
redeemLockPayload(params) {
|
|
21245
21831
|
const { xtoken } = this.sdk.sdkOptions;
|
|
21246
|
-
const tx = new
|
|
21832
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21247
21833
|
tx.moveCall({
|
|
21248
21834
|
target: `${xtoken.published_at}::${XTokenRouterModule}::redeem_lock`,
|
|
21249
21835
|
typeArguments: [],
|
|
@@ -21265,7 +21851,7 @@ var XTokenModule = class {
|
|
|
21265
21851
|
*/
|
|
21266
21852
|
redeemPayload(params) {
|
|
21267
21853
|
const { xtoken } = this.sdk.sdkOptions;
|
|
21268
|
-
const tx = new
|
|
21854
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21269
21855
|
tx.moveCall({
|
|
21270
21856
|
target: `${xtoken.published_at}::${XTokenRouterModule}::redeem`,
|
|
21271
21857
|
typeArguments: [],
|
|
@@ -21281,7 +21867,7 @@ var XTokenModule = class {
|
|
|
21281
21867
|
}
|
|
21282
21868
|
redeemDividendPayload(venft_id, bonus_types) {
|
|
21283
21869
|
const { xtoken_dividends } = this.sdk.sdkOptions;
|
|
21284
|
-
const tx = new
|
|
21870
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21285
21871
|
bonus_types.forEach((coin) => {
|
|
21286
21872
|
tx.moveCall({
|
|
21287
21873
|
target: `${xtoken_dividends.published_at}::${XTokenDividendsRouterModule}::redeem`,
|
|
@@ -21293,7 +21879,7 @@ var XTokenModule = class {
|
|
|
21293
21879
|
}
|
|
21294
21880
|
redeemDividendV2Payload(venft_id, bonus_types, xTokenType) {
|
|
21295
21881
|
const { xtoken_dividends } = this.sdk.sdkOptions;
|
|
21296
|
-
let tx = new
|
|
21882
|
+
let tx = new import_transactions20.TransactionBlock();
|
|
21297
21883
|
const xTokenTypeList = bonus_types.filter((coin) => {
|
|
21298
21884
|
return xTokenType.includes(coin);
|
|
21299
21885
|
});
|
|
@@ -21315,7 +21901,7 @@ var XTokenModule = class {
|
|
|
21315
21901
|
const { xtoken_dividends, xtoken } = this.sdk.sdkOptions;
|
|
21316
21902
|
const { xtoken_manager_id, lock_manager_id } = getPackagerConfigs(xtoken);
|
|
21317
21903
|
const { dividend_manager_id } = getPackagerConfigs(xtoken_dividends);
|
|
21318
|
-
tx = tx === void 0 ? new
|
|
21904
|
+
tx = tx === void 0 ? new import_transactions20.TransactionBlock() : tx;
|
|
21319
21905
|
tx.moveCall({
|
|
21320
21906
|
target: `${xtoken_dividends.published_at}::${XTokenDividendsRouterModule}::redeem_xtoken`,
|
|
21321
21907
|
typeArguments: [],
|
|
@@ -21342,7 +21928,7 @@ var XTokenModule = class {
|
|
|
21342
21928
|
*/
|
|
21343
21929
|
cancelRedeemPayload(params) {
|
|
21344
21930
|
const { xtoken } = this.sdk.sdkOptions;
|
|
21345
|
-
const tx = new
|
|
21931
|
+
const tx = new import_transactions20.TransactionBlock();
|
|
21346
21932
|
tx.moveCall({
|
|
21347
21933
|
target: `${xtoken.published_at}::${XTokenRouterModule}::cancel_redeem_lock`,
|
|
21348
21934
|
typeArguments: [],
|
|
@@ -21732,7 +22318,7 @@ var LiquidityStrategyModule = class {
|
|
|
21732
22318
|
fix_amount_a_vec.push(fix_amount_a);
|
|
21733
22319
|
});
|
|
21734
22320
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
21735
|
-
const tx = new
|
|
22321
|
+
const tx = new import_transactions21.TransactionBlock();
|
|
21736
22322
|
const primaryCoinAInputs = TransactionUtil.buildAddLiquidityFixTokenCoinInput(
|
|
21737
22323
|
tx,
|
|
21738
22324
|
!params.fix_amount_a,
|
|
@@ -21866,7 +22452,7 @@ var LiquidityStrategyModule = class {
|
|
|
21866
22452
|
async fetchMasterPositionInfos(params) {
|
|
21867
22453
|
const positionMap = {};
|
|
21868
22454
|
const { clmm_pool, integrate, simulationAccount } = this.sdk.ClmmSDK.sdkOptions;
|
|
21869
|
-
const tx = new
|
|
22455
|
+
const tx = new import_transactions21.TransactionBlock();
|
|
21870
22456
|
params.forEach((pool) => {
|
|
21871
22457
|
pool.position_ids.forEach((pos_id) => {
|
|
21872
22458
|
const typeArguments = [pool.coinTypeA, pool.coinTypeB];
|
|
@@ -21947,7 +22533,7 @@ var LiquidityStrategyModule = class {
|
|
|
21947
22533
|
removeMasterLiquidity(params) {
|
|
21948
22534
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
21949
22535
|
const { liquidity_stratefy } = this.sdk.sdkOptions;
|
|
21950
|
-
const tx = new
|
|
22536
|
+
const tx = new import_transactions21.TransactionBlock();
|
|
21951
22537
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
21952
22538
|
this.collectReward(
|
|
21953
22539
|
{
|
|
@@ -21988,7 +22574,7 @@ var LiquidityStrategyModule = class {
|
|
|
21988
22574
|
closeMasterLiquidity(params) {
|
|
21989
22575
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
21990
22576
|
const { liquidity_stratefy } = this.sdk.sdkOptions;
|
|
21991
|
-
const tx = new
|
|
22577
|
+
const tx = new import_transactions21.TransactionBlock();
|
|
21992
22578
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
21993
22579
|
this.collectReward(
|
|
21994
22580
|
{
|
|
@@ -22025,7 +22611,7 @@ var LiquidityStrategyModule = class {
|
|
|
22025
22611
|
collectFee(params, tx) {
|
|
22026
22612
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
22027
22613
|
const { liquidity_stratefy } = this.sdk.sdkOptions;
|
|
22028
|
-
tx = tx === void 0 ? new
|
|
22614
|
+
tx = tx === void 0 ? new import_transactions21.TransactionBlock() : tx;
|
|
22029
22615
|
const typeArguments = [params.coinTypeA, params.coinTypeB];
|
|
22030
22616
|
const args = [
|
|
22031
22617
|
tx.object(getPackagerConfigs(liquidity_stratefy).master_manger_id),
|
|
@@ -22049,7 +22635,7 @@ var LiquidityStrategyModule = class {
|
|
|
22049
22635
|
collectReward(params, tx) {
|
|
22050
22636
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
22051
22637
|
const { liquidity_stratefy } = this.sdk.sdkOptions;
|
|
22052
|
-
tx = tx === void 0 ? new
|
|
22638
|
+
tx = tx === void 0 ? new import_transactions21.TransactionBlock() : tx;
|
|
22053
22639
|
if (params.collect_fee) {
|
|
22054
22640
|
this.collectFee({ ...params }, tx);
|
|
22055
22641
|
}
|
|
@@ -22150,7 +22736,7 @@ var VaultsModule = class {
|
|
|
22150
22736
|
const { vaults, frams } = this._sdk.sdkOptions;
|
|
22151
22737
|
const { clmm_pool } = this._sdk.ClmmSDK.sdkOptions;
|
|
22152
22738
|
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.getVerifySenderAddress());
|
|
22153
|
-
const tx = new
|
|
22739
|
+
const tx = new import_transactions22.TransactionBlock();
|
|
22154
22740
|
let primaryCoinAInputs;
|
|
22155
22741
|
let primaryCoinBInputs;
|
|
22156
22742
|
if (params.swapParams) {
|
|
@@ -22203,13 +22789,13 @@ var VaultsModule = class {
|
|
|
22203
22789
|
}
|
|
22204
22790
|
async handleDepositSwap(params, tx, allCoinAsset) {
|
|
22205
22791
|
const { clmm_pool, integrate } = this._sdk.ClmmSDK.sdkOptions;
|
|
22206
|
-
const { swap_amount, a2b, route_obj,
|
|
22792
|
+
const { swap_amount, a2b, route_obj, stakeProtocol } = params.swapParams;
|
|
22207
22793
|
const fromCoinType = a2b ? params.coinTypeA : params.coinTypeB;
|
|
22208
22794
|
const swapCoinInputFrom = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(swap_amount), fromCoinType, false);
|
|
22209
22795
|
const selectedUnusedAmount = BigInt(swapCoinInputFrom.tragetCoinAmount) - BigInt(swap_amount);
|
|
22210
22796
|
let coinABs = [];
|
|
22211
|
-
if (
|
|
22212
|
-
const haSuiCoin = this.requestStakeCoin(
|
|
22797
|
+
if (stakeProtocol) {
|
|
22798
|
+
const haSuiCoin = this.requestStakeCoin(stakeProtocol, tx, swapCoinInputFrom.targetCoin);
|
|
22213
22799
|
const suiCoin = TransactionUtil.buildCoinForAmount(tx, swapCoinInputFrom.remainCoins, BigInt(0), fromCoinType, false).targetCoin;
|
|
22214
22800
|
coinABs = a2b ? [suiCoin, haSuiCoin] : [haSuiCoin, suiCoin];
|
|
22215
22801
|
} else if (route_obj) {
|
|
@@ -22283,7 +22869,7 @@ var VaultsModule = class {
|
|
|
22283
22869
|
console.log({ params });
|
|
22284
22870
|
const { vaults, frams } = this.sdk.sdkOptions;
|
|
22285
22871
|
const { clmm_pool, integrate } = this._sdk.ClmmSDK.sdkOptions;
|
|
22286
|
-
const tx = new
|
|
22872
|
+
const tx = new import_transactions22.TransactionBlock();
|
|
22287
22873
|
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.getVerifySenderAddress(), params.lp_token_type);
|
|
22288
22874
|
const primaryCoinInputs = TransactionUtil.buildCoinForAmount(
|
|
22289
22875
|
tx,
|
|
@@ -22389,7 +22975,7 @@ var VaultsModule = class {
|
|
|
22389
22975
|
objectList.forEach((item) => {
|
|
22390
22976
|
const pool = VaultsUtils.buildPool(item);
|
|
22391
22977
|
if (pool) {
|
|
22392
|
-
pool.
|
|
22978
|
+
pool.stake_protocol = this.findStakeProtocol(pool.position.coinTypeA, pool.position.coinTypeB);
|
|
22393
22979
|
this.savePoolToCache(pool);
|
|
22394
22980
|
poolList.push(pool);
|
|
22395
22981
|
}
|
|
@@ -22397,20 +22983,32 @@ var VaultsModule = class {
|
|
|
22397
22983
|
res.data = poolList;
|
|
22398
22984
|
return res;
|
|
22399
22985
|
}
|
|
22400
|
-
|
|
22401
|
-
const { haedal } = this._sdk.sdkOptions;
|
|
22402
|
-
const
|
|
22403
|
-
|
|
22986
|
+
findStakeProtocol(coinTypeA, coinTypeB) {
|
|
22987
|
+
const { haedal, volo, aftermath } = getPackagerConfigs(this._sdk.sdkOptions.vaults);
|
|
22988
|
+
const coinTypeAFormat = extractStructTagFromType(coinTypeA).full_address;
|
|
22989
|
+
const coinTypeBFormat = extractStructTagFromType(coinTypeB).full_address;
|
|
22990
|
+
if (!(CoinAssist.isSuiCoin(coinTypeAFormat) || CoinAssist.isSuiCoin(coinTypeBFormat))) {
|
|
22404
22991
|
return void 0;
|
|
22405
22992
|
}
|
|
22406
|
-
|
|
22407
|
-
const
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
-
|
|
22411
|
-
|
|
22412
|
-
|
|
22413
|
-
|
|
22993
|
+
if (haedal) {
|
|
22994
|
+
const coinType = extractStructTagFromType(getPackagerConfigs(haedal).coin_type).full_address;
|
|
22995
|
+
if (coinTypeAFormat === coinType || coinTypeBFormat === coinType) {
|
|
22996
|
+
return "Haedal";
|
|
22997
|
+
}
|
|
22998
|
+
}
|
|
22999
|
+
if (volo) {
|
|
23000
|
+
const coinType = extractStructTagFromType(getPackagerConfigs(volo).coin_type).full_address;
|
|
23001
|
+
if (coinTypeAFormat === coinType || coinTypeBFormat === coinType) {
|
|
23002
|
+
return "Volo";
|
|
23003
|
+
}
|
|
23004
|
+
}
|
|
23005
|
+
if (aftermath) {
|
|
23006
|
+
const coinType = extractStructTagFromType(getPackagerConfigs(aftermath).coin_type).full_address;
|
|
23007
|
+
if (coinTypeAFormat === coinType || coinTypeBFormat === coinType) {
|
|
23008
|
+
return "aftermath";
|
|
23009
|
+
}
|
|
23010
|
+
}
|
|
23011
|
+
return void 0;
|
|
22414
23012
|
}
|
|
22415
23013
|
savePoolToCache(pool) {
|
|
22416
23014
|
const cacheKey = `${pool.id}_mirrorPool`;
|
|
@@ -22425,7 +23023,7 @@ var VaultsModule = class {
|
|
|
22425
23023
|
*/
|
|
22426
23024
|
async calculateMaxAvailable(params) {
|
|
22427
23025
|
const { integrate, simulationAccount } = this.sdk.ClmmSDK.sdkOptions;
|
|
22428
|
-
const tx = new
|
|
23026
|
+
const tx = new import_transactions22.TransactionBlock();
|
|
22429
23027
|
const lowerSqrtPrice = TickMath.tickIndexToSqrtPriceX64(params.lowerTick);
|
|
22430
23028
|
const upperSqrtPrice = TickMath.tickIndexToSqrtPriceX64(params.upperTick);
|
|
22431
23029
|
const curSqrtPrice = new import_bn24.default(params.curSqrtPrice);
|
|
@@ -22565,10 +23163,10 @@ var VaultsModule = class {
|
|
|
22565
23163
|
* 只支持固定输入sui
|
|
22566
23164
|
* @param params
|
|
22567
23165
|
*/
|
|
22568
|
-
async
|
|
23166
|
+
async calculateStakeDepositFixSui(params) {
|
|
22569
23167
|
const remainSuiLimit = params.inputSuiAmount.mul(params.remainRate);
|
|
22570
23168
|
const remainSui = params.inputSuiAmount.sub(params.swapSuiAmount);
|
|
22571
|
-
const exchangeRate = params.exchangeRate ? params.exchangeRate : await this.
|
|
23169
|
+
const exchangeRate = params.exchangeRate ? params.exchangeRate : await this.getExchangeRateForStake(params.stakeProtocol, params.shouldRequestStake, Number(params.swapSuiAmount.toFixed(0)));
|
|
22572
23170
|
const hasuiAmount = params.swapSuiAmount.div(exchangeRate).toFixed(0);
|
|
22573
23171
|
console.log({
|
|
22574
23172
|
swapAmount: params.swapSuiAmount.toString(),
|
|
@@ -22604,11 +23202,11 @@ var VaultsModule = class {
|
|
|
22604
23202
|
fixAmountA: !params.fixCoinA,
|
|
22605
23203
|
is_exceed: true,
|
|
22606
23204
|
request_id: "",
|
|
22607
|
-
|
|
23205
|
+
stake_protocol: params.stakeProtocol
|
|
22608
23206
|
};
|
|
22609
23207
|
}
|
|
22610
23208
|
if (actRemainSui.lessThan(0)) {
|
|
22611
|
-
return await this.
|
|
23209
|
+
return await this.calculateStakeDepositFixSui({
|
|
22612
23210
|
...params,
|
|
22613
23211
|
rightSuiAmount: params.swapSuiAmount,
|
|
22614
23212
|
swapSuiAmount: params.swapSuiAmount.add(params.leftSuiAmount).div(2),
|
|
@@ -22617,7 +23215,7 @@ var VaultsModule = class {
|
|
|
22617
23215
|
});
|
|
22618
23216
|
}
|
|
22619
23217
|
if (actRemainSui.greaterThan(remainSuiLimit)) {
|
|
22620
|
-
return await this.
|
|
23218
|
+
return await this.calculateStakeDepositFixSui({
|
|
22621
23219
|
...params,
|
|
22622
23220
|
leftSuiAmount: params.swapSuiAmount,
|
|
22623
23221
|
swapSuiAmount: params.swapSuiAmount.add(params.rightSuiAmount).div(2),
|
|
@@ -22644,9 +23242,9 @@ var VaultsModule = class {
|
|
|
22644
23242
|
if (swapAmount.toFixed(0) === "0") {
|
|
22645
23243
|
return null;
|
|
22646
23244
|
}
|
|
22647
|
-
if (params.
|
|
23245
|
+
if (params.stakeProtocol) {
|
|
22648
23246
|
if (CoinAssist.isSuiCoin(params.coinTypeA) && params.fix_amount_a || CoinAssist.isSuiCoin(params.coinTypeB) && !params.fix_amount_a) {
|
|
22649
|
-
const res = await this.
|
|
23247
|
+
const res = await this.calculateStakeDepositFixSui({
|
|
22650
23248
|
inputSuiAmount: d(params.input_amount),
|
|
22651
23249
|
swapSuiAmount: swapAmount,
|
|
22652
23250
|
lowerTick: params.lowerTick,
|
|
@@ -22658,7 +23256,7 @@ var VaultsModule = class {
|
|
|
22658
23256
|
shouldRequestStake: params.shouldRequestStake,
|
|
22659
23257
|
leftSuiAmount: a2b ? new decimal_default(swapAmount.toFixed(0)) : new decimal_default(0),
|
|
22660
23258
|
rightSuiAmount: a2b ? new decimal_default(params.input_amount) : new decimal_default(swapAmount.toFixed(0)),
|
|
22661
|
-
|
|
23259
|
+
stakeProtocol: params.stakeProtocol
|
|
22662
23260
|
});
|
|
22663
23261
|
if (res) {
|
|
22664
23262
|
return { ...res, request_id: params.request_id };
|
|
@@ -22776,9 +23374,9 @@ var VaultsModule = class {
|
|
|
22776
23374
|
if (swapAmount.toFixed(0) === "0") {
|
|
22777
23375
|
return null;
|
|
22778
23376
|
}
|
|
22779
|
-
if (params.
|
|
23377
|
+
if (params.stakeProtocol) {
|
|
22780
23378
|
if (CoinAssist.isSuiCoin(params.coinTypeA) && params.fix_amount_a || CoinAssist.isSuiCoin(params.coinTypeB) && !params.fix_amount_a) {
|
|
22781
|
-
const res = await this.
|
|
23379
|
+
const res = await this.calculateStakeDepositFixSui({
|
|
22782
23380
|
inputSuiAmount: d(params.input_amount),
|
|
22783
23381
|
swapSuiAmount: swapAmount,
|
|
22784
23382
|
lowerTick: params.lowerTick,
|
|
@@ -22790,7 +23388,7 @@ var VaultsModule = class {
|
|
|
22790
23388
|
shouldRequestStake: params.shouldRequestStake,
|
|
22791
23389
|
leftSuiAmount: a2b ? new decimal_default(swapAmount.toFixed(0)) : new decimal_default(0),
|
|
22792
23390
|
rightSuiAmount: a2b ? new decimal_default(params.input_amount) : new decimal_default(swapAmount.toFixed(0)),
|
|
22793
|
-
|
|
23391
|
+
stakeProtocol: params.stakeProtocol
|
|
22794
23392
|
});
|
|
22795
23393
|
if (res) {
|
|
22796
23394
|
return { ...res, request_id: params.request_id };
|
|
@@ -22935,7 +23533,7 @@ var VaultsModule = class {
|
|
|
22935
23533
|
}
|
|
22936
23534
|
}
|
|
22937
23535
|
const { integrate, simulationAccount } = this.sdk.ClmmSDK.sdkOptions;
|
|
22938
|
-
const tx = new
|
|
23536
|
+
const tx = new import_transactions22.TransactionBlock();
|
|
22939
23537
|
const typeArguments = [coinTypeA, coinTypeB];
|
|
22940
23538
|
const args = [tx.pure(clmm_pool), tx.pure(a2b), tx.pure(byAmountIn), tx.pure(amount.toFixed(0))];
|
|
22941
23539
|
tx.moveCall({
|
|
@@ -22967,7 +23565,7 @@ var VaultsModule = class {
|
|
|
22967
23565
|
});
|
|
22968
23566
|
const pool = VaultsUtils.buildPool(item);
|
|
22969
23567
|
if (pool) {
|
|
22970
|
-
pool.
|
|
23568
|
+
pool.stake_protocol = this.findStakeProtocol(pool.position.coinTypeA, pool.position.coinTypeB);
|
|
22971
23569
|
this.savePoolToCache(pool);
|
|
22972
23570
|
return pool;
|
|
22973
23571
|
}
|
|
@@ -23010,40 +23608,15 @@ var VaultsModule = class {
|
|
|
23010
23608
|
* @param shouldRequestStake 为true 时 通过走质押逻辑,进行模拟计算
|
|
23011
23609
|
* @returns
|
|
23012
23610
|
*/
|
|
23013
|
-
async
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
|
|
23021
|
-
|
|
23022
|
-
target: `${haedal.published_at}::staking::get_exchange_rate`,
|
|
23023
|
-
typeArguments: [],
|
|
23024
|
-
arguments: [tx.object(staking_id)]
|
|
23025
|
-
});
|
|
23026
|
-
}
|
|
23027
|
-
const res = await this._sdk.ClmmSDK.fullClient.devInspectTransactionBlock({
|
|
23028
|
-
transactionBlock: tx,
|
|
23029
|
-
sender: shouldRequestStake ? this._sdk.ClmmSDK.senderAddress : simulationAccount.address
|
|
23030
|
-
});
|
|
23031
|
-
console.log("getExchangeRateForHaedal res: ", res);
|
|
23032
|
-
if (shouldRequestStake) {
|
|
23033
|
-
const findItem = res.events.find((item) => {
|
|
23034
|
-
return item.type.includes("UserStaked");
|
|
23035
|
-
});
|
|
23036
|
-
const { sui_amount, st_amount } = findItem.parsedJson;
|
|
23037
|
-
const rate2 = d(sui_amount).div(st_amount).toString();
|
|
23038
|
-
console.log({ st_amount, sui_amount, rate: rate2 });
|
|
23039
|
-
return rate2;
|
|
23040
|
-
}
|
|
23041
|
-
const returnValues = res.results[0].returnValues[0][0];
|
|
23042
|
-
const rate = import_bcs3.bcs.de("u64", Uint8Array.from(returnValues)) / 1e6;
|
|
23043
|
-
console.log("rate ", import_bcs3.bcs.de("u64", Uint8Array.from(returnValues)));
|
|
23044
|
-
return rate.toString();
|
|
23045
|
-
} catch (error) {
|
|
23046
|
-
console.log("getExchangeRateForHaedal", error);
|
|
23611
|
+
async getExchangeRateForStake(stakingProtocol, shouldRequestStake, swapAmount) {
|
|
23612
|
+
if (stakingProtocol === "Haedal") {
|
|
23613
|
+
return await HaedalUtils.getExchangeRateForStake(this._sdk, shouldRequestStake, swapAmount);
|
|
23614
|
+
}
|
|
23615
|
+
if (stakingProtocol === "Volo") {
|
|
23616
|
+
return await VoloUtils.getExchangeRateForStake(this._sdk, shouldRequestStake, swapAmount);
|
|
23617
|
+
}
|
|
23618
|
+
if (stakingProtocol === "aftermath") {
|
|
23619
|
+
return await AftermathoUtils.getExchangeRateForStake(this._sdk, shouldRequestStake, swapAmount);
|
|
23047
23620
|
}
|
|
23048
23621
|
return "0";
|
|
23049
23622
|
}
|
|
@@ -23053,53 +23626,29 @@ var VaultsModule = class {
|
|
|
23053
23626
|
* @param suiCoin
|
|
23054
23627
|
* @returns
|
|
23055
23628
|
*/
|
|
23056
|
-
requestStakeCoin(
|
|
23057
|
-
|
|
23058
|
-
|
|
23059
|
-
|
|
23060
|
-
|
|
23061
|
-
|
|
23062
|
-
}
|
|
23063
|
-
|
|
23629
|
+
requestStakeCoin(stakingProtocol, tx, suiCoin) {
|
|
23630
|
+
if (stakingProtocol === "Haedal") {
|
|
23631
|
+
return HaedalUtils.requestStakeCoin(this._sdk, tx, suiCoin);
|
|
23632
|
+
}
|
|
23633
|
+
if (stakingProtocol === "Volo") {
|
|
23634
|
+
return VoloUtils.requestStakeCoin(this._sdk, tx, suiCoin);
|
|
23635
|
+
}
|
|
23636
|
+
if (stakingProtocol === "aftermath") {
|
|
23637
|
+
return AftermathoUtils.requestStakeCoin(this._sdk, tx, suiCoin);
|
|
23638
|
+
}
|
|
23639
|
+
return void 0;
|
|
23064
23640
|
}
|
|
23065
|
-
|
|
23066
|
-
|
|
23067
|
-
|
|
23068
|
-
// console.log('requestStake amount: ', amount)
|
|
23069
|
-
// console.log('requestStake allCoinAsset: ', allCoinAsset)
|
|
23070
|
-
// tx = tx || new TransactionBlock()
|
|
23071
|
-
// const suiCoin = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(amount), GAS_TYPE_ARG, false, true)
|
|
23072
|
-
// console.log('requestStake suiCoin: ', suiCoin)
|
|
23073
|
-
// tx.moveCall({
|
|
23074
|
-
// target: `${haedal.published_at}::interface::request_stake`,
|
|
23075
|
-
// typeArguments: [],
|
|
23076
|
-
// arguments: [tx.object(normalizeSuiObjectId('0x5')), tx.object(staking_id), suiCoin.targetCoin, tx.pure(normalizeSuiObjectId('0x0'))],
|
|
23077
|
-
// })
|
|
23078
|
-
// return tx
|
|
23079
|
-
// }
|
|
23080
|
-
async requestStake(staking_id, amount, tx) {
|
|
23081
|
-
const { haedal } = this._sdk.sdkOptions;
|
|
23082
|
-
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.getVerifySenderAddress(), GAS_TYPE_ARG);
|
|
23083
|
-
tx = tx || new import_transactions18.TransactionBlock();
|
|
23084
|
-
let suiCoin;
|
|
23085
|
-
if (amount > 95e10) {
|
|
23086
|
-
const [fisrtCoin, ...otherCoins] = allCoinAsset;
|
|
23087
|
-
if (otherCoins.length > 0) {
|
|
23088
|
-
tx.mergeCoins(
|
|
23089
|
-
tx.object(fisrtCoin.coinObjectId),
|
|
23090
|
-
otherCoins.map((coin) => tx.object(coin.coinObjectId))
|
|
23091
|
-
);
|
|
23092
|
-
}
|
|
23093
|
-
suiCoin = tx.splitCoins(tx.object(fisrtCoin.coinObjectId), [amount]);
|
|
23094
|
-
} else {
|
|
23095
|
-
suiCoin = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(amount), GAS_TYPE_ARG, false, true).targetCoin;
|
|
23641
|
+
async requestStake(stakingProtocol, amount, tx) {
|
|
23642
|
+
if (stakingProtocol === "Haedal") {
|
|
23643
|
+
return await HaedalUtils.requestStake(this._sdk, amount, tx);
|
|
23096
23644
|
}
|
|
23097
|
-
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
|
|
23645
|
+
if (stakingProtocol === "Volo") {
|
|
23646
|
+
return await VoloUtils.requestStake(this._sdk, amount, tx);
|
|
23647
|
+
}
|
|
23648
|
+
if (stakingProtocol === "aftermath") {
|
|
23649
|
+
return await AftermathoUtils.requestStake(this._sdk, amount, tx);
|
|
23650
|
+
}
|
|
23651
|
+
return void 0;
|
|
23103
23652
|
}
|
|
23104
23653
|
/**
|
|
23105
23654
|
* Updates the cache for the given key.
|
|
@@ -23135,74 +23684,6 @@ var VaultsModule = class {
|
|
|
23135
23684
|
return void 0;
|
|
23136
23685
|
}
|
|
23137
23686
|
};
|
|
23138
|
-
var LimitOrderUtils = class {
|
|
23139
|
-
static buildOrderLimitEvent(item) {
|
|
23140
|
-
const { events } = item;
|
|
23141
|
-
const list = [];
|
|
23142
|
-
if (events) {
|
|
23143
|
-
events.forEach((event) => {
|
|
23144
|
-
const type = extractStructTagFromType(event.type).name;
|
|
23145
|
-
if (type === "OrderPlacedEvent" || type === "OrderCanceledEvent" || type === "FlashLoanEvent") {
|
|
23146
|
-
const info = {
|
|
23147
|
-
digest: item.digest,
|
|
23148
|
-
type,
|
|
23149
|
-
timestampMs: item.timestampMs,
|
|
23150
|
-
parsedJson: event.parsedJson
|
|
23151
|
-
};
|
|
23152
|
-
list.push(info);
|
|
23153
|
-
}
|
|
23154
|
-
});
|
|
23155
|
-
}
|
|
23156
|
-
return list;
|
|
23157
|
-
}
|
|
23158
|
-
static buildLimitOrderInfo(info) {
|
|
23159
|
-
const fields = getObjectFields(info);
|
|
23160
|
-
const type = getObjectType(info);
|
|
23161
|
-
if (fields && type) {
|
|
23162
|
-
try {
|
|
23163
|
-
const typeStruct = extractStructTagFromType(type);
|
|
23164
|
-
const info2 = {
|
|
23165
|
-
pay_coin_type: typeStruct.type_arguments[0],
|
|
23166
|
-
target_coin_type: typeStruct.type_arguments[1],
|
|
23167
|
-
balance: fields.balance,
|
|
23168
|
-
canceled_ts: fields.canceled_ts === "18446744073709551615" ? 0 : Number(fields.canceled_ts),
|
|
23169
|
-
id: fields.id.id,
|
|
23170
|
-
obtained_amount: fields.obtained_amount,
|
|
23171
|
-
owner: fields.owner,
|
|
23172
|
-
rate: fields.rate,
|
|
23173
|
-
expire_ts: Number(fields.expire_ts),
|
|
23174
|
-
total_pay_amount: fields.total_pay_amount,
|
|
23175
|
-
status: "Running",
|
|
23176
|
-
created_ts: Number(fields.created_ts)
|
|
23177
|
-
};
|
|
23178
|
-
if (info2.canceled_ts === 0) {
|
|
23179
|
-
info2.status = "Running";
|
|
23180
|
-
} else if (Number(info2.obtained_amount) === 0) {
|
|
23181
|
-
info2.status = "Cancelled";
|
|
23182
|
-
} else {
|
|
23183
|
-
const total_obtained_amount = d(info2.total_pay_amount).mul(1e20).div(info2.rate).toFixed(0);
|
|
23184
|
-
if (info2.obtained_amount === total_obtained_amount) {
|
|
23185
|
-
info2.status = "Completed";
|
|
23186
|
-
} else {
|
|
23187
|
-
info2.status = "Cancelled";
|
|
23188
|
-
}
|
|
23189
|
-
}
|
|
23190
|
-
return info2;
|
|
23191
|
-
} catch (error) {
|
|
23192
|
-
console.log(error);
|
|
23193
|
-
}
|
|
23194
|
-
}
|
|
23195
|
-
return void 0;
|
|
23196
|
-
}
|
|
23197
|
-
static calculateFormatRate(rate, payDecimal, targetDecimal) {
|
|
23198
|
-
const exponent = 20 + payDecimal - targetDecimal;
|
|
23199
|
-
return d(rate).mul(d(10).pow(exponent)).toString();
|
|
23200
|
-
}
|
|
23201
|
-
static calculateRate(formatRate, payDecimal, targetDecimal) {
|
|
23202
|
-
const exponent = 20 + payDecimal - targetDecimal;
|
|
23203
|
-
return Number(formatRate) / 10 ** exponent;
|
|
23204
|
-
}
|
|
23205
|
-
};
|
|
23206
23687
|
var LimitOrderModule = class {
|
|
23207
23688
|
_sdk;
|
|
23208
23689
|
_cache = {};
|
|
@@ -23259,7 +23740,7 @@ var LimitOrderModule = class {
|
|
|
23259
23740
|
if (indexer_id === void 0) {
|
|
23260
23741
|
const list = await this.getLimitOrderPoolList();
|
|
23261
23742
|
const filterInfoList = list.filter((item) => {
|
|
23262
|
-
return item.pay_coin_type === pay_coin_type && item.target_coin_type === target_coin_type;
|
|
23743
|
+
return extractStructTagFromType(item.pay_coin_type).full_address === extractStructTagFromType(pay_coin_type).full_address && extractStructTagFromType(item.target_coin_type).full_address === extractStructTagFromType(target_coin_type).full_address;
|
|
23263
23744
|
});
|
|
23264
23745
|
if (filterInfoList.length > 0) {
|
|
23265
23746
|
return filterInfoList[0].indexer_id;
|
|
@@ -23358,7 +23839,26 @@ var LimitOrderModule = class {
|
|
|
23358
23839
|
const res = await fullClient.queryTransactionBlocks({ filter: { ChangedObject: orderId }, options: { showEvents: true } });
|
|
23359
23840
|
const list = [];
|
|
23360
23841
|
res.data.forEach((item) => {
|
|
23361
|
-
list.push(...LimitOrderUtils.buildOrderLimitEvent(item));
|
|
23842
|
+
list.push(...LimitOrderUtils.buildOrderLimitEvent(item, ["OrderPlacedEvent", "OrderCanceledEvent", "FlashLoanEvent"]));
|
|
23843
|
+
});
|
|
23844
|
+
return list;
|
|
23845
|
+
} catch (error) {
|
|
23846
|
+
console.error("Error in getLimitOrderLogs:", error);
|
|
23847
|
+
return [];
|
|
23848
|
+
}
|
|
23849
|
+
}
|
|
23850
|
+
/**
|
|
23851
|
+
* 获取订单的Claim日志
|
|
23852
|
+
* @param orderId
|
|
23853
|
+
* @returns
|
|
23854
|
+
*/
|
|
23855
|
+
async getLimitOrderClaimLogs(orderId) {
|
|
23856
|
+
const { fullClient } = this._sdk.ClmmSDK;
|
|
23857
|
+
try {
|
|
23858
|
+
const res = await fullClient.queryTransactionBlocks({ filter: { ChangedObject: orderId }, options: { showEvents: true } });
|
|
23859
|
+
const list = [];
|
|
23860
|
+
res.data.forEach((item) => {
|
|
23861
|
+
list.push(...LimitOrderUtils.buildOrderLimitEvent(item, ["ClaimTargetCoinEvent"]));
|
|
23362
23862
|
});
|
|
23363
23863
|
return list;
|
|
23364
23864
|
} catch (error) {
|
|
@@ -23380,7 +23880,7 @@ var LimitOrderModule = class {
|
|
|
23380
23880
|
const { limit_order } = this._sdk.sdkOptions;
|
|
23381
23881
|
const { user_orders_indexer_id, global_config_id, rate_orders_indexer_id } = getPackagerConfigs(limit_order);
|
|
23382
23882
|
const coinAssets = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress, params.pay_coin_type);
|
|
23383
|
-
const tx = new
|
|
23883
|
+
const tx = new import_transactions23.TransactionBlock();
|
|
23384
23884
|
const indexerId = await this.getPoolIndexerId(params.pay_coin_type, params.target_coin_type);
|
|
23385
23885
|
const payCoinObj = TransactionUtil.buildCoinForAmount(tx, coinAssets, BigInt(params.pay_coin_amount), params.pay_coin_type, false, true);
|
|
23386
23886
|
tx.moveCall({
|
|
@@ -23391,13 +23891,29 @@ var LimitOrderModule = class {
|
|
|
23391
23891
|
indexerId === void 0 ? tx.object(rate_orders_indexer_id) : tx.object(indexerId),
|
|
23392
23892
|
tx.object(user_orders_indexer_id),
|
|
23393
23893
|
payCoinObj.targetCoin,
|
|
23394
|
-
tx.pure(LimitOrderUtils.
|
|
23894
|
+
tx.pure(LimitOrderUtils.priceToRate(params.price, params.pay_decimal, params.target_decimal)),
|
|
23395
23895
|
tx.pure(params.expired_ts),
|
|
23396
23896
|
tx.object(CLOCK_ADDRESS)
|
|
23397
23897
|
]
|
|
23398
23898
|
});
|
|
23399
23899
|
return tx;
|
|
23400
23900
|
}
|
|
23901
|
+
/**
|
|
23902
|
+
* claim target coin
|
|
23903
|
+
* @param params
|
|
23904
|
+
* @returns
|
|
23905
|
+
*/
|
|
23906
|
+
async claimTargetCoin(params) {
|
|
23907
|
+
const { limit_order } = this._sdk.sdkOptions;
|
|
23908
|
+
const { global_config_id } = getPackagerConfigs(limit_order);
|
|
23909
|
+
const tx = new import_transactions23.TransactionBlock();
|
|
23910
|
+
tx.moveCall({
|
|
23911
|
+
target: `${limit_order.published_at}::limit_order::claim_target_coin`,
|
|
23912
|
+
typeArguments: [params.pay_coin_type, params.target_coin_type],
|
|
23913
|
+
arguments: [tx.object(global_config_id), tx.pure(params.order_id)]
|
|
23914
|
+
});
|
|
23915
|
+
return tx;
|
|
23916
|
+
}
|
|
23401
23917
|
/**
|
|
23402
23918
|
* 取消订单
|
|
23403
23919
|
* @param payCoinType
|
|
@@ -23407,16 +23923,26 @@ var LimitOrderModule = class {
|
|
|
23407
23923
|
async cancelOrdersByOwner(params) {
|
|
23408
23924
|
const { limit_order } = this._sdk.sdkOptions;
|
|
23409
23925
|
const { global_config_id } = getPackagerConfigs(limit_order);
|
|
23410
|
-
const tx = new
|
|
23411
|
-
const
|
|
23412
|
-
|
|
23413
|
-
|
|
23926
|
+
const tx = new import_transactions23.TransactionBlock();
|
|
23927
|
+
const indexerIdMap = {};
|
|
23928
|
+
for (let index = 0; index < params.length; index++) {
|
|
23929
|
+
const element = params[index];
|
|
23930
|
+
const indexerId = await this.getPoolIndexerId(element.pay_coin_type, element.target_coin_type);
|
|
23931
|
+
if (indexerId === void 0) {
|
|
23932
|
+
throw Error("not found indexerId");
|
|
23933
|
+
}
|
|
23934
|
+
indexerIdMap[element.order_id] = indexerId;
|
|
23414
23935
|
}
|
|
23415
|
-
params.
|
|
23936
|
+
params.forEach((item) => {
|
|
23416
23937
|
tx.moveCall({
|
|
23417
23938
|
target: `${limit_order.published_at}::limit_order::cancel_order_by_owner`,
|
|
23418
|
-
typeArguments: [
|
|
23419
|
-
arguments: [
|
|
23939
|
+
typeArguments: [item.pay_coin_type, item.target_coin_type],
|
|
23940
|
+
arguments: [
|
|
23941
|
+
tx.object(global_config_id),
|
|
23942
|
+
tx.object(indexerIdMap[item.order_id]),
|
|
23943
|
+
tx.object(item.order_id),
|
|
23944
|
+
tx.object(CLOCK_ADDRESS)
|
|
23945
|
+
]
|
|
23420
23946
|
});
|
|
23421
23947
|
});
|
|
23422
23948
|
return tx;
|
|
@@ -23426,7 +23952,7 @@ var LimitOrderModule = class {
|
|
|
23426
23952
|
const { limit_order } = this._sdk.sdkOptions;
|
|
23427
23953
|
let userIndexerHandle = this.getUserIndexerHandleByCache(ownerAddress);
|
|
23428
23954
|
if (userIndexerHandle === void 0) {
|
|
23429
|
-
const tx = new
|
|
23955
|
+
const tx = new import_transactions23.TransactionBlock();
|
|
23430
23956
|
tx.moveCall({
|
|
23431
23957
|
target: `${limit_order.published_at}::limit_order::get_orders_indexer_by_owner`,
|
|
23432
23958
|
typeArguments: [],
|
|
@@ -23721,7 +24247,7 @@ var FarmsModule = class {
|
|
|
23721
24247
|
*/
|
|
23722
24248
|
async calculateFarmingRewards(params, useDevInspect = true) {
|
|
23723
24249
|
const { frams } = this._sdk.sdkOptions;
|
|
23724
|
-
const tx = new
|
|
24250
|
+
const tx = new import_transactions24.TransactionBlock();
|
|
23725
24251
|
const { rewarder_manager_id, global_config_id } = getPackagerConfigs(frams);
|
|
23726
24252
|
params.forEach((item) => {
|
|
23727
24253
|
tx.moveCall({
|
|
@@ -23768,7 +24294,7 @@ var FarmsModule = class {
|
|
|
23768
24294
|
*/
|
|
23769
24295
|
depositPayload(params, tx) {
|
|
23770
24296
|
const { frams } = this.sdk.sdkOptions;
|
|
23771
|
-
tx = tx || new
|
|
24297
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
23772
24298
|
const { global_config_id, rewarder_manager_id } = getPackagerConfigs(frams);
|
|
23773
24299
|
tx.moveCall({
|
|
23774
24300
|
target: `${frams.published_at}::router::deposit`,
|
|
@@ -23791,7 +24317,7 @@ var FarmsModule = class {
|
|
|
23791
24317
|
async withdrawPayload(params, tx) {
|
|
23792
24318
|
const { frams } = this.sdk.sdkOptions;
|
|
23793
24319
|
const { global_config_id, rewarder_manager_id } = getPackagerConfigs(frams);
|
|
23794
|
-
tx = tx || new
|
|
24320
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
23795
24321
|
tx = await this.harvestPayload(
|
|
23796
24322
|
{
|
|
23797
24323
|
pool_id: params.pool_id,
|
|
@@ -23818,12 +24344,151 @@ var FarmsModule = class {
|
|
|
23818
24344
|
* @returns
|
|
23819
24345
|
*/
|
|
23820
24346
|
async batchHarvestPayload(paramss, tx) {
|
|
23821
|
-
tx = tx || new
|
|
24347
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
23822
24348
|
for (const params of paramss) {
|
|
23823
24349
|
await this.harvestPayload(params, tx);
|
|
23824
24350
|
}
|
|
23825
24351
|
return tx;
|
|
23826
24352
|
}
|
|
24353
|
+
/**
|
|
24354
|
+
* 批量收割Frams奖励 和 clmm 奖励
|
|
24355
|
+
* @param paramss
|
|
24356
|
+
* @returns
|
|
24357
|
+
*/
|
|
24358
|
+
async batchHarvestAndClmmFeePayload(framsList, clmmList, published_at) {
|
|
24359
|
+
if (!checkInvalidSuiAddress(this._sdk.ClmmSDK.senderAddress)) {
|
|
24360
|
+
throw new Error("this config sdk senderAddress is not set right");
|
|
24361
|
+
}
|
|
24362
|
+
const tx = new import_transactions24.TransactionBlock();
|
|
24363
|
+
const coinIdMaps = {};
|
|
24364
|
+
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress, null);
|
|
24365
|
+
for (const item of clmmList) {
|
|
24366
|
+
this.collectClmmFeeInternal(item, coinIdMaps, tx, allCoinAsset, published_at);
|
|
24367
|
+
this.collectClmmRewardInternal(item, coinIdMaps, tx, allCoinAsset, published_at);
|
|
24368
|
+
}
|
|
24369
|
+
const { frams } = this.sdk.sdkOptions;
|
|
24370
|
+
const { global_config_id, rewarder_manager_id } = getPackagerConfigs(frams);
|
|
24371
|
+
for (const item of framsList) {
|
|
24372
|
+
const framsPool = await this.getFramsPool(item.pool_id, false);
|
|
24373
|
+
if (framsPool === void 0) {
|
|
24374
|
+
throw Error(`not found ${item.pool_id}`);
|
|
24375
|
+
}
|
|
24376
|
+
if (item.collect_fee) {
|
|
24377
|
+
this.collectFeeInternal(item, coinIdMaps, tx, allCoinAsset, published_at);
|
|
24378
|
+
}
|
|
24379
|
+
if (item.clmm_rewarder_types.length > 0) {
|
|
24380
|
+
await this.collectRewardInternal(item, coinIdMaps, tx, allCoinAsset, published_at);
|
|
24381
|
+
}
|
|
24382
|
+
if (item.collect_frams_rewarder) {
|
|
24383
|
+
framsPool.rewarders.forEach((rewardCoin) => {
|
|
24384
|
+
if (tx) {
|
|
24385
|
+
tx.moveCall({
|
|
24386
|
+
target: `${frams.published_at}::router::harvest`,
|
|
24387
|
+
typeArguments: [rewardCoin.reward_coin],
|
|
24388
|
+
arguments: [
|
|
24389
|
+
tx.object(global_config_id),
|
|
24390
|
+
tx.object(rewarder_manager_id),
|
|
24391
|
+
tx.object(item.pool_id),
|
|
24392
|
+
tx.object(item.position_nft_id),
|
|
24393
|
+
tx.object(CLOCK_ADDRESS)
|
|
24394
|
+
]
|
|
24395
|
+
});
|
|
24396
|
+
}
|
|
24397
|
+
});
|
|
24398
|
+
}
|
|
24399
|
+
}
|
|
24400
|
+
Object.keys(coinIdMaps).forEach((key) => {
|
|
24401
|
+
const value = coinIdMaps[key];
|
|
24402
|
+
if (value.isMintZeroCoin || value.originalSplitedCoin && value.originalSplitedCoin.kind === "GasCoin") {
|
|
24403
|
+
TransactionUtil.buildTransferCoin(this._sdk.ClmmSDK, tx, value.targetCoin, key, this._sdk.ClmmSDK.senderAddress);
|
|
24404
|
+
}
|
|
24405
|
+
});
|
|
24406
|
+
return tx;
|
|
24407
|
+
}
|
|
24408
|
+
async collectRewardInternal(item, coinIdMaps, tx, allCoinAsset, published_at) {
|
|
24409
|
+
const primaryCoinInputs = [];
|
|
24410
|
+
item.clmm_rewarder_types.forEach((type) => {
|
|
24411
|
+
const coinType = normalizeCoinType(type);
|
|
24412
|
+
let coinInput = coinIdMaps[type];
|
|
24413
|
+
if (coinInput === void 0) {
|
|
24414
|
+
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false);
|
|
24415
|
+
coinIdMaps[coinType] = coinInput;
|
|
24416
|
+
}
|
|
24417
|
+
primaryCoinInputs.push(coinInput.targetCoin);
|
|
24418
|
+
});
|
|
24419
|
+
await this.collectClmmRewardNoSendPayload(item, published_at, tx);
|
|
24420
|
+
}
|
|
24421
|
+
collectFeeInternal(item, coinIdMaps, tx, allCoinAsset, published_at) {
|
|
24422
|
+
const { frams } = this.sdk.sdkOptions;
|
|
24423
|
+
const { global_config_id } = getPackagerConfigs(frams);
|
|
24424
|
+
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24425
|
+
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
24426
|
+
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
24427
|
+
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
24428
|
+
let coinAInput = coinIdMaps[coinTypeA];
|
|
24429
|
+
if (coinAInput === void 0) {
|
|
24430
|
+
coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false);
|
|
24431
|
+
coinIdMaps[coinTypeA] = coinAInput;
|
|
24432
|
+
}
|
|
24433
|
+
let coinBInput = coinIdMaps[coinTypeB];
|
|
24434
|
+
if (coinBInput === void 0) {
|
|
24435
|
+
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false);
|
|
24436
|
+
coinIdMaps[coinTypeB] = coinBInput;
|
|
24437
|
+
}
|
|
24438
|
+
tx.moveCall({
|
|
24439
|
+
target: `${published_at}::stable_farming::collect_fee`,
|
|
24440
|
+
typeArguments: [item.coinTypeA, item.coinTypeB],
|
|
24441
|
+
arguments: [
|
|
24442
|
+
tx.object(global_config_id),
|
|
24443
|
+
tx.object(clmmConfig.global_config_id),
|
|
24444
|
+
tx.object(item.clmm_pool_id),
|
|
24445
|
+
tx.object(item.position_nft_id),
|
|
24446
|
+
coinAInput.targetCoin,
|
|
24447
|
+
coinBInput.targetCoin
|
|
24448
|
+
]
|
|
24449
|
+
});
|
|
24450
|
+
}
|
|
24451
|
+
collectClmmRewardInternal(item, coinIdMaps, tx, allCoinAsset, published_at) {
|
|
24452
|
+
const primaryCoinInputs = [];
|
|
24453
|
+
item.rewarder_coin_types.forEach((type) => {
|
|
24454
|
+
const coinType = normalizeCoinType(type);
|
|
24455
|
+
let coinInput = coinIdMaps[type];
|
|
24456
|
+
if (coinInput === void 0) {
|
|
24457
|
+
coinInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinType, false);
|
|
24458
|
+
coinIdMaps[coinType] = coinInput;
|
|
24459
|
+
}
|
|
24460
|
+
primaryCoinInputs.push(coinInput.targetCoin);
|
|
24461
|
+
});
|
|
24462
|
+
this._sdk.ClmmSDK.Rewarder.createCollectRewarderNoSendPaylod(item, published_at, tx, primaryCoinInputs);
|
|
24463
|
+
}
|
|
24464
|
+
collectClmmFeeInternal(item, coinIdMaps, tx, allCoinAsset, published_at) {
|
|
24465
|
+
if (item.collect_fee) {
|
|
24466
|
+
const coinTypeA = normalizeCoinType(item.coinTypeA);
|
|
24467
|
+
const coinTypeB = normalizeCoinType(item.coinTypeB);
|
|
24468
|
+
let coinAInput = coinIdMaps[coinTypeA];
|
|
24469
|
+
if (coinAInput === void 0) {
|
|
24470
|
+
coinAInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeA, false);
|
|
24471
|
+
coinIdMaps[coinTypeA] = coinAInput;
|
|
24472
|
+
}
|
|
24473
|
+
let coinBInput = coinIdMaps[coinTypeB];
|
|
24474
|
+
if (coinBInput === void 0) {
|
|
24475
|
+
coinBInput = TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), coinTypeB, false);
|
|
24476
|
+
coinIdMaps[coinTypeB] = coinBInput;
|
|
24477
|
+
}
|
|
24478
|
+
this._sdk.ClmmSDK.Position.createCollectFeeNoSendPaylod(
|
|
24479
|
+
{
|
|
24480
|
+
pool_id: item.pool_id,
|
|
24481
|
+
pos_id: item.pos_id,
|
|
24482
|
+
coinTypeA: item.coinTypeA,
|
|
24483
|
+
coinTypeB: item.coinTypeB
|
|
24484
|
+
},
|
|
24485
|
+
published_at,
|
|
24486
|
+
tx,
|
|
24487
|
+
coinAInput.targetCoin,
|
|
24488
|
+
coinBInput.targetCoin
|
|
24489
|
+
);
|
|
24490
|
+
}
|
|
24491
|
+
}
|
|
23827
24492
|
/**
|
|
23828
24493
|
* 收割Frams奖励
|
|
23829
24494
|
* @param paramss
|
|
@@ -23831,7 +24496,7 @@ var FarmsModule = class {
|
|
|
23831
24496
|
*/
|
|
23832
24497
|
async harvestPayload(params, tx) {
|
|
23833
24498
|
const { frams } = this.sdk.sdkOptions;
|
|
23834
|
-
tx = tx || new
|
|
24499
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
23835
24500
|
const framsPool = await this.getFramsPool(params.pool_id, false);
|
|
23836
24501
|
if (framsPool === void 0) {
|
|
23837
24502
|
throw Error(`not found ${params.pool_id}`);
|
|
@@ -23873,7 +24538,7 @@ var FarmsModule = class {
|
|
|
23873
24538
|
return tx;
|
|
23874
24539
|
}
|
|
23875
24540
|
async claimFeeAndClmmReward(params) {
|
|
23876
|
-
const tx = new
|
|
24541
|
+
const tx = new import_transactions24.TransactionBlock();
|
|
23877
24542
|
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress);
|
|
23878
24543
|
await this.buildCollectRewarderAndFeeParams(
|
|
23879
24544
|
{
|
|
@@ -23894,7 +24559,7 @@ var FarmsModule = class {
|
|
|
23894
24559
|
* @param params
|
|
23895
24560
|
*/
|
|
23896
24561
|
async openPositionAddLiquidityStakePaylod(params) {
|
|
23897
|
-
const tx = new
|
|
24562
|
+
const tx = new import_transactions24.TransactionBlock();
|
|
23898
24563
|
const { clmm_pool, integrate } = this._sdk.ClmmSDK.sdkOptions;
|
|
23899
24564
|
const clmmPoolConfig = getPackagerConfigs(clmm_pool);
|
|
23900
24565
|
const posId = tx.moveCall({
|
|
@@ -23943,7 +24608,7 @@ var FarmsModule = class {
|
|
|
23943
24608
|
async addLiquidityPayload(params, tx) {
|
|
23944
24609
|
const { frams } = this.sdk.sdkOptions;
|
|
23945
24610
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
23946
|
-
tx = tx || new
|
|
24611
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
23947
24612
|
const framsConfig = getPackagerConfigs(frams);
|
|
23948
24613
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
23949
24614
|
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress);
|
|
@@ -24005,7 +24670,7 @@ var FarmsModule = class {
|
|
|
24005
24670
|
async addLiquidityFixCoinPayload(params, tx) {
|
|
24006
24671
|
const { frams } = this.sdk.sdkOptions;
|
|
24007
24672
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24008
|
-
tx = tx || new
|
|
24673
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
24009
24674
|
const framsConfig = getPackagerConfigs(frams);
|
|
24010
24675
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
24011
24676
|
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress);
|
|
@@ -24067,7 +24732,7 @@ var FarmsModule = class {
|
|
|
24067
24732
|
async removeLiquidityPayload(params, tx) {
|
|
24068
24733
|
const { frams } = this.sdk.sdkOptions;
|
|
24069
24734
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24070
|
-
tx = tx || new
|
|
24735
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
24071
24736
|
const framsConfig = getPackagerConfigs(frams);
|
|
24072
24737
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
24073
24738
|
if (params.collect_rewarder && (!params.unstake || params.close_position)) {
|
|
@@ -24199,7 +24864,7 @@ var FarmsModule = class {
|
|
|
24199
24864
|
collectFeePayload(params, tx) {
|
|
24200
24865
|
const { frams } = this.sdk.sdkOptions;
|
|
24201
24866
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24202
|
-
tx = tx || new
|
|
24867
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
24203
24868
|
const framsConfig = getPackagerConfigs(frams);
|
|
24204
24869
|
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
24205
24870
|
tx.moveCall({
|
|
@@ -24225,7 +24890,7 @@ var FarmsModule = class {
|
|
|
24225
24890
|
async collectClmmRewardPayload(paramss, tx) {
|
|
24226
24891
|
const { frams } = this.sdk.sdkOptions;
|
|
24227
24892
|
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24228
|
-
tx = tx || new
|
|
24893
|
+
tx = tx || new import_transactions24.TransactionBlock();
|
|
24229
24894
|
let primaryCoinInputs = paramss.reward_coins;
|
|
24230
24895
|
if (paramss.clmm_rewarder_types.length > 0 && primaryCoinInputs === void 0) {
|
|
24231
24896
|
primaryCoinInputs = [];
|
|
@@ -24255,6 +24920,38 @@ var FarmsModule = class {
|
|
|
24255
24920
|
});
|
|
24256
24921
|
return tx;
|
|
24257
24922
|
}
|
|
24923
|
+
async collectClmmRewardNoSendPayload(paramss, published_at, tx) {
|
|
24924
|
+
const { frams } = this.sdk.sdkOptions;
|
|
24925
|
+
const { clmm_pool } = this.sdk.ClmmSDK.sdkOptions;
|
|
24926
|
+
let primaryCoinInputs = paramss.reward_coins;
|
|
24927
|
+
if (paramss.clmm_rewarder_types.length > 0 && primaryCoinInputs === void 0) {
|
|
24928
|
+
primaryCoinInputs = [];
|
|
24929
|
+
const allCoinAsset = await this._sdk.ClmmSDK.getOwnerCoinAssets(this._sdk.ClmmSDK.senderAddress);
|
|
24930
|
+
paramss.clmm_rewarder_types.forEach((type) => {
|
|
24931
|
+
primaryCoinInputs.push(TransactionUtil.buildCoinForAmount(tx, allCoinAsset, BigInt(0), type, false).targetCoin);
|
|
24932
|
+
});
|
|
24933
|
+
}
|
|
24934
|
+
const framsConfig = getPackagerConfigs(frams);
|
|
24935
|
+
const clmmConfig = getPackagerConfigs(clmm_pool);
|
|
24936
|
+
paramss.clmm_rewarder_types?.forEach((type, index) => {
|
|
24937
|
+
if (tx) {
|
|
24938
|
+
tx.moveCall({
|
|
24939
|
+
target: `${published_at}::stable_farming::collect_clmm_reward`,
|
|
24940
|
+
typeArguments: [type, paramss.coinTypeA, paramss.coinTypeB],
|
|
24941
|
+
arguments: [
|
|
24942
|
+
tx.object(framsConfig.global_config_id),
|
|
24943
|
+
tx.object(clmmConfig.global_config_id),
|
|
24944
|
+
tx.object(paramss.clmm_pool_id),
|
|
24945
|
+
tx.object(paramss.position_nft_id),
|
|
24946
|
+
tx.object(clmmConfig.global_vault_id),
|
|
24947
|
+
primaryCoinInputs[index],
|
|
24948
|
+
tx.object(CLOCK_ADDRESS)
|
|
24949
|
+
]
|
|
24950
|
+
});
|
|
24951
|
+
}
|
|
24952
|
+
});
|
|
24953
|
+
return tx;
|
|
24954
|
+
}
|
|
24258
24955
|
async getFrarmsConfigs() {
|
|
24259
24956
|
const { package_id } = this._sdk.sdkOptions.frams;
|
|
24260
24957
|
const config2 = {
|
|
@@ -24404,7 +25101,7 @@ var import_sui3_utils16 = require("@msafe/sui3-utils");
|
|
|
24404
25101
|
var import_sui3_utils17 = require("@msafe/sui3-utils");
|
|
24405
25102
|
var import_sui3_utils18 = require("@msafe/sui3-utils");
|
|
24406
25103
|
var import_sui3_utils19 = require("@msafe/sui3-utils");
|
|
24407
|
-
var
|
|
25104
|
+
var import_transactions28 = require("@mysten/sui.js/transactions");
|
|
24408
25105
|
var import_sui3_utils20 = require("@msafe/sui3-utils");
|
|
24409
25106
|
var import_sui3_utils21 = require("@msafe/sui3-utils");
|
|
24410
25107
|
var import_sui3_utils22 = require("@msafe/sui3-utils");
|
|
@@ -24412,15 +25109,15 @@ var import_sui3_utils23 = require("@msafe/sui3-utils");
|
|
|
24412
25109
|
var import_sui3_utils24 = require("@msafe/sui3-utils");
|
|
24413
25110
|
var import_sui3_utils25 = require("@msafe/sui3-utils");
|
|
24414
25111
|
var import_client3 = require("@mysten/sui.js/client");
|
|
24415
|
-
var
|
|
24416
|
-
var import_utils20 = require("@mysten/sui.js/utils");
|
|
24417
|
-
var import_transactions25 = require("@mysten/sui.js/transactions");
|
|
24418
|
-
var import_transactions26 = require("@mysten/sui.js/transactions");
|
|
24419
|
-
var import_utils21 = require("@mysten/sui.js/utils");
|
|
24420
|
-
var import_buffer = require("buffer");
|
|
25112
|
+
var import_axios2 = __toESM(require("axios"), 1);
|
|
24421
25113
|
var import_utils22 = require("@mysten/sui.js/utils");
|
|
24422
|
-
var
|
|
25114
|
+
var import_transactions29 = require("@mysten/sui.js/transactions");
|
|
25115
|
+
var import_transactions30 = require("@mysten/sui.js/transactions");
|
|
24423
25116
|
var import_utils23 = require("@mysten/sui.js/utils");
|
|
25117
|
+
var import_buffer = require("buffer");
|
|
25118
|
+
var import_utils24 = require("@mysten/sui.js/utils");
|
|
25119
|
+
var import_bcs6 = require("@mysten/sui.js/bcs");
|
|
25120
|
+
var import_utils25 = require("@mysten/sui.js/utils");
|
|
24424
25121
|
|
|
24425
25122
|
// node_modules/nanoid/index.browser.js
|
|
24426
25123
|
var nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => {
|
|
@@ -24438,9 +25135,9 @@ var nanoid = (size = 21) => crypto.getRandomValues(new Uint8Array(size)).reduce(
|
|
|
24438
25135
|
}, "");
|
|
24439
25136
|
|
|
24440
25137
|
// node_modules/@msafe/sui-app-store/dist/index.mjs
|
|
24441
|
-
var
|
|
24442
|
-
var
|
|
24443
|
-
var
|
|
25138
|
+
var import_transactions31 = require("@mysten/sui.js/transactions");
|
|
25139
|
+
var import_transactions32 = require("@mysten/sui.js/transactions");
|
|
25140
|
+
var import_utils26 = require("@mysten/sui.js/utils");
|
|
24444
25141
|
|
|
24445
25142
|
// node_modules/luxon/src/errors.js
|
|
24446
25143
|
var LuxonError = class extends Error {
|
|
@@ -30664,39 +31361,39 @@ function friendlyDateTime(dateTimeish) {
|
|
|
30664
31361
|
}
|
|
30665
31362
|
|
|
30666
31363
|
// node_modules/@msafe/sui-app-store/dist/index.mjs
|
|
30667
|
-
var
|
|
30668
|
-
var
|
|
31364
|
+
var import_utils27 = require("@mysten/sui.js/utils");
|
|
31365
|
+
var import_utils28 = require("@mysten/sui.js/utils");
|
|
30669
31366
|
var import_sort_keys_recursive2 = __toESM(require_sort_keys_recursive(), 1);
|
|
30670
31367
|
var import_sui3_utils26 = require("@msafe/sui3-utils");
|
|
30671
31368
|
var import_sui3_utils27 = require("@msafe/sui3-utils");
|
|
30672
31369
|
var import_sui3_utils28 = require("@msafe/sui3-utils");
|
|
30673
|
-
var
|
|
30674
|
-
var
|
|
31370
|
+
var import_bcs7 = require("@mysten/sui.js/bcs");
|
|
31371
|
+
var import_utils29 = require("@mysten/sui.js/utils");
|
|
30675
31372
|
var import_sui3_utils29 = require("@msafe/sui3-utils");
|
|
30676
31373
|
var import_sui3_utils30 = require("@msafe/sui3-utils");
|
|
30677
31374
|
var import_sui3_utils31 = require("@msafe/sui3-utils");
|
|
30678
31375
|
var import_sui3_utils32 = require("@msafe/sui3-utils");
|
|
30679
31376
|
var import_sui3_utils33 = require("@msafe/sui3-utils");
|
|
30680
|
-
var
|
|
31377
|
+
var import_transactions33 = require("@mysten/sui.js/transactions");
|
|
30681
31378
|
var import_sui3_utils34 = require("@msafe/sui3-utils");
|
|
30682
31379
|
var import_sui3_utils35 = require("@msafe/sui3-utils");
|
|
30683
|
-
var
|
|
30684
|
-
var
|
|
30685
|
-
var import_transactions30 = require("@mysten/sui.js/transactions");
|
|
30686
|
-
var import_transactions31 = require("@mysten/sui.js/transactions");
|
|
30687
|
-
var import_transactions32 = require("@mysten/sui.js/transactions");
|
|
30688
|
-
var import_transactions33 = require("@mysten/sui.js/transactions");
|
|
31380
|
+
var import_bcs8 = require("@mysten/sui.js/bcs");
|
|
31381
|
+
var import_utils30 = require("@mysten/sui.js/utils");
|
|
30689
31382
|
var import_transactions34 = require("@mysten/sui.js/transactions");
|
|
30690
|
-
var import_sui3_utils36 = require("@msafe/sui3-utils");
|
|
30691
31383
|
var import_transactions35 = require("@mysten/sui.js/transactions");
|
|
30692
|
-
var
|
|
31384
|
+
var import_transactions36 = require("@mysten/sui.js/transactions");
|
|
31385
|
+
var import_transactions37 = require("@mysten/sui.js/transactions");
|
|
31386
|
+
var import_transactions38 = require("@mysten/sui.js/transactions");
|
|
31387
|
+
var import_sui3_utils36 = require("@msafe/sui3-utils");
|
|
31388
|
+
var import_transactions39 = require("@mysten/sui.js/transactions");
|
|
31389
|
+
var import_utils31 = require("@mysten/sui.js/utils");
|
|
30693
31390
|
var import_sort_keys_recursive3 = __toESM(require_sort_keys_recursive(), 1);
|
|
30694
31391
|
var import_sui3_utils37 = require("@msafe/sui3-utils");
|
|
30695
31392
|
var import_sui3_utils38 = require("@msafe/sui3-utils");
|
|
30696
|
-
var
|
|
30697
|
-
var
|
|
30698
|
-
var
|
|
30699
|
-
var
|
|
31393
|
+
var import_bcs9 = require("@mysten/sui.js/bcs");
|
|
31394
|
+
var import_utils32 = require("@mysten/sui.js/utils");
|
|
31395
|
+
var import_transactions40 = require("@mysten/sui.js/transactions");
|
|
31396
|
+
var import_utils33 = require("@mysten/sui.js/utils");
|
|
30700
31397
|
|
|
30701
31398
|
// node_modules/bignumber.js/bignumber.mjs
|
|
30702
31399
|
var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
|
|
@@ -32173,22 +32870,22 @@ var BigNumber = clone4();
|
|
|
32173
32870
|
var bignumber_default = BigNumber;
|
|
32174
32871
|
|
|
32175
32872
|
// node_modules/@msafe/sui-app-store/dist/index.mjs
|
|
32176
|
-
var
|
|
32177
|
-
var import_utils32 = require("@mysten/sui.js/utils");
|
|
32178
|
-
var import_utils33 = require("@mysten/sui.js/utils");
|
|
32873
|
+
var import_transactions41 = require("@mysten/sui.js/transactions");
|
|
32179
32874
|
var import_utils34 = require("@mysten/sui.js/utils");
|
|
32180
|
-
var import_transactions38 = require("@mysten/sui.js/transactions");
|
|
32181
32875
|
var import_utils35 = require("@mysten/sui.js/utils");
|
|
32182
|
-
var import_transactions39 = require("@mysten/sui.js/transactions");
|
|
32183
32876
|
var import_utils36 = require("@mysten/sui.js/utils");
|
|
32877
|
+
var import_transactions42 = require("@mysten/sui.js/transactions");
|
|
32184
32878
|
var import_utils37 = require("@mysten/sui.js/utils");
|
|
32879
|
+
var import_transactions43 = require("@mysten/sui.js/transactions");
|
|
32185
32880
|
var import_utils38 = require("@mysten/sui.js/utils");
|
|
32186
32881
|
var import_utils39 = require("@mysten/sui.js/utils");
|
|
32187
|
-
var import_axios2 = __toESM(require("axios"), 1);
|
|
32188
|
-
var import_bcs8 = require("@mysten/sui.js/bcs");
|
|
32189
32882
|
var import_utils40 = require("@mysten/sui.js/utils");
|
|
32190
32883
|
var import_utils41 = require("@mysten/sui.js/utils");
|
|
32884
|
+
var import_axios3 = __toESM(require("axios"), 1);
|
|
32885
|
+
var import_bcs10 = require("@mysten/sui.js/bcs");
|
|
32191
32886
|
var import_utils42 = require("@mysten/sui.js/utils");
|
|
32887
|
+
var import_utils43 = require("@mysten/sui.js/utils");
|
|
32888
|
+
var import_utils44 = require("@mysten/sui.js/utils");
|
|
32192
32889
|
var import_sui3_utils39 = require("@msafe/sui3-utils");
|
|
32193
32890
|
|
|
32194
32891
|
// node_modules/turbos-clmm-sdk/dist/esm/index.js
|
|
@@ -36089,17 +36786,17 @@ var LRUCache = class _LRUCache {
|
|
|
36089
36786
|
// node_modules/turbos-clmm-sdk/dist/esm/index.js
|
|
36090
36787
|
var import_bn26 = __toESM(require_bn(), 1);
|
|
36091
36788
|
var import_jsbi = __toESM(require_jsbi_umd(), 1);
|
|
36092
|
-
var
|
|
36093
|
-
var
|
|
36789
|
+
var import_utils19 = require("@mysten/sui.js/utils");
|
|
36790
|
+
var import_transactions25 = require("@mysten/sui.js/transactions");
|
|
36094
36791
|
var import_bn27 = __toESM(require_bn(), 1);
|
|
36095
|
-
var
|
|
36792
|
+
var import_transactions26 = require("@mysten/sui.js/transactions");
|
|
36096
36793
|
var import_bn28 = __toESM(require_bn(), 1);
|
|
36097
36794
|
var import_bn29 = __toESM(require_bn(), 1);
|
|
36098
36795
|
var import_bn30 = __toESM(require_bn(), 1);
|
|
36099
36796
|
var import_bn31 = __toESM(require_bn(), 1);
|
|
36100
|
-
var
|
|
36101
|
-
var
|
|
36102
|
-
var
|
|
36797
|
+
var import_utils20 = require("@mysten/sui.js/utils");
|
|
36798
|
+
var import_transactions27 = require("@mysten/sui.js/transactions");
|
|
36799
|
+
var import_utils21 = require("@mysten/sui.js/utils");
|
|
36103
36800
|
var import_bn32 = __toESM(require_bn(), 1);
|
|
36104
36801
|
var __defProp3 = Object.defineProperty;
|
|
36105
36802
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -36699,7 +37396,7 @@ var Pool = class extends Base {
|
|
|
36699
37396
|
this.coin.selectTradeCoins(address, coinTypeA, amountA),
|
|
36700
37397
|
this.coin.selectTradeCoins(address, coinTypeB, amountB)
|
|
36701
37398
|
]);
|
|
36702
|
-
const txb = options.txb || new
|
|
37399
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36703
37400
|
const coinAObjects = coinIdsA.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsA, coinTypeA, amountA) : [this.coin.zero(coinTypeA, txb)];
|
|
36704
37401
|
const coinBObjects = coinIdsB.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsB, coinTypeB, amountB) : [this.coin.zero(coinTypeB, txb)];
|
|
36705
37402
|
txb.moveCall({
|
|
@@ -36738,7 +37435,7 @@ var Pool = class extends Base {
|
|
|
36738
37435
|
// deadline
|
|
36739
37436
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE), "u64"),
|
|
36740
37437
|
// clock
|
|
36741
|
-
txb.object(
|
|
37438
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36742
37439
|
// versioned
|
|
36743
37440
|
txb.object(contract.Versioned)
|
|
36744
37441
|
]
|
|
@@ -36762,7 +37459,7 @@ var Pool = class extends Base {
|
|
|
36762
37459
|
this.coin.selectTradeCoins(address, coinTypeA, amountA),
|
|
36763
37460
|
this.coin.selectTradeCoins(address, coinTypeB, amountB)
|
|
36764
37461
|
]);
|
|
36765
|
-
const txb = options.txb || new
|
|
37462
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36766
37463
|
const coinAObjects = coinIdsA.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsA, coinTypeA, amountA) : [this.coin.zero(coinTypeA, txb)];
|
|
36767
37464
|
const coinBObjects = coinIdsB.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsB, coinTypeB, amountB) : [this.coin.zero(coinTypeB, txb)];
|
|
36768
37465
|
txb.moveCall({
|
|
@@ -36797,7 +37494,7 @@ var Pool = class extends Base {
|
|
|
36797
37494
|
// deadline
|
|
36798
37495
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE), "u64"),
|
|
36799
37496
|
// clock
|
|
36800
|
-
txb.object(
|
|
37497
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36801
37498
|
// versioned
|
|
36802
37499
|
txb.object(contract.Versioned)
|
|
36803
37500
|
]
|
|
@@ -36815,7 +37512,7 @@ var Pool = class extends Base {
|
|
|
36815
37512
|
this.coin.selectTradeCoins(address, coinTypeA, amountA),
|
|
36816
37513
|
this.coin.selectTradeCoins(address, coinTypeB, amountB)
|
|
36817
37514
|
]);
|
|
36818
|
-
const txb = options.txb || new
|
|
37515
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36819
37516
|
const coinAObjects = coinIdsA.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsA, coinTypeA, amountA) : [this.coin.zero(coinTypeA, txb)];
|
|
36820
37517
|
const coinBObjects = coinIdsB.length > 0 ? this.coin.convertTradeCoins(txb, coinIdsB, coinTypeB, amountB) : [this.coin.zero(coinTypeB, txb)];
|
|
36821
37518
|
txb.moveCall({
|
|
@@ -36844,7 +37541,7 @@ var Pool = class extends Base {
|
|
|
36844
37541
|
// deadline
|
|
36845
37542
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE * 3), "u64"),
|
|
36846
37543
|
// clock
|
|
36847
|
-
txb.object(
|
|
37544
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36848
37545
|
// versioned
|
|
36849
37546
|
txb.object(contract.Versioned)
|
|
36850
37547
|
]
|
|
@@ -36857,7 +37554,7 @@ var Pool = class extends Base {
|
|
|
36857
37554
|
const amountB = new decimal_default(options.amountB);
|
|
36858
37555
|
const contract = await this.contract.getConfig();
|
|
36859
37556
|
const typeArguments = await this.getPoolTypeArguments(pool);
|
|
36860
|
-
const txb = options.txb || new
|
|
37557
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36861
37558
|
txb.moveCall({
|
|
36862
37559
|
target: `${contract.PackageId}::position_manager::decrease_liquidity`,
|
|
36863
37560
|
typeArguments,
|
|
@@ -36876,7 +37573,7 @@ var Pool = class extends Base {
|
|
|
36876
37573
|
// deadline
|
|
36877
37574
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE * 3), "u64"),
|
|
36878
37575
|
// clock
|
|
36879
|
-
txb.object(
|
|
37576
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36880
37577
|
// versioned
|
|
36881
37578
|
txb.object(contract.Versioned)
|
|
36882
37579
|
]
|
|
@@ -36898,7 +37595,7 @@ var Pool = class extends Base {
|
|
|
36898
37595
|
collectAmountA: amountAMax,
|
|
36899
37596
|
collectAmountB: amountBMax
|
|
36900
37597
|
} = options;
|
|
36901
|
-
const txb = options.txb || new
|
|
37598
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36902
37599
|
if (Number(amountAMax) === 0 && Number(amountBMax) === 0) {
|
|
36903
37600
|
return txb;
|
|
36904
37601
|
}
|
|
@@ -36920,7 +37617,7 @@ var Pool = class extends Base {
|
|
|
36920
37617
|
// deadline
|
|
36921
37618
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE * 3), "u64"),
|
|
36922
37619
|
// clock
|
|
36923
|
-
txb.object(
|
|
37620
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36924
37621
|
txb.object(contract.Versioned)
|
|
36925
37622
|
]
|
|
36926
37623
|
});
|
|
@@ -36928,7 +37625,7 @@ var Pool = class extends Base {
|
|
|
36928
37625
|
}
|
|
36929
37626
|
async collectReward(options) {
|
|
36930
37627
|
const { pool: poolId, nft, rewardAmounts, address } = options;
|
|
36931
|
-
const txb = options.txb || new
|
|
37628
|
+
const txb = options.txb || new import_transactions25.TransactionBlock();
|
|
36932
37629
|
const contract = await this.contract.getConfig();
|
|
36933
37630
|
const typeArguments = await this.getPoolTypeArguments(poolId);
|
|
36934
37631
|
const pool = await this.getPool(poolId);
|
|
@@ -36946,7 +37643,7 @@ var Pool = class extends Base {
|
|
|
36946
37643
|
//TODO
|
|
36947
37644
|
txb.pure(address),
|
|
36948
37645
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE * 3), "u64"),
|
|
36949
|
-
txb.object(
|
|
37646
|
+
txb.object(import_utils19.SUI_CLOCK_OBJECT_ID),
|
|
36950
37647
|
txb.object(contract.Versioned)
|
|
36951
37648
|
]
|
|
36952
37649
|
});
|
|
@@ -37343,7 +38040,7 @@ var NFT = class extends Base {
|
|
|
37343
38040
|
}
|
|
37344
38041
|
async burn(options) {
|
|
37345
38042
|
const { pool, nft } = options;
|
|
37346
|
-
const txb = options.txb || new
|
|
38043
|
+
const txb = options.txb || new import_transactions26.TransactionBlock();
|
|
37347
38044
|
const contract = await this.contract.getConfig();
|
|
37348
38045
|
const typeArguments = await this.pool.getPoolTypeArguments(pool);
|
|
37349
38046
|
txb.moveCall({
|
|
@@ -37506,7 +38203,7 @@ var NFT = class extends Base {
|
|
|
37506
38203
|
};
|
|
37507
38204
|
var Coin = class extends Base {
|
|
37508
38205
|
isSUI(coinType) {
|
|
37509
|
-
return (0,
|
|
38206
|
+
return (0, import_utils20.normalizeSuiAddress)(coinType) === "0x000000000000000000000000000000000000000000000000000002::sui::sui";
|
|
37510
38207
|
}
|
|
37511
38208
|
async getMetadata(coinType) {
|
|
37512
38209
|
return this.getCacheOrSet(`coin-metadata-${coinType}`, async () => {
|
|
@@ -37606,7 +38303,7 @@ var Trade = class extends Base {
|
|
|
37606
38303
|
coinB.decimals
|
|
37607
38304
|
);
|
|
37608
38305
|
});
|
|
37609
|
-
const txb = options.txb || new
|
|
38306
|
+
const txb = options.txb || new import_transactions27.TransactionBlock();
|
|
37610
38307
|
txb.moveCall({
|
|
37611
38308
|
target: `${contract.PackageId}::swap_router::${functionName}`,
|
|
37612
38309
|
typeArguments,
|
|
@@ -37628,7 +38325,7 @@ var Trade = class extends Base {
|
|
|
37628
38325
|
txb.pure(amountSpecifiedIsInput, "bool"),
|
|
37629
38326
|
txb.pure(address, "address"),
|
|
37630
38327
|
txb.pure(Date.now() + (options.deadline || ONE_MINUTE2 * 3), "u64"),
|
|
37631
|
-
txb.object(
|
|
38328
|
+
txb.object(import_utils21.SUI_CLOCK_OBJECT_ID),
|
|
37632
38329
|
txb.object(contract.Versioned)
|
|
37633
38330
|
]
|
|
37634
38331
|
});
|
|
@@ -37641,7 +38338,7 @@ var Trade = class extends Base {
|
|
|
37641
38338
|
let poolResult = await multiGetObjects(this.provider, poolIds, {
|
|
37642
38339
|
showContent: true
|
|
37643
38340
|
});
|
|
37644
|
-
const txb = new
|
|
38341
|
+
const txb = new import_transactions27.TransactionBlock();
|
|
37645
38342
|
poolResult.map(async (pool) => {
|
|
37646
38343
|
const fields = getObjectFields2(pool);
|
|
37647
38344
|
const _pool = pools.find((item) => item.pool === fields.id.id);
|
|
@@ -37669,7 +38366,7 @@ var Trade = class extends Base {
|
|
|
37669
38366
|
"u128"
|
|
37670
38367
|
),
|
|
37671
38368
|
// clock
|
|
37672
|
-
txb.object(
|
|
38369
|
+
txb.object(import_utils21.SUI_CLOCK_OBJECT_ID),
|
|
37673
38370
|
// versioned
|
|
37674
38371
|
txb.object(contract.Versioned)
|
|
37675
38372
|
]
|
|
@@ -37697,7 +38394,7 @@ var Trade = class extends Base {
|
|
|
37697
38394
|
showContent: true
|
|
37698
38395
|
}
|
|
37699
38396
|
);
|
|
37700
|
-
const txb = new
|
|
38397
|
+
const txb = new import_transactions27.TransactionBlock();
|
|
37701
38398
|
pools.forEach(async (pool) => {
|
|
37702
38399
|
const poolObject = poolResults.find(
|
|
37703
38400
|
(poolResult) => getObjectId2(poolResult) === pool.pool
|
|
@@ -37727,7 +38424,7 @@ var Trade = class extends Base {
|
|
|
37727
38424
|
"u128"
|
|
37728
38425
|
),
|
|
37729
38426
|
// clock
|
|
37730
|
-
txb.object(
|
|
38427
|
+
txb.object(import_utils21.SUI_CLOCK_OBJECT_ID),
|
|
37731
38428
|
// versioned
|
|
37732
38429
|
txb.object(contract.Versioned)
|
|
37733
38430
|
]
|
|
@@ -37828,21 +38525,21 @@ var TurbosSdk = class {
|
|
|
37828
38525
|
|
|
37829
38526
|
// node_modules/@msafe/sui-app-store/dist/index.mjs
|
|
37830
38527
|
var import_sui3_utils40 = require("@msafe/sui3-utils");
|
|
37831
|
-
var
|
|
37832
|
-
var import_utils43 = require("@mysten/sui.js/utils");
|
|
37833
|
-
var import_transactions40 = require("@mysten/sui.js/transactions");
|
|
37834
|
-
var import_utils44 = require("@mysten/sui.js/utils");
|
|
37835
|
-
var import_transactions41 = require("@mysten/sui.js/transactions");
|
|
37836
|
-
var import_transactions42 = require("@mysten/sui.js/transactions");
|
|
38528
|
+
var import_bcs11 = require("@mysten/sui.js/bcs");
|
|
37837
38529
|
var import_utils45 = require("@mysten/sui.js/utils");
|
|
37838
|
-
var import_transactions43 = require("@mysten/sui.js/transactions");
|
|
37839
|
-
var import_sui3_utils41 = require("@msafe/sui3-utils");
|
|
37840
|
-
var import_sui3_utils42 = require("@msafe/sui3-utils");
|
|
37841
|
-
var import_bcs10 = require("@mysten/sui.js/bcs");
|
|
37842
|
-
var import_utils46 = require("@mysten/sui.js/utils");
|
|
37843
38530
|
var import_transactions44 = require("@mysten/sui.js/transactions");
|
|
38531
|
+
var import_utils46 = require("@mysten/sui.js/utils");
|
|
37844
38532
|
var import_transactions45 = require("@mysten/sui.js/transactions");
|
|
37845
38533
|
var import_transactions46 = require("@mysten/sui.js/transactions");
|
|
38534
|
+
var import_utils47 = require("@mysten/sui.js/utils");
|
|
38535
|
+
var import_transactions47 = require("@mysten/sui.js/transactions");
|
|
38536
|
+
var import_sui3_utils41 = require("@msafe/sui3-utils");
|
|
38537
|
+
var import_sui3_utils42 = require("@msafe/sui3-utils");
|
|
38538
|
+
var import_bcs12 = require("@mysten/sui.js/bcs");
|
|
38539
|
+
var import_utils48 = require("@mysten/sui.js/utils");
|
|
38540
|
+
var import_transactions48 = require("@mysten/sui.js/transactions");
|
|
38541
|
+
var import_transactions49 = require("@mysten/sui.js/transactions");
|
|
38542
|
+
var import_transactions50 = require("@mysten/sui.js/transactions");
|
|
37846
38543
|
var Ar = Object.defineProperty;
|
|
37847
38544
|
var qn = (n83, e) => {
|
|
37848
38545
|
for (var t in e)
|
|
@@ -37859,10 +38556,10 @@ var u = class {
|
|
|
37859
38556
|
return JSON.stringify((0, import_sort_keys_recursive.default)(this.data));
|
|
37860
38557
|
}
|
|
37861
38558
|
};
|
|
37862
|
-
var _r = { fullRpcUrl: "https://fullnode.mainnet.sui.io/", simulationAccount: { address: "0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb" }, cetus_config: { package_id: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f", published_at: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f", config: { coin_list_id: "0x8cbc11d9e10140db3d230f50b4d30e9b721201c0083615441707ffec1ef77b23", launchpad_pools_id: "0x1098fac992eab3a0ab7acf15bb654fc1cf29b5a6142c4ef1058e6c408dd15115", clmm_pools_id: "0x15b6a27dd9ae03eb455aba03b39e29aad74abd3757b8e18c0755651b2ae5b71e", admin_cap_id: "0x39d78781750e193ce35c45ff32c6c0c3f2941fa3ddaf8595c90c555589ddb113", global_config_id: "0x0408fa4e4a4c03cc0de8f23d0c2bbfe8913d178713c9a271ed4080973fe42d8f", coin_list_handle: "0x49136005e90e28c4695419ed4194cc240603f1ea8eb84e62275eaff088a71063", launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c", clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb" } }, clmm_pool: { package_id: "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb", published_at: "
|
|
37863
|
-
var Br = { launchpad: { package_id: "0x80d114c5d474eabc2eb2fcd1a0903f1eb5b5096a8dc4184d72453f7a9be728e4", published_at: "0x80d114c5d474eabc2eb2fcd1a0903f1eb5b5096a8dc4184d72453f7a9be728e4", config: { pools_id: "0xfd8d37f7a1276878972d240302c8efe32f577220c1bbc6c8984d8b60dddfcab3", admin_cap_id: "0x66c70d58c69353714cc6fe2d3a62492d605a96a9821e2bd8274de17219c69980", config_cap_id: "0x02b8d23f033687579966e182c776fe0287cacdbb18bff56c29f141e29a18a4d1" } }, ido: { package_id: "0x1192c9e20b4b0a8848a73a8c711b43e38f7ea1f307b556aab6ffab4e982e9c59", published_at: "0x1192c9e20b4b0a8848a73a8c711b43e38f7ea1f307b556aab6ffab4e982e9c59", config: { pools_id: "0xefc209b47acf1f23b29d166440904600229e520ad36228aaf2329b7c16be9762", admin_cap_id: "0x281859d366951830aeeda90779aa170d8ee6845875545470d33ecb890e78c8ce", package_version_id: "0xc93dc996106770af5f4e979b6808518f8cee080f22f35b936f071f59d834bb22" } }, xcetus: { package_id: "0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606", published_at: "0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606", config: { xcetus_manager_id: "0x838b3dbade12b1e602efcaf8c8b818fae643e43176462bf14fd196afa59d1d9d", lock_manager_id: "0x288b59d9dedb51d0bb6cb5e13bfb30885ecf44f8c9076b6f5221c5ef6644fd28", lock_handle_id: "0x7c534bb7b8a2cc21538d0dbedd2437cc64f47106cb4c259b9ff921b5c3cb1a49" } }, xcetus_dividends: { package_id: "0x785248249ac457dfd378bdc6d2fbbfec9d1daf65e9d728b820eb4888c8da2c10", published_at: "0xcec352932edc6663a118e8d64ed54da6b8107e8719603bf728f80717592cd9e8", version: 3, config: { dividend_manager_id: "0x721c990bfc031d074341c6059a113a59c1febfbd2faeb62d49dcead8408fa6b5", dividend_admin_id: "", dividend_settle_id: "" } }, cetus_faucet: { package_id: "0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b", published_at: "0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b" }, xtoken: { package_id: "", published_at: "", config: { xtoken_manager_id: "", lock_manager_id: "", lock_handle_id: "" } }, xtoken_dividends: { package_id: "", published_at: "", config: { dividend_manager_id: "", dividend_admin_id: "", dividend_settle_id: "" } }, token_faucet: { package_id: "", published_at: "" }, booster: { package_id: "", published_at: "", config: { booster_config_id: "", booster_pool_handle: "" } }, maker_bonus: { package_id: "", published_at: "", config: { maker_config_id: "", maker_pool_handle: "" } }, liquidity_stratefy: { package_id: "", published_at: "", version: void 0, config: void 0 }, vaults: { package_id: "0xd3453d9be7e35efe222f78a810bb3af1859fd1600926afced8b4936d825c9a05", published_at: "
|
|
38559
|
+
var _r = { fullRpcUrl: "https://fullnode.mainnet.sui.io/", simulationAccount: { address: "0x326ce9894f08dcaa337fa232641cc34db957aec9ff6614c1186bc9a7508df0bb" }, cetus_config: { package_id: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f", published_at: "0x95b8d278b876cae22206131fb9724f701c9444515813042f54f0a426c9a3bc2f", config: { coin_list_id: "0x8cbc11d9e10140db3d230f50b4d30e9b721201c0083615441707ffec1ef77b23", launchpad_pools_id: "0x1098fac992eab3a0ab7acf15bb654fc1cf29b5a6142c4ef1058e6c408dd15115", clmm_pools_id: "0x15b6a27dd9ae03eb455aba03b39e29aad74abd3757b8e18c0755651b2ae5b71e", admin_cap_id: "0x39d78781750e193ce35c45ff32c6c0c3f2941fa3ddaf8595c90c555589ddb113", global_config_id: "0x0408fa4e4a4c03cc0de8f23d0c2bbfe8913d178713c9a271ed4080973fe42d8f", coin_list_handle: "0x49136005e90e28c4695419ed4194cc240603f1ea8eb84e62275eaff088a71063", launchpad_pools_handle: "0x5e194a8efcf653830daf85a85b52e3ae8f65dc39481d54b2382acda25068375c", clmm_pools_handle: "0x37f60eb2d9d227949b95da8fea810db3c32d1e1fa8ed87434fc51664f87d83cb" } }, clmm_pool: { package_id: "0x1eabed72c53feb3805120a081dc15963c204dc8d091542592abaf7a35689b2fb", published_at: "0x70968826ad1b4ba895753f634b0aea68d0672908ca1075a2abdf0fc9e0b2fc6a", version: 4, config: { pools_id: "0xf699e7f2276f5c9a75944b37a0c5b5d9ddfd2471bf6242483b03ab2887d198d0", global_config_id: "0xdaa46292632c3c4d8f31f23ea0f9b36a28ff3677e9684980e4438403a67a3d8f", global_vault_id: "0xce7bceef26d3ad1f6d9b6f13a953f053e6ed3ca77907516481ce99ae8e588f2b", admin_cap_id: "0x89c1a321291d15ddae5a086c9abc533dff697fde3d89e0ca836c41af73e36a75" } }, integrate: { package_id: "0x996c4d9480708fb8b92aa7acf819fb0497b5ec8e65ba06601cae2fb6db3312c3", published_at: "0x6f5e582ede61fe5395b50c4a449ec11479a54d7ff8e0158247adfda60d98970b", version: 6 }, deepbook: { package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9", published_at: "0x000000000000000000000000000000000000000000000000000000000000dee9" }, deepbook_endpoint_v2: { package_id: "0x92aee86c01c79146d23938a00c7fff725ee0688c389be36d1bcbe03761b466c6", published_at: "0x92aee86c01c79146d23938a00c7fff725ee0688c389be36d1bcbe03761b466c6" }, aggregatorUrl: "https://api-sui.cetus.zone/router", swapCountUrl: "https://api-sui.cetus.zone/v2/sui/swap/count" };
|
|
38560
|
+
var Br = { launchpad: { package_id: "0x80d114c5d474eabc2eb2fcd1a0903f1eb5b5096a8dc4184d72453f7a9be728e4", published_at: "0x80d114c5d474eabc2eb2fcd1a0903f1eb5b5096a8dc4184d72453f7a9be728e4", config: { pools_id: "0xfd8d37f7a1276878972d240302c8efe32f577220c1bbc6c8984d8b60dddfcab3", admin_cap_id: "0x66c70d58c69353714cc6fe2d3a62492d605a96a9821e2bd8274de17219c69980", config_cap_id: "0x02b8d23f033687579966e182c776fe0287cacdbb18bff56c29f141e29a18a4d1" } }, ido: { package_id: "0x1192c9e20b4b0a8848a73a8c711b43e38f7ea1f307b556aab6ffab4e982e9c59", published_at: "0x1192c9e20b4b0a8848a73a8c711b43e38f7ea1f307b556aab6ffab4e982e9c59", config: { pools_id: "0xefc209b47acf1f23b29d166440904600229e520ad36228aaf2329b7c16be9762", admin_cap_id: "0x281859d366951830aeeda90779aa170d8ee6845875545470d33ecb890e78c8ce", package_version_id: "0xc93dc996106770af5f4e979b6808518f8cee080f22f35b936f071f59d834bb22" } }, xcetus: { package_id: "0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606", published_at: "0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606", config: { xcetus_manager_id: "0x838b3dbade12b1e602efcaf8c8b818fae643e43176462bf14fd196afa59d1d9d", lock_manager_id: "0x288b59d9dedb51d0bb6cb5e13bfb30885ecf44f8c9076b6f5221c5ef6644fd28", lock_handle_id: "0x7c534bb7b8a2cc21538d0dbedd2437cc64f47106cb4c259b9ff921b5c3cb1a49" } }, xcetus_dividends: { package_id: "0x785248249ac457dfd378bdc6d2fbbfec9d1daf65e9d728b820eb4888c8da2c10", published_at: "0xcec352932edc6663a118e8d64ed54da6b8107e8719603bf728f80717592cd9e8", version: 3, config: { dividend_manager_id: "0x721c990bfc031d074341c6059a113a59c1febfbd2faeb62d49dcead8408fa6b5", dividend_admin_id: "", dividend_settle_id: "" } }, cetus_faucet: { package_id: "0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b", published_at: "0x6864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b" }, xtoken: { package_id: "", published_at: "", config: { xtoken_manager_id: "", lock_manager_id: "", lock_handle_id: "" } }, xtoken_dividends: { package_id: "", published_at: "", config: { dividend_manager_id: "", dividend_admin_id: "", dividend_settle_id: "" } }, token_faucet: { package_id: "", published_at: "" }, booster: { package_id: "", published_at: "", config: { booster_config_id: "", booster_pool_handle: "" } }, maker_bonus: { package_id: "", published_at: "", config: { maker_config_id: "", maker_pool_handle: "" } }, liquidity_stratefy: { package_id: "", published_at: "", version: void 0, config: void 0 }, vaults: { package_id: "0xd3453d9be7e35efe222f78a810bb3af1859fd1600926afced8b4936d825c9a05", published_at: "0x016b8ce6560f55bfe02abb2cc0681bb91f767107cfb1c9b6e73a6bcf74492a02", version: 1, config: { admin_cap_id: "0x78a42978709c4032fab7b33b782b5bcef64c1c6603250bf23644650b72144375", vaults_manager_id: "0x25b82dd2f5ee486ed1c8af144b89a8931cd9c29dee3a86a1bfe194fdea9d04a6", vaults_pool_handle: "0x9036bcc5aa7fd2cceec1659a6a1082871f45bc400c743f50063363457d1738bd", haedal: { package_id: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d", published_at: "0x1d56b8ec33c3fae897eb7bb1acb79914e8152faed614868928e684c25c8b198d", version: 1, config: { staking_id: "0x47b224762220393057ebf4f70501b6e657c3e56684737568439a04f80849b2ca", coin_type: "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI" } }, volo: { package_id: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55", published_at: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55", version: 1, config: { native_pool: "0x7fa2faa111b8c65bea48a23049bfd81ca8f971a262d981dcd9a17c3825cb5baf", vsui_metadata: "0x680cd26af32b2bde8d3361e804c53ec1d1cfe24c7f039eb7f549e8dfde389a60", coin_type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT" } }, aftermath: { package_id: "0x7f6ce7ade63857c4fd16ef7783fed2dfc4d7fb7e40615abdb653030b76aef0c6", published_at: "0x7f6ce7ade63857c4fd16ef7783fed2dfc4d7fb7e40615abdb653030b76aef0c6", version: 1, config: { staked_sui_vault: "0x2f8f6d5da7f13ea37daa397724280483ed062769813b6f31e9788e59cc88994d", referral_vault: "0x4ce9a19b594599536c53edb25d22532f82f18038dc8ef618afd00fbbfb9845ef", safe: "0xeb685899830dd5837b47007809c76d91a098d52aabbf61e8ac467c59e5cc4610", validator_address: "0xd30018ec3f5ff1a3c75656abf927a87d7f0529e6dc89c7ddd1bd27ecb05e3db2", coin_type: "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI" } } } }, limit_order: { package_id: "", published_at: "", version: 1, config: { rate_orders_indexer_id: "", rate_orders_indexer_handle: "", global_config_id: "", token_list_handle: "", user_orders_indexer_id: "", user_orders_indexer_handle: "" } }, frams: { package_id: "0x11ea791d82b5742cc8cab0bf7946035c97d9001d7c3803a93f119753da66f526", published_at: "0xd817d90368dafcbf3b051e96546dea6209bffad23289d66025beef80354dcd6b", version: 1, config: { global_config_id: "0x21215f2f6de04b57dd87d9be7bb4e15499aec935e36078e2488f36436d64996e", rewarder_manager_id: "0xe0e155a88c77025056da08db5b1701a91b79edb6167462f768e387c3ed6614d5", rewarder_manager_handle: "0xb32e312cbb3367d6f3d2b4e57c9225e903d29b7b9f612dae2ddf75bdeb26a5aa", admin_cap_id: "0xf10fbf1fea5b7aeaa524b87769461a28c5c977613046360093673991f26d886c" } } };
|
|
37864
38561
|
var jr = { fullRpcUrl: "https://fullnode.testnet.sui.io/", simulationAccount: { address: "0xcd0247d0b67e53dde69b285e7a748e3dc390e8a5244eb9dd9c5c53d95e4cf0aa" }, cetus_config: { package_id: "0xf5ff7d5ba73b581bca6b4b9fa0049cd320360abd154b809f8700a8fd3cfaf7ca", published_at: "0xf5ff7d5ba73b581bca6b4b9fa0049cd320360abd154b809f8700a8fd3cfaf7ca", config: { coin_list_id: "0x257eb2ba592a5480bba0a97d05338fab17cc3283f8df6998a0e12e4ab9b84478", launchpad_pools_id: "0xdc3a7bd66a6dcff73c77c866e87d73826e446e9171f34e1c1b656377314f94da", clmm_pools_id: "0x26c85500f5dd2983bf35123918a144de24e18936d0b234ef2b49fbb2d3d6307d", admin_cap_id: "0x1a496f6c67668eb2c27c99e07e1d61754715c1acf86dac45020c886ac601edb8", global_config_id: "0xe1f3db327e75f7ec30585fa52241edf66f7e359ef550b533f89aa1528dd1be52", coin_list_handle: "0x3204350fc603609c91675e07b8f9ac0999b9607d83845086321fca7f469de235", launchpad_pools_handle: "0xae67ff87c34aceea4d28107f9c6c62e297a111e9f8e70b9abbc2f4c9f5ec20fd", clmm_pools_handle: "0xd28736923703342b4752f5ed8c2f2a5c0cb2336c30e1fed42b387234ce8408ec" } }, clmm_pool: { package_id: "0x0868b71c0cba55bf0faf6c40df8c179c67a4d0ba0e79965b68b3d72d7dfbf666", published_at: "0x1c29d658882c40eeb39a8bb8fe58f71a216a918acb3e3eb3b47d24efd07257f2", config: { pools_id: "0xc090b101978bd6370def2666b7a31d7d07704f84e833e108a969eda86150e8cf", global_config_id: "0x6f4149091a5aea0e818e7243a13adcfb403842d670b9a2089de058512620687a", global_vault_id: "0xf3114a74d54cbe56b3e68f9306661c043ede8c6615f0351b0c3a93ce895e1699", admin_cap_id: "" } }, integrate: { package_id: "0x8627c5cdcd8b63bc3daa09a6ab7ed81a829a90cafce6003ae13372d611fbb1a9", published_at: "0xf1a5d0c5b0593e41d13f9684ca91365bdfe54a98836c1d33c90e361a031fac74", version: 6 }, deepbook: { package_id: "0x000000000000000000000000000000000000000000000000000000000000dee9", published_at: "0x000000000000000000000000000000000000000000000000000000000000dee9" }, deepbook_endpoint_v2: { package_id: "0xa34ffca2c6540e1ca9e53963ab43e7b1eed7b82e37696c743bb7c6179c15dfa6", published_at: "0xa34ffca2c6540e1ca9e53963ab43e7b1eed7b82e37696c743bb7c6179c15dfa6" }, aggregatorUrl: "https://api-sui.devcetus.com/router", swapCountUrl: "https://api-sui.devcetus.com/v2/sui/swap/count" };
|
|
37865
|
-
var Rr = { launchpad: { package_id: "0x3beee8416089a5cbff9cfd5c0a2ce2937b0452dc7e2a3ab4dc431c7be05c2335", published_at: "0x3beee8416089a5cbff9cfd5c0a2ce2937b0452dc7e2a3ab4dc431c7be05c2335", config: { pools_id: "0xccc10403ab3da4ae943847908e0e674fe1fdab81c6383e4c6dcd0eea0edade3d", admin_cap_id: "0x8a72713049dbcfc40902ff209dc5e6066fe455d152baa235957c84d7a3b875ed", config_cap_id: "0x16492b4252b01debb60f8a825334020d7fdb9d895b52f8139c98618de30817fc" } }, ido: { package_id: "0x1352bf18ef20458f7cc773852d4a90b240015a6a54479dda3a1debfc500bf044", published_at: "0xbd09a0889ea9970b821512428bab3e2fd01e16809a90a325cd3b3d3573eab6a4", config: { pools_id: "0x346bee25ab4d15bcfa9484ef5ebd4d7c94eb665ebaa745ff4094936a7f59a8b1", admin_cap_id: "0xc1bb19a24d3bb65dfd4f3835637b63347c223c67cde4b0888f1a857974f33cbb", package_version_id: "0x3ccf1b38e3259e638b980d4e6b49eac8c5aa94d3cb2ace5e75f0a551c8e67e5e" } }, xcetus: { package_id: "0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966", published_at: "0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966", config: { xcetus_manager_id: "0x3be34cbad122c8b100ed7157d762b9610e68b3c65734e08bc3c3baf857da807d", lock_manager_id: "0x7c67e805182e3fecd098bd68a6b06c317f28f8c6249bd771e07904a10b424e60", lock_handle_id: "0xc5f3bbfefe9a45c13da7a34bc72cac122ee45d633690476a8ac56bd2c4e78c86" } }, xcetus_dividends: { package_id: "0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828", published_at: "0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828", config: { dividend_manager_id: "0x13b7facb704fae1d199ff0038b8acabc253415a77d142b39189dee97d457e442", dividend_admin_id: "0x5eb78463007422d4130b21f61c180bcd190819b7792f56e00a61df3b8fb928ef", dividend_settle_id: "0x495095e13a170ff494d242ae44ac2c7453011ca6c33cff27498010105e10e4b4" } }, cetus_faucet: { package_id: "0x1a69aee6be709054750949959a67aedbb4200583b39586d5e3eabe57f40012c7", published_at: "0x1a69aee6be709054750949959a67aedbb4200583b39586d5e3eabe57f40012c7" }, xtoken: { package_id: "", published_at: "", config: { xtoken_manager_id: "", lock_manager_id: "", lock_handle_id: "" } }, xtoken_dividends: { package_id: "", published_at: "", config: { dividend_manager_id: "", dividend_admin_id: "", dividend_settle_id: "" } }, token_faucet: { package_id: "", published_at: "" }, booster: { package_id: "", published_at: "", config: { booster_config_id: "", booster_pool_handle: "" } }, maker_bonus: { package_id: "", published_at: "", config: { maker_config_id: "", maker_pool_handle: "" } }, liquidity_stratefy: { package_id: "", published_at: "", version: void 0, config: void 0 }, vaults: { package_id: "0x25cff94bdb454bae6a5565d09047bfe2b230025ef3bd2199622ec48d854b86b9", published_at: "0x25cff94bdb454bae6a5565d09047bfe2b230025ef3bd2199622ec48d854b86b9", config: { admin_cap_id: "0x9b2d6f5be2650d16d27cd630c4539a76d7793970343ed3cbb023e13f1637c07c", vaults_manager_id: "0xc0a1a937df08880e395d85014ff40c74f13abe7a53abdbffea36f51adaaaf79e", vaults_pool_handle: "0x3ab02203de753de9c8198cc0ce7594dc960878f2c34c5c5a4b7742082241860a" } }, limit_order: { package_id: "", published_at: "", version: 1, config: { rate_orders_indexer_id: "", rate_orders_indexer_handle: "", global_config_id: "", token_list_handle: "", user_orders_indexer_id: "", user_orders_indexer_handle: "" } }, frams: { package_id: "0xfa0d98e99c1dbdbea1b0fe089fa93ebab40a7719ae4160c42cc78ebfe029fda0", published_at: "0xfa0d98e99c1dbdbea1b0fe089fa93ebab40a7719ae4160c42cc78ebfe029fda0", config: { global_config_id: "0x5082c7a5ee9a758025d7b0a5e8aa08b56625c7cd535b8909d2b7993991e229cc", rewarder_manager_id: "0xe789e092dbd9dceadbe89350c4761a6f2e11647aab97f09746a01b151926cc0e", rewarder_manager_handle: "0x7e7dd42392b5d82564dc9ad5093a111c5f0598cc9f806cff257d7dacb71f7837", admin_cap_id: "0x4ec248bca2d1fc05f39fd7491ab490464a46d128624caa4d3c2a66d957ef40b0" } }
|
|
38562
|
+
var Rr = { launchpad: { package_id: "0x3beee8416089a5cbff9cfd5c0a2ce2937b0452dc7e2a3ab4dc431c7be05c2335", published_at: "0x3beee8416089a5cbff9cfd5c0a2ce2937b0452dc7e2a3ab4dc431c7be05c2335", config: { pools_id: "0xccc10403ab3da4ae943847908e0e674fe1fdab81c6383e4c6dcd0eea0edade3d", admin_cap_id: "0x8a72713049dbcfc40902ff209dc5e6066fe455d152baa235957c84d7a3b875ed", config_cap_id: "0x16492b4252b01debb60f8a825334020d7fdb9d895b52f8139c98618de30817fc" } }, ido: { package_id: "0x1352bf18ef20458f7cc773852d4a90b240015a6a54479dda3a1debfc500bf044", published_at: "0xbd09a0889ea9970b821512428bab3e2fd01e16809a90a325cd3b3d3573eab6a4", config: { pools_id: "0x346bee25ab4d15bcfa9484ef5ebd4d7c94eb665ebaa745ff4094936a7f59a8b1", admin_cap_id: "0xc1bb19a24d3bb65dfd4f3835637b63347c223c67cde4b0888f1a857974f33cbb", package_version_id: "0x3ccf1b38e3259e638b980d4e6b49eac8c5aa94d3cb2ace5e75f0a551c8e67e5e" } }, xcetus: { package_id: "0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966", published_at: "0xdebaab6b851fd3414c0a62dbdf8eb752d6b0d31f5cfce5e38541bc6c6daa8966", config: { xcetus_manager_id: "0x3be34cbad122c8b100ed7157d762b9610e68b3c65734e08bc3c3baf857da807d", lock_manager_id: "0x7c67e805182e3fecd098bd68a6b06c317f28f8c6249bd771e07904a10b424e60", lock_handle_id: "0xc5f3bbfefe9a45c13da7a34bc72cac122ee45d633690476a8ac56bd2c4e78c86" } }, xcetus_dividends: { package_id: "0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828", published_at: "0x20d948d640edd0c749f533d41efc5f843f212d441220324ad7959c6e1d281828", config: { dividend_manager_id: "0x13b7facb704fae1d199ff0038b8acabc253415a77d142b39189dee97d457e442", dividend_admin_id: "0x5eb78463007422d4130b21f61c180bcd190819b7792f56e00a61df3b8fb928ef", dividend_settle_id: "0x495095e13a170ff494d242ae44ac2c7453011ca6c33cff27498010105e10e4b4" } }, cetus_faucet: { package_id: "0x1a69aee6be709054750949959a67aedbb4200583b39586d5e3eabe57f40012c7", published_at: "0x1a69aee6be709054750949959a67aedbb4200583b39586d5e3eabe57f40012c7" }, xtoken: { package_id: "", published_at: "", config: { xtoken_manager_id: "", lock_manager_id: "", lock_handle_id: "" } }, xtoken_dividends: { package_id: "", published_at: "", config: { dividend_manager_id: "", dividend_admin_id: "", dividend_settle_id: "" } }, token_faucet: { package_id: "", published_at: "" }, booster: { package_id: "", published_at: "", config: { booster_config_id: "", booster_pool_handle: "" } }, maker_bonus: { package_id: "", published_at: "", config: { maker_config_id: "", maker_pool_handle: "" } }, liquidity_stratefy: { package_id: "", published_at: "", version: void 0, config: void 0 }, vaults: { package_id: "0x25cff94bdb454bae6a5565d09047bfe2b230025ef3bd2199622ec48d854b86b9", published_at: "0x25cff94bdb454bae6a5565d09047bfe2b230025ef3bd2199622ec48d854b86b9", config: { admin_cap_id: "0x9b2d6f5be2650d16d27cd630c4539a76d7793970343ed3cbb023e13f1637c07c", vaults_manager_id: "0xc0a1a937df08880e395d85014ff40c74f13abe7a53abdbffea36f51adaaaf79e", vaults_pool_handle: "0x3ab02203de753de9c8198cc0ce7594dc960878f2c34c5c5a4b7742082241860a" } }, limit_order: { package_id: "", published_at: "", version: 1, config: { rate_orders_indexer_id: "", rate_orders_indexer_handle: "", global_config_id: "", token_list_handle: "", user_orders_indexer_id: "", user_orders_indexer_handle: "" } }, frams: { package_id: "0xfa0d98e99c1dbdbea1b0fe089fa93ebab40a7719ae4160c42cc78ebfe029fda0", published_at: "0xfa0d98e99c1dbdbea1b0fe089fa93ebab40a7719ae4160c42cc78ebfe029fda0", config: { global_config_id: "0x5082c7a5ee9a758025d7b0a5e8aa08b56625c7cd535b8909d2b7993991e229cc", rewarder_manager_id: "0xe789e092dbd9dceadbe89350c4761a6f2e11647aab97f09746a01b151926cc0e", rewarder_manager_handle: "0x7e7dd42392b5d82564dc9ad5093a111c5f0598cc9f806cff257d7dacb71f7837", admin_cap_id: "0x4ec248bca2d1fc05f39fd7491ab490464a46d128624caa4d3c2a66d957ef40b0" } } };
|
|
37866
38563
|
var V = (n83, e) => {
|
|
37867
38564
|
let t = n83 === "sui:mainnet" ? _r : jr, a = new CetusClmmSDK(t);
|
|
37868
38565
|
return a.senderAddress = e.address, a;
|
|
@@ -38123,7 +38820,7 @@ var pt = class n16 extends u {
|
|
|
38123
38820
|
var oo = { package_id: "0x355714a1eeb7ab1d80902da6c92001170cda1212edf524c32aa308a3ac177c31", published_at: "0x355714a1eeb7ab1d80902da6c92001170cda1212edf524c32aa308a3ac177c31", cetus_coin_type: "0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS" };
|
|
38124
38821
|
var ro = async (n83, e, t) => {
|
|
38125
38822
|
console.log("getVestingRedeemTxb txbParams: ", n83), console.log("getVestingRedeemTxb account: ", e), console.log("getVestingRedeemTxb network: ", t);
|
|
38126
|
-
let { pool: a, nftId: o, periods: r, CLOCK_ADDRESS: i } = n83, s2 = new
|
|
38823
|
+
let { pool: a, nftId: o, periods: r, CLOCK_ADDRESS: i } = n83, s2 = new import_transactions28.TransactionBlock();
|
|
38127
38824
|
return r.forEach((c) => {
|
|
38128
38825
|
s2.moveCall({ target: `${oo.published_at}::router::redeem`, typeArguments: [oo.cetus_coin_type], arguments: [s2.object(a), s2.object(o), s2.pure(c), s2.object(i)] });
|
|
38129
38826
|
}), s2;
|
|
@@ -38369,7 +39066,7 @@ var Tt = class n23 {
|
|
|
38369
39066
|
this.apiURL = e;
|
|
38370
39067
|
}
|
|
38371
39068
|
static parseResponseData(e) {
|
|
38372
|
-
if (e instanceof
|
|
39069
|
+
if (e instanceof import_axios2.AxiosError)
|
|
38373
39070
|
throw new me(e.response?.statusText);
|
|
38374
39071
|
if (e.status === 200) {
|
|
38375
39072
|
if (e.data.success)
|
|
@@ -38379,30 +39076,30 @@ var Tt = class n23 {
|
|
|
38379
39076
|
throw new me(e.status.toString());
|
|
38380
39077
|
}
|
|
38381
39078
|
async getIncomingStreams(e, t) {
|
|
38382
|
-
let a = await
|
|
39079
|
+
let a = await import_axios2.default.post(`${this.apiURL}/stream`, { recipient: e, ...t });
|
|
38383
39080
|
return n23.parseResponseData(a);
|
|
38384
39081
|
}
|
|
38385
39082
|
async getOutgoingStreams(e, t) {
|
|
38386
|
-
let a = await
|
|
39083
|
+
let a = await import_axios2.default.post(`${this.apiURL}/stream`, { sender: e, ...t });
|
|
38387
39084
|
return n23.parseResponseData(a);
|
|
38388
39085
|
}
|
|
38389
39086
|
async getStreamHistory(e) {
|
|
38390
|
-
let t = await
|
|
39087
|
+
let t = await import_axios2.default.post(`${this.apiURL}/stream-events`, e), a = n23.parseResponseData(t);
|
|
38391
39088
|
return a.data.forEach((o) => {
|
|
38392
39089
|
let r = o;
|
|
38393
39090
|
return r.data.type === "create_stream" ? r.data.balance = BigInt(r.data.balance) : r.data.type === "cancel_stream" ? r.data.withdrawAmount = BigInt(r.data.withdrawAmount) : r.data.type === "claim" || r.data.type === "auto_claim" ? r.data.claimAmount = BigInt(r.data.claimAmount) : r.data.type === "set_auto_claim" && (r.data.enabled = !!r.data.enabled), r.createdAt = new Date(r.createdAt), r;
|
|
38394
39091
|
}), a;
|
|
38395
39092
|
}
|
|
38396
39093
|
async getAllCoinTypes(e) {
|
|
38397
|
-
let t = await
|
|
39094
|
+
let t = await import_axios2.default.post(`${this.apiURL}/stream-info`, { address: e });
|
|
38398
39095
|
return n23.parseResponseData(t);
|
|
38399
39096
|
}
|
|
38400
39097
|
async getAllRecipients(e, t) {
|
|
38401
|
-
let a = await
|
|
39098
|
+
let a = await import_axios2.default.post(`${this.apiURL}/stream-info`, { sender: e, status: t });
|
|
38402
39099
|
return n23.parseResponseData(a);
|
|
38403
39100
|
}
|
|
38404
39101
|
async getAllSenders(e, t) {
|
|
38405
|
-
let a = await
|
|
39102
|
+
let a = await import_axios2.default.post(`${this.apiURL}/stream-info`, { recipient: e, status: t });
|
|
38406
39103
|
return n23.parseResponseData(a);
|
|
38407
39104
|
}
|
|
38408
39105
|
};
|
|
@@ -38513,7 +39210,7 @@ var kt = class {
|
|
|
38513
39210
|
let [a, o] = this.getValue(e, t);
|
|
38514
39211
|
if (o !== "address")
|
|
38515
39212
|
throw new De("Invalid contract return type.", { ctx: { expectType: "address", gotType: o } });
|
|
38516
|
-
return (0,
|
|
39213
|
+
return (0, import_utils24.normalizeSuiAddress)(import_buffer.Buffer.from(a).toString("hex"));
|
|
38517
39214
|
}
|
|
38518
39215
|
getU64(e = 0, t = 0) {
|
|
38519
39216
|
let [a, o] = this.getValue(e, t);
|
|
@@ -38530,10 +39227,10 @@ var v = class extends S {
|
|
|
38530
39227
|
var So = { groupId: "string", name: "string" };
|
|
38531
39228
|
var ji = 64;
|
|
38532
39229
|
function wo(n83) {
|
|
38533
|
-
return Co(n83),
|
|
39230
|
+
return Co(n83), import_bcs6.bcs.ser(So, n83).toString("base64");
|
|
38534
39231
|
}
|
|
38535
39232
|
function _e(n83) {
|
|
38536
|
-
let e =
|
|
39233
|
+
let e = import_bcs6.bcs.de(So, n83, "base64");
|
|
38537
39234
|
return Co(e), e;
|
|
38538
39235
|
}
|
|
38539
39236
|
function Co(n83) {
|
|
@@ -38548,10 +39245,10 @@ function ho(n83) {
|
|
|
38548
39245
|
return /^[\x00-\x7F]+$/.test(n83);
|
|
38549
39246
|
}
|
|
38550
39247
|
function vt(n83, e) {
|
|
38551
|
-
return (0,
|
|
39248
|
+
return (0, import_utils25.normalizeStructTag)(n83) === (0, import_utils25.normalizeStructTag)(e);
|
|
38552
39249
|
}
|
|
38553
39250
|
function Z(n83, e) {
|
|
38554
|
-
return (0,
|
|
39251
|
+
return (0, import_utils25.normalizeStructTag)(n83) === (0, import_utils25.normalizeStructTag)(e);
|
|
38555
39252
|
}
|
|
38556
39253
|
var At = "txn.gas";
|
|
38557
39254
|
function To() {
|
|
@@ -38564,10 +39261,10 @@ var se = class n26 {
|
|
|
38564
39261
|
this.streamContract = a;
|
|
38565
39262
|
}
|
|
38566
39263
|
static convertCreateStreamInfoToInternal(e) {
|
|
38567
|
-
return { metadata: wo({ name: e.name, groupId: To() }), coinType: (0,
|
|
39264
|
+
return { metadata: wo({ name: e.name, groupId: To() }), coinType: (0, import_utils23.normalizeStructTag)(e.coinType), recipients: e.recipients.map((t) => ({ address: t.address, cliffAmount: t.cliffAmount, amountPerEpoch: t.amountPerStep })), epochInterval: e.interval, numberEpoch: e.steps, startTime: e.startTimeMs, cancelable: e.cancelable };
|
|
38568
39265
|
}
|
|
38569
39266
|
async buildCreateStreamTransactionBlock(e) {
|
|
38570
|
-
let t = new
|
|
39267
|
+
let t = new import_transactions30.TransactionBlock(), a = this.calculateFeesInternal(e), o = this.getCreateStreamCoinRequests(e, a), r = await this.wallet.requestCoins(o), i = await this.addMergeCoins(t, r[0]), s2;
|
|
38571
39268
|
o.length > 1 ? s2 = await this.addMergeCoins(t, r[1]) : s2 = i;
|
|
38572
39269
|
for (let c = 0; c < e.recipients.length; c++) {
|
|
38573
39270
|
let l2 = e.recipients[c], d2 = this.amountForRecipient(l2, e.numberEpoch), p = this.getStreamFeeLocal(d2), [m] = t.splitCoins(i, [t.pure(d2 + p, "u64")]), [b] = t.splitCoins(s2, [t.pure(this.flatSuiFee, "u64")]);
|
|
@@ -38588,7 +39285,7 @@ var se = class n26 {
|
|
|
38588
39285
|
}
|
|
38589
39286
|
getCreateStreamCoinRequests(e, t) {
|
|
38590
39287
|
let a = e.coinType;
|
|
38591
|
-
return vt(a,
|
|
39288
|
+
return vt(a, import_utils23.SUI_TYPE_ARG) ? [{ coinType: a, amount: t.totalAmount + t.streamFeeAmount + t.flatFeeAmount }] : [{ coinType: a, amount: t.totalAmount + t.streamFeeAmount }, { coinType: import_utils23.SUI_TYPE_ARG, amount: t.flatFeeAmount }];
|
|
38592
39289
|
}
|
|
38593
39290
|
calculateFeesInternal(e) {
|
|
38594
39291
|
let t = e.recipients.reduce((o, r) => {
|
|
@@ -38607,7 +39304,7 @@ var se = class n26 {
|
|
|
38607
39304
|
return e * dn / It;
|
|
38608
39305
|
}
|
|
38609
39306
|
async getStreamFeeRemote(e) {
|
|
38610
|
-
let t = this.feeContract.streamingFee(new
|
|
39307
|
+
let t = this.feeContract.streamingFee(new import_transactions30.TransactionBlock(), e), a = await this.globals.suiClient.devInspectTransactionBlock({ sender: await this.globals.walletAddress(), transactionBlock: t });
|
|
38611
39308
|
return new kt(a).getU64();
|
|
38612
39309
|
}
|
|
38613
39310
|
get wallet() {
|
|
@@ -38623,10 +39320,10 @@ var ge = class {
|
|
|
38623
39320
|
}
|
|
38624
39321
|
addContractCall(e, t) {
|
|
38625
39322
|
let a = `${this.config.contractId}::${this.moduleName}::${t.method}`;
|
|
38626
|
-
return e.add(
|
|
39323
|
+
return e.add(import_transactions31.Transactions.MoveCall({ target: a, arguments: t.arguments.map((o) => o instanceof Pe ? o.moveArgs(e) : o instanceof q ? o.moveArg(e) : o instanceof Y ? o.moveArg() : e.pure(o)), typeArguments: t.typeArgs })), e;
|
|
38627
39324
|
}
|
|
38628
39325
|
addTransactionBlock(e, t, a = [], o = []) {
|
|
38629
|
-
e.add(
|
|
39326
|
+
e.add(import_transactions31.Transactions.MoveCall({ target: t, arguments: a.map((r) => r instanceof Pe ? r.moveArgs(e) : r instanceof q ? r.moveArg(e) : r instanceof Y ? r.moveArg() : e.pure(r)), typeArguments: o }));
|
|
38630
39327
|
}
|
|
38631
39328
|
makeObject(e) {
|
|
38632
39329
|
return typeof e == "string" ? new q(e) : e;
|
|
@@ -38735,19 +39432,19 @@ var ye = class {
|
|
|
38735
39432
|
return new se(this.globals, this.feeContract, this.streamContract);
|
|
38736
39433
|
}
|
|
38737
39434
|
setAutoClaim(e, t, a) {
|
|
38738
|
-
let o = new
|
|
39435
|
+
let o = new import_transactions29.TransactionBlock();
|
|
38739
39436
|
return this.streamContract.setAutoClaim(o, { streamId: e, enabled: t, coinType: a });
|
|
38740
39437
|
}
|
|
38741
39438
|
claimStream(e, t) {
|
|
38742
|
-
let a = new
|
|
39439
|
+
let a = new import_transactions29.TransactionBlock();
|
|
38743
39440
|
return this.streamContract.claimStream(a, { streamId: e, coinType: t });
|
|
38744
39441
|
}
|
|
38745
39442
|
claimStreamByProxy(e, t) {
|
|
38746
|
-
let a = new
|
|
39443
|
+
let a = new import_transactions29.TransactionBlock();
|
|
38747
39444
|
return this.streamContract.claimStreamByProxy(a, { streamId: e, coinType: t });
|
|
38748
39445
|
}
|
|
38749
39446
|
cancelStream(e, t) {
|
|
38750
|
-
let a = new
|
|
39447
|
+
let a = new import_transactions29.TransactionBlock();
|
|
38751
39448
|
return this.streamContract.cancelStream(a, { streamId: e, coinType: t }), a;
|
|
38752
39449
|
}
|
|
38753
39450
|
};
|
|
@@ -38916,23 +39613,23 @@ var ee = class n29 {
|
|
|
38916
39613
|
async cancel() {
|
|
38917
39614
|
if (await this.globals.walletAddress() !== this.creator)
|
|
38918
39615
|
throw new Dt();
|
|
38919
|
-
let e = new
|
|
39616
|
+
let e = new import_transactions32.TransactionBlock();
|
|
38920
39617
|
return this.streamContract.cancelStream(e, { streamId: this.streamId, coinType: this.coinType }), e;
|
|
38921
39618
|
}
|
|
38922
39619
|
async claim() {
|
|
38923
39620
|
if (await this.globals.walletAddress() !== this.recipient)
|
|
38924
39621
|
throw new Be();
|
|
38925
|
-
let e = new
|
|
39622
|
+
let e = new import_transactions32.TransactionBlock();
|
|
38926
39623
|
return this.streamContract.claimStream(e, { streamId: this.streamId, coinType: this.coinType }), e;
|
|
38927
39624
|
}
|
|
38928
39625
|
async setAutoClaim(e) {
|
|
38929
39626
|
if (await this.globals.walletAddress() !== this.recipient)
|
|
38930
39627
|
throw new Be();
|
|
38931
|
-
let t = new
|
|
39628
|
+
let t = new import_transactions32.TransactionBlock();
|
|
38932
39629
|
return this.streamContract.setAutoClaim(t, { streamId: this.streamId, coinType: this.coinType, enabled: e }), t;
|
|
38933
39630
|
}
|
|
38934
39631
|
async claimByProxy() {
|
|
38935
|
-
let e = new
|
|
39632
|
+
let e = new import_transactions32.TransactionBlock();
|
|
38936
39633
|
return this.streamContract.claimStreamByProxy(e, { streamId: this.streamId, coinType: this.coinType }), e;
|
|
38937
39634
|
}
|
|
38938
39635
|
get wallet() {
|
|
@@ -38942,7 +39639,7 @@ var ee = class n29 {
|
|
|
38942
39639
|
return this.globals.suiClient;
|
|
38943
39640
|
}
|
|
38944
39641
|
get coinType() {
|
|
38945
|
-
return (0,
|
|
39642
|
+
return (0, import_utils26.normalizeStructTag)(this.rawData.coinType);
|
|
38946
39643
|
}
|
|
38947
39644
|
get progress() {
|
|
38948
39645
|
return { status: this.streamStatus, total: this.totalAmount, streamed: this.streamedAmount, claimed: this.claimedAmount, claimable: this.claimable, canceled: this.canceledAmount };
|
|
@@ -39039,7 +39736,7 @@ var ee = class n29 {
|
|
|
39039
39736
|
let a = t.data.content;
|
|
39040
39737
|
if (a.dataType !== "moveObject")
|
|
39041
39738
|
throw new je("Unexpected object type", { gotType: a.dataType });
|
|
39042
|
-
let { typeParams: o } = (0,
|
|
39739
|
+
let { typeParams: o } = (0, import_utils26.parseStructTag)(a.type), r = (0, import_utils26.normalizeStructTag)(o[0]), i = a.fields, s2 = i.config.fields, c = i.status.fields;
|
|
39043
39740
|
return { coinType: r, autoClaim: i.auto_claim, balance: BigInt(i.balance.fields.balance), config: { amountPerEpoch: BigInt(s2.amount_per_epoch), cancelable: s2.cancelable, cliff: BigInt(s2.cliff), creator: s2.creator, epochInterval: BigInt(s2.epoch_interval), metadata: s2.metadata, recipient: s2.recipient, timeStart: BigInt(s2.time_start), totalEpoch: BigInt(s2.total_epoch) }, status: { status: c.status, epochCanceled: BigInt(c.epoch_canceled), epochClaimed: BigInt(c.epoch_claimed) } };
|
|
39044
39741
|
}
|
|
39045
39742
|
};
|
|
@@ -39087,11 +39784,11 @@ var Nt = class {
|
|
|
39087
39784
|
}
|
|
39088
39785
|
async getBalance(e, t) {
|
|
39089
39786
|
let a = await this.globals.suiClient.getBalance({ owner: e, coinType: t }), o = await this.getCoinMeta(t);
|
|
39090
|
-
return { ...a, coinType: (0,
|
|
39787
|
+
return { ...a, coinType: (0, import_utils27.normalizeStructTag)(a.coinType), coinMeta: o };
|
|
39091
39788
|
}
|
|
39092
39789
|
async getAllBalance(e) {
|
|
39093
39790
|
let t = await this.globals.suiClient.getAllBalances({ owner: e }), a = await Promise.all(t.map((o) => this.getCoinMeta(o.coinType)));
|
|
39094
|
-
return t.map((o, r) => ({ ...o, coinType: (0,
|
|
39791
|
+
return t.map((o, r) => ({ ...o, coinType: (0, import_utils27.normalizeStructTag)(o.coinType), coinMeta: a[r] }));
|
|
39095
39792
|
}
|
|
39096
39793
|
async getCoinMeta(e) {
|
|
39097
39794
|
return this.coinMetaHelper.getCoinMeta(e);
|
|
@@ -39117,7 +39814,7 @@ var yn = class {
|
|
|
39117
39814
|
}
|
|
39118
39815
|
coinMetaReg;
|
|
39119
39816
|
async getCoinMeta(e) {
|
|
39120
|
-
let t = (0,
|
|
39817
|
+
let t = (0, import_utils27.normalizeStructTag)(e || import_utils27.SUI_TYPE_ARG);
|
|
39121
39818
|
if (this.coinMetaReg.has(t))
|
|
39122
39819
|
return this.coinMetaReg.get(t);
|
|
39123
39820
|
let a = await this.queryCoinMeta(t);
|
|
@@ -39311,7 +40008,7 @@ var Wt = class n33 {
|
|
|
39311
40008
|
current = 0;
|
|
39312
40009
|
objectIter;
|
|
39313
40010
|
static async newIncomingQuery(e) {
|
|
39314
|
-
let t = zi(e.query), a = await e.globals.walletAddress(), r = (await e.globals.backend.getIncomingStreams(a, t)).filter((s2) => (0,
|
|
40011
|
+
let t = zi(e.query), a = await e.globals.walletAddress(), r = (await e.globals.backend.getIncomingStreams(a, t)).filter((s2) => (0, import_utils28.normalizeSuiAddress)(s2.recipient) === (0, import_utils28.normalizeSuiAddress)(a)), i = jo(r);
|
|
39315
40012
|
return new n33(e.globals, a, i, e.query);
|
|
39316
40013
|
}
|
|
39317
40014
|
static async newOutgoingQuery(e) {
|
|
@@ -39410,11 +40107,11 @@ function Xi(n83) {
|
|
|
39410
40107
|
}
|
|
39411
40108
|
function Eo(n83) {
|
|
39412
40109
|
if (n83)
|
|
39413
|
-
return Array.isArray(n83) ? n83.length !== 0 ? n83.map((e) => (0,
|
|
40110
|
+
return Array.isArray(n83) ? n83.length !== 0 ? n83.map((e) => (0, import_utils28.normalizeStructTag)(e)) : void 0 : (0, import_utils28.normalizeStructTag)(n83);
|
|
39414
40111
|
}
|
|
39415
40112
|
function Mo(n83) {
|
|
39416
40113
|
if (n83)
|
|
39417
|
-
return Array.isArray(n83) ? n83.length !== 0 ? n83.map((e) => (0,
|
|
40114
|
+
return Array.isArray(n83) ? n83.length !== 0 ? n83.map((e) => (0, import_utils28.normalizeSuiAddress)(e)) : void 0 : (0, import_utils28.normalizeSuiAddress)(n83);
|
|
39418
40115
|
}
|
|
39419
40116
|
var Tn = class {
|
|
39420
40117
|
constructor(e) {
|
|
@@ -39453,7 +40150,7 @@ var In = class {
|
|
|
39453
40150
|
return Promise.all(e.map((t) => this.requestCoin(t)));
|
|
39454
40151
|
}
|
|
39455
40152
|
async requestCoin(e) {
|
|
39456
|
-
if (vt(e.coinType,
|
|
40153
|
+
if (vt(e.coinType, import_utils22.SUI_TYPE_ARG))
|
|
39457
40154
|
return { primaryCoin: At };
|
|
39458
40155
|
if (e.amount <= 0)
|
|
39459
40156
|
throw new v("Invalid coin request", "coinAmount", e.amount);
|
|
@@ -39491,15 +40188,15 @@ var Ut = class {
|
|
|
39491
40188
|
}
|
|
39492
40189
|
async getCoinTypesForStreamFilter() {
|
|
39493
40190
|
let e = await this.wallet.address();
|
|
39494
|
-
return (await this.globals.backend.getAllCoinTypes(e)).map((a) => (0,
|
|
40191
|
+
return (await this.globals.backend.getAllCoinTypes(e)).map((a) => (0, import_utils22.normalizeStructTag)(a));
|
|
39495
40192
|
}
|
|
39496
40193
|
async getRecipientsForStreamFilter(e) {
|
|
39497
40194
|
let t = await this.wallet.address();
|
|
39498
|
-
return (await this.globals.backend.getAllRecipients(t, e)).map((o) => (0,
|
|
40195
|
+
return (await this.globals.backend.getAllRecipients(t, e)).map((o) => (0, import_utils22.normalizeSuiAddress)(o));
|
|
39499
40196
|
}
|
|
39500
40197
|
async getCreatorsForStreamFilter(e) {
|
|
39501
40198
|
let t = await this.wallet.address();
|
|
39502
|
-
return (await this.globals.backend.getAllSenders(t, e)).map((o) => (0,
|
|
40199
|
+
return (await this.globals.backend.getAllSenders(t, e)).map((o) => (0, import_utils22.normalizeSuiAddress)(o));
|
|
39503
40200
|
}
|
|
39504
40201
|
get wallet() {
|
|
39505
40202
|
return this.globals.wallet;
|
|
@@ -39590,7 +40287,7 @@ var Ce = class n34 {
|
|
|
39590
40287
|
}
|
|
39591
40288
|
decodeInputAddress(e) {
|
|
39592
40289
|
let t = this.decodePureArg(e, "address");
|
|
39593
|
-
return (0,
|
|
40290
|
+
return (0, import_utils29.normalizeSuiAddress)(t);
|
|
39594
40291
|
}
|
|
39595
40292
|
decodeInputString(e) {
|
|
39596
40293
|
return this.decodePureArg(e, "string");
|
|
@@ -39613,7 +40310,7 @@ var Ce = class n34 {
|
|
|
39613
40310
|
throw new Error("not pure argument");
|
|
39614
40311
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
39615
40312
|
let a = e.value.Pure;
|
|
39616
|
-
return
|
|
40313
|
+
return import_bcs7.bcs.de(t, new Uint8Array(a));
|
|
39617
40314
|
}
|
|
39618
40315
|
return e.value;
|
|
39619
40316
|
}
|
|
@@ -39623,18 +40320,18 @@ var Ce = class n34 {
|
|
|
39623
40320
|
if (typeof e.value == "object") {
|
|
39624
40321
|
if (!("Object" in e.value) || !("ImmOrOwned" in e.value.Object))
|
|
39625
40322
|
throw new Error("not ImmOrOwned");
|
|
39626
|
-
return (0,
|
|
40323
|
+
return (0, import_utils29.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId);
|
|
39627
40324
|
}
|
|
39628
|
-
return (0,
|
|
40325
|
+
return (0, import_utils29.normalizeSuiAddress)(e.value);
|
|
39629
40326
|
}
|
|
39630
40327
|
static getSharedObjectId(e) {
|
|
39631
40328
|
if (e.type !== "object")
|
|
39632
40329
|
throw new Error(`not object argument: ${JSON.stringify(e)}`);
|
|
39633
40330
|
if (typeof e.value != "object")
|
|
39634
|
-
return (0,
|
|
40331
|
+
return (0, import_utils29.normalizeSuiAddress)(e.value);
|
|
39635
40332
|
if (!("Object" in e.value) || !("Shared" in e.value.Object))
|
|
39636
40333
|
throw new Error("not Shared");
|
|
39637
|
-
return (0,
|
|
40334
|
+
return (0, import_utils29.normalizeSuiAddress)(e.value.Object.Shared.objectId);
|
|
39638
40335
|
}
|
|
39639
40336
|
static getPureInput(e, t) {
|
|
39640
40337
|
if (e.type !== "pure")
|
|
@@ -39644,10 +40341,10 @@ var Ce = class n34 {
|
|
|
39644
40341
|
if (!("Pure" in e.value))
|
|
39645
40342
|
throw new Error("Pure not in value");
|
|
39646
40343
|
let a = e.value.Pure;
|
|
39647
|
-
return
|
|
40344
|
+
return import_bcs7.bcs.de(t, new Uint8Array(a));
|
|
39648
40345
|
}
|
|
39649
40346
|
typeArg(e) {
|
|
39650
|
-
return (0,
|
|
40347
|
+
return (0, import_utils29.normalizeStructTag)(this.moveCall.typeArguments[e]);
|
|
39651
40348
|
}
|
|
39652
40349
|
txArg(e) {
|
|
39653
40350
|
return this.moveCall.arguments[e];
|
|
@@ -39864,7 +40561,7 @@ var Ht = class n37 extends u {
|
|
|
39864
40561
|
txType;
|
|
39865
40562
|
txSubType;
|
|
39866
40563
|
async build(t) {
|
|
39867
|
-
let { account: a } = t, o =
|
|
40564
|
+
let { account: a } = t, o = import_transactions33.TransactionBlock.from(this.data.content);
|
|
39868
40565
|
if (!(0, import_sui3_utils33.isSameAddress)(o.blockData.sender, a.address))
|
|
39869
40566
|
throw new Error("Invalid sender address");
|
|
39870
40567
|
return o;
|
|
@@ -40008,7 +40705,7 @@ var Xt = class n38 {
|
|
|
40008
40705
|
}
|
|
40009
40706
|
decodeInputAddress(e) {
|
|
40010
40707
|
let t = this.decodePureArg(e, "address");
|
|
40011
|
-
return (0,
|
|
40708
|
+
return (0, import_utils30.normalizeSuiAddress)(t);
|
|
40012
40709
|
}
|
|
40013
40710
|
decodeInputString(e) {
|
|
40014
40711
|
return this.decodePureArg(e, "string");
|
|
@@ -40031,7 +40728,7 @@ var Xt = class n38 {
|
|
|
40031
40728
|
throw new Error("not pure argument");
|
|
40032
40729
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
40033
40730
|
let a = e.value.Pure;
|
|
40034
|
-
return
|
|
40731
|
+
return import_bcs8.bcs.de(t, new Uint8Array(a));
|
|
40035
40732
|
}
|
|
40036
40733
|
return e.value;
|
|
40037
40734
|
}
|
|
@@ -40041,18 +40738,18 @@ var Xt = class n38 {
|
|
|
40041
40738
|
if (typeof e.value == "object") {
|
|
40042
40739
|
if (!("Object" in e.value) || !("ImmOrOwned" in e.value.Object))
|
|
40043
40740
|
throw new Error("not ImmOrOwned");
|
|
40044
|
-
return (0,
|
|
40741
|
+
return (0, import_utils30.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId);
|
|
40045
40742
|
}
|
|
40046
|
-
return (0,
|
|
40743
|
+
return (0, import_utils30.normalizeSuiAddress)(e.value);
|
|
40047
40744
|
}
|
|
40048
40745
|
static getSharedObjectId(e) {
|
|
40049
40746
|
if (e.type !== "object")
|
|
40050
40747
|
throw new Error(`not object argument: ${JSON.stringify(e)}`);
|
|
40051
40748
|
if (typeof e.value != "object")
|
|
40052
|
-
return (0,
|
|
40749
|
+
return (0, import_utils30.normalizeSuiAddress)(e.value);
|
|
40053
40750
|
if (!("Object" in e.value) || !("Shared" in e.value.Object))
|
|
40054
40751
|
throw new Error("not Shared");
|
|
40055
|
-
return (0,
|
|
40752
|
+
return (0, import_utils30.normalizeSuiAddress)(e.value.Object.Shared.objectId);
|
|
40056
40753
|
}
|
|
40057
40754
|
static getPureInput(e, t) {
|
|
40058
40755
|
if (e.type !== "pure")
|
|
@@ -40062,10 +40759,10 @@ var Xt = class n38 {
|
|
|
40062
40759
|
if (!("Pure" in e.value))
|
|
40063
40760
|
throw new Error("Pure not in value");
|
|
40064
40761
|
let a = e.value.Pure;
|
|
40065
|
-
return
|
|
40762
|
+
return import_bcs8.bcs.de(t, new Uint8Array(a));
|
|
40066
40763
|
}
|
|
40067
40764
|
typeArg(e) {
|
|
40068
|
-
return (0,
|
|
40765
|
+
return (0, import_utils30.normalizeStructTag)(this.moveCall.typeArguments[e]);
|
|
40069
40766
|
}
|
|
40070
40767
|
txArg(e) {
|
|
40071
40768
|
return this.moveCall.arguments[e];
|
|
@@ -40094,7 +40791,7 @@ var Yt = class n39 extends u {
|
|
|
40094
40791
|
txType;
|
|
40095
40792
|
txSubType;
|
|
40096
40793
|
async build() {
|
|
40097
|
-
let { claims: t } = this.data, a = new
|
|
40794
|
+
let { claims: t } = this.data, a = new import_transactions34.TransactionBlock();
|
|
40098
40795
|
return t.forEach((o) => {
|
|
40099
40796
|
let { assetId: r, poolId: i, option: s2, typeArguments: c } = o;
|
|
40100
40797
|
Vo(a, r, i, s2, c);
|
|
@@ -40112,7 +40809,7 @@ var Zt = class n40 extends u {
|
|
|
40112
40809
|
txType;
|
|
40113
40810
|
txSubType;
|
|
40114
40811
|
async build() {
|
|
40115
|
-
let { coinType: t, amount: a } = this.data, o = new
|
|
40812
|
+
let { coinType: t, amount: a } = this.data, o = new import_transactions35.TransactionBlock();
|
|
40116
40813
|
o.setGasBudget(g.gasBudget), console.log("build", this.data);
|
|
40117
40814
|
let r = g.pool[t];
|
|
40118
40815
|
if (!r)
|
|
@@ -40135,7 +40832,7 @@ var ta = class n41 extends u {
|
|
|
40135
40832
|
txType;
|
|
40136
40833
|
txSubType;
|
|
40137
40834
|
async build(t) {
|
|
40138
|
-
let { suiClient: a, account: o } = t, { coinType: r, amount: i } = this.data, s2 = new
|
|
40835
|
+
let { suiClient: a, account: o } = t, { coinType: r, amount: i } = this.data, s2 = new import_transactions36.TransactionBlock();
|
|
40139
40836
|
if (s2.setGasBudget(g.gasBudget), console.log("build", this.data), r === "sui") {
|
|
40140
40837
|
let [p] = s2.splitCoins(s2.gas, [i]);
|
|
40141
40838
|
return vn(s2, g.pool.sui, p, i);
|
|
@@ -40166,7 +40863,7 @@ var aa = class n42 extends u {
|
|
|
40166
40863
|
txType;
|
|
40167
40864
|
txSubType;
|
|
40168
40865
|
async build(t) {
|
|
40169
|
-
let { suiClient: a, account: o } = t, { coinType: r, amount: i } = this.data, s2 = new
|
|
40866
|
+
let { suiClient: a, account: o } = t, { coinType: r, amount: i } = this.data, s2 = new import_transactions37.TransactionBlock();
|
|
40170
40867
|
if (s2.setGasBudget(g.gasBudget), console.log("build", this.data), r === "sui") {
|
|
40171
40868
|
let [p] = s2.splitCoins(s2.gas, [i]);
|
|
40172
40869
|
return An(s2, g.pool.sui, p, i);
|
|
@@ -40197,7 +40894,7 @@ var na = class n43 extends u {
|
|
|
40197
40894
|
txType;
|
|
40198
40895
|
txSubType;
|
|
40199
40896
|
async build() {
|
|
40200
|
-
let { coinType: t, amount: a } = this.data, o = new
|
|
40897
|
+
let { coinType: t, amount: a } = this.data, o = new import_transactions38.TransactionBlock();
|
|
40201
40898
|
console.log("build", this.data), o.setGasBudget(g.gasBudget);
|
|
40202
40899
|
let r = g.pool[t];
|
|
40203
40900
|
if (!r)
|
|
@@ -40248,10 +40945,10 @@ var ra = class {
|
|
|
40248
40945
|
}
|
|
40249
40946
|
async deserialize(e) {
|
|
40250
40947
|
let { transactionBlock: t, suiClient: a } = e, o = await t.build({ client: a });
|
|
40251
|
-
return { txType: import_sui3_utils36.TransactionType.Other, txSubType: As, intentionData: { content: (0,
|
|
40948
|
+
return { txType: import_sui3_utils36.TransactionType.Other, txSubType: As, intentionData: { content: (0, import_utils31.toHEX)(o) } };
|
|
40252
40949
|
}
|
|
40253
40950
|
async build(e) {
|
|
40254
|
-
let { suiClient: t, account: a } = e, o =
|
|
40951
|
+
let { suiClient: t, account: a } = e, o = import_transactions39.TransactionBlock.from((0, import_utils31.fromHEX)(e.intentionData.content)), r = await t.devInspectTransactionBlock({ transactionBlock: o, sender: a.address });
|
|
40255
40952
|
if (!(r.effects.status.status === "success"))
|
|
40256
40953
|
throw new Error(r.effects.status.error);
|
|
40257
40954
|
return o;
|
|
@@ -40617,7 +41314,7 @@ var N = class {
|
|
|
40617
41314
|
throw new Error("not pure argument");
|
|
40618
41315
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
40619
41316
|
let a = e.value.Pure;
|
|
40620
|
-
return
|
|
41317
|
+
return import_bcs9.bcs.de(t, new Uint8Array(a));
|
|
40621
41318
|
}
|
|
40622
41319
|
return e.value;
|
|
40623
41320
|
}
|
|
@@ -40645,7 +41342,7 @@ var T = class n44 {
|
|
|
40645
41342
|
}
|
|
40646
41343
|
decodeInputAddress(e) {
|
|
40647
41344
|
let t = this.decodePureArg(e, "address");
|
|
40648
|
-
return (0,
|
|
41345
|
+
return (0, import_utils32.normalizeSuiAddress)(t);
|
|
40649
41346
|
}
|
|
40650
41347
|
decodeInputString(e) {
|
|
40651
41348
|
return this.decodePureArg(e, "string");
|
|
@@ -40677,7 +41374,7 @@ var T = class n44 {
|
|
|
40677
41374
|
throw new Error("not pure argument");
|
|
40678
41375
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
40679
41376
|
let a = e.value.Pure;
|
|
40680
|
-
return
|
|
41377
|
+
return import_bcs9.bcs.de(t, new Uint8Array(a));
|
|
40681
41378
|
}
|
|
40682
41379
|
return e.value;
|
|
40683
41380
|
}
|
|
@@ -40687,18 +41384,18 @@ var T = class n44 {
|
|
|
40687
41384
|
if (typeof e.value == "object") {
|
|
40688
41385
|
if (!("Object" in e.value) || !("ImmOrOwned" in e.value.Object))
|
|
40689
41386
|
throw new Error("not ImmOrOwned");
|
|
40690
|
-
return (0,
|
|
41387
|
+
return (0, import_utils32.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId);
|
|
40691
41388
|
}
|
|
40692
|
-
return (0,
|
|
41389
|
+
return (0, import_utils32.normalizeSuiAddress)(e.value);
|
|
40693
41390
|
}
|
|
40694
41391
|
static getSharedObjectId(e) {
|
|
40695
41392
|
if (e.type !== "object")
|
|
40696
41393
|
throw new Error(`not object argument: ${JSON.stringify(e)}`);
|
|
40697
41394
|
if (typeof e.value != "object")
|
|
40698
|
-
return (0,
|
|
41395
|
+
return (0, import_utils32.normalizeSuiAddress)(e.value);
|
|
40699
41396
|
if (!("Object" in e.value) || !("Shared" in e.value.Object))
|
|
40700
41397
|
throw new Error("not Shared");
|
|
40701
|
-
return (0,
|
|
41398
|
+
return (0, import_utils32.normalizeSuiAddress)(e.value.Object.Shared.objectId);
|
|
40702
41399
|
}
|
|
40703
41400
|
static getPureInput(e, t) {
|
|
40704
41401
|
if (e.type !== "pure")
|
|
@@ -40708,10 +41405,10 @@ var T = class n44 {
|
|
|
40708
41405
|
if (!("Pure" in e.value))
|
|
40709
41406
|
throw new Error("Pure not in value");
|
|
40710
41407
|
let a = e.value.Pure;
|
|
40711
|
-
return
|
|
41408
|
+
return import_bcs9.bcs.de(t, new Uint8Array(a));
|
|
40712
41409
|
}
|
|
40713
41410
|
typeArg(e) {
|
|
40714
|
-
return (0,
|
|
41411
|
+
return (0, import_utils32.normalizeStructTag)(this.moveCall.typeArguments[e]);
|
|
40715
41412
|
}
|
|
40716
41413
|
txArg(e) {
|
|
40717
41414
|
return this.moveCall.arguments[e];
|
|
@@ -40816,9 +41513,9 @@ var ke = (n83) => {
|
|
|
40816
41513
|
if (n83 === void 0)
|
|
40817
41514
|
throw new Error("veSca not found");
|
|
40818
41515
|
};
|
|
40819
|
-
var _s = (n83) => ({ pointType: (0,
|
|
40820
|
-
var or = (n83) => ({ poolType: (0,
|
|
40821
|
-
let a = _s(t), o = (0,
|
|
41516
|
+
var _s = (n83) => ({ pointType: (0, import_utils36.normalizeStructTag)(n83.point_type.name), weightedAmount: Number(n83.weighted_amount), points: Number(n83.points), totalPoints: Number(n83.total_points), index: Number(n83.index) });
|
|
41517
|
+
var or = (n83) => ({ poolType: (0, import_utils36.normalizeStructTag)(n83.pool_type.name), debtAmount: Number(n83.debt_amount), pointList: n83.points_list.reduce((e, t) => {
|
|
41518
|
+
let a = _s(t), o = (0, import_utils36.parseStructTag)(a.pointType).name.toLowerCase();
|
|
40822
41519
|
return e[o] = a, e;
|
|
40823
41520
|
}, {}) });
|
|
40824
41521
|
var Dn = (n83) => {
|
|
@@ -40866,7 +41563,7 @@ var oe = class {
|
|
|
40866
41563
|
if (!a)
|
|
40867
41564
|
throw Error(`Coin ${e} is not supported`);
|
|
40868
41565
|
if (e === "sui")
|
|
40869
|
-
return (0,
|
|
41566
|
+
return (0, import_utils35.normalizeStructTag)(`${a}::sui::SUI`);
|
|
40870
41567
|
let o = [this._address.get("core.coins.usdc.id") ?? B.usdc, this._address.get("core.coins.usdt.id") ?? B.usdt, this._address.get("core.coins.eth.id") ?? B.eth, this._address.get("core.coins.btc.id") ?? B.btc, this._address.get("core.coins.sol.id") ?? B.sol, this._address.get("core.coins.apt.id") ?? B.apt], r = [this._address.get("core.coins.vsui.id") ?? On.vsui];
|
|
40871
41568
|
return o.includes(a) ? `${a}::coin::COIN` : r.includes(a) ? `${a}::cert::CERT` : `${a}::${t}::${t.toUpperCase()}`;
|
|
40872
41569
|
}
|
|
@@ -40875,7 +41572,7 @@ var oe = class {
|
|
|
40875
41572
|
return `${t}::reserve::MarketCoin<${a}>`;
|
|
40876
41573
|
}
|
|
40877
41574
|
parseCoinNameFromType(e) {
|
|
40878
|
-
let t = (0,
|
|
41575
|
+
let t = (0, import_utils35.normalizeStructTag)(e), a = /((0x[^:]+::[^:]+::[^<>]+))(?![^<>]*<)/, o = e.match(a), r = e.includes("reserve::MarketCoin");
|
|
40879
41576
|
t = o?.[1] || e;
|
|
40880
41577
|
let i = { [`${this._address.get("core.coins.usdc.id") ?? B.usdc}::coin::COIN`]: "usdc", [`${this._address.get("core.coins.usdt.id") ?? B.usdt}::coin::COIN`]: "usdt", [`${this._address.get("core.coins.eth.id") ?? B.eth}::coin::COIN`]: "eth", [`${this._address.get("core.coins.btc.id") ?? B.btc}::coin::COIN`]: "btc", [`${this._address.get("core.coins.sol.id") ?? B.sol}::coin::COIN`]: "sol", [`${this._address.get("core.coins.apt.id") ?? B.apt}::coin::COIN`]: "apt" }, s2 = { [`${this._address.get("core.coins.vsui.id") ?? On.vsui}::cert::CERT`]: "vsui" }, c = i[t] || s2[t] || t.split("::")[2].toLowerCase();
|
|
40881
41578
|
return r ? this.parseMarketCoinName(c) : c;
|
|
@@ -40894,7 +41591,7 @@ var oe = class {
|
|
|
40894
41591
|
getCoinWrappedType(e) {
|
|
40895
41592
|
return e === "usdc" || e === "usdt" || e === "eth" || e === "btc" || e === "apt" || e === "sol" ? { from: "Wormhole", type: "Portal from Ethereum" } : void 0;
|
|
40896
41593
|
}
|
|
40897
|
-
async selectCoinIds(e, t =
|
|
41594
|
+
async selectCoinIds(e, t = import_utils35.SUI_TYPE_ARG, a) {
|
|
40898
41595
|
let o = a, r = [], i = 0, s2 = true, c = null;
|
|
40899
41596
|
for (; s2 && i < e; ) {
|
|
40900
41597
|
let l2 = await this.client.getCoins({ owner: o, coinType: t, cursor: c });
|
|
@@ -41010,7 +41707,7 @@ var lr = async (n83, e, t) => {
|
|
|
41010
41707
|
}), c;
|
|
41011
41708
|
};
|
|
41012
41709
|
var ur = async (n83, e) => {
|
|
41013
|
-
let a = `${n83.address.get("core.packages.query.id")}::obligation_query::obligation_data`, o = new
|
|
41710
|
+
let a = `${n83.address.get("core.packages.query.id")}::obligation_query::obligation_data`, o = new import_transactions42.TransactionBlock();
|
|
41014
41711
|
return o.moveCall({ target: a, arguments: [o.object(e)] }), (await n83.client.devInspectTransactionBlock({ transactionBlock: o, sender: n83.walletAddress })).events[0].parsedJson;
|
|
41015
41712
|
};
|
|
41016
41713
|
var Ke = async (n83, e) => {
|
|
@@ -41027,7 +41724,7 @@ var Ke = async (n83, e) => {
|
|
|
41027
41724
|
let b = m.data.objectId, f = m.data.type;
|
|
41028
41725
|
if (m.data.content && "fields" in m.data.content) {
|
|
41029
41726
|
let y = m.data.content.fields, C = String(y.spool_id), _ = String(y.stake_type.fields.name), U = Number(y.stakes), K = Number(y.index), H = Number(y.points), z = Number(y.total_points);
|
|
41030
|
-
(0,
|
|
41727
|
+
(0, import_utils37.normalizeStructTag)(f) === l2.seth ? c.seth.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.ssui ? c.ssui.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.susdc ? c.susdc.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.susdt ? c.susdt.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.scetus ? c.scetus.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.safsui ? c.safsui.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.shasui ? c.shasui.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z }) : (0, import_utils37.normalizeStructTag)(f) === l2.svsui && c.svsui.push({ id: b, type: (0, import_utils37.normalizeStructTag)(f), stakePoolId: C, stakeType: (0, import_utils37.normalizeStructTag)(_), staked: U, index: K, points: H, totalPoints: z });
|
|
41031
41728
|
}
|
|
41032
41729
|
}), c;
|
|
41033
41730
|
};
|
|
@@ -41037,7 +41734,7 @@ var jn = async (n83, e) => {
|
|
|
41037
41734
|
let r = o.data, i = r.objectId, s2 = r.type;
|
|
41038
41735
|
if (r.content && "fields" in r.content) {
|
|
41039
41736
|
let c = r.content.fields, l2 = Number(c.max_distributed_point), d2 = Number(c.distributed_point), p = Number(c.distributed_point_per_period), m = Number(c.point_distribution_time), b = Number(c.max_stakes), f = String(c.stake_type.fields.name), y = Number(c.stakes), C = Number(c.index), _ = Number(c.created_at), U = Number(c.last_update);
|
|
41040
|
-
a = { id: i, type: (0,
|
|
41737
|
+
a = { id: i, type: (0, import_utils37.normalizeStructTag)(s2), maxPoint: l2, distributedPoint: d2, pointPerPeriod: p, period: m, maxStake: b, stakeType: (0, import_utils37.normalizeStructTag)(f), totalStaked: y, index: C, createdAt: _, lastUpdate: U };
|
|
41041
41738
|
}
|
|
41042
41739
|
}
|
|
41043
41740
|
return a;
|
|
@@ -41048,13 +41745,13 @@ var Rn = async (n83, e) => {
|
|
|
41048
41745
|
let r = o.data, i = r.objectId, s2 = r.type;
|
|
41049
41746
|
if (r.content && "fields" in r.content) {
|
|
41050
41747
|
let c = r.content.fields, l2 = String(c.spool_id), d2 = Number(c.exchange_rate_numerator), p = Number(c.exchange_rate_denominator), m = Number(c.rewards), b = Number(c.claimed_rewards);
|
|
41051
|
-
a = { id: i, type: (0,
|
|
41748
|
+
a = { id: i, type: (0, import_utils37.normalizeStructTag)(s2), stakePoolId: l2, ratioNumerator: d2, ratioDenominator: p, rewards: m, claimedRewards: b };
|
|
41052
41749
|
}
|
|
41053
41750
|
}
|
|
41054
41751
|
return a;
|
|
41055
41752
|
};
|
|
41056
41753
|
var pr = async (n83, e, t, a) => {
|
|
41057
|
-
let o = a || [...Ie], r = n83.address.get("borrowIncentive.query"), i = n83.address.get("borrowIncentive.incentiveAccounts"), s2 = `${r}::incentive_account_query::incentive_account_data`, c = new
|
|
41754
|
+
let o = a || [...Ie], r = n83.address.get("borrowIncentive.query"), i = n83.address.get("borrowIncentive.incentiveAccounts"), s2 = `${r}::incentive_account_query::incentive_account_data`, c = new import_transactions43.TransactionBlock();
|
|
41058
41755
|
c.moveCall({ target: s2, arguments: [c.object(i), c.object(e)] });
|
|
41059
41756
|
let d2 = (await n83.client.devInspectTransactionBlock({ transactionBlock: c, sender: t })).events[0].parsedJson, p = {};
|
|
41060
41757
|
return d2.pool_records.forEach((m) => {
|
|
@@ -41172,13 +41869,13 @@ var Ae = class {
|
|
|
41172
41869
|
client;
|
|
41173
41870
|
walletAddress;
|
|
41174
41871
|
constructor(e, t) {
|
|
41175
|
-
this.params = e, this.address = t?.address ?? new Q({ id: e?.addressesId || te, network: e?.networkType }), this.query = t?.query ?? new ve(e, { address: this.address }), this.utils = t?.utils ?? new oe(this.params, { address: this.address, query: this.query }), this.client = e.client, this.walletAddress = (0,
|
|
41872
|
+
this.params = e, this.address = t?.address ?? new Q({ id: e?.addressesId || te, network: e?.networkType }), this.query = t?.query ?? new ve(e, { address: this.address }), this.utils = t?.utils ?? new oe(this.params, { address: this.address, query: this.query }), this.client = e.client, this.walletAddress = (0, import_utils34.normalizeSuiAddress)(e.walletAddress), this.isTestnet = e.networkType ? e.networkType === "testnet" : false;
|
|
41176
41873
|
}
|
|
41177
41874
|
async init(e = false, t) {
|
|
41178
41875
|
e || !this.address.getAddresses() || !t?.getAddresses() ? this.address.read() : this.address = t, this.query.init(e, this.address), this.utils.init(e, this.address);
|
|
41179
41876
|
}
|
|
41180
41877
|
createTxBlock(e) {
|
|
41181
|
-
return new
|
|
41878
|
+
return new import_transactions41.TransactionBlock(e);
|
|
41182
41879
|
}
|
|
41183
41880
|
async selectCoin(e, t, a, o) {
|
|
41184
41881
|
let r = this.utils.parseCoinType(t), i = await this.utils.selectCoinIds(a, r, o), [s2, c] = this.utils.takeAmountFromCoins(e, i, a);
|
|
@@ -41220,19 +41917,19 @@ var Mn = async (...n83) => {
|
|
|
41220
41917
|
var Ws = ({ builder: n83, txBlock: e }) => {
|
|
41221
41918
|
let t = { borrowIncentivePkg: n83.address.get("borrowIncentive.id"), query: n83.address.get("borrowIncentive.query"), incentivePools: n83.address.get("borrowIncentive.incentivePools"), incentiveAccounts: n83.address.get("borrowIncentive.incentiveAccounts"), obligationAccessStore: n83.address.get("core.obligationAccessStore"), config: n83.address.get("borrowIncentive.config") }, a = { id: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410", incentivePools: "0x64972b713ccec45ec3964809e477cea6f97350c0c50ca3aec85bb631639266ec", incentiveAccounts: "0x3c0b707068bdcea8bb859d751ad3e2149a9f83c13fcf4054ef91372a00bccdd3" }, o = { table: n83.address.get("vesca.table"), treasury: n83.address.get("vesca.treasury"), config: n83.address.get("vesca.config") };
|
|
41222
41919
|
return { stakeObligation: (r, i) => {
|
|
41223
|
-
e.moveCall({ target: `${t.borrowIncentivePkg}::user::stake`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(t.obligationAccessStore), e.object(
|
|
41920
|
+
e.moveCall({ target: `${t.borrowIncentivePkg}::user::stake`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(t.obligationAccessStore), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)] });
|
|
41224
41921
|
}, stakeObligationWithVesca: (r, i, s2) => {
|
|
41225
|
-
e.moveCall({ target: `${t.borrowIncentivePkg}::user::stake_with_ve_sca`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(t.obligationAccessStore), e.object(o.config), e.object(o.treasury), e.object(o.table), e.object(s2), e.object(
|
|
41922
|
+
e.moveCall({ target: `${t.borrowIncentivePkg}::user::stake_with_ve_sca`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(t.obligationAccessStore), e.object(o.config), e.object(o.treasury), e.object(o.table), e.object(s2), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)] });
|
|
41226
41923
|
}, unstakeObligation: (r, i) => {
|
|
41227
|
-
e.moveCall({ target: `${t.borrowIncentivePkg}::user::unstake`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(
|
|
41924
|
+
e.moveCall({ target: `${t.borrowIncentivePkg}::user::unstake`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)] });
|
|
41228
41925
|
}, oldUnstakeObligation: (r, i) => {
|
|
41229
|
-
e.moveCall({ target: `${t.borrowIncentivePkg}::user::unstake`, arguments: [e.object(a.incentivePools), e.object(a.incentiveAccounts), e.object(i), e.object(r), e.object(
|
|
41926
|
+
e.moveCall({ target: `${t.borrowIncentivePkg}::user::unstake`, arguments: [e.object(a.incentivePools), e.object(a.incentiveAccounts), e.object(i), e.object(r), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)], typeArguments: [import_utils39.SUI_TYPE_ARG] });
|
|
41230
41927
|
}, claimBorrowIncentive: (r, i, s2) => {
|
|
41231
41928
|
let c = n83.utils.parseCoinType(s2);
|
|
41232
|
-
return e.moveCall({ target: `${t.borrowIncentivePkg}::user::redeem_rewards`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(
|
|
41929
|
+
return e.moveCall({ target: `${t.borrowIncentivePkg}::user::redeem_rewards`, arguments: [e.object(t.config), e.object(t.incentivePools), e.object(t.incentiveAccounts), e.object(i), e.object(r), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)], typeArguments: [c] });
|
|
41233
41930
|
}, oldClaimBorrowIncentive(r, i, s2) {
|
|
41234
41931
|
let c = n83.utils.parseCoinType(s2);
|
|
41235
|
-
return e.moveCall({ target: `${a.id}::user::redeem_rewards`, arguments: [e.object(a.incentivePools), e.object(a.incentiveAccounts), e.object(i), e.object(r), e.object(
|
|
41932
|
+
return e.moveCall({ target: `${a.id}::user::redeem_rewards`, arguments: [e.object(a.incentivePools), e.object(a.incentiveAccounts), e.object(i), e.object(r), e.object(import_utils39.SUI_CLOCK_OBJECT_ID)], typeArguments: [c] });
|
|
41236
41933
|
} };
|
|
41237
41934
|
};
|
|
41238
41935
|
var E = ({ builder: n83, txBlock: e }) => {
|
|
@@ -41291,7 +41988,7 @@ var ba = class {
|
|
|
41291
41988
|
async verifyVaas(e, t) {
|
|
41292
41989
|
let a = await this.getWormholePackageId(), o = [];
|
|
41293
41990
|
return e.forEach((r) => {
|
|
41294
|
-
let [i] = t.moveCall({ target: `${a}::vaa::parse_and_verify`, arguments: [t.object(this.wormholeStateId), t.pure(
|
|
41991
|
+
let [i] = t.moveCall({ target: `${a}::vaa::parse_and_verify`, arguments: [t.object(this.wormholeStateId), t.pure(import_bcs10.bcs.ser("vector<u8>", Array.from(r), { maxSize: Wn }).toBytes()), t.object(import_utils42.SUI_CLOCK_OBJECT_ID)] });
|
|
41295
41992
|
o.push(i);
|
|
41296
41993
|
}), o;
|
|
41297
41994
|
}
|
|
@@ -41300,13 +41997,13 @@ var ba = class {
|
|
|
41300
41997
|
if (t.length > 1)
|
|
41301
41998
|
throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");
|
|
41302
41999
|
let i = this.extractVaaBytesFromAccumulatorMessage(t[0]), s2 = await this.verifyVaas([i], e);
|
|
41303
|
-
[r] = e.moveCall({ target: `${o}::pyth::create_authenticated_price_infos_using_accumulator`, arguments: [e.object(this.pythStateId), e.pure(
|
|
42000
|
+
[r] = e.moveCall({ target: `${o}::pyth::create_authenticated_price_infos_using_accumulator`, arguments: [e.object(this.pythStateId), e.pure(import_bcs10.bcs.ser("vector<u8>", Array.from(t[0]), { maxSize: Wn }).toBytes()), s2[0], e.object(import_utils42.SUI_CLOCK_OBJECT_ID)] });
|
|
41304
42001
|
let c = [], l2 = await this.getBaseUpdateFee(), d2 = e.splitCoins(e.gas, a.map(() => e.pure(l2))), p = 0;
|
|
41305
42002
|
for (let m = 0; m < a.length; m++) {
|
|
41306
42003
|
let b = await this.getPriceFeedObjectId(a[m]);
|
|
41307
42004
|
if (!b)
|
|
41308
42005
|
throw new Error(`Price feed ${a[0]} not found, please create it first`);
|
|
41309
|
-
c.push(b), [r] = e.moveCall({ target: `${o}::pyth::update_single_price_feed`, arguments: [e.object(this.pythStateId), r, e.object(b), d2[p], e.object(
|
|
42006
|
+
c.push(b), [r] = e.moveCall({ target: `${o}::pyth::update_single_price_feed`, arguments: [e.object(this.pythStateId), r, e.object(b), d2[p], e.object(import_utils42.SUI_CLOCK_OBJECT_ID)] }), p++;
|
|
41310
42007
|
}
|
|
41311
42008
|
return e.moveCall({ target: `${o}::hot_potato_vector::destroy`, arguments: [r], typeArguments: [`${o}::price_info::PriceInfo`] }), c;
|
|
41312
42009
|
}
|
|
@@ -41315,7 +42012,7 @@ var ba = class {
|
|
|
41315
42012
|
if (t.length > 1)
|
|
41316
42013
|
throw new Error("SDK does not support sending multiple accumulator messages in a single transaction");
|
|
41317
42014
|
let o = this.extractVaaBytesFromAccumulatorMessage(t[0]), r = await this.verifyVaas([o], e);
|
|
41318
|
-
e.moveCall({ target: `${a}::pyth::create_price_feeds_using_accumulator`, arguments: [e.object(this.pythStateId), e.pure(
|
|
42015
|
+
e.moveCall({ target: `${a}::pyth::create_price_feeds_using_accumulator`, arguments: [e.object(this.pythStateId), e.pure(import_bcs10.bcs.ser("vector<u8>", Array.from(t[0]), { maxSize: Wn }).toBytes()), r[0], e.object(import_utils42.SUI_CLOCK_OBJECT_ID)] });
|
|
41319
42016
|
}
|
|
41320
42017
|
async getWormholePackageId() {
|
|
41321
42018
|
return this.wormholePackageId || (this.wormholePackageId = await this.getPackageId(this.wormholeStateId)), this.wormholePackageId;
|
|
@@ -41350,7 +42047,7 @@ var ba = class {
|
|
|
41350
42047
|
return e.subarray(r, r + o);
|
|
41351
42048
|
}
|
|
41352
42049
|
};
|
|
41353
|
-
var Us = async (n83, e) => (await
|
|
42050
|
+
var Us = async (n83, e) => (await import_axios3.default.get(`${n83}/api/latest_vaas`, { params: { ids: e } })).data.map((o) => Buffer.from(o, "base64"));
|
|
41354
42051
|
var ga = async (n83, e, t) => {
|
|
41355
42052
|
let a = t ?? [.../* @__PURE__ */ new Set([...de, ...ca])], o = n83.isTestnet ? ["pyth"] : ["pyth"];
|
|
41356
42053
|
if (o.includes("pyth")) {
|
|
@@ -41380,19 +42077,19 @@ var Qs = (n83, e, t, a) => {
|
|
|
41380
42077
|
};
|
|
41381
42078
|
var Vs = (n83, e, t, a, o) => {
|
|
41382
42079
|
let r = `${e}::x_oracle::confirm_price_update_request`, i = [o], s2 = typeof t == "string" ? n83.object(t) : t;
|
|
41383
|
-
return n83.moveCall({ target: r, arguments: [s2, a, n83.object(
|
|
42080
|
+
return n83.moveCall({ target: r, arguments: [s2, a, n83.object(import_utils41.SUI_CLOCK_OBJECT_ID)], typeArguments: i }), n83;
|
|
41384
42081
|
};
|
|
41385
42082
|
var Gs = (n83, e, t, a, o, r) => {
|
|
41386
42083
|
let i = typeof a == "string" ? n83.object(a) : a, s2 = typeof o == "string" ? n83.object(o) : o;
|
|
41387
|
-
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [t, i, s2, n83.object(
|
|
42084
|
+
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [t, i, s2, n83.object(import_utils41.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41388
42085
|
};
|
|
41389
42086
|
var Ks = (n83, e, t, a, o, r) => {
|
|
41390
42087
|
let i = typeof a == "string" ? n83.object(a) : a, s2 = typeof o == "string" ? n83.object(o) : o;
|
|
41391
|
-
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [t, i, s2, n83.object(
|
|
42088
|
+
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [t, i, s2, n83.object(import_utils41.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41392
42089
|
};
|
|
41393
42090
|
var Hs = (n83, e, t, a, o, r, i) => {
|
|
41394
42091
|
let s2 = typeof t == "string" ? n83.object(t) : t, c = typeof a == "string" ? n83.object(a) : a, l2 = typeof o == "string" ? n83.object(o) : o, d2 = typeof r == "string" ? n83.object(r) : r;
|
|
41395
|
-
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [s2, c, l2, d2, n83.object(
|
|
42092
|
+
n83.moveCall({ target: `${e}::rule::set_price`, arguments: [s2, c, l2, d2, n83.object(import_utils41.SUI_CLOCK_OBJECT_ID)], typeArguments: [i] });
|
|
41396
42093
|
};
|
|
41397
42094
|
var ha = async (...n83) => {
|
|
41398
42095
|
let [e, t, a, o] = n83;
|
|
@@ -41412,28 +42109,28 @@ var zs = ({ builder: n83, txBlock: e }) => {
|
|
|
41412
42109
|
return e.moveCall({ target: `${t.protocolPkg}::deposit_collateral::deposit_collateral`, arguments: [e.object(t.version), e.object(a), e.object(t.market), typeof o != "string" ? o : e.pure(o)], typeArguments: [i] });
|
|
41413
42110
|
}, takeCollateral: (a, o, r, i) => {
|
|
41414
42111
|
let s2 = n83.utils.parseCoinType(i);
|
|
41415
|
-
return e.moveCall({ target: `${t.protocolPkg}::withdraw_collateral::withdraw_collateral`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(
|
|
42112
|
+
return e.moveCall({ target: `${t.protocolPkg}::withdraw_collateral::withdraw_collateral`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [s2] });
|
|
41416
42113
|
}, deposit: (a, o) => {
|
|
41417
42114
|
let r = n83.utils.parseCoinType(o);
|
|
41418
|
-
return e.moveCall({ target: `${t.protocolPkg}::mint::mint`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(
|
|
42115
|
+
return e.moveCall({ target: `${t.protocolPkg}::mint::mint`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41419
42116
|
}, depositEntry: (a, o) => {
|
|
41420
42117
|
let r = n83.utils.parseCoinType(o);
|
|
41421
|
-
return e.moveCall({ target: `${t.protocolPkg}::mint::mint_entry`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(
|
|
42118
|
+
return e.moveCall({ target: `${t.protocolPkg}::mint::mint_entry`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41422
42119
|
}, withdraw: (a, o) => {
|
|
41423
42120
|
let r = n83.utils.parseCoinType(o);
|
|
41424
|
-
return e.moveCall({ target: `${t.protocolPkg}::redeem::redeem`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(
|
|
42121
|
+
return e.moveCall({ target: `${t.protocolPkg}::redeem::redeem`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41425
42122
|
}, withdrawEntry: (a, o) => {
|
|
41426
42123
|
let r = n83.utils.parseCoinType(o);
|
|
41427
|
-
return e.moveCall({ target: `${t.protocolPkg}::redeem::redeem_entry`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(
|
|
42124
|
+
return e.moveCall({ target: `${t.protocolPkg}::redeem::redeem_entry`, arguments: [e.object(t.version), e.object(t.market), typeof a != "string" ? a : e.pure(a), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [r] });
|
|
41428
42125
|
}, borrow: (a, o, r, i) => {
|
|
41429
42126
|
let s2 = n83.utils.parseCoinType(i);
|
|
41430
|
-
return e.moveCall({ target: `${t.protocolPkg}::borrow::borrow`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(
|
|
42127
|
+
return e.moveCall({ target: `${t.protocolPkg}::borrow::borrow`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [s2] });
|
|
41431
42128
|
}, borrowEntry: (a, o, r, i) => {
|
|
41432
42129
|
let s2 = n83.utils.parseCoinType(i);
|
|
41433
|
-
return e.moveCall({ target: `${t.protocolPkg}::borrow::borrow_entry`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(
|
|
42130
|
+
return e.moveCall({ target: `${t.protocolPkg}::borrow::borrow_entry`, arguments: [e.object(t.version), e.object(a), e.object(o), e.object(t.market), e.object(t.coinDecimalsRegistry), e.pure(r), e.object(t.xOracle), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [s2] });
|
|
41434
42131
|
}, repay: (a, o, r) => {
|
|
41435
42132
|
let i = n83.utils.parseCoinType(r);
|
|
41436
|
-
return e.moveCall({ target: `${t.protocolPkg}::repay::repay`, arguments: [e.object(t.version), e.object(a), e.object(t.market), typeof o != "string" ? o : e.pure(o), e.object(
|
|
42133
|
+
return e.moveCall({ target: `${t.protocolPkg}::repay::repay`, arguments: [e.object(t.version), e.object(a), e.object(t.market), typeof o != "string" ? o : e.pure(o), e.object(import_utils40.SUI_CLOCK_OBJECT_ID)], typeArguments: [i] });
|
|
41437
42134
|
}, borrowFlashLoan: (a, o) => {
|
|
41438
42135
|
let r = n83.utils.parseCoinType(o);
|
|
41439
42136
|
return e.moveCall({ target: `${t.protocolPkg}::flash_loan::borrow_flash_loan`, arguments: [e.object(t.version), e.object(t.market), e.pure(a)], typeArguments: [r] });
|
|
@@ -41498,16 +42195,16 @@ var Xs = ({ builder: n83, txBlock: e }) => {
|
|
|
41498
42195
|
let t = { spoolPkg: n83.address.get("spool.id") };
|
|
41499
42196
|
return { createStakeAccount: (a) => {
|
|
41500
42197
|
let o = n83.utils.parseMarketCoinType(a), r = n83.address.get(`spool.pools.${a}.id`);
|
|
41501
|
-
return e.moveCall({ target: `${t.spoolPkg}::user::new_spool_account`, arguments: [e.object(r), e.object(
|
|
42198
|
+
return e.moveCall({ target: `${t.spoolPkg}::user::new_spool_account`, arguments: [e.object(r), e.object(import_utils43.SUI_CLOCK_OBJECT_ID)], typeArguments: [o] });
|
|
41502
42199
|
}, stake: (a, o, r) => {
|
|
41503
42200
|
let i = n83.utils.parseMarketCoinType(r), s2 = n83.address.get(`spool.pools.${r}.id`);
|
|
41504
|
-
e.moveCall({ target: `${t.spoolPkg}::user::stake`, arguments: [e.object(s2), e.object(a), typeof o == "string" ? e.pure(o) : o, e.object(
|
|
42201
|
+
e.moveCall({ target: `${t.spoolPkg}::user::stake`, arguments: [e.object(s2), e.object(a), typeof o == "string" ? e.pure(o) : o, e.object(import_utils43.SUI_CLOCK_OBJECT_ID)], typeArguments: [i] });
|
|
41505
42202
|
}, unstake: (a, o, r) => {
|
|
41506
42203
|
let i = n83.utils.parseMarketCoinType(r), s2 = n83.address.get(`spool.pools.${r}.id`);
|
|
41507
|
-
return e.moveCall({ target: `${t.spoolPkg}::user::unstake`, arguments: [e.object(s2), e.object(a), e.pure(o), e.object(
|
|
42204
|
+
return e.moveCall({ target: `${t.spoolPkg}::user::unstake`, arguments: [e.object(s2), e.object(a), e.pure(o), e.object(import_utils43.SUI_CLOCK_OBJECT_ID)], typeArguments: [i] });
|
|
41508
42205
|
}, claim: (a, o) => {
|
|
41509
42206
|
let r = n83.address.get(`spool.pools.${o}.id`), i = n83.address.get(`spool.pools.${o}.rewardPoolId`), s2 = n83.utils.parseMarketCoinType(o), c = da[o], l2 = n83.utils.parseCoinType(c);
|
|
41510
|
-
return e.moveCall({ target: `${t.spoolPkg}::user::redeem_rewards`, arguments: [e.object(r), e.object(i), e.object(a), e.object(
|
|
42207
|
+
return e.moveCall({ target: `${t.spoolPkg}::user::redeem_rewards`, arguments: [e.object(r), e.object(i), e.object(a), e.object(import_utils43.SUI_CLOCK_OBJECT_ID)], typeArguments: [s2, l2] });
|
|
41511
42208
|
} };
|
|
41512
42209
|
};
|
|
41513
42210
|
var ue = ({ builder: n83, txBlock: e }) => {
|
|
@@ -41539,13 +42236,13 @@ var ue = ({ builder: n83, txBlock: e }) => {
|
|
|
41539
42236
|
};
|
|
41540
42237
|
var Ys = ({ builder: n83, txBlock: e }) => {
|
|
41541
42238
|
let t = { pkgId: n83.address.get("vesca.id"), table: n83.address.get("vesca.table"), treasury: n83.address.get("vesca.treasury"), config: n83.address.get("vesca.config") };
|
|
41542
|
-
return { lockSca: (a, o) => e.moveCall({ target: `${t.pkgId}::ve_sca::mint_ve_sca_key`, arguments: [e.object(t.config), e.object(t.table), e.object(t.treasury), typeof a == "string" ? e.pure(a) : a, e.pure(o), e.object(
|
|
41543
|
-
e.moveCall({ target: `${t.pkgId}::ve_sca::extend_lock_period`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), e.pure(o), e.object(
|
|
42239
|
+
return { lockSca: (a, o) => e.moveCall({ target: `${t.pkgId}::ve_sca::mint_ve_sca_key`, arguments: [e.object(t.config), e.object(t.table), e.object(t.treasury), typeof a == "string" ? e.pure(a) : a, e.pure(o), e.object(import_utils44.SUI_CLOCK_OBJECT_ID)] }), extendLockPeriod: (a, o) => {
|
|
42240
|
+
e.moveCall({ target: `${t.pkgId}::ve_sca::extend_lock_period`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), e.pure(o), e.object(import_utils44.SUI_CLOCK_OBJECT_ID)] });
|
|
41544
42241
|
}, extendLockAmount: (a, o) => {
|
|
41545
|
-
e.moveCall({ target: `${t.pkgId}::ve_sca::lock_more_sca`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), typeof o == "string" ? e.pure(o) : o, e.object(
|
|
42242
|
+
e.moveCall({ target: `${t.pkgId}::ve_sca::lock_more_sca`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), typeof o == "string" ? e.pure(o) : o, e.object(import_utils44.SUI_CLOCK_OBJECT_ID)] });
|
|
41546
42243
|
}, renewExpiredVeSca: (a, o, r) => {
|
|
41547
|
-
e.moveCall({ target: `${t.pkgId}::ve_sca::renew_expired_ve_sca`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), typeof o == "string" ? e.pure(o) : o, e.pure(r), e.object(
|
|
41548
|
-
}, redeemSca: (a) => e.moveCall({ target: `${t.pkgId}::ve_sca::redeem`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), e.object(
|
|
42244
|
+
e.moveCall({ target: `${t.pkgId}::ve_sca::renew_expired_ve_sca`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), typeof o == "string" ? e.pure(o) : o, e.pure(r), e.object(import_utils44.SUI_CLOCK_OBJECT_ID)] });
|
|
42245
|
+
}, redeemSca: (a) => e.moveCall({ target: `${t.pkgId}::ve_sca::redeem`, arguments: [e.object(t.config), e.object(a), e.object(t.table), e.object(t.treasury), e.object(import_utils44.SUI_CLOCK_OBJECT_ID)] }) };
|
|
41549
42246
|
};
|
|
41550
42247
|
var pe = ({ builder: n83, txBlock: e }) => {
|
|
41551
42248
|
let t = Ys({ builder: n83, txBlock: e });
|
|
@@ -41611,7 +42308,7 @@ var h = class {
|
|
|
41611
42308
|
utils;
|
|
41612
42309
|
walletAddress;
|
|
41613
42310
|
constructor(e, t) {
|
|
41614
|
-
this.params = e, this.client = e.client, this.address = t?.address ?? new Q({ id: e?.addressesId || te, network: e?.networkType }), this.query = t?.query ?? new ve(e, { address: this.address }), this.utils = t?.utils ?? new oe(e, { address: this.address, query: this.query }), this.builder = t?.builder ?? new Ae(e, { address: this.address, query: this.query, utils: this.utils }), this.walletAddress = (0,
|
|
42311
|
+
this.params = e, this.client = e.client, this.address = t?.address ?? new Q({ id: e?.addressesId || te, network: e?.networkType }), this.query = t?.query ?? new ve(e, { address: this.address }), this.utils = t?.utils ?? new oe(e, { address: this.address, query: this.query }), this.builder = t?.builder ?? new Ae(e, { address: this.address, query: this.query, utils: this.utils }), this.walletAddress = (0, import_utils33.normalizeSuiAddress)(e.walletAddress);
|
|
41615
42312
|
}
|
|
41616
42313
|
init(e = false) {
|
|
41617
42314
|
(e || !this.address.getAddresses()) && this.address.read(), this.builder.init(e, this.address), this.query.init(e, this.address), this.utils.init(e, this.address);
|
|
@@ -41635,11 +42332,11 @@ var h = class {
|
|
|
41635
42332
|
return this.query.getStakeRewardPool(e);
|
|
41636
42333
|
}
|
|
41637
42334
|
async openObligation(e) {
|
|
41638
|
-
let t = new
|
|
42335
|
+
let t = new import_transactions40.TransactionBlock(), a = L({ builder: this.builder, txBlock: t }), o = e || this.walletAddress;
|
|
41639
42336
|
return t.setSender(o), a.normalMethod.openObligationEntry(), t;
|
|
41640
42337
|
}
|
|
41641
42338
|
async depositCollateral(e, t, a, o) {
|
|
41642
|
-
let r = new
|
|
42339
|
+
let r = new import_transactions40.TransactionBlock(), i = o || this.walletAddress;
|
|
41643
42340
|
r.setSender(i);
|
|
41644
42341
|
let s2 = L({ builder: this.builder, txBlock: r }), c = await this.query.getObligations(i), l2 = a || c?.[0]?.id;
|
|
41645
42342
|
if (l2)
|
|
@@ -41651,25 +42348,25 @@ var h = class {
|
|
|
41651
42348
|
return r;
|
|
41652
42349
|
}
|
|
41653
42350
|
async withdrawCollateral(e, t, a, o, r) {
|
|
41654
|
-
let i = new
|
|
42351
|
+
let i = new import_transactions40.TransactionBlock(), s2 = L({ builder: this.builder, txBlock: i }), c = r || this.walletAddress;
|
|
41655
42352
|
i.setSender(c);
|
|
41656
42353
|
let l2 = await s2.takeCollateralQuick(t, e, a, o);
|
|
41657
42354
|
return i.transferObjects([l2], c), i;
|
|
41658
42355
|
}
|
|
41659
42356
|
async deposit(e, t, a) {
|
|
41660
|
-
let o = new
|
|
42357
|
+
let o = new import_transactions40.TransactionBlock(), r = L({ builder: this.builder, txBlock: o }), i = a || this.walletAddress;
|
|
41661
42358
|
o.setSender(i);
|
|
41662
42359
|
let s2 = await r.depositQuick(t, e, a);
|
|
41663
42360
|
return o.transferObjects([s2], i), o;
|
|
41664
42361
|
}
|
|
41665
42362
|
async withdraw(e, t, a) {
|
|
41666
|
-
let o = new
|
|
42363
|
+
let o = new import_transactions40.TransactionBlock(), r = a || this.walletAddress, i = L({ builder: this.builder, txBlock: o });
|
|
41667
42364
|
o.setSender(r);
|
|
41668
42365
|
let s2 = await i.withdrawQuick(t, e);
|
|
41669
42366
|
return o.transferObjects([s2], r), o;
|
|
41670
42367
|
}
|
|
41671
42368
|
async borrow(e, t, a, o, r) {
|
|
41672
|
-
let i = new
|
|
42369
|
+
let i = new import_transactions40.TransactionBlock(), s2 = L({ builder: this.builder, txBlock: i }), c = E({ builder: this.builder, txBlock: i }), l2 = r || this.walletAddress;
|
|
41673
42370
|
i.setSender(l2);
|
|
41674
42371
|
let d2 = Ie.includes(e);
|
|
41675
42372
|
d2 && await c.unstakeObligationQuick(a, o);
|
|
@@ -41677,7 +42374,7 @@ var h = class {
|
|
|
41677
42374
|
return i.transferObjects([p], l2), d2 && await c.stakeObligationQuick(a, o), i;
|
|
41678
42375
|
}
|
|
41679
42376
|
async borrowWithBoost(e, t, a, o, r, i) {
|
|
41680
|
-
let s2 = new
|
|
42377
|
+
let s2 = new import_transactions40.TransactionBlock(), c = L({ builder: this.builder, txBlock: s2 }), l2 = E({ builder: this.builder, txBlock: s2 }), d2 = i || this.walletAddress;
|
|
41681
42378
|
s2.setSender(d2);
|
|
41682
42379
|
let p = Ie.includes(e);
|
|
41683
42380
|
p && await l2.unstakeObligationQuick(a, o);
|
|
@@ -41685,19 +42382,19 @@ var h = class {
|
|
|
41685
42382
|
return s2.transferObjects([m], d2), p && await l2.stakeObligationWithVeScaQuick(a, o, r), s2;
|
|
41686
42383
|
}
|
|
41687
42384
|
async repay(e, t, a, o, r) {
|
|
41688
|
-
let i = new
|
|
42385
|
+
let i = new import_transactions40.TransactionBlock(), s2 = L({ builder: this.builder, txBlock: i }), c = E({ builder: this.builder, txBlock: i }), l2 = r || this.walletAddress;
|
|
41689
42386
|
i.setSender(l2);
|
|
41690
42387
|
let d2 = Ie.includes(e);
|
|
41691
42388
|
return d2 && await c.unstakeObligationQuick(a, o), await s2.repayQuick(t, e, a, l2), d2 && await c.stakeObligationQuick(a, o), i;
|
|
41692
42389
|
}
|
|
41693
42390
|
async createStakeAccount(e, t) {
|
|
41694
|
-
let a = new
|
|
42391
|
+
let a = new import_transactions40.TransactionBlock(), o = ue({ builder: this.builder, txBlock: a }), r = t || this.walletAddress;
|
|
41695
42392
|
a.setSender(r);
|
|
41696
42393
|
let i = o.normalMethod.createStakeAccount(e);
|
|
41697
42394
|
return a.transferObjects([i], r), a;
|
|
41698
42395
|
}
|
|
41699
42396
|
async supplyAndStake(e, t, a, o) {
|
|
41700
|
-
let r = new
|
|
42397
|
+
let r = new import_transactions40.TransactionBlock(), i = L({ builder: this.builder, txBlock: r }), s2 = ue({ builder: this.builder, txBlock: r }), c = o || this.walletAddress;
|
|
41701
42398
|
r.setSender(c);
|
|
41702
42399
|
let l2 = await i.depositQuick(t, e, o), d2 = this.utils.parseMarketCoinName(e);
|
|
41703
42400
|
if (!Ve.find((b) => b === d2))
|
|
@@ -41712,7 +42409,7 @@ var h = class {
|
|
|
41712
42409
|
return r;
|
|
41713
42410
|
}
|
|
41714
42411
|
async unstakeAndWithdraw(e, t, a) {
|
|
41715
|
-
let o = new
|
|
42412
|
+
let o = new import_transactions40.TransactionBlock(), r = L({ builder: this.builder, txBlock: o }), i = ue({ builder: this.builder, txBlock: o }), s2 = this.walletAddress, c = [];
|
|
41716
42413
|
o.setSender(s2);
|
|
41717
42414
|
let l2 = this.utils.parseMarketCoinName(e);
|
|
41718
42415
|
for (let d2 = 0; d2 < a.length; d2++) {
|
|
@@ -41729,7 +42426,7 @@ var h = class {
|
|
|
41729
42426
|
return o.transferObjects(c, s2), o;
|
|
41730
42427
|
}
|
|
41731
42428
|
async stake(e, t, a, o) {
|
|
41732
|
-
let r = new
|
|
42429
|
+
let r = new import_transactions40.TransactionBlock(), i = ue({ builder: this.builder, txBlock: r }), s2 = o || this.walletAddress;
|
|
41733
42430
|
r.setSender(s2);
|
|
41734
42431
|
let c = await this.query.getStakeAccounts(e, s2), l2 = a || (c.length > 0 ? c[0].id : void 0);
|
|
41735
42432
|
if (l2)
|
|
@@ -41741,13 +42438,13 @@ var h = class {
|
|
|
41741
42438
|
return r;
|
|
41742
42439
|
}
|
|
41743
42440
|
async unstake(e, t, a, o) {
|
|
41744
|
-
let r = new
|
|
42441
|
+
let r = new import_transactions40.TransactionBlock(), i = ue({ builder: this.builder, txBlock: r }), s2 = o || this.walletAddress;
|
|
41745
42442
|
r.setSender(s2);
|
|
41746
42443
|
let c = await i.unstakeQuick(t, e, a);
|
|
41747
42444
|
return r.transferObjects(c, s2), r;
|
|
41748
42445
|
}
|
|
41749
42446
|
async claim(e, t, a, o) {
|
|
41750
|
-
let r = new
|
|
42447
|
+
let r = new import_transactions40.TransactionBlock(), i = ue({ builder: this.builder, txBlock: r }), s2 = E({ builder: this.builder, txBlock: r }), c = o || this.walletAddress;
|
|
41751
42448
|
r.setSender(c);
|
|
41752
42449
|
let l2 = { sui: [], sca: [] };
|
|
41753
42450
|
for (let d2 = 0; d2 < e.length; d2++) {
|
|
@@ -41773,27 +42470,27 @@ var h = class {
|
|
|
41773
42470
|
return o.setSender(i), await r.unstakeObligationQuick(e, t), o;
|
|
41774
42471
|
}
|
|
41775
42472
|
async stakeSca(e, t = false, a = false, o, r, i, s2, c) {
|
|
41776
|
-
let l2 = new
|
|
42473
|
+
let l2 = new import_transactions40.TransactionBlock(), d2 = pe({ builder: this.builder, txBlock: l2 }), p = E({ builder: this.builder, txBlock: l2 }), m = c || this.walletAddress;
|
|
41777
42474
|
l2.setSender(m);
|
|
41778
42475
|
let b = await this.builder.utils.selectCoinIds(e, ae, m), [f, y] = this.builder.utils.takeAmountFromCoins(l2, b, e), C;
|
|
41779
42476
|
return s2 ? d2.normalMethod.extendLockAmount(s2, f) : C = d2.normalMethod.lockSca(f, i), o && r && (t && (a ? p.normalMethod.oldUnstakeObligation(o, r) : p.normalMethod.unstakeObligation(o, r)), p.normalMethod.stakeObligationWithVesca(o, r, s2 || C)), s2 || l2.transferObjects([C, y], m), l2;
|
|
41780
42477
|
}
|
|
41781
42478
|
async stakeMoreSca(e, t, a) {
|
|
41782
|
-
let o = new
|
|
42479
|
+
let o = new import_transactions40.TransactionBlock(), r = a || this.walletAddress;
|
|
41783
42480
|
return o.setSender(r), o;
|
|
41784
42481
|
}
|
|
41785
42482
|
async extendStakeScaLockPeriod(e, t, a, o, r = false, i = false, s2) {
|
|
41786
|
-
let c = new
|
|
42483
|
+
let c = new import_transactions40.TransactionBlock(), l2 = pe({ builder: this.builder, txBlock: c }), d2 = E({ builder: this.builder, txBlock: c }), p = s2 || this.walletAddress;
|
|
41787
42484
|
return c.setSender(p), l2.normalMethod.extendLockPeriod(t, e), a && o && (r && (i ? d2.normalMethod.oldUnstakeObligation(a, o) : d2.normalMethod.unstakeObligation(a, o)), d2.normalMethod.stakeObligationWithVesca(a, o, t)), c;
|
|
41788
42485
|
}
|
|
41789
42486
|
async extendPeriodAndStakeMoreSca(e, t, a, o, r, i = false, s2 = false, c) {
|
|
41790
|
-
let l2 = new
|
|
42487
|
+
let l2 = new import_transactions40.TransactionBlock(), d2 = pe({ builder: this.builder, txBlock: l2 }), p = E({ builder: this.builder, txBlock: l2 }), m = c || this.walletAddress;
|
|
41791
42488
|
l2.setSender(m);
|
|
41792
42489
|
let b = await this.builder.utils.selectCoinIds(e, ae, m), [f, y] = this.builder.utils.takeAmountFromCoins(l2, b, e);
|
|
41793
42490
|
return d2.normalMethod.extendLockPeriod(t, a), d2.normalMethod.extendLockAmount(t, f), l2.transferObjects([y], m), !o || !r || (i && (s2 ? p.normalMethod.oldUnstakeObligation(o, r) : p.normalMethod.unstakeObligation(o, r)), p.normalMethod.stakeObligationWithVesca(o, r, t)), l2;
|
|
41794
42491
|
}
|
|
41795
42492
|
async renewExpiredStakeSca(e, t, a, o = false, r, i, s2 = false, c = false, l2) {
|
|
41796
|
-
let d2 = new
|
|
42493
|
+
let d2 = new import_transactions40.TransactionBlock(), p = pe({ builder: this.builder, txBlock: d2 }), m = E({ builder: this.builder, txBlock: d2 }), b = l2 || this.walletAddress;
|
|
41797
42494
|
if (d2.setSender(b), o) {
|
|
41798
42495
|
let _ = p.normalMethod.redeemSca(a);
|
|
41799
42496
|
d2.transferObjects([_], b);
|
|
@@ -41802,17 +42499,17 @@ var h = class {
|
|
|
41802
42499
|
return d2.transferObjects([C], b), p.normalMethod.renewExpiredVeSca(a, y, t), !r || !i || (s2 && (c ? m.normalMethod.oldUnstakeObligation(r, i) : m.normalMethod.unstakeObligation(r, i)), m.normalMethod.stakeObligationWithVesca(r, i, a)), d2;
|
|
41803
42500
|
}
|
|
41804
42501
|
async redeemSca(e) {
|
|
41805
|
-
let t = new
|
|
42502
|
+
let t = new import_transactions40.TransactionBlock(), a = pe({ builder: this.builder, txBlock: t }), o = this.walletAddress;
|
|
41806
42503
|
return t.setSender(o), await a.redeemScaQuick(e), t;
|
|
41807
42504
|
}
|
|
41808
42505
|
async migrateAndClaim(e, t, a, o) {
|
|
41809
|
-
let r = new
|
|
42506
|
+
let r = new import_transactions40.TransactionBlock(), i = E({ builder: this.builder, txBlock: r }), s2 = this.walletAddress;
|
|
41810
42507
|
r.setSender(s2);
|
|
41811
42508
|
let c = i.normalMethod.oldClaimBorrowIncentive(a, t, o);
|
|
41812
42509
|
return r.transferObjects([c], s2), i.stakeObligationWithVeScaQuick(a, t, e), r;
|
|
41813
42510
|
}
|
|
41814
42511
|
async withdrawUnlockedSca(e, t) {
|
|
41815
|
-
let a = new
|
|
42512
|
+
let a = new import_transactions40.TransactionBlock(), o = pe({ builder: this.builder, txBlock: a }), r = t || this.walletAddress;
|
|
41816
42513
|
return a.setSender(r), await o.redeemScaQuick(e), a;
|
|
41817
42514
|
}
|
|
41818
42515
|
calculateAvailableClaimCoin(e, t) {
|
|
@@ -42415,7 +43112,7 @@ var ie = class n65 {
|
|
|
42415
43112
|
}
|
|
42416
43113
|
decodeInputAddress(e) {
|
|
42417
43114
|
let t = this.decodePureArg(e, "address");
|
|
42418
|
-
return (0,
|
|
43115
|
+
return (0, import_utils45.normalizeSuiAddress)(t);
|
|
42419
43116
|
}
|
|
42420
43117
|
decodeInputString(e) {
|
|
42421
43118
|
return this.decodePureArg(e, "string");
|
|
@@ -42438,7 +43135,7 @@ var ie = class n65 {
|
|
|
42438
43135
|
throw new Error("not pure argument");
|
|
42439
43136
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
42440
43137
|
let a = e.value.Pure;
|
|
42441
|
-
return
|
|
43138
|
+
return import_bcs11.bcs.de(t, new Uint8Array(a));
|
|
42442
43139
|
}
|
|
42443
43140
|
return e.value;
|
|
42444
43141
|
}
|
|
@@ -42448,18 +43145,18 @@ var ie = class n65 {
|
|
|
42448
43145
|
if (typeof e.value == "object") {
|
|
42449
43146
|
if (!("Object" in e.value) || !("ImmOrOwned" in e.value.Object))
|
|
42450
43147
|
throw new Error("not ImmOrOwned");
|
|
42451
|
-
return (0,
|
|
43148
|
+
return (0, import_utils45.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId);
|
|
42452
43149
|
}
|
|
42453
|
-
return (0,
|
|
43150
|
+
return (0, import_utils45.normalizeSuiAddress)(e.value);
|
|
42454
43151
|
}
|
|
42455
43152
|
static getSharedObjectId(e) {
|
|
42456
43153
|
if (e.type !== "object")
|
|
42457
43154
|
throw new Error(`not object argument: ${JSON.stringify(e)}`);
|
|
42458
43155
|
if (typeof e.value != "object")
|
|
42459
|
-
return (0,
|
|
43156
|
+
return (0, import_utils45.normalizeSuiAddress)(e.value);
|
|
42460
43157
|
if (!("Object" in e.value) || !("Shared" in e.value.Object))
|
|
42461
43158
|
throw new Error("not Shared");
|
|
42462
|
-
return (0,
|
|
43159
|
+
return (0, import_utils45.normalizeSuiAddress)(e.value.Object.Shared.objectId);
|
|
42463
43160
|
}
|
|
42464
43161
|
static getPureInput(e, t) {
|
|
42465
43162
|
if (e.type !== "pure")
|
|
@@ -42469,10 +43166,10 @@ var ie = class n65 {
|
|
|
42469
43166
|
if (!("Pure" in e.value))
|
|
42470
43167
|
throw new Error("Pure not in value");
|
|
42471
43168
|
let a = e.value.Pure;
|
|
42472
|
-
return
|
|
43169
|
+
return import_bcs11.bcs.de(t, new Uint8Array(a));
|
|
42473
43170
|
}
|
|
42474
43171
|
typeArg(e) {
|
|
42475
|
-
return (0,
|
|
43172
|
+
return (0, import_utils45.normalizeStructTag)(this.moveCall.typeArguments[e]);
|
|
42476
43173
|
}
|
|
42477
43174
|
shortTypeArg(e) {
|
|
42478
43175
|
return this.moveCall.typeArguments[e];
|
|
@@ -42594,8 +43291,8 @@ var Ha = class n73 extends u {
|
|
|
42594
43291
|
txType;
|
|
42595
43292
|
txSubType;
|
|
42596
43293
|
async build(t) {
|
|
42597
|
-
let a = new
|
|
42598
|
-
return a.moveCall({ target: `${W.PackageId}::claim::claim`, typeArguments: [W.turbosCoinType], arguments: [a.object(W.Claim), a.object(
|
|
43294
|
+
let a = new import_transactions44.TransactionBlock();
|
|
43295
|
+
return a.moveCall({ target: `${W.PackageId}::claim::claim`, typeArguments: [W.turbosCoinType], arguments: [a.object(W.Claim), a.object(import_utils46.SUI_CLOCK_OBJECT_ID)] }), a;
|
|
42599
43296
|
}
|
|
42600
43297
|
static fromData(t) {
|
|
42601
43298
|
return new n73(t);
|
|
@@ -42609,7 +43306,7 @@ var za = class n74 extends u {
|
|
|
42609
43306
|
txType;
|
|
42610
43307
|
txSubType;
|
|
42611
43308
|
async build(t) {
|
|
42612
|
-
let a = new
|
|
43309
|
+
let a = new import_transactions45.TransactionBlock();
|
|
42613
43310
|
return a.moveCall({ target: `${W.PackageId}::claim::join`, typeArguments: [W.turbosCoinType], arguments: [a.object(W.Claim)] }), a;
|
|
42614
43311
|
}
|
|
42615
43312
|
static fromData(t) {
|
|
@@ -42624,7 +43321,7 @@ var Ja = class n75 extends u {
|
|
|
42624
43321
|
txType;
|
|
42625
43322
|
txSubType;
|
|
42626
43323
|
async build(t) {
|
|
42627
|
-
let a = new TurbosSdk(t.network.replace("sui:", ""), t.suiClient), o = new
|
|
43324
|
+
let a = new TurbosSdk(t.network.replace("sui:", ""), t.suiClient), o = new import_transactions46.TransactionBlock();
|
|
42628
43325
|
return o = await a.pool.collectFee({ txb: o, ...this.data }), o = await a.pool.collectReward({ txb: o, ...this.data }), o = await a.pool.decreaseLiquidity({ txb: o, ...this.data }), o = await a.nft.burn({ txb: o, nft: this.data.nft, pool: this.data.pool }), o;
|
|
42629
43326
|
}
|
|
42630
43327
|
static fromData(t) {
|
|
@@ -42689,17 +43386,17 @@ var Je = class {
|
|
|
42689
43386
|
var Tr = 89;
|
|
42690
43387
|
var Ir = 1e6;
|
|
42691
43388
|
var kr = async (n83) => {
|
|
42692
|
-
let { token1: e, token2: t, poolId: a, amountIn: o, currentAddress: r, turbosSdk: i } = n83, s2 = new
|
|
43389
|
+
let { token1: e, token2: t, poolId: a, amountIn: o, currentAddress: r, turbosSdk: i } = n83, s2 = new import_transactions47.TransactionBlock(), c = new Je(i), l2 = await c.getCoinsData(r, t, o), [d2, p] = c.splitAndMergeCoin(l2, o, s2);
|
|
42693
43390
|
if (!d2)
|
|
42694
43391
|
throw new Error(`Not enough balance: ${t}`);
|
|
42695
|
-
let m = await c.IsAccountCap(r), b = m ? s2.object(m) : c.createAccount(s2), [f, y, C] = s2.moveCall({ typeArguments: [e, t], target: `${F.PackageId}::clob_v2::swap_exact_quote_for_base`, arguments: [s2.object(String(a)), s2.pure(Tr), b, s2.pure(o), s2.object((0,
|
|
43392
|
+
let m = await c.IsAccountCap(r), b = m ? s2.object(m) : c.createAccount(s2), [f, y, C] = s2.moveCall({ typeArguments: [e, t], target: `${F.PackageId}::clob_v2::swap_exact_quote_for_base`, arguments: [s2.object(String(a)), s2.pure(Tr), b, s2.pure(o), s2.object((0, import_utils47.normalizeSuiObjectId)("0x6")), d2] });
|
|
42696
43393
|
return p && s2.transferObjects([p], s2.pure(r)), s2.transferObjects([f], s2.pure(r)), s2.transferObjects([y], s2.pure(r)), m || s2.transferObjects([b], s2.pure(r)), s2.setSenderIfNotSet(r), s2.setGasBudget(Ir), s2;
|
|
42697
43394
|
};
|
|
42698
43395
|
var xr = async (n83) => {
|
|
42699
|
-
let { token1: e, token2: t, poolId: a, amountIn: o, currentAddress: r, turbosSdk: i } = n83, s2 = new
|
|
43396
|
+
let { token1: e, token2: t, poolId: a, amountIn: o, currentAddress: r, turbosSdk: i } = n83, s2 = new import_transactions47.TransactionBlock(), c = new Je(i), l2 = await c.getCoinsData(r, e, o), [d2, p] = c.splitAndMergeCoin(l2, o, s2);
|
|
42700
43397
|
if (!d2)
|
|
42701
43398
|
throw new Error(`Not enough balance: ${e}`);
|
|
42702
|
-
let m = await c.IsAccountCap(r), b = m ? s2.object(m) : c.createAccount(s2), f = c.zero(t, s2), [y, C, _] = s2.moveCall({ typeArguments: [e, t], target: `${F.PackageId}::clob_v2::swap_exact_base_for_quote`, arguments: [s2.object(String(a)), s2.pure(Tr), b, s2.pure(o), d2, f, s2.object((0,
|
|
43399
|
+
let m = await c.IsAccountCap(r), b = m ? s2.object(m) : c.createAccount(s2), f = c.zero(t, s2), [y, C, _] = s2.moveCall({ typeArguments: [e, t], target: `${F.PackageId}::clob_v2::swap_exact_base_for_quote`, arguments: [s2.object(String(a)), s2.pure(Tr), b, s2.pure(o), d2, f, s2.object((0, import_utils47.normalizeSuiObjectId)("0x6"))] });
|
|
42703
43400
|
return p && s2.transferObjects([p], s2.pure(r)), s2.transferObjects([y], s2.pure(r)), s2.transferObjects([C], s2.pure(r)), m || s2.transferObjects([b], s2.pure(r)), s2.setSenderIfNotSet(r), s2.setGasBudget(Ir), s2;
|
|
42704
43401
|
};
|
|
42705
43402
|
var Ya = class n77 extends u {
|
|
@@ -42858,7 +43555,7 @@ var Un = class n79 {
|
|
|
42858
43555
|
}
|
|
42859
43556
|
decodeInputAddress(e) {
|
|
42860
43557
|
let t = this.decodePureArg(e, "address");
|
|
42861
|
-
return (0,
|
|
43558
|
+
return (0, import_utils48.normalizeSuiAddress)(t);
|
|
42862
43559
|
}
|
|
42863
43560
|
decodeInputString(e) {
|
|
42864
43561
|
return this.decodePureArg(e, "string");
|
|
@@ -42881,7 +43578,7 @@ var Un = class n79 {
|
|
|
42881
43578
|
throw new Error("not pure argument");
|
|
42882
43579
|
if (typeof e.value == "object" && "Pure" in e.value) {
|
|
42883
43580
|
let a = e.value.Pure;
|
|
42884
|
-
return
|
|
43581
|
+
return import_bcs12.bcs.de(t, new Uint8Array(a));
|
|
42885
43582
|
}
|
|
42886
43583
|
return e.value;
|
|
42887
43584
|
}
|
|
@@ -42891,18 +43588,18 @@ var Un = class n79 {
|
|
|
42891
43588
|
if (typeof e.value == "object") {
|
|
42892
43589
|
if (!("Object" in e.value) || !("ImmOrOwned" in e.value.Object))
|
|
42893
43590
|
throw new Error("not ImmOrOwned");
|
|
42894
|
-
return (0,
|
|
43591
|
+
return (0, import_utils48.normalizeSuiAddress)(e.value.Object.ImmOrOwned.objectId);
|
|
42895
43592
|
}
|
|
42896
|
-
return (0,
|
|
43593
|
+
return (0, import_utils48.normalizeSuiAddress)(e.value);
|
|
42897
43594
|
}
|
|
42898
43595
|
static getSharedObjectId(e) {
|
|
42899
43596
|
if (e.type !== "object")
|
|
42900
43597
|
throw new Error(`not object argument: ${JSON.stringify(e)}`);
|
|
42901
43598
|
if (typeof e.value != "object")
|
|
42902
|
-
return (0,
|
|
43599
|
+
return (0, import_utils48.normalizeSuiAddress)(e.value);
|
|
42903
43600
|
if (!("Object" in e.value) || !("Shared" in e.value.Object))
|
|
42904
43601
|
throw new Error("not Shared");
|
|
42905
|
-
return (0,
|
|
43602
|
+
return (0, import_utils48.normalizeSuiAddress)(e.value.Object.Shared.objectId);
|
|
42906
43603
|
}
|
|
42907
43604
|
static getPureInput(e, t) {
|
|
42908
43605
|
if (e.type !== "pure")
|
|
@@ -42912,10 +43609,10 @@ var Un = class n79 {
|
|
|
42912
43609
|
if (!("Pure" in e.value))
|
|
42913
43610
|
throw new Error("Pure not in value");
|
|
42914
43611
|
let a = e.value.Pure;
|
|
42915
|
-
return
|
|
43612
|
+
return import_bcs12.bcs.de(t, new Uint8Array(a));
|
|
42916
43613
|
}
|
|
42917
43614
|
typeArg(e) {
|
|
42918
|
-
return (0,
|
|
43615
|
+
return (0, import_utils48.normalizeStructTag)(this.moveCall.typeArguments[e]);
|
|
42919
43616
|
}
|
|
42920
43617
|
txArg(e) {
|
|
42921
43618
|
return this.moveCall.arguments[e];
|
|
@@ -42930,7 +43627,7 @@ var an = class n80 extends u {
|
|
|
42930
43627
|
txSubType;
|
|
42931
43628
|
async build(t) {
|
|
42932
43629
|
console.log(t);
|
|
42933
|
-
let a = new
|
|
43630
|
+
let a = new import_transactions48.TransactionBlock(), { ticketId: o } = this.data;
|
|
42934
43631
|
return a.moveCall({ target: `${I.packageId}::native_pool::burn_ticket`, arguments: [a.object(I.poolObjectId), a.object(I.systemStateObjectId), a.object(o)] }), a.setGasBudget(I.gasBudget), a;
|
|
42935
43632
|
}
|
|
42936
43633
|
static fromData(t) {
|
|
@@ -42946,7 +43643,7 @@ var nn = class n81 extends u {
|
|
|
42946
43643
|
txSubType;
|
|
42947
43644
|
async build(t) {
|
|
42948
43645
|
console.log(t);
|
|
42949
|
-
let a = new
|
|
43646
|
+
let a = new import_transactions49.TransactionBlock(), { amount: o } = this.data, [r] = a.splitCoins(a.gas, [a.pure(o)]);
|
|
42950
43647
|
return a.moveCall({ target: `${I.packageId}::native_pool::stake`, arguments: [a.object(I.poolObjectId), a.object(I.metadataObjectId), a.object(I.systemStateObjectId), r] }), a.setGasBudget(I.gasBudget), a;
|
|
42951
43648
|
}
|
|
42952
43649
|
static fromData(t) {
|
|
@@ -42962,7 +43659,7 @@ var on = class n82 extends u {
|
|
|
42962
43659
|
txSubType;
|
|
42963
43660
|
async build(t) {
|
|
42964
43661
|
console.log(t);
|
|
42965
|
-
let a = new
|
|
43662
|
+
let a = new import_transactions50.TransactionBlock(), { amount: o } = this.data, r = (await t.suiClient.getAllCoins({ owner: t.account.address, limit: 100 })).data, [i, ...s2] = r.filter((d2) => d2.coinType.split("::")[0] === I.certType.split("::")[0]), c = a.object(i.coinObjectId);
|
|
42966
43663
|
s2.length && a.mergeCoins(c, s2.map((d2) => a.object(d2.coinObjectId)));
|
|
42967
43664
|
let l2 = a.splitCoins(a.object(i.coinObjectId), [a.pure(o)]);
|
|
42968
43665
|
return a.moveCall({ target: `${I.packageId}::native_pool::unstake`, arguments: [a.object(I.poolObjectId), a.object(I.metadataObjectId), a.object(I.systemStateObjectId), l2] }), a.setGasBudget(I.gasBudget), a;
|
|
@@ -42999,15 +43696,15 @@ var ok = new ia([new zt(), new oa(), new Vt(), new ra(), new St(), new en(), new
|
|
|
42999
43696
|
|
|
43000
43697
|
// src/core/MSafeAccount.ts
|
|
43001
43698
|
var import_sui3_utils44 = require("@msafe/sui3-utils");
|
|
43002
|
-
var
|
|
43003
|
-
var
|
|
43699
|
+
var import_transactions52 = require("@mysten/sui.js/transactions");
|
|
43700
|
+
var import_utils51 = require("@mysten/sui.js/utils");
|
|
43004
43701
|
|
|
43005
43702
|
// node_modules/@mysten/wallet-standard/dist/esm/chains.js
|
|
43006
43703
|
var SUI_TESTNET_CHAIN = "sui:testnet";
|
|
43007
43704
|
var SUI_MAINNET_CHAIN = "sui:mainnet";
|
|
43008
43705
|
|
|
43009
43706
|
// src/simulate/simulator.ts
|
|
43010
|
-
var
|
|
43707
|
+
var import_transactions51 = require("@mysten/sui.js/transactions");
|
|
43011
43708
|
var GAS_SAFE_OVERHEAD = 1000n;
|
|
43012
43709
|
var DEF_GAS_PRICE_NUM = 120n;
|
|
43013
43710
|
var DEF_GAS_PRICE_DEN = 100n;
|
|
@@ -43076,7 +43773,7 @@ var Simulator = class {
|
|
|
43076
43773
|
throw new Error("Sanity: Unknown gas price option");
|
|
43077
43774
|
}
|
|
43078
43775
|
copyTransactionBlock(tx) {
|
|
43079
|
-
return
|
|
43776
|
+
return import_transactions51.TransactionBlock.from(tx.serialize());
|
|
43080
43777
|
}
|
|
43081
43778
|
};
|
|
43082
43779
|
|
|
@@ -43096,10 +43793,10 @@ function HexToUint8Array(hex) {
|
|
|
43096
43793
|
var import_verify = require("@mysten/sui.js/verify");
|
|
43097
43794
|
|
|
43098
43795
|
// src/utils/format.ts
|
|
43099
|
-
var
|
|
43796
|
+
var import_utils50 = require("@mysten/sui.js/utils");
|
|
43100
43797
|
|
|
43101
43798
|
// src/utils/coin.ts
|
|
43102
|
-
var
|
|
43799
|
+
var import_utils49 = require("@mysten/sui.js/utils");
|
|
43103
43800
|
var CoinHelper = class {
|
|
43104
43801
|
_client;
|
|
43105
43802
|
_coinMetaReg;
|
|
@@ -43108,7 +43805,7 @@ var CoinHelper = class {
|
|
|
43108
43805
|
this._coinMetaReg = /* @__PURE__ */ new Map();
|
|
43109
43806
|
}
|
|
43110
43807
|
async getCoinMeta(coinType) {
|
|
43111
|
-
const normalized = (0,
|
|
43808
|
+
const normalized = (0, import_utils49.normalizeStructTag)(coinType);
|
|
43112
43809
|
if (this._coinMetaReg.has(normalized)) {
|
|
43113
43810
|
return this._coinMetaReg.get(normalized);
|
|
43114
43811
|
}
|
|
@@ -43129,10 +43826,10 @@ var Coin2 = class _Coin {
|
|
|
43129
43826
|
if (!type) {
|
|
43130
43827
|
return false;
|
|
43131
43828
|
}
|
|
43132
|
-
return (0,
|
|
43829
|
+
return (0, import_utils49.normalizeStructTag)(type).match(COIN_TYPE_ARG_REGEX2) != null;
|
|
43133
43830
|
}
|
|
43134
43831
|
static getCoinType(type) {
|
|
43135
|
-
const [, res] = (0,
|
|
43832
|
+
const [, res] = (0, import_utils49.normalizeStructTag)(type).match(COIN_TYPE_ARG_REGEX2) ?? [];
|
|
43136
43833
|
return res || null;
|
|
43137
43834
|
}
|
|
43138
43835
|
static getBalance(data) {
|
|
@@ -43153,16 +43850,16 @@ var Coin2 = class _Coin {
|
|
|
43153
43850
|
// src/utils/format.ts
|
|
43154
43851
|
var Formatter2 = class {
|
|
43155
43852
|
static normalizeSuiAddress(addr) {
|
|
43156
|
-
return (0,
|
|
43853
|
+
return (0, import_utils50.normalizeSuiAddress)(addr);
|
|
43157
43854
|
}
|
|
43158
43855
|
static normalizeStructTag(struct) {
|
|
43159
|
-
return (0,
|
|
43856
|
+
return (0, import_utils50.normalizeStructTag)(struct);
|
|
43160
43857
|
}
|
|
43161
43858
|
static isSuiAddressEqual(addr1, addr2) {
|
|
43162
|
-
return (0,
|
|
43859
|
+
return (0, import_utils50.normalizeSuiAddress)(addr1) === (0, import_utils50.normalizeSuiAddress)(addr2);
|
|
43163
43860
|
}
|
|
43164
43861
|
static isSuiStructEqual(struct1, struct2) {
|
|
43165
|
-
return (0,
|
|
43862
|
+
return (0, import_utils50.normalizeStructTag)(struct1) === (0, import_utils50.normalizeStructTag)(struct2);
|
|
43166
43863
|
}
|
|
43167
43864
|
static isCoinObjectType(struct) {
|
|
43168
43865
|
return Coin2.isCoin(struct);
|
|
@@ -43449,7 +44146,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43449
44146
|
const meta = await this.coinHelper.getCoinMeta(balance.coinType);
|
|
43450
44147
|
const unlockedBalance = balance.lockedBalance.number ? BigInt(balance.totalBalance) - BigInt(balance.lockedBalance.number) : BigInt(balance.totalBalance);
|
|
43451
44148
|
return {
|
|
43452
|
-
type: (0,
|
|
44149
|
+
type: (0, import_utils51.normalizeStructTag)(balance.coinType),
|
|
43453
44150
|
balance: BigInt(unlockedBalance),
|
|
43454
44151
|
metadata: meta
|
|
43455
44152
|
};
|
|
@@ -43517,7 +44214,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43517
44214
|
suiClient: this.globals.suiClient,
|
|
43518
44215
|
account: {
|
|
43519
44216
|
address: this.address,
|
|
43520
|
-
publicKey: (0,
|
|
44217
|
+
publicKey: (0, import_utils51.fromHEX)(this.address),
|
|
43521
44218
|
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
43522
44219
|
features: []
|
|
43523
44220
|
}
|
|
@@ -43552,7 +44249,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43552
44249
|
suiClient: this.globals.suiClient,
|
|
43553
44250
|
account: {
|
|
43554
44251
|
address: this.address,
|
|
43555
|
-
publicKey: (0,
|
|
44252
|
+
publicKey: (0, import_utils51.fromHEX)(this.address),
|
|
43556
44253
|
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
43557
44254
|
features: []
|
|
43558
44255
|
}
|
|
@@ -43567,7 +44264,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43567
44264
|
const signature = await this.wallet.signTransactionBlock({ transactionBlock: payload });
|
|
43568
44265
|
return this.backend.proposeIntentionAndBuildVote({
|
|
43569
44266
|
...input,
|
|
43570
|
-
payload: (0,
|
|
44267
|
+
payload: (0, import_utils51.toHEX)(payload),
|
|
43571
44268
|
digest,
|
|
43572
44269
|
msafeAddress: this.address,
|
|
43573
44270
|
signature: signature.signature
|
|
@@ -43625,7 +44322,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43625
44322
|
}
|
|
43626
44323
|
async proposePlainPayloadIntention(intention) {
|
|
43627
44324
|
const sn2 = await this.nextSequenceNumber();
|
|
43628
|
-
const tb =
|
|
44325
|
+
const tb = import_transactions52.TransactionBlock.from(intention.payload);
|
|
43629
44326
|
if (!tb.blockData.sender || !(0, import_sui3_utils44.isSameAddress)(tb.blockData.sender, this.address)) {
|
|
43630
44327
|
throw new Error("Transaction sender is not same as the multisig address");
|
|
43631
44328
|
}
|
|
@@ -43649,7 +44346,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43649
44346
|
// Shortcut for proposing a transaction to be a pending transaction, and add user vote to it.
|
|
43650
44347
|
// Requires the multi-sig to be empty in pending transaction.
|
|
43651
44348
|
async proposePendingTransaction(intention) {
|
|
43652
|
-
const txb = new
|
|
44349
|
+
const txb = new import_transactions52.TransactionBlock();
|
|
43653
44350
|
const payload = await txb.build({ client: this.suiClient });
|
|
43654
44351
|
const digest = await txb.getDigest({ client: this.suiClient });
|
|
43655
44352
|
const signature = await this.wallet.signTransactionBlock({ transactionBlock: payload });
|
|
@@ -43702,7 +44399,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43702
44399
|
suiClient: this.globals.suiClient,
|
|
43703
44400
|
account: {
|
|
43704
44401
|
address: this.address,
|
|
43705
|
-
publicKey: (0,
|
|
44402
|
+
publicKey: (0, import_utils51.fromHEX)(this.address),
|
|
43706
44403
|
chains: [SUI_MAINNET_CHAIN, SUI_TESTNET_CHAIN],
|
|
43707
44404
|
features: []
|
|
43708
44405
|
}
|
|
@@ -43790,7 +44487,7 @@ var MSafeAccount = class _MSafeAccount {
|
|
|
43790
44487
|
|
|
43791
44488
|
// src/core/PublicKeyHelper.ts
|
|
43792
44489
|
var import_sui3_utils45 = require("@msafe/sui3-utils");
|
|
43793
|
-
var
|
|
44490
|
+
var import_utils53 = require("@mysten/sui.js/utils");
|
|
43794
44491
|
var PublicKeyHelper = class {
|
|
43795
44492
|
constructor(globals) {
|
|
43796
44493
|
this.globals = globals;
|
|
@@ -43839,7 +44536,7 @@ var PublicKeyHelper = class {
|
|
|
43839
44536
|
if (!(0, import_sui3_utils45.isSameAddress)(address, publicKey.toSuiAddress())) {
|
|
43840
44537
|
throw new Error("Invalid public key");
|
|
43841
44538
|
}
|
|
43842
|
-
this.knownPublicKeys.set((0,
|
|
44539
|
+
this.knownPublicKeys.set((0, import_utils53.normalizeSuiAddress)(address), publicKey);
|
|
43843
44540
|
}
|
|
43844
44541
|
async _getPublicKey(address) {
|
|
43845
44542
|
const pkBackend = await this.getPublicKeyFromBackend(address);
|
|
@@ -43880,7 +44577,7 @@ var import_client4 = require("@mysten/sui.js/client");
|
|
|
43880
44577
|
|
|
43881
44578
|
// src/backend/BackendImpl.ts
|
|
43882
44579
|
var import_sui3_utils46 = require("@msafe/sui3-utils");
|
|
43883
|
-
var
|
|
44580
|
+
var import_axios4 = __toESM(require("axios"), 1);
|
|
43884
44581
|
var BackendImpl = class _BackendImpl {
|
|
43885
44582
|
constructor(apiURL, mockAddress) {
|
|
43886
44583
|
this.apiURL = apiURL;
|
|
@@ -44090,7 +44787,7 @@ var BackendImpl = class _BackendImpl {
|
|
|
44090
44787
|
async get(url, config2) {
|
|
44091
44788
|
const fullUrl = this.getFullUrl(url);
|
|
44092
44789
|
try {
|
|
44093
|
-
return await
|
|
44790
|
+
return await import_axios4.default.get(fullUrl, config2);
|
|
44094
44791
|
} catch (e) {
|
|
44095
44792
|
throw BackendError.fromError(e) ?? e;
|
|
44096
44793
|
}
|
|
@@ -44098,7 +44795,7 @@ var BackendImpl = class _BackendImpl {
|
|
|
44098
44795
|
async post(url, data, config2) {
|
|
44099
44796
|
const fullUrl = this.getFullUrl(url);
|
|
44100
44797
|
try {
|
|
44101
|
-
return await
|
|
44798
|
+
return await import_axios4.default.post(fullUrl, data, {
|
|
44102
44799
|
...config2,
|
|
44103
44800
|
transformRequest: this.getTransformRequest()
|
|
44104
44801
|
});
|
|
@@ -44111,7 +44808,7 @@ var BackendImpl = class _BackendImpl {
|
|
|
44111
44808
|
}
|
|
44112
44809
|
getTransformRequest() {
|
|
44113
44810
|
let transformRequests = [];
|
|
44114
|
-
const { transformRequest } =
|
|
44811
|
+
const { transformRequest } = import_axios4.default.defaults;
|
|
44115
44812
|
if (!transformRequest) {
|
|
44116
44813
|
transformRequests = [];
|
|
44117
44814
|
} else if (transformRequest instanceof Array) {
|
|
@@ -44133,7 +44830,7 @@ var BackendError = class _BackendError extends Error {
|
|
|
44133
44830
|
}
|
|
44134
44831
|
name;
|
|
44135
44832
|
static fromError(e) {
|
|
44136
|
-
if (
|
|
44833
|
+
if (import_axios4.default.isAxiosError(e) && e?.response?.data && "message" in e.response.data) {
|
|
44137
44834
|
return new _BackendError(e);
|
|
44138
44835
|
}
|
|
44139
44836
|
return void 0;
|