@typus/typus-perp-sdk 1.0.2 → 1.0.4

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 (31) hide show
  1. package/dist/src/fetch.d.ts +2 -0
  2. package/dist/src/fetch.js +28 -13
  3. package/dist/src/index.d.ts +8 -0
  4. package/dist/src/index.js +12 -2
  5. package/dist/src/typus_perp/admin/structs.d.ts +66 -4
  6. package/dist/src/typus_perp/admin/structs.js +155 -1
  7. package/dist/src/typus_perp/error/functions.d.ts +1 -0
  8. package/dist/src/typus_perp/error/functions.js +4 -0
  9. package/dist/src/typus_perp/escrow/structs.d.ts +1 -1
  10. package/dist/src/typus_perp/index.js +3 -3
  11. package/dist/src/typus_perp/init.js +2 -1
  12. package/dist/src/typus_perp/lp-pool/structs.d.ts +26 -26
  13. package/dist/src/typus_perp/oracle/structs.d.ts +2 -2
  14. package/dist/src/typus_perp/position/functions.d.ts +3 -0
  15. package/dist/src/typus_perp/position/functions.js +7 -1
  16. package/dist/src/typus_perp/position/structs.d.ts +24 -164
  17. package/dist/src/typus_perp/position/structs.js +19 -209
  18. package/dist/src/typus_perp/symbol/structs.d.ts +1 -1
  19. package/dist/src/typus_perp/tlp/structs.d.ts +2 -2
  20. package/dist/src/typus_perp/trading/structs.d.ts +173 -29
  21. package/dist/src/typus_perp/trading/structs.js +221 -1
  22. package/dist/src/typus_perp/treasury-caps/structs.d.ts +1 -1
  23. package/dist/src/typus_stake_pool/admin/structs.d.ts +4 -4
  24. package/dist/src/typus_stake_pool/index.js +3 -3
  25. package/dist/src/typus_stake_pool/stake-pool/structs.d.ts +22 -22
  26. package/dist/src/user/history.js +94 -14
  27. package/dist/src/user/order.js +17 -11
  28. package/dist/src/user/orderWithBidReceipt.d.ts +2 -4
  29. package/dist/src/user/orderWithBidReceipt.js +9 -20
  30. package/dist/src/user/tlp.js +18 -18
  31. package/package.json +2 -1
@@ -3,6 +3,7 @@ import { LiquidityPool } from "./typus_perp/lp-pool/structs";
3
3
  import { TradingOrder, Position } from "./typus_perp/position/structs";
4
4
  import { LpUserShare, StakePool } from "./typus_stake_pool/stake-pool/structs";
5
5
  import { PythClient, TypusConfig } from "@typus/typus-sdk/dist/src/utils";
6
+ import { TypusBidReceipt } from "./_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/vault/structs";
6
7
  export declare function getLpPools(config: TypusConfig): Promise<LiquidityPool[]>;
7
8
  export declare function getStakePools(config: TypusConfig): Promise<StakePool[]>;
