@gabox-labs/sdk 0.7.1 → 0.9.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.
@@ -1,23 +1,5 @@
1
- import { SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, SolanaError, assertAccountExists, assertAccountsExist, assertIsInstructionWithAccounts, combineCodec, containsBytes, decodeAccount, extendClient, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder } from "@solana/kit";
1
+ import { SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, SolanaError, assertAccountExists, assertAccountsExist, assertIsInstructionWithAccounts, combineCodec, containsBytes, decodeAccount, extendClient, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder } from "@solana/kit";
2
2
  import { addSelfFetchFunctions, addSelfPlanAndSendFunctions, getAccountMetaFactory, getAddressFromResolvedInstructionAccount, getNonNullResolvedInstructionInput } from "@solana/program-client-core";
3
- //#region src/generated/types/prize.ts
4
- /**
5
- * This code was AUTOGENERATED using the Codama library.
6
- * Please DO NOT EDIT THIS FILE, instead use visitors
7
- * to add features, then rerun Codama to update it.
8
- *
9
- * @see https://github.com/codama-idl/codama
10
- */
11
- function getPrizeEncoder() {
12
- return getStructEncoder([["amount", getU64Encoder()], ["tickets", getU32Encoder()]]);
13
- }
14
- function getPrizeDecoder() {
15
- return getStructDecoder([["amount", getU64Decoder()], ["tickets", getU32Decoder()]]);
16
- }
17
- function getPrizeCodec() {
18
- return combineCodec(getPrizeEncoder(), getPrizeDecoder());
19
- }
20
- //#endregion
21
3
  //#region src/generated/types/tier.ts
22
4
  /**
23
5
  * This code was AUTOGENERATED using the Codama library.
@@ -45,14 +27,14 @@ function getTierCodec() {
45
27
  * @see https://github.com/codama-idl/codama
46
28
  */
47
29
  const DRAW_DISCRIMINATOR = new Uint8Array([
48
- 101,
49
- 31,
50
- 52,
51
- 179,
52
- 121,
53
- 78,
54
- 252,
55
- 89
30
+ 27,
31
+ 129,
32
+ 22,
33
+ 20,
34
+ 6,
35
+ 20,
36
+ 18,
37
+ 20
56
38
  ]);
57
39
  function getDrawDiscriminatorBytes() {
58
40
  return fixEncoderSize(getBytesEncoder(), 8).encode(DRAW_DISCRIMINATOR);
@@ -63,14 +45,21 @@ function getDrawEncoder() {
63
45
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
64
46
  ["pool", getAddressEncoder()],
65
47
  ["purchaser", getAddressEncoder()],
66
- ["seq", getU64Encoder()],
48
+ ["nonce", getU64Encoder()],
67
49
  ["bump", getU8Encoder()],
50
+ ["seqStart", getU64Encoder()],
51
+ ["count", getU8Encoder()],
68
52
  ["requestSlot", getU64Encoder()],
69
53
  ["lastAttemptSlot", getU64Encoder()],
70
54
  ["attempts", getU8Encoder()],
71
- ["maximum", getU64Encoder()],
72
- ["minimum", getU64Encoder()],
73
- ["prizes", getArrayEncoder(getPrizeEncoder(), { size: 8 })]
55
+ ["tiers", getArrayEncoder(getTierEncoder(), { size: 8 })],
56
+ ["packTokens", getU64Encoder()],
57
+ ["freeSnapshot", getU64Encoder()],
58
+ ["reserved", getU64Encoder()],
59
+ ["settled", getBooleanEncoder()],
60
+ ["randomness", fixEncoderSize(getBytesEncoder(), 32)],
61
+ ["timedOut", getBooleanEncoder()],
62
+ ["owed", getU64Encoder()]
74
63
  ]), (value) => ({
75
64
  ...value,
76
65
  discriminator: DRAW_DISCRIMINATOR
@@ -82,14 +71,21 @@ function getDrawDecoder() {
82
71
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
83
72
  ["pool", getAddressDecoder()],
84
73
  ["purchaser", getAddressDecoder()],
85
- ["seq", getU64Decoder()],
74
+ ["nonce", getU64Decoder()],
86
75
  ["bump", getU8Decoder()],
76
+ ["seqStart", getU64Decoder()],
77
+ ["count", getU8Decoder()],
87
78
  ["requestSlot", getU64Decoder()],
88
79
  ["lastAttemptSlot", getU64Decoder()],
89
80
  ["attempts", getU8Decoder()],
90
- ["maximum", getU64Decoder()],
91
- ["minimum", getU64Decoder()],
92
- ["prizes", getArrayDecoder(getPrizeDecoder(), { size: 8 })]
81
+ ["tiers", getArrayDecoder(getTierDecoder(), { size: 8 })],
82
+ ["packTokens", getU64Decoder()],
83
+ ["freeSnapshot", getU64Decoder()],
84
+ ["reserved", getU64Decoder()],
85
+ ["settled", getBooleanDecoder()],
86
+ ["randomness", fixDecoderSize(getBytesDecoder(), 32)],
87
+ ["timedOut", getBooleanDecoder()],
88
+ ["owed", getU64Decoder()]
93
89
  ]);
94
90
  }
95
91
  /** Gets the codec for {@link Draw} account data. */
@@ -116,7 +112,7 @@ async function fetchAllMaybeDraw(rpc, addresses, config) {
116
112
  return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeDraw(maybeAccount));
117
113
  }
118
114
  function getDrawSize() {
119
- return 210;
115
+ return 237;
120
116
  }
121
117
  //#endregion
122
118
  //#region src/generated/accounts/pool.ts
@@ -128,14 +124,14 @@ function getDrawSize() {
128
124
  * @see https://github.com/codama-idl/codama
129
125
  */
130
126
  const POOL_DISCRIMINATOR = new Uint8Array([
131
- 153,
132
- 115,
133
- 78,
134
- 55,
135
- 156,
136
- 26,
137
- 133,
138
- 45
127
+ 48,
128
+ 150,
129
+ 170,
130
+ 25,
131
+ 50,
132
+ 211,
133
+ 226,
134
+ 239
139
135
  ]);
140
136
  function getPoolDiscriminatorBytes() {
141
137
  return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_DISCRIMINATOR);
@@ -324,7 +320,8 @@ async function findDrawPda(seeds, config = {}) {
324
320
  119
325
321
  ])),
326
322
  getAddressEncoder().encode(seeds.pool),
327
- getU64Encoder().encode(seeds.seq)
323
+ getAddressEncoder().encode(seeds.purchaser),
324
+ getU64Encoder().encode(seeds.nonce)
328
325
  ]
329
326
  });
330
327
  }
@@ -375,7 +372,7 @@ async function findPoolPda(seeds, config = {}) {
375
372
  });
376
373
  }
377
374
  //#endregion
378
- //#region src/generated/instructions/buyPack.ts
375
+ //#region src/generated/instructions/buyPacks.ts
379
376
  /**
380
377
  * This code was AUTOGENERATED using the Codama library.
381
378
  * Please DO NOT EDIT THIS FILE, instead use visitors
@@ -383,42 +380,46 @@ async function findPoolPda(seeds, config = {}) {
383
380
  *
384
381
  * @see https://github.com/codama-idl/codama
385
382
  */
