@solana/token-acl-gate-sdk 0.2.0 → 0.3.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/dist/src/index.js +267 -75
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +248 -75
- package/dist/src/index.mjs.map +1 -1
- package/dist/types/generated/accounts/listConfig.d.ts +2 -1
- package/dist/types/generated/accounts/listConfig.d.ts.map +1 -1
- package/dist/types/generated/accounts/walletEntry.d.ts +2 -1
- package/dist/types/generated/accounts/walletEntry.d.ts.map +1 -1
- package/dist/types/generated/instructions/addWallet.d.ts +1 -12
- package/dist/types/generated/instructions/addWallet.d.ts.map +1 -1
- package/dist/types/generated/instructions/canFreezePermissionless.d.ts +52 -0
- package/dist/types/generated/instructions/canFreezePermissionless.d.ts.map +1 -0
- package/dist/types/generated/instructions/canThawPermissionless.d.ts +57 -0
- package/dist/types/generated/instructions/canThawPermissionless.d.ts.map +1 -0
- package/dist/types/generated/instructions/createList.d.ts +1 -12
- package/dist/types/generated/instructions/createList.d.ts.map +1 -1
- package/dist/types/generated/instructions/deleteList.d.ts +1 -1
- package/dist/types/generated/instructions/deleteList.d.ts.map +1 -1
- package/dist/types/generated/instructions/index.d.ts +3 -0
- package/dist/types/generated/instructions/index.d.ts.map +1 -1
- package/dist/types/generated/instructions/removeWallet.d.ts +1 -1
- package/dist/types/generated/instructions/removeWallet.d.ts.map +1 -1
- package/dist/types/generated/instructions/setupExtraMetas.d.ts +6 -2
- package/dist/types/generated/instructions/setupExtraMetas.d.ts.map +1 -1
- package/dist/types/generated/instructions/setupFreezeExtraMetas.d.ts +52 -0
- package/dist/types/generated/instructions/setupFreezeExtraMetas.d.ts.map +1 -0
- package/dist/types/generated/programs/tokenAclGateProgram.d.ts +12 -3
- package/dist/types/generated/programs/tokenAclGateProgram.d.ts.map +1 -1
- package/dist/types/generated/types/mode.d.ts +1 -1
- package/dist/types/generated/types/mode.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/src/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getProgramDerivedAddress, getUtf8Encoder, getAddressEncoder, getU8Encoder, transformEncoder, getStructEncoder, getU64Encoder, getStructDecoder, getU8Decoder, getAddressDecoder, getU64Decoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, getEnumEncoder, getEnumDecoder,
|
|
1
|
+
import { getProgramDerivedAddress, getUtf8Encoder, getAddressEncoder, getU8Encoder, transformEncoder, getStructEncoder, getU64Encoder, getStructDecoder, getU8Decoder, getAddressDecoder, getU64Decoder, combineCodec, decodeAccount, assertAccountExists, fetchEncodedAccount, assertAccountsExist, fetchEncodedAccounts, containsBytes, AccountRole, getEnumEncoder, getEnumDecoder, upgradeRoleToSigner, isTransactionSigner as isTransactionSigner$1 } from '@solana/kit';
|
|
2
2
|
|
|
3
3
|
// src/generated/accounts/listConfig.ts
|
|
4
4
|
async function findListConfigPda(seeds, config = {}) {
|
|
@@ -42,7 +42,10 @@ function getListConfigEncoder() {
|
|
|
42
42
|
["mode", getU8Encoder()],
|
|
43
43
|
["walletsCount", getU64Encoder()]
|
|
44
44
|
]),
|
|
45
|
-
(value) => ({
|
|
45
|
+
(value) => ({
|
|
46
|
+
...value,
|
|
47
|
+
discriminator: value.discriminator ?? LIST_CONFIG_DISCRIMINATOR
|
|
48
|
+
})
|
|
46
49
|
);
|
|
47
50
|
}
|
|
48
51
|
function getListConfigDecoder() {
|
|
@@ -105,7 +108,10 @@ function getWalletEntryEncoder() {
|
|
|
105
108
|
["walletAddress", getAddressEncoder()],
|
|
106
109
|
["listConfig", getAddressEncoder()]
|
|
107
110
|
]),
|
|
108
|
-
(value) => ({
|
|
111
|
+
(value) => ({
|
|
112
|
+
...value,
|
|
113
|
+
discriminator: value.discriminator ?? WALLET_ENTRY_DISCRIMINATOR
|
|
114
|
+
})
|
|
109
115
|
);
|
|
110
116
|
}
|
|
111
117
|
function getWalletEntryDecoder() {
|
|
@@ -170,7 +176,7 @@ function identifyTokenAclGateProgramAccount(account) {
|
|
|
170
176
|
return 1 /* WalletEntry */;
|
|
171
177
|
}
|
|
172
178
|
throw new Error(
|
|
173
|
-
"The provided account could not be identified as a
|
|
179
|
+
"The provided account could not be identified as a tokenAclGateProgram account."
|
|
174
180
|
);
|
|
175
181
|
}
|
|
176
182
|
var TokenAclGateProgramInstruction = /* @__PURE__ */ ((TokenAclGateProgramInstruction2) => {
|
|
@@ -179,6 +185,9 @@ var TokenAclGateProgramInstruction = /* @__PURE__ */ ((TokenAclGateProgramInstru
|
|
|
179
185
|
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["RemoveWallet"] = 2] = "RemoveWallet";
|
|
180
186
|
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["SetupExtraMetas"] = 3] = "SetupExtraMetas";
|
|
181
187
|
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["DeleteList"] = 4] = "DeleteList";
|
|
188
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["SetupFreezeExtraMetas"] = 5] = "SetupFreezeExtraMetas";
|
|
189
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["CanThawPermissionless"] = 6] = "CanThawPermissionless";
|
|
190
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["CanFreezePermissionless"] = 7] = "CanFreezePermissionless";
|
|
182
191
|
return TokenAclGateProgramInstruction2;
|
|
183
192
|
})(TokenAclGateProgramInstruction || {});
|
|
184
193
|
function identifyTokenAclGateProgramInstruction(instruction) {
|
|
@@ -198,16 +207,19 @@ function identifyTokenAclGateProgramInstruction(instruction) {
|
|
|
198
207
|
if (containsBytes(data, getU8Encoder().encode(5), 0)) {
|
|
199
208
|
return 4 /* DeleteList */;
|
|
200
209
|
}
|
|
210
|
+
if (containsBytes(data, getU8Encoder().encode(6), 0)) {
|
|
211
|
+
return 5 /* SetupFreezeExtraMetas */;
|
|
212
|
+
}
|
|
213
|
+
if (containsBytes(data, getU8Encoder().encode(8), 0)) {
|
|
214
|
+
return 6 /* CanThawPermissionless */;
|
|
215
|
+
}
|
|
216
|
+
if (containsBytes(data, getU8Encoder().encode(214), 0)) {
|
|
217
|
+
return 7 /* CanFreezePermissionless */;
|
|
218
|
+
}
|
|
201
219
|
throw new Error(
|
|
202
|
-
"The provided instruction could not be identified as a
|
|
220
|
+
"The provided instruction could not be identified as a tokenAclGateProgram instruction."
|
|
203
221
|
);
|
|
204
222
|
}
|
|
205
|
-
function expectSome(value) {
|
|
206
|
-
if (value === null || value === void 0) {
|
|
207
|
-
throw new Error("Expected a value but received null or undefined.");
|
|
208
|
-
}
|
|
209
|
-
return value;
|
|
210
|
-
}
|
|
211
223
|
function expectAddress(value) {
|
|
212
224
|
if (!value) {
|
|
213
225
|
throw new Error("Expected a Address.");
|
|
@@ -260,7 +272,7 @@ function getAddWalletInstructionDataCodec() {
|
|
|
260
272
|
getAddWalletInstructionDataDecoder()
|
|
261
273
|
);
|
|
262
274
|
}
|
|
263
|
-
|
|
275
|
+
function getAddWalletInstruction(input, config) {
|
|
264
276
|
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
265
277
|
const originalAccounts = {
|
|
266
278
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
@@ -271,12 +283,6 @@ async function getAddWalletInstructionAsync(input, config) {
|
|
|
271
283
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
272
284
|
};
|
|
273
285
|
const accounts = originalAccounts;
|
|
274
|
-
if (!accounts.walletEntry.value) {
|
|
275
|
-
accounts.walletEntry.value = await findWalletEntryPda({
|
|
276
|
-
listConfig: expectAddress(accounts.listConfig.value),
|
|
277
|
-
wallet: expectAddress(accounts.wallet.value)
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
286
|
if (!accounts.systemProgram.value) {
|
|
281
287
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
282
288
|
}
|
|
@@ -294,35 +300,155 @@ async function getAddWalletInstructionAsync(input, config) {
|
|
|
294
300
|
programAddress
|
|
295
301
|
});
|
|
296
302
|
}
|
|
297
|
-
function
|
|
303
|
+
function parseAddWalletInstruction(instruction) {
|
|
304
|
+
if (instruction.accounts.length < 6) {
|
|
305
|
+
throw new Error("Not enough accounts");
|
|
306
|
+
}
|
|
307
|
+
let accountIndex = 0;
|
|
308
|
+
const getNextAccount = () => {
|
|
309
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
310
|
+
accountIndex += 1;
|
|
311
|
+
return accountMeta;
|
|
312
|
+
};
|
|
313
|
+
return {
|
|
314
|
+
programAddress: instruction.programAddress,
|
|
315
|
+
accounts: {
|
|
316
|
+
authority: getNextAccount(),
|
|
317
|
+
payer: getNextAccount(),
|
|
318
|
+
listConfig: getNextAccount(),
|
|
319
|
+
wallet: getNextAccount(),
|
|
320
|
+
walletEntry: getNextAccount(),
|
|
321
|
+
systemProgram: getNextAccount()
|
|
322
|
+
},
|
|
323
|
+
data: getAddWalletInstructionDataDecoder().decode(instruction.data)
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
var CAN_FREEZE_PERMISSIONLESS_DISCRIMINATOR = 214;
|
|
327
|
+
function getCanFreezePermissionlessDiscriminatorBytes() {
|
|
328
|
+
return getU8Encoder().encode(CAN_FREEZE_PERMISSIONLESS_DISCRIMINATOR);
|
|
329
|
+
}
|
|
330
|
+
function getCanFreezePermissionlessInstructionDataEncoder() {
|
|
331
|
+
return transformEncoder(
|
|
332
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
333
|
+
(value) => ({
|
|
334
|
+
...value,
|
|
335
|
+
discriminator: CAN_FREEZE_PERMISSIONLESS_DISCRIMINATOR
|
|
336
|
+
})
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
function getCanFreezePermissionlessInstructionDataDecoder() {
|
|
340
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
341
|
+
}
|
|
342
|
+
function getCanFreezePermissionlessInstructionDataCodec() {
|
|
343
|
+
return combineCodec(
|
|
344
|
+
getCanFreezePermissionlessInstructionDataEncoder(),
|
|
345
|
+
getCanFreezePermissionlessInstructionDataDecoder()
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
function getCanFreezePermissionlessInstruction(input, config) {
|
|
298
349
|
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
299
350
|
const originalAccounts = {
|
|
300
351
|
authority: { value: input.authority ?? null, isWritable: false },
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
352
|
+
tokenAccount: { value: input.tokenAccount ?? null, isWritable: false },
|
|
353
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
354
|
+
owner: { value: input.owner ?? null, isWritable: false },
|
|
355
|
+
flagAccount: { value: input.flagAccount ?? null, isWritable: false },
|
|
356
|
+
extraMetas: { value: input.extraMetas ?? null, isWritable: false }
|
|
306
357
|
};
|
|
307
358
|
const accounts = originalAccounts;
|
|
308
|
-
|
|
309
|
-
|
|
359
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
360
|
+
return Object.freeze({
|
|
361
|
+
accounts: [
|
|
362
|
+
getAccountMeta(accounts.authority),
|
|
363
|
+
getAccountMeta(accounts.tokenAccount),
|
|
364
|
+
getAccountMeta(accounts.mint),
|
|
365
|
+
getAccountMeta(accounts.owner),
|
|
366
|
+
getAccountMeta(accounts.flagAccount),
|
|
367
|
+
getAccountMeta(accounts.extraMetas)
|
|
368
|
+
],
|
|
369
|
+
data: getCanFreezePermissionlessInstructionDataEncoder().encode({}),
|
|
370
|
+
programAddress
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function parseCanFreezePermissionlessInstruction(instruction) {
|
|
374
|
+
if (instruction.accounts.length < 6) {
|
|
375
|
+
throw new Error("Not enough accounts");
|
|
310
376
|
}
|
|
377
|
+
let accountIndex = 0;
|
|
378
|
+
const getNextAccount = () => {
|
|
379
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
380
|
+
accountIndex += 1;
|
|
381
|
+
return accountMeta;
|
|
382
|
+
};
|
|
383
|
+
return {
|
|
384
|
+
programAddress: instruction.programAddress,
|
|
385
|
+
accounts: {
|
|
386
|
+
authority: getNextAccount(),
|
|
387
|
+
tokenAccount: getNextAccount(),
|
|
388
|
+
mint: getNextAccount(),
|
|
389
|
+
owner: getNextAccount(),
|
|
390
|
+
flagAccount: getNextAccount(),
|
|
391
|
+
extraMetas: getNextAccount()
|
|
392
|
+
},
|
|
393
|
+
data: getCanFreezePermissionlessInstructionDataDecoder().decode(
|
|
394
|
+
instruction.data
|
|
395
|
+
)
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
var CAN_THAW_PERMISSIONLESS_DISCRIMINATOR = 8;
|
|
399
|
+
function getCanThawPermissionlessDiscriminatorBytes() {
|
|
400
|
+
return getU8Encoder().encode(CAN_THAW_PERMISSIONLESS_DISCRIMINATOR);
|
|
401
|
+
}
|
|
402
|
+
function getCanThawPermissionlessInstructionDataEncoder() {
|
|
403
|
+
return transformEncoder(
|
|
404
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
405
|
+
(value) => ({
|
|
406
|
+
...value,
|
|
407
|
+
discriminator: CAN_THAW_PERMISSIONLESS_DISCRIMINATOR
|
|
408
|
+
})
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function getCanThawPermissionlessInstructionDataDecoder() {
|
|
412
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
413
|
+
}
|
|
414
|
+
function getCanThawPermissionlessInstructionDataCodec() {
|
|
415
|
+
return combineCodec(
|
|
416
|
+
getCanThawPermissionlessInstructionDataEncoder(),
|
|
417
|
+
getCanThawPermissionlessInstructionDataDecoder()
|
|
418
|
+
);
|
|
419
|
+
}
|
|
420
|
+
function getCanThawPermissionlessInstruction(input, config) {
|
|
421
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
422
|
+
const originalAccounts = {
|
|
423
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
424
|
+
tokenAccount: { value: input.tokenAccount ?? null, isWritable: false },
|
|
425
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
426
|
+
owner: { value: input.owner ?? null, isWritable: false },
|
|
427
|
+
flagAccount: { value: input.flagAccount ?? null, isWritable: false },
|
|
428
|
+
extraMetas: { value: input.extraMetas ?? null, isWritable: false }
|
|
429
|
+
};
|
|
430
|
+
const accounts = originalAccounts;
|
|
431
|
+
const args = { ...input };
|
|
432
|
+
const remainingAccounts = args.addresses.map((address) => ({
|
|
433
|
+
address,
|
|
434
|
+
role: AccountRole.READONLY
|
|
435
|
+
}));
|
|
311
436
|
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
312
437
|
return Object.freeze({
|
|
313
438
|
accounts: [
|
|
314
439
|
getAccountMeta(accounts.authority),
|
|
315
|
-
getAccountMeta(accounts.
|
|
316
|
-
getAccountMeta(accounts.
|
|
317
|
-
getAccountMeta(accounts.
|
|
318
|
-
getAccountMeta(accounts.
|
|
319
|
-
getAccountMeta(accounts.
|
|
440
|
+
getAccountMeta(accounts.tokenAccount),
|
|
441
|
+
getAccountMeta(accounts.mint),
|
|
442
|
+
getAccountMeta(accounts.owner),
|
|
443
|
+
getAccountMeta(accounts.flagAccount),
|
|
444
|
+
getAccountMeta(accounts.extraMetas),
|
|
445
|
+
...remainingAccounts
|
|
320
446
|
],
|
|
321
|
-
data:
|
|
447
|
+
data: getCanThawPermissionlessInstructionDataEncoder().encode({}),
|
|
322
448
|
programAddress
|
|
323
449
|
});
|
|
324
450
|
}
|
|
325
|
-
function
|
|
451
|
+
function parseCanThawPermissionlessInstruction(instruction) {
|
|
326
452
|
if (instruction.accounts.length < 6) {
|
|
327
453
|
throw new Error("Not enough accounts");
|
|
328
454
|
}
|
|
@@ -336,18 +462,20 @@ function parseAddWalletInstruction(instruction) {
|
|
|
336
462
|
programAddress: instruction.programAddress,
|
|
337
463
|
accounts: {
|
|
338
464
|
authority: getNextAccount(),
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
465
|
+
tokenAccount: getNextAccount(),
|
|
466
|
+
mint: getNextAccount(),
|
|
467
|
+
owner: getNextAccount(),
|
|
468
|
+
flagAccount: getNextAccount(),
|
|
469
|
+
extraMetas: getNextAccount()
|
|
344
470
|
},
|
|
345
|
-
data:
|
|
471
|
+
data: getCanThawPermissionlessInstructionDataDecoder().decode(
|
|
472
|
+
instruction.data
|
|
473
|
+
)
|
|
346
474
|
};
|
|
347
475
|
}
|
|
348
476
|
var Mode = /* @__PURE__ */ ((Mode2) => {
|
|
349
477
|
Mode2[Mode2["Allow"] = 0] = "Allow";
|
|
350
|
-
Mode2[Mode2["
|
|
478
|
+
Mode2[Mode2["Unused"] = 1] = "Unused";
|
|
351
479
|
Mode2[Mode2["Block"] = 2] = "Block";
|
|
352
480
|
return Mode2;
|
|
353
481
|
})(Mode || {});
|
|
@@ -389,39 +517,6 @@ function getCreateListInstructionDataCodec() {
|
|
|
389
517
|
getCreateListInstructionDataDecoder()
|
|
390
518
|
);
|
|
391
519
|
}
|
|
392
|
-
async function getCreateListInstructionAsync(input, config) {
|
|
393
|
-
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
394
|
-
const originalAccounts = {
|
|
395
|
-
authority: { value: input.authority ?? null, isWritable: false },
|
|
396
|
-
payer: { value: input.payer ?? null, isWritable: true },
|
|
397
|
-
listConfig: { value: input.listConfig ?? null, isWritable: true },
|
|
398
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
399
|
-
};
|
|
400
|
-
const accounts = originalAccounts;
|
|
401
|
-
const args = { ...input };
|
|
402
|
-
if (!accounts.listConfig.value) {
|
|
403
|
-
accounts.listConfig.value = await findListConfigPda({
|
|
404
|
-
authority: expectAddress(accounts.authority.value),
|
|
405
|
-
seed: expectSome(args.seed)
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
if (!accounts.systemProgram.value) {
|
|
409
|
-
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
410
|
-
}
|
|
411
|
-
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
412
|
-
return Object.freeze({
|
|
413
|
-
accounts: [
|
|
414
|
-
getAccountMeta(accounts.authority),
|
|
415
|
-
getAccountMeta(accounts.payer),
|
|
416
|
-
getAccountMeta(accounts.listConfig),
|
|
417
|
-
getAccountMeta(accounts.systemProgram)
|
|
418
|
-
],
|
|
419
|
-
data: getCreateListInstructionDataEncoder().encode(
|
|
420
|
-
args
|
|
421
|
-
),
|
|
422
|
-
programAddress
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
520
|
function getCreateListInstruction(input, config) {
|
|
426
521
|
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
427
522
|
const originalAccounts = {
|
|
@@ -617,7 +712,7 @@ function getSetupExtraMetasInstruction(input, config) {
|
|
|
617
712
|
if (!accounts.systemProgram.value) {
|
|
618
713
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
619
714
|
}
|
|
620
|
-
const remainingAccounts = args.
|
|
715
|
+
const remainingAccounts = args.addresses.map((address) => ({
|
|
621
716
|
address,
|
|
622
717
|
role: AccountRole.READONLY
|
|
623
718
|
}));
|
|
@@ -659,7 +754,85 @@ function parseSetupExtraMetasInstruction(instruction) {
|
|
|
659
754
|
data: getSetupExtraMetasInstructionDataDecoder().decode(instruction.data)
|
|
660
755
|
};
|
|
661
756
|
}
|
|
757
|
+
var SETUP_FREEZE_EXTRA_METAS_DISCRIMINATOR = 6;
|
|
758
|
+
function getSetupFreezeExtraMetasDiscriminatorBytes() {
|
|
759
|
+
return getU8Encoder().encode(SETUP_FREEZE_EXTRA_METAS_DISCRIMINATOR);
|
|
760
|
+
}
|
|
761
|
+
function getSetupFreezeExtraMetasInstructionDataEncoder() {
|
|
762
|
+
return transformEncoder(
|
|
763
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
764
|
+
(value) => ({
|
|
765
|
+
...value,
|
|
766
|
+
discriminator: SETUP_FREEZE_EXTRA_METAS_DISCRIMINATOR
|
|
767
|
+
})
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
function getSetupFreezeExtraMetasInstructionDataDecoder() {
|
|
771
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
772
|
+
}
|
|
773
|
+
function getSetupFreezeExtraMetasInstructionDataCodec() {
|
|
774
|
+
return combineCodec(
|
|
775
|
+
getSetupFreezeExtraMetasInstructionDataEncoder(),
|
|
776
|
+
getSetupFreezeExtraMetasInstructionDataDecoder()
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
function getSetupFreezeExtraMetasInstruction(input, config) {
|
|
780
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
781
|
+
const originalAccounts = {
|
|
782
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
783
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
784
|
+
tokenAclMintConfig: {
|
|
785
|
+
value: input.tokenAclMintConfig ?? null,
|
|
786
|
+
isWritable: false
|
|
787
|
+
},
|
|
788
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
789
|
+
extraMetas: { value: input.extraMetas ?? null, isWritable: true },
|
|
790
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
791
|
+
};
|
|
792
|
+
const accounts = originalAccounts;
|
|
793
|
+
if (!accounts.systemProgram.value) {
|
|
794
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
795
|
+
}
|
|
796
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
797
|
+
return Object.freeze({
|
|
798
|
+
accounts: [
|
|
799
|
+
getAccountMeta(accounts.authority),
|
|
800
|
+
getAccountMeta(accounts.payer),
|
|
801
|
+
getAccountMeta(accounts.tokenAclMintConfig),
|
|
802
|
+
getAccountMeta(accounts.mint),
|
|
803
|
+
getAccountMeta(accounts.extraMetas),
|
|
804
|
+
getAccountMeta(accounts.systemProgram)
|
|
805
|
+
],
|
|
806
|
+
data: getSetupFreezeExtraMetasInstructionDataEncoder().encode({}),
|
|
807
|
+
programAddress
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
function parseSetupFreezeExtraMetasInstruction(instruction) {
|
|
811
|
+
if (instruction.accounts.length < 6) {
|
|
812
|
+
throw new Error("Not enough accounts");
|
|
813
|
+
}
|
|
814
|
+
let accountIndex = 0;
|
|
815
|
+
const getNextAccount = () => {
|
|
816
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
817
|
+
accountIndex += 1;
|
|
818
|
+
return accountMeta;
|
|
819
|
+
};
|
|
820
|
+
return {
|
|
821
|
+
programAddress: instruction.programAddress,
|
|
822
|
+
accounts: {
|
|
823
|
+
authority: getNextAccount(),
|
|
824
|
+
payer: getNextAccount(),
|
|
825
|
+
tokenAclMintConfig: getNextAccount(),
|
|
826
|
+
mint: getNextAccount(),
|
|
827
|
+
extraMetas: getNextAccount(),
|
|
828
|
+
systemProgram: getNextAccount()
|
|
829
|
+
},
|
|
830
|
+
data: getSetupFreezeExtraMetasInstructionDataDecoder().decode(
|
|
831
|
+
instruction.data
|
|
832
|
+
)
|
|
833
|
+
};
|
|
834
|
+
}
|
|
662
835
|
|
|
663
|
-
export { ADD_WALLET_DISCRIMINATOR, CREATE_LIST_DISCRIMINATOR, DELETE_LIST_DISCRIMINATOR, LIST_CONFIG_DISCRIMINATOR, Mode, REMOVE_WALLET_DISCRIMINATOR, SETUP_EXTRA_METAS_DISCRIMINATOR, TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS, TokenAclGateProgramAccount, TokenAclGateProgramInstruction, WALLET_ENTRY_DISCRIMINATOR, decodeListConfig, decodeWalletEntry, fetchAllListConfig, fetchAllMaybeListConfig, fetchAllMaybeWalletEntry, fetchAllWalletEntry, fetchListConfig, fetchListConfigFromSeeds, fetchMaybeListConfig, fetchMaybeListConfigFromSeeds, fetchMaybeWalletEntry, fetchMaybeWalletEntryFromSeeds, fetchWalletEntry, fetchWalletEntryFromSeeds, findListConfigPda, findWalletEntryPda, getAddWalletDiscriminatorBytes, getAddWalletInstruction,
|
|
836
|
+
export { ADD_WALLET_DISCRIMINATOR, CAN_FREEZE_PERMISSIONLESS_DISCRIMINATOR, CAN_THAW_PERMISSIONLESS_DISCRIMINATOR, CREATE_LIST_DISCRIMINATOR, DELETE_LIST_DISCRIMINATOR, LIST_CONFIG_DISCRIMINATOR, Mode, REMOVE_WALLET_DISCRIMINATOR, SETUP_EXTRA_METAS_DISCRIMINATOR, SETUP_FREEZE_EXTRA_METAS_DISCRIMINATOR, TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS, TokenAclGateProgramAccount, TokenAclGateProgramInstruction, WALLET_ENTRY_DISCRIMINATOR, decodeListConfig, decodeWalletEntry, fetchAllListConfig, fetchAllMaybeListConfig, fetchAllMaybeWalletEntry, fetchAllWalletEntry, fetchListConfig, fetchListConfigFromSeeds, fetchMaybeListConfig, fetchMaybeListConfigFromSeeds, fetchMaybeWalletEntry, fetchMaybeWalletEntryFromSeeds, fetchWalletEntry, fetchWalletEntryFromSeeds, findListConfigPda, findWalletEntryPda, getAddWalletDiscriminatorBytes, getAddWalletInstruction, getAddWalletInstructionDataCodec, getAddWalletInstructionDataDecoder, getAddWalletInstructionDataEncoder, getCanFreezePermissionlessDiscriminatorBytes, getCanFreezePermissionlessInstruction, getCanFreezePermissionlessInstructionDataCodec, getCanFreezePermissionlessInstructionDataDecoder, getCanFreezePermissionlessInstructionDataEncoder, getCanThawPermissionlessDiscriminatorBytes, getCanThawPermissionlessInstruction, getCanThawPermissionlessInstructionDataCodec, getCanThawPermissionlessInstructionDataDecoder, getCanThawPermissionlessInstructionDataEncoder, getCreateListDiscriminatorBytes, getCreateListInstruction, getCreateListInstructionDataCodec, getCreateListInstructionDataDecoder, getCreateListInstructionDataEncoder, getDeleteListDiscriminatorBytes, getDeleteListInstruction, getDeleteListInstructionDataCodec, getDeleteListInstructionDataDecoder, getDeleteListInstructionDataEncoder, getListConfigCodec, getListConfigDecoder, getListConfigDiscriminatorBytes, getListConfigEncoder, getListConfigSize, getModeCodec, getModeDecoder, getModeEncoder, getRemoveWalletDiscriminatorBytes, getRemoveWalletInstruction, getRemoveWalletInstructionDataCodec, getRemoveWalletInstructionDataDecoder, getRemoveWalletInstructionDataEncoder, getSetupExtraMetasDiscriminatorBytes, getSetupExtraMetasInstruction, getSetupExtraMetasInstructionDataCodec, getSetupExtraMetasInstructionDataDecoder, getSetupExtraMetasInstructionDataEncoder, getSetupFreezeExtraMetasDiscriminatorBytes, getSetupFreezeExtraMetasInstruction, getSetupFreezeExtraMetasInstructionDataCodec, getSetupFreezeExtraMetasInstructionDataDecoder, getSetupFreezeExtraMetasInstructionDataEncoder, getWalletEntryCodec, getWalletEntryDecoder, getWalletEntryDiscriminatorBytes, getWalletEntryEncoder, getWalletEntrySize, identifyTokenAclGateProgramAccount, identifyTokenAclGateProgramInstruction, parseAddWalletInstruction, parseCanFreezePermissionlessInstruction, parseCanThawPermissionlessInstruction, parseCreateListInstruction, parseDeleteListInstruction, parseRemoveWalletInstruction, parseSetupExtraMetasInstruction, parseSetupFreezeExtraMetasInstruction };
|
|
664
837
|
//# sourceMappingURL=index.mjs.map
|
|
665
838
|
//# sourceMappingURL=index.mjs.map
|