@typus/typus-sdk 1.4.62 → 1.4.64

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.
@@ -69,7 +69,7 @@ function getRemoveAirdropTx(config, tx, input) {
69
69
  balance = tx.moveCall({
70
70
  target: "".concat(config.package.typus, "::airdrop::remove_airdrop"),
71
71
  typeArguments: input.typeArguments,
72
- arguments: [tx.object(config.version.typus), tx.object(config.registry.typus.airdrop), tx.object(input.key)],
72
+ arguments: [tx.object(config.version.typus), tx.object(config.registry.typus.airdrop), tx.pure(input.key)],
73
73
  });
74
74
  coin = tx.moveCall({
75
75
  target: "0x2::coin::from_balance",
@@ -105,7 +105,7 @@ function getSetAirdropTx(config, tx, input) {
105
105
  arguments: [
106
106
  tx.object(config.version.typus),
107
107
  tx.object(config.registry.typus.airdrop),
108
- tx.object(input.key),
108
+ tx.pure(input.key),
109
109
  tx.makeMoveVec({ objects: [coin] }),
110
110
  tx.pure(input.users),
111
111
  tx.pure(input.values),
@@ -119,7 +119,7 @@ function getSetAirdropTx(config, tx, input) {
119
119
  arguments: [
120
120
  tx.object(config.version.typus),
121
121
  tx.object(config.registry.typus.airdrop),
122
- tx.object(input.key),
122
+ tx.pure(input.key),
123
123
  tx.makeMoveVec({ objects: input.coins.map(function (id) { return tx.object(id); }) }),
124
124
  tx.pure(input.users),
125
125
  tx.pure(input.values),
@@ -1,5 +1,6 @@
1
1
  import { TypusConfig } from "../../../src/utils";
2
2
  export declare function getAirdrop(config: TypusConfig, input: {
3
+ typeArguments: string[];
3
4
  key: string;
4
5
  user: string;
5
6
  }): Promise<string[]>;
@@ -51,7 +51,7 @@ function getAirdrop(config, input) {
51
51
  transactionBlock = new transactions_1.TransactionBlock();
52
52
  transactionBlock.moveCall({
53
53
  target: "".concat(config.package.typus, "::airdrop::get_airdrop"),
54
- typeArguments: [],
54
+ typeArguments: input.typeArguments,
55
55
  arguments: [
56
56
  transactionBlock.pure(config.version.typus),
57
57
  transactionBlock.pure(config.registry.typus.airdrop),
@@ -15,7 +15,7 @@ export interface TxHistory {
15
15
  Date: Date;
16
16
  txDigest: string;
17
17
  }
18
- export declare function parseTxHistory(datas: Array<any>, originPackageId: string, vaults: {
18
+ export declare function parseTxHistory(datas: Array<any>, vaults: {
19
19
  [key: string]: Vault;
20
20
  }): Promise<Array<TxHistory>>;
21
21
  export declare function parseVaultInfo(vaults: {
@@ -145,7 +145,7 @@ function getAutoBidEvents(provider, originPackage, startTimeMs) {
145
145
  });
146
146
  });
147
147
  }
148
- function parseTxHistory(datas, originPackageId, vaults) {
148
+ function parseTxHistory(datas, vaults) {
149
149
  return __awaiter(this, void 0, void 0, function () {
150
150
  var results;
151
151
  var _this = this;
@@ -154,8 +154,9 @@ function parseTxHistory(datas, originPackageId, vaults) {
154
154
  case 0: return [4 /*yield*/, datas
155
155
  .filter(function (event) {
156
156
  var type = event.type;
157
- return (event.packageId == originPackageId ||
158
- type.includes(originPackageId) ||
157
+ return (event.module == "tds_user_entry" ||
158
+ type.includes("typus_dov_single") ||
159
+ type.includes("auto_bid") ||
159
160
  type.includes("typus_nft::First") ||
160
161
  type.includes("typus_nft::ExpUpEvent") ||
161
162
  type.includes("tails_staking"));
@@ -403,33 +403,3 @@ function parseBidEvents(datas, end_ts_ms) {
403
403
  });
404
404
  });
405
405
  }
406
- // SELECT
407
- // Settle.index as Index,
408
- // Settle.round as Round,
409
- // NewAuction.start_ts_ms as ActivationDate,
410
- // COALESCE(NULLIF(UpdateStrike.strikes, ''), NewAuction.strikes) AS Strikes, -- 如果 UpdateStrike.strikes 是空字符串,就使用 NewAuction.strikes
411
- // Settle.oracle_price as SettlePrice,
412
- // -- Settle.share_price as share_price,
413
- // Delivery.max_size as TotalAuctioned,
414
- // SafuOtc.delivery_size as OtcSize,
415
- // Delivery.delivery_size as DeliverySize,
416
- // ((SafuOtc.delivery_size + Delivery.delivery_size) / TotalAuctioned) as Filled,
417
- // Delivery.delivery_price as DeliveryPrice,
418
- // SafuOtc.delivery_price as OtcPrice,
419
- // Delivery.bidder_bid_value as BidderPremium,
420
- // Delivery.incentive_bid_value as IncentivePremium,
421
- // SafuOtc.bidder_bid_value as OtcPremium,
422
- // (Delivery.bidder_bid_value + Delivery.incentive_bid_value + SafuOtc.bidder_bid_value) AS Premium, -- 三個加在一起的 Premium
423
- // Delivery.depositor_incentive_value as BpIncentive, -- SUI or SCA
424
- // Delivery.fixed_incentive_amount as FiexedIncentive, -- SUI
425
- // (Settle.settle_balance - Settle.settled_balance) as OptionProfit,
426
- // Settle.d_token as d_token,
427
- // Delivery.b_token as b_token,
428
- // Delivery.o_token as o_token
429
- // FROM Settle
430
- // JOIN NewAuction ON Settle.index = NewAuction.index AND Settle.round = NewAuction.round
431
- // LEFT JOIN UpdateStrike ON Settle.index = UpdateStrike.index AND Settle.round = UpdateStrike.round
432
- // JOIN Delivery ON Settle.index = Delivery.index AND Settle.round = Delivery.round
433
- // LEFT JOIN SafuOtc ON Settle.index = SafuOtc.index AND Settle.round = SafuOtc.round
434
- // WHERE Settle.timestamp >= 1725170000
435
- // ORDER BY Index ASC;
@@ -1,5 +1,5 @@
1
1
  import { TransactionBlock } from "@mysten/sui.js/transactions";
2
- import { TypusConfig } from "../../src/utils";
2
+ import { TypusConfig } from "../../../src/utils";
3
3
  /**
4
4
  entry fun bid(
5
5
  version: &Version,
@@ -18,7 +18,7 @@ var __read = (this && this.__read) || function (o, n) {
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.bidTx = bidTx;
20
20
  exports.claimTx = claimTx;
21
- var constants_1 = require("../../src/constants");
21
+ var constants_1 = require("../../../src/constants");
22
22
  /**
23
23
  entry fun bid(
24
24
  version: &Version,
@@ -32,9 +32,9 @@ var constants_1 = require("../../src/constants");
32
32
  function bidTx(config, tx, input) {
33
33
  var _a = __read(tx.splitCoins(tx.gas, [tx.pure(input.amount)]), 1), input_coin = _a[0];
34
34
  tx.moveCall({
35
- target: "".concat(config.package.launch, "::auction::bid"),
35
+ target: "".concat(config.package.launchAuction, "::auction::bid"),
36
36
  arguments: [
37
- tx.object(config.version.launch),
37
+ tx.object(config.version.launchAuction),
38
38
  tx.object(config.object.launchAuction),
39
39
  tx.pure(input.size),
40
40
  input_coin,
@@ -53,8 +53,8 @@ function bidTx(config, tx, input) {
53
53
  */
54
54
  function claimTx(config, tx) {
55
55
  tx.moveCall({
56
- target: "".concat(config.package.launch, "::auction::claim"),
57
- arguments: [tx.object(config.version.launch), tx.object(config.object.launchAuction), tx.object(constants_1.CLOCK)],
56
+ target: "".concat(config.package.launchAuction, "::auction::claim"),
57
+ arguments: [tx.object(config.version.launchAuction), tx.object(config.object.launchAuction), tx.object(constants_1.CLOCK)],
58
58
  });
59
59
  return tx;
60
60
  }
@@ -1,4 +1,4 @@
1
- import { TypusConfig } from "../../src/utils";
1
+ import { TypusConfig } from "../../../src/utils";
2
2
  interface Record {
3
3
  bidder: string;
4
4
  price: string;
@@ -42,8 +42,8 @@ exports.getLaunchAuction = getLaunchAuction;
42
42
  var transactions_1 = require("@mysten/sui.js/transactions");
43
43
  var client_1 = require("@mysten/sui.js/client");
44
44
  var bcs_1 = require("@mysten/bcs");
45
- var constants_1 = require("../../src/constants");
46
- var utils_1 = require("../../src/utils");
45
+ var constants_1 = require("../../../src/constants");
46
+ var utils_1 = require("../../../src/utils");
47
47
  function getLaunchAuctionBids(config) {
48
48
  return __awaiter(this, void 0, void 0, function () {
49
49
  var provider, transactionBlock, target, transactionBlockArguments, results, bytes, reader, result;
@@ -52,7 +52,7 @@ function getLaunchAuctionBids(config) {
52
52
  case 0:
53
53
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
54
54
  transactionBlock = new transactions_1.TransactionBlock();
55
- target = "".concat(config.package.launch, "::auction::get_records_bcs");
55
+ target = "".concat(config.package.launchAuction, "::auction::get_records_bcs");
56
56
  transactionBlockArguments = [transactionBlock.pure(config.object.launchAuction)];
57
57
  transactionBlock.moveCall({
58
58
  target: target,
@@ -88,7 +88,7 @@ function getBidderInfo(config, bidder) {
88
88
  case 0:
89
89
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
90
90
  transactionBlock = new transactions_1.TransactionBlock();
91
- target = "".concat(config.package.launch, "::auction::get_bidder_info");
91
+ target = "".concat(config.package.launchAuction, "::auction::get_bidder_info");
92
92
  transactionBlockArguments = [transactionBlock.pure(config.object.launchAuction), transactionBlock.pure(bidder)];
93
93
  transactionBlock.moveCall({
94
94
  target: target,
@@ -0,0 +1,53 @@
1
+ import { TransactionBlock } from "@mysten/sui.js/transactions";
2
+ import { TypusConfig } from "../../../src/utils";
3
+ /**
4
+ entry fun add_user_share(
5
+ version: &Version,
6
+ snapshot: &mut Snapshot,
7
+ users: vector<address>,
8
+ shares: vector<u64>,
9
+ ctx: &TxContext,
10
+ ) {
11
+ */
12
+ export declare function addUserShare(config: TypusConfig, tx: TransactionBlock, input: {
13
+ users: string[];
14
+ shares: string[];
15
+ }): void;
16
+ /**
17
+ entry fun remove_user_share(
18
+ version: &Version,
19
+ snapshot: &mut Snapshot,
20
+ ctx: &TxContext,
21
+ ) {
22
+ */
23
+ export declare function removeUserShare(config: TypusConfig, tx: TransactionBlock, input: {
24
+ users: string[];
25
+ shares: string[];
26
+ }): void;
27
+ /**
28
+ entry fun add_airdrop_plan(
29
+ version: &Version,
30
+ snapshot: &mut Snapshot,
31
+ vault_index: u64,
32
+ mut auction_max_size: u64,
33
+ round: u64,
34
+ slice_size: u64,
35
+ ctx: &TxContext,
36
+ ) {
37
+ */
38
+ export declare function addAirdropPlan(config: TypusConfig, tx: TransactionBlock, input: {
39
+ vault_index: string;
40
+ auction_max_size: string;
41
+ round: string;
42
+ slice_size: string;
43
+ }): void;
44
+ /**
45
+ entry fun airdrop_otc(
46
+ version: &Version,
47
+ snapshot: &mut Snapshot,
48
+ registry: &mut Registry,
49
+ clock: &Clock,
50
+ ctx: &mut TxContext,
51
+ ) {
52
+ */
53
+ export declare function airdropOtc(config: TypusConfig, tx: TransactionBlock): void;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addUserShare = addUserShare;
4
+ exports.removeUserShare = removeUserShare;
5
+ exports.addAirdropPlan = addAirdropPlan;
6
+ exports.airdropOtc = airdropOtc;
7
+ var constants_1 = require("../../../src/constants");
8
+ /**
9
+ entry fun add_user_share(
10
+ version: &Version,
11
+ snapshot: &mut Snapshot,
12
+ users: vector<address>,
13
+ shares: vector<u64>,
14
+ ctx: &TxContext,
15
+ ) {
16
+ */
17
+ function addUserShare(config, tx, input) {
18
+ tx.moveCall({
19
+ target: "".concat(config.package.launchOptionAirdrop, "::option_airdop::add_user_share"),
20
+ arguments: [
21
+ tx.object(config.version.launchOptionAirdrop),
22
+ tx.object(config.object.launchSnapshot),
23
+ tx.pure(input.users),
24
+ tx.pure(input.shares),
25
+ ],
26
+ });
27
+ }
28
+ /**
29
+ entry fun remove_user_share(
30
+ version: &Version,
31
+ snapshot: &mut Snapshot,
32
+ ctx: &TxContext,
33
+ ) {
34
+ */
35
+ function removeUserShare(config, tx, input) {
36
+ tx.moveCall({
37
+ target: "".concat(config.package.launchOptionAirdrop, "::option_airdop::remove_user_share"),
38
+ arguments: [tx.object(config.version.launchOptionAirdrop), tx.object(config.object.launchSnapshot)],
39
+ });
40
+ }
41
+ /**
42
+ entry fun add_airdrop_plan(
43
+ version: &Version,
44
+ snapshot: &mut Snapshot,
45
+ vault_index: u64,
46
+ mut auction_max_size: u64,
47
+ round: u64,
48
+ slice_size: u64,
49
+ ctx: &TxContext,
50
+ ) {
51
+ */
52
+ function addAirdropPlan(config, tx, input) {
53
+ tx.moveCall({
54
+ target: "".concat(config.package.launchOptionAirdrop, "::option_airdop::add_airdrop_plan"),
55
+ arguments: [
56
+ tx.object(config.version.launchOptionAirdrop),
57
+ tx.object(config.object.launchSnapshot),
58
+ tx.pure(input.vault_index),
59
+ tx.pure(input.auction_max_size),
60
+ tx.pure(input.round),
61
+ tx.pure(input.slice_size),
62
+ ],
63
+ });
64
+ }
65
+ /**
66
+ entry fun airdrop_otc(
67
+ version: &Version,
68
+ snapshot: &mut Snapshot,
69
+ registry: &mut Registry,
70
+ clock: &Clock,
71
+ ctx: &mut TxContext,
72
+ ) {
73
+ */
74
+ function airdropOtc(config, tx) {
75
+ tx.moveCall({
76
+ target: "".concat(config.package.launchOptionAirdrop, "::option_airdop::airdrop_otc"),
77
+ arguments: [
78
+ tx.object(config.version.launchOptionAirdrop),
79
+ tx.object(config.object.launchSnapshot),
80
+ tx.object(config.registry.dov.dovSingle),
81
+ tx.object(constants_1.CLOCK),
82
+ ],
83
+ });
84
+ }
@@ -10,7 +10,7 @@ export interface TxHistory {
10
10
  txDigest: string;
11
11
  log: string[];
12
12
  }
13
- export declare function parseTxHistory(datas: Array<any>, originPackage: string): Promise<Array<TxHistory>>;
13
+ export declare function parseTxHistory(datas: Array<any>): Promise<Array<TxHistory>>;
14
14
  export declare function getDepositorCashFlows(userHistory: TxHistory[]): Map<string, DepositorCashFlow>;
15
15
  export interface DepositorCashFlow {
16
16
  D_TOKEN: string | undefined;
@@ -100,8 +100,7 @@ function getUserEvents(provider, sender, cursor) {
100
100
  });
101
101
  });
102
102
  }
103
- function parseTxHistory(datas, originPackage // safu package
104
- ) {
103
+ function parseTxHistory(datas) {
105
104
  return __awaiter(this, void 0, void 0, function () {
106
105
  var results;
107
106
  var _this = this;
@@ -109,7 +108,7 @@ function parseTxHistory(datas, originPackage // safu package
109
108
  switch (_a.label) {
110
109
  case 0: return [4 /*yield*/, datas
111
110
  .filter(function (event) {
112
- return event.packageId == originPackage || event.type.includes(originPackage);
111
+ return event.type.includes("safu");
113
112
  })
114
113
  .sort(function (a, b) {
115
114
  // From Old to New!
@@ -19,13 +19,15 @@ export interface Package {
19
19
  perp: string;
20
20
  safu: string;
21
21
  typus: string;
22
- launch: string;
22
+ launchAuction: string;
23
+ launchOptionAirdrop: string;
23
24
  }
24
25
  export interface Version {
25
26
  perp: string;
26
27
  safu: string;
27
28
  typus: string;
28
- launch: string;
29
+ launchAuction: string;
30
+ launchOptionAirdrop: string;
29
31
  }
30
32
  export interface Registry {
31
33
  dice: {
@@ -68,6 +70,7 @@ export interface Object {
68
70
  tgldTokenPolicy: string;
69
71
  tlpTreasuryCap: string;
70
72
  launchAuction: string;
73
+ launchSnapshot: string;
71
74
  }
72
75
  export interface Oracle {
73
76
  afsui: string;
@@ -122,4 +125,5 @@ export interface Token {
122
125
  mliq: string;
123
126
  hippo: string;
124
127
  deep: string;
128
+ typus: string;
125
129
  }
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.4.62",
5
+ "version": "1.4.64",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
8
  "@mysten/kiosk": "0.8.10",