@typus/typus-sdk 1.5.6 → 1.5.8

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.
@@ -494,6 +494,9 @@ function parseTxHistory(datas, vaults) {
494
494
  Amount = "".concat((0, bignumber_js_1.default)(profit).toFixed(), " ").concat(d_token);
495
495
  break;
496
496
  case "RedeemEvent":
497
+ if (event.type == "0xc654c3634a10567b329de1226c2629cae39cdc16ec5d594897d87b250d46e958::typus_dov_single::RedeemEvent") {
498
+ break;
499
+ }
497
500
  token = (0, constants_1.typeArgToAsset)("0x" + event.parsedJson.token.name);
498
501
  amount = Number(event.parsedJson.amount) / Math.pow(10, (0, constants_1.assetToDecimal)(token));
499
502
  Action = "Harvest Reward";
@@ -0,0 +1,17 @@
1
+ import { Transaction } from "@mysten/sui/transactions";
2
+ import { TypusConfig } from "../../src/utils";
3
+ /**
4
+ entry fun update_vault_config(
5
+ version: &Version,
6
+ registry: &mut Registry,
7
+ index: u64,
8
+ config_index: u64,
9
+ value: u64,
10
+ ctx: &TxContext,
11
+ ) {
12
+ */
13
+ export declare function updateVaultConfig(config: TypusConfig, tx: Transaction, input: {
14
+ index: string;
15
+ configIndex: string;
16
+ value: string;
17
+ }): void;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateVaultConfig = updateVaultConfig;
4
+ /**
5
+ entry fun update_vault_config(
6
+ version: &Version,
7
+ registry: &mut Registry,
8
+ index: u64,
9
+ config_index: u64,
10
+ value: u64,
11
+ ctx: &TxContext,
12
+ ) {
13
+ */
14
+ function updateVaultConfig(config, tx, input) {
15
+ tx.moveCall({
16
+ target: "".concat(config.package.safu, "::safu::update_vault_config"),
17
+ typeArguments: [],
18
+ arguments: [
19
+ tx.object(config.version.safu),
20
+ tx.object(config.registry.safu.safu),
21
+ tx.pure.u64(input.index),
22
+ tx.pure.u64(input.configIndex),
23
+ tx.pure.u64(input.value),
24
+ ],
25
+ });
26
+ }
@@ -1,3 +1,4 @@
1
1
  export * from "./view-function";
2
2
  export * from "./user-entry";
3
3
  export * from "./user-history";
4
+ export * from "./authority-entry";
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./view-function"), exports);
18
18
  __exportStar(require("./user-entry"), exports);
19
19
  __exportStar(require("./user-history"), exports);
20
+ __exportStar(require("./authority-entry"), exports);
@@ -27,16 +27,17 @@ export declare function getRaiseFundTx(config: TypusConfig, tx: Transaction, inp
27
27
  user: string;
28
28
  }): Transaction;
