@typus/typus-sdk 1.2.73 → 1.2.74-dappkit

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/lib/config.json CHANGED
@@ -14,8 +14,8 @@
14
14
  "TYPUS": "0x4b0f4ee1a40ce37ec81c987cc4e76a665419e74b863319492fc7d26f708b835a"
15
15
  },
16
16
  "PACKAGE": {
17
- "DOV_SINGLE": "0x9c907e9af7bedaab3382542f342cce21ca95fa72bedcc887edb478d17f8293d1",
18
- "FRAMEWORK": "0x0580e4c45e06e6a60b0500027a42c7bb7cb87163fdf03a98b0b44b1842c0f3bd",
17
+ "DOV_SINGLE": "0x5395c48f9bd7ee96586fa1e10f22fc1cb2455f83994ca919aaef51ae4db40242",
18
+ "FRAMEWORK": "0x946d188d91cabd4fe15ef763e463a6738db1965814d3fd790085b4720cf90e28",
19
19
  "MFUD": "0xd8f04cd2a16c19c17428c3b4c22b01dd06740423b93fb7ee88fbe2676a82849d",
20
20
  "NFT": "0xba06aae31d9b7c9f651e783272c7e4f776fb5ae17e89d525b75a17b099f58202",
21
21
  "ORACLE": "0x978f65df8570a075298598a9965c18de9087f9e888eb3430fe20334f5c554cfd",
@@ -18,33 +18,33 @@ export declare function parseTypeName(name: string): {
18
18
  export declare function isTransactionArgument(arg: GenericArg): arg is TransactionArgument;
19
19
  export declare function isTransactionObjectArgument(arg: GenericArg): arg is TransactionObjectArgument;
20
20
  export declare function obj(txb: TransactionBlock, arg: ObjectArg): {
21
- type: "pure";
22
21
  index: number;
23
22
  kind: "Input";
23
+ type: "pure";
24
24
  value?: any;
25
25
  } | TransactionObjectArgument;
26
26
  export declare function pure(txb: TransactionBlock, arg: PureArg, type: string): {
27
- type: "pure";
28
27
  index: number;
29
28
  kind: "Input";
29
+ type: "pure";
30
30
  value?: any;
31
31
  } | TransactionObjectArgument;
32
32
  export declare function option(txb: TransactionBlock, type: string, arg: GenericArg | null): {
33
- type: "pure";
34
33
  index: number;
35
34
  kind: "Input";
35
+ type: "pure";
36
36
  value?: any;
37
37
  } | TransactionObjectArgument;
38
38
  export declare function generic(txb: TransactionBlock, type: string, arg: GenericArg): {
39
- type: "pure";
40
39
  index: number;
41
40
  kind: "Input";
41
+ type: "pure";
42
42
  value?: any;
43
43
  } | TransactionObjectArgument;
44
44
  export declare function vector(txb: TransactionBlock, itemType: string, items: Array<GenericArg> | TransactionArgument): {
45
- type: "pure";
46
45
  index: number;
47
46
  kind: "Input";
47
+ type: "pure";
48
48
  value?: any;
49
49
  } | TransactionObjectArgument;
50
50
  export declare function typeArgIsPure(type: string): boolean;
@@ -1,6 +1,7 @@
1
1
  export declare function getTotalDepositorIncentive(): Promise<TokenAmount>;
2
2
  export declare function getTotalPremium(): Promise<number>;
3
- export declare function getAccumulatedRewardGeneratedUSD(): Promise<number>;
3
+ /** Returns Accumulated Rewards im USD [v1, v2] */
4
+ export declare function getAccumulatedRewardGeneratedUSD(): Promise<[number, number]>;
4
5
  export declare function getTotalProfitSharingClaimed(): Promise<TokenAmount[]>;
5
6
  import { SuiClient } from "@mysten/sui.js/client";
6
7
  export declare function getTotalProfitSharing(provider: SuiClient): Promise<TokenAmount[]>;
@@ -8,4 +9,6 @@ interface TokenAmount {
8
9
  token: string;
9
10
  total_amount: string;
10
11
  }
12
+ /** Returns Accumulated Users [v1, v2] */
13
+ export declare function getAccumulatedUser(): Promise<number[]>;
11
14
  export {};
@@ -47,7 +47,7 @@ var __values = (this && this.__values) || function(o) {
47
47
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
48
  };
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.getTotalProfitSharing = exports.getTotalProfitSharingClaimed = exports.getAccumulatedRewardGeneratedUSD = exports.getTotalPremium = exports.getTotalDepositorIncentive = void 0;
50
+ exports.getAccumulatedUser = exports.getTotalProfitSharing = exports.getTotalProfitSharingClaimed = exports.getAccumulatedRewardGeneratedUSD = exports.getTotalPremium = exports.getTotalDepositorIncentive = void 0;
51
51
  var headers = {
52
52
  "api-key": "tz3JJ6stG7Fux6ueRSRA5mdpC9U0lozI3",
53
53
  "Content-Type": "application/json",
@@ -146,12 +146,73 @@ function getTotalPremium() {
146
146
  });
147
147
  }
148
148
  exports.getTotalPremium = getTotalPremium;
149
+ /** Returns Accumulated Rewards im USD [v1, v2] */
149
150
  function getAccumulatedRewardGeneratedUSD() {
150
151
  return __awaiter(this, void 0, void 0, function () {
151
- var apiUrl, requestData, jsonData, response, data;
152
+ var apiUrlV1, requestDataV1, jsonDataV1, responseV1, dataV1, apiUrl, requestData, jsonData, response, data;
152
153
  return __generator(this, function (_a) {
153
154
  switch (_a.label) {
154
155
  case 0:
156
+ apiUrlV1 = "https://app.sentio.xyz/api/v1/insights/typus/typus_v1/query";
157
+ requestDataV1 = {
158
+ timeRange: {
159
+ start: "now",
160
+ end: "now",
161
+ step: 3600,
162
+ timezone: "Asia/Taipei",
163
+ },
164
+ limit: 1,
165
+ queries: [
166
+ {
167
+ metricsQuery: {
168
+ query: "premiumUSD",
169
+ alias: "",
170
+ id: "a",
171
+ labelSelector: {},
172
+ aggregate: {
173
+ op: "SUM",
174
+ grouping: [],
175
+ },
176
+ functions: [
177
+ {
178
+ name: "sum_over_time",
179
+ arguments: [
180
+ {
181
+ durationValue: {
182
+ value: 100,
183
+ unit: "w",
184
+ },
185
+ },
186
+ ],
187
+ },
188
+ ],
189
+ disabled: true,
190
+ },
191
+ dataSource: "METRICS",
192
+ sourceName: "",
193
+ },
194
+ ],
195
+ formulas: [
196
+ {
197
+ expression: "a/2",
198
+ alias: "",
199
+ id: "A",
200
+ disabled: false,
201
+ functions: [],
202
+ },
203
+ ],
204
+ };
205
+ jsonDataV1 = JSON.stringify(requestDataV1);
206
+ return [4 /*yield*/, fetch(apiUrlV1, {
207
+ method: "POST",
208
+ headers: headers,
209
+ body: jsonDataV1,
210
+ })];
211
+ case 1:
212
+ responseV1 = _a.sent();
213
+ return [4 /*yield*/, responseV1.json()];
214
+ case 2:
215
+ dataV1 = _a.sent();
155
216
  apiUrl = "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query";
156
217
  requestData = {
157
218
  timeRange: {
@@ -187,13 +248,13 @@ function getAccumulatedRewardGeneratedUSD() {
187
248
  headers: headers,
188
249
  body: jsonData,
189
250
  })];
190
- case 1:
251
+ case 3:
191
252
  response = _a.sent();
192
253
  return [4 /*yield*/, response.json()];
193
- case 2:
254
+ case 4:
194
255
  data = _a.sent();
195
256
  // console.log(data);
196
- return [2 /*return*/, data.results[0].matrix.samples[0].values[0].value];
257
+ return [2 /*return*/, [dataV1.results[0].matrix.samples[0].values[0].value, data.results[0].matrix.samples[0].values[0].value]];
197
258
  }
198
259
  });
199
260
  });
@@ -301,6 +362,97 @@ function getTotalProfitSharing(provider) {
301
362
  });
302
363
  }
