@gmsol-labs/gmsol-sdk 0.5.0 → 0.6.0

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/README.md CHANGED
@@ -4,19 +4,23 @@
4
4
  [![Docs.rs](https://docs.rs/gmsol-sdk/badge.svg)](https://docs.rs/gmsol-sdk)
5
5
  [![npm](https://img.shields.io/npm/v/@gmsol-labs/gmsol-sdk.svg)](https://www.npmjs.com/package/@gmsol-labs/gmsol-sdk)
6
6
 
7
+ [Examples](https://github.com/gmsol-labs/gmx-solana/tree/main/examples)
8
+
7
9
  ## Audits
8
10
 
9
- | Program | Last Audit Date | Version |
10
- | ---------------- | --------------- | --------- |
11
- | [gmsol-store] | [2025-03-07] | [2a66761] |
12
- | [gmsol-treasury] | [2025-03-07] | [2a66761] |
13
- | [gmsol-timelock] | [2025-03-07] | [2a66761] |
11
+ | Program | Last Audit Date | Version |
12
+ | ------------------- | --------------- | --------- |
13
+ | [gmsol-store] | [2025-06-19] | [a5b38f3] |
14
+ | [gmsol-treasury] | [2025-06-19] | [a5b38f3] |
15
+ | [gmsol-timelock] | [2025-06-19] | [a5b38f3] |
16
+ | [gmsol-competition] | [2025-06-19] | [a5b38f3] |
14
17
 
15
- [gmsol-store]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-store
16
- [gmsol-treasury]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-treasury
17
- [gmsol-timelock]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/gmsol-timelock
18
- [2025-03-07]: https://github.com/gmsol-labs/gmx-solana-audits/blob/main/GMX_Solana_Audit_Report_Mar_7_2025_Zenith.pdf
19
- [2a66761]: https://github.com/gmsol-labs/gmx-solana/commit/2a66761d6573a6db6160a19fc3057e2091aebbfe
18
+ [gmsol-store]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/store
19
+ [gmsol-treasury]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/treasury
20
+ [gmsol-timelock]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/timelock
21
+ [gmsol-competition]: https://github.com/gmsol-labs/gmx-solana/tree/main/programs/competition
22
+ [2025-06-19]: https://github.com/gmsol-labs/gmx-solana-audits/blob/main/GMX_Solana_Audit_Report_June_19_2025_Zenith.pdf
23
+ [a5b38f3]: https://github.com/gmsol-labs/gmx-solana/commit/a5b38f3be9cc1acfe810bb9072e98c5ba8a12fbb
20
24
 
21
25
  ## Integration
22
26
 
@@ -26,7 +30,7 @@ Add the following to your `Cargo.toml`:
26
30
 
27
31
  ```toml
28
32
  [dependencies]
29
- gmsol-sdk = { version = "0.5.0", features = ["client"] }
33
+ gmsol-sdk = { version = "0.6.0", features = ["client"] }
30
34
  ```
31
35
 
32
36
  Create a `Client` and start using the core APIs:
@@ -71,8 +75,8 @@ Create a new Rust project and include `anchor_lang` and `bytemuck` as dependenci
71
75
 
72
76
  ```toml
73
77
  [dependencies]
74
- anchor-lang = "0.30.1"
75
- bytemuck = { version = "1.19.0", features = ["min_const_generics"] }
78
+ anchor-lang = "0.31.1"
79
+ bytemuck = { version = "1.19.0", features = ["min_const_generics", "derive"] }
76
80
  ```
77
81
 
78
82
  #### 2. Download and Store IDLs in `{PROJECT_ROOT}/idls/`
@@ -129,8 +133,8 @@ For a working implementation, check out the [gmx-solana-programs][gmx-solana-pro
129
133
  ### Prerequisites
130
134
 
131
135
  - [Rust](https://www.rust-lang.org/tools/install)
132
- - [Solana v1.18.26](https://docs.anza.xyz/cli/install)
133
- - [Anchor v0.30.1](https://www.anchor-lang.com/docs/installation)
136
+ - [Solana v2.1.21](https://docs.anza.xyz/cli/install)
137
+ - [Anchor v0.31.1](https://www.anchor-lang.com/docs/installation)
134
138
  - [Node](https://nodejs.org/en/download)
135
139
  - [Just](https://github.com/casey/just?tab=readme-ov-file#installation)
136
140
 
@@ -142,16 +146,22 @@ To run all tests:
142
146
  just
143
147
  ```
144
148
 
149
+ To use the `gmsol` CLI in development mode:
150
+
151
+ ```bash
152
+ just cli
153
+ ```
154
+
145
155
  To install the `gmsol` CLI:
146
156
 
147
157
  ```bash
148
- cargo install-gmsol
158
+ just install-cli
149
159
  ```
150
160
 
151
161
  Use the following command to verify the CLI is installed properly:
152
162
 
153
163
  ```bash
154
- gmsol --version
164
+ gmsol -V
155
165
  ```
156
166
 
157
167
  ### Troubleshooting
package/index.d.ts CHANGED
@@ -286,7 +286,7 @@ export interface MarketStatus {
286
286
  */
287
287
  pool_value_without_pnl_for_long: Value;
288
288
  /**
289
- * Pool avlue without pnl for short.
289
+ * Pool value without pnl for short.
290
290
  */
291
291
  pool_value_without_pnl_for_short: Value;
292
292
  /**
@@ -359,6 +359,28 @@ export interface Value {
359
359
  max: bigint;
360
360
  }
361
361
 
362
+ /**
363
+ * Callback.
364
+ */
365
+ export interface Callback {
366
+ /**
367
+ * Callback version.
368
+ */
369
+ version: number;
370
+ /**
371
+ * Callback program ID.
372
+ */
373
+ program: StringPubkey;
374
+ /**
375
+ * The address of shared data account.
376
+ */
377
+ shared_data: StringPubkey;
378
+ /**
379
+ * The address of partitioned data account.
380
+ */
381
+ partitioned_data: StringPubkey;
382
+ }
383
+
362
384
  /**
363
385
  * Hint for [`UpdateOrder`].
364
386
  */
@@ -367,6 +389,10 @@ export interface UpdateOrderHint {
367
389
  * Market token.
368
390
  */
369
391
  market_token: StringPubkey;
392
+ /**
393
+ * Callback.
394
+ */
395
+ callback: Callback | undefined;
370
396
  }
371
397
 
372
398
  /**
@@ -457,6 +483,10 @@ export interface CloseOrderHint {
457
483
  * `should_unwrap_native_token` flag.
458
484
  */
459
485
  should_unwrap_native_token: boolean;
486
+ /**
487
+ * Callback.
488
+ */
489
+ callback: Callback | undefined;
460
490
  }
461
491
 
462
492
  /**
@@ -551,6 +581,7 @@ export interface CreateOrder {
551
581
  * Whether to unwrap the native token when receiving (e.g., convert WSOL to SOL).
552
582
  */
553
583
  unwrap_native_on_receive?: boolean;
584
+ callback?: Callback | undefined;
554
585
  }
555
586
 
556
587
  /**
@@ -630,17 +661,37 @@ export interface StoreProgram {
630
661
  */
631
662
  export type PnlFactorKind = "max_after_deposit" | "max_after_withdrawal" | "max_for_trader" | "for_adl" | "min_after_adl";
632
663
 
664
+ /**
665
+ * A (twisted) ElGamal encryption keypair.
666
+ *
667
+ * The instances of the secret key are zeroized on drop.
668
+ */
669
+ export class ElGamalKeypair {
670
+ private constructor();
671
+ free(): void;
672
+ /**
673
+ * Generates the public and secret keys for ElGamal encryption.
674
+ *
675
+ * This function is randomized. It internally samples a scalar element using `OsRng`.
676
+ */
677
+ static new_rand(): ElGamalKeypair;
678
+ pubkey_owned(): ElGamalPubkey;
679
+ }
680
+ /**
681
+ * Public key for the ElGamal encryption scheme.
682
+ */
683
+ export class ElGamalPubkey {
684
+ private constructor();
685
+ free(): void;
686
+ }
633
687
  /**
634
688
  * A hash; the 32-byte output of a hashing algorithm.
635
689
  *
636
690
  * This struct is used most often in `solana-sdk` and related crates to contain
637
- * a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
638
- * [`blake3`] module (and used in [`Message::hash`]).
691
+ * a [SHA-256] hash, but may instead contain a [blake3] hash.
639
692
  *
640
693
  * [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
641
694
  * [blake3]: https://github.com/BLAKE3-team/BLAKE3
642
- * [`blake3`]: crate::blake3
643
- * [`Message::hash`]: crate::message::Message::hash
644
695
  */
645
696
  export class Hash {
646
697
  free(): void;
@@ -664,65 +715,9 @@ export class Hash {
664
715
  toBytes(): Uint8Array;
665
716
  }
666
717
  /**
667
- * A directive for a single invocation of a Solana program.
668
- *
669
- * An instruction specifies which program it is calling, which accounts it may
670
- * read or modify, and additional data that serves as input to the program. One
671
- * or more instructions are included in transactions submitted by Solana
672
- * clients. Instructions are also used to describe [cross-program
673
- * invocations][cpi].
674
- *
675
- * [cpi]: https://solana.com/docs/core/cpi
676
- *
677
- * During execution, a program will receive a list of account data as one of
678
- * its arguments, in the same order as specified during `Instruction`
679
- * construction.
680
- *
681
- * While Solana is agnostic to the format of the instruction data, it has
682
- * built-in support for serialization via [`borsh`] and [`bincode`].
683
- *
684
- * [`borsh`]: https://docs.rs/borsh/latest/borsh/
685
- * [`bincode`]: https://docs.rs/bincode/latest/bincode/
686
- *
687
- * # Specifying account metadata
688
- *
689
- * When constructing an [`Instruction`], a list of all accounts that may be
690
- * read or written during the execution of that instruction must be supplied as
691
- * [`AccountMeta`] values.
692
- *
693
- * Any account whose data may be mutated by the program during execution must
694
- * be specified as writable. During execution, writing to an account that was
695
- * not specified as writable will cause the transaction to fail. Writing to an
696
- * account that is not owned by the program will cause the transaction to fail.
697
- *
698
- * Any account whose lamport balance may be mutated by the program during
699
- * execution must be specified as writable. During execution, mutating the
700
- * lamports of an account that was not specified as writable will cause the
701
- * transaction to fail. While _subtracting_ lamports from an account not owned
702
- * by the program will cause the transaction to fail, _adding_ lamports to any
703
- * account is allowed, as long is it is mutable.
704
- *
705
- * Accounts that are not read or written by the program may still be specified
706
- * in an `Instruction`'s account list. These will affect scheduling of program
707
- * execution by the runtime, but will otherwise be ignored.
708
- *
709
- * When building a transaction, the Solana runtime coalesces all accounts used
710
- * by all instructions in that transaction, along with accounts and permissions
711
- * required by the runtime, into a single account list. Some accounts and
712
- * account permissions required by the runtime to process a transaction are
713
- * _not_ required to be included in an `Instruction`s account list. These
714
- * include:
715
- *
716
- * - The program ID — it is a separate field of `Instruction`
717
- * - The transaction's fee-paying account — it is added during [`Message`]
718
- * construction. A program may still require the fee payer as part of the
719
- * account list if it directly references it.
720
- *
721
- * [`Message`]: crate::message::Message
722
- *
723
- * Programs may require signatures from some accounts, in which case they
724
- * should be specified as signers during `Instruction` construction. The
725
- * program must still validate during execution that the account is a signer.
718
+ * wasm-bindgen version of the Instruction struct.
719
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
720
+ * is fixed. This must not diverge from the regular non-wasm Instruction struct.
726
721
  */
727
722
  export class Instruction {
728
723
  private constructor();
@@ -791,7 +786,7 @@ export class Market {
791
786
  short_token_address(): string;
792
787
  }
793
788
  /**
794
- * A JS binding for [`MarkegGraph`].
789
+ * A JS binding for [`MarketGraph`].
795
790
  */
796
791
  export class MarketGraph {
797
792
  free(): void;
@@ -852,20 +847,9 @@ export class MarketModel {
852
847
  status(params: MarketStatusParams): MarketStatus;
853
848
  }
854
849
  /**
855
- * A Solana transaction message (legacy).
856
- *
857
- * See the [`message`] module documentation for further description.
858
- *
859
- * [`message`]: crate::message
860
- *
861
- * Some constructors accept an optional `payer`, the account responsible for
862
- * paying the cost of executing a transaction. In most cases, callers should
863
- * specify the payer explicitly in these constructors. In some cases though,
864
- * the caller is not _required_ to specify the payer, but is still allowed to:
865
- * in the `Message` structure, the first account is always the fee-payer, so if
866
- * the caller has knowledge that the first account of the constructed
867
- * transaction's `Message` is both a signer and the expected fee-payer, then
868
- * redundantly specifying the fee-payer is not strictly required.
850
+ * wasm-bindgen version of the Message struct.
851
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
852
+ * is fixed. This must not diverge from the regular non-wasm Message struct.
869
853
  */
870
854
  export class Message {
871
855
  private constructor();
@@ -875,6 +859,32 @@ export class Message {
875
859
  */
876
860
  recent_blockhash: Hash;
877
861
  }
862
+ /**
863
+ * The `ElGamalPubkey` type as a `Pod`.
864
+ */
865
+ export class PodElGamalPubkey {
866
+ free(): void;
867
+ /**
868
+ * Create a new `PodElGamalPubkey` object
869
+ *
870
+ * * `value` - optional public key as a base64 encoded string, `Uint8Array`, `[number]`
871
+ */
872
+ constructor(value: any);
873
+ /**
874
+ * Return the base64 string representation of the public key
875
+ */
876
+ toString(): string;
877
+ /**
878
+ * Checks if two `ElGamalPubkey`s are equal
879
+ */
880
+ equals(other: PodElGamalPubkey): boolean;
881
+ /**
882
+ * Return the `Uint8Array` representation of the public key
883
+ */
884
+ toBytes(): Uint8Array;
885
+ static compressed(decoded: ElGamalPubkey): PodElGamalPubkey;
886
+ decompressed(): ElGamalPubkey;
887
+ }
878
888
  /**
879
889
  * JS version of [`Position`].
880
890
  */
@@ -970,26 +980,9 @@ export class Pubkey {
970
980
  static findProgramAddress(seeds: any[], program_id: Pubkey): any;
971
981
  }
972
982
  /**
973
- * An atomically-committed sequence of instructions.
974
- *
975
- * While [`Instruction`]s are the basic unit of computation in Solana,
976
- * they are submitted by clients in [`Transaction`]s containing one or
977
- * more instructions, and signed by one or more [`Signer`]s.
978
- *
979
- * [`Signer`]: crate::signer::Signer
980
- *
981
- * See the [module documentation] for more details about transactions.
982
- *
983
- * [module documentation]: self
984
- *
985
- * Some constructors accept an optional `payer`, the account responsible for
986
- * paying the cost of executing a transaction. In most cases, callers should
987
- * specify the payer explicitly in these constructors. In some cases though,
988
- * the caller is not _required_ to specify the payer, but is still allowed to:
989
- * in the [`Message`] structure, the first account is always the fee-payer, so
990
- * if the caller has knowledge that the first account of the constructed
991
- * transaction's `Message` is both a signer and the expected fee-payer, then
992
- * redundantly specifying the fee-payer is not strictly required.
983
+ * wasm-bindgen version of the Transaction struct.
984
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
985
+ * is fixed. This must not diverge from the regular non-wasm Transaction struct.
993
986
  */
994
987
  export class Transaction {
995
988
  free(): void;
package/index_bg.js CHANGED
@@ -287,6 +287,83 @@ export function solana_program_init() {
287
287
  wasm.solana_program_init();
288
288
  }
289
289
 
290
+ const ElGamalKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
291
+ ? { register: () => {}, unregister: () => {} }
292
+ : new FinalizationRegistry(ptr => wasm.__wbg_elgamalkeypair_free(ptr >>> 0, 1));
293
+ /**
294
+ * A (twisted) ElGamal encryption keypair.
295
+ *
296
+ * The instances of the secret key are zeroized on drop.
297
+ */
298
+ export class ElGamalKeypair {
299
+
300
+ static __wrap(ptr) {
301
+ ptr = ptr >>> 0;
302
+ const obj = Object.create(ElGamalKeypair.prototype);
303
+ obj.__wbg_ptr = ptr;
304
+ ElGamalKeypairFinalization.register(obj, obj.__wbg_ptr, obj);
305
+ return obj;
306
+ }
307
+
308
+ __destroy_into_raw() {
309
+ const ptr = this.__wbg_ptr;
310
+ this.__wbg_ptr = 0;
311
+ ElGamalKeypairFinalization.unregister(this);
312
+ return ptr;
313
+ }
314
+
315
+ free() {
316
+ const ptr = this.__destroy_into_raw();
317
+ wasm.__wbg_elgamalkeypair_free(ptr, 0);
318
+ }
319
+ /**
320
+ * Generates the public and secret keys for ElGamal encryption.
321
+ *
322
+ * This function is randomized. It internally samples a scalar element using `OsRng`.
323
+ * @returns {ElGamalKeypair}
324
+ */
325
+ static new_rand() {
326
+ const ret = wasm.elgamalkeypair_new_rand();
327
+ return ElGamalKeypair.__wrap(ret);
328
+ }
329
+ /**
330
+ * @returns {ElGamalPubkey}
331
+ */
332
+ pubkey_owned() {
333
+ const ret = wasm.elgamalkeypair_pubkey_owned(this.__wbg_ptr);
334
+ return ElGamalPubkey.__wrap(ret);
335
+ }
336
+ }
337
+
338
+ const ElGamalPubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
339
+ ? { register: () => {}, unregister: () => {} }
340
+ : new FinalizationRegistry(ptr => wasm.__wbg_elgamalpubkey_free(ptr >>> 0, 1));
341
+ /**
342
+ * Public key for the ElGamal encryption scheme.
343
+ */
344
+ export class ElGamalPubkey {
345
+
346
+ static __wrap(ptr) {
347
+ ptr = ptr >>> 0;
348
+ const obj = Object.create(ElGamalPubkey.prototype);
349
+ obj.__wbg_ptr = ptr;
350
+ ElGamalPubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
351
+ return obj;
352
+ }
353
+
354
+ __destroy_into_raw() {
355
+ const ptr = this.__wbg_ptr;
356
+ this.__wbg_ptr = 0;
357
+ ElGamalPubkeyFinalization.unregister(this);
358
+ return ptr;
359
+ }
360
+
361
+ free() {
362
+ const ptr = this.__destroy_into_raw();
363
+ wasm.__wbg_elgamalpubkey_free(ptr, 0);
364
+ }
365
+ }
366
+
290
367
  const HashFinalization = (typeof FinalizationRegistry === 'undefined')
291
368
  ? { register: () => {}, unregister: () => {} }
292
369
  : new FinalizationRegistry(ptr => wasm.__wbg_hash_free(ptr >>> 0, 1));
@@ -294,13 +371,10 @@ const HashFinalization = (typeof FinalizationRegistry === 'undefined')
294
371
  * A hash; the 32-byte output of a hashing algorithm.
295
372
  *
296
373
  * This struct is used most often in `solana-sdk` and related crates to contain
297
- * a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
298
- * [`blake3`] module (and used in [`Message::hash`]).
374
+ * a [SHA-256] hash, but may instead contain a [blake3] hash.
299
375
  *
300
376
  * [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
301
377
  * [blake3]: https://github.com/BLAKE3-team/BLAKE3
302
- * [`blake3`]: crate::blake3
303
- * [`Message::hash`]: crate::message::Message::hash
304
378
  */
305
379
  export class Hash {
306
380
 
@@ -380,65 +454,9 @@ const InstructionFinalization = (typeof FinalizationRegistry === 'undefined')
380
454
  ? { register: () => {}, unregister: () => {} }
381
455
  : new FinalizationRegistry(ptr => wasm.__wbg_instruction_free(ptr >>> 0, 1));
382
456
  /**
383
- * A directive for a single invocation of a Solana program.
384
- *
385
- * An instruction specifies which program it is calling, which accounts it may
386
- * read or modify, and additional data that serves as input to the program. One
387
- * or more instructions are included in transactions submitted by Solana
388
- * clients. Instructions are also used to describe [cross-program
389
- * invocations][cpi].
390
- *
391
- * [cpi]: https://solana.com/docs/core/cpi
392
- *
393
- * During execution, a program will receive a list of account data as one of
394
- * its arguments, in the same order as specified during `Instruction`
395
- * construction.
396
- *
397
- * While Solana is agnostic to the format of the instruction data, it has
398
- * built-in support for serialization via [`borsh`] and [`bincode`].
399
- *
400
- * [`borsh`]: https://docs.rs/borsh/latest/borsh/
401
- * [`bincode`]: https://docs.rs/bincode/latest/bincode/
402
- *
403
- * # Specifying account metadata
404
- *
405
- * When constructing an [`Instruction`], a list of all accounts that may be
406
- * read or written during the execution of that instruction must be supplied as
407
- * [`AccountMeta`] values.
408
- *
409
- * Any account whose data may be mutated by the program during execution must
410
- * be specified as writable. During execution, writing to an account that was
411
- * not specified as writable will cause the transaction to fail. Writing to an
412
- * account that is not owned by the program will cause the transaction to fail.
413
- *
414
- * Any account whose lamport balance may be mutated by the program during
415
- * execution must be specified as writable. During execution, mutating the
416
- * lamports of an account that was not specified as writable will cause the
417
- * transaction to fail. While _subtracting_ lamports from an account not owned
418
- * by the program will cause the transaction to fail, _adding_ lamports to any
419
- * account is allowed, as long is it is mutable.
420
- *
421
- * Accounts that are not read or written by the program may still be specified
422
- * in an `Instruction`'s account list. These will affect scheduling of program
423
- * execution by the runtime, but will otherwise be ignored.
424
- *
425
- * When building a transaction, the Solana runtime coalesces all accounts used
426
- * by all instructions in that transaction, along with accounts and permissions
427
- * required by the runtime, into a single account list. Some accounts and
428
- * account permissions required by the runtime to process a transaction are
429
- * _not_ required to be included in an `Instruction`s account list. These
430
- * include:
431
- *
432
- * - The program ID — it is a separate field of `Instruction`
433
- * - The transaction's fee-paying account — it is added during [`Message`]
434
- * construction. A program may still require the fee payer as part of the
435
- * account list if it directly references it.
436
- *
437
- * [`Message`]: crate::message::Message
438
- *
439
- * Programs may require signatures from some accounts, in which case they
440
- * should be specified as signers during `Instruction` construction. The
441
- * program must still validate during execution that the account is a signer.
457
+ * wasm-bindgen version of the Instruction struct.
458
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
459
+ * is fixed. This must not diverge from the regular non-wasm Instruction struct.
442
460
  */
443
461
  export class Instruction {
444
462
 
@@ -700,7 +718,7 @@ const MarketGraphFinalization = (typeof FinalizationRegistry === 'undefined')
700
718
  ? { register: () => {}, unregister: () => {} }
701
719
  : new FinalizationRegistry(ptr => wasm.__wbg_marketgraph_free(ptr >>> 0, 1));
702
720
  /**
703
- * A JS binding for [`MarkegGraph`].
721
+ * A JS binding for [`MarketGraph`].
704
722
  */
705
723
  export class MarketGraph {
706
724
 
@@ -885,20 +903,9 @@ const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
885
903
  ? { register: () => {}, unregister: () => {} }
886
904
  : new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
887
905
  /**
888
- * A Solana transaction message (legacy).
889
- *
890
- * See the [`message`] module documentation for further description.
891
- *
892
- * [`message`]: crate::message
893
- *
894
- * Some constructors accept an optional `payer`, the account responsible for
895
- * paying the cost of executing a transaction. In most cases, callers should
896
- * specify the payer explicitly in these constructors. In some cases though,
897
- * the caller is not _required_ to specify the payer, but is still allowed to:
898
- * in the `Message` structure, the first account is always the fee-payer, so if
899
- * the caller has knowledge that the first account of the constructed
900
- * transaction's `Message` is both a signer and the expected fee-payer, then
901
- * redundantly specifying the fee-payer is not strictly required.
906
+ * wasm-bindgen version of the Message struct.
907
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
908
+ * is fixed. This must not diverge from the regular non-wasm Message struct.
902
909
  */
903
910
  export class Message {
904
911
 
@@ -940,6 +947,105 @@ export class Message {
940
947
  }
941
948
  }
942
949
 
950
+ const PodElGamalPubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
951
+ ? { register: () => {}, unregister: () => {} }
952
+ : new FinalizationRegistry(ptr => wasm.__wbg_podelgamalpubkey_free(ptr >>> 0, 1));
953
+ /**
954
+ * The `ElGamalPubkey` type as a `Pod`.
955
+ */
956
+ export class PodElGamalPubkey {
957
+
958
+ static __wrap(ptr) {
959
+ ptr = ptr >>> 0;
960
+ const obj = Object.create(PodElGamalPubkey.prototype);
961
+ obj.__wbg_ptr = ptr;
962
+ PodElGamalPubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
963
+ return obj;
964
+ }
965
+
966
+ __destroy_into_raw() {
967
+ const ptr = this.__wbg_ptr;
968
+ this.__wbg_ptr = 0;
969
+ PodElGamalPubkeyFinalization.unregister(this);
970
+ return ptr;
971
+ }
972
+
973
+ free() {
974
+ const ptr = this.__destroy_into_raw();
975
+ wasm.__wbg_podelgamalpubkey_free(ptr, 0);
976
+ }
977
+ /**
978
+ * Create a new `PodElGamalPubkey` object
979
+ *
980
+ * * `value` - optional public key as a base64 encoded string, `Uint8Array`, `[number]`
981
+ * @param {any} value
982
+ */
983
+ constructor(value) {
984
+ const ret = wasm.podelgamalpubkey_constructor(value);
985
+ if (ret[2]) {
986
+ throw takeFromExternrefTable0(ret[1]);
987
+ }
988
+ this.__wbg_ptr = ret[0] >>> 0;
989
+ PodElGamalPubkeyFinalization.register(this, this.__wbg_ptr, this);
990
+ return this;
991
+ }
992
+ /**
993
+ * Return the base64 string representation of the public key
994
+ * @returns {string}
995
+ */
996
+ toString() {
997
+ let deferred1_0;
998
+ let deferred1_1;
999
+ try {
1000
+ const ret = wasm.podelgamalpubkey_toString(this.__wbg_ptr);
1001
+ deferred1_0 = ret[0];
1002
+ deferred1_1 = ret[1];
1003
+ return getStringFromWasm0(ret[0], ret[1]);
1004
+ } finally {
1005
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1006
+ }
1007
+ }
1008
+ /**
1009
+ * Checks if two `ElGamalPubkey`s are equal
1010
+ * @param {PodElGamalPubkey} other
1011
+ * @returns {boolean}
1012
+ */
1013
+ equals(other) {
1014
+ _assertClass(other, PodElGamalPubkey);
1015
+ const ret = wasm.podelgamalpubkey_equals(this.__wbg_ptr, other.__wbg_ptr);
1016
+ return ret !== 0;
1017
+ }
1018
+ /**
1019
+ * Return the `Uint8Array` representation of the public key
1020
+ * @returns {Uint8Array}
1021
+ */
1022
+ toBytes() {
1023
+ const ret = wasm.podelgamalpubkey_toBytes(this.__wbg_ptr);
1024
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1025
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1026
+ return v1;
1027
+ }
1028
+ /**
1029
+ * @param {ElGamalPubkey} decoded
1030
+ * @returns {PodElGamalPubkey}
1031
+ */
1032
+ static compressed(decoded) {
1033
+ _assertClass(decoded, ElGamalPubkey);
1034
+ const ret = wasm.podelgamalpubkey_compressed(decoded.__wbg_ptr);
1035
+ return PodElGamalPubkey.__wrap(ret);
1036
+ }
1037
+ /**
1038
+ * @returns {ElGamalPubkey}
1039
+ */
1040
+ decompressed() {
1041
+ const ret = wasm.podelgamalpubkey_decompressed(this.__wbg_ptr);
1042
+ if (ret[2]) {
1043
+ throw takeFromExternrefTable0(ret[1]);
1044
+ }
1045
+ return ElGamalPubkey.__wrap(ret[0]);
1046
+ }
1047
+ }
1048
+
943
1049
  const PositionFinalization = (typeof FinalizationRegistry === 'undefined')
944
1050
  ? { register: () => {}, unregister: () => {} }
945
1051
  : new FinalizationRegistry(ptr => wasm.__wbg_position_free(ptr >>> 0, 1));
@@ -1147,7 +1253,7 @@ export class Pubkey {
1147
1253
  */
1148
1254
  equals(other) {
1149
1255
  _assertClass(other, Pubkey);
1150
- const ret = wasm.hash_equals(this.__wbg_ptr, other.__wbg_ptr);
1256
+ const ret = wasm.pubkey_equals(this.__wbg_ptr, other.__wbg_ptr);
1151
1257
  return ret !== 0;
1152
1258
  }
1153
1259
  /**
@@ -1410,26 +1516,9 @@ const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
1410
1516
  ? { register: () => {}, unregister: () => {} }
1411
1517
  : new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
1412
1518
  /**
1413
- * An atomically-committed sequence of instructions.
1414
- *
1415
- * While [`Instruction`]s are the basic unit of computation in Solana,
1416
- * they are submitted by clients in [`Transaction`]s containing one or
1417
- * more instructions, and signed by one or more [`Signer`]s.
1418
- *
1419
- * [`Signer`]: crate::signer::Signer
1420
- *
1421
- * See the [module documentation] for more details about transactions.
1422
- *
1423
- * [module documentation]: self
1424
- *
1425
- * Some constructors accept an optional `payer`, the account responsible for
1426
- * paying the cost of executing a transaction. In most cases, callers should
1427
- * specify the payer explicitly in these constructors. In some cases though,
1428
- * the caller is not _required_ to specify the payer, but is still allowed to:
1429
- * in the [`Message`] structure, the first account is always the fee-payer, so
1430
- * if the caller has knowledge that the first account of the constructed
1431
- * transaction's `Message` is both a signer and the expected fee-payer, then
1432
- * redundantly specifying the fee-payer is not strictly required.
1519
+ * wasm-bindgen version of the Transaction struct.
1520
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
1521
+ * is fixed. This must not diverge from the regular non-wasm Transaction struct.
1433
1522
  */
1434
1523
  export class Transaction {
1435
1524
 
@@ -1744,11 +1833,21 @@ export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg
1744
1833
  return ret;
1745
1834
  }, arguments) };
1746
1835
 
1836
+ export function __wbg_call_7cccdd69e0791ae2() { return handleError(function (arg0, arg1, arg2) {
1837
+ const ret = arg0.call(arg1, arg2);
1838
+ return ret;
1839
+ }, arguments) };
1840
+
1747
1841
  export function __wbg_crypto_038798f665f985e2(arg0) {
1748
1842
  const ret = arg0.crypto;
1749
1843
  return ret;
1750
1844
  };
1751
1845
 
1846
+ export function __wbg_crypto_574e78ad8b13b65f(arg0) {
1847
+ const ret = arg0.crypto;
1848
+ return ret;
1849
+ };
1850
+
1752
1851
  export function __wbg_debug_3cb59063b29f58c1(arg0) {
1753
1852
  console.debug(arg0);
1754
1853
  };
@@ -1788,6 +1887,10 @@ export function __wbg_getRandomValues_7dfe5bd1b67c9ca1(arg0) {
1788
1887
  return ret;
1789
1888
  };
1790
1889
 
1890
+ export function __wbg_getRandomValues_b8f5dbd5f3995a9e() { return handleError(function (arg0, arg1) {
1891
+ arg0.getRandomValues(arg1);
1892
+ }, arguments) };
1893
+
1791
1894
  export function __wbg_getTime_46267b1c24877e30(arg0) {
1792
1895
  const ret = arg0.getTime();
1793
1896
  return ret;
@@ -1868,6 +1971,11 @@ export function __wbg_log_c222819a41e063d3(arg0) {
1868
1971
  console.log(arg0);
1869
1972
  };
1870
1973
 
1974
+ export function __wbg_msCrypto_a61aeb35a24c1329(arg0) {
1975
+ const ret = arg0.msCrypto;
1976
+ return ret;
1977
+ };
1978
+
1871
1979
  export function __wbg_msCrypto_ff35fce085fab2a3(arg0) {
1872
1980
  const ret = arg0.msCrypto;
1873
1981
  return ret;
@@ -1898,6 +2006,16 @@ export function __wbg_new_a12002a7f91c75be(arg0) {
1898
2006
  return ret;
1899
2007
  };
1900
2008
 
2009
+ export function __wbg_newnoargs_105ed471475aaf50(arg0, arg1) {
2010
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
2011
+ return ret;
2012
+ };
2013
+
2014
+ export function __wbg_newwithbyteoffsetandlength_d97e637ebe145a9a(arg0, arg1, arg2) {
2015
+ const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0);
2016
+ return ret;
2017
+ };
2018
+
1901
2019
  export function __wbg_newwithlength_a381634e90c276d4(arg0) {
1902
2020
  const ret = new Uint8Array(arg0 >>> 0);
1903
2021
  return ret;
@@ -1918,6 +2036,16 @@ export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg
1918
2036
  return ret;
1919
2037
  }, arguments) };
1920
2038
 
2039
+ export function __wbg_node_905d3e251edff8a2(arg0) {
2040
+ const ret = arg0.node;
2041
+ return ret;
2042
+ };
2043
+
2044
+ export function __wbg_process_dc0fbacc7c1c06f7(arg0) {
2045
+ const ret = arg0.process;
2046
+ return ret;
2047
+ };
2048
+
1921
2049
  export function __wbg_pubkey_new(arg0) {
1922
2050
  const ret = Pubkey.__wrap(arg0);
1923
2051
  return ret;
@@ -1932,11 +2060,20 @@ export function __wbg_randomFillSync_994ac6d9ade7a695(arg0, arg1, arg2) {
1932
2060
  arg0.randomFillSync(getArrayU8FromWasm0(arg1, arg2));
1933
2061
  };
1934
2062
 
2063
+ export function __wbg_randomFillSync_ac0988aba3254290() { return handleError(function (arg0, arg1) {
2064
+ arg0.randomFillSync(arg1);
2065
+ }, arguments) };
2066
+
1935
2067
  export function __wbg_require_0d6aeaec3c042c88(arg0, arg1, arg2) {
1936
2068
  const ret = arg0.require(getStringFromWasm0(arg1, arg2));
1937
2069
  return ret;
1938
2070
  };
1939
2071
 
2072
+ export function __wbg_require_60cc747a6bc5215a() { return handleError(function () {
2073
+ const ret = module.require;
2074
+ return ret;
2075
+ }, arguments) };
2076
+
1940
2077
  export function __wbg_self_25aabeb5a7b41685() { return handleError(function () {
1941
2078
  const ret = self.self;
1942
2079
  return ret;
@@ -1962,11 +2099,31 @@ export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
1962
2099
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1963
2100
  };
1964
2101
 
2102
+ export function __wbg_static_accessor_GLOBAL_88a902d13a557d07() {
2103
+ const ret = typeof global === 'undefined' ? null : global;
2104
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2105
+ };
2106
+
2107
+ export function __wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0() {
2108
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
2109
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2110
+ };
2111
+
1965
2112
  export function __wbg_static_accessor_MODULE_ef3aa2eb251158a5() {
1966
2113
  const ret = module;
1967
2114
  return ret;
1968
2115
  };
1969
2116
 
2117
+ export function __wbg_static_accessor_SELF_37c5d418e4bf5819() {
2118
+ const ret = typeof self === 'undefined' ? null : self;
2119
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2120
+ };
2121
+
2122
+ export function __wbg_static_accessor_WINDOW_5de37043a91a9c40() {
2123
+ const ret = typeof window === 'undefined' ? null : window;
2124
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
2125
+ };
2126
+
1970
2127
  export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
1971
2128
  const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1972
2129
  return ret;
@@ -1982,6 +2139,11 @@ export function __wbg_values_99f7a68c7f313d66(arg0) {
1982
2139
  return ret;
1983
2140
  };
1984
2141
 
2142
+ export function __wbg_versions_c01dfd4722a88165(arg0) {
2143
+ const ret = arg0.versions;
2144
+ return ret;
2145
+ };
2146
+
1985
2147
  export function __wbg_warn_4ca3906c248c47c4(arg0) {
1986
2148
  console.warn(arg0);
1987
2149
  };
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.5.0",
5
+ "version": "0.6.0",
6
6
  "license": "SEE LICENSE IN ../../LICENSE",
7
7
  "repository": {
8
8
  "type": "git",