386
- const BUY_PACK_DISCRIMINATOR = new Uint8Array([
387
- 151,
388
- 46,
389
- 141,
390
- 93,
391
- 174,
392
- 5,
393
- 49,
394
- 173
383
+ const BUY_PACKS_DISCRIMINATOR = new Uint8Array([
384
+ 136,
385
+ 30,
386
+ 10,
387
+ 209,
388
+ 228,
389
+ 139,
390
+ 105,
391
+ 138
395
392
  ]);
396
- function getBuyPackDiscriminatorBytes() {
397
- return fixEncoderSize(getBytesEncoder(), 8).encode(BUY_PACK_DISCRIMINATOR);
393
+ function getBuyPacksDiscriminatorBytes() {
394
+ return fixEncoderSize(getBytesEncoder(), 8).encode(BUY_PACKS_DISCRIMINATOR);
398
395
  }
399
- function getBuyPackInstructionDataEncoder() {
396
+ function getBuyPacksInstructionDataEncoder() {
400
397
  return transformEncoder(getStructEncoder([
401
398
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
399
+ ["count", getU8Encoder()],
400
+ ["nonce", getU64Encoder()],
402
401
  ["maxQuoteIn", getU64Encoder()],
403
- ["minMaximum", getU64Encoder()],
402
+ ["minFirstMaximum", getU64Encoder()],
404
403
  ["maxNativeDebit", getU64Encoder()]
405
404
  ]), (value) => ({
406
405
  ...value,
407
- discriminator: BUY_PACK_DISCRIMINATOR
406
+ discriminator: BUY_PACKS_DISCRIMINATOR
408
407
  }));
409
408
  }
410
- function getBuyPackInstructionDataDecoder() {
409
+ function getBuyPacksInstructionDataDecoder() {
411
410
  return getStructDecoder([
412
411
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
412
+ ["count", getU8Decoder()],
413
+ ["nonce", getU64Decoder()],
413
414
  ["maxQuoteIn", getU64Decoder()],
414
- ["minMaximum", getU64Decoder()],
415
+ ["minFirstMaximum", getU64Decoder()],
415
416
  ["maxNativeDebit", getU64Decoder()]
416
417
  ]);
417
418
  }
418
- function getBuyPackInstructionDataCodec() {
419
- return combineCodec(getBuyPackInstructionDataEncoder(), getBuyPackInstructionDataDecoder());
419
+ function getBuyPacksInstructionDataCodec() {
420
+ return combineCodec(getBuyPacksInstructionDataEncoder(), getBuyPacksInstructionDataDecoder());
420
421
  }
421
- async function getBuyPackInstructionAsync(input, config) {
422
+ async function getBuyPacksInstructionAsync(input, config) {
422
423
  const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
423
424
  const accounts = {
424
425
  purchaser: {
@@ -492,6 +493,11 @@ async function getBuyPackInstructionAsync(input, config) {
492
493
  };
493
494
  const args = { ...input };
494
495
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
496
+ if (!accounts.draw.value) accounts.draw.value = await findDrawPda({
497
+ pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
498
+ purchaser: getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value),
499
+ nonce: getNonNullResolvedInstructionInput("nonce", args.nonce)
500
+ }, { programAddress });
495
501
  if (!accounts.activity.value) accounts.activity.value = await findActivityPda({ purchaser: getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value) }, { programAddress });
496
502
  if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
497
503
  programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
@@ -539,34 +545,490 @@ async function getBuyPackInstructionAsync(input, config) {
539
545
  if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
540
546
  if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
541
547
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
542
- if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
543
- if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
548
+ if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
549
+ if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
550
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
551
+ return Object.freeze({
552
+ accounts: [
553
+ getAccountMeta("purchaser", accounts.purchaser),
554
+ getAccountMeta("pool", accounts.pool),
555
+ getAccountMeta("draw", accounts.draw),
556
+ getAccountMeta("activity", accounts.activity),
557
+ getAccountMeta("mint", accounts.mint),
558
+ getAccountMeta("quoteMint", accounts.quoteMint),
559
+ getAccountMeta("vault", accounts.vault),
560
+ getAccountMeta("userTokens", accounts.userTokens),
561
+ getAccountMeta("venue", accounts.venue),
562
+ getAccountMeta("identity", accounts.identity),
563
+ getAccountMeta("queue", accounts.queue),
564
+ getAccountMeta("program", accounts.program),
565
+ getAccountMeta("slotHashes", accounts.slotHashes),
566
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
567
+ getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
568
+ getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
569
+ getAccountMeta("systemProgram", accounts.systemProgram)
570
+ ],
571
+ data: getBuyPacksInstructionDataEncoder().encode(args),
572
+ programAddress
573
+ });
574
+ }
575
+ function getBuyPacksInstruction(input, config) {
576
+ const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
577
+ const accounts = {
578
+ purchaser: {
579
+ value: input.purchaser ?? null,
580
+ isWritable: true
581
+ },
582
+ pool: {
583
+ value: input.pool ?? null,
584
+ isWritable: true
585
+ },
586
+ draw: {
587
+ value: input.draw ?? null,
588
+ isWritable: true
589
+ },
590
+ activity: {
591
+ value: input.activity ?? null,
592
+ isWritable: true
593
+ },
594
+ mint: {
595
+ value: input.mint ?? null,
596
+ isWritable: false
597
+ },
598
+ quoteMint: {
599
+ value: input.quoteMint ?? null,
600
+ isWritable: false
601
+ },
602
+ vault: {
603
+ value: input.vault ?? null,
604
+ isWritable: true
605
+ },
606
+ userTokens: {
607
+ value: input.userTokens ?? null,
608
+ isWritable: true
609
+ },
610
+ venue: {
611
+ value: input.venue ?? null,
612
+ isWritable: false
613
+ },
614
+ identity: {
615
+ value: input.identity ?? null,
616
+ isWritable: false
617
+ },
618
+ queue: {
619
+ value: input.queue ?? null,
620
+ isWritable: true
621
+ },
622
+ program: {
623
+ value: input.program ?? null,
624
+ isWritable: false
625
+ },
626
+ slotHashes: {
627
+ value: input.slotHashes ?? null,
628
+ isWritable: false
629
+ },
630
+ tokenProgram: {
631
+ value: input.tokenProgram ?? null,
632
+ isWritable: false
633
+ },
634
+ quoteTokenProgram: {
635
+ value: input.quoteTokenProgram ?? null,
636
+ isWritable: false
637
+ },
638
+ associatedTokenProgram: {
639
+ value: input.associatedTokenProgram ?? null,
640
+ isWritable: false
641
+ },
642
+ systemProgram: {
643
+ value: input.systemProgram ?? null,
644
+ isWritable: false
645
+ }
646
+ };
647
+ const args = { ...input };
648
+ if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
649
+ if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
650
+ if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
651
+ if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
652
+ if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
653
+ if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
654
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
655
+ return Object.freeze({
656
+ accounts: [
657
+ getAccountMeta("purchaser", accounts.purchaser),
658
+ getAccountMeta("pool", accounts.pool),
659
+ getAccountMeta("draw", accounts.draw),
660
+ getAccountMeta("activity", accounts.activity),
661
+ getAccountMeta("mint", accounts.mint),
662
+ getAccountMeta("quoteMint", accounts.quoteMint),
663
+ getAccountMeta("vault", accounts.vault),
664
+ getAccountMeta("userTokens", accounts.userTokens),
665
+ getAccountMeta("venue", accounts.venue),
666
+ getAccountMeta("identity", accounts.identity),
667
+ getAccountMeta("queue", accounts.queue),
668
+ getAccountMeta("program", accounts.program),
669
+ getAccountMeta("slotHashes", accounts.slotHashes),
670
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
671
+ getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
672
+ getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
673
+ getAccountMeta("systemProgram", accounts.systemProgram)
674
+ ],
675
+ data: getBuyPacksInstructionDataEncoder().encode(args),
676
+ programAddress
677
+ });
678
+ }
679
+ function parseBuyPacksInstruction(instruction) {
680
+ if (instruction.accounts.length < 17) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
681
+ actualAccountMetas: instruction.accounts.length,
682
+ expectedAccountMetas: 17
683
+ });
684
+ let accountIndex = 0;
685
+ const getNextAccount = () => {
686
+ const accountMeta = instruction.accounts[accountIndex];
687
+ accountIndex += 1;
688
+ return accountMeta;
689
+ };
690
+ return {
691
+ programAddress: instruction.programAddress,
692
+ accounts: {
693
+ purchaser: getNextAccount(),
694
+ pool: getNextAccount(),
695
+ draw: getNextAccount(),
696
+ activity: getNextAccount(),
697
+ mint: getNextAccount(),
698
+ quoteMint: getNextAccount(),
699
+ vault: getNextAccount(),
700
+ userTokens: getNextAccount(),
701
+ venue: getNextAccount(),
702
+ identity: getNextAccount(),
703
+ queue: getNextAccount(),
704
+ program: getNextAccount(),
705
+ slotHashes: getNextAccount(),
706
+ tokenProgram: getNextAccount(),
707
+ quoteTokenProgram: getNextAccount(),
708
+ associatedTokenProgram: getNextAccount(),
709
+ systemProgram: getNextAccount()
710
+ },
711
+ data: getBuyPacksInstructionDataDecoder().decode(instruction.data)
712
+ };
713
+ }
714
+ //#endregion
715
+ //#region src/generated/instructions/claimPrize.ts
716
+ /**
717
+ * This code was AUTOGENERATED using the Codama library.
718
+ * Please DO NOT EDIT THIS FILE, instead use visitors
719
+ * to add features, then rerun Codama to update it.
720
+ *
721
+ * @see https://github.com/codama-idl/codama
722
+ */
723
+ const CLAIM_PRIZE_DISCRIMINATOR = new Uint8Array([
724
+ 157,
725
+ 233,
726
+ 139,
727
+ 121,
728
+ 246,
729
+ 62,
730
+ 234,
731
+ 235
732
+ ]);
733
+ function getClaimPrizeDiscriminatorBytes() {
734
+ return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_PRIZE_DISCRIMINATOR);
735
+ }
736
+ function getClaimPrizeInstructionDataEncoder() {
737
+ return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
738
+ ...value,
739
+ discriminator: CLAIM_PRIZE_DISCRIMINATOR
740
+ }));
741
+ }
742
+ function getClaimPrizeInstructionDataDecoder() {
743
+ return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
744
+ }
745
+ function getClaimPrizeInstructionDataCodec() {
746
+ return combineCodec(getClaimPrizeInstructionDataEncoder(), getClaimPrizeInstructionDataDecoder());
747
+ }
748
+ async function getClaimPrizeInstructionAsync(input, config) {
749
+ const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
750
+ const accounts = {
751
+ payer: {
752
+ value: input.payer ?? null,
753
+ isWritable: true
754
+ },
755
+ pool: {
756
+ value: input.pool ?? null,
757
+ isWritable: true
758
+ },
759
+ draw: {
760
+ value: input.draw ?? null,
761
+ isWritable: true
762
+ },
763
+ purchaser: {
764
+ value: input.purchaser ?? null,
765
+ isWritable: true
766
+ },
767
+ mint: {
768
+ value: input.mint ?? null,
769
+ isWritable: false
770
+ },
771
+ vault: {
772
+ value: input.vault ?? null,
773
+ isWritable: true
774
+ },
775
+ userTokens: {
776
+ value: input.userTokens ?? null,
777
+ isWritable: true
778
+ },
779
+ tokenProgram: {
780
+ value: input.tokenProgram ?? null,
781
+ isWritable: false
782
+ },
783
+ associatedTokenProgram: {
784
+ value: input.associatedTokenProgram ?? null,
785
+ isWritable: false
786
+ },
787
+ systemProgram: {
788
+ value: input.systemProgram ?? null,
789
+ isWritable: false
790
+ }
791
+ };
792
+ if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
793
+ if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
794
+ programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
795
+ seeds: [
796
+ getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
797
+ getBytesEncoder().encode(new Uint8Array([
798
+ 6,
799
+ 221,
800
+ 246,
801
+ 225,
802
+ 215,
803
+ 101,
804
+ 161,
805
+ 147,
806
+ 217,
807
+ 203,
808
+ 225,
809
+ 70,
810
+ 206,
811
+ 235,
812
+ 121,
813
+ 172,
814
+ 28,
815
+ 180,
816
+ 133,
817
+ 237,
818
+ 95,
819
+ 91,
820
+ 55,
821
+ 145,
822
+ 58,
823
+ 140,
824
+ 245,
825
+ 133,
826
+ 126,
827
+ 255,
828
+ 0,
829
+ 169
830
+ ])),
831
+ getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
832
+ ]
833
+ });
834
+ if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
835
+ if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
836
+ if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
837
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
838
+ return Object.freeze({
839
+ accounts: [
840
+ getAccountMeta("payer", accounts.payer),
841
+ getAccountMeta("pool", accounts.pool),
842
+ getAccountMeta("draw", accounts.draw),
843
+ getAccountMeta("purchaser", accounts.purchaser),
844
+ getAccountMeta("mint", accounts.mint),
845
+ getAccountMeta("vault", accounts.vault),
846
+ getAccountMeta("userTokens", accounts.userTokens),
847
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
848
+ getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
849
+ getAccountMeta("systemProgram", accounts.systemProgram)
850
+ ],
851
+ data: getClaimPrizeInstructionDataEncoder().encode({}),
852
+ programAddress
853
+ });
854
+ }
855
+ function getClaimPrizeInstruction(input, config) {
856
+ const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
857
+ const accounts = {
858
+ payer: {
859
+ value: input.payer ?? null,
860
+ isWritable: true
861
+ },
862
+ pool: {
863
+ value: input.pool ?? null,
864
+ isWritable: true
865
+ },
866
+ draw: {
867
+ value: input.draw ?? null,
868
+ isWritable: true
869
+ },
870
+ purchaser: {
871
+ value: input.purchaser ?? null,
872
+ isWritable: true
873
+ },
874
+ mint: {
875
+ value: input.mint ?? null,
876
+ isWritable: false
877
+ },
878
+ vault: {
879
+ value: input.vault ?? null,
880
+ isWritable: true
881
+ },
882
+ userTokens: {
883
+ value: input.userTokens ?? null,
884
+ isWritable: true
885
+ },
886
+ tokenProgram: {
887
+ value: input.tokenProgram ?? null,
888
+ isWritable: false
889
+ },
890
+ associatedTokenProgram: {
891
+ value: input.associatedTokenProgram ?? null,
892
+ isWritable: false
893
+ },
894
+ systemProgram: {
895
+ value: input.systemProgram ?? null,
896
+ isWritable: false
897
+ }
898
+ };
899
+ if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
900
+ if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
901
+ if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
902
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
903
+ return Object.freeze({
904
+ accounts: [
905
+ getAccountMeta("payer", accounts.payer),
906
+ getAccountMeta("pool", accounts.pool),
907
+ getAccountMeta("draw", accounts.draw),
908
+ getAccountMeta("purchaser", accounts.purchaser),
909
+ getAccountMeta("mint", accounts.mint),
910
+ getAccountMeta("vault", accounts.vault),
911
+ getAccountMeta("userTokens", accounts.userTokens),
912
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
913
+ getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
914
+ getAccountMeta("systemProgram", accounts.systemProgram)
915
+ ],
916
+ data: getClaimPrizeInstructionDataEncoder().encode({}),
917
+ programAddress
918
+ });
919
+ }
920
+ function parseClaimPrizeInstruction(instruction) {
921
+ if (instruction.accounts.length < 10) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
922
+ actualAccountMetas: instruction.accounts.length,
923
+ expectedAccountMetas: 10
924
+ });
925
+ let accountIndex = 0;
926
+ const getNextAccount = () => {
927
+ const accountMeta = instruction.accounts[accountIndex];
928
+ accountIndex += 1;
929
+ return accountMeta;
930
+ };
931
+ return {
932
+ programAddress: instruction.programAddress,
933
+ accounts: {
934
+ payer: getNextAccount(),
935
+ pool: getNextAccount(),
936
+ draw: getNextAccount(),
937
+ purchaser: getNextAccount(),
938
+ mint: getNextAccount(),
939
+ vault: getNextAccount(),
940
+ userTokens: getNextAccount(),
941
+ tokenProgram: getNextAccount(),
942
+ associatedTokenProgram: getNextAccount(),
943
+ systemProgram: getNextAccount()
944
+ },
945
+ data: getClaimPrizeInstructionDataDecoder().decode(instruction.data)
946
+ };
947
+ }
948
+ //#endregion
949
+ //#region src/generated/instructions/claimPrizeTo.ts
950
+ /**
951
+ * This code was AUTOGENERATED using the Codama library.
952
+ * Please DO NOT EDIT THIS FILE, instead use visitors
953
+ * to add features, then rerun Codama to update it.
954
+ *
955
+ * @see https://github.com/codama-idl/codama
956
+ */
957
+ const CLAIM_PRIZE_TO_DISCRIMINATOR = new Uint8Array([
958
+ 247,
959
+ 118,
960
+ 231,
961
+ 78,
962
+ 81,
963
+ 61,
964
+ 176,
965
+ 150
966
+ ]);
967
+ function getClaimPrizeToDiscriminatorBytes() {
968
+ return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_PRIZE_TO_DISCRIMINATOR);
969
+ }
970
+ function getClaimPrizeToInstructionDataEncoder() {
971
+ return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
972
+ ...value,
973
+ discriminator: CLAIM_PRIZE_TO_DISCRIMINATOR
974
+ }));
975
+ }
976
+ function getClaimPrizeToInstructionDataDecoder() {
977
+ return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
978
+ }
979
+ function getClaimPrizeToInstructionDataCodec() {
980
+ return combineCodec(getClaimPrizeToInstructionDataEncoder(), getClaimPrizeToInstructionDataDecoder());
981
+ }
982
+ async function getClaimPrizeToInstructionAsync(input, config) {
983
+ const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
984
+ const accounts = {
985
+ purchaser: {
986
+ value: input.purchaser ?? null,
987
+ isWritable: true
988
+ },
989
+ pool: {
990
+ value: input.pool ?? null,
991
+ isWritable: true
992
+ },
993
+ draw: {
994
+ value: input.draw ?? null,
995
+ isWritable: true
996
+ },
997
+ mint: {
998
+ value: input.mint ?? null,
999
+ isWritable: false
1000
+ },
1001
+ vault: {
1002
+ value: input.vault ?? null,
1003
+ isWritable: true
1004
+ },
1005
+ destination: {
1006
+ value: input.destination ?? null,
1007
+ isWritable: true
1008
+ },
1009
+ tokenProgram: {
1010
+ value: input.tokenProgram ?? null,
1011
+ isWritable: false
1012
+ }
1013
+ };
1014
+ if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
1015
+ if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
544
1016
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
545
1017
  return Object.freeze({
546
1018
  accounts: [
547
1019
  getAccountMeta("purchaser", accounts.purchaser),
548
1020
  getAccountMeta("pool", accounts.pool),
549
1021
  getAccountMeta("draw", accounts.draw),
550
- getAccountMeta("activity", accounts.activity),
551
1022
  getAccountMeta("mint", accounts.mint),
552
- getAccountMeta("quoteMint", accounts.quoteMint),
553
1023
  getAccountMeta("vault", accounts.vault),
554
- getAccountMeta("userTokens", accounts.userTokens),
555
- getAccountMeta("venue", accounts.venue),
556
- getAccountMeta("identity", accounts.identity),
557
- getAccountMeta("queue", accounts.queue),
558
- getAccountMeta("program", accounts.program),
559
- getAccountMeta("slotHashes", accounts.slotHashes),
560
- getAccountMeta("tokenProgram", accounts.tokenProgram),
561
- getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
562
- getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
563
- getAccountMeta("systemProgram", accounts.systemProgram)
1024
+ getAccountMeta("destination", accounts.destination),
1025
+ getAccountMeta("tokenProgram", accounts.tokenProgram)
564
1026
  ],
565
- data: getBuyPackInstructionDataEncoder().encode(args),
1027
+ data: getClaimPrizeToInstructionDataEncoder().encode({}),
566
1028
  programAddress
567
1029
  });
568
1030
  }
