@wuwei-labs/srsly 2.0.0-beta.3 → 2.0.0-beta.4

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 (182) hide show
  1. package/README.md +14 -26
  2. package/dist/cjs/codama/mainnet/accounts/contractState.js +92 -0
  3. package/dist/cjs/codama/mainnet/accounts/contractState.js.map +1 -0
  4. package/dist/cjs/codama/mainnet/accounts/fleet.js +77 -0
  5. package/dist/cjs/codama/mainnet/accounts/fleet.js.map +1 -0
  6. package/dist/cjs/codama/mainnet/accounts/index.js +28 -0
  7. package/dist/cjs/codama/mainnet/accounts/index.js.map +1 -0
  8. package/dist/cjs/codama/mainnet/accounts/rentalState.js +85 -0
  9. package/dist/cjs/codama/mainnet/accounts/rentalState.js.map +1 -0
  10. package/dist/cjs/codama/mainnet/accounts/thread.js +89 -0
  11. package/dist/cjs/codama/mainnet/accounts/thread.js.map +1 -0
  12. package/dist/cjs/codama/mainnet/errors/index.js +25 -0
  13. package/dist/cjs/codama/mainnet/errors/index.js.map +1 -0
  14. package/dist/cjs/codama/mainnet/errors/srsly.js +71 -0
  15. package/dist/cjs/codama/mainnet/errors/srsly.js.map +1 -0
  16. package/dist/cjs/codama/mainnet/index.js +29 -0
  17. package/dist/cjs/codama/mainnet/index.js.map +1 -0
  18. package/dist/cjs/codama/mainnet/instructions/acceptRental.js +363 -0
  19. package/dist/cjs/codama/mainnet/instructions/acceptRental.js.map +1 -0
  20. package/dist/cjs/codama/mainnet/instructions/cancelRental.js +225 -0
  21. package/dist/cjs/codama/mainnet/instructions/cancelRental.js.map +1 -0
  22. package/dist/cjs/codama/mainnet/instructions/closeContract.js +219 -0
  23. package/dist/cjs/codama/mainnet/instructions/closeContract.js.map +1 -0
  24. package/dist/cjs/codama/mainnet/instructions/closeRental.js +233 -0
  25. package/dist/cjs/codama/mainnet/instructions/closeRental.js.map +1 -0
  26. package/dist/cjs/codama/mainnet/instructions/createContract.js +261 -0
  27. package/dist/cjs/codama/mainnet/instructions/createContract.js.map +1 -0
  28. package/dist/cjs/codama/mainnet/instructions/index.js +32 -0
  29. package/dist/cjs/codama/mainnet/instructions/index.js.map +1 -0
  30. package/dist/cjs/codama/mainnet/instructions/normalizeAdmin.js +152 -0
  31. package/dist/cjs/codama/mainnet/instructions/normalizeAdmin.js.map +1 -0
  32. package/dist/cjs/codama/mainnet/instructions/payRental.js +236 -0
  33. package/dist/cjs/codama/mainnet/instructions/payRental.js.map +1 -0
  34. package/dist/cjs/codama/mainnet/instructions/resetRental.js +155 -0
  35. package/dist/cjs/codama/mainnet/instructions/resetRental.js.map +1 -0
  36. package/dist/cjs/codama/mainnet/programs/index.js +25 -0
  37. package/dist/cjs/codama/mainnet/programs/index.js.map +1 -0
  38. package/dist/cjs/codama/mainnet/programs/srsly.js +77 -0
  39. package/dist/cjs/codama/mainnet/programs/srsly.js.map +1 -0
  40. package/dist/cjs/codama/mainnet/shared/index.js +95 -0
  41. package/dist/cjs/codama/mainnet/shared/index.js.map +1 -0
  42. package/dist/cjs/codama/mainnet/types/clockData.js +31 -0
  43. package/dist/cjs/codama/mainnet/types/clockData.js.map +1 -0
  44. package/dist/cjs/codama/mainnet/types/equality.js +30 -0
  45. package/dist/cjs/codama/mainnet/types/equality.js.map +1 -0
  46. package/dist/cjs/codama/mainnet/types/execContext.js +38 -0
  47. package/dist/cjs/codama/mainnet/types/execContext.js.map +1 -0
  48. package/dist/cjs/codama/mainnet/types/index.js +33 -0
  49. package/dist/cjs/codama/mainnet/types/index.js.map +1 -0
  50. package/dist/cjs/codama/mainnet/types/paymentFrequency.js +32 -0
  51. package/dist/cjs/codama/mainnet/types/paymentFrequency.js.map +1 -0
  52. package/dist/cjs/codama/mainnet/types/serializableAccount.js +31 -0
  53. package/dist/cjs/codama/mainnet/types/serializableAccount.js.map +1 -0
  54. package/dist/cjs/codama/mainnet/types/serializableInstruction.js +32 -0
  55. package/dist/cjs/codama/mainnet/types/serializableInstruction.js.map +1 -0
  56. package/dist/cjs/codama/mainnet/types/threadResponse.js +38 -0
  57. package/dist/cjs/codama/mainnet/types/threadResponse.js.map +1 -0
  58. package/dist/cjs/codama/mainnet/types/trigger.js +90 -0
  59. package/dist/cjs/codama/mainnet/types/trigger.js.map +1 -0
  60. package/dist/cjs/codama/mainnet/types/triggerContext.js +49 -0
  61. package/dist/cjs/codama/mainnet/types/triggerContext.js.map +1 -0
  62. package/dist/esm/codama/mainnet/accounts/contractState.js +79 -0
  63. package/dist/esm/codama/mainnet/accounts/contractState.js.map +1 -0
  64. package/dist/esm/codama/mainnet/accounts/fleet.js +64 -0
  65. package/dist/esm/codama/mainnet/accounts/fleet.js.map +1 -0
  66. package/dist/esm/codama/mainnet/accounts/index.js +12 -0
  67. package/dist/esm/codama/mainnet/accounts/index.js.map +1 -0
  68. package/dist/esm/codama/mainnet/accounts/rentalState.js +72 -0
  69. package/dist/esm/codama/mainnet/accounts/rentalState.js.map +1 -0
  70. package/dist/esm/codama/mainnet/accounts/thread.js +77 -0
  71. package/dist/esm/codama/mainnet/accounts/thread.js.map +1 -0
  72. package/dist/esm/codama/mainnet/errors/index.js +9 -0
  73. package/dist/esm/codama/mainnet/errors/index.js.map +1 -0
  74. package/dist/esm/codama/mainnet/errors/srsly.js +66 -0
  75. package/dist/esm/codama/mainnet/errors/srsly.js.map +1 -0
  76. package/dist/esm/codama/mainnet/index.js +13 -0
  77. package/dist/esm/codama/mainnet/index.js.map +1 -0
  78. package/dist/esm/codama/mainnet/instructions/acceptRental.js +353 -0
  79. package/dist/esm/codama/mainnet/instructions/acceptRental.js.map +1 -0
  80. package/dist/esm/codama/mainnet/instructions/cancelRental.js +215 -0
  81. package/dist/esm/codama/mainnet/instructions/cancelRental.js.map +1 -0
  82. package/dist/esm/codama/mainnet/instructions/closeContract.js +209 -0
  83. package/dist/esm/codama/mainnet/instructions/closeContract.js.map +1 -0
  84. package/dist/esm/codama/mainnet/instructions/closeRental.js +223 -0
  85. package/dist/esm/codama/mainnet/instructions/closeRental.js.map +1 -0
  86. package/dist/esm/codama/mainnet/instructions/createContract.js +251 -0
  87. package/dist/esm/codama/mainnet/instructions/createContract.js.map +1 -0
  88. package/dist/esm/codama/mainnet/instructions/index.js +16 -0
  89. package/dist/esm/codama/mainnet/instructions/index.js.map +1 -0
  90. package/dist/esm/codama/mainnet/instructions/normalizeAdmin.js +142 -0
  91. package/dist/esm/codama/mainnet/instructions/normalizeAdmin.js.map +1 -0
  92. package/dist/esm/codama/mainnet/instructions/payRental.js +226 -0
  93. package/dist/esm/codama/mainnet/instructions/payRental.js.map +1 -0
  94. package/dist/esm/codama/mainnet/instructions/resetRental.js +145 -0
  95. package/dist/esm/codama/mainnet/instructions/resetRental.js.map +1 -0
  96. package/dist/esm/codama/mainnet/programs/index.js +9 -0
  97. package/dist/esm/codama/mainnet/programs/index.js.map +1 -0
  98. package/dist/esm/codama/mainnet/programs/srsly.js +72 -0
  99. package/dist/esm/codama/mainnet/programs/srsly.js.map +1 -0
  100. package/dist/esm/codama/mainnet/shared/index.js +87 -0
  101. package/dist/esm/codama/mainnet/shared/index.js.map +1 -0
  102. package/dist/esm/codama/mainnet/types/clockData.js +26 -0
  103. package/dist/esm/codama/mainnet/types/clockData.js.map +1 -0
  104. package/dist/esm/codama/mainnet/types/equality.js +24 -0
  105. package/dist/esm/codama/mainnet/types/equality.js.map +1 -0
  106. package/dist/esm/codama/mainnet/types/execContext.js +33 -0
  107. package/dist/esm/codama/mainnet/types/execContext.js.map +1 -0
  108. package/dist/esm/codama/mainnet/types/index.js +17 -0
  109. package/dist/esm/codama/mainnet/types/index.js.map +1 -0
  110. package/dist/esm/codama/mainnet/types/paymentFrequency.js +26 -0
  111. package/dist/esm/codama/mainnet/types/paymentFrequency.js.map +1 -0
  112. package/dist/esm/codama/mainnet/types/serializableAccount.js +26 -0
  113. package/dist/esm/codama/mainnet/types/serializableAccount.js.map +1 -0
  114. package/dist/esm/codama/mainnet/types/serializableInstruction.js +27 -0
  115. package/dist/esm/codama/mainnet/types/serializableInstruction.js.map +1 -0
  116. package/dist/esm/codama/mainnet/types/threadResponse.js +33 -0
  117. package/dist/esm/codama/mainnet/types/threadResponse.js.map +1 -0
  118. package/dist/esm/codama/mainnet/types/trigger.js +83 -0
  119. package/dist/esm/codama/mainnet/types/trigger.js.map +1 -0
  120. package/dist/esm/codama/mainnet/types/triggerContext.js +42 -0
  121. package/dist/esm/codama/mainnet/types/triggerContext.js.map +1 -0
  122. package/dist/types/codama/mainnet/accounts/contractState.d.ts +53 -0
  123. package/dist/types/codama/mainnet/accounts/contractState.d.ts.map +1 -0
  124. package/dist/types/codama/mainnet/accounts/fleet.d.ts +38 -0
  125. package/dist/types/codama/mainnet/accounts/fleet.d.ts.map +1 -0
  126. package/dist/types/codama/mainnet/accounts/index.d.ts +12 -0
  127. package/dist/types/codama/mainnet/accounts/index.d.ts.map +1 -0
  128. package/dist/types/codama/mainnet/accounts/rentalState.d.ts +46 -0
  129. package/dist/types/codama/mainnet/accounts/rentalState.d.ts.map +1 -0
  130. package/dist/types/codama/mainnet/accounts/thread.d.ts +74 -0
  131. package/dist/types/codama/mainnet/accounts/thread.d.ts.map +1 -0
  132. package/dist/types/codama/mainnet/errors/index.d.ts +9 -0
  133. package/dist/types/codama/mainnet/errors/index.d.ts.map +1 -0
  134. package/dist/types/codama/mainnet/errors/srsly.d.ts +48 -0
  135. package/dist/types/codama/mainnet/errors/srsly.d.ts.map +1 -0
  136. package/dist/types/codama/mainnet/index.d.ts +13 -0
  137. package/dist/types/codama/mainnet/index.d.ts.map +1 -0
  138. package/dist/types/codama/mainnet/instructions/acceptRental.d.ts +128 -0
  139. package/dist/types/codama/mainnet/instructions/acceptRental.d.ts.map +1 -0
  140. package/dist/types/codama/mainnet/instructions/cancelRental.d.ts +71 -0
  141. package/dist/types/codama/mainnet/instructions/cancelRental.d.ts.map +1 -0
  142. package/dist/types/codama/mainnet/instructions/closeContract.d.ts +96 -0
  143. package/dist/types/codama/mainnet/instructions/closeContract.d.ts.map +1 -0
  144. package/dist/types/codama/mainnet/instructions/closeRental.d.ts +79 -0
  145. package/dist/types/codama/mainnet/instructions/closeRental.d.ts.map +1 -0
  146. package/dist/types/codama/mainnet/instructions/createContract.d.ts +108 -0
  147. package/dist/types/codama/mainnet/instructions/createContract.d.ts.map +1 -0
  148. package/dist/types/codama/mainnet/instructions/index.d.ts +16 -0
  149. package/dist/types/codama/mainnet/instructions/index.d.ts.map +1 -0
  150. package/dist/types/codama/mainnet/instructions/normalizeAdmin.d.ts +67 -0
  151. package/dist/types/codama/mainnet/instructions/normalizeAdmin.d.ts.map +1 -0
  152. package/dist/types/codama/mainnet/instructions/payRental.d.ts +99 -0
  153. package/dist/types/codama/mainnet/instructions/payRental.d.ts.map +1 -0
  154. package/dist/types/codama/mainnet/instructions/resetRental.d.ts +71 -0
  155. package/dist/types/codama/mainnet/instructions/resetRental.d.ts.map +1 -0
  156. package/dist/types/codama/mainnet/programs/index.d.ts +9 -0
  157. package/dist/types/codama/mainnet/programs/index.d.ts.map +1 -0
  158. package/dist/types/codama/mainnet/programs/srsly.d.ts +50 -0
  159. package/dist/types/codama/mainnet/programs/srsly.d.ts.map +1 -0
  160. package/dist/types/codama/mainnet/shared/index.d.ts +50 -0
  161. package/dist/types/codama/mainnet/shared/index.d.ts.map +1 -0
  162. package/dist/types/codama/mainnet/types/clockData.d.ts +29 -0
  163. package/dist/types/codama/mainnet/types/clockData.d.ts.map +1 -0
  164. package/dist/types/codama/mainnet/types/equality.d.ts +18 -0
  165. package/dist/types/codama/mainnet/types/equality.d.ts.map +1 -0
  166. package/dist/types/codama/mainnet/types/execContext.d.ts +48 -0
  167. package/dist/types/codama/mainnet/types/execContext.d.ts.map +1 -0
  168. package/dist/types/codama/mainnet/types/index.d.ts +17 -0
  169. package/dist/types/codama/mainnet/types/index.d.ts.map +1 -0
  170. package/dist/types/codama/mainnet/types/paymentFrequency.d.ts +20 -0
  171. package/dist/types/codama/mainnet/types/paymentFrequency.d.ts.map +1 -0
  172. package/dist/types/codama/mainnet/types/serializableAccount.d.ts +22 -0
  173. package/dist/types/codama/mainnet/types/serializableAccount.d.ts.map +1 -0
  174. package/dist/types/codama/mainnet/types/serializableInstruction.d.ts +30 -0
  175. package/dist/types/codama/mainnet/types/serializableInstruction.d.ts.map +1 -0
  176. package/dist/types/codama/mainnet/types/threadResponse.d.ts +42 -0
  177. package/dist/types/codama/mainnet/types/threadResponse.d.ts.map +1 -0
  178. package/dist/types/codama/mainnet/types/trigger.d.ts +98 -0
  179. package/dist/types/codama/mainnet/types/trigger.d.ts.map +1 -0
  180. package/dist/types/codama/mainnet/types/triggerContext.d.ts +75 -0
  181. package/dist/types/codama/mainnet/types/triggerContext.d.ts.map +1 -0
  182. package/package.json +3 -2
