@suigar/sdk 2.0.0-beta.0 → 2.0.0-beta.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/dist/index.cjs CHANGED
@@ -4,85 +4,126 @@ var utils = require('@mysten/sui/utils');
4
4
  var bcs = require('@mysten/sui/bcs');
5
5
  var transactions = require('@mysten/sui/transactions');
6
6
 
7
- // src/utils/config.ts
7
+ // src/types/network.type.ts
8
+ var SUPPORTED_SUI_NETWORKS = [
9
+ "mainnet",
10
+ "testnet"
11
+ ];
12
+
13
+ // src/configs/package.mainnet.ts
14
+ var MAINNET_PACKAGE_IDS = {
15
+ sweetHouse: "0xa1549d73230118716bc08865b8d62454f360ddaf40eee2158e458e52125d4ef1",
16
+ core: "0xcbb0929f21450013ebe5e86e7139f2409da2e3ed212c51126a7e6448b795a43f",
17
+ coinflip: "0xca96885371150f55653f7fab9e9b146f5a19698b1002bdff42159ea9d2ba7d7e",
18
+ limbo: "0x89db6a55ad4e650cad641b6f9fd90b391b22b1d9adbb2cabbfeb94a9eeda7026",
19
+ plinko: "0x74a73daff11c11ed05299c93ed770c62ec4dc6756fa99e271e251c2399f49fef",
20
+ pvpCoinflip: "0x29162faf01a8135630e0a32bbe4ce47f69607b24dbb1edea3800861f91d0030a",
21
+ range: "0xd19e32b0f2a5e541fbd345b4602f8a93a2eee25c16029595b6fef0b1e0461a54",
22
+ wheel: "0x6791eac73fe7bf463b7f3b1ea391df265fbc1b96201270664a5a11e2441e9955"
23
+ };
24
+ var MAINNET_COIN_TYPES = {
25
+ sui: "0x2::sui::SUI",
26
+ usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"
27
+ };
28
+ var MAINNET_PRICE_INFO_OBJECT_IDS = {
29
+ sui: "0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37",
30
+ usdc: "0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab"
31
+ };
8
32
 
