@gmsol-labs/gmsol-sdk 0.8.0 → 0.9.0-alpha.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.
package/index_bg.js CHANGED
@@ -287,6 +287,156 @@ export function update_orders(args) {
287
287
  return TransactionGroup.__wrap(ret[0]);
288
288
  }
289
289
 
290
+ /**
291
+ * @param {CreateDepositParamsJs[]} deposits
292
+ * @param {CreateDepositOptions} options
293
+ * @returns {CreateDepositsBuilder}
294
+ */
295
+ export function create_deposits_builder(deposits, options) {
296
+ const ptr0 = passArrayJsValueToWasm0(deposits, wasm.__wbindgen_malloc);
297
+ const len0 = WASM_VECTOR_LEN;
298
+ const ret = wasm.create_deposits_builder(ptr0, len0, options);
299
+ if (ret[2]) {
300
+ throw takeFromExternrefTable0(ret[1]);
301
+ }
302
+ return CreateDepositsBuilder.__wrap(ret[0]);
303
+ }
304
+
305
+ /**
306
+ * @param {CreateDepositParamsJs[]} deposits
307
+ * @param {CreateDepositOptions} options
308
+ * @returns {TransactionGroup}
309
+ */
310
+ export function create_deposits(deposits, options) {
311
+ const ptr0 = passArrayJsValueToWasm0(deposits, wasm.__wbindgen_malloc);
312
+ const len0 = WASM_VECTOR_LEN;
313
+ const ret = wasm.create_deposits(ptr0, len0, options);
314
+ if (ret[2]) {
315
+ throw takeFromExternrefTable0(ret[1]);
316
+ }
317
+ return TransactionGroup.__wrap(ret[0]);
318
+ }
319
+
320
+ /**
321
+ * @param {CreateWithdrawalParamsJs[]} withdrawals
322
+ * @param {CreateWithdrawalOptions} options
323
+ * @returns {CreateWithdrawalsBuilder}
324
+ */
325
+ export function create_withdrawals_builder(withdrawals, options) {
326
+ const ptr0 = passArrayJsValueToWasm0(withdrawals, wasm.__wbindgen_malloc);
327
+ const len0 = WASM_VECTOR_LEN;
328
+ const ret = wasm.create_withdrawals_builder(ptr0, len0, options);
329
+ if (ret[2]) {
330
+ throw takeFromExternrefTable0(ret[1]);
331
+ }
332
+ return CreateWithdrawalsBuilder.__wrap(ret[0]);
333
+ }
334
+
335
+ /**
336
+ * @param {CreateWithdrawalParamsJs[]} withdrawals
337
+ * @param {CreateWithdrawalOptions} options
338
+ * @returns {TransactionGroup}
339
+ */
340
+ export function create_withdrawals(withdrawals, options) {
341
+ const ptr0 = passArrayJsValueToWasm0(withdrawals, wasm.__wbindgen_malloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ret = wasm.create_withdrawals(ptr0, len0, options);
344
+ if (ret[2]) {
345
+ throw takeFromExternrefTable0(ret[1]);
346
+ }
347
+ return TransactionGroup.__wrap(ret[0]);
348
+ }
349
+
350
+ /**
351
+ * @param {CreateShiftParamsJs[]} shifts
352
+ * @param {CreateShiftOptions} options
353
+ * @returns {CreateShiftsBuilder}
354
+ */
355
+ export function create_shifts_builder(shifts, options) {
356
+ const ptr0 = passArrayJsValueToWasm0(shifts, wasm.__wbindgen_malloc);
357
+ const len0 = WASM_VECTOR_LEN;
358
+ const ret = wasm.create_shifts_builder(ptr0, len0, options);
359
+ if (ret[2]) {
360
+ throw takeFromExternrefTable0(ret[1]);
361
+ }
362
+ return CreateShiftsBuilder.__wrap(ret[0]);
363
+ }
364
+
365
+ /**
366
+ * @param {CreateShiftParamsJs[]} shifts
367
+ * @param {CreateShiftOptions} options
368
+ * @returns {TransactionGroup}
369
+ */
370
+ export function create_shifts(shifts, options) {
371
+ const ptr0 = passArrayJsValueToWasm0(shifts, wasm.__wbindgen_malloc);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ const ret = wasm.create_shifts(ptr0, len0, options);
374
+ if (ret[2]) {
375
+ throw takeFromExternrefTable0(ret[1]);
376
+ }
377
+ return TransactionGroup.__wrap(ret[0]);
378
+ }
379
+
380
+ /**
381
+ * @param {CreateGlvDepositParamsJs[]} deposits
382
+ * @param {CreateGlvDepositOptions} options
383
+ * @returns {CreateGlvDepositsBuilder}
384
+ */
385
+ export function create_glv_deposits_builder(deposits, options) {
386
+ const ptr0 = passArrayJsValueToWasm0(deposits, wasm.__wbindgen_malloc);
387
+ const len0 = WASM_VECTOR_LEN;
388
+ const ret = wasm.create_glv_deposits_builder(ptr0, len0, options);
389
+ if (ret[2]) {
390
+ throw takeFromExternrefTable0(ret[1]);
391
+ }
392
+ return CreateGlvDepositsBuilder.__wrap(ret[0]);
393
+ }
394
+
395
+ /**
396
+ * @param {CreateGlvDepositParamsJs[]} deposits
397
+ * @param {CreateGlvDepositOptions} options
398
+ * @returns {TransactionGroup}
399
+ */
400
+ export function create_glv_deposits(deposits, options) {
401
+ const ptr0 = passArrayJsValueToWasm0(deposits, wasm.__wbindgen_malloc);
402
+ const len0 = WASM_VECTOR_LEN;
403
+ const ret = wasm.create_glv_deposits(ptr0, len0, options);
404
+ if (ret[2]) {
405
+ throw takeFromExternrefTable0(ret[1]);
406
+ }
407
+ return TransactionGroup.__wrap(ret[0]);
408
+ }
409
+
410
+ /**
411
+ * @param {CreateGlvWithdrawalParamsJs[]} withdrawals
412
+ * @param {CreateGlvWithdrawalOptions} options
413
+ * @returns {CreateGlvWithdrawalsBuilder}
414
+ */
415
+ export function create_glv_withdrawals_builder(withdrawals, options) {
416
+ const ptr0 = passArrayJsValueToWasm0(withdrawals, wasm.__wbindgen_malloc);
417
+ const len0 = WASM_VECTOR_LEN;
418
+ const ret = wasm.create_glv_withdrawals_builder(ptr0, len0, options);
419
+ if (ret[2]) {
420
+ throw takeFromExternrefTable0(ret[1]);
421
+ }
422
+ return CreateGlvWithdrawalsBuilder.__wrap(ret[0]);
423
+ }
424
+
425
+ /**
426
+ * @param {CreateGlvWithdrawalParamsJs[]} withdrawals
427
+ * @param {CreateGlvWithdrawalOptions} options
428
+ * @returns {TransactionGroup}
429
+ */
430
+ export function create_glv_withdrawals(withdrawals, options) {
431
+ const ptr0 = passArrayJsValueToWasm0(withdrawals, wasm.__wbindgen_malloc);
432
+ const len0 = WASM_VECTOR_LEN;
433
+ const ret = wasm.create_glv_withdrawals(ptr0, len0, options);
434
+ if (ret[2]) {
435
+ throw takeFromExternrefTable0(ret[1]);
436
+ }
437
+ return TransactionGroup.__wrap(ret[0]);
438
+ }
439
+
290
440
  /**
291
441
  * Apply `factor` to the `value`.
292
442
  * @param {bigint} value
@@ -305,6 +455,126 @@ export function solana_program_init() {
305
455
  wasm.solana_program_init();
306
456
  }
307
457
 
458
+ const CreateDepositsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
459
+ ? { register: () => {}, unregister: () => {} }
460
+ : new FinalizationRegistry(ptr => wasm.__wbg_createdepositsbuilder_free(ptr >>> 0, 1));
461
+
462
+ export class CreateDepositsBuilder {
463
+
464
+ static __wrap(ptr) {
465
+ ptr = ptr >>> 0;
466
+ const obj = Object.create(CreateDepositsBuilder.prototype);
467
+ obj.__wbg_ptr = ptr;
468
+ CreateDepositsBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
469
+ return obj;
470
+ }
471
+
472
+ __destroy_into_raw() {
473
+ const ptr = this.__wbg_ptr;
474
+ this.__wbg_ptr = 0;
475
+ CreateDepositsBuilderFinalization.unregister(this);
476
+ return ptr;
477
+ }
478
+
479
+ free() {
480
+ const ptr = this.__destroy_into_raw();
481
+ wasm.__wbg_createdepositsbuilder_free(ptr, 0);
482
+ }
483
+ /**
484
+ * @param {TransactionGroupOptions | null} [transaction_group]
485
+ * @param {BuildTransactionOptions | null} [build]
486
+ * @returns {TransactionGroup}
487
+ */
488
+ build_with_options(transaction_group, build) {
489
+ const ptr = this.__destroy_into_raw();
490
+ const ret = wasm.createdepositsbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
491
+ if (ret[2]) {
492
+ throw takeFromExternrefTable0(ret[1]);
493
+ }
494
+ return TransactionGroup.__wrap(ret[0]);
495
+ }
496
+ }
497
+
498
+ const CreateGlvDepositsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
499
+ ? { register: () => {}, unregister: () => {} }
500
+ : new FinalizationRegistry(ptr => wasm.__wbg_createglvdepositsbuilder_free(ptr >>> 0, 1));
501
+
502
+ export class CreateGlvDepositsBuilder {
503
+
504
+ static __wrap(ptr) {
505
+ ptr = ptr >>> 0;
506
+ const obj = Object.create(CreateGlvDepositsBuilder.prototype);
507
+ obj.__wbg_ptr = ptr;
508
+ CreateGlvDepositsBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
509
+ return obj;
510
+ }
511
+
512
+ __destroy_into_raw() {
513
+ const ptr = this.__wbg_ptr;
514
+ this.__wbg_ptr = 0;
515
+ CreateGlvDepositsBuilderFinalization.unregister(this);
516
+ return ptr;
517
+ }
518
+
519
+ free() {
520
+ const ptr = this.__destroy_into_raw();
521
+ wasm.__wbg_createglvdepositsbuilder_free(ptr, 0);
522
+ }
523
+ /**
524
+ * @param {TransactionGroupOptions | null} [transaction_group]
525
+ * @param {BuildTransactionOptions | null} [build]
526
+ * @returns {TransactionGroup}
527
+ */
528
+ build_with_options(transaction_group, build) {
529
+ const ptr = this.__destroy_into_raw();
530
+ const ret = wasm.createglvdepositsbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
531
+ if (ret[2]) {
532
+ throw takeFromExternrefTable0(ret[1]);
533
+ }
534
+ return TransactionGroup.__wrap(ret[0]);
535
+ }
536
+ }
537
+
538
+ const CreateGlvWithdrawalsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
539
+ ? { register: () => {}, unregister: () => {} }
540
+ : new FinalizationRegistry(ptr => wasm.__wbg_createglvwithdrawalsbuilder_free(ptr >>> 0, 1));
541
+
542
+ export class CreateGlvWithdrawalsBuilder {
543
+
544
+ static __wrap(ptr) {
545
+ ptr = ptr >>> 0;
546
+ const obj = Object.create(CreateGlvWithdrawalsBuilder.prototype);
547
+ obj.__wbg_ptr = ptr;
548
+ CreateGlvWithdrawalsBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
549
+ return obj;
550
+ }
551
+
552
+ __destroy_into_raw() {
553
+ const ptr = this.__wbg_ptr;
554
+ this.__wbg_ptr = 0;
555
+ CreateGlvWithdrawalsBuilderFinalization.unregister(this);
556
+ return ptr;
557
+ }
558
+
559
+ free() {
560
+ const ptr = this.__destroy_into_raw();
561
+ wasm.__wbg_createglvwithdrawalsbuilder_free(ptr, 0);
562
+ }
563
+ /**
564
+ * @param {TransactionGroupOptions | null} [transaction_group]
565
+ * @param {BuildTransactionOptions | null} [build]
566
+ * @returns {TransactionGroup}
567
+ */
568
+ build_with_options(transaction_group, build) {
569
+ const ptr = this.__destroy_into_raw();
570
+ const ret = wasm.createglvwithdrawalsbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
571
+ if (ret[2]) {
572
+ throw takeFromExternrefTable0(ret[1]);
573
+ }
574
+ return TransactionGroup.__wrap(ret[0]);
575
+ }
576
+ }
577
+
308
578
  const CreateOrdersBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