569
- function getBuyPackInstruction(input, config) {
1031
+ function getClaimPrizeToInstruction(input, config) {
570
1032
  const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
571
1033
  const accounts = {
572
1034
  purchaser: {
@@ -581,99 +1043,43 @@ function getBuyPackInstruction(input, config) {
581
1043
  value: input.draw ?? null,
582
1044
  isWritable: true
583
1045
  },
584
- activity: {
585
- value: input.activity ?? null,
586
- isWritable: true
587
- },
588
1046
  mint: {
589
1047
  value: input.mint ?? null,
590
1048
  isWritable: false
591
1049
  },
592
- quoteMint: {
593
- value: input.quoteMint ?? null,
594
- isWritable: false
595
- },
596
1050
  vault: {
597
1051
  value: input.vault ?? null,
598
1052
  isWritable: true
599
1053
  },
600
- userTokens: {
601
- value: input.userTokens ?? null,
602
- isWritable: true
603
- },
604
- venue: {
605
- value: input.venue ?? null,
606
- isWritable: false
607
- },
608
- identity: {
609
- value: input.identity ?? null,
610
- isWritable: false
611
- },
612
- queue: {
613
- value: input.queue ?? null,
1054
+ destination: {
1055
+ value: input.destination ?? null,
614
1056
  isWritable: true
615
1057
  },
616
- program: {
617
- value: input.program ?? null,
618
- isWritable: false
619
- },
620
- slotHashes: {
621
- value: input.slotHashes ?? null,
622
- isWritable: false
623
- },
624
1058
  tokenProgram: {
625
1059
  value: input.tokenProgram ?? null,
626
1060
  isWritable: false
627
- },
628
- quoteTokenProgram: {
629
- value: input.quoteTokenProgram ?? null,
630
- isWritable: false
631
- },
632
- associatedTokenProgram: {
633
- value: input.associatedTokenProgram ?? null,
634
- isWritable: false
635
- },
636
- systemProgram: {
637
- value: input.systemProgram ?? null,
638
- isWritable: false
639
1061
  }
640
1062
  };
641
- const args = { ...input };
642
- if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
643
- if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
644
- if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
645
1063
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
646
- if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
647
- if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
648
1064
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
649
1065
  return Object.freeze({
650
1066
  accounts: [
651
1067
  getAccountMeta("purchaser", accounts.purchaser),
652
1068
  getAccountMeta("pool", accounts.pool),
653
1069
  getAccountMeta("draw", accounts.draw),
654
- getAccountMeta("activity", accounts.activity),
655
1070
  getAccountMeta("mint", accounts.mint),
656
- getAccountMeta("quoteMint", accounts.quoteMint),
657
1071
  getAccountMeta("vault", accounts.vault),
658
- getAccountMeta("userTokens", accounts.userTokens),
659
- getAccountMeta("venue", accounts.venue),
660
- getAccountMeta("identity", accounts.identity),
661
- getAccountMeta("queue", accounts.queue),
662
- getAccountMeta("program", accounts.program),
663
- getAccountMeta("slotHashes", accounts.slotHashes),
664
- getAccountMeta("tokenProgram", accounts.tokenProgram),
665
- getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
666
- getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
667
- getAccountMeta("systemProgram", accounts.systemProgram)
1072
+ getAccountMeta("destination", accounts.destination),
1073
+ getAccountMeta("tokenProgram", accounts.tokenProgram)
668
1074
  ],
669
- data: getBuyPackInstructionDataEncoder().encode(args),
1075
+ data: getClaimPrizeToInstructionDataEncoder().encode({}),
670
1076
  programAddress
671
1077
  });
672
1078
  }
673
- function parseBuyPackInstruction(instruction) {
674
- if (instruction.accounts.length < 17) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1079
+ function parseClaimPrizeToInstruction(instruction) {
1080
+ if (instruction.accounts.length < 7) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
675
1081
  actualAccountMetas: instruction.accounts.length,
676
- expectedAccountMetas: 17
1082
+ expectedAccountMetas: 7
677
1083
  });
678
1084
  let accountIndex = 0;
679
1085
  const getNextAccount = () => {
@@ -687,22 +1093,12 @@ function parseBuyPackInstruction(instruction) {
687
1093
  purchaser: getNextAccount(),
688
1094
  pool: getNextAccount(),
689
1095
  draw: getNextAccount(),
690
- activity: getNextAccount(),
691
1096
  mint: getNextAccount(),
692
- quoteMint: getNextAccount(),
693
1097
  vault: getNextAccount(),
694
- userTokens: getNextAccount(),
695
- venue: getNextAccount(),
696
- identity: getNextAccount(),
697
- queue: getNextAccount(),
698
- program: getNextAccount(),
699
- slotHashes: getNextAccount(),
700
- tokenProgram: getNextAccount(),
701
- quoteTokenProgram: getNextAccount(),
702
- associatedTokenProgram: getNextAccount(),
703
- systemProgram: getNextAccount()
1098
+ destination: getNextAccount(),
1099
+ tokenProgram: getNextAccount()
704
1100
  },
705
- data: getBuyPackInstructionDataDecoder().decode(instruction.data)
1101
+ data: getClaimPrizeToInstructionDataDecoder().decode(instruction.data)
706
1102
  };
707
1103
  }
708
1104
  //#endregion
@@ -731,7 +1127,7 @@ function getDeliverDrawInstructionDataEncoder() {
731
1127
  return transformEncoder(getStructEncoder([
732
1128
  ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
733
1129
  ["randomness", fixEncoderSize(getBytesEncoder(), 32)],
734
- ["seq", getU64Encoder()]
1130
+ ["seqStart", getU64Encoder()]
735
1131
  ]), (value) => ({
736
1132
  ...value,
737
1133
  discriminator: DELIVER_DRAW_DISCRIMINATOR
@@ -741,7 +1137,7 @@ function getDeliverDrawInstructionDataDecoder() {
741
1137
  return getStructDecoder([
742
1138
  ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
743
1139
  ["randomness", fixDecoderSize(getBytesDecoder(), 32)],
744
- ["seq", getU64Decoder()]
1140
+ ["seqStart", getU64Decoder()]
745
1141
  ]);
746
1142
  }
747
1143
  function getDeliverDrawInstructionDataCodec() {
@@ -831,51 +1227,6 @@ async function getDeliverDrawInstructionAsync(input, config) {
831
1227
  ]))]
832
1228
  });
833
1229
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
834
- if (!accounts.draw.value) accounts.draw.value = await findDrawPda({
835
- pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
836
- seq: getNonNullResolvedInstructionInput("seq", args.seq)
837
- }, { programAddress });
838
- if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
839
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
840
- seeds: [
841
- getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
842
- getBytesEncoder().encode(new Uint8Array([
843
- 6,
844
- 221,
845
- 246,
846
- 225,
847
- 215,
848
- 101,
849
- 161,
850
- 147,
851
- 217,
852
- 203,
853
- 225,
854
- 70,
855
- 206,
856
- 235,
857
- 121,
858
- 172,
859
- 28,
860
- 180,
861
- 133,
862
- 237,
863
- 95,
864
- 91,
865
- 55,
866
- 145,
867
- 58,
868
- 140,
869
- 245,
870
- 133,
871
- 126,
872
- 255,
873
- 0,
874
- 169
875
- ])),
876
- getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
877
- ]
878
- });
879
1230
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
880
1231
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
881
1232
  return Object.freeze({
@@ -1040,47 +1391,6 @@ async function getExpireDrawInstructionAsync(input, config) {
1040
1391
  }
1041
1392
  };
1042
1393
  if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
1043
- if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
1044
- programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
1045
- seeds: [
1046
- getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
1047
- getBytesEncoder().encode(new Uint8Array([
1048
- 6,
1049
- 221,
1050
- 246,
1051
- 225,
1052
- 215,
1053
- 101,
1054
- 161,
1055
- 147,
1056
- 217,
1057
- 203,
1058
- 225,
1059
- 70,
1060
- 206,
1061
- 235,
1062
- 121,
1063
- 172,
1064
- 28,
1065
- 180,
1066
- 133,
1067
- 237,
1068
- 95,
1069
- 91,
1070
- 55,
1071
- 145,
1072
- 58,
1073
- 140,
1074
- 245,
1075
- 133,
1076
- 126,
1077
- 255,
1078
- 0,
1079
- 169
1080
- ])),
1081
- getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
1082
- ]
1083
- });
1084
1394
  if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1085
