@wuwei-labs/srsly 2.0.0-beta.15 → 2.0.0-beta.17

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 (227) hide show
  1. package/README.md +164 -927
  2. package/dist/cjs/codama/accounts/config.js +88 -0
  3. package/dist/cjs/codama/accounts/config.js.map +1 -0
  4. package/dist/cjs/codama/accounts/contractState.js +87 -0
  5. package/dist/cjs/codama/accounts/contractState.js.map +1 -0
  6. package/dist/cjs/codama/accounts/fleet.js +77 -0
  7. package/dist/cjs/codama/accounts/fleet.js.map +1 -0
  8. package/dist/cjs/codama/accounts/index.js +29 -0
  9. package/dist/cjs/codama/accounts/index.js.map +1 -0
  10. package/dist/cjs/codama/accounts/rentalState.js +87 -0
  11. package/dist/cjs/codama/accounts/rentalState.js.map +1 -0
  12. package/dist/cjs/codama/accounts/thread.js +89 -0
  13. package/dist/cjs/codama/accounts/thread.js.map +1 -0
  14. package/dist/cjs/codama/errors/index.js +25 -0
  15. package/dist/cjs/codama/errors/index.js.map +1 -0
  16. package/dist/cjs/codama/errors/srsly.js +86 -0
  17. package/dist/cjs/codama/errors/srsly.js.map +1 -0
  18. package/dist/cjs/codama/index.js +29 -0
  19. package/dist/cjs/codama/index.js.map +1 -0
  20. package/dist/cjs/codama/instructions/acceptRental.js +354 -0
  21. package/dist/cjs/codama/instructions/acceptRental.js.map +1 -0
  22. package/dist/cjs/codama/instructions/cancelRental.js +202 -0
  23. package/dist/cjs/codama/instructions/cancelRental.js.map +1 -0
  24. package/dist/cjs/codama/instructions/closeContract.js +211 -0
  25. package/dist/cjs/codama/instructions/closeContract.js.map +1 -0
  26. package/dist/cjs/codama/instructions/closeRental.js +233 -0
  27. package/dist/cjs/codama/instructions/closeRental.js.map +1 -0
  28. package/dist/cjs/codama/instructions/createContract.js +258 -0
  29. package/dist/cjs/codama/instructions/createContract.js.map +1 -0
  30. package/dist/cjs/codama/instructions/index.js +33 -0
  31. package/dist/cjs/codama/instructions/index.js.map +1 -0
  32. package/dist/cjs/codama/instructions/initializeConfig.js +131 -0
  33. package/dist/cjs/codama/instructions/initializeConfig.js.map +1 -0
  34. package/dist/cjs/codama/instructions/payRental.js +245 -0
  35. package/dist/cjs/codama/instructions/payRental.js.map +1 -0
  36. package/dist/cjs/codama/instructions/resetRental.js +146 -0
  37. package/dist/cjs/codama/instructions/resetRental.js.map +1 -0
  38. package/dist/cjs/codama/instructions/updateConfig.js +145 -0
  39. package/dist/cjs/codama/instructions/updateConfig.js.map +1 -0
  40. package/dist/cjs/codama/programs/index.js +25 -0
  41. package/dist/cjs/codama/programs/index.js.map +1 -0
  42. package/dist/cjs/codama/programs/srsly.js +85 -0
  43. package/dist/cjs/codama/programs/srsly.js.map +1 -0
  44. package/dist/cjs/codama/shared/index.js +95 -0
  45. package/dist/cjs/codama/shared/index.js.map +1 -0
  46. package/dist/cjs/codama/types/clockData.js +31 -0
  47. package/dist/cjs/codama/types/clockData.js.map +1 -0
  48. package/dist/cjs/codama/types/equality.js +30 -0
  49. package/dist/cjs/codama/types/equality.js.map +1 -0
  50. package/dist/cjs/codama/types/execContext.js +38 -0
  51. package/dist/cjs/codama/types/execContext.js.map +1 -0
  52. package/dist/cjs/codama/types/index.js +33 -0
  53. package/dist/cjs/codama/types/index.js.map +1 -0
  54. package/dist/cjs/codama/types/paymentFrequency.js +34 -0
  55. package/dist/cjs/codama/types/paymentFrequency.js.map +1 -0
  56. package/dist/cjs/codama/types/serializableAccount.js +31 -0
  57. package/dist/cjs/codama/types/serializableAccount.js.map +1 -0
  58. package/dist/cjs/codama/types/serializableInstruction.js +32 -0
  59. package/dist/cjs/codama/types/serializableInstruction.js.map +1 -0
  60. package/dist/cjs/codama/types/threadResponse.js +38 -0
  61. package/dist/cjs/codama/types/threadResponse.js.map +1 -0
  62. package/dist/cjs/codama/types/trigger.js +90 -0
  63. package/dist/cjs/codama/types/trigger.js.map +1 -0
  64. package/dist/cjs/codama/types/triggerContext.js +49 -0
  65. package/dist/cjs/codama/types/triggerContext.js.map +1 -0
  66. package/dist/cjs/contract/close.js +3 -3
  67. package/dist/cjs/contract/close.js.map +1 -1
  68. package/dist/cjs/contract/create.js +12 -8
  69. package/dist/cjs/contract/create.js.map +1 -1
  70. package/dist/cjs/package.json +1 -1
  71. package/dist/cjs/rental/accept.js +6 -6
  72. package/dist/cjs/rental/accept.js.map +1 -1
  73. package/dist/cjs/utils/config.js +12 -0
  74. package/dist/cjs/utils/config.js.map +1 -1
  75. package/dist/cjs/utils/constants.js +20 -4
  76. package/dist/cjs/utils/constants.js.map +1 -1
  77. package/dist/esm/codama/accounts/config.js +76 -0
  78. package/dist/esm/codama/accounts/config.js.map +1 -0
  79. package/dist/esm/codama/accounts/contractState.js +75 -0
  80. package/dist/esm/codama/accounts/contractState.js.map +1 -0
  81. package/dist/esm/codama/accounts/fleet.js +64 -0
  82. package/dist/esm/codama/accounts/fleet.js.map +1 -0
  83. package/dist/esm/codama/accounts/index.js +13 -0
  84. package/dist/esm/codama/accounts/index.js.map +1 -0
  85. package/dist/esm/codama/accounts/rentalState.js +74 -0
  86. package/dist/esm/codama/accounts/rentalState.js.map +1 -0
  87. package/dist/esm/codama/accounts/thread.js +77 -0
  88. package/dist/esm/codama/accounts/thread.js.map +1 -0
  89. package/dist/esm/codama/errors/index.js +9 -0
  90. package/dist/esm/codama/errors/index.js.map +1 -0
  91. package/dist/esm/codama/errors/srsly.js +81 -0
  92. package/dist/esm/codama/errors/srsly.js.map +1 -0
  93. package/dist/esm/codama/index.js +13 -0
  94. package/dist/esm/codama/index.js.map +1 -0
  95. package/dist/esm/codama/instructions/acceptRental.js +344 -0
  96. package/dist/esm/codama/instructions/acceptRental.js.map +1 -0
  97. package/dist/esm/codama/instructions/cancelRental.js +192 -0
  98. package/dist/esm/codama/instructions/cancelRental.js.map +1 -0
  99. package/dist/esm/codama/instructions/closeContract.js +201 -0
  100. package/dist/esm/codama/instructions/closeContract.js.map +1 -0
  101. package/dist/esm/codama/instructions/closeRental.js +223 -0
  102. package/dist/esm/codama/instructions/closeRental.js.map +1 -0
  103. package/dist/esm/codama/instructions/createContract.js +248 -0
  104. package/dist/esm/codama/instructions/createContract.js.map +1 -0
  105. package/dist/esm/codama/instructions/index.js +17 -0
  106. package/dist/esm/codama/instructions/index.js.map +1 -0
  107. package/dist/esm/codama/instructions/initializeConfig.js +121 -0
  108. package/dist/esm/codama/instructions/initializeConfig.js.map +1 -0
  109. package/dist/esm/codama/instructions/payRental.js +235 -0
  110. package/dist/esm/codama/instructions/payRental.js.map +1 -0
  111. package/dist/esm/codama/instructions/resetRental.js +136 -0
  112. package/dist/esm/codama/instructions/resetRental.js.map +1 -0
  113. package/dist/esm/codama/instructions/updateConfig.js +135 -0
  114. package/dist/esm/codama/instructions/updateConfig.js.map +1 -0
  115. package/dist/esm/codama/programs/index.js +9 -0
  116. package/dist/esm/codama/programs/index.js.map +1 -0
  117. package/dist/esm/codama/programs/srsly.js +80 -0
  118. package/dist/esm/codama/programs/srsly.js.map +1 -0
  119. package/dist/esm/codama/shared/index.js +87 -0
  120. package/dist/esm/codama/shared/index.js.map +1 -0
  121. package/dist/esm/codama/types/clockData.js +26 -0
  122. package/dist/esm/codama/types/clockData.js.map +1 -0
  123. package/dist/esm/codama/types/equality.js +24 -0
  124. package/dist/esm/codama/types/equality.js.map +1 -0
  125. package/dist/esm/codama/types/execContext.js +33 -0
  126. package/dist/esm/codama/types/execContext.js.map +1 -0
  127. package/dist/esm/codama/types/index.js +17 -0
  128. package/dist/esm/codama/types/index.js.map +1 -0
  129. package/dist/esm/codama/types/paymentFrequency.js +28 -0
  130. package/dist/esm/codama/types/paymentFrequency.js.map +1 -0
  131. package/dist/esm/codama/types/serializableAccount.js +26 -0
  132. package/dist/esm/codama/types/serializableAccount.js.map +1 -0
  133. package/dist/esm/codama/types/serializableInstruction.js +27 -0
  134. package/dist/esm/codama/types/serializableInstruction.js.map +1 -0
  135. package/dist/esm/codama/types/threadResponse.js +33 -0
  136. package/dist/esm/codama/types/threadResponse.js.map +1 -0
  137. package/dist/esm/codama/types/trigger.js +83 -0
  138. package/dist/esm/codama/types/trigger.js.map +1 -0
  139. package/dist/esm/codama/types/triggerContext.js +42 -0
  140. package/dist/esm/codama/types/triggerContext.js.map +1 -0
  141. package/dist/esm/contract/close.js +4 -4
  142. package/dist/esm/contract/close.js.map +1 -1
  143. package/dist/esm/contract/create.js +13 -9
  144. package/dist/esm/contract/create.js.map +1 -1
  145. package/dist/esm/package.json +1 -1
  146. package/dist/esm/rental/accept.js +7 -7
  147. package/dist/esm/rental/accept.js.map +1 -1
  148. package/dist/esm/utils/config.js +12 -0
  149. package/dist/esm/utils/config.js.map +1 -1
  150. package/dist/esm/utils/constants.js +18 -4
  151. package/dist/esm/utils/constants.js.map +1 -1
  152. package/dist/types/codama/accounts/config.d.ts +52 -0
  153. package/dist/types/codama/accounts/config.d.ts.map +1 -0
  154. package/dist/types/codama/accounts/contractState.d.ts +51 -0
  155. package/dist/types/codama/accounts/contractState.d.ts.map +1 -0
  156. package/dist/types/codama/accounts/fleet.d.ts +38 -0
  157. package/dist/types/codama/accounts/fleet.d.ts.map +1 -0
  158. package/dist/types/codama/accounts/index.d.ts +13 -0
  159. package/dist/types/codama/accounts/index.d.ts.map +1 -0
  160. package/dist/types/codama/accounts/rentalState.d.ts +48 -0
  161. package/dist/types/codama/accounts/rentalState.d.ts.map +1 -0
  162. package/dist/types/codama/accounts/thread.d.ts +74 -0
  163. package/dist/types/codama/accounts/thread.d.ts.map +1 -0
  164. package/dist/types/codama/errors/index.d.ts +9 -0
  165. package/dist/types/codama/errors/index.d.ts.map +1 -0
  166. package/dist/types/codama/errors/srsly.d.ts +58 -0
  167. package/dist/types/codama/errors/srsly.d.ts.map +1 -0
  168. package/dist/types/codama/index.d.ts +13 -0
  169. package/dist/types/codama/index.d.ts.map +1 -0
  170. package/dist/types/codama/instructions/acceptRental.d.ts +135 -0
  171. package/dist/types/codama/instructions/acceptRental.d.ts.map +1 -0
  172. package/dist/types/codama/instructions/cancelRental.d.ts +75 -0
  173. package/dist/types/codama/instructions/cancelRental.d.ts.map +1 -0
  174. package/dist/types/codama/instructions/closeContract.d.ts +104 -0
  175. package/dist/types/codama/instructions/closeContract.d.ts.map +1 -0
  176. package/dist/types/codama/instructions/closeRental.d.ts +87 -0
  177. package/dist/types/codama/instructions/closeRental.d.ts.map +1 -0
  178. package/dist/types/codama/instructions/createContract.d.ts +112 -0
  179. package/dist/types/codama/instructions/createContract.d.ts.map +1 -0
  180. package/dist/types/codama/instructions/index.d.ts +17 -0
  181. package/dist/types/codama/instructions/index.d.ts.map +1 -0
  182. package/dist/types/codama/instructions/initializeConfig.d.ts +60 -0
  183. package/dist/types/codama/instructions/initializeConfig.d.ts.map +1 -0
  184. package/dist/types/codama/instructions/payRental.d.ts +114 -0
  185. package/dist/types/codama/instructions/payRental.d.ts.map +1 -0
  186. package/dist/types/codama/instructions/resetRental.d.ts +71 -0
  187. package/dist/types/codama/instructions/resetRental.d.ts.map +1 -0
  188. package/dist/types/codama/instructions/updateConfig.d.ts +93 -0
  189. package/dist/types/codama/instructions/updateConfig.d.ts.map +1 -0
  190. package/dist/types/codama/programs/index.d.ts +9 -0
  191. package/dist/types/codama/programs/index.d.ts.map +1 -0
  192. package/dist/types/codama/programs/srsly.d.ts +54 -0
  193. package/dist/types/codama/programs/srsly.d.ts.map +1 -0
  194. package/dist/types/codama/shared/index.d.ts +50 -0
  195. package/dist/types/codama/shared/index.d.ts.map +1 -0
  196. package/dist/types/codama/types/clockData.d.ts +29 -0
  197. package/dist/types/codama/types/clockData.d.ts.map +1 -0
  198. package/dist/types/codama/types/equality.d.ts +18 -0
  199. package/dist/types/codama/types/equality.d.ts.map +1 -0
  200. package/dist/types/codama/types/execContext.d.ts +48 -0
  201. package/dist/types/codama/types/execContext.d.ts.map +1 -0
  202. package/dist/types/codama/types/index.d.ts +17 -0
  203. package/dist/types/codama/types/index.d.ts.map +1 -0
  204. package/dist/types/codama/types/paymentFrequency.d.ts +22 -0
  205. package/dist/types/codama/types/paymentFrequency.d.ts.map +1 -0
  206. package/dist/types/codama/types/serializableAccount.d.ts +22 -0
  207. package/dist/types/codama/types/serializableAccount.d.ts.map +1 -0
  208. package/dist/types/codama/types/serializableInstruction.d.ts +30 -0
  209. package/dist/types/codama/types/serializableInstruction.d.ts.map +1 -0
  210. package/dist/types/codama/types/threadResponse.d.ts +42 -0
  211. package/dist/types/codama/types/threadResponse.d.ts.map +1 -0
  212. package/dist/types/codama/types/trigger.d.ts +98 -0
  213. package/dist/types/codama/types/trigger.d.ts.map +1 -0
  214. package/dist/types/codama/types/triggerContext.d.ts +75 -0
  215. package/dist/types/codama/types/triggerContext.d.ts.map +1 -0
  216. package/dist/types/contract/close.d.ts +3 -3
  217. package/dist/types/contract/close.d.ts.map +1 -1
  218. package/dist/types/contract/create.d.ts +8 -3
  219. package/dist/types/contract/create.d.ts.map +1 -1
  220. package/dist/types/rental/accept.d.ts +5 -5
  221. package/dist/types/rental/accept.d.ts.map +1 -1
  222. package/dist/types/utils/config.d.ts +11 -0
  223. package/dist/types/utils/config.d.ts.map +1 -1
  224. package/dist/types/utils/constants.d.ts +12 -6
  225. package/dist/types/utils/constants.d.ts.map +1 -1
  226. package/package.json +13 -3
  227. package/target/idl/srsly.json +54 -54