@@ -0,0 +1,223 @@
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
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
+ import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
+ import { expectAddress, getAccountMetaFactory, } from '../shared';
11
+ export const CLOSE_RENTAL_DISCRIMINATOR = new Uint8Array([
12
+ 179, 188, 113, 211, 41, 232, 51, 51,
13
+ ]);
14
+ export function getCloseRentalDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(CLOSE_RENTAL_DISCRIMINATOR);
16
+ }
17
+ export function getCloseRentalInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CLOSE_RENTAL_DISCRIMINATOR }));
19
+ }
20
+ export function getCloseRentalInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
23
+ ]);
24
+ }
25
+ export function getCloseRentalInstructionDataCodec() {
26
+ return combineCodec(getCloseRentalInstructionDataEncoder(), getCloseRentalInstructionDataDecoder());
27
+ }
28
+ export async function getCloseRentalInstructionAsync(input, config) {
29
+ // Program address.
30
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
31
+ // Original accounts.
32
+ const originalAccounts = {
33
+ borrower: { value: input.borrower ?? null, isWritable: true },
34
+ ownerTokenAccount: {
35
+ value: input.ownerTokenAccount ?? null,
36
+ isWritable: true,
37
+ },
38
+ contract: { value: input.contract ?? null, isWritable: false },
39
+ rentalState: { value: input.rentalState ?? null, isWritable: true },
40
+ rentalTokenAccount: {
41
+ value: input.rentalTokenAccount ?? null,
42
+ isWritable: true,
43
+ },
44
+ rentalAuthority: {
45
+ value: input.rentalAuthority ?? null,
46
+ isWritable: false,
47
+ },
48
+ rentalThread: { value: input.rentalThread ?? null, isWritable: true },
49
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
50
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
51
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
52
+ };
53
+ const accounts = originalAccounts;
54
+ // Resolve default values.
55
+ if (!accounts.rentalState.value) {
56
+ accounts.rentalState.value = await getProgramDerivedAddress({
57
+ programAddress,
58
+ seeds: [
59
+ getBytesEncoder().encode(new Uint8Array([
60
+ 114, 101, 110, 116, 97, 108, 95, 115, 116, 97, 116, 101,
61
+ ])),
62
+ getAddressEncoder().encode(expectAddress(accounts.contract.value)),
63
+ getAddressEncoder().encode(expectAddress(accounts.borrower.value)),
64
+ ],
65
+ });
66
+ }
67
+ if (!accounts.rentalTokenAccount.value) {
68
+ accounts.rentalTokenAccount.value = await getProgramDerivedAddress({
69
+ programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
70
+ seeds: [
71
+ getAddressEncoder().encode(expectAddress(accounts.rentalState.value)),
72
+ getBytesEncoder().encode(new Uint8Array([
73
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235,
74
+ 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133,
75
+ 126, 255, 0, 169,
76
+ ])),
77
+ getBytesEncoder().encode(new Uint8Array([
78
+ 140, 119, 243, 102, 29, 107, 74, 142, 243, 157, 188, 83, 64, 238,
79
+ 173, 140, 60, 190, 11, 69, 9, 152, 64, 232, 38, 61, 135, 37, 181,
80
+ 135, 176, 115,
81
+ ])),
82
+ ],
83
+ });
84
+ }
85
+ if (!accounts.rentalAuthority.value) {
86
+ accounts.rentalAuthority.value = await getProgramDerivedAddress({
87
+ programAddress,
88
+ seeds: [
89
+ getBytesEncoder().encode(new Uint8Array([
90
+ 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
91
+ 116, 121,
92
+ ])),
93
+ ],
94
+ });
95
+ }
96
+ if (!accounts.rentalThread.value) {
97
+ accounts.rentalThread.value = await getProgramDerivedAddress({
98
+ programAddress,
99
+ seeds: [
100
+ getBytesEncoder().encode(new Uint8Array([116, 104, 114, 101, 97, 100])),
101
+ getAddressEncoder().encode(expectAddress(accounts.rentalAuthority.value)),
102
+ getAddressEncoder().encode(expectAddress(accounts.rentalState.value)),
103
+ ],
104
+ });
105
+ }
106
+ if (!accounts.antegenProgram.value) {
107
+ accounts.antegenProgram.value =
108
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
109
+ }
110
+ if (!accounts.tokenProgram.value) {
111
+ accounts.tokenProgram.value =
112
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
113
+ }
114
+ if (!accounts.systemProgram.value) {
115
+ accounts.systemProgram.value =
116
+ '11111111111111111111111111111111';
117
+ }
118
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
119
+ const instruction = {
120
+ accounts: [
121
+ getAccountMeta(accounts.borrower),
122
+ getAccountMeta(accounts.ownerTokenAccount),
123
+ getAccountMeta(accounts.contract),
124
+ getAccountMeta(accounts.rentalState),
125
+ getAccountMeta(accounts.rentalTokenAccount),
126
+ getAccountMeta(accounts.rentalAuthority),
127
+ getAccountMeta(accounts.rentalThread),
128
+ getAccountMeta(accounts.antegenProgram),
129
+ getAccountMeta(accounts.tokenProgram),
130
+ getAccountMeta(accounts.systemProgram),
131
+ ],
132
+ programAddress,
133
+ data: getCloseRentalInstructionDataEncoder().encode({}),
134
+ };
135
+ return instruction;
136
+ }
137
+ export function getCloseRentalInstruction(input, config) {
138
+ // Program address.
139
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
140
+ // Original accounts.
141
+ const originalAccounts = {
142
+ borrower: { value: input.borrower ?? null, isWritable: true },
143
+ ownerTokenAccount: {
144
+ value: input.ownerTokenAccount ?? null,
145
+ isWritable: true,
146
+ },
147
+ contract: { value: input.contract ?? null, isWritable: false },
148
+ rentalState: { value: input.rentalState ?? null, isWritable: true },
149
+ rentalTokenAccount: {
150
+ value: input.rentalTokenAccount ?? null,
151
+ isWritable: true,
152
+ },
153
+ rentalAuthority: {
154
+ value: input.rentalAuthority ?? null,
155
+ isWritable: false,
156
+ },
157
+ rentalThread: { value: input.rentalThread ?? null, isWritable: true },
158
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
159
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
160
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
161
+ };
162
+ const accounts = originalAccounts;
163
+ // Resolve default values.
164
+ if (!accounts.antegenProgram.value) {
165
+ accounts.antegenProgram.value =
166
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
167
+ }
168
+ if (!accounts.tokenProgram.value) {
169
+ accounts.tokenProgram.value =
170
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
171
+ }
172
+ if (!accounts.systemProgram.value) {
173
+ accounts.systemProgram.value =
174
+ '11111111111111111111111111111111';
175
+ }
176
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
177
+ const instruction = {
178
+ accounts: [
179
+ getAccountMeta(accounts.borrower),
180
+ getAccountMeta(accounts.ownerTokenAccount),
181
+ getAccountMeta(accounts.contract),
182
+ getAccountMeta(accounts.rentalState),
183
+ getAccountMeta(accounts.rentalTokenAccount),
184
+ getAccountMeta(accounts.rentalAuthority),
185
+ getAccountMeta(accounts.rentalThread),
186
+ getAccountMeta(accounts.antegenProgram),
187
+ getAccountMeta(accounts.tokenProgram),
188
+ getAccountMeta(accounts.systemProgram),
189
+ ],
190
+ programAddress,
191
+ data: getCloseRentalInstructionDataEncoder().encode({}),
192
+ };
193
+ return instruction;
194
+ }
195
+ export function parseCloseRentalInstruction(instruction) {
196
+ if (instruction.accounts.length < 10) {
197
+ // TODO: Coded error.
198
+ throw new Error('Not enough accounts');
199
+ }
200
+ let accountIndex = 0;
201
+ const getNextAccount = () => {
202
+ const accountMeta = instruction.accounts[accountIndex];
203
+ accountIndex += 1;
204
+ return accountMeta;
205
+ };
206
+ return {
207
+ programAddress: instruction.programAddress,
208
+ accounts: {
209
+ borrower: getNextAccount(),
210
+ ownerTokenAccount: getNextAccount(),
211
+ contract: getNextAccount(),
212
+ rentalState: getNextAccount(),
213
+ rentalTokenAccount: getNextAccount(),
214
+ rentalAuthority: getNextAccount(),
215
+ rentalThread: getNextAccount(),
216
+ antegenProgram: getNextAccount(),
217
+ tokenProgram: getNextAccount(),
218
+ systemProgram: getNextAccount(),
219
+ },
220
+ data: getCloseRentalInstructionDataDecoder().decode(instruction.data),
221
+ };
222
+ }
223
+ //# sourceMappingURL=closeRental.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closeRental.js","sourceRoot":"","sources":["../../../../../src/codama/mainnet/instructions/closeRental.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd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CAAC;IACzC,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAG,WAAW,CAAC,QAAS,CAAC,YAAY,CAAE,CAAC;QACzD,YAAY,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IACF,OAAO;QACL,cAAc,EAAE,WAAW,CAAC,cAAc;QAC1C,QAAQ,EAAE;YACR,QAAQ,EAAE,cAAc,EAAE;YAC1B,iBAAiB,EAAE,cAAc,EAAE;YACnC,QAAQ,EAAE,cAAc,EAAE;YAC1B,WAAW,EAAE,cAAc,EAAE;YAC7B,kBAAkB,EAAE,cAAc,EAAE;YACpC,eAAe,EAAE,cAAc,EAAE;YACjC,YAAY,EAAE,cAAc,EAAE;YAC9B,cAAc,EAAE,cAAc,EAAE;YAChC,YAAY,EAAE,cAAc,EAAE;YAC9B,aAAa,EAAE,cAAc,EAAE;SAChC;QACD,IAAI,EAAE,oCAAoC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACtE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,251 @@
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
+ import { addDecoderSizePrefix, addEncoderSizePrefix, combineCodec, fixDecoderSize, fixEncoderSize, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getUtf8Decoder, getUtf8Encoder, transformEncoder, } from '@solana/kit';
9
+ import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
+ import { expectAddress, getAccountMetaFactory, } from '../shared';
11
+ export const CREATE_CONTRACT_DISCRIMINATOR = new Uint8Array([
12
+ 244, 48, 244, 178, 216, 88, 122, 52,
13
+ ]);
14
+ export function getCreateContractDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(CREATE_CONTRACT_DISCRIMINATOR);
16
+ }
17
+ export function getCreateContractInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([
19
+ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
20
+ ['rate', getU64Encoder()],
21
+ ['durationMin', getU64Encoder()],
22
+ ['durationMax', getU64Encoder()],
23
+ ['paymentsFeq', addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
24
+ ['ownerKeyIndex', getU16Encoder()],
25
+ ]), (value) => ({ ...value, discriminator: CREATE_CONTRACT_DISCRIMINATOR }));
26
+ }
27
+ export function getCreateContractInstructionDataDecoder() {
28
+ return getStructDecoder([
29
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
30
+ ['rate', getU64Decoder()],
31
+ ['durationMin', getU64Decoder()],
32
+ ['durationMax', getU64Decoder()],
33
+ ['paymentsFeq', addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
34
+ ['ownerKeyIndex', getU16Decoder()],
35
+ ]);
36
+ }
37
+ export function getCreateContractInstructionDataCodec() {
38
+ return combineCodec(getCreateContractInstructionDataEncoder(), getCreateContractInstructionDataDecoder());
39
+ }
40
+ export async function getCreateContractInstructionAsync(input, config) {
41
+ // Program address.
42
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
43
+ // Original accounts.
44
+ const originalAccounts = {
45
+ mint: { value: input.mint ?? null, isWritable: false },
46
+ owner: { value: input.owner ?? null, isWritable: true },
47
+ ownerTokenAccount: {
48
+ value: input.ownerTokenAccount ?? null,
49
+ isWritable: true,
50
+ },
51
+ fleet: { value: input.fleet ?? null, isWritable: true },
52
+ ownerProfile: { value: input.ownerProfile ?? null, isWritable: false },
53
+ gameId: { value: input.gameId ?? null, isWritable: false },
54
+ contract: { value: input.contract ?? null, isWritable: true },
55
+ rentalAuthority: {
56
+ value: input.rentalAuthority ?? null,
57
+ isWritable: false,
58
+ },
59
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
60
+ associatedTokenProgram: {
61
+ value: input.associatedTokenProgram ?? null,
62
+ isWritable: false,
63
+ },
64
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
65
+ sageProgram: { value: input.sageProgram ?? null, isWritable: false },
66
+ };
67
+ const accounts = originalAccounts;
68
+ // Original args.
69
+ const args = { ...input };
70
+ // Resolve default values.
71
+ if (!accounts.mint.value) {
72
+ accounts.mint.value =
73
+ 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx';
74
+ }
75
+ if (!accounts.ownerTokenAccount.value) {
76
+ accounts.ownerTokenAccount.value = await getProgramDerivedAddress({
77
+ programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
78
+ seeds: [
79
+ getAddressEncoder().encode(expectAddress(accounts.owner.value)),
80
+ getBytesEncoder().encode(new Uint8Array([
81
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235,
82
+ 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133,
83
+ 126, 255, 0, 169,
84
+ ])),
85
+ getAddressEncoder().encode(expectAddress(accounts.mint.value)),
86
+ ],
87
+ });
88
+ }
89
+ if (!accounts.contract.value) {
90
+ accounts.contract.value = await getProgramDerivedAddress({
91
+ programAddress,
92
+ seeds: [
93
+ getBytesEncoder().encode(new Uint8Array([
94
+ 114, 101, 110, 116, 97, 108, 95, 99, 111, 110, 116, 114, 97, 99,
95
+ 116,
96
+ ])),
97
+ getAddressEncoder().encode(expectAddress(accounts.fleet.value)),
98
+ ],
99
+ });
100
+ }
101
+ if (!accounts.rentalAuthority.value) {
102
+ accounts.rentalAuthority.value = await getProgramDerivedAddress({
103
+ programAddress,
104
+ seeds: [
105
+ getBytesEncoder().encode(new Uint8Array([
106
+ 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
107
+ 116, 121,
108
+ ])),
109
+ ],
110
+ });
111
+ }
112
+ if (!accounts.tokenProgram.value) {
113
+ accounts.tokenProgram.value =
114
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
115
+ }
116
+ if (!accounts.associatedTokenProgram.value) {
117
+ accounts.associatedTokenProgram.value =
118
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
119
+ }
120
+ if (!accounts.systemProgram.value) {
121
+ accounts.systemProgram.value =
122
+ '11111111111111111111111111111111';
123
+ }
124
+ if (!accounts.sageProgram.value) {
125
+ accounts.sageProgram.value =
126
+ 'SAGE2HAwep459SNq61LHvjxPk4pLPEJLoMETef7f7EE';
127
+ }
128
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
129
+ const instruction = {
130
+ accounts: [
131
+ getAccountMeta(accounts.mint),
132
+ getAccountMeta(accounts.owner),
133
+ getAccountMeta(accounts.ownerTokenAccount),
134
+ getAccountMeta(accounts.fleet),
135
+ getAccountMeta(accounts.ownerProfile),
136
+ getAccountMeta(accounts.gameId),
137
+ getAccountMeta(accounts.contract),
138
+ getAccountMeta(accounts.rentalAuthority),
139
+ getAccountMeta(accounts.tokenProgram),
140
+ getAccountMeta(accounts.associatedTokenProgram),
141
+ getAccountMeta(accounts.systemProgram),
142
+ getAccountMeta(accounts.sageProgram),
143
+ ],
144
+ programAddress,
145
+ data: getCreateContractInstructionDataEncoder().encode(args),
146
+ };
147
+ return instruction;
148
+ }
149
+ export function getCreateContractInstruction(input, config) {
150
+ // Program address.
151
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
152
+ // Original accounts.
153
+ const originalAccounts = {
154
+ mint: { value: input.mint ?? null, isWritable: false },
155
+ owner: { value: input.owner ?? null, isWritable: true },
156
+ ownerTokenAccount: {
157
+ value: input.ownerTokenAccount ?? null,
158
+ isWritable: true,
159
+ },
160
+ fleet: { value: input.fleet ?? null, isWritable: true },
161
+ ownerProfile: { value: input.ownerProfile ?? null, isWritable: false },
162
+ gameId: { value: input.gameId ?? null, isWritable: false },
163
+ contract: { value: input.contract ?? null, isWritable: true },
164
+ rentalAuthority: {
165
+ value: input.rentalAuthority ?? null,
166
+ isWritable: false,
167
+ },
168
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
169
+ associatedTokenProgram: {
170
+ value: input.associatedTokenProgram ?? null,
171
+ isWritable: false,
172
+ },
173
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
174
+ sageProgram: { value: input.sageProgram ?? null, isWritable: false },
175
+ };
176
+ const accounts = originalAccounts;
177
+ // Original args.
178
+ const args = { ...input };
179
+ // Resolve default values.
180
+ if (!accounts.mint.value) {
181
+ accounts.mint.value =
182
+ 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx';
183
+ }
184
+ if (!accounts.tokenProgram.value) {
185
+ accounts.tokenProgram.value =
186
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
187
+ }
188
+ if (!accounts.associatedTokenProgram.value) {
189
+ accounts.associatedTokenProgram.value =
190
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
191
+ }
192
+ if (!accounts.systemProgram.value) {
193
+ accounts.systemProgram.value =
194
+ '11111111111111111111111111111111';
195
+ }
196
+ if (!accounts.sageProgram.value) {
197
+ accounts.sageProgram.value =
198
+ 'SAGE2HAwep459SNq61LHvjxPk4pLPEJLoMETef7f7EE';
199
+ }
200
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
201
+ const instruction = {
202
+ accounts: [
203
+ getAccountMeta(accounts.mint),
204
+ getAccountMeta(accounts.owner),
205
+ getAccountMeta(accounts.ownerTokenAccount),
206
+ getAccountMeta(accounts.fleet),
207
+ getAccountMeta(accounts.ownerProfile),
208
+ getAccountMeta(accounts.gameId),
209
+ getAccountMeta(accounts.contract),
210
+ getAccountMeta(accounts.rentalAuthority),
211
+ getAccountMeta(accounts.tokenProgram),
212
+ getAccountMeta(accounts.associatedTokenProgram),
213
+ getAccountMeta(accounts.systemProgram),
214
+ getAccountMeta(accounts.sageProgram),
215
+ ],
216
+ programAddress,
217
+ data: getCreateContractInstructionDataEncoder().encode(args),
218
+ };
219
+ return instruction;
220
+ }
221
+ export function parseCreateContractInstruction(instruction) {
222
+ if (instruction.accounts.length < 12) {
223
+ // TODO: Coded error.
224
+ throw new Error('Not enough accounts');
225
+ }
226
+ let accountIndex = 0;
227
+ const getNextAccount = () => {
228
+ const accountMeta = instruction.accounts[accountIndex];
229
+ accountIndex += 1;
230
+ return accountMeta;
231
+ };
232
+ return {
233
+ programAddress: instruction.programAddress,
234
+ accounts: {
235
+ mint: getNextAccount(),
236
+ owner: getNextAccount(),
237
+ ownerTokenAccount: getNextAccount(),
238
+ fleet: getNextAccount(),
239
+ ownerProfile: getNextAccount(),
240
+ gameId: getNextAccount(),
241
+ contract: getNextAccount(),
242
+ rentalAuthority: getNextAccount(),
243
+ tokenProgram: getNextAccount(),
244
+ associatedTokenProgram: getNextAccount(),
245
+ systemProgram: getNextAccount(),
246
+ sageProgram: getNextAccount(),
247
+ },
248
+ data: getCreateContractInstructionDataDecoder().decode(instruction.data),
249
+ };
250
+ }
251
+ //# sourceMappingURL=createContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContract.js","sourceRoot":"","sources":["../../../../../src/codama/mainnet/instructions/createContract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,gBAAgB,GAejB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,EAAE;YACjC,YAAY,EAAE,cAAc,EAAE;YAC9B,sBAAsB,EAAE,cAAc,EAAE;YACxC,aAAa,EAAE,cAAc,EAAE;YAC/B,WAAW,EAAE,cAAc,EAAE;SAC9B;QACD,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACzE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
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
+ export * from './acceptRental';
9
+ export * from './cancelRental';
10
+ export * from './closeContract';
11
+ export * from './closeRental';
12
+ export * from './createContract';
13
+ export * from './normalizeAdmin';
14
+ export * from './payRental';
15
+ export * from './resetRental';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/codama/mainnet/instructions/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,142 @@
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
+ import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
+ import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const NORMALIZE_ADMIN_DISCRIMINATOR = new Uint8Array([
12
+ 26, 134, 185, 168, 82, 175, 6, 182,
13
+ ]);
14
+ export function getNormalizeAdminDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(NORMALIZE_ADMIN_DISCRIMINATOR);
16
+ }
17
+ export function getNormalizeAdminInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: NORMALIZE_ADMIN_DISCRIMINATOR }));
19
+ }
20
+ export function getNormalizeAdminInstructionDataDecoder() {
21
+ return getStructDecoder([
22
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
23
+ ]);
24
+ }
25
+ export function getNormalizeAdminInstructionDataCodec() {
26
+ return combineCodec(getNormalizeAdminInstructionDataEncoder(), getNormalizeAdminInstructionDataDecoder());
27
+ }
28
+ export async function getNormalizeAdminInstructionAsync(input, config) {
29
+ // Program address.
30
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
31
+ // Original accounts.
32
+ const originalAccounts = {
33
+ admin: { value: input.admin ?? null, isWritable: false },
34
+ contract: { value: input.contract ?? null, isWritable: true },
35
+ rentalState: { value: input.rentalState ?? null, isWritable: true },
36
+ rentalAuthority: { value: input.rentalAuthority ?? null, isWritable: true },
37
+ thread: { value: input.thread ?? null, isWritable: true },
38
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
39
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
40
+ };
41
+ const accounts = originalAccounts;
42
+ // Resolve default values.
43
+ if (!accounts.rentalAuthority.value) {
44
+ accounts.rentalAuthority.value = await getProgramDerivedAddress({
45
+ programAddress,
46
+ seeds: [
47
+ getBytesEncoder().encode(new Uint8Array([
48
+ 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
49
+ 116, 121,
50
+ ])),
51
+ ],
52
+ });
53
+ }
54
+ if (!accounts.antegenProgram.value) {
55
+ accounts.antegenProgram.value =
56
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
57
+ }
58
+ if (!accounts.systemProgram.value) {
59
+ accounts.systemProgram.value =
60
+ '11111111111111111111111111111111';
61
+ }
62
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
63
+ const instruction = {
64
+ accounts: [
65
+ getAccountMeta(accounts.admin),
66
+ getAccountMeta(accounts.contract),
67
+ getAccountMeta(accounts.rentalState),
68
+ getAccountMeta(accounts.rentalAuthority),
69
+ getAccountMeta(accounts.thread),
70
+ getAccountMeta(accounts.antegenProgram),
71
+ getAccountMeta(accounts.systemProgram),
72
+ ],
73
+ programAddress,
74
+ data: getNormalizeAdminInstructionDataEncoder().encode({}),
75
+ };
76
+ return instruction;
77
+ }
78
+ export function getNormalizeAdminInstruction(input, config) {
79
+ // Program address.
80
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
81
+ // Original accounts.
82
+ const originalAccounts = {
83
+ admin: { value: input.admin ?? null, isWritable: false },
84
+ contract: { value: input.contract ?? null, isWritable: true },
85
+ rentalState: { value: input.rentalState ?? null, isWritable: true },
86
+ rentalAuthority: { value: input.rentalAuthority ?? null, isWritable: true },
87
+ thread: { value: input.thread ?? null, isWritable: true },
88
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
89
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
90
+ };
91
+ const accounts = originalAccounts;
92
+ // Resolve default values.
93
+ if (!accounts.antegenProgram.value) {
94
+ accounts.antegenProgram.value =
95
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
96
+ }
97
+ if (!accounts.systemProgram.value) {
98
+ accounts.systemProgram.value =
99
+ '11111111111111111111111111111111';
100
+ }
101
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
102
+ const instruction = {
103
+ accounts: [
104
+ getAccountMeta(accounts.admin),
105
+ getAccountMeta(accounts.contract),
106
+ getAccountMeta(accounts.rentalState),
107
+ getAccountMeta(accounts.rentalAuthority),
108
+ getAccountMeta(accounts.thread),
109
+ getAccountMeta(accounts.antegenProgram),
110
+ getAccountMeta(accounts.systemProgram),
111
+ ],
112
+ programAddress,
113
+ data: getNormalizeAdminInstructionDataEncoder().encode({}),
114
+ };
115
+ return instruction;
116
+ }
117
+ export function parseNormalizeAdminInstruction(instruction) {
118
+ if (instruction.accounts.length < 7) {
119
+ // TODO: Coded error.
120
+ throw new Error('Not enough accounts');
121
+ }
122
+ let accountIndex = 0;
123
+ const getNextAccount = () => {
124
+ const accountMeta = instruction.accounts[accountIndex];
125
+ accountIndex += 1;
126
+ return accountMeta;
127
+ };
128
+ return {
129
+ programAddress: instruction.programAddress,
130
+ accounts: {
131
+ admin: getNextAccount(),
132
+ contract: getNextAccount(),
133
+ rentalState: getNextAccount(),
134
+ rentalAuthority: getNextAccount(),
135
+ thread: getNextAccount(),
136
+ antegenProgram: getNextAccount(),
137
+ systemProgram: getNextAccount(),
138
+ },
139
+ data: getNormalizeAdminInstructionDataDecoder().decode(instruction.data),
140
+ };
141
+ }
142
+ //# sourceMappingURL=normalizeAdmin.js.map