1395
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
1086
1396
  return Object.freeze({
@@ -2055,24 +2365,24 @@ let GaboxAccount = /* @__PURE__ */ function(GaboxAccount) {
2055
2365
  function identifyGaboxAccount(account) {
2056
2366
  const data = "data" in account ? account.data : account;
2057
2367
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2058
- 101,
2059
- 31,
2060
- 52,
2061
- 179,
2062
- 121,
2063
- 78,
2064
- 252,
2065
- 89
2368
+ 27,
2369
+ 129,
2370
+ 22,
2371
+ 20,
2372
+ 6,
2373
+ 20,
2374
+ 18,
2375
+ 20
2066
2376
  ])), 0)) return 0;
2067
2377
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2068
- 153,
2069
- 115,
2070
- 78,
2071
- 55,
2072
- 156,
2073
- 26,
2074
- 133,
2075
- 45
2378
+ 48,
2379
+ 150,
2380
+ 170,
2381
+ 25,
2382
+ 50,
2383
+ 211,
2384
+ 226,
2385
+ 239
2076
2386
  ])), 0)) return 1;
2077
2387
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2078
2388
  212,
@@ -2091,11 +2401,12 @@ function identifyGaboxAccount(account) {
2091
2401
  }
2092
2402
  let GaboxEvent = /* @__PURE__ */ function(GaboxEvent) {
2093
2403
  GaboxEvent[GaboxEvent["DrawResolved"] = 0] = "DrawResolved";
2094
- GaboxEvent[GaboxEvent["PackBought"] = 1] = "PackBought";
2404
+ GaboxEvent[GaboxEvent["PacksBought"] = 1] = "PacksBought";
2095
2405
  GaboxEvent[GaboxEvent["PoolCreated"] = 2] = "PoolCreated";
2096
- GaboxEvent[GaboxEvent["PrizesFunded"] = 3] = "PrizesFunded";
2097
- GaboxEvent[GaboxEvent["RandomnessRetried"] = 4] = "RandomnessRetried";
2098
- GaboxEvent[GaboxEvent["TokensSold"] = 5] = "TokensSold";
2406
+ GaboxEvent[GaboxEvent["PrizeClaimed"] = 3] = "PrizeClaimed";
2407
+ GaboxEvent[GaboxEvent["PrizesFunded"] = 4] = "PrizesFunded";
2408
+ GaboxEvent[GaboxEvent["RandomnessRetried"] = 5] = "RandomnessRetried";
2409
+ GaboxEvent[GaboxEvent["TokensSold"] = 6] = "TokensSold";
2099
2410
  return GaboxEvent;
2100
2411
  }({});
