@typus/typus-sdk 1.1.55 → 1.1.57
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.
|
@@ -1,91 +1,75 @@
|
|
|
1
1
|
import { TransactionBlock } from "@mysten/sui.js/transactions";
|
|
2
2
|
/**
|
|
3
|
-
public
|
|
3
|
+
public fun deposit<D_TOKEN, B_TOKEN>(
|
|
4
4
|
registry: &mut Registry,
|
|
5
5
|
index: u64,
|
|
6
6
|
coins: vector<Coin<D_TOKEN>>,
|
|
7
7
|
amount: u64,
|
|
8
8
|
receipts: vector<TypusDepositReceipt>,
|
|
9
|
+
clock: &Clock,
|
|
9
10
|
ctx: &mut TxContext,
|
|
10
11
|
)
|
|
11
12
|
*/
|
|
12
|
-
export declare function getDepositTx(
|
|
13
|
+
export declare function getDepositTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], amount: string, receipts: string[], user: string, usingSponsoredGasCoin?: boolean): TransactionBlock;
|
|
13
14
|
/**
|
|
14
|
-
public
|
|
15
|
+
public fun withdraw<D_TOKEN, B_TOKEN>(
|
|
15
16
|
registry: &mut Registry,
|
|
16
17
|
index: u64,
|
|
17
18
|
receipts: vector<TypusDepositReceipt>,
|
|
18
19
|
share: Option<u64>,
|
|
20
|
+
clock: &Clock,
|
|
19
21
|
ctx: &mut TxContext,
|
|
20
22
|
)
|
|
21
23
|
*/
|
|
22
|
-
export declare function getWithdrawTx(
|
|
24
|
+
export declare function getWithdrawTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string, share?: string): TransactionBlock;
|
|
23
25
|
/**
|
|
24
|
-
public
|
|
26
|
+
public fun unsubscribe<D_TOKEN, B_TOKEN>(
|
|
25
27
|
registry: &mut Registry,
|
|
26
28
|
index: u64,
|
|
27
29
|
receipts: vector<TypusDepositReceipt>,
|
|
28
30
|
share: Option<u64>,
|
|
31
|
+
clock: &Clock,
|
|
29
32
|
ctx: &mut TxContext,
|
|
30
33
|
)
|
|
31
34
|
*/
|
|
32
|
-
export declare function getUnsubscribeTx(
|
|
35
|
+
export declare function getUnsubscribeTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string, share?: string): TransactionBlock;
|
|
33
36
|
/**
|
|
34
|
-
public
|
|
37
|
+
public fun compound<D_TOKEN, B_TOKEN>(
|
|
35
38
|
registry: &mut Registry,
|
|
36
39
|
index: u64,
|
|
37
40
|
receipts: vector<TypusDepositReceipt>,
|
|
41
|
+
clock: &Clock,
|
|
38
42
|
ctx: &mut TxContext,
|
|
39
43
|
)
|
|
40
44
|
*/
|
|
41
|
-
export declare function
|
|
42
|
-
typeArguments: string[];
|
|
43
|
-
index: string;
|
|
44
|
-
receipts: string[];
|
|
45
|
-
}[]): Promise<TransactionBlock>;
|
|
45
|
+
export declare function getCompoundTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
|
|
46
46
|
/**
|
|
47
|
-
public
|
|
47
|
+
public fun claim<D_TOKEN, B_TOKEN>(
|
|
48
48
|
registry: &mut Registry,
|
|
49
49
|
index: u64,
|
|
50
50
|
receipts: vector<TypusDepositReceipt>,
|
|
51
51
|
ctx: &mut TxContext,
|
|
52
52
|
)
|
|
53
53
|
*/
|
|
54
|
-
export declare function
|
|
55
|
-
typeArguments: string[];
|
|
56
|
-
index: string;
|
|
57
|
-
receipts: string[];
|
|
58
|
-
}[]): Promise<TransactionBlock>;
|
|
59
|
-
export declare function getBatchClaimHarvestWithdrawRedeemTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, claimRequests: {
|
|
60
|
-
typeArguments: string[];
|
|
61
|
-
index: string;
|
|
62
|
-
receipts: string[];
|
|
63
|
-
}[], harvestRequests: {
|
|
64
|
-
typeArguments: string[];
|
|
65
|
-
index: string;
|
|
66
|
-
receipts: string[];
|
|
67
|
-
}[], withdrawRequests: {
|
|
68
|
-
typeArguments: string[];
|
|
69
|
-
index: string;
|
|
70
|
-
receipts: string[];
|
|
71
|
-
}[], redeemRequests: {
|
|
72
|
-
typeArguments: string[];
|
|
73
|
-
index: string;
|
|
74
|
-
receipts: string[];
|
|
75
|
-
}[]): Promise<TransactionBlock>;
|
|
54
|
+
export declare function getClaimTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
|
|
76
55
|
/**
|
|
77
|
-
public
|
|
56
|
+
public fun harvest<D_TOKEN, B_TOKEN>(
|
|
78
57
|
registry: &mut Registry,
|
|
79
58
|
index: u64,
|
|
80
59
|
receipts: vector<TypusDepositReceipt>,
|
|
81
60
|
ctx: &mut TxContext,
|
|
82
61
|
)
|
|
83
62
|
*/
|
|
84
|
-
export declare function
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
export declare function getHarvestTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
|
|
64
|
+
/**
|
|
65
|
+
public fun redeem<D_TOKEN, B_TOKEN, I_TOKEN>(
|
|
66
|
+
registry: &mut Registry,
|
|
67
|
+
index: u64,
|
|
68
|
+
receipts: vector<TypusDepositReceipt>,
|
|
69
|
+
ctx: &mut TxContext,
|
|
70
|
+
)
|
|
71
|
+
*/
|
|
72
|
+
export declare function getRedeemTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
|
|
89
73
|
/**
|
|
90
74
|
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
|
|
91
75
|
registry: &mut Registry,
|
|
@@ -96,8 +80,17 @@ export declare function getCompoundTx(gasBudget: number, typusFrameworkPackageId
|
|
|
96
80
|
ctx: &mut TxContext,
|
|
97
81
|
)
|
|
98
82
|
*/
|
|
99
|
-
export declare function getNewBidTx(
|
|
100
|
-
usingSponsoredGasCoin?: boolean):
|
|
83
|
+
export declare function getNewBidTx(tx: TransactionBlock, packageId: string, typeArguments: string[], registry: string, index: string, coins: string[], size: string, premium_required: string, // fe float * b_token_decimal
|
|
84
|
+
user: string, usingSponsoredGasCoin?: boolean): TransactionBlock;
|
|
85
|
+
/**
|
|
86
|
+
public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
|
|
87
|
+
registry: &mut Registry,
|
|
88
|
+
index: u64,
|
|
89
|
+
receipts: vector<TypusBidReceipt>,
|
|
90
|
+
ctx: &mut TxContext,
|
|
91
|
+
)
|
|
92
|
+
*/
|
|
93
|
+
export declare function getExerciseTx(tx: TransactionBlock, typusFrameworkOriginPackageId: string, typusFrameworkPackageId: string, packageId: string, typeArguments: string[], registry: string, index: string, receipts: string[], user: string): TransactionBlock;
|
|
101
94
|
/**
|
|
102
95
|
public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
|
|
103
96
|
registry: &mut Registry,
|
|
@@ -110,7 +103,7 @@ usingSponsoredGasCoin?: boolean): Promise<TransactionBlock>;
|
|
|
110
103
|
*/
|
|
111
104
|
export declare function getTransferBidReceiptTx(input: {
|
|
112
105
|
gasBudget: number;
|
|
113
|
-
|
|
106
|
+
typusFrameworkOriginPackageId: string;
|
|
114
107
|
packageId: string;
|
|
115
108
|
typeArguments: string[];
|
|
116
109
|
registry: string;
|
|
@@ -118,27 +111,14 @@ export declare function getTransferBidReceiptTx(input: {
|
|
|
118
111
|
receipts: string[];
|
|
119
112
|
share?: string;
|
|
120
113
|
recipient: string;
|
|
121
|
-
}):
|
|
122
|
-
/**
|
|
123
|
-
public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
|
|
124
|
-
registry: &mut Registry,
|
|
125
|
-
index: u64,
|
|
126
|
-
receipts: vector<TypusBidReceipt>,
|
|
127
|
-
ctx: &mut TxContext,
|
|
128
|
-
)
|
|
129
|
-
*/
|
|
130
|
-
export declare function getExerciseTx(gasBudget: number, typusFrameworkPackageId: string, packageId: string, registry: string, requests: {
|
|
131
|
-
typeArguments: string[];
|
|
132
|
-
index: string;
|
|
133
|
-
receipts: string[];
|
|
134
|
-
}[]): Promise<TransactionBlock>;
|
|
114
|
+
}): TransactionBlock;
|
|
135
115
|
/**
|
|
136
116
|
public(friend) entry fun refund<TOKEN>(
|
|
137
117
|
registry: &mut Registry,
|
|
138
118
|
ctx: &mut TxContext,
|
|
139
119
|
)
|
|
140
120
|
*/
|
|
141
|
-
export declare function getRebateTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string):
|
|
121
|
+
export declare function getRebateTx(gasBudget: number, packageId: string, typeArguments: string[], registry: string): TransactionBlock;
|
|
142
122
|
/**
|
|
143
123
|
entry fun new_strategy<B_TOKEN>(
|
|
144
124
|
strategy_pool: &mut StrategyPool,
|
|
@@ -153,4 +133,4 @@ export declare function getRebateTx(gasBudget: number, packageId: string, typeAr
|
|
|
153
133
|
)
|
|
154
134
|
*/
|
|
155
135
|
export declare function getNewStrategyTx(gasBudget: number, packageId: string, typeArguments: string[], // B_TOKEN
|
|
156
|
-
strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]):
|
|
136
|
+
strategy_pool: string, vault_index: string, signal_index: string, coins: string[], amount: string, size: string, price_percentage: string, max_times: string, target_rounds: string[]): TransactionBlock;
|
|
@@ -1,40 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __read = (this && this.__read) || function (o, n) {
|
|
39
3
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
40
4
|
if (!m) return o;
|
|
@@ -52,306 +16,266 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
52
16
|
return ar;
|
|
53
17
|
};
|
|
54
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
|
-
exports.getNewStrategyTx = exports.getRebateTx = exports.
|
|
19
|
+
exports.getNewStrategyTx = exports.getRebateTx = exports.getTransferBidReceiptTx = exports.getExerciseTx = exports.getNewBidTx = exports.getRedeemTx = exports.getHarvestTx = exports.getClaimTx = exports.getCompoundTx = exports.getUnsubscribeTx = exports.getWithdrawTx = exports.getDepositTx = void 0;
|
|
56
20
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
57
21
|
var constants_1 = require("../../constants");
|
|
58
22
|
/**
|
|
59
|
-
public
|
|
23
|
+
public fun deposit<D_TOKEN, B_TOKEN>(
|
|
60
24
|
registry: &mut Registry,
|
|
61
25
|
index: u64,
|
|
62
26
|
coins: vector<Coin<D_TOKEN>>,
|
|
63
27
|
amount: u64,
|
|
64
28
|
receipts: vector<TypusDepositReceipt>,
|
|
29
|
+
clock: &Clock,
|
|
65
30
|
ctx: &mut TxContext,
|
|
66
31
|
)
|
|
67
32
|
*/
|
|
68
|
-
function getDepositTx(
|
|
33
|
+
function getDepositTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, coins, amount, receipts, user, usingSponsoredGasCoin) {
|
|
69
34
|
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
tx.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
89
|
-
}),
|
|
90
|
-
tx.pure(constants_1.CLOCK),
|
|
91
|
-
],
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
tx.moveCall({
|
|
96
|
-
target: "".concat(packageId, "::tails_staking::deposit"),
|
|
97
|
-
typeArguments: typeArguments,
|
|
98
|
-
arguments: [
|
|
99
|
-
tx.object(registry),
|
|
100
|
-
tx.pure(index),
|
|
101
|
-
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
102
|
-
tx.pure(amount),
|
|
103
|
-
tx.makeMoveVec({
|
|
104
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
105
|
-
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
106
|
-
}),
|
|
107
|
-
tx.pure(constants_1.CLOCK),
|
|
108
|
-
],
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
tx.setGasBudget(gasBudget);
|
|
112
|
-
return [2 /*return*/, tx];
|
|
35
|
+
if (!usingSponsoredGasCoin &&
|
|
36
|
+
(typeArguments[0] == "0x2::sui::SUI" ||
|
|
37
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
38
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), coin = _a[0];
|
|
39
|
+
var result = tx.moveCall({
|
|
40
|
+
target: "".concat(packageId, "::tails_staking::deposit"),
|
|
41
|
+
typeArguments: typeArguments,
|
|
42
|
+
arguments: [
|
|
43
|
+
tx.object(registry),
|
|
44
|
+
tx.pure(index),
|
|
45
|
+
tx.makeMoveVec({ objects: [coin] }),
|
|
46
|
+
tx.pure(amount),
|
|
47
|
+
tx.makeMoveVec({
|
|
48
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
49
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
50
|
+
}),
|
|
51
|
+
tx.pure(constants_1.CLOCK),
|
|
52
|
+
],
|
|
113
53
|
});
|
|
114
|
-
|
|
54
|
+
tx.moveCall({
|
|
55
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
56
|
+
typeArguments: [typeArguments[0]],
|
|
57
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
58
|
+
});
|
|
59
|
+
tx.transferObjects([tx.object(result[1])], user);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
var result = tx.moveCall({
|
|
63
|
+
target: "".concat(packageId, "::tails_staking::deposit"),
|
|
64
|
+
typeArguments: typeArguments,
|
|
65
|
+
arguments: [
|
|
66
|
+
tx.object(registry),
|
|
67
|
+
tx.pure(index),
|
|
68
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
69
|
+
tx.pure(amount),
|
|
70
|
+
tx.makeMoveVec({
|
|
71
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
72
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
73
|
+
}),
|
|
74
|
+
tx.pure(constants_1.CLOCK),
|
|
75
|
+
],
|
|
76
|
+
});
|
|
77
|
+
tx.moveCall({
|
|
78
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_coins"),
|
|
79
|
+
typeArguments: [typeArguments[0]],
|
|
80
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
81
|
+
});
|
|
82
|
+
tx.transferObjects([tx.object(result[1])], user);
|
|
83
|
+
}
|
|
84
|
+
return tx;
|
|
115
85
|
}
|
|
116
86
|
exports.getDepositTx = getDepositTx;
|
|
117
87
|
/**
|
|
118
|
-
public
|
|
88
|
+
public fun withdraw<D_TOKEN, B_TOKEN>(
|
|
119
89
|
registry: &mut Registry,
|
|
120
90
|
index: u64,
|
|
121
91
|
receipts: vector<TypusDepositReceipt>,
|
|
122
92
|
share: Option<u64>,
|
|
93
|
+
clock: &Clock,
|
|
123
94
|
ctx: &mut TxContext,
|
|
124
95
|
)
|
|
125
96
|
*/
|
|
126
|
-
function getWithdrawTx(
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
tx.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
tx.setGasBudget(gasBudget);
|
|
146
|
-
return [2 /*return*/, tx];
|
|
147
|
-
});
|
|
97
|
+
function getWithdrawTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
|
|
98
|
+
var result = tx.moveCall({
|
|
99
|
+
target: "".concat(packageId, "::tails_staking::withdraw"),
|
|
100
|
+
typeArguments: typeArguments,
|
|
101
|
+
arguments: [
|
|
102
|
+
tx.object(registry),
|
|
103
|
+
tx.pure(index),
|
|
104
|
+
tx.makeMoveVec({
|
|
105
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
106
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
107
|
+
}),
|
|
108
|
+
tx.pure(share ? [share] : []),
|
|
109
|
+
tx.pure(constants_1.CLOCK),
|
|
110
|
+
],
|
|
111
|
+
});
|
|
112
|
+
tx.moveCall({
|
|
113
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
114
|
+
typeArguments: [typeArguments[0]],
|
|
115
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
148
116
|
});
|
|
117
|
+
tx.moveCall({
|
|
118
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
119
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
120
|
+
});
|
|
121
|
+
return tx;
|
|
149
122
|
}
|
|
150
123
|
exports.getWithdrawTx = getWithdrawTx;
|
|
151
124
|
/**
|
|
152
|
-
public
|
|
125
|
+
public fun unsubscribe<D_TOKEN, B_TOKEN>(
|
|
153
126
|
registry: &mut Registry,
|
|
154
127
|
index: u64,
|
|
155
128
|
receipts: vector<TypusDepositReceipt>,
|
|
156
129
|
share: Option<u64>,
|
|
130
|
+
clock: &Clock,
|
|
157
131
|
ctx: &mut TxContext,
|
|
158
132
|
)
|
|
159
133
|
*/
|
|
160
|
-
function getUnsubscribeTx(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
tx.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}),
|
|
175
|
-
tx.pure(share ? [share] : []),
|
|
176
|
-
tx.pure(constants_1.CLOCK),
|
|
177
|
-
],
|
|
178
|
-
});
|
|
179
|
-
tx.setGasBudget(gasBudget);
|
|
180
|
-
return [2 /*return*/, tx];
|
|
181
|
-
});
|
|
134
|
+
function getUnsubscribeTx(tx, typusFrameworkOriginPackageId, packageId, typeArguments, registry, index, receipts, user, share) {
|
|
135
|
+
var result = tx.moveCall({
|
|
136
|
+
target: "".concat(packageId, "::tails_staking::unsubscribe"),
|
|
137
|
+
typeArguments: typeArguments,
|
|
138
|
+
arguments: [
|
|
139
|
+
tx.object(registry),
|
|
140
|
+
tx.pure(index),
|
|
141
|
+
tx.makeMoveVec({
|
|
142
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
143
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
144
|
+
}),
|
|
145
|
+
tx.pure(share ? [share] : []),
|
|
146
|
+
tx.pure(constants_1.CLOCK),
|
|
147
|
+
],
|
|
182
148
|
});
|
|
149
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
150
|
+
return tx;
|
|
183
151
|
}
|
|
184
152
|
exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
185
153
|
/**
|
|
186
|
-
public
|
|
154
|
+
public fun compound<D_TOKEN, B_TOKEN>(
|
|
155
|
+
registry: &mut Registry,
|
|
156
|
+
index: u64,
|
|
157
|
+
receipts: vector<TypusDepositReceipt>,
|
|
158
|
+
clock: &Clock,
|
|
159
|
+
ctx: &mut TxContext,
|
|
160
|
+
)
|
|
161
|
+
*/
|
|
162
|
+
function getCompoundTx(tx, typusFrameworkOriginPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
163
|
+
var result = tx.moveCall({
|
|
164
|
+
target: "".concat(packageId, "::tails_staking::compound"),
|
|
165
|
+
typeArguments: typeArguments,
|
|
166
|
+
arguments: [
|
|
167
|
+
tx.object(registry),
|
|
168
|
+
tx.pure(index),
|
|
169
|
+
tx.makeMoveVec({
|
|
170
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
171
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
172
|
+
}),
|
|
173
|
+
tx.object(constants_1.CLOCK),
|
|
174
|
+
],
|
|
175
|
+
});
|
|
176
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
177
|
+
return tx;
|
|
178
|
+
}
|
|
179
|
+
exports.getCompoundTx = getCompoundTx;
|
|
180
|
+
/**
|
|
181
|
+
public fun claim<D_TOKEN, B_TOKEN>(
|
|
187
182
|
registry: &mut Registry,
|
|
188
183
|
index: u64,
|
|
189
184
|
receipts: vector<TypusDepositReceipt>,
|
|
190
185
|
ctx: &mut TxContext,
|
|
191
186
|
)
|
|
192
187
|
*/
|
|
193
|
-
function getClaimTx(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
tx.setGasBudget(gasBudget);
|
|
213
|
-
return [2 /*return*/, tx];
|
|
214
|
-
});
|
|
188
|
+
function getClaimTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
189
|
+
var result = tx.moveCall({
|
|
190
|
+
target: "".concat(packageId, "::tds_user_entry::claim"),
|
|
191
|
+
typeArguments: typeArguments,
|
|
192
|
+
arguments: [
|
|
193
|
+
tx.object(registry),
|
|
194
|
+
tx.pure(index),
|
|
195
|
+
tx.makeMoveVec({
|
|
196
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
197
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
198
|
+
}),
|
|
199
|
+
],
|
|
200
|
+
});
|
|
201
|
+
tx.moveCall({
|
|
202
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
203
|
+
typeArguments: [typeArguments[0]],
|
|
204
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
215
205
|
});
|
|
206
|
+
tx.moveCall({
|
|
207
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
208
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
209
|
+
});
|
|
210
|
+
return tx;
|
|
216
211
|
}
|
|
217
212
|
exports.getClaimTx = getClaimTx;
|
|
218
213
|
/**
|
|
219
|
-
public
|
|
214
|
+
public fun harvest<D_TOKEN, B_TOKEN>(
|
|
220
215
|
registry: &mut Registry,
|
|
221
216
|
index: u64,
|
|
222
217
|
receipts: vector<TypusDepositReceipt>,
|
|
223
218
|
ctx: &mut TxContext,
|
|
224
219
|
)
|
|
225
220
|
*/
|
|
226
|
-
function getHarvestTx(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
tx.makeMoveVec({
|
|
239
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
240
|
-
objects: request.receipts.map(function (id) { return tx.object(id); }),
|
|
241
|
-
}),
|
|
242
|
-
],
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
tx.setGasBudget(gasBudget);
|
|
246
|
-
return [2 /*return*/, tx];
|
|
247
|
-
});
|
|
221
|
+
function getHarvestTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
222
|
+
var result = tx.moveCall({
|
|
223
|
+
target: "".concat(packageId, "::tds_user_entry::harvest"),
|
|
224
|
+
typeArguments: typeArguments,
|
|
225
|
+
arguments: [
|
|
226
|
+
tx.object(registry),
|
|
227
|
+
tx.pure(index),
|
|
228
|
+
tx.makeMoveVec({
|
|
229
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
230
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
231
|
+
}),
|
|
232
|
+
],
|
|
248
233
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
tx.moveCall({
|
|
258
|
-
target: "".concat(packageId, "::tds_user_entry::claim"),
|
|
259
|
-
typeArguments: request.typeArguments,
|
|
260
|
-
arguments: [
|
|
261
|
-
tx.object(registry),
|
|
262
|
-
tx.pure(request.index),
|
|
263
|
-
tx.makeMoveVec({
|
|
264
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
265
|
-
objects: request.receipts.map(function (id) { return tx.object(id); }),
|
|
266
|
-
}),
|
|
267
|
-
],
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
harvestRequests.forEach(function (request) {
|
|
271
|
-
tx.moveCall({
|
|
272
|
-
target: "".concat(packageId, "::tds_user_entry::harvest"),
|
|
273
|
-
typeArguments: request.typeArguments,
|
|
274
|
-
arguments: [
|
|
275
|
-
tx.object(registry),
|
|
276
|
-
tx.pure(request.index),
|
|
277
|
-
tx.makeMoveVec({
|
|
278
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
279
|
-
objects: request.receipts.map(function (id) { return tx.object(id); }),
|
|
280
|
-
}),
|
|
281
|
-
],
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
withdrawRequests.forEach(function (request) {
|
|
285
|
-
tx.moveCall({
|
|
286
|
-
target: "".concat(packageId, "::tails_staking::withdraw"),
|
|
287
|
-
typeArguments: request.typeArguments,
|
|
288
|
-
arguments: [
|
|
289
|
-
tx.object(registry),
|
|
290
|
-
tx.pure(request.index),
|
|
291
|
-
tx.makeMoveVec({
|
|
292
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
293
|
-
objects: request.receipts.map(function (id) { return tx.object(id); }),
|
|
294
|
-
}),
|
|
295
|
-
tx.pure([]),
|
|
296
|
-
tx.pure(constants_1.CLOCK),
|
|
297
|
-
],
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
redeemRequests.forEach(function (request) {
|
|
301
|
-
tx.moveCall({
|
|
302
|
-
target: "".concat(packageId, "::tds_user_entry::redeem"),
|
|
303
|
-
typeArguments: request.typeArguments,
|
|
304
|
-
arguments: [
|
|
305
|
-
tx.object(registry),
|
|
306
|
-
tx.pure(request.index),
|
|
307
|
-
tx.makeMoveVec({
|
|
308
|
-
type: "".concat(typusFrameworkPackageId, "::vault::TypusDepositReceipt"),
|
|
309
|
-
objects: request.receipts.map(function (id) { return tx.object(id); }),
|
|
310
|
-
}),
|
|
311
|
-
tx.pure(constants_1.CLOCK),
|
|
312
|
-
],
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
tx.setGasBudget(gasBudget);
|
|
316
|
-
return [2 /*return*/, tx];
|
|
317
|
-
});
|
|
234
|
+
tx.moveCall({
|
|
235
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
236
|
+
typeArguments: [typeArguments[1]],
|
|
237
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
238
|
+
});
|
|
239
|
+
tx.moveCall({
|
|
240
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
241
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
318
242
|
});
|
|
243
|
+
return tx;
|
|
319
244
|
}
|
|
320
|
-
exports.
|
|
245
|
+
exports.getHarvestTx = getHarvestTx;
|
|
321
246
|
/**
|
|
322
|
-
public
|
|
247
|
+
public fun redeem<D_TOKEN, B_TOKEN, I_TOKEN>(
|
|
323
248
|
registry: &mut Registry,
|
|
324
249
|
index: u64,
|
|
325
250
|
receipts: vector<TypusDepositReceipt>,
|
|
326
251
|
ctx: &mut TxContext,
|
|
327
252
|
)
|
|
328
253
|
*/
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
],
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
tx.setGasBudget(gasBudget);
|
|
350
|
-
return [2 /*return*/, tx];
|
|
351
|
-
});
|
|
254
|
+
function getRedeemTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
255
|
+
var result = tx.moveCall({
|
|
256
|
+
target: "".concat(packageId, "::tds_user_entry::redeem"),
|
|
257
|
+
typeArguments: typeArguments,
|
|
258
|
+
arguments: [
|
|
259
|
+
tx.object(registry),
|
|
260
|
+
tx.pure(index),
|
|
261
|
+
tx.makeMoveVec({
|
|
262
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
263
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
264
|
+
}),
|
|
265
|
+
],
|
|
266
|
+
});
|
|
267
|
+
tx.moveCall({
|
|
268
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
269
|
+
typeArguments: [typeArguments[2]],
|
|
270
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
352
271
|
});
|
|
272
|
+
tx.moveCall({
|
|
273
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
274
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
275
|
+
});
|
|
276
|
+
return tx;
|
|
353
277
|
}
|
|
354
|
-
exports.
|
|
278
|
+
exports.getRedeemTx = getRedeemTx;
|
|
355
279
|
/**
|
|
356
280
|
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
|
|
357
281
|
registry: &mut Registry,
|
|
@@ -362,110 +286,96 @@ exports.getCompoundTx = getCompoundTx;
|
|
|
362
286
|
ctx: &mut TxContext,
|
|
363
287
|
)
|
|
364
288
|
*/
|
|
365
|
-
function getNewBidTx(
|
|
366
|
-
usingSponsoredGasCoin) {
|
|
289
|
+
function getNewBidTx(tx, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
|
|
290
|
+
user, usingSponsoredGasCoin) {
|
|
367
291
|
if (usingSponsoredGasCoin === void 0) { usingSponsoredGasCoin = false; }
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
tx.moveCall({
|
|
377
|
-
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
378
|
-
typeArguments: typeArguments,
|
|
379
|
-
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
tx.moveCall({
|
|
384
|
-
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
385
|
-
typeArguments: typeArguments,
|
|
386
|
-
arguments: [
|
|
387
|
-
tx.object(registry),
|
|
388
|
-
tx.pure(index),
|
|
389
|
-
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
390
|
-
tx.pure(size),
|
|
391
|
-
tx.pure("0x6"),
|
|
392
|
-
],
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
tx.setGasBudget(gasBudget);
|
|
396
|
-
return [2 /*return*/, tx];
|
|
292
|
+
if (!usingSponsoredGasCoin &&
|
|
293
|
+
(typeArguments[1] == "0x2::sui::SUI" ||
|
|
294
|
+
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
295
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
296
|
+
var result = tx.moveCall({
|
|
297
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
298
|
+
typeArguments: typeArguments,
|
|
299
|
+
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
|
|
397
300
|
});
|
|
398
|
-
|
|
301
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
var result = tx.moveCall({
|
|
305
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
306
|
+
typeArguments: typeArguments,
|
|
307
|
+
arguments: [
|
|
308
|
+
tx.object(registry),
|
|
309
|
+
tx.pure(index),
|
|
310
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
311
|
+
tx.pure(size),
|
|
312
|
+
tx.pure("0x6"),
|
|
313
|
+
],
|
|
314
|
+
});
|
|
315
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
316
|
+
}
|
|
317
|
+
return tx;
|
|
399
318
|
}
|
|
400
319
|
exports.getNewBidTx = getNewBidTx;
|
|
401
320
|
/**
|
|
402
|
-
public(friend) entry fun
|
|
321
|
+
public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
|
|
403
322
|
registry: &mut Registry,
|
|
404
323
|
index: u64,
|
|
405
324
|
receipts: vector<TypusBidReceipt>,
|
|
406
|
-
share: Option<u64>,
|
|
407
|
-
recipient: address,
|
|
408
325
|
ctx: &mut TxContext,
|
|
409
|
-
)
|
|
326
|
+
)
|
|
410
327
|
*/
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
tx.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
],
|
|
429
|
-
});
|
|
430
|
-
tx.setGasBudget(input.gasBudget);
|
|
431
|
-
return [2 /*return*/, tx];
|
|
432
|
-
});
|
|
328
|
+
function getExerciseTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
329
|
+
var result = tx.moveCall({
|
|
330
|
+
target: "".concat(packageId, "::tds_user_entry::exercise"),
|
|
331
|
+
typeArguments: typeArguments,
|
|
332
|
+
arguments: [
|
|
333
|
+
tx.object(registry),
|
|
334
|
+
tx.pure(index),
|
|
335
|
+
tx.makeMoveVec({
|
|
336
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
337
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
338
|
+
}),
|
|
339
|
+
],
|
|
340
|
+
});
|
|
341
|
+
tx.moveCall({
|
|
342
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
343
|
+
typeArguments: [typeArguments[0]],
|
|
344
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
433
345
|
});
|
|
346
|
+
return tx;
|
|
434
347
|
}
|
|
435
|
-
exports.
|
|
348
|
+
exports.getExerciseTx = getExerciseTx;
|
|
436
349
|
/**
|
|
437
|
-
public(friend) entry fun
|
|
350
|
+
public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
|
|
438
351
|
registry: &mut Registry,
|
|
439
352
|
index: u64,
|
|
440
353
|
receipts: vector<TypusBidReceipt>,
|
|
354
|
+
share: Option<u64>,
|
|
355
|
+
recipient: address,
|
|
441
356
|
ctx: &mut TxContext,
|
|
442
|
-
)
|
|
357
|
+
) {
|
|
443
358
|
*/
|
|
444
|
-
function
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}),
|
|
460
|
-
],
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
tx.setGasBudget(gasBudget);
|
|
464
|
-
return [2 /*return*/, tx];
|
|
465
|
-
});
|
|
359
|
+
function getTransferBidReceiptTx(input) {
|
|
360
|
+
var tx = new transactions_1.TransactionBlock();
|
|
361
|
+
tx.moveCall({
|
|
362
|
+
target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
|
|
363
|
+
typeArguments: input.typeArguments,
|
|
364
|
+
arguments: [
|
|
365
|
+
tx.object(input.registry),
|
|
366
|
+
tx.pure(input.index),
|
|
367
|
+
tx.makeMoveVec({
|
|
368
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
369
|
+
objects: input.receipts.map(function (id) { return tx.object(id); }),
|
|
370
|
+
}),
|
|
371
|
+
tx.pure(input.share ? [input.share] : []),
|
|
372
|
+
tx.pure(input.recipient),
|
|
373
|
+
],
|
|
466
374
|
});
|
|
375
|
+
tx.setGasBudget(input.gasBudget);
|
|
376
|
+
return tx;
|
|
467
377
|
}
|
|
468
|
-
exports.
|
|
378
|
+
exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
|
|
469
379
|
/**
|
|
470
380
|
public(friend) entry fun refund<TOKEN>(
|
|
471
381
|
registry: &mut Registry,
|
|
@@ -473,21 +383,16 @@ exports.getExerciseTx = getExerciseTx;
|
|
|
473
383
|
)
|
|
474
384
|
*/
|
|
475
385
|
function getRebateTx(gasBudget, packageId, typeArguments, registry) {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
typeArguments
|
|
481
|
-
|
|
482
|
-
target: "".concat(packageId, "::tds_user_entry::rebate"),
|
|
483
|
-
typeArguments: [typeArgument],
|
|
484
|
-
arguments: [tx.object(registry)],
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
tx.setGasBudget(gasBudget);
|
|
488
|
-
return [2 /*return*/, tx];
|
|
386
|
+
var tx = new transactions_1.TransactionBlock();
|
|
387
|
+
typeArguments.forEach(function (typeArgument) {
|
|
388
|
+
tx.moveCall({
|
|
389
|
+
target: "".concat(packageId, "::tds_user_entry::rebate"),
|
|
390
|
+
typeArguments: [typeArgument],
|
|
391
|
+
arguments: [tx.object(registry)],
|
|
489
392
|
});
|
|
490
393
|
});
|
|
394
|
+
tx.setGasBudget(gasBudget);
|
|
395
|
+
return tx;
|
|
491
396
|
}
|
|
492
397
|
exports.getRebateTx = getRebateTx;
|
|
493
398
|
/**
|
|
@@ -505,52 +410,47 @@ exports.getRebateTx = getRebateTx;
|
|
|
505
410
|
*/
|
|
506
411
|
function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
|
|
507
412
|
strategy_pool, vault_index, signal_index, coins, amount, size, price_percentage, max_times, target_rounds) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
tx.pure(target_rounds),
|
|
526
|
-
input_coin,
|
|
527
|
-
],
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
else {
|
|
531
|
-
coin = coins.pop();
|
|
532
|
-
if (coins.length > 0) {
|
|
533
|
-
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
534
|
-
}
|
|
535
|
-
_b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
536
|
-
tx.moveCall({
|
|
537
|
-
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
538
|
-
typeArguments: typeArguments,
|
|
539
|
-
arguments: [
|
|
540
|
-
tx.object(strategy_pool),
|
|
541
|
-
tx.pure(vault_index),
|
|
542
|
-
tx.pure(signal_index),
|
|
543
|
-
tx.pure(size),
|
|
544
|
-
tx.pure(price_percentage),
|
|
545
|
-
tx.pure(max_times),
|
|
546
|
-
tx.pure(target_rounds),
|
|
547
|
-
input_coin,
|
|
548
|
-
],
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
tx.setGasBudget(gasBudget);
|
|
552
|
-
return [2 /*return*/, tx];
|
|
413
|
+
var tx = new transactions_1.TransactionBlock();
|
|
414
|
+
if (typeArguments[0] == "0x2::sui::SUI" ||
|
|
415
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
416
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
|
|
417
|
+
tx.moveCall({
|
|
418
|
+
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
419
|
+
typeArguments: typeArguments,
|
|
420
|
+
arguments: [
|
|
421
|
+
tx.object(strategy_pool),
|
|
422
|
+
tx.pure(vault_index),
|
|
423
|
+
tx.pure(signal_index),
|
|
424
|
+
tx.pure(size),
|
|
425
|
+
tx.pure(price_percentage),
|
|
426
|
+
tx.pure(max_times),
|
|
427
|
+
tx.pure(target_rounds),
|
|
428
|
+
input_coin,
|
|
429
|
+
],
|
|
553
430
|
});
|
|
554
|
-
}
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
var coin = coins.pop();
|
|
434
|
+
if (coins.length > 0) {
|
|
435
|
+
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
436
|
+
}
|
|
437
|
+
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
438
|
+
tx.moveCall({
|
|
439
|
+
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
440
|
+
typeArguments: typeArguments,
|
|
441
|
+
arguments: [
|
|
442
|
+
tx.object(strategy_pool),
|
|
443
|
+
tx.pure(vault_index),
|
|
444
|
+
tx.pure(signal_index),
|
|
445
|
+
tx.pure(size),
|
|
446
|
+
tx.pure(price_percentage),
|
|
447
|
+
tx.pure(max_times),
|
|
448
|
+
tx.pure(target_rounds),
|
|
449
|
+
input_coin,
|
|
450
|
+
],
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
tx.setGasBudget(gasBudget);
|
|
454
|
+
return tx;
|
|
555
455
|
}
|
|
556
456
|
exports.getNewStrategyTx = getNewStrategyTx;
|