@alphafi/alphafi-sdk 0.0.37 → 0.0.39
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/README.md +115 -12
- package/dist/cjs/adminFunctions.d.ts +6 -0
- package/dist/cjs/adminFunctions.d.ts.map +1 -0
- package/dist/cjs/adminFunctions.js +52 -0
- package/dist/cjs/adminFunctions.js.map +1 -0
- package/dist/cjs/common/coins.d.ts.map +1 -1
- package/dist/cjs/common/coins.js +1 -2
- package/dist/cjs/common/coins.js.map +1 -1
- package/dist/cjs/common/constants.d.ts +138 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +106 -9
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +3 -1
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +233 -1
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +112 -3
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/getTVL.d.ts +5 -0
- package/dist/cjs/getTVL.d.ts.map +1 -0
- package/dist/cjs/getTVL.js +109 -0
- package/dist/cjs/getTVL.js.map +1 -0
- package/dist/cjs/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/cjs/graphql/getMultiReceipts.js +16 -57
- package/dist/cjs/graphql/getMultiReceipts.js.map +1 -1
- package/dist/cjs/index.d.ts +12 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +22 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.d.ts +3 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.d.ts.map +1 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.js +44 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.js.map +1 -0
- package/dist/cjs/sui-sdk/events/fetchEvents.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchEvents.js +41 -0
- package/dist/cjs/sui-sdk/events/fetchEvents.js.map +1 -1
- package/dist/cjs/sui-sdk/events/types.d.ts +9 -1
- package/dist/cjs/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/types.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +8 -6
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +75 -30
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/alpha.d.ts +2 -2
- package/dist/cjs/transactions/alpha.d.ts.map +1 -1
- package/dist/cjs/transactions/alpha.js +2 -2
- package/dist/cjs/transactions/alpha.js.map +1 -1
- package/dist/cjs/transactions/bluefin.d.ts +8 -2
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -1
- package/dist/cjs/transactions/bluefin.js +355 -7
- package/dist/cjs/transactions/bluefin.js.map +1 -1
- package/dist/cjs/transactions/bucket.d.ts +2 -2
- package/dist/cjs/transactions/bucket.js +2 -2
- package/dist/cjs/transactions/bucket.js.map +1 -1
- package/dist/cjs/transactions/cetus.d.ts +4 -4
- package/dist/cjs/transactions/cetus.d.ts.map +1 -1
- package/dist/cjs/transactions/cetus.js +27 -29
- package/dist/cjs/transactions/cetus.js.map +1 -1
- package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/cjs/transactions/collect_rewards.js +23 -2
- package/dist/cjs/transactions/collect_rewards.js.map +1 -1
- package/dist/cjs/transactions/deposit.d.ts +2 -2
- package/dist/cjs/transactions/deposit.d.ts.map +1 -1
- package/dist/cjs/transactions/deposit.js +19 -9
- package/dist/cjs/transactions/deposit.js.map +1 -1
- package/dist/cjs/transactions/navi-looping.d.ts +33 -0
- package/dist/cjs/transactions/navi-looping.d.ts.map +1 -0
- package/dist/cjs/transactions/navi-looping.js +597 -0
- package/dist/cjs/transactions/navi-looping.js.map +1 -0
- package/dist/cjs/transactions/navi.d.ts +2 -2
- package/dist/cjs/transactions/navi.d.ts.map +1 -1
- package/dist/cjs/transactions/navi.js +137 -9
- package/dist/cjs/transactions/navi.js.map +1 -1
- package/dist/cjs/transactions/withdraw.d.ts +3 -2
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -1
- package/dist/cjs/transactions/withdraw.js +39 -15
- package/dist/cjs/transactions/withdraw.js.map +1 -1
- package/dist/esm/adminFunctions.d.ts +6 -0
- package/dist/esm/adminFunctions.d.ts.map +1 -0
- package/dist/esm/adminFunctions.js +45 -0
- package/dist/esm/adminFunctions.js.map +1 -0
- package/dist/esm/common/coins.d.ts.map +1 -1
- package/dist/esm/common/coins.js +1 -2
- package/dist/esm/common/coins.js.map +1 -1
- package/dist/esm/common/constants.d.ts +138 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +106 -9
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +3 -1
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +233 -1
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +112 -3
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/getTVL.d.ts +5 -0
- package/dist/esm/getTVL.d.ts.map +1 -0
- package/dist/esm/getTVL.js +103 -0
- package/dist/esm/getTVL.js.map +1 -0
- package/dist/esm/graphql/getMultiReceipts.d.ts.map +1 -1
- package/dist/esm/graphql/getMultiReceipts.js +16 -57
- package/dist/esm/graphql/getMultiReceipts.js.map +1 -1
- package/dist/esm/index.d.ts +12 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.d.ts +3 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.d.ts.map +1 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.js +41 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.js.map +1 -0
- package/dist/esm/sui-sdk/events/fetchEvents.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/fetchEvents.js +41 -0
- package/dist/esm/sui-sdk/events/fetchEvents.js.map +1 -1
- package/dist/esm/sui-sdk/events/types.d.ts +9 -1
- package/dist/esm/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/types.js.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +8 -6
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +75 -31
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/alpha.d.ts +2 -2
- package/dist/esm/transactions/alpha.d.ts.map +1 -1
- package/dist/esm/transactions/alpha.js +2 -2
- package/dist/esm/transactions/alpha.js.map +1 -1
- package/dist/esm/transactions/bluefin.d.ts +8 -2
- package/dist/esm/transactions/bluefin.d.ts.map +1 -1
- package/dist/esm/transactions/bluefin.js +352 -6
- package/dist/esm/transactions/bluefin.js.map +1 -1
- package/dist/esm/transactions/bucket.d.ts +2 -2
- package/dist/esm/transactions/bucket.js +2 -2
- package/dist/esm/transactions/bucket.js.map +1 -1
- package/dist/esm/transactions/cetus.d.ts +4 -4
- package/dist/esm/transactions/cetus.d.ts.map +1 -1
- package/dist/esm/transactions/cetus.js +27 -29
- package/dist/esm/transactions/cetus.js.map +1 -1
- package/dist/esm/transactions/collect_rewards.d.ts.map +1 -1
- package/dist/esm/transactions/collect_rewards.js +23 -2
- package/dist/esm/transactions/collect_rewards.js.map +1 -1
- package/dist/esm/transactions/deposit.d.ts +2 -2
- package/dist/esm/transactions/deposit.d.ts.map +1 -1
- package/dist/esm/transactions/deposit.js +18 -8
- package/dist/esm/transactions/deposit.js.map +1 -1
- package/dist/esm/transactions/navi-looping.d.ts +33 -0
- package/dist/esm/transactions/navi-looping.d.ts.map +1 -0
- package/dist/esm/transactions/navi-looping.js +585 -0
- package/dist/esm/transactions/navi-looping.js.map +1 -0
- package/dist/esm/transactions/navi.d.ts +2 -2
- package/dist/esm/transactions/navi.d.ts.map +1 -1
- package/dist/esm/transactions/navi.js +137 -9
- package/dist/esm/transactions/navi.js.map +1 -1
- package/dist/esm/transactions/withdraw.d.ts +3 -2
- package/dist/esm/transactions/withdraw.d.ts.map +1 -1
- package/dist/esm/transactions/withdraw.js +39 -17
- package/dist/esm/transactions/withdraw.js.map +1 -1
- package/package.json +4 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinType1Txb = exports.depositBluefinSuiFirstTxb = void 0;
|
|
3
|
+
exports.withdrawBluefinType2Txb = exports.withdrawBluefinType1Txb = exports.withdrawBluefinSuiFirstTxb = exports.depositBluefinType2Txb = exports.depositBluefinType1Txb = exports.depositBluefinSuiFirstTxb = void 0;
|
|
4
4
|
const transactions_1 = require("@mysten/sui/transactions");
|
|
5
5
|
const coins_js_1 = require("../common/coins.js");
|
|
6
6
|
const constants_js_1 = require("../common/constants.js");
|
|
@@ -122,6 +122,33 @@ const depositBluefinSuiFirstTxb = async (amount, poolName, isAmountA, options, t
|
|
|
122
122
|
],
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
+
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
126
|
+
txb.moveCall({
|
|
127
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_deposit`,
|
|
128
|
+
typeArguments: [
|
|
129
|
+
coins_js_1.coinsList[pool1].type,
|
|
130
|
+
coins_js_1.coinsList[pool2].type,
|
|
131
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
132
|
+
coins_js_1.coinsList["SUI"].type,
|
|
133
|
+
],
|
|
134
|
+
arguments: [
|
|
135
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
136
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
137
|
+
someReceipt,
|
|
138
|
+
txb.object(poolinfo.poolId),
|
|
139
|
+
depositCoinA,
|
|
140
|
+
depositCoinB,
|
|
141
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
142
|
+
txb.object(poolinfo.investorId),
|
|
143
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
144
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
145
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
146
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
147
|
+
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
148
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
149
|
+
],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
125
152
|
txb.transferObjects([coin1], address);
|
|
126
153
|
}
|
|
127
154
|
else {
|
|
@@ -268,6 +295,34 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
268
295
|
],
|
|
269
296
|
});
|
|
270
297
|
}
|
|
298
|
+
else if (poolName === "BLUEFIN-WBTC-USDC") {
|
|
299
|
+
txb.moveCall({
|
|
300
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_deposit`,
|
|
301
|
+
typeArguments: [
|
|
302
|
+
coins_js_1.coinsList[pool1].type,
|
|
303
|
+
coins_js_1.coinsList[pool2].type,
|
|
304
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
305
|
+
coins_js_1.coinsList["SUI"].type,
|
|
306
|
+
],
|
|
307
|
+
arguments: [
|
|
308
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
309
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
310
|
+
someReceipt,
|
|
311
|
+
txb.object(poolinfo.poolId),
|
|
312
|
+
depositCoinA,
|
|
313
|
+
depositCoinB,
|
|
314
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
315
|
+
txb.object(poolinfo.investorId),
|
|
316
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
317
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
318
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
319
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
320
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
321
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
322
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
323
|
+
],
|
|
324
|
+
});
|
|
325
|
+
}
|
|
271
326
|
txb.transferObjects([coin1], address);
|
|
272
327
|
txb.transferObjects([coin2], address);
|
|
273
328
|
}
|
|
@@ -278,7 +333,154 @@ const depositBluefinType1Txb = async (amount, poolName, isAmountA, options, tran
|
|
|
278
333
|
return txb;
|
|
279
334
|
};
|
|
280
335
|
exports.depositBluefinType1Txb = depositBluefinType1Txb;
|
|
281
|
-
const
|
|
336
|
+
const depositBluefinType2Txb = async (amount, poolName, isAmountA, options, transaction = undefined) => {
|
|
337
|
+
const suiClient = (0, client_js_1.getSuiClient)();
|
|
338
|
+
const address = options.address;
|
|
339
|
+
let txb;
|
|
340
|
+
if (transaction)
|
|
341
|
+
txb = transaction;
|
|
342
|
+
else
|
|
343
|
+
txb = new transactions_1.Transaction();
|
|
344
|
+
poolName = poolName.toUpperCase();
|
|
345
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
346
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
347
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
348
|
+
let coins1 = [];
|
|
349
|
+
let coins2 = [];
|
|
350
|
+
let currentCursor = null;
|
|
351
|
+
do {
|
|
352
|
+
const response = await suiClient.getCoins({
|
|
353
|
+
owner: address,
|
|
354
|
+
coinType: coins_js_1.coinsList[pool1].type,
|
|
355
|
+
cursor: currentCursor,
|
|
356
|
+
});
|
|
357
|
+
coins1 = coins1.concat(response.data);
|
|
358
|
+
// Check if there's a next page
|
|
359
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
360
|
+
currentCursor = response.nextCursor;
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
// No more pages available
|
|
364
|
+
// console.log("No more receipts available.");
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
} while (true);
|
|
368
|
+
currentCursor = null;
|
|
369
|
+
do {
|
|
370
|
+
const response = await suiClient.getCoins({
|
|
371
|
+
owner: address,
|
|
372
|
+
coinType: coins_js_1.coinsList[pool2].type,
|
|
373
|
+
cursor: currentCursor,
|
|
374
|
+
});
|
|
375
|
+
coins2 = coins2.concat(response.data);
|
|
376
|
+
// Check if there's a next page
|
|
377
|
+
if (response.hasNextPage && response.nextCursor) {
|
|
378
|
+
currentCursor = response.nextCursor;
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
// No more pages available
|
|
382
|
+
// console.log("No more receipts available.");
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
} while (true);
|
|
386
|
+
const amounts = await (0, cetus_js_1.getAmounts)(poolName, isAmountA, amount);
|
|
387
|
+
if (amounts) {
|
|
388
|
+
const amount1 = amounts[0];
|
|
389
|
+
const amount2 = amounts[1];
|
|
390
|
+
let coin1;
|
|
391
|
+
let coin2;
|
|
392
|
+
if (coins1.length >= 1 && coins2.length >= 1) {
|
|
393
|
+
//coin1
|
|
394
|
+
[coin1] = txb.splitCoins(txb.object(coins1[0].coinObjectId), [0]);
|
|
395
|
+
txb.mergeCoins(coin1, coins1.map((c) => c.coinObjectId));
|
|
396
|
+
const [depositCoinA] = txb.splitCoins(coin1, [amount1]);
|
|
397
|
+
//coin2
|
|
398
|
+
[coin2] = txb.splitCoins(txb.object(coins2[0].coinObjectId), [0]);
|
|
399
|
+
txb.mergeCoins(coin2, coins2.map((c) => c.coinObjectId));
|
|
400
|
+
const [depositCoinB] = txb.splitCoins(coin2, [amount2]);
|
|
401
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
402
|
+
let someReceipt;
|
|
403
|
+
if (receipt.length == 0) {
|
|
404
|
+
[someReceipt] = txb.moveCall({
|
|
405
|
+
target: `0x1::option::none`,
|
|
406
|
+
typeArguments: [poolinfo.receiptType],
|
|
407
|
+
arguments: [],
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
[someReceipt] = txb.moveCall({
|
|
412
|
+
target: `0x1::option::some`,
|
|
413
|
+
typeArguments: [receipt[0].content.type],
|
|
414
|
+
arguments: [txb.object(receipt[0].objectId)],
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
if (poolName === "BLUEFIN-ALPHA-USDC") {
|
|
418
|
+
txb.moveCall({
|
|
419
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
420
|
+
typeArguments: [
|
|
421
|
+
coins_js_1.coinsList[pool1].type,
|
|
422
|
+
coins_js_1.coinsList[pool2].type,
|
|
423
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
424
|
+
coins_js_1.coinsList["SUI"].type,
|
|
425
|
+
],
|
|
426
|
+
arguments: [
|
|
427
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
428
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
429
|
+
someReceipt,
|
|
430
|
+
txb.object(poolinfo.poolId),
|
|
431
|
+
depositCoinA,
|
|
432
|
+
depositCoinB,
|
|
433
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
434
|
+
txb.object(poolinfo.investorId),
|
|
435
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
436
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
437
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_USDC_POOL),
|
|
438
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
439
|
+
txb.object(maps_js_1.cetusPoolMap["ALPHA-USDC"]),
|
|
440
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
441
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
442
|
+
],
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
else if (poolName === "BLUEFIN-NAVX-VSUI") {
|
|
446
|
+
txb.moveCall({
|
|
447
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_deposit`,
|
|
448
|
+
typeArguments: [
|
|
449
|
+
coins_js_1.coinsList[pool1].type,
|
|
450
|
+
coins_js_1.coinsList[pool2].type,
|
|
451
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
452
|
+
coins_js_1.coinsList["SUI"].type,
|
|
453
|
+
],
|
|
454
|
+
arguments: [
|
|
455
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
456
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
457
|
+
someReceipt,
|
|
458
|
+
txb.object(poolinfo.poolId),
|
|
459
|
+
depositCoinA,
|
|
460
|
+
depositCoinB,
|
|
461
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
462
|
+
txb.object(poolinfo.investorId),
|
|
463
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
464
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
465
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_NAVX_VSUI_POOL),
|
|
466
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
467
|
+
txb.object(maps_js_1.cetusPoolMap["NAVX-VSUI"]),
|
|
468
|
+
txb.object(maps_js_1.cetusPoolMap["VSUI-SUI"]),
|
|
469
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
470
|
+
],
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
txb.transferObjects([coin1], address);
|
|
474
|
+
txb.transferObjects([coin2], address);
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
throw new Error(`No ${pool1} or ${pool2} Coins`);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return txb;
|
|
481
|
+
};
|
|
482
|
+
exports.depositBluefinType2Txb = depositBluefinType2Txb;
|
|
483
|
+
const withdrawBluefinSuiFirstTxb = async (xTokens, poolName, options) => {
|
|
282
484
|
const address = options.address;
|
|
283
485
|
const txb = new transactions_1.Transaction();
|
|
284
486
|
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
@@ -320,7 +522,7 @@ const withdrawBluefinSuiFirstTxb = async (amount, poolName, options) => {
|
|
|
320
522
|
txb.object(poolinfo.poolId),
|
|
321
523
|
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
322
524
|
txb.object(poolinfo.investorId),
|
|
323
|
-
txb.pure.u128(
|
|
525
|
+
txb.pure.u128(xTokens),
|
|
324
526
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
325
527
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
326
528
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_USDC_POOL),
|
|
@@ -348,7 +550,7 @@ const withdrawBluefinSuiFirstTxb = async (amount, poolName, options) => {
|
|
|
348
550
|
txb.object(poolinfo.poolId),
|
|
349
551
|
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
350
552
|
txb.object(poolinfo.investorId),
|
|
351
|
-
txb.pure.u128(
|
|
553
|
+
txb.pure.u128(xTokens),
|
|
352
554
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
353
555
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
354
556
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_BUCK_POOL),
|
|
@@ -358,6 +560,34 @@ const withdrawBluefinSuiFirstTxb = async (amount, poolName, options) => {
|
|
|
358
560
|
],
|
|
359
561
|
});
|
|
360
562
|
}
|
|
563
|
+
else if (poolName === "BLUEFIN-SUI-AUSD") {
|
|
564
|
+
txb.moveCall({
|
|
565
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_sui_first_pool::user_withdraw`,
|
|
566
|
+
typeArguments: [
|
|
567
|
+
coins_js_1.coinsList[pool1].type,
|
|
568
|
+
coins_js_1.coinsList[pool2].type,
|
|
569
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
570
|
+
coins_js_1.coinsList["SUI"].type,
|
|
571
|
+
],
|
|
572
|
+
arguments: [
|
|
573
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
574
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
575
|
+
txb.object(receipt[0].objectId),
|
|
576
|
+
alpha_receipt,
|
|
577
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
578
|
+
txb.object(poolinfo.poolId),
|
|
579
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
580
|
+
txb.object(poolinfo.investorId),
|
|
581
|
+
txb.pure.u128(xTokens),
|
|
582
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
583
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
584
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_SUI_AUSD_POOL),
|
|
585
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
586
|
+
txb.object(maps_js_1.cetusPoolMap["AUSD-SUI"]),
|
|
587
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
588
|
+
],
|
|
589
|
+
});
|
|
590
|
+
}
|
|
361
591
|
}
|
|
362
592
|
else {
|
|
363
593
|
throw new Error("No receipt found!");
|
|
@@ -365,7 +595,7 @@ const withdrawBluefinSuiFirstTxb = async (amount, poolName, options) => {
|
|
|
365
595
|
return txb;
|
|
366
596
|
};
|
|
367
597
|
exports.withdrawBluefinSuiFirstTxb = withdrawBluefinSuiFirstTxb;
|
|
368
|
-
const withdrawBluefinType1Txb = async (
|
|
598
|
+
const withdrawBluefinType1Txb = async (xTokens, poolName, options) => {
|
|
369
599
|
const address = options.address;
|
|
370
600
|
const txb = new transactions_1.Transaction();
|
|
371
601
|
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
@@ -407,7 +637,7 @@ const withdrawBluefinType1Txb = async (amount, poolName, options) => {
|
|
|
407
637
|
txb.object(poolinfo.poolId),
|
|
408
638
|
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
409
639
|
txb.object(poolinfo.investorId),
|
|
410
|
-
txb.pure.u128(
|
|
640
|
+
txb.pure.u128(xTokens),
|
|
411
641
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
412
642
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
413
643
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_USDT_USDC_POOL),
|
|
@@ -436,7 +666,7 @@ const withdrawBluefinType1Txb = async (amount, poolName, options) => {
|
|
|
436
666
|
txb.object(poolinfo.poolId),
|
|
437
667
|
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
438
668
|
txb.object(poolinfo.investorId),
|
|
439
|
-
txb.pure.u128(
|
|
669
|
+
txb.pure.u128(xTokens),
|
|
440
670
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
441
671
|
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
442
672
|
txb.object((0, constants_js_1.getConf)().BLUEFIN_AUSD_USDC_POOL),
|
|
@@ -447,6 +677,35 @@ const withdrawBluefinType1Txb = async (amount, poolName, options) => {
|
|
|
447
677
|
],
|
|
448
678
|
});
|
|
449
679
|
}
|
|
680
|
+
else if (poolName === "BLUEFIN-WBTC-USDC") {
|
|
681
|
+
txb.moveCall({
|
|
682
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_1_pool::user_withdraw`,
|
|
683
|
+
typeArguments: [
|
|
684
|
+
coins_js_1.coinsList[pool1].type,
|
|
685
|
+
coins_js_1.coinsList[pool2].type,
|
|
686
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
687
|
+
coins_js_1.coinsList["SUI"].type,
|
|
688
|
+
],
|
|
689
|
+
arguments: [
|
|
690
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
691
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
692
|
+
txb.object(receipt[0].objectId),
|
|
693
|
+
alpha_receipt,
|
|
694
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
695
|
+
txb.object(poolinfo.poolId),
|
|
696
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
697
|
+
txb.object(poolinfo.investorId),
|
|
698
|
+
txb.pure.u128(xTokens),
|
|
699
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
700
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
701
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_WBTC_USDC_POOL),
|
|
702
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
703
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-WBTC"]),
|
|
704
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
705
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
706
|
+
],
|
|
707
|
+
});
|
|
708
|
+
}
|
|
450
709
|
}
|
|
451
710
|
else {
|
|
452
711
|
throw new Error("No receipt found!");
|
|
@@ -454,4 +713,93 @@ const withdrawBluefinType1Txb = async (amount, poolName, options) => {
|
|
|
454
713
|
return txb;
|
|
455
714
|
};
|
|
456
715
|
exports.withdrawBluefinType1Txb = withdrawBluefinType1Txb;
|
|
716
|
+
const withdrawBluefinType2Txb = async (xTokens, poolName, options) => {
|
|
717
|
+
const address = options.address;
|
|
718
|
+
const txb = new transactions_1.Transaction();
|
|
719
|
+
const pool1 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin1;
|
|
720
|
+
const pool2 = maps_js_1.doubleAssetPoolCoinMap[poolName].coin2;
|
|
721
|
+
const receipt = await (0, getReceipts_js_1.getReceipts)(poolName, address, true);
|
|
722
|
+
const alphaReceipt = await (0, getReceipts_js_1.getReceipts)("ALPHA", address, true);
|
|
723
|
+
if (receipt.length > 0) {
|
|
724
|
+
let alpha_receipt;
|
|
725
|
+
if (alphaReceipt.length == 0) {
|
|
726
|
+
[alpha_receipt] = txb.moveCall({
|
|
727
|
+
target: `0x1::option::none`,
|
|
728
|
+
typeArguments: [(0, constants_js_1.getConf)().ALPHA_POOL_RECEIPT],
|
|
729
|
+
arguments: [],
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
[alpha_receipt] = txb.moveCall({
|
|
734
|
+
target: `0x1::option::some`,
|
|
735
|
+
typeArguments: [alphaReceipt[0].content.type],
|
|
736
|
+
arguments: [txb.object(alphaReceipt[0].objectId)],
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
const poolinfo = maps_js_1.poolInfo[poolName];
|
|
740
|
+
if (poolName === "BLUEFIN-ALPHA-USDC") {
|
|
741
|
+
txb.moveCall({
|
|
742
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
743
|
+
typeArguments: [
|
|
744
|
+
coins_js_1.coinsList[pool1].type,
|
|
745
|
+
coins_js_1.coinsList[pool2].type,
|
|
746
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
747
|
+
coins_js_1.coinsList["SUI"].type,
|
|
748
|
+
],
|
|
749
|
+
arguments: [
|
|
750
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
751
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
752
|
+
txb.object(receipt[0].objectId),
|
|
753
|
+
alpha_receipt,
|
|
754
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
755
|
+
txb.object(poolinfo.poolId),
|
|
756
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
757
|
+
txb.object(poolinfo.investorId),
|
|
758
|
+
txb.pure.u128(xTokens),
|
|
759
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
760
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
761
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_ALPHA_USDC_POOL),
|
|
762
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
763
|
+
txb.object(maps_js_1.cetusPoolMap["ALPHA-USDC"]),
|
|
764
|
+
txb.object(maps_js_1.cetusPoolMap["USDC-SUI"]),
|
|
765
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
766
|
+
],
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
else if (poolName === "BLUEFIN-NAVX-VSUI") {
|
|
770
|
+
txb.moveCall({
|
|
771
|
+
target: `${poolinfo.packageId}::alphafi_bluefin_type_2_pool::user_withdraw`,
|
|
772
|
+
typeArguments: [
|
|
773
|
+
coins_js_1.coinsList[pool1].type,
|
|
774
|
+
coins_js_1.coinsList[pool2].type,
|
|
775
|
+
coins_js_1.coinsList["DEEP"].type,
|
|
776
|
+
coins_js_1.coinsList["SUI"].type,
|
|
777
|
+
],
|
|
778
|
+
arguments: [
|
|
779
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_4_VERSION),
|
|
780
|
+
txb.object((0, constants_js_1.getConf)().VERSION),
|
|
781
|
+
txb.object(receipt[0].objectId),
|
|
782
|
+
alpha_receipt,
|
|
783
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_POOL),
|
|
784
|
+
txb.object(poolinfo.poolId),
|
|
785
|
+
txb.object((0, constants_js_1.getConf)().ALPHA_DISTRIBUTOR),
|
|
786
|
+
txb.object(poolinfo.investorId),
|
|
787
|
+
txb.pure.u128(xTokens),
|
|
788
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_GLOBAL_CONFIG),
|
|
789
|
+
txb.object((0, constants_js_1.getConf)().CETUS_GLOBAL_CONFIG_ID),
|
|
790
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_NAVX_VSUI_POOL),
|
|
791
|
+
txb.object((0, constants_js_1.getConf)().BLUEFIN_DEEP_SUI_POOL),
|
|
792
|
+
txb.object(maps_js_1.cetusPoolMap["NAVX-VSUI"]),
|
|
793
|
+
txb.object(maps_js_1.cetusPoolMap["VSUI-SUI"]),
|
|
794
|
+
txb.object((0, constants_js_1.getConf)().CLOCK_PACKAGE_ID),
|
|
795
|
+
],
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
throw new Error("No receipt found!");
|
|
801
|
+
}
|
|
802
|
+
return txb;
|
|
803
|
+
};
|
|
804
|
+
exports.withdrawBluefinType2Txb = withdrawBluefinType2Txb;
|
|
457
805
|
//# sourceMappingURL=bluefin.js.map
|