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