2101
2412
  function identifyGaboxEvent(event) {
@@ -2111,14 +2422,14 @@ function identifyGaboxEvent(event) {
2111
2422
  218
2112
2423
  ])), 0)) return 0;
2113
2424
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2114
- 220,
2115
- 208,
2116
- 74,
2117
- 75,
2118
- 42,
2119
- 144,
2120
- 231,
2121
- 69
2425
+ 44,
2426
+ 243,
2427
+ 223,
2428
+ 11,
2429
+ 90,
2430
+ 23,
2431
+ 184,
2432
+ 47
2122
2433
  ])), 0)) return 1;
2123
2434
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2124
2435
  202,
@@ -2130,6 +2441,16 @@ function identifyGaboxEvent(event) {
2130
2441
  157,
2131
2442
  82
2132
2443
  ])), 0)) return 2;
2444
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2445
+ 213,
2446
+ 150,
2447
+ 192,
2448
+ 76,
2449
+ 199,
2450
+ 33,
2451
+ 212,
2452
+ 38
2453
+ ])), 0)) return 3;
2133
2454
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2134
2455
  188,
2135
2456
  129,
@@ -2139,7 +2460,7 @@ function identifyGaboxEvent(event) {
2139
2460
  71,
2140
2461
  53,
2141
2462
  60
2142
- ])), 0)) return 3;
2463
+ ])), 0)) return 4;
2143
2464
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2144
2465
  243,
