@1upmonster/duel 0.1.8 → 0.2.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.
Files changed (186) hide show
  1. package/README.md +110 -59
  2. package/dist/admin.d.ts +25 -40
  3. package/dist/admin.js +93 -114
  4. package/dist/encryption.js +1 -2
  5. package/dist/generated/duel/accounts/index.d.ts +10 -0
  6. package/dist/generated/duel/accounts/index.js +11 -0
  7. package/dist/generated/duel/accounts/matchTicket.d.ts +38 -0
  8. package/dist/generated/duel/accounts/matchTicket.js +45 -0
  9. package/dist/generated/duel/accounts/queue.d.ts +42 -0
  10. package/dist/generated/duel/accounts/queue.js +45 -0
  11. package/dist/generated/duel/accounts/tenant.d.ts +41 -0
  12. package/dist/generated/duel/accounts/tenant.js +44 -0
  13. package/dist/generated/duel/errors/duel.d.ts +31 -0
  14. package/dist/generated/duel/errors/duel.js +35 -0
  15. package/dist/generated/duel/errors/index.d.ts +8 -0
  16. package/dist/generated/duel/errors/index.js +9 -0
  17. package/dist/generated/duel/index.d.ts +12 -0
  18. package/dist/generated/duel/index.js +13 -0
  19. package/dist/generated/duel/instructions/cancelTicket.d.ts +45 -0
  20. package/dist/generated/duel/instructions/cancelTicket.js +56 -0
  21. package/dist/generated/duel/instructions/closeTicket.d.ts +45 -0
  22. package/dist/generated/duel/instructions/closeTicket.js +56 -0
  23. package/dist/generated/duel/instructions/commitTickets.d.ts +39 -0
  24. package/dist/generated/duel/instructions/commitTickets.js +50 -0
  25. package/dist/generated/duel/instructions/createTicket.d.ts +48 -0
  26. package/dist/generated/duel/instructions/createTicket.js +63 -0
  27. package/dist/generated/duel/instructions/delegateQueue.d.ts +69 -0
  28. package/dist/generated/duel/instructions/delegateQueue.js +90 -0
  29. package/dist/generated/duel/instructions/delegateTicket.d.ts +69 -0
  30. package/dist/generated/duel/instructions/delegateTicket.js +90 -0
  31. package/dist/generated/duel/instructions/flushMatches.d.ts +37 -0
  32. package/dist/generated/duel/instructions/flushMatches.js +43 -0
  33. package/dist/generated/duel/instructions/index.d.ts +19 -0
  34. package/dist/generated/duel/instructions/index.js +20 -0
  35. package/dist/generated/duel/instructions/initializeQueue.d.ts +48 -0
  36. package/dist/generated/duel/instructions/initializeQueue.js +63 -0
  37. package/dist/generated/duel/instructions/initializeTenant.d.ts +70 -0
  38. package/dist/generated/duel/instructions/initializeTenant.js +67 -0
  39. package/dist/generated/duel/instructions/joinQueue.d.ts +51 -0
  40. package/dist/generated/duel/instructions/joinQueue.js +56 -0
  41. package/dist/generated/duel/instructions/processUndelegation.d.ts +43 -0
  42. package/dist/generated/duel/instructions/processUndelegation.js +49 -0
  43. package/dist/generated/duel/instructions/setupTicketPermission.d.ts +54 -0
  44. package/dist/generated/duel/instructions/setupTicketPermission.js +63 -0
  45. package/dist/generated/duel/programs/duel.d.ts +92 -0
  46. package/dist/generated/duel/programs/duel.js +146 -0
  47. package/dist/generated/duel/programs/index.d.ts +8 -0
  48. package/dist/generated/duel/programs/index.js +9 -0
  49. package/dist/generated/duel/types/accountType.d.ts +25 -0
  50. package/dist/generated/duel/types/accountType.js +25 -0
  51. package/dist/generated/duel/types/index.d.ts +13 -0
  52. package/dist/generated/duel/types/index.js +14 -0
  53. package/dist/generated/duel/types/matchEntry.d.ts +23 -0
  54. package/dist/generated/duel/types/matchEntry.js +18 -0
  55. package/dist/generated/duel/types/matchFound.d.ts +23 -0
  56. package/dist/generated/duel/types/matchFound.js +18 -0
  57. package/dist/generated/duel/types/pendingMatch.d.ts +21 -0
  58. package/dist/generated/duel/types/pendingMatch.js +18 -0
  59. package/dist/generated/duel/types/queueEntry.d.ts +19 -0
  60. package/dist/generated/duel/types/queueEntry.js +18 -0
  61. package/dist/generated/duel/types/ticketStatus.d.ts +40 -0
  62. package/dist/generated/duel/types/ticketStatus.js +25 -0
  63. package/dist/generated/rps-game/accounts/gameSession.d.ts +40 -0
  64. package/dist/generated/rps-game/accounts/gameSession.js +45 -0
  65. package/dist/generated/rps-game/accounts/index.d.ts +9 -0
  66. package/dist/generated/rps-game/accounts/index.js +10 -0
  67. package/dist/generated/rps-game/accounts/playerProfile.d.ts +36 -0
  68. package/dist/generated/rps-game/accounts/playerProfile.js +47 -0
  69. package/dist/generated/rps-game/errors/index.d.ts +8 -0
  70. package/dist/generated/rps-game/errors/index.js +9 -0
  71. package/dist/generated/rps-game/errors/rpsGame.d.ts +25 -0
  72. package/dist/generated/rps-game/errors/rpsGame.js +29 -0
  73. package/dist/generated/rps-game/index.d.ts +12 -0
  74. package/dist/generated/rps-game/index.js +13 -0
  75. package/dist/generated/rps-game/instructions/closePlayer.d.ts +45 -0
  76. package/dist/generated/rps-game/instructions/closePlayer.js +56 -0
  77. package/dist/generated/rps-game/instructions/delegatePda.d.ts +69 -0
  78. package/dist/generated/rps-game/instructions/delegatePda.js +90 -0
  79. package/dist/generated/rps-game/instructions/index.d.ts +16 -0
  80. package/dist/generated/rps-game/instructions/index.js +17 -0
  81. package/dist/generated/rps-game/instructions/initializePlayer.d.ts +48 -0
  82. package/dist/generated/rps-game/instructions/initializePlayer.js +63 -0
  83. package/dist/generated/rps-game/instructions/makeChoice.d.ts +44 -0
  84. package/dist/generated/rps-game/instructions/makeChoice.js +46 -0
  85. package/dist/generated/rps-game/instructions/onMatchFound.d.ts +43 -0
  86. package/dist/generated/rps-game/instructions/onMatchFound.js +45 -0
  87. package/dist/generated/rps-game/instructions/persistResults.d.ts +43 -0
  88. package/dist/generated/rps-game/instructions/persistResults.js +50 -0
  89. package/dist/generated/rps-game/instructions/processUndelegation.d.ts +43 -0
  90. package/dist/generated/rps-game/instructions/processUndelegation.js +49 -0
  91. package/dist/generated/rps-game/instructions/startGame.d.ts +54 -0
  92. package/dist/generated/rps-game/instructions/startGame.js +67 -0
  93. package/dist/generated/rps-game/instructions/startGameWithTicket.d.ts +57 -0
  94. package/dist/generated/rps-game/instructions/startGameWithTicket.js +67 -0
  95. package/dist/generated/rps-game/programs/index.d.ts +8 -0
  96. package/dist/generated/rps-game/programs/index.js +9 -0
  97. package/dist/generated/rps-game/programs/rpsGame.d.ts +78 -0
  98. package/dist/generated/rps-game/programs/rpsGame.js +118 -0
  99. package/dist/generated/rps-game/types/accountType.d.ts +34 -0
  100. package/dist/generated/rps-game/types/accountType.js +25 -0
  101. package/dist/generated/rps-game/types/choice.d.ts +17 -0
  102. package/dist/generated/rps-game/types/choice.js +25 -0
  103. package/dist/generated/rps-game/types/gameResult.d.ts +26 -0
  104. package/dist/generated/rps-game/types/gameResult.js +25 -0
  105. package/dist/generated/rps-game/types/index.d.ts +10 -0
  106. package/dist/generated/rps-game/types/index.js +11 -0
  107. package/dist/index.d.ts +2 -1
  108. package/dist/index.js +3 -2
  109. package/dist/player.d.ts +25 -46
  110. package/dist/player.js +81 -140
  111. package/dist/tee.d.ts +14 -0
  112. package/dist/tee.js +62 -0
  113. package/dist/transaction.d.ts +11 -0
  114. package/dist/transaction.js +50 -0
  115. package/dist/utils.d.ts +4 -4
  116. package/dist/utils.js +23 -8
  117. package/package.json +3 -6
  118. package/src/admin.ts +151 -161
  119. package/src/duel.json +66 -7
  120. package/src/encryption.ts +0 -3
  121. package/src/generated/duel/accounts/index.ts +11 -0
  122. package/src/generated/duel/accounts/matchTicket.ts +77 -0
  123. package/src/generated/duel/accounts/queue.ts +77 -0
  124. package/src/generated/duel/accounts/tenant.ts +76 -0
  125. package/src/generated/duel/errors/duel.ts +46 -0
  126. package/src/generated/duel/errors/index.ts +9 -0
  127. package/src/generated/duel/index.ts +13 -0
  128. package/src/generated/duel/instructions/cancelTicket.ts +100 -0
  129. package/src/generated/duel/instructions/closeTicket.ts +100 -0
  130. package/src/generated/duel/instructions/commitTickets.ts +84 -0
  131. package/src/generated/duel/instructions/createTicket.ts +109 -0
  132. package/src/generated/duel/instructions/delegateQueue.ts +157 -0
  133. package/src/generated/duel/instructions/delegateTicket.ts +157 -0
  134. package/src/generated/duel/instructions/flushMatches.ts +76 -0
  135. package/src/generated/duel/instructions/index.ts +20 -0
  136. package/src/generated/duel/instructions/initializeQueue.ts +109 -0
  137. package/src/generated/duel/instructions/initializeTenant.ts +126 -0
  138. package/src/generated/duel/instructions/joinQueue.ts +106 -0
  139. package/src/generated/duel/instructions/processUndelegation.ts +86 -0
  140. package/src/generated/duel/instructions/setupTicketPermission.ts +115 -0
  141. package/src/generated/duel/programs/duel.ts +108 -0
  142. package/src/generated/duel/programs/index.ts +9 -0
  143. package/src/generated/duel/types/accountType.ts +36 -0
  144. package/src/generated/duel/types/index.ts +14 -0
  145. package/src/generated/duel/types/matchEntry.ts +25 -0
  146. package/src/generated/duel/types/matchFound.ts +25 -0
  147. package/src/generated/duel/types/pendingMatch.ts +25 -0
  148. package/src/generated/duel/types/queueEntry.ts +25 -0
  149. package/src/generated/duel/types/ticketStatus.ts +38 -0
  150. package/src/generated/rps-game/accounts/gameSession.ts +77 -0
  151. package/src/generated/rps-game/accounts/index.ts +10 -0
  152. package/src/generated/rps-game/accounts/playerProfile.ts +80 -0
  153. package/src/generated/rps-game/errors/index.ts +9 -0
  154. package/src/generated/rps-game/errors/rpsGame.ts +40 -0
  155. package/src/generated/rps-game/index.ts +13 -0
  156. package/src/generated/rps-game/instructions/closePlayer.ts +100 -0
  157. package/src/generated/rps-game/instructions/delegatePda.ts +157 -0
  158. package/src/generated/rps-game/instructions/index.ts +17 -0
  159. package/src/generated/rps-game/instructions/initializePlayer.ts +109 -0
  160. package/src/generated/rps-game/instructions/makeChoice.ts +84 -0
  161. package/src/generated/rps-game/instructions/onMatchFound.ts +79 -0
  162. package/src/generated/rps-game/instructions/persistResults.ts +88 -0
  163. package/src/generated/rps-game/instructions/processUndelegation.ts +86 -0
  164. package/src/generated/rps-game/instructions/startGame.ts +118 -0
  165. package/src/generated/rps-game/instructions/startGameWithTicket.ts +121 -0
  166. package/src/generated/rps-game/programs/index.ts +9 -0
  167. package/src/generated/rps-game/programs/rpsGame.ts +95 -0
  168. package/src/generated/rps-game/types/accountType.ts +36 -0
  169. package/src/generated/rps-game/types/choice.ts +25 -0
  170. package/src/generated/rps-game/types/gameResult.ts +37 -0
  171. package/src/generated/rps-game/types/index.ts +11 -0
  172. package/src/index.ts +2 -1
  173. package/src/player.ts +129 -192
  174. package/src/{idl/private_matchmaking.json → rps_game.json} +547 -583
  175. package/src/tee.ts +79 -0
  176. package/src/transaction.ts +90 -0
  177. package/src/utils.ts +35 -20
  178. package/tsconfig.json +2 -2
  179. package/dist/client.d.ts +0 -54
  180. package/dist/client.js +0 -265
  181. package/dist/duel.json +0 -1207
  182. package/dist/private_matchmaking.json +0 -534
  183. package/dist/types.d.ts +0 -635
  184. package/dist/types.js +0 -2
  185. package/src/idl/private_matchmaking.ts +0 -1033
  186. package/src/types.ts +0 -300
