@typus/typus-sdk 1.4.20 → 1.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/auto-bid/token-user-entry.d.ts +46 -8
- package/dist/src/auto-bid/token-user-entry.js +117 -74
- package/dist/src/auto-bid/user-entry.d.ts +42 -8
- package/dist/src/auto-bid/user-entry.js +92 -93
- package/dist/src/auto-bid/view-function.d.ts +8 -5
- package/dist/src/auto-bid/view-function.js +26 -15
- package/dist/src/constants/constant.d.ts +1 -0
- package/dist/src/constants/constant.js +2 -1
- package/dist/src/dice/api.d.ts +13 -1
- package/dist/src/dice/api.js +25 -14
- package/dist/src/dice/fetch.d.ts +8 -12
- package/dist/src/dice/fetch.js +77 -30
- package/dist/src/dice/user-entry.d.ts +29 -17
- package/dist/src/dice/user-entry.js +114 -79
- package/dist/src/dice/view-function.d.ts +14 -1
- package/dist/src/dice/view-function.js +34 -25
- package/dist/src/typus/airdrop/view-function.d.ts +1 -2
- package/dist/src/typus/airdrop/view-function.js +6 -3
- package/dist/src/typus/leaderboard/view-function.d.ts +1 -2
- package/dist/src/typus/leaderboard/view-function.js +6 -3
- package/dist/src/typus/tails-staking/authority-entry.js +2 -2
- package/dist/src/typus/tails-staking/view-function.d.ts +2 -3
- package/dist/src/typus/tails-staking/view-function.js +10 -6
- package/dist/src/typus/user/view-function.d.ts +1 -2
- package/dist/src/typus/user/view-function.js +6 -4
- package/dist/src/typus-dov-single-v2/authority-entry.d.ts +0 -25
- package/dist/src/typus-dov-single-v2/authority-entry.js +26 -0
- package/dist/src/typus-dov-single-v2/function/bidding.d.ts +5 -3
- package/dist/src/typus-dov-single-v2/function/bidding.js +17 -14
- package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +3 -2
- package/dist/src/typus-dov-single-v2/history/vault-history.js +6 -4
- package/dist/src/typus-dov-single-v2/token-user-entry.js +10 -10
- package/dist/src/typus-dov-single-v2/view-function.d.ts +7 -7
- package/dist/src/typus-dov-single-v2/view-function.js +26 -19
- package/dist/src/typus-nft/user-entry.d.ts +25 -6
- package/dist/src/typus-nft/user-entry.js +24 -36
- package/dist/src/typus-perp/fetch.d.ts +7 -8
- package/dist/src/typus-perp/fetch.js +35 -24
- package/dist/src/typus-perp/user/order.d.ts +4 -11
- package/dist/src/typus-perp/user/order.js +23 -23
- package/dist/src/typus-perp/user/orderWithBidReceipt.d.ts +9 -9
- package/dist/src/typus-perp/user/orderWithBidReceipt.js +50 -49
- package/dist/src/typus-perp/user/tlp.d.ts +5 -13
- package/dist/src/typus-perp/user/tlp.js +30 -30
- package/dist/src/typus-safu/user-entry.d.ts +4 -8
- package/dist/src/typus-safu/user-entry.js +56 -56
- package/dist/src/typus-safu/view-function.d.ts +0 -3
- package/dist/src/typus-safu/view-function.js +10 -7
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ var functions_2 = require("../stake-pool/functions");
|
|
|
74
74
|
var utils_1 = require("../../utils");
|
|
75
75
|
var constants_2 = require("../../constants");
|
|
76
76
|
var __1 = require("..");
|
|
77
|
-
function mintStakeLp(config, input) {
|
|
77
|
+
function mintStakeLp(config, tx, pythClient, input) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
79
|
var tokens, cToken, tokens_1, tokens_1_1, token, coin, destination, lpCoin;
|
|
80
80
|
var e_1, _a, _b, _c;
|
|
@@ -82,14 +82,14 @@ function mintStakeLp(config, input) {
|
|
|
82
82
|
switch (_d.label) {
|
|
83
83
|
case 0:
|
|
84
84
|
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_2.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
85
|
-
return [4 /*yield*/, (0, utils_1.updatePyth)(
|
|
85
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens)];
|
|
86
86
|
case 1:
|
|
87
87
|
_d.sent();
|
|
88
88
|
cToken = constants_2.tokenType[__1.NETWORK][input.cTOKEN];
|
|
89
89
|
try {
|
|
90
90
|
for (tokens_1 = __values(tokens), tokens_1_1 = tokens_1.next(); !tokens_1_1.done; tokens_1_1 = tokens_1.next()) {
|
|
91
91
|
token = tokens_1_1.value;
|
|
92
|
-
(0, functions_1.updateLiquidityValue)(
|
|
92
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
93
93
|
version: config.version.perp,
|
|
94
94
|
registry: config.registry.perp.lpPool,
|
|
95
95
|
index: BigInt(0),
|
|
@@ -107,16 +107,16 @@ function mintStakeLp(config, input) {
|
|
|
107
107
|
finally { if (e_1) throw e_1.error; }
|
|
108
108
|
}
|
|
109
109
|
if (input.cTOKEN == "SUI") {
|
|
110
|
-
_b = __read(
|
|
110
|
+
_b = __read(tx.splitCoins(tx.gas, [input.amount]), 1), coin = _b[0];
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
113
|
destination = input.coins.pop();
|
|
114
114
|
if (input.coins.length > 0) {
|
|
115
|
-
|
|
115
|
+
tx.mergeCoins(destination, input.coins);
|
|
116
116
|
}
|
|
117
|
-
_c = __read(
|
|
117
|
+
_c = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _c[0];
|
|
118
118
|
}
|
|
119
|
-
lpCoin = (0, functions_1.mintLp)(
|
|
119
|
+
lpCoin = (0, functions_1.mintLp)(tx, [cToken, config.token.tlp], {
|
|
120
120
|
version: config.version.perp,
|
|
121
121
|
registry: config.registry.perp.lpPool,
|
|
122
122
|
treasuryCaps: config.object.tlpTreasuryCap,
|
|
@@ -126,7 +126,7 @@ function mintStakeLp(config, input) {
|
|
|
126
126
|
coin: coin,
|
|
127
127
|
clock: constants_1.CLOCK,
|
|
128
128
|
});
|
|
129
|
-
(0, functions_2.stake)(
|
|
129
|
+
(0, functions_2.stake)(tx, config.token.tlp, {
|
|
130
130
|
version: config.version.perp,
|
|
131
131
|
registry: config.registry.perp.stakePool,
|
|
132
132
|
index: BigInt(0),
|
|
@@ -134,12 +134,12 @@ function mintStakeLp(config, input) {
|
|
|
134
134
|
clock: constants_1.CLOCK,
|
|
135
135
|
userShareId: input.userShareId ? BigInt(input.userShareId) : null,
|
|
136
136
|
});
|
|
137
|
-
return [2 /*return*/,
|
|
137
|
+
return [2 /*return*/, tx];
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
function unstakeBurn(config, input) {
|
|
142
|
+
function unstakeBurn(config, tx, pythClient, input) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
144
|
var tokens, cToken, oracle, tokens_2, tokens_2_1, token, lpCoin, coin;
|
|
145
145
|
var e_2, _a;
|
|
@@ -147,7 +147,7 @@ function unstakeBurn(config, input) {
|
|
|
147
147
|
switch (_b.label) {
|
|
148
148
|
case 0:
|
|
149
149
|
tokens = input.lpPool.tokenPools.map(function (p) { return (0, constants_2.typeArgToAsset)("0x" + p.tokenType.name); });
|
|
150
|
-
return [4 /*yield*/, (0, utils_1.updatePyth)(
|
|
150
|
+
return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, tokens)];
|
|
151
151
|
case 1:
|
|
152
152
|
_b.sent();
|
|
153
153
|
cToken = constants_2.tokenType[__1.NETWORK][input.cTOKEN];
|
|
@@ -155,7 +155,7 @@ function unstakeBurn(config, input) {
|
|
|
155
155
|
try {
|
|
156
156
|
for (tokens_2 = __values(tokens), tokens_2_1 = tokens_2.next(); !tokens_2_1.done; tokens_2_1 = tokens_2.next()) {
|
|
157
157
|
token = tokens_2_1.value;
|
|
158
|
-
(0, functions_1.updateLiquidityValue)(
|
|
158
|
+
(0, functions_1.updateLiquidityValue)(tx, constants_2.tokenType[__1.NETWORK][token], {
|
|
159
159
|
version: config.version.perp,
|
|
160
160
|
registry: config.registry.perp.lpPool,
|
|
161
161
|
index: BigInt(0),
|
|
@@ -172,7 +172,7 @@ function unstakeBurn(config, input) {
|
|
|
172
172
|
}
|
|
173
173
|
finally { if (e_2) throw e_2.error; }
|
|
174
174
|
}
|
|
175
|
-
lpCoin = (0, functions_2.unstake)(
|
|
175
|
+
lpCoin = (0, functions_2.unstake)(tx, config.token.tlp, {
|
|
176
176
|
version: config.version.perp,
|
|
177
177
|
registry: config.registry.perp.stakePool,
|
|
178
178
|
index: BigInt(0),
|
|
@@ -180,7 +180,7 @@ function unstakeBurn(config, input) {
|
|
|
180
180
|
clock: constants_1.CLOCK,
|
|
181
181
|
unstakedShares: input.share ? BigInt(input.share) : null,
|
|
182
182
|
});
|
|
183
|
-
coin = (0, functions_1.burnLp)(
|
|
183
|
+
coin = (0, functions_1.burnLp)(tx, [cToken, config.token.tlp], {
|
|
184
184
|
version: config.version.perp,
|
|
185
185
|
registry: config.registry.perp.lpPool,
|
|
186
186
|
treasuryCaps: config.object.tlpTreasuryCap,
|
|
@@ -190,34 +190,34 @@ function unstakeBurn(config, input) {
|
|
|
190
190
|
coin: lpCoin,
|
|
191
191
|
clock: constants_1.CLOCK,
|
|
192
192
|
});
|
|
193
|
-
|
|
194
|
-
return [2 /*return*/,
|
|
193
|
+
tx.transferObjects([coin], input.user);
|
|
194
|
+
return [2 /*return*/, tx];
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function swap(config, input) {
|
|
199
|
+
function swap(config, tx, pythClient, input) {
|
|
200
200
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
201
|
var fromToken, toToken, coin, destination, token;
|
|
202
202
|
var _a, _b;
|
|
203
203
|
return __generator(this, function (_c) {
|
|
204
204
|
switch (_c.label) {
|
|
205
|
-
case 0: return [4 /*yield*/, (0, utils_1.updatePyth)(
|
|
205
|
+
case 0: return [4 /*yield*/, (0, utils_1.updatePyth)(pythClient, tx, [input.FROM_TOKEN, input.TO_TOKEN])];
|
|
206
206
|
case 1:
|
|
207
207
|
_c.sent();
|
|
208
208
|
fromToken = constants_2.tokenType[__1.NETWORK][input.FROM_TOKEN];
|
|
209
209
|
toToken = constants_2.tokenType[__1.NETWORK][input.TO_TOKEN];
|
|
210
210
|
if (input.FROM_TOKEN == "SUI") {
|
|
211
|
-
_a = __read(
|
|
211
|
+
_a = __read(tx.splitCoins(tx.gas, [input.amount]), 1), coin = _a[0];
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
214
|
destination = input.coins.pop();
|
|
215
215
|
if (input.coins.length > 0) {
|
|
216
|
-
|
|
216
|
+
tx.mergeCoins(destination, input.coins);
|
|
217
217
|
}
|
|
218
|
-
_b = __read(
|
|
218
|
+
_b = __read(tx.splitCoins(destination, [input.amount]), 1), coin = _b[0];
|
|
219
219
|
}
|
|
220
|
-
token = (0, functions_1.swap)(
|
|
220
|
+
token = (0, functions_1.swap)(tx, [fromToken, toToken], {
|
|
221
221
|
version: config.version.perp,
|
|
222
222
|
registry: config.registry.perp.lpPool,
|
|
223
223
|
pythState: utils_1.pythStateId[__1.NETWORK],
|
|
@@ -228,16 +228,16 @@ function swap(config, input) {
|
|
|
228
228
|
fromCoin: coin,
|
|
229
229
|
minToAmount: BigInt(0),
|
|
230
230
|
});
|
|
231
|
-
|
|
232
|
-
return [2 /*return*/,
|
|
231
|
+
tx.transferObjects([token], input.user);
|
|
232
|
+
return [2 /*return*/, tx];
|
|
233
233
|
}
|
|
234
234
|
});
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
function unsubscribe(config, input) {
|
|
237
|
+
function unsubscribe(config, tx, input) {
|
|
238
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
239
239
|
return __generator(this, function (_a) {
|
|
240
|
-
(0, functions_2.unsubscribe)(
|
|
240
|
+
(0, functions_2.unsubscribe)(tx, config.token.tlp, {
|
|
241
241
|
version: config.version.perp,
|
|
242
242
|
registry: config.registry.perp.stakePool,
|
|
243
243
|
index: BigInt(0),
|
|
@@ -245,21 +245,21 @@ function unsubscribe(config, input) {
|
|
|
245
245
|
clock: constants_1.CLOCK,
|
|
246
246
|
unsubscribedShares: input.share ? BigInt(input.share) : null,
|
|
247
247
|
});
|
|
248
|
-
return [2 /*return*/,
|
|
248
|
+
return [2 /*return*/, tx];
|
|
249
249
|
});
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
function harvest(config, input) {
|
|
252
|
+
function harvest(config, tx, input) {
|
|
253
253
|
return __awaiter(this, void 0, void 0, function () {
|
|
254
254
|
return __generator(this, function (_a) {
|
|
255
|
-
(0, functions_2.harvestPerUserShare)(
|
|
255
|
+
(0, functions_2.harvestPerUserShare)(tx, "0x2::sui::SUI", {
|
|
256
256
|
version: config.version.perp,
|
|
257
257
|
registry: config.registry.perp.stakePool,
|
|
258
258
|
index: BigInt(0),
|
|
259
259
|
userShareId: BigInt(input.userShareId),
|
|
260
260
|
clock: constants_1.CLOCK,
|
|
261
261
|
});
|
|
262
|
-
return [2 /*return*/,
|
|
262
|
+
return [2 /*return*/, tx];
|
|
263
263
|
});
|
|
264
264
|
});
|
|
265
265
|
}
|
|
@@ -16,8 +16,7 @@ import { TypusConfig } from "src/utils";
|
|
|
16
16
|
ctx: &mut TxContext,
|
|
17
17
|
) {
|
|
18
18
|
*/
|
|
19
|
-
export declare function getRaiseFundTx(config: TypusConfig, input: {
|
|
20
|
-
tx: TransactionBlock;
|
|
19
|
+
export declare function getRaiseFundTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
21
20
|
typeArguments: string[];
|
|
22
21
|
index: string;
|
|
23
22
|
raiseCoins: string[];
|
|
@@ -42,8 +41,7 @@ export declare function getRaiseFundTx(config: TypusConfig, input: {
|
|
|
42
41
|
ctx: &mut TxContext,
|
|
43
42
|
): Balance<D_TOKEN> {
|
|
44
43
|
*/
|
|
45
|
-
export declare function getReduceFundTx(config: TypusConfig, input: {
|
|
46
|
-
tx: TransactionBlock;
|
|
44
|
+
export declare function getReduceFundTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
47
45
|
typeArguments: string[];
|
|
48
46
|
index: string;
|
|
49
47
|
reduceFromWarmup: string;
|
|
@@ -59,8 +57,7 @@ export declare function getReduceFundTx(config: TypusConfig, input: {
|
|
|
59
57
|
ctx: &TxContext,
|
|
60
58
|
): Balance<R_TOKEN> {
|
|
61
59
|
*/
|
|
62
|
-
export declare function getClaimRewardTx(config: TypusConfig, input: {
|
|
63
|
-
tx: TransactionBlock;
|
|
60
|
+
export declare function getClaimRewardTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
64
61
|
typeArguments: string[];
|
|
65
62
|
index: string;
|
|
66
63
|
user: string;
|
|
@@ -77,8 +74,7 @@ export declare function getClaimRewardTx(config: TypusConfig, input: {
|
|
|
77
74
|
ctx: &mut TxContext,
|
|
78
75
|
) {
|
|
79
76
|
*/
|
|
80
|
-
export declare function getSnapshotTx(config: TypusConfig, input: {
|
|
81
|
-
tx: TransactionBlock;
|
|
77
|
+
export declare function getSnapshotTx(config: TypusConfig, tx: TransactionBlock, input: {
|
|
82
78
|
typeArguments: string[];
|
|
83
79
|
index: string;
|
|
84
80
|
}): TransactionBlock;
|
|
@@ -21,52 +21,52 @@ var constants_1 = require("../constants");
|
|
|
21
21
|
ctx: &mut TxContext,
|
|
22
22
|
) {
|
|
23
23
|
*/
|
|
24
|
-
function getRaiseFundTx(config, input) {
|
|
24
|
+
function getRaiseFundTx(config, tx, input) {
|
|
25
25
|
var raiseBalance = input.typeArguments[0] == "0x2::sui::SUI" ||
|
|
26
26
|
input.typeArguments[0] == "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
|
|
27
|
-
?
|
|
27
|
+
? tx.moveCall({
|
|
28
28
|
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
29
29
|
typeArguments: [input.typeArguments[0]],
|
|
30
30
|
arguments: [
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
tx.pure(input.user),
|
|
32
|
+
tx.makeMoveVec({
|
|
33
33
|
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
34
|
-
objects: [
|
|
34
|
+
objects: [tx.splitCoins(tx.gas, [tx.pure(input.raiseAmount)])],
|
|
35
35
|
}),
|
|
36
|
-
|
|
36
|
+
tx.pure(input.raiseAmount),
|
|
37
37
|
],
|
|
38
38
|
})
|
|
39
|
-
:
|
|
39
|
+
: tx.moveCall({
|
|
40
40
|
target: "".concat(config.package.framework, "::utils::delegate_extract_balance"),
|
|
41
41
|
typeArguments: [input.typeArguments[0]],
|
|
42
42
|
arguments: [
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
tx.pure(input.user),
|
|
44
|
+
tx.makeMoveVec({
|
|
45
45
|
type: "0x2::coin::Coin<".concat(input.typeArguments[0], ">"),
|
|
46
|
-
objects: input.raiseCoins.map(function (coin) { return
|
|
46
|
+
objects: input.raiseCoins.map(function (coin) { return tx.object(coin); }),
|
|
47
47
|
}),
|
|
48
|
-
|
|
48
|
+
tx.pure(input.raiseAmount),
|
|
49
49
|
],
|
|
50
50
|
});
|
|
51
|
-
var result =
|
|
51
|
+
var result = tx.moveCall({
|
|
52
52
|
target: "".concat(config.package.safu, "::safu::raise_fund"),
|
|
53
53
|
typeArguments: input.typeArguments,
|
|
54
54
|
arguments: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
tx.object(config.version.typus),
|
|
56
|
+
tx.object(config.registry.typus.leaderboard),
|
|
57
|
+
tx.object(config.registry.typus.user),
|
|
58
|
+
tx.object(config.version.safu),
|
|
59
|
+
tx.object(config.registry.safu.safu),
|
|
60
|
+
tx.pure(input.index),
|
|
61
|
+
tx.object(raiseBalance),
|
|
62
|
+
tx.pure(input.raiseFromDeactivating),
|
|
63
|
+
tx.pure(input.raiseFromInactive),
|
|
64
|
+
tx.pure(input.raiseFromReward),
|
|
65
|
+
tx.object(constants_1.CLOCK),
|
|
66
66
|
],
|
|
67
67
|
});
|
|
68
|
-
//
|
|
69
|
-
return
|
|
68
|
+
// tx.transferObjects([tx.object(result[0])], input.user);
|
|
69
|
+
return tx;
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
public fun reduce_fund<D_TOKEN>(
|
|
@@ -83,29 +83,29 @@ function getRaiseFundTx(config, input) {
|
|
|
83
83
|
ctx: &mut TxContext,
|
|
84
84
|
): Balance<D_TOKEN> {
|
|
85
85
|
*/
|
|
86
|
-
function getReduceFundTx(config, input) {
|
|
87
|
-
var result =
|
|
86
|
+
function getReduceFundTx(config, tx, input) {
|
|
87
|
+
var result = tx.moveCall({
|
|
88
88
|
target: "".concat(config.package.safu, "::safu::reduce_fund"),
|
|
89
89
|
typeArguments: input.typeArguments,
|
|
90
90
|
arguments: [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
tx.object(config.version.typus),
|
|
92
|
+
tx.object(config.registry.typus.leaderboard),
|
|
93
|
+
tx.object(config.registry.typus.user),
|
|
94
|
+
tx.object(config.version.safu),
|
|
95
|
+
tx.object(config.registry.safu.safu),
|
|
96
|
+
tx.pure(input.index),
|
|
97
|
+
tx.pure(input.reduceFromWarmup),
|
|
98
|
+
tx.pure(input.reduceFromActive),
|
|
99
|
+
tx.pure(input.reduceFromInactive),
|
|
100
|
+
tx.object(constants_1.CLOCK),
|
|
101
101
|
],
|
|
102
102
|
});
|
|
103
|
-
|
|
103
|
+
tx.moveCall({
|
|
104
104
|
target: "".concat(config.package.framework, "::utils::transfer_balance"),
|
|
105
105
|
typeArguments: [input.typeArguments[0]],
|
|
106
|
-
arguments: [
|
|
106
|
+
arguments: [tx.object(result[0]), tx.pure(input.user)],
|
|
107
107
|
});
|
|
108
|
-
return
|
|
108
|
+
return tx;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
111
111
|
public fun claim_reward<R_TOKEN>(
|
|
@@ -115,18 +115,18 @@ function getReduceFundTx(config, input) {
|
|
|
115
115
|
ctx: &TxContext,
|
|
116
116
|
): Balance<R_TOKEN> {
|
|
117
117
|
*/
|
|
118
|
-
function getClaimRewardTx(config, input) {
|
|
119
|
-
var result =
|
|
118
|
+
function getClaimRewardTx(config, tx, input) {
|
|
119
|
+
var result = tx.moveCall({
|
|
120
120
|
target: "".concat(config.package.safu, "::safu::claim_reward"),
|
|
121
121
|
typeArguments: input.typeArguments,
|
|
122
|
-
arguments: [
|
|
122
|
+
arguments: [tx.object(config.version.safu), tx.object(config.registry.safu.safu), tx.pure(input.index)],
|
|
123
123
|
});
|
|
124
|
-
|
|
124
|
+
tx.moveCall({
|
|
125
125
|
target: "".concat(config.package.framework, "::utils::transfer_balance"),
|
|
126
126
|
typeArguments: [input.typeArguments[0]],
|
|
127
|
-
arguments: [
|
|
127
|
+
arguments: [tx.object(result[0]), tx.pure(input.user)],
|
|
128
128
|
});
|
|
129
|
-
return
|
|
129
|
+
return tx;
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
public fun snapshot(
|
|
@@ -140,19 +140,19 @@ function getClaimRewardTx(config, input) {
|
|
|
140
140
|
ctx: &mut TxContext,
|
|
141
141
|
) {
|
|
142
142
|
*/
|
|
143
|
-
function getSnapshotTx(config, input) {
|
|
144
|
-
var result =
|
|
143
|
+
function getSnapshotTx(config, tx, input) {
|
|
144
|
+
var result = tx.moveCall({
|
|
145
145
|
target: "".concat(config.package.safu, "::safu::snapshot"),
|
|
146
146
|
typeArguments: input.typeArguments,
|
|
147
147
|
arguments: [
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
148
|
+
tx.object(config.version.typus),
|
|
149
|
+
tx.object(config.registry.typus.leaderboard),
|
|
150
|
+
tx.object(config.registry.typus.user),
|
|
151
|
+
tx.object(config.version.safu),
|
|
152
|
+
tx.object(config.registry.safu.safu),
|
|
153
|
+
tx.pure(input.index),
|
|
154
|
+
tx.object(constants_1.CLOCK),
|
|
155
155
|
],
|
|
156
156
|
});
|
|
157
|
-
return
|
|
157
|
+
return tx;
|
|
158
158
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SuiClient } from "@mysten/sui.js/client";
|
|
2
1
|
import { TypusConfig } from "../utils";
|
|
3
2
|
export interface Vault {
|
|
4
3
|
id: string;
|
|
@@ -41,7 +40,6 @@ export interface ShareSupply {
|
|
|
41
40
|
reward_share: string[];
|
|
42
41
|
}
|
|
43
42
|
export declare function getVaultData(config: TypusConfig, input: {
|
|
44
|
-
provider: SuiClient;
|
|
45
43
|
indexes: string[];
|
|
46
44
|
}): Promise<{
|
|
47
45
|
[key: string]: Vault;
|
|
@@ -53,7 +51,6 @@ export interface Share {
|
|
|
53
51
|
bcsPadding: string[];
|
|
54
52
|
}
|
|
55
53
|
export declare function getShareData(config: TypusConfig, input: {
|
|
56
|
-
provider: SuiClient;
|
|
57
54
|
user: string;
|
|
58
55
|
indexes: string[];
|
|
59
56
|
}): Promise<{
|
|
@@ -39,22 +39,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getVaultData = getVaultData;
|
|
40
40
|
exports.getShareData = getShareData;
|
|
41
41
|
var transactions_1 = require("@mysten/sui.js/transactions");
|
|
42
|
+
var client_1 = require("@mysten/sui.js/client");
|
|
42
43
|
var bcs_1 = require("@mysten/bcs");
|
|
43
44
|
var utils_1 = require("../utils");
|
|
44
|
-
var
|
|
45
|
+
var constants_1 = require("src/constants");
|
|
45
46
|
function getVaultData(config, input) {
|
|
46
47
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var transactionBlock, results, bytes, reader, result;
|
|
48
|
+
var provider, transactionBlock, results, bytes, reader, result;
|
|
48
49
|
return __generator(this, function (_a) {
|
|
49
50
|
switch (_a.label) {
|
|
50
51
|
case 0:
|
|
52
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
51
53
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
52
54
|
transactionBlock.moveCall({
|
|
53
55
|
target: "".concat(config.package.safu, "::view_function::get_vault_data_bcs"),
|
|
54
56
|
typeArguments: [],
|
|
55
57
|
arguments: [transactionBlock.pure(config.registry.safu.safu), transactionBlock.pure(input.indexes)],
|
|
56
58
|
});
|
|
57
|
-
return [4 /*yield*/,
|
|
59
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
58
60
|
case 1:
|
|
59
61
|
results = (_a.sent()).results;
|
|
60
62
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -110,7 +112,7 @@ function getVaultData(config, input) {
|
|
|
110
112
|
inactive_share: shareSupplyArray[2],
|
|
111
113
|
warmup_share: shareSupplyArray[3],
|
|
112
114
|
snapshot_share: shareSupplyArray[4],
|
|
113
|
-
reward_share: shareSupplyArray.slice(5)
|
|
115
|
+
reward_share: shareSupplyArray.slice(5),
|
|
114
116
|
};
|
|
115
117
|
var u64Padding = reader.readVec(function (reader) {
|
|
116
118
|
return reader.read64();
|
|
@@ -136,10 +138,11 @@ function getVaultData(config, input) {
|
|
|
136
138
|
}
|
|
137
139
|
function getShareData(config, input) {
|
|
138
140
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
-
var transactionBlock, results, bytes, reader, result;
|
|
141
|
+
var provider, transactionBlock, results, bytes, reader, result;
|
|
140
142
|
return __generator(this, function (_a) {
|
|
141
143
|
switch (_a.label) {
|
|
142
144
|
case 0:
|
|
145
|
+
provider = new client_1.SuiClient({ url: config.rpcEndpoint });
|
|
143
146
|
transactionBlock = new transactions_1.TransactionBlock();
|
|
144
147
|
transactionBlock.moveCall({
|
|
145
148
|
target: "".concat(config.package.safu, "::view_function::get_share_data_bcs"),
|
|
@@ -150,7 +153,7 @@ function getShareData(config, input) {
|
|
|
150
153
|
transactionBlock.pure(input.indexes),
|
|
151
154
|
],
|
|
152
155
|
});
|
|
153
|
-
return [4 /*yield*/,
|
|
156
|
+
return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transactionBlock })];
|
|
154
157
|
case 1:
|
|
155
158
|
results = (_a.sent()).results;
|
|
156
159
|
bytes = results[results.length - 1].returnValues[0][0];
|
|
@@ -169,7 +172,7 @@ function getShareData(config, input) {
|
|
|
169
172
|
inactive_share: shareSupplyArray[2],
|
|
170
173
|
warmup_share: shareSupplyArray[3],
|
|
171
174
|
snapshot_share: shareSupplyArray[4],
|
|
172
|
-
reward_share: shareSupplyArray.slice(5)
|
|
175
|
+
reward_share: shareSupplyArray.slice(5),
|
|
173
176
|
};
|
|
174
177
|
return {
|
|
175
178
|
user: user,
|