8
9
  export interface MarketsData {
@@ -14,6 +15,7 @@ export declare function getMarkets(config: TypusConfig, input: {
14
15
  }): Promise<MarketsData[]>;
15
16
  export declare function getUserOrders(config: TypusConfig, user: string): Promise<TradingOrder[]>;
16
17
  export declare function getUserPositions(config: TypusConfig, user: string): Promise<Position[]>;
18
+ export declare function parseOptionBidReceipts(positions: Position[]): (TypusBidReceipt | null)[];
17
19
  export declare function getUserStake(config: TypusConfig, user: string): Promise<LpUserShare[]>;
18
20
  export declare function getLiquidationPrice(config: TypusConfig, pythClient: PythClient, input: {
19
21
  positions: Position[];
package/dist/src/fetch.js CHANGED
@@ -52,6 +52,7 @@ exports.getStakePools = getStakePools;
52
52
  exports.getMarkets = getMarkets;
53
53
  exports.getUserOrders = getUserOrders;
54
54
  exports.getUserPositions = getUserPositions;
55
+ exports.parseOptionBidReceipts = parseOptionBidReceipts;
55
56
  exports.getUserStake = getUserStake;
56
57
  exports.getLiquidationPrice = getLiquidationPrice;
57
58
  var client_1 = require("@mysten/sui/client");
@@ -66,6 +67,8 @@ var structs_4 = require("./typus_stake_pool/stake-pool/structs");
66
67
  var constants_1 = require("@typus/typus-sdk/dist/src/constants");
67
68
  var utils_1 = require("@typus/typus-sdk/dist/src/utils");
68
69
  var _1 = require(".");
70
+ var structs_5 = require("./_dependencies/source/0x908a10789a1a6953e0b73a997c10e3552f7ce4e2907afd00a334ed74bd973ded/vault/structs");
71
+ var typus_perp_1 = require("./typus_perp");
69
72
  function getLpPools(config) {
70
73
  return __awaiter(this, void 0, void 0, function () {
71
74
  var provider, dynamicFields, lpPools, _a, _b, field, lpPool, e_1_1;
@@ -75,7 +78,7 @@ function getLpPools(config) {
75
78
  case 0:
76
79
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
77
80
  return [4 /*yield*/, provider.getDynamicFields({
78
- parentId: config.registry.perp.liquidityPool,
81
+ parentId: _1.LIQUIDITY_POOL,
79
82
  })];
80
83
  case 1:
81
84
  dynamicFields = _d.sent();
@@ -122,7 +125,7 @@ function getStakePools(config) {
122
125
  case 0:
123
126
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
124
127
  return [4 /*yield*/, provider.getDynamicFields({
125
- parentId: config.registry.perp.stakePool,
128
+ parentId: _1.STAKE_POOL,
126
129
  })];
127
130
  case 1:
128
131
  dynamicFields = _d.sent();
@@ -169,8 +172,8 @@ function getMarkets(config, input) {
169
172
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
170
173
  transaction = new transactions_1.Transaction();
171
174
  transaction.moveCall({
172
- target: "".concat(config.package.perp.perp, "::trading::get_markets_bcs"),
173
- arguments: [transaction.object(config.registry.perp.market), transaction.pure.vector("u64", input.indexes)],
175
+ target: "".concat(typus_perp_1.PUBLISHED_AT, "::trading::get_markets_bcs"),
176
+ arguments: [transaction.object(_1.MARKET), transaction.pure.vector("u64", input.indexes)],
174
177
  });
175
178
  return [4 /*yield*/, provider.devInspectTransactionBlock({ sender: constants_1.SENDER, transactionBlock: transaction })];
176
179
  case 1:
@@ -201,7 +204,7 @@ function getMarkets(config, input) {
201
204
  }
202
205
  // export async function getMarkets(config: TypusConfig): Promise<Markets[]> {
203
206
  // let provider = new SuiClient({ url: config.rpcEndpoint });
204
- // // const marketRegistry = await MarketRegistry.fetch(provider, config.registry.perp.market);
207
+ // // const marketRegistry = await MarketRegistry.fetch(provider, MARKET);
205
208
  // // console.log(marketRegistry.markets.vid);
206
209
  // let dynamicFields = await provider.getDynamicFields({
207
210
  // // @ts-ignore
@@ -239,8 +242,8 @@ function getUserOrders(config, user) {
239
242
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
240
243
  tx = new transactions_1.Transaction();
241
244
  (0, functions_1.getUserOrders)(tx, {
242
- version: config.version.perp.perp,
243
- registry: config.registry.perp.market,
245
+ version: _1.PERP_VERSION,
246
+ registry: _1.MARKET,
244
247
  marketIndex: BigInt(0),
245
248
  user: user,
246
249
  });
@@ -272,8 +275,8 @@ function getUserPositions(config, user) {
272
275
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
273
276
  tx = new transactions_1.Transaction();
274
277
  (0, functions_1.getUserPositions)(tx, {
275
- version: config.version.perp.perp,
276
- registry: config.registry.perp.market,
278
+ version: _1.PERP_VERSION,
279
+ registry: _1.MARKET,
277
280
  marketIndex: BigInt(0),
278
281
  user: user,
279
282
  });
@@ -296,6 +299,18 @@ function getUserPositions(config, user) {
296
299
  });
297
300
  });
298
301
  }
302
+ function parseOptionBidReceipts(positions) {
303
+ return positions.map(function (position) {
304
+ if (position.optionCollateralInfo) {
305
+ var bidReceipt = structs_5.TypusBidReceipt.fromBcs(Uint8Array.from(Array.from(position.optionCollateralInfo.bidReceiptsBcs[0])));
306
+ // console.log(bidReceipt);
307
+ return bidReceipt;
308
+ }
309
+ else {
310
+ return null;
311
+ }
312
+ });
313
+ }
299
314
  function getUserStake(config, user) {
300
315
  return __awaiter(this, void 0, void 0, function () {
301
316
  var provider, tx, res, returnValues, reader, lpShares_1;
@@ -305,7 +320,7 @@ function getUserStake(config, user) {
305
320
  provider = new client_1.SuiClient({ url: config.rpcEndpoint });
306
321
  tx = new transactions_1.Transaction();
307
322
  (0, functions_2.getUserShares)(tx, {
308
- registry: config.registry.perp.stakePool,
323
+ registry: _1.STAKE_POOL,
309
324
  index: BigInt(0),
310
325
  user: user,
311
326
  });
@@ -373,9 +388,9 @@ function getLiquidationPrice(config, pythClient, input) {
373
388
  TOKEN = (0, constants_1.typeArgToToken)(position.collateralToken.name);
374
389
  BASE_TOKEN = (0, constants_1.typeArgToToken)(position.symbol.baseToken.name);
375
390
  (0, functions_1.getEstimatedLiquidationPrice)(tx, [position.collateralToken.name, position.symbol.baseToken.name], {
376
- version: config.version.perp.perp,
377
- registry: config.registry.perp.market,
378
- poolRegistry: config.registry.perp.lpPool,
391
+ version: _1.PERP_VERSION,
392
+ registry: _1.MARKET,
393
+ poolRegistry: _1.LP_POOL,
379
394
  marketIndex: BigInt(0),
380
395
  poolIndex: BigInt(0),
381
396
  pythState: utils_1.pythStateId[_1.NETWORK],
@@ -1,3 +1,11 @@
1
1
  export * from "./fetch";
2
2
  export * from "./user";
3
3
  export declare const NETWORK: string;
4
+ export declare const LP_POOL: string;
5
+ export declare const LIQUIDITY_POOL: string;
6
+ export declare const MARKET: string;
7
+ export declare const TLP: string;
8
+ export declare const TLP_TREASURY_CAP: string;
9
+ export declare const STAKE_POOL: string;
10
+ export declare const PERP_VERSION: string;
11
+ export declare const STAKE_POOL_VERSION: string;
package/dist/src/index.js CHANGED
@@ -17,11 +17,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.NETWORK = void 0;
20
+ exports.STAKE_POOL_VERSION = exports.PERP_VERSION = exports.STAKE_POOL = exports.TLP_TREASURY_CAP = exports.TLP = exports.MARKET = exports.LIQUIDITY_POOL = exports.LP_POOL = exports.NETWORK = void 0;
21
21
  __exportStar(require("./fetch"), exports);
22
22
  __exportStar(require("./user"), exports);
23
23
  var dotenv_1 = __importDefault(require("dotenv"));
24
24
  // import .env file if exists
25
25
  dotenv_1.default.config();
26
- exports.NETWORK = process.env.CLUSTER == "mainnet" ? "MAINNET" : "TESTNET";
26
+ exports.NETWORK = process.env.NEXT_PUBLIC_CLUSTER == "mainnet" ? "MAINNET" : "TESTNET";
27
+ console.log("Load .env NEXT_PUBLIC_CLUSTER: ".concat(process.env.NEXT_PUBLIC_CLUSTER));
27
28
  console.log("Initializing Typus Perp SDK for ".concat(exports.NETWORK));
29
+ exports.LP_POOL = exports.NETWORK == "MAINNET" ? "" : "0xf85bb9b6bbe877e43e9a79f9c59d57331884f7519825f1116d8634806cd167e1";
30
+ exports.LIQUIDITY_POOL = exports.NETWORK == "MAINNET" ? "" : "0x93bc498e59e97c93820c14687a9a340bc794eada7f7ce0f458bb25190bdd395e";
31
+ exports.MARKET = exports.NETWORK == "MAINNET" ? "" : "0xb73983f279effad13b455846c192a2eb402ed453f84a1e627c9e34cfd329bf92";
32
+ exports.TLP = exports.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
33
+ exports.TLP_TREASURY_CAP = exports.NETWORK == "MAINNET" ? "" : "0x7d9c6f9dfceb4788c21388f77e4ccf83e1b3f10282ae272b379402e92c97bbf6";
34
+ exports.STAKE_POOL = exports.NETWORK == "MAINNET" ? "" : "0x27efed0157eea40aa1a8483622edeb48ca8c3fa3073f9e662503280a22a4e51b";
35
+ exports.PERP_VERSION = exports.NETWORK == "MAINNET" ? "" : "0xa3066f440d0e2fa74b1c98e55c316ce63b208be87b018b089bf39d5dd11e8dfd";
36
+ exports.STAKE_POOL_VERSION = exports.NETWORK == "MAINNET" ? "" : "0x25868624d2254a14eb513ae2b276fb56ca355ffd6cdd8ee05c5a51620f3f1bf3";
37
+ // "TLP_TOKEN": "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::tlp::TLP",
@@ -36,7 +36,7 @@ export declare class Version implements StructClass {
36
36
  static reified(): VersionReified;
37
37
  static get r(): reified.StructClassReified<Version, VersionFields>;
38
38
  static phantom(): PhantomReified<ToTypeStr<Version>>;
39
- static get p(): reified.PhantomReified<"::admin::Version" | "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e::admin::Version">;
39
+ static get p(): reified.PhantomReified<"::admin::Version" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::admin::Version">;
40
40
  static get bcs(): import("@mysten/sui/bcs").BcsType<{
41
41
  id: {
42
42
  id: {
@@ -216,7 +216,7 @@ export declare class FeeInfo implements StructClass {
216
216
  static reified(): FeeInfoReified;
217
217
  static get r(): reified.StructClassReified<FeeInfo, FeeInfoFields>;
218
218
  static phantom(): PhantomReified<ToTypeStr<FeeInfo>>;
219
- static get p(): reified.PhantomReified<"::admin::FeeInfo" | "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e::admin::FeeInfo">;
219
+ static get p(): reified.PhantomReified<"::admin::FeeInfo" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::admin::FeeInfo">;
220
220
  static get bcs(): import("@mysten/sui/bcs").BcsType<{
221
221
  token: {
222
222
  name: {
@@ -278,7 +278,7 @@ export declare class FeePool implements StructClass {
278
278
  static reified(): FeePoolReified;
279
279
  static get r(): reified.StructClassReified<FeePool, FeePoolFields>;
280
280
  static phantom(): PhantomReified<ToTypeStr<FeePool>>;
281
- static get p(): reified.PhantomReified<"::admin::FeePool" | "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e::admin::FeePool">;
281
+ static get p(): reified.PhantomReified<"::admin::FeePool" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::admin::FeePool">;
282
282
  static get bcs(): import("@mysten/sui/bcs").BcsType<{
283
283
  id: {
284
284
  id: {
@@ -362,7 +362,7 @@ export declare class SendFeeEvent implements StructClass {
362
362
  static reified(): SendFeeEventReified;
363
363
  static get r(): reified.StructClassReified<SendFeeEvent, SendFeeEventFields>;
364
364
  static phantom(): PhantomReified<ToTypeStr<SendFeeEvent>>;
365
- static get p(): reified.PhantomReified<"::admin::SendFeeEvent" | "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e::admin::SendFeeEvent">;
365
+ static get p(): reified.PhantomReified<"::admin::SendFeeEvent" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::admin::SendFeeEvent">;
366
366
  static get bcs(): import("@mysten/sui/bcs").BcsType<{
367
367
  token: {
368
368
  name: {
@@ -403,3 +403,65 @@ export declare class SendFeeEvent implements StructClass {
403
403
  static fromSuiObjectData(data: SuiObjectData): SendFeeEvent;
404
404
  static fetch(client: SuiClient, id: string): Promise<SendFeeEvent>;
405
405
  }
406
+ export declare function isProtocolFeeEvent(type: string): boolean;
407
+ export interface ProtocolFeeEventFields {
408
+ token: ToField<TypeName>;
409
+ amount: ToField<"u64">;
410
+ }
411
+ export type ProtocolFeeEventReified = Reified<ProtocolFeeEvent, ProtocolFeeEventFields>;
412
+ export declare class ProtocolFeeEvent implements StructClass {
413
+ __StructClass: true;
414
+ static readonly $typeName: string;
415
+ static readonly $numTypeParams = 0;
416
+ static readonly $isPhantom: readonly [];
417
+ readonly $typeName: string;
418
+ readonly $fullTypeName: `${typeof PKG_V1}::admin::ProtocolFeeEvent`;
419
+ readonly $typeArgs: [];
420
+ readonly $isPhantom: readonly [];
421
+ readonly token: ToField<TypeName>;
422
+ readonly amount: ToField<"u64">;
423
+ private constructor();
424
+ static reified(): ProtocolFeeEventReified;
425
+ static get r(): reified.StructClassReified<ProtocolFeeEvent, ProtocolFeeEventFields>;
426
+ static phantom(): PhantomReified<ToTypeStr<ProtocolFeeEvent>>;
427
+ static get p(): reified.PhantomReified<"::admin::ProtocolFeeEvent" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::admin::ProtocolFeeEvent">;
428
+ static get bcs(): import("@mysten/sui/bcs").BcsType<{
429
+ token: {
430
+ name: {
431
+ bytes: number[];
432
+ };
433
+ };
434
+ amount: string;
435
+ }, {
436
+ token: {
437
+ name: {
438
+ bytes: Iterable<number> & {
439
+ length: number;
440
+ };
441
+ };
442
+ };
443
+ amount: string | number | bigint;
444
+ }>;
445
+ static fromFields(fields: Record<string, any>): ProtocolFeeEvent;
446
+ static fromFieldsWithTypes(item: FieldsWithTypes): ProtocolFeeEvent;
447
+ static fromBcs(data: Uint8Array): ProtocolFeeEvent;
448
+ toJSONField(): {
449
+ token: {
450
+ name: string;
451
+ };
452
+ amount: string;
453
+ };
454
+ toJSON(): {
455
+ token: {
456
+ name: string;
457
+ };
458
+ amount: string;
459
+ $typeName: string;
460
+ $typeArgs: [];
461
+ };
462
+ static fromJSONField(field: any): ProtocolFeeEvent;
463
+ static fromJSON(json: Record<string, any>): ProtocolFeeEvent;
464
+ static fromSuiParsedData(content: SuiParsedData): ProtocolFeeEvent;
465
+ static fromSuiObjectData(data: SuiObjectData): ProtocolFeeEvent;
466
+ static fetch(client: SuiClient, id: string): Promise<ProtocolFeeEvent>;
467
+ }
@@ -105,11 +105,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
105
105
  return to.concat(ar || Array.prototype.slice.call(from));
106
106
  };
107
107
  Object.defineProperty(exports, "__esModule", { value: true });
108
- exports.SendFeeEvent = exports.FeePool = exports.FeeInfo = exports.Version = void 0;
108
+ exports.ProtocolFeeEvent = exports.SendFeeEvent = exports.FeePool = exports.FeeInfo = exports.Version = void 0;
109
109
  exports.isVersion = isVersion;
110
110
  exports.isFeeInfo = isFeeInfo;
111
111
  exports.isFeePool = isFeePool;
112
112
  exports.isSendFeeEvent = isSendFeeEvent;
113
+ exports.isProtocolFeeEvent = isProtocolFeeEvent;
113
114
  var reified = __importStar(require("../../_framework/reified"));
114
115
  var structs_1 = require("../../_dependencies/source/0x1/type-name/structs");
115
116
  var structs_2 = require("../../_dependencies/source/0x2/object/structs");
@@ -755,3 +756,156 @@ var SendFeeEvent = /** @class */ (function () {
755
756
  return SendFeeEvent;
756
757
  }());
757
758
  exports.SendFeeEvent = SendFeeEvent;
759
+ /* ============================== ProtocolFeeEvent =============================== */
760
+ function isProtocolFeeEvent(type) {
761
+ type = (0, util_1.compressSuiType)(type);
762
+ return type === "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
763
+ }
764
+ var ProtocolFeeEvent = /** @class */ (function () {
765
+ function ProtocolFeeEvent(typeArgs, fields) {
766
+ this.__StructClass = true;
767
+ this.$typeName = ProtocolFeeEvent.$typeName;
768
+ this.$isPhantom = ProtocolFeeEvent.$isPhantom;
769
+ this.$fullTypeName = util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], __read(typeArgs), false));
770
+ this.$typeArgs = typeArgs;
771
+ this.token = fields.token;
772
+ this.amount = fields.amount;
773
+ }
774
+ ProtocolFeeEvent.reified = function () {
775
+ var _this = this;
776
+ return {
777
+ typeName: ProtocolFeeEvent.$typeName,
778
+ fullTypeName: util_1.composeSuiType.apply(void 0, __spreadArray([ProtocolFeeEvent.$typeName], [], false)),
779
+ typeArgs: [],
780
+ isPhantom: ProtocolFeeEvent.$isPhantom,
781
+ reifiedTypeArgs: [],
782
+ fromFields: function (fields) { return ProtocolFeeEvent.fromFields(fields); },
783
+ fromFieldsWithTypes: function (item) { return ProtocolFeeEvent.fromFieldsWithTypes(item); },
784
+ fromBcs: function (data) { return ProtocolFeeEvent.fromBcs(data); },
785
+ bcs: ProtocolFeeEvent.bcs,
786
+ fromJSONField: function (field) { return ProtocolFeeEvent.fromJSONField(field); },
787
+ fromJSON: function (json) { return ProtocolFeeEvent.fromJSON(json); },
788
+ fromSuiParsedData: function (content) { return ProtocolFeeEvent.fromSuiParsedData(content); },
789
+ fromSuiObjectData: function (content) { return ProtocolFeeEvent.fromSuiObjectData(content); },
790
+ fetch: function (client, id) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
791
+ return [2 /*return*/, ProtocolFeeEvent.fetch(client, id)];
792
+ }); }); },
793
+ new: function (fields) {
794
+ return new ProtocolFeeEvent([], fields);
795
+ },
796
+ kind: "StructClassReified",
797
+ };
798
+ };
799
+ Object.defineProperty(ProtocolFeeEvent, "r", {
800
+ get: function () {
801
+ return ProtocolFeeEvent.reified();
802
+ },
803
+ enumerable: false,
804
+ configurable: true
805
+ });
806
+ ProtocolFeeEvent.phantom = function () {
807
+ return (0, reified_1.phantom)(ProtocolFeeEvent.reified());
808
+ };
809
+ Object.defineProperty(ProtocolFeeEvent, "p", {
810
+ get: function () {
811
+ return ProtocolFeeEvent.phantom();
812
+ },
813
+ enumerable: false,
814
+ configurable: true
815
+ });
816
+ Object.defineProperty(ProtocolFeeEvent, "bcs", {
817
+ get: function () {
818
+ return bcs_1.bcs.struct("ProtocolFeeEvent", {
819
+ token: structs_1.TypeName.bcs,
820
+ amount: bcs_1.bcs.u64(),
821
+ });
822
+ },
823
+ enumerable: false,
824
+ configurable: true
825
+ });
826
+ ProtocolFeeEvent.fromFields = function (fields) {
827
+ return ProtocolFeeEvent.reified().new({
828
+ token: (0, reified_1.decodeFromFields)(structs_1.TypeName.reified(), fields.token),
829
+ amount: (0, reified_1.decodeFromFields)("u64", fields.amount),
830
+ });
831
+ };
832
+ ProtocolFeeEvent.fromFieldsWithTypes = function (item) {
833
+ if (!isProtocolFeeEvent(item.type)) {
834
+ throw new Error("not a ProtocolFeeEvent type");
835
+ }
836
+ return ProtocolFeeEvent.reified().new({
837
+ token: (0, reified_1.decodeFromFieldsWithTypes)(structs_1.TypeName.reified(), item.fields.token),
838
+ amount: (0, reified_1.decodeFromFieldsWithTypes)("u64", item.fields.amount),
839
+ });
840
+ };
841
+ ProtocolFeeEvent.fromBcs = function (data) {
842
+ return ProtocolFeeEvent.fromFields(ProtocolFeeEvent.bcs.parse(data));
843
+ };
844
+ ProtocolFeeEvent.prototype.toJSONField = function () {
845
+ return {
846
+ token: this.token.toJSONField(),
847
+ amount: this.amount.toString(),
848
+ };
849
+ };
850
+ ProtocolFeeEvent.prototype.toJSON = function () {
851
+ return __assign({ $typeName: this.$typeName, $typeArgs: this.$typeArgs }, this.toJSONField());
852
+ };
853
+ ProtocolFeeEvent.fromJSONField = function (field) {
854
+ return ProtocolFeeEvent.reified().new({
855
+ token: (0, reified_1.decodeFromJSONField)(structs_1.TypeName.reified(), field.token),
856
+ amount: (0, reified_1.decodeFromJSONField)("u64", field.amount),
857
+ });
858
+ };
859
+ ProtocolFeeEvent.fromJSON = function (json) {
860
+ if (json.$typeName !== ProtocolFeeEvent.$typeName) {
861
+ throw new Error("not a WithTwoGenerics json object");
862
+ }
863
+ return ProtocolFeeEvent.fromJSONField(json);
864
+ };
865
+ ProtocolFeeEvent.fromSuiParsedData = function (content) {
866
+ if (content.dataType !== "moveObject") {
867
+ throw new Error("not an object");
868
+ }
869
+ if (!isProtocolFeeEvent(content.type)) {
870
+ throw new Error("object at ".concat(content.fields.id, " is not a ProtocolFeeEvent object"));
871
+ }
872
+ return ProtocolFeeEvent.fromFieldsWithTypes(content);
873
+ };
874
+ ProtocolFeeEvent.fromSuiObjectData = function (data) {
875
+ if (data.bcs) {
876
+ if (data.bcs.dataType !== "moveObject" || !isProtocolFeeEvent(data.bcs.type)) {
877
+ throw new Error("object at is not a ProtocolFeeEvent object");
878
+ }
879
+ return ProtocolFeeEvent.fromBcs((0, utils_1.fromB64)(data.bcs.bcsBytes));
880
+ }
881
+ if (data.content) {
882
+ return ProtocolFeeEvent.fromSuiParsedData(data.content);
883
+ }
884
+ throw new Error("Both `bcs` and `content` fields are missing from the data. Include `showBcs` or `showContent` in the request.");
885
+ };
886
+ ProtocolFeeEvent.fetch = function (client, id) {
887
+ return __awaiter(this, void 0, void 0, function () {
888
+ var res;
889
+ var _a, _b;
890
+ return __generator(this, function (_c) {
891
+ switch (_c.label) {
892
+ case 0: return [4 /*yield*/, client.getObject({ id: id, options: { showBcs: true } })];
893
+ case 1:
894
+ res = _c.sent();
895
+ if (res.error) {
896
+ throw new Error("error fetching ProtocolFeeEvent object at id ".concat(id, ": ").concat(res.error.code));
897
+ }
898
+ if (((_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.bcs) === null || _b === void 0 ? void 0 : _b.dataType) !== "moveObject" || !isProtocolFeeEvent(res.data.bcs.type)) {
899
+ throw new Error("object at id ".concat(id, " is not a ProtocolFeeEvent object"));
900
+ }
901
+ return [2 /*return*/, ProtocolFeeEvent.fromSuiObjectData(res.data)];
902
+ }
903
+ });
904
+ });
905
+ };
906
+ ProtocolFeeEvent.$typeName = "".concat(index_1.PKG_V1, "::admin::ProtocolFeeEvent");
907
+ ProtocolFeeEvent.$numTypeParams = 0;
908
+ ProtocolFeeEvent.$isPhantom = [];
909
+ return ProtocolFeeEvent;
910
+ }());
911
+ exports.ProtocolFeeEvent = ProtocolFeeEvent;
@@ -11,6 +11,7 @@ export declare function baseTokenMismatched(tx: Transaction): import("@mysten/su
11
11
  export declare function bidReceiptHasBeenExpired(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
12
12
  export declare function bidReceiptNotExpired(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
13
13
  export declare function bidReceiptNotItm(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
14
+ export declare function bidTokenMismatched(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
14
15
  export declare function collateralTokenTypeMismatched(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
15
16
  export declare function depositAmountInsufficient(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
16
17
  export declare function depositTokenMismatched(tx: Transaction): import("@mysten/sui/transactions").TransactionResult;
@@ -12,6 +12,7 @@ exports.baseTokenMismatched = baseTokenMismatched;
12
12
  exports.bidReceiptHasBeenExpired = bidReceiptHasBeenExpired;
13
13
  exports.bidReceiptNotExpired = bidReceiptNotExpired;
14
14
  exports.bidReceiptNotItm = bidReceiptNotItm;
15
+ exports.bidTokenMismatched = bidTokenMismatched;
15
16
  exports.collateralTokenTypeMismatched = collateralTokenTypeMismatched;
16
17
  exports.depositAmountInsufficient = depositAmountInsufficient;
17
18
  exports.depositTokenMismatched = depositTokenMismatched;
@@ -103,6 +104,9 @@ function bidReceiptNotExpired(tx) {
103
104
  function bidReceiptNotItm(tx) {
104
105
  return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::error::bid_receipt_not_itm"), arguments: [] });
105
106
  }
107
+ function bidTokenMismatched(tx) {
108
+ return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::error::bid_token_mismatched"), arguments: [] });
109
+ }
106
110
  function collateralTokenTypeMismatched(tx) {
107
111
  return tx.moveCall({ target: "".concat(__1.PUBLISHED_AT, "::error::collateral_token_type_mismatched"), arguments: [] });
108
112
  }
@@ -45,7 +45,7 @@ export declare class UnsettledBidReceipt implements StructClass {
45
45
  static reified(): UnsettledBidReceiptReified;
46
46
  static get r(): reified.StructClassReified<UnsettledBidReceipt, UnsettledBidReceiptFields>;
47
47
  static phantom(): PhantomReified<ToTypeStr<UnsettledBidReceipt>>;
48
- static get p(): reified.PhantomReified<"::escrow::UnsettledBidReceipt" | "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e::escrow::UnsettledBidReceipt">;
48
+ static get p(): reified.PhantomReified<"::escrow::UnsettledBidReceipt" | "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509::escrow::UnsettledBidReceipt">;
49
49
  static get bcs(): import("@mysten/sui/bcs").BcsType<{
50
50
  receipt: {
51
51
  id: {
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PKG_V1 = exports.PUBLISHED_AT = exports.PACKAGE_ID = void 0;
4
4
  var index_1 = require("../index");
5
- exports.PACKAGE_ID = index_1.NETWORK == "MAINNET" ? "" : "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e";
6
- exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e";
7
- exports.PKG_V1 = index_1.NETWORK == "MAINNET" ? "" : "0xac3919fd321e4c397a5c17d0cc01ed150a5e0f7d8c0f2b728fde3f5d719a2f0e";
5
+ exports.PACKAGE_ID = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
6
+ exports.PUBLISHED_AT = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
7
+ exports.PKG_V1 = index_1.NETWORK == "MAINNET" ? "" : "0x7c19f81d9d411e78305d7af8dad25317c56bb449fede8a78b6021232478f0509";
@@ -48,6 +48,7 @@ function registerClasses(loader) {
48
48
  loader.register(admin.FeeInfo);
49
49
  loader.register(admin.FeePool);
50
50
  loader.register(admin.SendFeeEvent);
51
+ loader.register(admin.ProtocolFeeEvent);
51
52
  loader.register(escrow.UnsettledBidReceipt);
52
53
  loader.register(treasuryCaps.TreasuryCaps);
53
54
  loader.register(tlp.LpRegistry);
@@ -85,7 +86,6 @@ function registerClasses(loader) {
85
86
  loader.register(position.OrderFilledEvent);
86
87
  loader.register(position.Position);
87
88
  loader.register(position.RealizeFundingEvent);
88
- loader.register(position.RealizedPnlEvent);
89
89
  loader.register(position.RemovePositionEvent);
90
90
  loader.register(position.TradingOrder);
91
91
  loader.register(trading.AddTradingSymbolEvent);
@@ -106,6 +106,7 @@ function registerClasses(loader) {
106
106
  loader.register(trading.Markets);
107
107
  loader.register(trading.MatchTradingOrderEvent);
108
108
  loader.register(trading.NewMarketsEvent);
109
+ loader.register(trading.RealizeOptionPositionEvent);
109
110
  loader.register(trading.ReleaseCollateralEvent);
110
111
  loader.register(trading.ResumeMarketEvent);
111
112
  loader.register(trading.ResumeTradingSymbolEvent);