@typus/typus-sdk 1.1.54 → 1.1.56
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, typusFrameworkPackageId: 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, typusFrameworkPackageId: 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,272 @@ 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
|
-
|
|
146
|
-
|
|
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)],
|
|
116
|
+
});
|
|
117
|
+
tx.moveCall({
|
|
118
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
119
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
148
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, typusFrameworkPackageId, 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.moveCall({
|
|
150
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
151
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
152
|
+
});
|
|
153
|
+
return tx;
|
|
183
154
|
}
|
|
184
155
|
exports.getUnsubscribeTx = getUnsubscribeTx;
|
|
185
156
|
/**
|
|
186
|
-
public
|
|
157
|
+
public fun compound<D_TOKEN, B_TOKEN>(
|
|
187
158
|
registry: &mut Registry,
|
|
188
159
|
index: u64,
|
|
189
160
|
receipts: vector<TypusDepositReceipt>,
|
|
161
|
+
clock: &Clock,
|
|
190
162
|
ctx: &mut TxContext,
|
|
191
163
|
)
|
|
192
164
|
*/
|
|
193
|
-
function
|
|
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
|
-
});
|
|
165
|
+
function getCompoundTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
166
|
+
var result = tx.moveCall({
|
|
167
|
+
target: "".concat(packageId, "::tails_staking::compound"),
|
|
168
|
+
typeArguments: typeArguments,
|
|
169
|
+
arguments: [
|
|
170
|
+
tx.object(registry),
|
|
171
|
+
tx.pure(index),
|
|
172
|
+
tx.makeMoveVec({
|
|
173
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
174
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
175
|
+
}),
|
|
176
|
+
tx.object(constants_1.CLOCK),
|
|
177
|
+
],
|
|
178
|
+
});
|
|
179
|
+
tx.moveCall({
|
|
180
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
181
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
215
182
|
});
|
|
183
|
+
return tx;
|
|
216
184
|
}
|
|
217
|
-
exports.
|
|
185
|
+
exports.getCompoundTx = getCompoundTx;
|
|
218
186
|
/**
|
|
219
|
-
public
|
|
187
|
+
public fun claim<D_TOKEN, B_TOKEN>(
|
|
220
188
|
registry: &mut Registry,
|
|
221
189
|
index: u64,
|
|
222
190
|
receipts: vector<TypusDepositReceipt>,
|
|
223
191
|
ctx: &mut TxContext,
|
|
224
192
|
)
|
|
225
193
|
*/
|
|
226
|
-
function
|
|
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
|
-
});
|
|
194
|
+
function getClaimTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
195
|
+
var result = tx.moveCall({
|
|
196
|
+
target: "".concat(packageId, "::tds_user_entry::claim"),
|
|
197
|
+
typeArguments: typeArguments,
|
|
198
|
+
arguments: [
|
|
199
|
+
tx.object(registry),
|
|
200
|
+
tx.pure(index),
|
|
201
|
+
tx.makeMoveVec({
|
|
202
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
203
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
204
|
+
}),
|
|
205
|
+
],
|
|
248
206
|
});
|
|
207
|
+
tx.moveCall({
|
|
208
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
209
|
+
typeArguments: [typeArguments[0]],
|
|
210
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
211
|
+
});
|
|
212
|
+
tx.moveCall({
|
|
213
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
214
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
215
|
+
});
|
|
216
|
+
return tx;
|
|
249
217
|
}
|
|
250
|
-
exports.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
})
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
-
});
|
|
218
|
+
exports.getClaimTx = getClaimTx;
|
|
219
|
+
/**
|
|
220
|
+
public fun harvest<D_TOKEN, B_TOKEN>(
|
|
221
|
+
registry: &mut Registry,
|
|
222
|
+
index: u64,
|
|
223
|
+
receipts: vector<TypusDepositReceipt>,
|
|
224
|
+
ctx: &mut TxContext,
|
|
225
|
+
)
|
|
226
|
+
*/
|
|
227
|
+
function getHarvestTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
228
|
+
var result = tx.moveCall({
|
|
229
|
+
target: "".concat(packageId, "::tds_user_entry::harvest"),
|
|
230
|
+
typeArguments: typeArguments,
|
|
231
|
+
arguments: [
|
|
232
|
+
tx.object(registry),
|
|
233
|
+
tx.pure(index),
|
|
234
|
+
tx.makeMoveVec({
|
|
235
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
236
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
237
|
+
}),
|
|
238
|
+
],
|
|
239
|
+
});
|
|
240
|
+
tx.moveCall({
|
|
241
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
242
|
+
typeArguments: [typeArguments[1]],
|
|
243
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
318
244
|
});
|
|
245
|
+
tx.moveCall({
|
|
246
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
247
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
248
|
+
});
|
|
249
|
+
return tx;
|
|
319
250
|
}
|
|
320
|
-
exports.
|
|
251
|
+
exports.getHarvestTx = getHarvestTx;
|
|
321
252
|
/**
|
|
322
|
-
public
|
|
253
|
+
public fun redeem<D_TOKEN, B_TOKEN, I_TOKEN>(
|
|
323
254
|
registry: &mut Registry,
|
|
324
255
|
index: u64,
|
|
325
256
|
receipts: vector<TypusDepositReceipt>,
|
|
326
257
|
ctx: &mut TxContext,
|
|
327
258
|
)
|
|
328
259
|
*/
|
|
329
|
-
function
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return [2 /*return*/, tx];
|
|
351
|
-
});
|
|
260
|
+
function getRedeemTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
261
|
+
var result = tx.moveCall({
|
|
262
|
+
target: "".concat(packageId, "::tds_user_entry::redeem"),
|
|
263
|
+
typeArguments: typeArguments,
|
|
264
|
+
arguments: [
|
|
265
|
+
tx.object(registry),
|
|
266
|
+
tx.pure(index),
|
|
267
|
+
tx.makeMoveVec({
|
|
268
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusDepositReceipt"),
|
|
269
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
270
|
+
}),
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
tx.moveCall({
|
|
274
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
275
|
+
typeArguments: [typeArguments[2]],
|
|
276
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
277
|
+
});
|
|
278
|
+
tx.moveCall({
|
|
279
|
+
target: "".concat(typusFrameworkPackageId, "::vault::transfer_deposit_receipt"),
|
|
280
|
+
arguments: [tx.object(result[1]), tx.pure(user)],
|
|
352
281
|
});
|
|
282
|
+
return tx;
|
|
353
283
|
}
|
|
354
|
-
exports.
|
|
284
|
+
exports.getRedeemTx = getRedeemTx;
|
|
355
285
|
/**
|
|
356
286
|
public(friend) entry fun new_bid<D_TOKEN, B_TOKEN>(
|
|
357
287
|
registry: &mut Registry,
|
|
@@ -362,110 +292,96 @@ exports.getCompoundTx = getCompoundTx;
|
|
|
362
292
|
ctx: &mut TxContext,
|
|
363
293
|
)
|
|
364
294
|
*/
|
|
365
|
-
function getNewBidTx(
|
|
366
|
-
usingSponsoredGasCoin) {
|
|
295
|
+
function getNewBidTx(tx, packageId, typeArguments, registry, index, coins, size, premium_required, // fe float * b_token_decimal
|
|
296
|
+
user, usingSponsoredGasCoin) {
|
|
367
297
|
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];
|
|
298
|
+
if (!usingSponsoredGasCoin &&
|
|
299
|
+
(typeArguments[1] == "0x2::sui::SUI" ||
|
|
300
|
+
typeArguments[1] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI")) {
|
|
301
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(premium_required)]), 1), coin = _a[0];
|
|
302
|
+
var result = tx.moveCall({
|
|
303
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
304
|
+
typeArguments: typeArguments,
|
|
305
|
+
arguments: [tx.object(registry), tx.pure(index), tx.makeMoveVec({ objects: [coin] }), tx.pure(size), tx.pure("0x6")],
|
|
397
306
|
});
|
|
398
|
-
|
|
307
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
var result = tx.moveCall({
|
|
311
|
+
target: "".concat(packageId, "::tails_staking::new_bid"),
|
|
312
|
+
typeArguments: typeArguments,
|
|
313
|
+
arguments: [
|
|
314
|
+
tx.object(registry),
|
|
315
|
+
tx.pure(index),
|
|
316
|
+
tx.makeMoveVec({ objects: coins.map(function (id) { return tx.object(id); }) }),
|
|
317
|
+
tx.pure(size),
|
|
318
|
+
tx.pure("0x6"),
|
|
319
|
+
],
|
|
320
|
+
});
|
|
321
|
+
tx.transferObjects([tx.object(result[0])], user);
|
|
322
|
+
}
|
|
323
|
+
return tx;
|
|
399
324
|
}
|
|
400
325
|
exports.getNewBidTx = getNewBidTx;
|
|
401
326
|
/**
|
|
402
|
-
public(friend) entry fun
|
|
327
|
+
public(friend) entry fun exercise<D_TOKEN, B_TOKEN>(
|
|
403
328
|
registry: &mut Registry,
|
|
404
329
|
index: u64,
|
|
405
330
|
receipts: vector<TypusBidReceipt>,
|
|
406
|
-
share: Option<u64>,
|
|
407
|
-
recipient: address,
|
|
408
331
|
ctx: &mut TxContext,
|
|
409
|
-
)
|
|
332
|
+
)
|
|
410
333
|
*/
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
tx.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
type: "".concat(input.typusFrameworkPackageId, "::vault::TypusBidReceipt"),
|
|
424
|
-
objects: input.receipts.map(function (id) { return tx.object(id); }),
|
|
425
|
-
}),
|
|
426
|
-
tx.pure(input.share ? [input.share] : []),
|
|
427
|
-
tx.pure(input.recipient),
|
|
428
|
-
],
|
|
429
|
-
});
|
|
430
|
-
tx.setGasBudget(input.gasBudget);
|
|
431
|
-
return [2 /*return*/, tx];
|
|
432
|
-
});
|
|
334
|
+
function getExerciseTx(tx, typusFrameworkOriginPackageId, typusFrameworkPackageId, packageId, typeArguments, registry, index, receipts, user) {
|
|
335
|
+
var result = tx.moveCall({
|
|
336
|
+
target: "".concat(packageId, "::tds_user_entry::exercise"),
|
|
337
|
+
typeArguments: typeArguments,
|
|
338
|
+
arguments: [
|
|
339
|
+
tx.object(registry),
|
|
340
|
+
tx.pure(index),
|
|
341
|
+
tx.makeMoveVec({
|
|
342
|
+
type: "".concat(typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
343
|
+
objects: receipts.map(function (id) { return tx.object(id); }),
|
|
344
|
+
}),
|
|
345
|
+
],
|
|
433
346
|
});
|
|
347
|
+
tx.moveCall({
|
|
348
|
+
target: "".concat(typusFrameworkPackageId, "::utils::transfer_balance"),
|
|
349
|
+
typeArguments: [typeArguments[0]],
|
|
350
|
+
arguments: [tx.object(result[0]), tx.pure(user)],
|
|
351
|
+
});
|
|
352
|
+
return tx;
|
|
434
353
|
}
|
|
435
|
-
exports.
|
|
354
|
+
exports.getExerciseTx = getExerciseTx;
|
|
436
355
|
/**
|
|
437
|
-
public(friend) entry fun
|
|
356
|
+
public(friend) entry fun transfer_bid_receipt<D_TOKEN, B_TOKEN>(
|
|
438
357
|
registry: &mut Registry,
|
|
439
358
|
index: u64,
|
|
440
359
|
receipts: vector<TypusBidReceipt>,
|
|
360
|
+
share: Option<u64>,
|
|
361
|
+
recipient: address,
|
|
441
362
|
ctx: &mut TxContext,
|
|
442
|
-
)
|
|
363
|
+
) {
|
|
443
364
|
*/
|
|
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
|
-
});
|
|
365
|
+
function getTransferBidReceiptTx(input) {
|
|
366
|
+
var tx = new transactions_1.TransactionBlock();
|
|
367
|
+
tx.moveCall({
|
|
368
|
+
target: "".concat(input.packageId, "::tds_user_entry::transfer_bid_receipt"),
|
|
369
|
+
typeArguments: input.typeArguments,
|
|
370
|
+
arguments: [
|
|
371
|
+
tx.object(input.registry),
|
|
372
|
+
tx.pure(input.index),
|
|
373
|
+
tx.makeMoveVec({
|
|
374
|
+
type: "".concat(input.typusFrameworkOriginPackageId, "::vault::TypusBidReceipt"),
|
|
375
|
+
objects: input.receipts.map(function (id) { return tx.object(id); }),
|
|
376
|
+
}),
|
|
377
|
+
tx.pure(input.share ? [input.share] : []),
|
|
378
|
+
tx.pure(input.recipient),
|
|
379
|
+
],
|
|
466
380
|
});
|
|
381
|
+
tx.setGasBudget(input.gasBudget);
|
|
382
|
+
return tx;
|
|
467
383
|
}
|
|
468
|
-
exports.
|
|
384
|
+
exports.getTransferBidReceiptTx = getTransferBidReceiptTx;
|
|
469
385
|
/**
|
|
470
386
|
public(friend) entry fun refund<TOKEN>(
|
|
471
387
|
registry: &mut Registry,
|
|
@@ -473,21 +389,16 @@ exports.getExerciseTx = getExerciseTx;
|
|
|
473
389
|
)
|
|
474
390
|
*/
|
|
475
391
|
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];
|
|
392
|
+
var tx = new transactions_1.TransactionBlock();
|
|
393
|
+
typeArguments.forEach(function (typeArgument) {
|
|
394
|
+
tx.moveCall({
|
|
395
|
+
target: "".concat(packageId, "::tds_user_entry::rebate"),
|
|
396
|
+
typeArguments: [typeArgument],
|
|
397
|
+
arguments: [tx.object(registry)],
|
|
489
398
|
});
|
|
490
399
|
});
|
|
400
|
+
tx.setGasBudget(gasBudget);
|
|
401
|
+
return tx;
|
|
491
402
|
}
|
|
492
403
|
exports.getRebateTx = getRebateTx;
|
|
493
404
|
/**
|
|
@@ -505,52 +416,47 @@ exports.getRebateTx = getRebateTx;
|
|
|
505
416
|
*/
|
|
506
417
|
function getNewStrategyTx(gasBudget, packageId, typeArguments, // B_TOKEN
|
|
507
418
|
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];
|
|
419
|
+
var tx = new transactions_1.TransactionBlock();
|
|
420
|
+
if (typeArguments[0] == "0x2::sui::SUI" ||
|
|
421
|
+
typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI") {
|
|
422
|
+
var _a = __read(tx.splitCoins(tx.gas, [tx.pure(amount)]), 1), input_coin = _a[0];
|
|
423
|
+
tx.moveCall({
|
|
424
|
+
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
425
|
+
typeArguments: typeArguments,
|
|
426
|
+
arguments: [
|
|
427
|
+
tx.object(strategy_pool),
|
|
428
|
+
tx.pure(vault_index),
|
|
429
|
+
tx.pure(signal_index),
|
|
430
|
+
tx.pure(size),
|
|
431
|
+
tx.pure(price_percentage),
|
|
432
|
+
tx.pure(max_times),
|
|
433
|
+
tx.pure(target_rounds),
|
|
434
|
+
input_coin,
|
|
435
|
+
],
|
|
553
436
|
});
|
|
554
|
-
}
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
var coin = coins.pop();
|
|
440
|
+
if (coins.length > 0) {
|
|
441
|
+
tx.mergeCoins(tx.object(coin), coins.map(function (id) { return tx.object(id); }));
|
|
442
|
+
}
|
|
443
|
+
var _b = __read(tx.splitCoins(tx.object(coin), [tx.pure(amount)]), 1), input_coin = _b[0];
|
|
444
|
+
tx.moveCall({
|
|
445
|
+
target: "".concat(packageId, "::auto_bid::new_strategy"),
|
|
446
|
+
typeArguments: typeArguments,
|
|
447
|
+
arguments: [
|
|
448
|
+
tx.object(strategy_pool),
|
|
449
|
+
tx.pure(vault_index),
|
|
450
|
+
tx.pure(signal_index),
|
|
451
|
+
tx.pure(size),
|
|
452
|
+
tx.pure(price_percentage),
|
|
453
|
+
tx.pure(max_times),
|
|
454
|
+
tx.pure(target_rounds),
|
|
455
|
+
input_coin,
|
|
456
|
+
],
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
tx.setGasBudget(gasBudget);
|
|
460
|
+
return tx;
|
|
555
461
|
}
|
|
556
462
|
exports.getNewStrategyTx = getNewStrategyTx;
|
package/package.json
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"name": "@typus/typus-sdk",
|
|
3
3
|
"author": "Typus",
|
|
4
4
|
"description": "typus sdk",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.56",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@mysten/bcs": "^0.7.3",
|
|
8
|
-
"@mysten/kiosk": "0.7.
|
|
9
|
-
"@mysten/sui.js": "
|
|
8
|
+
"@mysten/kiosk": "0.7.12",
|
|
9
|
+
"@mysten/sui.js": "0.48.0",
|
|
10
10
|
"@types/node": "^20.5.7",
|
|
11
11
|
"aftermath-ts-sdk": "^1.1.14",
|
|
12
12
|
"bignumber.js": "^9.1.1",
|