309
579
  ? { register: () => {}, unregister: () => {} }
310
580
  : new FinalizationRegistry(ptr => wasm.__wbg_createordersbuilder_free(ptr >>> 0, 1));
@@ -344,95 +614,644 @@ export class CreateOrdersBuilder {
344
614
  if (ret[2]) {
345
615
  throw takeFromExternrefTable0(ret[1]);
346
616
  }
347
- return TransactionGroup.__wrap(ret[0]);
617
+ return TransactionGroup.__wrap(ret[0]);
618
+ }
619
+ /**
620
+ * Merge with the other [`CreateOrderBuilder`].
621
+ * @param {CreateOrdersBuilder} other
622
+ */
623
+ merge(other) {
624
+ _assertClass(other, CreateOrdersBuilder);
625
+ const ret = wasm.createordersbuilder_merge(this.__wbg_ptr, other.__wbg_ptr);
626
+ if (ret[1]) {
627
+ throw takeFromExternrefTable0(ret[0]);
628
+ }
629
+ }
630
+ }
631
+
632
+ const CreateShiftsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
633
+ ? { register: () => {}, unregister: () => {} }
634
+ : new FinalizationRegistry(ptr => wasm.__wbg_createshiftsbuilder_free(ptr >>> 0, 1));
635
+
636
+ export class CreateShiftsBuilder {
637
+
638
+ static __wrap(ptr) {
639
+ ptr = ptr >>> 0;
640
+ const obj = Object.create(CreateShiftsBuilder.prototype);
641
+ obj.__wbg_ptr = ptr;
642
+ CreateShiftsBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
643
+ return obj;
644
+ }
645
+
646
+ __destroy_into_raw() {
647
+ const ptr = this.__wbg_ptr;
648
+ this.__wbg_ptr = 0;
649
+ CreateShiftsBuilderFinalization.unregister(this);
650
+ return ptr;
651
+ }
652
+
653
+ free() {
654
+ const ptr = this.__destroy_into_raw();
655
+ wasm.__wbg_createshiftsbuilder_free(ptr, 0);
656
+ }
657
+ /**
658
+ * @param {TransactionGroupOptions | null} [transaction_group]
659
+ * @param {BuildTransactionOptions | null} [build]
660
+ * @returns {TransactionGroup}
661
+ */
662
+ build_with_options(transaction_group, build) {
663
+ const ptr = this.__destroy_into_raw();
664
+ const ret = wasm.createshiftsbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
665
+ if (ret[2]) {
666
+ throw takeFromExternrefTable0(ret[1]);
667
+ }
668
+ return TransactionGroup.__wrap(ret[0]);
669
+ }
670
+ }
671
+
672
+ const CreateWithdrawalsBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
673
+ ? { register: () => {}, unregister: () => {} }
674
+ : new FinalizationRegistry(ptr => wasm.__wbg_createwithdrawalsbuilder_free(ptr >>> 0, 1));
675
+
676
+ export class CreateWithdrawalsBuilder {
677
+
678
+ static __wrap(ptr) {
679
+ ptr = ptr >>> 0;
680
+ const obj = Object.create(CreateWithdrawalsBuilder.prototype);
681
+ obj.__wbg_ptr = ptr;
682
+ CreateWithdrawalsBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
683
+ return obj;
684
+ }
685
+
686
+ __destroy_into_raw() {
687
+ const ptr = this.__wbg_ptr;
688
+ this.__wbg_ptr = 0;
689
+ CreateWithdrawalsBuilderFinalization.unregister(this);
690
+ return ptr;
691
+ }
692
+
693
+ free() {
694
+ const ptr = this.__destroy_into_raw();
695
+ wasm.__wbg_createwithdrawalsbuilder_free(ptr, 0);
696
+ }
697
+ /**
698
+ * @param {TransactionGroupOptions | null} [transaction_group]
699
+ * @param {BuildTransactionOptions | null} [build]
700
+ * @returns {TransactionGroup}
701
+ */
702
+ build_with_options(transaction_group, build) {
703
+ const ptr = this.__destroy_into_raw();
704
+ const ret = wasm.createwithdrawalsbuilder_build_with_options(ptr, isLikeNone(transaction_group) ? 0 : addToExternrefTable0(transaction_group), isLikeNone(build) ? 0 : addToExternrefTable0(build));
705
+ if (ret[2]) {
706
+ throw takeFromExternrefTable0(ret[1]);
707
+ }
708
+ return TransactionGroup.__wrap(ret[0]);
709
+ }
710
+ }
711
+
712
+ const DepositSimulationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
713
+ ? { register: () => {}, unregister: () => {} }
714
+ : new FinalizationRegistry(ptr => wasm.__wbg_depositsimulationoutput_free(ptr >>> 0, 1));
715
+ /**
716
+ * Simulation output for deposit.
717
+ */
718
+ export class DepositSimulationOutput {
719
+
720
+ static __wrap(ptr) {
721
+ ptr = ptr >>> 0;
722
+ const obj = Object.create(DepositSimulationOutput.prototype);
723
+ obj.__wbg_ptr = ptr;
724
+ DepositSimulationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
725
+ return obj;
726
+ }
727
+
728
+ __destroy_into_raw() {
729
+ const ptr = this.__wbg_ptr;
730
+ this.__wbg_ptr = 0;
731
+ DepositSimulationOutputFinalization.unregister(this);
732
+ return ptr;
733
+ }
734
+
735
+ free() {
736
+ const ptr = this.__destroy_into_raw();
737
+ wasm.__wbg_depositsimulationoutput_free(ptr, 0);
738
+ }
739
+ /**
740
+ * Returns the deposit report.
741
+ * @returns {string}
742
+ */
743
+ report() {
744
+ let deferred2_0;
745
+ let deferred2_1;
746
+ try {
747
+ const ret = wasm.depositsimulationoutput_report(this.__wbg_ptr);
748
+ var ptr1 = ret[0];
749
+ var len1 = ret[1];
750
+ if (ret[3]) {
751
+ ptr1 = 0; len1 = 0;
752
+ throw takeFromExternrefTable0(ret[2]);
753
+ }
754
+ deferred2_0 = ptr1;
755
+ deferred2_1 = len1;
756
+ return getStringFromWasm0(ptr1, len1);
757
+ } finally {
758
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
759
+ }
760
+ }
761
+ /**
762
+ * Returns swap reports for the long token path.
763
+ * @returns {string[]}
764
+ */
765
+ long_swaps() {
766
+ const ret = wasm.depositsimulationoutput_long_swaps(this.__wbg_ptr);
767
+ if (ret[3]) {
768
+ throw takeFromExternrefTable0(ret[2]);
769
+ }
770
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
771
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
772
+ return v1;
773
+ }
774
+ /**
775
+ * Returns swap reports for the short token path.
776
+ * @returns {string[]}
777
+ */
778
+ short_swaps() {
779
+ const ret = wasm.depositsimulationoutput_short_swaps(this.__wbg_ptr);
780
+ if (ret[3]) {
781
+ throw takeFromExternrefTable0(ret[2]);
782
+ }
783
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
784
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
785
+ return v1;
786
+ }
787
+ }
788
+
789
+ const ElGamalKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
790
+ ? { register: () => {}, unregister: () => {} }
791
+ : new FinalizationRegistry(ptr => wasm.__wbg_elgamalkeypair_free(ptr >>> 0, 1));
792
+ /**
793
+ * A (twisted) ElGamal encryption keypair.
794
+ *
795
+ * The instances of the secret key are zeroized on drop.
796
+ */
797
+ export class ElGamalKeypair {
798
+
799
+ static __wrap(ptr) {
800
+ ptr = ptr >>> 0;
801
+ const obj = Object.create(ElGamalKeypair.prototype);
802
+ obj.__wbg_ptr = ptr;
803
+ ElGamalKeypairFinalization.register(obj, obj.__wbg_ptr, obj);
804
+ return obj;
805
+ }
806
+
807
+ __destroy_into_raw() {
808
+ const ptr = this.__wbg_ptr;
809
+ this.__wbg_ptr = 0;
810
+ ElGamalKeypairFinalization.unregister(this);
811
+ return ptr;
812
+ }
813
+
814
+ free() {
815
+ const ptr = this.__destroy_into_raw();
816
+ wasm.__wbg_elgamalkeypair_free(ptr, 0);
817
+ }
818
+ /**
819
+ * Generates the public and secret keys for ElGamal encryption.
820
+ *
821
+ * This function is randomized. It internally samples a scalar element using `OsRng`.
822
+ * @returns {ElGamalKeypair}
823
+ */
824
+ static new_rand() {
825
+ const ret = wasm.elgamalkeypair_new_rand();
826
+ return ElGamalKeypair.__wrap(ret);
827
+ }
828
+ /**
829
+ * @returns {ElGamalPubkey}
830
+ */
831
+ pubkey_owned() {
832
+ const ret = wasm.elgamalkeypair_pubkey_owned(this.__wbg_ptr);
833
+ return ElGamalPubkey.__wrap(ret);
834
+ }
835
+ }
836
+
837
+ const ElGamalPubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
838
+ ? { register: () => {}, unregister: () => {} }
839
+ : new FinalizationRegistry(ptr => wasm.__wbg_elgamalpubkey_free(ptr >>> 0, 1));
840
+ /**
841
+ * Public key for the ElGamal encryption scheme.
842
+ */
843
+ export class ElGamalPubkey {
844
+
845
+ static __wrap(ptr) {
846
+ ptr = ptr >>> 0;
847
+ const obj = Object.create(ElGamalPubkey.prototype);
848
+ obj.__wbg_ptr = ptr;
849
+ ElGamalPubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
850
+ return obj;
851
+ }
852
+
853
+ __destroy_into_raw() {
854
+ const ptr = this.__wbg_ptr;
855
+ this.__wbg_ptr = 0;
856
+ ElGamalPubkeyFinalization.unregister(this);
857
+ return ptr;
858
+ }
859
+
860
+ free() {
861
+ const ptr = this.__destroy_into_raw();
862
+ wasm.__wbg_elgamalpubkey_free(ptr, 0);
863
+ }
864
+ }
865
+
866
+ const GlvFinalization = (typeof FinalizationRegistry === 'undefined')
867
+ ? { register: () => {}, unregister: () => {} }
868
+ : new FinalizationRegistry(ptr => wasm.__wbg_glv_free(ptr >>> 0, 1));
869
+ /**
870
+ * Wrapper of [`Glv`].
871
+ */
872
+ export class Glv {
873
+
874
+ static __wrap(ptr) {
875
+ ptr = ptr >>> 0;
876
+ const obj = Object.create(Glv.prototype);
877
+ obj.__wbg_ptr = ptr;
878
+ GlvFinalization.register(obj, obj.__wbg_ptr, obj);
879
+ return obj;
880
+ }
881
+
882
+ __destroy_into_raw() {
883
+ const ptr = this.__wbg_ptr;
884
+ this.__wbg_ptr = 0;
885
+ GlvFinalization.unregister(this);
886
+ return ptr;
887
+ }
888
+
889
+ free() {
890
+ const ptr = this.__destroy_into_raw();
891
+ wasm.__wbg_glv_free(ptr, 0);
892
+ }
893
+ /**
894
+ * Create from base64 encoded account data with options.
895
+ * @param {string} data
896
+ * @param {boolean | null} [no_discriminator]
897
+ * @returns {Glv}
898
+ */
899
+ static decode_from_base64_with_options(data, no_discriminator) {
900
+ const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
901
+ const len0 = WASM_VECTOR_LEN;
902
+ const ret = wasm.glv_decode_from_base64_with_options(ptr0, len0, isLikeNone(no_discriminator) ? 0xFFFFFF : no_discriminator ? 1 : 0);
903
+ if (ret[2]) {
904
+ throw takeFromExternrefTable0(ret[1]);
905
+ }
906
+ return Glv.__wrap(ret[0]);
907
+ }
908
+ /**
909
+ * Create from base64 encoded account data with options.
910
+ * @param {Uint8Array} data
911
+ * @param {boolean | null} [no_discriminator]
912
+ * @returns {Glv}
913
+ */
914
+ static decode_with_options(data, no_discriminator) {
915
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
916
+ const len0 = WASM_VECTOR_LEN;
917
+ const ret = wasm.glv_decode_with_options(ptr0, len0, isLikeNone(no_discriminator) ? 0xFFFFFF : no_discriminator ? 1 : 0);
918
+ if (ret[2]) {
919
+ throw takeFromExternrefTable0(ret[1]);
920
+ }
921
+ return Glv.__wrap(ret[0]);
922
+ }
923
+ /**
924
+ * Convert into [`JsGlvModel`].
925
+ * @param {bigint} supply
926
+ * @returns {GlvModel}
927
+ */
928
+ to_model(supply) {
929
+ const ret = wasm.glv_to_model(this.__wbg_ptr, supply, supply >> BigInt(64));
930
+ if (ret[2]) {
931
+ throw takeFromExternrefTable0(ret[1]);
932
+ }
933
+ return GlvModel.__wrap(ret[0]);
934
+ }
935
+ /**
936
+ * Returns GLV token address.
937
+ * @returns {string}
938
+ */
939
+ glv_token_address() {
940
+ let deferred1_0;
941
+ let deferred1_1;
942
+ try {
943
+ const ret = wasm.glv_glv_token_address(this.__wbg_ptr);
944
+ deferred1_0 = ret[0];
945
+ deferred1_1 = ret[1];
946
+ return getStringFromWasm0(ret[0], ret[1]);
947
+ } finally {
948
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
949
+ }
950
+ }
951
+ /**
952
+ * Returns long token address.
953
+ * @returns {string}
954
+ */
955
+ long_token_address() {
956
+ let deferred1_0;
957
+ let deferred1_1;
958
+ try {
959
+ const ret = wasm.glv_long_token_address(this.__wbg_ptr);
960
+ deferred1_0 = ret[0];
961
+ deferred1_1 = ret[1];
962
+ return getStringFromWasm0(ret[0], ret[1]);
963
+ } finally {
964
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
965
+ }
966
+ }
967
+ /**
968
+ * Returns short token address.
969
+ * @returns {string}
970
+ */
971
+ short_token_address() {
972
+ let deferred1_0;
973
+ let deferred1_1;
974
+ try {
975
+ const ret = wasm.glv_short_token_address(this.__wbg_ptr);
976
+ deferred1_0 = ret[0];
977
+ deferred1_1 = ret[1];
978
+ return getStringFromWasm0(ret[0], ret[1]);
979
+ } finally {
980
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
981
+ }
982
+ }
983
+ /**
984
+ * Create a clone of this market.
985
+ * @returns {Glv}
986
+ */
987
+ clone() {
988
+ const ret = wasm.glv_clone(this.__wbg_ptr);
989
+ return Glv.__wrap(ret);
990
+ }
991
+ }
992
+
993
+ const GlvDepositSimulationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
994
+ ? { register: () => {}, unregister: () => {} }
995
+ : new FinalizationRegistry(ptr => wasm.__wbg_glvdepositsimulationoutput_free(ptr >>> 0, 1));
996
+ /**
997
+ * Simulation output for GLV deposit.
998
+ */
999
+ export class GlvDepositSimulationOutput {
1000
+
1001
+ static __wrap(ptr) {
1002
+ ptr = ptr >>> 0;
1003
+ const obj = Object.create(GlvDepositSimulationOutput.prototype);
1004
+ obj.__wbg_ptr = ptr;
1005
+ GlvDepositSimulationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
1006
+ return obj;
1007
+ }
1008
+
1009
+ __destroy_into_raw() {
1010
+ const ptr = this.__wbg_ptr;
1011
+ this.__wbg_ptr = 0;
1012
+ GlvDepositSimulationOutputFinalization.unregister(this);
1013
+ return ptr;
1014
+ }
1015
+
1016
+ free() {
1017
+ const ptr = this.__destroy_into_raw();
1018
+ wasm.__wbg_glvdepositsimulationoutput_free(ptr, 0);
1019
+ }
1020
+ /**
1021
+ * Returns the deposit report.
1022
+ * @returns {string | undefined}
1023
+ */
1024
+ deposit_report() {
1025
+ const ret = wasm.glvdepositsimulationoutput_deposit_report(this.__wbg_ptr);
1026
+ if (ret[3]) {
1027
+ throw takeFromExternrefTable0(ret[2]);
1028
+ }
1029
+ let v1;
1030
+ if (ret[0] !== 0) {
1031
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1032
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1033
+ }
1034
+ return v1;
1035
+ }
1036
+ /**
1037
+ * Returns swap reports for the long token path.
1038
+ * @returns {string[]}
1039
+ */
1040
+ long_swaps() {
1041
+ const ret = wasm.glvdepositsimulationoutput_long_swaps(this.__wbg_ptr);
1042
+ if (ret[3]) {
1043
+ throw takeFromExternrefTable0(ret[2]);
1044
+ }
1045
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1046
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1047
+ return v1;
1048
+ }
1049
+ /**
1050
+ * Returns swap reports for the short token path.
1051
+ * @returns {string[]}
1052
+ */
1053
+ short_swaps() {
1054
+ const ret = wasm.glvdepositsimulationoutput_short_swaps(this.__wbg_ptr);
1055
+ if (ret[3]) {
1056
+ throw takeFromExternrefTable0(ret[2]);
1057
+ }
1058
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1059
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1060
+ return v1;
1061
+ }
1062
+ /**
1063
+ * Returns the output GLV token amount.
1064
+ * @returns {bigint}
1065
+ */
1066
+ output_amount() {
1067
+ const ret = wasm.glvdepositsimulationoutput_output_amount(this.__wbg_ptr);
1068
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1069
+ }
1070
+ }
1071
+
1072
+ const GlvModelFinalization = (typeof FinalizationRegistry === 'undefined')
1073
+ ? { register: () => {}, unregister: () => {} }
1074
+ : new FinalizationRegistry(ptr => wasm.__wbg_glvmodel_free(ptr >>> 0, 1));
1075
+ /**
1076
+ * Wrapper of [`GlvModel`].
1077
+ */
1078
+ export class GlvModel {
1079
+
1080
+ static __wrap(ptr) {
1081
+ ptr = ptr >>> 0;
1082
+ const obj = Object.create(GlvModel.prototype);
1083
+ obj.__wbg_ptr = ptr;
1084
+ GlvModelFinalization.register(obj, obj.__wbg_ptr, obj);
1085
+ return obj;
1086
+ }
1087
+
1088
+ __destroy_into_raw() {
1089
+ const ptr = this.__wbg_ptr;
1090
+ this.__wbg_ptr = 0;
1091
+ GlvModelFinalization.unregister(this);
1092
+ return ptr;
1093
+ }
1094
+
1095
+ free() {
1096
+ const ptr = this.__destroy_into_raw();
1097
+ wasm.__wbg_glvmodel_free(ptr, 0);
1098
+ }
1099
+ /**
1100
+ * Returns current supply.
1101
+ * @returns {bigint}
1102
+ */
1103
+ supply() {
1104
+ const ret = wasm.glvmodel_supply(this.__wbg_ptr);
1105
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1106
+ }
1107
+ /**
1108
+ * Returns GLV token address.
1109
+ * @returns {string}
1110
+ */
1111
+ glv_token_address() {
1112
+ let deferred1_0;
1113
+ let deferred1_1;
1114
+ try {
1115
+ const ret = wasm.glvmodel_glv_token_address(this.__wbg_ptr);
1116
+ deferred1_0 = ret[0];
1117
+ deferred1_1 = ret[1];
1118
+ return getStringFromWasm0(ret[0], ret[1]);
1119
+ } finally {
1120
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1121
+ }
1122
+ }
1123
+ /**
1124
+ * Returns long token address.
1125
+ * @returns {string}
1126
+ */
1127
+ long_token_address() {
1128
+ let deferred1_0;
1129
+ let deferred1_1;
1130
+ try {
1131
+ const ret = wasm.glvmodel_long_token_address(this.__wbg_ptr);
1132
+ deferred1_0 = ret[0];
1133
+ deferred1_1 = ret[1];
1134
+ return getStringFromWasm0(ret[0], ret[1]);
1135
+ } finally {
1136
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1137
+ }
1138
+ }
1139
+ /**
1140
+ * Returns short token address.
1141
+ * @returns {string}
1142
+ */
1143
+ short_token_address() {
1144
+ let deferred1_0;
1145
+ let deferred1_1;
1146
+ try {
1147
+ const ret = wasm.glvmodel_short_token_address(this.__wbg_ptr);
1148
+ deferred1_0 = ret[0];
1149
+ deferred1_1 = ret[1];
1150
+ return getStringFromWasm0(ret[0], ret[1]);
1151
+ } finally {
1152
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1153
+ }
348
1154
  }
349
1155
  /**
350
- * Merge with the other [`CreateOrderBuilder`].
351
- * @param {CreateOrdersBuilder} other
1156
+ * Create a clone of this market model.
1157
+ * @returns {GlvModel}
352
1158
  */
353
- merge(other) {
354
- _assertClass(other, CreateOrdersBuilder);
355
- const ret = wasm.createordersbuilder_merge(this.__wbg_ptr, other.__wbg_ptr);
356
- if (ret[1]) {
357
- throw takeFromExternrefTable0(ret[0]);
358
- }
1159
+ clone() {
1160
+ const ret = wasm.glvmodel_clone(this.__wbg_ptr);
1161
+ return GlvModel.__wrap(ret);
359
1162
  }
360
1163
  }
361
1164
 
362
- const ElGamalKeypairFinalization = (typeof FinalizationRegistry === 'undefined')
1165
+ const GlvWithdrawalSimulationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
363
1166
  ? { register: () => {}, unregister: () => {} }
364
- : new FinalizationRegistry(ptr => wasm.__wbg_elgamalkeypair_free(ptr >>> 0, 1));
1167
+ : new FinalizationRegistry(ptr => wasm.__wbg_glvwithdrawalsimulationoutput_free(ptr >>> 0, 1));
365
1168
  /**
366
- * A (twisted) ElGamal encryption keypair.
367
- *
368
- * The instances of the secret key are zeroized on drop.
1169
+ * Simulation output for withdrawal.
369
1170
  */
370
- export class ElGamalKeypair {
1171
+ export class GlvWithdrawalSimulationOutput {
371
1172
 
372
1173
  static __wrap(ptr) {
373
1174
  ptr = ptr >>> 0;
374
- const obj = Object.create(ElGamalKeypair.prototype);
1175
+ const obj = Object.create(GlvWithdrawalSimulationOutput.prototype);
375
1176
  obj.__wbg_ptr = ptr;
376
- ElGamalKeypairFinalization.register(obj, obj.__wbg_ptr, obj);
1177
+ GlvWithdrawalSimulationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
377
1178
  return obj;
378
1179
  }
379
1180
 
380
1181
  __destroy_into_raw() {
381
1182
  const ptr = this.__wbg_ptr;
382
1183
  this.__wbg_ptr = 0;
383
- ElGamalKeypairFinalization.unregister(this);
1184
+ GlvWithdrawalSimulationOutputFinalization.unregister(this);
384
1185
  return ptr;
385
1186
  }
386
1187
 
387
1188
  free() {
388
1189
  const ptr = this.__destroy_into_raw();
389
- wasm.__wbg_elgamalkeypair_free(ptr, 0);
1190
+ wasm.__wbg_glvwithdrawalsimulationoutput_free(ptr, 0);
390
1191
  }
391
1192
  /**
392
- * Generates the public and secret keys for ElGamal encryption.
393
- *
394
- * This function is randomized. It internally samples a scalar element using `OsRng`.
395
- * @returns {ElGamalKeypair}
1193
+ * Returns the withdraw report.
1194
+ * @returns {string}
396
1195
  */
397
- static new_rand() {
398
- const ret = wasm.elgamalkeypair_new_rand();
399
- return ElGamalKeypair.__wrap(ret);
1196
+ withdraw_report() {
1197
+ let deferred2_0;
1198
+ let deferred2_1;
1199
+ try {
1200
+ const ret = wasm.glvwithdrawalsimulationoutput_withdraw_report(this.__wbg_ptr);
1201
+ var ptr1 = ret[0];
1202
+ var len1 = ret[1];
1203
+ if (ret[3]) {
1204
+ ptr1 = 0; len1 = 0;
1205
+ throw takeFromExternrefTable0(ret[2]);
1206
+ }
1207
+ deferred2_0 = ptr1;
1208
+ deferred2_1 = len1;
1209
+ return getStringFromWasm0(ptr1, len1);
1210
+ } finally {
1211
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1212
+ }
400
1213
  }
401
1214
  /**
402
- * @returns {ElGamalPubkey}
1215
+ * Returns swap reports for the long token path.
1216
+ * @returns {string[]}
403
1217
  */
404
- pubkey_owned() {
405
- const ret = wasm.elgamalkeypair_pubkey_owned(this.__wbg_ptr);
406
- return ElGamalPubkey.__wrap(ret);
1218
+ long_swaps() {
1219
+ const ret = wasm.glvwithdrawalsimulationoutput_long_swaps(this.__wbg_ptr);
1220
+ if (ret[3]) {
1221
+ throw takeFromExternrefTable0(ret[2]);
1222
+ }
1223
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1224
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1225
+ return v1;
407
1226
  }
408
- }
409
-
410
- const ElGamalPubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
411
- ? { register: () => {}, unregister: () => {} }
412
- : new FinalizationRegistry(ptr => wasm.__wbg_elgamalpubkey_free(ptr >>> 0, 1));
413
- /**
414
- * Public key for the ElGamal encryption scheme.
415
- */
416
- export class ElGamalPubkey {
417
-
418
- static __wrap(ptr) {
419
- ptr = ptr >>> 0;
420
- const obj = Object.create(ElGamalPubkey.prototype);
421
- obj.__wbg_ptr = ptr;
422
- ElGamalPubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
423
- return obj;
1227
+ /**
1228
+ * Returns swap reports for the short token path.
1229
+ * @returns {string[]}
1230
+ */
1231
+ short_swaps() {
1232
+ const ret = wasm.glvwithdrawalsimulationoutput_short_swaps(this.__wbg_ptr);
1233
+ if (ret[3]) {
1234
+ throw takeFromExternrefTable0(ret[2]);
1235
+ }
1236
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1237
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1238
+ return v1;
424
1239
  }
425
-
426
- __destroy_into_raw() {
427
- const ptr = this.__wbg_ptr;
428
- this.__wbg_ptr = 0;
429
- ElGamalPubkeyFinalization.unregister(this);
430
- return ptr;
1240
+ /**
1241
+ * Returns long token output amount.
1242
+ * @returns {bigint}
1243
+ */
1244
+ long_output_amount() {
1245
+ const ret = wasm.glvwithdrawalsimulationoutput_long_output_amount(this.__wbg_ptr);
1246
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
431
1247
  }
432
-
433
- free() {
434
- const ptr = this.__destroy_into_raw();
435
- wasm.__wbg_elgamalpubkey_free(ptr, 0);
1248
+ /**
1249
+ * Returns short token output amount.
1250
+ * @returns {bigint}
1251
+ */
1252
+ short_output_amount() {
1253
+ const ret = wasm.glvwithdrawalsimulationoutput_short_output_amount(this.__wbg_ptr);
1254
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
436
1255
  }
437
1256
  }
438
1257
 
@@ -1035,6 +1854,18 @@ export class MarketModel {
1035
1854
  }
1036
1855
  return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1037
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
+ }
1038
1869
  /**
1039
1870
  * Get market status.
1040
1871
  * @param {MarketStatusParams} params
@@ -1047,6 +1878,14 @@ export class MarketModel {
1047
1878
  }
1048
1879
  return takeFromExternrefTable0(ret[0]);
1049
1880
  }
1881
+ /**
1882
+ * Returns current supply.
1883
+ * @returns {bigint}
1884
+ */
1885
+ supply() {
1886
+ const ret = wasm.marketmodel_supply(this.__wbg_ptr);
1887
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
1888
+ }
1050
1889
  /**
1051
1890
  * Create an empty position model.
1052
1891
  * @param {CreateEmptyPositionArgs} args
@@ -1630,6 +2469,79 @@ export class Pubkey {
1630
2469
  }
1631
2470
  }
1632
2471
 
2472
+ const ShiftSimulationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
2473
+ ? { register: () => {}, unregister: () => {} }
2474
+ : new FinalizationRegistry(ptr => wasm.__wbg_shiftsimulationoutput_free(ptr >>> 0, 1));
2475
+ /**
2476
+ * Simulation output for shift.
2477
+ */
2478
+ export class ShiftSimulationOutput {
2479
+
2480
+ static __wrap(ptr) {
2481
+ ptr = ptr >>> 0;
2482
+ const obj = Object.create(ShiftSimulationOutput.prototype);
2483
+ obj.__wbg_ptr = ptr;
2484
+ ShiftSimulationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
2485
+ return obj;
2486
+ }
2487
+
2488
+ __destroy_into_raw() {
2489
+ const ptr = this.__wbg_ptr;
2490
+ this.__wbg_ptr = 0;
2491
+ ShiftSimulationOutputFinalization.unregister(this);
2492
+ return ptr;
2493
+ }
2494
+
2495
+ free() {
2496
+ const ptr = this.__destroy_into_raw();
2497
+ wasm.__wbg_shiftsimulationoutput_free(ptr, 0);
2498
+ }
2499
+ /**
2500
+ * Returns the deposit report.
2501
+ * @returns {string}
2502
+ */
2503
+ deposit_report() {
2504
+ let deferred2_0;
2505
+ let deferred2_1;
2506
+ try {
2507
+ const ret = wasm.shiftsimulationoutput_deposit_report(this.__wbg_ptr);
2508
+ var ptr1 = ret[0];
2509
+ var len1 = ret[1];
2510
+ if (ret[3]) {
2511
+ ptr1 = 0; len1 = 0;
2512
+ throw takeFromExternrefTable0(ret[2]);
2513
+ }
2514
+ deferred2_0 = ptr1;
2515
+ deferred2_1 = len1;
2516
+ return getStringFromWasm0(ptr1, len1);
2517
+ } finally {
2518
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2519
+ }
2520
+ }
2521
+ /**
2522
+ * Returns the withdraw report.
2523
+ * @returns {string}
2524
+ */
2525
+ withdraw_report() {
2526
+ let deferred2_0;
2527
+ let deferred2_1;
2528
+ try {
2529
+ const ret = wasm.shiftsimulationoutput_withdraw_report(this.__wbg_ptr);
2530
+ var ptr1 = ret[0];
2531
+ var len1 = ret[1];
2532
+ if (ret[3]) {
2533
+ ptr1 = 0; len1 = 0;
2534
+ throw takeFromExternrefTable0(ret[2]);
2535
+ }
2536
+ deferred2_0 = ptr1;
2537
+ deferred2_1 = len1;
2538
+ return getStringFromWasm0(ptr1, len1);
2539
+ } finally {
2540
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
2541
+ }
2542
+ }
2543
+ }
2544
+
1633
2545
  const SimulatorFinalization = (typeof FinalizationRegistry === 'undefined')
1634
2546
  ? { register: () => {}, unregister: () => {} }
1635
2547
  : new FinalizationRegistry(ptr => wasm.__wbg_simulator_free(ptr >>> 0, 1));
@@ -1685,6 +2597,20 @@ export class Simulator {
1685
2597
  }
1686
2598
  return takeFromExternrefTable0(ret[0]);
1687
2599
  }
2600
+ /**
2601
+ * Get GLV by its GLV token.
2602
+ * @param {string} glv_token
2603
+ * @returns {GlvModel | undefined}
2604
+ */
2605
+ get_glv(glv_token) {
2606
+ const ptr0 = passStringToWasm0(glv_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2607
+ const len0 = WASM_VECTOR_LEN;
2608
+ const ret = wasm.simulator_get_glv(this.__wbg_ptr, ptr0, len0);
2609
+ if (ret[2]) {
2610
+ throw takeFromExternrefTable0(ret[1]);
2611
+ }
2612
+ return ret[0] === 0 ? undefined : GlvModel.__wrap(ret[0]);
2613
+ }
1688
2614
  /**
1689
2615
  * Upsert the prices for the given token.
1690
2616
  * @param {string} token
@@ -1699,6 +2625,18 @@ export class Simulator {
1699
2625
  }
1700
2626
  }
1701
2627
  /**
2628
+ * Upsert a GLV model.
2629
+ * @param {GlvModel} glv
2630
+ */
2631
+ insert_glv(glv) {
2632
+ _assertClass(glv, GlvModel);
2633
+ const ret = wasm.simulator_insert_glv(this.__wbg_ptr, glv.__wbg_ptr);
2634
+ if (ret[1]) {
2635
+ throw takeFromExternrefTable0(ret[0]);
2636
+ }
2637
+ }
2638
+ /**
2639
+ * Simulate an order execution.
1702
2640
  * @param {SimulateOrderArgs} args
1703
2641
  * @param {Position | null} [position]
1704
2642
  * @returns {OrderSimulationOutput}
@@ -1715,6 +2653,66 @@ export class Simulator {
1715
2653
  }
1716
2654
  return OrderSimulationOutput.__wrap(ret[0]);
1717
2655
  }
2656
+ /**
2657
+ * Simulate a deposit execution.
2658
+ * @param {SimulateDepositArgs} args
2659
+ * @returns {DepositSimulationOutput}
2660
+ */
2661
+ simulate_deposit(args) {
2662
+ const ret = wasm.simulator_simulate_deposit(this.__wbg_ptr, args);
2663
+ if (ret[2]) {
2664
+ throw takeFromExternrefTable0(ret[1]);
2665
+ }
2666
+ return DepositSimulationOutput.__wrap(ret[0]);
2667
+ }
2668
+ /**
2669
+ * Simulate a withdrawal execution.
2670
+ * @param {SimulateWithdrawalArgs} args
2671
+ * @returns {WithdrawalSimulationOutput}
2672
+ */
2673
+ simulate_withdrawal(args) {
2674
+ const ret = wasm.simulator_simulate_withdrawal(this.__wbg_ptr, args);
2675
+ if (ret[2]) {
2676
+ throw takeFromExternrefTable0(ret[1]);
2677
+ }
2678
+ return WithdrawalSimulationOutput.__wrap(ret[0]);
2679
+ }
2680
+ /**
2681
+ * Simulate a shift execution.
2682
+ * @param {SimulateShiftArgs} args
2683
+ * @returns {ShiftSimulationOutput}
2684
+ */
2685
+ simulate_shift(args) {
2686
+ const ret = wasm.simulator_simulate_shift(this.__wbg_ptr, args);
2687
+ if (ret[2]) {
2688
+ throw takeFromExternrefTable0(ret[1]);
2689
+ }
2690
+ return ShiftSimulationOutput.__wrap(ret[0]);
2691
+ }
2692
+ /**
2693
+ * Simulate a GLV deposit execution.
2694
+ * @param {SimulateGlvDepositArgs} args
2695
+ * @returns {GlvDepositSimulationOutput}
2696
+ */
2697
+ simulate_glv_deposit(args) {
2698
+ const ret = wasm.simulator_simulate_glv_deposit(this.__wbg_ptr, args);
2699
+ if (ret[2]) {
2700
+ throw takeFromExternrefTable0(ret[1]);
2701
+ }
2702
+ return GlvDepositSimulationOutput.__wrap(ret[0]);
2703
+ }
2704
+ /**
2705
+ * Simulate a GLV withdrawal execution.
2706
+ * @param {SimulateGlvWithdrawalArgs} args
2707
+ * @returns {GlvWithdrawalSimulationOutput}
2708
+ */
2709
+ simulate_glv_withdrawal(args) {
2710
+ const ret = wasm.simulator_simulate_glv_withdrawal(this.__wbg_ptr, args);
2711
+ if (ret[2]) {
2712
+ throw takeFromExternrefTable0(ret[1]);
2713
+ }
2714
+ return GlvWithdrawalSimulationOutput.__wrap(ret[0]);
2715
+ }
1718
2716
  /**
1719
2717
  * Create a clone of this simulator.
1720
2718
  * @returns {Simulator}
@@ -1723,6 +2721,30 @@ export class Simulator {
1723
2721
  const ret = wasm.simulator_clone(this.__wbg_ptr);
1724
2722
  return Simulator.__wrap(ret);
1725
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
+ }
1726
2748
  }
1727
2749
 
1728
2750
  const SystemInstructionFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -2305,6 +3327,99 @@ export class User {
2305
3327
  }
2306
3328
  }
2307
3329
 
3330
+ const WithdrawalSimulationOutputFinalization = (typeof FinalizationRegistry === 'undefined')
3331
+ ? { register: () => {}, unregister: () => {} }
3332
+ : new FinalizationRegistry(ptr => wasm.__wbg_withdrawalsimulationoutput_free(ptr >>> 0, 1));
3333
+ /**
3334
+ * Simulation output for withdrawal.
3335
+ */
3336
+ export class WithdrawalSimulationOutput {
3337
+
3338
+ static __wrap(ptr) {
3339
+ ptr = ptr >>> 0;
3340
+ const obj = Object.create(WithdrawalSimulationOutput.prototype);
3341
+ obj.__wbg_ptr = ptr;
3342
+ WithdrawalSimulationOutputFinalization.register(obj, obj.__wbg_ptr, obj);
3343
+ return obj;
3344
+ }
3345
+
3346
+ __destroy_into_raw() {
3347
+ const ptr = this.__wbg_ptr;
3348
+ this.__wbg_ptr = 0;
3349
+ WithdrawalSimulationOutputFinalization.unregister(this);
3350
+ return ptr;
3351
+ }
3352
+
3353
+ free() {
3354
+ const ptr = this.__destroy_into_raw();
3355
+ wasm.__wbg_withdrawalsimulationoutput_free(ptr, 0);
3356
+ }
3357
+ /**
3358
+ * Returns the withdraw report.
3359
+ * @returns {string}
3360
+ */
3361
+ report() {
3362
+ let deferred2_0;
3363
+ let deferred2_1;
3364
+ try {
3365
+ const ret = wasm.withdrawalsimulationoutput_report(this.__wbg_ptr);
3366
+ var ptr1 = ret[0];
3367
+ var len1 = ret[1];
3368
+ if (ret[3]) {
3369
+ ptr1 = 0; len1 = 0;
3370
+ throw takeFromExternrefTable0(ret[2]);
3371
+ }
3372
+ deferred2_0 = ptr1;
3373
+ deferred2_1 = len1;
3374
+ return getStringFromWasm0(ptr1, len1);
3375
+ } finally {
3376
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
3377
+ }
3378
+ }
3379
+ /**
3380
+ * Returns swap reports for the long token path.
3381
+ * @returns {string[]}
3382
+ */
3383
+ long_swaps() {
3384
+ const ret = wasm.withdrawalsimulationoutput_long_swaps(this.__wbg_ptr);
3385
+ if (ret[3]) {
3386
+ throw takeFromExternrefTable0(ret[2]);
3387
+ }
3388
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
3389
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
3390
+ return v1;
3391
+ }
3392
+ /**
3393
+ * Returns swap reports for the short token path.
3394
+ * @returns {string[]}
3395
+ */
3396
+ short_swaps() {
3397
+ const ret = wasm.withdrawalsimulationoutput_short_swaps(this.__wbg_ptr);
3398
+ if (ret[3]) {
3399
+ throw takeFromExternrefTable0(ret[2]);
3400
+ }
3401
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
3402
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
3403
+ return v1;
3404
+ }
3405
+ /**
3406
+ * Returns long token output amount.
3407
+ * @returns {bigint}
3408
+ */
3409
+ long_output_amount() {
3410
+ const ret = wasm.withdrawalsimulationoutput_long_output_amount(this.__wbg_ptr);
3411
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
3412
+ }
3413
+ /**
3414
+ * Returns short token output amount.
3415
+ * @returns {bigint}
3416
+ */
3417
+ short_output_amount() {
3418
+ const ret = wasm.withdrawalsimulationoutput_short_output_amount(this.__wbg_ptr);
3419
+ return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
3420
+ }
3421
+ }
3422
+
2308
3423
  export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
2309
3424
  const ret = String(arg1);
2310
3425
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);