@gmsol-labs/gmsol-sdk 0.9.0-alpha.0 → 0.9.0-test.2

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/index.d.ts CHANGED
@@ -66,6 +66,16 @@ export interface MarketStatusParams {
66
66
  prices: Prices;
67
67
  }
68
68
 
69
+ /**
70
+ * Params for calculating max sellable avlue.
71
+ */
72
+ export interface MaxSellableValueParams {
73
+ /**
74
+ * Prices.
75
+ */
76
+ prices: Prices;
77
+ }
78
+
69
79
  /**
70
80
  * Parameters for creating empty position model.
71
81
  */
@@ -390,6 +400,22 @@ export interface SimulateShiftArgs {
390
400
  params: CreateShiftParamsJs;
391
401
  }
392
402
 
403
+ /**
404
+ * Arguments for GLV status calculations.
405
+ */
406
+ export interface GetGlvStatusArgs {
407
+ glv_token: StringPubkey;
408
+ }
409
+
410
+ /**
411
+ * Arguments for GLV status calculations.
412
+ */
413
+ export interface GetGlvTokenValueArgs {
414
+ glv_token: StringPubkey;
415
+ amount: bigint;
416
+ maximize: boolean;
417
+ }
418
+
393
419
  /**
394
420
  * Arguments for withdrawal simulation.
395
421
  */
@@ -470,6 +496,20 @@ export interface Prices {
470
496
  short_token: Value;
471
497
  }
472
498
 
499
+ /**
500
+ * GLV Status.
501
+ */
502
+ export interface GlvStatus {
503
+ /**
504
+ * The estimated max sellable value in the GLV.
505
+ */
506
+ max_sellable_value: bigint;
507
+ /**
508
+ * The estimated total GLV value.
509
+ */
510
+ total_value: Value;
511
+ }
512
+
473
513
  /**
474
514
  * Position Status.
475
515
  */
@@ -1948,6 +1988,10 @@ export class MarketModel {
1948
1988
  * Get market token price.
1949
1989
  */
1950
1990
  market_token_price(params: MarketTokenPriceParams): bigint;
1991
+ /**
1992
+ * Calculates max sellable value.
1993
+ */
1994
+ max_sellable_value(params: MaxSellableValueParams): bigint;
1951
1995
  /**
1952
1996
  * Get market status.
1953
1997
  */
@@ -2214,6 +2258,14 @@ export class Simulator {
2214
2258
  * Create a clone of this simulator.
2215
2259
  */
2216
2260
  clone(): Simulator;
2261
+ /**
2262
+ * Calculates GLV status.
2263
+ */
2264
+ get_glv_status(args: GetGlvStatusArgs): GlvStatus;
2265
+ /**
2266
+ * Calculates GLV token value.
2267
+ */
2268
+ get_glv_token_value(args: GetGlvTokenValueArgs): bigint;
2217
2269
  }
2218
2270
  /**
2219
2271
  * JS version of [`TradeEvent`].
package/index_bg.js CHANGED
@@ -1854,6 +1854,18 @@ export class MarketModel {
1854
1854
  }
1855
1855
  return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1856
1856
  }
1857
+ /**
1858
+ * Calculates max sellable value.
1859
+ * @param {MaxSellableValueParams} params
1860
+ * @returns {bigint}
1861
+ */
1862
+ max_sellable_value(params) {
1863
+ const ret = wasm.marketmodel_max_sellable_value(this.__wbg_ptr, params);
1864
+ if (ret[3]) {
1865
+ throw takeFromExternrefTable0(ret[2]);
1866
+ }
1867
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1868
+ }
1857
1869
  /**
1858
1870
  * Get market status.
1859
1871
  * @param {MarketStatusParams} params
@@ -2709,6 +2721,30 @@ export class Simulator {
2709
2721
  const ret = wasm.simulator_clone(this.__wbg_ptr);
2710
2722
  return Simulator.__wrap(ret);
2711
2723
  }
2724
+ /**
2725
+ * Calculates GLV status.
2726
+ * @param {GetGlvStatusArgs} args
2727
+ * @returns {GlvStatus}
2728
+ */
2729
+ get_glv_status(args) {
2730
+ const ret = wasm.simulator_get_glv_status(this.__wbg_ptr, args);
2731
+ if (ret[2]) {
2732
+ throw takeFromExternrefTable0(ret[1]);
2733
+ }
2734
+ return takeFromExternrefTable0(ret[0]);
2735
+ }
2736
+ /**
2737
+ * Calculates GLV token value.
2738
+ * @param {GetGlvTokenValueArgs} args
2739
+ * @returns {bigint}
2740
+ */
2741
+ get_glv_token_value(args) {
2742
+ const ret = wasm.simulator_get_glv_token_value(this.__wbg_ptr, args);
2743
+ if (ret[3]) {
2744
+ throw takeFromExternrefTable0(ret[2]);
2745
+ }
2746
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
2747
+ }
2712
2748
  }
2713
2749
 
2714
2750
  const SystemInstructionFinalization = (typeof FinalizationRegistry === 'undefined')
package/index_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gmsol-labs/gmsol-sdk",
3
3
  "type": "module",
4
4
  "description": "GMX-Solana is an extension of GMX on the Solana blockchain.",
5
- "version": "0.9.0-alpha.0",
5
+ "version": "0.9.0-test.2",
6
6
  "license": "SEE LICENSE IN ../../LICENSE",
7
7
  "repository": {
8
8
  "type": "git",