29
29
  /**
30
- public fun reduce_fund<D_TOKEN>(
30
+ public fun reduce_fund_v2<D_TOKEN>(
31
31
  typus_version: &TypusVersion,
32
32
  typus_leaderboard_registry: &mut TypusLeaderboardRegistry,
33
33
  typus_user_registry: &mut TypusUserRegistry,
34
- version: &Version,
34
+ version: &mut Version,
35
35
  registry: &mut Registry,
36
36
  index: u64,
37
37
  reduce_from_warmup: u64,
38
38
  reduce_from_active: u64,
39
39
  reduce_from_inactive: u64,
40
+ coin: Coin<SUI>,
40
41
  clock: &Clock,
41
42
  ctx: &mut TxContext,
42
43
  ): Balance<D_TOKEN> {
@@ -47,6 +48,7 @@ export declare function getReduceFundTx(config: TypusConfig, tx: Transaction, in
47
48
  reduceFromWarmup: string;
48
49
  reduceFromActive: string;
49
50
  reduceFromInactive: string;
51
+ feeAmount: string;
50
52
  user: string;
51
53
  }): Transaction;
52
54
  /**
@@ -5,6 +5,7 @@ exports.getReduceFundTx = getReduceFundTx;
5
5
  exports.getClaimRewardTx = getClaimRewardTx;
6
6
  exports.getSnapshotTx = getSnapshotTx;
7
7
  var constants_1 = require("../../src/constants");
8
+ var utils_1 = require("../../src/utils");
8
9
  /**
9
10
  public fun raise_fund<D_TOKEN>(
10
11
  typus_version: &TypusVersion,
@@ -69,23 +70,24 @@ function getRaiseFundTx(config, tx, input) {
69
70
  return tx;
70
71
  }
71
72
  /**
72
- public fun reduce_fund<D_TOKEN>(
73
+ public fun reduce_fund_v2<D_TOKEN>(
73
74
  typus_version: &TypusVersion,
74
75
  typus_leaderboard_registry: &mut TypusLeaderboardRegistry,
75
76
  typus_user_registry: &mut TypusUserRegistry,
76
- version: &Version,
77
+ version: &mut Version,
77
78
  registry: &mut Registry,
78
79
  index: u64,
79
80
  reduce_from_warmup: u64,
80
81
  reduce_from_active: u64,
81
82
  reduce_from_inactive: u64,
83
+ coin: Coin<SUI>,
82
84
  clock: &Clock,
83
85
  ctx: &mut TxContext,
84
86
  ): Balance<D_TOKEN> {
85
87
  */
