@solana/subscriptions 0.0.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,3581 @@
1
+ // src/accounts/decode.ts
2
+ import { getBase64Encoder } from "@solana/kit";
3
+
4
+ // src/generated/accounts/eventAuthority.ts
5
+ import {
6
+ assertAccountExists,
7
+ assertAccountsExist,
8
+ combineCodec,
9
+ decodeAccount,
10
+ fetchEncodedAccount,
11
+ fetchEncodedAccounts,
12
+ getStructDecoder,
13
+ getStructEncoder
14
+ } from "@solana/kit";
15
+
16
+ // src/generated/pdas/eventAuthority.ts
17
+ import { getProgramDerivedAddress, getUtf8Encoder } from "@solana/kit";
18
+ async function findEventAuthorityPda(config = {}) {
19
+ const {
20
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
21
+ } = config;
22
+ return await getProgramDerivedAddress({ programAddress, seeds: [getUtf8Encoder().encode("event_authority")] });
23
+ }
24
+
25
+ // src/generated/pdas/fixedDelegation.ts
26
+ import {
27
+ getAddressEncoder,
28
+ getProgramDerivedAddress as getProgramDerivedAddress2,
29
+ getU64Encoder,
30
+ getUtf8Encoder as getUtf8Encoder2
31
+ } from "@solana/kit";
32
+ async function findFixedDelegationPda(seeds, config = {}) {
33
+ const {
34
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
35
+ } = config;
36
+ return await getProgramDerivedAddress2({
37
+ programAddress,
38
+ seeds: [
39
+ getUtf8Encoder2().encode("delegation"),
40
+ getAddressEncoder().encode(seeds.subscriptionAuthority),
41
+ getAddressEncoder().encode(seeds.delegator),
42
+ getAddressEncoder().encode(seeds.delegatee),
43
+ getU64Encoder().encode(seeds.nonce)
44
+ ]
45
+ });
46
+ }
47
+
48
+ // src/generated/pdas/plan.ts
49
+ import {
50
+ getAddressEncoder as getAddressEncoder2,
51
+ getProgramDerivedAddress as getProgramDerivedAddress3,
52
+ getU64Encoder as getU64Encoder2,
53
+ getUtf8Encoder as getUtf8Encoder3
54
+ } from "@solana/kit";
55
+ async function findPlanPda(seeds, config = {}) {
56
+ const {
57
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
58
+ } = config;
59
+ return await getProgramDerivedAddress3({
60
+ programAddress,
61
+ seeds: [
62
+ getUtf8Encoder3().encode("plan"),
63
+ getAddressEncoder2().encode(seeds.owner),
64
+ getU64Encoder2().encode(seeds.planId)
65
+ ]
66
+ });
67
+ }
68
+
69
+ // src/generated/pdas/recurringDelegation.ts
70
+ import {
71
+ getAddressEncoder as getAddressEncoder3,
72
+ getProgramDerivedAddress as getProgramDerivedAddress4,
73
+ getU64Encoder as getU64Encoder3,
74
+ getUtf8Encoder as getUtf8Encoder4
75
+ } from "@solana/kit";
76
+ async function findRecurringDelegationPda(seeds, config = {}) {
77
+ const {
78
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
79
+ } = config;
80
+ return await getProgramDerivedAddress4({
81
+ programAddress,
82
+ seeds: [
83
+ getUtf8Encoder4().encode("delegation"),
84
+ getAddressEncoder3().encode(seeds.subscriptionAuthority),
85
+ getAddressEncoder3().encode(seeds.delegator),
86
+ getAddressEncoder3().encode(seeds.delegatee),
87
+ getU64Encoder3().encode(seeds.nonce)
88
+ ]
89
+ });
90
+ }
91
+
92
+ // src/generated/pdas/subscriptionAuthority.ts
93
+ import {
94
+ getAddressEncoder as getAddressEncoder4,
95
+ getProgramDerivedAddress as getProgramDerivedAddress5,
96
+ getUtf8Encoder as getUtf8Encoder5
97
+ } from "@solana/kit";
98
+ async function findSubscriptionAuthorityPda(seeds, config = {}) {
99
+ const {
100
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
101
+ } = config;
102
+ return await getProgramDerivedAddress5({
103
+ programAddress,
104
+ seeds: [
105
+ getUtf8Encoder5().encode("SubscriptionAuthority"),
106
+ getAddressEncoder4().encode(seeds.user),
107
+ getAddressEncoder4().encode(seeds.tokenMint)
108
+ ]
109
+ });
110
+ }
111
+
112
+ // src/generated/pdas/subscriptionDelegation.ts
113
+ import {
114
+ getAddressEncoder as getAddressEncoder5,
115
+ getProgramDerivedAddress as getProgramDerivedAddress6,
116
+ getUtf8Encoder as getUtf8Encoder6
117
+ } from "@solana/kit";
118
+ async function findSubscriptionDelegationPda(seeds, config = {}) {
119
+ const {
120
+ programAddress = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44"
121
+ } = config;
122
+ return await getProgramDerivedAddress6({
123
+ programAddress,
124
+ seeds: [
125
+ getUtf8Encoder6().encode("subscription"),
126
+ getAddressEncoder5().encode(seeds.planPda),
127
+ getAddressEncoder5().encode(seeds.subscriber)
128
+ ]
129
+ });
130
+ }
131
+
132
+ // src/generated/accounts/eventAuthority.ts
133
+ function getEventAuthorityEncoder() {
134
+ return getStructEncoder([]);
135
+ }
136
+ function getEventAuthorityDecoder() {
137
+ return getStructDecoder([]);
138
+ }
139
+ function getEventAuthorityCodec() {
140
+ return combineCodec(getEventAuthorityEncoder(), getEventAuthorityDecoder());
141
+ }
142
+ function decodeEventAuthority(encodedAccount) {
143
+ return decodeAccount(encodedAccount, getEventAuthorityDecoder());
144
+ }
145
+ async function fetchEventAuthority(rpc, address, config) {
146
+ const maybeAccount = await fetchMaybeEventAuthority(rpc, address, config);
147
+ assertAccountExists(maybeAccount);
148
+ return maybeAccount;
149
+ }
150
+ async function fetchMaybeEventAuthority(rpc, address, config) {
151
+ const maybeAccount = await fetchEncodedAccount(rpc, address, config);
152
+ return decodeEventAuthority(maybeAccount);
153
+ }
154
+ async function fetchAllEventAuthority(rpc, addresses, config) {
155
+ const maybeAccounts = await fetchAllMaybeEventAuthority(rpc, addresses, config);
156
+ assertAccountsExist(maybeAccounts);
157
+ return maybeAccounts;
158
+ }
159
+ async function fetchAllMaybeEventAuthority(rpc, addresses, config) {
160
+ const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
161
+ return maybeAccounts.map((maybeAccount) => decodeEventAuthority(maybeAccount));
162
+ }
163
+ async function fetchEventAuthorityFromSeeds(rpc, config = {}) {
164
+ const maybeAccount = await fetchMaybeEventAuthorityFromSeeds(rpc, config);
165
+ assertAccountExists(maybeAccount);
166
+ return maybeAccount;
167
+ }
168
+ async function fetchMaybeEventAuthorityFromSeeds(rpc, config = {}) {
169
+ const { programAddress, ...fetchConfig } = config;
170
+ const [address] = await findEventAuthorityPda({ programAddress });
171
+ return await fetchMaybeEventAuthority(rpc, address, fetchConfig);
172
+ }
173
+
174
+ // src/generated/accounts/fixedDelegation.ts
175
+ import {
176
+ assertAccountExists as assertAccountExists2,
177
+ assertAccountsExist as assertAccountsExist2,
178
+ combineCodec as combineCodec12,
179
+ decodeAccount as decodeAccount2,
180
+ fetchEncodedAccount as fetchEncodedAccount2,
181
+ fetchEncodedAccounts as fetchEncodedAccounts2,
182
+ getAddressDecoder as getAddressDecoder6,
183
+ getAddressEncoder as getAddressEncoder11,
184
+ getI64Decoder as getI64Decoder8,
185
+ getI64Encoder as getI64Encoder8,
186
+ getStructDecoder as getStructDecoder10,
187
+ getStructEncoder as getStructEncoder10,
188
+ getU64Decoder as getU64Decoder7,
189
+ getU64Encoder as getU64Encoder10
190
+ } from "@solana/kit";
191
+
192
+ // src/generated/types/accountDiscriminator.ts
193
+ import {
194
+ combineCodec as combineCodec2,
195
+ getEnumDecoder,
196
+ getEnumEncoder
197
+ } from "@solana/kit";
198
+ var AccountDiscriminator = /* @__PURE__ */ ((AccountDiscriminator2) => {
199
+ AccountDiscriminator2[AccountDiscriminator2["SubscriptionAuthority"] = 0] = "SubscriptionAuthority";
200
+ AccountDiscriminator2[AccountDiscriminator2["Plan"] = 1] = "Plan";
201
+ AccountDiscriminator2[AccountDiscriminator2["FixedDelegation"] = 2] = "FixedDelegation";
202
+ AccountDiscriminator2[AccountDiscriminator2["RecurringDelegation"] = 3] = "RecurringDelegation";
203
+ AccountDiscriminator2[AccountDiscriminator2["SubscriptionDelegation"] = 4] = "SubscriptionDelegation";
204
+ return AccountDiscriminator2;
205
+ })(AccountDiscriminator || {});
206
+ function getAccountDiscriminatorEncoder() {
207
+ return getEnumEncoder(AccountDiscriminator);
208
+ }
209
+ function getAccountDiscriminatorDecoder() {
210
+ return getEnumDecoder(AccountDiscriminator);
211
+ }
212
+ function getAccountDiscriminatorCodec() {
213
+ return combineCodec2(getAccountDiscriminatorEncoder(), getAccountDiscriminatorDecoder());
214
+ }
215
+
216
+ // src/generated/types/createFixedDelegationData.ts
217
+ import {
218
+ combineCodec as combineCodec3,
219
+ getI64Decoder,
220
+ getI64Encoder,
221
+ getStructDecoder as getStructDecoder2,
222
+ getStructEncoder as getStructEncoder2,
223
+ getU64Decoder,
224
+ getU64Encoder as getU64Encoder4
225
+ } from "@solana/kit";
226
+ function getCreateFixedDelegationDataEncoder() {
227
+ return getStructEncoder2([
228
+ ["nonce", getU64Encoder4()],
229
+ ["amount", getU64Encoder4()],
230
+ ["expiryTs", getI64Encoder()]
231
+ ]);
232
+ }
233
+ function getCreateFixedDelegationDataDecoder() {
234
+ return getStructDecoder2([
235
+ ["nonce", getU64Decoder()],
236
+ ["amount", getU64Decoder()],
237
+ ["expiryTs", getI64Decoder()]
238
+ ]);
239
+ }
240
+ function getCreateFixedDelegationDataCodec() {
241
+ return combineCodec3(getCreateFixedDelegationDataEncoder(), getCreateFixedDelegationDataDecoder());
242
+ }
243
+
244
+ // src/generated/types/createRecurringDelegationData.ts
245
+ import {
246
+ combineCodec as combineCodec4,
247
+ getI64Decoder as getI64Decoder2,
248
+ getI64Encoder as getI64Encoder2,
249
+ getStructDecoder as getStructDecoder3,
250
+ getStructEncoder as getStructEncoder3,
251
+ getU64Decoder as getU64Decoder2,
252
+ getU64Encoder as getU64Encoder5
253
+ } from "@solana/kit";
254
+ function getCreateRecurringDelegationDataEncoder() {
255
+ return getStructEncoder3([
256
+ ["nonce", getU64Encoder5()],
257
+ ["amountPerPeriod", getU64Encoder5()],
258
+ ["periodLengthS", getU64Encoder5()],
259
+ ["startTs", getI64Encoder2()],
260
+ ["expiryTs", getI64Encoder2()]
261
+ ]);
262
+ }
263
+ function getCreateRecurringDelegationDataDecoder() {
264
+ return getStructDecoder3([
265
+ ["nonce", getU64Decoder2()],
266
+ ["amountPerPeriod", getU64Decoder2()],
267
+ ["periodLengthS", getU64Decoder2()],
268
+ ["startTs", getI64Decoder2()],
269
+ ["expiryTs", getI64Decoder2()]
270
+ ]);
271
+ }
272
+ function getCreateRecurringDelegationDataCodec() {
273
+ return combineCodec4(getCreateRecurringDelegationDataEncoder(), getCreateRecurringDelegationDataDecoder());
274
+ }
275
+
276
+ // src/generated/types/header.ts
277
+ import {
278
+ combineCodec as combineCodec5,
279
+ getAddressDecoder,
280
+ getAddressEncoder as getAddressEncoder6,
281
+ getI64Decoder as getI64Decoder3,
282
+ getI64Encoder as getI64Encoder3,
283
+ getStructDecoder as getStructDecoder4,
284
+ getStructEncoder as getStructEncoder4,
285
+ getU8Decoder,
286
+ getU8Encoder
287
+ } from "@solana/kit";
288
+ function getHeaderEncoder() {
289
+ return getStructEncoder4([
290
+ ["discriminator", getU8Encoder()],
291
+ ["version", getU8Encoder()],
292
+ ["bump", getU8Encoder()],
293
+ ["delegator", getAddressEncoder6()],
294
+ ["delegatee", getAddressEncoder6()],
295
+ ["payer", getAddressEncoder6()],
296
+ ["initId", getI64Encoder3()]
297
+ ]);
298
+ }
299
+ function getHeaderDecoder() {
300
+ return getStructDecoder4([
301
+ ["discriminator", getU8Decoder()],
302
+ ["version", getU8Decoder()],
303
+ ["bump", getU8Decoder()],
304
+ ["delegator", getAddressDecoder()],
305
+ ["delegatee", getAddressDecoder()],
306
+ ["payer", getAddressDecoder()],
307
+ ["initId", getI64Decoder3()]
308
+ ]);
309
+ }
310
+ function getHeaderCodec() {
311
+ return combineCodec5(getHeaderEncoder(), getHeaderDecoder());
312
+ }
313
+
314
+ // src/generated/types/planData.ts
315
+ import {
316
+ combineCodec as combineCodec6,
317
+ fixDecoderSize,
318
+ fixEncoderSize,
319
+ getAddressDecoder as getAddressDecoder2,
320
+ getAddressEncoder as getAddressEncoder7,
321
+ getArrayDecoder,
322
+ getArrayEncoder,
323
+ getI64Decoder as getI64Decoder4,
324
+ getI64Encoder as getI64Encoder4,
325
+ getStructDecoder as getStructDecoder5,
326
+ getStructEncoder as getStructEncoder5,
327
+ getU64Decoder as getU64Decoder3,
328
+ getU64Encoder as getU64Encoder6,
329
+ getUtf8Decoder,
330
+ getUtf8Encoder as getUtf8Encoder7
331
+ } from "@solana/kit";
332
+ function getPlanDataEncoder() {
333
+ return getStructEncoder5([
334
+ ["planId", getU64Encoder6()],
335
+ ["mint", getAddressEncoder7()],
336
+ ["terms", getPlanTermsEncoder()],
337
+ ["endTs", getI64Encoder4()],
338
+ ["destinations", getArrayEncoder(getAddressEncoder7(), { size: 4 })],
339
+ ["pullers", getArrayEncoder(getAddressEncoder7(), { size: 4 })],
340
+ ["metadataUri", fixEncoderSize(getUtf8Encoder7(), 128)]
341
+ ]);
342
+ }
343
+ function getPlanDataDecoder() {
344
+ return getStructDecoder5([
345
+ ["planId", getU64Decoder3()],
346
+ ["mint", getAddressDecoder2()],
347
+ ["terms", getPlanTermsDecoder()],
348
+ ["endTs", getI64Decoder4()],
349
+ ["destinations", getArrayDecoder(getAddressDecoder2(), { size: 4 })],
350
+ ["pullers", getArrayDecoder(getAddressDecoder2(), { size: 4 })],
351
+ ["metadataUri", fixDecoderSize(getUtf8Decoder(), 128)]
352
+ ]);
353
+ }
354
+ function getPlanDataCodec() {
355
+ return combineCodec6(getPlanDataEncoder(), getPlanDataDecoder());
356
+ }
357
+
358
+ // src/generated/types/planStatus.ts
359
+ import {
360
+ combineCodec as combineCodec7,
361
+ getEnumDecoder as getEnumDecoder2,
362
+ getEnumEncoder as getEnumEncoder2
363
+ } from "@solana/kit";
364
+ var PlanStatus = /* @__PURE__ */ ((PlanStatus2) => {
365
+ PlanStatus2[PlanStatus2["Sunset"] = 0] = "Sunset";
366
+ PlanStatus2[PlanStatus2["Active"] = 1] = "Active";
367
+ return PlanStatus2;
368
+ })(PlanStatus || {});
369
+ function getPlanStatusEncoder() {
370
+ return getEnumEncoder2(PlanStatus);
371
+ }
372
+ function getPlanStatusDecoder() {
373
+ return getEnumDecoder2(PlanStatus);
374
+ }
375
+ function getPlanStatusCodec() {
376
+ return combineCodec7(getPlanStatusEncoder(), getPlanStatusDecoder());
377
+ }
378
+
379
+ // src/generated/types/planTerms.ts
380
+ import {
381
+ combineCodec as combineCodec8,
382
+ getI64Decoder as getI64Decoder5,
383
+ getI64Encoder as getI64Encoder5,
384
+ getStructDecoder as getStructDecoder6,
385
+ getStructEncoder as getStructEncoder6,
386
+ getU64Decoder as getU64Decoder4,
387
+ getU64Encoder as getU64Encoder7
388
+ } from "@solana/kit";
389
+ function getPlanTermsEncoder() {
390
+ return getStructEncoder6([
391
+ ["amount", getU64Encoder7()],
392
+ ["periodHours", getU64Encoder7()],
393
+ ["createdAt", getI64Encoder5()]
394
+ ]);
395
+ }
396
+ function getPlanTermsDecoder() {
397
+ return getStructDecoder6([
398
+ ["amount", getU64Decoder4()],
399
+ ["periodHours", getU64Decoder4()],
400
+ ["createdAt", getI64Decoder5()]
401
+ ]);
402
+ }
403
+ function getPlanTermsCodec() {
404
+ return combineCodec8(getPlanTermsEncoder(), getPlanTermsDecoder());
405
+ }
406
+
407
+ // src/generated/types/subscribeData.ts
408
+ import {
409
+ combineCodec as combineCodec9,
410
+ getAddressDecoder as getAddressDecoder3,
411
+ getAddressEncoder as getAddressEncoder8,
412
+ getI64Decoder as getI64Decoder6,
413
+ getI64Encoder as getI64Encoder6,
414
+ getStructDecoder as getStructDecoder7,
415
+ getStructEncoder as getStructEncoder7,
416
+ getU64Decoder as getU64Decoder5,
417
+ getU64Encoder as getU64Encoder8,
418
+ getU8Decoder as getU8Decoder2,
419
+ getU8Encoder as getU8Encoder2
420
+ } from "@solana/kit";
421
+ function getSubscribeDataEncoder() {
422
+ return getStructEncoder7([
423
+ ["planId", getU64Encoder8()],
424
+ ["planBump", getU8Encoder2()],
425
+ ["expectedMint", getAddressEncoder8()],
426
+ ["expectedAmount", getU64Encoder8()],
427
+ ["expectedPeriodHours", getU64Encoder8()],
428
+ ["expectedCreatedAt", getI64Encoder6()]
429
+ ]);
430
+ }
431
+ function getSubscribeDataDecoder() {
432
+ return getStructDecoder7([
433
+ ["planId", getU64Decoder5()],
434
+ ["planBump", getU8Decoder2()],
435
+ ["expectedMint", getAddressDecoder3()],
436
+ ["expectedAmount", getU64Decoder5()],
437
+ ["expectedPeriodHours", getU64Decoder5()],
438
+ ["expectedCreatedAt", getI64Decoder6()]
439
+ ]);
440
+ }
441
+ function getSubscribeDataCodec() {
442
+ return combineCodec9(getSubscribeDataEncoder(), getSubscribeDataDecoder());
443
+ }
444
+
445
+ // src/generated/types/transferData.ts
446
+ import {
447
+ combineCodec as combineCodec10,
448
+ getAddressDecoder as getAddressDecoder4,
449
+ getAddressEncoder as getAddressEncoder9,
450
+ getStructDecoder as getStructDecoder8,
451
+ getStructEncoder as getStructEncoder8,
452
+ getU64Decoder as getU64Decoder6,
453
+ getU64Encoder as getU64Encoder9
454
+ } from "@solana/kit";
455
+ function getTransferDataEncoder() {
456
+ return getStructEncoder8([
457
+ ["amount", getU64Encoder9()],
458
+ ["delegator", getAddressEncoder9()],
459
+ ["mint", getAddressEncoder9()]
460
+ ]);
461
+ }
462
+ function getTransferDataDecoder() {
463
+ return getStructDecoder8([
464
+ ["amount", getU64Decoder6()],
465
+ ["delegator", getAddressDecoder4()],
466
+ ["mint", getAddressDecoder4()]
467
+ ]);
468
+ }
469
+ function getTransferDataCodec() {
470
+ return combineCodec10(getTransferDataEncoder(), getTransferDataDecoder());
471
+ }
472
+
473
+ // src/generated/types/updatePlanData.ts
474
+ import {
475
+ combineCodec as combineCodec11,
476
+ fixDecoderSize as fixDecoderSize2,
477
+ fixEncoderSize as fixEncoderSize2,
478
+ getAddressDecoder as getAddressDecoder5,
479
+ getAddressEncoder as getAddressEncoder10,
480
+ getArrayDecoder as getArrayDecoder2,
481
+ getArrayEncoder as getArrayEncoder2,
482
+ getI64Decoder as getI64Decoder7,
483
+ getI64Encoder as getI64Encoder7,
484
+ getStructDecoder as getStructDecoder9,
485
+ getStructEncoder as getStructEncoder9,
486
+ getU8Decoder as getU8Decoder3,
487
+ getU8Encoder as getU8Encoder3,
488
+ getUtf8Decoder as getUtf8Decoder2,
489
+ getUtf8Encoder as getUtf8Encoder8
490
+ } from "@solana/kit";
491
+ function getUpdatePlanDataEncoder() {
492
+ return getStructEncoder9([
493
+ ["status", getU8Encoder3()],
494
+ ["endTs", getI64Encoder7()],
495
+ ["pullers", getArrayEncoder2(getAddressEncoder10(), { size: 4 })],
496
+ ["metadataUri", fixEncoderSize2(getUtf8Encoder8(), 128)]
497
+ ]);
498
+ }
499
+ function getUpdatePlanDataDecoder() {
500
+ return getStructDecoder9([
501
+ ["status", getU8Decoder3()],
502
+ ["endTs", getI64Decoder7()],
503
+ ["pullers", getArrayDecoder2(getAddressDecoder5(), { size: 4 })],
504
+ ["metadataUri", fixDecoderSize2(getUtf8Decoder2(), 128)]
505
+ ]);
506
+ }
507
+ function getUpdatePlanDataCodec() {
508
+ return combineCodec11(getUpdatePlanDataEncoder(), getUpdatePlanDataDecoder());
509
+ }
510
+
511
+ // src/generated/accounts/fixedDelegation.ts
512
+ function getFixedDelegationEncoder() {
513
+ return getStructEncoder10([
514
+ ["header", getHeaderEncoder()],
515
+ ["subscriptionAuthority", getAddressEncoder11()],
516
+ ["mint", getAddressEncoder11()],
517
+ ["amount", getU64Encoder10()],
518
+ ["expiryTs", getI64Encoder8()]
519
+ ]);
520
+ }
521
+ function getFixedDelegationDecoder() {
522
+ return getStructDecoder10([
523
+ ["header", getHeaderDecoder()],
524
+ ["subscriptionAuthority", getAddressDecoder6()],
525
+ ["mint", getAddressDecoder6()],
526
+ ["amount", getU64Decoder7()],
527
+ ["expiryTs", getI64Decoder8()]
528
+ ]);
529
+ }
530
+ function getFixedDelegationCodec() {
531
+ return combineCodec12(getFixedDelegationEncoder(), getFixedDelegationDecoder());
532
+ }
533
+ function decodeFixedDelegation(encodedAccount) {
534
+ return decodeAccount2(encodedAccount, getFixedDelegationDecoder());
535
+ }
536
+ async function fetchFixedDelegation(rpc, address, config) {
537
+ const maybeAccount = await fetchMaybeFixedDelegation(rpc, address, config);
538
+ assertAccountExists2(maybeAccount);
539
+ return maybeAccount;
540
+ }
541
+ async function fetchMaybeFixedDelegation(rpc, address, config) {
542
+ const maybeAccount = await fetchEncodedAccount2(rpc, address, config);
543
+ return decodeFixedDelegation(maybeAccount);
544
+ }
545
+ async function fetchAllFixedDelegation(rpc, addresses, config) {
546
+ const maybeAccounts = await fetchAllMaybeFixedDelegation(rpc, addresses, config);
547
+ assertAccountsExist2(maybeAccounts);
548
+ return maybeAccounts;
549
+ }
550
+ async function fetchAllMaybeFixedDelegation(rpc, addresses, config) {
551
+ const maybeAccounts = await fetchEncodedAccounts2(rpc, addresses, config);
552
+ return maybeAccounts.map((maybeAccount) => decodeFixedDelegation(maybeAccount));
553
+ }
554
+ async function fetchFixedDelegationFromSeeds(rpc, seeds, config = {}) {
555
+ const maybeAccount = await fetchMaybeFixedDelegationFromSeeds(rpc, seeds, config);
556
+ assertAccountExists2(maybeAccount);
557
+ return maybeAccount;
558
+ }
559
+ async function fetchMaybeFixedDelegationFromSeeds(rpc, seeds, config = {}) {
560
+ const { programAddress, ...fetchConfig } = config;
561
+ const [address] = await findFixedDelegationPda(seeds, { programAddress });
562
+ return await fetchMaybeFixedDelegation(rpc, address, fetchConfig);
563
+ }
564
+
565
+ // src/generated/accounts/plan.ts
566
+ import {
567
+ assertAccountExists as assertAccountExists3,
568
+ assertAccountsExist as assertAccountsExist3,
569
+ combineCodec as combineCodec13,
570
+ decodeAccount as decodeAccount3,
571
+ fetchEncodedAccount as fetchEncodedAccount3,
572
+ fetchEncodedAccounts as fetchEncodedAccounts3,
573
+ getAddressDecoder as getAddressDecoder7,
574
+ getAddressEncoder as getAddressEncoder12,
575
+ getStructDecoder as getStructDecoder11,
576
+ getStructEncoder as getStructEncoder11,
577
+ getU8Decoder as getU8Decoder4,
578
+ getU8Encoder as getU8Encoder4
579
+ } from "@solana/kit";
580
+ function getPlanEncoder() {
581
+ return getStructEncoder11([
582
+ ["discriminator", getU8Encoder4()],
583
+ ["owner", getAddressEncoder12()],
584
+ ["bump", getU8Encoder4()],
585
+ ["status", getU8Encoder4()],
586
+ ["data", getPlanDataEncoder()]
587
+ ]);
588
+ }
589
+ function getPlanDecoder() {
590
+ return getStructDecoder11([
591
+ ["discriminator", getU8Decoder4()],
592
+ ["owner", getAddressDecoder7()],
593
+ ["bump", getU8Decoder4()],
594
+ ["status", getU8Decoder4()],
595
+ ["data", getPlanDataDecoder()]
596
+ ]);
597
+ }
598
+ function getPlanCodec() {
599
+ return combineCodec13(getPlanEncoder(), getPlanDecoder());
600
+ }
601
+ function decodePlan(encodedAccount) {
602
+ return decodeAccount3(encodedAccount, getPlanDecoder());
603
+ }
604
+ async function fetchPlan(rpc, address, config) {
605
+ const maybeAccount = await fetchMaybePlan(rpc, address, config);
606
+ assertAccountExists3(maybeAccount);
607
+ return maybeAccount;
608
+ }
609
+ async function fetchMaybePlan(rpc, address, config) {
610
+ const maybeAccount = await fetchEncodedAccount3(rpc, address, config);
611
+ return decodePlan(maybeAccount);
612
+ }
613
+ async function fetchAllPlan(rpc, addresses, config) {
614
+ const maybeAccounts = await fetchAllMaybePlan(rpc, addresses, config);
615
+ assertAccountsExist3(maybeAccounts);
616
+ return maybeAccounts;
617
+ }
618
+ async function fetchAllMaybePlan(rpc, addresses, config) {
619
+ const maybeAccounts = await fetchEncodedAccounts3(rpc, addresses, config);
620
+ return maybeAccounts.map((maybeAccount) => decodePlan(maybeAccount));
621
+ }
622
+ async function fetchPlanFromSeeds(rpc, seeds, config = {}) {
623
+ const maybeAccount = await fetchMaybePlanFromSeeds(rpc, seeds, config);
624
+ assertAccountExists3(maybeAccount);
625
+ return maybeAccount;
626
+ }
627
+ async function fetchMaybePlanFromSeeds(rpc, seeds, config = {}) {
628
+ const { programAddress, ...fetchConfig } = config;
629
+ const [address] = await findPlanPda(seeds, { programAddress });
630
+ return await fetchMaybePlan(rpc, address, fetchConfig);
631
+ }
632
+
633
+ // src/generated/accounts/recurringDelegation.ts
634
+ import {
635
+ assertAccountExists as assertAccountExists4,
636
+ assertAccountsExist as assertAccountsExist4,
637
+ combineCodec as combineCodec14,
638
+ decodeAccount as decodeAccount4,
639
+ fetchEncodedAccount as fetchEncodedAccount4,
640
+ fetchEncodedAccounts as fetchEncodedAccounts4,
641
+ getAddressDecoder as getAddressDecoder8,
642
+ getAddressEncoder as getAddressEncoder13,
643
+ getI64Decoder as getI64Decoder9,
644
+ getI64Encoder as getI64Encoder9,
645
+ getStructDecoder as getStructDecoder12,
646
+ getStructEncoder as getStructEncoder12,
647
+ getU64Decoder as getU64Decoder8,
648
+ getU64Encoder as getU64Encoder11
649
+ } from "@solana/kit";
650
+ function getRecurringDelegationEncoder() {
651
+ return getStructEncoder12([
652
+ ["header", getHeaderEncoder()],
653
+ ["subscriptionAuthority", getAddressEncoder13()],
654
+ ["mint", getAddressEncoder13()],
655
+ ["currentPeriodStartTs", getI64Encoder9()],
656
+ ["periodLengthS", getU64Encoder11()],
657
+ ["expiryTs", getI64Encoder9()],
658
+ ["amountPerPeriod", getU64Encoder11()],
659
+ ["amountPulledInPeriod", getU64Encoder11()]
660
+ ]);
661
+ }
662
+ function getRecurringDelegationDecoder() {
663
+ return getStructDecoder12([
664
+ ["header", getHeaderDecoder()],
665
+ ["subscriptionAuthority", getAddressDecoder8()],
666
+ ["mint", getAddressDecoder8()],
667
+ ["currentPeriodStartTs", getI64Decoder9()],
668
+ ["periodLengthS", getU64Decoder8()],
669
+ ["expiryTs", getI64Decoder9()],
670
+ ["amountPerPeriod", getU64Decoder8()],
671
+ ["amountPulledInPeriod", getU64Decoder8()]
672
+ ]);
673
+ }
674
+ function getRecurringDelegationCodec() {
675
+ return combineCodec14(getRecurringDelegationEncoder(), getRecurringDelegationDecoder());
676
+ }
677
+ function decodeRecurringDelegation(encodedAccount) {
678
+ return decodeAccount4(encodedAccount, getRecurringDelegationDecoder());
679
+ }
680
+ async function fetchRecurringDelegation(rpc, address, config) {
681
+ const maybeAccount = await fetchMaybeRecurringDelegation(rpc, address, config);
682
+ assertAccountExists4(maybeAccount);
683
+ return maybeAccount;
684
+ }
685
+ async function fetchMaybeRecurringDelegation(rpc, address, config) {
686
+ const maybeAccount = await fetchEncodedAccount4(rpc, address, config);
687
+ return decodeRecurringDelegation(maybeAccount);
688
+ }
689
+ async function fetchAllRecurringDelegation(rpc, addresses, config) {
690
+ const maybeAccounts = await fetchAllMaybeRecurringDelegation(rpc, addresses, config);
691
+ assertAccountsExist4(maybeAccounts);
692
+ return maybeAccounts;
693
+ }
694
+ async function fetchAllMaybeRecurringDelegation(rpc, addresses, config) {
695
+ const maybeAccounts = await fetchEncodedAccounts4(rpc, addresses, config);
696
+ return maybeAccounts.map((maybeAccount) => decodeRecurringDelegation(maybeAccount));
697
+ }
698
+ async function fetchRecurringDelegationFromSeeds(rpc, seeds, config = {}) {
699
+ const maybeAccount = await fetchMaybeRecurringDelegationFromSeeds(rpc, seeds, config);
700
+ assertAccountExists4(maybeAccount);
701
+ return maybeAccount;
702
+ }
703
+ async function fetchMaybeRecurringDelegationFromSeeds(rpc, seeds, config = {}) {
704
+ const { programAddress, ...fetchConfig } = config;
705
+ const [address] = await findRecurringDelegationPda(seeds, { programAddress });
706
+ return await fetchMaybeRecurringDelegation(rpc, address, fetchConfig);
707
+ }
708
+
709
+ // src/generated/accounts/subscriptionAuthority.ts
710
+ import {
711
+ assertAccountExists as assertAccountExists5,
712
+ assertAccountsExist as assertAccountsExist5,
713
+ combineCodec as combineCodec15,
714
+ decodeAccount as decodeAccount5,
715
+ fetchEncodedAccount as fetchEncodedAccount5,
716
+ fetchEncodedAccounts as fetchEncodedAccounts5,
717
+ getAddressDecoder as getAddressDecoder9,
718
+ getAddressEncoder as getAddressEncoder14,
719
+ getI64Decoder as getI64Decoder10,
720
+ getI64Encoder as getI64Encoder10,
721
+ getStructDecoder as getStructDecoder13,
722
+ getStructEncoder as getStructEncoder13,
723
+ getU8Decoder as getU8Decoder5,
724
+ getU8Encoder as getU8Encoder5
725
+ } from "@solana/kit";
726
+ function getSubscriptionAuthorityEncoder() {
727
+ return getStructEncoder13([
728
+ ["discriminator", getU8Encoder5()],
729
+ ["user", getAddressEncoder14()],
730
+ ["tokenMint", getAddressEncoder14()],
731
+ ["payer", getAddressEncoder14()],
732
+ ["bump", getU8Encoder5()],
733
+ ["initId", getI64Encoder10()]
734
+ ]);
735
+ }
736
+ function getSubscriptionAuthorityDecoder() {
737
+ return getStructDecoder13([
738
+ ["discriminator", getU8Decoder5()],
739
+ ["user", getAddressDecoder9()],
740
+ ["tokenMint", getAddressDecoder9()],
741
+ ["payer", getAddressDecoder9()],
742
+ ["bump", getU8Decoder5()],
743
+ ["initId", getI64Decoder10()]
744
+ ]);
745
+ }
746
+ function getSubscriptionAuthorityCodec() {
747
+ return combineCodec15(getSubscriptionAuthorityEncoder(), getSubscriptionAuthorityDecoder());
748
+ }
749
+ function decodeSubscriptionAuthority(encodedAccount) {
750
+ return decodeAccount5(encodedAccount, getSubscriptionAuthorityDecoder());
751
+ }
752
+ async function fetchSubscriptionAuthority(rpc, address, config) {
753
+ const maybeAccount = await fetchMaybeSubscriptionAuthority(rpc, address, config);
754
+ assertAccountExists5(maybeAccount);
755
+ return maybeAccount;
756
+ }
757
+ async function fetchMaybeSubscriptionAuthority(rpc, address, config) {
758
+ const maybeAccount = await fetchEncodedAccount5(rpc, address, config);
759
+ return decodeSubscriptionAuthority(maybeAccount);
760
+ }
761
+ async function fetchAllSubscriptionAuthority(rpc, addresses, config) {
762
+ const maybeAccounts = await fetchAllMaybeSubscriptionAuthority(rpc, addresses, config);
763
+ assertAccountsExist5(maybeAccounts);
764
+ return maybeAccounts;
765
+ }
766
+ async function fetchAllMaybeSubscriptionAuthority(rpc, addresses, config) {
767
+ const maybeAccounts = await fetchEncodedAccounts5(rpc, addresses, config);
768
+ return maybeAccounts.map((maybeAccount) => decodeSubscriptionAuthority(maybeAccount));
769
+ }
770
+ async function fetchSubscriptionAuthorityFromSeeds(rpc, seeds, config = {}) {
771
+ const maybeAccount = await fetchMaybeSubscriptionAuthorityFromSeeds(rpc, seeds, config);
772
+ assertAccountExists5(maybeAccount);
773
+ return maybeAccount;
774
+ }
775
+ async function fetchMaybeSubscriptionAuthorityFromSeeds(rpc, seeds, config = {}) {
776
+ const { programAddress, ...fetchConfig } = config;
777
+ const [address] = await findSubscriptionAuthorityPda(seeds, { programAddress });
778
+ return await fetchMaybeSubscriptionAuthority(rpc, address, fetchConfig);
779
+ }
780
+
781
+ // src/generated/accounts/subscriptionDelegation.ts
782
+ import {
783
+ assertAccountExists as assertAccountExists6,
784
+ assertAccountsExist as assertAccountsExist6,
785
+ combineCodec as combineCodec16,
786
+ decodeAccount as decodeAccount6,
787
+ fetchEncodedAccount as fetchEncodedAccount6,
788
+ fetchEncodedAccounts as fetchEncodedAccounts6,
789
+ getI64Decoder as getI64Decoder11,
790
+ getI64Encoder as getI64Encoder11,
791
+ getStructDecoder as getStructDecoder14,
792
+ getStructEncoder as getStructEncoder14,
793
+ getU64Decoder as getU64Decoder9,
794
+ getU64Encoder as getU64Encoder12
795
+ } from "@solana/kit";
796
+ function getSubscriptionDelegationEncoder() {
797
+ return getStructEncoder14([
798
+ ["header", getHeaderEncoder()],
799
+ ["terms", getPlanTermsEncoder()],
800
+ ["amountPulledInPeriod", getU64Encoder12()],
801
+ ["currentPeriodStartTs", getI64Encoder11()],
802
+ ["expiresAtTs", getI64Encoder11()]
803
+ ]);
804
+ }
805
+ function getSubscriptionDelegationDecoder() {
806
+ return getStructDecoder14([
807
+ ["header", getHeaderDecoder()],
808
+ ["terms", getPlanTermsDecoder()],
809
+ ["amountPulledInPeriod", getU64Decoder9()],
810
+ ["currentPeriodStartTs", getI64Decoder11()],
811
+ ["expiresAtTs", getI64Decoder11()]
812
+ ]);
813
+ }
814
+ function getSubscriptionDelegationCodec() {
815
+ return combineCodec16(getSubscriptionDelegationEncoder(), getSubscriptionDelegationDecoder());
816
+ }
817
+ function decodeSubscriptionDelegation(encodedAccount) {
818
+ return decodeAccount6(encodedAccount, getSubscriptionDelegationDecoder());
819
+ }
820
+ async function fetchSubscriptionDelegation(rpc, address, config) {
821
+ const maybeAccount = await fetchMaybeSubscriptionDelegation(rpc, address, config);
822
+ assertAccountExists6(maybeAccount);
823
+ return maybeAccount;
824
+ }
825
+ async function fetchMaybeSubscriptionDelegation(rpc, address, config) {
826
+ const maybeAccount = await fetchEncodedAccount6(rpc, address, config);
827
+ return decodeSubscriptionDelegation(maybeAccount);
828
+ }
829
+ async function fetchAllSubscriptionDelegation(rpc, addresses, config) {
830
+ const maybeAccounts = await fetchAllMaybeSubscriptionDelegation(rpc, addresses, config);
831
+ assertAccountsExist6(maybeAccounts);
832
+ return maybeAccounts;
833
+ }
834
+ async function fetchAllMaybeSubscriptionDelegation(rpc, addresses, config) {
835
+ const maybeAccounts = await fetchEncodedAccounts6(rpc, addresses, config);
836
+ return maybeAccounts.map((maybeAccount) => decodeSubscriptionDelegation(maybeAccount));
837
+ }
838
+ async function fetchSubscriptionDelegationFromSeeds(rpc, seeds, config = {}) {
839
+ const maybeAccount = await fetchMaybeSubscriptionDelegationFromSeeds(rpc, seeds, config);
840
+ assertAccountExists6(maybeAccount);
841
+ return maybeAccount;
842
+ }
843
+ async function fetchMaybeSubscriptionDelegationFromSeeds(rpc, seeds, config = {}) {
844
+ const { programAddress, ...fetchConfig } = config;
845
+ const [address] = await findSubscriptionDelegationPda(seeds, { programAddress });
846
+ return await fetchMaybeSubscriptionDelegation(rpc, address, fetchConfig);
847
+ }
848
+
849
+ // src/generated/errors/subscriptions.ts
850
+ import {
851
+ isProgramError
852
+ } from "@solana/kit";
853
+
854
+ // src/generated/programs/subscriptions.ts
855
+ import {
856
+ assertIsInstructionWithAccounts,
857
+ containsBytes,
858
+ extendClient,
859
+ getU8Encoder as getU8Encoder20,
860
+ SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
861
+ SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
862
+ SolanaError as SolanaError15
863
+ } from "@solana/kit";
864
+ import {
865
+ addSelfFetchFunctions,
866
+ addSelfPlanAndSendFunctions
867
+ } from "@solana/program-client-core";
868
+
869
+ // src/generated/instructions/cancelSubscription.ts
870
+ import {
871
+ combineCodec as combineCodec17,
872
+ getStructDecoder as getStructDecoder15,
873
+ getStructEncoder as getStructEncoder15,
874
+ getU8Decoder as getU8Decoder6,
875
+ getU8Encoder as getU8Encoder6,
876
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
877
+ SolanaError,
878
+ transformEncoder
879
+ } from "@solana/kit";
880
+ import {
881
+ getAccountMetaFactory,
882
+ getAddressFromResolvedInstructionAccount
883
+ } from "@solana/program-client-core";
884
+ var CANCEL_SUBSCRIPTION_DISCRIMINATOR = 12;
885
+ function getCancelSubscriptionDiscriminatorBytes() {
886
+ return getU8Encoder6().encode(CANCEL_SUBSCRIPTION_DISCRIMINATOR);
887
+ }
888
+ function getCancelSubscriptionInstructionDataEncoder() {
889
+ return transformEncoder(getStructEncoder15([["discriminator", getU8Encoder6()]]), (value) => ({
890
+ ...value,
891
+ discriminator: CANCEL_SUBSCRIPTION_DISCRIMINATOR
892
+ }));
893
+ }
894
+ function getCancelSubscriptionInstructionDataDecoder() {
895
+ return getStructDecoder15([["discriminator", getU8Decoder6()]]);
896
+ }
897
+ function getCancelSubscriptionInstructionDataCodec() {
898
+ return combineCodec17(getCancelSubscriptionInstructionDataEncoder(), getCancelSubscriptionInstructionDataDecoder());
899
+ }
900
+ async function getCancelSubscriptionInstructionAsync(input, config) {
901
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
902
+ const originalAccounts = {
903
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
904
+ planPda: { value: input.planPda ?? null, isWritable: false },
905
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
906
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
907
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
908
+ };
909
+ const accounts = originalAccounts;
910
+ if (!accounts.subscriptionPda.value) {
911
+ accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
912
+ planPda: getAddressFromResolvedInstructionAccount("planPda", accounts.planPda.value),
913
+ subscriber: getAddressFromResolvedInstructionAccount("subscriber", accounts.subscriber.value)
914
+ });
915
+ }
916
+ if (!accounts.eventAuthority.value) {
917
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
918
+ }
919
+ if (!accounts.selfProgram.value) {
920
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
921
+ }
922
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
923
+ return Object.freeze({
924
+ accounts: [
925
+ getAccountMeta("subscriber", accounts.subscriber),
926
+ getAccountMeta("planPda", accounts.planPda),
927
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
928
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
929
+ getAccountMeta("selfProgram", accounts.selfProgram)
930
+ ],
931
+ data: getCancelSubscriptionInstructionDataEncoder().encode({}),
932
+ programAddress
933
+ });
934
+ }
935
+ function getCancelSubscriptionInstruction(input, config) {
936
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
937
+ const originalAccounts = {
938
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
939
+ planPda: { value: input.planPda ?? null, isWritable: false },
940
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
941
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
942
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
943
+ };
944
+ const accounts = originalAccounts;
945
+ if (!accounts.eventAuthority.value) {
946
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
947
+ }
948
+ if (!accounts.selfProgram.value) {
949
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
950
+ }
951
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
952
+ return Object.freeze({
953
+ accounts: [
954
+ getAccountMeta("subscriber", accounts.subscriber),
955
+ getAccountMeta("planPda", accounts.planPda),
956
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
957
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
958
+ getAccountMeta("selfProgram", accounts.selfProgram)
959
+ ],
960
+ data: getCancelSubscriptionInstructionDataEncoder().encode({}),
961
+ programAddress
962
+ });
963
+ }
964
+ function parseCancelSubscriptionInstruction(instruction) {
965
+ if (instruction.accounts.length < 5) {
966
+ throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
967
+ actualAccountMetas: instruction.accounts.length,
968
+ expectedAccountMetas: 5
969
+ });
970
+ }
971
+ let accountIndex = 0;
972
+ const getNextAccount = () => {
973
+ const accountMeta = instruction.accounts[accountIndex];
974
+ accountIndex += 1;
975
+ return accountMeta;
976
+ };
977
+ return {
978
+ programAddress: instruction.programAddress,
979
+ accounts: {
980
+ subscriber: getNextAccount(),
981
+ planPda: getNextAccount(),
982
+ subscriptionPda: getNextAccount(),
983
+ eventAuthority: getNextAccount(),
984
+ selfProgram: getNextAccount()
985
+ },
986
+ data: getCancelSubscriptionInstructionDataDecoder().decode(instruction.data)
987
+ };
988
+ }
989
+
990
+ // src/generated/instructions/closeSubscriptionAuthority.ts
991
+ import {
992
+ combineCodec as combineCodec18,
993
+ getStructDecoder as getStructDecoder16,
994
+ getStructEncoder as getStructEncoder16,
995
+ getU8Decoder as getU8Decoder7,
996
+ getU8Encoder as getU8Encoder7,
997
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS2,
998
+ SolanaError as SolanaError2,
999
+ transformEncoder as transformEncoder2
1000
+ } from "@solana/kit";
1001
+ import { getAccountMetaFactory as getAccountMetaFactory2 } from "@solana/program-client-core";
1002
+ var CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 6;
1003
+ function getCloseSubscriptionAuthorityDiscriminatorBytes() {
1004
+ return getU8Encoder7().encode(CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
1005
+ }
1006
+ function getCloseSubscriptionAuthorityInstructionDataEncoder() {
1007
+ return transformEncoder2(getStructEncoder16([["discriminator", getU8Encoder7()]]), (value) => ({
1008
+ ...value,
1009
+ discriminator: CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
1010
+ }));
1011
+ }
1012
+ function getCloseSubscriptionAuthorityInstructionDataDecoder() {
1013
+ return getStructDecoder16([["discriminator", getU8Decoder7()]]);
1014
+ }
1015
+ function getCloseSubscriptionAuthorityInstructionDataCodec() {
1016
+ return combineCodec18(
1017
+ getCloseSubscriptionAuthorityInstructionDataEncoder(),
1018
+ getCloseSubscriptionAuthorityInstructionDataDecoder()
1019
+ );
1020
+ }
1021
+ function getCloseSubscriptionAuthorityInstruction(input, config) {
1022
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1023
+ const originalAccounts = {
1024
+ user: { value: input.user ?? null, isWritable: true },
1025
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true }
1026
+ };
1027
+ const accounts = originalAccounts;
1028
+ const getAccountMeta = getAccountMetaFactory2(programAddress, "programId");
1029
+ return Object.freeze({
1030
+ accounts: [
1031
+ getAccountMeta("user", accounts.user),
1032
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority)
1033
+ ],
1034
+ data: getCloseSubscriptionAuthorityInstructionDataEncoder().encode({}),
1035
+ programAddress
1036
+ });
1037
+ }
1038
+ function parseCloseSubscriptionAuthorityInstruction(instruction) {
1039
+ if (instruction.accounts.length < 2) {
1040
+ throw new SolanaError2(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS2, {
1041
+ actualAccountMetas: instruction.accounts.length,
1042
+ expectedAccountMetas: 2
1043
+ });
1044
+ }
1045
+ let accountIndex = 0;
1046
+ const getNextAccount = () => {
1047
+ const accountMeta = instruction.accounts[accountIndex];
1048
+ accountIndex += 1;
1049
+ return accountMeta;
1050
+ };
1051
+ return {
1052
+ programAddress: instruction.programAddress,
1053
+ accounts: { user: getNextAccount(), subscriptionAuthority: getNextAccount() },
1054
+ data: getCloseSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
1055
+ };
1056
+ }
1057
+
1058
+ // src/generated/instructions/createFixedDelegation.ts
1059
+ import {
1060
+ combineCodec as combineCodec19,
1061
+ getStructDecoder as getStructDecoder17,
1062
+ getStructEncoder as getStructEncoder17,
1063
+ getU8Decoder as getU8Decoder8,
1064
+ getU8Encoder as getU8Encoder8,
1065
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS3,
1066
+ SolanaError as SolanaError3,
1067
+ transformEncoder as transformEncoder3
1068
+ } from "@solana/kit";
1069
+ import { getAccountMetaFactory as getAccountMetaFactory3 } from "@solana/program-client-core";
1070
+ var CREATE_FIXED_DELEGATION_DISCRIMINATOR = 1;
1071
+ function getCreateFixedDelegationDiscriminatorBytes() {
1072
+ return getU8Encoder8().encode(CREATE_FIXED_DELEGATION_DISCRIMINATOR);
1073
+ }
1074
+ function getCreateFixedDelegationInstructionDataEncoder() {
1075
+ return transformEncoder3(
1076
+ getStructEncoder17([
1077
+ ["discriminator", getU8Encoder8()],
1078
+ ["fixedDelegation", getCreateFixedDelegationDataEncoder()]
1079
+ ]),
1080
+ (value) => ({ ...value, discriminator: CREATE_FIXED_DELEGATION_DISCRIMINATOR })
1081
+ );
1082
+ }
1083
+ function getCreateFixedDelegationInstructionDataDecoder() {
1084
+ return getStructDecoder17([
1085
+ ["discriminator", getU8Decoder8()],
1086
+ ["fixedDelegation", getCreateFixedDelegationDataDecoder()]
1087
+ ]);
1088
+ }
1089
+ function getCreateFixedDelegationInstructionDataCodec() {
1090
+ return combineCodec19(
1091
+ getCreateFixedDelegationInstructionDataEncoder(),
1092
+ getCreateFixedDelegationInstructionDataDecoder()
1093
+ );
1094
+ }
1095
+ function getCreateFixedDelegationInstruction(input, config) {
1096
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1097
+ const originalAccounts = {
1098
+ delegator: { value: input.delegator ?? null, isWritable: true },
1099
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1100
+ delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
1101
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
1102
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1103
+ };
1104
+ const accounts = originalAccounts;
1105
+ const args = { ...input };
1106
+ if (!accounts.systemProgram.value) {
1107
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1108
+ }
1109
+ const getAccountMeta = getAccountMetaFactory3(programAddress, "programId");
1110
+ return Object.freeze({
1111
+ accounts: [
1112
+ getAccountMeta("delegator", accounts.delegator),
1113
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1114
+ getAccountMeta("delegationAccount", accounts.delegationAccount),
1115
+ getAccountMeta("delegatee", accounts.delegatee),
1116
+ getAccountMeta("systemProgram", accounts.systemProgram)
1117
+ ],
1118
+ data: getCreateFixedDelegationInstructionDataEncoder().encode(args),
1119
+ programAddress
1120
+ });
1121
+ }
1122
+ function parseCreateFixedDelegationInstruction(instruction) {
1123
+ if (instruction.accounts.length < 5) {
1124
+ throw new SolanaError3(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS3, {
1125
+ actualAccountMetas: instruction.accounts.length,
1126
+ expectedAccountMetas: 5
1127
+ });
1128
+ }
1129
+ let accountIndex = 0;
1130
+ const getNextAccount = () => {
1131
+ const accountMeta = instruction.accounts[accountIndex];
1132
+ accountIndex += 1;
1133
+ return accountMeta;
1134
+ };
1135
+ return {
1136
+ programAddress: instruction.programAddress,
1137
+ accounts: {
1138
+ delegator: getNextAccount(),
1139
+ subscriptionAuthority: getNextAccount(),
1140
+ delegationAccount: getNextAccount(),
1141
+ delegatee: getNextAccount(),
1142
+ systemProgram: getNextAccount()
1143
+ },
1144
+ data: getCreateFixedDelegationInstructionDataDecoder().decode(instruction.data)
1145
+ };
1146
+ }
1147
+
1148
+ // src/generated/instructions/createPlan.ts
1149
+ import {
1150
+ combineCodec as combineCodec20,
1151
+ getStructDecoder as getStructDecoder18,
1152
+ getStructEncoder as getStructEncoder18,
1153
+ getU8Decoder as getU8Decoder9,
1154
+ getU8Encoder as getU8Encoder9,
1155
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS4,
1156
+ SolanaError as SolanaError4,
1157
+ transformEncoder as transformEncoder4
1158
+ } from "@solana/kit";
1159
+ import { getAccountMetaFactory as getAccountMetaFactory4 } from "@solana/program-client-core";
1160
+ var CREATE_PLAN_DISCRIMINATOR = 7;
1161
+ function getCreatePlanDiscriminatorBytes() {
1162
+ return getU8Encoder9().encode(CREATE_PLAN_DISCRIMINATOR);
1163
+ }
1164
+ function getCreatePlanInstructionDataEncoder() {
1165
+ return transformEncoder4(
1166
+ getStructEncoder18([
1167
+ ["discriminator", getU8Encoder9()],
1168
+ ["planData", getPlanDataEncoder()]
1169
+ ]),
1170
+ (value) => ({ ...value, discriminator: CREATE_PLAN_DISCRIMINATOR })
1171
+ );
1172
+ }
1173
+ function getCreatePlanInstructionDataDecoder() {
1174
+ return getStructDecoder18([
1175
+ ["discriminator", getU8Decoder9()],
1176
+ ["planData", getPlanDataDecoder()]
1177
+ ]);
1178
+ }
1179
+ function getCreatePlanInstructionDataCodec() {
1180
+ return combineCodec20(getCreatePlanInstructionDataEncoder(), getCreatePlanInstructionDataDecoder());
1181
+ }
1182
+ function getCreatePlanInstruction(input, config) {
1183
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1184
+ const originalAccounts = {
1185
+ merchant: { value: input.merchant ?? null, isWritable: true },
1186
+ planPda: { value: input.planPda ?? null, isWritable: true },
1187
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1188
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1189
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1190
+ };
1191
+ const accounts = originalAccounts;
1192
+ const args = { ...input };
1193
+ if (!accounts.systemProgram.value) {
1194
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1195
+ }
1196
+ if (!accounts.tokenProgram.value) {
1197
+ accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
1198
+ }
1199
+ const getAccountMeta = getAccountMetaFactory4(programAddress, "programId");
1200
+ return Object.freeze({
1201
+ accounts: [
1202
+ getAccountMeta("merchant", accounts.merchant),
1203
+ getAccountMeta("planPda", accounts.planPda),
1204
+ getAccountMeta("tokenMint", accounts.tokenMint),
1205
+ getAccountMeta("systemProgram", accounts.systemProgram),
1206
+ getAccountMeta("tokenProgram", accounts.tokenProgram)
1207
+ ],
1208
+ data: getCreatePlanInstructionDataEncoder().encode(args),
1209
+ programAddress
1210
+ });
1211
+ }
1212
+ function parseCreatePlanInstruction(instruction) {
1213
+ if (instruction.accounts.length < 5) {
1214
+ throw new SolanaError4(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS4, {
1215
+ actualAccountMetas: instruction.accounts.length,
1216
+ expectedAccountMetas: 5
1217
+ });
1218
+ }
1219
+ let accountIndex = 0;
1220
+ const getNextAccount = () => {
1221
+ const accountMeta = instruction.accounts[accountIndex];
1222
+ accountIndex += 1;
1223
+ return accountMeta;
1224
+ };
1225
+ return {
1226
+ programAddress: instruction.programAddress,
1227
+ accounts: {
1228
+ merchant: getNextAccount(),
1229
+ planPda: getNextAccount(),
1230
+ tokenMint: getNextAccount(),
1231
+ systemProgram: getNextAccount(),
1232
+ tokenProgram: getNextAccount()
1233
+ },
1234
+ data: getCreatePlanInstructionDataDecoder().decode(instruction.data)
1235
+ };
1236
+ }
1237
+
1238
+ // src/generated/instructions/createRecurringDelegation.ts
1239
+ import {
1240
+ combineCodec as combineCodec21,
1241
+ getStructDecoder as getStructDecoder19,
1242
+ getStructEncoder as getStructEncoder19,
1243
+ getU8Decoder as getU8Decoder10,
1244
+ getU8Encoder as getU8Encoder10,
1245
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS5,
1246
+ SolanaError as SolanaError5,
1247
+ transformEncoder as transformEncoder5
1248
+ } from "@solana/kit";
1249
+ import { getAccountMetaFactory as getAccountMetaFactory5 } from "@solana/program-client-core";
1250
+ var CREATE_RECURRING_DELEGATION_DISCRIMINATOR = 2;
1251
+ function getCreateRecurringDelegationDiscriminatorBytes() {
1252
+ return getU8Encoder10().encode(CREATE_RECURRING_DELEGATION_DISCRIMINATOR);
1253
+ }
1254
+ function getCreateRecurringDelegationInstructionDataEncoder() {
1255
+ return transformEncoder5(
1256
+ getStructEncoder19([
1257
+ ["discriminator", getU8Encoder10()],
1258
+ ["recurringDelegation", getCreateRecurringDelegationDataEncoder()]
1259
+ ]),
1260
+ (value) => ({ ...value, discriminator: CREATE_RECURRING_DELEGATION_DISCRIMINATOR })
1261
+ );
1262
+ }
1263
+ function getCreateRecurringDelegationInstructionDataDecoder() {
1264
+ return getStructDecoder19([
1265
+ ["discriminator", getU8Decoder10()],
1266
+ ["recurringDelegation", getCreateRecurringDelegationDataDecoder()]
1267
+ ]);
1268
+ }
1269
+ function getCreateRecurringDelegationInstructionDataCodec() {
1270
+ return combineCodec21(
1271
+ getCreateRecurringDelegationInstructionDataEncoder(),
1272
+ getCreateRecurringDelegationInstructionDataDecoder()
1273
+ );
1274
+ }
1275
+ function getCreateRecurringDelegationInstruction(input, config) {
1276
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1277
+ const originalAccounts = {
1278
+ delegator: { value: input.delegator ?? null, isWritable: true },
1279
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1280
+ delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
1281
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
1282
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1283
+ };
1284
+ const accounts = originalAccounts;
1285
+ const args = { ...input };
1286
+ if (!accounts.systemProgram.value) {
1287
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1288
+ }
1289
+ const getAccountMeta = getAccountMetaFactory5(programAddress, "programId");
1290
+ return Object.freeze({
1291
+ accounts: [
1292
+ getAccountMeta("delegator", accounts.delegator),
1293
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1294
+ getAccountMeta("delegationAccount", accounts.delegationAccount),
1295
+ getAccountMeta("delegatee", accounts.delegatee),
1296
+ getAccountMeta("systemProgram", accounts.systemProgram)
1297
+ ],
1298
+ data: getCreateRecurringDelegationInstructionDataEncoder().encode(
1299
+ args
1300
+ ),
1301
+ programAddress
1302
+ });
1303
+ }
1304
+ function parseCreateRecurringDelegationInstruction(instruction) {
1305
+ if (instruction.accounts.length < 5) {
1306
+ throw new SolanaError5(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS5, {
1307
+ actualAccountMetas: instruction.accounts.length,
1308
+ expectedAccountMetas: 5
1309
+ });
1310
+ }
1311
+ let accountIndex = 0;
1312
+ const getNextAccount = () => {
1313
+ const accountMeta = instruction.accounts[accountIndex];
1314
+ accountIndex += 1;
1315
+ return accountMeta;
1316
+ };
1317
+ return {
1318
+ programAddress: instruction.programAddress,
1319
+ accounts: {
1320
+ delegator: getNextAccount(),
1321
+ subscriptionAuthority: getNextAccount(),
1322
+ delegationAccount: getNextAccount(),
1323
+ delegatee: getNextAccount(),
1324
+ systemProgram: getNextAccount()
1325
+ },
1326
+ data: getCreateRecurringDelegationInstructionDataDecoder().decode(instruction.data)
1327
+ };
1328
+ }
1329
+
1330
+ // src/generated/instructions/deletePlan.ts
1331
+ import {
1332
+ combineCodec as combineCodec22,
1333
+ getStructDecoder as getStructDecoder20,
1334
+ getStructEncoder as getStructEncoder20,
1335
+ getU8Decoder as getU8Decoder11,
1336
+ getU8Encoder as getU8Encoder11,
1337
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS6,
1338
+ SolanaError as SolanaError6,
1339
+ transformEncoder as transformEncoder6
1340
+ } from "@solana/kit";
1341
+ import { getAccountMetaFactory as getAccountMetaFactory6 } from "@solana/program-client-core";
1342
+ var DELETE_PLAN_DISCRIMINATOR = 9;
1343
+ function getDeletePlanDiscriminatorBytes() {
1344
+ return getU8Encoder11().encode(DELETE_PLAN_DISCRIMINATOR);
1345
+ }
1346
+ function getDeletePlanInstructionDataEncoder() {
1347
+ return transformEncoder6(getStructEncoder20([["discriminator", getU8Encoder11()]]), (value) => ({
1348
+ ...value,
1349
+ discriminator: DELETE_PLAN_DISCRIMINATOR
1350
+ }));
1351
+ }
1352
+ function getDeletePlanInstructionDataDecoder() {
1353
+ return getStructDecoder20([["discriminator", getU8Decoder11()]]);
1354
+ }
1355
+ function getDeletePlanInstructionDataCodec() {
1356
+ return combineCodec22(getDeletePlanInstructionDataEncoder(), getDeletePlanInstructionDataDecoder());
1357
+ }
1358
+ function getDeletePlanInstruction(input, config) {
1359
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1360
+ const originalAccounts = {
1361
+ owner: { value: input.owner ?? null, isWritable: true },
1362
+ planPda: { value: input.planPda ?? null, isWritable: true }
1363
+ };
1364
+ const accounts = originalAccounts;
1365
+ const getAccountMeta = getAccountMetaFactory6(programAddress, "programId");
1366
+ return Object.freeze({
1367
+ accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
1368
+ data: getDeletePlanInstructionDataEncoder().encode({}),
1369
+ programAddress
1370
+ });
1371
+ }
1372
+ function parseDeletePlanInstruction(instruction) {
1373
+ if (instruction.accounts.length < 2) {
1374
+ throw new SolanaError6(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS6, {
1375
+ actualAccountMetas: instruction.accounts.length,
1376
+ expectedAccountMetas: 2
1377
+ });
1378
+ }
1379
+ let accountIndex = 0;
1380
+ const getNextAccount = () => {
1381
+ const accountMeta = instruction.accounts[accountIndex];
1382
+ accountIndex += 1;
1383
+ return accountMeta;
1384
+ };
1385
+ return {
1386
+ programAddress: instruction.programAddress,
1387
+ accounts: { owner: getNextAccount(), planPda: getNextAccount() },
1388
+ data: getDeletePlanInstructionDataDecoder().decode(instruction.data)
1389
+ };
1390
+ }
1391
+
1392
+ // src/generated/instructions/initSubscriptionAuthority.ts
1393
+ import {
1394
+ combineCodec as combineCodec23,
1395
+ getStructDecoder as getStructDecoder21,
1396
+ getStructEncoder as getStructEncoder21,
1397
+ getU8Decoder as getU8Decoder12,
1398
+ getU8Encoder as getU8Encoder12,
1399
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS7,
1400
+ SolanaError as SolanaError7,
1401
+ transformEncoder as transformEncoder7
1402
+ } from "@solana/kit";
1403
+ import {
1404
+ getAccountMetaFactory as getAccountMetaFactory7,
1405
+ getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount2
1406
+ } from "@solana/program-client-core";
1407
+ var INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 0;
1408
+ function getInitSubscriptionAuthorityDiscriminatorBytes() {
1409
+ return getU8Encoder12().encode(INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
1410
+ }
1411
+ function getInitSubscriptionAuthorityInstructionDataEncoder() {
1412
+ return transformEncoder7(getStructEncoder21([["discriminator", getU8Encoder12()]]), (value) => ({
1413
+ ...value,
1414
+ discriminator: INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
1415
+ }));
1416
+ }
1417
+ function getInitSubscriptionAuthorityInstructionDataDecoder() {
1418
+ return getStructDecoder21([["discriminator", getU8Decoder12()]]);
1419
+ }
1420
+ function getInitSubscriptionAuthorityInstructionDataCodec() {
1421
+ return combineCodec23(
1422
+ getInitSubscriptionAuthorityInstructionDataEncoder(),
1423
+ getInitSubscriptionAuthorityInstructionDataDecoder()
1424
+ );
1425
+ }
1426
+ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
1427
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1428
+ const originalAccounts = {
1429
+ owner: { value: input.owner ?? null, isWritable: true },
1430
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
1431
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1432
+ userAta: { value: input.userAta ?? null, isWritable: true },
1433
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1434
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1435
+ };
1436
+ const accounts = originalAccounts;
1437
+ if (!accounts.subscriptionAuthority.value) {
1438
+ accounts.subscriptionAuthority.value = await findSubscriptionAuthorityPda({
1439
+ user: getAddressFromResolvedInstructionAccount2("owner", accounts.owner.value),
1440
+ tokenMint: getAddressFromResolvedInstructionAccount2("tokenMint", accounts.tokenMint.value)
1441
+ });
1442
+ }
1443
+ if (!accounts.systemProgram.value) {
1444
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1445
+ }
1446
+ const getAccountMeta = getAccountMetaFactory7(programAddress, "programId");
1447
+ return Object.freeze({
1448
+ accounts: [
1449
+ getAccountMeta("owner", accounts.owner),
1450
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1451
+ getAccountMeta("tokenMint", accounts.tokenMint),
1452
+ getAccountMeta("userAta", accounts.userAta),
1453
+ getAccountMeta("systemProgram", accounts.systemProgram),
1454
+ getAccountMeta("tokenProgram", accounts.tokenProgram)
1455
+ ],
1456
+ data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
1457
+ programAddress
1458
+ });
1459
+ }
1460
+ function getInitSubscriptionAuthorityInstruction(input, config) {
1461
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1462
+ const originalAccounts = {
1463
+ owner: { value: input.owner ?? null, isWritable: true },
1464
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
1465
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1466
+ userAta: { value: input.userAta ?? null, isWritable: true },
1467
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1468
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1469
+ };
1470
+ const accounts = originalAccounts;
1471
+ if (!accounts.systemProgram.value) {
1472
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1473
+ }
1474
+ const getAccountMeta = getAccountMetaFactory7(programAddress, "programId");
1475
+ return Object.freeze({
1476
+ accounts: [
1477
+ getAccountMeta("owner", accounts.owner),
1478
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1479
+ getAccountMeta("tokenMint", accounts.tokenMint),
1480
+ getAccountMeta("userAta", accounts.userAta),
1481
+ getAccountMeta("systemProgram", accounts.systemProgram),
1482
+ getAccountMeta("tokenProgram", accounts.tokenProgram)
1483
+ ],
1484
+ data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
1485
+ programAddress
1486
+ });
1487
+ }
1488
+ function parseInitSubscriptionAuthorityInstruction(instruction) {
1489
+ if (instruction.accounts.length < 6) {
1490
+ throw new SolanaError7(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS7, {
1491
+ actualAccountMetas: instruction.accounts.length,
1492
+ expectedAccountMetas: 6
1493
+ });
1494
+ }
1495
+ let accountIndex = 0;
1496
+ const getNextAccount = () => {
1497
+ const accountMeta = instruction.accounts[accountIndex];
1498
+ accountIndex += 1;
1499
+ return accountMeta;
1500
+ };
1501
+ return {
1502
+ programAddress: instruction.programAddress,
1503
+ accounts: {
1504
+ owner: getNextAccount(),
1505
+ subscriptionAuthority: getNextAccount(),
1506
+ tokenMint: getNextAccount(),
1507
+ userAta: getNextAccount(),
1508
+ systemProgram: getNextAccount(),
1509
+ tokenProgram: getNextAccount()
1510
+ },
1511
+ data: getInitSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
1512
+ };
1513
+ }
1514
+
1515
+ // src/generated/instructions/resumeSubscription.ts
1516
+ import {
1517
+ combineCodec as combineCodec24,
1518
+ getStructDecoder as getStructDecoder22,
1519
+ getStructEncoder as getStructEncoder22,
1520
+ getU8Decoder as getU8Decoder13,
1521
+ getU8Encoder as getU8Encoder13,
1522
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8,
1523
+ SolanaError as SolanaError8,
1524
+ transformEncoder as transformEncoder8
1525
+ } from "@solana/kit";
1526
+ import {
1527
+ getAccountMetaFactory as getAccountMetaFactory8,
1528
+ getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount3
1529
+ } from "@solana/program-client-core";
1530
+ var RESUME_SUBSCRIPTION_DISCRIMINATOR = 13;
1531
+ function getResumeSubscriptionDiscriminatorBytes() {
1532
+ return getU8Encoder13().encode(RESUME_SUBSCRIPTION_DISCRIMINATOR);
1533
+ }
1534
+ function getResumeSubscriptionInstructionDataEncoder() {
1535
+ return transformEncoder8(getStructEncoder22([["discriminator", getU8Encoder13()]]), (value) => ({
1536
+ ...value,
1537
+ discriminator: RESUME_SUBSCRIPTION_DISCRIMINATOR
1538
+ }));
1539
+ }
1540
+ function getResumeSubscriptionInstructionDataDecoder() {
1541
+ return getStructDecoder22([["discriminator", getU8Decoder13()]]);
1542
+ }
1543
+ function getResumeSubscriptionInstructionDataCodec() {
1544
+ return combineCodec24(getResumeSubscriptionInstructionDataEncoder(), getResumeSubscriptionInstructionDataDecoder());
1545
+ }
1546
+ async function getResumeSubscriptionInstructionAsync(input, config) {
1547
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1548
+ const originalAccounts = {
1549
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
1550
+ planPda: { value: input.planPda ?? null, isWritable: false },
1551
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1552
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1553
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1554
+ };
1555
+ const accounts = originalAccounts;
1556
+ if (!accounts.subscriptionPda.value) {
1557
+ accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
1558
+ planPda: getAddressFromResolvedInstructionAccount3("planPda", accounts.planPda.value),
1559
+ subscriber: getAddressFromResolvedInstructionAccount3("subscriber", accounts.subscriber.value)
1560
+ });
1561
+ }
1562
+ if (!accounts.eventAuthority.value) {
1563
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1564
+ }
1565
+ if (!accounts.selfProgram.value) {
1566
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1567
+ }
1568
+ const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
1569
+ return Object.freeze({
1570
+ accounts: [
1571
+ getAccountMeta("subscriber", accounts.subscriber),
1572
+ getAccountMeta("planPda", accounts.planPda),
1573
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1574
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1575
+ getAccountMeta("selfProgram", accounts.selfProgram)
1576
+ ],
1577
+ data: getResumeSubscriptionInstructionDataEncoder().encode({}),
1578
+ programAddress
1579
+ });
1580
+ }
1581
+ function getResumeSubscriptionInstruction(input, config) {
1582
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1583
+ const originalAccounts = {
1584
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
1585
+ planPda: { value: input.planPda ?? null, isWritable: false },
1586
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1587
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1588
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1589
+ };
1590
+ const accounts = originalAccounts;
1591
+ if (!accounts.eventAuthority.value) {
1592
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1593
+ }
1594
+ if (!accounts.selfProgram.value) {
1595
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1596
+ }
1597
+ const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
1598
+ return Object.freeze({
1599
+ accounts: [
1600
+ getAccountMeta("subscriber", accounts.subscriber),
1601
+ getAccountMeta("planPda", accounts.planPda),
1602
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1603
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1604
+ getAccountMeta("selfProgram", accounts.selfProgram)
1605
+ ],
1606
+ data: getResumeSubscriptionInstructionDataEncoder().encode({}),
1607
+ programAddress
1608
+ });
1609
+ }
1610
+ function parseResumeSubscriptionInstruction(instruction) {
1611
+ if (instruction.accounts.length < 5) {
1612
+ throw new SolanaError8(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8, {
1613
+ actualAccountMetas: instruction.accounts.length,
1614
+ expectedAccountMetas: 5
1615
+ });
1616
+ }
1617
+ let accountIndex = 0;
1618
+ const getNextAccount = () => {
1619
+ const accountMeta = instruction.accounts[accountIndex];
1620
+ accountIndex += 1;
1621
+ return accountMeta;
1622
+ };
1623
+ return {
1624
+ programAddress: instruction.programAddress,
1625
+ accounts: {
1626
+ subscriber: getNextAccount(),
1627
+ planPda: getNextAccount(),
1628
+ subscriptionPda: getNextAccount(),
1629
+ eventAuthority: getNextAccount(),
1630
+ selfProgram: getNextAccount()
1631
+ },
1632
+ data: getResumeSubscriptionInstructionDataDecoder().decode(instruction.data)
1633
+ };
1634
+ }
1635
+
1636
+ // src/generated/instructions/revokeDelegation.ts
1637
+ import {
1638
+ combineCodec as combineCodec25,
1639
+ getStructDecoder as getStructDecoder23,
1640
+ getStructEncoder as getStructEncoder23,
1641
+ getU8Decoder as getU8Decoder14,
1642
+ getU8Encoder as getU8Encoder14,
1643
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9,
1644
+ SolanaError as SolanaError9,
1645
+ transformEncoder as transformEncoder9
1646
+ } from "@solana/kit";
1647
+ import { getAccountMetaFactory as getAccountMetaFactory9 } from "@solana/program-client-core";
1648
+ var REVOKE_DELEGATION_DISCRIMINATOR = 3;
1649
+ function getRevokeDelegationDiscriminatorBytes() {
1650
+ return getU8Encoder14().encode(REVOKE_DELEGATION_DISCRIMINATOR);
1651
+ }
1652
+ function getRevokeDelegationInstructionDataEncoder() {
1653
+ return transformEncoder9(getStructEncoder23([["discriminator", getU8Encoder14()]]), (value) => ({
1654
+ ...value,
1655
+ discriminator: REVOKE_DELEGATION_DISCRIMINATOR
1656
+ }));
1657
+ }
1658
+ function getRevokeDelegationInstructionDataDecoder() {
1659
+ return getStructDecoder23([["discriminator", getU8Decoder14()]]);
1660
+ }
1661
+ function getRevokeDelegationInstructionDataCodec() {
1662
+ return combineCodec25(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
1663
+ }
1664
+ function getRevokeDelegationInstruction(input, config) {
1665
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1666
+ const originalAccounts = {
1667
+ authority: { value: input.authority ?? null, isWritable: true },
1668
+ delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
1669
+ };
1670
+ const accounts = originalAccounts;
1671
+ const getAccountMeta = getAccountMetaFactory9(programAddress, "programId");
1672
+ return Object.freeze({
1673
+ accounts: [
1674
+ getAccountMeta("authority", accounts.authority),
1675
+ getAccountMeta("delegationAccount", accounts.delegationAccount)
1676
+ ],
1677
+ data: getRevokeDelegationInstructionDataEncoder().encode({}),
1678
+ programAddress
1679
+ });
1680
+ }
1681
+ function parseRevokeDelegationInstruction(instruction) {
1682
+ if (instruction.accounts.length < 2) {
1683
+ throw new SolanaError9(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9, {
1684
+ actualAccountMetas: instruction.accounts.length,
1685
+ expectedAccountMetas: 2
1686
+ });
1687
+ }
1688
+ let accountIndex = 0;
1689
+ const getNextAccount = () => {
1690
+ const accountMeta = instruction.accounts[accountIndex];
1691
+ accountIndex += 1;
1692
+ return accountMeta;
1693
+ };
1694
+ return {
1695
+ programAddress: instruction.programAddress,
1696
+ accounts: { authority: getNextAccount(), delegationAccount: getNextAccount() },
1697
+ data: getRevokeDelegationInstructionDataDecoder().decode(instruction.data)
1698
+ };
1699
+ }
1700
+
1701
+ // src/generated/instructions/subscribe.ts
1702
+ import {
1703
+ combineCodec as combineCodec26,
1704
+ getStructDecoder as getStructDecoder24,
1705
+ getStructEncoder as getStructEncoder24,
1706
+ getU8Decoder as getU8Decoder15,
1707
+ getU8Encoder as getU8Encoder15,
1708
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10,
1709
+ SolanaError as SolanaError10,
1710
+ transformEncoder as transformEncoder10
1711
+ } from "@solana/kit";
1712
+ import {
1713
+ getAccountMetaFactory as getAccountMetaFactory10,
1714
+ getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount4
1715
+ } from "@solana/program-client-core";
1716
+ var SUBSCRIBE_DISCRIMINATOR = 11;
1717
+ function getSubscribeDiscriminatorBytes() {
1718
+ return getU8Encoder15().encode(SUBSCRIBE_DISCRIMINATOR);
1719
+ }
1720
+ function getSubscribeInstructionDataEncoder() {
1721
+ return transformEncoder10(
1722
+ getStructEncoder24([
1723
+ ["discriminator", getU8Encoder15()],
1724
+ ["subscribeData", getSubscribeDataEncoder()]
1725
+ ]),
1726
+ (value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
1727
+ );
1728
+ }
1729
+ function getSubscribeInstructionDataDecoder() {
1730
+ return getStructDecoder24([
1731
+ ["discriminator", getU8Decoder15()],
1732
+ ["subscribeData", getSubscribeDataDecoder()]
1733
+ ]);
1734
+ }
1735
+ function getSubscribeInstructionDataCodec() {
1736
+ return combineCodec26(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
1737
+ }
1738
+ async function getSubscribeInstructionAsync(input, config) {
1739
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1740
+ const originalAccounts = {
1741
+ subscriber: { value: input.subscriber ?? null, isWritable: true },
1742
+ merchant: { value: input.merchant ?? null, isWritable: false },
1743
+ planPda: { value: input.planPda ?? null, isWritable: false },
1744
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1745
+ subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
1746
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1747
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1748
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1749
+ };
1750
+ const accounts = originalAccounts;
1751
+ const args = { ...input };
1752
+ if (!accounts.subscriptionPda.value) {
1753
+ accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
1754
+ planPda: getAddressFromResolvedInstructionAccount4("planPda", accounts.planPda.value),
1755
+ subscriber: getAddressFromResolvedInstructionAccount4("subscriber", accounts.subscriber.value)
1756
+ });
1757
+ }
1758
+ if (!accounts.systemProgram.value) {
1759
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1760
+ }
1761
+ if (!accounts.eventAuthority.value) {
1762
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1763
+ }
1764
+ if (!accounts.selfProgram.value) {
1765
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1766
+ }
1767
+ const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
1768
+ return Object.freeze({
1769
+ accounts: [
1770
+ getAccountMeta("subscriber", accounts.subscriber),
1771
+ getAccountMeta("merchant", accounts.merchant),
1772
+ getAccountMeta("planPda", accounts.planPda),
1773
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1774
+ getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
1775
+ getAccountMeta("systemProgram", accounts.systemProgram),
1776
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1777
+ getAccountMeta("selfProgram", accounts.selfProgram)
1778
+ ],
1779
+ data: getSubscribeInstructionDataEncoder().encode(args),
1780
+ programAddress
1781
+ });
1782
+ }
1783
+ function getSubscribeInstruction(input, config) {
1784
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1785
+ const originalAccounts = {
1786
+ subscriber: { value: input.subscriber ?? null, isWritable: true },
1787
+ merchant: { value: input.merchant ?? null, isWritable: false },
1788
+ planPda: { value: input.planPda ?? null, isWritable: false },
1789
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1790
+ subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
1791
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1792
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1793
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1794
+ };
1795
+ const accounts = originalAccounts;
1796
+ const args = { ...input };
1797
+ if (!accounts.systemProgram.value) {
1798
+ accounts.systemProgram.value = "11111111111111111111111111111111";
1799
+ }
1800
+ if (!accounts.eventAuthority.value) {
1801
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1802
+ }
1803
+ if (!accounts.selfProgram.value) {
1804
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1805
+ }
1806
+ const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
1807
+ return Object.freeze({
1808
+ accounts: [
1809
+ getAccountMeta("subscriber", accounts.subscriber),
1810
+ getAccountMeta("merchant", accounts.merchant),
1811
+ getAccountMeta("planPda", accounts.planPda),
1812
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1813
+ getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
1814
+ getAccountMeta("systemProgram", accounts.systemProgram),
1815
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1816
+ getAccountMeta("selfProgram", accounts.selfProgram)
1817
+ ],
1818
+ data: getSubscribeInstructionDataEncoder().encode(args),
1819
+ programAddress
1820
+ });
1821
+ }
1822
+ function parseSubscribeInstruction(instruction) {
1823
+ if (instruction.accounts.length < 8) {
1824
+ throw new SolanaError10(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10, {
1825
+ actualAccountMetas: instruction.accounts.length,
1826
+ expectedAccountMetas: 8
1827
+ });
1828
+ }
1829
+ let accountIndex = 0;
1830
+ const getNextAccount = () => {
1831
+ const accountMeta = instruction.accounts[accountIndex];
1832
+ accountIndex += 1;
1833
+ return accountMeta;
1834
+ };
1835
+ return {
1836
+ programAddress: instruction.programAddress,
1837
+ accounts: {
1838
+ subscriber: getNextAccount(),
1839
+ merchant: getNextAccount(),
1840
+ planPda: getNextAccount(),
1841
+ subscriptionPda: getNextAccount(),
1842
+ subscriptionAuthorityPda: getNextAccount(),
1843
+ systemProgram: getNextAccount(),
1844
+ eventAuthority: getNextAccount(),
1845
+ selfProgram: getNextAccount()
1846
+ },
1847
+ data: getSubscribeInstructionDataDecoder().decode(instruction.data)
1848
+ };
1849
+ }
1850
+
1851
+ // src/generated/instructions/transferFixed.ts
1852
+ import {
1853
+ combineCodec as combineCodec27,
1854
+ getStructDecoder as getStructDecoder25,
1855
+ getStructEncoder as getStructEncoder25,
1856
+ getU8Decoder as getU8Decoder16,
1857
+ getU8Encoder as getU8Encoder16,
1858
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11,
1859
+ SolanaError as SolanaError11,
1860
+ transformEncoder as transformEncoder11
1861
+ } from "@solana/kit";
1862
+ import { getAccountMetaFactory as getAccountMetaFactory11 } from "@solana/program-client-core";
1863
+ var TRANSFER_FIXED_DISCRIMINATOR = 4;
1864
+ function getTransferFixedDiscriminatorBytes() {
1865
+ return getU8Encoder16().encode(TRANSFER_FIXED_DISCRIMINATOR);
1866
+ }
1867
+ function getTransferFixedInstructionDataEncoder() {
1868
+ return transformEncoder11(
1869
+ getStructEncoder25([
1870
+ ["discriminator", getU8Encoder16()],
1871
+ ["transferData", getTransferDataEncoder()]
1872
+ ]),
1873
+ (value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
1874
+ );
1875
+ }
1876
+ function getTransferFixedInstructionDataDecoder() {
1877
+ return getStructDecoder25([
1878
+ ["discriminator", getU8Decoder16()],
1879
+ ["transferData", getTransferDataDecoder()]
1880
+ ]);
1881
+ }
1882
+ function getTransferFixedInstructionDataCodec() {
1883
+ return combineCodec27(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
1884
+ }
1885
+ function getTransferFixedInstruction(input, config) {
1886
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1887
+ const originalAccounts = {
1888
+ delegationPda: { value: input.delegationPda ?? null, isWritable: true },
1889
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1890
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
1891
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
1892
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1893
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
1894
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1895
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1896
+ };
1897
+ const accounts = originalAccounts;
1898
+ const args = { ...input };
1899
+ if (!accounts.eventAuthority.value) {
1900
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1901
+ }
1902
+ if (!accounts.selfProgram.value) {
1903
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1904
+ }
1905
+ const getAccountMeta = getAccountMetaFactory11(programAddress, "programId");
1906
+ return Object.freeze({
1907
+ accounts: [
1908
+ getAccountMeta("delegationPda", accounts.delegationPda),
1909
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1910
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
1911
+ getAccountMeta("receiverAta", accounts.receiverAta),
1912
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
1913
+ getAccountMeta("delegatee", accounts.delegatee),
1914
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1915
+ getAccountMeta("selfProgram", accounts.selfProgram)
1916
+ ],
1917
+ data: getTransferFixedInstructionDataEncoder().encode(args),
1918
+ programAddress
1919
+ });
1920
+ }
1921
+ function parseTransferFixedInstruction(instruction) {
1922
+ if (instruction.accounts.length < 8) {
1923
+ throw new SolanaError11(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11, {
1924
+ actualAccountMetas: instruction.accounts.length,
1925
+ expectedAccountMetas: 8
1926
+ });
1927
+ }
1928
+ let accountIndex = 0;
1929
+ const getNextAccount = () => {
1930
+ const accountMeta = instruction.accounts[accountIndex];
1931
+ accountIndex += 1;
1932
+ return accountMeta;
1933
+ };
1934
+ return {
1935
+ programAddress: instruction.programAddress,
1936
+ accounts: {
1937
+ delegationPda: getNextAccount(),
1938
+ subscriptionAuthority: getNextAccount(),
1939
+ delegatorAta: getNextAccount(),
1940
+ receiverAta: getNextAccount(),
1941
+ tokenProgram: getNextAccount(),
1942
+ delegatee: getNextAccount(),
1943
+ eventAuthority: getNextAccount(),
1944
+ selfProgram: getNextAccount()
1945
+ },
1946
+ data: getTransferFixedInstructionDataDecoder().decode(instruction.data)
1947
+ };
1948
+ }
1949
+
1950
+ // src/generated/instructions/transferRecurring.ts
1951
+ import {
1952
+ combineCodec as combineCodec28,
1953
+ getStructDecoder as getStructDecoder26,
1954
+ getStructEncoder as getStructEncoder26,
1955
+ getU8Decoder as getU8Decoder17,
1956
+ getU8Encoder as getU8Encoder17,
1957
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12,
1958
+ SolanaError as SolanaError12,
1959
+ transformEncoder as transformEncoder12
1960
+ } from "@solana/kit";
1961
+ import { getAccountMetaFactory as getAccountMetaFactory12 } from "@solana/program-client-core";
1962
+ var TRANSFER_RECURRING_DISCRIMINATOR = 5;
1963
+ function getTransferRecurringDiscriminatorBytes() {
1964
+ return getU8Encoder17().encode(TRANSFER_RECURRING_DISCRIMINATOR);
1965
+ }
1966
+ function getTransferRecurringInstructionDataEncoder() {
1967
+ return transformEncoder12(
1968
+ getStructEncoder26([
1969
+ ["discriminator", getU8Encoder17()],
1970
+ ["transferData", getTransferDataEncoder()]
1971
+ ]),
1972
+ (value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
1973
+ );
1974
+ }
1975
+ function getTransferRecurringInstructionDataDecoder() {
1976
+ return getStructDecoder26([
1977
+ ["discriminator", getU8Decoder17()],
1978
+ ["transferData", getTransferDataDecoder()]
1979
+ ]);
1980
+ }
1981
+ function getTransferRecurringInstructionDataCodec() {
1982
+ return combineCodec28(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
1983
+ }
1984
+ function getTransferRecurringInstruction(input, config) {
1985
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1986
+ const originalAccounts = {
1987
+ delegationPda: { value: input.delegationPda ?? null, isWritable: true },
1988
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1989
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
1990
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
1991
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1992
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
1993
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1994
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1995
+ };
1996
+ const accounts = originalAccounts;
1997
+ const args = { ...input };
1998
+ if (!accounts.eventAuthority.value) {
1999
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2000
+ }
2001
+ if (!accounts.selfProgram.value) {
2002
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2003
+ }
2004
+ const getAccountMeta = getAccountMetaFactory12(programAddress, "programId");
2005
+ return Object.freeze({
2006
+ accounts: [
2007
+ getAccountMeta("delegationPda", accounts.delegationPda),
2008
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
2009
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
2010
+ getAccountMeta("receiverAta", accounts.receiverAta),
2011
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
2012
+ getAccountMeta("delegatee", accounts.delegatee),
2013
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2014
+ getAccountMeta("selfProgram", accounts.selfProgram)
2015
+ ],
2016
+ data: getTransferRecurringInstructionDataEncoder().encode(args),
2017
+ programAddress
2018
+ });
2019
+ }
2020
+ function parseTransferRecurringInstruction(instruction) {
2021
+ if (instruction.accounts.length < 8) {
2022
+ throw new SolanaError12(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12, {
2023
+ actualAccountMetas: instruction.accounts.length,
2024
+ expectedAccountMetas: 8
2025
+ });
2026
+ }
2027
+ let accountIndex = 0;
2028
+ const getNextAccount = () => {
2029
+ const accountMeta = instruction.accounts[accountIndex];
2030
+ accountIndex += 1;
2031
+ return accountMeta;
2032
+ };
2033
+ return {
2034
+ programAddress: instruction.programAddress,
2035
+ accounts: {
2036
+ delegationPda: getNextAccount(),
2037
+ subscriptionAuthority: getNextAccount(),
2038
+ delegatorAta: getNextAccount(),
2039
+ receiverAta: getNextAccount(),
2040
+ tokenProgram: getNextAccount(),
2041
+ delegatee: getNextAccount(),
2042
+ eventAuthority: getNextAccount(),
2043
+ selfProgram: getNextAccount()
2044
+ },
2045
+ data: getTransferRecurringInstructionDataDecoder().decode(instruction.data)
2046
+ };
2047
+ }
2048
+
2049
+ // src/generated/instructions/transferSubscription.ts
2050
+ import {
2051
+ combineCodec as combineCodec29,
2052
+ getStructDecoder as getStructDecoder27,
2053
+ getStructEncoder as getStructEncoder27,
2054
+ getU8Decoder as getU8Decoder18,
2055
+ getU8Encoder as getU8Encoder18,
2056
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13,
2057
+ SolanaError as SolanaError13,
2058
+ transformEncoder as transformEncoder13
2059
+ } from "@solana/kit";
2060
+ import { getAccountMetaFactory as getAccountMetaFactory13 } from "@solana/program-client-core";
2061
+ var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
2062
+ function getTransferSubscriptionDiscriminatorBytes() {
2063
+ return getU8Encoder18().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
2064
+ }
2065
+ function getTransferSubscriptionInstructionDataEncoder() {
2066
+ return transformEncoder13(
2067
+ getStructEncoder27([
2068
+ ["discriminator", getU8Encoder18()],
2069
+ ["transferData", getTransferDataEncoder()]
2070
+ ]),
2071
+ (value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
2072
+ );
2073
+ }
2074
+ function getTransferSubscriptionInstructionDataDecoder() {
2075
+ return getStructDecoder27([
2076
+ ["discriminator", getU8Decoder18()],
2077
+ ["transferData", getTransferDataDecoder()]
2078
+ ]);
2079
+ }
2080
+ function getTransferSubscriptionInstructionDataCodec() {
2081
+ return combineCodec29(
2082
+ getTransferSubscriptionInstructionDataEncoder(),
2083
+ getTransferSubscriptionInstructionDataDecoder()
2084
+ );
2085
+ }
2086
+ function getTransferSubscriptionInstruction(input, config) {
2087
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2088
+ const originalAccounts = {
2089
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
2090
+ planPda: { value: input.planPda ?? null, isWritable: false },
2091
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
2092
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
2093
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
2094
+ caller: { value: input.caller ?? null, isWritable: false },
2095
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
2096
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2097
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2098
+ };
2099
+ const accounts = originalAccounts;
2100
+ const args = { ...input };
2101
+ if (!accounts.eventAuthority.value) {
2102
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2103
+ }
2104
+ if (!accounts.selfProgram.value) {
2105
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2106
+ }
2107
+ const getAccountMeta = getAccountMetaFactory13(programAddress, "programId");
2108
+ return Object.freeze({
2109
+ accounts: [
2110
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
2111
+ getAccountMeta("planPda", accounts.planPda),
2112
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
2113
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
2114
+ getAccountMeta("receiverAta", accounts.receiverAta),
2115
+ getAccountMeta("caller", accounts.caller),
2116
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
2117
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2118
+ getAccountMeta("selfProgram", accounts.selfProgram)
2119
+ ],
2120
+ data: getTransferSubscriptionInstructionDataEncoder().encode(args),
2121
+ programAddress
2122
+ });
2123
+ }
2124
+ function parseTransferSubscriptionInstruction(instruction) {
2125
+ if (instruction.accounts.length < 9) {
2126
+ throw new SolanaError13(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13, {
2127
+ actualAccountMetas: instruction.accounts.length,
2128
+ expectedAccountMetas: 9
2129
+ });
2130
+ }
2131
+ let accountIndex = 0;
2132
+ const getNextAccount = () => {
2133
+ const accountMeta = instruction.accounts[accountIndex];
2134
+ accountIndex += 1;
2135
+ return accountMeta;
2136
+ };
2137
+ return {
2138
+ programAddress: instruction.programAddress,
2139
+ accounts: {
2140
+ subscriptionPda: getNextAccount(),
2141
+ planPda: getNextAccount(),
2142
+ subscriptionAuthority: getNextAccount(),
2143
+ delegatorAta: getNextAccount(),
2144
+ receiverAta: getNextAccount(),
2145
+ caller: getNextAccount(),
2146
+ tokenProgram: getNextAccount(),
2147
+ eventAuthority: getNextAccount(),
2148
+ selfProgram: getNextAccount()
2149
+ },
2150
+ data: getTransferSubscriptionInstructionDataDecoder().decode(instruction.data)
2151
+ };
2152
+ }
2153
+
2154
+ // src/generated/instructions/updatePlan.ts
2155
+ import {
2156
+ combineCodec as combineCodec30,
2157
+ getStructDecoder as getStructDecoder28,
2158
+ getStructEncoder as getStructEncoder28,
2159
+ getU8Decoder as getU8Decoder19,
2160
+ getU8Encoder as getU8Encoder19,
2161
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14,
2162
+ SolanaError as SolanaError14,
2163
+ transformEncoder as transformEncoder14
2164
+ } from "@solana/kit";
2165
+ import { getAccountMetaFactory as getAccountMetaFactory14 } from "@solana/program-client-core";
2166
+ var UPDATE_PLAN_DISCRIMINATOR = 8;
2167
+ function getUpdatePlanDiscriminatorBytes() {
2168
+ return getU8Encoder19().encode(UPDATE_PLAN_DISCRIMINATOR);
2169
+ }
2170
+ function getUpdatePlanInstructionDataEncoder() {
2171
+ return transformEncoder14(
2172
+ getStructEncoder28([
2173
+ ["discriminator", getU8Encoder19()],
2174
+ ["updatePlanData", getUpdatePlanDataEncoder()]
2175
+ ]),
2176
+ (value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
2177
+ );
2178
+ }
2179
+ function getUpdatePlanInstructionDataDecoder() {
2180
+ return getStructDecoder28([
2181
+ ["discriminator", getU8Decoder19()],
2182
+ ["updatePlanData", getUpdatePlanDataDecoder()]
2183
+ ]);
2184
+ }
2185
+ function getUpdatePlanInstructionDataCodec() {
2186
+ return combineCodec30(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
2187
+ }
2188
+ function getUpdatePlanInstruction(input, config) {
2189
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2190
+ const originalAccounts = {
2191
+ owner: { value: input.owner ?? null, isWritable: false },
2192
+ planPda: { value: input.planPda ?? null, isWritable: true }
2193
+ };
2194
+ const accounts = originalAccounts;
2195
+ const args = { ...input };
2196
+ const getAccountMeta = getAccountMetaFactory14(programAddress, "programId");
2197
+ return Object.freeze({
2198
+ accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
2199
+ data: getUpdatePlanInstructionDataEncoder().encode(args),
2200
+ programAddress
2201
+ });
2202
+ }
2203
+ function parseUpdatePlanInstruction(instruction) {
2204
+ if (instruction.accounts.length < 2) {
2205
+ throw new SolanaError14(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14, {
2206
+ actualAccountMetas: instruction.accounts.length,
2207
+ expectedAccountMetas: 2
2208
+ });
2209
+ }
2210
+ let accountIndex = 0;
2211
+ const getNextAccount = () => {
2212
+ const accountMeta = instruction.accounts[accountIndex];
2213
+ accountIndex += 1;
2214
+ return accountMeta;
2215
+ };
2216
+ return {
2217
+ programAddress: instruction.programAddress,
2218
+ accounts: { owner: getNextAccount(), planPda: getNextAccount() },
2219
+ data: getUpdatePlanInstructionDataDecoder().decode(instruction.data)
2220
+ };
2221
+ }
2222
+
2223
+ // src/generated/programs/subscriptions.ts
2224
+ var SUBSCRIPTIONS_PROGRAM_ADDRESS = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2225
+ var SubscriptionsAccount = /* @__PURE__ */ ((SubscriptionsAccount2) => {
2226
+ SubscriptionsAccount2[SubscriptionsAccount2["FixedDelegation"] = 0] = "FixedDelegation";
2227
+ SubscriptionsAccount2[SubscriptionsAccount2["Plan"] = 1] = "Plan";
2228
+ SubscriptionsAccount2[SubscriptionsAccount2["RecurringDelegation"] = 2] = "RecurringDelegation";
2229
+ SubscriptionsAccount2[SubscriptionsAccount2["SubscriptionAuthority"] = 3] = "SubscriptionAuthority";
2230
+ SubscriptionsAccount2[SubscriptionsAccount2["SubscriptionDelegation"] = 4] = "SubscriptionDelegation";
2231
+ SubscriptionsAccount2[SubscriptionsAccount2["EventAuthority"] = 5] = "EventAuthority";
2232
+ return SubscriptionsAccount2;
2233
+ })(SubscriptionsAccount || {});
2234
+ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
2235
+ SubscriptionsInstruction2[SubscriptionsInstruction2["InitSubscriptionAuthority"] = 0] = "InitSubscriptionAuthority";
2236
+ SubscriptionsInstruction2[SubscriptionsInstruction2["CreateFixedDelegation"] = 1] = "CreateFixedDelegation";
2237
+ SubscriptionsInstruction2[SubscriptionsInstruction2["CreateRecurringDelegation"] = 2] = "CreateRecurringDelegation";
2238
+ SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeDelegation"] = 3] = "RevokeDelegation";
2239
+ SubscriptionsInstruction2[SubscriptionsInstruction2["TransferFixed"] = 4] = "TransferFixed";
2240
+ SubscriptionsInstruction2[SubscriptionsInstruction2["TransferRecurring"] = 5] = "TransferRecurring";
2241
+ SubscriptionsInstruction2[SubscriptionsInstruction2["CloseSubscriptionAuthority"] = 6] = "CloseSubscriptionAuthority";
2242
+ SubscriptionsInstruction2[SubscriptionsInstruction2["CreatePlan"] = 7] = "CreatePlan";
2243
+ SubscriptionsInstruction2[SubscriptionsInstruction2["UpdatePlan"] = 8] = "UpdatePlan";
2244
+ SubscriptionsInstruction2[SubscriptionsInstruction2["DeletePlan"] = 9] = "DeletePlan";
2245
+ SubscriptionsInstruction2[SubscriptionsInstruction2["TransferSubscription"] = 10] = "TransferSubscription";
2246
+ SubscriptionsInstruction2[SubscriptionsInstruction2["Subscribe"] = 11] = "Subscribe";
2247
+ SubscriptionsInstruction2[SubscriptionsInstruction2["CancelSubscription"] = 12] = "CancelSubscription";
2248
+ SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
2249
+ return SubscriptionsInstruction2;
2250
+ })(SubscriptionsInstruction || {});
2251
+ function identifySubscriptionsInstruction(instruction) {
2252
+ const data = "data" in instruction ? instruction.data : instruction;
2253
+ if (containsBytes(data, getU8Encoder20().encode(0), 0)) {
2254
+ return 0 /* InitSubscriptionAuthority */;
2255
+ }
2256
+ if (containsBytes(data, getU8Encoder20().encode(1), 0)) {
2257
+ return 1 /* CreateFixedDelegation */;
2258
+ }
2259
+ if (containsBytes(data, getU8Encoder20().encode(2), 0)) {
2260
+ return 2 /* CreateRecurringDelegation */;
2261
+ }
2262
+ if (containsBytes(data, getU8Encoder20().encode(3), 0)) {
2263
+ return 3 /* RevokeDelegation */;
2264
+ }
2265
+ if (containsBytes(data, getU8Encoder20().encode(4), 0)) {
2266
+ return 4 /* TransferFixed */;
2267
+ }
2268
+ if (containsBytes(data, getU8Encoder20().encode(5), 0)) {
2269
+ return 5 /* TransferRecurring */;
2270
+ }
2271
+ if (containsBytes(data, getU8Encoder20().encode(6), 0)) {
2272
+ return 6 /* CloseSubscriptionAuthority */;
2273
+ }
2274
+ if (containsBytes(data, getU8Encoder20().encode(7), 0)) {
2275
+ return 7 /* CreatePlan */;
2276
+ }
2277
+ if (containsBytes(data, getU8Encoder20().encode(8), 0)) {
2278
+ return 8 /* UpdatePlan */;
2279
+ }
2280
+ if (containsBytes(data, getU8Encoder20().encode(9), 0)) {
2281
+ return 9 /* DeletePlan */;
2282
+ }
2283
+ if (containsBytes(data, getU8Encoder20().encode(10), 0)) {
2284
+ return 10 /* TransferSubscription */;
2285
+ }
2286
+ if (containsBytes(data, getU8Encoder20().encode(11), 0)) {
2287
+ return 11 /* Subscribe */;
2288
+ }
2289
+ if (containsBytes(data, getU8Encoder20().encode(12), 0)) {
2290
+ return 12 /* CancelSubscription */;
2291
+ }
2292
+ if (containsBytes(data, getU8Encoder20().encode(13), 0)) {
2293
+ return 13 /* ResumeSubscription */;
2294
+ }
2295
+ throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2296
+ instructionData: data,
2297
+ programName: "subscriptions"
2298
+ });
2299
+ }
2300
+ function parseSubscriptionsInstruction(instruction) {
2301
+ const instructionType = identifySubscriptionsInstruction(instruction);
2302
+ switch (instructionType) {
2303
+ case 0 /* InitSubscriptionAuthority */: {
2304
+ assertIsInstructionWithAccounts(instruction);
2305
+ return {
2306
+ instructionType: 0 /* InitSubscriptionAuthority */,
2307
+ ...parseInitSubscriptionAuthorityInstruction(instruction)
2308
+ };
2309
+ }
2310
+ case 1 /* CreateFixedDelegation */: {
2311
+ assertIsInstructionWithAccounts(instruction);
2312
+ return {
2313
+ instructionType: 1 /* CreateFixedDelegation */,
2314
+ ...parseCreateFixedDelegationInstruction(instruction)
2315
+ };
2316
+ }
2317
+ case 2 /* CreateRecurringDelegation */: {
2318
+ assertIsInstructionWithAccounts(instruction);
2319
+ return {
2320
+ instructionType: 2 /* CreateRecurringDelegation */,
2321
+ ...parseCreateRecurringDelegationInstruction(instruction)
2322
+ };
2323
+ }
2324
+ case 3 /* RevokeDelegation */: {
2325
+ assertIsInstructionWithAccounts(instruction);
2326
+ return {
2327
+ instructionType: 3 /* RevokeDelegation */,
2328
+ ...parseRevokeDelegationInstruction(instruction)
2329
+ };
2330
+ }
2331
+ case 4 /* TransferFixed */: {
2332
+ assertIsInstructionWithAccounts(instruction);
2333
+ return {
2334
+ instructionType: 4 /* TransferFixed */,
2335
+ ...parseTransferFixedInstruction(instruction)
2336
+ };
2337
+ }
2338
+ case 5 /* TransferRecurring */: {
2339
+ assertIsInstructionWithAccounts(instruction);
2340
+ return {
2341
+ instructionType: 5 /* TransferRecurring */,
2342
+ ...parseTransferRecurringInstruction(instruction)
2343
+ };
2344
+ }
2345
+ case 6 /* CloseSubscriptionAuthority */: {
2346
+ assertIsInstructionWithAccounts(instruction);
2347
+ return {
2348
+ instructionType: 6 /* CloseSubscriptionAuthority */,
2349
+ ...parseCloseSubscriptionAuthorityInstruction(instruction)
2350
+ };
2351
+ }
2352
+ case 7 /* CreatePlan */: {
2353
+ assertIsInstructionWithAccounts(instruction);
2354
+ return { instructionType: 7 /* CreatePlan */, ...parseCreatePlanInstruction(instruction) };
2355
+ }
2356
+ case 8 /* UpdatePlan */: {
2357
+ assertIsInstructionWithAccounts(instruction);
2358
+ return { instructionType: 8 /* UpdatePlan */, ...parseUpdatePlanInstruction(instruction) };
2359
+ }
2360
+ case 9 /* DeletePlan */: {
2361
+ assertIsInstructionWithAccounts(instruction);
2362
+ return { instructionType: 9 /* DeletePlan */, ...parseDeletePlanInstruction(instruction) };
2363
+ }
2364
+ case 10 /* TransferSubscription */: {
2365
+ assertIsInstructionWithAccounts(instruction);
2366
+ return {
2367
+ instructionType: 10 /* TransferSubscription */,
2368
+ ...parseTransferSubscriptionInstruction(instruction)
2369
+ };
2370
+ }
2371
+ case 11 /* Subscribe */: {
2372
+ assertIsInstructionWithAccounts(instruction);
2373
+ return { instructionType: 11 /* Subscribe */, ...parseSubscribeInstruction(instruction) };
2374
+ }
2375
+ case 12 /* CancelSubscription */: {
2376
+ assertIsInstructionWithAccounts(instruction);
2377
+ return {
2378
+ instructionType: 12 /* CancelSubscription */,
2379
+ ...parseCancelSubscriptionInstruction(instruction)
2380
+ };
2381
+ }
2382
+ case 13 /* ResumeSubscription */: {
2383
+ assertIsInstructionWithAccounts(instruction);
2384
+ return {
2385
+ instructionType: 13 /* ResumeSubscription */,
2386
+ ...parseResumeSubscriptionInstruction(instruction)
2387
+ };
2388
+ }
2389
+ default:
2390
+ throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
2391
+ instructionType,
2392
+ programName: "subscriptions"
2393
+ });
2394
+ }
2395
+ }
2396
+ function subscriptionsProgram() {
2397
+ return (client) => {
2398
+ return extendClient(client, {
2399
+ subscriptions: {
2400
+ accounts: {
2401
+ fixedDelegation: addSelfFetchFunctions(client, getFixedDelegationCodec()),
2402
+ plan: addSelfFetchFunctions(client, getPlanCodec()),
2403
+ recurringDelegation: addSelfFetchFunctions(client, getRecurringDelegationCodec()),
2404
+ subscriptionAuthority: addSelfFetchFunctions(client, getSubscriptionAuthorityCodec()),
2405
+ subscriptionDelegation: addSelfFetchFunctions(client, getSubscriptionDelegationCodec()),
2406
+ eventAuthority: addSelfFetchFunctions(client, getEventAuthorityCodec())
2407
+ },
2408
+ instructions: {
2409
+ initSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getInitSubscriptionAuthorityInstructionAsync(input)),
2410
+ createFixedDelegation: (input) => addSelfPlanAndSendFunctions(client, getCreateFixedDelegationInstruction(input)),
2411
+ createRecurringDelegation: (input) => addSelfPlanAndSendFunctions(client, getCreateRecurringDelegationInstruction(input)),
2412
+ revokeDelegation: (input) => addSelfPlanAndSendFunctions(client, getRevokeDelegationInstruction(input)),
2413
+ transferFixed: (input) => addSelfPlanAndSendFunctions(client, getTransferFixedInstruction(input)),
2414
+ transferRecurring: (input) => addSelfPlanAndSendFunctions(client, getTransferRecurringInstruction(input)),
2415
+ closeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getCloseSubscriptionAuthorityInstruction(input)),
2416
+ createPlan: (input) => addSelfPlanAndSendFunctions(client, getCreatePlanInstruction(input)),
2417
+ updatePlan: (input) => addSelfPlanAndSendFunctions(client, getUpdatePlanInstruction(input)),
2418
+ deletePlan: (input) => addSelfPlanAndSendFunctions(client, getDeletePlanInstruction(input)),
2419
+ transferSubscription: (input) => addSelfPlanAndSendFunctions(client, getTransferSubscriptionInstruction(input)),
2420
+ subscribe: (input) => addSelfPlanAndSendFunctions(client, getSubscribeInstructionAsync(input)),
2421
+ cancelSubscription: (input) => addSelfPlanAndSendFunctions(client, getCancelSubscriptionInstructionAsync(input)),
2422
+ resumeSubscription: (input) => addSelfPlanAndSendFunctions(client, getResumeSubscriptionInstructionAsync(input))
2423
+ },
2424
+ pdas: {
2425
+ fixedDelegation: findFixedDelegationPda,
2426
+ plan: findPlanPda,
2427
+ recurringDelegation: findRecurringDelegationPda,
2428
+ subscriptionAuthority: findSubscriptionAuthorityPda,
2429
+ subscriptionDelegation: findSubscriptionDelegationPda,
2430
+ eventAuthority: findEventAuthorityPda
2431
+ }
2432
+ }
2433
+ });
2434
+ };
2435
+ }
2436
+
2437
+ // src/generated/errors/subscriptions.ts
2438
+ var SUBSCRIPTIONS_ERROR__NOT_SIGNER = 100;
2439
+ var SUBSCRIPTIONS_ERROR__INVALID_ADDRESS = 101;
2440
+ var SUBSCRIPTIONS_ERROR__INVALID_ESCROW_PDA = 102;
2441
+ var SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA = 103;
2442
+ var SUBSCRIPTIONS_ERROR__NOT_SYSTEM_PROGRAM = 104;
2443
+ var SUBSCRIPTIONS_ERROR__INVALID_TOKEN_PROGRAM = 105;
2444
+ var SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA = 106;
2445
+ var SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_TOKEN_ACCOUNT_DATA = 107;
2446
+ var SUBSCRIPTIONS_ERROR__INVALID_ASSOCIATED_TOKEN_ACCOUNT_DERIVED_ADDRESS = 108;
2447
+ var SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_MINT_ACCOUNT_DATA = 109;
2448
+ var SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_TOKEN_ACCOUNT_DATA = 110;
2449
+ var SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DATA = 111;
2450
+ var SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION_DATA = 112;
2451
+ var SUBSCRIPTIONS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 113;
2452
+ var SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION = 114;
2453
+ var SUBSCRIPTIONS_ERROR__ARITHMETIC_OVERFLOW = 115;
2454
+ var SUBSCRIPTIONS_ERROR__ARITHMETIC_UNDERFLOW = 116;
2455
+ var SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR = 117;
2456
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_CONFIDENTIAL_TRANSFER = 118;
2457
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_NON_TRANSFERABLE = 119;
2458
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_PERMANENT_DELEGATE = 120;
2459
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_HOOK = 121;
2460
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_FEE = 122;
2461
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_MINT_CLOSE_AUTHORITY = 123;
2462
+ var SUBSCRIPTIONS_ERROR__MINT_HAS_PAUSABLE = 124;
2463
+ var SUBSCRIPTIONS_ERROR__MINT_MISMATCH = 125;
2464
+ var SUBSCRIPTIONS_ERROR__INVALID_DELEGATE_PDA = 126;
2465
+ var SUBSCRIPTIONS_ERROR__INVALID_HEADER_DATA = 127;
2466
+ var SUBSCRIPTIONS_ERROR__DELEGATION_EXPIRED = 128;
2467
+ var SUBSCRIPTIONS_ERROR__INVALID_AMOUNT = 129;
2468
+ var SUBSCRIPTIONS_ERROR__UNAUTHORIZED = 130;
2469
+ var SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE = 131;
2470
+ var SUBSCRIPTIONS_ERROR__ATA_OWNER_MISMATCH = 132;
2471
+ var SUBSCRIPTIONS_ERROR__DELEGATION_VERSION_MISMATCH = 133;
2472
+ var SUBSCRIPTIONS_ERROR__MIGRATION_REQUIRED = 134;
2473
+ var SUBSCRIPTIONS_ERROR__DELEGATION_ALREADY_EXISTS = 135;
2474
+ var SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY = 136;
2475
+ var SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_LIMIT = 300;
2476
+ var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_EXPIRY_IN_PAST = 301;
2477
+ var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_AMOUNT_ZERO = 302;
2478
+ var SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_PERIOD_LIMIT = 400;
2479
+ var SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED = 401;
2480
+ var SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH = 402;
2481
+ var SUBSCRIPTIONS_ERROR__INVALID_PAYER_DATA = 403;
2482
+ var SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_IN_PAST = 404;
2483
+ var SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_GREATER_THAN_EXPIRY = 405;
2484
+ var SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_AMOUNT_ZERO = 406;
2485
+ var SUBSCRIPTIONS_ERROR__DELEGATION_NOT_STARTED = 407;
2486
+ var SUBSCRIPTIONS_ERROR__PLAN_SUNSET = 500;
2487
+ var SUBSCRIPTIONS_ERROR__PLAN_EXPIRED = 501;
2488
+ var SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA = 502;
2489
+ var SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA = 503;
2490
+ var SUBSCRIPTIONS_ERROR__NOT_PLAN_OWNER = 504;
2491
+ var SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH = 505;
2492
+ var SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION = 506;
2493
+ var SUBSCRIPTIONS_ERROR__INVALID_NUM_DESTINATIONS = 507;
2494
+ var SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED = 508;
2495
+ var SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED = 509;
2496
+ var SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED = 510;
2497
+ var SUBSCRIPTIONS_ERROR__INVALID_END_TS = 511;
2498
+ var SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS = 512;
2499
+ var SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET = 513;
2500
+ var SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS = 514;
2501
+ var SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED = 515;
2502
+ var SUBSCRIPTIONS_ERROR__PLAN_CLOSED = 516;
2503
+ var SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED = 517;
2504
+ var SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS = 518;
2505
+ var SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH = 519;
2506
+ var SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY = 600;
2507
+ var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA = 601;
2508
+ var SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG = 602;
2509
+ var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DISCRIMINATOR = 603;
2510
+ var subscriptionsErrorMessages;
2511
+ if (process.env["NODE_ENV"] !== "production") {
2512
+ subscriptionsErrorMessages = {
2513
+ [SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE]: `Account must be writable`,
2514
+ [SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED]: `Already subscribed to this plan`,
2515
+ [SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_LIMIT]: `Transfer amount exceeds delegation limit`,
2516
+ [SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_PERIOD_LIMIT]: `Transfer amount exceeds period limit`,
2517
+ [SUBSCRIPTIONS_ERROR__ARITHMETIC_OVERFLOW]: `Arithmetic Overflow`,
2518
+ [SUBSCRIPTIONS_ERROR__ARITHMETIC_UNDERFLOW]: `Arithmetic Underflow`,
2519
+ [SUBSCRIPTIONS_ERROR__ATA_OWNER_MISMATCH]: `Token account owner does not match expected`,
2520
+ [SUBSCRIPTIONS_ERROR__DELEGATION_ALREADY_EXISTS]: `Delegation account already exists`,
2521
+ [SUBSCRIPTIONS_ERROR__DELEGATION_EXPIRED]: `Delegation has expired`,
2522
+ [SUBSCRIPTIONS_ERROR__DELEGATION_NOT_STARTED]: `Delegation period has not started yet`,
2523
+ [SUBSCRIPTIONS_ERROR__DELEGATION_VERSION_MISMATCH]: `Delegation header version is not compatible`,
2524
+ [SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_AMOUNT_ZERO]: `zero amount specified`,
2525
+ [SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_EXPIRY_IN_PAST]: `Expiry time specified is less than current time`,
2526
+ [SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DATA]: `Invalid account data`,
2527
+ [SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR]: `Invalid account discriminator`,
2528
+ [SUBSCRIPTIONS_ERROR__INVALID_ADDRESS]: `Invalid account address`,
2529
+ [SUBSCRIPTIONS_ERROR__INVALID_AMOUNT]: `Invalid amount specified`,
2530
+ [SUBSCRIPTIONS_ERROR__INVALID_ASSOCIATED_TOKEN_ACCOUNT_DERIVED_ADDRESS]: `Invalid associated token account address`,
2531
+ [SUBSCRIPTIONS_ERROR__INVALID_DELEGATE_PDA]: `Invalid delegation PDA derivation`,
2532
+ [SUBSCRIPTIONS_ERROR__INVALID_END_TS]: `End timestamp must be zero or in the future`,
2533
+ [SUBSCRIPTIONS_ERROR__INVALID_ESCROW_PDA]: `Invalid escrow PDA derivation`,
2534
+ [SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY]: `Invalid event authority PDA`,
2535
+ [SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA]: `Invalid event data`,
2536
+ [SUBSCRIPTIONS_ERROR__INVALID_EVENT_DISCRIMINATOR]: `Unknown event discriminator`,
2537
+ [SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG]: `Invalid event tag prefix`,
2538
+ [SUBSCRIPTIONS_ERROR__INVALID_HEADER_DATA]: `Invalid header data`,
2539
+ [SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION]: `Invalid instruction`,
2540
+ [SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION_DATA]: `Invalid instruction data`,
2541
+ [SUBSCRIPTIONS_ERROR__INVALID_NUM_DESTINATIONS]: `No valid destinations provided`,
2542
+ [SUBSCRIPTIONS_ERROR__INVALID_PAYER_DATA]: `Payer provided does not match delegation`,
2543
+ [SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH]: `Invalid Period length`,
2544
+ [SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA]: `Invalid Plan PDA derivation`,
2545
+ [SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS]: `Invalid plan status value`,
2546
+ [SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA]: `Invalid subscription-authority PDA derivation`,
2547
+ [SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA]: `Invalid subscription PDA derivation`,
2548
+ [SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA]: `Invalid Token-2022 mint account data`,
2549
+ [SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_TOKEN_ACCOUNT_DATA]: `Invalid Token-2022 token account data`,
2550
+ [SUBSCRIPTIONS_ERROR__INVALID_TOKEN_PROGRAM]: `Token Program does not match other accounts`,
2551
+ [SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_MINT_ACCOUNT_DATA]: `Invalid SPL Token mint account data`,
2552
+ [SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_TOKEN_ACCOUNT_DATA]: `Invalid SPL Token account data`,
2553
+ [SUBSCRIPTIONS_ERROR__MIGRATION_REQUIRED]: `Account requires explicit migration`,
2554
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_CONFIDENTIAL_TRANSFER]: `Mint has ConfidentialTransfer extension`,
2555
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_MINT_CLOSE_AUTHORITY]: `Mint has MintCloseAuthority extension`,
2556
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_NON_TRANSFERABLE]: `Mint has NonTransferable extension`,
2557
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_PAUSABLE]: `Mint has Pausable extension`,
2558
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_PERMANENT_DELEGATE]: `Mint has PermanentDelegate extension`,
2559
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_FEE]: `Mint has TransferFee extension`,
2560
+ [SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_HOOK]: `Mint has TransferHook extension`,
2561
+ [SUBSCRIPTIONS_ERROR__MINT_MISMATCH]: `Token mint mismatch`,
2562
+ [SUBSCRIPTIONS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: `Not enough account keys provided`,
2563
+ [SUBSCRIPTIONS_ERROR__NOT_PLAN_OWNER]: `Caller is not the plan owner`,
2564
+ [SUBSCRIPTIONS_ERROR__NOT_SIGNER]: `Account must be a signer`,
2565
+ [SUBSCRIPTIONS_ERROR__NOT_SYSTEM_PROGRAM]: `Expected system program`,
2566
+ [SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED]: `Period has not elapsed yet`,
2567
+ [SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS]: `Plan account already exists`,
2568
+ [SUBSCRIPTIONS_ERROR__PLAN_CLOSED]: `Plan account has been closed`,
2569
+ [SUBSCRIPTIONS_ERROR__PLAN_EXPIRED]: `Plan has expired`,
2570
+ [SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET]: `Plan cannot be updated after sunset`,
2571
+ [SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED]: `Plan must be expired to delete`,
2572
+ [SUBSCRIPTIONS_ERROR__PLAN_SUNSET]: `Plan is in sunset status`,
2573
+ [SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH]: `Subscription plan terms do not match the current plan`,
2574
+ [SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_AMOUNT_ZERO]: `zero amount specified`,
2575
+ [SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_GREATER_THAN_EXPIRY]: `start time specified is greater than expiry`,
2576
+ [SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_IN_PAST]: `Past start time specified`,
2577
+ [SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY]: `Delegation init_id does not match current SubscriptionAuthority`,
2578
+ [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED]: `Subscription already cancelled`,
2579
+ [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED]: `Subscription cancelled and past valid period`,
2580
+ [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription is not cancelled`,
2581
+ [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
2582
+ [SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
2583
+ [SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
2584
+ [SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION]: `Destination not in plan whitelist`
2585
+ };
2586
+ }
2587
+ function getSubscriptionsErrorMessage(code) {
2588
+ if (process.env["NODE_ENV"] !== "production") {
2589
+ return subscriptionsErrorMessages[code];
2590
+ }
2591
+ return "Error message not available in production bundles.";
2592
+ }
2593
+ function isSubscriptionsError(error, transactionMessage, code) {
2594
+ return isProgramError(error, transactionMessage, SUBSCRIPTIONS_PROGRAM_ADDRESS, code);
2595
+ }
2596
+
2597
+ // src/constants.ts
2598
+ var PROGRAM_ID = SUBSCRIPTIONS_PROGRAM_ADDRESS;
2599
+ var CURRENT_PROGRAM_VERSION = 1;
2600
+ var ZERO_ADDRESS = "11111111111111111111111111111111";
2601
+ var DISCRIMINATOR_OFFSET = 0;
2602
+ var DELEGATOR_OFFSET = 3;
2603
+ var DELEGATEE_OFFSET = 35;
2604
+ var U64_BYTE_SIZE = 8;
2605
+ var SUBSCRIPTION_AUTHORITY_SEED = "SubscriptionAuthority";
2606
+ var DELEGATION_SEED = "delegation";
2607
+ var PLAN_SEED = "plan";
2608
+ var SUBSCRIPTION_SEED = "subscription";
2609
+ var EVENT_AUTHORITY_SEED = "event_authority";
2610
+ var PLAN_SIZE = 491;
2611
+ var SUBSCRIPTION_SIZE = 155;
2612
+ var PLAN_OWNER_OFFSET = 1;
2613
+ var MAX_PLAN_DESTINATIONS = 4;
2614
+ var MAX_PLAN_PULLERS = 4;
2615
+ var METADATA_URI_LEN = 128;
2616
+
2617
+ // src/accounts/decode.ts
2618
+ function toEncodedAccount(raw, programAddress) {
2619
+ const base64Encoder = getBase64Encoder();
2620
+ const data = base64Encoder.encode(raw.account.data[0]);
2621
+ return {
2622
+ address: raw.pubkey,
2623
+ data,
2624
+ executable: raw.account.executable,
2625
+ lamports: raw.account.lamports,
2626
+ programAddress,
2627
+ space: raw.account.space
2628
+ };
2629
+ }
2630
+ function decodeDelegationAccount(raw, programAddress) {
2631
+ const encoded = toEncodedAccount(raw, programAddress);
2632
+ const kind = encoded.data[DISCRIMINATOR_OFFSET];
2633
+ switch (kind) {
2634
+ case 2 /* FixedDelegation */: {
2635
+ const decoded = decodeFixedDelegation(encoded);
2636
+ return {
2637
+ address: raw.pubkey,
2638
+ data: decoded.data,
2639
+ kind: "fixed"
2640
+ };
2641
+ }
2642
+ case 3 /* RecurringDelegation */: {
2643
+ const decoded = decodeRecurringDelegation(encoded);
2644
+ return {
2645
+ address: raw.pubkey,
2646
+ data: decoded.data,
2647
+ kind: "recurring"
2648
+ };
2649
+ }
2650
+ case 4 /* SubscriptionDelegation */: {
2651
+ const decoded = decodeSubscriptionDelegation(encoded);
2652
+ return {
2653
+ address: raw.pubkey,
2654
+ data: decoded.data,
2655
+ kind: "subscription"
2656
+ };
2657
+ }
2658
+ default:
2659
+ console.warn(`Unknown delegation discriminator: ${kind}`);
2660
+ return null;
2661
+ }
2662
+ }
2663
+
2664
+ // src/accounts/delegations.ts
2665
+ async function fetchDelegationsByDelegator(rpc, wallet, programAddress) {
2666
+ return await fetchDelegationsByOffset(rpc, wallet, DELEGATOR_OFFSET, programAddress);
2667
+ }
2668
+ async function fetchDelegationsByDelegatee(rpc, wallet, programAddress) {
2669
+ return await fetchDelegationsByOffset(rpc, wallet, DELEGATEE_OFFSET, programAddress);
2670
+ }
2671
+ async function fetchDelegationsByOffset(rpc, wallet, offset, programAddress) {
2672
+ const progAddr = programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2673
+ const response = await rpc.getProgramAccounts(progAddr, {
2674
+ encoding: "base64",
2675
+ filters: [
2676
+ {
2677
+ memcmp: {
2678
+ bytes: wallet,
2679
+ encoding: "base58",
2680
+ offset: BigInt(offset)
2681
+ }
2682
+ }
2683
+ ]
2684
+ }).send();
2685
+ return response.map((account) => decodeDelegationAccount(account, progAddr)).filter((d) => d !== null);
2686
+ }
2687
+
2688
+ // src/accounts/plans.ts
2689
+ async function fetchPlansForOwner(rpc, owner, programAddress) {
2690
+ const progAddr = programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2691
+ const response = await rpc.getProgramAccounts(progAddr, {
2692
+ encoding: "base64",
2693
+ filters: [
2694
+ { dataSize: BigInt(PLAN_SIZE) },
2695
+ {
2696
+ memcmp: {
2697
+ bytes: owner,
2698
+ encoding: "base58",
2699
+ offset: BigInt(PLAN_OWNER_OFFSET)
2700
+ }
2701
+ }
2702
+ ]
2703
+ }).send();
2704
+ return response.map((account) => {
2705
+ const encoded = toEncodedAccount(account, progAddr);
2706
+ const { address, data } = decodePlan(encoded);
2707
+ return { address, data };
2708
+ });
2709
+ }
2710
+
2711
+ // src/accounts/subscriptions.ts
2712
+ async function fetchSubscriptionsForUser(rpc, user, programAddress) {
2713
+ const progAddr = programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2714
+ const response = await rpc.getProgramAccounts(progAddr, {
2715
+ encoding: "base64",
2716
+ filters: [
2717
+ { dataSize: BigInt(SUBSCRIPTION_SIZE) },
2718
+ {
2719
+ memcmp: {
2720
+ bytes: user,
2721
+ encoding: "base58",
2722
+ offset: BigInt(DELEGATOR_OFFSET)
2723
+ }
2724
+ }
2725
+ ]
2726
+ }).send();
2727
+ return response.map((account) => {
2728
+ const raw = account;
2729
+ const encoded = toEncodedAccount(raw, progAddr);
2730
+ const decoded = decodeSubscriptionDelegation(encoded);
2731
+ return { address: raw.pubkey, data: decoded.data };
2732
+ });
2733
+ }
2734
+
2735
+ // src/plugin.ts
2736
+ import {
2737
+ AccountRole,
2738
+ pipe
2739
+ } from "@solana/kit";
2740
+ import { addSelfPlanAndSendFunctions as addSelfPlanAndSendFunctions2 } from "@solana/program-client-core";
2741
+ import { findAssociatedTokenPda } from "@solana-program/token";
2742
+
2743
+ // src/validators.ts
2744
+ var textEncoder = new TextEncoder();
2745
+ var ValidationError = class extends Error {
2746
+ constructor(message) {
2747
+ super(message);
2748
+ this.name = "ValidationError";
2749
+ }
2750
+ };
2751
+ function assertPositive(value, name) {
2752
+ if (BigInt(value) <= 0n) throw new ValidationError(`${name} must be greater than zero`);
2753
+ }
2754
+ function assertMetadataUri(metadataUri) {
2755
+ if (textEncoder.encode(metadataUri).length > METADATA_URI_LEN)
2756
+ throw new ValidationError(`metadataUri exceeds ${METADATA_URI_LEN} bytes`);
2757
+ }
2758
+ function assertMaxLen(arr, max, name) {
2759
+ if (arr.length > max) throw new ValidationError(`${name} must have at most ${max} entries`);
2760
+ }
2761
+ function padAddresses(addresses, maxLen) {
2762
+ return Array.from({ length: maxLen }, (_, i) => addresses[i] ?? ZERO_ADDRESS);
2763
+ }
2764
+ function padPlanDestinations(addresses) {
2765
+ assertMaxLen(addresses, MAX_PLAN_DESTINATIONS, "destinations");
2766
+ return padAddresses(addresses, MAX_PLAN_DESTINATIONS);
2767
+ }
2768
+ function padPlanPullers(addresses) {
2769
+ assertMaxLen(addresses, MAX_PLAN_PULLERS, "pullers");
2770
+ return padAddresses(addresses, MAX_PLAN_PULLERS);
2771
+ }
2772
+
2773
+ // src/plugin.ts
2774
+ function pdaConfig(programAddress) {
2775
+ return programAddress ? { programAddress } : {};
2776
+ }
2777
+ function withTrailing(instruction, trailing) {
2778
+ if (trailing.length === 0) return instruction;
2779
+ const accounts = [
2780
+ ...instruction.accounts ?? [],
2781
+ ...trailing
2782
+ ];
2783
+ return { ...instruction, accounts };
2784
+ }
2785
+ function appendPayer(instruction, payer) {
2786
+ if (!payer) return instruction;
2787
+ return withTrailing(instruction, [
2788
+ {
2789
+ address: payer.address,
2790
+ role: AccountRole.WRITABLE_SIGNER,
2791
+ signer: payer
2792
+ }
2793
+ ]);
2794
+ }
2795
+ async function getInitSubscriptionAuthorityOverlayInstructionAsync(input) {
2796
+ return appendPayer(
2797
+ await getInitSubscriptionAuthorityInstructionAsync(
2798
+ {
2799
+ owner: input.owner,
2800
+ tokenMint: input.tokenMint,
2801
+ tokenProgram: input.tokenProgram,
2802
+ userAta: input.userAta
2803
+ },
2804
+ pdaConfig(input.programAddress)
2805
+ ),
2806
+ input.payer
2807
+ );
2808
+ }
2809
+ async function getCloseSubscriptionAuthorityOverlayInstructionAsync(input) {
2810
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2811
+ { tokenMint: input.tokenMint, user: input.user.address },
2812
+ pdaConfig(input.programAddress)
2813
+ );
2814
+ let ix = getCloseSubscriptionAuthorityInstruction(
2815
+ { subscriptionAuthority, user: input.user },
2816
+ pdaConfig(input.programAddress)
2817
+ );
2818
+ if (input.receiver) {
2819
+ ix = withTrailing(ix, [{ address: input.receiver, role: AccountRole.WRITABLE }]);
2820
+ }
2821
+ return ix;
2822
+ }
2823
+ async function getCreateFixedDelegationOverlayInstructionAsync(input) {
2824
+ assertPositive(input.amount, "amount");
2825
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2826
+ { tokenMint: input.tokenMint, user: input.delegator.address },
2827
+ pdaConfig(input.programAddress)
2828
+ );
2829
+ const [delegationPda] = await findFixedDelegationPda(
2830
+ {
2831
+ delegatee: input.delegatee,
2832
+ delegator: input.delegator.address,
2833
+ nonce: input.nonce,
2834
+ subscriptionAuthority
2835
+ },
2836
+ pdaConfig(input.programAddress)
2837
+ );
2838
+ return appendPayer(
2839
+ getCreateFixedDelegationInstruction(
2840
+ {
2841
+ delegatee: input.delegatee,
2842
+ delegationAccount: delegationPda,
2843
+ delegator: input.delegator,
2844
+ fixedDelegation: {
2845
+ amount: input.amount,
2846
+ expiryTs: input.expiryTs,
2847
+ nonce: input.nonce
2848
+ },
2849
+ subscriptionAuthority
2850
+ },
2851
+ pdaConfig(input.programAddress)
2852
+ ),
2853
+ input.payer
2854
+ );
2855
+ }
2856
+ async function getCreateRecurringDelegationOverlayInstructionAsync(input) {
2857
+ assertPositive(input.amountPerPeriod, "amountPerPeriod");
2858
+ assertPositive(input.periodLengthS, "periodLengthS");
2859
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2860
+ { tokenMint: input.tokenMint, user: input.delegator.address },
2861
+ pdaConfig(input.programAddress)
2862
+ );
2863
+ const [delegationPda] = await findRecurringDelegationPda(
2864
+ {
2865
+ delegatee: input.delegatee,
2866
+ delegator: input.delegator.address,
2867
+ nonce: input.nonce,
2868
+ subscriptionAuthority
2869
+ },
2870
+ pdaConfig(input.programAddress)
2871
+ );
2872
+ return appendPayer(
2873
+ getCreateRecurringDelegationInstruction(
2874
+ {
2875
+ delegatee: input.delegatee,
2876
+ delegationAccount: delegationPda,
2877
+ delegator: input.delegator,
2878
+ recurringDelegation: {
2879
+ amountPerPeriod: input.amountPerPeriod,
2880
+ expiryTs: input.expiryTs,
2881
+ nonce: input.nonce,
2882
+ periodLengthS: input.periodLengthS,
2883
+ startTs: input.startTs
2884
+ },
2885
+ subscriptionAuthority
2886
+ },
2887
+ pdaConfig(input.programAddress)
2888
+ ),
2889
+ input.payer
2890
+ );
2891
+ }
2892
+ function getRevokeDelegationOverlayInstruction(input) {
2893
+ let ix = getRevokeDelegationInstruction(
2894
+ {
2895
+ authority: input.authority,
2896
+ delegationAccount: input.delegationAccount
2897
+ },
2898
+ pdaConfig(input.programAddress)
2899
+ );
2900
+ if (input.receiver) {
2901
+ ix = withTrailing(ix, [{ address: input.receiver, role: AccountRole.WRITABLE }]);
2902
+ }
2903
+ return ix;
2904
+ }
2905
+ function getRevokeSubscriptionOverlayInstruction(input) {
2906
+ const trailing = [{ address: input.planPda, role: AccountRole.READONLY }];
2907
+ if (input.receiver) {
2908
+ trailing.push({ address: input.receiver, role: AccountRole.WRITABLE });
2909
+ }
2910
+ return withTrailing(
2911
+ getRevokeDelegationInstruction(
2912
+ {
2913
+ authority: input.authority,
2914
+ delegationAccount: input.subscriptionPda
2915
+ },
2916
+ pdaConfig(input.programAddress)
2917
+ ),
2918
+ trailing
2919
+ );
2920
+ }
2921
+ async function getTransferDelegationOverlayInstructionAsync(input, getInstruction) {
2922
+ assertPositive(input.amount, "amount");
2923
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2924
+ { tokenMint: input.tokenMint, user: input.delegator },
2925
+ pdaConfig(input.programAddress)
2926
+ );
2927
+ return getInstruction(
2928
+ {
2929
+ delegatee: input.delegatee,
2930
+ delegationPda: input.delegationPda,
2931
+ delegatorAta: input.delegatorAta,
2932
+ receiverAta: input.receiverAta,
2933
+ subscriptionAuthority,
2934
+ tokenProgram: input.tokenProgram,
2935
+ transferData: {
2936
+ amount: input.amount,
2937
+ delegator: input.delegator,
2938
+ mint: input.tokenMint
2939
+ }
2940
+ },
2941
+ pdaConfig(input.programAddress)
2942
+ );
2943
+ }
2944
+ function getTransferFixedOverlayInstructionAsync(input) {
2945
+ return getTransferDelegationOverlayInstructionAsync(input, getTransferFixedInstruction);
2946
+ }
2947
+ function getTransferRecurringOverlayInstructionAsync(input) {
2948
+ return getTransferDelegationOverlayInstructionAsync(input, getTransferRecurringInstruction);
2949
+ }
2950
+ async function getTransferSubscriptionOverlayInstructionAsync(input) {
2951
+ assertPositive(input.amount, "amount");
2952
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2953
+ { tokenMint: input.tokenMint, user: input.delegator },
2954
+ pdaConfig(input.programAddress)
2955
+ );
2956
+ const [delegatorAta] = await findAssociatedTokenPda({
2957
+ mint: input.tokenMint,
2958
+ owner: input.delegator,
2959
+ tokenProgram: input.tokenProgram
2960
+ });
2961
+ return getTransferSubscriptionInstruction(
2962
+ {
2963
+ caller: input.caller,
2964
+ delegatorAta,
2965
+ planPda: input.planPda,
2966
+ receiverAta: input.receiverAta,
2967
+ subscriptionAuthority,
2968
+ subscriptionPda: input.subscriptionPda,
2969
+ tokenProgram: input.tokenProgram,
2970
+ transferData: {
2971
+ amount: input.amount,
2972
+ delegator: input.delegator,
2973
+ mint: input.tokenMint
2974
+ }
2975
+ },
2976
+ pdaConfig(input.programAddress)
2977
+ );
2978
+ }
2979
+ async function getCreatePlanOverlayInstructionAsync(input) {
2980
+ assertPositive(input.amount, "amount");
2981
+ assertPositive(input.periodHours, "periodHours");
2982
+ assertMetadataUri(input.metadataUri);
2983
+ const destinations = padPlanDestinations(input.destinations);
2984
+ const pullers = padPlanPullers(input.pullers);
2985
+ const [planPda] = await findPlanPda(
2986
+ { owner: input.owner.address, planId: input.planId },
2987
+ pdaConfig(input.programAddress)
2988
+ );
2989
+ return getCreatePlanInstruction(
2990
+ {
2991
+ merchant: input.owner,
2992
+ planData: {
2993
+ destinations,
2994
+ endTs: input.endTs,
2995
+ metadataUri: input.metadataUri,
2996
+ mint: input.mint,
2997
+ planId: input.planId,
2998
+ pullers,
2999
+ terms: {
3000
+ amount: input.amount,
3001
+ createdAt: 0n,
3002
+ periodHours: input.periodHours
3003
+ }
3004
+ },
3005
+ planPda,
3006
+ tokenMint: input.mint,
3007
+ tokenProgram: input.tokenProgram
3008
+ },
3009
+ pdaConfig(input.programAddress)
3010
+ );
3011
+ }
3012
+ function getUpdatePlanOverlayInstruction(input) {
3013
+ assertMetadataUri(input.metadataUri);
3014
+ const pullers = padPlanPullers(input.pullers ?? []);
3015
+ return getUpdatePlanInstruction(
3016
+ {
3017
+ owner: input.owner,
3018
+ planPda: input.planPda,
3019
+ updatePlanData: {
3020
+ endTs: input.endTs,
3021
+ metadataUri: input.metadataUri,
3022
+ pullers,
3023
+ status: input.status
3024
+ }
3025
+ },
3026
+ pdaConfig(input.programAddress)
3027
+ );
3028
+ }
3029
+ function getDeletePlanOverlayInstruction(input) {
3030
+ return getDeletePlanInstruction({ owner: input.owner, planPda: input.planPda }, pdaConfig(input.programAddress));
3031
+ }
3032
+ async function getSubscribeOverlayInstructionAsync(input) {
3033
+ if (input.expectedAmount === void 0 || input.expectedPeriodHours === void 0 || input.expectedCreatedAt === void 0) {
3034
+ throw new Error(
3035
+ "getSubscribeOverlayInstructionAsync requires expectedAmount, expectedPeriodHours, and expectedCreatedAt. Use the plugin client `subscriptions.instructions.subscribe(...)` to auto-fetch from the live plan."
3036
+ );
3037
+ }
3038
+ const [planPda, planBump] = await findPlanPda(
3039
+ { owner: input.merchant, planId: input.planId },
3040
+ pdaConfig(input.programAddress)
3041
+ );
3042
+ const [subscriptionAuthorityPda] = await findSubscriptionAuthorityPda(
3043
+ { tokenMint: input.tokenMint, user: input.subscriber.address },
3044
+ pdaConfig(input.programAddress)
3045
+ );
3046
+ return appendPayer(
3047
+ await getSubscribeInstructionAsync(
3048
+ {
3049
+ merchant: input.merchant,
3050
+ planPda,
3051
+ subscribeData: {
3052
+ expectedAmount: input.expectedAmount,
3053
+ expectedCreatedAt: input.expectedCreatedAt,
3054
+ expectedMint: input.tokenMint,
3055
+ expectedPeriodHours: input.expectedPeriodHours,
3056
+ planBump,
3057
+ planId: input.planId
3058
+ },
3059
+ subscriber: input.subscriber,
3060
+ subscriptionAuthorityPda
3061
+ },
3062
+ pdaConfig(input.programAddress)
3063
+ ),
3064
+ input.payer
3065
+ );
3066
+ }
3067
+ function getCancelSubscriptionOverlayInstructionAsync(input) {
3068
+ return getCancelSubscriptionInstructionAsync(
3069
+ {
3070
+ planPda: input.planPda,
3071
+ subscriber: input.subscriber,
3072
+ subscriptionPda: input.subscriptionPda
3073
+ },
3074
+ pdaConfig(input.programAddress)
3075
+ );
3076
+ }
3077
+ function getResumeSubscriptionOverlayInstructionAsync(input) {
3078
+ return getResumeSubscriptionInstructionAsync(
3079
+ {
3080
+ planPda: input.planPda,
3081
+ subscriber: input.subscriber,
3082
+ subscriptionPda: input.subscriptionPda
3083
+ },
3084
+ pdaConfig(input.programAddress)
3085
+ );
3086
+ }
3087
+ function subscriptionsProgram2() {
3088
+ return (client) => {
3089
+ return pipe(client, subscriptionsProgram(), (c) => {
3090
+ const queries = {
3091
+ activeDelegationSummary: async (wallet) => {
3092
+ const delegations = await fetchDelegationsByDelegator(c.rpc, wallet);
3093
+ let fixed = 0;
3094
+ let recurring = 0;
3095
+ let subscriptions = 0;
3096
+ for (const d of delegations) {
3097
+ if (d.kind === "fixed") fixed++;
3098
+ else if (d.kind === "recurring") recurring++;
3099
+ else if (d.kind === "subscription") subscriptions++;
3100
+ }
3101
+ return { fixed, recurring, subscriptions, total: delegations.length };
3102
+ },
3103
+ delegationsByDelegatee: (wallet) => fetchDelegationsByDelegatee(c.rpc, wallet),
3104
+ delegationsByDelegator: (wallet) => fetchDelegationsByDelegator(c.rpc, wallet),
3105
+ isSubscriptionAuthorityInitialized: async (user, tokenMint, programAddress) => {
3106
+ const [pda] = await findSubscriptionAuthorityPda({ tokenMint, user }, pdaConfig(programAddress));
3107
+ const account = await fetchMaybeSubscriptionAuthority(c.rpc, pda);
3108
+ return { initialized: account.exists, pda };
3109
+ },
3110
+ plansForOwner: (owner) => fetchPlansForOwner(c.rpc, owner)
3111
+ };
3112
+ const instructions = {
3113
+ cancelSubscription: (input) => addSelfPlanAndSendFunctions2(
3114
+ client,
3115
+ getCancelSubscriptionOverlayInstructionAsync({
3116
+ ...input,
3117
+ subscriber: input.subscriber ?? client.identity
3118
+ })
3119
+ ),
3120
+ closeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions2(
3121
+ client,
3122
+ getCloseSubscriptionAuthorityOverlayInstructionAsync({
3123
+ ...input,
3124
+ user: input.user ?? client.identity
3125
+ })
3126
+ ),
3127
+ createFixedDelegation: (input) => addSelfPlanAndSendFunctions2(
3128
+ client,
3129
+ getCreateFixedDelegationOverlayInstructionAsync({
3130
+ ...input,
3131
+ delegator: input.delegator ?? client.identity,
3132
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3133
+ })
3134
+ ),
3135
+ createPlan: (input) => addSelfPlanAndSendFunctions2(
3136
+ client,
3137
+ getCreatePlanOverlayInstructionAsync({
3138
+ ...input,
3139
+ owner: input.owner ?? client.identity
3140
+ })
3141
+ ),
3142
+ createRecurringDelegation: (input) => addSelfPlanAndSendFunctions2(
3143
+ client,
3144
+ getCreateRecurringDelegationOverlayInstructionAsync({
3145
+ ...input,
3146
+ delegator: input.delegator ?? client.identity,
3147
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3148
+ })
3149
+ ),
3150
+ deletePlan: (input) => addSelfPlanAndSendFunctions2(
3151
+ client,
3152
+ getDeletePlanOverlayInstruction({
3153
+ ...input,
3154
+ owner: input.owner ?? client.identity
3155
+ })
3156
+ ),
3157
+ initSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions2(
3158
+ client,
3159
+ getInitSubscriptionAuthorityOverlayInstructionAsync({
3160
+ ...input,
3161
+ owner: input.owner ?? client.identity,
3162
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3163
+ })
3164
+ ),
3165
+ resumeSubscription: (input) => addSelfPlanAndSendFunctions2(
3166
+ client,
3167
+ getResumeSubscriptionOverlayInstructionAsync({
3168
+ ...input,
3169
+ subscriber: input.subscriber ?? client.identity
3170
+ })
3171
+ ),
3172
+ revokeDelegation: (input) => addSelfPlanAndSendFunctions2(
3173
+ client,
3174
+ getRevokeDelegationOverlayInstruction({
3175
+ ...input,
3176
+ authority: input.authority ?? client.identity
3177
+ })
3178
+ ),
3179
+ revokeSubscription: (input) => addSelfPlanAndSendFunctions2(
3180
+ client,
3181
+ getRevokeSubscriptionOverlayInstruction({
3182
+ ...input,
3183
+ authority: input.authority ?? client.identity
3184
+ })
3185
+ ),
3186
+ subscribe: (input) => addSelfPlanAndSendFunctions2(
3187
+ client,
3188
+ (async () => {
3189
+ let { expectedAmount, expectedPeriodHours, expectedCreatedAt } = input;
3190
+ if (expectedAmount === void 0 || expectedPeriodHours === void 0 || expectedCreatedAt === void 0) {
3191
+ const subscriber = input.subscriber ?? client.identity;
3192
+ const [planPda] = await findPlanPda(
3193
+ { owner: input.merchant, planId: input.planId },
3194
+ pdaConfig(input.programAddress)
3195
+ );
3196
+ const plan = await fetchPlan(c.rpc, planPda);
3197
+ expectedAmount = expectedAmount ?? plan.data.data.terms.amount;
3198
+ expectedPeriodHours = expectedPeriodHours ?? plan.data.data.terms.periodHours;
3199
+ expectedCreatedAt = expectedCreatedAt ?? plan.data.data.terms.createdAt;
3200
+ return await getSubscribeOverlayInstructionAsync({
3201
+ ...input,
3202
+ expectedAmount,
3203
+ expectedCreatedAt,
3204
+ expectedPeriodHours,
3205
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer),
3206
+ subscriber
3207
+ });
3208
+ }
3209
+ return await getSubscribeOverlayInstructionAsync({
3210
+ ...input,
3211
+ expectedAmount,
3212
+ expectedCreatedAt,
3213
+ expectedPeriodHours,
3214
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer),
3215
+ subscriber: input.subscriber ?? client.identity
3216
+ });
3217
+ })()
3218
+ ),
3219
+ transferFixed: (input) => addSelfPlanAndSendFunctions2(
3220
+ client,
3221
+ getTransferFixedOverlayInstructionAsync({
3222
+ ...input,
3223
+ delegatee: input.delegatee ?? client.identity
3224
+ })
3225
+ ),
3226
+ transferRecurring: (input) => addSelfPlanAndSendFunctions2(
3227
+ client,
3228
+ getTransferRecurringOverlayInstructionAsync({
3229
+ ...input,
3230
+ delegatee: input.delegatee ?? client.identity
3231
+ })
3232
+ ),
3233
+ transferSubscription: (input) => addSelfPlanAndSendFunctions2(
3234
+ client,
3235
+ getTransferSubscriptionOverlayInstructionAsync({
3236
+ ...input,
3237
+ caller: input.caller ?? client.identity
3238
+ })
3239
+ ),
3240
+ updatePlan: (input) => addSelfPlanAndSendFunctions2(
3241
+ client,
3242
+ getUpdatePlanOverlayInstruction({
3243
+ ...input,
3244
+ owner: input.owner ?? client.identity
3245
+ })
3246
+ )
3247
+ };
3248
+ return {
3249
+ ...c,
3250
+ subscriptions: {
3251
+ ...c.subscriptions,
3252
+ instructions,
3253
+ queries
3254
+ }
3255
+ };
3256
+ });
3257
+ };
3258
+ }
3259
+ export {
3260
+ AccountDiscriminator,
3261
+ CANCEL_SUBSCRIPTION_DISCRIMINATOR,
3262
+ CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
3263
+ CREATE_FIXED_DELEGATION_DISCRIMINATOR,
3264
+ CREATE_PLAN_DISCRIMINATOR,
3265
+ CREATE_RECURRING_DELEGATION_DISCRIMINATOR,
3266
+ CURRENT_PROGRAM_VERSION,
3267
+ DELEGATEE_OFFSET,
3268
+ DELEGATION_SEED,
3269
+ DELEGATOR_OFFSET,
3270
+ DELETE_PLAN_DISCRIMINATOR,
3271
+ DISCRIMINATOR_OFFSET,
3272
+ EVENT_AUTHORITY_SEED,
3273
+ INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
3274
+ MAX_PLAN_DESTINATIONS,
3275
+ MAX_PLAN_PULLERS,
3276
+ METADATA_URI_LEN,
3277
+ PLAN_OWNER_OFFSET,
3278
+ PLAN_SEED,
3279
+ PLAN_SIZE,
3280
+ PROGRAM_ID,
3281
+ PlanStatus,
3282
+ RESUME_SUBSCRIPTION_DISCRIMINATOR,
3283
+ REVOKE_DELEGATION_DISCRIMINATOR,
3284
+ SUBSCRIBE_DISCRIMINATOR,
3285
+ SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
3286
+ SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED,
3287
+ SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_LIMIT,
3288
+ SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_PERIOD_LIMIT,
3289
+ SUBSCRIPTIONS_ERROR__ARITHMETIC_OVERFLOW,
3290
+ SUBSCRIPTIONS_ERROR__ARITHMETIC_UNDERFLOW,
3291
+ SUBSCRIPTIONS_ERROR__ATA_OWNER_MISMATCH,
3292
+ SUBSCRIPTIONS_ERROR__DELEGATION_ALREADY_EXISTS,
3293
+ SUBSCRIPTIONS_ERROR__DELEGATION_EXPIRED,
3294
+ SUBSCRIPTIONS_ERROR__DELEGATION_NOT_STARTED,
3295
+ SUBSCRIPTIONS_ERROR__DELEGATION_VERSION_MISMATCH,
3296
+ SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_AMOUNT_ZERO,
3297
+ SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_EXPIRY_IN_PAST,
3298
+ SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DATA,
3299
+ SUBSCRIPTIONS_ERROR__INVALID_ACCOUNT_DISCRIMINATOR,
3300
+ SUBSCRIPTIONS_ERROR__INVALID_ADDRESS,
3301
+ SUBSCRIPTIONS_ERROR__INVALID_AMOUNT,
3302
+ SUBSCRIPTIONS_ERROR__INVALID_ASSOCIATED_TOKEN_ACCOUNT_DERIVED_ADDRESS,
3303
+ SUBSCRIPTIONS_ERROR__INVALID_DELEGATE_PDA,
3304
+ SUBSCRIPTIONS_ERROR__INVALID_END_TS,
3305
+ SUBSCRIPTIONS_ERROR__INVALID_ESCROW_PDA,
3306
+ SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY,
3307
+ SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA,
3308
+ SUBSCRIPTIONS_ERROR__INVALID_EVENT_DISCRIMINATOR,
3309
+ SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG,
3310
+ SUBSCRIPTIONS_ERROR__INVALID_HEADER_DATA,
3311
+ SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION,
3312
+ SUBSCRIPTIONS_ERROR__INVALID_INSTRUCTION_DATA,
3313
+ SUBSCRIPTIONS_ERROR__INVALID_NUM_DESTINATIONS,
3314
+ SUBSCRIPTIONS_ERROR__INVALID_PAYER_DATA,
3315
+ SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH,
3316
+ SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA,
3317
+ SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS,
3318
+ SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA,
3319
+ SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA,
3320
+ SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA,
3321
+ SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_TOKEN_ACCOUNT_DATA,
3322
+ SUBSCRIPTIONS_ERROR__INVALID_TOKEN_PROGRAM,
3323
+ SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_MINT_ACCOUNT_DATA,
3324
+ SUBSCRIPTIONS_ERROR__INVALID_TOKEN_SPL_TOKEN_ACCOUNT_DATA,
3325
+ SUBSCRIPTIONS_ERROR__MIGRATION_REQUIRED,
3326
+ SUBSCRIPTIONS_ERROR__MINT_HAS_CONFIDENTIAL_TRANSFER,
3327
+ SUBSCRIPTIONS_ERROR__MINT_HAS_MINT_CLOSE_AUTHORITY,
3328
+ SUBSCRIPTIONS_ERROR__MINT_HAS_NON_TRANSFERABLE,
3329
+ SUBSCRIPTIONS_ERROR__MINT_HAS_PAUSABLE,
3330
+ SUBSCRIPTIONS_ERROR__MINT_HAS_PERMANENT_DELEGATE,
3331
+ SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_FEE,
3332
+ SUBSCRIPTIONS_ERROR__MINT_HAS_TRANSFER_HOOK,
3333
+ SUBSCRIPTIONS_ERROR__MINT_MISMATCH,
3334
+ SUBSCRIPTIONS_ERROR__NOT_ENOUGH_ACCOUNT_KEYS,
3335
+ SUBSCRIPTIONS_ERROR__NOT_PLAN_OWNER,
3336
+ SUBSCRIPTIONS_ERROR__NOT_SIGNER,
3337
+ SUBSCRIPTIONS_ERROR__NOT_SYSTEM_PROGRAM,
3338
+ SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED,
3339
+ SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS,
3340
+ SUBSCRIPTIONS_ERROR__PLAN_CLOSED,
3341
+ SUBSCRIPTIONS_ERROR__PLAN_EXPIRED,
3342
+ SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET,
3343
+ SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED,
3344
+ SUBSCRIPTIONS_ERROR__PLAN_SUNSET,
3345
+ SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH,
3346
+ SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_AMOUNT_ZERO,
3347
+ SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_GREATER_THAN_EXPIRY,
3348
+ SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_IN_PAST,
3349
+ SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY,
3350
+ SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED,
3351
+ SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED,
3352
+ SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED,
3353
+ SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH,
3354
+ SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS,
3355
+ SUBSCRIPTIONS_ERROR__UNAUTHORIZED,
3356
+ SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION,
3357
+ SUBSCRIPTIONS_PROGRAM_ADDRESS,
3358
+ SUBSCRIPTION_AUTHORITY_SEED,
3359
+ SUBSCRIPTION_SEED,
3360
+ SUBSCRIPTION_SIZE,
3361
+ SubscriptionsAccount,
3362
+ SubscriptionsInstruction,
3363
+ TRANSFER_FIXED_DISCRIMINATOR,
3364
+ TRANSFER_RECURRING_DISCRIMINATOR,
3365
+ TRANSFER_SUBSCRIPTION_DISCRIMINATOR,
3366
+ U64_BYTE_SIZE,
3367
+ UPDATE_PLAN_DISCRIMINATOR,
3368
+ ValidationError,
3369
+ ZERO_ADDRESS,
3370
+ decodeDelegationAccount,
3371
+ decodeEventAuthority,
3372
+ decodeFixedDelegation,
3373
+ decodePlan,
3374
+ decodeRecurringDelegation,
3375
+ decodeSubscriptionAuthority,
3376
+ decodeSubscriptionDelegation,
3377
+ fetchAllEventAuthority,
3378
+ fetchAllFixedDelegation,
3379
+ fetchAllMaybeEventAuthority,
3380
+ fetchAllMaybeFixedDelegation,
3381
+ fetchAllMaybePlan,
3382
+ fetchAllMaybeRecurringDelegation,
3383
+ fetchAllMaybeSubscriptionAuthority,
3384
+ fetchAllMaybeSubscriptionDelegation,
3385
+ fetchAllPlan,
3386
+ fetchAllRecurringDelegation,
3387
+ fetchAllSubscriptionAuthority,
3388
+ fetchAllSubscriptionDelegation,
3389
+ fetchDelegationsByDelegatee,
3390
+ fetchDelegationsByDelegator,
3391
+ fetchEventAuthority,
3392
+ fetchEventAuthorityFromSeeds,
3393
+ fetchFixedDelegation,
3394
+ fetchFixedDelegationFromSeeds,
3395
+ fetchMaybeEventAuthority,
3396
+ fetchMaybeEventAuthorityFromSeeds,
3397
+ fetchMaybeFixedDelegation,
3398
+ fetchMaybeFixedDelegationFromSeeds,
3399
+ fetchMaybePlan,
3400
+ fetchMaybePlanFromSeeds,
3401
+ fetchMaybeRecurringDelegation,
3402
+ fetchMaybeRecurringDelegationFromSeeds,
3403
+ fetchMaybeSubscriptionAuthority,
3404
+ fetchMaybeSubscriptionAuthorityFromSeeds,
3405
+ fetchMaybeSubscriptionDelegation,
3406
+ fetchMaybeSubscriptionDelegationFromSeeds,
3407
+ fetchPlan,
3408
+ fetchPlanFromSeeds,
3409
+ fetchPlansForOwner,
3410
+ fetchRecurringDelegation,
3411
+ fetchRecurringDelegationFromSeeds,
3412
+ fetchSubscriptionAuthority,
3413
+ fetchSubscriptionAuthorityFromSeeds,
3414
+ fetchSubscriptionDelegation,
3415
+ fetchSubscriptionDelegationFromSeeds,
3416
+ fetchSubscriptionsForUser,
3417
+ findEventAuthorityPda,
3418
+ findFixedDelegationPda,
3419
+ findPlanPda,
3420
+ findRecurringDelegationPda,
3421
+ findSubscriptionAuthorityPda,
3422
+ findSubscriptionDelegationPda,
3423
+ getAccountDiscriminatorCodec,
3424
+ getAccountDiscriminatorDecoder,
3425
+ getAccountDiscriminatorEncoder,
3426
+ getCancelSubscriptionDiscriminatorBytes,
3427
+ getCancelSubscriptionInstruction,
3428
+ getCancelSubscriptionInstructionAsync,
3429
+ getCancelSubscriptionInstructionDataCodec,
3430
+ getCancelSubscriptionInstructionDataDecoder,
3431
+ getCancelSubscriptionInstructionDataEncoder,
3432
+ getCancelSubscriptionOverlayInstructionAsync,
3433
+ getCloseSubscriptionAuthorityDiscriminatorBytes,
3434
+ getCloseSubscriptionAuthorityInstruction,
3435
+ getCloseSubscriptionAuthorityInstructionDataCodec,
3436
+ getCloseSubscriptionAuthorityInstructionDataDecoder,
3437
+ getCloseSubscriptionAuthorityInstructionDataEncoder,
3438
+ getCloseSubscriptionAuthorityOverlayInstructionAsync,
3439
+ getCreateFixedDelegationDataCodec,
3440
+ getCreateFixedDelegationDataDecoder,
3441
+ getCreateFixedDelegationDataEncoder,
3442
+ getCreateFixedDelegationDiscriminatorBytes,
3443
+ getCreateFixedDelegationInstruction,
3444
+ getCreateFixedDelegationInstructionDataCodec,
3445
+ getCreateFixedDelegationInstructionDataDecoder,
3446
+ getCreateFixedDelegationInstructionDataEncoder,
3447
+ getCreateFixedDelegationOverlayInstructionAsync,
3448
+ getCreatePlanDiscriminatorBytes,
3449
+ getCreatePlanInstruction,
3450
+ getCreatePlanInstructionDataCodec,
3451
+ getCreatePlanInstructionDataDecoder,
3452
+ getCreatePlanInstructionDataEncoder,
3453
+ getCreatePlanOverlayInstructionAsync,
3454
+ getCreateRecurringDelegationDataCodec,
3455
+ getCreateRecurringDelegationDataDecoder,
3456
+ getCreateRecurringDelegationDataEncoder,
3457
+ getCreateRecurringDelegationDiscriminatorBytes,
3458
+ getCreateRecurringDelegationInstruction,
3459
+ getCreateRecurringDelegationInstructionDataCodec,
3460
+ getCreateRecurringDelegationInstructionDataDecoder,
3461
+ getCreateRecurringDelegationInstructionDataEncoder,
3462
+ getCreateRecurringDelegationOverlayInstructionAsync,
3463
+ getDeletePlanDiscriminatorBytes,
3464
+ getDeletePlanInstruction,
3465
+ getDeletePlanInstructionDataCodec,
3466
+ getDeletePlanInstructionDataDecoder,
3467
+ getDeletePlanInstructionDataEncoder,
3468
+ getDeletePlanOverlayInstruction,
3469
+ getEventAuthorityCodec,
3470
+ getEventAuthorityDecoder,
3471
+ getEventAuthorityEncoder,
3472
+ getFixedDelegationCodec,
3473
+ getFixedDelegationDecoder,
3474
+ getFixedDelegationEncoder,
3475
+ getHeaderCodec,
3476
+ getHeaderDecoder,
3477
+ getHeaderEncoder,
3478
+ getInitSubscriptionAuthorityDiscriminatorBytes,
3479
+ getInitSubscriptionAuthorityInstruction,
3480
+ getInitSubscriptionAuthorityInstructionAsync,
3481
+ getInitSubscriptionAuthorityInstructionDataCodec,
3482
+ getInitSubscriptionAuthorityInstructionDataDecoder,
3483
+ getInitSubscriptionAuthorityInstructionDataEncoder,
3484
+ getInitSubscriptionAuthorityOverlayInstructionAsync,
3485
+ getPlanCodec,
3486
+ getPlanDataCodec,
3487
+ getPlanDataDecoder,
3488
+ getPlanDataEncoder,
3489
+ getPlanDecoder,
3490
+ getPlanEncoder,
3491
+ getPlanStatusCodec,
3492
+ getPlanStatusDecoder,
3493
+ getPlanStatusEncoder,
3494
+ getPlanTermsCodec,
3495
+ getPlanTermsDecoder,
3496
+ getPlanTermsEncoder,
3497
+ getRecurringDelegationCodec,
3498
+ getRecurringDelegationDecoder,
3499
+ getRecurringDelegationEncoder,
3500
+ getResumeSubscriptionDiscriminatorBytes,
3501
+ getResumeSubscriptionInstruction,
3502
+ getResumeSubscriptionInstructionAsync,
3503
+ getResumeSubscriptionInstructionDataCodec,
3504
+ getResumeSubscriptionInstructionDataDecoder,
3505
+ getResumeSubscriptionInstructionDataEncoder,
3506
+ getResumeSubscriptionOverlayInstructionAsync,
3507
+ getRevokeDelegationDiscriminatorBytes,
3508
+ getRevokeDelegationInstruction,
3509
+ getRevokeDelegationInstructionDataCodec,
3510
+ getRevokeDelegationInstructionDataDecoder,
3511
+ getRevokeDelegationInstructionDataEncoder,
3512
+ getRevokeDelegationOverlayInstruction,
3513
+ getRevokeSubscriptionOverlayInstruction,
3514
+ getSubscribeDataCodec,
3515
+ getSubscribeDataDecoder,
3516
+ getSubscribeDataEncoder,
3517
+ getSubscribeDiscriminatorBytes,
3518
+ getSubscribeInstruction,
3519
+ getSubscribeInstructionAsync,
3520
+ getSubscribeInstructionDataCodec,
3521
+ getSubscribeInstructionDataDecoder,
3522
+ getSubscribeInstructionDataEncoder,
3523
+ getSubscribeOverlayInstructionAsync,
3524
+ getSubscriptionAuthorityCodec,
3525
+ getSubscriptionAuthorityDecoder,
3526
+ getSubscriptionAuthorityEncoder,
3527
+ getSubscriptionDelegationCodec,
3528
+ getSubscriptionDelegationDecoder,
3529
+ getSubscriptionDelegationEncoder,
3530
+ getSubscriptionsErrorMessage,
3531
+ getTransferDataCodec,
3532
+ getTransferDataDecoder,
3533
+ getTransferDataEncoder,
3534
+ getTransferFixedDiscriminatorBytes,
3535
+ getTransferFixedInstruction,
3536
+ getTransferFixedInstructionDataCodec,
3537
+ getTransferFixedInstructionDataDecoder,
3538
+ getTransferFixedInstructionDataEncoder,
3539
+ getTransferFixedOverlayInstructionAsync,
3540
+ getTransferRecurringDiscriminatorBytes,
3541
+ getTransferRecurringInstruction,
3542
+ getTransferRecurringInstructionDataCodec,
3543
+ getTransferRecurringInstructionDataDecoder,
3544
+ getTransferRecurringInstructionDataEncoder,
3545
+ getTransferRecurringOverlayInstructionAsync,
3546
+ getTransferSubscriptionDiscriminatorBytes,
3547
+ getTransferSubscriptionInstruction,
3548
+ getTransferSubscriptionInstructionDataCodec,
3549
+ getTransferSubscriptionInstructionDataDecoder,
3550
+ getTransferSubscriptionInstructionDataEncoder,
3551
+ getTransferSubscriptionOverlayInstructionAsync,
3552
+ getUpdatePlanDataCodec,
3553
+ getUpdatePlanDataDecoder,
3554
+ getUpdatePlanDataEncoder,
3555
+ getUpdatePlanDiscriminatorBytes,
3556
+ getUpdatePlanInstruction,
3557
+ getUpdatePlanInstructionDataCodec,
3558
+ getUpdatePlanInstructionDataDecoder,
3559
+ getUpdatePlanInstructionDataEncoder,
3560
+ getUpdatePlanOverlayInstruction,
3561
+ identifySubscriptionsInstruction,
3562
+ isSubscriptionsError,
3563
+ parseCancelSubscriptionInstruction,
3564
+ parseCloseSubscriptionAuthorityInstruction,
3565
+ parseCreateFixedDelegationInstruction,
3566
+ parseCreatePlanInstruction,
3567
+ parseCreateRecurringDelegationInstruction,
3568
+ parseDeletePlanInstruction,
3569
+ parseInitSubscriptionAuthorityInstruction,
3570
+ parseResumeSubscriptionInstruction,
3571
+ parseRevokeDelegationInstruction,
3572
+ parseSubscribeInstruction,
3573
+ parseSubscriptionsInstruction,
3574
+ parseTransferFixedInstruction,
3575
+ parseTransferRecurringInstruction,
3576
+ parseTransferSubscriptionInstruction,
3577
+ parseUpdatePlanInstruction,
3578
+ subscriptionsProgram2 as subscriptionsProgram,
3579
+ toEncodedAccount
3580
+ };
3581
+ //# sourceMappingURL=index.js.map