@gabox-labs/sdk 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/README.md +113 -34
- package/dist/gabox-DGTCh34U.js +2338 -0
- package/dist/gabox-DGTCh34U.js.map +1 -0
- package/dist/generated/index.d.ts +89 -36
- package/dist/generated/index.js +2 -2289
- package/dist/generated/index.js.map +1 -1
- package/dist/{index-BDfGvmgF.d.ts → index-C4at2cZ_.d.ts} +304 -54
- package/dist/index.d.ts +333 -34
- package/dist/index.js +884 -506
- package/dist/index.js.map +1 -1
- package/dist/raydium/index.d.ts +2 -2
- package/dist/raydium/index.js +2 -2
- package/dist/{raydium-B-l9V3O-.js → raydium-CU-tZzIk.js} +869 -191
- package/dist/raydium-CU-tZzIk.js.map +1 -0
- package/llms.txt +4 -2
- package/package.json +1 -1
- package/skills/gabox-sdk/SKILL.md +27 -14
- package/skills/gabox-sdk/references/api.md +78 -26
- package/dist/raydium-B-l9V3O-.js.map +0 -1
|
@@ -0,0 +1,2338 @@
|
|
|
1
|
+
import { SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, SolanaError, assertAccountExists, assertAccountsExist, assertIsInstructionWithAccounts, combineCodec, containsBytes, decodeAccount, extendClient, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder } from "@solana/kit";
|
|
2
|
+
import { addSelfFetchFunctions, addSelfPlanAndSendFunctions, getAccountMetaFactory, getAddressFromResolvedInstructionAccount, getNonNullResolvedInstructionInput } from "@solana/program-client-core";
|
|
3
|
+
//#region src/generated/types/prize.ts
|
|
4
|
+
/**
|
|
5
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
6
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
7
|
+
* to add features, then rerun Codama to update it.
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/codama-idl/codama
|
|
10
|
+
*/
|
|
11
|
+
function getPrizeEncoder() {
|
|
12
|
+
return getStructEncoder([["amount", getU64Encoder()], ["tickets", getU32Encoder()]]);
|
|
13
|
+
}
|
|
14
|
+
function getPrizeDecoder() {
|
|
15
|
+
return getStructDecoder([["amount", getU64Decoder()], ["tickets", getU32Decoder()]]);
|
|
16
|
+
}
|
|
17
|
+
function getPrizeCodec() {
|
|
18
|
+
return combineCodec(getPrizeEncoder(), getPrizeDecoder());
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/generated/types/tier.ts
|
|
22
|
+
/**
|
|
23
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
24
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
25
|
+
* to add features, then rerun Codama to update it.
|
|
26
|
+
*
|
|
27
|
+
* @see https://github.com/codama-idl/codama
|
|
28
|
+
*/
|
|
29
|
+
function getTierEncoder() {
|
|
30
|
+
return getStructEncoder([["multiplierBps", getU32Encoder()], ["tickets", getU32Encoder()]]);
|
|
31
|
+
}
|
|
32
|
+
function getTierDecoder() {
|
|
33
|
+
return getStructDecoder([["multiplierBps", getU32Decoder()], ["tickets", getU32Decoder()]]);
|
|
34
|
+
}
|
|
35
|
+
function getTierCodec() {
|
|
36
|
+
return combineCodec(getTierEncoder(), getTierDecoder());
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/generated/accounts/draw.ts
|
|
40
|
+
/**
|
|
41
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
42
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
43
|
+
* to add features, then rerun Codama to update it.
|
|
44
|
+
*
|
|
45
|
+
* @see https://github.com/codama-idl/codama
|
|
46
|
+
*/
|
|
47
|
+
const DRAW_DISCRIMINATOR = new Uint8Array([
|
|
48
|
+
101,
|
|
49
|
+
31,
|
|
50
|
+
52,
|
|
51
|
+
179,
|
|
52
|
+
121,
|
|
53
|
+
78,
|
|
54
|
+
252,
|
|
55
|
+
89
|
|
56
|
+
]);
|
|
57
|
+
function getDrawDiscriminatorBytes() {
|
|
58
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(DRAW_DISCRIMINATOR);
|
|
59
|
+
}
|
|
60
|
+
/** Gets the encoder for {@link DrawArgs} account data. */
|
|
61
|
+
function getDrawEncoder() {
|
|
62
|
+
return transformEncoder(getStructEncoder([
|
|
63
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
64
|
+
["pool", getAddressEncoder()],
|
|
65
|
+
["purchaser", getAddressEncoder()],
|
|
66
|
+
["seq", getU64Encoder()],
|
|
67
|
+
["bump", getU8Encoder()],
|
|
68
|
+
["requestSlot", getU64Encoder()],
|
|
69
|
+
["lastAttemptSlot", getU64Encoder()],
|
|
70
|
+
["attempts", getU8Encoder()],
|
|
71
|
+
["maximum", getU64Encoder()],
|
|
72
|
+
["minimum", getU64Encoder()],
|
|
73
|
+
["prizes", getArrayEncoder(getPrizeEncoder(), { size: 8 })]
|
|
74
|
+
]), (value) => ({
|
|
75
|
+
...value,
|
|
76
|
+
discriminator: DRAW_DISCRIMINATOR
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
/** Gets the decoder for {@link Draw} account data. */
|
|
80
|
+
function getDrawDecoder() {
|
|
81
|
+
return getStructDecoder([
|
|
82
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
83
|
+
["pool", getAddressDecoder()],
|
|
84
|
+
["purchaser", getAddressDecoder()],
|
|
85
|
+
["seq", getU64Decoder()],
|
|
86
|
+
["bump", getU8Decoder()],
|
|
87
|
+
["requestSlot", getU64Decoder()],
|
|
88
|
+
["lastAttemptSlot", getU64Decoder()],
|
|
89
|
+
["attempts", getU8Decoder()],
|
|
90
|
+
["maximum", getU64Decoder()],
|
|
91
|
+
["minimum", getU64Decoder()],
|
|
92
|
+
["prizes", getArrayDecoder(getPrizeDecoder(), { size: 8 })]
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
/** Gets the codec for {@link Draw} account data. */
|
|
96
|
+
function getDrawCodec() {
|
|
97
|
+
return combineCodec(getDrawEncoder(), getDrawDecoder());
|
|
98
|
+
}
|
|
99
|
+
function decodeDraw(encodedAccount) {
|
|
100
|
+
return decodeAccount(encodedAccount, getDrawDecoder());
|
|
101
|
+
}
|
|
102
|
+
async function fetchDraw(rpc, address, config) {
|
|
103
|
+
const maybeAccount = await fetchMaybeDraw(rpc, address, config);
|
|
104
|
+
assertAccountExists(maybeAccount);
|
|
105
|
+
return maybeAccount;
|
|
106
|
+
}
|
|
107
|
+
async function fetchMaybeDraw(rpc, address, config) {
|
|
108
|
+
return decodeDraw(await fetchEncodedAccount(rpc, address, config));
|
|
109
|
+
}
|
|
110
|
+
async function fetchAllDraw(rpc, addresses, config) {
|
|
111
|
+
const maybeAccounts = await fetchAllMaybeDraw(rpc, addresses, config);
|
|
112
|
+
assertAccountsExist(maybeAccounts);
|
|
113
|
+
return maybeAccounts;
|
|
114
|
+
}
|
|
115
|
+
async function fetchAllMaybeDraw(rpc, addresses, config) {
|
|
116
|
+
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeDraw(maybeAccount));
|
|
117
|
+
}
|
|
118
|
+
function getDrawSize() {
|
|
119
|
+
return 210;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/generated/accounts/pool.ts
|
|
123
|
+
/**
|
|
124
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
125
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
126
|
+
* to add features, then rerun Codama to update it.
|
|
127
|
+
*
|
|
128
|
+
* @see https://github.com/codama-idl/codama
|
|
129
|
+
*/
|
|
130
|
+
const POOL_DISCRIMINATOR = new Uint8Array([
|
|
131
|
+
153,
|
|
132
|
+
115,
|
|
133
|
+
78,
|
|
134
|
+
55,
|
|
135
|
+
156,
|
|
136
|
+
26,
|
|
137
|
+
133,
|
|
138
|
+
45
|
|
139
|
+
]);
|
|
140
|
+
function getPoolDiscriminatorBytes() {
|
|
141
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_DISCRIMINATOR);
|
|
142
|
+
}
|
|
143
|
+
/** Gets the encoder for {@link PoolArgs} account data. */
|
|
144
|
+
function getPoolEncoder() {
|
|
145
|
+
return transformEncoder(getStructEncoder([
|
|
146
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
147
|
+
["creator", getAddressEncoder()],
|
|
148
|
+
["mint", getAddressEncoder()],
|
|
149
|
+
["vault", getAddressEncoder()],
|
|
150
|
+
["quoteMint", getAddressEncoder()],
|
|
151
|
+
["bump", getU8Encoder()],
|
|
152
|
+
["packTokens", getU64Encoder()],
|
|
153
|
+
["seedQuoteAmount", getU64Encoder()],
|
|
154
|
+
["tiers", getArrayEncoder(getTierEncoder(), { size: 8 })],
|
|
155
|
+
["nextSeq", getU64Encoder()],
|
|
156
|
+
["reserved", getU64Encoder()],
|
|
157
|
+
["quoteConfig", getAddressEncoder()],
|
|
158
|
+
["quoteTokenProgram", getAddressEncoder()]
|
|
159
|
+
]), (value) => ({
|
|
160
|
+
...value,
|
|
161
|
+
discriminator: POOL_DISCRIMINATOR
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
/** Gets the decoder for {@link Pool} account data. */
|
|
165
|
+
function getPoolDecoder() {
|
|
166
|
+
return getStructDecoder([
|
|
167
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
168
|
+
["creator", getAddressDecoder()],
|
|
169
|
+
["mint", getAddressDecoder()],
|
|
170
|
+
["vault", getAddressDecoder()],
|
|
171
|
+
["quoteMint", getAddressDecoder()],
|
|
172
|
+
["bump", getU8Decoder()],
|
|
173
|
+
["packTokens", getU64Decoder()],
|
|
174
|
+
["seedQuoteAmount", getU64Decoder()],
|
|
175
|
+
["tiers", getArrayDecoder(getTierDecoder(), { size: 8 })],
|
|
176
|
+
["nextSeq", getU64Decoder()],
|
|
177
|
+
["reserved", getU64Decoder()],
|
|
178
|
+
["quoteConfig", getAddressDecoder()],
|
|
179
|
+
["quoteTokenProgram", getAddressDecoder()]
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
/** Gets the codec for {@link Pool} account data. */
|
|
183
|
+
function getPoolCodec() {
|
|
184
|
+
return combineCodec(getPoolEncoder(), getPoolDecoder());
|
|
185
|
+
}
|
|
186
|
+
function decodePool(encodedAccount) {
|
|
187
|
+
return decodeAccount(encodedAccount, getPoolDecoder());
|
|
188
|
+
}
|
|
189
|
+
async function fetchPool(rpc, address, config) {
|
|
190
|
+
const maybeAccount = await fetchMaybePool(rpc, address, config);
|
|
191
|
+
assertAccountExists(maybeAccount);
|
|
192
|
+
return maybeAccount;
|
|
193
|
+
}
|
|
194
|
+
async function fetchMaybePool(rpc, address, config) {
|
|
195
|
+
return decodePool(await fetchEncodedAccount(rpc, address, config));
|
|
196
|
+
}
|
|
197
|
+
async function fetchAllPool(rpc, addresses, config) {
|
|
198
|
+
const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
|
|
199
|
+
assertAccountsExist(maybeAccounts);
|
|
200
|
+
return maybeAccounts;
|
|
201
|
+
}
|
|
202
|
+
async function fetchAllMaybePool(rpc, addresses, config) {
|
|
203
|
+
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodePool(maybeAccount));
|
|
204
|
+
}
|
|
205
|
+
function getPoolSize() {
|
|
206
|
+
return 297;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/generated/accounts/walletActivity.ts
|
|
210
|
+
/**
|
|
211
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
212
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
213
|
+
* to add features, then rerun Codama to update it.
|
|
214
|
+
*
|
|
215
|
+
* @see https://github.com/codama-idl/codama
|
|
216
|
+
*/
|
|
217
|
+
const WALLET_ACTIVITY_DISCRIMINATOR = new Uint8Array([
|
|
218
|
+
212,
|
|
219
|
+
80,
|
|
220
|
+
180,
|
|
221
|
+
131,
|
|
222
|
+
173,
|
|
223
|
+
1,
|
|
224
|
+
252,
|
|
225
|
+
141
|
|
226
|
+
]);
|
|
227
|
+
function getWalletActivityDiscriminatorBytes() {
|
|
228
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(WALLET_ACTIVITY_DISCRIMINATOR);
|
|
229
|
+
}
|
|
230
|
+
/** Gets the encoder for {@link WalletActivityArgs} account data. */
|
|
231
|
+
function getWalletActivityEncoder() {
|
|
232
|
+
return transformEncoder(getStructEncoder([
|
|
233
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
234
|
+
["wallet", getAddressEncoder()],
|
|
235
|
+
["bump", getU8Encoder()],
|
|
236
|
+
["packsBought", getU64Encoder()],
|
|
237
|
+
["nativeSpent", getU64Encoder()],
|
|
238
|
+
["reserved", fixEncoderSize(getBytesEncoder(), 64)]
|
|
239
|
+
]), (value) => ({
|
|
240
|
+
...value,
|
|
241
|
+
discriminator: WALLET_ACTIVITY_DISCRIMINATOR
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
/** Gets the decoder for {@link WalletActivity} account data. */
|
|
245
|
+
function getWalletActivityDecoder() {
|
|
246
|
+
return getStructDecoder([
|
|
247
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
248
|
+
["wallet", getAddressDecoder()],
|
|
249
|
+
["bump", getU8Decoder()],
|
|
250
|
+
["packsBought", getU64Decoder()],
|
|
251
|
+
["nativeSpent", getU64Decoder()],
|
|
252
|
+
["reserved", fixDecoderSize(getBytesDecoder(), 64)]
|
|
253
|
+
]);
|
|
254
|
+
}
|
|
255
|
+
/** Gets the codec for {@link WalletActivity} account data. */
|
|
256
|
+
function getWalletActivityCodec() {
|
|
257
|
+
return combineCodec(getWalletActivityEncoder(), getWalletActivityDecoder());
|
|
258
|
+
}
|
|
259
|
+
function decodeWalletActivity(encodedAccount) {
|
|
260
|
+
return decodeAccount(encodedAccount, getWalletActivityDecoder());
|
|
261
|
+
}
|
|
262
|
+
async function fetchWalletActivity(rpc, address, config) {
|
|
263
|
+
const maybeAccount = await fetchMaybeWalletActivity(rpc, address, config);
|
|
264
|
+
assertAccountExists(maybeAccount);
|
|
265
|
+
return maybeAccount;
|
|
266
|
+
}
|
|
267
|
+
async function fetchMaybeWalletActivity(rpc, address, config) {
|
|
268
|
+
return decodeWalletActivity(await fetchEncodedAccount(rpc, address, config));
|
|
269
|
+
}
|
|
270
|
+
async function fetchAllWalletActivity(rpc, addresses, config) {
|
|
271
|
+
const maybeAccounts = await fetchAllMaybeWalletActivity(rpc, addresses, config);
|
|
272
|
+
assertAccountsExist(maybeAccounts);
|
|
273
|
+
return maybeAccounts;
|
|
274
|
+
}
|
|
275
|
+
async function fetchAllMaybeWalletActivity(rpc, addresses, config) {
|
|
276
|
+
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeWalletActivity(maybeAccount));
|
|
277
|
+
}
|
|
278
|
+
function getWalletActivitySize() {
|
|
279
|
+
return 121;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/generated/pdas/activity.ts
|
|
283
|
+
/**
|
|
284
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
285
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
286
|
+
* to add features, then rerun Codama to update it.
|
|
287
|
+
*
|
|
288
|
+
* @see https://github.com/codama-idl/codama
|
|
289
|
+
*/
|
|
290
|
+
async function findActivityPda(seeds, config = {}) {
|
|
291
|
+
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
292
|
+
return await getProgramDerivedAddress({
|
|
293
|
+
programAddress,
|
|
294
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
295
|
+
97,
|
|
296
|
+
99,
|
|
297
|
+
116,
|
|
298
|
+
105,
|
|
299
|
+
118,
|
|
300
|
+
105,
|
|
301
|
+
116,
|
|
302
|
+
121
|
|
303
|
+
])), getAddressEncoder().encode(seeds.purchaser)]
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/generated/pdas/draw.ts
|
|
308
|
+
/**
|
|
309
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
310
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
311
|
+
* to add features, then rerun Codama to update it.
|
|
312
|
+
*
|
|
313
|
+
* @see https://github.com/codama-idl/codama
|
|
314
|
+
*/
|
|
315
|
+
async function findDrawPda(seeds, config = {}) {
|
|
316
|
+
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
317
|
+
return await getProgramDerivedAddress({
|
|
318
|
+
programAddress,
|
|
319
|
+
seeds: [
|
|
320
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
321
|
+
100,
|
|
322
|
+
114,
|
|
323
|
+
97,
|
|
324
|
+
119
|
|
325
|
+
])),
|
|
326
|
+
getAddressEncoder().encode(seeds.pool),
|
|
327
|
+
getU64Encoder().encode(seeds.seq)
|
|
328
|
+
]
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/generated/pdas/identity.ts
|
|
333
|
+
/**
|
|
334
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
335
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
336
|
+
* to add features, then rerun Codama to update it.
|
|
337
|
+
*
|
|
338
|
+
* @see https://github.com/codama-idl/codama
|
|
339
|
+
*/
|
|
340
|
+
async function findIdentityPda(config = {}) {
|
|
341
|
+
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
342
|
+
return await getProgramDerivedAddress({
|
|
343
|
+
programAddress,
|
|
344
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
345
|
+
105,
|
|
346
|
+
100,
|
|
347
|
+
101,
|
|
348
|
+
110,
|
|
349
|
+
116,
|
|
350
|
+
105,
|
|
351
|
+
116,
|
|
352
|
+
121
|
|
353
|
+
]))]
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/generated/pdas/pool.ts
|
|
358
|
+
/**
|
|
359
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
360
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
361
|
+
* to add features, then rerun Codama to update it.
|
|
362
|
+
*
|
|
363
|
+
* @see https://github.com/codama-idl/codama
|
|
364
|
+
*/
|
|
365
|
+
async function findPoolPda(seeds, config = {}) {
|
|
366
|
+
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
367
|
+
return await getProgramDerivedAddress({
|
|
368
|
+
programAddress,
|
|
369
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
370
|
+
112,
|
|
371
|
+
111,
|
|
372
|
+
111,
|
|
373
|
+
108
|
|
374
|
+
])), getAddressEncoder().encode(seeds.mint)]
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/generated/instructions/buyPack.ts
|
|
379
|
+
/**
|
|
380
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
381
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
382
|
+
* to add features, then rerun Codama to update it.
|
|
383
|
+
*
|
|
384
|
+
* @see https://github.com/codama-idl/codama
|
|
385
|
+
*/
|
|
386
|
+
const BUY_PACK_DISCRIMINATOR = new Uint8Array([
|
|
387
|
+
151,
|
|
388
|
+
46,
|
|
389
|
+
141,
|
|
390
|
+
93,
|
|
391
|
+
174,
|
|
392
|
+
5,
|
|
393
|
+
49,
|
|
394
|
+
173
|
|
395
|
+
]);
|
|
396
|
+
function getBuyPackDiscriminatorBytes() {
|
|
397
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(BUY_PACK_DISCRIMINATOR);
|
|
398
|
+
}
|
|
399
|
+
function getBuyPackInstructionDataEncoder() {
|
|
400
|
+
return transformEncoder(getStructEncoder([
|
|
401
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
402
|
+
["maxQuoteIn", getU64Encoder()],
|
|
403
|
+
["minMaximum", getU64Encoder()],
|
|
404
|
+
["maxNativeDebit", getU64Encoder()]
|
|
405
|
+
]), (value) => ({
|
|
406
|
+
...value,
|
|
407
|
+
discriminator: BUY_PACK_DISCRIMINATOR
|
|
408
|
+
}));
|
|
409
|
+
}
|
|
410
|
+
function getBuyPackInstructionDataDecoder() {
|
|
411
|
+
return getStructDecoder([
|
|
412
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
413
|
+
["maxQuoteIn", getU64Decoder()],
|
|
414
|
+
["minMaximum", getU64Decoder()],
|
|
415
|
+
["maxNativeDebit", getU64Decoder()]
|
|
416
|
+
]);
|
|
417
|
+
}
|
|
418
|
+
function getBuyPackInstructionDataCodec() {
|
|
419
|
+
return combineCodec(getBuyPackInstructionDataEncoder(), getBuyPackInstructionDataDecoder());
|
|
420
|
+
}
|
|
421
|
+
async function getBuyPackInstructionAsync(input, config) {
|
|
422
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
423
|
+
const accounts = {
|
|
424
|
+
purchaser: {
|
|
425
|
+
value: input.purchaser ?? null,
|
|
426
|
+
isWritable: true
|
|
427
|
+
},
|
|
428
|
+
pool: {
|
|
429
|
+
value: input.pool ?? null,
|
|
430
|
+
isWritable: true
|
|
431
|
+
},
|
|
432
|
+
draw: {
|
|
433
|
+
value: input.draw ?? null,
|
|
434
|
+
isWritable: true
|
|
435
|
+
},
|
|
436
|
+
activity: {
|
|
437
|
+
value: input.activity ?? null,
|
|
438
|
+
isWritable: true
|
|
439
|
+
},
|
|
440
|
+
mint: {
|
|
441
|
+
value: input.mint ?? null,
|
|
442
|
+
isWritable: false
|
|
443
|
+
},
|
|
444
|
+
quoteMint: {
|
|
445
|
+
value: input.quoteMint ?? null,
|
|
446
|
+
isWritable: false
|
|
447
|
+
},
|
|
448
|
+
vault: {
|
|
449
|
+
value: input.vault ?? null,
|
|
450
|
+
isWritable: true
|
|
451
|
+
},
|
|
452
|
+
userTokens: {
|
|
453
|
+
value: input.userTokens ?? null,
|
|
454
|
+
isWritable: true
|
|
455
|
+
},
|
|
456
|
+
venue: {
|
|
457
|
+
value: input.venue ?? null,
|
|
458
|
+
isWritable: false
|
|
459
|
+
},
|
|
460
|
+
identity: {
|
|
461
|
+
value: input.identity ?? null,
|
|
462
|
+
isWritable: false
|
|
463
|
+
},
|
|
464
|
+
queue: {
|
|
465
|
+
value: input.queue ?? null,
|
|
466
|
+
isWritable: true
|
|
467
|
+
},
|
|
468
|
+
program: {
|
|
469
|
+
value: input.program ?? null,
|
|
470
|
+
isWritable: false
|
|
471
|
+
},
|
|
472
|
+
slotHashes: {
|
|
473
|
+
value: input.slotHashes ?? null,
|
|
474
|
+
isWritable: false
|
|
475
|
+
},
|
|
476
|
+
tokenProgram: {
|
|
477
|
+
value: input.tokenProgram ?? null,
|
|
478
|
+
isWritable: false
|
|
479
|
+
},
|
|
480
|
+
quoteTokenProgram: {
|
|
481
|
+
value: input.quoteTokenProgram ?? null,
|
|
482
|
+
isWritable: false
|
|
483
|
+
},
|
|
484
|
+
associatedTokenProgram: {
|
|
485
|
+
value: input.associatedTokenProgram ?? null,
|
|
486
|
+
isWritable: false
|
|
487
|
+
},
|
|
488
|
+
systemProgram: {
|
|
489
|
+
value: input.systemProgram ?? null,
|
|
490
|
+
isWritable: false
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
const args = { ...input };
|
|
494
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
495
|
+
if (!accounts.activity.value) accounts.activity.value = await findActivityPda({ purchaser: getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value) }, { programAddress });
|
|
496
|
+
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
497
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
498
|
+
seeds: [
|
|
499
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
500
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
501
|
+
6,
|
|
502
|
+
221,
|
|
503
|
+
246,
|
|
504
|
+
225,
|
|
505
|
+
215,
|
|
506
|
+
101,
|
|
507
|
+
161,
|
|
508
|
+
147,
|
|
509
|
+
217,
|
|
510
|
+
203,
|
|
511
|
+
225,
|
|
512
|
+
70,
|
|
513
|
+
206,
|
|
514
|
+
235,
|
|
515
|
+
121,
|
|
516
|
+
172,
|
|
517
|
+
28,
|
|
518
|
+
180,
|
|
519
|
+
133,
|
|
520
|
+
237,
|
|
521
|
+
95,
|
|
522
|
+
91,
|
|
523
|
+
55,
|
|
524
|
+
145,
|
|
525
|
+
58,
|
|
526
|
+
140,
|
|
527
|
+
245,
|
|
528
|
+
133,
|
|
529
|
+
126,
|
|
530
|
+
255,
|
|
531
|
+
0,
|
|
532
|
+
169
|
|
533
|
+
])),
|
|
534
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
535
|
+
]
|
|
536
|
+
});
|
|
537
|
+
if (!accounts.identity.value) accounts.identity.value = await findIdentityPda({ programAddress });
|
|
538
|
+
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
539
|
+
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
540
|
+
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
541
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
542
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
543
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
544
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
545
|
+
return Object.freeze({
|
|
546
|
+
accounts: [
|
|
547
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
548
|
+
getAccountMeta("pool", accounts.pool),
|
|
549
|
+
getAccountMeta("draw", accounts.draw),
|
|
550
|
+
getAccountMeta("activity", accounts.activity),
|
|
551
|
+
getAccountMeta("mint", accounts.mint),
|
|
552
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
553
|
+
getAccountMeta("vault", accounts.vault),
|
|
554
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
555
|
+
getAccountMeta("venue", accounts.venue),
|
|
556
|
+
getAccountMeta("identity", accounts.identity),
|
|
557
|
+
getAccountMeta("queue", accounts.queue),
|
|
558
|
+
getAccountMeta("program", accounts.program),
|
|
559
|
+
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
560
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
561
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
562
|
+
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
563
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
564
|
+
],
|
|
565
|
+
data: getBuyPackInstructionDataEncoder().encode(args),
|
|
566
|
+
programAddress
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
function getBuyPackInstruction(input, config) {
|
|
570
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
571
|
+
const accounts = {
|
|
572
|
+
purchaser: {
|
|
573
|
+
value: input.purchaser ?? null,
|
|
574
|
+
isWritable: true
|
|
575
|
+
},
|
|
576
|
+
pool: {
|
|
577
|
+
value: input.pool ?? null,
|
|
578
|
+
isWritable: true
|
|
579
|
+
},
|
|
580
|
+
draw: {
|
|
581
|
+
value: input.draw ?? null,
|
|
582
|
+
isWritable: true
|
|
583
|
+
},
|
|
584
|
+
activity: {
|
|
585
|
+
value: input.activity ?? null,
|
|
586
|
+
isWritable: true
|
|
587
|
+
},
|
|
588
|
+
mint: {
|
|
589
|
+
value: input.mint ?? null,
|
|
590
|
+
isWritable: false
|
|
591
|
+
},
|
|
592
|
+
quoteMint: {
|
|
593
|
+
value: input.quoteMint ?? null,
|
|
594
|
+
isWritable: false
|
|
595
|
+
},
|
|
596
|
+
vault: {
|
|
597
|
+
value: input.vault ?? null,
|
|
598
|
+
isWritable: true
|
|
599
|
+
},
|
|
600
|
+
userTokens: {
|
|
601
|
+
value: input.userTokens ?? null,
|
|
602
|
+
isWritable: true
|
|
603
|
+
},
|
|
604
|
+
venue: {
|
|
605
|
+
value: input.venue ?? null,
|
|
606
|
+
isWritable: false
|
|
607
|
+
},
|
|
608
|
+
identity: {
|
|
609
|
+
value: input.identity ?? null,
|
|
610
|
+
isWritable: false
|
|
611
|
+
},
|
|
612
|
+
queue: {
|
|
613
|
+
value: input.queue ?? null,
|
|
614
|
+
isWritable: true
|
|
615
|
+
},
|
|
616
|
+
program: {
|
|
617
|
+
value: input.program ?? null,
|
|
618
|
+
isWritable: false
|
|
619
|
+
},
|
|
620
|
+
slotHashes: {
|
|
621
|
+
value: input.slotHashes ?? null,
|
|
622
|
+
isWritable: false
|
|
623
|
+
},
|
|
624
|
+
tokenProgram: {
|
|
625
|
+
value: input.tokenProgram ?? null,
|
|
626
|
+
isWritable: false
|
|
627
|
+
},
|
|
628
|
+
quoteTokenProgram: {
|
|
629
|
+
value: input.quoteTokenProgram ?? null,
|
|
630
|
+
isWritable: false
|
|
631
|
+
},
|
|
632
|
+
associatedTokenProgram: {
|
|
633
|
+
value: input.associatedTokenProgram ?? null,
|
|
634
|
+
isWritable: false
|
|
635
|
+
},
|
|
636
|
+
systemProgram: {
|
|
637
|
+
value: input.systemProgram ?? null,
|
|
638
|
+
isWritable: false
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
const args = { ...input };
|
|
642
|
+
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
643
|
+
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
644
|
+
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
645
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
646
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
647
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
648
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
649
|
+
return Object.freeze({
|
|
650
|
+
accounts: [
|
|
651
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
652
|
+
getAccountMeta("pool", accounts.pool),
|
|
653
|
+
getAccountMeta("draw", accounts.draw),
|
|
654
|
+
getAccountMeta("activity", accounts.activity),
|
|
655
|
+
getAccountMeta("mint", accounts.mint),
|
|
656
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
657
|
+
getAccountMeta("vault", accounts.vault),
|
|
658
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
659
|
+
getAccountMeta("venue", accounts.venue),
|
|
660
|
+
getAccountMeta("identity", accounts.identity),
|
|
661
|
+
getAccountMeta("queue", accounts.queue),
|
|
662
|
+
getAccountMeta("program", accounts.program),
|
|
663
|
+
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
664
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
665
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
666
|
+
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
667
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
668
|
+
],
|
|
669
|
+
data: getBuyPackInstructionDataEncoder().encode(args),
|
|
670
|
+
programAddress
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
function parseBuyPackInstruction(instruction) {
|
|
674
|
+
if (instruction.accounts.length < 17) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
675
|
+
actualAccountMetas: instruction.accounts.length,
|
|
676
|
+
expectedAccountMetas: 17
|
|
677
|
+
});
|
|
678
|
+
let accountIndex = 0;
|
|
679
|
+
const getNextAccount = () => {
|
|
680
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
681
|
+
accountIndex += 1;
|
|
682
|
+
return accountMeta;
|
|
683
|
+
};
|
|
684
|
+
return {
|
|
685
|
+
programAddress: instruction.programAddress,
|
|
686
|
+
accounts: {
|
|
687
|
+
purchaser: getNextAccount(),
|
|
688
|
+
pool: getNextAccount(),
|
|
689
|
+
draw: getNextAccount(),
|
|
690
|
+
activity: getNextAccount(),
|
|
691
|
+
mint: getNextAccount(),
|
|
692
|
+
quoteMint: getNextAccount(),
|
|
693
|
+
vault: getNextAccount(),
|
|
694
|
+
userTokens: getNextAccount(),
|
|
695
|
+
venue: getNextAccount(),
|
|
696
|
+
identity: getNextAccount(),
|
|
697
|
+
queue: getNextAccount(),
|
|
698
|
+
program: getNextAccount(),
|
|
699
|
+
slotHashes: getNextAccount(),
|
|
700
|
+
tokenProgram: getNextAccount(),
|
|
701
|
+
quoteTokenProgram: getNextAccount(),
|
|
702
|
+
associatedTokenProgram: getNextAccount(),
|
|
703
|
+
systemProgram: getNextAccount()
|
|
704
|
+
},
|
|
705
|
+
data: getBuyPackInstructionDataDecoder().decode(instruction.data)
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/generated/instructions/deliverDraw.ts
|
|
710
|
+
/**
|
|
711
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
712
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
713
|
+
* to add features, then rerun Codama to update it.
|
|
714
|
+
*
|
|
715
|
+
* @see https://github.com/codama-idl/codama
|
|
716
|
+
*/
|
|
717
|
+
const DELIVER_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
718
|
+
113,
|
|
719
|
+
181,
|
|
720
|
+
226,
|
|
721
|
+
173,
|
|
722
|
+
237,
|
|
723
|
+
138,
|
|
724
|
+
199,
|
|
725
|
+
51
|
|
726
|
+
]);
|
|
727
|
+
function getDeliverDrawDiscriminatorBytes() {
|
|
728
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(DELIVER_DRAW_DISCRIMINATOR);
|
|
729
|
+
}
|
|
730
|
+
function getDeliverDrawInstructionDataEncoder() {
|
|
731
|
+
return transformEncoder(getStructEncoder([
|
|
732
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
733
|
+
["randomness", fixEncoderSize(getBytesEncoder(), 32)],
|
|
734
|
+
["seq", getU64Encoder()]
|
|
735
|
+
]), (value) => ({
|
|
736
|
+
...value,
|
|
737
|
+
discriminator: DELIVER_DRAW_DISCRIMINATOR
|
|
738
|
+
}));
|
|
739
|
+
}
|
|
740
|
+
function getDeliverDrawInstructionDataDecoder() {
|
|
741
|
+
return getStructDecoder([
|
|
742
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
743
|
+
["randomness", fixDecoderSize(getBytesDecoder(), 32)],
|
|
744
|
+
["seq", getU64Decoder()]
|
|
745
|
+
]);
|
|
746
|
+
}
|
|
747
|
+
function getDeliverDrawInstructionDataCodec() {
|
|
748
|
+
return combineCodec(getDeliverDrawInstructionDataEncoder(), getDeliverDrawInstructionDataDecoder());
|
|
749
|
+
}
|
|
750
|
+
async function getDeliverDrawInstructionAsync(input, config) {
|
|
751
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
752
|
+
const accounts = {
|
|
753
|
+
oracleIdentity: {
|
|
754
|
+
value: input.oracleIdentity ?? null,
|
|
755
|
+
isWritable: false
|
|
756
|
+
},
|
|
757
|
+
pool: {
|
|
758
|
+
value: input.pool ?? null,
|
|
759
|
+
isWritable: true
|
|
760
|
+
},
|
|
761
|
+
draw: {
|
|
762
|
+
value: input.draw ?? null,
|
|
763
|
+
isWritable: true
|
|
764
|
+
},
|
|
765
|
+
purchaser: {
|
|
766
|
+
value: input.purchaser ?? null,
|
|
767
|
+
isWritable: true
|
|
768
|
+
},
|
|
769
|
+
mint: {
|
|
770
|
+
value: input.mint ?? null,
|
|
771
|
+
isWritable: false
|
|
772
|
+
},
|
|
773
|
+
vault: {
|
|
774
|
+
value: input.vault ?? null,
|
|
775
|
+
isWritable: true
|
|
776
|
+
},
|
|
777
|
+
userTokens: {
|
|
778
|
+
value: input.userTokens ?? null,
|
|
779
|
+
isWritable: true
|
|
780
|
+
},
|
|
781
|
+
tokenProgram: {
|
|
782
|
+
value: input.tokenProgram ?? null,
|
|
783
|
+
isWritable: false
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
const args = { ...input };
|
|
787
|
+
if (!accounts.oracleIdentity.value) accounts.oracleIdentity.value = await getProgramDerivedAddress({
|
|
788
|
+
programAddress: "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz",
|
|
789
|
+
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
790
|
+
105,
|
|
791
|
+
100,
|
|
792
|
+
101,
|
|
793
|
+
110,
|
|
794
|
+
116,
|
|
795
|
+
105,
|
|
796
|
+
116,
|
|
797
|
+
121
|
|
798
|
+
])), getBytesEncoder().encode(new Uint8Array([
|
|
799
|
+
231,
|
|
800
|
+
95,
|
|
801
|
+
177,
|
|
802
|
+
105,
|
|
803
|
+
231,
|
|
804
|
+
174,
|
|
805
|
+
80,
|
|
806
|
+
36,
|
|
807
|
+
228,
|
|
808
|
+
6,
|
|
809
|
+
241,
|
|
810
|
+
195,
|
|
811
|
+
89,
|
|
812
|
+
243,
|
|
813
|
+
52,
|
|
814
|
+
57,
|
|
815
|
+
128,
|
|
816
|
+
219,
|
|
817
|
+
206,
|
|
818
|
+
84,
|
|
819
|
+
115,
|
|
820
|
+
45,
|
|
821
|
+
3,
|
|
822
|
+
217,
|
|
823
|
+
77,
|
|
824
|
+
35,
|
|
825
|
+
38,
|
|
826
|
+
40,
|
|
827
|
+
214,
|
|
828
|
+
248,
|
|
829
|
+
69,
|
|
830
|
+
83
|
|
831
|
+
]))]
|
|
832
|
+
});
|
|
833
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
834
|
+
if (!accounts.draw.value) accounts.draw.value = await findDrawPda({
|
|
835
|
+
pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
|
|
836
|
+
seq: getNonNullResolvedInstructionInput("seq", args.seq)
|
|
837
|
+
}, { programAddress });
|
|
838
|
+
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
839
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
840
|
+
seeds: [
|
|
841
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
842
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
843
|
+
6,
|
|
844
|
+
221,
|
|
845
|
+
246,
|
|
846
|
+
225,
|
|
847
|
+
215,
|
|
848
|
+
101,
|
|
849
|
+
161,
|
|
850
|
+
147,
|
|
851
|
+
217,
|
|
852
|
+
203,
|
|
853
|
+
225,
|
|
854
|
+
70,
|
|
855
|
+
206,
|
|
856
|
+
235,
|
|
857
|
+
121,
|
|
858
|
+
172,
|
|
859
|
+
28,
|
|
860
|
+
180,
|
|
861
|
+
133,
|
|
862
|
+
237,
|
|
863
|
+
95,
|
|
864
|
+
91,
|
|
865
|
+
55,
|
|
866
|
+
145,
|
|
867
|
+
58,
|
|
868
|
+
140,
|
|
869
|
+
245,
|
|
870
|
+
133,
|
|
871
|
+
126,
|
|
872
|
+
255,
|
|
873
|
+
0,
|
|
874
|
+
169
|
|
875
|
+
])),
|
|
876
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
877
|
+
]
|
|
878
|
+
});
|
|
879
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
880
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
881
|
+
return Object.freeze({
|
|
882
|
+
accounts: [
|
|
883
|
+
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
884
|
+
getAccountMeta("pool", accounts.pool),
|
|
885
|
+
getAccountMeta("draw", accounts.draw),
|
|
886
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
887
|
+
getAccountMeta("mint", accounts.mint),
|
|
888
|
+
getAccountMeta("vault", accounts.vault),
|
|
889
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
890
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
891
|
+
],
|
|
892
|
+
data: getDeliverDrawInstructionDataEncoder().encode(args),
|
|
893
|
+
programAddress
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
function getDeliverDrawInstruction(input, config) {
|
|
897
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
898
|
+
const accounts = {
|
|
899
|
+
oracleIdentity: {
|
|
900
|
+
value: input.oracleIdentity ?? null,
|
|
901
|
+
isWritable: false
|
|
902
|
+
},
|
|
903
|
+
pool: {
|
|
904
|
+
value: input.pool ?? null,
|
|
905
|
+
isWritable: true
|
|
906
|
+
},
|
|
907
|
+
draw: {
|
|
908
|
+
value: input.draw ?? null,
|
|
909
|
+
isWritable: true
|
|
910
|
+
},
|
|
911
|
+
purchaser: {
|
|
912
|
+
value: input.purchaser ?? null,
|
|
913
|
+
isWritable: true
|
|
914
|
+
},
|
|
915
|
+
mint: {
|
|
916
|
+
value: input.mint ?? null,
|
|
917
|
+
isWritable: false
|
|
918
|
+
},
|
|
919
|
+
vault: {
|
|
920
|
+
value: input.vault ?? null,
|
|
921
|
+
isWritable: true
|
|
922
|
+
},
|
|
923
|
+
userTokens: {
|
|
924
|
+
value: input.userTokens ?? null,
|
|
925
|
+
isWritable: true
|
|
926
|
+
},
|
|
927
|
+
tokenProgram: {
|
|
928
|
+
value: input.tokenProgram ?? null,
|
|
929
|
+
isWritable: false
|
|
930
|
+
}
|
|
931
|
+
};
|
|
932
|
+
const args = { ...input };
|
|
933
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
934
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
935
|
+
return Object.freeze({
|
|
936
|
+
accounts: [
|
|
937
|
+
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
938
|
+
getAccountMeta("pool", accounts.pool),
|
|
939
|
+
getAccountMeta("draw", accounts.draw),
|
|
940
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
941
|
+
getAccountMeta("mint", accounts.mint),
|
|
942
|
+
getAccountMeta("vault", accounts.vault),
|
|
943
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
944
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
945
|
+
],
|
|
946
|
+
data: getDeliverDrawInstructionDataEncoder().encode(args),
|
|
947
|
+
programAddress
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
function parseDeliverDrawInstruction(instruction) {
|
|
951
|
+
if (instruction.accounts.length < 8) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
952
|
+
actualAccountMetas: instruction.accounts.length,
|
|
953
|
+
expectedAccountMetas: 8
|
|
954
|
+
});
|
|
955
|
+
let accountIndex = 0;
|
|
956
|
+
const getNextAccount = () => {
|
|
957
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
958
|
+
accountIndex += 1;
|
|
959
|
+
return accountMeta;
|
|
960
|
+
};
|
|
961
|
+
return {
|
|
962
|
+
programAddress: instruction.programAddress,
|
|
963
|
+
accounts: {
|
|
964
|
+
oracleIdentity: getNextAccount(),
|
|
965
|
+
pool: getNextAccount(),
|
|
966
|
+
draw: getNextAccount(),
|
|
967
|
+
purchaser: getNextAccount(),
|
|
968
|
+
mint: getNextAccount(),
|
|
969
|
+
vault: getNextAccount(),
|
|
970
|
+
userTokens: getNextAccount(),
|
|
971
|
+
tokenProgram: getNextAccount()
|
|
972
|
+
},
|
|
973
|
+
data: getDeliverDrawInstructionDataDecoder().decode(instruction.data)
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
//#endregion
|
|
977
|
+
//#region src/generated/instructions/expireDraw.ts
|
|
978
|
+
/**
|
|
979
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
980
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
981
|
+
* to add features, then rerun Codama to update it.
|
|
982
|
+
*
|
|
983
|
+
* @see https://github.com/codama-idl/codama
|
|
984
|
+
*/
|
|
985
|
+
const EXPIRE_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
986
|
+
100,
|
|
987
|
+
119,
|
|
988
|
+
235,
|
|
989
|
+
75,
|
|
990
|
+
8,
|
|
991
|
+
25,
|
|
992
|
+
252,
|
|
993
|
+
255
|
|
994
|
+
]);
|
|
995
|
+
function getExpireDrawDiscriminatorBytes() {
|
|
996
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(EXPIRE_DRAW_DISCRIMINATOR);
|
|
997
|
+
}
|
|
998
|
+
function getExpireDrawInstructionDataEncoder() {
|
|
999
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
1000
|
+
...value,
|
|
1001
|
+
discriminator: EXPIRE_DRAW_DISCRIMINATOR
|
|
1002
|
+
}));
|
|
1003
|
+
}
|
|
1004
|
+
function getExpireDrawInstructionDataDecoder() {
|
|
1005
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
1006
|
+
}
|
|
1007
|
+
function getExpireDrawInstructionDataCodec() {
|
|
1008
|
+
return combineCodec(getExpireDrawInstructionDataEncoder(), getExpireDrawInstructionDataDecoder());
|
|
1009
|
+
}
|
|
1010
|
+
async function getExpireDrawInstructionAsync(input, config) {
|
|
1011
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1012
|
+
const accounts = {
|
|
1013
|
+
pool: {
|
|
1014
|
+
value: input.pool ?? null,
|
|
1015
|
+
isWritable: true
|
|
1016
|
+
},
|
|
1017
|
+
draw: {
|
|
1018
|
+
value: input.draw ?? null,
|
|
1019
|
+
isWritable: true
|
|
1020
|
+
},
|
|
1021
|
+
purchaser: {
|
|
1022
|
+
value: input.purchaser ?? null,
|
|
1023
|
+
isWritable: true
|
|
1024
|
+
},
|
|
1025
|
+
mint: {
|
|
1026
|
+
value: input.mint ?? null,
|
|
1027
|
+
isWritable: false
|
|
1028
|
+
},
|
|
1029
|
+
vault: {
|
|
1030
|
+
value: input.vault ?? null,
|
|
1031
|
+
isWritable: true
|
|
1032
|
+
},
|
|
1033
|
+
userTokens: {
|
|
1034
|
+
value: input.userTokens ?? null,
|
|
1035
|
+
isWritable: true
|
|
1036
|
+
},
|
|
1037
|
+
tokenProgram: {
|
|
1038
|
+
value: input.tokenProgram ?? null,
|
|
1039
|
+
isWritable: false
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1043
|
+
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
1044
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1045
|
+
seeds: [
|
|
1046
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
1047
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
1048
|
+
6,
|
|
1049
|
+
221,
|
|
1050
|
+
246,
|
|
1051
|
+
225,
|
|
1052
|
+
215,
|
|
1053
|
+
101,
|
|
1054
|
+
161,
|
|
1055
|
+
147,
|
|
1056
|
+
217,
|
|
1057
|
+
203,
|
|
1058
|
+
225,
|
|
1059
|
+
70,
|
|
1060
|
+
206,
|
|
1061
|
+
235,
|
|
1062
|
+
121,
|
|
1063
|
+
172,
|
|
1064
|
+
28,
|
|
1065
|
+
180,
|
|
1066
|
+
133,
|
|
1067
|
+
237,
|
|
1068
|
+
95,
|
|
1069
|
+
91,
|
|
1070
|
+
55,
|
|
1071
|
+
145,
|
|
1072
|
+
58,
|
|
1073
|
+
140,
|
|
1074
|
+
245,
|
|
1075
|
+
133,
|
|
1076
|
+
126,
|
|
1077
|
+
255,
|
|
1078
|
+
0,
|
|
1079
|
+
169
|
|
1080
|
+
])),
|
|
1081
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1082
|
+
]
|
|
1083
|
+
});
|
|
1084
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1085
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1086
|
+
return Object.freeze({
|
|
1087
|
+
accounts: [
|
|
1088
|
+
getAccountMeta("pool", accounts.pool),
|
|
1089
|
+
getAccountMeta("draw", accounts.draw),
|
|
1090
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
1091
|
+
getAccountMeta("mint", accounts.mint),
|
|
1092
|
+
getAccountMeta("vault", accounts.vault),
|
|
1093
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
1094
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1095
|
+
],
|
|
1096
|
+
data: getExpireDrawInstructionDataEncoder().encode({}),
|
|
1097
|
+
programAddress
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
function getExpireDrawInstruction(input, config) {
|
|
1101
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1102
|
+
const accounts = {
|
|
1103
|
+
pool: {
|
|
1104
|
+
value: input.pool ?? null,
|
|
1105
|
+
isWritable: true
|
|
1106
|
+
},
|
|
1107
|
+
draw: {
|
|
1108
|
+
value: input.draw ?? null,
|
|
1109
|
+
isWritable: true
|
|
1110
|
+
},
|
|
1111
|
+
purchaser: {
|
|
1112
|
+
value: input.purchaser ?? null,
|
|
1113
|
+
isWritable: true
|
|
1114
|
+
},
|
|
1115
|
+
mint: {
|
|
1116
|
+
value: input.mint ?? null,
|
|
1117
|
+
isWritable: false
|
|
1118
|
+
},
|
|
1119
|
+
vault: {
|
|
1120
|
+
value: input.vault ?? null,
|
|
1121
|
+
isWritable: true
|
|
1122
|
+
},
|
|
1123
|
+
userTokens: {
|
|
1124
|
+
value: input.userTokens ?? null,
|
|
1125
|
+
isWritable: true
|
|
1126
|
+
},
|
|
1127
|
+
tokenProgram: {
|
|
1128
|
+
value: input.tokenProgram ?? null,
|
|
1129
|
+
isWritable: false
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1133
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1134
|
+
return Object.freeze({
|
|
1135
|
+
accounts: [
|
|
1136
|
+
getAccountMeta("pool", accounts.pool),
|
|
1137
|
+
getAccountMeta("draw", accounts.draw),
|
|
1138
|
+
getAccountMeta("purchaser", accounts.purchaser),
|
|
1139
|
+
getAccountMeta("mint", accounts.mint),
|
|
1140
|
+
getAccountMeta("vault", accounts.vault),
|
|
1141
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
1142
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1143
|
+
],
|
|
1144
|
+
data: getExpireDrawInstructionDataEncoder().encode({}),
|
|
1145
|
+
programAddress
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
function parseExpireDrawInstruction(instruction) {
|
|
1149
|
+
if (instruction.accounts.length < 7) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1150
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1151
|
+
expectedAccountMetas: 7
|
|
1152
|
+
});
|
|
1153
|
+
let accountIndex = 0;
|
|
1154
|
+
const getNextAccount = () => {
|
|
1155
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1156
|
+
accountIndex += 1;
|
|
1157
|
+
return accountMeta;
|
|
1158
|
+
};
|
|
1159
|
+
return {
|
|
1160
|
+
programAddress: instruction.programAddress,
|
|
1161
|
+
accounts: {
|
|
1162
|
+
pool: getNextAccount(),
|
|
1163
|
+
draw: getNextAccount(),
|
|
1164
|
+
purchaser: getNextAccount(),
|
|
1165
|
+
mint: getNextAccount(),
|
|
1166
|
+
vault: getNextAccount(),
|
|
1167
|
+
userTokens: getNextAccount(),
|
|
1168
|
+
tokenProgram: getNextAccount()
|
|
1169
|
+
},
|
|
1170
|
+
data: getExpireDrawInstructionDataDecoder().decode(instruction.data)
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region src/generated/instructions/fundPrizes.ts
|
|
1175
|
+
/**
|
|
1176
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1177
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1178
|
+
* to add features, then rerun Codama to update it.
|
|
1179
|
+
*
|
|
1180
|
+
* @see https://github.com/codama-idl/codama
|
|
1181
|
+
*/
|
|
1182
|
+
const FUND_PRIZES_DISCRIMINATOR = new Uint8Array([
|
|
1183
|
+
163,
|
|
1184
|
+
225,
|
|
1185
|
+
193,
|
|
1186
|
+
125,
|
|
1187
|
+
144,
|
|
1188
|
+
171,
|
|
1189
|
+
29,
|
|
1190
|
+
241
|
|
1191
|
+
]);
|
|
1192
|
+
function getFundPrizesDiscriminatorBytes() {
|
|
1193
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(FUND_PRIZES_DISCRIMINATOR);
|
|
1194
|
+
}
|
|
1195
|
+
function getFundPrizesInstructionDataEncoder() {
|
|
1196
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["amount", getU64Encoder()]]), (value) => ({
|
|
1197
|
+
...value,
|
|
1198
|
+
discriminator: FUND_PRIZES_DISCRIMINATOR
|
|
1199
|
+
}));
|
|
1200
|
+
}
|
|
1201
|
+
function getFundPrizesInstructionDataDecoder() {
|
|
1202
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["amount", getU64Decoder()]]);
|
|
1203
|
+
}
|
|
1204
|
+
function getFundPrizesInstructionDataCodec() {
|
|
1205
|
+
return combineCodec(getFundPrizesInstructionDataEncoder(), getFundPrizesInstructionDataDecoder());
|
|
1206
|
+
}
|
|
1207
|
+
async function getFundPrizesInstructionAsync(input, config) {
|
|
1208
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1209
|
+
const accounts = {
|
|
1210
|
+
funder: {
|
|
1211
|
+
value: input.funder ?? null,
|
|
1212
|
+
isWritable: false
|
|
1213
|
+
},
|
|
1214
|
+
pool: {
|
|
1215
|
+
value: input.pool ?? null,
|
|
1216
|
+
isWritable: false
|
|
1217
|
+
},
|
|
1218
|
+
mint: {
|
|
1219
|
+
value: input.mint ?? null,
|
|
1220
|
+
isWritable: false
|
|
1221
|
+
},
|
|
1222
|
+
source: {
|
|
1223
|
+
value: input.source ?? null,
|
|
1224
|
+
isWritable: true
|
|
1225
|
+
},
|
|
1226
|
+
vault: {
|
|
1227
|
+
value: input.vault ?? null,
|
|
1228
|
+
isWritable: true
|
|
1229
|
+
},
|
|
1230
|
+
tokenProgram: {
|
|
1231
|
+
value: input.tokenProgram ?? null,
|
|
1232
|
+
isWritable: false
|
|
1233
|
+
}
|
|
1234
|
+
};
|
|
1235
|
+
const args = { ...input };
|
|
1236
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1237
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1238
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1239
|
+
return Object.freeze({
|
|
1240
|
+
accounts: [
|
|
1241
|
+
getAccountMeta("funder", accounts.funder),
|
|
1242
|
+
getAccountMeta("pool", accounts.pool),
|
|
1243
|
+
getAccountMeta("mint", accounts.mint),
|
|
1244
|
+
getAccountMeta("source", accounts.source),
|
|
1245
|
+
getAccountMeta("vault", accounts.vault),
|
|
1246
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1247
|
+
],
|
|
1248
|
+
data: getFundPrizesInstructionDataEncoder().encode(args),
|
|
1249
|
+
programAddress
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function getFundPrizesInstruction(input, config) {
|
|
1253
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1254
|
+
const accounts = {
|
|
1255
|
+
funder: {
|
|
1256
|
+
value: input.funder ?? null,
|
|
1257
|
+
isWritable: false
|
|
1258
|
+
},
|
|
1259
|
+
pool: {
|
|
1260
|
+
value: input.pool ?? null,
|
|
1261
|
+
isWritable: false
|
|
1262
|
+
},
|
|
1263
|
+
mint: {
|
|
1264
|
+
value: input.mint ?? null,
|
|
1265
|
+
isWritable: false
|
|
1266
|
+
},
|
|
1267
|
+
source: {
|
|
1268
|
+
value: input.source ?? null,
|
|
1269
|
+
isWritable: true
|
|
1270
|
+
},
|
|
1271
|
+
vault: {
|
|
1272
|
+
value: input.vault ?? null,
|
|
1273
|
+
isWritable: true
|
|
1274
|
+
},
|
|
1275
|
+
tokenProgram: {
|
|
1276
|
+
value: input.tokenProgram ?? null,
|
|
1277
|
+
isWritable: false
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
const args = { ...input };
|
|
1281
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1282
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1283
|
+
return Object.freeze({
|
|
1284
|
+
accounts: [
|
|
1285
|
+
getAccountMeta("funder", accounts.funder),
|
|
1286
|
+
getAccountMeta("pool", accounts.pool),
|
|
1287
|
+
getAccountMeta("mint", accounts.mint),
|
|
1288
|
+
getAccountMeta("source", accounts.source),
|
|
1289
|
+
getAccountMeta("vault", accounts.vault),
|
|
1290
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1291
|
+
],
|
|
1292
|
+
data: getFundPrizesInstructionDataEncoder().encode(args),
|
|
1293
|
+
programAddress
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
function parseFundPrizesInstruction(instruction) {
|
|
1297
|
+
if (instruction.accounts.length < 6) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1298
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1299
|
+
expectedAccountMetas: 6
|
|
1300
|
+
});
|
|
1301
|
+
let accountIndex = 0;
|
|
1302
|
+
const getNextAccount = () => {
|
|
1303
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1304
|
+
accountIndex += 1;
|
|
1305
|
+
return accountMeta;
|
|
1306
|
+
};
|
|
1307
|
+
return {
|
|
1308
|
+
programAddress: instruction.programAddress,
|
|
1309
|
+
accounts: {
|
|
1310
|
+
funder: getNextAccount(),
|
|
1311
|
+
pool: getNextAccount(),
|
|
1312
|
+
mint: getNextAccount(),
|
|
1313
|
+
source: getNextAccount(),
|
|
1314
|
+
vault: getNextAccount(),
|
|
1315
|
+
tokenProgram: getNextAccount()
|
|
1316
|
+
},
|
|
1317
|
+
data: getFundPrizesInstructionDataDecoder().decode(instruction.data)
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
//#endregion
|
|
1321
|
+
//#region src/generated/instructions/initializePool.ts
|
|
1322
|
+
/**
|
|
1323
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1324
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1325
|
+
* to add features, then rerun Codama to update it.
|
|
1326
|
+
*
|
|
1327
|
+
* @see https://github.com/codama-idl/codama
|
|
1328
|
+
*/
|
|
1329
|
+
const INITIALIZE_POOL_DISCRIMINATOR = new Uint8Array([
|
|
1330
|
+
95,
|
|
1331
|
+
180,
|
|
1332
|
+
10,
|
|
1333
|
+
172,
|
|
1334
|
+
84,
|
|
1335
|
+
174,
|
|
1336
|
+
232,
|
|
1337
|
+
40
|
|
1338
|
+
]);
|
|
1339
|
+
function getInitializePoolDiscriminatorBytes() {
|
|
1340
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(INITIALIZE_POOL_DISCRIMINATOR);
|
|
1341
|
+
}
|
|
1342
|
+
function getInitializePoolInstructionDataEncoder() {
|
|
1343
|
+
return transformEncoder(getStructEncoder([
|
|
1344
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1345
|
+
["tiers", getArrayEncoder(getTierEncoder(), { size: 8 })],
|
|
1346
|
+
["maxSeedQuoteIn", getU64Encoder()],
|
|
1347
|
+
["maxSeedNativeDebit", getU64Encoder()],
|
|
1348
|
+
["extraSeedTokens", getU64Encoder()]
|
|
1349
|
+
]), (value) => ({
|
|
1350
|
+
...value,
|
|
1351
|
+
discriminator: INITIALIZE_POOL_DISCRIMINATOR
|
|
1352
|
+
}));
|
|
1353
|
+
}
|
|
1354
|
+
function getInitializePoolInstructionDataDecoder() {
|
|
1355
|
+
return getStructDecoder([
|
|
1356
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1357
|
+
["tiers", getArrayDecoder(getTierDecoder(), { size: 8 })],
|
|
1358
|
+
["maxSeedQuoteIn", getU64Decoder()],
|
|
1359
|
+
["maxSeedNativeDebit", getU64Decoder()],
|
|
1360
|
+
["extraSeedTokens", getU64Decoder()]
|
|
1361
|
+
]);
|
|
1362
|
+
}
|
|
1363
|
+
function getInitializePoolInstructionDataCodec() {
|
|
1364
|
+
return combineCodec(getInitializePoolInstructionDataEncoder(), getInitializePoolInstructionDataDecoder());
|
|
1365
|
+
}
|
|
1366
|
+
async function getInitializePoolInstructionAsync(input, config) {
|
|
1367
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1368
|
+
const accounts = {
|
|
1369
|
+
creator: {
|
|
1370
|
+
value: input.creator ?? null,
|
|
1371
|
+
isWritable: true
|
|
1372
|
+
},
|
|
1373
|
+
pool: {
|
|
1374
|
+
value: input.pool ?? null,
|
|
1375
|
+
isWritable: true
|
|
1376
|
+
},
|
|
1377
|
+
mint: {
|
|
1378
|
+
value: input.mint ?? null,
|
|
1379
|
+
isWritable: false
|
|
1380
|
+
},
|
|
1381
|
+
quoteMint: {
|
|
1382
|
+
value: input.quoteMint ?? null,
|
|
1383
|
+
isWritable: false
|
|
1384
|
+
},
|
|
1385
|
+
quoteConfig: {
|
|
1386
|
+
value: input.quoteConfig ?? null,
|
|
1387
|
+
isWritable: false
|
|
1388
|
+
},
|
|
1389
|
+
creatorTokens: {
|
|
1390
|
+
value: input.creatorTokens ?? null,
|
|
1391
|
+
isWritable: true
|
|
1392
|
+
},
|
|
1393
|
+
vault: {
|
|
1394
|
+
value: input.vault ?? null,
|
|
1395
|
+
isWritable: true
|
|
1396
|
+
},
|
|
1397
|
+
venue: {
|
|
1398
|
+
value: input.venue ?? null,
|
|
1399
|
+
isWritable: false
|
|
1400
|
+
},
|
|
1401
|
+
instructions: {
|
|
1402
|
+
value: input.instructions ?? null,
|
|
1403
|
+
isWritable: false
|
|
1404
|
+
},
|
|
1405
|
+
tokenProgram: {
|
|
1406
|
+
value: input.tokenProgram ?? null,
|
|
1407
|
+
isWritable: false
|
|
1408
|
+
},
|
|
1409
|
+
quoteTokenProgram: {
|
|
1410
|
+
value: input.quoteTokenProgram ?? null,
|
|
1411
|
+
isWritable: false
|
|
1412
|
+
},
|
|
1413
|
+
associatedTokenProgram: {
|
|
1414
|
+
value: input.associatedTokenProgram ?? null,
|
|
1415
|
+
isWritable: false
|
|
1416
|
+
},
|
|
1417
|
+
systemProgram: {
|
|
1418
|
+
value: input.systemProgram ?? null,
|
|
1419
|
+
isWritable: false
|
|
1420
|
+
}
|
|
1421
|
+
};
|
|
1422
|
+
const args = { ...input };
|
|
1423
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1424
|
+
if (!accounts.creatorTokens.value) accounts.creatorTokens.value = await getProgramDerivedAddress({
|
|
1425
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1426
|
+
seeds: [
|
|
1427
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("creator", accounts.creator.value)),
|
|
1428
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
1429
|
+
6,
|
|
1430
|
+
221,
|
|
1431
|
+
246,
|
|
1432
|
+
225,
|
|
1433
|
+
215,
|
|
1434
|
+
101,
|
|
1435
|
+
161,
|
|
1436
|
+
147,
|
|
1437
|
+
217,
|
|
1438
|
+
203,
|
|
1439
|
+
225,
|
|
1440
|
+
70,
|
|
1441
|
+
206,
|
|
1442
|
+
235,
|
|
1443
|
+
121,
|
|
1444
|
+
172,
|
|
1445
|
+
28,
|
|
1446
|
+
180,
|
|
1447
|
+
133,
|
|
1448
|
+
237,
|
|
1449
|
+
95,
|
|
1450
|
+
91,
|
|
1451
|
+
55,
|
|
1452
|
+
145,
|
|
1453
|
+
58,
|
|
1454
|
+
140,
|
|
1455
|
+
245,
|
|
1456
|
+
133,
|
|
1457
|
+
126,
|
|
1458
|
+
255,
|
|
1459
|
+
0,
|
|
1460
|
+
169
|
|
1461
|
+
])),
|
|
1462
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1463
|
+
]
|
|
1464
|
+
});
|
|
1465
|
+
if (!accounts.vault.value) accounts.vault.value = await getProgramDerivedAddress({
|
|
1466
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1467
|
+
seeds: [
|
|
1468
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)),
|
|
1469
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
1470
|
+
6,
|
|
1471
|
+
221,
|
|
1472
|
+
246,
|
|
1473
|
+
225,
|
|
1474
|
+
215,
|
|
1475
|
+
101,
|
|
1476
|
+
161,
|
|
1477
|
+
147,
|
|
1478
|
+
217,
|
|
1479
|
+
203,
|
|
1480
|
+
225,
|
|
1481
|
+
70,
|
|
1482
|
+
206,
|
|
1483
|
+
235,
|
|
1484
|
+
121,
|
|
1485
|
+
172,
|
|
1486
|
+
28,
|
|
1487
|
+
180,
|
|
1488
|
+
133,
|
|
1489
|
+
237,
|
|
1490
|
+
95,
|
|
1491
|
+
91,
|
|
1492
|
+
55,
|
|
1493
|
+
145,
|
|
1494
|
+
58,
|
|
1495
|
+
140,
|
|
1496
|
+
245,
|
|
1497
|
+
133,
|
|
1498
|
+
126,
|
|
1499
|
+
255,
|
|
1500
|
+
0,
|
|
1501
|
+
169
|
|
1502
|
+
])),
|
|
1503
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1504
|
+
]
|
|
1505
|
+
});
|
|
1506
|
+
if (!accounts.instructions.value) accounts.instructions.value = "Sysvar1nstructions1111111111111111111111111";
|
|
1507
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1508
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1509
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1510
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1511
|
+
return Object.freeze({
|
|
1512
|
+
accounts: [
|
|
1513
|
+
getAccountMeta("creator", accounts.creator),
|
|
1514
|
+
getAccountMeta("pool", accounts.pool),
|
|
1515
|
+
getAccountMeta("mint", accounts.mint),
|
|
1516
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
1517
|
+
getAccountMeta("quoteConfig", accounts.quoteConfig),
|
|
1518
|
+
getAccountMeta("creatorTokens", accounts.creatorTokens),
|
|
1519
|
+
getAccountMeta("vault", accounts.vault),
|
|
1520
|
+
getAccountMeta("venue", accounts.venue),
|
|
1521
|
+
getAccountMeta("instructions", accounts.instructions),
|
|
1522
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1523
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
1524
|
+
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
1525
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1526
|
+
],
|
|
1527
|
+
data: getInitializePoolInstructionDataEncoder().encode(args),
|
|
1528
|
+
programAddress
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
function getInitializePoolInstruction(input, config) {
|
|
1532
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1533
|
+
const accounts = {
|
|
1534
|
+
creator: {
|
|
1535
|
+
value: input.creator ?? null,
|
|
1536
|
+
isWritable: true
|
|
1537
|
+
},
|
|
1538
|
+
pool: {
|
|
1539
|
+
value: input.pool ?? null,
|
|
1540
|
+
isWritable: true
|
|
1541
|
+
},
|
|
1542
|
+
mint: {
|
|
1543
|
+
value: input.mint ?? null,
|
|
1544
|
+
isWritable: false
|
|
1545
|
+
},
|
|
1546
|
+
quoteMint: {
|
|
1547
|
+
value: input.quoteMint ?? null,
|
|
1548
|
+
isWritable: false
|
|
1549
|
+
},
|
|
1550
|
+
quoteConfig: {
|
|
1551
|
+
value: input.quoteConfig ?? null,
|
|
1552
|
+
isWritable: false
|
|
1553
|
+
},
|
|
1554
|
+
creatorTokens: {
|
|
1555
|
+
value: input.creatorTokens ?? null,
|
|
1556
|
+
isWritable: true
|
|
1557
|
+
},
|
|
1558
|
+
vault: {
|
|
1559
|
+
value: input.vault ?? null,
|
|
1560
|
+
isWritable: true
|
|
1561
|
+
},
|
|
1562
|
+
venue: {
|
|
1563
|
+
value: input.venue ?? null,
|
|
1564
|
+
isWritable: false
|
|
1565
|
+
},
|
|
1566
|
+
instructions: {
|
|
1567
|
+
value: input.instructions ?? null,
|
|
1568
|
+
isWritable: false
|
|
1569
|
+
},
|
|
1570
|
+
tokenProgram: {
|
|
1571
|
+
value: input.tokenProgram ?? null,
|
|
1572
|
+
isWritable: false
|
|
1573
|
+
},
|
|
1574
|
+
quoteTokenProgram: {
|
|
1575
|
+
value: input.quoteTokenProgram ?? null,
|
|
1576
|
+
isWritable: false
|
|
1577
|
+
},
|
|
1578
|
+
associatedTokenProgram: {
|
|
1579
|
+
value: input.associatedTokenProgram ?? null,
|
|
1580
|
+
isWritable: false
|
|
1581
|
+
},
|
|
1582
|
+
systemProgram: {
|
|
1583
|
+
value: input.systemProgram ?? null,
|
|
1584
|
+
isWritable: false
|
|
1585
|
+
}
|
|
1586
|
+
};
|
|
1587
|
+
const args = { ...input };
|
|
1588
|
+
if (!accounts.instructions.value) accounts.instructions.value = "Sysvar1nstructions1111111111111111111111111";
|
|
1589
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1590
|
+
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1591
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1592
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1593
|
+
return Object.freeze({
|
|
1594
|
+
accounts: [
|
|
1595
|
+
getAccountMeta("creator", accounts.creator),
|
|
1596
|
+
getAccountMeta("pool", accounts.pool),
|
|
1597
|
+
getAccountMeta("mint", accounts.mint),
|
|
1598
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
1599
|
+
getAccountMeta("quoteConfig", accounts.quoteConfig),
|
|
1600
|
+
getAccountMeta("creatorTokens", accounts.creatorTokens),
|
|
1601
|
+
getAccountMeta("vault", accounts.vault),
|
|
1602
|
+
getAccountMeta("venue", accounts.venue),
|
|
1603
|
+
getAccountMeta("instructions", accounts.instructions),
|
|
1604
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1605
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
1606
|
+
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
1607
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1608
|
+
],
|
|
1609
|
+
data: getInitializePoolInstructionDataEncoder().encode(args),
|
|
1610
|
+
programAddress
|
|
1611
|
+
});
|
|
1612
|
+
}
|
|
1613
|
+
function parseInitializePoolInstruction(instruction) {
|
|
1614
|
+
if (instruction.accounts.length < 13) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1615
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1616
|
+
expectedAccountMetas: 13
|
|
1617
|
+
});
|
|
1618
|
+
let accountIndex = 0;
|
|
1619
|
+
const getNextAccount = () => {
|
|
1620
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1621
|
+
accountIndex += 1;
|
|
1622
|
+
return accountMeta;
|
|
1623
|
+
};
|
|
1624
|
+
return {
|
|
1625
|
+
programAddress: instruction.programAddress,
|
|
1626
|
+
accounts: {
|
|
1627
|
+
creator: getNextAccount(),
|
|
1628
|
+
pool: getNextAccount(),
|
|
1629
|
+
mint: getNextAccount(),
|
|
1630
|
+
quoteMint: getNextAccount(),
|
|
1631
|
+
quoteConfig: getNextAccount(),
|
|
1632
|
+
creatorTokens: getNextAccount(),
|
|
1633
|
+
vault: getNextAccount(),
|
|
1634
|
+
venue: getNextAccount(),
|
|
1635
|
+
instructions: getNextAccount(),
|
|
1636
|
+
tokenProgram: getNextAccount(),
|
|
1637
|
+
quoteTokenProgram: getNextAccount(),
|
|
1638
|
+
associatedTokenProgram: getNextAccount(),
|
|
1639
|
+
systemProgram: getNextAccount()
|
|
1640
|
+
},
|
|
1641
|
+
data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region src/generated/instructions/retryDraw.ts
|
|
1646
|
+
/**
|
|
1647
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1648
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1649
|
+
* to add features, then rerun Codama to update it.
|
|
1650
|
+
*
|
|
1651
|
+
* @see https://github.com/codama-idl/codama
|
|
1652
|
+
*/
|
|
1653
|
+
const RETRY_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
1654
|
+
112,
|
|
1655
|
+
118,
|
|
1656
|
+
137,
|
|
1657
|
+
120,
|
|
1658
|
+
211,
|
|
1659
|
+
39,
|
|
1660
|
+
196,
|
|
1661
|
+
96
|
|
1662
|
+
]);
|
|
1663
|
+
function getRetryDrawDiscriminatorBytes() {
|
|
1664
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(RETRY_DRAW_DISCRIMINATOR);
|
|
1665
|
+
}
|
|
1666
|
+
function getRetryDrawInstructionDataEncoder() {
|
|
1667
|
+
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["maxVrfDebit", getU64Encoder()]]), (value) => ({
|
|
1668
|
+
...value,
|
|
1669
|
+
discriminator: RETRY_DRAW_DISCRIMINATOR
|
|
1670
|
+
}));
|
|
1671
|
+
}
|
|
1672
|
+
function getRetryDrawInstructionDataDecoder() {
|
|
1673
|
+
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["maxVrfDebit", getU64Decoder()]]);
|
|
1674
|
+
}
|
|
1675
|
+
function getRetryDrawInstructionDataCodec() {
|
|
1676
|
+
return combineCodec(getRetryDrawInstructionDataEncoder(), getRetryDrawInstructionDataDecoder());
|
|
1677
|
+
}
|
|
1678
|
+
async function getRetryDrawInstructionAsync(input, config) {
|
|
1679
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1680
|
+
const accounts = {
|
|
1681
|
+
payer: {
|
|
1682
|
+
value: input.payer ?? null,
|
|
1683
|
+
isWritable: true
|
|
1684
|
+
},
|
|
1685
|
+
pool: {
|
|
1686
|
+
value: input.pool ?? null,
|
|
1687
|
+
isWritable: false
|
|
1688
|
+
},
|
|
1689
|
+
draw: {
|
|
1690
|
+
value: input.draw ?? null,
|
|
1691
|
+
isWritable: true
|
|
1692
|
+
},
|
|
1693
|
+
identity: {
|
|
1694
|
+
value: input.identity ?? null,
|
|
1695
|
+
isWritable: false
|
|
1696
|
+
},
|
|
1697
|
+
queue: {
|
|
1698
|
+
value: input.queue ?? null,
|
|
1699
|
+
isWritable: true
|
|
1700
|
+
},
|
|
1701
|
+
program: {
|
|
1702
|
+
value: input.program ?? null,
|
|
1703
|
+
isWritable: false
|
|
1704
|
+
},
|
|
1705
|
+
slotHashes: {
|
|
1706
|
+
value: input.slotHashes ?? null,
|
|
1707
|
+
isWritable: false
|
|
1708
|
+
},
|
|
1709
|
+
systemProgram: {
|
|
1710
|
+
value: input.systemProgram ?? null,
|
|
1711
|
+
isWritable: false
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
const args = { ...input };
|
|
1715
|
+
if (!accounts.identity.value) accounts.identity.value = await findIdentityPda({ programAddress });
|
|
1716
|
+
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
1717
|
+
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
1718
|
+
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
1719
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1720
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1721
|
+
return Object.freeze({
|
|
1722
|
+
accounts: [
|
|
1723
|
+
getAccountMeta("payer", accounts.payer),
|
|
1724
|
+
getAccountMeta("pool", accounts.pool),
|
|
1725
|
+
getAccountMeta("draw", accounts.draw),
|
|
1726
|
+
getAccountMeta("identity", accounts.identity),
|
|
1727
|
+
getAccountMeta("queue", accounts.queue),
|
|
1728
|
+
getAccountMeta("program", accounts.program),
|
|
1729
|
+
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
1730
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1731
|
+
],
|
|
1732
|
+
data: getRetryDrawInstructionDataEncoder().encode(args),
|
|
1733
|
+
programAddress
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
function getRetryDrawInstruction(input, config) {
|
|
1737
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1738
|
+
const accounts = {
|
|
1739
|
+
payer: {
|
|
1740
|
+
value: input.payer ?? null,
|
|
1741
|
+
isWritable: true
|
|
1742
|
+
},
|
|
1743
|
+
pool: {
|
|
1744
|
+
value: input.pool ?? null,
|
|
1745
|
+
isWritable: false
|
|
1746
|
+
},
|
|
1747
|
+
draw: {
|
|
1748
|
+
value: input.draw ?? null,
|
|
1749
|
+
isWritable: true
|
|
1750
|
+
},
|
|
1751
|
+
identity: {
|
|
1752
|
+
value: input.identity ?? null,
|
|
1753
|
+
isWritable: false
|
|
1754
|
+
},
|
|
1755
|
+
queue: {
|
|
1756
|
+
value: input.queue ?? null,
|
|
1757
|
+
isWritable: true
|
|
1758
|
+
},
|
|
1759
|
+
program: {
|
|
1760
|
+
value: input.program ?? null,
|
|
1761
|
+
isWritable: false
|
|
1762
|
+
},
|
|
1763
|
+
slotHashes: {
|
|
1764
|
+
value: input.slotHashes ?? null,
|
|
1765
|
+
isWritable: false
|
|
1766
|
+
},
|
|
1767
|
+
systemProgram: {
|
|
1768
|
+
value: input.systemProgram ?? null,
|
|
1769
|
+
isWritable: false
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
const args = { ...input };
|
|
1773
|
+
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
1774
|
+
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
1775
|
+
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
1776
|
+
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1777
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1778
|
+
return Object.freeze({
|
|
1779
|
+
accounts: [
|
|
1780
|
+
getAccountMeta("payer", accounts.payer),
|
|
1781
|
+
getAccountMeta("pool", accounts.pool),
|
|
1782
|
+
getAccountMeta("draw", accounts.draw),
|
|
1783
|
+
getAccountMeta("identity", accounts.identity),
|
|
1784
|
+
getAccountMeta("queue", accounts.queue),
|
|
1785
|
+
getAccountMeta("program", accounts.program),
|
|
1786
|
+
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
1787
|
+
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1788
|
+
],
|
|
1789
|
+
data: getRetryDrawInstructionDataEncoder().encode(args),
|
|
1790
|
+
programAddress
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
function parseRetryDrawInstruction(instruction) {
|
|
1794
|
+
if (instruction.accounts.length < 8) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1795
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1796
|
+
expectedAccountMetas: 8
|
|
1797
|
+
});
|
|
1798
|
+
let accountIndex = 0;
|
|
1799
|
+
const getNextAccount = () => {
|
|
1800
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1801
|
+
accountIndex += 1;
|
|
1802
|
+
return accountMeta;
|
|
1803
|
+
};
|
|
1804
|
+
return {
|
|
1805
|
+
programAddress: instruction.programAddress,
|
|
1806
|
+
accounts: {
|
|
1807
|
+
payer: getNextAccount(),
|
|
1808
|
+
pool: getNextAccount(),
|
|
1809
|
+
draw: getNextAccount(),
|
|
1810
|
+
identity: getNextAccount(),
|
|
1811
|
+
queue: getNextAccount(),
|
|
1812
|
+
program: getNextAccount(),
|
|
1813
|
+
slotHashes: getNextAccount(),
|
|
1814
|
+
systemProgram: getNextAccount()
|
|
1815
|
+
},
|
|
1816
|
+
data: getRetryDrawInstructionDataDecoder().decode(instruction.data)
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
//#endregion
|
|
1820
|
+
//#region src/generated/instructions/sellTokens.ts
|
|
1821
|
+
/**
|
|
1822
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1823
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1824
|
+
* to add features, then rerun Codama to update it.
|
|
1825
|
+
*
|
|
1826
|
+
* @see https://github.com/codama-idl/codama
|
|
1827
|
+
*/
|
|
1828
|
+
const SELL_TOKENS_DISCRIMINATOR = new Uint8Array([
|
|
1829
|
+
114,
|
|
1830
|
+
242,
|
|
1831
|
+
25,
|
|
1832
|
+
12,
|
|
1833
|
+
62,
|
|
1834
|
+
126,
|
|
1835
|
+
92,
|
|
1836
|
+
2
|
|
1837
|
+
]);
|
|
1838
|
+
function getSellTokensDiscriminatorBytes() {
|
|
1839
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(SELL_TOKENS_DISCRIMINATOR);
|
|
1840
|
+
}
|
|
1841
|
+
function getSellTokensInstructionDataEncoder() {
|
|
1842
|
+
return transformEncoder(getStructEncoder([
|
|
1843
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1844
|
+
["amount", getU64Encoder()],
|
|
1845
|
+
["minQuoteOutput", getU64Encoder()],
|
|
1846
|
+
["maxNativeDebit", getU64Encoder()]
|
|
1847
|
+
]), (value) => ({
|
|
1848
|
+
...value,
|
|
1849
|
+
discriminator: SELL_TOKENS_DISCRIMINATOR
|
|
1850
|
+
}));
|
|
1851
|
+
}
|
|
1852
|
+
function getSellTokensInstructionDataDecoder() {
|
|
1853
|
+
return getStructDecoder([
|
|
1854
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1855
|
+
["amount", getU64Decoder()],
|
|
1856
|
+
["minQuoteOutput", getU64Decoder()],
|
|
1857
|
+
["maxNativeDebit", getU64Decoder()]
|
|
1858
|
+
]);
|
|
1859
|
+
}
|
|
1860
|
+
function getSellTokensInstructionDataCodec() {
|
|
1861
|
+
return combineCodec(getSellTokensInstructionDataEncoder(), getSellTokensInstructionDataDecoder());
|
|
1862
|
+
}
|
|
1863
|
+
async function getSellTokensInstructionAsync(input, config) {
|
|
1864
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1865
|
+
const accounts = {
|
|
1866
|
+
seller: {
|
|
1867
|
+
value: input.seller ?? null,
|
|
1868
|
+
isWritable: true
|
|
1869
|
+
},
|
|
1870
|
+
pool: {
|
|
1871
|
+
value: input.pool ?? null,
|
|
1872
|
+
isWritable: false
|
|
1873
|
+
},
|
|
1874
|
+
mint: {
|
|
1875
|
+
value: input.mint ?? null,
|
|
1876
|
+
isWritable: false
|
|
1877
|
+
},
|
|
1878
|
+
quoteMint: {
|
|
1879
|
+
value: input.quoteMint ?? null,
|
|
1880
|
+
isWritable: false
|
|
1881
|
+
},
|
|
1882
|
+
userTokens: {
|
|
1883
|
+
value: input.userTokens ?? null,
|
|
1884
|
+
isWritable: true
|
|
1885
|
+
},
|
|
1886
|
+
venue: {
|
|
1887
|
+
value: input.venue ?? null,
|
|
1888
|
+
isWritable: false
|
|
1889
|
+
},
|
|
1890
|
+
tokenProgram: {
|
|
1891
|
+
value: input.tokenProgram ?? null,
|
|
1892
|
+
isWritable: false
|
|
1893
|
+
},
|
|
1894
|
+
quoteTokenProgram: {
|
|
1895
|
+
value: input.quoteTokenProgram ?? null,
|
|
1896
|
+
isWritable: false
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
const args = { ...input };
|
|
1900
|
+
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1901
|
+
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
1902
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1903
|
+
seeds: [
|
|
1904
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("seller", accounts.seller.value)),
|
|
1905
|
+
getBytesEncoder().encode(new Uint8Array([
|
|
1906
|
+
6,
|
|
1907
|
+
221,
|
|
1908
|
+
246,
|
|
1909
|
+
225,
|
|
1910
|
+
215,
|
|
1911
|
+
101,
|
|
1912
|
+
161,
|
|
1913
|
+
147,
|
|
1914
|
+
217,
|
|
1915
|
+
203,
|
|
1916
|
+
225,
|
|
1917
|
+
70,
|
|
1918
|
+
206,
|
|
1919
|
+
235,
|
|
1920
|
+
121,
|
|
1921
|
+
172,
|
|
1922
|
+
28,
|
|
1923
|
+
180,
|
|
1924
|
+
133,
|
|
1925
|
+
237,
|
|
1926
|
+
95,
|
|
1927
|
+
91,
|
|
1928
|
+
55,
|
|
1929
|
+
145,
|
|
1930
|
+
58,
|
|
1931
|
+
140,
|
|
1932
|
+
245,
|
|
1933
|
+
133,
|
|
1934
|
+
126,
|
|
1935
|
+
255,
|
|
1936
|
+
0,
|
|
1937
|
+
169
|
|
1938
|
+
])),
|
|
1939
|
+
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1940
|
+
]
|
|
1941
|
+
});
|
|
1942
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1943
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1944
|
+
return Object.freeze({
|
|
1945
|
+
accounts: [
|
|
1946
|
+
getAccountMeta("seller", accounts.seller),
|
|
1947
|
+
getAccountMeta("pool", accounts.pool),
|
|
1948
|
+
getAccountMeta("mint", accounts.mint),
|
|
1949
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
1950
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
1951
|
+
getAccountMeta("venue", accounts.venue),
|
|
1952
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1953
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
1954
|
+
],
|
|
1955
|
+
data: getSellTokensInstructionDataEncoder().encode(args),
|
|
1956
|
+
programAddress
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
function getSellTokensInstruction(input, config) {
|
|
1960
|
+
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1961
|
+
const accounts = {
|
|
1962
|
+
seller: {
|
|
1963
|
+
value: input.seller ?? null,
|
|
1964
|
+
isWritable: true
|
|
1965
|
+
},
|
|
1966
|
+
pool: {
|
|
1967
|
+
value: input.pool ?? null,
|
|
1968
|
+
isWritable: false
|
|
1969
|
+
},
|
|
1970
|
+
mint: {
|
|
1971
|
+
value: input.mint ?? null,
|
|
1972
|
+
isWritable: false
|
|
1973
|
+
},
|
|
1974
|
+
quoteMint: {
|
|
1975
|
+
value: input.quoteMint ?? null,
|
|
1976
|
+
isWritable: false
|
|
1977
|
+
},
|
|
1978
|
+
userTokens: {
|
|
1979
|
+
value: input.userTokens ?? null,
|
|
1980
|
+
isWritable: true
|
|
1981
|
+
},
|
|
1982
|
+
venue: {
|
|
1983
|
+
value: input.venue ?? null,
|
|
1984
|
+
isWritable: false
|
|
1985
|
+
},
|
|
1986
|
+
tokenProgram: {
|
|
1987
|
+
value: input.tokenProgram ?? null,
|
|
1988
|
+
isWritable: false
|
|
1989
|
+
},
|
|
1990
|
+
quoteTokenProgram: {
|
|
1991
|
+
value: input.quoteTokenProgram ?? null,
|
|
1992
|
+
isWritable: false
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
const args = { ...input };
|
|
1996
|
+
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1997
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1998
|
+
return Object.freeze({
|
|
1999
|
+
accounts: [
|
|
2000
|
+
getAccountMeta("seller", accounts.seller),
|
|
2001
|
+
getAccountMeta("pool", accounts.pool),
|
|
2002
|
+
getAccountMeta("mint", accounts.mint),
|
|
2003
|
+
getAccountMeta("quoteMint", accounts.quoteMint),
|
|
2004
|
+
getAccountMeta("userTokens", accounts.userTokens),
|
|
2005
|
+
getAccountMeta("venue", accounts.venue),
|
|
2006
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2007
|
+
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
2008
|
+
],
|
|
2009
|
+
data: getSellTokensInstructionDataEncoder().encode(args),
|
|
2010
|
+
programAddress
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
function parseSellTokensInstruction(instruction) {
|
|
2014
|
+
if (instruction.accounts.length < 8) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2015
|
+
actualAccountMetas: instruction.accounts.length,
|
|
2016
|
+
expectedAccountMetas: 8
|
|
2017
|
+
});
|
|
2018
|
+
let accountIndex = 0;
|
|
2019
|
+
const getNextAccount = () => {
|
|
2020
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
2021
|
+
accountIndex += 1;
|
|
2022
|
+
return accountMeta;
|
|
2023
|
+
};
|
|
2024
|
+
return {
|
|
2025
|
+
programAddress: instruction.programAddress,
|
|
2026
|
+
accounts: {
|
|
2027
|
+
seller: getNextAccount(),
|
|
2028
|
+
pool: getNextAccount(),
|
|
2029
|
+
mint: getNextAccount(),
|
|
2030
|
+
quoteMint: getNextAccount(),
|
|
2031
|
+
userTokens: getNextAccount(),
|
|
2032
|
+
venue: getNextAccount(),
|
|
2033
|
+
tokenProgram: getNextAccount(),
|
|
2034
|
+
quoteTokenProgram: getNextAccount()
|
|
2035
|
+
},
|
|
2036
|
+
data: getSellTokensInstructionDataDecoder().decode(instruction.data)
|
|
2037
|
+
};
|
|
2038
|
+
}
|
|
2039
|
+
//#endregion
|
|
2040
|
+
//#region src/generated/programs/gabox.ts
|
|
2041
|
+
/**
|
|
2042
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
2043
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2044
|
+
* to add features, then rerun Codama to update it.
|
|
2045
|
+
*
|
|
2046
|
+
* @see https://github.com/codama-idl/codama
|
|
2047
|
+
*/
|
|
2048
|
+
const GABOX_PROGRAM_ADDRESS = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2049
|
+
let GaboxAccount = /* @__PURE__ */ function(GaboxAccount) {
|
|
2050
|
+
GaboxAccount[GaboxAccount["Draw"] = 0] = "Draw";
|
|
2051
|
+
GaboxAccount[GaboxAccount["Pool"] = 1] = "Pool";
|
|
2052
|
+
GaboxAccount[GaboxAccount["WalletActivity"] = 2] = "WalletActivity";
|
|
2053
|
+
return GaboxAccount;
|
|
2054
|
+
}({});
|
|
2055
|
+
function identifyGaboxAccount(account) {
|
|
2056
|
+
const data = "data" in account ? account.data : account;
|
|
2057
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2058
|
+
101,
|
|
2059
|
+
31,
|
|
2060
|
+
52,
|
|
2061
|
+
179,
|
|
2062
|
+
121,
|
|
2063
|
+
78,
|
|
2064
|
+
252,
|
|
2065
|
+
89
|
|
2066
|
+
])), 0)) return 0;
|
|
2067
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2068
|
+
153,
|
|
2069
|
+
115,
|
|
2070
|
+
78,
|
|
2071
|
+
55,
|
|
2072
|
+
156,
|
|
2073
|
+
26,
|
|
2074
|
+
133,
|
|
2075
|
+
45
|
|
2076
|
+
])), 0)) return 1;
|
|
2077
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2078
|
+
212,
|
|
2079
|
+
80,
|
|
2080
|
+
180,
|
|
2081
|
+
131,
|
|
2082
|
+
173,
|
|
2083
|
+
1,
|
|
2084
|
+
252,
|
|
2085
|
+
141
|
|
2086
|
+
])), 0)) return 2;
|
|
2087
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, {
|
|
2088
|
+
accountData: data,
|
|
2089
|
+
programName: "gabox"
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
let GaboxEvent = /* @__PURE__ */ function(GaboxEvent) {
|
|
2093
|
+
GaboxEvent[GaboxEvent["DrawResolved"] = 0] = "DrawResolved";
|
|
2094
|
+
GaboxEvent[GaboxEvent["PackBought"] = 1] = "PackBought";
|
|
2095
|
+
GaboxEvent[GaboxEvent["PoolCreated"] = 2] = "PoolCreated";
|
|
2096
|
+
GaboxEvent[GaboxEvent["PrizesFunded"] = 3] = "PrizesFunded";
|
|
2097
|
+
GaboxEvent[GaboxEvent["RandomnessRetried"] = 4] = "RandomnessRetried";
|
|
2098
|
+
GaboxEvent[GaboxEvent["TokensSold"] = 5] = "TokensSold";
|
|
2099
|
+
return GaboxEvent;
|
|
2100
|
+
}({});
|
|
2101
|
+
function identifyGaboxEvent(event) {
|
|
2102
|
+
const data = "data" in event ? event.data : event;
|
|
2103
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2104
|
+
127,
|
|
2105
|
+
177,
|
|
2106
|
+
62,
|
|
2107
|
+
146,
|
|
2108
|
+
164,
|
|
2109
|
+
90,
|
|
2110
|
+
185,
|
|
2111
|
+
218
|
|
2112
|
+
])), 0)) return 0;
|
|
2113
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2114
|
+
220,
|
|
2115
|
+
208,
|
|
2116
|
+
74,
|
|
2117
|
+
75,
|
|
2118
|
+
42,
|
|
2119
|
+
144,
|
|
2120
|
+
231,
|
|
2121
|
+
69
|
|
2122
|
+
])), 0)) return 1;
|
|
2123
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2124
|
+
202,
|
|
2125
|
+
44,
|
|
2126
|
+
41,
|
|
2127
|
+
88,
|
|
2128
|
+
104,
|
|
2129
|
+
220,
|
|
2130
|
+
157,
|
|
2131
|
+
82
|
|
2132
|
+
])), 0)) return 2;
|
|
2133
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2134
|
+
188,
|
|
2135
|
+
129,
|
|
2136
|
+
185,
|
|
2137
|
+
44,
|
|
2138
|
+
234,
|
|
2139
|
+
71,
|
|
2140
|
+
53,
|
|
2141
|
+
60
|
|
2142
|
+
])), 0)) return 3;
|
|
2143
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2144
|
+
243,
|
|
2145
|
+
30,
|
|
2146
|
+
148,
|
|
2147
|
+
22,
|
|
2148
|
+
14,
|
|
2149
|
+
127,
|
|
2150
|
+
52,
|
|
2151
|
+
140
|
|
2152
|
+
])), 0)) return 4;
|
|
2153
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2154
|
+
217,
|
|
2155
|
+
83,
|
|
2156
|
+
68,
|
|
2157
|
+
137,
|
|
2158
|
+
134,
|
|
2159
|
+
225,
|
|
2160
|
+
94,
|
|
2161
|
+
45
|
|
2162
|
+
])), 0)) return 5;
|
|
2163
|
+
throw new Error("The provided event could not be identified as a gabox event.");
|
|
2164
|
+
}
|
|
2165
|
+
let GaboxInstruction = /* @__PURE__ */ function(GaboxInstruction) {
|
|
2166
|
+
GaboxInstruction[GaboxInstruction["BuyPack"] = 0] = "BuyPack";
|
|
2167
|
+
GaboxInstruction[GaboxInstruction["DeliverDraw"] = 1] = "DeliverDraw";
|
|
2168
|
+
GaboxInstruction[GaboxInstruction["ExpireDraw"] = 2] = "ExpireDraw";
|
|
2169
|
+
GaboxInstruction[GaboxInstruction["FundPrizes"] = 3] = "FundPrizes";
|
|
2170
|
+
GaboxInstruction[GaboxInstruction["InitializePool"] = 4] = "InitializePool";
|
|
2171
|
+
GaboxInstruction[GaboxInstruction["RetryDraw"] = 5] = "RetryDraw";
|
|
2172
|
+
GaboxInstruction[GaboxInstruction["SellTokens"] = 6] = "SellTokens";
|
|
2173
|
+
return GaboxInstruction;
|
|
2174
|
+
}({});
|
|
2175
|
+
function identifyGaboxInstruction(instruction) {
|
|
2176
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
2177
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2178
|
+
151,
|
|
2179
|
+
46,
|
|
2180
|
+
141,
|
|
2181
|
+
93,
|
|
2182
|
+
174,
|
|
2183
|
+
5,
|
|
2184
|
+
49,
|
|
2185
|
+
173
|
|
2186
|
+
])), 0)) return 0;
|
|
2187
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2188
|
+
113,
|
|
2189
|
+
181,
|
|
2190
|
+
226,
|
|
2191
|
+
173,
|
|
2192
|
+
237,
|
|
2193
|
+
138,
|
|
2194
|
+
199,
|
|
2195
|
+
51
|
|
2196
|
+
])), 0)) return 1;
|
|
2197
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2198
|
+
100,
|
|
2199
|
+
119,
|
|
2200
|
+
235,
|
|
2201
|
+
75,
|
|
2202
|
+
8,
|
|
2203
|
+
25,
|
|
2204
|
+
252,
|
|
2205
|
+
255
|
|
2206
|
+
])), 0)) return 2;
|
|
2207
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2208
|
+
163,
|
|
2209
|
+
225,
|
|
2210
|
+
193,
|
|
2211
|
+
125,
|
|
2212
|
+
144,
|
|
2213
|
+
171,
|
|
2214
|
+
29,
|
|
2215
|
+
241
|
|
2216
|
+
])), 0)) return 3;
|
|
2217
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2218
|
+
95,
|
|
2219
|
+
180,
|
|
2220
|
+
10,
|
|
2221
|
+
172,
|
|
2222
|
+
84,
|
|
2223
|
+
174,
|
|
2224
|
+
232,
|
|
2225
|
+
40
|
|
2226
|
+
])), 0)) return 4;
|
|
2227
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2228
|
+
112,
|
|
2229
|
+
118,
|
|
2230
|
+
137,
|
|
2231
|
+
120,
|
|
2232
|
+
211,
|
|
2233
|
+
39,
|
|
2234
|
+
196,
|
|
2235
|
+
96
|
|
2236
|
+
])), 0)) return 5;
|
|
2237
|
+
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2238
|
+
114,
|
|
2239
|
+
242,
|
|
2240
|
+
25,
|
|
2241
|
+
12,
|
|
2242
|
+
62,
|
|
2243
|
+
126,
|
|
2244
|
+
92,
|
|
2245
|
+
2
|
|
2246
|
+
])), 0)) return 6;
|
|
2247
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
2248
|
+
instructionData: data,
|
|
2249
|
+
programName: "gabox"
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
function parseGaboxInstruction(instruction) {
|
|
2253
|
+
const instructionType = identifyGaboxInstruction(instruction);
|
|
2254
|
+
switch (instructionType) {
|
|
2255
|
+
case 0:
|
|
2256
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2257
|
+
return {
|
|
2258
|
+
instructionType: 0,
|
|
2259
|
+
...parseBuyPackInstruction(instruction)
|
|
2260
|
+
};
|
|
2261
|
+
case 1:
|
|
2262
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2263
|
+
return {
|
|
2264
|
+
instructionType: 1,
|
|
2265
|
+
...parseDeliverDrawInstruction(instruction)
|
|
2266
|
+
};
|
|
2267
|
+
case 2:
|
|
2268
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2269
|
+
return {
|
|
2270
|
+
instructionType: 2,
|
|
2271
|
+
...parseExpireDrawInstruction(instruction)
|
|
2272
|
+
};
|
|
2273
|
+
case 3:
|
|
2274
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2275
|
+
return {
|
|
2276
|
+
instructionType: 3,
|
|
2277
|
+
...parseFundPrizesInstruction(instruction)
|
|
2278
|
+
};
|
|
2279
|
+
case 4:
|
|
2280
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2281
|
+
return {
|
|
2282
|
+
instructionType: 4,
|
|
2283
|
+
...parseInitializePoolInstruction(instruction)
|
|
2284
|
+
};
|
|
2285
|
+
case 5:
|
|
2286
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2287
|
+
return {
|
|
2288
|
+
instructionType: 5,
|
|
2289
|
+
...parseRetryDrawInstruction(instruction)
|
|
2290
|
+
};
|
|
2291
|
+
case 6:
|
|
2292
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2293
|
+
return {
|
|
2294
|
+
instructionType: 6,
|
|
2295
|
+
...parseSellTokensInstruction(instruction)
|
|
2296
|
+
};
|
|
2297
|
+
default: throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
2298
|
+
instructionType,
|
|
2299
|
+
programName: "gabox"
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
function gaboxProgram() {
|
|
2304
|
+
return (client) => {
|
|
2305
|
+
return extendClient(client, { gabox: {
|
|
2306
|
+
accounts: {
|
|
2307
|
+
draw: addSelfFetchFunctions(client, getDrawCodec()),
|
|
2308
|
+
pool: addSelfFetchFunctions(client, getPoolCodec()),
|
|
2309
|
+
walletActivity: addSelfFetchFunctions(client, getWalletActivityCodec())
|
|
2310
|
+
},
|
|
2311
|
+
instructions: {
|
|
2312
|
+
buyPack: (input) => addSelfPlanAndSendFunctions(client, getBuyPackInstructionAsync(input)),
|
|
2313
|
+
deliverDraw: (input) => addSelfPlanAndSendFunctions(client, getDeliverDrawInstructionAsync(input)),
|
|
2314
|
+
expireDraw: (input) => addSelfPlanAndSendFunctions(client, getExpireDrawInstructionAsync(input)),
|
|
2315
|
+
fundPrizes: (input) => addSelfPlanAndSendFunctions(client, getFundPrizesInstructionAsync(input)),
|
|
2316
|
+
initializePool: (input) => addSelfPlanAndSendFunctions(client, getInitializePoolInstructionAsync(input)),
|
|
2317
|
+
retryDraw: (input) => addSelfPlanAndSendFunctions(client, getRetryDrawInstructionAsync({
|
|
2318
|
+
...input,
|
|
2319
|
+
payer: input.payer ?? client.payer
|
|
2320
|
+
})),
|
|
2321
|
+
sellTokens: (input) => addSelfPlanAndSendFunctions(client, getSellTokensInstructionAsync(input))
|
|
2322
|
+
},
|
|
2323
|
+
pdas: {
|
|
2324
|
+
pool: findPoolPda,
|
|
2325
|
+
activity: findActivityPda,
|
|
2326
|
+
identity: findIdentityPda,
|
|
2327
|
+
draw: findDrawPda
|
|
2328
|
+
},
|
|
2329
|
+
identifyAccount: identifyGaboxAccount,
|
|
2330
|
+
identifyInstruction: identifyGaboxInstruction,
|
|
2331
|
+
parseInstruction: parseGaboxInstruction
|
|
2332
|
+
} });
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
//#endregion
|
|
2336
|
+
export { getDeliverDrawInstructionAsync as $, getPrizeDecoder as $t, getInitializePoolInstructionDataCodec as A, fetchAllPool as At, getFundPrizesInstructionDataEncoder as B, fetchAllDraw as Bt, getRetryDrawInstructionDataDecoder as C, getWalletActivityDecoder as Ct, getInitializePoolDiscriminatorBytes as D, POOL_DISCRIMINATOR as Dt, INITIALIZE_POOL_DISCRIMINATOR as E, getWalletActivitySize as Et, getFundPrizesDiscriminatorBytes as F, getPoolDiscriminatorBytes as Ft, getExpireDrawInstructionAsync as G, getDrawDecoder as Gt, EXPIRE_DRAW_DISCRIMINATOR as H, fetchDraw as Ht, getFundPrizesInstruction as I, getPoolEncoder as It, getExpireDrawInstructionDataEncoder as J, getDrawSize as Jt, getExpireDrawInstructionDataCodec as K, getDrawDiscriminatorBytes as Kt, getFundPrizesInstructionAsync as L, getPoolSize as Lt, getInitializePoolInstructionDataEncoder as M, fetchPool as Mt, parseInitializePoolInstruction as N, getPoolCodec as Nt, getInitializePoolInstruction as O, decodePool as Ot, FUND_PRIZES_DISCRIMINATOR as P, getPoolDecoder as Pt, getDeliverDrawInstruction as Q, getPrizeCodec as Qt, getFundPrizesInstructionDataCodec as R, DRAW_DISCRIMINATOR as Rt, getRetryDrawInstructionDataCodec as S, getWalletActivityCodec as St, parseRetryDrawInstruction as T, getWalletActivityEncoder as Tt, getExpireDrawDiscriminatorBytes as U, fetchMaybeDraw as Ut, parseFundPrizesInstruction as V, fetchAllMaybeDraw as Vt, getExpireDrawInstruction as W, getDrawCodec as Wt, DELIVER_DRAW_DISCRIMINATOR as X, getTierDecoder as Xt, parseExpireDrawInstruction as Y, getTierCodec as Yt, getDeliverDrawDiscriminatorBytes as Z, getTierEncoder as Zt, parseSellTokensInstruction as _, decodeWalletActivity as _t, gaboxProgram as a, getBuyPackDiscriminatorBytes as at, getRetryDrawInstruction as b, fetchMaybeWalletActivity as bt, identifyGaboxInstruction as c, getBuyPackInstructionDataCodec as ct, getSellTokensDiscriminatorBytes as d, parseBuyPackInstruction as dt, getPrizeEncoder as en, getDeliverDrawInstructionDataCodec as et, getSellTokensInstruction as f, findPoolPda as ft, getSellTokensInstructionDataEncoder as g, WALLET_ACTIVITY_DISCRIMINATOR as gt, getSellTokensInstructionDataDecoder as h, findActivityPda as ht, GaboxInstruction as i, BUY_PACK_DISCRIMINATOR as it, getInitializePoolInstructionDataDecoder as j, fetchMaybePool as jt, getInitializePoolInstructionAsync as k, fetchAllMaybePool as kt, parseGaboxInstruction as l, getBuyPackInstructionDataDecoder as lt, getSellTokensInstructionDataCodec as m, findDrawPda as mt, GaboxAccount as n, getDeliverDrawInstructionDataEncoder as nt, identifyGaboxAccount as o, getBuyPackInstruction as ot, getSellTokensInstructionAsync as p, findIdentityPda as pt, getExpireDrawInstructionDataDecoder as q, getDrawEncoder as qt, GaboxEvent as r, parseDeliverDrawInstruction as rt, identifyGaboxEvent as s, getBuyPackInstructionAsync as st, GABOX_PROGRAM_ADDRESS as t, getDeliverDrawInstructionDataDecoder as tt, SELL_TOKENS_DISCRIMINATOR as u, getBuyPackInstructionDataEncoder as ut, RETRY_DRAW_DISCRIMINATOR as v, fetchAllMaybeWalletActivity as vt, getRetryDrawInstructionDataEncoder as w, getWalletActivityDiscriminatorBytes as wt, getRetryDrawInstructionAsync as x, fetchWalletActivity as xt, getRetryDrawDiscriminatorBytes as y, fetchAllWalletActivity as yt, getFundPrizesInstructionDataDecoder as z, decodeDraw as zt };
|
|
2337
|
+
|
|
2338
|
+
//# sourceMappingURL=gabox-DGTCh34U.js.map
|