@@ -0,0 +1,84 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
10
+ import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/program-client-core';
11
+ import { DUEL_PROGRAM_ADDRESS } from '../programs';
12
+
13
+ export const COMMIT_TICKETS_DISCRIMINATOR = new Uint8Array([245, 199, 81, 0, 62, 133, 18, 22]);
14
+
15
+ export function getCommitTicketsDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(COMMIT_TICKETS_DISCRIMINATOR); }
16
+
17
+ export type CommitTicketsInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountTenant extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> = string, TAccountMagicProgram extends string | AccountMeta<string> = "Magic11111111111111111111111111111111111111", TAccountMagicContext extends string | AccountMeta<string> = "MagicContext1111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> =
18
+ Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountTenant extends string ? ReadonlyAccount<TAccountTenant> : TAccountTenant, TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer, TAccountMagicProgram extends string ? ReadonlyAccount<TAccountMagicProgram> : TAccountMagicProgram, TAccountMagicContext extends string ? WritableAccount<TAccountMagicContext> : TAccountMagicContext, ...TRemainingAccounts]>;
19
+
20
+ export type CommitTicketsInstructionData = { discriminator: ReadonlyUint8Array; };
21
+
22
+ export type CommitTicketsInstructionDataArgs = { };
23
+
24
+ export function getCommitTicketsInstructionDataEncoder(): FixedSizeEncoder<CommitTicketsInstructionDataArgs> {
25
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: COMMIT_TICKETS_DISCRIMINATOR }));
26
+ }
27
+
28
+ export function getCommitTicketsInstructionDataDecoder(): FixedSizeDecoder<CommitTicketsInstructionData> {
29
+ return getStructDecoder([['discriminator', fixDecoderSize(getBytesDecoder(), 8)]]);
30
+ }
31
+
32
+ export function getCommitTicketsInstructionDataCodec(): FixedSizeCodec<CommitTicketsInstructionDataArgs, CommitTicketsInstructionData> {
33
+ return combineCodec(getCommitTicketsInstructionDataEncoder(), getCommitTicketsInstructionDataDecoder());
34
+ }
35
+
36
+ export type CommitTicketsInput<TAccountTenant extends string = string, TAccountPayer extends string = string, TAccountMagicProgram extends string = string, TAccountMagicContext extends string = string> = {
37
+ tenant: Address<TAccountTenant>;
38
+ payer: TransactionSigner<TAccountPayer>;
39
+ magicProgram?: Address<TAccountMagicProgram>;
40
+ magicContext?: Address<TAccountMagicContext>;
41
+ }
42
+
43
+ export function getCommitTicketsInstruction<TAccountTenant extends string, TAccountPayer extends string, TAccountMagicProgram extends string, TAccountMagicContext extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: CommitTicketsInput<TAccountTenant, TAccountPayer, TAccountMagicProgram, TAccountMagicContext>, config?: { programAddress?: TProgramAddress } ): CommitTicketsInstruction<TProgramAddress, TAccountTenant, TAccountPayer, TAccountMagicProgram, TAccountMagicContext> {
44
+ // Program address.
45
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
46
+
47
+ // Original accounts.
48
+ const originalAccounts = { tenant: { value: input.tenant ?? null, isWritable: false }, payer: { value: input.payer ?? null, isWritable: true }, magicProgram: { value: input.magicProgram ?? null, isWritable: false }, magicContext: { value: input.magicContext ?? null, isWritable: true } }
49
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
50
+
51
+
52
+ // Resolve default values.
53
+ if (!accounts.magicProgram.value) {
54
+ accounts.magicProgram.value = 'Magic11111111111111111111111111111111111111' as Address<'Magic11111111111111111111111111111111111111'>;
55
+ }
56
+ if (!accounts.magicContext.value) {
57
+ accounts.magicContext.value = 'MagicContext1111111111111111111111111111111' as Address<'MagicContext1111111111111111111111111111111'>;
58
+ }
59
+
60
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
61
+ return Object.freeze({ accounts: [getAccountMeta("tenant", accounts.tenant), getAccountMeta("payer", accounts.payer), getAccountMeta("magicProgram", accounts.magicProgram), getAccountMeta("magicContext", accounts.magicContext)], data: getCommitTicketsInstructionDataEncoder().encode({}), programAddress } as CommitTicketsInstruction<TProgramAddress, TAccountTenant, TAccountPayer, TAccountMagicProgram, TAccountMagicContext>);
62
+ }
63
+
64
+ export type ParsedCommitTicketsInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = { programAddress: Address<TProgram>;
65
+ accounts: {
66
+ tenant: TAccountMetas[0];
67
+ payer: TAccountMetas[1];
68
+ magicProgram: TAccountMetas[2];
69
+ magicContext: TAccountMetas[3];
70
+ };
71
+ data: CommitTicketsInstructionData; };
72
+
73
+ export function parseCommitTicketsInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCommitTicketsInstruction<TProgram, TAccountMetas> {
74
+ if (instruction.accounts.length < 4) {
75
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, { actualAccountMetas: instruction.accounts.length, expectedAccountMetas: 4 });
76
+ }
77
+ let accountIndex = 0;
78
+ const getNextAccount = () => {
79
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
80
+ accountIndex += 1;
81
+ return accountMeta;
82
+ }
83
+ return { programAddress: instruction.programAddress, accounts: { tenant: getNextAccount(), payer: getNextAccount(), magicProgram: getNextAccount(), magicContext: getNextAccount() }, data: getCommitTicketsInstructionDataDecoder().decode(instruction.data) };
84
+ }
@@ -0,0 +1,109 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
10
+ import { getAccountMetaFactory, getAddressFromResolvedInstructionAccount, type ResolvedInstructionAccount } from '@solana/program-client-core';
11
+ import { DUEL_PROGRAM_ADDRESS } from '../programs';
12
+
13
+ export const CREATE_TICKET_DISCRIMINATOR = new Uint8Array([16, 178, 122, 25, 213, 85, 96, 129]);
14
+
15
+ export function getCreateTicketDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(CREATE_TICKET_DISCRIMINATOR); }
16
+
17
+ export type CreateTicketInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountTicket extends string | AccountMeta<string> = string, TAccountTenant extends string | AccountMeta<string> = string, TAccountPlayer extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> =
18
+ Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountTicket extends string ? WritableAccount<TAccountTicket> : TAccountTicket, TAccountTenant extends string ? ReadonlyAccount<TAccountTenant> : TAccountTenant, TAccountPlayer extends string ? WritableSignerAccount<TAccountPlayer> & AccountSignerMeta<TAccountPlayer> : TAccountPlayer, TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram, ...TRemainingAccounts]>;
19
+
20
+ export type CreateTicketInstructionData = { discriminator: ReadonlyUint8Array; };
21
+
22
+ export type CreateTicketInstructionDataArgs = { };
23
+
24
+ export function getCreateTicketInstructionDataEncoder(): FixedSizeEncoder<CreateTicketInstructionDataArgs> {
25
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CREATE_TICKET_DISCRIMINATOR }));
26
+ }
27
+
28
+ export function getCreateTicketInstructionDataDecoder(): FixedSizeDecoder<CreateTicketInstructionData> {
29
+ return getStructDecoder([['discriminator', fixDecoderSize(getBytesDecoder(), 8)]]);
30
+ }
31
+
32
+ export function getCreateTicketInstructionDataCodec(): FixedSizeCodec<CreateTicketInstructionDataArgs, CreateTicketInstructionData> {
33
+ return combineCodec(getCreateTicketInstructionDataEncoder(), getCreateTicketInstructionDataDecoder());
34
+ }
35
+
36
+ export type CreateTicketAsyncInput<TAccountTicket extends string = string, TAccountTenant extends string = string, TAccountPlayer extends string = string, TAccountSystemProgram extends string = string> = {
37
+ ticket?: Address<TAccountTicket>;
38
+ tenant: Address<TAccountTenant>;
39
+ player: TransactionSigner<TAccountPlayer>;
40
+ systemProgram?: Address<TAccountSystemProgram>;
41
+ }
42
+
43
+ export async function getCreateTicketInstructionAsync<TAccountTicket extends string, TAccountTenant extends string, TAccountPlayer extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: CreateTicketAsyncInput<TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): Promise<CreateTicketInstruction<TProgramAddress, TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram>> {
44
+ // Program address.
45
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
46
+
47
+ // Original accounts.
48
+ const originalAccounts = { ticket: { value: input.ticket ?? null, isWritable: true }, tenant: { value: input.tenant ?? null, isWritable: false }, player: { value: input.player ?? null, isWritable: true }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
49
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
50
+
51
+
52
+ // Resolve default values.
53
+ if (!accounts.ticket.value) {
54
+ accounts.ticket.value = await getProgramDerivedAddress({ programAddress, seeds: [getBytesEncoder().encode(new Uint8Array([116, 105, 99, 107, 101, 116])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("player", accounts.player.value)), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tenant", accounts.tenant.value))] });
55
+ }
56
+ if (!accounts.systemProgram.value) {
57
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
58
+ }
59
+
60
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
61
+ return Object.freeze({ accounts: [getAccountMeta("ticket", accounts.ticket), getAccountMeta("tenant", accounts.tenant), getAccountMeta("player", accounts.player), getAccountMeta("systemProgram", accounts.systemProgram)], data: getCreateTicketInstructionDataEncoder().encode({}), programAddress } as CreateTicketInstruction<TProgramAddress, TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram>);
62
+ }
63
+
64
+ export type CreateTicketInput<TAccountTicket extends string = string, TAccountTenant extends string = string, TAccountPlayer extends string = string, TAccountSystemProgram extends string = string> = {
65
+ ticket: Address<TAccountTicket>;
66
+ tenant: Address<TAccountTenant>;
67
+ player: TransactionSigner<TAccountPlayer>;
68
+ systemProgram?: Address<TAccountSystemProgram>;
69
+ }
70
+
71
+ export function getCreateTicketInstruction<TAccountTicket extends string, TAccountTenant extends string, TAccountPlayer extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: CreateTicketInput<TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): CreateTicketInstruction<TProgramAddress, TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram> {
72
+ // Program address.
73
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
74
+
75
+ // Original accounts.
76
+ const originalAccounts = { ticket: { value: input.ticket ?? null, isWritable: true }, tenant: { value: input.tenant ?? null, isWritable: false }, player: { value: input.player ?? null, isWritable: true }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
77
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
78
+
79
+
80
+ // Resolve default values.
81
+ if (!accounts.systemProgram.value) {
82
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
83
+ }
84
+
85
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
86
+ return Object.freeze({ accounts: [getAccountMeta("ticket", accounts.ticket), getAccountMeta("tenant", accounts.tenant), getAccountMeta("player", accounts.player), getAccountMeta("systemProgram", accounts.systemProgram)], data: getCreateTicketInstructionDataEncoder().encode({}), programAddress } as CreateTicketInstruction<TProgramAddress, TAccountTicket, TAccountTenant, TAccountPlayer, TAccountSystemProgram>);
87
+ }
88
+
89
+ export type ParsedCreateTicketInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = { programAddress: Address<TProgram>;
90
+ accounts: {
91
+ ticket: TAccountMetas[0];
92
+ tenant: TAccountMetas[1];
93
+ player: TAccountMetas[2];
94
+ systemProgram: TAccountMetas[3];
95
+ };
96
+ data: CreateTicketInstructionData; };
97
+
98
+ export function parseCreateTicketInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedCreateTicketInstruction<TProgram, TAccountMetas> {
99
+ if (instruction.accounts.length < 4) {
100
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, { actualAccountMetas: instruction.accounts.length, expectedAccountMetas: 4 });
101
+ }
102
+ let accountIndex = 0;
103
+ const getNextAccount = () => {
104
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
105
+ accountIndex += 1;
106
+ return accountMeta;
107
+ }
108
+ return { programAddress: instruction.programAddress, accounts: { ticket: getNextAccount(), tenant: getNextAccount(), player: getNextAccount(), systemProgram: getNextAccount() }, data: getCreateTicketInstructionDataDecoder().decode(instruction.data) };
109
+ }
@@ -0,0 +1,157 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, type AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
10
+ import { getAccountMetaFactory, getAddressFromResolvedInstructionAccount, type ResolvedInstructionAccount } from '@solana/program-client-core';
11
+ import { DUEL_PROGRAM_ADDRESS } from '../programs';
12
+ import { getAccountTypeDecoder, getAccountTypeEncoder, type AccountType, type AccountTypeArgs } from '../types';
13
+
14
+ export const DELEGATE_QUEUE_DISCRIMINATOR = new Uint8Array([31, 200, 139, 125, 93, 239, 83, 87]);
15
+
16
+ export function getDelegateQueueDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(DELEGATE_QUEUE_DISCRIMINATOR); }
17
+
18
+ export type DelegateQueueInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountBufferPda extends string | AccountMeta<string> = string, TAccountDelegationRecordPda extends string | AccountMeta<string> = string, TAccountDelegationMetadataPda extends string | AccountMeta<string> = string, TAccountPda extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> = string, TAccountValidator extends string | AccountMeta<string> = string, TAccountOwnerProgram extends string | AccountMeta<string> = "EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X", TAccountDelegationProgram extends string | AccountMeta<string> = "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> =
19
+ Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountBufferPda extends string ? WritableAccount<TAccountBufferPda> : TAccountBufferPda, TAccountDelegationRecordPda extends string ? WritableAccount<TAccountDelegationRecordPda> : TAccountDelegationRecordPda, TAccountDelegationMetadataPda extends string ? WritableAccount<TAccountDelegationMetadataPda> : TAccountDelegationMetadataPda, TAccountPda extends string ? WritableAccount<TAccountPda> : TAccountPda, TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer, TAccountValidator extends string ? ReadonlyAccount<TAccountValidator> : TAccountValidator, TAccountOwnerProgram extends string ? ReadonlyAccount<TAccountOwnerProgram> : TAccountOwnerProgram, TAccountDelegationProgram extends string ? ReadonlyAccount<TAccountDelegationProgram> : TAccountDelegationProgram, TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram, ...TRemainingAccounts]>;
20
+
21
+ export type DelegateQueueInstructionData = { discriminator: ReadonlyUint8Array; accountType: AccountType; };
22
+
23
+ export type DelegateQueueInstructionDataArgs = { accountType: AccountTypeArgs; };
24
+
25
+ export function getDelegateQueueInstructionDataEncoder(): Encoder<DelegateQueueInstructionDataArgs> {
26
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)], ['accountType', getAccountTypeEncoder()]]), (value) => ({ ...value, discriminator: DELEGATE_QUEUE_DISCRIMINATOR }));
27
+ }
28
+
29
+ export function getDelegateQueueInstructionDataDecoder(): Decoder<DelegateQueueInstructionData> {
30
+ return getStructDecoder([['discriminator', fixDecoderSize(getBytesDecoder(), 8)], ['accountType', getAccountTypeDecoder()]]);
31
+ }
32
+
33
+ export function getDelegateQueueInstructionDataCodec(): Codec<DelegateQueueInstructionDataArgs, DelegateQueueInstructionData> {
34
+ return combineCodec(getDelegateQueueInstructionDataEncoder(), getDelegateQueueInstructionDataDecoder());
35
+ }
36
+
37
+ export type DelegateQueueAsyncInput<TAccountBufferPda extends string = string, TAccountDelegationRecordPda extends string = string, TAccountDelegationMetadataPda extends string = string, TAccountPda extends string = string, TAccountPayer extends string = string, TAccountValidator extends string = string, TAccountOwnerProgram extends string = string, TAccountDelegationProgram extends string = string, TAccountSystemProgram extends string = string> = {
38
+ bufferPda?: Address<TAccountBufferPda>;
39
+ delegationRecordPda?: Address<TAccountDelegationRecordPda>;
40
+ delegationMetadataPda?: Address<TAccountDelegationMetadataPda>;
41
+ pda: Address<TAccountPda>;
42
+ payer: TransactionSigner<TAccountPayer>;
43
+ validator?: Address<TAccountValidator>;
44
+ ownerProgram?: Address<TAccountOwnerProgram>;
45
+ delegationProgram?: Address<TAccountDelegationProgram>;
46
+ systemProgram?: Address<TAccountSystemProgram>;
47
+ accountType: DelegateQueueInstructionDataArgs["accountType"];
48
+ }
49
+
50
+ export async function getDelegateQueueInstructionAsync<TAccountBufferPda extends string, TAccountDelegationRecordPda extends string, TAccountDelegationMetadataPda extends string, TAccountPda extends string, TAccountPayer extends string, TAccountValidator extends string, TAccountOwnerProgram extends string, TAccountDelegationProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: DelegateQueueAsyncInput<TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): Promise<DelegateQueueInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>> {
51
+ // Program address.
52
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
53
+
54
+ // Original accounts.
55
+ const originalAccounts = { bufferPda: { value: input.bufferPda ?? null, isWritable: true }, delegationRecordPda: { value: input.delegationRecordPda ?? null, isWritable: true }, delegationMetadataPda: { value: input.delegationMetadataPda ?? null, isWritable: true }, pda: { value: input.pda ?? null, isWritable: true }, payer: { value: input.payer ?? null, isWritable: true }, validator: { value: input.validator ?? null, isWritable: false }, ownerProgram: { value: input.ownerProgram ?? null, isWritable: false }, delegationProgram: { value: input.delegationProgram ?? null, isWritable: false }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
56
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
57
+
58
+
59
+ // Original args.
60
+ const args = { ...input, };
61
+
62
+
63
+ // Resolve default values.
64
+ if (!accounts.bufferPda.value) {
65
+ accounts.bufferPda.value = await getProgramDerivedAddress({ programAddress: 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>, seeds: [getBytesEncoder().encode(new Uint8Array([98, 117, 102, 102, 101, 114])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
66
+ }
67
+ if (!accounts.delegationRecordPda.value) {
68
+ accounts.delegationRecordPda.value = await getProgramDerivedAddress({ programAddress, seeds: [getBytesEncoder().encode(new Uint8Array([100, 101, 108, 101, 103, 97, 116, 105, 111, 110])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
69
+ }
70
+ if (!accounts.delegationMetadataPda.value) {
71
+ accounts.delegationMetadataPda.value = await getProgramDerivedAddress({ programAddress, seeds: [getBytesEncoder().encode(new Uint8Array([100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 45, 109, 101, 116, 97, 100, 97, 116, 97])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
72
+ }
73
+ if (!accounts.ownerProgram.value) {
74
+ accounts.ownerProgram.value = 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>;
75
+ }
76
+ if (!accounts.delegationProgram.value) {
77
+ accounts.delegationProgram.value = 'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh' as Address<'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh'>;
78
+ }
79
+ if (!accounts.systemProgram.value) {
80
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
81
+ }
82
+
83
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
84
+ return Object.freeze({ accounts: [getAccountMeta("bufferPda", accounts.bufferPda), getAccountMeta("delegationRecordPda", accounts.delegationRecordPda), getAccountMeta("delegationMetadataPda", accounts.delegationMetadataPda), getAccountMeta("pda", accounts.pda), getAccountMeta("payer", accounts.payer), getAccountMeta("validator", accounts.validator), getAccountMeta("ownerProgram", accounts.ownerProgram), getAccountMeta("delegationProgram", accounts.delegationProgram), getAccountMeta("systemProgram", accounts.systemProgram)], data: getDelegateQueueInstructionDataEncoder().encode(args as DelegateQueueInstructionDataArgs), programAddress } as DelegateQueueInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>);
85
+ }
86
+
87
+ export type DelegateQueueInput<TAccountBufferPda extends string = string, TAccountDelegationRecordPda extends string = string, TAccountDelegationMetadataPda extends string = string, TAccountPda extends string = string, TAccountPayer extends string = string, TAccountValidator extends string = string, TAccountOwnerProgram extends string = string, TAccountDelegationProgram extends string = string, TAccountSystemProgram extends string = string> = {
88
+ bufferPda: Address<TAccountBufferPda>;
89
+ delegationRecordPda: Address<TAccountDelegationRecordPda>;
90
+ delegationMetadataPda: Address<TAccountDelegationMetadataPda>;
91
+ pda: Address<TAccountPda>;
92
+ payer: TransactionSigner<TAccountPayer>;
93
+ validator?: Address<TAccountValidator>;
94
+ ownerProgram?: Address<TAccountOwnerProgram>;
95
+ delegationProgram?: Address<TAccountDelegationProgram>;
96
+ systemProgram?: Address<TAccountSystemProgram>;
97
+ accountType: DelegateQueueInstructionDataArgs["accountType"];
98
+ }
99
+
100
+ export function getDelegateQueueInstruction<TAccountBufferPda extends string, TAccountDelegationRecordPda extends string, TAccountDelegationMetadataPda extends string, TAccountPda extends string, TAccountPayer extends string, TAccountValidator extends string, TAccountOwnerProgram extends string, TAccountDelegationProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: DelegateQueueInput<TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): DelegateQueueInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram> {
101
+ // Program address.
102
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
103
+
104
+ // Original accounts.
105
+ const originalAccounts = { bufferPda: { value: input.bufferPda ?? null, isWritable: true }, delegationRecordPda: { value: input.delegationRecordPda ?? null, isWritable: true }, delegationMetadataPda: { value: input.delegationMetadataPda ?? null, isWritable: true }, pda: { value: input.pda ?? null, isWritable: true }, payer: { value: input.payer ?? null, isWritable: true }, validator: { value: input.validator ?? null, isWritable: false }, ownerProgram: { value: input.ownerProgram ?? null, isWritable: false }, delegationProgram: { value: input.delegationProgram ?? null, isWritable: false }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
106
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
107
+
108
+
109
+ // Original args.
110
+ const args = { ...input, };
111
+
112
+
113
+ // Resolve default values.
114
+ if (!accounts.ownerProgram.value) {
115
+ accounts.ownerProgram.value = 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>;
116
+ }
117
+ if (!accounts.delegationProgram.value) {
118
+ accounts.delegationProgram.value = 'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh' as Address<'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh'>;
119
+ }
120
+ if (!accounts.systemProgram.value) {
121
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
122
+ }
123
+
124
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
125
+ return Object.freeze({ accounts: [getAccountMeta("bufferPda", accounts.bufferPda), getAccountMeta("delegationRecordPda", accounts.delegationRecordPda), getAccountMeta("delegationMetadataPda", accounts.delegationMetadataPda), getAccountMeta("pda", accounts.pda), getAccountMeta("payer", accounts.payer), getAccountMeta("validator", accounts.validator), getAccountMeta("ownerProgram", accounts.ownerProgram), getAccountMeta("delegationProgram", accounts.delegationProgram), getAccountMeta("systemProgram", accounts.systemProgram)], data: getDelegateQueueInstructionDataEncoder().encode(args as DelegateQueueInstructionDataArgs), programAddress } as DelegateQueueInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>);
126
+ }
127
+
128
+ export type ParsedDelegateQueueInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = { programAddress: Address<TProgram>;
129
+ accounts: {
130
+ bufferPda: TAccountMetas[0];
131
+ delegationRecordPda: TAccountMetas[1];
132
+ delegationMetadataPda: TAccountMetas[2];
133
+ pda: TAccountMetas[3];
134
+ payer: TAccountMetas[4];
135
+ validator?: TAccountMetas[5] | undefined;
136
+ ownerProgram: TAccountMetas[6];
137
+ delegationProgram: TAccountMetas[7];
138
+ systemProgram: TAccountMetas[8];
139
+ };
140
+ data: DelegateQueueInstructionData; };
141
+
142
+ export function parseDelegateQueueInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedDelegateQueueInstruction<TProgram, TAccountMetas> {
143
+ if (instruction.accounts.length < 9) {
144
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, { actualAccountMetas: instruction.accounts.length, expectedAccountMetas: 9 });
145
+ }
146
+ let accountIndex = 0;
147
+ const getNextAccount = () => {
148
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
149
+ accountIndex += 1;
150
+ return accountMeta;
151
+ }
152
+ const getNextOptionalAccount = () => {
153
+ const accountMeta = getNextAccount();
154
+ return accountMeta.address === DUEL_PROGRAM_ADDRESS ? undefined : accountMeta;
155
+ };
156
+ return { programAddress: instruction.programAddress, accounts: { bufferPda: getNextAccount(), delegationRecordPda: getNextAccount(), delegationMetadataPda: getNextAccount(), pda: getNextAccount(), payer: getNextAccount(), validator: getNextOptionalAccount(), ownerProgram: getNextAccount(), delegationProgram: getNextAccount(), systemProgram: getNextAccount() }, data: getDelegateQueueInstructionDataDecoder().decode(instruction.data) };
157
+ }
@@ -0,0 +1,157 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, type AccountMeta, type AccountSignerMeta, type Address, type Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
10
+ import { getAccountMetaFactory, getAddressFromResolvedInstructionAccount, type ResolvedInstructionAccount } from '@solana/program-client-core';
11
+ import { DUEL_PROGRAM_ADDRESS } from '../programs';
12
+ import { getAccountTypeDecoder, getAccountTypeEncoder, type AccountType, type AccountTypeArgs } from '../types';
13
+
14
+ export const DELEGATE_TICKET_DISCRIMINATOR = new Uint8Array([195, 3, 78, 64, 128, 235, 209, 171]);
15
+
16
+ export function getDelegateTicketDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(DELEGATE_TICKET_DISCRIMINATOR); }
17
+
18
+ export type DelegateTicketInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountBufferPda extends string | AccountMeta<string> = string, TAccountDelegationRecordPda extends string | AccountMeta<string> = string, TAccountDelegationMetadataPda extends string | AccountMeta<string> = string, TAccountPda extends string | AccountMeta<string> = string, TAccountPayer extends string | AccountMeta<string> = string, TAccountValidator extends string | AccountMeta<string> = string, TAccountOwnerProgram extends string | AccountMeta<string> = "EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X", TAccountDelegationProgram extends string | AccountMeta<string> = "DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TRemainingAccounts extends readonly AccountMeta<string>[] = []> =
19
+ Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountBufferPda extends string ? WritableAccount<TAccountBufferPda> : TAccountBufferPda, TAccountDelegationRecordPda extends string ? WritableAccount<TAccountDelegationRecordPda> : TAccountDelegationRecordPda, TAccountDelegationMetadataPda extends string ? WritableAccount<TAccountDelegationMetadataPda> : TAccountDelegationMetadataPda, TAccountPda extends string ? WritableAccount<TAccountPda> : TAccountPda, TAccountPayer extends string ? WritableSignerAccount<TAccountPayer> & AccountSignerMeta<TAccountPayer> : TAccountPayer, TAccountValidator extends string ? ReadonlyAccount<TAccountValidator> : TAccountValidator, TAccountOwnerProgram extends string ? ReadonlyAccount<TAccountOwnerProgram> : TAccountOwnerProgram, TAccountDelegationProgram extends string ? ReadonlyAccount<TAccountDelegationProgram> : TAccountDelegationProgram, TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram, ...TRemainingAccounts]>;
20
+
21
+ export type DelegateTicketInstructionData = { discriminator: ReadonlyUint8Array; accountType: AccountType; };
22
+
23
+ export type DelegateTicketInstructionDataArgs = { accountType: AccountTypeArgs; };
24
+
25
+ export function getDelegateTicketInstructionDataEncoder(): Encoder<DelegateTicketInstructionDataArgs> {
26
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)], ['accountType', getAccountTypeEncoder()]]), (value) => ({ ...value, discriminator: DELEGATE_TICKET_DISCRIMINATOR }));
27
+ }
28
+
29
+ export function getDelegateTicketInstructionDataDecoder(): Decoder<DelegateTicketInstructionData> {
30
+ return getStructDecoder([['discriminator', fixDecoderSize(getBytesDecoder(), 8)], ['accountType', getAccountTypeDecoder()]]);
31
+ }
32
+
33
+ export function getDelegateTicketInstructionDataCodec(): Codec<DelegateTicketInstructionDataArgs, DelegateTicketInstructionData> {
34
+ return combineCodec(getDelegateTicketInstructionDataEncoder(), getDelegateTicketInstructionDataDecoder());
35
+ }
36
+
37
+ export type DelegateTicketAsyncInput<TAccountBufferPda extends string = string, TAccountDelegationRecordPda extends string = string, TAccountDelegationMetadataPda extends string = string, TAccountPda extends string = string, TAccountPayer extends string = string, TAccountValidator extends string = string, TAccountOwnerProgram extends string = string, TAccountDelegationProgram extends string = string, TAccountSystemProgram extends string = string> = {
38
+ bufferPda?: Address<TAccountBufferPda>;
39
+ delegationRecordPda?: Address<TAccountDelegationRecordPda>;
40
+ delegationMetadataPda?: Address<TAccountDelegationMetadataPda>;
41
+ pda: Address<TAccountPda>;
42
+ payer: TransactionSigner<TAccountPayer>;
43
+ validator?: Address<TAccountValidator>;
44
+ ownerProgram?: Address<TAccountOwnerProgram>;
45
+ delegationProgram?: Address<TAccountDelegationProgram>;
46
+ systemProgram?: Address<TAccountSystemProgram>;
47
+ accountType: DelegateTicketInstructionDataArgs["accountType"];
48
+ }
49
+
50
+ export async function getDelegateTicketInstructionAsync<TAccountBufferPda extends string, TAccountDelegationRecordPda extends string, TAccountDelegationMetadataPda extends string, TAccountPda extends string, TAccountPayer extends string, TAccountValidator extends string, TAccountOwnerProgram extends string, TAccountDelegationProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: DelegateTicketAsyncInput<TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): Promise<DelegateTicketInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>> {
51
+ // Program address.
52
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
53
+
54
+ // Original accounts.
55
+ const originalAccounts = { bufferPda: { value: input.bufferPda ?? null, isWritable: true }, delegationRecordPda: { value: input.delegationRecordPda ?? null, isWritable: true }, delegationMetadataPda: { value: input.delegationMetadataPda ?? null, isWritable: true }, pda: { value: input.pda ?? null, isWritable: true }, payer: { value: input.payer ?? null, isWritable: true }, validator: { value: input.validator ?? null, isWritable: false }, ownerProgram: { value: input.ownerProgram ?? null, isWritable: false }, delegationProgram: { value: input.delegationProgram ?? null, isWritable: false }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
56
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
57
+
58
+
59
+ // Original args.
60
+ const args = { ...input, };
61
+
62
+
63
+ // Resolve default values.
64
+ if (!accounts.bufferPda.value) {
65
+ accounts.bufferPda.value = await getProgramDerivedAddress({ programAddress: 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>, seeds: [getBytesEncoder().encode(new Uint8Array([98, 117, 102, 102, 101, 114])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
66
+ }
67
+ if (!accounts.delegationRecordPda.value) {
68
+ accounts.delegationRecordPda.value = await getProgramDerivedAddress({ programAddress, seeds: [getBytesEncoder().encode(new Uint8Array([100, 101, 108, 101, 103, 97, 116, 105, 111, 110])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
69
+ }
70
+ if (!accounts.delegationMetadataPda.value) {
71
+ accounts.delegationMetadataPda.value = await getProgramDerivedAddress({ programAddress, seeds: [getBytesEncoder().encode(new Uint8Array([100, 101, 108, 101, 103, 97, 116, 105, 111, 110, 45, 109, 101, 116, 97, 100, 97, 116, 97])), getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pda", accounts.pda.value))] });
72
+ }
73
+ if (!accounts.ownerProgram.value) {
74
+ accounts.ownerProgram.value = 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>;
75
+ }
76
+ if (!accounts.delegationProgram.value) {
77
+ accounts.delegationProgram.value = 'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh' as Address<'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh'>;
78
+ }
79
+ if (!accounts.systemProgram.value) {
80
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
81
+ }
82
+
83
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
84
+ return Object.freeze({ accounts: [getAccountMeta("bufferPda", accounts.bufferPda), getAccountMeta("delegationRecordPda", accounts.delegationRecordPda), getAccountMeta("delegationMetadataPda", accounts.delegationMetadataPda), getAccountMeta("pda", accounts.pda), getAccountMeta("payer", accounts.payer), getAccountMeta("validator", accounts.validator), getAccountMeta("ownerProgram", accounts.ownerProgram), getAccountMeta("delegationProgram", accounts.delegationProgram), getAccountMeta("systemProgram", accounts.systemProgram)], data: getDelegateTicketInstructionDataEncoder().encode(args as DelegateTicketInstructionDataArgs), programAddress } as DelegateTicketInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>);
85
+ }
86
+
87
+ export type DelegateTicketInput<TAccountBufferPda extends string = string, TAccountDelegationRecordPda extends string = string, TAccountDelegationMetadataPda extends string = string, TAccountPda extends string = string, TAccountPayer extends string = string, TAccountValidator extends string = string, TAccountOwnerProgram extends string = string, TAccountDelegationProgram extends string = string, TAccountSystemProgram extends string = string> = {
88
+ bufferPda: Address<TAccountBufferPda>;
89
+ delegationRecordPda: Address<TAccountDelegationRecordPda>;
90
+ delegationMetadataPda: Address<TAccountDelegationMetadataPda>;
91
+ pda: Address<TAccountPda>;
92
+ payer: TransactionSigner<TAccountPayer>;
93
+ validator?: Address<TAccountValidator>;
94
+ ownerProgram?: Address<TAccountOwnerProgram>;
95
+ delegationProgram?: Address<TAccountDelegationProgram>;
96
+ systemProgram?: Address<TAccountSystemProgram>;
97
+ accountType: DelegateTicketInstructionDataArgs["accountType"];
98
+ }
99
+
100
+ export function getDelegateTicketInstruction<TAccountBufferPda extends string, TAccountDelegationRecordPda extends string, TAccountDelegationMetadataPda extends string, TAccountPda extends string, TAccountPayer extends string, TAccountValidator extends string, TAccountOwnerProgram extends string, TAccountDelegationProgram extends string, TAccountSystemProgram extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: DelegateTicketInput<TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>, config?: { programAddress?: TProgramAddress } ): DelegateTicketInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram> {
101
+ // Program address.
102
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
103
+
104
+ // Original accounts.
105
+ const originalAccounts = { bufferPda: { value: input.bufferPda ?? null, isWritable: true }, delegationRecordPda: { value: input.delegationRecordPda ?? null, isWritable: true }, delegationMetadataPda: { value: input.delegationMetadataPda ?? null, isWritable: true }, pda: { value: input.pda ?? null, isWritable: true }, payer: { value: input.payer ?? null, isWritable: true }, validator: { value: input.validator ?? null, isWritable: false }, ownerProgram: { value: input.ownerProgram ?? null, isWritable: false }, delegationProgram: { value: input.delegationProgram ?? null, isWritable: false }, systemProgram: { value: input.systemProgram ?? null, isWritable: false } }
106
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
107
+
108
+
109
+ // Original args.
110
+ const args = { ...input, };
111
+
112
+
113
+ // Resolve default values.
114
+ if (!accounts.ownerProgram.value) {
115
+ accounts.ownerProgram.value = 'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X' as Address<'EdZzUwKd1X2ZWjxLPpz1cpEzMF7RUZC43Pq64v1VcK5X'>;
116
+ }
117
+ if (!accounts.delegationProgram.value) {
118
+ accounts.delegationProgram.value = 'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh' as Address<'DELeGGvXpWV2fqJUhqcF5ZSYMS4JTLjteaAMARRSaeSh'>;
119
+ }
120
+ if (!accounts.systemProgram.value) {
121
+ accounts.systemProgram.value = '11111111111111111111111111111111' as Address<'11111111111111111111111111111111'>;
122
+ }
123
+
124
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
125
+ return Object.freeze({ accounts: [getAccountMeta("bufferPda", accounts.bufferPda), getAccountMeta("delegationRecordPda", accounts.delegationRecordPda), getAccountMeta("delegationMetadataPda", accounts.delegationMetadataPda), getAccountMeta("pda", accounts.pda), getAccountMeta("payer", accounts.payer), getAccountMeta("validator", accounts.validator), getAccountMeta("ownerProgram", accounts.ownerProgram), getAccountMeta("delegationProgram", accounts.delegationProgram), getAccountMeta("systemProgram", accounts.systemProgram)], data: getDelegateTicketInstructionDataEncoder().encode(args as DelegateTicketInstructionDataArgs), programAddress } as DelegateTicketInstruction<TProgramAddress, TAccountBufferPda, TAccountDelegationRecordPda, TAccountDelegationMetadataPda, TAccountPda, TAccountPayer, TAccountValidator, TAccountOwnerProgram, TAccountDelegationProgram, TAccountSystemProgram>);
126
+ }
127
+
128
+ export type ParsedDelegateTicketInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = { programAddress: Address<TProgram>;
129
+ accounts: {
130
+ bufferPda: TAccountMetas[0];
131
+ delegationRecordPda: TAccountMetas[1];
132
+ delegationMetadataPda: TAccountMetas[2];
133
+ pda: TAccountMetas[3];
134
+ payer: TAccountMetas[4];
135
+ validator?: TAccountMetas[5] | undefined;
136
+ ownerProgram: TAccountMetas[6];
137
+ delegationProgram: TAccountMetas[7];
138
+ systemProgram: TAccountMetas[8];
139
+ };
140
+ data: DelegateTicketInstructionData; };
141
+
142
+ export function parseDelegateTicketInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedDelegateTicketInstruction<TProgram, TAccountMetas> {
143
+ if (instruction.accounts.length < 9) {
144
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, { actualAccountMetas: instruction.accounts.length, expectedAccountMetas: 9 });
145
+ }
146
+ let accountIndex = 0;
147
+ const getNextAccount = () => {
148
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
149
+ accountIndex += 1;
150
+ return accountMeta;
151
+ }
152
+ const getNextOptionalAccount = () => {
153
+ const accountMeta = getNextAccount();
154
+ return accountMeta.address === DUEL_PROGRAM_ADDRESS ? undefined : accountMeta;
155
+ };
156
+ return { programAddress: instruction.programAddress, accounts: { bufferPda: getNextAccount(), delegationRecordPda: getNextAccount(), delegationMetadataPda: getNextAccount(), pda: getNextAccount(), payer: getNextAccount(), validator: getNextOptionalAccount(), ownerProgram: getNextAccount(), delegationProgram: getNextAccount(), systemProgram: getNextAccount() }, data: getDelegateTicketInstructionDataDecoder().decode(instruction.data) };
157
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getStructDecoder, getStructEncoder, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SolanaError, transformEncoder, type AccountMeta, type AccountSignerMeta, type Address, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlySignerAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount } from '@solana/kit';
10
+ import { getAccountMetaFactory, type ResolvedInstructionAccount } from '@solana/program-client-core';
11
+ import { DUEL_PROGRAM_ADDRESS } from '../programs';
12
+
13
+ export const FLUSH_MATCHES_DISCRIMINATOR = new Uint8Array([49, 148, 163, 71, 77, 63, 197, 76]);
14
+
15
+ export function getFlushMatchesDiscriminatorBytes() { return fixEncoderSize(getBytesEncoder(), 8).encode(FLUSH_MATCHES_DISCRIMINATOR); }
16
+
17
+ export type FlushMatchesInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountQueue extends string | AccountMeta<string> = string, TAccountTenant extends string | AccountMeta<string> = string, TAccountSigner extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> =
18
+ Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[TAccountQueue extends string ? WritableAccount<TAccountQueue> : TAccountQueue, TAccountTenant extends string ? ReadonlyAccount<TAccountTenant> : TAccountTenant, TAccountSigner extends string ? ReadonlySignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner, ...TRemainingAccounts]>;
19
+
20
+ export type FlushMatchesInstructionData = { discriminator: ReadonlyUint8Array; };
21
+
22
+ export type FlushMatchesInstructionDataArgs = { };
23
+
24
+ export function getFlushMatchesInstructionDataEncoder(): FixedSizeEncoder<FlushMatchesInstructionDataArgs> {
25
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: FLUSH_MATCHES_DISCRIMINATOR }));
26
+ }
27
+
28
+ export function getFlushMatchesInstructionDataDecoder(): FixedSizeDecoder<FlushMatchesInstructionData> {
29
+ return getStructDecoder([['discriminator', fixDecoderSize(getBytesDecoder(), 8)]]);
30
+ }
31
+
32
+ export function getFlushMatchesInstructionDataCodec(): FixedSizeCodec<FlushMatchesInstructionDataArgs, FlushMatchesInstructionData> {
33
+ return combineCodec(getFlushMatchesInstructionDataEncoder(), getFlushMatchesInstructionDataDecoder());
34
+ }
35
+
36
+ export type FlushMatchesInput<TAccountQueue extends string = string, TAccountTenant extends string = string, TAccountSigner extends string = string> = {
37
+ queue: Address<TAccountQueue>;
38
+ tenant: Address<TAccountTenant>;
39
+ signer: TransactionSigner<TAccountSigner>;
40
+ }
41
+
42
+ export function getFlushMatchesInstruction<TAccountQueue extends string, TAccountTenant extends string, TAccountSigner extends string, TProgramAddress extends Address = typeof DUEL_PROGRAM_ADDRESS>(input: FlushMatchesInput<TAccountQueue, TAccountTenant, TAccountSigner>, config?: { programAddress?: TProgramAddress } ): FlushMatchesInstruction<TProgramAddress, TAccountQueue, TAccountTenant, TAccountSigner> {
43
+ // Program address.
44
+ const programAddress = config?.programAddress ?? DUEL_PROGRAM_ADDRESS;
45
+
46
+ // Original accounts.
47
+ const originalAccounts = { queue: { value: input.queue ?? null, isWritable: true }, tenant: { value: input.tenant ?? null, isWritable: false }, signer: { value: input.signer ?? null, isWritable: false } }
48
+ const accounts = originalAccounts as Record<keyof typeof originalAccounts, ResolvedInstructionAccount>;
49
+
50
+
51
+
52
+
53
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
54
+ return Object.freeze({ accounts: [getAccountMeta("queue", accounts.queue), getAccountMeta("tenant", accounts.tenant), getAccountMeta("signer", accounts.signer)], data: getFlushMatchesInstructionDataEncoder().encode({}), programAddress } as FlushMatchesInstruction<TProgramAddress, TAccountQueue, TAccountTenant, TAccountSigner>);
55
+ }
56
+
57
+ export type ParsedFlushMatchesInstruction<TProgram extends string = typeof DUEL_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = { programAddress: Address<TProgram>;
58
+ accounts: {
59
+ queue: TAccountMetas[0];
60
+ tenant: TAccountMetas[1];
61
+ signer: TAccountMetas[2];
62
+ };
63
+ data: FlushMatchesInstructionData; };
64
+
65
+ export function parseFlushMatchesInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedFlushMatchesInstruction<TProgram, TAccountMetas> {
66
+ if (instruction.accounts.length < 3) {
67
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, { actualAccountMetas: instruction.accounts.length, expectedAccountMetas: 3 });
68
+ }
69
+ let accountIndex = 0;
70
+ const getNextAccount = () => {
71
+ const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
72
+ accountIndex += 1;
73
+ return accountMeta;
74
+ }
75
+ return { programAddress: instruction.programAddress, accounts: { queue: getNextAccount(), tenant: getNextAccount(), signer: getNextAccount() }, data: getFlushMatchesInstructionDataDecoder().decode(instruction.data) };
76
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+
9
+ export * from './cancelTicket';
10
+ export * from './closeTicket';
11
+ export * from './commitTickets';
12
+ export * from './createTicket';
13
+ export * from './delegateQueue';
14
+ export * from './delegateTicket';
15
+ export * from './flushMatches';
16
+ export * from './initializeQueue';
17
+ export * from './initializeTenant';
18
+ export * from './joinQueue';
19
+ export * from './processUndelegation';
20
+ export * from './setupTicketPermission';