9
- // src/configs/package-id.ts
10
- var DEFAULT_SWEETHOUSE_PACKAGE_ID = "0xb7f64e5a273aba1ede00caa0a6f8027cc7490c279d17eab12e7100ed20660603";
11
- var DEFAULT_GAMES_PACKAGE_ID = {
33
+ // src/configs/package.testnet.ts
34
+ var TESTNET_PACKAGE_IDS = {
35
+ sweetHouse: "0xb7f64e5a273aba1ede00caa0a6f8027cc7490c279d17eab12e7100ed20660603",
36
+ core: "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc",
12
37
  coinflip: "0xb35c5f286c443752afc8ccb40125a578a4f32df35617170ccfa17fe180ab80ea",
13
38
  limbo: "0x96c7841b9b32c59a219760fd656f1c3aceb53cc74a68ec9844a3a696374309f4",
14
39
  plinko: "0xd3dd2200883af10811724f0bed97591ad155a02efd6332d471ff8b346030dfb7",
15
- pvp_coinflip: "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202",
40
+ pvpCoinflip: "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202",
16
41
  range: "0x096a4cf18b3661e76b2c62b90785418345d52f45b272448794f123a4cb6b6416",
17
42
  wheel: "0x0997852ded7e13301c42317004bc49704a893aa82997c5706cebee59053a31b7"
18
43
  };
44
+ var TESTNET_COIN_TYPES = {
45
+ sui: "0x47c67b9594069c32caa7a6e875ddf31d7fa52602dd22ccb9ebd8d3482aed76dc::test_sui::TEST_SUI",
46
+ usdc: "0x47c67b9594069c32caa7a6e875ddf31d7fa52602dd22ccb9ebd8d3482aed76dc::test_usdc::TEST_USDC"
47
+ };
48
+ var TESTNET_PRICE_INFO_OBJECT_IDS = {
49
+ sui: "0x1ebb295c789cc42b3b2a1606482cd1c7124076a0f5676718501fda8c7fd075a0",
50
+ usdc: "0x9c4dd4008297ffa5e480684b8100ec21cc934405ed9a25d4e4d7b6259aad9c81"
51
+ };
19
52
 
20
- // src/configs/usdc-coin-type.ts
21
- var DEFAULT_USDC_COIN_TYPE = "0xdba34672e30cb065b1f93e3a0e89fd79d1f22e12e55e88edbbcbac48609f4af0::usdc::USDC";
22
- var DEFAULT_USDC_FLOWX_COIN_TYPE = "0xbde4ba4c7f1193c4f1f5b9e8a9c1cdec42c6f3f3a73cf40e1f4cb12cc7e6a4c0::usdc::USDC";
53
+ // src/configs/package.ts
54
+ var PACKAGE_IDS = {
55
+ mainnet: { ...MAINNET_PACKAGE_IDS },
56
+ testnet: { ...TESTNET_PACKAGE_IDS }
57
+ };
58
+ var COIN_TYPES = {
59
+ mainnet: { ...MAINNET_COIN_TYPES },
60
+ testnet: { ...TESTNET_COIN_TYPES }
61
+ };
62
+ var PRICE_INFO_OBJECT_IDS = {
63
+ mainnet: { ...MAINNET_PRICE_INFO_OBJECT_IDS },
64
+ testnet: { ...TESTNET_PRICE_INFO_OBJECT_IDS }
65
+ };
23
66
 
24
67
  // src/utils/config.ts
25
- var trim = (value) => value?.trim() ?? "";
26
- function resolveSuigarConfig(options) {
27
- const suiCoinType = utils.normalizeStructTag(
28
- options.coinTypes?.sui ?? utils.SUI_TYPE_ARG
29
- );
30
- const usdcCoinType = utils.normalizeStructTag(
31
- options.coinTypes?.usdc ?? DEFAULT_USDC_COIN_TYPE
32
- );
33
- const usdcFlowxCoinType = utils.normalizeStructTag(
34
- options.coinTypes?.usdcFlowx ?? DEFAULT_USDC_FLOWX_COIN_TYPE
35
- );
36
- const explicitPriceInfoObjectIds = Object.fromEntries(
37
- Object.entries(options.pyth?.priceInfoObjectIds ?? {}).map(
38
- ([coinType, objectId]) => [utils.normalizeStructTag(coinType), objectId]
39
- )
40
- );
68
+ function resolveSuigarConfig(network) {
69
+ const packageIds = PACKAGE_IDS[network];
70
+ const coinTypes = COIN_TYPES[network];
71
+ const priceInfoObjectIds = PRICE_INFO_OBJECT_IDS[network];
41
72
  return {
42
- sweetHousePackageId: trim(options.sweetHousePackageId) || trim(DEFAULT_SWEETHOUSE_PACKAGE_ID),
73
+ packageIds: { ...packageIds },
43
74
  coinTypes: {
44
- sui: suiCoinType,
45
- usdc: usdcCoinType,
46
- usdcFlowx: usdcFlowxCoinType
47
- },
48
- gamesPackageId: {
49
- coinflip: trim(options.gamesPackageId?.coinflip) || DEFAULT_GAMES_PACKAGE_ID.coinflip,
50
- limbo: trim(options.gamesPackageId?.limbo) || DEFAULT_GAMES_PACKAGE_ID.limbo,
51
- plinko: trim(options.gamesPackageId?.plinko) || DEFAULT_GAMES_PACKAGE_ID.plinko,
52
- "pvp-coinflip": trim(options.gamesPackageId?.["pvp-coinflip"]) || DEFAULT_GAMES_PACKAGE_ID.pvp_coinflip,
53
- range: trim(options.gamesPackageId?.range) || DEFAULT_GAMES_PACKAGE_ID.range,
54
- wheel: trim(options.gamesPackageId?.wheel) || DEFAULT_GAMES_PACKAGE_ID.wheel
75
+ sui: utils.normalizeStructTag(coinTypes.sui),
76
+ usdc: utils.normalizeStructTag(coinTypes.usdc)
55
77
  },
56
- pyth: {
57
- packageId: trim(options.pyth?.packageId) || void 0,
58
- suiPriceInfoObjectId: trim(options.pyth?.suiPriceInfoObjectId),
59
- usdcPriceInfoObjectId: trim(options.pyth?.usdcPriceInfoObjectId),
60
- priceInfoObjectIds: explicitPriceInfoObjectIds
78
+ priceInfoObjectIds: {
79
+ sui: priceInfoObjectIds.sui,
80
+ usdc: priceInfoObjectIds.usdc
61
81
  }
62
82
  };
63
83
  }
64
- function resolvePythPriceInfoObjectId(config, coinType) {
65
- const normalizedCoinType = utils.normalizeStructTag(coinType);
66
- const explicitObjectId = config.pyth.priceInfoObjectIds[normalizedCoinType];
67
- if (explicitObjectId) {
68
- return explicitObjectId;
84
+ function assertConfiguredBetGame(config, game) {
85
+ if (!resolveGamePackageId(config, game)) {
86
+ throw new Error(`Missing required config for ${game}: packageIds.${game}`);
69
87
  }
70
- if (normalizedCoinType === config.coinTypes.sui && config.pyth.suiPriceInfoObjectId) {
71
- return config.pyth.suiPriceInfoObjectId;
88
+ }
89
+ function resolveGamePackageId(config, game) {
90
+ switch (game) {
91
+ case "coinflip":
92
+ return config.packageIds.coinflip;
93
+ case "limbo":
94
+ return config.packageIds.limbo;
95
+ case "plinko":
96
+ return config.packageIds.plinko;
97
+ case "pvp-coinflip":
98
+ return config.packageIds.pvpCoinflip;
99
+ case "range":
100
+ return config.packageIds.range;
101
+ case "wheel":
102
+ return config.packageIds.wheel;
72
103
  }
73
- if ((normalizedCoinType === config.coinTypes.usdc || normalizedCoinType === config.coinTypes.usdcFlowx) && config.pyth.usdcPriceInfoObjectId) {
74
- return config.pyth.usdcPriceInfoObjectId;
104
+ }
105
+ function resolvePriceInfoObjectId(config, coinType) {
106
+ const normalizedCoinType = utils.normalizeStructTag(coinType);
107
+ const supportedCoin = resolveSupportedCoin(config, normalizedCoinType);
108
+ const objectId = config.priceInfoObjectIds[supportedCoin];
109
+ if (objectId) {
110
+ return objectId;
75
111
  }
76
112
  throw new Error(
77
- `Missing Pyth price object configuration for coin type ${coinType}`
113
+ `Missing price info object configuration for coin type ${coinType}`
78
114
  );
79
115
  }
80
- function assertConfiguredBetGame(config, game) {
81
- if (!config.gamesPackageId[game]) {
82
- throw new Error(
83
- `Missing required config for ${game}: gamesPackageId.${game}`
84
- );
116
+ function resolveSupportedCoin(config, coinType) {
117
+ const entries = Object.entries(config.coinTypes);
118
+ const supportedCoin = entries.find(
119
+ ([, configuredCoinType]) => configuredCoinType === coinType
120
+ )?.[0];
121
+ if (supportedCoin) {
122
+ return supportedCoin;
85
123
  }
124
+ throw new Error(
125
+ `Unsupported coin type ${coinType}. Supported coin types: ${entries.map(([, configuredCoinType]) => configuredCoinType).join(", ")}`
126
+ );
86
127
  }
87
128
  var ADDRESS_METADATA_KEYS = /* @__PURE__ */ new Set(["referrer", "partner"]);
88
129
  var textEncoder = new TextEncoder();
@@ -343,7 +384,7 @@ function buildSharedStandardGameBetCall({
343
384
  const resolvedCashStake = toBigIntAmount(cashStake ?? stake, "cashStake");
344
385
  const resolvedBetCount = toBigIntAmount(betCount ?? 1, "betCount");
345
386
  const encodedMetadata = encodeBetMetadata(metadata);
346
- const pythPriceInfoObjectId = resolvePythPriceInfoObjectId(
387
+ const priceInfoObjectId = resolvePriceInfoObjectId(
347
388
  config,
348
389
  normalizedCoinType
349
390
  );
@@ -361,7 +402,7 @@ function buildSharedStandardGameBetCall({
361
402
  cashStake: resolvedCashStake,
362
403
  betCount: resolvedBetCount,
363
404
  metadata: encodedMetadata,
364
- pythPriceInfoObjectId,
405
+ priceInfoObjectId,
365
406
  betCoin
366
407
  });
367
408
  tx.transferObjects([rewardCoin], tx.pure.address(normalizedOwner));
@@ -386,20 +427,20 @@ function buildCoinflipTransaction(options) {
386
427
  stake,
387
428
  betCount,
388
429
  metadata,
389
- pythPriceInfoObjectId,
430
+ priceInfoObjectId,
390
431
  betCoin
391
432
  }) => play({
392
- package: config.gamesPackageId.coinflip,
433
+ package: config.packageIds.coinflip,
393
434
  typeArguments: [coinType],
394
435
  arguments: [
395
- config.sweetHousePackageId,
436
+ config.packageIds.sweetHouse,
396
437
  stake,
397
438
  betCoin,
398
439
  betCount,
399
440
  options.side === "tails",
400
441
  metadata.keys,
401
442
  metadata.values,
402
- pythPriceInfoObjectId
443
+ priceInfoObjectId
403
444
  ]
404
445
  })(tx)
405
446
  });
@@ -444,13 +485,13 @@ function buildLimboTransaction(options) {
444
485
  stake,
445
486
  betCount,
446
487
  metadata,
447
- pythPriceInfoObjectId,
488
+ priceInfoObjectId,
448
489
  betCoin
449
490
  }) => play2({
450
- package: config.gamesPackageId.limbo,
491
+ package: config.packageIds.limbo,
451
492
  typeArguments: [coinType],
452
493
  arguments: [
453
- config.sweetHousePackageId,
494
+ config.packageIds.sweetHouse,
454
495
  stake,
455
496
  betCoin,
456
497
  betCount,
@@ -458,7 +499,7 @@ function buildLimboTransaction(options) {
458
499
  BigInt(scale),
459
500
  metadata.keys,
460
501
  metadata.values,
461
- pythPriceInfoObjectId
502
+ priceInfoObjectId
462
503
  ]
463
504
  })(tx)
464
505
  });
@@ -501,20 +542,20 @@ function buildPlinkoTransaction(options) {
501
542
  stake,
502
543
  betCount,
503
544
  metadata,
504
- pythPriceInfoObjectId,
545
+ priceInfoObjectId,
505
546
  betCoin
506
547
  }) => play3({
507
- package: config.gamesPackageId.plinko,
548
+ package: config.packageIds.plinko,
508
549
  typeArguments: [coinType],
509
550
  arguments: [
510
- config.sweetHousePackageId,
551
+ config.packageIds.sweetHouse,
511
552
  stake,
512
553
  betCoin,
513
554
  betCount,
514
555
  configId,
515
556
  metadata.keys,
516
557
  metadata.values,
517
- pythPriceInfoObjectId
558
+ priceInfoObjectId
518
559
  ]
519
560
  })(tx)
520
561
  });
@@ -526,44 +567,38 @@ var TypeName = new MoveStruct({ name: `${$moduleName}::TypeName`, fields: {
526
567
 
527
568
  // src/contracts/pvp-coinflip/pvp_coinflip.ts
528
569
  var $moduleName2 = "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202::pvp_coinflip";
529
- function GameCreatedEvent(...typeParameters) {
530
- return new MoveStruct({ name: `${$moduleName2}::GameCreatedEvent<${typeParameters[0].name}>`, fields: {
531
- game_id: bcs.bcs.Address,
532
- creator: bcs.bcs.Address,
533
- creator_is_tails: bcs.bcs.bool(),
534
- is_private: bcs.bcs.bool(),
535
- joiner_is_tails: bcs.bcs.bool(),
536
- stake_per_player: bcs.bcs.u64(),
537
- house_edge_bps: bcs.bcs.u64(),
538
- coin_type: TypeName
539
- } });
540
- }
541
- function GameResolvedEvent(...typeParameters) {
542
- return new MoveStruct({ name: `${$moduleName2}::GameResolvedEvent<${typeParameters[0].name}>`, fields: {
543
- game_id: bcs.bcs.Address,
544
- creator: bcs.bcs.Address,
545
- joiner: bcs.bcs.Address,
546
- winner: bcs.bcs.Address,
547
- creator_is_tails: bcs.bcs.bool(),
548
- is_private: bcs.bcs.bool(),
549
- joiner_is_tails: bcs.bcs.bool(),
550
- stake_per_player: bcs.bcs.u64(),
551
- total_pot: bcs.bcs.u64(),
552
- house_edge_amount: bcs.bcs.u64(),
553
- payout_amount: bcs.bcs.u64(),
554
- coin_type: TypeName
555
- } });
556
- }
557
- function GameCancelledEvent(...typeParameters) {
558
- return new MoveStruct({ name: `${$moduleName2}::GameCancelledEvent<${typeParameters[0].name}>`, fields: {
559
- game_id: bcs.bcs.Address,
560
- creator: bcs.bcs.Address,
561
- creator_is_tails: bcs.bcs.bool(),
562
- is_private: bcs.bcs.bool(),
563
- stake_per_player: bcs.bcs.u64(),
564
- coin_type: TypeName
565
- } });
566
- }
570
+ var GameCreatedEvent = new MoveStruct({ name: `${$moduleName2}::GameCreatedEvent<phantom T0>`, fields: {
571
+ game_id: bcs.bcs.Address,
572
+ creator: bcs.bcs.Address,
573
+ creator_is_tails: bcs.bcs.bool(),
574
+ is_private: bcs.bcs.bool(),
575
+ joiner_is_tails: bcs.bcs.bool(),
576
+ stake_per_player: bcs.bcs.u64(),
577
+ house_edge_bps: bcs.bcs.u64(),
578
+ coin_type: TypeName
579
+ } });
580
+ var GameResolvedEvent = new MoveStruct({ name: `${$moduleName2}::GameResolvedEvent<phantom T0>`, fields: {
581
+ game_id: bcs.bcs.Address,
582
+ creator: bcs.bcs.Address,
583
+ joiner: bcs.bcs.Address,
584
+ winner: bcs.bcs.Address,
585
+ creator_is_tails: bcs.bcs.bool(),
586
+ is_private: bcs.bcs.bool(),
587
+ joiner_is_tails: bcs.bcs.bool(),
588
+ stake_per_player: bcs.bcs.u64(),
589
+ total_pot: bcs.bcs.u64(),
590
+ house_edge_amount: bcs.bcs.u64(),
591
+ payout_amount: bcs.bcs.u64(),
592
+ coin_type: TypeName
593
+ } });
594
+ var GameCancelledEvent = new MoveStruct({ name: `${$moduleName2}::GameCancelledEvent<phantom T0>`, fields: {
595
+ game_id: bcs.bcs.Address,
596
+ creator: bcs.bcs.Address,
597
+ creator_is_tails: bcs.bcs.bool(),
598
+ is_private: bcs.bcs.bool(),
599
+ stake_per_player: bcs.bcs.u64(),
600
+ coin_type: TypeName
601
+ } });
567
602
  function createGame(options) {
568
603
  const packageAddress = options.package ?? "0xb43cf6583c0c15315c7e66f173af4be79ac40c38aad1fd92ec08638ab2026202";
569
604
  const argumentsTypes = [
@@ -636,10 +671,10 @@ function buildPvPCoinflipTransaction(action, options) {
636
671
  });
637
672
  tx.add(
638
673
  createGame({
639
- package: createOptions.config.gamesPackageId["pvp-coinflip"],
674
+ package: createOptions.config.packageIds.pvpCoinflip,
640
675
  typeArguments: [normalizedCoinType],
641
676
  arguments: [
642
- createOptions.config.sweetHousePackageId,
677
+ createOptions.config.packageIds.sweetHouse,
643
678
  betCoin,
644
679
  createOptions.side === "tails",
645
680
  Boolean(createOptions.isPrivate),
@@ -660,11 +695,11 @@ function buildPvPCoinflipTransaction(action, options) {
660
695
  });
661
696
  tx.add(
662
697
  joinGame({
663
- package: joinOptions.config.gamesPackageId["pvp-coinflip"],
698
+ package: joinOptions.config.packageIds.pvpCoinflip,
664
699
  typeArguments: [normalizedCoinType],
665
700
  arguments: [
666
701
  joinOptions.gameId,
667
- joinOptions.config.sweetHousePackageId,
702
+ joinOptions.config.packageIds.sweetHouse,
668
703
  betCoin,
669
704
  encodedMetadata.keys,
670
705
  encodedMetadata.values,
@@ -678,11 +713,11 @@ function buildPvPCoinflipTransaction(action, options) {
678
713
  const cancelOptions = options;
679
714
  tx.add(
680
715
  cancelGame({
681
- package: cancelOptions.config.gamesPackageId["pvp-coinflip"],
716
+ package: cancelOptions.config.packageIds.pvpCoinflip,
682
717
  typeArguments: [normalizedCoinType],
683
718
  arguments: [
684
719
  cancelOptions.gameId,
685
- cancelOptions.config.sweetHousePackageId
720
+ cancelOptions.config.packageIds.sweetHouse
686
721
  ]
687
722
  })
688
723
  );
@@ -734,13 +769,13 @@ function buildRangeTransaction(options) {
734
769
  stake,
735
770
  betCount,
736
771
  metadata,
737
- pythPriceInfoObjectId,
772
+ priceInfoObjectId,
738
773
  betCoin
739
774
  }) => play4({
740
- package: config.gamesPackageId.range,
775
+ package: config.packageIds.range,
741
776
  typeArguments: [coinType],
742
777
  arguments: [
743
- config.sweetHousePackageId,
778
+ config.packageIds.sweetHouse,
744
779
  stake,
745
780
  betCoin,
746
781
  betCount,
@@ -749,7 +784,7 @@ function buildRangeTransaction(options) {
749
784
  Boolean(options.outOfRange),
750
785
  metadata.keys,
751
786
  metadata.values,
752
- pythPriceInfoObjectId
787
+ priceInfoObjectId
753
788
  ]
754
789
  })(tx)
755
790
  });
@@ -792,20 +827,20 @@ function buildWheelTransaction(options) {
792
827
  stake,
793
828
  betCount,
794
829
  metadata,
795
- pythPriceInfoObjectId,
830
+ priceInfoObjectId,
796
831
  betCoin
797
832
  }) => play5({
798
- package: config.gamesPackageId.wheel,
833
+ package: config.packageIds.wheel,
799
834
  typeArguments: [coinType],
800
835
  arguments: [
801
- config.sweetHousePackageId,
836
+ config.packageIds.sweetHouse,
802
837
  stake,
803
838
  betCoin,
804
839
  betCount,
805
840
  configId,
806
841
  metadata.keys,
807
842
  metadata.values,
808
- pythPriceInfoObjectId
843
+ priceInfoObjectId
809
844
  ]
810
845
  })(tx)
811
846
  });
@@ -841,50 +876,63 @@ function VecMap(...typeParameters) {
841
876
 
842
877
  // src/contracts/core/core.ts
843
878
  var $moduleName7 = "0xf391858d2a08473e8d4defcc8df89976bd7b123d3865c6b9341b237f7853dbbc::core";
844
- function BetResultEvent(...typeParameters) {
845
- return new MoveStruct({ name: `${$moduleName7}::BetResultEvent<${typeParameters[0].name}>`, fields: {
846
- player: bcs.bcs.Address,
847
- coin_type: TypeName2,
848
- stake_amount: bcs.bcs.u64(),
849
- unsafe_oracle_usd_coin_price: Float,
850
- adjusted_oracle_usd_coin_price: Float,
851
- outcome_amount: bcs.bcs.u64(),
852
- game_details: VecMap(bcs.bcs.string(), bcs.bcs.vector(bcs.bcs.u8())),
853
- metadata: VecMap(bcs.bcs.string(), bcs.bcs.vector(bcs.bcs.u8()))
854
- } });
855
- }
856
-
857
- // src/client.ts
879
+ var BetResultEvent = new MoveStruct({ name: `${$moduleName7}::BetResultEvent<phantom T0>`, fields: {
880
+ player: bcs.bcs.Address,
881
+ coin_type: TypeName2,
882
+ stake_amount: bcs.bcs.u64(),
883
+ unsafe_oracle_usd_coin_price: Float,
884
+ adjusted_oracle_usd_coin_price: Float,
885
+ outcome_amount: bcs.bcs.u64(),
886
+ game_details: VecMap(bcs.bcs.string(), bcs.bcs.vector(bcs.bcs.u8())),
887
+ metadata: VecMap(bcs.bcs.string(), bcs.bcs.vector(bcs.bcs.u8()))
888
+ } });
858
889
  function suigar({
859
- name = "suigar",
860
- ...options
890
+ name = "suigar"
861
891
  } = {}) {
862
892
  return {
863
893
  name,
864
894
  register: (client) => {
865
- return new SuigarClient({ client, options });
895
+ return new SuigarClient({ client });
866
896
  }
867
897
  };
868
898
  }
869
899
  var SuigarClient = class {
870
900
  #client;
871
901
  #config;
872
- constructor({
873
- client,
874
- options
875
- }) {
902
+ constructor({ client }) {
876
903
  this.#client = client;
877
- this.#config = resolveSuigarConfig(options);
904
+ const network = this.#client.network;
905
+ if (!SUPPORTED_SUI_NETWORKS.includes(network)) {
906
+ throw new Error(`Unsupported network: ${network}`);
907
+ }
908
+ this.#config = resolveSuigarConfig(network);
878
909
  }
879
910
  /**
880
- * Builds a transaction with the configured Sui client and returns the BCS bytes as a base64 string.
911
+ * Returns the resolved SDK configuration for the connected network.
912
+ *
913
+ * This is primarily useful for debugging or inspecting which package ids,
914
+ * supported coin types, and price info object ids the SDK resolved for the
915
+ * current client network.
916
+ *
917
+ * @returns Network-resolved Suigar configuration.
918
+ */
919
+ getConfig() {
920
+ return this.#config;
921
+ }
922
+ /**
923
+ * Builds a transaction with the configured Sui client and encodes the resulting BCS bytes as base64.
924
+ *
925
+ * Use this when an external wallet, API, or transport expects the built transaction payload as a base64 string
926
+ * instead of raw bytes. The SDK always injects the configured Sui client, so `options` accepts the standard
927
+ * transaction build options except for `client`.
881
928
  *
882
- * @param transaction Transaction block to serialize.
929
+ * @param transaction Transaction to build and serialize.
930
+ * @param options Optional transaction build options forwarded to `transaction.build()`, excluding `client`.
883
931
  * @returns Base64-encoded transaction bytes ready to send over the wire.
884
932
  */
885
- async serializeTransactionToBase64(transaction) {
886
- const bytes = await transaction.build({ client: this.#client });
887
- return Buffer.from(bytes).toString("base64");
933
+ async serializeTransactionToBase64(transaction, options) {
934
+ const bytes = await transaction.build({ ...options, client: this.#client });
935
+ return utils.toBase64(bytes);
888
936
  }
889
937
  /**
890
938
  * BCS struct constructors for decoding Suigar events emitted on-chain.
@@ -965,5 +1013,4 @@ var SuigarClient = class {
965
1013
  };
966
1014
  };
967
1015
 
968
- exports.SuigarClient = SuigarClient;
969
1016
  exports.suigar = suigar;