@typus/typus-sdk 1.8.43 → 1.9.1

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.
Files changed (52) hide show
  1. package/dist/src/auto-bid/view-function.d.ts +0 -2
  2. package/dist/src/auto-bid/view-function.js +7 -76
  3. package/dist/src/dice/fetch.d.ts +2 -2
  4. package/dist/src/dice/fetch.js +34 -91
  5. package/dist/src/typus/airdrop/view-function.js +7 -8
  6. package/dist/src/typus/leaderboard/view-function.js +7 -8
  7. package/dist/src/typus/tails-staking/view-function.js +14 -14
  8. package/dist/src/typus/user/view-function.js +5 -6
  9. package/dist/src/typus-dov-single-v2/function/index.d.ts +0 -1
  10. package/dist/src/typus-dov-single-v2/function/index.js +0 -1
  11. package/dist/src/typus-dov-single-v2/function/token.js +1 -1
  12. package/dist/src/typus-dov-single-v2/history/index.d.ts +0 -1
  13. package/dist/src/typus-dov-single-v2/history/index.js +0 -1
  14. package/dist/src/typus-dov-single-v2/history/user-history.d.ts +5 -3
  15. package/dist/src/typus-dov-single-v2/history/user-history.js +124 -187
  16. package/dist/src/typus-dov-single-v2/otc-entry.js +5 -6
  17. package/dist/src/typus-dov-single-v2/user-entry.d.ts +1 -1
  18. package/dist/src/typus-dov-single-v2/view-function.d.ts +3 -0
  19. package/dist/src/typus-dov-single-v2/view-function.js +74 -28
  20. package/dist/src/typus-hedge/view-function.js +10 -10
  21. package/dist/src/typus-launch/airdrop/view-function.js +7 -5
  22. package/dist/src/typus-launch/auction/view-function.js +17 -16
  23. package/dist/src/typus-launch/funding-vault/view-function.js +21 -19
  24. package/dist/src/typus-launch/improvement-proposal/view-function.js +33 -18
  25. package/dist/src/typus-launch/ve-typus/view-function.js +19 -15
  26. package/dist/src/typus-nft/fetch.d.ts +2 -36
  27. package/dist/src/typus-nft/fetch.js +34 -396
  28. package/dist/src/typus-nft/index.d.ts +0 -1
  29. package/dist/src/typus-nft/index.js +0 -1
  30. package/dist/src/typus-safu/view-function.js +13 -13
  31. package/dist/src/utils/api/price.js +6 -58
  32. package/dist/src/utils/api/sentio/events.js +4 -4
  33. package/dist/src/utils/api/sentio/leader-board.js +1 -1
  34. package/dist/src/utils/api/sentio/reward-generated.js +16 -16
  35. package/dist/src/utils/api/sentio/vault-history.js +1 -1
  36. package/dist/src/utils/graphQl.d.ts +27 -0
  37. package/dist/src/utils/graphQl.js +132 -0
  38. package/dist/src/utils/index.d.ts +1 -0
  39. package/dist/src/utils/index.js +1 -0
  40. package/dist/src/utils/oracle.js +13 -14
  41. package/dist/src/utils/sponsoredTx.d.ts +2 -2
  42. package/dist/src/utils/typusConfig.d.ts +4 -0
  43. package/dist/src/utils/typusConfig.js +33 -31
  44. package/package.json +10 -9
  45. package/dist/src/dice/view-function.d.ts +0 -1
  46. package/dist/src/dice/view-function.js +0 -20
  47. package/dist/src/typus-dov-single-v2/function/bidding.d.ts +0 -87
  48. package/dist/src/typus-dov-single-v2/function/bidding.js +0 -653
  49. package/dist/src/typus-dov-single-v2/history/vault-history.d.ts +0 -123
  50. package/dist/src/typus-dov-single-v2/history/vault-history.js +0 -307
  51. package/dist/src/typus-nft/user-entry.d.ts +0 -57
  52. package/dist/src/typus-nft/user-entry.js +0 -161
@@ -42,10 +42,8 @@ exports.getOngoingTipVotes = getOngoingTipVotes;
42
42
  exports.getEndedTipVotes = getEndedTipVotes;
43
43
  exports.getTipVotes = getTipVotes;
44
44
  var transactions_1 = require("@mysten/sui/transactions");
45
- var client_1 = require("@mysten/sui/client");
46
45
  var bcs_1 = require("@mysten/bcs");
47
46
  var utils_1 = require("../../../src/utils");
