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