303
364
  exports.getTotalProfitSharing = getTotalProfitSharing;
365
+ /** Returns Accumulated Users [v1, v2] */
366
+ function getAccumulatedUser() {
367
+ return __awaiter(this, void 0, void 0, function () {
368
+ var apiUrls, result, apiUrls_1, apiUrls_1_1, apiUrl, requestData, jsonData, response, data, e_3_1;
369
+ var e_3, _a;
370
+ return __generator(this, function (_b) {
371
+ switch (_b.label) {
372
+ case 0:
373
+ apiUrls = [
374
+ "https://app.sentio.xyz/api/v1/insights/typus/typus_v1/query",
375
+ "https://app.sentio.xyz/api/v1/insights/typus/typus_v2/query",
376
+ ];
377
+ result = [];
378
+ _b.label = 1;
379
+ case 1:
380
+ _b.trys.push([1, 7, 8, 9]);
381
+ apiUrls_1 = __values(apiUrls), apiUrls_1_1 = apiUrls_1.next();
382
+ _b.label = 2;
383
+ case 2:
384
+ if (!!apiUrls_1_1.done) return [3 /*break*/, 6];
385
+ apiUrl = apiUrls_1_1.value;
386
+ requestData = {
387
+ timeRange: {
388
+ start: "now-1h",
389
+ end: "now",
390
+ step: 3600,
391
+ timezone: "Asia/Taipei",
392
+ },
393
+ limit: 1,
394
+ queries: [
395
+ {
396
+ eventsQuery: {
397
+ resource: {
398
+ name: "",
399
+ type: "EVENTS",
400
+ },
401
+ alias: "",
402
+ id: "a",
403
+ aggregation: {
404
+ countUnique: {
405
+ duration: {
406
+ value: 0,
407
+ unit: "day",
408
+ },
409
+ },
410
+ },
411
+ groupBy: [],
412
+ limit: 1,
413
+ functions: [],
414
+ disabled: false,
415
+ },
416
+ dataSource: "EVENTS",
417
+ sourceName: "",
418
+ },
419
+ ],
420
+ formulas: [],
421
+ };
422
+ jsonData = JSON.stringify(requestData);
423
+ return [4 /*yield*/, fetch(apiUrl, {
424
+ method: "POST",
425
+ headers: headers,
426
+ body: jsonData,
427
+ })];
428
+ case 3:
429
+ response = _b.sent();
430
+ return [4 /*yield*/, response.json()];
431
+ case 4:
432
+ data = _b.sent();
433
+ // console.log(data.results[0].matrix.samples[0].values[0].value);
434
+ result.push(data.results[0].matrix.samples[0].values[0].value);
435
+ _b.label = 5;
436
+ case 5:
437
+ apiUrls_1_1 = apiUrls_1.next();
438
+ return [3 /*break*/, 2];
439
+ case 6: return [3 /*break*/, 9];
440
+ case 7:
441
+ e_3_1 = _b.sent();
442
+ e_3 = { error: e_3_1 };
443
+ return [3 /*break*/, 9];
444
+ case 8:
445
+ try {
446
+ if (apiUrls_1_1 && !apiUrls_1_1.done && (_a = apiUrls_1.return)) _a.call(apiUrls_1);
447
+ }
448
+ finally { if (e_3) throw e_3.error; }
449
+ return [7 /*endfinally*/];
450
+ case 9: return [2 /*return*/, result];
451
+ }
452
+ });
453
+ });
454
+ }
455
+ exports.getAccumulatedUser = getAccumulatedUser;
304
456
  var token_1 = require("../../token");