@@ -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
+ feeTokenAccount: { value: input.feeTokenAccount ?? null, isWritable: true },
49
+ rentalThread: { value: input.rentalThread ?? null, isWritable: true },
50
+ config: { value: input.config ?? null, isWritable: false },
51
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
52
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
53
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
54
+ };
55
+ const accounts = originalAccounts;
56
+ // Resolve default values.
57
+ if (!accounts.rentalState.value) {
58
+ accounts.rentalState.value = await getProgramDerivedAddress({
59
+ programAddress,
60
+ seeds: [
61
+ getBytesEncoder().encode(new Uint8Array([
62
+ 114, 101, 110, 116, 97, 108, 95, 115, 116, 97, 116, 101,
63
+ ])),
64
+ getAddressEncoder().encode(expectAddress(accounts.contract.value)),
65
+ getAddressEncoder().encode(expectAddress(accounts.borrower.value)),
66
+ ],
67
+ });
68
+ }
69
+ if (!accounts.rentalAuthority.value) {
70
+ accounts.rentalAuthority.value = await getProgramDerivedAddress({
71
+ programAddress,
72
+ seeds: [
73
+ getBytesEncoder().encode(new Uint8Array([
74
+ 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
75
+ 116, 121,
76
+ ])),
77
+ ],
78
+ });
79
+ }
80
+ if (!accounts.rentalThread.value) {
81
+ accounts.rentalThread.value = await getProgramDerivedAddress({
82
+ programAddress,
83
+ seeds: [
84
+ getBytesEncoder().encode(new Uint8Array([116, 104, 114, 101, 97, 100])),
85
+ getAddressEncoder().encode(expectAddress(accounts.rentalAuthority.value)),
86
+ getAddressEncoder().encode(expectAddress(accounts.rentalState.value)),
87
+ ],
88
+ });
89
+ }
90
+ if (!accounts.config.value) {
91
+ accounts.config.value = await getProgramDerivedAddress({
92
+ programAddress,
93
+ seeds: [
94
+ getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103])),
95
+ ],
96
+ });
97
+ }
98
+ if (!accounts.antegenProgram.value) {
99
+ accounts.antegenProgram.value =
100
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
101
+ }
102
+ if (!accounts.tokenProgram.value) {
103
+ accounts.tokenProgram.value =
104
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
105
+ }
106
+ if (!accounts.systemProgram.value) {
107
+ accounts.systemProgram.value =
108
+ '11111111111111111111111111111111';
109
+ }
110
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
111
+ const instruction = {
112
+ accounts: [
113
+ getAccountMeta(accounts.borrower),
114
+ getAccountMeta(accounts.ownerTokenAccount),
115
+ getAccountMeta(accounts.contract),
116
+ getAccountMeta(accounts.rentalState),
117
+ getAccountMeta(accounts.rentalTokenAccount),
118
+ getAccountMeta(accounts.rentalAuthority),
119
+ getAccountMeta(accounts.feeTokenAccount),
120
+ getAccountMeta(accounts.rentalThread),
121
+ getAccountMeta(accounts.config),
122
+ getAccountMeta(accounts.antegenProgram),
123
+ getAccountMeta(accounts.tokenProgram),
124
+ getAccountMeta(accounts.systemProgram),
125
+ ],
126
+ programAddress,
127
+ data: getCloseRentalInstructionDataEncoder().encode({}),
128
+ };
129
+ return instruction;
130
+ }
131
+ export function getCloseRentalInstruction(input, config) {
132
+ // Program address.
133
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
134
+ // Original accounts.
135
+ const originalAccounts = {
136
+ borrower: { value: input.borrower ?? null, isWritable: true },
137
+ ownerTokenAccount: {
138
+ value: input.ownerTokenAccount ?? null,
139
+ isWritable: true,
140
+ },
141
+ contract: { value: input.contract ?? null, isWritable: false },
142
+ rentalState: { value: input.rentalState ?? null, isWritable: true },
143
+ rentalTokenAccount: {
144
+ value: input.rentalTokenAccount ?? null,
145
+ isWritable: true,
146
+ },
147
+ rentalAuthority: {
148
+ value: input.rentalAuthority ?? null,
149
+ isWritable: false,
150
+ },
151
+ feeTokenAccount: { value: input.feeTokenAccount ?? null, isWritable: true },
152
+ rentalThread: { value: input.rentalThread ?? null, isWritable: true },
153
+ config: { value: input.config ?? null, isWritable: false },
154
+ antegenProgram: { value: input.antegenProgram ?? null, isWritable: false },
155
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
156
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
157
+ };
158
+ const accounts = originalAccounts;
159
+ // Resolve default values.
160
+ if (!accounts.antegenProgram.value) {
161
+ accounts.antegenProgram.value =
162
+ 'AgThdyi1P5RkVeZD2rQahTvs8HePJoGFFxKtvok5s2J1';
163
+ }
164
+ if (!accounts.tokenProgram.value) {
165
+ accounts.tokenProgram.value =
166
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
167
+ }
168
+ if (!accounts.systemProgram.value) {
169
+ accounts.systemProgram.value =
170
+ '11111111111111111111111111111111';
171
+ }
172
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
173
+ const instruction = {
174
+ accounts: [
175
+ getAccountMeta(accounts.borrower),
176
+ getAccountMeta(accounts.ownerTokenAccount),
177
+ getAccountMeta(accounts.contract),
178
+ getAccountMeta(accounts.rentalState),
179
+ getAccountMeta(accounts.rentalTokenAccount),
180
+ getAccountMeta(accounts.rentalAuthority),
181
+ getAccountMeta(accounts.feeTokenAccount),
182
+ getAccountMeta(accounts.rentalThread),
183
+ getAccountMeta(accounts.config),
184
+ getAccountMeta(accounts.antegenProgram),
185
+ getAccountMeta(accounts.tokenProgram),
186
+ getAccountMeta(accounts.systemProgram),
187
+ ],
188
+ programAddress,
189
+ data: getCloseRentalInstructionDataEncoder().encode({}),
190
+ };
191
+ return instruction;
192
+ }
193
+ export function parseCloseRentalInstruction(instruction) {
194
+ if (instruction.accounts.length < 12) {
195
+ // TODO: Coded error.
196
+ throw new Error('Not enough accounts');
197
+ }
198
+ let accountIndex = 0;
199
+ const getNextAccount = () => {
200
+ const accountMeta = instruction.accounts[accountIndex];
201
+ accountIndex += 1;
202
+ return accountMeta;
203
+ };
204
+ return {
205
+ programAddress: instruction.programAddress,
206
+ accounts: {
207
+ borrower: getNextAccount(),
208
+ ownerTokenAccount: getNextAccount(),
209
+ contract: getNextAccount(),
210
+ rentalState: getNextAccount(),
211
+ rentalTokenAccount: getNextAccount(),
212
+ rentalAuthority: getNextAccount(),
213
+ feeTokenAccount: getNextAccount(),
214
+ rentalThread: getNextAccount(),
215
+ config: 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/instructions/closeRental.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GAYjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,aAAa,EACb,qBAAqB,GAEtB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,0BAA0B,GAAG,IAAI,UAAU,CAAC;IACvD,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE;CACpC,CAAC,CAAC;AAEH,MAAM,UAAU,gCAAgC;IAC9C,OAAO,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChD,0BAA0B,CAC3B,CAAC;AACJ,CAAC;AAuED,MAAM,UAAU,oCAAoC;IAClD,OAAO,gBAAgB,CACrB,gBAAgB,CAAC,CAAC,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3E,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,CAAC,CACrE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC;IAClD,OAAO,gBAAgB,CAAC;QACtB,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;KACxD,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kCAAkC;IAIhD,OAAO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C1B,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,eAAe,EAAE,cAAc,EAAE;YACjC,YAAY,EAAE,cAAc,EAAE;YAC9B,MAAM,EAAE,cAAc,EAAE;YACxB,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,248 @@
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
+ config: { value: input.config ?? null, isWritable: false },
46
+ mint: { value: input.mint ?? null, isWritable: false },
47
+ owner: { value: input.owner ?? null, isWritable: true },
48
+ ownerTokenAccount: {
49
+ value: input.ownerTokenAccount ?? null,
50
+ isWritable: true,
51
+ },
52
+ fleet: { value: input.fleet ?? null, isWritable: true },
53
+ ownerProfile: { value: input.ownerProfile ?? null, isWritable: false },
54
+ gameId: { value: input.gameId ?? null, isWritable: false },
55
+ contract: { value: input.contract ?? null, isWritable: true },
56
+ rentalAuthority: {
57
+ value: input.rentalAuthority ?? null,
58
+ isWritable: false,
59
+ },
60
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
61
+ associatedTokenProgram: {
62
+ value: input.associatedTokenProgram ?? null,
63
+ isWritable: false,
64
+ },
65
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
66
+ sageProgram: { value: input.sageProgram ?? null, isWritable: false },
67
+ };
68
+ const accounts = originalAccounts;
69
+ // Original args.
70
+ const args = { ...input };
71
+ // Resolve default values.
72
+ if (!accounts.config.value) {
73
+ accounts.config.value = await getProgramDerivedAddress({
74
+ programAddress,
75
+ seeds: [
76
+ getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103])),
77
+ ],
78
+ });
79
+ }
80
+ if (!accounts.ownerTokenAccount.value) {
81
+ accounts.ownerTokenAccount.value = await getProgramDerivedAddress({
82
+ programAddress: 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL',
83
+ seeds: [
84
+ getAddressEncoder().encode(expectAddress(accounts.owner.value)),
85
+ getBytesEncoder().encode(new Uint8Array([
86
+ 6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235,
87
+ 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133,
88
+ 126, 255, 0, 169,
89
+ ])),
90
+ getAddressEncoder().encode(expectAddress(accounts.mint.value)),
91
+ ],
92
+ });
93
+ }
94
+ if (!accounts.contract.value) {
95
+ accounts.contract.value = await getProgramDerivedAddress({
96
+ programAddress,
97
+ seeds: [
98
+ getBytesEncoder().encode(new Uint8Array([
99
+ 114, 101, 110, 116, 97, 108, 95, 99, 111, 110, 116, 114, 97, 99,
100
+ 116,
101
+ ])),
102
+ getAddressEncoder().encode(expectAddress(accounts.fleet.value)),
103
+ ],
104
+ });
105
+ }
106
+ if (!accounts.rentalAuthority.value) {
107
+ accounts.rentalAuthority.value = await getProgramDerivedAddress({
108
+ programAddress,
109
+ seeds: [
110
+ getBytesEncoder().encode(new Uint8Array([
111
+ 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
112
+ 116, 121,
113
+ ])),
114
+ ],
115
+ });
116
+ }
117
+ if (!accounts.tokenProgram.value) {
118
+ accounts.tokenProgram.value =
119
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
120
+ }
121
+ if (!accounts.associatedTokenProgram.value) {
122
+ accounts.associatedTokenProgram.value =
123
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
124
+ }
125
+ if (!accounts.systemProgram.value) {
126
+ accounts.systemProgram.value =
127
+ '11111111111111111111111111111111';
128
+ }
129
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
130
+ const instruction = {
131
+ accounts: [
132
+ getAccountMeta(accounts.config),
133
+ getAccountMeta(accounts.mint),
134
+ getAccountMeta(accounts.owner),
135
+ getAccountMeta(accounts.ownerTokenAccount),
136
+ getAccountMeta(accounts.fleet),
137
+ getAccountMeta(accounts.ownerProfile),
138
+ getAccountMeta(accounts.gameId),
139
+ getAccountMeta(accounts.contract),
140
+ getAccountMeta(accounts.rentalAuthority),
141
+ getAccountMeta(accounts.tokenProgram),
142
+ getAccountMeta(accounts.associatedTokenProgram),
143
+ getAccountMeta(accounts.systemProgram),
144
+ getAccountMeta(accounts.sageProgram),
145
+ ],
146
+ programAddress,
147
+ data: getCreateContractInstructionDataEncoder().encode(args),
148
+ };
149
+ return instruction;
150
+ }
151
+ export function getCreateContractInstruction(input, config) {
152
+ // Program address.
153
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
154
+ // Original accounts.
155
+ const originalAccounts = {
156
+ config: { value: input.config ?? null, isWritable: false },
157
+ mint: { value: input.mint ?? null, isWritable: false },
158
+ owner: { value: input.owner ?? null, isWritable: true },
159
+ ownerTokenAccount: {
160
+ value: input.ownerTokenAccount ?? null,
161
+ isWritable: true,
162
+ },
163
+ fleet: { value: input.fleet ?? null, isWritable: true },
164
+ ownerProfile: { value: input.ownerProfile ?? null, isWritable: false },
165
+ gameId: { value: input.gameId ?? null, isWritable: false },
166
+ contract: { value: input.contract ?? null, isWritable: true },
167
+ rentalAuthority: {
168
+ value: input.rentalAuthority ?? null,
169
+ isWritable: false,
170
+ },
171
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
172
+ associatedTokenProgram: {
173
+ value: input.associatedTokenProgram ?? null,
174
+ isWritable: false,
175
+ },
176
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
177
+ sageProgram: { value: input.sageProgram ?? null, isWritable: false },
178
+ };
179
+ const accounts = originalAccounts;
180
+ // Original args.
181
+ const args = { ...input };
182
+ // Resolve default values.
183
+ if (!accounts.tokenProgram.value) {
184
+ accounts.tokenProgram.value =
185
+ 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA';
186
+ }
187
+ if (!accounts.associatedTokenProgram.value) {
188
+ accounts.associatedTokenProgram.value =
189
+ 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL';
190
+ }
191
+ if (!accounts.systemProgram.value) {
192
+ accounts.systemProgram.value =
193
+ '11111111111111111111111111111111';
194
+ }
195
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
196
+ const instruction = {
197
+ accounts: [
198
+ getAccountMeta(accounts.config),
199
+ getAccountMeta(accounts.mint),
200
+ getAccountMeta(accounts.owner),
201
+ getAccountMeta(accounts.ownerTokenAccount),
202
+ getAccountMeta(accounts.fleet),
203
+ getAccountMeta(accounts.ownerProfile),
204
+ getAccountMeta(accounts.gameId),
205
+ getAccountMeta(accounts.contract),
206
+ getAccountMeta(accounts.rentalAuthority),
207
+ getAccountMeta(accounts.tokenProgram),
208
+ getAccountMeta(accounts.associatedTokenProgram),
209
+ getAccountMeta(accounts.systemProgram),
210
+ getAccountMeta(accounts.sageProgram),
211
+ ],
212
+ programAddress,
213
+ data: getCreateContractInstructionDataEncoder().encode(args),
214
+ };
215
+ return instruction;
216
+ }
217
+ export function parseCreateContractInstruction(instruction) {
218
+ if (instruction.accounts.length < 13) {
219
+ // TODO: Coded error.
220
+ throw new Error('Not enough accounts');
221
+ }
222
+ let accountIndex = 0;
223
+ const getNextAccount = () => {
224
+ const accountMeta = instruction.accounts[accountIndex];
225
+ accountIndex += 1;
226
+ return accountMeta;
227
+ };
228
+ return {
229
+ programAddress: instruction.programAddress,
230
+ accounts: {
231
+ config: getNextAccount(),
232
+ mint: getNextAccount(),
233
+ owner: getNextAccount(),
234
+ ownerTokenAccount: getNextAccount(),
235
+ fleet: getNextAccount(),
236
+ ownerProfile: getNextAccount(),
237
+ gameId: getNextAccount(),
238
+ contract: getNextAccount(),
239
+ rentalAuthority: getNextAccount(),
240
+ tokenProgram: getNextAccount(),
241
+ associatedTokenProgram: getNextAccount(),
242
+ systemProgram: getNextAccount(),
243
+ sageProgram: getNextAccount(),
244
+ },
245
+ data: getCreateContractInstructionDataDecoder().decode(instruction.data),
246
+ };
247
+ }
248
+ //# sourceMappingURL=createContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createContract.js","sourceRoot":"","sources":["../../../../src/codama/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,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,aAAa,EACb,qBAAqB,GAEtB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,6BAA6B,GAAG,IAAI,UAAU,CAAC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AAc,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,17 @@
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 './initializeConfig';
14
+ export * from './payRental';
15
+ export * from './resetRental';
16
+ export * from './updateConfig';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codama/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,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,121 @@
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, getAddressDecoder, getAddressEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
+ import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
+ import { getAccountMetaFactory } from '../shared';
11
+ export const INITIALIZE_CONFIG_DISCRIMINATOR = new Uint8Array([
12
+ 208, 127, 21, 1, 194, 190, 196, 70,
13
+ ]);
14
+ export function getInitializeConfigDiscriminatorBytes() {
15
+ return fixEncoderSize(getBytesEncoder(), 8).encode(INITIALIZE_CONFIG_DISCRIMINATOR);
16
+ }
17
+ export function getInitializeConfigInstructionDataEncoder() {
18
+ return transformEncoder(getStructEncoder([
19
+ ['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
20
+ ['feesAccount', getAddressEncoder()],
21
+ ['atlasMint', getAddressEncoder()],
22
+ ]), (value) => ({ ...value, discriminator: INITIALIZE_CONFIG_DISCRIMINATOR }));
23
+ }
24
+ export function getInitializeConfigInstructionDataDecoder() {
25
+ return getStructDecoder([
26
+ ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
27
+ ['feesAccount', getAddressDecoder()],
28
+ ['atlasMint', getAddressDecoder()],
29
+ ]);
30
+ }
31
+ export function getInitializeConfigInstructionDataCodec() {
32
+ return combineCodec(getInitializeConfigInstructionDataEncoder(), getInitializeConfigInstructionDataDecoder());
33
+ }
34
+ export async function getInitializeConfigInstructionAsync(input, config) {
35
+ // Program address.
36
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
37
+ // Original accounts.
38
+ const originalAccounts = {
39
+ config: { value: input.config ?? null, isWritable: true },
40
+ authority: { value: input.authority ?? null, isWritable: true },
41
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
42
+ };
43
+ const accounts = originalAccounts;
44
+ // Original args.
45
+ const args = { ...input };
46
+ // Resolve default values.
47
+ if (!accounts.config.value) {
48
+ accounts.config.value = await getProgramDerivedAddress({
49
+ programAddress,
50
+ seeds: [
51
+ getBytesEncoder().encode(new Uint8Array([99, 111, 110, 102, 105, 103])),
52
+ ],
53
+ });
54
+ }
55
+ if (!accounts.systemProgram.value) {
56
+ accounts.systemProgram.value =
57
+ '11111111111111111111111111111111';
58
+ }
59
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
60
+ const instruction = {
61
+ accounts: [
62
+ getAccountMeta(accounts.config),
63
+ getAccountMeta(accounts.authority),
64
+ getAccountMeta(accounts.systemProgram),
65
+ ],
66
+ programAddress,
67
+ data: getInitializeConfigInstructionDataEncoder().encode(args),
68
+ };
69
+ return instruction;
70
+ }
71
+ export function getInitializeConfigInstruction(input, config) {
72
+ // Program address.
73
+ const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
74
+ // Original accounts.
75
+ const originalAccounts = {
76
+ config: { value: input.config ?? null, isWritable: true },
77
+ authority: { value: input.authority ?? null, isWritable: true },
78
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
79
+ };
80
+ const accounts = originalAccounts;
81
+ // Original args.
82
+ const args = { ...input };
83
+ // Resolve default values.
84
+ if (!accounts.systemProgram.value) {
85
+ accounts.systemProgram.value =
86
+ '11111111111111111111111111111111';
87
+ }
88
+ const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
89
+ const instruction = {
90
+ accounts: [
91
+ getAccountMeta(accounts.config),
92
+ getAccountMeta(accounts.authority),
93
+ getAccountMeta(accounts.systemProgram),
94
+ ],
95
+ programAddress,
96
+ data: getInitializeConfigInstructionDataEncoder().encode(args),
97
+ };
98
+ return instruction;
99
+ }
100
+ export function parseInitializeConfigInstruction(instruction) {
101
+ if (instruction.accounts.length < 3) {
102
+ // TODO: Coded error.
103
+ throw new Error('Not enough accounts');
104
+ }
105
+ let accountIndex = 0;
106
+ const getNextAccount = () => {
107
+ const accountMeta = instruction.accounts[accountIndex];
108
+ accountIndex += 1;
109
+ return accountMeta;
110
+ };
111
+ return {
112
+ programAddress: instruction.programAddress,
113
+ accounts: {
114
+ config: getNextAccount(),
115
+ authority: getNextAccount(),
116
+ systemProgram: getNextAccount(),
117
+ },
118
+ data: getInitializeConfigInstructionDataDecoder().decode(instruction.data),
119
+ };
120
+ }
121
+ //# sourceMappingURL=initializeConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeConfig.js","sourceRoot":"","sources":["../../../../src/codama/instructions/initializeConfig.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GAejB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAwB,MAAM,WAAW,CAAC;AAExE,MAAM,CAAC,MAAM,+BAA+B,GAAG,IAAI,UAAU,CAAC;IAC5D,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,UAAU,qCAAqC;IACnD,OAAO,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChD,+BAA+B,CAChC,CAAC;AACJ,CAAC;AAuCD,MAAM,UAAU,yCAAyC;IACvD,OAAO,gBAAgB,CACrB,gBAAgB,CAAC;QACf,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC,aAAa,EAAE,iBAAiB,EAAE,CAAC;QACpC,CAAC,WAAW,EAAE,iBAAiB,EAAE,CAAC;KACnC,CAAC,EACF,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,+BAA+B,EAAE,CAAC,CAC1E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yCAAyC;IACvD,OAAO,gBAAgB,CAAC;QACtB,CAAC,eAAe,EAAE,cAAc,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;QACvD,CAAC,aAAa,EAAE,iBAAiB,EAAE,CAAC;QACpC,CAAC,WAAW,EAAE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