@gabox-labs/sdk 0.1.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +249 -1
- package/README.md +116 -458
- package/dist/generated/index.d.ts +334 -755
- package/dist/generated/index.js +2403 -338
- package/dist/generated/index.js.map +1 -1
- package/dist/index-BDfGvmgF.d.ts +934 -0
- package/dist/index.d.ts +211 -472
- package/dist/index.js +539 -1093
- package/dist/index.js.map +1 -1
- package/dist/raydium/index.d.ts +2 -0
- package/dist/raydium/index.js +2 -0
- package/dist/raydium-B-l9V3O-.js +2604 -0
- package/dist/raydium-B-l9V3O-.js.map +1 -0
- package/llms.txt +4 -2
- package/package.json +11 -16
- package/skills/gabox-sdk/SKILL.md +40 -141
- package/skills/gabox-sdk/references/api.md +102 -145
- package/dist/gaboxV2-CV2XltqC.js +0 -3347
- package/dist/gaboxV2-CV2XltqC.js.map +0 -1
- package/dist/index-BxvSkzCO.d.ts +0 -471
- package/dist/pump/index.d.ts +0 -2
- package/dist/pump/index.js +0 -2
- package/dist/pump-D0K_0uiC.js +0 -1531
- package/dist/pump-D0K_0uiC.js.map +0 -1
package/dist/gaboxV2-CV2XltqC.js
DELETED
|
@@ -1,3347 +0,0 @@
|
|
|
1
|
-
import { SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, SolanaError, assertAccountExists, assertAccountsExist, assertIsInstructionWithAccounts, combineCodec, containsBytes, decodeAccount, extendClient, fetchEncodedAccount, fetchEncodedAccounts, fixDecoderSize, fixEncoderSize, getAddressDecoder, getAddressEncoder, getArrayDecoder, getArrayEncoder, getBooleanDecoder, getBooleanEncoder, getBytesDecoder, getBytesEncoder, getEnumDecoder, getEnumEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, getU16Decoder, getU16Encoder, getU32Decoder, getU32Encoder, getU64Decoder, getU64Encoder, getU8Decoder, getU8Encoder, transformEncoder } from "@solana/kit";
|
|
2
|
-
import { addSelfFetchFunctions, addSelfPlanAndSendFunctions, getAccountMetaFactory, getAddressFromResolvedInstructionAccount, getNonNullResolvedInstructionInput } from "@solana/program-client-core";
|
|
3
|
-
//#region src/generated/types/drawStatus.ts
|
|
4
|
-
/**
|
|
5
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
6
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
7
|
-
* to add features, then rerun Codama to update it.
|
|
8
|
-
*
|
|
9
|
-
* @see https://github.com/codama-idl/codama
|
|
10
|
-
*/
|
|
11
|
-
let DrawStatus = /* @__PURE__ */ function(DrawStatus) {
|
|
12
|
-
DrawStatus[DrawStatus["Pending"] = 0] = "Pending";
|
|
13
|
-
DrawStatus[DrawStatus["Ready"] = 1] = "Ready";
|
|
14
|
-
return DrawStatus;
|
|
15
|
-
}({});
|
|
16
|
-
function getDrawStatusEncoder() {
|
|
17
|
-
return getEnumEncoder(DrawStatus);
|
|
18
|
-
}
|
|
19
|
-
function getDrawStatusDecoder() {
|
|
20
|
-
return getEnumDecoder(DrawStatus);
|
|
21
|
-
}
|
|
22
|
-
function getDrawStatusCodec() {
|
|
23
|
-
return combineCodec(getDrawStatusEncoder(), getDrawStatusDecoder());
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region src/generated/types/prize.ts
|
|
27
|
-
/**
|
|
28
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
29
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
30
|
-
* to add features, then rerun Codama to update it.
|
|
31
|
-
*
|
|
32
|
-
* @see https://github.com/codama-idl/codama
|
|
33
|
-
*/
|
|
34
|
-
function getPrizeEncoder() {
|
|
35
|
-
return getStructEncoder([["amount", getU64Encoder()], ["tickets", getU32Encoder()]]);
|
|
36
|
-
}
|
|
37
|
-
function getPrizeDecoder() {
|
|
38
|
-
return getStructDecoder([["amount", getU64Decoder()], ["tickets", getU32Decoder()]]);
|
|
39
|
-
}
|
|
40
|
-
function getPrizeCodec() {
|
|
41
|
-
return combineCodec(getPrizeEncoder(), getPrizeDecoder());
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/generated/types/tier.ts
|
|
45
|
-
/**
|
|
46
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
47
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
48
|
-
* to add features, then rerun Codama to update it.
|
|
49
|
-
*
|
|
50
|
-
* @see https://github.com/codama-idl/codama
|
|
51
|
-
*/
|
|
52
|
-
function getTierEncoder() {
|
|
53
|
-
return getStructEncoder([["multiplierBps", getU32Encoder()], ["tickets", getU32Encoder()]]);
|
|
54
|
-
}
|
|
55
|
-
function getTierDecoder() {
|
|
56
|
-
return getStructDecoder([["multiplierBps", getU32Decoder()], ["tickets", getU32Decoder()]]);
|
|
57
|
-
}
|
|
58
|
-
function getTierCodec() {
|
|
59
|
-
return combineCodec(getTierEncoder(), getTierDecoder());
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
//#region src/generated/accounts/draw.ts
|
|
63
|
-
/**
|
|
64
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
65
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
66
|
-
* to add features, then rerun Codama to update it.
|
|
67
|
-
*
|
|
68
|
-
* @see https://github.com/codama-idl/codama
|
|
69
|
-
*/
|
|
70
|
-
const DRAW_DISCRIMINATOR = new Uint8Array([
|
|
71
|
-
225,
|
|
72
|
-
131,
|
|
73
|
-
41,
|
|
74
|
-
222,
|
|
75
|
-
122,
|
|
76
|
-
20,
|
|
77
|
-
146,
|
|
78
|
-
202
|
|
79
|
-
]);
|
|
80
|
-
function getDrawDiscriminatorBytes() {
|
|
81
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(DRAW_DISCRIMINATOR);
|
|
82
|
-
}
|
|
83
|
-
/** Gets the encoder for {@link DrawArgs} account data. */
|
|
84
|
-
function getDrawEncoder() {
|
|
85
|
-
return transformEncoder(getStructEncoder([
|
|
86
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
87
|
-
["pool", getAddressEncoder()],
|
|
88
|
-
["purchaser", getAddressEncoder()],
|
|
89
|
-
["seq", getU64Encoder()],
|
|
90
|
-
["bump", getU8Encoder()],
|
|
91
|
-
["status", getDrawStatusEncoder()],
|
|
92
|
-
["requestSlot", getU64Encoder()],
|
|
93
|
-
["lastAttemptSlot", getU64Encoder()],
|
|
94
|
-
["attempts", getU8Encoder()],
|
|
95
|
-
["maximum", getU64Encoder()],
|
|
96
|
-
["minimum", getU64Encoder()],
|
|
97
|
-
["prizes", getArrayEncoder(getPrizeEncoder(), { size: 8 })],
|
|
98
|
-
["amount", getU64Encoder()],
|
|
99
|
-
["randomness", fixEncoderSize(getBytesEncoder(), 32)],
|
|
100
|
-
["timedOut", getBooleanEncoder()]
|
|
101
|
-
]), (value) => ({
|
|
102
|
-
...value,
|
|
103
|
-
discriminator: DRAW_DISCRIMINATOR
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
/** Gets the decoder for {@link Draw} account data. */
|
|
107
|
-
function getDrawDecoder() {
|
|
108
|
-
return getStructDecoder([
|
|
109
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
110
|
-
["pool", getAddressDecoder()],
|
|
111
|
-
["purchaser", getAddressDecoder()],
|
|
112
|
-
["seq", getU64Decoder()],
|
|
113
|
-
["bump", getU8Decoder()],
|
|
114
|
-
["status", getDrawStatusDecoder()],
|
|
115
|
-
["requestSlot", getU64Decoder()],
|
|
116
|
-
["lastAttemptSlot", getU64Decoder()],
|
|
117
|
-
["attempts", getU8Decoder()],
|
|
118
|
-
["maximum", getU64Decoder()],
|
|
119
|
-
["minimum", getU64Decoder()],
|
|
120
|
-
["prizes", getArrayDecoder(getPrizeDecoder(), { size: 8 })],
|
|
121
|
-
["amount", getU64Decoder()],
|
|
122
|
-
["randomness", fixDecoderSize(getBytesDecoder(), 32)],
|
|
123
|
-
["timedOut", getBooleanDecoder()]
|
|
124
|
-
]);
|
|
125
|
-
}
|
|
126
|
-
/** Gets the codec for {@link Draw} account data. */
|
|
127
|
-
function getDrawCodec() {
|
|
128
|
-
return combineCodec(getDrawEncoder(), getDrawDecoder());
|
|
129
|
-
}
|
|
130
|
-
function decodeDraw(encodedAccount) {
|
|
131
|
-
return decodeAccount(encodedAccount, getDrawDecoder());
|
|
132
|
-
}
|
|
133
|
-
async function fetchDraw(rpc, address, config) {
|
|
134
|
-
const maybeAccount = await fetchMaybeDraw(rpc, address, config);
|
|
135
|
-
assertAccountExists(maybeAccount);
|
|
136
|
-
return maybeAccount;
|
|
137
|
-
}
|
|
138
|
-
async function fetchMaybeDraw(rpc, address, config) {
|
|
139
|
-
return decodeDraw(await fetchEncodedAccount(rpc, address, config));
|
|
140
|
-
}
|
|
141
|
-
async function fetchAllDraw(rpc, addresses, config) {
|
|
142
|
-
const maybeAccounts = await fetchAllMaybeDraw(rpc, addresses, config);
|
|
143
|
-
assertAccountsExist(maybeAccounts);
|
|
144
|
-
return maybeAccounts;
|
|
145
|
-
}
|
|
146
|
-
async function fetchAllMaybeDraw(rpc, addresses, config) {
|
|
147
|
-
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeDraw(maybeAccount));
|
|
148
|
-
}
|
|
149
|
-
function getDrawSize() {
|
|
150
|
-
return 252;
|
|
151
|
-
}
|
|
152
|
-
//#endregion
|
|
153
|
-
//#region src/generated/accounts/pool.ts
|
|
154
|
-
/**
|
|
155
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
156
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
157
|
-
* to add features, then rerun Codama to update it.
|
|
158
|
-
*
|
|
159
|
-
* @see https://github.com/codama-idl/codama
|
|
160
|
-
*/
|
|
161
|
-
const POOL_DISCRIMINATOR = new Uint8Array([
|
|
162
|
-
241,
|
|
163
|
-
154,
|
|
164
|
-
109,
|
|
165
|
-
4,
|
|
166
|
-
17,
|
|
167
|
-
177,
|
|
168
|
-
109,
|
|
169
|
-
188
|
|
170
|
-
]);
|
|
171
|
-
function getPoolDiscriminatorBytes() {
|
|
172
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(POOL_DISCRIMINATOR);
|
|
173
|
-
}
|
|
174
|
-
/** Gets the encoder for {@link PoolArgs} account data. */
|
|
175
|
-
function getPoolEncoder() {
|
|
176
|
-
return transformEncoder(getStructEncoder([
|
|
177
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
178
|
-
["creator", getAddressEncoder()],
|
|
179
|
-
["mint", getAddressEncoder()],
|
|
180
|
-
["tokenProgram", getAddressEncoder()],
|
|
181
|
-
["vault", getAddressEncoder()],
|
|
182
|
-
["bump", getU8Encoder()],
|
|
183
|
-
["packTokens", getU64Encoder()],
|
|
184
|
-
["feeBps", getU16Encoder()],
|
|
185
|
-
["seedLamports", getU64Encoder()],
|
|
186
|
-
["seedTokens", getU64Encoder()],
|
|
187
|
-
["tiers", getArrayEncoder(getTierEncoder(), { size: 8 })],
|
|
188
|
-
["nextSeq", getU64Encoder()],
|
|
189
|
-
["reserved", getU64Encoder()]
|
|
190
|
-
]), (value) => ({
|
|
191
|
-
...value,
|
|
192
|
-
discriminator: POOL_DISCRIMINATOR
|
|
193
|
-
}));
|
|
194
|
-
}
|
|
195
|
-
/** Gets the decoder for {@link Pool} account data. */
|
|
196
|
-
function getPoolDecoder() {
|
|
197
|
-
return getStructDecoder([
|
|
198
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
199
|
-
["creator", getAddressDecoder()],
|
|
200
|
-
["mint", getAddressDecoder()],
|
|
201
|
-
["tokenProgram", getAddressDecoder()],
|
|
202
|
-
["vault", getAddressDecoder()],
|
|
203
|
-
["bump", getU8Decoder()],
|
|
204
|
-
["packTokens", getU64Decoder()],
|
|
205
|
-
["feeBps", getU16Decoder()],
|
|
206
|
-
["seedLamports", getU64Decoder()],
|
|
207
|
-
["seedTokens", getU64Decoder()],
|
|
208
|
-
["tiers", getArrayDecoder(getTierDecoder(), { size: 8 })],
|
|
209
|
-
["nextSeq", getU64Decoder()],
|
|
210
|
-
["reserved", getU64Decoder()]
|
|
211
|
-
]);
|
|
212
|
-
}
|
|
213
|
-
/** Gets the codec for {@link Pool} account data. */
|
|
214
|
-
function getPoolCodec() {
|
|
215
|
-
return combineCodec(getPoolEncoder(), getPoolDecoder());
|
|
216
|
-
}
|
|
217
|
-
function decodePool(encodedAccount) {
|
|
218
|
-
return decodeAccount(encodedAccount, getPoolDecoder());
|
|
219
|
-
}
|
|
220
|
-
async function fetchPool(rpc, address, config) {
|
|
221
|
-
const maybeAccount = await fetchMaybePool(rpc, address, config);
|
|
222
|
-
assertAccountExists(maybeAccount);
|
|
223
|
-
return maybeAccount;
|
|
224
|
-
}
|
|
225
|
-
async function fetchMaybePool(rpc, address, config) {
|
|
226
|
-
return decodePool(await fetchEncodedAccount(rpc, address, config));
|
|
227
|
-
}
|
|
228
|
-
async function fetchAllPool(rpc, addresses, config) {
|
|
229
|
-
const maybeAccounts = await fetchAllMaybePool(rpc, addresses, config);
|
|
230
|
-
assertAccountsExist(maybeAccounts);
|
|
231
|
-
return maybeAccounts;
|
|
232
|
-
}
|
|
233
|
-
async function fetchAllMaybePool(rpc, addresses, config) {
|
|
234
|
-
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodePool(maybeAccount));
|
|
235
|
-
}
|
|
236
|
-
function getPoolSize() {
|
|
237
|
-
return 243;
|
|
238
|
-
}
|
|
239
|
-
//#endregion
|
|
240
|
-
//#region src/generated/accounts/referral.ts
|
|
241
|
-
/**
|
|
242
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
243
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
244
|
-
* to add features, then rerun Codama to update it.
|
|
245
|
-
*
|
|
246
|
-
* @see https://github.com/codama-idl/codama
|
|
247
|
-
*/
|
|
248
|
-
const REFERRAL_DISCRIMINATOR = new Uint8Array([
|
|
249
|
-
30,
|
|
250
|
-
235,
|
|
251
|
-
136,
|
|
252
|
-
224,
|
|
253
|
-
106,
|
|
254
|
-
107,
|
|
255
|
-
49,
|
|
256
|
-
64
|
|
257
|
-
]);
|
|
258
|
-
function getReferralDiscriminatorBytes() {
|
|
259
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(REFERRAL_DISCRIMINATOR);
|
|
260
|
-
}
|
|
261
|
-
/** Gets the encoder for {@link ReferralArgs} account data. */
|
|
262
|
-
function getReferralEncoder() {
|
|
263
|
-
return transformEncoder(getStructEncoder([
|
|
264
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
265
|
-
["pool", getAddressEncoder()],
|
|
266
|
-
["referrer", getAddressEncoder()],
|
|
267
|
-
["owed", getU64Encoder()],
|
|
268
|
-
["bump", getU8Encoder()]
|
|
269
|
-
]), (value) => ({
|
|
270
|
-
...value,
|
|
271
|
-
discriminator: REFERRAL_DISCRIMINATOR
|
|
272
|
-
}));
|
|
273
|
-
}
|
|
274
|
-
/** Gets the decoder for {@link Referral} account data. */
|
|
275
|
-
function getReferralDecoder() {
|
|
276
|
-
return getStructDecoder([
|
|
277
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
278
|
-
["pool", getAddressDecoder()],
|
|
279
|
-
["referrer", getAddressDecoder()],
|
|
280
|
-
["owed", getU64Decoder()],
|
|
281
|
-
["bump", getU8Decoder()]
|
|
282
|
-
]);
|
|
283
|
-
}
|
|
284
|
-
/** Gets the codec for {@link Referral} account data. */
|
|
285
|
-
function getReferralCodec() {
|
|
286
|
-
return combineCodec(getReferralEncoder(), getReferralDecoder());
|
|
287
|
-
}
|
|
288
|
-
function decodeReferral(encodedAccount) {
|
|
289
|
-
return decodeAccount(encodedAccount, getReferralDecoder());
|
|
290
|
-
}
|
|
291
|
-
async function fetchReferral(rpc, address, config) {
|
|
292
|
-
const maybeAccount = await fetchMaybeReferral(rpc, address, config);
|
|
293
|
-
assertAccountExists(maybeAccount);
|
|
294
|
-
return maybeAccount;
|
|
295
|
-
}
|
|
296
|
-
async function fetchMaybeReferral(rpc, address, config) {
|
|
297
|
-
return decodeReferral(await fetchEncodedAccount(rpc, address, config));
|
|
298
|
-
}
|
|
299
|
-
async function fetchAllReferral(rpc, addresses, config) {
|
|
300
|
-
const maybeAccounts = await fetchAllMaybeReferral(rpc, addresses, config);
|
|
301
|
-
assertAccountsExist(maybeAccounts);
|
|
302
|
-
return maybeAccounts;
|
|
303
|
-
}
|
|
304
|
-
async function fetchAllMaybeReferral(rpc, addresses, config) {
|
|
305
|
-
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeReferral(maybeAccount));
|
|
306
|
-
}
|
|
307
|
-
function getReferralSize() {
|
|
308
|
-
return 81;
|
|
309
|
-
}
|
|
310
|
-
//#endregion
|
|
311
|
-
//#region src/generated/accounts/referralLink.ts
|
|
312
|
-
/**
|
|
313
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
314
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
315
|
-
* to add features, then rerun Codama to update it.
|
|
316
|
-
*
|
|
317
|
-
* @see https://github.com/codama-idl/codama
|
|
318
|
-
*/
|
|
319
|
-
const REFERRAL_LINK_DISCRIMINATOR = new Uint8Array([
|
|
320
|
-
30,
|
|
321
|
-
231,
|
|
322
|
-
159,
|
|
323
|
-
98,
|
|
324
|
-
189,
|
|
325
|
-
47,
|
|
326
|
-
48,
|
|
327
|
-
5
|
|
328
|
-
]);
|
|
329
|
-
function getReferralLinkDiscriminatorBytes() {
|
|
330
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(REFERRAL_LINK_DISCRIMINATOR);
|
|
331
|
-
}
|
|
332
|
-
/** Gets the encoder for {@link ReferralLinkArgs} account data. */
|
|
333
|
-
function getReferralLinkEncoder() {
|
|
334
|
-
return transformEncoder(getStructEncoder([
|
|
335
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
336
|
-
["referee", getAddressEncoder()],
|
|
337
|
-
["referrer", getAddressEncoder()],
|
|
338
|
-
["bump", getU8Encoder()]
|
|
339
|
-
]), (value) => ({
|
|
340
|
-
...value,
|
|
341
|
-
discriminator: REFERRAL_LINK_DISCRIMINATOR
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
/** Gets the decoder for {@link ReferralLink} account data. */
|
|
345
|
-
function getReferralLinkDecoder() {
|
|
346
|
-
return getStructDecoder([
|
|
347
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
348
|
-
["referee", getAddressDecoder()],
|
|
349
|
-
["referrer", getAddressDecoder()],
|
|
350
|
-
["bump", getU8Decoder()]
|
|
351
|
-
]);
|
|
352
|
-
}
|
|
353
|
-
/** Gets the codec for {@link ReferralLink} account data. */
|
|
354
|
-
function getReferralLinkCodec() {
|
|
355
|
-
return combineCodec(getReferralLinkEncoder(), getReferralLinkDecoder());
|
|
356
|
-
}
|
|
357
|
-
function decodeReferralLink(encodedAccount) {
|
|
358
|
-
return decodeAccount(encodedAccount, getReferralLinkDecoder());
|
|
359
|
-
}
|
|
360
|
-
async function fetchReferralLink(rpc, address, config) {
|
|
361
|
-
const maybeAccount = await fetchMaybeReferralLink(rpc, address, config);
|
|
362
|
-
assertAccountExists(maybeAccount);
|
|
363
|
-
return maybeAccount;
|
|
364
|
-
}
|
|
365
|
-
async function fetchMaybeReferralLink(rpc, address, config) {
|
|
366
|
-
return decodeReferralLink(await fetchEncodedAccount(rpc, address, config));
|
|
367
|
-
}
|
|
368
|
-
async function fetchAllReferralLink(rpc, addresses, config) {
|
|
369
|
-
const maybeAccounts = await fetchAllMaybeReferralLink(rpc, addresses, config);
|
|
370
|
-
assertAccountsExist(maybeAccounts);
|
|
371
|
-
return maybeAccounts;
|
|
372
|
-
}
|
|
373
|
-
async function fetchAllMaybeReferralLink(rpc, addresses, config) {
|
|
374
|
-
return (await fetchEncodedAccounts(rpc, addresses, config)).map((maybeAccount) => decodeReferralLink(maybeAccount));
|
|
375
|
-
}
|
|
376
|
-
function getReferralLinkSize() {
|
|
377
|
-
return 73;
|
|
378
|
-
}
|
|
379
|
-
//#endregion
|
|
380
|
-
//#region src/generated/pdas/claimReferralReferral.ts
|
|
381
|
-
/**
|
|
382
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
383
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
384
|
-
* to add features, then rerun Codama to update it.
|
|
385
|
-
*
|
|
386
|
-
* @see https://github.com/codama-idl/codama
|
|
387
|
-
*/
|
|
388
|
-
async function findClaimReferralReferralPda(seeds, config = {}) {
|
|
389
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
390
|
-
return await getProgramDerivedAddress({
|
|
391
|
-
programAddress,
|
|
392
|
-
seeds: [
|
|
393
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
394
|
-
114,
|
|
395
|
-
101,
|
|
396
|
-
102,
|
|
397
|
-
101,
|
|
398
|
-
114,
|
|
399
|
-
114,
|
|
400
|
-
97,
|
|
401
|
-
108
|
|
402
|
-
])),
|
|
403
|
-
getAddressEncoder().encode(seeds.pool),
|
|
404
|
-
getAddressEncoder().encode(seeds.referrer)
|
|
405
|
-
]
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
//#endregion
|
|
409
|
-
//#region src/generated/pdas/draw.ts
|
|
410
|
-
/**
|
|
411
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
412
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
413
|
-
* to add features, then rerun Codama to update it.
|
|
414
|
-
*
|
|
415
|
-
* @see https://github.com/codama-idl/codama
|
|
416
|
-
*/
|
|
417
|
-
async function findDrawPda(seeds, config = {}) {
|
|
418
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
419
|
-
return await getProgramDerivedAddress({
|
|
420
|
-
programAddress,
|
|
421
|
-
seeds: [
|
|
422
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
423
|
-
100,
|
|
424
|
-
114,
|
|
425
|
-
97,
|
|
426
|
-
119
|
|
427
|
-
])),
|
|
428
|
-
getAddressEncoder().encode(seeds.pool),
|
|
429
|
-
getU64Encoder().encode(seeds.seq)
|
|
430
|
-
]
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region src/generated/pdas/identity.ts
|
|
435
|
-
/**
|
|
436
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
437
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
438
|
-
* to add features, then rerun Codama to update it.
|
|
439
|
-
*
|
|
440
|
-
* @see https://github.com/codama-idl/codama
|
|
441
|
-
*/
|
|
442
|
-
async function findIdentityPda(config = {}) {
|
|
443
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
444
|
-
return await getProgramDerivedAddress({
|
|
445
|
-
programAddress,
|
|
446
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
447
|
-
105,
|
|
448
|
-
100,
|
|
449
|
-
101,
|
|
450
|
-
110,
|
|
451
|
-
116,
|
|
452
|
-
105,
|
|
453
|
-
116,
|
|
454
|
-
121
|
|
455
|
-
]))]
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
//#endregion
|
|
459
|
-
//#region src/generated/pdas/link.ts
|
|
460
|
-
/**
|
|
461
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
462
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
463
|
-
* to add features, then rerun Codama to update it.
|
|
464
|
-
*
|
|
465
|
-
* @see https://github.com/codama-idl/codama
|
|
466
|
-
*/
|
|
467
|
-
async function findLinkPda(seeds, config = {}) {
|
|
468
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
469
|
-
return await getProgramDerivedAddress({
|
|
470
|
-
programAddress,
|
|
471
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
472
|
-
114,
|
|
473
|
-
101,
|
|
474
|
-
102,
|
|
475
|
-
101,
|
|
476
|
-
114,
|
|
477
|
-
114,
|
|
478
|
-
97,
|
|
479
|
-
108
|
|
480
|
-
])), getAddressEncoder().encode(seeds.referee)]
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
//#endregion
|
|
484
|
-
//#region src/generated/pdas/pool.ts
|
|
485
|
-
/**
|
|
486
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
487
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
488
|
-
* to add features, then rerun Codama to update it.
|
|
489
|
-
*
|
|
490
|
-
* @see https://github.com/codama-idl/codama
|
|
491
|
-
*/
|
|
492
|
-
async function findPoolPda(seeds, config = {}) {
|
|
493
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
494
|
-
return await getProgramDerivedAddress({
|
|
495
|
-
programAddress,
|
|
496
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
497
|
-
112,
|
|
498
|
-
111,
|
|
499
|
-
111,
|
|
500
|
-
108
|
|
501
|
-
])), getAddressEncoder().encode(seeds.mint)]
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
//#endregion
|
|
505
|
-
//#region src/generated/pdas/referral.ts
|
|
506
|
-
/**
|
|
507
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
508
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
509
|
-
* to add features, then rerun Codama to update it.
|
|
510
|
-
*
|
|
511
|
-
* @see https://github.com/codama-idl/codama
|
|
512
|
-
*/
|
|
513
|
-
async function findReferralPda(seeds, config = {}) {
|
|
514
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
515
|
-
return await getProgramDerivedAddress({
|
|
516
|
-
programAddress,
|
|
517
|
-
seeds: [
|
|
518
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
519
|
-
114,
|
|
520
|
-
101,
|
|
521
|
-
102,
|
|
522
|
-
101,
|
|
523
|
-
114,
|
|
524
|
-
114,
|
|
525
|
-
97,
|
|
526
|
-
108
|
|
527
|
-
])),
|
|
528
|
-
getAddressEncoder().encode(seeds.pool),
|
|
529
|
-
getAddressEncoder().encode(seeds.referralLink)
|
|
530
|
-
]
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
//#endregion
|
|
534
|
-
//#region src/generated/pdas/referralLink.ts
|
|
535
|
-
/**
|
|
536
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
537
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
538
|
-
* to add features, then rerun Codama to update it.
|
|
539
|
-
*
|
|
540
|
-
* @see https://github.com/codama-idl/codama
|
|
541
|
-
*/
|
|
542
|
-
async function findReferralLinkPda(seeds, config = {}) {
|
|
543
|
-
const { programAddress = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" } = config;
|
|
544
|
-
return await getProgramDerivedAddress({
|
|
545
|
-
programAddress,
|
|
546
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
547
|
-
114,
|
|
548
|
-
101,
|
|
549
|
-
102,
|
|
550
|
-
101,
|
|
551
|
-
114,
|
|
552
|
-
114,
|
|
553
|
-
97,
|
|
554
|
-
108
|
|
555
|
-
])), getAddressEncoder().encode(seeds.purchaser)]
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
//#endregion
|
|
559
|
-
//#region src/generated/instructions/bindReferrer.ts
|
|
560
|
-
/**
|
|
561
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
562
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
563
|
-
* to add features, then rerun Codama to update it.
|
|
564
|
-
*
|
|
565
|
-
* @see https://github.com/codama-idl/codama
|
|
566
|
-
*/
|
|
567
|
-
const BIND_REFERRER_DISCRIMINATOR = new Uint8Array([
|
|
568
|
-
45,
|
|
569
|
-
172,
|
|
570
|
-
18,
|
|
571
|
-
187,
|
|
572
|
-
3,
|
|
573
|
-
160,
|
|
574
|
-
196,
|
|
575
|
-
176
|
|
576
|
-
]);
|
|
577
|
-
function getBindReferrerDiscriminatorBytes() {
|
|
578
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(BIND_REFERRER_DISCRIMINATOR);
|
|
579
|
-
}
|
|
580
|
-
function getBindReferrerInstructionDataEncoder() {
|
|
581
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["referrer", getAddressEncoder()]]), (value) => ({
|
|
582
|
-
...value,
|
|
583
|
-
discriminator: BIND_REFERRER_DISCRIMINATOR
|
|
584
|
-
}));
|
|
585
|
-
}
|
|
586
|
-
function getBindReferrerInstructionDataDecoder() {
|
|
587
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["referrer", getAddressDecoder()]]);
|
|
588
|
-
}
|
|
589
|
-
function getBindReferrerInstructionDataCodec() {
|
|
590
|
-
return combineCodec(getBindReferrerInstructionDataEncoder(), getBindReferrerInstructionDataDecoder());
|
|
591
|
-
}
|
|
592
|
-
async function getBindReferrerInstructionAsync(input, config) {
|
|
593
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
594
|
-
const accounts = {
|
|
595
|
-
referee: {
|
|
596
|
-
value: input.referee ?? null,
|
|
597
|
-
isWritable: true
|
|
598
|
-
},
|
|
599
|
-
link: {
|
|
600
|
-
value: input.link ?? null,
|
|
601
|
-
isWritable: true
|
|
602
|
-
},
|
|
603
|
-
systemProgram: {
|
|
604
|
-
value: input.systemProgram ?? null,
|
|
605
|
-
isWritable: false
|
|
606
|
-
}
|
|
607
|
-
};
|
|
608
|
-
const args = { ...input };
|
|
609
|
-
if (!accounts.link.value) accounts.link.value = await findLinkPda({ referee: getAddressFromResolvedInstructionAccount("referee", accounts.referee.value) }, { programAddress });
|
|
610
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
611
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
612
|
-
return Object.freeze({
|
|
613
|
-
accounts: [
|
|
614
|
-
getAccountMeta("referee", accounts.referee),
|
|
615
|
-
getAccountMeta("link", accounts.link),
|
|
616
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
617
|
-
],
|
|
618
|
-
data: getBindReferrerInstructionDataEncoder().encode(args),
|
|
619
|
-
programAddress
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
function getBindReferrerInstruction(input, config) {
|
|
623
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
624
|
-
const accounts = {
|
|
625
|
-
referee: {
|
|
626
|
-
value: input.referee ?? null,
|
|
627
|
-
isWritable: true
|
|
628
|
-
},
|
|
629
|
-
link: {
|
|
630
|
-
value: input.link ?? null,
|
|
631
|
-
isWritable: true
|
|
632
|
-
},
|
|
633
|
-
systemProgram: {
|
|
634
|
-
value: input.systemProgram ?? null,
|
|
635
|
-
isWritable: false
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
const args = { ...input };
|
|
639
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
640
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
641
|
-
return Object.freeze({
|
|
642
|
-
accounts: [
|
|
643
|
-
getAccountMeta("referee", accounts.referee),
|
|
644
|
-
getAccountMeta("link", accounts.link),
|
|
645
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
646
|
-
],
|
|
647
|
-
data: getBindReferrerInstructionDataEncoder().encode(args),
|
|
648
|
-
programAddress
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
function parseBindReferrerInstruction(instruction) {
|
|
652
|
-
if (instruction.accounts.length < 3) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
653
|
-
actualAccountMetas: instruction.accounts.length,
|
|
654
|
-
expectedAccountMetas: 3
|
|
655
|
-
});
|
|
656
|
-
let accountIndex = 0;
|
|
657
|
-
const getNextAccount = () => {
|
|
658
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
659
|
-
accountIndex += 1;
|
|
660
|
-
return accountMeta;
|
|
661
|
-
};
|
|
662
|
-
return {
|
|
663
|
-
programAddress: instruction.programAddress,
|
|
664
|
-
accounts: {
|
|
665
|
-
referee: getNextAccount(),
|
|
666
|
-
link: getNextAccount(),
|
|
667
|
-
systemProgram: getNextAccount()
|
|
668
|
-
},
|
|
669
|
-
data: getBindReferrerInstructionDataDecoder().decode(instruction.data)
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
//#endregion
|
|
673
|
-
//#region src/generated/instructions/buyPack.ts
|
|
674
|
-
/**
|
|
675
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
676
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
677
|
-
* to add features, then rerun Codama to update it.
|
|
678
|
-
*
|
|
679
|
-
* @see https://github.com/codama-idl/codama
|
|
680
|
-
*/
|
|
681
|
-
const BUY_PACK_DISCRIMINATOR = new Uint8Array([
|
|
682
|
-
151,
|
|
683
|
-
46,
|
|
684
|
-
141,
|
|
685
|
-
93,
|
|
686
|
-
174,
|
|
687
|
-
5,
|
|
688
|
-
49,
|
|
689
|
-
173
|
|
690
|
-
]);
|
|
691
|
-
function getBuyPackDiscriminatorBytes() {
|
|
692
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(BUY_PACK_DISCRIMINATOR);
|
|
693
|
-
}
|
|
694
|
-
function getBuyPackInstructionDataEncoder() {
|
|
695
|
-
return transformEncoder(getStructEncoder([
|
|
696
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
697
|
-
["maxQuoteIn", getU64Encoder()],
|
|
698
|
-
["minMaximum", getU64Encoder()],
|
|
699
|
-
["maxTotalDebit", getU64Encoder()]
|
|
700
|
-
]), (value) => ({
|
|
701
|
-
...value,
|
|
702
|
-
discriminator: BUY_PACK_DISCRIMINATOR
|
|
703
|
-
}));
|
|
704
|
-
}
|
|
705
|
-
function getBuyPackInstructionDataDecoder() {
|
|
706
|
-
return getStructDecoder([
|
|
707
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
708
|
-
["maxQuoteIn", getU64Decoder()],
|
|
709
|
-
["minMaximum", getU64Decoder()],
|
|
710
|
-
["maxTotalDebit", getU64Decoder()]
|
|
711
|
-
]);
|
|
712
|
-
}
|
|
713
|
-
function getBuyPackInstructionDataCodec() {
|
|
714
|
-
return combineCodec(getBuyPackInstructionDataEncoder(), getBuyPackInstructionDataDecoder());
|
|
715
|
-
}
|
|
716
|
-
async function getBuyPackInstructionAsync(input, config) {
|
|
717
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
718
|
-
const accounts = {
|
|
719
|
-
purchaser: {
|
|
720
|
-
value: input.purchaser ?? null,
|
|
721
|
-
isWritable: true
|
|
722
|
-
},
|
|
723
|
-
pool: {
|
|
724
|
-
value: input.pool ?? null,
|
|
725
|
-
isWritable: true
|
|
726
|
-
},
|
|
727
|
-
creator: {
|
|
728
|
-
value: input.creator ?? null,
|
|
729
|
-
isWritable: true
|
|
730
|
-
},
|
|
731
|
-
feeCollector: {
|
|
732
|
-
value: input.feeCollector ?? null,
|
|
733
|
-
isWritable: true
|
|
734
|
-
},
|
|
735
|
-
draw: {
|
|
736
|
-
value: input.draw ?? null,
|
|
737
|
-
isWritable: true
|
|
738
|
-
},
|
|
739
|
-
mint: {
|
|
740
|
-
value: input.mint ?? null,
|
|
741
|
-
isWritable: false
|
|
742
|
-
},
|
|
743
|
-
vault: {
|
|
744
|
-
value: input.vault ?? null,
|
|
745
|
-
isWritable: true
|
|
746
|
-
},
|
|
747
|
-
userTokens: {
|
|
748
|
-
value: input.userTokens ?? null,
|
|
749
|
-
isWritable: true
|
|
750
|
-
},
|
|
751
|
-
venue: {
|
|
752
|
-
value: input.venue ?? null,
|
|
753
|
-
isWritable: false
|
|
754
|
-
},
|
|
755
|
-
identity: {
|
|
756
|
-
value: input.identity ?? null,
|
|
757
|
-
isWritable: false
|
|
758
|
-
},
|
|
759
|
-
queue: {
|
|
760
|
-
value: input.queue ?? null,
|
|
761
|
-
isWritable: true
|
|
762
|
-
},
|
|
763
|
-
program: {
|
|
764
|
-
value: input.program ?? null,
|
|
765
|
-
isWritable: false
|
|
766
|
-
},
|
|
767
|
-
slotHashes: {
|
|
768
|
-
value: input.slotHashes ?? null,
|
|
769
|
-
isWritable: false
|
|
770
|
-
},
|
|
771
|
-
tokenProgram: {
|
|
772
|
-
value: input.tokenProgram ?? null,
|
|
773
|
-
isWritable: false
|
|
774
|
-
},
|
|
775
|
-
associatedTokenProgram: {
|
|
776
|
-
value: input.associatedTokenProgram ?? null,
|
|
777
|
-
isWritable: false
|
|
778
|
-
},
|
|
779
|
-
systemProgram: {
|
|
780
|
-
value: input.systemProgram ?? null,
|
|
781
|
-
isWritable: false
|
|
782
|
-
},
|
|
783
|
-
referralLink: {
|
|
784
|
-
value: input.referralLink ?? null,
|
|
785
|
-
isWritable: false
|
|
786
|
-
},
|
|
787
|
-
referral: {
|
|
788
|
-
value: input.referral ?? null,
|
|
789
|
-
isWritable: true
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
const args = { ...input };
|
|
793
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
794
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
795
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
796
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
797
|
-
seeds: [
|
|
798
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
799
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
800
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
801
|
-
]
|
|
802
|
-
});
|
|
803
|
-
if (!accounts.identity.value) accounts.identity.value = await findIdentityPda({ programAddress });
|
|
804
|
-
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
805
|
-
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
806
|
-
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
807
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
808
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
809
|
-
if (!accounts.referralLink.value) accounts.referralLink.value = await findReferralLinkPda({ purchaser: getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value) }, { programAddress });
|
|
810
|
-
if (!accounts.referral.value) accounts.referral.value = await findReferralPda({
|
|
811
|
-
pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
|
|
812
|
-
referralLink: getAddressFromResolvedInstructionAccount("referralLink", accounts.referralLink.value)
|
|
813
|
-
}, { programAddress });
|
|
814
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
815
|
-
return Object.freeze({
|
|
816
|
-
accounts: [
|
|
817
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
818
|
-
getAccountMeta("pool", accounts.pool),
|
|
819
|
-
getAccountMeta("creator", accounts.creator),
|
|
820
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
821
|
-
getAccountMeta("draw", accounts.draw),
|
|
822
|
-
getAccountMeta("mint", accounts.mint),
|
|
823
|
-
getAccountMeta("vault", accounts.vault),
|
|
824
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
825
|
-
getAccountMeta("venue", accounts.venue),
|
|
826
|
-
getAccountMeta("identity", accounts.identity),
|
|
827
|
-
getAccountMeta("queue", accounts.queue),
|
|
828
|
-
getAccountMeta("program", accounts.program),
|
|
829
|
-
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
830
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
831
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
832
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
833
|
-
getAccountMeta("referralLink", accounts.referralLink),
|
|
834
|
-
getAccountMeta("referral", accounts.referral)
|
|
835
|
-
],
|
|
836
|
-
data: getBuyPackInstructionDataEncoder().encode(args),
|
|
837
|
-
programAddress
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
function getBuyPackInstruction(input, config) {
|
|
841
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
842
|
-
const accounts = {
|
|
843
|
-
purchaser: {
|
|
844
|
-
value: input.purchaser ?? null,
|
|
845
|
-
isWritable: true
|
|
846
|
-
},
|
|
847
|
-
pool: {
|
|
848
|
-
value: input.pool ?? null,
|
|
849
|
-
isWritable: true
|
|
850
|
-
},
|
|
851
|
-
creator: {
|
|
852
|
-
value: input.creator ?? null,
|
|
853
|
-
isWritable: true
|
|
854
|
-
},
|
|
855
|
-
feeCollector: {
|
|
856
|
-
value: input.feeCollector ?? null,
|
|
857
|
-
isWritable: true
|
|
858
|
-
},
|
|
859
|
-
draw: {
|
|
860
|
-
value: input.draw ?? null,
|
|
861
|
-
isWritable: true
|
|
862
|
-
},
|
|
863
|
-
mint: {
|
|
864
|
-
value: input.mint ?? null,
|
|
865
|
-
isWritable: false
|
|
866
|
-
},
|
|
867
|
-
vault: {
|
|
868
|
-
value: input.vault ?? null,
|
|
869
|
-
isWritable: true
|
|
870
|
-
},
|
|
871
|
-
userTokens: {
|
|
872
|
-
value: input.userTokens ?? null,
|
|
873
|
-
isWritable: true
|
|
874
|
-
},
|
|
875
|
-
venue: {
|
|
876
|
-
value: input.venue ?? null,
|
|
877
|
-
isWritable: false
|
|
878
|
-
},
|
|
879
|
-
identity: {
|
|
880
|
-
value: input.identity ?? null,
|
|
881
|
-
isWritable: false
|
|
882
|
-
},
|
|
883
|
-
queue: {
|
|
884
|
-
value: input.queue ?? null,
|
|
885
|
-
isWritable: true
|
|
886
|
-
},
|
|
887
|
-
program: {
|
|
888
|
-
value: input.program ?? null,
|
|
889
|
-
isWritable: false
|
|
890
|
-
},
|
|
891
|
-
slotHashes: {
|
|
892
|
-
value: input.slotHashes ?? null,
|
|
893
|
-
isWritable: false
|
|
894
|
-
},
|
|
895
|
-
tokenProgram: {
|
|
896
|
-
value: input.tokenProgram ?? null,
|
|
897
|
-
isWritable: false
|
|
898
|
-
},
|
|
899
|
-
associatedTokenProgram: {
|
|
900
|
-
value: input.associatedTokenProgram ?? null,
|
|
901
|
-
isWritable: false
|
|
902
|
-
},
|
|
903
|
-
systemProgram: {
|
|
904
|
-
value: input.systemProgram ?? null,
|
|
905
|
-
isWritable: false
|
|
906
|
-
},
|
|
907
|
-
referralLink: {
|
|
908
|
-
value: input.referralLink ?? null,
|
|
909
|
-
isWritable: false
|
|
910
|
-
},
|
|
911
|
-
referral: {
|
|
912
|
-
value: input.referral ?? null,
|
|
913
|
-
isWritable: true
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
const args = { ...input };
|
|
917
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
918
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
919
|
-
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
920
|
-
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
921
|
-
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
922
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
923
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
924
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
925
|
-
return Object.freeze({
|
|
926
|
-
accounts: [
|
|
927
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
928
|
-
getAccountMeta("pool", accounts.pool),
|
|
929
|
-
getAccountMeta("creator", accounts.creator),
|
|
930
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
931
|
-
getAccountMeta("draw", accounts.draw),
|
|
932
|
-
getAccountMeta("mint", accounts.mint),
|
|
933
|
-
getAccountMeta("vault", accounts.vault),
|
|
934
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
935
|
-
getAccountMeta("venue", accounts.venue),
|
|
936
|
-
getAccountMeta("identity", accounts.identity),
|
|
937
|
-
getAccountMeta("queue", accounts.queue),
|
|
938
|
-
getAccountMeta("program", accounts.program),
|
|
939
|
-
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
940
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
941
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
942
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
943
|
-
getAccountMeta("referralLink", accounts.referralLink),
|
|
944
|
-
getAccountMeta("referral", accounts.referral)
|
|
945
|
-
],
|
|
946
|
-
data: getBuyPackInstructionDataEncoder().encode(args),
|
|
947
|
-
programAddress
|
|
948
|
-
});
|
|
949
|
-
}
|
|
950
|
-
function parseBuyPackInstruction(instruction) {
|
|
951
|
-
if (instruction.accounts.length < 18) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
952
|
-
actualAccountMetas: instruction.accounts.length,
|
|
953
|
-
expectedAccountMetas: 18
|
|
954
|
-
});
|
|
955
|
-
let accountIndex = 0;
|
|
956
|
-
const getNextAccount = () => {
|
|
957
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
958
|
-
accountIndex += 1;
|
|
959
|
-
return accountMeta;
|
|
960
|
-
};
|
|
961
|
-
const getNextOptionalAccount = () => {
|
|
962
|
-
const accountMeta = getNextAccount();
|
|
963
|
-
return accountMeta.address === "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA" ? void 0 : accountMeta;
|
|
964
|
-
};
|
|
965
|
-
return {
|
|
966
|
-
programAddress: instruction.programAddress,
|
|
967
|
-
accounts: {
|
|
968
|
-
purchaser: getNextAccount(),
|
|
969
|
-
pool: getNextAccount(),
|
|
970
|
-
creator: getNextAccount(),
|
|
971
|
-
feeCollector: getNextAccount(),
|
|
972
|
-
draw: getNextAccount(),
|
|
973
|
-
mint: getNextAccount(),
|
|
974
|
-
vault: getNextAccount(),
|
|
975
|
-
userTokens: getNextAccount(),
|
|
976
|
-
venue: getNextAccount(),
|
|
977
|
-
identity: getNextAccount(),
|
|
978
|
-
queue: getNextAccount(),
|
|
979
|
-
program: getNextAccount(),
|
|
980
|
-
slotHashes: getNextAccount(),
|
|
981
|
-
tokenProgram: getNextAccount(),
|
|
982
|
-
associatedTokenProgram: getNextAccount(),
|
|
983
|
-
systemProgram: getNextAccount(),
|
|
984
|
-
referralLink: getNextOptionalAccount(),
|
|
985
|
-
referral: getNextOptionalAccount()
|
|
986
|
-
},
|
|
987
|
-
data: getBuyPackInstructionDataDecoder().decode(instruction.data)
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
//#endregion
|
|
991
|
-
//#region src/generated/instructions/claimPrize.ts
|
|
992
|
-
/**
|
|
993
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
994
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
995
|
-
* to add features, then rerun Codama to update it.
|
|
996
|
-
*
|
|
997
|
-
* @see https://github.com/codama-idl/codama
|
|
998
|
-
*/
|
|
999
|
-
const CLAIM_PRIZE_DISCRIMINATOR = new Uint8Array([
|
|
1000
|
-
157,
|
|
1001
|
-
233,
|
|
1002
|
-
139,
|
|
1003
|
-
121,
|
|
1004
|
-
246,
|
|
1005
|
-
62,
|
|
1006
|
-
234,
|
|
1007
|
-
235
|
|
1008
|
-
]);
|
|
1009
|
-
function getClaimPrizeDiscriminatorBytes() {
|
|
1010
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_PRIZE_DISCRIMINATOR);
|
|
1011
|
-
}
|
|
1012
|
-
function getClaimPrizeInstructionDataEncoder() {
|
|
1013
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
1014
|
-
...value,
|
|
1015
|
-
discriminator: CLAIM_PRIZE_DISCRIMINATOR
|
|
1016
|
-
}));
|
|
1017
|
-
}
|
|
1018
|
-
function getClaimPrizeInstructionDataDecoder() {
|
|
1019
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
1020
|
-
}
|
|
1021
|
-
function getClaimPrizeInstructionDataCodec() {
|
|
1022
|
-
return combineCodec(getClaimPrizeInstructionDataEncoder(), getClaimPrizeInstructionDataDecoder());
|
|
1023
|
-
}
|
|
1024
|
-
async function getClaimPrizeInstructionAsync(input, config) {
|
|
1025
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1026
|
-
const accounts = {
|
|
1027
|
-
purchaser: {
|
|
1028
|
-
value: input.purchaser ?? null,
|
|
1029
|
-
isWritable: true
|
|
1030
|
-
},
|
|
1031
|
-
pool: {
|
|
1032
|
-
value: input.pool ?? null,
|
|
1033
|
-
isWritable: true
|
|
1034
|
-
},
|
|
1035
|
-
draw: {
|
|
1036
|
-
value: input.draw ?? null,
|
|
1037
|
-
isWritable: true
|
|
1038
|
-
},
|
|
1039
|
-
mint: {
|
|
1040
|
-
value: input.mint ?? null,
|
|
1041
|
-
isWritable: false
|
|
1042
|
-
},
|
|
1043
|
-
vault: {
|
|
1044
|
-
value: input.vault ?? null,
|
|
1045
|
-
isWritable: true
|
|
1046
|
-
},
|
|
1047
|
-
userTokens: {
|
|
1048
|
-
value: input.userTokens ?? null,
|
|
1049
|
-
isWritable: true
|
|
1050
|
-
},
|
|
1051
|
-
tokenProgram: {
|
|
1052
|
-
value: input.tokenProgram ?? null,
|
|
1053
|
-
isWritable: false
|
|
1054
|
-
},
|
|
1055
|
-
associatedTokenProgram: {
|
|
1056
|
-
value: input.associatedTokenProgram ?? null,
|
|
1057
|
-
isWritable: false
|
|
1058
|
-
},
|
|
1059
|
-
systemProgram: {
|
|
1060
|
-
value: input.systemProgram ?? null,
|
|
1061
|
-
isWritable: false
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1065
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1066
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
1067
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1068
|
-
seeds: [
|
|
1069
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
1070
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
1071
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1072
|
-
]
|
|
1073
|
-
});
|
|
1074
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1075
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1076
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1077
|
-
return Object.freeze({
|
|
1078
|
-
accounts: [
|
|
1079
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1080
|
-
getAccountMeta("pool", accounts.pool),
|
|
1081
|
-
getAccountMeta("draw", accounts.draw),
|
|
1082
|
-
getAccountMeta("mint", accounts.mint),
|
|
1083
|
-
getAccountMeta("vault", accounts.vault),
|
|
1084
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1085
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1086
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
1087
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1088
|
-
],
|
|
1089
|
-
data: getClaimPrizeInstructionDataEncoder().encode({}),
|
|
1090
|
-
programAddress
|
|
1091
|
-
});
|
|
1092
|
-
}
|
|
1093
|
-
function getClaimPrizeInstruction(input, config) {
|
|
1094
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1095
|
-
const accounts = {
|
|
1096
|
-
purchaser: {
|
|
1097
|
-
value: input.purchaser ?? null,
|
|
1098
|
-
isWritable: true
|
|
1099
|
-
},
|
|
1100
|
-
pool: {
|
|
1101
|
-
value: input.pool ?? null,
|
|
1102
|
-
isWritable: true
|
|
1103
|
-
},
|
|
1104
|
-
draw: {
|
|
1105
|
-
value: input.draw ?? null,
|
|
1106
|
-
isWritable: true
|
|
1107
|
-
},
|
|
1108
|
-
mint: {
|
|
1109
|
-
value: input.mint ?? null,
|
|
1110
|
-
isWritable: false
|
|
1111
|
-
},
|
|
1112
|
-
vault: {
|
|
1113
|
-
value: input.vault ?? null,
|
|
1114
|
-
isWritable: true
|
|
1115
|
-
},
|
|
1116
|
-
userTokens: {
|
|
1117
|
-
value: input.userTokens ?? null,
|
|
1118
|
-
isWritable: true
|
|
1119
|
-
},
|
|
1120
|
-
tokenProgram: {
|
|
1121
|
-
value: input.tokenProgram ?? null,
|
|
1122
|
-
isWritable: false
|
|
1123
|
-
},
|
|
1124
|
-
associatedTokenProgram: {
|
|
1125
|
-
value: input.associatedTokenProgram ?? null,
|
|
1126
|
-
isWritable: false
|
|
1127
|
-
},
|
|
1128
|
-
systemProgram: {
|
|
1129
|
-
value: input.systemProgram ?? null,
|
|
1130
|
-
isWritable: false
|
|
1131
|
-
}
|
|
1132
|
-
};
|
|
1133
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1134
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
1135
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1136
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1137
|
-
return Object.freeze({
|
|
1138
|
-
accounts: [
|
|
1139
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1140
|
-
getAccountMeta("pool", accounts.pool),
|
|
1141
|
-
getAccountMeta("draw", accounts.draw),
|
|
1142
|
-
getAccountMeta("mint", accounts.mint),
|
|
1143
|
-
getAccountMeta("vault", accounts.vault),
|
|
1144
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1145
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1146
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
1147
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1148
|
-
],
|
|
1149
|
-
data: getClaimPrizeInstructionDataEncoder().encode({}),
|
|
1150
|
-
programAddress
|
|
1151
|
-
});
|
|
1152
|
-
}
|
|
1153
|
-
function parseClaimPrizeInstruction(instruction) {
|
|
1154
|
-
if (instruction.accounts.length < 9) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1155
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1156
|
-
expectedAccountMetas: 9
|
|
1157
|
-
});
|
|
1158
|
-
let accountIndex = 0;
|
|
1159
|
-
const getNextAccount = () => {
|
|
1160
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1161
|
-
accountIndex += 1;
|
|
1162
|
-
return accountMeta;
|
|
1163
|
-
};
|
|
1164
|
-
return {
|
|
1165
|
-
programAddress: instruction.programAddress,
|
|
1166
|
-
accounts: {
|
|
1167
|
-
purchaser: getNextAccount(),
|
|
1168
|
-
pool: getNextAccount(),
|
|
1169
|
-
draw: getNextAccount(),
|
|
1170
|
-
mint: getNextAccount(),
|
|
1171
|
-
vault: getNextAccount(),
|
|
1172
|
-
userTokens: getNextAccount(),
|
|
1173
|
-
tokenProgram: getNextAccount(),
|
|
1174
|
-
associatedTokenProgram: getNextAccount(),
|
|
1175
|
-
systemProgram: getNextAccount()
|
|
1176
|
-
},
|
|
1177
|
-
data: getClaimPrizeInstructionDataDecoder().decode(instruction.data)
|
|
1178
|
-
};
|
|
1179
|
-
}
|
|
1180
|
-
//#endregion
|
|
1181
|
-
//#region src/generated/instructions/claimReferral.ts
|
|
1182
|
-
/**
|
|
1183
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
1184
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1185
|
-
* to add features, then rerun Codama to update it.
|
|
1186
|
-
*
|
|
1187
|
-
* @see https://github.com/codama-idl/codama
|
|
1188
|
-
*/
|
|
1189
|
-
const CLAIM_REFERRAL_DISCRIMINATOR = new Uint8Array([
|
|
1190
|
-
219,
|
|
1191
|
-
247,
|
|
1192
|
-
18,
|
|
1193
|
-
148,
|
|
1194
|
-
63,
|
|
1195
|
-
247,
|
|
1196
|
-
112,
|
|
1197
|
-
198
|
|
1198
|
-
]);
|
|
1199
|
-
function getClaimReferralDiscriminatorBytes() {
|
|
1200
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(CLAIM_REFERRAL_DISCRIMINATOR);
|
|
1201
|
-
}
|
|
1202
|
-
function getClaimReferralInstructionDataEncoder() {
|
|
1203
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
1204
|
-
...value,
|
|
1205
|
-
discriminator: CLAIM_REFERRAL_DISCRIMINATOR
|
|
1206
|
-
}));
|
|
1207
|
-
}
|
|
1208
|
-
function getClaimReferralInstructionDataDecoder() {
|
|
1209
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
1210
|
-
}
|
|
1211
|
-
function getClaimReferralInstructionDataCodec() {
|
|
1212
|
-
return combineCodec(getClaimReferralInstructionDataEncoder(), getClaimReferralInstructionDataDecoder());
|
|
1213
|
-
}
|
|
1214
|
-
async function getClaimReferralInstructionAsync(input, config) {
|
|
1215
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1216
|
-
const accounts = {
|
|
1217
|
-
referrer: {
|
|
1218
|
-
value: input.referrer ?? null,
|
|
1219
|
-
isWritable: true
|
|
1220
|
-
},
|
|
1221
|
-
pool: {
|
|
1222
|
-
value: input.pool ?? null,
|
|
1223
|
-
isWritable: false
|
|
1224
|
-
},
|
|
1225
|
-
referral: {
|
|
1226
|
-
value: input.referral ?? null,
|
|
1227
|
-
isWritable: true
|
|
1228
|
-
},
|
|
1229
|
-
systemProgram: {
|
|
1230
|
-
value: input.systemProgram ?? null,
|
|
1231
|
-
isWritable: false
|
|
1232
|
-
}
|
|
1233
|
-
};
|
|
1234
|
-
if (!accounts.referral.value) accounts.referral.value = await findClaimReferralReferralPda({
|
|
1235
|
-
pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
|
|
1236
|
-
referrer: getAddressFromResolvedInstructionAccount("referrer", accounts.referrer.value)
|
|
1237
|
-
}, { programAddress });
|
|
1238
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1239
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1240
|
-
return Object.freeze({
|
|
1241
|
-
accounts: [
|
|
1242
|
-
getAccountMeta("referrer", accounts.referrer),
|
|
1243
|
-
getAccountMeta("pool", accounts.pool),
|
|
1244
|
-
getAccountMeta("referral", accounts.referral),
|
|
1245
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1246
|
-
],
|
|
1247
|
-
data: getClaimReferralInstructionDataEncoder().encode({}),
|
|
1248
|
-
programAddress
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
function getClaimReferralInstruction(input, config) {
|
|
1252
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1253
|
-
const accounts = {
|
|
1254
|
-
referrer: {
|
|
1255
|
-
value: input.referrer ?? null,
|
|
1256
|
-
isWritable: true
|
|
1257
|
-
},
|
|
1258
|
-
pool: {
|
|
1259
|
-
value: input.pool ?? null,
|
|
1260
|
-
isWritable: false
|
|
1261
|
-
},
|
|
1262
|
-
referral: {
|
|
1263
|
-
value: input.referral ?? null,
|
|
1264
|
-
isWritable: true
|
|
1265
|
-
},
|
|
1266
|
-
systemProgram: {
|
|
1267
|
-
value: input.systemProgram ?? null,
|
|
1268
|
-
isWritable: false
|
|
1269
|
-
}
|
|
1270
|
-
};
|
|
1271
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1272
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1273
|
-
return Object.freeze({
|
|
1274
|
-
accounts: [
|
|
1275
|
-
getAccountMeta("referrer", accounts.referrer),
|
|
1276
|
-
getAccountMeta("pool", accounts.pool),
|
|
1277
|
-
getAccountMeta("referral", accounts.referral),
|
|
1278
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1279
|
-
],
|
|
1280
|
-
data: getClaimReferralInstructionDataEncoder().encode({}),
|
|
1281
|
-
programAddress
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
function parseClaimReferralInstruction(instruction) {
|
|
1285
|
-
if (instruction.accounts.length < 4) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1286
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1287
|
-
expectedAccountMetas: 4
|
|
1288
|
-
});
|
|
1289
|
-
let accountIndex = 0;
|
|
1290
|
-
const getNextAccount = () => {
|
|
1291
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1292
|
-
accountIndex += 1;
|
|
1293
|
-
return accountMeta;
|
|
1294
|
-
};
|
|
1295
|
-
return {
|
|
1296
|
-
programAddress: instruction.programAddress,
|
|
1297
|
-
accounts: {
|
|
1298
|
-
referrer: getNextAccount(),
|
|
1299
|
-
pool: getNextAccount(),
|
|
1300
|
-
referral: getNextAccount(),
|
|
1301
|
-
systemProgram: getNextAccount()
|
|
1302
|
-
},
|
|
1303
|
-
data: getClaimReferralInstructionDataDecoder().decode(instruction.data)
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
//#endregion
|
|
1307
|
-
//#region src/generated/instructions/deliverDraw.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 DELIVER_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
1316
|
-
113,
|
|
1317
|
-
181,
|
|
1318
|
-
226,
|
|
1319
|
-
173,
|
|
1320
|
-
237,
|
|
1321
|
-
138,
|
|
1322
|
-
199,
|
|
1323
|
-
51
|
|
1324
|
-
]);
|
|
1325
|
-
function getDeliverDrawDiscriminatorBytes() {
|
|
1326
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(DELIVER_DRAW_DISCRIMINATOR);
|
|
1327
|
-
}
|
|
1328
|
-
function getDeliverDrawInstructionDataEncoder() {
|
|
1329
|
-
return transformEncoder(getStructEncoder([
|
|
1330
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1331
|
-
["randomness", fixEncoderSize(getBytesEncoder(), 32)],
|
|
1332
|
-
["seq", getU64Encoder()]
|
|
1333
|
-
]), (value) => ({
|
|
1334
|
-
...value,
|
|
1335
|
-
discriminator: DELIVER_DRAW_DISCRIMINATOR
|
|
1336
|
-
}));
|
|
1337
|
-
}
|
|
1338
|
-
function getDeliverDrawInstructionDataDecoder() {
|
|
1339
|
-
return getStructDecoder([
|
|
1340
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1341
|
-
["randomness", fixDecoderSize(getBytesDecoder(), 32)],
|
|
1342
|
-
["seq", getU64Decoder()]
|
|
1343
|
-
]);
|
|
1344
|
-
}
|
|
1345
|
-
function getDeliverDrawInstructionDataCodec() {
|
|
1346
|
-
return combineCodec(getDeliverDrawInstructionDataEncoder(), getDeliverDrawInstructionDataDecoder());
|
|
1347
|
-
}
|
|
1348
|
-
async function getDeliverDrawInstructionAsync(input, config) {
|
|
1349
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1350
|
-
const accounts = {
|
|
1351
|
-
oracleIdentity: {
|
|
1352
|
-
value: input.oracleIdentity ?? null,
|
|
1353
|
-
isWritable: false
|
|
1354
|
-
},
|
|
1355
|
-
pool: {
|
|
1356
|
-
value: input.pool ?? null,
|
|
1357
|
-
isWritable: true
|
|
1358
|
-
},
|
|
1359
|
-
draw: {
|
|
1360
|
-
value: input.draw ?? null,
|
|
1361
|
-
isWritable: true
|
|
1362
|
-
},
|
|
1363
|
-
purchaser: {
|
|
1364
|
-
value: input.purchaser ?? null,
|
|
1365
|
-
isWritable: true
|
|
1366
|
-
},
|
|
1367
|
-
mint: {
|
|
1368
|
-
value: input.mint ?? null,
|
|
1369
|
-
isWritable: false
|
|
1370
|
-
},
|
|
1371
|
-
vault: {
|
|
1372
|
-
value: input.vault ?? null,
|
|
1373
|
-
isWritable: true
|
|
1374
|
-
},
|
|
1375
|
-
userTokens: {
|
|
1376
|
-
value: input.userTokens ?? null,
|
|
1377
|
-
isWritable: true
|
|
1378
|
-
},
|
|
1379
|
-
tokenProgram: {
|
|
1380
|
-
value: input.tokenProgram ?? null,
|
|
1381
|
-
isWritable: false
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
const args = { ...input };
|
|
1385
|
-
if (!accounts.oracleIdentity.value) accounts.oracleIdentity.value = await getProgramDerivedAddress({
|
|
1386
|
-
programAddress: "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz",
|
|
1387
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
1388
|
-
105,
|
|
1389
|
-
100,
|
|
1390
|
-
101,
|
|
1391
|
-
110,
|
|
1392
|
-
116,
|
|
1393
|
-
105,
|
|
1394
|
-
116,
|
|
1395
|
-
121
|
|
1396
|
-
])), getBytesEncoder().encode(new Uint8Array([
|
|
1397
|
-
231,
|
|
1398
|
-
95,
|
|
1399
|
-
177,
|
|
1400
|
-
105,
|
|
1401
|
-
231,
|
|
1402
|
-
174,
|
|
1403
|
-
80,
|
|
1404
|
-
36,
|
|
1405
|
-
228,
|
|
1406
|
-
6,
|
|
1407
|
-
241,
|
|
1408
|
-
195,
|
|
1409
|
-
89,
|
|
1410
|
-
243,
|
|
1411
|
-
52,
|
|
1412
|
-
57,
|
|
1413
|
-
128,
|
|
1414
|
-
219,
|
|
1415
|
-
206,
|
|
1416
|
-
84,
|
|
1417
|
-
115,
|
|
1418
|
-
45,
|
|
1419
|
-
3,
|
|
1420
|
-
217,
|
|
1421
|
-
77,
|
|
1422
|
-
35,
|
|
1423
|
-
38,
|
|
1424
|
-
40,
|
|
1425
|
-
214,
|
|
1426
|
-
248,
|
|
1427
|
-
69,
|
|
1428
|
-
83
|
|
1429
|
-
]))]
|
|
1430
|
-
});
|
|
1431
|
-
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1432
|
-
if (!accounts.draw.value) accounts.draw.value = await findDrawPda({
|
|
1433
|
-
pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
|
|
1434
|
-
seq: getNonNullResolvedInstructionInput("seq", args.seq)
|
|
1435
|
-
}, { programAddress });
|
|
1436
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1437
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
1438
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1439
|
-
seeds: [
|
|
1440
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
1441
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
1442
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1443
|
-
]
|
|
1444
|
-
});
|
|
1445
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1446
|
-
return Object.freeze({
|
|
1447
|
-
accounts: [
|
|
1448
|
-
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
1449
|
-
getAccountMeta("pool", accounts.pool),
|
|
1450
|
-
getAccountMeta("draw", accounts.draw),
|
|
1451
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1452
|
-
getAccountMeta("mint", accounts.mint),
|
|
1453
|
-
getAccountMeta("vault", accounts.vault),
|
|
1454
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1455
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1456
|
-
],
|
|
1457
|
-
data: getDeliverDrawInstructionDataEncoder().encode(args),
|
|
1458
|
-
programAddress
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
function getDeliverDrawInstruction(input, config) {
|
|
1462
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1463
|
-
const accounts = {
|
|
1464
|
-
oracleIdentity: {
|
|
1465
|
-
value: input.oracleIdentity ?? null,
|
|
1466
|
-
isWritable: false
|
|
1467
|
-
},
|
|
1468
|
-
pool: {
|
|
1469
|
-
value: input.pool ?? null,
|
|
1470
|
-
isWritable: true
|
|
1471
|
-
},
|
|
1472
|
-
draw: {
|
|
1473
|
-
value: input.draw ?? null,
|
|
1474
|
-
isWritable: true
|
|
1475
|
-
},
|
|
1476
|
-
purchaser: {
|
|
1477
|
-
value: input.purchaser ?? null,
|
|
1478
|
-
isWritable: true
|
|
1479
|
-
},
|
|
1480
|
-
mint: {
|
|
1481
|
-
value: input.mint ?? null,
|
|
1482
|
-
isWritable: false
|
|
1483
|
-
},
|
|
1484
|
-
vault: {
|
|
1485
|
-
value: input.vault ?? null,
|
|
1486
|
-
isWritable: true
|
|
1487
|
-
},
|
|
1488
|
-
userTokens: {
|
|
1489
|
-
value: input.userTokens ?? null,
|
|
1490
|
-
isWritable: true
|
|
1491
|
-
},
|
|
1492
|
-
tokenProgram: {
|
|
1493
|
-
value: input.tokenProgram ?? null,
|
|
1494
|
-
isWritable: false
|
|
1495
|
-
}
|
|
1496
|
-
};
|
|
1497
|
-
const args = { ...input };
|
|
1498
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1499
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1500
|
-
return Object.freeze({
|
|
1501
|
-
accounts: [
|
|
1502
|
-
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
1503
|
-
getAccountMeta("pool", accounts.pool),
|
|
1504
|
-
getAccountMeta("draw", accounts.draw),
|
|
1505
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1506
|
-
getAccountMeta("mint", accounts.mint),
|
|
1507
|
-
getAccountMeta("vault", accounts.vault),
|
|
1508
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1509
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1510
|
-
],
|
|
1511
|
-
data: getDeliverDrawInstructionDataEncoder().encode(args),
|
|
1512
|
-
programAddress
|
|
1513
|
-
});
|
|
1514
|
-
}
|
|
1515
|
-
function parseDeliverDrawInstruction(instruction) {
|
|
1516
|
-
if (instruction.accounts.length < 8) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1517
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1518
|
-
expectedAccountMetas: 8
|
|
1519
|
-
});
|
|
1520
|
-
let accountIndex = 0;
|
|
1521
|
-
const getNextAccount = () => {
|
|
1522
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1523
|
-
accountIndex += 1;
|
|
1524
|
-
return accountMeta;
|
|
1525
|
-
};
|
|
1526
|
-
return {
|
|
1527
|
-
programAddress: instruction.programAddress,
|
|
1528
|
-
accounts: {
|
|
1529
|
-
oracleIdentity: getNextAccount(),
|
|
1530
|
-
pool: getNextAccount(),
|
|
1531
|
-
draw: getNextAccount(),
|
|
1532
|
-
purchaser: getNextAccount(),
|
|
1533
|
-
mint: getNextAccount(),
|
|
1534
|
-
vault: getNextAccount(),
|
|
1535
|
-
userTokens: getNextAccount(),
|
|
1536
|
-
tokenProgram: getNextAccount()
|
|
1537
|
-
},
|
|
1538
|
-
data: getDeliverDrawInstructionDataDecoder().decode(instruction.data)
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
//#endregion
|
|
1542
|
-
//#region src/generated/instructions/expireDraw.ts
|
|
1543
|
-
/**
|
|
1544
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
1545
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1546
|
-
* to add features, then rerun Codama to update it.
|
|
1547
|
-
*
|
|
1548
|
-
* @see https://github.com/codama-idl/codama
|
|
1549
|
-
*/
|
|
1550
|
-
const EXPIRE_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
1551
|
-
100,
|
|
1552
|
-
119,
|
|
1553
|
-
235,
|
|
1554
|
-
75,
|
|
1555
|
-
8,
|
|
1556
|
-
25,
|
|
1557
|
-
252,
|
|
1558
|
-
255
|
|
1559
|
-
]);
|
|
1560
|
-
function getExpireDrawDiscriminatorBytes() {
|
|
1561
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(EXPIRE_DRAW_DISCRIMINATOR);
|
|
1562
|
-
}
|
|
1563
|
-
function getExpireDrawInstructionDataEncoder() {
|
|
1564
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({
|
|
1565
|
-
...value,
|
|
1566
|
-
discriminator: EXPIRE_DRAW_DISCRIMINATOR
|
|
1567
|
-
}));
|
|
1568
|
-
}
|
|
1569
|
-
function getExpireDrawInstructionDataDecoder() {
|
|
1570
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)]]);
|
|
1571
|
-
}
|
|
1572
|
-
function getExpireDrawInstructionDataCodec() {
|
|
1573
|
-
return combineCodec(getExpireDrawInstructionDataEncoder(), getExpireDrawInstructionDataDecoder());
|
|
1574
|
-
}
|
|
1575
|
-
async function getExpireDrawInstructionAsync(input, config) {
|
|
1576
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1577
|
-
const accounts = {
|
|
1578
|
-
pool: {
|
|
1579
|
-
value: input.pool ?? null,
|
|
1580
|
-
isWritable: true
|
|
1581
|
-
},
|
|
1582
|
-
draw: {
|
|
1583
|
-
value: input.draw ?? null,
|
|
1584
|
-
isWritable: true
|
|
1585
|
-
},
|
|
1586
|
-
purchaser: {
|
|
1587
|
-
value: input.purchaser ?? null,
|
|
1588
|
-
isWritable: true
|
|
1589
|
-
},
|
|
1590
|
-
mint: {
|
|
1591
|
-
value: input.mint ?? null,
|
|
1592
|
-
isWritable: false
|
|
1593
|
-
},
|
|
1594
|
-
vault: {
|
|
1595
|
-
value: input.vault ?? null,
|
|
1596
|
-
isWritable: true
|
|
1597
|
-
},
|
|
1598
|
-
userTokens: {
|
|
1599
|
-
value: input.userTokens ?? null,
|
|
1600
|
-
isWritable: true
|
|
1601
|
-
},
|
|
1602
|
-
tokenProgram: {
|
|
1603
|
-
value: input.tokenProgram ?? null,
|
|
1604
|
-
isWritable: false
|
|
1605
|
-
}
|
|
1606
|
-
};
|
|
1607
|
-
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
1608
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1609
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
1610
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
1611
|
-
seeds: [
|
|
1612
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
1613
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
1614
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
1615
|
-
]
|
|
1616
|
-
});
|
|
1617
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1618
|
-
return Object.freeze({
|
|
1619
|
-
accounts: [
|
|
1620
|
-
getAccountMeta("pool", accounts.pool),
|
|
1621
|
-
getAccountMeta("draw", accounts.draw),
|
|
1622
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1623
|
-
getAccountMeta("mint", accounts.mint),
|
|
1624
|
-
getAccountMeta("vault", accounts.vault),
|
|
1625
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1626
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1627
|
-
],
|
|
1628
|
-
data: getExpireDrawInstructionDataEncoder().encode({}),
|
|
1629
|
-
programAddress
|
|
1630
|
-
});
|
|
1631
|
-
}
|
|
1632
|
-
function getExpireDrawInstruction(input, config) {
|
|
1633
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1634
|
-
const accounts = {
|
|
1635
|
-
pool: {
|
|
1636
|
-
value: input.pool ?? null,
|
|
1637
|
-
isWritable: true
|
|
1638
|
-
},
|
|
1639
|
-
draw: {
|
|
1640
|
-
value: input.draw ?? null,
|
|
1641
|
-
isWritable: true
|
|
1642
|
-
},
|
|
1643
|
-
purchaser: {
|
|
1644
|
-
value: input.purchaser ?? null,
|
|
1645
|
-
isWritable: true
|
|
1646
|
-
},
|
|
1647
|
-
mint: {
|
|
1648
|
-
value: input.mint ?? null,
|
|
1649
|
-
isWritable: false
|
|
1650
|
-
},
|
|
1651
|
-
vault: {
|
|
1652
|
-
value: input.vault ?? null,
|
|
1653
|
-
isWritable: true
|
|
1654
|
-
},
|
|
1655
|
-
userTokens: {
|
|
1656
|
-
value: input.userTokens ?? null,
|
|
1657
|
-
isWritable: true
|
|
1658
|
-
},
|
|
1659
|
-
tokenProgram: {
|
|
1660
|
-
value: input.tokenProgram ?? null,
|
|
1661
|
-
isWritable: false
|
|
1662
|
-
}
|
|
1663
|
-
};
|
|
1664
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1665
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1666
|
-
return Object.freeze({
|
|
1667
|
-
accounts: [
|
|
1668
|
-
getAccountMeta("pool", accounts.pool),
|
|
1669
|
-
getAccountMeta("draw", accounts.draw),
|
|
1670
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
1671
|
-
getAccountMeta("mint", accounts.mint),
|
|
1672
|
-
getAccountMeta("vault", accounts.vault),
|
|
1673
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
1674
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1675
|
-
],
|
|
1676
|
-
data: getExpireDrawInstructionDataEncoder().encode({}),
|
|
1677
|
-
programAddress
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
function parseExpireDrawInstruction(instruction) {
|
|
1681
|
-
if (instruction.accounts.length < 7) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1682
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1683
|
-
expectedAccountMetas: 7
|
|
1684
|
-
});
|
|
1685
|
-
let accountIndex = 0;
|
|
1686
|
-
const getNextAccount = () => {
|
|
1687
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1688
|
-
accountIndex += 1;
|
|
1689
|
-
return accountMeta;
|
|
1690
|
-
};
|
|
1691
|
-
return {
|
|
1692
|
-
programAddress: instruction.programAddress,
|
|
1693
|
-
accounts: {
|
|
1694
|
-
pool: getNextAccount(),
|
|
1695
|
-
draw: getNextAccount(),
|
|
1696
|
-
purchaser: getNextAccount(),
|
|
1697
|
-
mint: getNextAccount(),
|
|
1698
|
-
vault: getNextAccount(),
|
|
1699
|
-
userTokens: getNextAccount(),
|
|
1700
|
-
tokenProgram: getNextAccount()
|
|
1701
|
-
},
|
|
1702
|
-
data: getExpireDrawInstructionDataDecoder().decode(instruction.data)
|
|
1703
|
-
};
|
|
1704
|
-
}
|
|
1705
|
-
//#endregion
|
|
1706
|
-
//#region src/generated/instructions/fulfillDraw.ts
|
|
1707
|
-
/**
|
|
1708
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
1709
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1710
|
-
* to add features, then rerun Codama to update it.
|
|
1711
|
-
*
|
|
1712
|
-
* @see https://github.com/codama-idl/codama
|
|
1713
|
-
*/
|
|
1714
|
-
const FULFILL_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
1715
|
-
136,
|
|
1716
|
-
46,
|
|
1717
|
-
22,
|
|
1718
|
-
51,
|
|
1719
|
-
33,
|
|
1720
|
-
153,
|
|
1721
|
-
232,
|
|
1722
|
-
234
|
|
1723
|
-
]);
|
|
1724
|
-
function getFulfillDrawDiscriminatorBytes() {
|
|
1725
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(FULFILL_DRAW_DISCRIMINATOR);
|
|
1726
|
-
}
|
|
1727
|
-
function getFulfillDrawInstructionDataEncoder() {
|
|
1728
|
-
return transformEncoder(getStructEncoder([
|
|
1729
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
1730
|
-
["randomness", fixEncoderSize(getBytesEncoder(), 32)],
|
|
1731
|
-
["seq", getU64Encoder()]
|
|
1732
|
-
]), (value) => ({
|
|
1733
|
-
...value,
|
|
1734
|
-
discriminator: FULFILL_DRAW_DISCRIMINATOR
|
|
1735
|
-
}));
|
|
1736
|
-
}
|
|
1737
|
-
function getFulfillDrawInstructionDataDecoder() {
|
|
1738
|
-
return getStructDecoder([
|
|
1739
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
1740
|
-
["randomness", fixDecoderSize(getBytesDecoder(), 32)],
|
|
1741
|
-
["seq", getU64Decoder()]
|
|
1742
|
-
]);
|
|
1743
|
-
}
|
|
1744
|
-
function getFulfillDrawInstructionDataCodec() {
|
|
1745
|
-
return combineCodec(getFulfillDrawInstructionDataEncoder(), getFulfillDrawInstructionDataDecoder());
|
|
1746
|
-
}
|
|
1747
|
-
async function getFulfillDrawInstructionAsync(input, config) {
|
|
1748
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1749
|
-
const accounts = {
|
|
1750
|
-
oracleIdentity: {
|
|
1751
|
-
value: input.oracleIdentity ?? null,
|
|
1752
|
-
isWritable: false
|
|
1753
|
-
},
|
|
1754
|
-
pool: {
|
|
1755
|
-
value: input.pool ?? null,
|
|
1756
|
-
isWritable: true
|
|
1757
|
-
},
|
|
1758
|
-
draw: {
|
|
1759
|
-
value: input.draw ?? null,
|
|
1760
|
-
isWritable: true
|
|
1761
|
-
}
|
|
1762
|
-
};
|
|
1763
|
-
const args = { ...input };
|
|
1764
|
-
if (!accounts.oracleIdentity.value) accounts.oracleIdentity.value = await getProgramDerivedAddress({
|
|
1765
|
-
programAddress: "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz",
|
|
1766
|
-
seeds: [getBytesEncoder().encode(new Uint8Array([
|
|
1767
|
-
105,
|
|
1768
|
-
100,
|
|
1769
|
-
101,
|
|
1770
|
-
110,
|
|
1771
|
-
116,
|
|
1772
|
-
105,
|
|
1773
|
-
116,
|
|
1774
|
-
121
|
|
1775
|
-
])), getBytesEncoder().encode(new Uint8Array([
|
|
1776
|
-
231,
|
|
1777
|
-
95,
|
|
1778
|
-
177,
|
|
1779
|
-
105,
|
|
1780
|
-
231,
|
|
1781
|
-
174,
|
|
1782
|
-
80,
|
|
1783
|
-
36,
|
|
1784
|
-
228,
|
|
1785
|
-
6,
|
|
1786
|
-
241,
|
|
1787
|
-
195,
|
|
1788
|
-
89,
|
|
1789
|
-
243,
|
|
1790
|
-
52,
|
|
1791
|
-
57,
|
|
1792
|
-
128,
|
|
1793
|
-
219,
|
|
1794
|
-
206,
|
|
1795
|
-
84,
|
|
1796
|
-
115,
|
|
1797
|
-
45,
|
|
1798
|
-
3,
|
|
1799
|
-
217,
|
|
1800
|
-
77,
|
|
1801
|
-
35,
|
|
1802
|
-
38,
|
|
1803
|
-
40,
|
|
1804
|
-
214,
|
|
1805
|
-
248,
|
|
1806
|
-
69,
|
|
1807
|
-
83
|
|
1808
|
-
]))]
|
|
1809
|
-
});
|
|
1810
|
-
if (!accounts.draw.value) accounts.draw.value = await findDrawPda({
|
|
1811
|
-
pool: getAddressFromResolvedInstructionAccount("pool", accounts.pool.value),
|
|
1812
|
-
seq: getNonNullResolvedInstructionInput("seq", args.seq)
|
|
1813
|
-
}, { programAddress });
|
|
1814
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1815
|
-
return Object.freeze({
|
|
1816
|
-
accounts: [
|
|
1817
|
-
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
1818
|
-
getAccountMeta("pool", accounts.pool),
|
|
1819
|
-
getAccountMeta("draw", accounts.draw)
|
|
1820
|
-
],
|
|
1821
|
-
data: getFulfillDrawInstructionDataEncoder().encode(args),
|
|
1822
|
-
programAddress
|
|
1823
|
-
});
|
|
1824
|
-
}
|
|
1825
|
-
function getFulfillDrawInstruction(input, config) {
|
|
1826
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1827
|
-
const accounts = {
|
|
1828
|
-
oracleIdentity: {
|
|
1829
|
-
value: input.oracleIdentity ?? null,
|
|
1830
|
-
isWritable: false
|
|
1831
|
-
},
|
|
1832
|
-
pool: {
|
|
1833
|
-
value: input.pool ?? null,
|
|
1834
|
-
isWritable: true
|
|
1835
|
-
},
|
|
1836
|
-
draw: {
|
|
1837
|
-
value: input.draw ?? null,
|
|
1838
|
-
isWritable: true
|
|
1839
|
-
}
|
|
1840
|
-
};
|
|
1841
|
-
const args = { ...input };
|
|
1842
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1843
|
-
return Object.freeze({
|
|
1844
|
-
accounts: [
|
|
1845
|
-
getAccountMeta("oracleIdentity", accounts.oracleIdentity),
|
|
1846
|
-
getAccountMeta("pool", accounts.pool),
|
|
1847
|
-
getAccountMeta("draw", accounts.draw)
|
|
1848
|
-
],
|
|
1849
|
-
data: getFulfillDrawInstructionDataEncoder().encode(args),
|
|
1850
|
-
programAddress
|
|
1851
|
-
});
|
|
1852
|
-
}
|
|
1853
|
-
function parseFulfillDrawInstruction(instruction) {
|
|
1854
|
-
if (instruction.accounts.length < 3) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1855
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1856
|
-
expectedAccountMetas: 3
|
|
1857
|
-
});
|
|
1858
|
-
let accountIndex = 0;
|
|
1859
|
-
const getNextAccount = () => {
|
|
1860
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1861
|
-
accountIndex += 1;
|
|
1862
|
-
return accountMeta;
|
|
1863
|
-
};
|
|
1864
|
-
return {
|
|
1865
|
-
programAddress: instruction.programAddress,
|
|
1866
|
-
accounts: {
|
|
1867
|
-
oracleIdentity: getNextAccount(),
|
|
1868
|
-
pool: getNextAccount(),
|
|
1869
|
-
draw: getNextAccount()
|
|
1870
|
-
},
|
|
1871
|
-
data: getFulfillDrawInstructionDataDecoder().decode(instruction.data)
|
|
1872
|
-
};
|
|
1873
|
-
}
|
|
1874
|
-
//#endregion
|
|
1875
|
-
//#region src/generated/instructions/fundPrizes.ts
|
|
1876
|
-
/**
|
|
1877
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
1878
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1879
|
-
* to add features, then rerun Codama to update it.
|
|
1880
|
-
*
|
|
1881
|
-
* @see https://github.com/codama-idl/codama
|
|
1882
|
-
*/
|
|
1883
|
-
const FUND_PRIZES_DISCRIMINATOR = new Uint8Array([
|
|
1884
|
-
163,
|
|
1885
|
-
225,
|
|
1886
|
-
193,
|
|
1887
|
-
125,
|
|
1888
|
-
144,
|
|
1889
|
-
171,
|
|
1890
|
-
29,
|
|
1891
|
-
241
|
|
1892
|
-
]);
|
|
1893
|
-
function getFundPrizesDiscriminatorBytes() {
|
|
1894
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(FUND_PRIZES_DISCRIMINATOR);
|
|
1895
|
-
}
|
|
1896
|
-
function getFundPrizesInstructionDataEncoder() {
|
|
1897
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["amount", getU64Encoder()]]), (value) => ({
|
|
1898
|
-
...value,
|
|
1899
|
-
discriminator: FUND_PRIZES_DISCRIMINATOR
|
|
1900
|
-
}));
|
|
1901
|
-
}
|
|
1902
|
-
function getFundPrizesInstructionDataDecoder() {
|
|
1903
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["amount", getU64Decoder()]]);
|
|
1904
|
-
}
|
|
1905
|
-
function getFundPrizesInstructionDataCodec() {
|
|
1906
|
-
return combineCodec(getFundPrizesInstructionDataEncoder(), getFundPrizesInstructionDataDecoder());
|
|
1907
|
-
}
|
|
1908
|
-
function getFundPrizesInstruction(input, config) {
|
|
1909
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
1910
|
-
const accounts = {
|
|
1911
|
-
funder: {
|
|
1912
|
-
value: input.funder ?? null,
|
|
1913
|
-
isWritable: false
|
|
1914
|
-
},
|
|
1915
|
-
pool: {
|
|
1916
|
-
value: input.pool ?? null,
|
|
1917
|
-
isWritable: false
|
|
1918
|
-
},
|
|
1919
|
-
mint: {
|
|
1920
|
-
value: input.mint ?? null,
|
|
1921
|
-
isWritable: false
|
|
1922
|
-
},
|
|
1923
|
-
source: {
|
|
1924
|
-
value: input.source ?? null,
|
|
1925
|
-
isWritable: true
|
|
1926
|
-
},
|
|
1927
|
-
vault: {
|
|
1928
|
-
value: input.vault ?? null,
|
|
1929
|
-
isWritable: true
|
|
1930
|
-
},
|
|
1931
|
-
tokenProgram: {
|
|
1932
|
-
value: input.tokenProgram ?? null,
|
|
1933
|
-
isWritable: false
|
|
1934
|
-
}
|
|
1935
|
-
};
|
|
1936
|
-
const args = { ...input };
|
|
1937
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1938
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
1939
|
-
return Object.freeze({
|
|
1940
|
-
accounts: [
|
|
1941
|
-
getAccountMeta("funder", accounts.funder),
|
|
1942
|
-
getAccountMeta("pool", accounts.pool),
|
|
1943
|
-
getAccountMeta("mint", accounts.mint),
|
|
1944
|
-
getAccountMeta("source", accounts.source),
|
|
1945
|
-
getAccountMeta("vault", accounts.vault),
|
|
1946
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1947
|
-
],
|
|
1948
|
-
data: getFundPrizesInstructionDataEncoder().encode(args),
|
|
1949
|
-
programAddress
|
|
1950
|
-
});
|
|
1951
|
-
}
|
|
1952
|
-
function parseFundPrizesInstruction(instruction) {
|
|
1953
|
-
if (instruction.accounts.length < 6) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1954
|
-
actualAccountMetas: instruction.accounts.length,
|
|
1955
|
-
expectedAccountMetas: 6
|
|
1956
|
-
});
|
|
1957
|
-
let accountIndex = 0;
|
|
1958
|
-
const getNextAccount = () => {
|
|
1959
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
1960
|
-
accountIndex += 1;
|
|
1961
|
-
return accountMeta;
|
|
1962
|
-
};
|
|
1963
|
-
return {
|
|
1964
|
-
programAddress: instruction.programAddress,
|
|
1965
|
-
accounts: {
|
|
1966
|
-
funder: getNextAccount(),
|
|
1967
|
-
pool: getNextAccount(),
|
|
1968
|
-
mint: getNextAccount(),
|
|
1969
|
-
source: getNextAccount(),
|
|
1970
|
-
vault: getNextAccount(),
|
|
1971
|
-
tokenProgram: getNextAccount()
|
|
1972
|
-
},
|
|
1973
|
-
data: getFundPrizesInstructionDataDecoder().decode(instruction.data)
|
|
1974
|
-
};
|
|
1975
|
-
}
|
|
1976
|
-
//#endregion
|
|
1977
|
-
//#region src/generated/instructions/initializePool.ts
|
|
1978
|
-
/**
|
|
1979
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
1980
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1981
|
-
* to add features, then rerun Codama to update it.
|
|
1982
|
-
*
|
|
1983
|
-
* @see https://github.com/codama-idl/codama
|
|
1984
|
-
*/
|
|
1985
|
-
const INITIALIZE_POOL_DISCRIMINATOR = new Uint8Array([
|
|
1986
|
-
95,
|
|
1987
|
-
180,
|
|
1988
|
-
10,
|
|
1989
|
-
172,
|
|
1990
|
-
84,
|
|
1991
|
-
174,
|
|
1992
|
-
232,
|
|
1993
|
-
40
|
|
1994
|
-
]);
|
|
1995
|
-
function getInitializePoolDiscriminatorBytes() {
|
|
1996
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(INITIALIZE_POOL_DISCRIMINATOR);
|
|
1997
|
-
}
|
|
1998
|
-
function getInitializePoolInstructionDataEncoder() {
|
|
1999
|
-
return transformEncoder(getStructEncoder([
|
|
2000
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2001
|
-
["feeBps", getU16Encoder()],
|
|
2002
|
-
["tiers", getArrayEncoder(getTierEncoder(), { size: 8 })],
|
|
2003
|
-
["maxSeedLamports", getU64Encoder()]
|
|
2004
|
-
]), (value) => ({
|
|
2005
|
-
...value,
|
|
2006
|
-
discriminator: INITIALIZE_POOL_DISCRIMINATOR
|
|
2007
|
-
}));
|
|
2008
|
-
}
|
|
2009
|
-
function getInitializePoolInstructionDataDecoder() {
|
|
2010
|
-
return getStructDecoder([
|
|
2011
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2012
|
-
["feeBps", getU16Decoder()],
|
|
2013
|
-
["tiers", getArrayDecoder(getTierDecoder(), { size: 8 })],
|
|
2014
|
-
["maxSeedLamports", getU64Decoder()]
|
|
2015
|
-
]);
|
|
2016
|
-
}
|
|
2017
|
-
function getInitializePoolInstructionDataCodec() {
|
|
2018
|
-
return combineCodec(getInitializePoolInstructionDataEncoder(), getInitializePoolInstructionDataDecoder());
|
|
2019
|
-
}
|
|
2020
|
-
async function getInitializePoolInstructionAsync(input, config) {
|
|
2021
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2022
|
-
const accounts = {
|
|
2023
|
-
creator: {
|
|
2024
|
-
value: input.creator ?? null,
|
|
2025
|
-
isWritable: true
|
|
2026
|
-
},
|
|
2027
|
-
pool: {
|
|
2028
|
-
value: input.pool ?? null,
|
|
2029
|
-
isWritable: true
|
|
2030
|
-
},
|
|
2031
|
-
mint: {
|
|
2032
|
-
value: input.mint ?? null,
|
|
2033
|
-
isWritable: false
|
|
2034
|
-
},
|
|
2035
|
-
creatorTokens: {
|
|
2036
|
-
value: input.creatorTokens ?? null,
|
|
2037
|
-
isWritable: true
|
|
2038
|
-
},
|
|
2039
|
-
vault: {
|
|
2040
|
-
value: input.vault ?? null,
|
|
2041
|
-
isWritable: true
|
|
2042
|
-
},
|
|
2043
|
-
venue: {
|
|
2044
|
-
value: input.venue ?? null,
|
|
2045
|
-
isWritable: false
|
|
2046
|
-
},
|
|
2047
|
-
instructions: {
|
|
2048
|
-
value: input.instructions ?? null,
|
|
2049
|
-
isWritable: false
|
|
2050
|
-
},
|
|
2051
|
-
tokenProgram: {
|
|
2052
|
-
value: input.tokenProgram ?? null,
|
|
2053
|
-
isWritable: false
|
|
2054
|
-
},
|
|
2055
|
-
associatedTokenProgram: {
|
|
2056
|
-
value: input.associatedTokenProgram ?? null,
|
|
2057
|
-
isWritable: false
|
|
2058
|
-
},
|
|
2059
|
-
systemProgram: {
|
|
2060
|
-
value: input.systemProgram ?? null,
|
|
2061
|
-
isWritable: false
|
|
2062
|
-
}
|
|
2063
|
-
};
|
|
2064
|
-
const args = { ...input };
|
|
2065
|
-
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
2066
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2067
|
-
if (!accounts.creatorTokens.value) accounts.creatorTokens.value = await getProgramDerivedAddress({
|
|
2068
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2069
|
-
seeds: [
|
|
2070
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("creator", accounts.creator.value)),
|
|
2071
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
2072
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
2073
|
-
]
|
|
2074
|
-
});
|
|
2075
|
-
if (!accounts.vault.value) accounts.vault.value = await getProgramDerivedAddress({
|
|
2076
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2077
|
-
seeds: [
|
|
2078
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)),
|
|
2079
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
2080
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
2081
|
-
]
|
|
2082
|
-
});
|
|
2083
|
-
if (!accounts.venue.value) accounts.venue.value = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
|
|
2084
|
-
if (!accounts.instructions.value) accounts.instructions.value = "Sysvar1nstructions1111111111111111111111111";
|
|
2085
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2086
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2087
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2088
|
-
return Object.freeze({
|
|
2089
|
-
accounts: [
|
|
2090
|
-
getAccountMeta("creator", accounts.creator),
|
|
2091
|
-
getAccountMeta("pool", accounts.pool),
|
|
2092
|
-
getAccountMeta("mint", accounts.mint),
|
|
2093
|
-
getAccountMeta("creatorTokens", accounts.creatorTokens),
|
|
2094
|
-
getAccountMeta("vault", accounts.vault),
|
|
2095
|
-
getAccountMeta("venue", accounts.venue),
|
|
2096
|
-
getAccountMeta("instructions", accounts.instructions),
|
|
2097
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2098
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
2099
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2100
|
-
],
|
|
2101
|
-
data: getInitializePoolInstructionDataEncoder().encode(args),
|
|
2102
|
-
programAddress
|
|
2103
|
-
});
|
|
2104
|
-
}
|
|
2105
|
-
function getInitializePoolInstruction(input, config) {
|
|
2106
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2107
|
-
const accounts = {
|
|
2108
|
-
creator: {
|
|
2109
|
-
value: input.creator ?? null,
|
|
2110
|
-
isWritable: true
|
|
2111
|
-
},
|
|
2112
|
-
pool: {
|
|
2113
|
-
value: input.pool ?? null,
|
|
2114
|
-
isWritable: true
|
|
2115
|
-
},
|
|
2116
|
-
mint: {
|
|
2117
|
-
value: input.mint ?? null,
|
|
2118
|
-
isWritable: false
|
|
2119
|
-
},
|
|
2120
|
-
creatorTokens: {
|
|
2121
|
-
value: input.creatorTokens ?? null,
|
|
2122
|
-
isWritable: true
|
|
2123
|
-
},
|
|
2124
|
-
vault: {
|
|
2125
|
-
value: input.vault ?? null,
|
|
2126
|
-
isWritable: true
|
|
2127
|
-
},
|
|
2128
|
-
venue: {
|
|
2129
|
-
value: input.venue ?? null,
|
|
2130
|
-
isWritable: false
|
|
2131
|
-
},
|
|
2132
|
-
instructions: {
|
|
2133
|
-
value: input.instructions ?? null,
|
|
2134
|
-
isWritable: false
|
|
2135
|
-
},
|
|
2136
|
-
tokenProgram: {
|
|
2137
|
-
value: input.tokenProgram ?? null,
|
|
2138
|
-
isWritable: false
|
|
2139
|
-
},
|
|
2140
|
-
associatedTokenProgram: {
|
|
2141
|
-
value: input.associatedTokenProgram ?? null,
|
|
2142
|
-
isWritable: false
|
|
2143
|
-
},
|
|
2144
|
-
systemProgram: {
|
|
2145
|
-
value: input.systemProgram ?? null,
|
|
2146
|
-
isWritable: false
|
|
2147
|
-
}
|
|
2148
|
-
};
|
|
2149
|
-
const args = { ...input };
|
|
2150
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2151
|
-
if (!accounts.venue.value) accounts.venue.value = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P";
|
|
2152
|
-
if (!accounts.instructions.value) accounts.instructions.value = "Sysvar1nstructions1111111111111111111111111";
|
|
2153
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2154
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2155
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2156
|
-
return Object.freeze({
|
|
2157
|
-
accounts: [
|
|
2158
|
-
getAccountMeta("creator", accounts.creator),
|
|
2159
|
-
getAccountMeta("pool", accounts.pool),
|
|
2160
|
-
getAccountMeta("mint", accounts.mint),
|
|
2161
|
-
getAccountMeta("creatorTokens", accounts.creatorTokens),
|
|
2162
|
-
getAccountMeta("vault", accounts.vault),
|
|
2163
|
-
getAccountMeta("venue", accounts.venue),
|
|
2164
|
-
getAccountMeta("instructions", accounts.instructions),
|
|
2165
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2166
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
2167
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2168
|
-
],
|
|
2169
|
-
data: getInitializePoolInstructionDataEncoder().encode(args),
|
|
2170
|
-
programAddress
|
|
2171
|
-
});
|
|
2172
|
-
}
|
|
2173
|
-
function parseInitializePoolInstruction(instruction) {
|
|
2174
|
-
if (instruction.accounts.length < 10) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2175
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2176
|
-
expectedAccountMetas: 10
|
|
2177
|
-
});
|
|
2178
|
-
let accountIndex = 0;
|
|
2179
|
-
const getNextAccount = () => {
|
|
2180
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2181
|
-
accountIndex += 1;
|
|
2182
|
-
return accountMeta;
|
|
2183
|
-
};
|
|
2184
|
-
return {
|
|
2185
|
-
programAddress: instruction.programAddress,
|
|
2186
|
-
accounts: {
|
|
2187
|
-
creator: getNextAccount(),
|
|
2188
|
-
pool: getNextAccount(),
|
|
2189
|
-
mint: getNextAccount(),
|
|
2190
|
-
creatorTokens: getNextAccount(),
|
|
2191
|
-
vault: getNextAccount(),
|
|
2192
|
-
venue: getNextAccount(),
|
|
2193
|
-
instructions: getNextAccount(),
|
|
2194
|
-
tokenProgram: getNextAccount(),
|
|
2195
|
-
associatedTokenProgram: getNextAccount(),
|
|
2196
|
-
systemProgram: getNextAccount()
|
|
2197
|
-
},
|
|
2198
|
-
data: getInitializePoolInstructionDataDecoder().decode(instruction.data)
|
|
2199
|
-
};
|
|
2200
|
-
}
|
|
2201
|
-
//#endregion
|
|
2202
|
-
//#region src/generated/instructions/retryDraw.ts
|
|
2203
|
-
/**
|
|
2204
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
2205
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2206
|
-
* to add features, then rerun Codama to update it.
|
|
2207
|
-
*
|
|
2208
|
-
* @see https://github.com/codama-idl/codama
|
|
2209
|
-
*/
|
|
2210
|
-
const RETRY_DRAW_DISCRIMINATOR = new Uint8Array([
|
|
2211
|
-
112,
|
|
2212
|
-
118,
|
|
2213
|
-
137,
|
|
2214
|
-
120,
|
|
2215
|
-
211,
|
|
2216
|
-
39,
|
|
2217
|
-
196,
|
|
2218
|
-
96
|
|
2219
|
-
]);
|
|
2220
|
-
function getRetryDrawDiscriminatorBytes() {
|
|
2221
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(RETRY_DRAW_DISCRIMINATOR);
|
|
2222
|
-
}
|
|
2223
|
-
function getRetryDrawInstructionDataEncoder() {
|
|
2224
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["maxVrfDebit", getU64Encoder()]]), (value) => ({
|
|
2225
|
-
...value,
|
|
2226
|
-
discriminator: RETRY_DRAW_DISCRIMINATOR
|
|
2227
|
-
}));
|
|
2228
|
-
}
|
|
2229
|
-
function getRetryDrawInstructionDataDecoder() {
|
|
2230
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["maxVrfDebit", getU64Decoder()]]);
|
|
2231
|
-
}
|
|
2232
|
-
function getRetryDrawInstructionDataCodec() {
|
|
2233
|
-
return combineCodec(getRetryDrawInstructionDataEncoder(), getRetryDrawInstructionDataDecoder());
|
|
2234
|
-
}
|
|
2235
|
-
async function getRetryDrawInstructionAsync(input, config) {
|
|
2236
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2237
|
-
const accounts = {
|
|
2238
|
-
payer: {
|
|
2239
|
-
value: input.payer ?? null,
|
|
2240
|
-
isWritable: true
|
|
2241
|
-
},
|
|
2242
|
-
pool: {
|
|
2243
|
-
value: input.pool ?? null,
|
|
2244
|
-
isWritable: false
|
|
2245
|
-
},
|
|
2246
|
-
draw: {
|
|
2247
|
-
value: input.draw ?? null,
|
|
2248
|
-
isWritable: true
|
|
2249
|
-
},
|
|
2250
|
-
identity: {
|
|
2251
|
-
value: input.identity ?? null,
|
|
2252
|
-
isWritable: false
|
|
2253
|
-
},
|
|
2254
|
-
queue: {
|
|
2255
|
-
value: input.queue ?? null,
|
|
2256
|
-
isWritable: true
|
|
2257
|
-
},
|
|
2258
|
-
program: {
|
|
2259
|
-
value: input.program ?? null,
|
|
2260
|
-
isWritable: false
|
|
2261
|
-
},
|
|
2262
|
-
slotHashes: {
|
|
2263
|
-
value: input.slotHashes ?? null,
|
|
2264
|
-
isWritable: false
|
|
2265
|
-
},
|
|
2266
|
-
systemProgram: {
|
|
2267
|
-
value: input.systemProgram ?? null,
|
|
2268
|
-
isWritable: false
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
const args = { ...input };
|
|
2272
|
-
if (!accounts.identity.value) accounts.identity.value = await findIdentityPda({ programAddress });
|
|
2273
|
-
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
2274
|
-
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
2275
|
-
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
2276
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2277
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2278
|
-
return Object.freeze({
|
|
2279
|
-
accounts: [
|
|
2280
|
-
getAccountMeta("payer", accounts.payer),
|
|
2281
|
-
getAccountMeta("pool", accounts.pool),
|
|
2282
|
-
getAccountMeta("draw", accounts.draw),
|
|
2283
|
-
getAccountMeta("identity", accounts.identity),
|
|
2284
|
-
getAccountMeta("queue", accounts.queue),
|
|
2285
|
-
getAccountMeta("program", accounts.program),
|
|
2286
|
-
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
2287
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2288
|
-
],
|
|
2289
|
-
data: getRetryDrawInstructionDataEncoder().encode(args),
|
|
2290
|
-
programAddress
|
|
2291
|
-
});
|
|
2292
|
-
}
|
|
2293
|
-
function getRetryDrawInstruction(input, config) {
|
|
2294
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2295
|
-
const accounts = {
|
|
2296
|
-
payer: {
|
|
2297
|
-
value: input.payer ?? null,
|
|
2298
|
-
isWritable: true
|
|
2299
|
-
},
|
|
2300
|
-
pool: {
|
|
2301
|
-
value: input.pool ?? null,
|
|
2302
|
-
isWritable: false
|
|
2303
|
-
},
|
|
2304
|
-
draw: {
|
|
2305
|
-
value: input.draw ?? null,
|
|
2306
|
-
isWritable: true
|
|
2307
|
-
},
|
|
2308
|
-
identity: {
|
|
2309
|
-
value: input.identity ?? null,
|
|
2310
|
-
isWritable: false
|
|
2311
|
-
},
|
|
2312
|
-
queue: {
|
|
2313
|
-
value: input.queue ?? null,
|
|
2314
|
-
isWritable: true
|
|
2315
|
-
},
|
|
2316
|
-
program: {
|
|
2317
|
-
value: input.program ?? null,
|
|
2318
|
-
isWritable: false
|
|
2319
|
-
},
|
|
2320
|
-
slotHashes: {
|
|
2321
|
-
value: input.slotHashes ?? null,
|
|
2322
|
-
isWritable: false
|
|
2323
|
-
},
|
|
2324
|
-
systemProgram: {
|
|
2325
|
-
value: input.systemProgram ?? null,
|
|
2326
|
-
isWritable: false
|
|
2327
|
-
}
|
|
2328
|
-
};
|
|
2329
|
-
const args = { ...input };
|
|
2330
|
-
if (!accounts.queue.value) accounts.queue.value = "Cuj97ggrhhidhbu39TijNVqE74xvKJ69gDervRUXAxGh";
|
|
2331
|
-
if (!accounts.program.value) accounts.program.value = "Vrf1RNUjXmQGjmQrQLvJHs9SNkvDJEsRVFPkfSQUwGz";
|
|
2332
|
-
if (!accounts.slotHashes.value) accounts.slotHashes.value = "SysvarS1otHashes111111111111111111111111111";
|
|
2333
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2334
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2335
|
-
return Object.freeze({
|
|
2336
|
-
accounts: [
|
|
2337
|
-
getAccountMeta("payer", accounts.payer),
|
|
2338
|
-
getAccountMeta("pool", accounts.pool),
|
|
2339
|
-
getAccountMeta("draw", accounts.draw),
|
|
2340
|
-
getAccountMeta("identity", accounts.identity),
|
|
2341
|
-
getAccountMeta("queue", accounts.queue),
|
|
2342
|
-
getAccountMeta("program", accounts.program),
|
|
2343
|
-
getAccountMeta("slotHashes", accounts.slotHashes),
|
|
2344
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2345
|
-
],
|
|
2346
|
-
data: getRetryDrawInstructionDataEncoder().encode(args),
|
|
2347
|
-
programAddress
|
|
2348
|
-
});
|
|
2349
|
-
}
|
|
2350
|
-
function parseRetryDrawInstruction(instruction) {
|
|
2351
|
-
if (instruction.accounts.length < 8) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2352
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2353
|
-
expectedAccountMetas: 8
|
|
2354
|
-
});
|
|
2355
|
-
let accountIndex = 0;
|
|
2356
|
-
const getNextAccount = () => {
|
|
2357
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2358
|
-
accountIndex += 1;
|
|
2359
|
-
return accountMeta;
|
|
2360
|
-
};
|
|
2361
|
-
return {
|
|
2362
|
-
programAddress: instruction.programAddress,
|
|
2363
|
-
accounts: {
|
|
2364
|
-
payer: getNextAccount(),
|
|
2365
|
-
pool: getNextAccount(),
|
|
2366
|
-
draw: getNextAccount(),
|
|
2367
|
-
identity: getNextAccount(),
|
|
2368
|
-
queue: getNextAccount(),
|
|
2369
|
-
program: getNextAccount(),
|
|
2370
|
-
slotHashes: getNextAccount(),
|
|
2371
|
-
systemProgram: getNextAccount()
|
|
2372
|
-
},
|
|
2373
|
-
data: getRetryDrawInstructionDataDecoder().decode(instruction.data)
|
|
2374
|
-
};
|
|
2375
|
-
}
|
|
2376
|
-
//#endregion
|
|
2377
|
-
//#region src/generated/instructions/sellPrize.ts
|
|
2378
|
-
/**
|
|
2379
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
2380
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2381
|
-
* to add features, then rerun Codama to update it.
|
|
2382
|
-
*
|
|
2383
|
-
* @see https://github.com/codama-idl/codama
|
|
2384
|
-
*/
|
|
2385
|
-
const SELL_PRIZE_DISCRIMINATOR = new Uint8Array([
|
|
2386
|
-
235,
|
|
2387
|
-
236,
|
|
2388
|
-
8,
|
|
2389
|
-
137,
|
|
2390
|
-
79,
|
|
2391
|
-
25,
|
|
2392
|
-
208,
|
|
2393
|
-
235
|
|
2394
|
-
]);
|
|
2395
|
-
function getSellPrizeDiscriminatorBytes() {
|
|
2396
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(SELL_PRIZE_DISCRIMINATOR);
|
|
2397
|
-
}
|
|
2398
|
-
function getSellPrizeInstructionDataEncoder() {
|
|
2399
|
-
return transformEncoder(getStructEncoder([["discriminator", fixEncoderSize(getBytesEncoder(), 8)], ["minQuoteOutput", getU64Encoder()]]), (value) => ({
|
|
2400
|
-
...value,
|
|
2401
|
-
discriminator: SELL_PRIZE_DISCRIMINATOR
|
|
2402
|
-
}));
|
|
2403
|
-
}
|
|
2404
|
-
function getSellPrizeInstructionDataDecoder() {
|
|
2405
|
-
return getStructDecoder([["discriminator", fixDecoderSize(getBytesDecoder(), 8)], ["minQuoteOutput", getU64Decoder()]]);
|
|
2406
|
-
}
|
|
2407
|
-
function getSellPrizeInstructionDataCodec() {
|
|
2408
|
-
return combineCodec(getSellPrizeInstructionDataEncoder(), getSellPrizeInstructionDataDecoder());
|
|
2409
|
-
}
|
|
2410
|
-
async function getSellPrizeInstructionAsync(input, config) {
|
|
2411
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2412
|
-
const accounts = {
|
|
2413
|
-
purchaser: {
|
|
2414
|
-
value: input.purchaser ?? null,
|
|
2415
|
-
isWritable: true
|
|
2416
|
-
},
|
|
2417
|
-
pool: {
|
|
2418
|
-
value: input.pool ?? null,
|
|
2419
|
-
isWritable: true
|
|
2420
|
-
},
|
|
2421
|
-
draw: {
|
|
2422
|
-
value: input.draw ?? null,
|
|
2423
|
-
isWritable: true
|
|
2424
|
-
},
|
|
2425
|
-
mint: {
|
|
2426
|
-
value: input.mint ?? null,
|
|
2427
|
-
isWritable: false
|
|
2428
|
-
},
|
|
2429
|
-
vault: {
|
|
2430
|
-
value: input.vault ?? null,
|
|
2431
|
-
isWritable: true
|
|
2432
|
-
},
|
|
2433
|
-
userTokens: {
|
|
2434
|
-
value: input.userTokens ?? null,
|
|
2435
|
-
isWritable: true
|
|
2436
|
-
},
|
|
2437
|
-
tokenProgram: {
|
|
2438
|
-
value: input.tokenProgram ?? null,
|
|
2439
|
-
isWritable: false
|
|
2440
|
-
},
|
|
2441
|
-
associatedTokenProgram: {
|
|
2442
|
-
value: input.associatedTokenProgram ?? null,
|
|
2443
|
-
isWritable: false
|
|
2444
|
-
},
|
|
2445
|
-
systemProgram: {
|
|
2446
|
-
value: input.systemProgram ?? null,
|
|
2447
|
-
isWritable: false
|
|
2448
|
-
},
|
|
2449
|
-
venue: {
|
|
2450
|
-
value: input.venue ?? null,
|
|
2451
|
-
isWritable: false
|
|
2452
|
-
},
|
|
2453
|
-
feeCollector: {
|
|
2454
|
-
value: input.feeCollector ?? null,
|
|
2455
|
-
isWritable: true
|
|
2456
|
-
},
|
|
2457
|
-
feeCollectorWsol: {
|
|
2458
|
-
value: input.feeCollectorWsol ?? null,
|
|
2459
|
-
isWritable: true
|
|
2460
|
-
},
|
|
2461
|
-
quoteTokenProgram: {
|
|
2462
|
-
value: input.quoteTokenProgram ?? null,
|
|
2463
|
-
isWritable: false
|
|
2464
|
-
}
|
|
2465
|
-
};
|
|
2466
|
-
const args = { ...input };
|
|
2467
|
-
if (!accounts.pool.value) accounts.pool.value = await findPoolPda({ mint: getAddressFromResolvedInstructionAccount("mint", accounts.mint.value) }, { programAddress });
|
|
2468
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2469
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
2470
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2471
|
-
seeds: [
|
|
2472
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("purchaser", accounts.purchaser.value)),
|
|
2473
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
2474
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
2475
|
-
]
|
|
2476
|
-
});
|
|
2477
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2478
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2479
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
2480
|
-
if (!accounts.quoteTokenProgram.value) accounts.quoteTokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2481
|
-
if (!accounts.feeCollectorWsol.value) accounts.feeCollectorWsol.value = await getProgramDerivedAddress({
|
|
2482
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2483
|
-
seeds: [
|
|
2484
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("feeCollector", accounts.feeCollector.value)),
|
|
2485
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("quoteTokenProgram", accounts.quoteTokenProgram.value)),
|
|
2486
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
2487
|
-
6,
|
|
2488
|
-
155,
|
|
2489
|
-
136,
|
|
2490
|
-
87,
|
|
2491
|
-
254,
|
|
2492
|
-
171,
|
|
2493
|
-
129,
|
|
2494
|
-
132,
|
|
2495
|
-
251,
|
|
2496
|
-
104,
|
|
2497
|
-
127,
|
|
2498
|
-
99,
|
|
2499
|
-
70,
|
|
2500
|
-
24,
|
|
2501
|
-
192,
|
|
2502
|
-
53,
|
|
2503
|
-
218,
|
|
2504
|
-
196,
|
|
2505
|
-
57,
|
|
2506
|
-
220,
|
|
2507
|
-
26,
|
|
2508
|
-
235,
|
|
2509
|
-
59,
|
|
2510
|
-
85,
|
|
2511
|
-
152,
|
|
2512
|
-
160,
|
|
2513
|
-
240,
|
|
2514
|
-
0,
|
|
2515
|
-
0,
|
|
2516
|
-
0,
|
|
2517
|
-
0,
|
|
2518
|
-
1
|
|
2519
|
-
]))
|
|
2520
|
-
]
|
|
2521
|
-
});
|
|
2522
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2523
|
-
return Object.freeze({
|
|
2524
|
-
accounts: [
|
|
2525
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
2526
|
-
getAccountMeta("pool", accounts.pool),
|
|
2527
|
-
getAccountMeta("draw", accounts.draw),
|
|
2528
|
-
getAccountMeta("mint", accounts.mint),
|
|
2529
|
-
getAccountMeta("vault", accounts.vault),
|
|
2530
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
2531
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2532
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
2533
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2534
|
-
getAccountMeta("venue", accounts.venue),
|
|
2535
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
2536
|
-
getAccountMeta("feeCollectorWsol", accounts.feeCollectorWsol),
|
|
2537
|
-
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
2538
|
-
],
|
|
2539
|
-
data: getSellPrizeInstructionDataEncoder().encode(args),
|
|
2540
|
-
programAddress
|
|
2541
|
-
});
|
|
2542
|
-
}
|
|
2543
|
-
function getSellPrizeInstruction(input, config) {
|
|
2544
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2545
|
-
const accounts = {
|
|
2546
|
-
purchaser: {
|
|
2547
|
-
value: input.purchaser ?? null,
|
|
2548
|
-
isWritable: true
|
|
2549
|
-
},
|
|
2550
|
-
pool: {
|
|
2551
|
-
value: input.pool ?? null,
|
|
2552
|
-
isWritable: true
|
|
2553
|
-
},
|
|
2554
|
-
draw: {
|
|
2555
|
-
value: input.draw ?? null,
|
|
2556
|
-
isWritable: true
|
|
2557
|
-
},
|
|
2558
|
-
mint: {
|
|
2559
|
-
value: input.mint ?? null,
|
|
2560
|
-
isWritable: false
|
|
2561
|
-
},
|
|
2562
|
-
vault: {
|
|
2563
|
-
value: input.vault ?? null,
|
|
2564
|
-
isWritable: true
|
|
2565
|
-
},
|
|
2566
|
-
userTokens: {
|
|
2567
|
-
value: input.userTokens ?? null,
|
|
2568
|
-
isWritable: true
|
|
2569
|
-
},
|
|
2570
|
-
tokenProgram: {
|
|
2571
|
-
value: input.tokenProgram ?? null,
|
|
2572
|
-
isWritable: false
|
|
2573
|
-
},
|
|
2574
|
-
associatedTokenProgram: {
|
|
2575
|
-
value: input.associatedTokenProgram ?? null,
|
|
2576
|
-
isWritable: false
|
|
2577
|
-
},
|
|
2578
|
-
systemProgram: {
|
|
2579
|
-
value: input.systemProgram ?? null,
|
|
2580
|
-
isWritable: false
|
|
2581
|
-
},
|
|
2582
|
-
venue: {
|
|
2583
|
-
value: input.venue ?? null,
|
|
2584
|
-
isWritable: false
|
|
2585
|
-
},
|
|
2586
|
-
feeCollector: {
|
|
2587
|
-
value: input.feeCollector ?? null,
|
|
2588
|
-
isWritable: true
|
|
2589
|
-
},
|
|
2590
|
-
feeCollectorWsol: {
|
|
2591
|
-
value: input.feeCollectorWsol ?? null,
|
|
2592
|
-
isWritable: true
|
|
2593
|
-
},
|
|
2594
|
-
quoteTokenProgram: {
|
|
2595
|
-
value: input.quoteTokenProgram ?? null,
|
|
2596
|
-
isWritable: false
|
|
2597
|
-
}
|
|
2598
|
-
};
|
|
2599
|
-
const args = { ...input };
|
|
2600
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2601
|
-
if (!accounts.associatedTokenProgram.value) accounts.associatedTokenProgram.value = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
2602
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2603
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
2604
|
-
if (!accounts.quoteTokenProgram.value) accounts.quoteTokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2605
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2606
|
-
return Object.freeze({
|
|
2607
|
-
accounts: [
|
|
2608
|
-
getAccountMeta("purchaser", accounts.purchaser),
|
|
2609
|
-
getAccountMeta("pool", accounts.pool),
|
|
2610
|
-
getAccountMeta("draw", accounts.draw),
|
|
2611
|
-
getAccountMeta("mint", accounts.mint),
|
|
2612
|
-
getAccountMeta("vault", accounts.vault),
|
|
2613
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
2614
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2615
|
-
getAccountMeta("associatedTokenProgram", accounts.associatedTokenProgram),
|
|
2616
|
-
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2617
|
-
getAccountMeta("venue", accounts.venue),
|
|
2618
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
2619
|
-
getAccountMeta("feeCollectorWsol", accounts.feeCollectorWsol),
|
|
2620
|
-
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram)
|
|
2621
|
-
],
|
|
2622
|
-
data: getSellPrizeInstructionDataEncoder().encode(args),
|
|
2623
|
-
programAddress
|
|
2624
|
-
});
|
|
2625
|
-
}
|
|
2626
|
-
function parseSellPrizeInstruction(instruction) {
|
|
2627
|
-
if (instruction.accounts.length < 13) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2628
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2629
|
-
expectedAccountMetas: 13
|
|
2630
|
-
});
|
|
2631
|
-
let accountIndex = 0;
|
|
2632
|
-
const getNextAccount = () => {
|
|
2633
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2634
|
-
accountIndex += 1;
|
|
2635
|
-
return accountMeta;
|
|
2636
|
-
};
|
|
2637
|
-
return {
|
|
2638
|
-
programAddress: instruction.programAddress,
|
|
2639
|
-
accounts: {
|
|
2640
|
-
purchaser: getNextAccount(),
|
|
2641
|
-
pool: getNextAccount(),
|
|
2642
|
-
draw: getNextAccount(),
|
|
2643
|
-
mint: getNextAccount(),
|
|
2644
|
-
vault: getNextAccount(),
|
|
2645
|
-
userTokens: getNextAccount(),
|
|
2646
|
-
tokenProgram: getNextAccount(),
|
|
2647
|
-
associatedTokenProgram: getNextAccount(),
|
|
2648
|
-
systemProgram: getNextAccount(),
|
|
2649
|
-
venue: getNextAccount(),
|
|
2650
|
-
feeCollector: getNextAccount(),
|
|
2651
|
-
feeCollectorWsol: getNextAccount(),
|
|
2652
|
-
quoteTokenProgram: getNextAccount()
|
|
2653
|
-
},
|
|
2654
|
-
data: getSellPrizeInstructionDataDecoder().decode(instruction.data)
|
|
2655
|
-
};
|
|
2656
|
-
}
|
|
2657
|
-
//#endregion
|
|
2658
|
-
//#region src/generated/instructions/sellTokens.ts
|
|
2659
|
-
/**
|
|
2660
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
2661
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2662
|
-
* to add features, then rerun Codama to update it.
|
|
2663
|
-
*
|
|
2664
|
-
* @see https://github.com/codama-idl/codama
|
|
2665
|
-
*/
|
|
2666
|
-
const SELL_TOKENS_DISCRIMINATOR = new Uint8Array([
|
|
2667
|
-
114,
|
|
2668
|
-
242,
|
|
2669
|
-
25,
|
|
2670
|
-
12,
|
|
2671
|
-
62,
|
|
2672
|
-
126,
|
|
2673
|
-
92,
|
|
2674
|
-
2
|
|
2675
|
-
]);
|
|
2676
|
-
function getSellTokensDiscriminatorBytes() {
|
|
2677
|
-
return fixEncoderSize(getBytesEncoder(), 8).encode(SELL_TOKENS_DISCRIMINATOR);
|
|
2678
|
-
}
|
|
2679
|
-
function getSellTokensInstructionDataEncoder() {
|
|
2680
|
-
return transformEncoder(getStructEncoder([
|
|
2681
|
-
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
2682
|
-
["amount", getU64Encoder()],
|
|
2683
|
-
["minQuoteOutput", getU64Encoder()]
|
|
2684
|
-
]), (value) => ({
|
|
2685
|
-
...value,
|
|
2686
|
-
discriminator: SELL_TOKENS_DISCRIMINATOR
|
|
2687
|
-
}));
|
|
2688
|
-
}
|
|
2689
|
-
function getSellTokensInstructionDataDecoder() {
|
|
2690
|
-
return getStructDecoder([
|
|
2691
|
-
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
2692
|
-
["amount", getU64Decoder()],
|
|
2693
|
-
["minQuoteOutput", getU64Decoder()]
|
|
2694
|
-
]);
|
|
2695
|
-
}
|
|
2696
|
-
function getSellTokensInstructionDataCodec() {
|
|
2697
|
-
return combineCodec(getSellTokensInstructionDataEncoder(), getSellTokensInstructionDataDecoder());
|
|
2698
|
-
}
|
|
2699
|
-
async function getSellTokensInstructionAsync(input, config) {
|
|
2700
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2701
|
-
const accounts = {
|
|
2702
|
-
seller: {
|
|
2703
|
-
value: input.seller ?? null,
|
|
2704
|
-
isWritable: true
|
|
2705
|
-
},
|
|
2706
|
-
pool: {
|
|
2707
|
-
value: input.pool ?? null,
|
|
2708
|
-
isWritable: false
|
|
2709
|
-
},
|
|
2710
|
-
mint: {
|
|
2711
|
-
value: input.mint ?? null,
|
|
2712
|
-
isWritable: false
|
|
2713
|
-
},
|
|
2714
|
-
userTokens: {
|
|
2715
|
-
value: input.userTokens ?? null,
|
|
2716
|
-
isWritable: true
|
|
2717
|
-
},
|
|
2718
|
-
venue: {
|
|
2719
|
-
value: input.venue ?? null,
|
|
2720
|
-
isWritable: false
|
|
2721
|
-
},
|
|
2722
|
-
feeCollector: {
|
|
2723
|
-
value: input.feeCollector ?? null,
|
|
2724
|
-
isWritable: true
|
|
2725
|
-
},
|
|
2726
|
-
feeCollectorWsol: {
|
|
2727
|
-
value: input.feeCollectorWsol ?? null,
|
|
2728
|
-
isWritable: true
|
|
2729
|
-
},
|
|
2730
|
-
quoteTokenProgram: {
|
|
2731
|
-
value: input.quoteTokenProgram ?? null,
|
|
2732
|
-
isWritable: false
|
|
2733
|
-
},
|
|
2734
|
-
tokenProgram: {
|
|
2735
|
-
value: input.tokenProgram ?? null,
|
|
2736
|
-
isWritable: false
|
|
2737
|
-
},
|
|
2738
|
-
systemProgram: {
|
|
2739
|
-
value: input.systemProgram ?? null,
|
|
2740
|
-
isWritable: false
|
|
2741
|
-
}
|
|
2742
|
-
};
|
|
2743
|
-
const args = { ...input };
|
|
2744
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2745
|
-
if (!accounts.userTokens.value) accounts.userTokens.value = await getProgramDerivedAddress({
|
|
2746
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2747
|
-
seeds: [
|
|
2748
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("seller", accounts.seller.value)),
|
|
2749
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("tokenProgram", accounts.tokenProgram.value)),
|
|
2750
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("mint", accounts.mint.value))
|
|
2751
|
-
]
|
|
2752
|
-
});
|
|
2753
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
2754
|
-
if (!accounts.quoteTokenProgram.value) accounts.quoteTokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2755
|
-
if (!accounts.feeCollectorWsol.value) accounts.feeCollectorWsol.value = await getProgramDerivedAddress({
|
|
2756
|
-
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
2757
|
-
seeds: [
|
|
2758
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("feeCollector", accounts.feeCollector.value)),
|
|
2759
|
-
getAddressEncoder().encode(getAddressFromResolvedInstructionAccount("quoteTokenProgram", accounts.quoteTokenProgram.value)),
|
|
2760
|
-
getBytesEncoder().encode(new Uint8Array([
|
|
2761
|
-
6,
|
|
2762
|
-
155,
|
|
2763
|
-
136,
|
|
2764
|
-
87,
|
|
2765
|
-
254,
|
|
2766
|
-
171,
|
|
2767
|
-
129,
|
|
2768
|
-
132,
|
|
2769
|
-
251,
|
|
2770
|
-
104,
|
|
2771
|
-
127,
|
|
2772
|
-
99,
|
|
2773
|
-
70,
|
|
2774
|
-
24,
|
|
2775
|
-
192,
|
|
2776
|
-
53,
|
|
2777
|
-
218,
|
|
2778
|
-
196,
|
|
2779
|
-
57,
|
|
2780
|
-
220,
|
|
2781
|
-
26,
|
|
2782
|
-
235,
|
|
2783
|
-
59,
|
|
2784
|
-
85,
|
|
2785
|
-
152,
|
|
2786
|
-
160,
|
|
2787
|
-
240,
|
|
2788
|
-
0,
|
|
2789
|
-
0,
|
|
2790
|
-
0,
|
|
2791
|
-
0,
|
|
2792
|
-
1
|
|
2793
|
-
]))
|
|
2794
|
-
]
|
|
2795
|
-
});
|
|
2796
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2797
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2798
|
-
return Object.freeze({
|
|
2799
|
-
accounts: [
|
|
2800
|
-
getAccountMeta("seller", accounts.seller),
|
|
2801
|
-
getAccountMeta("pool", accounts.pool),
|
|
2802
|
-
getAccountMeta("mint", accounts.mint),
|
|
2803
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
2804
|
-
getAccountMeta("venue", accounts.venue),
|
|
2805
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
2806
|
-
getAccountMeta("feeCollectorWsol", accounts.feeCollectorWsol),
|
|
2807
|
-
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
2808
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2809
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2810
|
-
],
|
|
2811
|
-
data: getSellTokensInstructionDataEncoder().encode(args),
|
|
2812
|
-
programAddress
|
|
2813
|
-
});
|
|
2814
|
-
}
|
|
2815
|
-
function getSellTokensInstruction(input, config) {
|
|
2816
|
-
const programAddress = config?.programAddress ?? "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2817
|
-
const accounts = {
|
|
2818
|
-
seller: {
|
|
2819
|
-
value: input.seller ?? null,
|
|
2820
|
-
isWritable: true
|
|
2821
|
-
},
|
|
2822
|
-
pool: {
|
|
2823
|
-
value: input.pool ?? null,
|
|
2824
|
-
isWritable: false
|
|
2825
|
-
},
|
|
2826
|
-
mint: {
|
|
2827
|
-
value: input.mint ?? null,
|
|
2828
|
-
isWritable: false
|
|
2829
|
-
},
|
|
2830
|
-
userTokens: {
|
|
2831
|
-
value: input.userTokens ?? null,
|
|
2832
|
-
isWritable: true
|
|
2833
|
-
},
|
|
2834
|
-
venue: {
|
|
2835
|
-
value: input.venue ?? null,
|
|
2836
|
-
isWritable: false
|
|
2837
|
-
},
|
|
2838
|
-
feeCollector: {
|
|
2839
|
-
value: input.feeCollector ?? null,
|
|
2840
|
-
isWritable: true
|
|
2841
|
-
},
|
|
2842
|
-
feeCollectorWsol: {
|
|
2843
|
-
value: input.feeCollectorWsol ?? null,
|
|
2844
|
-
isWritable: true
|
|
2845
|
-
},
|
|
2846
|
-
quoteTokenProgram: {
|
|
2847
|
-
value: input.quoteTokenProgram ?? null,
|
|
2848
|
-
isWritable: false
|
|
2849
|
-
},
|
|
2850
|
-
tokenProgram: {
|
|
2851
|
-
value: input.tokenProgram ?? null,
|
|
2852
|
-
isWritable: false
|
|
2853
|
-
},
|
|
2854
|
-
systemProgram: {
|
|
2855
|
-
value: input.systemProgram ?? null,
|
|
2856
|
-
isWritable: false
|
|
2857
|
-
}
|
|
2858
|
-
};
|
|
2859
|
-
const args = { ...input };
|
|
2860
|
-
if (!accounts.tokenProgram.value) accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2861
|
-
if (!accounts.feeCollector.value) accounts.feeCollector.value = "5WcPTEQ59UqpQzjZUPbU8QRGCbj7NeQNLDa7DbsLkLKT";
|
|
2862
|
-
if (!accounts.quoteTokenProgram.value) accounts.quoteTokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
2863
|
-
if (!accounts.systemProgram.value) accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2864
|
-
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
2865
|
-
return Object.freeze({
|
|
2866
|
-
accounts: [
|
|
2867
|
-
getAccountMeta("seller", accounts.seller),
|
|
2868
|
-
getAccountMeta("pool", accounts.pool),
|
|
2869
|
-
getAccountMeta("mint", accounts.mint),
|
|
2870
|
-
getAccountMeta("userTokens", accounts.userTokens),
|
|
2871
|
-
getAccountMeta("venue", accounts.venue),
|
|
2872
|
-
getAccountMeta("feeCollector", accounts.feeCollector),
|
|
2873
|
-
getAccountMeta("feeCollectorWsol", accounts.feeCollectorWsol),
|
|
2874
|
-
getAccountMeta("quoteTokenProgram", accounts.quoteTokenProgram),
|
|
2875
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2876
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
2877
|
-
],
|
|
2878
|
-
data: getSellTokensInstructionDataEncoder().encode(args),
|
|
2879
|
-
programAddress
|
|
2880
|
-
});
|
|
2881
|
-
}
|
|
2882
|
-
function parseSellTokensInstruction(instruction) {
|
|
2883
|
-
if (instruction.accounts.length < 10) throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2884
|
-
actualAccountMetas: instruction.accounts.length,
|
|
2885
|
-
expectedAccountMetas: 10
|
|
2886
|
-
});
|
|
2887
|
-
let accountIndex = 0;
|
|
2888
|
-
const getNextAccount = () => {
|
|
2889
|
-
const accountMeta = instruction.accounts[accountIndex];
|
|
2890
|
-
accountIndex += 1;
|
|
2891
|
-
return accountMeta;
|
|
2892
|
-
};
|
|
2893
|
-
return {
|
|
2894
|
-
programAddress: instruction.programAddress,
|
|
2895
|
-
accounts: {
|
|
2896
|
-
seller: getNextAccount(),
|
|
2897
|
-
pool: getNextAccount(),
|
|
2898
|
-
mint: getNextAccount(),
|
|
2899
|
-
userTokens: getNextAccount(),
|
|
2900
|
-
venue: getNextAccount(),
|
|
2901
|
-
feeCollector: getNextAccount(),
|
|
2902
|
-
feeCollectorWsol: getNextAccount(),
|
|
2903
|
-
quoteTokenProgram: getNextAccount(),
|
|
2904
|
-
tokenProgram: getNextAccount(),
|
|
2905
|
-
systemProgram: getNextAccount()
|
|
2906
|
-
},
|
|
2907
|
-
data: getSellTokensInstructionDataDecoder().decode(instruction.data)
|
|
2908
|
-
};
|
|
2909
|
-
}
|
|
2910
|
-
//#endregion
|
|
2911
|
-
//#region src/generated/programs/gaboxV2.ts
|
|
2912
|
-
/**
|
|
2913
|
-
* This code was AUTOGENERATED using the Codama library.
|
|
2914
|
-
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2915
|
-
* to add features, then rerun Codama to update it.
|
|
2916
|
-
*
|
|
2917
|
-
* @see https://github.com/codama-idl/codama
|
|
2918
|
-
*/
|
|
2919
|
-
const GABOX_V2_PROGRAM_ADDRESS = "GaBoxR9nYcK1zeu8EvSJVHV3SrYpCFmvbh2MLgobMcUA";
|
|
2920
|
-
let GaboxV2Account = /* @__PURE__ */ function(GaboxV2Account) {
|
|
2921
|
-
GaboxV2Account[GaboxV2Account["Draw"] = 0] = "Draw";
|
|
2922
|
-
GaboxV2Account[GaboxV2Account["Pool"] = 1] = "Pool";
|
|
2923
|
-
GaboxV2Account[GaboxV2Account["Referral"] = 2] = "Referral";
|
|
2924
|
-
GaboxV2Account[GaboxV2Account["ReferralLink"] = 3] = "ReferralLink";
|
|
2925
|
-
return GaboxV2Account;
|
|
2926
|
-
}({});
|
|
2927
|
-
function identifyGaboxV2Account(account) {
|
|
2928
|
-
const data = "data" in account ? account.data : account;
|
|
2929
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2930
|
-
225,
|
|
2931
|
-
131,
|
|
2932
|
-
41,
|
|
2933
|
-
222,
|
|
2934
|
-
122,
|
|
2935
|
-
20,
|
|
2936
|
-
146,
|
|
2937
|
-
202
|
|
2938
|
-
])), 0)) return 0;
|
|
2939
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2940
|
-
241,
|
|
2941
|
-
154,
|
|
2942
|
-
109,
|
|
2943
|
-
4,
|
|
2944
|
-
17,
|
|
2945
|
-
177,
|
|
2946
|
-
109,
|
|
2947
|
-
188
|
|
2948
|
-
])), 0)) return 1;
|
|
2949
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2950
|
-
30,
|
|
2951
|
-
235,
|
|
2952
|
-
136,
|
|
2953
|
-
224,
|
|
2954
|
-
106,
|
|
2955
|
-
107,
|
|
2956
|
-
49,
|
|
2957
|
-
64
|
|
2958
|
-
])), 0)) return 2;
|
|
2959
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2960
|
-
30,
|
|
2961
|
-
231,
|
|
2962
|
-
159,
|
|
2963
|
-
98,
|
|
2964
|
-
189,
|
|
2965
|
-
47,
|
|
2966
|
-
48,
|
|
2967
|
-
5
|
|
2968
|
-
])), 0)) return 3;
|
|
2969
|
-
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_ACCOUNT, {
|
|
2970
|
-
accountData: data,
|
|
2971
|
-
programName: "gaboxV2"
|
|
2972
|
-
});
|
|
2973
|
-
}
|
|
2974
|
-
let GaboxV2Event = /* @__PURE__ */ function(GaboxV2Event) {
|
|
2975
|
-
GaboxV2Event[GaboxV2Event["DrawResolved"] = 0] = "DrawResolved";
|
|
2976
|
-
GaboxV2Event[GaboxV2Event["PackBought"] = 1] = "PackBought";
|
|
2977
|
-
GaboxV2Event[GaboxV2Event["PoolCreated"] = 2] = "PoolCreated";
|
|
2978
|
-
GaboxV2Event[GaboxV2Event["PrizeRedeemed"] = 3] = "PrizeRedeemed";
|
|
2979
|
-
GaboxV2Event[GaboxV2Event["PrizesFunded"] = 4] = "PrizesFunded";
|
|
2980
|
-
GaboxV2Event[GaboxV2Event["RandomnessRetried"] = 5] = "RandomnessRetried";
|
|
2981
|
-
GaboxV2Event[GaboxV2Event["ReferralBound"] = 6] = "ReferralBound";
|
|
2982
|
-
GaboxV2Event[GaboxV2Event["ReferralClaimed"] = 7] = "ReferralClaimed";
|
|
2983
|
-
GaboxV2Event[GaboxV2Event["TokensSold"] = 8] = "TokensSold";
|
|
2984
|
-
return GaboxV2Event;
|
|
2985
|
-
}({});
|
|
2986
|
-
function identifyGaboxV2Event(event) {
|
|
2987
|
-
const data = "data" in event ? event.data : event;
|
|
2988
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2989
|
-
127,
|
|
2990
|
-
177,
|
|
2991
|
-
62,
|
|
2992
|
-
146,
|
|
2993
|
-
164,
|
|
2994
|
-
90,
|
|
2995
|
-
185,
|
|
2996
|
-
218
|
|
2997
|
-
])), 0)) return 0;
|
|
2998
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
2999
|
-
220,
|
|
3000
|
-
208,
|
|
3001
|
-
74,
|
|
3002
|
-
75,
|
|
3003
|
-
42,
|
|
3004
|
-
144,
|
|
3005
|
-
231,
|
|
3006
|
-
69
|
|
3007
|
-
])), 0)) return 1;
|
|
3008
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3009
|
-
202,
|
|
3010
|
-
44,
|
|
3011
|
-
41,
|
|
3012
|
-
88,
|
|
3013
|
-
104,
|
|
3014
|
-
220,
|
|
3015
|
-
157,
|
|
3016
|
-
82
|
|
3017
|
-
])), 0)) return 2;
|
|
3018
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3019
|
-
243,
|
|
3020
|
-
193,
|
|
3021
|
-
245,
|
|
3022
|
-
166,
|
|
3023
|
-
160,
|
|
3024
|
-
101,
|
|
3025
|
-
182,
|
|
3026
|
-
207
|
|
3027
|
-
])), 0)) return 3;
|
|
3028
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3029
|
-
188,
|
|
3030
|
-
129,
|
|
3031
|
-
185,
|
|
3032
|
-
44,
|
|
3033
|
-
234,
|
|
3034
|
-
71,
|
|
3035
|
-
53,
|
|
3036
|
-
60
|
|
3037
|
-
])), 0)) return 4;
|
|
3038
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3039
|
-
243,
|
|
3040
|
-
30,
|
|
3041
|
-
148,
|
|
3042
|
-
22,
|
|
3043
|
-
14,
|
|
3044
|
-
127,
|
|
3045
|
-
52,
|
|
3046
|
-
140
|
|
3047
|
-
])), 0)) return 5;
|
|
3048
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3049
|
-
12,
|
|
3050
|
-
28,
|
|
3051
|
-
152,
|
|
3052
|
-
148,
|
|
3053
|
-
55,
|
|
3054
|
-
210,
|
|
3055
|
-
102,
|
|
3056
|
-
190
|
|
3057
|
-
])), 0)) return 6;
|
|
3058
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3059
|
-
195,
|
|
3060
|
-
109,
|
|
3061
|
-
77,
|
|
3062
|
-
196,
|
|
3063
|
-
134,
|
|
3064
|
-
226,
|
|
3065
|
-
78,
|
|
3066
|
-
108
|
|
3067
|
-
])), 0)) return 7;
|
|
3068
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3069
|
-
217,
|
|
3070
|
-
83,
|
|
3071
|
-
68,
|
|
3072
|
-
137,
|
|
3073
|
-
134,
|
|
3074
|
-
225,
|
|
3075
|
-
94,
|
|
3076
|
-
45
|
|
3077
|
-
])), 0)) return 8;
|
|
3078
|
-
throw new Error("The provided event could not be identified as a gaboxV2 event.");
|
|
3079
|
-
}
|
|
3080
|
-
let GaboxV2Instruction = /* @__PURE__ */ function(GaboxV2Instruction) {
|
|
3081
|
-
GaboxV2Instruction[GaboxV2Instruction["BindReferrer"] = 0] = "BindReferrer";
|
|
3082
|
-
GaboxV2Instruction[GaboxV2Instruction["BuyPack"] = 1] = "BuyPack";
|
|
3083
|
-
GaboxV2Instruction[GaboxV2Instruction["ClaimPrize"] = 2] = "ClaimPrize";
|
|
3084
|
-
GaboxV2Instruction[GaboxV2Instruction["ClaimReferral"] = 3] = "ClaimReferral";
|
|
3085
|
-
GaboxV2Instruction[GaboxV2Instruction["DeliverDraw"] = 4] = "DeliverDraw";
|
|
3086
|
-
GaboxV2Instruction[GaboxV2Instruction["ExpireDraw"] = 5] = "ExpireDraw";
|
|
3087
|
-
GaboxV2Instruction[GaboxV2Instruction["FulfillDraw"] = 6] = "FulfillDraw";
|
|
3088
|
-
GaboxV2Instruction[GaboxV2Instruction["FundPrizes"] = 7] = "FundPrizes";
|
|
3089
|
-
GaboxV2Instruction[GaboxV2Instruction["InitializePool"] = 8] = "InitializePool";
|
|
3090
|
-
GaboxV2Instruction[GaboxV2Instruction["RetryDraw"] = 9] = "RetryDraw";
|
|
3091
|
-
GaboxV2Instruction[GaboxV2Instruction["SellPrize"] = 10] = "SellPrize";
|
|
3092
|
-
GaboxV2Instruction[GaboxV2Instruction["SellTokens"] = 11] = "SellTokens";
|
|
3093
|
-
return GaboxV2Instruction;
|
|
3094
|
-
}({});
|
|
3095
|
-
function identifyGaboxV2Instruction(instruction) {
|
|
3096
|
-
const data = "data" in instruction ? instruction.data : instruction;
|
|
3097
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3098
|
-
45,
|
|
3099
|
-
172,
|
|
3100
|
-
18,
|
|
3101
|
-
187,
|
|
3102
|
-
3,
|
|
3103
|
-
160,
|
|
3104
|
-
196,
|
|
3105
|
-
176
|
|
3106
|
-
])), 0)) return 0;
|
|
3107
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3108
|
-
151,
|
|
3109
|
-
46,
|
|
3110
|
-
141,
|
|
3111
|
-
93,
|
|
3112
|
-
174,
|
|
3113
|
-
5,
|
|
3114
|
-
49,
|
|
3115
|
-
173
|
|
3116
|
-
])), 0)) return 1;
|
|
3117
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3118
|
-
157,
|
|
3119
|
-
233,
|
|
3120
|
-
139,
|
|
3121
|
-
121,
|
|
3122
|
-
246,
|
|
3123
|
-
62,
|
|
3124
|
-
234,
|
|
3125
|
-
235
|
|
3126
|
-
])), 0)) return 2;
|
|
3127
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3128
|
-
219,
|
|
3129
|
-
247,
|
|
3130
|
-
18,
|
|
3131
|
-
148,
|
|
3132
|
-
63,
|
|
3133
|
-
247,
|
|
3134
|
-
112,
|
|
3135
|
-
198
|
|
3136
|
-
])), 0)) return 3;
|
|
3137
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3138
|
-
113,
|
|
3139
|
-
181,
|
|
3140
|
-
226,
|
|
3141
|
-
173,
|
|
3142
|
-
237,
|
|
3143
|
-
138,
|
|
3144
|
-
199,
|
|
3145
|
-
51
|
|
3146
|
-
])), 0)) return 4;
|
|
3147
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3148
|
-
100,
|
|
3149
|
-
119,
|
|
3150
|
-
235,
|
|
3151
|
-
75,
|
|
3152
|
-
8,
|
|
3153
|
-
25,
|
|
3154
|
-
252,
|
|
3155
|
-
255
|
|
3156
|
-
])), 0)) return 5;
|
|
3157
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3158
|
-
136,
|
|
3159
|
-
46,
|
|
3160
|
-
22,
|
|
3161
|
-
51,
|
|
3162
|
-
33,
|
|
3163
|
-
153,
|
|
3164
|
-
232,
|
|
3165
|
-
234
|
|
3166
|
-
])), 0)) return 6;
|
|
3167
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3168
|
-
163,
|
|
3169
|
-
225,
|
|
3170
|
-
193,
|
|
3171
|
-
125,
|
|
3172
|
-
144,
|
|
3173
|
-
171,
|
|
3174
|
-
29,
|
|
3175
|
-
241
|
|
3176
|
-
])), 0)) return 7;
|
|
3177
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3178
|
-
95,
|
|
3179
|
-
180,
|
|
3180
|
-
10,
|
|
3181
|
-
172,
|
|
3182
|
-
84,
|
|
3183
|
-
174,
|
|
3184
|
-
232,
|
|
3185
|
-
40
|
|
3186
|
-
])), 0)) return 8;
|
|
3187
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3188
|
-
112,
|
|
3189
|
-
118,
|
|
3190
|
-
137,
|
|
3191
|
-
120,
|
|
3192
|
-
211,
|
|
3193
|
-
39,
|
|
3194
|
-
196,
|
|
3195
|
-
96
|
|
3196
|
-
])), 0)) return 9;
|
|
3197
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3198
|
-
235,
|
|
3199
|
-
236,
|
|
3200
|
-
8,
|
|
3201
|
-
137,
|
|
3202
|
-
79,
|
|
3203
|
-
25,
|
|
3204
|
-
208,
|
|
3205
|
-
235
|
|
3206
|
-
])), 0)) return 10;
|
|
3207
|
-
if (containsBytes(data, fixEncoderSize(getBytesEncoder(), 8).encode(new Uint8Array([
|
|
3208
|
-
114,
|
|
3209
|
-
242,
|
|
3210
|
-
25,
|
|
3211
|
-
12,
|
|
3212
|
-
62,
|
|
3213
|
-
126,
|
|
3214
|
-
92,
|
|
3215
|
-
2
|
|
3216
|
-
])), 0)) return 11;
|
|
3217
|
-
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
3218
|
-
instructionData: data,
|
|
3219
|
-
programName: "gaboxV2"
|
|
3220
|
-
});
|
|
3221
|
-
}
|
|
3222
|
-
function parseGaboxV2Instruction(instruction) {
|
|
3223
|
-
const instructionType = identifyGaboxV2Instruction(instruction);
|
|
3224
|
-
switch (instructionType) {
|
|
3225
|
-
case 0:
|
|
3226
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3227
|
-
return {
|
|
3228
|
-
instructionType: 0,
|
|
3229
|
-
...parseBindReferrerInstruction(instruction)
|
|
3230
|
-
};
|
|
3231
|
-
case 1:
|
|
3232
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3233
|
-
return {
|
|
3234
|
-
instructionType: 1,
|
|
3235
|
-
...parseBuyPackInstruction(instruction)
|
|
3236
|
-
};
|
|
3237
|
-
case 2:
|
|
3238
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3239
|
-
return {
|
|
3240
|
-
instructionType: 2,
|
|
3241
|
-
...parseClaimPrizeInstruction(instruction)
|
|
3242
|
-
};
|
|
3243
|
-
case 3:
|
|
3244
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3245
|
-
return {
|
|
3246
|
-
instructionType: 3,
|
|
3247
|
-
...parseClaimReferralInstruction(instruction)
|
|
3248
|
-
};
|
|
3249
|
-
case 4:
|
|
3250
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3251
|
-
return {
|
|
3252
|
-
instructionType: 4,
|
|
3253
|
-
...parseDeliverDrawInstruction(instruction)
|
|
3254
|
-
};
|
|
3255
|
-
case 5:
|
|
3256
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3257
|
-
return {
|
|
3258
|
-
instructionType: 5,
|
|
3259
|
-
...parseExpireDrawInstruction(instruction)
|
|
3260
|
-
};
|
|
3261
|
-
case 6:
|
|
3262
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3263
|
-
return {
|
|
3264
|
-
instructionType: 6,
|
|
3265
|
-
...parseFulfillDrawInstruction(instruction)
|
|
3266
|
-
};
|
|
3267
|
-
case 7:
|
|
3268
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3269
|
-
return {
|
|
3270
|
-
instructionType: 7,
|
|
3271
|
-
...parseFundPrizesInstruction(instruction)
|
|
3272
|
-
};
|
|
3273
|
-
case 8:
|
|
3274
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3275
|
-
return {
|
|
3276
|
-
instructionType: 8,
|
|
3277
|
-
...parseInitializePoolInstruction(instruction)
|
|
3278
|
-
};
|
|
3279
|
-
case 9:
|
|
3280
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3281
|
-
return {
|
|
3282
|
-
instructionType: 9,
|
|
3283
|
-
...parseRetryDrawInstruction(instruction)
|
|
3284
|
-
};
|
|
3285
|
-
case 10:
|
|
3286
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3287
|
-
return {
|
|
3288
|
-
instructionType: 10,
|
|
3289
|
-
...parseSellPrizeInstruction(instruction)
|
|
3290
|
-
};
|
|
3291
|
-
case 11:
|
|
3292
|
-
assertIsInstructionWithAccounts(instruction);
|
|
3293
|
-
return {
|
|
3294
|
-
instructionType: 11,
|
|
3295
|
-
...parseSellTokensInstruction(instruction)
|
|
3296
|
-
};
|
|
3297
|
-
default: throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
3298
|
-
instructionType,
|
|
3299
|
-
programName: "gaboxV2"
|
|
3300
|
-
});
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
function gaboxV2Program() {
|
|
3304
|
-
return (client) => {
|
|
3305
|
-
return extendClient(client, { gaboxV2: {
|
|
3306
|
-
accounts: {
|
|
3307
|
-
draw: addSelfFetchFunctions(client, getDrawCodec()),
|
|
3308
|
-
pool: addSelfFetchFunctions(client, getPoolCodec()),
|
|
3309
|
-
referral: addSelfFetchFunctions(client, getReferralCodec()),
|
|
3310
|
-
referralLink: addSelfFetchFunctions(client, getReferralLinkCodec())
|
|
3311
|
-
},
|
|
3312
|
-
instructions: {
|
|
3313
|
-
bindReferrer: (input) => addSelfPlanAndSendFunctions(client, getBindReferrerInstructionAsync(input)),
|
|
3314
|
-
buyPack: (input) => addSelfPlanAndSendFunctions(client, getBuyPackInstructionAsync(input)),
|
|
3315
|
-
claimPrize: (input) => addSelfPlanAndSendFunctions(client, getClaimPrizeInstructionAsync(input)),
|
|
3316
|
-
claimReferral: (input) => addSelfPlanAndSendFunctions(client, getClaimReferralInstructionAsync(input)),
|
|
3317
|
-
deliverDraw: (input) => addSelfPlanAndSendFunctions(client, getDeliverDrawInstructionAsync(input)),
|
|
3318
|
-
expireDraw: (input) => addSelfPlanAndSendFunctions(client, getExpireDrawInstructionAsync(input)),
|
|
3319
|
-
fulfillDraw: (input) => addSelfPlanAndSendFunctions(client, getFulfillDrawInstructionAsync(input)),
|
|
3320
|
-
fundPrizes: (input) => addSelfPlanAndSendFunctions(client, getFundPrizesInstruction(input)),
|
|
3321
|
-
initializePool: (input) => addSelfPlanAndSendFunctions(client, getInitializePoolInstructionAsync(input)),
|
|
3322
|
-
retryDraw: (input) => addSelfPlanAndSendFunctions(client, getRetryDrawInstructionAsync({
|
|
3323
|
-
...input,
|
|
3324
|
-
payer: input.payer ?? client.payer
|
|
3325
|
-
})),
|
|
3326
|
-
sellPrize: (input) => addSelfPlanAndSendFunctions(client, getSellPrizeInstructionAsync(input)),
|
|
3327
|
-
sellTokens: (input) => addSelfPlanAndSendFunctions(client, getSellTokensInstructionAsync(input))
|
|
3328
|
-
},
|
|
3329
|
-
pdas: {
|
|
3330
|
-
link: findLinkPda,
|
|
3331
|
-
identity: findIdentityPda,
|
|
3332
|
-
referralLink: findReferralLinkPda,
|
|
3333
|
-
referral: findReferralPda,
|
|
3334
|
-
pool: findPoolPda,
|
|
3335
|
-
claimReferralReferral: findClaimReferralReferralPda,
|
|
3336
|
-
draw: findDrawPda
|
|
3337
|
-
},
|
|
3338
|
-
identifyAccount: identifyGaboxV2Account,
|
|
3339
|
-
identifyInstruction: identifyGaboxV2Instruction,
|
|
3340
|
-
parseInstruction: parseGaboxV2Instruction
|
|
3341
|
-
} });
|
|
3342
|
-
};
|
|
3343
|
-
}
|
|
3344
|
-
//#endregion
|
|
3345
|
-
export { getFulfillDrawInstructionDataCodec as $, getPrizeEncoder as $n, findPoolPda as $t, getRetryDrawInstructionDataCodec as A, fetchMaybePool as An, getClaimPrizeInstructionAsync as At, getInitializePoolInstructionDataEncoder as B, fetchAllMaybeDraw as Bn, getBuyPackInstructionDataDecoder as Bt, getSellPrizeInstructionDataDecoder as C, getReferralDiscriminatorBytes as Cn, getClaimReferralInstructionDataCodec as Ct, getRetryDrawDiscriminatorBytes as D, decodePool as Dn, CLAIM_PRIZE_DISCRIMINATOR as Dt, RETRY_DRAW_DISCRIMINATOR as E, POOL_DISCRIMINATOR as En, parseClaimReferralInstruction as Et, getInitializePoolDiscriminatorBytes as F, getPoolEncoder as Fn, BUY_PACK_DISCRIMINATOR as Ft, getFundPrizesInstructionDataCodec as G, getDrawDiscriminatorBytes as Gn, getBindReferrerInstruction as Gt, FUND_PRIZES_DISCRIMINATOR as H, fetchMaybeDraw as Hn, parseBuyPackInstruction as Ht, getInitializePoolInstruction as I, getPoolSize as In, getBuyPackDiscriminatorBytes as It, parseFundPrizesInstruction as J, getTierCodec as Jn, getBindReferrerInstructionDataDecoder as Jt, getFundPrizesInstructionDataDecoder as K, getDrawEncoder as Kn, getBindReferrerInstructionAsync as Kt, getInitializePoolInstructionAsync as L, DRAW_DISCRIMINATOR as Ln, getBuyPackInstruction as Lt, getRetryDrawInstructionDataEncoder as M, getPoolCodec as Mn, getClaimPrizeInstructionDataDecoder as Mt, parseRetryDrawInstruction as N, getPoolDecoder as Nn, getClaimPrizeInstructionDataEncoder as Nt, getRetryDrawInstruction as O, fetchAllMaybePool as On, getClaimPrizeDiscriminatorBytes as Ot, INITIALIZE_POOL_DISCRIMINATOR as P, getPoolDiscriminatorBytes as Pn, parseClaimPrizeInstruction as Pt, getFulfillDrawInstructionAsync as Q, getPrizeDecoder as Qn, findReferralPda as Qt, getInitializePoolInstructionDataCodec as R, decodeDraw as Rn, getBuyPackInstructionAsync as Rt, getSellPrizeInstructionDataCodec as S, getReferralDecoder as Sn, getClaimReferralInstructionAsync as St, parseSellPrizeInstruction as T, getReferralSize as Tn, getClaimReferralInstructionDataEncoder as Tt, getFundPrizesDiscriminatorBytes as U, getDrawCodec as Un, BIND_REFERRER_DISCRIMINATOR as Ut, parseInitializePoolInstruction as V, fetchDraw as Vn, getBuyPackInstructionDataEncoder as Vt, getFundPrizesInstruction as W, getDrawDecoder as Wn, getBindReferrerDiscriminatorBytes as Wt, getFulfillDrawDiscriminatorBytes as X, getTierEncoder as Xn, parseBindReferrerInstruction as Xt, FULFILL_DRAW_DISCRIMINATOR as Y, getTierDecoder as Yn, getBindReferrerInstructionDataEncoder as Yt, getFulfillDrawInstruction as Z, getPrizeCodec as Zn, findReferralLinkPda as Zt, parseSellTokensInstruction as _, fetchAllMaybeReferral as _n, getDeliverDrawInstructionDataEncoder as _t, gaboxV2Program as a, decodeReferralLink as an, getExpireDrawInstruction as at, getSellPrizeInstruction as b, fetchReferral as bn, getClaimReferralDiscriminatorBytes as bt, identifyGaboxV2Instruction as c, fetchMaybeReferralLink as cn, getExpireDrawInstructionDataDecoder as ct, getSellTokensDiscriminatorBytes as d, getReferralLinkDecoder as dn, DELIVER_DRAW_DISCRIMINATOR as dt, findLinkPda as en, DrawStatus as er, getFulfillDrawInstructionDataDecoder as et, getSellTokensInstruction as f, getReferralLinkDiscriminatorBytes as fn, getDeliverDrawDiscriminatorBytes as ft, getSellTokensInstructionDataEncoder as g, decodeReferral as gn, getDeliverDrawInstructionDataDecoder as gt, getSellTokensInstructionDataDecoder as h, REFERRAL_DISCRIMINATOR as hn, getDeliverDrawInstructionDataCodec as ht, GaboxV2Instruction as i, REFERRAL_LINK_DISCRIMINATOR as in, getExpireDrawDiscriminatorBytes as it, getRetryDrawInstructionDataDecoder as j, fetchPool as jn, getClaimPrizeInstructionDataCodec as jt, getRetryDrawInstructionAsync as k, fetchAllPool as kn, getClaimPrizeInstruction as kt, parseGaboxV2Instruction as l, fetchReferralLink as ln, getExpireDrawInstructionDataEncoder as lt, getSellTokensInstructionDataCodec as m, getReferralLinkSize as mn, getDeliverDrawInstructionAsync as mt, GaboxV2Account as n, findDrawPda as nn, getDrawStatusDecoder as nr, parseFulfillDrawInstruction as nt, identifyGaboxV2Account as o, fetchAllMaybeReferralLink as on, getExpireDrawInstructionAsync as ot, getSellTokensInstructionAsync as p, getReferralLinkEncoder as pn, getDeliverDrawInstruction as pt, getFundPrizesInstructionDataEncoder as q, getDrawSize as qn, getBindReferrerInstructionDataCodec as qt, GaboxV2Event as r, findClaimReferralReferralPda as rn, getDrawStatusEncoder as rr, EXPIRE_DRAW_DISCRIMINATOR as rt, identifyGaboxV2Event as s, fetchAllReferralLink as sn, getExpireDrawInstructionDataCodec as st, GABOX_V2_PROGRAM_ADDRESS as t, findIdentityPda as tn, getDrawStatusCodec as tr, getFulfillDrawInstructionDataEncoder as tt, SELL_TOKENS_DISCRIMINATOR as u, getReferralLinkCodec as un, parseExpireDrawInstruction as ut, SELL_PRIZE_DISCRIMINATOR as v, fetchAllReferral as vn, parseDeliverDrawInstruction as vt, getSellPrizeInstructionDataEncoder as w, getReferralEncoder as wn, getClaimReferralInstructionDataDecoder as wt, getSellPrizeInstructionAsync as x, getReferralCodec as xn, getClaimReferralInstruction as xt, getSellPrizeDiscriminatorBytes as y, fetchMaybeReferral as yn, CLAIM_REFERRAL_DISCRIMINATOR as yt, getInitializePoolInstructionDataDecoder as z, fetchAllDraw as zn, getBuyPackInstructionDataCodec as zt };
|
|
3346
|
-
|
|
3347
|
-
//# sourceMappingURL=gaboxV2-CV2XltqC.js.map
|