2145
2466
  30,
@@ -2149,7 +2470,7 @@ function identifyGaboxEvent(event) {
2149
2470
  127,
2150
2471
  52,
2151
2472
  140
2152
- ])), 0)) return 4;
2473
+ ])), 0)) return 5;
2153
2474
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2154
2475
  217,
2155
2476
  83,
@@ -2159,31 +2480,53 @@ function identifyGaboxEvent(event) {
2159
2480
  225,
2160
2481
  94,
2161
2482
  45
2162
- ])), 0)) return 5;
2483
+ ])), 0)) return 6;
2163
2484
  throw new Error("The provided event could not be identified as a gabox event.");
2164
2485
  }
2165
2486
  let GaboxInstruction = /* @__PURE__ */ function(GaboxInstruction) {
2166
- GaboxInstruction[GaboxInstruction["BuyPack"] = 0] = "BuyPack";
2167
- GaboxInstruction[GaboxInstruction["DeliverDraw"] = 1] = "DeliverDraw";
2168
- GaboxInstruction[GaboxInstruction["ExpireDraw"] = 2] = "ExpireDraw";
2169
- GaboxInstruction[GaboxInstruction["FundPrizes"] = 3] = "FundPrizes";
2170
- GaboxInstruction[GaboxInstruction["InitializePool"] = 4] = "InitializePool";
2171
- GaboxInstruction[GaboxInstruction["RetryDraw"] = 5] = "RetryDraw";
2172
- GaboxInstruction[GaboxInstruction["SellTokens"] = 6] = "SellTokens";
2487
+ GaboxInstruction[GaboxInstruction["BuyPacks"] = 0] = "BuyPacks";
2488
+ GaboxInstruction[GaboxInstruction["ClaimPrize"] = 1] = "ClaimPrize";
2489
+ GaboxInstruction[GaboxInstruction["ClaimPrizeTo"] = 2] = "ClaimPrizeTo";
2490
+ GaboxInstruction[GaboxInstruction["DeliverDraw"] = 3] = "DeliverDraw";
2491
+ GaboxInstruction[GaboxInstruction["ExpireDraw"] = 4] = "ExpireDraw";
2492
+ GaboxInstruction[GaboxInstruction["FundPrizes"] = 5] = "FundPrizes";
2493
+ GaboxInstruction[GaboxInstruction["InitializePool"] = 6] = "InitializePool";
2494
+ GaboxInstruction[GaboxInstruction["RetryDraw"] = 7] = "RetryDraw";
2495
+ GaboxInstruction[GaboxInstruction["SellTokens"] = 8] = "SellTokens";
2173
2496
  return GaboxInstruction;
2174
2497
  }({});
2175
2498
  function identifyGaboxInstruction(instruction) {
2176
2499
  const data = "data" in instruction ? instruction.data : instruction;
2177
2500
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2178
- 151,
2179
- 46,
2180
- 141,
2181
- 93,
2182
- 174,
2183
- 5,
2184
- 49,
2185
- 173
2501
+ 136,
2502
+ 30,
2503
+ 10,
2504
+ 209,
2505
+ 228,
2506
+ 139,
2507
+ 105,
2508
+ 138
2186
2509
  ])), 0)) return 0;
2510
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2511
+ 157,
2512
+ 233,
2513
+ 139,
2514
+ 121,
2515
+ 246,
2516
+ 62,
2517
+ 234,
2518
+ 235
2519
+ ])), 0)) return 1;
2520
+ if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2521
+ 247,
2522
+ 118,
2523
+ 231,
2524
+ 78,
2525
+ 81,
2526
+ 61,
2527
+ 176,
2528
+ 150
2529
+ ])), 0)) return 2;
2187
2530
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2188
2531
  113,
2189
2532
  181,
@@ -2193,7 +2536,7 @@ function identifyGaboxInstruction(instruction) {
2193
2536
  138,
2194
2537
  199,
2195
2538
  51
2196
- ])), 0)) return 1;
2539
+ ])), 0)) return 3;
2197
2540
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2198
2541
  100,
2199
2542
  119,
@@ -2203,7 +2546,7 @@ function identifyGaboxInstruction(instruction) {
2203
2546
  25,
2204
2547
  252,
2205
2548
  255
2206
- ])), 0)) return 2;
2549
+ ])), 0)) return 4;
2207
2550
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2208
2551
  163,
2209
2552
  225,
@@ -2213,7 +2556,7 @@ function identifyGaboxInstruction(instruction) {
2213
2556
  171,
2214
2557
  29,
2215
2558
  241
2216
- ])), 0)) return 3;
2559
+ ])), 0)) return 5;
2217
2560
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2218
2561
  95,
2219
2562
  180,
@@ -2223,7 +2566,7 @@ function identifyGaboxInstruction(instruction) {
2223
2566
  174,
2224
2567
  232,
2225
2568
  40
2226
- ])), 0)) return 4;
2569
+ ])), 0)) return 6;
2227
2570
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2228
2571
  112,
