@solana/subscriptions 0.4.0-rc.1 → 0.4.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/README.md +20 -12
- package/dist/index.cjs +668 -260
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +298 -68
- package/dist/index.d.ts +298 -68
- package/dist/index.js +647 -226
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
PlanStatus: () => PlanStatus,
|
|
45
45
|
RESUME_SUBSCRIPTION_DISCRIMINATOR: () => RESUME_SUBSCRIPTION_DISCRIMINATOR,
|
|
46
46
|
REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR: () => REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR,
|
|
47
|
+
REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR: () => REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR,
|
|
47
48
|
REVOKE_DELEGATION_DISCRIMINATOR: () => REVOKE_DELEGATION_DISCRIMINATOR,
|
|
48
49
|
REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR: () => REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
|
|
49
50
|
SUBSCRIBE_DISCRIMINATOR: () => SUBSCRIBE_DISCRIMINATOR,
|
|
@@ -80,6 +81,7 @@ __export(index_exports, {
|
|
|
80
81
|
SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH: () => SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH,
|
|
81
82
|
SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA: () => SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA,
|
|
82
83
|
SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS: () => SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS,
|
|
84
|
+
SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM: () => SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM,
|
|
83
85
|
SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA: () => SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA,
|
|
84
86
|
SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA: () => SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA,
|
|
85
87
|
SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA: () => SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA,
|
|
@@ -103,6 +105,7 @@ __export(index_exports, {
|
|
|
103
105
|
SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED: () => SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED,
|
|
104
106
|
SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS: () => SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS,
|
|
105
107
|
SUBSCRIPTIONS_ERROR__PLAN_CLOSED: () => SUBSCRIPTIONS_ERROR__PLAN_CLOSED,
|
|
108
|
+
SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND: () => SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND,
|
|
106
109
|
SUBSCRIPTIONS_ERROR__PLAN_EXPIRED: () => SUBSCRIPTIONS_ERROR__PLAN_EXPIRED,
|
|
107
110
|
SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET: () => SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET,
|
|
108
111
|
SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED: () => SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED,
|
|
@@ -119,7 +122,6 @@ __export(index_exports, {
|
|
|
119
122
|
SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH: () => SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH,
|
|
120
123
|
SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS: () => SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS,
|
|
121
124
|
SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS: () => SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS,
|
|
122
|
-
SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING: () => SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING,
|
|
123
125
|
SUBSCRIPTIONS_ERROR__UNAUTHORIZED: () => SUBSCRIPTIONS_ERROR__UNAUTHORIZED,
|
|
124
126
|
SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION: () => SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION,
|
|
125
127
|
SUBSCRIPTIONS_PROGRAM_ADDRESS: () => SUBSCRIPTIONS_PROGRAM_ADDRESS,
|
|
@@ -277,6 +279,11 @@ __export(index_exports, {
|
|
|
277
279
|
getRevokeAbandonedDelegationInstructionDataCodec: () => getRevokeAbandonedDelegationInstructionDataCodec,
|
|
278
280
|
getRevokeAbandonedDelegationInstructionDataDecoder: () => getRevokeAbandonedDelegationInstructionDataDecoder,
|
|
279
281
|
getRevokeAbandonedDelegationInstructionDataEncoder: () => getRevokeAbandonedDelegationInstructionDataEncoder,
|
|
282
|
+
getRevokeAbandonedSubscriptionDiscriminatorBytes: () => getRevokeAbandonedSubscriptionDiscriminatorBytes,
|
|
283
|
+
getRevokeAbandonedSubscriptionInstruction: () => getRevokeAbandonedSubscriptionInstruction,
|
|
284
|
+
getRevokeAbandonedSubscriptionInstructionDataCodec: () => getRevokeAbandonedSubscriptionInstructionDataCodec,
|
|
285
|
+
getRevokeAbandonedSubscriptionInstructionDataDecoder: () => getRevokeAbandonedSubscriptionInstructionDataDecoder,
|
|
286
|
+
getRevokeAbandonedSubscriptionInstructionDataEncoder: () => getRevokeAbandonedSubscriptionInstructionDataEncoder,
|
|
280
287
|
getRevokeDelegationDiscriminatorBytes: () => getRevokeDelegationDiscriminatorBytes,
|
|
281
288
|
getRevokeDelegationInstruction: () => getRevokeDelegationInstruction,
|
|
282
289
|
getRevokeDelegationInstructionDataCodec: () => getRevokeDelegationInstructionDataCodec,
|
|
@@ -285,6 +292,7 @@ __export(index_exports, {
|
|
|
285
292
|
getRevokeDelegationOverlayInstruction: () => getRevokeDelegationOverlayInstruction,
|
|
286
293
|
getRevokeSubscriptionAuthorityDiscriminatorBytes: () => getRevokeSubscriptionAuthorityDiscriminatorBytes,
|
|
287
294
|
getRevokeSubscriptionAuthorityInstruction: () => getRevokeSubscriptionAuthorityInstruction,
|
|
295
|
+
getRevokeSubscriptionAuthorityInstructionAsync: () => getRevokeSubscriptionAuthorityInstructionAsync,
|
|
288
296
|
getRevokeSubscriptionAuthorityInstructionDataCodec: () => getRevokeSubscriptionAuthorityInstructionDataCodec,
|
|
289
297
|
getRevokeSubscriptionAuthorityInstructionDataDecoder: () => getRevokeSubscriptionAuthorityInstructionDataDecoder,
|
|
290
298
|
getRevokeSubscriptionAuthorityInstructionDataEncoder: () => getRevokeSubscriptionAuthorityInstructionDataEncoder,
|
|
@@ -312,18 +320,21 @@ __export(index_exports, {
|
|
|
312
320
|
getTransferDataEncoder: () => getTransferDataEncoder,
|
|
313
321
|
getTransferFixedDiscriminatorBytes: () => getTransferFixedDiscriminatorBytes,
|
|
314
322
|
getTransferFixedInstruction: () => getTransferFixedInstruction,
|
|
323
|
+
getTransferFixedInstructionAsync: () => getTransferFixedInstructionAsync,
|
|
315
324
|
getTransferFixedInstructionDataCodec: () => getTransferFixedInstructionDataCodec,
|
|
316
325
|
getTransferFixedInstructionDataDecoder: () => getTransferFixedInstructionDataDecoder,
|
|
317
326
|
getTransferFixedInstructionDataEncoder: () => getTransferFixedInstructionDataEncoder,
|
|
318
327
|
getTransferFixedOverlayInstructionAsync: () => getTransferFixedOverlayInstructionAsync,
|
|
319
328
|
getTransferRecurringDiscriminatorBytes: () => getTransferRecurringDiscriminatorBytes,
|
|
320
329
|
getTransferRecurringInstruction: () => getTransferRecurringInstruction,
|
|
330
|
+
getTransferRecurringInstructionAsync: () => getTransferRecurringInstructionAsync,
|
|
321
331
|
getTransferRecurringInstructionDataCodec: () => getTransferRecurringInstructionDataCodec,
|
|
322
332
|
getTransferRecurringInstructionDataDecoder: () => getTransferRecurringInstructionDataDecoder,
|
|
323
333
|
getTransferRecurringInstructionDataEncoder: () => getTransferRecurringInstructionDataEncoder,
|
|
324
334
|
getTransferRecurringOverlayInstructionAsync: () => getTransferRecurringOverlayInstructionAsync,
|
|
325
335
|
getTransferSubscriptionDiscriminatorBytes: () => getTransferSubscriptionDiscriminatorBytes,
|
|
326
336
|
getTransferSubscriptionInstruction: () => getTransferSubscriptionInstruction,
|
|
337
|
+
getTransferSubscriptionInstructionAsync: () => getTransferSubscriptionInstructionAsync,
|
|
327
338
|
getTransferSubscriptionInstructionDataCodec: () => getTransferSubscriptionInstructionDataCodec,
|
|
328
339
|
getTransferSubscriptionInstructionDataDecoder: () => getTransferSubscriptionInstructionDataDecoder,
|
|
329
340
|
getTransferSubscriptionInstructionDataEncoder: () => getTransferSubscriptionInstructionDataEncoder,
|
|
@@ -333,6 +344,7 @@ __export(index_exports, {
|
|
|
333
344
|
getUpdatePlanDataEncoder: () => getUpdatePlanDataEncoder,
|
|
334
345
|
getUpdatePlanDiscriminatorBytes: () => getUpdatePlanDiscriminatorBytes,
|
|
335
346
|
getUpdatePlanInstruction: () => getUpdatePlanInstruction,
|
|
347
|
+
getUpdatePlanInstructionAsync: () => getUpdatePlanInstructionAsync,
|
|
336
348
|
getUpdatePlanInstructionDataCodec: () => getUpdatePlanInstructionDataCodec,
|
|
337
349
|
getUpdatePlanInstructionDataDecoder: () => getUpdatePlanInstructionDataDecoder,
|
|
338
350
|
getUpdatePlanInstructionDataEncoder: () => getUpdatePlanInstructionDataEncoder,
|
|
@@ -348,6 +360,7 @@ __export(index_exports, {
|
|
|
348
360
|
parseInitSubscriptionAuthorityInstruction: () => parseInitSubscriptionAuthorityInstruction,
|
|
349
361
|
parseResumeSubscriptionInstruction: () => parseResumeSubscriptionInstruction,
|
|
350
362
|
parseRevokeAbandonedDelegationInstruction: () => parseRevokeAbandonedDelegationInstruction,
|
|
363
|
+
parseRevokeAbandonedSubscriptionInstruction: () => parseRevokeAbandonedSubscriptionInstruction,
|
|
351
364
|
parseRevokeDelegationInstruction: () => parseRevokeDelegationInstruction,
|
|
352
365
|
parseRevokeSubscriptionAuthorityInstruction: () => parseRevokeSubscriptionAuthorityInstruction,
|
|
353
366
|
parseSubscribeInstruction: () => parseSubscribeInstruction,
|
|
@@ -363,7 +376,7 @@ __export(index_exports, {
|
|
|
363
376
|
module.exports = __toCommonJS(index_exports);
|
|
364
377
|
|
|
365
378
|
// src/accounts/decode.ts
|
|
366
|
-
var
|
|
379
|
+
var import_kit42 = require("@solana/kit");
|
|
367
380
|
|
|
368
381
|
// src/generated/accounts/eventAuthority.ts
|
|
369
382
|
var import_kit7 = require("@solana/kit");
|
|
@@ -1020,11 +1033,11 @@ async function fetchMaybeSubscriptionDelegationFromSeeds(rpc, seeds, config = {}
|
|
|
1020
1033
|
}
|
|
1021
1034
|
|
|
1022
1035
|
// src/generated/errors/subscriptions.ts
|
|
1023
|
-
var
|
|
1036
|
+
var import_kit41 = require("@solana/kit");
|
|
1024
1037
|
|
|
1025
1038
|
// src/generated/programs/subscriptions.ts
|
|
1026
|
-
var
|
|
1027
|
-
var
|
|
1039
|
+
var import_kit40 = require("@solana/kit");
|
|
1040
|
+
var import_program_client_core18 = require("@solana/program-client-core");
|
|
1028
1041
|
|
|
1029
1042
|
// src/generated/instructions/cancelSubscription.ts
|
|
1030
1043
|
var import_kit23 = require("@solana/kit");
|
|
@@ -1062,10 +1075,14 @@ async function getCancelSubscriptionInstructionAsync(input, config) {
|
|
|
1062
1075
|
});
|
|
1063
1076
|
}
|
|
1064
1077
|
if (!accounts.eventAuthority.value) {
|
|
1065
|
-
accounts.eventAuthority.value =
|
|
1078
|
+
accounts.eventAuthority.value = await (0, import_kit23.getProgramDerivedAddress)({
|
|
1079
|
+
programAddress,
|
|
1080
|
+
seeds: [(0, import_kit23.getUtf8Encoder)().encode("event_authority")]
|
|
1081
|
+
});
|
|
1066
1082
|
}
|
|
1067
1083
|
if (!accounts.selfProgram.value) {
|
|
1068
|
-
accounts.selfProgram.value =
|
|
1084
|
+
accounts.selfProgram.value = programAddress;
|
|
1085
|
+
accounts.selfProgram.isWritable = false;
|
|
1069
1086
|
}
|
|
1070
1087
|
const getAccountMeta = (0, import_program_client_core.getAccountMetaFactory)(programAddress, "programId");
|
|
1071
1088
|
return Object.freeze({
|
|
@@ -1090,11 +1107,9 @@ function getCancelSubscriptionInstruction(input, config) {
|
|
|
1090
1107
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1091
1108
|
};
|
|
1092
1109
|
const accounts = originalAccounts;
|
|
1093
|
-
if (!accounts.eventAuthority.value) {
|
|
1094
|
-
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1095
|
-
}
|
|
1096
1110
|
if (!accounts.selfProgram.value) {
|
|
1097
|
-
accounts.selfProgram.value =
|
|
1111
|
+
accounts.selfProgram.value = programAddress;
|
|
1112
|
+
accounts.selfProgram.isWritable = false;
|
|
1098
1113
|
}
|
|
1099
1114
|
const getAccountMeta = (0, import_program_client_core.getAccountMetaFactory)(programAddress, "programId");
|
|
1100
1115
|
return Object.freeze({
|
|
@@ -1161,15 +1176,17 @@ function getCloseSubscriptionAuthorityInstruction(input, config) {
|
|
|
1161
1176
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1162
1177
|
const originalAccounts = {
|
|
1163
1178
|
user: { value: input.user ?? null, isWritable: true },
|
|
1164
|
-
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true }
|
|
1179
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
|
|
1180
|
+
receiver: { value: input.receiver ?? null, isWritable: true }
|
|
1165
1181
|
};
|
|
1166
1182
|
const accounts = originalAccounts;
|
|
1167
|
-
const getAccountMeta = (0, import_program_client_core2.getAccountMetaFactory)(programAddress, "
|
|
1183
|
+
const getAccountMeta = (0, import_program_client_core2.getAccountMetaFactory)(programAddress, "omitted");
|
|
1168
1184
|
return Object.freeze({
|
|
1169
1185
|
accounts: [
|
|
1170
1186
|
getAccountMeta("user", accounts.user),
|
|
1171
|
-
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority)
|
|
1172
|
-
|
|
1187
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1188
|
+
getAccountMeta("receiver", accounts.receiver)
|
|
1189
|
+
].filter((x) => x !== void 0),
|
|
1173
1190
|
data: getCloseSubscriptionAuthorityInstructionDataEncoder().encode({}),
|
|
1174
1191
|
programAddress
|
|
1175
1192
|
});
|
|
@@ -1187,9 +1204,19 @@ function parseCloseSubscriptionAuthorityInstruction(instruction) {
|
|
|
1187
1204
|
accountIndex += 1;
|
|
1188
1205
|
return accountMeta;
|
|
1189
1206
|
};
|
|
1207
|
+
let optionalAccountsRemaining = instruction.accounts.length - 2;
|
|
1208
|
+
const getNextOptionalAccount = () => {
|
|
1209
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
1210
|
+
optionalAccountsRemaining -= 1;
|
|
1211
|
+
return getNextAccount();
|
|
1212
|
+
};
|
|
1190
1213
|
return {
|
|
1191
1214
|
programAddress: instruction.programAddress,
|
|
1192
|
-
accounts: {
|
|
1215
|
+
accounts: {
|
|
1216
|
+
user: getNextAccount(),
|
|
1217
|
+
subscriptionAuthority: getNextAccount(),
|
|
1218
|
+
receiver: getNextOptionalAccount()
|
|
1219
|
+
},
|
|
1193
1220
|
data: getCloseSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
1194
1221
|
};
|
|
1195
1222
|
}
|
|
@@ -1229,22 +1256,24 @@ function getCreateFixedDelegationInstruction(input, config) {
|
|
|
1229
1256
|
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1230
1257
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
|
|
1231
1258
|
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
1232
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1259
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1260
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1233
1261
|
};
|
|
1234
1262
|
const accounts = originalAccounts;
|
|
1235
1263
|
const args = { ...input };
|
|
1236
1264
|
if (!accounts.systemProgram.value) {
|
|
1237
1265
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1238
1266
|
}
|
|
1239
|
-
const getAccountMeta = (0, import_program_client_core3.getAccountMetaFactory)(programAddress, "
|
|
1267
|
+
const getAccountMeta = (0, import_program_client_core3.getAccountMetaFactory)(programAddress, "omitted");
|
|
1240
1268
|
return Object.freeze({
|
|
1241
1269
|
accounts: [
|
|
1242
1270
|
getAccountMeta("delegator", accounts.delegator),
|
|
1243
1271
|
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1244
1272
|
getAccountMeta("delegationAccount", accounts.delegationAccount),
|
|
1245
1273
|
getAccountMeta("delegatee", accounts.delegatee),
|
|
1246
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1247
|
-
|
|
1274
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1275
|
+
getAccountMeta("payer", accounts.payer)
|
|
1276
|
+
].filter((x) => x !== void 0),
|
|
1248
1277
|
data: getCreateFixedDelegationInstructionDataEncoder().encode(args),
|
|
1249
1278
|
programAddress
|
|
1250
1279
|
});
|
|
@@ -1262,6 +1291,12 @@ function parseCreateFixedDelegationInstruction(instruction) {
|
|
|
1262
1291
|
accountIndex += 1;
|
|
1263
1292
|
return accountMeta;
|
|
1264
1293
|
};
|
|
1294
|
+
let optionalAccountsRemaining = instruction.accounts.length - 5;
|
|
1295
|
+
const getNextOptionalAccount = () => {
|
|
1296
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
1297
|
+
optionalAccountsRemaining -= 1;
|
|
1298
|
+
return getNextAccount();
|
|
1299
|
+
};
|
|
1265
1300
|
return {
|
|
1266
1301
|
programAddress: instruction.programAddress,
|
|
1267
1302
|
accounts: {
|
|
@@ -1269,7 +1304,8 @@ function parseCreateFixedDelegationInstruction(instruction) {
|
|
|
1269
1304
|
subscriptionAuthority: getNextAccount(),
|
|
1270
1305
|
delegationAccount: getNextAccount(),
|
|
1271
1306
|
delegatee: getNextAccount(),
|
|
1272
|
-
systemProgram: getNextAccount()
|
|
1307
|
+
systemProgram: getNextAccount(),
|
|
1308
|
+
payer: getNextOptionalAccount()
|
|
1273
1309
|
},
|
|
1274
1310
|
data: getCreateFixedDelegationInstructionDataDecoder().decode(instruction.data)
|
|
1275
1311
|
};
|
|
@@ -1391,22 +1427,24 @@ function getCreateRecurringDelegationInstruction(input, config) {
|
|
|
1391
1427
|
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1392
1428
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
|
|
1393
1429
|
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
1394
|
-
systemProgram: { value: input.systemProgram ?? null, isWritable: false }
|
|
1430
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1431
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1395
1432
|
};
|
|
1396
1433
|
const accounts = originalAccounts;
|
|
1397
1434
|
const args = { ...input };
|
|
1398
1435
|
if (!accounts.systemProgram.value) {
|
|
1399
1436
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1400
1437
|
}
|
|
1401
|
-
const getAccountMeta = (0, import_program_client_core5.getAccountMetaFactory)(programAddress, "
|
|
1438
|
+
const getAccountMeta = (0, import_program_client_core5.getAccountMetaFactory)(programAddress, "omitted");
|
|
1402
1439
|
return Object.freeze({
|
|
1403
1440
|
accounts: [
|
|
1404
1441
|
getAccountMeta("delegator", accounts.delegator),
|
|
1405
1442
|
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1406
1443
|
getAccountMeta("delegationAccount", accounts.delegationAccount),
|
|
1407
1444
|
getAccountMeta("delegatee", accounts.delegatee),
|
|
1408
|
-
getAccountMeta("systemProgram", accounts.systemProgram)
|
|
1409
|
-
|
|
1445
|
+
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1446
|
+
getAccountMeta("payer", accounts.payer)
|
|
1447
|
+
].filter((x) => x !== void 0),
|
|
1410
1448
|
data: getCreateRecurringDelegationInstructionDataEncoder().encode(
|
|
1411
1449
|
args
|
|
1412
1450
|
),
|
|
@@ -1426,6 +1464,12 @@ function parseCreateRecurringDelegationInstruction(instruction) {
|
|
|
1426
1464
|
accountIndex += 1;
|
|
1427
1465
|
return accountMeta;
|
|
1428
1466
|
};
|
|
1467
|
+
let optionalAccountsRemaining = instruction.accounts.length - 5;
|
|
1468
|
+
const getNextOptionalAccount = () => {
|
|
1469
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
1470
|
+
optionalAccountsRemaining -= 1;
|
|
1471
|
+
return getNextAccount();
|
|
1472
|
+
};
|
|
1429
1473
|
return {
|
|
1430
1474
|
programAddress: instruction.programAddress,
|
|
1431
1475
|
accounts: {
|
|
@@ -1433,7 +1477,8 @@ function parseCreateRecurringDelegationInstruction(instruction) {
|
|
|
1433
1477
|
subscriptionAuthority: getNextAccount(),
|
|
1434
1478
|
delegationAccount: getNextAccount(),
|
|
1435
1479
|
delegatee: getNextAccount(),
|
|
1436
|
-
systemProgram: getNextAccount()
|
|
1480
|
+
systemProgram: getNextAccount(),
|
|
1481
|
+
payer: getNextOptionalAccount()
|
|
1437
1482
|
},
|
|
1438
1483
|
data: getCreateRecurringDelegationInstructionDataDecoder().decode(instruction.data)
|
|
1439
1484
|
};
|
|
@@ -1522,7 +1567,8 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
|
|
|
1522
1567
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1523
1568
|
userAta: { value: input.userAta ?? null, isWritable: true },
|
|
1524
1569
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1525
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
1570
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1571
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1526
1572
|
};
|
|
1527
1573
|
const accounts = originalAccounts;
|
|
1528
1574
|
if (!accounts.subscriptionAuthority.value) {
|
|
@@ -1534,7 +1580,7 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
|
|
|
1534
1580
|
if (!accounts.systemProgram.value) {
|
|
1535
1581
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1536
1582
|
}
|
|
1537
|
-
const getAccountMeta = (0, import_program_client_core7.getAccountMetaFactory)(programAddress, "
|
|
1583
|
+
const getAccountMeta = (0, import_program_client_core7.getAccountMetaFactory)(programAddress, "omitted");
|
|
1538
1584
|
return Object.freeze({
|
|
1539
1585
|
accounts: [
|
|
1540
1586
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -1542,8 +1588,9 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
|
|
|
1542
1588
|
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1543
1589
|
getAccountMeta("userAta", accounts.userAta),
|
|
1544
1590
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1545
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1546
|
-
|
|
1591
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1592
|
+
getAccountMeta("payer", accounts.payer)
|
|
1593
|
+
].filter((x) => x !== void 0),
|
|
1547
1594
|
data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
|
|
1548
1595
|
programAddress
|
|
1549
1596
|
});
|
|
@@ -1556,13 +1603,14 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
|
|
|
1556
1603
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1557
1604
|
userAta: { value: input.userAta ?? null, isWritable: true },
|
|
1558
1605
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1559
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
1606
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1607
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1560
1608
|
};
|
|
1561
1609
|
const accounts = originalAccounts;
|
|
1562
1610
|
if (!accounts.systemProgram.value) {
|
|
1563
1611
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1564
1612
|
}
|
|
1565
|
-
const getAccountMeta = (0, import_program_client_core7.getAccountMetaFactory)(programAddress, "
|
|
1613
|
+
const getAccountMeta = (0, import_program_client_core7.getAccountMetaFactory)(programAddress, "omitted");
|
|
1566
1614
|
return Object.freeze({
|
|
1567
1615
|
accounts: [
|
|
1568
1616
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -1570,8 +1618,9 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
|
|
|
1570
1618
|
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1571
1619
|
getAccountMeta("userAta", accounts.userAta),
|
|
1572
1620
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1573
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1574
|
-
|
|
1621
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1622
|
+
getAccountMeta("payer", accounts.payer)
|
|
1623
|
+
].filter((x) => x !== void 0),
|
|
1575
1624
|
data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
|
|
1576
1625
|
programAddress
|
|
1577
1626
|
});
|
|
@@ -1589,6 +1638,12 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
|
1589
1638
|
accountIndex += 1;
|
|
1590
1639
|
return accountMeta;
|
|
1591
1640
|
};
|
|
1641
|
+
let optionalAccountsRemaining = instruction.accounts.length - 6;
|
|
1642
|
+
const getNextOptionalAccount = () => {
|
|
1643
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
1644
|
+
optionalAccountsRemaining -= 1;
|
|
1645
|
+
return getNextAccount();
|
|
1646
|
+
};
|
|
1592
1647
|
return {
|
|
1593
1648
|
programAddress: instruction.programAddress,
|
|
1594
1649
|
accounts: {
|
|
@@ -1597,7 +1652,8 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
|
1597
1652
|
tokenMint: getNextAccount(),
|
|
1598
1653
|
userAta: getNextAccount(),
|
|
1599
1654
|
systemProgram: getNextAccount(),
|
|
1600
|
-
tokenProgram: getNextAccount()
|
|
1655
|
+
tokenProgram: getNextAccount(),
|
|
1656
|
+
payer: getNextOptionalAccount()
|
|
1601
1657
|
},
|
|
1602
1658
|
data: getInitSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
1603
1659
|
};
|
|
@@ -1628,6 +1684,7 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
|
1628
1684
|
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1629
1685
|
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1630
1686
|
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1687
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1631
1688
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1632
1689
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1633
1690
|
};
|
|
@@ -1639,10 +1696,14 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
|
1639
1696
|
});
|
|
1640
1697
|
}
|
|
1641
1698
|
if (!accounts.eventAuthority.value) {
|
|
1642
|
-
accounts.eventAuthority.value =
|
|
1699
|
+
accounts.eventAuthority.value = await (0, import_kit30.getProgramDerivedAddress)({
|
|
1700
|
+
programAddress,
|
|
1701
|
+
seeds: [(0, import_kit30.getUtf8Encoder)().encode("event_authority")]
|
|
1702
|
+
});
|
|
1643
1703
|
}
|
|
1644
1704
|
if (!accounts.selfProgram.value) {
|
|
1645
|
-
accounts.selfProgram.value =
|
|
1705
|
+
accounts.selfProgram.value = programAddress;
|
|
1706
|
+
accounts.selfProgram.isWritable = false;
|
|
1646
1707
|
}
|
|
1647
1708
|
const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
|
|
1648
1709
|
return Object.freeze({
|
|
@@ -1650,6 +1711,7 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
|
1650
1711
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
1651
1712
|
getAccountMeta("planPda", accounts.planPda),
|
|
1652
1713
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1714
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1653
1715
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1654
1716
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1655
1717
|
],
|
|
@@ -1663,15 +1725,14 @@ function getResumeSubscriptionInstruction(input, config) {
|
|
|
1663
1725
|
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1664
1726
|
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1665
1727
|
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1728
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1666
1729
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1667
1730
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1668
1731
|
};
|
|
1669
1732
|
const accounts = originalAccounts;
|
|
1670
|
-
if (!accounts.eventAuthority.value) {
|
|
1671
|
-
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1672
|
-
}
|
|
1673
1733
|
if (!accounts.selfProgram.value) {
|
|
1674
|
-
accounts.selfProgram.value =
|
|
1734
|
+
accounts.selfProgram.value = programAddress;
|
|
1735
|
+
accounts.selfProgram.isWritable = false;
|
|
1675
1736
|
}
|
|
1676
1737
|
const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
|
|
1677
1738
|
return Object.freeze({
|
|
@@ -1679,6 +1740,7 @@ function getResumeSubscriptionInstruction(input, config) {
|
|
|
1679
1740
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
1680
1741
|
getAccountMeta("planPda", accounts.planPda),
|
|
1681
1742
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1743
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1682
1744
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1683
1745
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1684
1746
|
],
|
|
@@ -1687,10 +1749,10 @@ function getResumeSubscriptionInstruction(input, config) {
|
|
|
1687
1749
|
});
|
|
1688
1750
|
}
|
|
1689
1751
|
function parseResumeSubscriptionInstruction(instruction) {
|
|
1690
|
-
if (instruction.accounts.length <
|
|
1752
|
+
if (instruction.accounts.length < 6) {
|
|
1691
1753
|
throw new import_kit30.SolanaError(import_kit30.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1692
1754
|
actualAccountMetas: instruction.accounts.length,
|
|
1693
|
-
expectedAccountMetas:
|
|
1755
|
+
expectedAccountMetas: 6
|
|
1694
1756
|
});
|
|
1695
1757
|
}
|
|
1696
1758
|
let accountIndex = 0;
|
|
@@ -1705,6 +1767,7 @@ function parseResumeSubscriptionInstruction(instruction) {
|
|
|
1705
1767
|
subscriber: getNextAccount(),
|
|
1706
1768
|
planPda: getNextAccount(),
|
|
1707
1769
|
subscriptionPda: getNextAccount(),
|
|
1770
|
+
subscriptionAuthority: getNextAccount(),
|
|
1708
1771
|
eventAuthority: getNextAccount(),
|
|
1709
1772
|
selfProgram: getNextAccount()
|
|
1710
1773
|
},
|
|
@@ -1777,24 +1840,92 @@ function parseRevokeAbandonedDelegationInstruction(instruction) {
|
|
|
1777
1840
|
};
|
|
1778
1841
|
}
|
|
1779
1842
|
|
|
1780
|
-
// src/generated/instructions/
|
|
1843
|
+
// src/generated/instructions/revokeAbandonedSubscription.ts
|
|
1781
1844
|
var import_kit32 = require("@solana/kit");
|
|
1782
1845
|
var import_program_client_core10 = require("@solana/program-client-core");
|
|
1846
|
+
var REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR = 16;
|
|
1847
|
+
function getRevokeAbandonedSubscriptionDiscriminatorBytes() {
|
|
1848
|
+
return (0, import_kit32.getU8Encoder)().encode(REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR);
|
|
1849
|
+
}
|
|
1850
|
+
function getRevokeAbandonedSubscriptionInstructionDataEncoder() {
|
|
1851
|
+
return (0, import_kit32.transformEncoder)((0, import_kit32.getStructEncoder)([["discriminator", (0, import_kit32.getU8Encoder)()]]), (value) => ({
|
|
1852
|
+
...value,
|
|
1853
|
+
discriminator: REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR
|
|
1854
|
+
}));
|
|
1855
|
+
}
|
|
1856
|
+
function getRevokeAbandonedSubscriptionInstructionDataDecoder() {
|
|
1857
|
+
return (0, import_kit32.getStructDecoder)([["discriminator", (0, import_kit32.getU8Decoder)()]]);
|
|
1858
|
+
}
|
|
1859
|
+
function getRevokeAbandonedSubscriptionInstructionDataCodec() {
|
|
1860
|
+
return (0, import_kit32.combineCodec)(
|
|
1861
|
+
getRevokeAbandonedSubscriptionInstructionDataEncoder(),
|
|
1862
|
+
getRevokeAbandonedSubscriptionInstructionDataDecoder()
|
|
1863
|
+
);
|
|
1864
|
+
}
|
|
1865
|
+
function getRevokeAbandonedSubscriptionInstruction(input, config) {
|
|
1866
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1867
|
+
const originalAccounts = {
|
|
1868
|
+
payer: { value: input.payer ?? null, isWritable: true },
|
|
1869
|
+
subscriptionAccount: { value: input.subscriptionAccount ?? null, isWritable: true },
|
|
1870
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1871
|
+
planPda: { value: input.planPda ?? null, isWritable: false }
|
|
1872
|
+
};
|
|
1873
|
+
const accounts = originalAccounts;
|
|
1874
|
+
const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
|
|
1875
|
+
return Object.freeze({
|
|
1876
|
+
accounts: [
|
|
1877
|
+
getAccountMeta("payer", accounts.payer),
|
|
1878
|
+
getAccountMeta("subscriptionAccount", accounts.subscriptionAccount),
|
|
1879
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1880
|
+
getAccountMeta("planPda", accounts.planPda)
|
|
1881
|
+
],
|
|
1882
|
+
data: getRevokeAbandonedSubscriptionInstructionDataEncoder().encode({}),
|
|
1883
|
+
programAddress
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
function parseRevokeAbandonedSubscriptionInstruction(instruction) {
|
|
1887
|
+
if (instruction.accounts.length < 4) {
|
|
1888
|
+
throw new import_kit32.SolanaError(import_kit32.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1889
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1890
|
+
expectedAccountMetas: 4
|
|
1891
|
+
});
|
|
1892
|
+
}
|
|
1893
|
+
let accountIndex = 0;
|
|
1894
|
+
const getNextAccount = () => {
|
|
1895
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1896
|
+
accountIndex += 1;
|
|
1897
|
+
return accountMeta;
|
|
1898
|
+
};
|
|
1899
|
+
return {
|
|
1900
|
+
programAddress: instruction.programAddress,
|
|
1901
|
+
accounts: {
|
|
1902
|
+
payer: getNextAccount(),
|
|
1903
|
+
subscriptionAccount: getNextAccount(),
|
|
1904
|
+
subscriptionAuthority: getNextAccount(),
|
|
1905
|
+
planPda: getNextAccount()
|
|
1906
|
+
},
|
|
1907
|
+
data: getRevokeAbandonedSubscriptionInstructionDataDecoder().decode(instruction.data)
|
|
1908
|
+
};
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// src/generated/instructions/revokeDelegation.ts
|
|
1912
|
+
var import_kit33 = require("@solana/kit");
|
|
1913
|
+
var import_program_client_core11 = require("@solana/program-client-core");
|
|
1783
1914
|
var REVOKE_DELEGATION_DISCRIMINATOR = 3;
|
|
1784
1915
|
function getRevokeDelegationDiscriminatorBytes() {
|
|
1785
|
-
return (0,
|
|
1916
|
+
return (0, import_kit33.getU8Encoder)().encode(REVOKE_DELEGATION_DISCRIMINATOR);
|
|
1786
1917
|
}
|
|
1787
1918
|
function getRevokeDelegationInstructionDataEncoder() {
|
|
1788
|
-
return (0,
|
|
1919
|
+
return (0, import_kit33.transformEncoder)((0, import_kit33.getStructEncoder)([["discriminator", (0, import_kit33.getU8Encoder)()]]), (value) => ({
|
|
1789
1920
|
...value,
|
|
1790
1921
|
discriminator: REVOKE_DELEGATION_DISCRIMINATOR
|
|
1791
1922
|
}));
|
|
1792
1923
|
}
|
|
1793
1924
|
function getRevokeDelegationInstructionDataDecoder() {
|
|
1794
|
-
return (0,
|
|
1925
|
+
return (0, import_kit33.getStructDecoder)([["discriminator", (0, import_kit33.getU8Decoder)()]]);
|
|
1795
1926
|
}
|
|
1796
1927
|
function getRevokeDelegationInstructionDataCodec() {
|
|
1797
|
-
return (0,
|
|
1928
|
+
return (0, import_kit33.combineCodec)(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
|
|
1798
1929
|
}
|
|
1799
1930
|
function getRevokeDelegationInstruction(input, config) {
|
|
1800
1931
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1803,7 +1934,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1803
1934
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
|
|
1804
1935
|
};
|
|
1805
1936
|
const accounts = originalAccounts;
|
|
1806
|
-
const getAccountMeta = (0,
|
|
1937
|
+
const getAccountMeta = (0, import_program_client_core11.getAccountMetaFactory)(programAddress, "programId");
|
|
1807
1938
|
return Object.freeze({
|
|
1808
1939
|
accounts: [
|
|
1809
1940
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -1815,7 +1946,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1815
1946
|
}
|
|
1816
1947
|
function parseRevokeDelegationInstruction(instruction) {
|
|
1817
1948
|
if (instruction.accounts.length < 2) {
|
|
1818
|
-
throw new
|
|
1949
|
+
throw new import_kit33.SolanaError(import_kit33.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1819
1950
|
actualAccountMetas: instruction.accounts.length,
|
|
1820
1951
|
expectedAccountMetas: 2
|
|
1821
1952
|
});
|
|
@@ -1834,53 +1965,88 @@ function parseRevokeDelegationInstruction(instruction) {
|
|
|
1834
1965
|
}
|
|
1835
1966
|
|
|
1836
1967
|
// src/generated/instructions/revokeSubscriptionAuthority.ts
|
|
1837
|
-
var
|
|
1838
|
-
var
|
|
1968
|
+
var import_kit34 = require("@solana/kit");
|
|
1969
|
+
var import_program_client_core12 = require("@solana/program-client-core");
|
|
1839
1970
|
var REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 14;
|
|
1840
1971
|
function getRevokeSubscriptionAuthorityDiscriminatorBytes() {
|
|
1841
|
-
return (0,
|
|
1972
|
+
return (0, import_kit34.getU8Encoder)().encode(REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
|
|
1842
1973
|
}
|
|
1843
1974
|
function getRevokeSubscriptionAuthorityInstructionDataEncoder() {
|
|
1844
|
-
return (0,
|
|
1975
|
+
return (0, import_kit34.transformEncoder)((0, import_kit34.getStructEncoder)([["discriminator", (0, import_kit34.getU8Encoder)()]]), (value) => ({
|
|
1845
1976
|
...value,
|
|
1846
1977
|
discriminator: REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
|
|
1847
1978
|
}));
|
|
1848
1979
|
}
|
|
1849
1980
|
function getRevokeSubscriptionAuthorityInstructionDataDecoder() {
|
|
1850
|
-
return (0,
|
|
1981
|
+
return (0, import_kit34.getStructDecoder)([["discriminator", (0, import_kit34.getU8Decoder)()]]);
|
|
1851
1982
|
}
|
|
1852
1983
|
function getRevokeSubscriptionAuthorityInstructionDataCodec() {
|
|
1853
|
-
return (0,
|
|
1984
|
+
return (0, import_kit34.combineCodec)(
|
|
1854
1985
|
getRevokeSubscriptionAuthorityInstructionDataEncoder(),
|
|
1855
1986
|
getRevokeSubscriptionAuthorityInstructionDataDecoder()
|
|
1856
1987
|
);
|
|
1857
1988
|
}
|
|
1989
|
+
async function getRevokeSubscriptionAuthorityInstructionAsync(input, config) {
|
|
1990
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1991
|
+
const originalAccounts = {
|
|
1992
|
+
user: { value: input.user ?? null, isWritable: true },
|
|
1993
|
+
userAta: { value: input.userAta ?? null, isWritable: true },
|
|
1994
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1995
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1996
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
|
|
1997
|
+
receiver: { value: input.receiver ?? null, isWritable: true }
|
|
1998
|
+
};
|
|
1999
|
+
const accounts = originalAccounts;
|
|
2000
|
+
if (!accounts.subscriptionAuthority.value) {
|
|
2001
|
+
accounts.subscriptionAuthority.value = await findSubscriptionAuthorityPda({
|
|
2002
|
+
user: (0, import_program_client_core12.getAddressFromResolvedInstructionAccount)("user", accounts.user.value),
|
|
2003
|
+
tokenMint: (0, import_program_client_core12.getAddressFromResolvedInstructionAccount)("tokenMint", accounts.tokenMint.value)
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
const getAccountMeta = (0, import_program_client_core12.getAccountMetaFactory)(programAddress, "omitted");
|
|
2007
|
+
return Object.freeze({
|
|
2008
|
+
accounts: [
|
|
2009
|
+
getAccountMeta("user", accounts.user),
|
|
2010
|
+
getAccountMeta("userAta", accounts.userAta),
|
|
2011
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
2012
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2013
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
2014
|
+
getAccountMeta("receiver", accounts.receiver)
|
|
2015
|
+
].filter((x) => x !== void 0),
|
|
2016
|
+
data: getRevokeSubscriptionAuthorityInstructionDataEncoder().encode({}),
|
|
2017
|
+
programAddress
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
1858
2020
|
function getRevokeSubscriptionAuthorityInstruction(input, config) {
|
|
1859
2021
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1860
2022
|
const originalAccounts = {
|
|
1861
|
-
user: { value: input.user ?? null, isWritable:
|
|
2023
|
+
user: { value: input.user ?? null, isWritable: true },
|
|
1862
2024
|
userAta: { value: input.userAta ?? null, isWritable: true },
|
|
1863
2025
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1864
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
2026
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
2027
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
|
|
2028
|
+
receiver: { value: input.receiver ?? null, isWritable: true }
|
|
1865
2029
|
};
|
|
1866
2030
|
const accounts = originalAccounts;
|
|
1867
|
-
const getAccountMeta = (0,
|
|
2031
|
+
const getAccountMeta = (0, import_program_client_core12.getAccountMetaFactory)(programAddress, "omitted");
|
|
1868
2032
|
return Object.freeze({
|
|
1869
2033
|
accounts: [
|
|
1870
2034
|
getAccountMeta("user", accounts.user),
|
|
1871
2035
|
getAccountMeta("userAta", accounts.userAta),
|
|
1872
2036
|
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1873
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1874
|
-
|
|
2037
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2038
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
2039
|
+
getAccountMeta("receiver", accounts.receiver)
|
|
2040
|
+
].filter((x) => x !== void 0),
|
|
1875
2041
|
data: getRevokeSubscriptionAuthorityInstructionDataEncoder().encode({}),
|
|
1876
2042
|
programAddress
|
|
1877
2043
|
});
|
|
1878
2044
|
}
|
|
1879
2045
|
function parseRevokeSubscriptionAuthorityInstruction(instruction) {
|
|
1880
|
-
if (instruction.accounts.length <
|
|
1881
|
-
throw new
|
|
2046
|
+
if (instruction.accounts.length < 5) {
|
|
2047
|
+
throw new import_kit34.SolanaError(import_kit34.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1882
2048
|
actualAccountMetas: instruction.accounts.length,
|
|
1883
|
-
expectedAccountMetas:
|
|
2049
|
+
expectedAccountMetas: 5
|
|
1884
2050
|
});
|
|
1885
2051
|
}
|
|
1886
2052
|
let accountIndex = 0;
|
|
@@ -1889,42 +2055,50 @@ function parseRevokeSubscriptionAuthorityInstruction(instruction) {
|
|
|
1889
2055
|
accountIndex += 1;
|
|
1890
2056
|
return accountMeta;
|
|
1891
2057
|
};
|
|
2058
|
+
let optionalAccountsRemaining = instruction.accounts.length - 5;
|
|
2059
|
+
const getNextOptionalAccount = () => {
|
|
2060
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
2061
|
+
optionalAccountsRemaining -= 1;
|
|
2062
|
+
return getNextAccount();
|
|
2063
|
+
};
|
|
1892
2064
|
return {
|
|
1893
2065
|
programAddress: instruction.programAddress,
|
|
1894
2066
|
accounts: {
|
|
1895
2067
|
user: getNextAccount(),
|
|
1896
2068
|
userAta: getNextAccount(),
|
|
1897
2069
|
tokenMint: getNextAccount(),
|
|
1898
|
-
tokenProgram: getNextAccount()
|
|
2070
|
+
tokenProgram: getNextAccount(),
|
|
2071
|
+
subscriptionAuthority: getNextAccount(),
|
|
2072
|
+
receiver: getNextOptionalAccount()
|
|
1899
2073
|
},
|
|
1900
2074
|
data: getRevokeSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
|
|
1901
2075
|
};
|
|
1902
2076
|
}
|
|
1903
2077
|
|
|
1904
2078
|
// src/generated/instructions/subscribe.ts
|
|
1905
|
-
var
|
|
1906
|
-
var
|
|
2079
|
+
var import_kit35 = require("@solana/kit");
|
|
2080
|
+
var import_program_client_core13 = require("@solana/program-client-core");
|
|
1907
2081
|
var SUBSCRIBE_DISCRIMINATOR = 11;
|
|
1908
2082
|
function getSubscribeDiscriminatorBytes() {
|
|
1909
|
-
return (0,
|
|
2083
|
+
return (0, import_kit35.getU8Encoder)().encode(SUBSCRIBE_DISCRIMINATOR);
|
|
1910
2084
|
}
|
|
1911
2085
|
function getSubscribeInstructionDataEncoder() {
|
|
1912
|
-
return (0,
|
|
1913
|
-
(0,
|
|
1914
|
-
["discriminator", (0,
|
|
2086
|
+
return (0, import_kit35.transformEncoder)(
|
|
2087
|
+
(0, import_kit35.getStructEncoder)([
|
|
2088
|
+
["discriminator", (0, import_kit35.getU8Encoder)()],
|
|
1915
2089
|
["subscribeData", getSubscribeDataEncoder()]
|
|
1916
2090
|
]),
|
|
1917
2091
|
(value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
|
|
1918
2092
|
);
|
|
1919
2093
|
}
|
|
1920
2094
|
function getSubscribeInstructionDataDecoder() {
|
|
1921
|
-
return (0,
|
|
1922
|
-
["discriminator", (0,
|
|
2095
|
+
return (0, import_kit35.getStructDecoder)([
|
|
2096
|
+
["discriminator", (0, import_kit35.getU8Decoder)()],
|
|
1923
2097
|
["subscribeData", getSubscribeDataDecoder()]
|
|
1924
2098
|
]);
|
|
1925
2099
|
}
|
|
1926
2100
|
function getSubscribeInstructionDataCodec() {
|
|
1927
|
-
return (0,
|
|
2101
|
+
return (0, import_kit35.combineCodec)(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
|
|
1928
2102
|
}
|
|
1929
2103
|
async function getSubscribeInstructionAsync(input, config) {
|
|
1930
2104
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1936,26 +2110,31 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1936
2110
|
subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
|
|
1937
2111
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1938
2112
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1939
|
-
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2113
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false },
|
|
2114
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1940
2115
|
};
|
|
1941
2116
|
const accounts = originalAccounts;
|
|
1942
2117
|
const args = { ...input };
|
|
1943
2118
|
if (!accounts.subscriptionPda.value) {
|
|
1944
2119
|
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1945
|
-
planPda: (0,
|
|
1946
|
-
subscriber: (0,
|
|
2120
|
+
planPda: (0, import_program_client_core13.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
|
|
2121
|
+
subscriber: (0, import_program_client_core13.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
|
|
1947
2122
|
});
|
|
1948
2123
|
}
|
|
1949
2124
|
if (!accounts.systemProgram.value) {
|
|
1950
2125
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1951
2126
|
}
|
|
1952
2127
|
if (!accounts.eventAuthority.value) {
|
|
1953
|
-
accounts.eventAuthority.value =
|
|
2128
|
+
accounts.eventAuthority.value = await (0, import_kit35.getProgramDerivedAddress)({
|
|
2129
|
+
programAddress,
|
|
2130
|
+
seeds: [(0, import_kit35.getUtf8Encoder)().encode("event_authority")]
|
|
2131
|
+
});
|
|
1954
2132
|
}
|
|
1955
2133
|
if (!accounts.selfProgram.value) {
|
|
1956
|
-
accounts.selfProgram.value =
|
|
2134
|
+
accounts.selfProgram.value = programAddress;
|
|
2135
|
+
accounts.selfProgram.isWritable = false;
|
|
1957
2136
|
}
|
|
1958
|
-
const getAccountMeta = (0,
|
|
2137
|
+
const getAccountMeta = (0, import_program_client_core13.getAccountMetaFactory)(programAddress, "omitted");
|
|
1959
2138
|
return Object.freeze({
|
|
1960
2139
|
accounts: [
|
|
1961
2140
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1965,8 +2144,9 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1965
2144
|
getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
|
|
1966
2145
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1967
2146
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1968
|
-
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1969
|
-
|
|
2147
|
+
getAccountMeta("selfProgram", accounts.selfProgram),
|
|
2148
|
+
getAccountMeta("payer", accounts.payer)
|
|
2149
|
+
].filter((x) => x !== void 0),
|
|
1970
2150
|
data: getSubscribeInstructionDataEncoder().encode(args),
|
|
1971
2151
|
programAddress
|
|
1972
2152
|
});
|
|
@@ -1981,20 +2161,19 @@ function getSubscribeInstruction(input, config) {
|
|
|
1981
2161
|
subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
|
|
1982
2162
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1983
2163
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1984
|
-
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2164
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false },
|
|
2165
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1985
2166
|
};
|
|
1986
2167
|
const accounts = originalAccounts;
|
|
1987
2168
|
const args = { ...input };
|
|
1988
2169
|
if (!accounts.systemProgram.value) {
|
|
1989
2170
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1990
2171
|
}
|
|
1991
|
-
if (!accounts.eventAuthority.value) {
|
|
1992
|
-
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1993
|
-
}
|
|
1994
2172
|
if (!accounts.selfProgram.value) {
|
|
1995
|
-
accounts.selfProgram.value =
|
|
2173
|
+
accounts.selfProgram.value = programAddress;
|
|
2174
|
+
accounts.selfProgram.isWritable = false;
|
|
1996
2175
|
}
|
|
1997
|
-
const getAccountMeta = (0,
|
|
2176
|
+
const getAccountMeta = (0, import_program_client_core13.getAccountMetaFactory)(programAddress, "omitted");
|
|
1998
2177
|
return Object.freeze({
|
|
1999
2178
|
accounts: [
|
|
2000
2179
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -2004,15 +2183,16 @@ function getSubscribeInstruction(input, config) {
|
|
|
2004
2183
|
getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
|
|
2005
2184
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
2006
2185
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2007
|
-
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2008
|
-
|
|
2186
|
+
getAccountMeta("selfProgram", accounts.selfProgram),
|
|
2187
|
+
getAccountMeta("payer", accounts.payer)
|
|
2188
|
+
].filter((x) => x !== void 0),
|
|
2009
2189
|
data: getSubscribeInstructionDataEncoder().encode(args),
|
|
2010
2190
|
programAddress
|
|
2011
2191
|
});
|
|
2012
2192
|
}
|
|
2013
2193
|
function parseSubscribeInstruction(instruction) {
|
|
2014
2194
|
if (instruction.accounts.length < 8) {
|
|
2015
|
-
throw new
|
|
2195
|
+
throw new import_kit35.SolanaError(import_kit35.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2016
2196
|
actualAccountMetas: instruction.accounts.length,
|
|
2017
2197
|
expectedAccountMetas: 8
|
|
2018
2198
|
});
|
|
@@ -2023,6 +2203,12 @@ function parseSubscribeInstruction(instruction) {
|
|
|
2023
2203
|
accountIndex += 1;
|
|
2024
2204
|
return accountMeta;
|
|
2025
2205
|
};
|
|
2206
|
+
let optionalAccountsRemaining = instruction.accounts.length - 8;
|
|
2207
|
+
const getNextOptionalAccount = () => {
|
|
2208
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
2209
|
+
optionalAccountsRemaining -= 1;
|
|
2210
|
+
return getNextAccount();
|
|
2211
|
+
};
|
|
2026
2212
|
return {
|
|
2027
2213
|
programAddress: instruction.programAddress,
|
|
2028
2214
|
accounts: {
|
|
@@ -2033,38 +2219,39 @@ function parseSubscribeInstruction(instruction) {
|
|
|
2033
2219
|
subscriptionAuthorityPda: getNextAccount(),
|
|
2034
2220
|
systemProgram: getNextAccount(),
|
|
2035
2221
|
eventAuthority: getNextAccount(),
|
|
2036
|
-
selfProgram: getNextAccount()
|
|
2222
|
+
selfProgram: getNextAccount(),
|
|
2223
|
+
payer: getNextOptionalAccount()
|
|
2037
2224
|
},
|
|
2038
2225
|
data: getSubscribeInstructionDataDecoder().decode(instruction.data)
|
|
2039
2226
|
};
|
|
2040
2227
|
}
|
|
2041
2228
|
|
|
2042
2229
|
// src/generated/instructions/transferFixed.ts
|
|
2043
|
-
var
|
|
2044
|
-
var
|
|
2230
|
+
var import_kit36 = require("@solana/kit");
|
|
2231
|
+
var import_program_client_core14 = require("@solana/program-client-core");
|
|
2045
2232
|
var TRANSFER_FIXED_DISCRIMINATOR = 4;
|
|
2046
2233
|
function getTransferFixedDiscriminatorBytes() {
|
|
2047
|
-
return (0,
|
|
2234
|
+
return (0, import_kit36.getU8Encoder)().encode(TRANSFER_FIXED_DISCRIMINATOR);
|
|
2048
2235
|
}
|
|
2049
2236
|
function getTransferFixedInstructionDataEncoder() {
|
|
2050
|
-
return (0,
|
|
2051
|
-
(0,
|
|
2052
|
-
["discriminator", (0,
|
|
2237
|
+
return (0, import_kit36.transformEncoder)(
|
|
2238
|
+
(0, import_kit36.getStructEncoder)([
|
|
2239
|
+
["discriminator", (0, import_kit36.getU8Encoder)()],
|
|
2053
2240
|
["transferData", getTransferDataEncoder()]
|
|
2054
2241
|
]),
|
|
2055
2242
|
(value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
|
|
2056
2243
|
);
|
|
2057
2244
|
}
|
|
2058
2245
|
function getTransferFixedInstructionDataDecoder() {
|
|
2059
|
-
return (0,
|
|
2060
|
-
["discriminator", (0,
|
|
2246
|
+
return (0, import_kit36.getStructDecoder)([
|
|
2247
|
+
["discriminator", (0, import_kit36.getU8Decoder)()],
|
|
2061
2248
|
["transferData", getTransferDataDecoder()]
|
|
2062
2249
|
]);
|
|
2063
2250
|
}
|
|
2064
2251
|
function getTransferFixedInstructionDataCodec() {
|
|
2065
|
-
return (0,
|
|
2252
|
+
return (0, import_kit36.combineCodec)(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
|
|
2066
2253
|
}
|
|
2067
|
-
function
|
|
2254
|
+
async function getTransferFixedInstructionAsync(input, config) {
|
|
2068
2255
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2069
2256
|
const originalAccounts = {
|
|
2070
2257
|
delegationPda: { value: input.delegationPda ?? null, isWritable: true },
|
|
@@ -2080,12 +2267,52 @@ function getTransferFixedInstruction(input, config) {
|
|
|
2080
2267
|
const accounts = originalAccounts;
|
|
2081
2268
|
const args = { ...input };
|
|
2082
2269
|
if (!accounts.eventAuthority.value) {
|
|
2083
|
-
accounts.eventAuthority.value =
|
|
2270
|
+
accounts.eventAuthority.value = await (0, import_kit36.getProgramDerivedAddress)({
|
|
2271
|
+
programAddress,
|
|
2272
|
+
seeds: [(0, import_kit36.getUtf8Encoder)().encode("event_authority")]
|
|
2273
|
+
});
|
|
2274
|
+
}
|
|
2275
|
+
if (!accounts.selfProgram.value) {
|
|
2276
|
+
accounts.selfProgram.value = programAddress;
|
|
2277
|
+
accounts.selfProgram.isWritable = false;
|
|
2084
2278
|
}
|
|
2279
|
+
const getAccountMeta = (0, import_program_client_core14.getAccountMetaFactory)(programAddress, "programId");
|
|
2280
|
+
return Object.freeze({
|
|
2281
|
+
accounts: [
|
|
2282
|
+
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
2283
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
2284
|
+
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
2285
|
+
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
2286
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
2287
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2288
|
+
getAccountMeta("delegatee", accounts.delegatee),
|
|
2289
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2290
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2291
|
+
],
|
|
2292
|
+
data: getTransferFixedInstructionDataEncoder().encode(args),
|
|
2293
|
+
programAddress
|
|
2294
|
+
});
|
|
2295
|
+
}
|
|
2296
|
+
function getTransferFixedInstruction(input, config) {
|
|
2297
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2298
|
+
const originalAccounts = {
|
|
2299
|
+
delegationPda: { value: input.delegationPda ?? null, isWritable: true },
|
|
2300
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
2301
|
+
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
2302
|
+
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
2303
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
2304
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
2305
|
+
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
2306
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
2307
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2308
|
+
};
|
|
2309
|
+
const accounts = originalAccounts;
|
|
2310
|
+
const args = { ...input };
|
|
2085
2311
|
if (!accounts.selfProgram.value) {
|
|
2086
|
-
accounts.selfProgram.value =
|
|
2312
|
+
accounts.selfProgram.value = programAddress;
|
|
2313
|
+
accounts.selfProgram.isWritable = false;
|
|
2087
2314
|
}
|
|
2088
|
-
const getAccountMeta = (0,
|
|
2315
|
+
const getAccountMeta = (0, import_program_client_core14.getAccountMetaFactory)(programAddress, "programId");
|
|
2089
2316
|
return Object.freeze({
|
|
2090
2317
|
accounts: [
|
|
2091
2318
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2104,7 +2331,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
2104
2331
|
}
|
|
2105
2332
|
function parseTransferFixedInstruction(instruction) {
|
|
2106
2333
|
if (instruction.accounts.length < 9) {
|
|
2107
|
-
throw new
|
|
2334
|
+
throw new import_kit36.SolanaError(import_kit36.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2108
2335
|
actualAccountMetas: instruction.accounts.length,
|
|
2109
2336
|
expectedAccountMetas: 9
|
|
2110
2337
|
});
|
|
@@ -2133,31 +2360,31 @@ function parseTransferFixedInstruction(instruction) {
|
|
|
2133
2360
|
}
|
|
2134
2361
|
|
|
2135
2362
|
// src/generated/instructions/transferRecurring.ts
|
|
2136
|
-
var
|
|
2137
|
-
var
|
|
2363
|
+
var import_kit37 = require("@solana/kit");
|
|
2364
|
+
var import_program_client_core15 = require("@solana/program-client-core");
|
|
2138
2365
|
var TRANSFER_RECURRING_DISCRIMINATOR = 5;
|
|
2139
2366
|
function getTransferRecurringDiscriminatorBytes() {
|
|
2140
|
-
return (0,
|
|
2367
|
+
return (0, import_kit37.getU8Encoder)().encode(TRANSFER_RECURRING_DISCRIMINATOR);
|
|
2141
2368
|
}
|
|
2142
2369
|
function getTransferRecurringInstructionDataEncoder() {
|
|
2143
|
-
return (0,
|
|
2144
|
-
(0,
|
|
2145
|
-
["discriminator", (0,
|
|
2370
|
+
return (0, import_kit37.transformEncoder)(
|
|
2371
|
+
(0, import_kit37.getStructEncoder)([
|
|
2372
|
+
["discriminator", (0, import_kit37.getU8Encoder)()],
|
|
2146
2373
|
["transferData", getTransferDataEncoder()]
|
|
2147
2374
|
]),
|
|
2148
2375
|
(value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
|
|
2149
2376
|
);
|
|
2150
2377
|
}
|
|
2151
2378
|
function getTransferRecurringInstructionDataDecoder() {
|
|
2152
|
-
return (0,
|
|
2153
|
-
["discriminator", (0,
|
|
2379
|
+
return (0, import_kit37.getStructDecoder)([
|
|
2380
|
+
["discriminator", (0, import_kit37.getU8Decoder)()],
|
|
2154
2381
|
["transferData", getTransferDataDecoder()]
|
|
2155
2382
|
]);
|
|
2156
2383
|
}
|
|
2157
2384
|
function getTransferRecurringInstructionDataCodec() {
|
|
2158
|
-
return (0,
|
|
2385
|
+
return (0, import_kit37.combineCodec)(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
|
|
2159
2386
|
}
|
|
2160
|
-
function
|
|
2387
|
+
async function getTransferRecurringInstructionAsync(input, config) {
|
|
2161
2388
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2162
2389
|
const originalAccounts = {
|
|
2163
2390
|
delegationPda: { value: input.delegationPda ?? null, isWritable: true },
|
|
@@ -2173,12 +2400,52 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
2173
2400
|
const accounts = originalAccounts;
|
|
2174
2401
|
const args = { ...input };
|
|
2175
2402
|
if (!accounts.eventAuthority.value) {
|
|
2176
|
-
accounts.eventAuthority.value =
|
|
2403
|
+
accounts.eventAuthority.value = await (0, import_kit37.getProgramDerivedAddress)({
|
|
2404
|
+
programAddress,
|
|
2405
|
+
seeds: [(0, import_kit37.getUtf8Encoder)().encode("event_authority")]
|
|
2406
|
+
});
|
|
2177
2407
|
}
|
|
2178
2408
|
if (!accounts.selfProgram.value) {
|
|
2179
|
-
accounts.selfProgram.value =
|
|
2409
|
+
accounts.selfProgram.value = programAddress;
|
|
2410
|
+
accounts.selfProgram.isWritable = false;
|
|
2180
2411
|
}
|
|
2181
|
-
const getAccountMeta = (0,
|
|
2412
|
+
const getAccountMeta = (0, import_program_client_core15.getAccountMetaFactory)(programAddress, "programId");
|
|
2413
|
+
return Object.freeze({
|
|
2414
|
+
accounts: [
|
|
2415
|
+
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
2416
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
2417
|
+
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
2418
|
+
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
2419
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
2420
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2421
|
+
getAccountMeta("delegatee", accounts.delegatee),
|
|
2422
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2423
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2424
|
+
],
|
|
2425
|
+
data: getTransferRecurringInstructionDataEncoder().encode(args),
|
|
2426
|
+
programAddress
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
function getTransferRecurringInstruction(input, config) {
|
|
2430
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2431
|
+
const originalAccounts = {
|
|
2432
|
+
delegationPda: { value: input.delegationPda ?? null, isWritable: true },
|
|
2433
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
2434
|
+
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
2435
|
+
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
2436
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
2437
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
2438
|
+
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
2439
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
2440
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2441
|
+
};
|
|
2442
|
+
const accounts = originalAccounts;
|
|
2443
|
+
const args = { ...input };
|
|
2444
|
+
if (!accounts.selfProgram.value) {
|
|
2445
|
+
accounts.selfProgram.value = programAddress;
|
|
2446
|
+
accounts.selfProgram.isWritable = false;
|
|
2447
|
+
}
|
|
2448
|
+
const getAccountMeta = (0, import_program_client_core15.getAccountMetaFactory)(programAddress, "programId");
|
|
2182
2449
|
return Object.freeze({
|
|
2183
2450
|
accounts: [
|
|
2184
2451
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2197,7 +2464,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
2197
2464
|
}
|
|
2198
2465
|
function parseTransferRecurringInstruction(instruction) {
|
|
2199
2466
|
if (instruction.accounts.length < 9) {
|
|
2200
|
-
throw new
|
|
2467
|
+
throw new import_kit37.SolanaError(import_kit37.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2201
2468
|
actualAccountMetas: instruction.accounts.length,
|
|
2202
2469
|
expectedAccountMetas: 9
|
|
2203
2470
|
});
|
|
@@ -2226,34 +2493,34 @@ function parseTransferRecurringInstruction(instruction) {
|
|
|
2226
2493
|
}
|
|
2227
2494
|
|
|
2228
2495
|
// src/generated/instructions/transferSubscription.ts
|
|
2229
|
-
var
|
|
2230
|
-
var
|
|
2496
|
+
var import_kit38 = require("@solana/kit");
|
|
2497
|
+
var import_program_client_core16 = require("@solana/program-client-core");
|
|
2231
2498
|
var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
|
|
2232
2499
|
function getTransferSubscriptionDiscriminatorBytes() {
|
|
2233
|
-
return (0,
|
|
2500
|
+
return (0, import_kit38.getU8Encoder)().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
|
|
2234
2501
|
}
|
|
2235
2502
|
function getTransferSubscriptionInstructionDataEncoder() {
|
|
2236
|
-
return (0,
|
|
2237
|
-
(0,
|
|
2238
|
-
["discriminator", (0,
|
|
2503
|
+
return (0, import_kit38.transformEncoder)(
|
|
2504
|
+
(0, import_kit38.getStructEncoder)([
|
|
2505
|
+
["discriminator", (0, import_kit38.getU8Encoder)()],
|
|
2239
2506
|
["transferData", getTransferDataEncoder()]
|
|
2240
2507
|
]),
|
|
2241
2508
|
(value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
|
|
2242
2509
|
);
|
|
2243
2510
|
}
|
|
2244
2511
|
function getTransferSubscriptionInstructionDataDecoder() {
|
|
2245
|
-
return (0,
|
|
2246
|
-
["discriminator", (0,
|
|
2512
|
+
return (0, import_kit38.getStructDecoder)([
|
|
2513
|
+
["discriminator", (0, import_kit38.getU8Decoder)()],
|
|
2247
2514
|
["transferData", getTransferDataDecoder()]
|
|
2248
2515
|
]);
|
|
2249
2516
|
}
|
|
2250
2517
|
function getTransferSubscriptionInstructionDataCodec() {
|
|
2251
|
-
return (0,
|
|
2518
|
+
return (0, import_kit38.combineCodec)(
|
|
2252
2519
|
getTransferSubscriptionInstructionDataEncoder(),
|
|
2253
2520
|
getTransferSubscriptionInstructionDataDecoder()
|
|
2254
2521
|
);
|
|
2255
2522
|
}
|
|
2256
|
-
function
|
|
2523
|
+
async function getTransferSubscriptionInstructionAsync(input, config) {
|
|
2257
2524
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2258
2525
|
const originalAccounts = {
|
|
2259
2526
|
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
@@ -2270,12 +2537,54 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2270
2537
|
const accounts = originalAccounts;
|
|
2271
2538
|
const args = { ...input };
|
|
2272
2539
|
if (!accounts.eventAuthority.value) {
|
|
2273
|
-
accounts.eventAuthority.value =
|
|
2540
|
+
accounts.eventAuthority.value = await (0, import_kit38.getProgramDerivedAddress)({
|
|
2541
|
+
programAddress,
|
|
2542
|
+
seeds: [(0, import_kit38.getUtf8Encoder)().encode("event_authority")]
|
|
2543
|
+
});
|
|
2274
2544
|
}
|
|
2275
2545
|
if (!accounts.selfProgram.value) {
|
|
2276
|
-
accounts.selfProgram.value =
|
|
2546
|
+
accounts.selfProgram.value = programAddress;
|
|
2547
|
+
accounts.selfProgram.isWritable = false;
|
|
2277
2548
|
}
|
|
2278
|
-
const getAccountMeta = (0,
|
|
2549
|
+
const getAccountMeta = (0, import_program_client_core16.getAccountMetaFactory)(programAddress, "programId");
|
|
2550
|
+
return Object.freeze({
|
|
2551
|
+
accounts: [
|
|
2552
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
2553
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
2554
|
+
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
2555
|
+
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
2556
|
+
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
2557
|
+
getAccountMeta("caller", accounts.caller),
|
|
2558
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
2559
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
2560
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2561
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2562
|
+
],
|
|
2563
|
+
data: getTransferSubscriptionInstructionDataEncoder().encode(args),
|
|
2564
|
+
programAddress
|
|
2565
|
+
});
|
|
2566
|
+
}
|
|
2567
|
+
function getTransferSubscriptionInstruction(input, config) {
|
|
2568
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2569
|
+
const originalAccounts = {
|
|
2570
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
2571
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
2572
|
+
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
2573
|
+
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
2574
|
+
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
2575
|
+
caller: { value: input.caller ?? null, isWritable: false },
|
|
2576
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
2577
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
2578
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
2579
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2580
|
+
};
|
|
2581
|
+
const accounts = originalAccounts;
|
|
2582
|
+
const args = { ...input };
|
|
2583
|
+
if (!accounts.selfProgram.value) {
|
|
2584
|
+
accounts.selfProgram.value = programAddress;
|
|
2585
|
+
accounts.selfProgram.isWritable = false;
|
|
2586
|
+
}
|
|
2587
|
+
const getAccountMeta = (0, import_program_client_core16.getAccountMetaFactory)(programAddress, "programId");
|
|
2279
2588
|
return Object.freeze({
|
|
2280
2589
|
accounts: [
|
|
2281
2590
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
@@ -2295,7 +2604,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2295
2604
|
}
|
|
2296
2605
|
function parseTransferSubscriptionInstruction(instruction) {
|
|
2297
2606
|
if (instruction.accounts.length < 10) {
|
|
2298
|
-
throw new
|
|
2607
|
+
throw new import_kit38.SolanaError(import_kit38.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2299
2608
|
actualAccountMetas: instruction.accounts.length,
|
|
2300
2609
|
expectedAccountMetas: 10
|
|
2301
2610
|
});
|
|
@@ -2325,50 +2634,93 @@ function parseTransferSubscriptionInstruction(instruction) {
|
|
|
2325
2634
|
}
|
|
2326
2635
|
|
|
2327
2636
|
// src/generated/instructions/updatePlan.ts
|
|
2328
|
-
var
|
|
2329
|
-
var
|
|
2637
|
+
var import_kit39 = require("@solana/kit");
|
|
2638
|
+
var import_program_client_core17 = require("@solana/program-client-core");
|
|
2330
2639
|
var UPDATE_PLAN_DISCRIMINATOR = 8;
|
|
2331
2640
|
function getUpdatePlanDiscriminatorBytes() {
|
|
2332
|
-
return (0,
|
|
2641
|
+
return (0, import_kit39.getU8Encoder)().encode(UPDATE_PLAN_DISCRIMINATOR);
|
|
2333
2642
|
}
|
|
2334
2643
|
function getUpdatePlanInstructionDataEncoder() {
|
|
2335
|
-
return (0,
|
|
2336
|
-
(0,
|
|
2337
|
-
["discriminator", (0,
|
|
2644
|
+
return (0, import_kit39.transformEncoder)(
|
|
2645
|
+
(0, import_kit39.getStructEncoder)([
|
|
2646
|
+
["discriminator", (0, import_kit39.getU8Encoder)()],
|
|
2338
2647
|
["updatePlanData", getUpdatePlanDataEncoder()]
|
|
2339
2648
|
]),
|
|
2340
2649
|
(value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
|
|
2341
2650
|
);
|
|
2342
2651
|
}
|
|
2343
2652
|
function getUpdatePlanInstructionDataDecoder() {
|
|
2344
|
-
return (0,
|
|
2345
|
-
["discriminator", (0,
|
|
2653
|
+
return (0, import_kit39.getStructDecoder)([
|
|
2654
|
+
["discriminator", (0, import_kit39.getU8Decoder)()],
|
|
2346
2655
|
["updatePlanData", getUpdatePlanDataDecoder()]
|
|
2347
2656
|
]);
|
|
2348
2657
|
}
|
|
2349
2658
|
function getUpdatePlanInstructionDataCodec() {
|
|
2350
|
-
return (0,
|
|
2659
|
+
return (0, import_kit39.combineCodec)(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
|
|
2660
|
+
}
|
|
2661
|
+
async function getUpdatePlanInstructionAsync(input, config) {
|
|
2662
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2663
|
+
const originalAccounts = {
|
|
2664
|
+
owner: { value: input.owner ?? null, isWritable: false },
|
|
2665
|
+
planPda: { value: input.planPda ?? null, isWritable: true },
|
|
2666
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
2667
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2668
|
+
};
|
|
2669
|
+
const accounts = originalAccounts;
|
|
2670
|
+
const args = { ...input };
|
|
2671
|
+
if (!accounts.eventAuthority.value) {
|
|
2672
|
+
accounts.eventAuthority.value = await (0, import_kit39.getProgramDerivedAddress)({
|
|
2673
|
+
programAddress,
|
|
2674
|
+
seeds: [(0, import_kit39.getUtf8Encoder)().encode("event_authority")]
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
if (!accounts.selfProgram.value) {
|
|
2678
|
+
accounts.selfProgram.value = programAddress;
|
|
2679
|
+
accounts.selfProgram.isWritable = false;
|
|
2680
|
+
}
|
|
2681
|
+
const getAccountMeta = (0, import_program_client_core17.getAccountMetaFactory)(programAddress, "programId");
|
|
2682
|
+
return Object.freeze({
|
|
2683
|
+
accounts: [
|
|
2684
|
+
getAccountMeta("owner", accounts.owner),
|
|
2685
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
2686
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2687
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2688
|
+
],
|
|
2689
|
+
data: getUpdatePlanInstructionDataEncoder().encode(args),
|
|
2690
|
+
programAddress
|
|
2691
|
+
});
|
|
2351
2692
|
}
|
|
2352
2693
|
function getUpdatePlanInstruction(input, config) {
|
|
2353
2694
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
2354
2695
|
const originalAccounts = {
|
|
2355
2696
|
owner: { value: input.owner ?? null, isWritable: false },
|
|
2356
|
-
planPda: { value: input.planPda ?? null, isWritable: true }
|
|
2697
|
+
planPda: { value: input.planPda ?? null, isWritable: true },
|
|
2698
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
2699
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
2357
2700
|
};
|
|
2358
2701
|
const accounts = originalAccounts;
|
|
2359
2702
|
const args = { ...input };
|
|
2360
|
-
|
|
2703
|
+
if (!accounts.selfProgram.value) {
|
|
2704
|
+
accounts.selfProgram.value = programAddress;
|
|
2705
|
+
accounts.selfProgram.isWritable = false;
|
|
2706
|
+
}
|
|
2707
|
+
const getAccountMeta = (0, import_program_client_core17.getAccountMetaFactory)(programAddress, "programId");
|
|
2361
2708
|
return Object.freeze({
|
|
2362
|
-
accounts: [
|
|
2709
|
+
accounts: [
|
|
2710
|
+
getAccountMeta("owner", accounts.owner),
|
|
2711
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
2712
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
2713
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
2714
|
+
],
|
|
2363
2715
|
data: getUpdatePlanInstructionDataEncoder().encode(args),
|
|
2364
2716
|
programAddress
|
|
2365
2717
|
});
|
|
2366
2718
|
}
|
|
2367
2719
|
function parseUpdatePlanInstruction(instruction) {
|
|
2368
|
-
if (instruction.accounts.length <
|
|
2369
|
-
throw new
|
|
2720
|
+
if (instruction.accounts.length < 4) {
|
|
2721
|
+
throw new import_kit39.SolanaError(import_kit39.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2370
2722
|
actualAccountMetas: instruction.accounts.length,
|
|
2371
|
-
expectedAccountMetas:
|
|
2723
|
+
expectedAccountMetas: 4
|
|
2372
2724
|
});
|
|
2373
2725
|
}
|
|
2374
2726
|
let accountIndex = 0;
|
|
@@ -2379,7 +2731,12 @@ function parseUpdatePlanInstruction(instruction) {
|
|
|
2379
2731
|
};
|
|
2380
2732
|
return {
|
|
2381
2733
|
programAddress: instruction.programAddress,
|
|
2382
|
-
accounts: {
|
|
2734
|
+
accounts: {
|
|
2735
|
+
owner: getNextAccount(),
|
|
2736
|
+
planPda: getNextAccount(),
|
|
2737
|
+
eventAuthority: getNextAccount(),
|
|
2738
|
+
selfProgram: getNextAccount()
|
|
2739
|
+
},
|
|
2383
2740
|
data: getUpdatePlanInstructionDataDecoder().decode(instruction.data)
|
|
2384
2741
|
};
|
|
2385
2742
|
}
|
|
@@ -2412,59 +2769,63 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
|
|
|
2412
2769
|
SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
|
|
2413
2770
|
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeSubscriptionAuthority"] = 14] = "RevokeSubscriptionAuthority";
|
|
2414
2771
|
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedDelegation"] = 15] = "RevokeAbandonedDelegation";
|
|
2772
|
+
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedSubscription"] = 16] = "RevokeAbandonedSubscription";
|
|
2415
2773
|
return SubscriptionsInstruction2;
|
|
2416
2774
|
})(SubscriptionsInstruction || {});
|
|
2417
2775
|
function identifySubscriptionsInstruction(instruction) {
|
|
2418
2776
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
2419
|
-
if ((0,
|
|
2777
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(0), 0)) {
|
|
2420
2778
|
return 0 /* InitSubscriptionAuthority */;
|
|
2421
2779
|
}
|
|
2422
|
-
if ((0,
|
|
2780
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(1), 0)) {
|
|
2423
2781
|
return 1 /* CreateFixedDelegation */;
|
|
2424
2782
|
}
|
|
2425
|
-
if ((0,
|
|
2783
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(2), 0)) {
|
|
2426
2784
|
return 2 /* CreateRecurringDelegation */;
|
|
2427
2785
|
}
|
|
2428
|
-
if ((0,
|
|
2786
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(3), 0)) {
|
|
2429
2787
|
return 3 /* RevokeDelegation */;
|
|
2430
2788
|
}
|
|
2431
|
-
if ((0,
|
|
2789
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(4), 0)) {
|
|
2432
2790
|
return 4 /* TransferFixed */;
|
|
2433
2791
|
}
|
|
2434
|
-
if ((0,
|
|
2792
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(5), 0)) {
|
|
2435
2793
|
return 5 /* TransferRecurring */;
|
|
2436
2794
|
}
|
|
2437
|
-
if ((0,
|
|
2795
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(6), 0)) {
|
|
2438
2796
|
return 6 /* CloseSubscriptionAuthority */;
|
|
2439
2797
|
}
|
|
2440
|
-
if ((0,
|
|
2798
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(7), 0)) {
|
|
2441
2799
|
return 7 /* CreatePlan */;
|
|
2442
2800
|
}
|
|
2443
|
-
if ((0,
|
|
2801
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(8), 0)) {
|
|
2444
2802
|
return 8 /* UpdatePlan */;
|
|
2445
2803
|
}
|
|
2446
|
-
if ((0,
|
|
2804
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(9), 0)) {
|
|
2447
2805
|
return 9 /* DeletePlan */;
|
|
2448
2806
|
}
|
|
2449
|
-
if ((0,
|
|
2807
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(10), 0)) {
|
|
2450
2808
|
return 10 /* TransferSubscription */;
|
|
2451
2809
|
}
|
|
2452
|
-
if ((0,
|
|
2810
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(11), 0)) {
|
|
2453
2811
|
return 11 /* Subscribe */;
|
|
2454
2812
|
}
|
|
2455
|
-
if ((0,
|
|
2813
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(12), 0)) {
|
|
2456
2814
|
return 12 /* CancelSubscription */;
|
|
2457
2815
|
}
|
|
2458
|
-
if ((0,
|
|
2816
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(13), 0)) {
|
|
2459
2817
|
return 13 /* ResumeSubscription */;
|
|
2460
2818
|
}
|
|
2461
|
-
if ((0,
|
|
2819
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(14), 0)) {
|
|
2462
2820
|
return 14 /* RevokeSubscriptionAuthority */;
|
|
2463
2821
|
}
|
|
2464
|
-
if ((0,
|
|
2822
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(15), 0)) {
|
|
2465
2823
|
return 15 /* RevokeAbandonedDelegation */;
|
|
2466
2824
|
}
|
|
2467
|
-
|
|
2825
|
+
if ((0, import_kit40.containsBytes)(data, (0, import_kit40.getU8Encoder)().encode(16), 0)) {
|
|
2826
|
+
return 16 /* RevokeAbandonedSubscription */;
|
|
2827
|
+
}
|
|
2828
|
+
throw new import_kit40.SolanaError(import_kit40.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
2468
2829
|
instructionData: data,
|
|
2469
2830
|
programName: "subscriptions"
|
|
2470
2831
|
});
|
|
@@ -2473,107 +2834,114 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2473
2834
|
const instructionType = identifySubscriptionsInstruction(instruction);
|
|
2474
2835
|
switch (instructionType) {
|
|
2475
2836
|
case 0 /* InitSubscriptionAuthority */: {
|
|
2476
|
-
(0,
|
|
2837
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2477
2838
|
return {
|
|
2478
2839
|
instructionType: 0 /* InitSubscriptionAuthority */,
|
|
2479
2840
|
...parseInitSubscriptionAuthorityInstruction(instruction)
|
|
2480
2841
|
};
|
|
2481
2842
|
}
|
|
2482
2843
|
case 1 /* CreateFixedDelegation */: {
|
|
2483
|
-
(0,
|
|
2844
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2484
2845
|
return {
|
|
2485
2846
|
instructionType: 1 /* CreateFixedDelegation */,
|
|
2486
2847
|
...parseCreateFixedDelegationInstruction(instruction)
|
|
2487
2848
|
};
|
|
2488
2849
|
}
|
|
2489
2850
|
case 2 /* CreateRecurringDelegation */: {
|
|
2490
|
-
(0,
|
|
2851
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2491
2852
|
return {
|
|
2492
2853
|
instructionType: 2 /* CreateRecurringDelegation */,
|
|
2493
2854
|
...parseCreateRecurringDelegationInstruction(instruction)
|
|
2494
2855
|
};
|
|
2495
2856
|
}
|
|
2496
2857
|
case 3 /* RevokeDelegation */: {
|
|
2497
|
-
(0,
|
|
2858
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2498
2859
|
return {
|
|
2499
2860
|
instructionType: 3 /* RevokeDelegation */,
|
|
2500
2861
|
...parseRevokeDelegationInstruction(instruction)
|
|
2501
2862
|
};
|
|
2502
2863
|
}
|
|
2503
2864
|
case 4 /* TransferFixed */: {
|
|
2504
|
-
(0,
|
|
2865
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2505
2866
|
return {
|
|
2506
2867
|
instructionType: 4 /* TransferFixed */,
|
|
2507
2868
|
...parseTransferFixedInstruction(instruction)
|
|
2508
2869
|
};
|
|
2509
2870
|
}
|
|
2510
2871
|
case 5 /* TransferRecurring */: {
|
|
2511
|
-
(0,
|
|
2872
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2512
2873
|
return {
|
|
2513
2874
|
instructionType: 5 /* TransferRecurring */,
|
|
2514
2875
|
...parseTransferRecurringInstruction(instruction)
|
|
2515
2876
|
};
|
|
2516
2877
|
}
|
|
2517
2878
|
case 6 /* CloseSubscriptionAuthority */: {
|
|
2518
|
-
(0,
|
|
2879
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2519
2880
|
return {
|
|
2520
2881
|
instructionType: 6 /* CloseSubscriptionAuthority */,
|
|
2521
2882
|
...parseCloseSubscriptionAuthorityInstruction(instruction)
|
|
2522
2883
|
};
|
|
2523
2884
|
}
|
|
2524
2885
|
case 7 /* CreatePlan */: {
|
|
2525
|
-
(0,
|
|
2886
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2526
2887
|
return { instructionType: 7 /* CreatePlan */, ...parseCreatePlanInstruction(instruction) };
|
|
2527
2888
|
}
|
|
2528
2889
|
case 8 /* UpdatePlan */: {
|
|
2529
|
-
(0,
|
|
2890
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2530
2891
|
return { instructionType: 8 /* UpdatePlan */, ...parseUpdatePlanInstruction(instruction) };
|
|
2531
2892
|
}
|
|
2532
2893
|
case 9 /* DeletePlan */: {
|
|
2533
|
-
(0,
|
|
2894
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2534
2895
|
return { instructionType: 9 /* DeletePlan */, ...parseDeletePlanInstruction(instruction) };
|
|
2535
2896
|
}
|
|
2536
2897
|
case 10 /* TransferSubscription */: {
|
|
2537
|
-
(0,
|
|
2898
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2538
2899
|
return {
|
|
2539
2900
|
instructionType: 10 /* TransferSubscription */,
|
|
2540
2901
|
...parseTransferSubscriptionInstruction(instruction)
|
|
2541
2902
|
};
|
|
2542
2903
|
}
|
|
2543
2904
|
case 11 /* Subscribe */: {
|
|
2544
|
-
(0,
|
|
2905
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2545
2906
|
return { instructionType: 11 /* Subscribe */, ...parseSubscribeInstruction(instruction) };
|
|
2546
2907
|
}
|
|
2547
2908
|
case 12 /* CancelSubscription */: {
|
|
2548
|
-
(0,
|
|
2909
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2549
2910
|
return {
|
|
2550
2911
|
instructionType: 12 /* CancelSubscription */,
|
|
2551
2912
|
...parseCancelSubscriptionInstruction(instruction)
|
|
2552
2913
|
};
|
|
2553
2914
|
}
|
|
2554
2915
|
case 13 /* ResumeSubscription */: {
|
|
2555
|
-
(0,
|
|
2916
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2556
2917
|
return {
|
|
2557
2918
|
instructionType: 13 /* ResumeSubscription */,
|
|
2558
2919
|
...parseResumeSubscriptionInstruction(instruction)
|
|
2559
2920
|
};
|
|
2560
2921
|
}
|
|
2561
2922
|
case 14 /* RevokeSubscriptionAuthority */: {
|
|
2562
|
-
(0,
|
|
2923
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2563
2924
|
return {
|
|
2564
2925
|
instructionType: 14 /* RevokeSubscriptionAuthority */,
|
|
2565
2926
|
...parseRevokeSubscriptionAuthorityInstruction(instruction)
|
|
2566
2927
|
};
|
|
2567
2928
|
}
|
|
2568
2929
|
case 15 /* RevokeAbandonedDelegation */: {
|
|
2569
|
-
(0,
|
|
2930
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2570
2931
|
return {
|
|
2571
2932
|
instructionType: 15 /* RevokeAbandonedDelegation */,
|
|
2572
2933
|
...parseRevokeAbandonedDelegationInstruction(instruction)
|
|
2573
2934
|
};
|
|
2574
2935
|
}
|
|
2936
|
+
case 16 /* RevokeAbandonedSubscription */: {
|
|
2937
|
+
(0, import_kit40.assertIsInstructionWithAccounts)(instruction);
|
|
2938
|
+
return {
|
|
2939
|
+
instructionType: 16 /* RevokeAbandonedSubscription */,
|
|
2940
|
+
...parseRevokeAbandonedSubscriptionInstruction(instruction)
|
|
2941
|
+
};
|
|
2942
|
+
}
|
|
2575
2943
|
default:
|
|
2576
|
-
throw new
|
|
2944
|
+
throw new import_kit40.SolanaError(import_kit40.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
2577
2945
|
instructionType,
|
|
2578
2946
|
programName: "subscriptions"
|
|
2579
2947
|
});
|
|
@@ -2581,33 +2949,34 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2581
2949
|
}
|
|
2582
2950
|
function subscriptionsProgram() {
|
|
2583
2951
|
return (client) => {
|
|
2584
|
-
return (0,
|
|
2952
|
+
return (0, import_kit40.extendClient)(client, {
|
|
2585
2953
|
subscriptions: {
|
|
2586
2954
|
accounts: {
|
|
2587
|
-
fixedDelegation: (0,
|
|
2588
|
-
plan: (0,
|
|
2589
|
-
recurringDelegation: (0,
|
|
2590
|
-
subscriptionAuthority: (0,
|
|
2591
|
-
subscriptionDelegation: (0,
|
|
2592
|
-
eventAuthority: (0,
|
|
2955
|
+
fixedDelegation: (0, import_program_client_core18.addSelfFetchFunctions)(client, getFixedDelegationCodec()),
|
|
2956
|
+
plan: (0, import_program_client_core18.addSelfFetchFunctions)(client, getPlanCodec()),
|
|
2957
|
+
recurringDelegation: (0, import_program_client_core18.addSelfFetchFunctions)(client, getRecurringDelegationCodec()),
|
|
2958
|
+
subscriptionAuthority: (0, import_program_client_core18.addSelfFetchFunctions)(client, getSubscriptionAuthorityCodec()),
|
|
2959
|
+
subscriptionDelegation: (0, import_program_client_core18.addSelfFetchFunctions)(client, getSubscriptionDelegationCodec()),
|
|
2960
|
+
eventAuthority: (0, import_program_client_core18.addSelfFetchFunctions)(client, getEventAuthorityCodec())
|
|
2593
2961
|
},
|
|
2594
2962
|
instructions: {
|
|
2595
|
-
initSubscriptionAuthority: (input) => (0,
|
|
2596
|
-
createFixedDelegation: (input) => (0,
|
|
2597
|
-
createRecurringDelegation: (input) => (0,
|
|
2598
|
-
revokeDelegation: (input) => (0,
|
|
2599
|
-
transferFixed: (input) => (0,
|
|
2600
|
-
transferRecurring: (input) => (0,
|
|
2601
|
-
closeSubscriptionAuthority: (input) => (0,
|
|
2602
|
-
createPlan: (input) => (0,
|
|
2603
|
-
updatePlan: (input) => (0,
|
|
2604
|
-
deletePlan: (input) => (0,
|
|
2605
|
-
transferSubscription: (input) => (0,
|
|
2606
|
-
subscribe: (input) => (0,
|
|
2607
|
-
cancelSubscription: (input) => (0,
|
|
2608
|
-
resumeSubscription: (input) => (0,
|
|
2609
|
-
revokeSubscriptionAuthority: (input) => (0,
|
|
2610
|
-
revokeAbandonedDelegation: (input) => (0,
|
|
2963
|
+
initSubscriptionAuthority: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getInitSubscriptionAuthorityInstructionAsync(input)),
|
|
2964
|
+
createFixedDelegation: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getCreateFixedDelegationInstruction(input)),
|
|
2965
|
+
createRecurringDelegation: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getCreateRecurringDelegationInstruction(input)),
|
|
2966
|
+
revokeDelegation: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getRevokeDelegationInstruction(input)),
|
|
2967
|
+
transferFixed: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getTransferFixedInstructionAsync(input)),
|
|
2968
|
+
transferRecurring: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getTransferRecurringInstructionAsync(input)),
|
|
2969
|
+
closeSubscriptionAuthority: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getCloseSubscriptionAuthorityInstruction(input)),
|
|
2970
|
+
createPlan: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getCreatePlanInstruction(input)),
|
|
2971
|
+
updatePlan: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getUpdatePlanInstructionAsync(input)),
|
|
2972
|
+
deletePlan: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getDeletePlanInstruction(input)),
|
|
2973
|
+
transferSubscription: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getTransferSubscriptionInstructionAsync(input)),
|
|
2974
|
+
subscribe: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getSubscribeInstructionAsync(input)),
|
|
2975
|
+
cancelSubscription: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getCancelSubscriptionInstructionAsync(input)),
|
|
2976
|
+
resumeSubscription: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getResumeSubscriptionInstructionAsync(input)),
|
|
2977
|
+
revokeSubscriptionAuthority: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getRevokeSubscriptionAuthorityInstructionAsync(input)),
|
|
2978
|
+
revokeAbandonedDelegation: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getRevokeAbandonedDelegationInstruction(input)),
|
|
2979
|
+
revokeAbandonedSubscription: (input) => (0, import_program_client_core18.addSelfPlanAndSendFunctions)(client, getRevokeAbandonedSubscriptionInstruction(input))
|
|
2611
2980
|
},
|
|
2612
2981
|
pdas: {
|
|
2613
2982
|
fixedDelegation: findFixedDelegationPda,
|
|
@@ -2661,7 +3030,6 @@ var SUBSCRIPTIONS_ERROR__MIGRATION_REQUIRED = 134;
|
|
|
2661
3030
|
var SUBSCRIPTIONS_ERROR__DELEGATION_ALREADY_EXISTS = 135;
|
|
2662
3031
|
var SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY = 136;
|
|
2663
3032
|
var SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS = 137;
|
|
2664
|
-
var SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING = 138;
|
|
2665
3033
|
var SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_LIMIT = 300;
|
|
2666
3034
|
var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_EXPIRY_IN_PAST = 301;
|
|
2667
3035
|
var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_AMOUNT_ZERO = 302;
|
|
@@ -2694,10 +3062,12 @@ var SUBSCRIPTIONS_ERROR__PLAN_CLOSED = 516;
|
|
|
2694
3062
|
var SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED = 517;
|
|
2695
3063
|
var SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS = 518;
|
|
2696
3064
|
var SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH = 519;
|
|
3065
|
+
var SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND = 520;
|
|
2697
3066
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY = 600;
|
|
2698
3067
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA = 601;
|
|
2699
3068
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG = 602;
|
|
2700
3069
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DISCRIMINATOR = 603;
|
|
3070
|
+
var SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM = 604;
|
|
2701
3071
|
var subscriptionsErrorMessages;
|
|
2702
3072
|
if (process.env["NODE_ENV"] !== "production") {
|
|
2703
3073
|
subscriptionsErrorMessages = {
|
|
@@ -2734,6 +3104,7 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
2734
3104
|
[SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH]: `Invalid Period length`,
|
|
2735
3105
|
[SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA]: `Invalid Plan PDA derivation`,
|
|
2736
3106
|
[SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS]: `Invalid plan status value`,
|
|
3107
|
+
[SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM]: `Self program account does not match this program`,
|
|
2737
3108
|
[SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA]: `Invalid subscription-authority PDA derivation`,
|
|
2738
3109
|
[SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA]: `Invalid subscription PDA derivation`,
|
|
2739
3110
|
[SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA]: `Invalid Token-2022 mint account data`,
|
|
@@ -2757,6 +3128,7 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
2757
3128
|
[SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED]: `Period has not elapsed yet`,
|
|
2758
3129
|
[SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS]: `Plan account already exists`,
|
|
2759
3130
|
[SUBSCRIPTIONS_ERROR__PLAN_CLOSED]: `Plan account has been closed`,
|
|
3131
|
+
[SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND]: `A finite plan end timestamp can only be shortened, not removed or extended`,
|
|
2760
3132
|
[SUBSCRIPTIONS_ERROR__PLAN_EXPIRED]: `Plan has expired`,
|
|
2761
3133
|
[SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET]: `Plan cannot be updated after sunset`,
|
|
2762
3134
|
[SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED]: `Plan must be expired to delete`,
|
|
@@ -2773,7 +3145,6 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
2773
3145
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
|
|
2774
3146
|
[SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
|
|
2775
3147
|
[SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS]: `Too many transfer hook accounts provided`,
|
|
2776
|
-
[SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING]: `Transfer hook validation account missing from provided accounts`,
|
|
2777
3148
|
[SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
|
|
2778
3149
|
[SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION]: `Destination not in plan whitelist`
|
|
2779
3150
|
};
|
|
@@ -2785,7 +3156,7 @@ function getSubscriptionsErrorMessage(code) {
|
|
|
2785
3156
|
return "Error message not available in production bundles.";
|
|
2786
3157
|
}
|
|
2787
3158
|
function isSubscriptionsError(error, transactionMessage, code) {
|
|
2788
|
-
return (0,
|
|
3159
|
+
return (0, import_kit41.isProgramError)(error, transactionMessage, SUBSCRIPTIONS_PROGRAM_ADDRESS, code);
|
|
2789
3160
|
}
|
|
2790
3161
|
|
|
2791
3162
|
// src/constants.ts
|
|
@@ -2810,7 +3181,7 @@ var METADATA_URI_LEN = 128;
|
|
|
2810
3181
|
|
|
2811
3182
|
// src/accounts/decode.ts
|
|
2812
3183
|
function toEncodedAccount(raw, programAddress) {
|
|
2813
|
-
const base64Encoder = (0,
|
|
3184
|
+
const base64Encoder = (0, import_kit42.getBase64Encoder)();
|
|
2814
3185
|
const data = base64Encoder.encode(raw.account.data[0]);
|
|
2815
3186
|
return {
|
|
2816
3187
|
address: raw.pubkey,
|
|
@@ -2927,12 +3298,12 @@ async function fetchSubscriptionsForUser(rpc, user, programAddress) {
|
|
|
2927
3298
|
}
|
|
2928
3299
|
|
|
2929
3300
|
// src/plugin.ts
|
|
2930
|
-
var
|
|
2931
|
-
var
|
|
3301
|
+
var import_kit44 = require("@solana/kit");
|
|
3302
|
+
var import_program_client_core19 = require("@solana/program-client-core");
|
|
2932
3303
|
var import_token = require("@solana-program/token");
|
|
2933
3304
|
|
|
2934
3305
|
// src/transfer-hook.ts
|
|
2935
|
-
var
|
|
3306
|
+
var import_kit43 = require("@solana/kit");
|
|
2936
3307
|
var import_token_2022 = require("@solana-program/token-2022");
|
|
2937
3308
|
var DEFAULT_ADDRESS = "11111111111111111111111111111111";
|
|
2938
3309
|
var EXTRA_ACCOUNT_METAS_SEED = "extra-account-metas";
|
|
@@ -2942,16 +3313,16 @@ var EXTRA_ACCOUNT_META_LEN = 35;
|
|
|
2942
3313
|
var PUBKEY_LEN = 32;
|
|
2943
3314
|
var PDA_PROGRAM_INDEX_OFFSET = 1 << 7;
|
|
2944
3315
|
var EXECUTE_DISCRIMINATOR = Uint8Array.from([105, 37, 101, 197, 75, 251, 102, 26]);
|
|
2945
|
-
var addressDecoder = (0,
|
|
2946
|
-
var addressEncoder = (0,
|
|
3316
|
+
var addressDecoder = (0, import_kit43.getAddressDecoder)();
|
|
3317
|
+
var addressEncoder = (0, import_kit43.getAddressEncoder)();
|
|
2947
3318
|
function roleFor(isSigner, isWritable) {
|
|
2948
|
-
if (isSigner && isWritable) return
|
|
2949
|
-
if (isSigner) return
|
|
2950
|
-
if (isWritable) return
|
|
2951
|
-
return
|
|
3319
|
+
if (isSigner && isWritable) return import_kit43.AccountRole.WRITABLE_SIGNER;
|
|
3320
|
+
if (isSigner) return import_kit43.AccountRole.READONLY_SIGNER;
|
|
3321
|
+
if (isWritable) return import_kit43.AccountRole.WRITABLE;
|
|
3322
|
+
return import_kit43.AccountRole.READONLY;
|
|
2952
3323
|
}
|
|
2953
3324
|
async function fetchData(rpc, address) {
|
|
2954
|
-
const account = await (0,
|
|
3325
|
+
const account = await (0, import_kit43.fetchEncodedAccount)(rpc, address);
|
|
2955
3326
|
if (!account.exists) throw new Error("transfer hook: referenced account not found");
|
|
2956
3327
|
return account.data;
|
|
2957
3328
|
}
|
|
@@ -3032,7 +3403,7 @@ async function resolveMeta(meta, previous, instructionData, hookProgram, rpc) {
|
|
|
3032
3403
|
}
|
|
3033
3404
|
const programId = meta.discriminator === 1 ? hookProgram : previous[meta.discriminator - PDA_PROGRAM_INDEX_OFFSET].address;
|
|
3034
3405
|
const seeds = await unpackSeeds(meta.addressConfig, previous, instructionData, rpc);
|
|
3035
|
-
const [pda] = await (0,
|
|
3406
|
+
const [pda] = await (0, import_kit43.getProgramDerivedAddress)({ programAddress: programId, seeds });
|
|
3036
3407
|
return { address: pda, role };
|
|
3037
3408
|
}
|
|
3038
3409
|
async function resolveTransferHookAccounts(rpc, args) {
|
|
@@ -3043,23 +3414,23 @@ async function resolveTransferHookAccounts(rpc, args) {
|
|
|
3043
3414
|
const hook = extensions.find((extension) => extension.__kind === "TransferHook");
|
|
3044
3415
|
if (!hook || hook.programId === DEFAULT_ADDRESS) return [];
|
|
3045
3416
|
const hookProgram = hook.programId;
|
|
3046
|
-
const [validationPda] = await (0,
|
|
3417
|
+
const [validationPda] = await (0, import_kit43.getProgramDerivedAddress)({
|
|
3047
3418
|
programAddress: hookProgram,
|
|
3048
3419
|
seeds: [EXTRA_ACCOUNT_METAS_SEED, addressEncoder.encode(args.mint)]
|
|
3049
3420
|
});
|
|
3050
3421
|
const trailing = [
|
|
3051
|
-
{ address: hookProgram, role:
|
|
3052
|
-
{ address: validationPda, role:
|
|
3422
|
+
{ address: hookProgram, role: import_kit43.AccountRole.READONLY },
|
|
3423
|
+
{ address: validationPda, role: import_kit43.AccountRole.READONLY }
|
|
3053
3424
|
];
|
|
3054
|
-
const validationAccount = await (0,
|
|
3425
|
+
const validationAccount = await (0, import_kit43.fetchEncodedAccount)(rpc, validationPda);
|
|
3055
3426
|
if (!validationAccount.exists) return trailing;
|
|
3056
3427
|
const instructionData = executeInstructionData(args.amount);
|
|
3057
3428
|
const previous = [
|
|
3058
|
-
{ address: args.source, role:
|
|
3059
|
-
{ address: args.mint, role:
|
|
3060
|
-
{ address: args.destination, role:
|
|
3061
|
-
{ address: args.authority, role:
|
|
3062
|
-
{ address: validationPda, role:
|
|
3429
|
+
{ address: args.source, role: import_kit43.AccountRole.READONLY },
|
|
3430
|
+
{ address: args.mint, role: import_kit43.AccountRole.READONLY },
|
|
3431
|
+
{ address: args.destination, role: import_kit43.AccountRole.READONLY },
|
|
3432
|
+
{ address: args.authority, role: import_kit43.AccountRole.READONLY },
|
|
3433
|
+
{ address: validationPda, role: import_kit43.AccountRole.READONLY }
|
|
3063
3434
|
];
|
|
3064
3435
|
for (const meta of readMetas(validationAccount.data)) {
|
|
3065
3436
|
const resolved = await resolveMeta(meta, previous, instructionData, hookProgram, rpc);
|
|
@@ -3107,6 +3478,10 @@ function padPlanPullers(addresses) {
|
|
|
3107
3478
|
function pdaConfig(programAddress) {
|
|
3108
3479
|
return programAddress ? { programAddress } : {};
|
|
3109
3480
|
}
|
|
3481
|
+
async function eventAccounts(programAddress) {
|
|
3482
|
+
const [eventAuthority] = await findEventAuthorityPda(pdaConfig(programAddress));
|
|
3483
|
+
return { eventAuthority, selfProgram: programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS };
|
|
3484
|
+
}
|
|
3110
3485
|
function withTrailing(instruction, trailing) {
|
|
3111
3486
|
if (trailing.length === 0) return instruction;
|
|
3112
3487
|
const accounts = [
|
|
@@ -3120,7 +3495,7 @@ function appendPayer(instruction, payer) {
|
|
|
3120
3495
|
return withTrailing(instruction, [
|
|
3121
3496
|
{
|
|
3122
3497
|
address: payer.address,
|
|
3123
|
-
role:
|
|
3498
|
+
role: import_kit44.AccountRole.WRITABLE_SIGNER,
|
|
3124
3499
|
signer: payer
|
|
3125
3500
|
}
|
|
3126
3501
|
]);
|
|
@@ -3149,7 +3524,7 @@ async function getCloseSubscriptionAuthorityOverlayInstructionAsync(input) {
|
|
|
3149
3524
|
pdaConfig(input.programAddress)
|
|
3150
3525
|
);
|
|
3151
3526
|
if (input.receiver) {
|
|
3152
|
-
ix = withTrailing(ix, [{ address: input.receiver, role:
|
|
3527
|
+
ix = withTrailing(ix, [{ address: input.receiver, role: import_kit44.AccountRole.WRITABLE }]);
|
|
3153
3528
|
}
|
|
3154
3529
|
return ix;
|
|
3155
3530
|
}
|
|
@@ -3159,8 +3534,13 @@ async function getRevokeSubscriptionAuthorityOverlayInstructionAsync(input) {
|
|
|
3159
3534
|
owner: input.user.address,
|
|
3160
3535
|
tokenProgram: input.tokenProgram
|
|
3161
3536
|
});
|
|
3162
|
-
|
|
3537
|
+
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
3538
|
+
{ tokenMint: input.tokenMint, user: input.user.address },
|
|
3539
|
+
pdaConfig(input.programAddress)
|
|
3540
|
+
);
|
|
3541
|
+
let ix = getRevokeSubscriptionAuthorityInstruction(
|
|
3163
3542
|
{
|
|
3543
|
+
subscriptionAuthority,
|
|
3164
3544
|
tokenMint: input.tokenMint,
|
|
3165
3545
|
tokenProgram: input.tokenProgram,
|
|
3166
3546
|
user: input.user,
|
|
@@ -3168,6 +3548,10 @@ async function getRevokeSubscriptionAuthorityOverlayInstructionAsync(input) {
|
|
|
3168
3548
|
},
|
|
3169
3549
|
pdaConfig(input.programAddress)
|
|
3170
3550
|
);
|
|
3551
|
+
if (input.receiver) {
|
|
3552
|
+
ix = withTrailing(ix, [{ address: input.receiver, role: import_kit44.AccountRole.WRITABLE }]);
|
|
3553
|
+
}
|
|
3554
|
+
return ix;
|
|
3171
3555
|
}
|
|
3172
3556
|
async function getCreateFixedDelegationOverlayInstructionAsync(input) {
|
|
3173
3557
|
assertPositive(input.amount, "amount");
|
|
@@ -3259,14 +3643,14 @@ function getRevokeDelegationOverlayInstruction(input) {
|
|
|
3259
3643
|
pdaConfig(input.programAddress)
|
|
3260
3644
|
);
|
|
3261
3645
|
if (input.receiver) {
|
|
3262
|
-
ix = withTrailing(ix, [{ address: input.receiver, role:
|
|
3646
|
+
ix = withTrailing(ix, [{ address: input.receiver, role: import_kit44.AccountRole.WRITABLE }]);
|
|
3263
3647
|
}
|
|
3264
3648
|
return ix;
|
|
3265
3649
|
}
|
|
3266
3650
|
function getRevokeSubscriptionOverlayInstruction(input) {
|
|
3267
|
-
const trailing = [{ address: input.planPda, role:
|
|
3651
|
+
const trailing = [{ address: input.planPda, role: import_kit44.AccountRole.READONLY }];
|
|
3268
3652
|
if (input.receiver) {
|
|
3269
|
-
trailing.push({ address: input.receiver, role:
|
|
3653
|
+
trailing.push({ address: input.receiver, role: import_kit44.AccountRole.WRITABLE });
|
|
3270
3654
|
}
|
|
3271
3655
|
return withTrailing(
|
|
3272
3656
|
getRevokeDelegationInstruction(
|
|
@@ -3288,6 +3672,7 @@ async function getTransferDelegationOverlayInstructionAsync(input, getInstructio
|
|
|
3288
3672
|
return withTrailing(
|
|
3289
3673
|
getInstruction(
|
|
3290
3674
|
{
|
|
3675
|
+
...await eventAccounts(input.programAddress),
|
|
3291
3676
|
delegatee: input.delegatee,
|
|
3292
3677
|
delegationPda: input.delegationPda,
|
|
3293
3678
|
delegatorAta: input.delegatorAta,
|
|
@@ -3326,6 +3711,7 @@ async function getTransferSubscriptionOverlayInstructionAsync(input) {
|
|
|
3326
3711
|
return withTrailing(
|
|
3327
3712
|
getTransferSubscriptionInstruction(
|
|
3328
3713
|
{
|
|
3714
|
+
...await eventAccounts(input.programAddress),
|
|
3329
3715
|
caller: input.caller,
|
|
3330
3716
|
delegatorAta,
|
|
3331
3717
|
planPda: input.planPda,
|
|
@@ -3379,11 +3765,12 @@ async function getCreatePlanOverlayInstructionAsync(input) {
|
|
|
3379
3765
|
pdaConfig(input.programAddress)
|
|
3380
3766
|
);
|
|
3381
3767
|
}
|
|
3382
|
-
function getUpdatePlanOverlayInstruction(input) {
|
|
3768
|
+
async function getUpdatePlanOverlayInstruction(input) {
|
|
3383
3769
|
assertMetadataUri(input.metadataUri);
|
|
3384
3770
|
const pullers = padPlanPullers(input.pullers);
|
|
3385
3771
|
return getUpdatePlanInstruction(
|
|
3386
3772
|
{
|
|
3773
|
+
...await eventAccounts(input.programAddress),
|
|
3387
3774
|
owner: input.owner,
|
|
3388
3775
|
planPda: input.planPda,
|
|
3389
3776
|
updatePlanData: {
|
|
@@ -3417,6 +3804,7 @@ async function getSubscribeOverlayInstructionAsync(input) {
|
|
|
3417
3804
|
return appendPayer(
|
|
3418
3805
|
await getSubscribeInstructionAsync(
|
|
3419
3806
|
{
|
|
3807
|
+
...await eventAccounts(input.programAddress),
|
|
3420
3808
|
merchant: input.merchant,
|
|
3421
3809
|
planPda,
|
|
3422
3810
|
subscribeData: {
|
|
@@ -3436,9 +3824,10 @@ async function getSubscribeOverlayInstructionAsync(input) {
|
|
|
3436
3824
|
input.payer
|
|
3437
3825
|
);
|
|
3438
3826
|
}
|
|
3439
|
-
function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
3440
|
-
return getCancelSubscriptionInstructionAsync(
|
|
3827
|
+
async function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
3828
|
+
return await getCancelSubscriptionInstructionAsync(
|
|
3441
3829
|
{
|
|
3830
|
+
...await eventAccounts(input.programAddress),
|
|
3442
3831
|
planPda: input.planPda,
|
|
3443
3832
|
subscriber: input.subscriber,
|
|
3444
3833
|
subscriptionPda: input.subscriptionPda
|
|
@@ -3446,11 +3835,17 @@ function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
|
3446
3835
|
pdaConfig(input.programAddress)
|
|
3447
3836
|
);
|
|
3448
3837
|
}
|
|
3449
|
-
function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
3450
|
-
|
|
3838
|
+
async function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
3839
|
+
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
3840
|
+
{ tokenMint: input.tokenMint, user: input.subscriber.address },
|
|
3841
|
+
pdaConfig(input.programAddress)
|
|
3842
|
+
);
|
|
3843
|
+
return await getResumeSubscriptionInstructionAsync(
|
|
3451
3844
|
{
|
|
3845
|
+
...await eventAccounts(input.programAddress),
|
|
3452
3846
|
planPda: input.planPda,
|
|
3453
3847
|
subscriber: input.subscriber,
|
|
3848
|
+
subscriptionAuthority,
|
|
3454
3849
|
subscriptionPda: input.subscriptionPda
|
|
3455
3850
|
},
|
|
3456
3851
|
pdaConfig(input.programAddress)
|
|
@@ -3458,7 +3853,7 @@ function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
|
3458
3853
|
}
|
|
3459
3854
|
function subscriptionsProgram2() {
|
|
3460
3855
|
return (client) => {
|
|
3461
|
-
return (0,
|
|
3856
|
+
return (0, import_kit44.pipe)(client, subscriptionsProgram(), (c) => {
|
|
3462
3857
|
const queries = {
|
|
3463
3858
|
activeDelegationSummary: async (wallet) => {
|
|
3464
3859
|
const delegations = await fetchDelegationsByDelegator(c.rpc, wallet);
|
|
@@ -3511,21 +3906,21 @@ function subscriptionsProgram2() {
|
|
|
3511
3906
|
});
|
|
3512
3907
|
};
|
|
3513
3908
|
const instructions = {
|
|
3514
|
-
cancelSubscription: (input) => (0,
|
|
3909
|
+
cancelSubscription: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3515
3910
|
client,
|
|
3516
3911
|
getCancelSubscriptionOverlayInstructionAsync({
|
|
3517
3912
|
...input,
|
|
3518
3913
|
subscriber: input.subscriber ?? client.identity
|
|
3519
3914
|
})
|
|
3520
3915
|
),
|
|
3521
|
-
closeSubscriptionAuthority: (input) => (0,
|
|
3916
|
+
closeSubscriptionAuthority: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3522
3917
|
client,
|
|
3523
3918
|
getCloseSubscriptionAuthorityOverlayInstructionAsync({
|
|
3524
3919
|
...input,
|
|
3525
3920
|
user: input.user ?? client.identity
|
|
3526
3921
|
})
|
|
3527
3922
|
),
|
|
3528
|
-
createFixedDelegation: (input) => (0,
|
|
3923
|
+
createFixedDelegation: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3529
3924
|
client,
|
|
3530
3925
|
(async () => {
|
|
3531
3926
|
const delegator = input.delegator ?? client.identity;
|
|
@@ -3543,14 +3938,14 @@ function subscriptionsProgram2() {
|
|
|
3543
3938
|
});
|
|
3544
3939
|
})()
|
|
3545
3940
|
),
|
|
3546
|
-
createPlan: (input) => (0,
|
|
3941
|
+
createPlan: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3547
3942
|
client,
|
|
3548
3943
|
getCreatePlanOverlayInstructionAsync({
|
|
3549
3944
|
...input,
|
|
3550
3945
|
owner: input.owner ?? client.identity
|
|
3551
3946
|
})
|
|
3552
3947
|
),
|
|
3553
|
-
createRecurringDelegation: (input) => (0,
|
|
3948
|
+
createRecurringDelegation: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3554
3949
|
client,
|
|
3555
3950
|
(async () => {
|
|
3556
3951
|
const delegator = input.delegator ?? client.identity;
|
|
@@ -3568,14 +3963,14 @@ function subscriptionsProgram2() {
|
|
|
3568
3963
|
});
|
|
3569
3964
|
})()
|
|
3570
3965
|
),
|
|
3571
|
-
deletePlan: (input) => (0,
|
|
3966
|
+
deletePlan: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3572
3967
|
client,
|
|
3573
3968
|
getDeletePlanOverlayInstruction({
|
|
3574
3969
|
...input,
|
|
3575
3970
|
owner: input.owner ?? client.identity
|
|
3576
3971
|
})
|
|
3577
3972
|
),
|
|
3578
|
-
initSubscriptionAuthority: (input) => (0,
|
|
3973
|
+
initSubscriptionAuthority: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3579
3974
|
client,
|
|
3580
3975
|
getInitSubscriptionAuthorityOverlayInstructionAsync({
|
|
3581
3976
|
...input,
|
|
@@ -3583,35 +3978,35 @@ function subscriptionsProgram2() {
|
|
|
3583
3978
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3584
3979
|
})
|
|
3585
3980
|
),
|
|
3586
|
-
resumeSubscription: (input) => (0,
|
|
3981
|
+
resumeSubscription: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3587
3982
|
client,
|
|
3588
3983
|
getResumeSubscriptionOverlayInstructionAsync({
|
|
3589
3984
|
...input,
|
|
3590
3985
|
subscriber: input.subscriber ?? client.identity
|
|
3591
3986
|
})
|
|
3592
3987
|
),
|
|
3593
|
-
revokeDelegation: (input) => (0,
|
|
3988
|
+
revokeDelegation: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3594
3989
|
client,
|
|
3595
3990
|
getRevokeDelegationOverlayInstruction({
|
|
3596
3991
|
...input,
|
|
3597
3992
|
authority: input.authority ?? client.identity
|
|
3598
3993
|
})
|
|
3599
3994
|
),
|
|
3600
|
-
revokeSubscription: (input) => (0,
|
|
3995
|
+
revokeSubscription: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3601
3996
|
client,
|
|
3602
3997
|
getRevokeSubscriptionOverlayInstruction({
|
|
3603
3998
|
...input,
|
|
3604
3999
|
authority: input.authority ?? client.identity
|
|
3605
4000
|
})
|
|
3606
4001
|
),
|
|
3607
|
-
revokeSubscriptionAuthority: (input) => (0,
|
|
4002
|
+
revokeSubscriptionAuthority: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3608
4003
|
client,
|
|
3609
4004
|
getRevokeSubscriptionAuthorityOverlayInstructionAsync({
|
|
3610
4005
|
...input,
|
|
3611
4006
|
user: input.user ?? client.identity
|
|
3612
4007
|
})
|
|
3613
4008
|
),
|
|
3614
|
-
subscribe: (input) => (0,
|
|
4009
|
+
subscribe: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3615
4010
|
client,
|
|
3616
4011
|
(async () => {
|
|
3617
4012
|
const subscriber = input.subscriber ?? client.identity;
|
|
@@ -3659,7 +4054,7 @@ function subscriptionsProgram2() {
|
|
|
3659
4054
|
});
|
|
3660
4055
|
})()
|
|
3661
4056
|
),
|
|
3662
|
-
transferFixed: (input) => (0,
|
|
4057
|
+
transferFixed: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3663
4058
|
client,
|
|
3664
4059
|
(async () => await getTransferFixedOverlayInstructionAsync({
|
|
3665
4060
|
...input,
|
|
@@ -3667,7 +4062,7 @@ function subscriptionsProgram2() {
|
|
|
3667
4062
|
transferHookAccounts: await resolveDelegationHookAccounts(input)
|
|
3668
4063
|
}))()
|
|
3669
4064
|
),
|
|
3670
|
-
transferRecurring: (input) => (0,
|
|
4065
|
+
transferRecurring: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3671
4066
|
client,
|
|
3672
4067
|
(async () => await getTransferRecurringOverlayInstructionAsync({
|
|
3673
4068
|
...input,
|
|
@@ -3675,7 +4070,7 @@ function subscriptionsProgram2() {
|
|
|
3675
4070
|
transferHookAccounts: await resolveDelegationHookAccounts(input)
|
|
3676
4071
|
}))()
|
|
3677
4072
|
),
|
|
3678
|
-
transferSubscription: (input) => (0,
|
|
4073
|
+
transferSubscription: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3679
4074
|
client,
|
|
3680
4075
|
(async () => {
|
|
3681
4076
|
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
@@ -3703,7 +4098,7 @@ function subscriptionsProgram2() {
|
|
|
3703
4098
|
});
|
|
3704
4099
|
})()
|
|
3705
4100
|
),
|
|
3706
|
-
updatePlan: (input) => (0,
|
|
4101
|
+
updatePlan: (input) => (0, import_program_client_core19.addSelfPlanAndSendFunctions)(
|
|
3707
4102
|
client,
|
|
3708
4103
|
getUpdatePlanOverlayInstruction({
|
|
3709
4104
|
...input,
|
|
@@ -3748,6 +4143,7 @@ function subscriptionsProgram2() {
|
|
|
3748
4143
|
PlanStatus,
|
|
3749
4144
|
RESUME_SUBSCRIPTION_DISCRIMINATOR,
|
|
3750
4145
|
REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR,
|
|
4146
|
+
REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR,
|
|
3751
4147
|
REVOKE_DELEGATION_DISCRIMINATOR,
|
|
3752
4148
|
REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
|
|
3753
4149
|
SUBSCRIBE_DISCRIMINATOR,
|
|
@@ -3784,6 +4180,7 @@ function subscriptionsProgram2() {
|
|
|
3784
4180
|
SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH,
|
|
3785
4181
|
SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA,
|
|
3786
4182
|
SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS,
|
|
4183
|
+
SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM,
|
|
3787
4184
|
SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA,
|
|
3788
4185
|
SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA,
|
|
3789
4186
|
SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA,
|
|
@@ -3807,6 +4204,7 @@ function subscriptionsProgram2() {
|
|
|
3807
4204
|
SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED,
|
|
3808
4205
|
SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS,
|
|
3809
4206
|
SUBSCRIPTIONS_ERROR__PLAN_CLOSED,
|
|
4207
|
+
SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND,
|
|
3810
4208
|
SUBSCRIPTIONS_ERROR__PLAN_EXPIRED,
|
|
3811
4209
|
SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET,
|
|
3812
4210
|
SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED,
|
|
@@ -3823,7 +4221,6 @@ function subscriptionsProgram2() {
|
|
|
3823
4221
|
SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH,
|
|
3824
4222
|
SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS,
|
|
3825
4223
|
SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS,
|
|
3826
|
-
SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING,
|
|
3827
4224
|
SUBSCRIPTIONS_ERROR__UNAUTHORIZED,
|
|
3828
4225
|
SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION,
|
|
3829
4226
|
SUBSCRIPTIONS_PROGRAM_ADDRESS,
|
|
@@ -3981,6 +4378,11 @@ function subscriptionsProgram2() {
|
|
|
3981
4378
|
getRevokeAbandonedDelegationInstructionDataCodec,
|
|
3982
4379
|
getRevokeAbandonedDelegationInstructionDataDecoder,
|
|
3983
4380
|
getRevokeAbandonedDelegationInstructionDataEncoder,
|
|
4381
|
+
getRevokeAbandonedSubscriptionDiscriminatorBytes,
|
|
4382
|
+
getRevokeAbandonedSubscriptionInstruction,
|
|
4383
|
+
getRevokeAbandonedSubscriptionInstructionDataCodec,
|
|
4384
|
+
getRevokeAbandonedSubscriptionInstructionDataDecoder,
|
|
4385
|
+
getRevokeAbandonedSubscriptionInstructionDataEncoder,
|
|
3984
4386
|
getRevokeDelegationDiscriminatorBytes,
|
|
3985
4387
|
getRevokeDelegationInstruction,
|
|
3986
4388
|
getRevokeDelegationInstructionDataCodec,
|
|
@@ -3989,6 +4391,7 @@ function subscriptionsProgram2() {
|
|
|
3989
4391
|
getRevokeDelegationOverlayInstruction,
|
|
3990
4392
|
getRevokeSubscriptionAuthorityDiscriminatorBytes,
|
|
3991
4393
|
getRevokeSubscriptionAuthorityInstruction,
|
|
4394
|
+
getRevokeSubscriptionAuthorityInstructionAsync,
|
|
3992
4395
|
getRevokeSubscriptionAuthorityInstructionDataCodec,
|
|
3993
4396
|
getRevokeSubscriptionAuthorityInstructionDataDecoder,
|
|
3994
4397
|
getRevokeSubscriptionAuthorityInstructionDataEncoder,
|
|
@@ -4016,18 +4419,21 @@ function subscriptionsProgram2() {
|
|
|
4016
4419
|
getTransferDataEncoder,
|
|
4017
4420
|
getTransferFixedDiscriminatorBytes,
|
|
4018
4421
|
getTransferFixedInstruction,
|
|
4422
|
+
getTransferFixedInstructionAsync,
|
|
4019
4423
|
getTransferFixedInstructionDataCodec,
|
|
4020
4424
|
getTransferFixedInstructionDataDecoder,
|
|
4021
4425
|
getTransferFixedInstructionDataEncoder,
|
|
4022
4426
|
getTransferFixedOverlayInstructionAsync,
|
|
4023
4427
|
getTransferRecurringDiscriminatorBytes,
|
|
4024
4428
|
getTransferRecurringInstruction,
|
|
4429
|
+
getTransferRecurringInstructionAsync,
|
|
4025
4430
|
getTransferRecurringInstructionDataCodec,
|
|
4026
4431
|
getTransferRecurringInstructionDataDecoder,
|
|
4027
4432
|
getTransferRecurringInstructionDataEncoder,
|
|
4028
4433
|
getTransferRecurringOverlayInstructionAsync,
|
|
4029
4434
|
getTransferSubscriptionDiscriminatorBytes,
|
|
4030
4435
|
getTransferSubscriptionInstruction,
|
|
4436
|
+
getTransferSubscriptionInstructionAsync,
|
|
4031
4437
|
getTransferSubscriptionInstructionDataCodec,
|
|
4032
4438
|
getTransferSubscriptionInstructionDataDecoder,
|
|
4033
4439
|
getTransferSubscriptionInstructionDataEncoder,
|
|
@@ -4037,6 +4443,7 @@ function subscriptionsProgram2() {
|
|
|
4037
4443
|
getUpdatePlanDataEncoder,
|
|
4038
4444
|
getUpdatePlanDiscriminatorBytes,
|
|
4039
4445
|
getUpdatePlanInstruction,
|
|
4446
|
+
getUpdatePlanInstructionAsync,
|
|
4040
4447
|
getUpdatePlanInstructionDataCodec,
|
|
4041
4448
|
getUpdatePlanInstructionDataDecoder,
|
|
4042
4449
|
getUpdatePlanInstructionDataEncoder,
|
|
@@ -4052,6 +4459,7 @@ function subscriptionsProgram2() {
|
|
|
4052
4459
|
parseInitSubscriptionAuthorityInstruction,
|
|
4053
4460
|
parseResumeSubscriptionInstruction,
|
|
4054
4461
|
parseRevokeAbandonedDelegationInstruction,
|
|
4462
|
+
parseRevokeAbandonedSubscriptionInstruction,
|
|
4055
4463
|
parseRevokeDelegationInstruction,
|
|
4056
4464
|
parseRevokeSubscriptionAuthorityInstruction,
|
|
4057
4465
|
parseSubscribeInstruction,
|