86
88
  function getReduceFundTx(config, tx, input) {
87
89
  var result = tx.moveCall({
88
- target: "".concat(config.package.safu, "::safu::reduce_fund"),
90
+ target: "".concat(config.package.safu, "::safu::reduce_fund_v2"),
89
91
  typeArguments: input.typeArguments,
90
92
  arguments: [
91
93
  tx.object(config.version.typus),
@@ -97,6 +99,7 @@ function getReduceFundTx(config, tx, input) {
97
99
  tx.pure.u64(input.reduceFromWarmup),
98
100
  tx.pure.u64(input.reduceFromActive),
99
101
  tx.pure.u64(input.reduceFromInactive),
102
+ tx.object((0, utils_1.splitCoins)(tx, constants_1.tokenType.SUI, [], input.feeAmount)),
100
103
  tx.object(constants_1.CLOCK),
101
104
  ],
102
105
  });
@@ -6,6 +6,7 @@ export interface Vault {
6
6
  rewardToken: string[];
7
7
  info: Info;
8
8
  config: Config;
9
+ share: BigVector;
9
10
  shareSupply: ShareSupply;
10
11
  u64Padding: string[];
11
12
  bcsPadding: string[];
@@ -30,9 +31,13 @@ export interface Config {
30
31
  min_size: string;
31
32
  fee_bp: string;
32
33
  utilization_rate_bp: string;
33
- point_per_hour_bp: string;
34
+ exp_per_hour_bp: string;
34
35
  incentive_mbp: string;
35
36
  incentive_fixed: string;
37
+ point_per_hour_bp: string;
38
+ exercise_fee_bp: string;
39
+ exit_fee_bp: string;
40
+ exit_fee_amount: string;
36
41
  }
37
42
  export interface ShareSupply {
38
43
  active_share: string;
@@ -42,6 +47,14 @@ export interface ShareSupply {
42
47
  snapshot_share: string;
43
48
  reward_share: string[];
44
49
  }
50
+ export interface BigVector {
51
+ id: string;
52
+ element_type: string;
53
+ slice_idx: string;
54
+ slice_size: number;
55
+ length: string;
56
+ }
57
+ export declare function getBigVectorData(config: TypusConfig, bigVector: BigVector): Promise<any[]>;
45
58
  export declare function getVaultData(config: TypusConfig, input: {
46
59
  indexes: string[];
47
60
  }): Promise<{
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getBigVectorData = getBigVectorData;
39
40
  exports.getVaultData = getVaultData;
40
41
  exports.getShareData = getShareData;
41
42
  var transactions_1 = require("@mysten/sui/transactions");
@@ -43,6 +44,39 @@ var client_1 = require("@mysten/sui/client");
43
44
  var bcs_1 = require("@mysten/bcs");
44
45
  var utils_1 = require("../../src/utils");
45
46
  var constants_1 = require("../../src/constants");
47
+ function getBigVectorData(config, bigVector) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var provider, results, i, df, result;
50
+ var _a;
51
+ return __generator(this, function (_b) {
52
+ switch (_b.label) {
53
+ case 0:
54
+ provider = new client_1.SuiClient({ url: config.rpcEndpoint });
55
+ results = [];
56
+ i = 0;
57
+ _b.label = 1;
58
+ case 1:
59
+ if (!(i <= Number(bigVector.slice_idx))) return [3 /*break*/, 4];
60
+ return [4 /*yield*/, provider.getDynamicFieldObject({
61
+ parentId: bigVector.id,
62
+ name: {
63
+ type: "u64",
64
+ value: "".concat(i),
65
+ },
66
+ })];
67
+ case 2:
68
+ df = _b.sent();
69
+ result = (_a = df.data) === null || _a === void 0 ? void 0 : _a.content.fields.value.fields.vector.map(function (x) { return x.fields; });
70
+ results = results.concat(result);
71
+ _b.label = 3;
72
+ case 3:
73
+ i++;
74
+ return [3 /*break*/, 1];
75
+ case 4: return [2 /*return*/, results];
76
+ }
77
+ });
78
+ });
79
+ }
46
80
  function getVaultData(config, input) {
47
81
  return __awaiter(this, void 0, void 0, function () {
48
82
  var provider, transaction, results, bytes, reader, result;
@@ -95,16 +129,22 @@ function getVaultData(config, input) {
95
129
  min_size: configArray[2],
96
130
  fee_bp: configArray[3],
97
131
  utilization_rate_bp: configArray[4],
98
- point_per_hour_bp: configArray[5],
132
+ exp_per_hour_bp: configArray[5],
99
133
  incentive_mbp: configArray[6],
100
134
  incentive_fixed: configArray[7],
135
+ point_per_hour_bp: configArray[8],
136
+ exercise_fee_bp: configArray[9],
137
+ exit_fee_bp: configArray[10],
138
+ exit_fee_amount: configArray[11],
101
139
  };
102
140
  // skip BigVector
103
- reader.readBytes(32); // id
104
- reader.readBytes(reader.read8()); // element_type
105
- reader.read64(); // slice_idx
106
- reader.read32(); // slice_size
107
- reader.read64(); // length
141
+ var bigVector = {
142
+ id: (0, utils_1.AddressFromBytes)(reader.readBytes(32)),
143
+ element_type: String.fromCharCode.apply(null, Array.from(reader.readBytes(reader.readULEB()))), // element_type
144
+ slice_idx: reader.read64(), // slice_idx
145
+ slice_size: reader.read32(), // slice_size
146
+ length: reader.read64(), // length
147
+ };
108
148
  var shareSupplyArray = reader.readVec(function (reader) {
109
149
  return reader.read64();
110
150
  });
@@ -131,6 +171,7 @@ function getVaultData(config, input) {
131
171
  rewardToken: rewardToken,
132
172
  info: info,
133
173
  config: config,
174
+ share: bigVector,
134
175
  shareSupply: shareSupply,
135
176
  u64Padding: u64Padding,
136
177
  bcsPadding: bcsPadding,
@@ -154,6 +195,7 @@ function getVaultData(config, input) {
154
195
  rewardToken: rewardToken,
155
196
  info: info,
156
197
  config: config,
198
+ share: bigVector,
157
199
  shareSupply: shareSupply,
158
200
  u64Padding: u64Padding,
159
201
  bcsPadding: bcsPadding,
@@ -69,7 +69,7 @@ var countFloating = function (value) {
69
69
  };
70
70
  exports.countFloating = countFloating;
71
71
  function splitCoins(tx, token, coins, amount) {
72
- var _a = __read((0, utils_1.normalizeSuiAddress)(token) == constants_1.tokenType.SUI
72
+ var _a = __read((0, utils_1.normalizeStructTag)(token) == constants_1.tokenType.SUI
73
73
  ? tx.splitCoins(tx.gas, [tx.pure.u64(amount)])
74
74
  : (function () {
75
75
  var coin = coins.pop();
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "1.5.6",
5
+ "version": "1.5.8",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.9.34",