2229
2572
  118,
@@ -2233,7 +2576,7 @@ function identifyGaboxInstruction(instruction) {
2233
2576
  39,
2234
2577
  196,
2235
2578
  96
2236
- ])), 0)) return 5;
2579
+ ])), 0)) return 7;
2237
2580
  if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
2238
2581
  114,
2239
2582
  242,
@@ -2243,7 +2586,7 @@ function identifyGaboxInstruction(instruction) {
2243
2586
  126,
2244
2587
  92,
2245
2588
  2
2246
- ])), 0)) return 6;
2589
+ ])), 0)) return 8;
2247
2590
  throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2248
2591
  instructionData: data,
2249
2592
  programName: "gabox"
@@ -2256,42 +2599,54 @@ function parseGaboxInstruction(instruction) {
2256
2599
  assertIsInstructionWithAccounts(instruction);
2257
2600
  return {
2258
2601
  instructionType: 0,
2259
- ...parseBuyPackInstruction(instruction)
2602
+ ...parseBuyPacksInstruction(instruction)
2260
2603
  };
2261
2604
  case 1:
2262
2605
  assertIsInstructionWithAccounts(instruction);
2263
2606
  return {
2264
2607
  instructionType: 1,
2265
- ...parseDeliverDrawInstruction(instruction)
2608
+ ...parseClaimPrizeInstruction(instruction)
2266
2609
  };
2267
2610
  case 2:
2268
2611
  assertIsInstructionWithAccounts(instruction);
2269
2612
  return {
2270
2613
  instructionType: 2,
2271
- ...parseExpireDrawInstruction(instruction)
2614
+ ...parseClaimPrizeToInstruction(instruction)
2272
2615
  };
2273
2616
  case 3:
2274
2617
  assertIsInstructionWithAccounts(instruction);
2275
2618
  return {
2276
2619
  instructionType: 3,
2277
- ...parseFundPrizesInstruction(instruction)
2620
+ ...parseDeliverDrawInstruction(instruction)
2278
2621
  };
2279
2622
  case 4:
2280
2623
  assertIsInstructionWithAccounts(instruction);
2281
2624
  return {
2282
2625
  instructionType: 4,
2283
- ...parseInitializePoolInstruction(instruction)
2626
+ ...parseExpireDrawInstruction(instruction)
2284
2627
  };
2285
2628
  case 5:
2286
2629
  assertIsInstructionWithAccounts(instruction);
2287
2630
  return {
2288
2631
  instructionType: 5,
2289
- ...parseRetryDrawInstruction(instruction)
2632
+ ...parseFundPrizesInstruction(instruction)
2290
2633
  };
2291
2634
  case 6:
2292
2635
  assertIsInstructionWithAccounts(instruction);
2293
2636
  return {
2294
2637
  instructionType: 6,
2638
+ ...parseInitializePoolInstruction(instruction)
2639
+ };
2640
+ case 7:
2641
+ assertIsInstructionWithAccounts(instruction);
2642
+ return {
2643
+ instructionType: 7,
2644
+ ...parseRetryDrawInstruction(instruction)
2645
+ };
2646
+ case 8:
2647
+ assertIsInstructionWithAccounts(instruction);
2648
+ return {
2649
+ instructionType: 8,
2295
2650
  ...parseSellTokensInstruction(instruction)
2296
2651
  };
2297
2652
  default: throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
@@ -2309,7 +2664,12 @@ function gaboxProgram() {
2309
2664
  walletActivity: addSelfFetchFunctions(client, getWalletActivityCodec())
2310
2665
  },
2311
2666
  instructions: {
2312
- buyPack: (input) => addSelfPlanAndSendFunctions(client, getBuyPackInstructionAsync(input)),
2667
+ buyPacks: (input) => addSelfPlanAndSendFunctions(client, getBuyPacksInstructionAsync(input)),
2668
+ claimPrize: (input) => addSelfPlanAndSendFunctions(client, getClaimPrizeInstructionAsync({
2669
+ ...input,
2670
+ payer: input.payer ?? client.payer
2671
+ })),
2672
+ claimPrizeTo: (input) => addSelfPlanAndSendFunctions(client, getClaimPrizeToInstructionAsync(input)),
2313
2673
  deliverDraw: (input) => addSelfPlanAndSendFunctions(client, getDeliverDrawInstructionAsync(input)),
2314
2674
  expireDraw: (input) => addSelfPlanAndSendFunctions(client, getExpireDrawInstructionAsync(input)),
2315
2675
  fundPrizes: (input) => addSelfPlanAndSendFunctions(client, getFundPrizesInstructionAsync(input)),
@@ -2322,9 +2682,9 @@ function gaboxProgram() {
2322
2682
  },
2323
2683
  pdas: {
2324
2684
  pool: findPoolPda,
2685
+ draw: findDrawPda,
2325
2686
  activity: findActivityPda,
2326
- identity: findIdentityPda,
2327
- draw: findDrawPda
2687
+ identity: findIdentityPda
2328
2688
  },
2329
2689
  identifyAccount: identifyGaboxAccount,
2330
2690
  identifyInstruction: identifyGaboxInstruction,
@@ -2333,6 +2693,6 @@ function gaboxProgram() {
2333
2693
  };
2334
2694
  }
2335
2695
  //#endregion
2336
- export { getDeliverDrawInstructionAsync as $, getPrizeDecoder as $t, getInitializePoolInstructionDataCodec as A, fetchAllPool as At, getFundPrizesInstructionDataEncoder as B, fetchAllDraw as Bt, getRetryDrawInstructionDataDecoder as C, getWalletActivityDecoder as Ct, getInitializePoolDiscriminatorBytes as D, POOL_DISCRIMINATOR as Dt, INITIALIZE_POOL_DISCRIMINATOR as E, getWalletActivitySize as Et, getFundPrizesDiscriminatorBytes as F, getPoolDiscriminatorBytes as Ft, getExpireDrawInstructionAsync as G, getDrawDecoder as Gt, EXPIRE_DRAW_DISCRIMINATOR as H, fetchDraw as Ht, getFundPrizesInstruction as I, getPoolEncoder as It, getExpireDrawInstructionDataEncoder as J, getDrawSize as Jt, getExpireDrawInstructionDataCodec as K, getDrawDiscriminatorBytes as Kt, getFundPrizesInstructionAsync as L, getPoolSize as Lt, getInitializePoolInstructionDataEncoder as M, fetchPool as Mt, parseInitializePoolInstruction as N, getPoolCodec as Nt, getInitializePoolInstruction as O, decodePool as Ot, FUND_PRIZES_DISCRIMINATOR as P, getPoolDecoder as Pt, getDeliverDrawInstruction as Q, getPrizeCodec as Qt, getFundPrizesInstructionDataCodec as R, DRAW_DISCRIMINATOR as Rt, getRetryDrawInstructionDataCodec as S, getWalletActivityCodec as St, parseRetryDrawInstruction as T, getWalletActivityEncoder as Tt, getExpireDrawDiscriminatorBytes as U, fetchMaybeDraw as Ut, parseFundPrizesInstruction as V, fetchAllMaybeDraw as Vt, getExpireDrawInstruction as W, getDrawCodec as Wt, DELIVER_DRAW_DISCRIMINATOR as X, getTierDecoder as Xt, parseExpireDrawInstruction as Y, getTierCodec as Yt, getDeliverDrawDiscriminatorBytes as Z, getTierEncoder as Zt, parseSellTokensInstruction as _, decodeWalletActivity as _t, gaboxProgram as a, getBuyPackDiscriminatorBytes as at, getRetryDrawInstruction as b, fetchMaybeWalletActivity as bt, identifyGaboxInstruction as c, getBuyPackInstructionDataCodec as ct, getSellTokensDiscriminatorBytes as d, parseBuyPackInstruction as dt, getPrizeEncoder as en, getDeliverDrawInstructionDataCodec as et, getSellTokensInstruction as f, findPoolPda as ft, getSellTokensInstructionDataEncoder as g, WALLET_ACTIVITY_DISCRIMINATOR as gt, getSellTokensInstructionDataDecoder as h, findActivityPda as ht, GaboxInstruction as i, BUY_PACK_DISCRIMINATOR as it, getInitializePoolInstructionDataDecoder as j, fetchMaybePool as jt, getInitializePoolInstructionAsync as k, fetchAllMaybePool as kt, parseGaboxInstruction as l, getBuyPackInstructionDataDecoder as lt, getSellTokensInstructionDataCodec as m, findDrawPda as mt, GaboxAccount as n, getDeliverDrawInstructionDataEncoder as nt, identifyGaboxAccount as o, getBuyPackInstruction as ot, getSellTokensInstructionAsync as p, findIdentityPda as pt, getExpireDrawInstructionDataDecoder as q, getDrawEncoder as qt, GaboxEvent as r, parseDeliverDrawInstruction as rt, identifyGaboxEvent as s, getBuyPackInstructionAsync as st, GABOX_PROGRAM_ADDRESS as t, getDeliverDrawInstructionDataDecoder as tt, SELL_TOKENS_DISCRIMINATOR as u, getBuyPackInstructionDataEncoder as ut, RETRY_DRAW_DISCRIMINATOR as v, fetchAllMaybeWalletActivity as vt, getRetryDrawInstructionDataEncoder as w, getWalletActivityDiscriminatorBytes as wt, getRetryDrawInstructionAsync as x, fetchWalletActivity as xt, getRetryDrawDiscriminatorBytes as y, fetchAllWalletActivity as yt, getFundPrizesInstructionDataDecoder as z, decodeDraw as zt };
2696
+ export { getDeliverDrawInstructionAsync as $, getPoolSize as $t, getInitializePoolInstructionDataCodec as A, findDrawPda as At, getFundPrizesInstructionDataEncoder as B, getWalletActivityDiscriminatorBytes as Bt, getRetryDrawInstructionDataDecoder as C, getBuyPacksInstructionAsync as Ct, getInitializePoolDiscriminatorBytes as D, parseBuyPacksInstruction as Dt, INITIALIZE_POOL_DISCRIMINATOR as E, getBuyPacksInstructionDataEncoder as Et, getFundPrizesDiscriminatorBytes as F, fetchAllWalletActivity as Ft, getExpireDrawInstructionAsync as G, fetchAllMaybePool as Gt, EXPIRE_DRAW_DISCRIMINATOR as H, getWalletActivitySize as Ht, getFundPrizesInstruction as I, fetchMaybeWalletActivity as It, getExpireDrawInstructionDataEncoder as J, fetchPool as Jt, getExpireDrawInstructionDataCodec as K, fetchAllPool as Kt, getFundPrizesInstructionAsync as L, fetchWalletActivity as Lt, getInitializePoolInstructionDataEncoder as M, WALLET_ACTIVITY_DISCRIMINATOR as Mt, parseInitializePoolInstruction as N, decodeWalletActivity as Nt, getInitializePoolInstruction as O, findPoolPda as Ot, FUND_PRIZES_DISCRIMINATOR as P, fetchAllMaybeWalletActivity as Pt, getDeliverDrawInstruction as Q, getPoolEncoder as Qt, getFundPrizesInstructionDataCodec as R, getWalletActivityCodec as Rt, getRetryDrawInstructionDataCodec as S, getBuyPacksInstruction as St, parseRetryDrawInstruction as T, getBuyPacksInstructionDataDecoder as Tt, getExpireDrawDiscriminatorBytes as U, POOL_DISCRIMINATOR as Ut, parseFundPrizesInstruction as V, getWalletActivityEncoder as Vt, getExpireDrawInstruction as W, decodePool as Wt, DELIVER_DRAW_DISCRIMINATOR as X, getPoolDecoder as Xt, parseExpireDrawInstruction as Y, getPoolCodec as Yt, getDeliverDrawDiscriminatorBytes as Z, getPoolDiscriminatorBytes as Zt, parseSellTokensInstruction as _, getClaimPrizeInstructionDataDecoder as _t, gaboxProgram as a, fetchMaybeDraw as an, getClaimPrizeToDiscriminatorBytes as at, getRetryDrawInstruction as b, BUY_PACKS_DISCRIMINATOR as bt, identifyGaboxInstruction as c, getDrawDiscriminatorBytes as cn, getClaimPrizeToInstructionDataCodec as ct, getSellTokensDiscriminatorBytes as d, getTierCodec as dn, parseClaimPrizeToInstruction as dt, DRAW_DISCRIMINATOR as en, getDeliverDrawInstructionDataCodec as et, getSellTokensInstruction as f, getTierDecoder as fn, CLAIM_PRIZE_DISCRIMINATOR as ft, getSellTokensInstructionDataEncoder as g, getClaimPrizeInstructionDataCodec as gt, getSellTokensInstructionDataDecoder as h, getClaimPrizeInstructionAsync as ht, GaboxInstruction as i, fetchDraw as in, CLAIM_PRIZE_TO_DISCRIMINATOR as it, getInitializePoolInstructionDataDecoder as j, findActivityPda as jt, getInitializePoolInstructionAsync as k, findIdentityPda as kt, parseGaboxInstruction as l, getDrawEncoder as ln, getClaimPrizeToInstructionDataDecoder as lt, getSellTokensInstructionDataCodec as m, getClaimPrizeInstruction as mt, GaboxAccount as n, fetchAllDraw as nn, getDeliverDrawInstructionDataEncoder as nt, identifyGaboxAccount as o, getDrawCodec as on, getClaimPrizeToInstruction as ot, getSellTokensInstructionAsync as p, getTierEncoder as pn, getClaimPrizeDiscriminatorBytes as pt, getExpireDrawInstructionDataDecoder as q, fetchMaybePool as qt, GaboxEvent as r, fetchAllMaybeDraw as rn, parseDeliverDrawInstruction as rt, identifyGaboxEvent as s, getDrawDecoder as sn, getClaimPrizeToInstructionAsync as st, GABOX_PROGRAM_ADDRESS as t, decodeDraw as tn, getDeliverDrawInstructionDataDecoder as tt, SELL_TOKENS_DISCRIMINATOR as u, getDrawSize as un, getClaimPrizeToInstructionDataEncoder as ut, RETRY_DRAW_DISCRIMINATOR as v, getClaimPrizeInstructionDataEncoder as vt, getRetryDrawInstructionDataEncoder as w, getBuyPacksInstructionDataCodec as wt, getRetryDrawInstructionAsync as x, getBuyPacksDiscriminatorBytes as xt, getRetryDrawDiscriminatorBytes as y, parseClaimPrizeInstruction as yt, getFundPrizesInstructionDataDecoder as z, getWalletActivityDecoder as zt };
2337
2697
 
2338
- //# sourceMappingURL=gabox-DGTCh34U.js.map
2698
+ //# sourceMappingURL=gabox-CuyJYmrS.js.map