@solana/token-acl-gate-sdk 0.0.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 +932 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.mjs +838 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/types/generated/accounts/index.d.ts +10 -0
- package/dist/types/generated/accounts/index.d.ts.map +1 -0
- package/dist/types/generated/accounts/listConfig.d.ts +42 -0
- package/dist/types/generated/accounts/listConfig.d.ts.map +1 -0
- package/dist/types/generated/accounts/walletEntry.d.ts +38 -0
- package/dist/types/generated/accounts/walletEntry.d.ts.map +1 -0
- package/dist/types/generated/index.d.ts +13 -0
- package/dist/types/generated/index.d.ts.map +1 -0
- package/dist/types/generated/instructions/addWallet.d.ts +52 -0
- package/dist/types/generated/instructions/addWallet.d.ts.map +1 -0
- 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 +54 -0
- package/dist/types/generated/instructions/createList.d.ts.map +1 -0
- package/dist/types/generated/instructions/deleteList.d.ts +40 -0
- package/dist/types/generated/instructions/deleteList.d.ts.map +1 -0
- package/dist/types/generated/instructions/index.d.ts +16 -0
- package/dist/types/generated/instructions/index.d.ts.map +1 -0
- package/dist/types/generated/instructions/removeWallet.d.ts +43 -0
- package/dist/types/generated/instructions/removeWallet.d.ts.map +1 -0
- package/dist/types/generated/instructions/setupExtraMetas.d.ts +57 -0
- package/dist/types/generated/instructions/setupExtraMetas.d.ts.map +1 -0
- 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/pdas/index.d.ts +10 -0
- package/dist/types/generated/pdas/index.d.ts.map +1 -0
- package/dist/types/generated/pdas/listConfig.d.ts +16 -0
- package/dist/types/generated/pdas/listConfig.d.ts.map +1 -0
- package/dist/types/generated/pdas/walletEntry.d.ts +16 -0
- package/dist/types/generated/pdas/walletEntry.d.ts.map +1 -0
- package/dist/types/generated/programs/index.d.ts +9 -0
- package/dist/types/generated/programs/index.d.ts.map +1 -0
- package/dist/types/generated/programs/tokenAclGateProgram.d.ts +48 -0
- package/dist/types/generated/programs/tokenAclGateProgram.d.ts.map +1 -0
- package/dist/types/generated/shared/index.d.ts +50 -0
- package/dist/types/generated/shared/index.d.ts.map +1 -0
- package/dist/types/generated/types/index.d.ts +9 -0
- package/dist/types/generated/types/index.d.ts.map +1 -0
- package/dist/types/generated/types/mode.d.ts +18 -0
- package/dist/types/generated/types/mode.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +71 -7
|
@@ -0,0 +1,838 @@
|
|
|
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
|
+
|
|
3
|
+
// src/generated/accounts/listConfig.ts
|
|
4
|
+
async function findListConfigPda(seeds, config = {}) {
|
|
5
|
+
const {
|
|
6
|
+
programAddress = "GATEzzqxhJnsWF6vHRsgtixxSB8PaQdcqGEVTEHWiULz"
|
|
7
|
+
} = config;
|
|
8
|
+
return await getProgramDerivedAddress({
|
|
9
|
+
programAddress,
|
|
10
|
+
seeds: [
|
|
11
|
+
getUtf8Encoder().encode("list_config"),
|
|
12
|
+
getAddressEncoder().encode(seeds.authority),
|
|
13
|
+
getAddressEncoder().encode(seeds.seed)
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async function findWalletEntryPda(seeds, config = {}) {
|
|
18
|
+
const {
|
|
19
|
+
programAddress = "GATEzzqxhJnsWF6vHRsgtixxSB8PaQdcqGEVTEHWiULz"
|
|
20
|
+
} = config;
|
|
21
|
+
return await getProgramDerivedAddress({
|
|
22
|
+
programAddress,
|
|
23
|
+
seeds: [
|
|
24
|
+
getUtf8Encoder().encode("wallet_entry"),
|
|
25
|
+
getAddressEncoder().encode(seeds.listConfig),
|
|
26
|
+
getAddressEncoder().encode(seeds.wallet)
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/generated/accounts/listConfig.ts
|
|
32
|
+
var LIST_CONFIG_DISCRIMINATOR = 1;
|
|
33
|
+
function getListConfigDiscriminatorBytes() {
|
|
34
|
+
return getU8Encoder().encode(LIST_CONFIG_DISCRIMINATOR);
|
|
35
|
+
}
|
|
36
|
+
function getListConfigEncoder() {
|
|
37
|
+
return transformEncoder(
|
|
38
|
+
getStructEncoder([
|
|
39
|
+
["discriminator", getU8Encoder()],
|
|
40
|
+
["authority", getAddressEncoder()],
|
|
41
|
+
["seed", getAddressEncoder()],
|
|
42
|
+
["mode", getU8Encoder()],
|
|
43
|
+
["walletsCount", getU64Encoder()]
|
|
44
|
+
]),
|
|
45
|
+
(value) => ({
|
|
46
|
+
...value,
|
|
47
|
+
discriminator: value.discriminator ?? LIST_CONFIG_DISCRIMINATOR
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function getListConfigDecoder() {
|
|
52
|
+
return getStructDecoder([
|
|
53
|
+
["discriminator", getU8Decoder()],
|
|
54
|
+
["authority", getAddressDecoder()],
|
|
55
|
+
["seed", getAddressDecoder()],
|
|
56
|
+
["mode", getU8Decoder()],
|
|
57
|
+
["walletsCount", getU64Decoder()]
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
function getListConfigCodec() {
|
|
61
|
+
return combineCodec(getListConfigEncoder(), getListConfigDecoder());
|
|
62
|
+
}
|
|
63
|
+
function decodeListConfig(encodedAccount) {
|
|
64
|
+
return decodeAccount(
|
|
65
|
+
encodedAccount,
|
|
66
|
+
getListConfigDecoder()
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
async function fetchListConfig(rpc, address, config) {
|
|
70
|
+
const maybeAccount = await fetchMaybeListConfig(rpc, address, config);
|
|
71
|
+
assertAccountExists(maybeAccount);
|
|
72
|
+
return maybeAccount;
|
|
73
|
+
}
|
|
74
|
+
async function fetchMaybeListConfig(rpc, address, config) {
|
|
75
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
76
|
+
return decodeListConfig(maybeAccount);
|
|
77
|
+
}
|
|
78
|
+
async function fetchAllListConfig(rpc, addresses, config) {
|
|
79
|
+
const maybeAccounts = await fetchAllMaybeListConfig(rpc, addresses, config);
|
|
80
|
+
assertAccountsExist(maybeAccounts);
|
|
81
|
+
return maybeAccounts;
|
|
82
|
+
}
|
|
83
|
+
async function fetchAllMaybeListConfig(rpc, addresses, config) {
|
|
84
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
85
|
+
return maybeAccounts.map((maybeAccount) => decodeListConfig(maybeAccount));
|
|
86
|
+
}
|
|
87
|
+
function getListConfigSize() {
|
|
88
|
+
return 74;
|
|
89
|
+
}
|
|
90
|
+
async function fetchListConfigFromSeeds(rpc, seeds, config = {}) {
|
|
91
|
+
const maybeAccount = await fetchMaybeListConfigFromSeeds(rpc, seeds, config);
|
|
92
|
+
assertAccountExists(maybeAccount);
|
|
93
|
+
return maybeAccount;
|
|
94
|
+
}
|
|
95
|
+
async function fetchMaybeListConfigFromSeeds(rpc, seeds, config = {}) {
|
|
96
|
+
const { programAddress, ...fetchConfig } = config;
|
|
97
|
+
const [address] = await findListConfigPda(seeds, { programAddress });
|
|
98
|
+
return await fetchMaybeListConfig(rpc, address, fetchConfig);
|
|
99
|
+
}
|
|
100
|
+
var WALLET_ENTRY_DISCRIMINATOR = 2;
|
|
101
|
+
function getWalletEntryDiscriminatorBytes() {
|
|
102
|
+
return getU8Encoder().encode(WALLET_ENTRY_DISCRIMINATOR);
|
|
103
|
+
}
|
|
104
|
+
function getWalletEntryEncoder() {
|
|
105
|
+
return transformEncoder(
|
|
106
|
+
getStructEncoder([
|
|
107
|
+
["discriminator", getU8Encoder()],
|
|
108
|
+
["walletAddress", getAddressEncoder()],
|
|
109
|
+
["listConfig", getAddressEncoder()]
|
|
110
|
+
]),
|
|
111
|
+
(value) => ({
|
|
112
|
+
...value,
|
|
113
|
+
discriminator: value.discriminator ?? WALLET_ENTRY_DISCRIMINATOR
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function getWalletEntryDecoder() {
|
|
118
|
+
return getStructDecoder([
|
|
119
|
+
["discriminator", getU8Decoder()],
|
|
120
|
+
["walletAddress", getAddressDecoder()],
|
|
121
|
+
["listConfig", getAddressDecoder()]
|
|
122
|
+
]);
|
|
123
|
+
}
|
|
124
|
+
function getWalletEntryCodec() {
|
|
125
|
+
return combineCodec(getWalletEntryEncoder(), getWalletEntryDecoder());
|
|
126
|
+
}
|
|
127
|
+
function decodeWalletEntry(encodedAccount) {
|
|
128
|
+
return decodeAccount(
|
|
129
|
+
encodedAccount,
|
|
130
|
+
getWalletEntryDecoder()
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
async function fetchWalletEntry(rpc, address, config) {
|
|
134
|
+
const maybeAccount = await fetchMaybeWalletEntry(rpc, address, config);
|
|
135
|
+
assertAccountExists(maybeAccount);
|
|
136
|
+
return maybeAccount;
|
|
137
|
+
}
|
|
138
|
+
async function fetchMaybeWalletEntry(rpc, address, config) {
|
|
139
|
+
const maybeAccount = await fetchEncodedAccount(rpc, address, config);
|
|
140
|
+
return decodeWalletEntry(maybeAccount);
|
|
141
|
+
}
|
|
142
|
+
async function fetchAllWalletEntry(rpc, addresses, config) {
|
|
143
|
+
const maybeAccounts = await fetchAllMaybeWalletEntry(rpc, addresses, config);
|
|
144
|
+
assertAccountsExist(maybeAccounts);
|
|
145
|
+
return maybeAccounts;
|
|
146
|
+
}
|
|
147
|
+
async function fetchAllMaybeWalletEntry(rpc, addresses, config) {
|
|
148
|
+
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
149
|
+
return maybeAccounts.map((maybeAccount) => decodeWalletEntry(maybeAccount));
|
|
150
|
+
}
|
|
151
|
+
function getWalletEntrySize() {
|
|
152
|
+
return 65;
|
|
153
|
+
}
|
|
154
|
+
async function fetchWalletEntryFromSeeds(rpc, seeds, config = {}) {
|
|
155
|
+
const maybeAccount = await fetchMaybeWalletEntryFromSeeds(rpc, seeds, config);
|
|
156
|
+
assertAccountExists(maybeAccount);
|
|
157
|
+
return maybeAccount;
|
|
158
|
+
}
|
|
159
|
+
async function fetchMaybeWalletEntryFromSeeds(rpc, seeds, config = {}) {
|
|
160
|
+
const { programAddress, ...fetchConfig } = config;
|
|
161
|
+
const [address] = await findWalletEntryPda(seeds, { programAddress });
|
|
162
|
+
return await fetchMaybeWalletEntry(rpc, address, fetchConfig);
|
|
163
|
+
}
|
|
164
|
+
var TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS = "GATEzzqxhJnsWF6vHRsgtixxSB8PaQdcqGEVTEHWiULz";
|
|
165
|
+
var TokenAclGateProgramAccount = /* @__PURE__ */ ((TokenAclGateProgramAccount2) => {
|
|
166
|
+
TokenAclGateProgramAccount2[TokenAclGateProgramAccount2["ListConfig"] = 0] = "ListConfig";
|
|
167
|
+
TokenAclGateProgramAccount2[TokenAclGateProgramAccount2["WalletEntry"] = 1] = "WalletEntry";
|
|
168
|
+
return TokenAclGateProgramAccount2;
|
|
169
|
+
})(TokenAclGateProgramAccount || {});
|
|
170
|
+
function identifyTokenAclGateProgramAccount(account) {
|
|
171
|
+
const data = "data" in account ? account.data : account;
|
|
172
|
+
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
|
|
173
|
+
return 0 /* ListConfig */;
|
|
174
|
+
}
|
|
175
|
+
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
|
|
176
|
+
return 1 /* WalletEntry */;
|
|
177
|
+
}
|
|
178
|
+
throw new Error(
|
|
179
|
+
"The provided account could not be identified as a tokenAclGateProgram account."
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
var TokenAclGateProgramInstruction = /* @__PURE__ */ ((TokenAclGateProgramInstruction2) => {
|
|
183
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["CreateList"] = 0] = "CreateList";
|
|
184
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["AddWallet"] = 1] = "AddWallet";
|
|
185
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["RemoveWallet"] = 2] = "RemoveWallet";
|
|
186
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["SetupExtraMetas"] = 3] = "SetupExtraMetas";
|
|
187
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["DeleteList"] = 4] = "DeleteList";
|
|
188
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["SetupFreezeExtraMetas"] = 5] = "SetupFreezeExtraMetas";
|
|
189
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["CanThawPermissionless"] = 6] = "CanThawPermissionless";
|
|
190
|
+
TokenAclGateProgramInstruction2[TokenAclGateProgramInstruction2["CanFreezePermissionless"] = 7] = "CanFreezePermissionless";
|
|
191
|
+
return TokenAclGateProgramInstruction2;
|
|
192
|
+
})(TokenAclGateProgramInstruction || {});
|
|
193
|
+
function identifyTokenAclGateProgramInstruction(instruction) {
|
|
194
|
+
const data = "data" in instruction ? instruction.data : instruction;
|
|
195
|
+
if (containsBytes(data, getU8Encoder().encode(1), 0)) {
|
|
196
|
+
return 0 /* CreateList */;
|
|
197
|
+
}
|
|
198
|
+
if (containsBytes(data, getU8Encoder().encode(2), 0)) {
|
|
199
|
+
return 1 /* AddWallet */;
|
|
200
|
+
}
|
|
201
|
+
if (containsBytes(data, getU8Encoder().encode(3), 0)) {
|
|
202
|
+
return 2 /* RemoveWallet */;
|
|
203
|
+
}
|
|
204
|
+
if (containsBytes(data, getU8Encoder().encode(4), 0)) {
|
|
205
|
+
return 3 /* SetupExtraMetas */;
|
|
206
|
+
}
|
|
207
|
+
if (containsBytes(data, getU8Encoder().encode(5), 0)) {
|
|
208
|
+
return 4 /* DeleteList */;
|
|
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
|
+
}
|
|
219
|
+
throw new Error(
|
|
220
|
+
"The provided instruction could not be identified as a tokenAclGateProgram instruction."
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
function expectAddress(value) {
|
|
224
|
+
if (!value) {
|
|
225
|
+
throw new Error("Expected a Address.");
|
|
226
|
+
}
|
|
227
|
+
if (typeof value === "object" && "address" in value) {
|
|
228
|
+
return value.address;
|
|
229
|
+
}
|
|
230
|
+
if (Array.isArray(value)) {
|
|
231
|
+
return value[0];
|
|
232
|
+
}
|
|
233
|
+
return value;
|
|
234
|
+
}
|
|
235
|
+
function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
|
|
236
|
+
return (account) => {
|
|
237
|
+
if (!account.value) {
|
|
238
|
+
return Object.freeze({
|
|
239
|
+
address: programAddress,
|
|
240
|
+
role: AccountRole.READONLY
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const writableRole = account.isWritable ? AccountRole.WRITABLE : AccountRole.READONLY;
|
|
244
|
+
return Object.freeze({
|
|
245
|
+
address: expectAddress(account.value),
|
|
246
|
+
role: isTransactionSigner(account.value) ? upgradeRoleToSigner(writableRole) : writableRole,
|
|
247
|
+
...isTransactionSigner(account.value) ? { signer: account.value } : {}
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function isTransactionSigner(value) {
|
|
252
|
+
return !!value && typeof value === "object" && "address" in value && isTransactionSigner$1(value);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// src/generated/instructions/addWallet.ts
|
|
256
|
+
var ADD_WALLET_DISCRIMINATOR = 2;
|
|
257
|
+
function getAddWalletDiscriminatorBytes() {
|
|
258
|
+
return getU8Encoder().encode(ADD_WALLET_DISCRIMINATOR);
|
|
259
|
+
}
|
|
260
|
+
function getAddWalletInstructionDataEncoder() {
|
|
261
|
+
return transformEncoder(
|
|
262
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
263
|
+
(value) => ({ ...value, discriminator: ADD_WALLET_DISCRIMINATOR })
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function getAddWalletInstructionDataDecoder() {
|
|
267
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
268
|
+
}
|
|
269
|
+
function getAddWalletInstructionDataCodec() {
|
|
270
|
+
return combineCodec(
|
|
271
|
+
getAddWalletInstructionDataEncoder(),
|
|
272
|
+
getAddWalletInstructionDataDecoder()
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function getAddWalletInstruction(input, config) {
|
|
276
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
277
|
+
const originalAccounts = {
|
|
278
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
279
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
280
|
+
listConfig: { value: input.listConfig ?? null, isWritable: true },
|
|
281
|
+
wallet: { value: input.wallet ?? null, isWritable: false },
|
|
282
|
+
walletEntry: { value: input.walletEntry ?? null, isWritable: true },
|
|
283
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
284
|
+
};
|
|
285
|
+
const accounts = originalAccounts;
|
|
286
|
+
if (!accounts.systemProgram.value) {
|
|
287
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
288
|
+
}
|
|
289
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
290
|
+
return Object.freeze({
|
|
291
|
+
accounts: [
|
|
292
|
+
getAccountMeta(accounts.authority),
|
|
293
|
+
getAccountMeta(accounts.payer),
|
|
294
|
+
getAccountMeta(accounts.listConfig),
|
|
295
|
+
getAccountMeta(accounts.wallet),
|
|
296
|
+
getAccountMeta(accounts.walletEntry),
|
|
297
|
+
getAccountMeta(accounts.systemProgram)
|
|
298
|
+
],
|
|
299
|
+
data: getAddWalletInstructionDataEncoder().encode({}),
|
|
300
|
+
programAddress
|
|
301
|
+
});
|
|
302
|
+
}
|
|
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) {
|
|
349
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
350
|
+
const originalAccounts = {
|
|
351
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
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 }
|
|
357
|
+
};
|
|
358
|
+
const accounts = originalAccounts;
|
|
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");
|
|
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
|
+
}));
|
|
436
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
437
|
+
return Object.freeze({
|
|
438
|
+
accounts: [
|
|
439
|
+
getAccountMeta(accounts.authority),
|
|
440
|
+
getAccountMeta(accounts.tokenAccount),
|
|
441
|
+
getAccountMeta(accounts.mint),
|
|
442
|
+
getAccountMeta(accounts.owner),
|
|
443
|
+
getAccountMeta(accounts.flagAccount),
|
|
444
|
+
getAccountMeta(accounts.extraMetas),
|
|
445
|
+
...remainingAccounts
|
|
446
|
+
],
|
|
447
|
+
data: getCanThawPermissionlessInstructionDataEncoder().encode({}),
|
|
448
|
+
programAddress
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function parseCanThawPermissionlessInstruction(instruction) {
|
|
452
|
+
if (instruction.accounts.length < 6) {
|
|
453
|
+
throw new Error("Not enough accounts");
|
|
454
|
+
}
|
|
455
|
+
let accountIndex = 0;
|
|
456
|
+
const getNextAccount = () => {
|
|
457
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
458
|
+
accountIndex += 1;
|
|
459
|
+
return accountMeta;
|
|
460
|
+
};
|
|
461
|
+
return {
|
|
462
|
+
programAddress: instruction.programAddress,
|
|
463
|
+
accounts: {
|
|
464
|
+
authority: getNextAccount(),
|
|
465
|
+
tokenAccount: getNextAccount(),
|
|
466
|
+
mint: getNextAccount(),
|
|
467
|
+
owner: getNextAccount(),
|
|
468
|
+
flagAccount: getNextAccount(),
|
|
469
|
+
extraMetas: getNextAccount()
|
|
470
|
+
},
|
|
471
|
+
data: getCanThawPermissionlessInstructionDataDecoder().decode(
|
|
472
|
+
instruction.data
|
|
473
|
+
)
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
var Mode = /* @__PURE__ */ ((Mode2) => {
|
|
477
|
+
Mode2[Mode2["Allow"] = 0] = "Allow";
|
|
478
|
+
Mode2[Mode2["Unused"] = 1] = "Unused";
|
|
479
|
+
Mode2[Mode2["Block"] = 2] = "Block";
|
|
480
|
+
return Mode2;
|
|
481
|
+
})(Mode || {});
|
|
482
|
+
function getModeEncoder() {
|
|
483
|
+
return getEnumEncoder(Mode);
|
|
484
|
+
}
|
|
485
|
+
function getModeDecoder() {
|
|
486
|
+
return getEnumDecoder(Mode);
|
|
487
|
+
}
|
|
488
|
+
function getModeCodec() {
|
|
489
|
+
return combineCodec(getModeEncoder(), getModeDecoder());
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// src/generated/instructions/createList.ts
|
|
493
|
+
var CREATE_LIST_DISCRIMINATOR = 1;
|
|
494
|
+
function getCreateListDiscriminatorBytes() {
|
|
495
|
+
return getU8Encoder().encode(CREATE_LIST_DISCRIMINATOR);
|
|
496
|
+
}
|
|
497
|
+
function getCreateListInstructionDataEncoder() {
|
|
498
|
+
return transformEncoder(
|
|
499
|
+
getStructEncoder([
|
|
500
|
+
["discriminator", getU8Encoder()],
|
|
501
|
+
["mode", getModeEncoder()],
|
|
502
|
+
["seed", getAddressEncoder()]
|
|
503
|
+
]),
|
|
504
|
+
(value) => ({ ...value, discriminator: CREATE_LIST_DISCRIMINATOR })
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
function getCreateListInstructionDataDecoder() {
|
|
508
|
+
return getStructDecoder([
|
|
509
|
+
["discriminator", getU8Decoder()],
|
|
510
|
+
["mode", getModeDecoder()],
|
|
511
|
+
["seed", getAddressDecoder()]
|
|
512
|
+
]);
|
|
513
|
+
}
|
|
514
|
+
function getCreateListInstructionDataCodec() {
|
|
515
|
+
return combineCodec(
|
|
516
|
+
getCreateListInstructionDataEncoder(),
|
|
517
|
+
getCreateListInstructionDataDecoder()
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
function getCreateListInstruction(input, config) {
|
|
521
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
522
|
+
const originalAccounts = {
|
|
523
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
524
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
525
|
+
listConfig: { value: input.listConfig ?? null, isWritable: true },
|
|
526
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
527
|
+
};
|
|
528
|
+
const accounts = originalAccounts;
|
|
529
|
+
const args = { ...input };
|
|
530
|
+
if (!accounts.systemProgram.value) {
|
|
531
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
532
|
+
}
|
|
533
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
534
|
+
return Object.freeze({
|
|
535
|
+
accounts: [
|
|
536
|
+
getAccountMeta(accounts.authority),
|
|
537
|
+
getAccountMeta(accounts.payer),
|
|
538
|
+
getAccountMeta(accounts.listConfig),
|
|
539
|
+
getAccountMeta(accounts.systemProgram)
|
|
540
|
+
],
|
|
541
|
+
data: getCreateListInstructionDataEncoder().encode(
|
|
542
|
+
args
|
|
543
|
+
),
|
|
544
|
+
programAddress
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
function parseCreateListInstruction(instruction) {
|
|
548
|
+
if (instruction.accounts.length < 4) {
|
|
549
|
+
throw new Error("Not enough accounts");
|
|
550
|
+
}
|
|
551
|
+
let accountIndex = 0;
|
|
552
|
+
const getNextAccount = () => {
|
|
553
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
554
|
+
accountIndex += 1;
|
|
555
|
+
return accountMeta;
|
|
556
|
+
};
|
|
557
|
+
return {
|
|
558
|
+
programAddress: instruction.programAddress,
|
|
559
|
+
accounts: {
|
|
560
|
+
authority: getNextAccount(),
|
|
561
|
+
payer: getNextAccount(),
|
|
562
|
+
listConfig: getNextAccount(),
|
|
563
|
+
systemProgram: getNextAccount()
|
|
564
|
+
},
|
|
565
|
+
data: getCreateListInstructionDataDecoder().decode(instruction.data)
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
var DELETE_LIST_DISCRIMINATOR = 5;
|
|
569
|
+
function getDeleteListDiscriminatorBytes() {
|
|
570
|
+
return getU8Encoder().encode(DELETE_LIST_DISCRIMINATOR);
|
|
571
|
+
}
|
|
572
|
+
function getDeleteListInstructionDataEncoder() {
|
|
573
|
+
return transformEncoder(
|
|
574
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
575
|
+
(value) => ({ ...value, discriminator: DELETE_LIST_DISCRIMINATOR })
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
function getDeleteListInstructionDataDecoder() {
|
|
579
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
580
|
+
}
|
|
581
|
+
function getDeleteListInstructionDataCodec() {
|
|
582
|
+
return combineCodec(
|
|
583
|
+
getDeleteListInstructionDataEncoder(),
|
|
584
|
+
getDeleteListInstructionDataDecoder()
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
function getDeleteListInstruction(input, config) {
|
|
588
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
589
|
+
const originalAccounts = {
|
|
590
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
591
|
+
listConfig: { value: input.listConfig ?? null, isWritable: true }
|
|
592
|
+
};
|
|
593
|
+
const accounts = originalAccounts;
|
|
594
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
595
|
+
return Object.freeze({
|
|
596
|
+
accounts: [
|
|
597
|
+
getAccountMeta(accounts.authority),
|
|
598
|
+
getAccountMeta(accounts.listConfig)
|
|
599
|
+
],
|
|
600
|
+
data: getDeleteListInstructionDataEncoder().encode({}),
|
|
601
|
+
programAddress
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function parseDeleteListInstruction(instruction) {
|
|
605
|
+
if (instruction.accounts.length < 2) {
|
|
606
|
+
throw new Error("Not enough accounts");
|
|
607
|
+
}
|
|
608
|
+
let accountIndex = 0;
|
|
609
|
+
const getNextAccount = () => {
|
|
610
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
611
|
+
accountIndex += 1;
|
|
612
|
+
return accountMeta;
|
|
613
|
+
};
|
|
614
|
+
return {
|
|
615
|
+
programAddress: instruction.programAddress,
|
|
616
|
+
accounts: { authority: getNextAccount(), listConfig: getNextAccount() },
|
|
617
|
+
data: getDeleteListInstructionDataDecoder().decode(instruction.data)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
var REMOVE_WALLET_DISCRIMINATOR = 3;
|
|
621
|
+
function getRemoveWalletDiscriminatorBytes() {
|
|
622
|
+
return getU8Encoder().encode(REMOVE_WALLET_DISCRIMINATOR);
|
|
623
|
+
}
|
|
624
|
+
function getRemoveWalletInstructionDataEncoder() {
|
|
625
|
+
return transformEncoder(
|
|
626
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
627
|
+
(value) => ({ ...value, discriminator: REMOVE_WALLET_DISCRIMINATOR })
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
function getRemoveWalletInstructionDataDecoder() {
|
|
631
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
632
|
+
}
|
|
633
|
+
function getRemoveWalletInstructionDataCodec() {
|
|
634
|
+
return combineCodec(
|
|
635
|
+
getRemoveWalletInstructionDataEncoder(),
|
|
636
|
+
getRemoveWalletInstructionDataDecoder()
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
function getRemoveWalletInstruction(input, config) {
|
|
640
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
641
|
+
const originalAccounts = {
|
|
642
|
+
authority: { value: input.authority ?? null, isWritable: true },
|
|
643
|
+
listConfig: { value: input.listConfig ?? null, isWritable: true },
|
|
644
|
+
walletEntry: { value: input.walletEntry ?? null, isWritable: true }
|
|
645
|
+
};
|
|
646
|
+
const accounts = originalAccounts;
|
|
647
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
648
|
+
return Object.freeze({
|
|
649
|
+
accounts: [
|
|
650
|
+
getAccountMeta(accounts.authority),
|
|
651
|
+
getAccountMeta(accounts.listConfig),
|
|
652
|
+
getAccountMeta(accounts.walletEntry)
|
|
653
|
+
],
|
|
654
|
+
data: getRemoveWalletInstructionDataEncoder().encode({}),
|
|
655
|
+
programAddress
|
|
656
|
+
});
|
|
657
|
+
}
|
|
658
|
+
function parseRemoveWalletInstruction(instruction) {
|
|
659
|
+
if (instruction.accounts.length < 3) {
|
|
660
|
+
throw new Error("Not enough accounts");
|
|
661
|
+
}
|
|
662
|
+
let accountIndex = 0;
|
|
663
|
+
const getNextAccount = () => {
|
|
664
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
665
|
+
accountIndex += 1;
|
|
666
|
+
return accountMeta;
|
|
667
|
+
};
|
|
668
|
+
return {
|
|
669
|
+
programAddress: instruction.programAddress,
|
|
670
|
+
accounts: {
|
|
671
|
+
authority: getNextAccount(),
|
|
672
|
+
listConfig: getNextAccount(),
|
|
673
|
+
walletEntry: getNextAccount()
|
|
674
|
+
},
|
|
675
|
+
data: getRemoveWalletInstructionDataDecoder().decode(instruction.data)
|
|
676
|
+
};
|
|
677
|
+
}
|
|
678
|
+
var SETUP_EXTRA_METAS_DISCRIMINATOR = 4;
|
|
679
|
+
function getSetupExtraMetasDiscriminatorBytes() {
|
|
680
|
+
return getU8Encoder().encode(SETUP_EXTRA_METAS_DISCRIMINATOR);
|
|
681
|
+
}
|
|
682
|
+
function getSetupExtraMetasInstructionDataEncoder() {
|
|
683
|
+
return transformEncoder(
|
|
684
|
+
getStructEncoder([["discriminator", getU8Encoder()]]),
|
|
685
|
+
(value) => ({ ...value, discriminator: SETUP_EXTRA_METAS_DISCRIMINATOR })
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
function getSetupExtraMetasInstructionDataDecoder() {
|
|
689
|
+
return getStructDecoder([["discriminator", getU8Decoder()]]);
|
|
690
|
+
}
|
|
691
|
+
function getSetupExtraMetasInstructionDataCodec() {
|
|
692
|
+
return combineCodec(
|
|
693
|
+
getSetupExtraMetasInstructionDataEncoder(),
|
|
694
|
+
getSetupExtraMetasInstructionDataDecoder()
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
function getSetupExtraMetasInstruction(input, config) {
|
|
698
|
+
const programAddress = config?.programAddress ?? TOKEN_ACL_GATE_PROGRAM_PROGRAM_ADDRESS;
|
|
699
|
+
const originalAccounts = {
|
|
700
|
+
authority: { value: input.authority ?? null, isWritable: false },
|
|
701
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
702
|
+
tokenAclMintConfig: {
|
|
703
|
+
value: input.tokenAclMintConfig ?? null,
|
|
704
|
+
isWritable: false
|
|
705
|
+
},
|
|
706
|
+
mint: { value: input.mint ?? null, isWritable: false },
|
|
707
|
+
extraMetas: { value: input.extraMetas ?? null, isWritable: true },
|
|
708
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
709
|
+
};
|
|
710
|
+
const accounts = originalAccounts;
|
|
711
|
+
const args = { ...input };
|
|
712
|
+
if (!accounts.systemProgram.value) {
|
|
713
|
+
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
714
|
+
}
|
|
715
|
+
const remainingAccounts = args.addresses.map((address) => ({
|
|
716
|
+
address,
|
|
717
|
+
role: AccountRole.READONLY
|
|
718
|
+
}));
|
|
719
|
+
const getAccountMeta = getAccountMetaFactory(programAddress);
|
|
720
|
+
return Object.freeze({
|
|
721
|
+
accounts: [
|
|
722
|
+
getAccountMeta(accounts.authority),
|
|
723
|
+
getAccountMeta(accounts.payer),
|
|
724
|
+
getAccountMeta(accounts.tokenAclMintConfig),
|
|
725
|
+
getAccountMeta(accounts.mint),
|
|
726
|
+
getAccountMeta(accounts.extraMetas),
|
|
727
|
+
getAccountMeta(accounts.systemProgram),
|
|
728
|
+
...remainingAccounts
|
|
729
|
+
],
|
|
730
|
+
data: getSetupExtraMetasInstructionDataEncoder().encode({}),
|
|
731
|
+
programAddress
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function parseSetupExtraMetasInstruction(instruction) {
|
|
735
|
+
if (instruction.accounts.length < 6) {
|
|
736
|
+
throw new Error("Not enough accounts");
|
|
737
|
+
}
|
|
738
|
+
let accountIndex = 0;
|
|
739
|
+
const getNextAccount = () => {
|
|
740
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
741
|
+
accountIndex += 1;
|
|
742
|
+
return accountMeta;
|
|
743
|
+
};
|
|
744
|
+
return {
|
|
745
|
+
programAddress: instruction.programAddress,
|
|
746
|
+
accounts: {
|
|
747
|
+
authority: getNextAccount(),
|
|
748
|
+
payer: getNextAccount(),
|
|
749
|
+
tokenAclMintConfig: getNextAccount(),
|
|
750
|
+
mint: getNextAccount(),
|
|
751
|
+
extraMetas: getNextAccount(),
|
|
752
|
+
systemProgram: getNextAccount()
|
|
753
|
+
},
|
|
754
|
+
data: getSetupExtraMetasInstructionDataDecoder().decode(instruction.data)
|
|
755
|
+
};
|
|
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
|
+
}
|
|
835
|
+
|
|
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 };
|
|
837
|
+
//# sourceMappingURL=index.mjs.map
|
|
838
|
+
//# sourceMappingURL=index.mjs.map
|