48
- var constants_1 = require("../../../src/constants");
49
47
  /**
50
48
  public(package) fun get_ongoing_tips_bcs(
51
49
  registry: &Registry,
@@ -59,7 +57,7 @@ function getOngoingTips(config, input) {
59
57
  return __generator(this, function (_a) {
60
58
  switch (_a.label) {
61
59
  case 0:
62
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
60
+ provider = config.gRpcClient();
63
61
  transaction = new transactions_1.Transaction();
64
62
  transaction.moveCall({
65
63
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tips_bcs"),
@@ -69,10 +67,11 @@ function getOngoingTips(config, input) {
69
67
  transaction.pure.option("address", input.user),
70
68
  ],
71
69
  });
72
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
70
+ return [4 /*yield*/, provider.simulateTransaction({ transaction: transaction, checksEnabled: false, include: { commandResults: true } })];
73
71
  case 1:
74
- results = (_a.sent()).results;
75
- bytes = results[0].returnValues[0][0];
72
+ results = (_a.sent())
73
+ .commandResults;
74
+ bytes = results[0].returnValues[0].bcs;
76
75
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
77
76
  reader.readULEB();
78
77
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -128,16 +127,20 @@ function getEndedTips(config) {
128
127
  return __generator(this, function (_a) {
129
128
  switch (_a.label) {
130
129
  case 0:
131
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
130
+ provider = config.gRpcClient();
132
131
  transaction = new transactions_1.Transaction();
133
132
  transaction.moveCall({
134
133
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tips_bcs"),
135
134
  arguments: [transaction.object(config.registry.launch.improvementProposal)],
136
135
  });
137
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
136
+ return [4 /*yield*/, provider.simulateTransaction({
137
+ transaction: transaction,
138
+ checksEnabled: false,
139
+ include: { commandResults: true },
140
+ })];
138
141
  case 1:
139
142
  devInspectTransactionBlockResult = _a.sent();
140
- bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
143
+ bytes = devInspectTransactionBlockResult.commandResults[0].returnValues[0].bcs;
141
144
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
142
145
  reader.readULEB();
143
146
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -193,16 +196,20 @@ function getOngoingTipVotes(config, input) {
193
196
  return __generator(this, function (_a) {
194
197
  switch (_a.label) {
195
198
  case 0:
196
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
199
+ provider = config.gRpcClient();
197
200
  transaction = new transactions_1.Transaction();
198
201
  transaction.moveCall({
199
202
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ongoing_tip_votes_bcs"),
200
203
  arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.address(input.user)],
201
204
  });
202
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
205
+ return [4 /*yield*/, provider.simulateTransaction({
206
+ transaction: transaction,
207
+ checksEnabled: false,
208
+ include: { commandResults: true },
209
+ })];
203
210
  case 1:
204
211
  devInspectTransactionBlockResult = _a.sent();
205
- bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
212
+ bytes = devInspectTransactionBlockResult.commandResults[0].returnValues[0].bcs;
206
213
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
207
214
  reader.readULEB();
208
215
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -230,16 +237,20 @@ function getEndedTipVotes(config, input) {
230
237
  return __generator(this, function (_a) {
231
238
  switch (_a.label) {
232
239
  case 0:
233
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
240
+ provider = config.gRpcClient();
234
241
  transaction = new transactions_1.Transaction();
235
242
  transaction.moveCall({
236
243
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_ended_tip_votes_bcs"),
237
244
  arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.address(input.user)],
238
245
  });
239
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
246
+ return [4 /*yield*/, provider.simulateTransaction({
247
+ transaction: transaction,
248
+ checksEnabled: false,
249
+ include: { commandResults: true },
250
+ })];
240
251
  case 1:
241
252
  devInspectTransactionBlockResult = _a.sent();
242
- bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
253
+ bytes = devInspectTransactionBlockResult.commandResults[0].returnValues[0].bcs;
243
254
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
244
255
  reader.readULEB();
245
256
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -267,16 +278,20 @@ function getTipVotes(config, input) {
267
278
  return __generator(this, function (_a) {
268
279
  switch (_a.label) {
269
280
  case 0:
270
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
281
+ provider = config.gRpcClient();
271
282
  transaction = new transactions_1.Transaction();
272
283
  transaction.moveCall({
273
284
  target: "".concat(config.package.launch.improvementProposal, "::improvement_proposal::get_tip_votes_bcs"),
274
285
  arguments: [transaction.object(config.registry.launch.improvementProposal), transaction.pure.u64(input.index)],
275
286
  });
276
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
287
+ return [4 /*yield*/, provider.simulateTransaction({
288
+ transaction: transaction,
289
+ checksEnabled: false,
290
+ include: { commandResults: true },
291
+ })];
277
292
  case 1:
278
293
  devInspectTransactionBlockResult = _a.sent();
279
- bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
294
+ bytes = devInspectTransactionBlockResult.commandResults[0].returnValues[0].bcs;
280
295
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
281
296
  reader.readULEB();
282
297
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -40,9 +40,7 @@ exports.getVeTypus = getVeTypus;
40
40
  exports.getReports = getReports;
41
41
  exports.fetchVeTypusInfo = fetchVeTypusInfo;
42
42
  var transactions_1 = require("@mysten/sui/transactions");
43
- var client_1 = require("@mysten/sui/client");
44
43
  var bcs_1 = require("@mysten/bcs");
45
- var constants_1 = require("../../../src/constants");
46
44
  var utils_1 = require("../../../src/utils");
47
45
  function getVeTypus(config, input) {
48
46
  return __awaiter(this, void 0, void 0, function () {
@@ -50,16 +48,20 @@ function getVeTypus(config, input) {
50
48
  return __generator(this, function (_a) {
51
49
  switch (_a.label) {
52
50
  case 0:
53
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
51
+ provider = config.gRpcClient();
54
52
  transaction = new transactions_1.Transaction();
55
53
  transaction.moveCall({
56
54
  target: "".concat(config.package.launch.veTypus, "::ve_typus::get_ve_typus_bcs"),
57
55
  arguments: [transaction.object(config.registry.launch.veTypus), transaction.pure.address(input.user)],
58
56
  });
59
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
57
+ return [4 /*yield*/, provider.simulateTransaction({
58
+ transaction: transaction,
59
+ checksEnabled: false,
60
+ include: { commandResults: true },
61
+ })];
60
62
  case 1:
61
63
  devInspectTransactionBlockResult = _a.sent();
62
- bytes = devInspectTransactionBlockResult.results[0].returnValues[0][0];
64
+ bytes = devInspectTransactionBlockResult.commandResults[0].returnValues[0].bcs;
63
65
  reader = new bcs_1.BcsReader(new Uint8Array(bytes));
64
66
  reader.readULEB();
65
67
  return [2 /*return*/, reader.readVec(function (reader) {
@@ -82,7 +84,7 @@ function getReports(config, input) {
82
84
  return __generator(this, function (_a) {
83
85
  switch (_a.label) {
84
86
  case 0:
85
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
87
+ provider = config.gRpcClient();
86
88
  transaction = new transactions_1.Transaction();
87
89
  input.tsMss.forEach(function (tsMs) {
88
90
  transaction.moveCall({
@@ -90,13 +92,14 @@ function getReports(config, input) {
90
92
  arguments: [transaction.object(config.registry.launch.veTypus), transaction.pure.u64(tsMs)],
91
93
  });
92
94
  });
93
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
95
+ return [4 /*yield*/, provider.simulateTransaction({ transaction: transaction, checksEnabled: false, include: { commandResults: true } })];
94
96
  case 1:
95
- results = (_a.sent()).results;
97
+ results = (_a.sent())
98
+ .commandResults;
96
99
  // @ts-ignore
97
100
  return [2 /*return*/, results === null || results === void 0 ? void 0 : results.map(function (result) {
98
101
  // @ts-ignore
99
- var reader = new bcs_1.BcsReader(new Uint8Array(result.returnValues[0][0]));
102
+ var reader = new bcs_1.BcsReader(new Uint8Array(result.returnValues[0].bcs));
100
103
  reader.readULEB();
101
104
  return {
102
105
  totalVeTypusAmount: reader.read64(),
@@ -113,7 +116,7 @@ function fetchVeTypusInfo(config, input) {
113
116
  return __generator(this, function (_a) {
114
117
  switch (_a.label) {
115
118
  case 0:
116
- provider = new client_1.SuiClient({ url: config.rpcEndpoint });
119
+ provider = config.gRpcClient();
117
120
  transaction = new transactions_1.Transaction();
118
121
  transaction.moveCall({
119
122
  target: "".concat(config.package.launch.veTypus, "::ve_typus::get_report"),
@@ -133,17 +136,18 @@ function fetchVeTypusInfo(config, input) {
133
136
  ],
134
137
  });
135
138
  }
136
- return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
139
+ return [4 /*yield*/, provider.simulateTransaction({ transaction: transaction, checksEnabled: false, include: { commandResults: true } })];
137
140
  case 1:
138
- results = (_a.sent()).results;
139
- reader = new bcs_1.BcsReader(new Uint8Array(results[0].returnValues[0][0]));
141
+ results = (_a.sent())
142
+ .commandResults;
143
+ reader = new bcs_1.BcsReader(new Uint8Array(results[0].returnValues[0].bcs));
140
144
  reader.readULEB();
141
145
  totalVeTypusAmount = reader.read64();
142
146
  totalStakedTypusAmount = reader.read64();
143
147
  averageLockUpTime = ((BigInt(totalVeTypusAmount) * BigInt(4 * 365 * 24 * 60 * 60 * 1000)) /
144
148
  BigInt(totalStakedTypusAmount)).toString();
145
149
  if (input.user) {
146
- reader_1 = new bcs_1.BcsReader(new Uint8Array(results[1].returnValues[0][0]));
150
+ reader_1 = new bcs_1.BcsReader(new Uint8Array(results[1].returnValues[0].bcs));
147
151
  reader_1.readULEB();
148
152
  veTypus = reader_1.readVec(function (reader) {
149
153
  reader.readULEB();
@@ -156,7 +160,7 @@ function fetchVeTypusInfo(config, input) {
156
160
  };
157
161
  });
158
162
  // @ts-ignore
159
- reader_1 = new bcs_1.BcsReader(new Uint8Array(results[2].returnValues[0][0]));
163
+ reader_1 = new bcs_1.BcsReader(new Uint8Array(results[2].returnValues[0].bcs));
160
164
  veTypusAmount = reader_1.read64();
161
165
  return [2 /*return*/, {
162
166
  totalVeTypusAmount: totalVeTypusAmount,
@@ -1,17 +1,5 @@
1
- import { SuiClient, SuiObjectResponse } from "@mysten/sui/client";
2
1
  import { KioskClient, KioskListing } from "@mysten/kiosk";
3
- export declare function getPool(provider: SuiClient, pool: string): Promise<PoolData>;
4
- export interface PoolData {
5
- pool_id: string;
6
- is_live: boolean;
7
- start_ms: string;
8
- num: number;
9
- remaining: number;
10
- table: string;
11
- }
12
- export declare const necklaces: string[];
13
- export declare function getPoolMap(provider: SuiClient, nftConfig: any): Promise<Map<string, PoolData>>;
14
- export declare function getWhitelistMap(nftConfig: any, wlTokens: any): Promise<Map<string, string[]>>;
2
+ import { SuiGraphQLClient } from "@mysten/sui/graphql";
15
3
  export interface TailsId {
16
4
  nftId: string;
17
5
  kiosk: string;
@@ -25,16 +13,11 @@ export interface kioskOwnerCap {
25
13
  objectId: string;
26
14
  isPersonal: boolean;
27
15
  }
28
- export declare function getkioskOwnerCaps(datas: SuiObjectResponse[]): kioskOwnerCap[];
29
16
  export declare function getTailsIds(kioskClient: KioskClient, NFT_PACKAGE_ORIGIN: string, kioskOwnerCaps: kioskOwnerCap[]): Promise<TailsId[]>;
30
17
  export interface TailsWithType extends Tails {
31
18
  type: string | null | undefined;
32
19
  }
33
- export declare function getTails(provider: SuiClient, tailsIds: string[]): Promise<TailsWithType[]>;
34
- export declare function getTailsDynamicField(provider: SuiClient, tailsIds: string[]): Promise<[Tails[], Map<string, string>]>;
35
- export declare function getTailsKiosk(provider: SuiClient, tailsToDynamicField: Map<string, string>): Promise<Map<string, string>>;
36
- export declare function getKioskOwner(provider: SuiClient, DynamicFieldToKiosk: Map<string, string>): Promise<Map<string, string>>;
37
- export declare function fieldsToTails(fields: any): Tails;
20
+ export declare function getTails(provider: SuiGraphQLClient, tailsIds: string[]): Promise<TailsWithType[]>;
38
21
  export interface Tails {
39
22
  id: string;
40
23
  name: string;
@@ -50,21 +33,4 @@ export interface Tails {
50
33
  }
51
34
  export declare function getLevelExp(level: number): number | undefined;
52
35
  export declare const LevelExpVec: number[];
53
- export declare function getTableTails(provider: SuiClient, parentId: string): Promise<TailsWithType[]>;
54
- export declare function getDiscountPool(provider: SuiClient, pool: string): Promise<DiscountPoolData>;
55
- export interface DiscountPoolData {
56
- id: string;
57
- num: string;
58
- total: string;
59
- price: string;
60
- start_ms: string;
61
- end_ms: string;
62
- authority: string;
63
- public_key: number[];
64
- discount_pcts: string[];
65
- is_live: boolean;
66
- balance: string;
67
- inventory: number;
68
- }
69
- export declare function getMintHistory(provider: SuiClient, NFT_PACKAGE: string, vrf_input: any): Promise<import("@mysten/sui/client").PaginatedEvents | undefined>;
70
36
  export declare function calculateLevelReward(totalRewards: number, levelShares: number[], numOfHolders: number[]): number[];