305
457
  (function () { return __awaiter(void 0, void 0, void 0, function () {
306
458
  return __generator(this, function (_a) {
@@ -112,7 +112,7 @@ function getPythLatestPrice() {
112
112
  return __generator(this, function (_a) {
113
113
  switch (_a.label) {
114
114
  case 0:
115
- apiUrlWithParams = "https://hermes.pyth.network/api/latest_price_feeds?ids[]=0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744&ids[]=0xe5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef&ids[]=0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a&ids[]=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&ids[]=0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace&ids[]=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d&ids[]=0xf9c2e890443dd995d0baafc08eea3358be1ffb874f93f99c30b3816c460bbac3&ids[]=0x03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5&ids[]=0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b&ids[]=0xdcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c&ids[]=0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592&ids[]=0x53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb";
115
+ apiUrlWithParams = "https://hermes.pyth.network/api/latest_price_feeds?ids[]=0x23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744&ids[]=0xe5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef&ids[]=0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a&ids[]=0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43&ids[]=0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace&ids[]=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d&ids[]=0xf9c2e890443dd995d0baafc08eea3358be1ffb874f93f99c30b3816c460bbac3&ids[]=0x03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5&ids[]=0x2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b&ids[]=0xdcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c&ids[]=0x7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592&ids[]=0x53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb&ids[]=0x88250f854c019ef4f88a5c073d52a18bb1c6ac437033f5932cd017d24917ab46&ids[]=0xe393449f6aff8a4b6d3e1165a7c9ebec103685f3b41e60db4277b5b6d10e7326";
116
116
  return [4 /*yield*/, fetch(apiUrlWithParams, {
117
117
  method: "GET",
118
118
  headers: { "Content-Type": "application/json" },
@@ -204,4 +204,6 @@ var pythId = {
204
204
  dcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c: "DOGE",
205
205
  "7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592": "INJ",
206
206
  "53614f1cb0c031d4af66c04cb9c756234adad0e1cee85303795091499a4084eb": "SEI",
207
+ "88250f854c019ef4f88a5c073d52a18bb1c6ac437033f5932cd017d24917ab46": "NAVX",
208
+ e393449f6aff8a4b6d3e1165a7c9ebec103685f3b41e60db4277b5b6d10e7326: "USDY",
207
209
  };
@@ -116,7 +116,7 @@ function getHistory(provider, dicePackage, playgrounds) {
116
116
  history = _a.sent();
117
117
  _a.label = 3;
118
118
  case 3:
119
- if (!result.hasNextPage) return [3 /*break*/, 6];
119
+ if (!(result.hasNextPage && history.length <= 60)) return [3 /*break*/, 6];
120
120
  return [4 /*yield*/, provider.queryEvents({ query: eventFilter, order: "descending", cursor: result.nextCursor })];
121
121
  case 4:
122
122
  result = _a.sent();
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.2.73",
5
+ "version": "1.2.74-dappkit",
6
6
  "dependencies": {
7
7
  "@mysten/bcs": "^0.11.1",
8
- "@mysten/kiosk": "0.7.12",
9
- "@mysten/sui.js": "0.48.0",
8
+ "@mysten/kiosk": "0.8.10",
9
+ "@mysten/sui.js": "0.54.1",
10
10
  "@types/node": "^20.5.7",
11
11
  "aftermath-ts-sdk": "^1.1.14",
12
12
  "bignumber.js": "^9.1.1",