@solana/subscriptions 0.4.0 → 0.5.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/dist/index.cjs +832 -551
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -17
- package/dist/index.d.ts +197 -17
- package/dist/index.js +811 -522
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -175,16 +175,16 @@ async function fetchMaybeEventAuthorityFromSeeds(rpc, config = {}) {
|
|
|
175
175
|
import {
|
|
176
176
|
assertAccountExists as assertAccountExists2,
|
|
177
177
|
assertAccountsExist as assertAccountsExist2,
|
|
178
|
-
combineCodec as
|
|
178
|
+
combineCodec as combineCodec14,
|
|
179
179
|
decodeAccount as decodeAccount2,
|
|
180
180
|
fetchEncodedAccount as fetchEncodedAccount2,
|
|
181
181
|
fetchEncodedAccounts as fetchEncodedAccounts2,
|
|
182
182
|
getAddressDecoder as getAddressDecoder6,
|
|
183
183
|
getAddressEncoder as getAddressEncoder11,
|
|
184
|
-
getI64Decoder as
|
|
185
|
-
getI64Encoder as
|
|
186
|
-
getStructDecoder as
|
|
187
|
-
getStructEncoder as
|
|
184
|
+
getI64Decoder as getI64Decoder10,
|
|
185
|
+
getI64Encoder as getI64Encoder10,
|
|
186
|
+
getStructDecoder as getStructDecoder12,
|
|
187
|
+
getStructEncoder as getStructEncoder12,
|
|
188
188
|
getU64Decoder as getU64Decoder7,
|
|
189
189
|
getU64Encoder as getU64Encoder10
|
|
190
190
|
} from "@solana/kit";
|
|
@@ -213,155 +213,173 @@ function getAccountDiscriminatorCodec() {
|
|
|
213
213
|
return combineCodec2(getAccountDiscriminatorEncoder(), getAccountDiscriminatorDecoder());
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
// src/generated/types/
|
|
216
|
+
// src/generated/types/cancelSubscriptionNowData.ts
|
|
217
217
|
import {
|
|
218
218
|
combineCodec as combineCodec3,
|
|
219
219
|
getI64Decoder,
|
|
220
220
|
getI64Encoder,
|
|
221
221
|
getStructDecoder as getStructDecoder2,
|
|
222
|
-
getStructEncoder as getStructEncoder2
|
|
222
|
+
getStructEncoder as getStructEncoder2
|
|
223
|
+
} from "@solana/kit";
|
|
224
|
+
function getCancelSubscriptionNowDataEncoder() {
|
|
225
|
+
return getStructEncoder2([["expectedCurrentPeriodStartTs", getI64Encoder()]]);
|
|
226
|
+
}
|
|
227
|
+
function getCancelSubscriptionNowDataDecoder() {
|
|
228
|
+
return getStructDecoder2([["expectedCurrentPeriodStartTs", getI64Decoder()]]);
|
|
229
|
+
}
|
|
230
|
+
function getCancelSubscriptionNowDataCodec() {
|
|
231
|
+
return combineCodec3(getCancelSubscriptionNowDataEncoder(), getCancelSubscriptionNowDataDecoder());
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/generated/types/createFixedDelegationData.ts
|
|
235
|
+
import {
|
|
236
|
+
combineCodec as combineCodec4,
|
|
237
|
+
getI64Decoder as getI64Decoder2,
|
|
238
|
+
getI64Encoder as getI64Encoder2,
|
|
239
|
+
getStructDecoder as getStructDecoder3,
|
|
240
|
+
getStructEncoder as getStructEncoder3,
|
|
223
241
|
getU64Decoder,
|
|
224
242
|
getU64Encoder as getU64Encoder4
|
|
225
243
|
} from "@solana/kit";
|
|
226
244
|
function getCreateFixedDelegationDataEncoder() {
|
|
227
|
-
return
|
|
245
|
+
return getStructEncoder3([
|
|
228
246
|
["nonce", getU64Encoder4()],
|
|
229
247
|
["amount", getU64Encoder4()],
|
|
230
|
-
["expiryTs",
|
|
231
|
-
["expectedSubscriptionAuthorityInitId",
|
|
248
|
+
["expiryTs", getI64Encoder2()],
|
|
249
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder2()]
|
|
232
250
|
]);
|
|
233
251
|
}
|
|
234
252
|
function getCreateFixedDelegationDataDecoder() {
|
|
235
|
-
return
|
|
253
|
+
return getStructDecoder3([
|
|
236
254
|
["nonce", getU64Decoder()],
|
|
237
255
|
["amount", getU64Decoder()],
|
|
238
|
-
["expiryTs",
|
|
239
|
-
["expectedSubscriptionAuthorityInitId",
|
|
256
|
+
["expiryTs", getI64Decoder2()],
|
|
257
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder2()]
|
|
240
258
|
]);
|
|
241
259
|
}
|
|
242
260
|
function getCreateFixedDelegationDataCodec() {
|
|
243
|
-
return
|
|
261
|
+
return combineCodec4(getCreateFixedDelegationDataEncoder(), getCreateFixedDelegationDataDecoder());
|
|
244
262
|
}
|
|
245
263
|
|
|
246
264
|
// src/generated/types/createRecurringDelegationData.ts
|
|
247
265
|
import {
|
|
248
|
-
combineCodec as
|
|
249
|
-
getI64Decoder as
|
|
250
|
-
getI64Encoder as
|
|
251
|
-
getStructDecoder as
|
|
252
|
-
getStructEncoder as
|
|
266
|
+
combineCodec as combineCodec5,
|
|
267
|
+
getI64Decoder as getI64Decoder3,
|
|
268
|
+
getI64Encoder as getI64Encoder3,
|
|
269
|
+
getStructDecoder as getStructDecoder4,
|
|
270
|
+
getStructEncoder as getStructEncoder4,
|
|
253
271
|
getU64Decoder as getU64Decoder2,
|
|
254
272
|
getU64Encoder as getU64Encoder5
|
|
255
273
|
} from "@solana/kit";
|
|
256
274
|
function getCreateRecurringDelegationDataEncoder() {
|
|
257
|
-
return
|
|
275
|
+
return getStructEncoder4([
|
|
258
276
|
["nonce", getU64Encoder5()],
|
|
259
277
|
["amountPerPeriod", getU64Encoder5()],
|
|
260
278
|
["periodLengthS", getU64Encoder5()],
|
|
261
|
-
["startTs",
|
|
262
|
-
["expiryTs",
|
|
263
|
-
["expectedSubscriptionAuthorityInitId",
|
|
279
|
+
["startTs", getI64Encoder3()],
|
|
280
|
+
["expiryTs", getI64Encoder3()],
|
|
281
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder3()]
|
|
264
282
|
]);
|
|
265
283
|
}
|
|
266
284
|
function getCreateRecurringDelegationDataDecoder() {
|
|
267
|
-
return
|
|
285
|
+
return getStructDecoder4([
|
|
268
286
|
["nonce", getU64Decoder2()],
|
|
269
287
|
["amountPerPeriod", getU64Decoder2()],
|
|
270
288
|
["periodLengthS", getU64Decoder2()],
|
|
271
|
-
["startTs",
|
|
272
|
-
["expiryTs",
|
|
273
|
-
["expectedSubscriptionAuthorityInitId",
|
|
289
|
+
["startTs", getI64Decoder3()],
|
|
290
|
+
["expiryTs", getI64Decoder3()],
|
|
291
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder3()]
|
|
274
292
|
]);
|
|
275
293
|
}
|
|
276
294
|
function getCreateRecurringDelegationDataCodec() {
|
|
277
|
-
return
|
|
295
|
+
return combineCodec5(getCreateRecurringDelegationDataEncoder(), getCreateRecurringDelegationDataDecoder());
|
|
278
296
|
}
|
|
279
297
|
|
|
280
298
|
// src/generated/types/header.ts
|
|
281
299
|
import {
|
|
282
|
-
combineCodec as
|
|
300
|
+
combineCodec as combineCodec6,
|
|
283
301
|
getAddressDecoder,
|
|
284
302
|
getAddressEncoder as getAddressEncoder6,
|
|
285
|
-
getI64Decoder as
|
|
286
|
-
getI64Encoder as
|
|
287
|
-
getStructDecoder as
|
|
288
|
-
getStructEncoder as
|
|
303
|
+
getI64Decoder as getI64Decoder4,
|
|
304
|
+
getI64Encoder as getI64Encoder4,
|
|
305
|
+
getStructDecoder as getStructDecoder5,
|
|
306
|
+
getStructEncoder as getStructEncoder5,
|
|
289
307
|
getU8Decoder,
|
|
290
308
|
getU8Encoder
|
|
291
309
|
} from "@solana/kit";
|
|
292
310
|
function getHeaderEncoder() {
|
|
293
|
-
return
|
|
311
|
+
return getStructEncoder5([
|
|
294
312
|
["discriminator", getU8Encoder()],
|
|
295
313
|
["version", getU8Encoder()],
|
|
296
314
|
["bump", getU8Encoder()],
|
|
297
315
|
["delegator", getAddressEncoder6()],
|
|
298
316
|
["delegatee", getAddressEncoder6()],
|
|
299
317
|
["payer", getAddressEncoder6()],
|
|
300
|
-
["initId",
|
|
318
|
+
["initId", getI64Encoder4()]
|
|
301
319
|
]);
|
|
302
320
|
}
|
|
303
321
|
function getHeaderDecoder() {
|
|
304
|
-
return
|
|
322
|
+
return getStructDecoder5([
|
|
305
323
|
["discriminator", getU8Decoder()],
|
|
306
324
|
["version", getU8Decoder()],
|
|
307
325
|
["bump", getU8Decoder()],
|
|
308
326
|
["delegator", getAddressDecoder()],
|
|
309
327
|
["delegatee", getAddressDecoder()],
|
|
310
328
|
["payer", getAddressDecoder()],
|
|
311
|
-
["initId",
|
|
329
|
+
["initId", getI64Decoder4()]
|
|
312
330
|
]);
|
|
313
331
|
}
|
|
314
332
|
function getHeaderCodec() {
|
|
315
|
-
return
|
|
333
|
+
return combineCodec6(getHeaderEncoder(), getHeaderDecoder());
|
|
316
334
|
}
|
|
317
335
|
|
|
318
336
|
// src/generated/types/planData.ts
|
|
319
337
|
import {
|
|
320
|
-
combineCodec as
|
|
338
|
+
combineCodec as combineCodec7,
|
|
321
339
|
fixDecoderSize,
|
|
322
340
|
fixEncoderSize,
|
|
323
341
|
getAddressDecoder as getAddressDecoder2,
|
|
324
342
|
getAddressEncoder as getAddressEncoder7,
|
|
325
343
|
getArrayDecoder,
|
|
326
344
|
getArrayEncoder,
|
|
327
|
-
getI64Decoder as
|
|
328
|
-
getI64Encoder as
|
|
329
|
-
getStructDecoder as
|
|
330
|
-
getStructEncoder as
|
|
345
|
+
getI64Decoder as getI64Decoder5,
|
|
346
|
+
getI64Encoder as getI64Encoder5,
|
|
347
|
+
getStructDecoder as getStructDecoder6,
|
|
348
|
+
getStructEncoder as getStructEncoder6,
|
|
331
349
|
getU64Decoder as getU64Decoder3,
|
|
332
350
|
getU64Encoder as getU64Encoder6,
|
|
333
351
|
getUtf8Decoder,
|
|
334
352
|
getUtf8Encoder as getUtf8Encoder7
|
|
335
353
|
} from "@solana/kit";
|
|
336
354
|
function getPlanDataEncoder() {
|
|
337
|
-
return
|
|
355
|
+
return getStructEncoder6([
|
|
338
356
|
["planId", getU64Encoder6()],
|
|
339
357
|
["mint", getAddressEncoder7()],
|
|
340
358
|
["terms", getPlanTermsEncoder()],
|
|
341
|
-
["endTs",
|
|
359
|
+
["endTs", getI64Encoder5()],
|
|
342
360
|
["destinations", getArrayEncoder(getAddressEncoder7(), { size: 4 })],
|
|
343
361
|
["pullers", getArrayEncoder(getAddressEncoder7(), { size: 4 })],
|
|
344
362
|
["metadataUri", fixEncoderSize(getUtf8Encoder7(), 128)]
|
|
345
363
|
]);
|
|
346
364
|
}
|
|
347
365
|
function getPlanDataDecoder() {
|
|
348
|
-
return
|
|
366
|
+
return getStructDecoder6([
|
|
349
367
|
["planId", getU64Decoder3()],
|
|
350
368
|
["mint", getAddressDecoder2()],
|
|
351
369
|
["terms", getPlanTermsDecoder()],
|
|
352
|
-
["endTs",
|
|
370
|
+
["endTs", getI64Decoder5()],
|
|
353
371
|
["destinations", getArrayDecoder(getAddressDecoder2(), { size: 4 })],
|
|
354
372
|
["pullers", getArrayDecoder(getAddressDecoder2(), { size: 4 })],
|
|
355
373
|
["metadataUri", fixDecoderSize(getUtf8Decoder(), 128)]
|
|
356
374
|
]);
|
|
357
375
|
}
|
|
358
376
|
function getPlanDataCodec() {
|
|
359
|
-
return
|
|
377
|
+
return combineCodec7(getPlanDataEncoder(), getPlanDataDecoder());
|
|
360
378
|
}
|
|
361
379
|
|
|
362
380
|
// src/generated/types/planStatus.ts
|
|
363
381
|
import {
|
|
364
|
-
combineCodec as
|
|
382
|
+
combineCodec as combineCodec8,
|
|
365
383
|
getEnumDecoder as getEnumDecoder2,
|
|
366
384
|
getEnumEncoder as getEnumEncoder2
|
|
367
385
|
} from "@solana/kit";
|
|
@@ -377,164 +395,190 @@ function getPlanStatusDecoder() {
|
|
|
377
395
|
return getEnumDecoder2(PlanStatus);
|
|
378
396
|
}
|
|
379
397
|
function getPlanStatusCodec() {
|
|
380
|
-
return
|
|
398
|
+
return combineCodec8(getPlanStatusEncoder(), getPlanStatusDecoder());
|
|
381
399
|
}
|
|
382
400
|
|
|
383
401
|
// src/generated/types/planTerms.ts
|
|
384
402
|
import {
|
|
385
|
-
combineCodec as
|
|
386
|
-
getI64Decoder as
|
|
387
|
-
getI64Encoder as
|
|
388
|
-
getStructDecoder as
|
|
389
|
-
getStructEncoder as
|
|
403
|
+
combineCodec as combineCodec9,
|
|
404
|
+
getI64Decoder as getI64Decoder6,
|
|
405
|
+
getI64Encoder as getI64Encoder6,
|
|
406
|
+
getStructDecoder as getStructDecoder7,
|
|
407
|
+
getStructEncoder as getStructEncoder7,
|
|
390
408
|
getU64Decoder as getU64Decoder4,
|
|
391
409
|
getU64Encoder as getU64Encoder7
|
|
392
410
|
} from "@solana/kit";
|
|
393
411
|
function getPlanTermsEncoder() {
|
|
394
|
-
return
|
|
412
|
+
return getStructEncoder7([
|
|
395
413
|
["amount", getU64Encoder7()],
|
|
396
414
|
["periodHours", getU64Encoder7()],
|
|
397
|
-
["createdAt",
|
|
415
|
+
["createdAt", getI64Encoder6()]
|
|
398
416
|
]);
|
|
399
417
|
}
|
|
400
418
|
function getPlanTermsDecoder() {
|
|
401
|
-
return
|
|
419
|
+
return getStructDecoder7([
|
|
402
420
|
["amount", getU64Decoder4()],
|
|
403
421
|
["periodHours", getU64Decoder4()],
|
|
404
|
-
["createdAt",
|
|
422
|
+
["createdAt", getI64Decoder6()]
|
|
405
423
|
]);
|
|
406
424
|
}
|
|
407
425
|
function getPlanTermsCodec() {
|
|
408
|
-
return
|
|
426
|
+
return combineCodec9(getPlanTermsEncoder(), getPlanTermsDecoder());
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/generated/types/resumeData.ts
|
|
430
|
+
import {
|
|
431
|
+
combineCodec as combineCodec10,
|
|
432
|
+
getI64Decoder as getI64Decoder7,
|
|
433
|
+
getI64Encoder as getI64Encoder7,
|
|
434
|
+
getStructDecoder as getStructDecoder8,
|
|
435
|
+
getStructEncoder as getStructEncoder8
|
|
436
|
+
} from "@solana/kit";
|
|
437
|
+
function getResumeDataEncoder() {
|
|
438
|
+
return getStructEncoder8([["expectedExpiresAtTs", getI64Encoder7()]]);
|
|
439
|
+
}
|
|
440
|
+
function getResumeDataDecoder() {
|
|
441
|
+
return getStructDecoder8([["expectedExpiresAtTs", getI64Decoder7()]]);
|
|
442
|
+
}
|
|
443
|
+
function getResumeDataCodec() {
|
|
444
|
+
return combineCodec10(getResumeDataEncoder(), getResumeDataDecoder());
|
|
409
445
|
}
|
|
410
446
|
|
|
411
447
|
// src/generated/types/subscribeData.ts
|
|
412
448
|
import {
|
|
413
|
-
combineCodec as
|
|
449
|
+
combineCodec as combineCodec11,
|
|
414
450
|
getAddressDecoder as getAddressDecoder3,
|
|
415
451
|
getAddressEncoder as getAddressEncoder8,
|
|
416
|
-
getI64Decoder as
|
|
417
|
-
getI64Encoder as
|
|
418
|
-
getStructDecoder as
|
|
419
|
-
getStructEncoder as
|
|
452
|
+
getI64Decoder as getI64Decoder8,
|
|
453
|
+
getI64Encoder as getI64Encoder8,
|
|
454
|
+
getStructDecoder as getStructDecoder9,
|
|
455
|
+
getStructEncoder as getStructEncoder9,
|
|
420
456
|
getU64Decoder as getU64Decoder5,
|
|
421
457
|
getU64Encoder as getU64Encoder8,
|
|
422
458
|
getU8Decoder as getU8Decoder2,
|
|
423
459
|
getU8Encoder as getU8Encoder2
|
|
424
460
|
} from "@solana/kit";
|
|
425
461
|
function getSubscribeDataEncoder() {
|
|
426
|
-
return
|
|
462
|
+
return getStructEncoder9([
|
|
427
463
|
["planId", getU64Encoder8()],
|
|
428
464
|
["planBump", getU8Encoder2()],
|
|
429
465
|
["expectedMint", getAddressEncoder8()],
|
|
430
466
|
["expectedAmount", getU64Encoder8()],
|
|
431
467
|
["expectedPeriodHours", getU64Encoder8()],
|
|
432
|
-
["expectedCreatedAt",
|
|
433
|
-
["expectedSubscriptionAuthorityInitId",
|
|
468
|
+
["expectedCreatedAt", getI64Encoder8()],
|
|
469
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder8()]
|
|
434
470
|
]);
|
|
435
471
|
}
|
|
436
472
|
function getSubscribeDataDecoder() {
|
|
437
|
-
return
|
|
473
|
+
return getStructDecoder9([
|
|
438
474
|
["planId", getU64Decoder5()],
|
|
439
475
|
["planBump", getU8Decoder2()],
|
|
440
476
|
["expectedMint", getAddressDecoder3()],
|
|
441
477
|
["expectedAmount", getU64Decoder5()],
|
|
442
478
|
["expectedPeriodHours", getU64Decoder5()],
|
|
443
|
-
["expectedCreatedAt",
|
|
444
|
-
["expectedSubscriptionAuthorityInitId",
|
|
479
|
+
["expectedCreatedAt", getI64Decoder8()],
|
|
480
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder8()]
|
|
445
481
|
]);
|
|
446
482
|
}
|
|
447
483
|
function getSubscribeDataCodec() {
|
|
448
|
-
return
|
|
484
|
+
return combineCodec11(getSubscribeDataEncoder(), getSubscribeDataDecoder());
|
|
449
485
|
}
|
|
450
486
|
|
|
451
487
|
// src/generated/types/transferData.ts
|
|
452
488
|
import {
|
|
453
|
-
combineCodec as
|
|
489
|
+
combineCodec as combineCodec12,
|
|
454
490
|
getAddressDecoder as getAddressDecoder4,
|
|
455
491
|
getAddressEncoder as getAddressEncoder9,
|
|
456
|
-
getStructDecoder as
|
|
457
|
-
getStructEncoder as
|
|
492
|
+
getStructDecoder as getStructDecoder10,
|
|
493
|
+
getStructEncoder as getStructEncoder10,
|
|
458
494
|
getU64Decoder as getU64Decoder6,
|
|
459
495
|
getU64Encoder as getU64Encoder9
|
|
460
496
|
} from "@solana/kit";
|
|
461
497
|
function getTransferDataEncoder() {
|
|
462
|
-
return
|
|
498
|
+
return getStructEncoder10([
|
|
463
499
|
["amount", getU64Encoder9()],
|
|
464
500
|
["delegator", getAddressEncoder9()],
|
|
465
501
|
["mint", getAddressEncoder9()]
|
|
466
502
|
]);
|
|
467
503
|
}
|
|
468
504
|
function getTransferDataDecoder() {
|
|
469
|
-
return
|
|
505
|
+
return getStructDecoder10([
|
|
470
506
|
["amount", getU64Decoder6()],
|
|
471
507
|
["delegator", getAddressDecoder4()],
|
|
472
508
|
["mint", getAddressDecoder4()]
|
|
473
509
|
]);
|
|
474
510
|
}
|
|
475
511
|
function getTransferDataCodec() {
|
|
476
|
-
return
|
|
512
|
+
return combineCodec12(getTransferDataEncoder(), getTransferDataDecoder());
|
|
477
513
|
}
|
|
478
514
|
|
|
479
515
|
// src/generated/types/updatePlanData.ts
|
|
480
516
|
import {
|
|
481
|
-
combineCodec as
|
|
517
|
+
combineCodec as combineCodec13,
|
|
482
518
|
fixDecoderSize as fixDecoderSize2,
|
|
483
519
|
fixEncoderSize as fixEncoderSize2,
|
|
484
520
|
getAddressDecoder as getAddressDecoder5,
|
|
485
521
|
getAddressEncoder as getAddressEncoder10,
|
|
486
522
|
getArrayDecoder as getArrayDecoder2,
|
|
487
523
|
getArrayEncoder as getArrayEncoder2,
|
|
488
|
-
getI64Decoder as
|
|
489
|
-
getI64Encoder as
|
|
490
|
-
getStructDecoder as
|
|
491
|
-
getStructEncoder as
|
|
524
|
+
getI64Decoder as getI64Decoder9,
|
|
525
|
+
getI64Encoder as getI64Encoder9,
|
|
526
|
+
getStructDecoder as getStructDecoder11,
|
|
527
|
+
getStructEncoder as getStructEncoder11,
|
|
492
528
|
getU8Decoder as getU8Decoder3,
|
|
493
529
|
getU8Encoder as getU8Encoder3,
|
|
494
530
|
getUtf8Decoder as getUtf8Decoder2,
|
|
495
531
|
getUtf8Encoder as getUtf8Encoder8
|
|
496
532
|
} from "@solana/kit";
|
|
497
533
|
function getUpdatePlanDataEncoder() {
|
|
498
|
-
return
|
|
534
|
+
return getStructEncoder11([
|
|
499
535
|
["status", getU8Encoder3()],
|
|
500
|
-
["endTs",
|
|
536
|
+
["endTs", getI64Encoder9()],
|
|
501
537
|
["pullers", getArrayEncoder2(getAddressEncoder10(), { size: 4 })],
|
|
502
|
-
["metadataUri", fixEncoderSize2(getUtf8Encoder8(), 128)]
|
|
538
|
+
["metadataUri", fixEncoderSize2(getUtf8Encoder8(), 128)],
|
|
539
|
+
["expectedCreatedAt", getI64Encoder9()],
|
|
540
|
+
["expectedEndTs", getI64Encoder9()],
|
|
541
|
+
["expectedPullers", getArrayEncoder2(getAddressEncoder10(), { size: 4 })],
|
|
542
|
+
["expectedMetadataUri", fixEncoderSize2(getUtf8Encoder8(), 128)]
|
|
503
543
|
]);
|
|
504
544
|
}
|
|
505
545
|
function getUpdatePlanDataDecoder() {
|
|
506
|
-
return
|
|
546
|
+
return getStructDecoder11([
|
|
507
547
|
["status", getU8Decoder3()],
|
|
508
|
-
["endTs",
|
|
548
|
+
["endTs", getI64Decoder9()],
|
|
509
549
|
["pullers", getArrayDecoder2(getAddressDecoder5(), { size: 4 })],
|
|
510
|
-
["metadataUri", fixDecoderSize2(getUtf8Decoder2(), 128)]
|
|
550
|
+
["metadataUri", fixDecoderSize2(getUtf8Decoder2(), 128)],
|
|
551
|
+
["expectedCreatedAt", getI64Decoder9()],
|
|
552
|
+
["expectedEndTs", getI64Decoder9()],
|
|
553
|
+
["expectedPullers", getArrayDecoder2(getAddressDecoder5(), { size: 4 })],
|
|
554
|
+
["expectedMetadataUri", fixDecoderSize2(getUtf8Decoder2(), 128)]
|
|
511
555
|
]);
|
|
512
556
|
}
|
|
513
557
|
function getUpdatePlanDataCodec() {
|
|
514
|
-
return
|
|
558
|
+
return combineCodec13(getUpdatePlanDataEncoder(), getUpdatePlanDataDecoder());
|
|
515
559
|
}
|
|
516
560
|
|
|
517
561
|
// src/generated/accounts/fixedDelegation.ts
|
|
518
562
|
function getFixedDelegationEncoder() {
|
|
519
|
-
return
|
|
563
|
+
return getStructEncoder12([
|
|
520
564
|
["header", getHeaderEncoder()],
|
|
521
565
|
["subscriptionAuthority", getAddressEncoder11()],
|
|
522
566
|
["mint", getAddressEncoder11()],
|
|
523
567
|
["amount", getU64Encoder10()],
|
|
524
|
-
["expiryTs",
|
|
568
|
+
["expiryTs", getI64Encoder10()]
|
|
525
569
|
]);
|
|
526
570
|
}
|
|
527
571
|
function getFixedDelegationDecoder() {
|
|
528
|
-
return
|
|
572
|
+
return getStructDecoder12([
|
|
529
573
|
["header", getHeaderDecoder()],
|
|
530
574
|
["subscriptionAuthority", getAddressDecoder6()],
|
|
531
575
|
["mint", getAddressDecoder6()],
|
|
532
576
|
["amount", getU64Decoder7()],
|
|
533
|
-
["expiryTs",
|
|
577
|
+
["expiryTs", getI64Decoder10()]
|
|
534
578
|
]);
|
|
535
579
|
}
|
|
536
580
|
function getFixedDelegationCodec() {
|
|
537
|
-
return
|
|
581
|
+
return combineCodec14(getFixedDelegationEncoder(), getFixedDelegationDecoder());
|
|
538
582
|
}
|
|
539
583
|
function decodeFixedDelegation(encodedAccount) {
|
|
540
584
|
return decodeAccount2(encodedAccount, getFixedDelegationDecoder());
|
|
@@ -572,19 +616,19 @@ async function fetchMaybeFixedDelegationFromSeeds(rpc, seeds, config = {}) {
|
|
|
572
616
|
import {
|
|
573
617
|
assertAccountExists as assertAccountExists3,
|
|
574
618
|
assertAccountsExist as assertAccountsExist3,
|
|
575
|
-
combineCodec as
|
|
619
|
+
combineCodec as combineCodec15,
|
|
576
620
|
decodeAccount as decodeAccount3,
|
|
577
621
|
fetchEncodedAccount as fetchEncodedAccount3,
|
|
578
622
|
fetchEncodedAccounts as fetchEncodedAccounts3,
|
|
579
623
|
getAddressDecoder as getAddressDecoder7,
|
|
580
624
|
getAddressEncoder as getAddressEncoder12,
|
|
581
|
-
getStructDecoder as
|
|
582
|
-
getStructEncoder as
|
|
625
|
+
getStructDecoder as getStructDecoder13,
|
|
626
|
+
getStructEncoder as getStructEncoder13,
|
|
583
627
|
getU8Decoder as getU8Decoder4,
|
|
584
628
|
getU8Encoder as getU8Encoder4
|
|
585
629
|
} from "@solana/kit";
|
|
586
630
|
function getPlanEncoder() {
|
|
587
|
-
return
|
|
631
|
+
return getStructEncoder13([
|
|
588
632
|
["discriminator", getU8Encoder4()],
|
|
589
633
|
["owner", getAddressEncoder12()],
|
|
590
634
|
["bump", getU8Encoder4()],
|
|
@@ -593,7 +637,7 @@ function getPlanEncoder() {
|
|
|
593
637
|
]);
|
|
594
638
|
}
|
|
595
639
|
function getPlanDecoder() {
|
|
596
|
-
return
|
|
640
|
+
return getStructDecoder13([
|
|
597
641
|
["discriminator", getU8Decoder4()],
|
|
598
642
|
["owner", getAddressDecoder7()],
|
|
599
643
|
["bump", getU8Decoder4()],
|
|
@@ -602,7 +646,7 @@ function getPlanDecoder() {
|
|
|
602
646
|
]);
|
|
603
647
|
}
|
|
604
648
|
function getPlanCodec() {
|
|
605
|
-
return
|
|
649
|
+
return combineCodec15(getPlanEncoder(), getPlanDecoder());
|
|
606
650
|
}
|
|
607
651
|
function decodePlan(encodedAccount) {
|
|
608
652
|
return decodeAccount3(encodedAccount, getPlanDecoder());
|
|
@@ -640,45 +684,45 @@ async function fetchMaybePlanFromSeeds(rpc, seeds, config = {}) {
|
|
|
640
684
|
import {
|
|
641
685
|
assertAccountExists as assertAccountExists4,
|
|
642
686
|
assertAccountsExist as assertAccountsExist4,
|
|
643
|
-
combineCodec as
|
|
687
|
+
combineCodec as combineCodec16,
|
|
644
688
|
decodeAccount as decodeAccount4,
|
|
645
689
|
fetchEncodedAccount as fetchEncodedAccount4,
|
|
646
690
|
fetchEncodedAccounts as fetchEncodedAccounts4,
|
|
647
691
|
getAddressDecoder as getAddressDecoder8,
|
|
648
692
|
getAddressEncoder as getAddressEncoder13,
|
|
649
|
-
getI64Decoder as
|
|
650
|
-
getI64Encoder as
|
|
651
|
-
getStructDecoder as
|
|
652
|
-
getStructEncoder as
|
|
693
|
+
getI64Decoder as getI64Decoder11,
|
|
694
|
+
getI64Encoder as getI64Encoder11,
|
|
695
|
+
getStructDecoder as getStructDecoder14,
|
|
696
|
+
getStructEncoder as getStructEncoder14,
|
|
653
697
|
getU64Decoder as getU64Decoder8,
|
|
654
698
|
getU64Encoder as getU64Encoder11
|
|
655
699
|
} from "@solana/kit";
|
|
656
700
|
function getRecurringDelegationEncoder() {
|
|
657
|
-
return
|
|
701
|
+
return getStructEncoder14([
|
|
658
702
|
["header", getHeaderEncoder()],
|
|
659
703
|
["subscriptionAuthority", getAddressEncoder13()],
|
|
660
704
|
["mint", getAddressEncoder13()],
|
|
661
|
-
["currentPeriodStartTs",
|
|
705
|
+
["currentPeriodStartTs", getI64Encoder11()],
|
|
662
706
|
["periodLengthS", getU64Encoder11()],
|
|
663
|
-
["expiryTs",
|
|
707
|
+
["expiryTs", getI64Encoder11()],
|
|
664
708
|
["amountPerPeriod", getU64Encoder11()],
|
|
665
709
|
["amountPulledInPeriod", getU64Encoder11()]
|
|
666
710
|
]);
|
|
667
711
|
}
|
|
668
712
|
function getRecurringDelegationDecoder() {
|
|
669
|
-
return
|
|
713
|
+
return getStructDecoder14([
|
|
670
714
|
["header", getHeaderDecoder()],
|
|
671
715
|
["subscriptionAuthority", getAddressDecoder8()],
|
|
672
716
|
["mint", getAddressDecoder8()],
|
|
673
|
-
["currentPeriodStartTs",
|
|
717
|
+
["currentPeriodStartTs", getI64Decoder11()],
|
|
674
718
|
["periodLengthS", getU64Decoder8()],
|
|
675
|
-
["expiryTs",
|
|
719
|
+
["expiryTs", getI64Decoder11()],
|
|
676
720
|
["amountPerPeriod", getU64Decoder8()],
|
|
677
721
|
["amountPulledInPeriod", getU64Decoder8()]
|
|
678
722
|
]);
|
|
679
723
|
}
|
|
680
724
|
function getRecurringDelegationCodec() {
|
|
681
|
-
return
|
|
725
|
+
return combineCodec16(getRecurringDelegationEncoder(), getRecurringDelegationDecoder());
|
|
682
726
|
}
|
|
683
727
|
function decodeRecurringDelegation(encodedAccount) {
|
|
684
728
|
return decodeAccount4(encodedAccount, getRecurringDelegationDecoder());
|
|
@@ -716,41 +760,41 @@ async function fetchMaybeRecurringDelegationFromSeeds(rpc, seeds, config = {}) {
|
|
|
716
760
|
import {
|
|
717
761
|
assertAccountExists as assertAccountExists5,
|
|
718
762
|
assertAccountsExist as assertAccountsExist5,
|
|
719
|
-
combineCodec as
|
|
763
|
+
combineCodec as combineCodec17,
|
|
720
764
|
decodeAccount as decodeAccount5,
|
|
721
765
|
fetchEncodedAccount as fetchEncodedAccount5,
|
|
722
766
|
fetchEncodedAccounts as fetchEncodedAccounts5,
|
|
723
767
|
getAddressDecoder as getAddressDecoder9,
|
|
724
768
|
getAddressEncoder as getAddressEncoder14,
|
|
725
|
-
getI64Decoder as
|
|
726
|
-
getI64Encoder as
|
|
727
|
-
getStructDecoder as
|
|
728
|
-
getStructEncoder as
|
|
769
|
+
getI64Decoder as getI64Decoder12,
|
|
770
|
+
getI64Encoder as getI64Encoder12,
|
|
771
|
+
getStructDecoder as getStructDecoder15,
|
|
772
|
+
getStructEncoder as getStructEncoder15,
|
|
729
773
|
getU8Decoder as getU8Decoder5,
|
|
730
774
|
getU8Encoder as getU8Encoder5
|
|
731
775
|
} from "@solana/kit";
|
|
732
776
|
function getSubscriptionAuthorityEncoder() {
|
|
733
|
-
return
|
|
777
|
+
return getStructEncoder15([
|
|
734
778
|
["discriminator", getU8Encoder5()],
|
|
735
779
|
["user", getAddressEncoder14()],
|
|
736
780
|
["tokenMint", getAddressEncoder14()],
|
|
737
781
|
["payer", getAddressEncoder14()],
|
|
738
782
|
["bump", getU8Encoder5()],
|
|
739
|
-
["initId",
|
|
783
|
+
["initId", getI64Encoder12()]
|
|
740
784
|
]);
|
|
741
785
|
}
|
|
742
786
|
function getSubscriptionAuthorityDecoder() {
|
|
743
|
-
return
|
|
787
|
+
return getStructDecoder15([
|
|
744
788
|
["discriminator", getU8Decoder5()],
|
|
745
789
|
["user", getAddressDecoder9()],
|
|
746
790
|
["tokenMint", getAddressDecoder9()],
|
|
747
791
|
["payer", getAddressDecoder9()],
|
|
748
792
|
["bump", getU8Decoder5()],
|
|
749
|
-
["initId",
|
|
793
|
+
["initId", getI64Decoder12()]
|
|
750
794
|
]);
|
|
751
795
|
}
|
|
752
796
|
function getSubscriptionAuthorityCodec() {
|
|
753
|
-
return
|
|
797
|
+
return combineCodec17(getSubscriptionAuthorityEncoder(), getSubscriptionAuthorityDecoder());
|
|
754
798
|
}
|
|
755
799
|
function decodeSubscriptionAuthority(encodedAccount) {
|
|
756
800
|
return decodeAccount5(encodedAccount, getSubscriptionAuthorityDecoder());
|
|
@@ -788,37 +832,37 @@ async function fetchMaybeSubscriptionAuthorityFromSeeds(rpc, seeds, config = {})
|
|
|
788
832
|
import {
|
|
789
833
|
assertAccountExists as assertAccountExists6,
|
|
790
834
|
assertAccountsExist as assertAccountsExist6,
|
|
791
|
-
combineCodec as
|
|
835
|
+
combineCodec as combineCodec18,
|
|
792
836
|
decodeAccount as decodeAccount6,
|
|
793
837
|
fetchEncodedAccount as fetchEncodedAccount6,
|
|
794
838
|
fetchEncodedAccounts as fetchEncodedAccounts6,
|
|
795
|
-
getI64Decoder as
|
|
796
|
-
getI64Encoder as
|
|
797
|
-
getStructDecoder as
|
|
798
|
-
getStructEncoder as
|
|
839
|
+
getI64Decoder as getI64Decoder13,
|
|
840
|
+
getI64Encoder as getI64Encoder13,
|
|
841
|
+
getStructDecoder as getStructDecoder16,
|
|
842
|
+
getStructEncoder as getStructEncoder16,
|
|
799
843
|
getU64Decoder as getU64Decoder9,
|
|
800
844
|
getU64Encoder as getU64Encoder12
|
|
801
845
|
} from "@solana/kit";
|
|
802
846
|
function getSubscriptionDelegationEncoder() {
|
|
803
|
-
return
|
|
847
|
+
return getStructEncoder16([
|
|
804
848
|
["header", getHeaderEncoder()],
|
|
805
849
|
["terms", getPlanTermsEncoder()],
|
|
806
850
|
["amountPulledInPeriod", getU64Encoder12()],
|
|
807
|
-
["currentPeriodStartTs",
|
|
808
|
-
["expiresAtTs",
|
|
851
|
+
["currentPeriodStartTs", getI64Encoder13()],
|
|
852
|
+
["expiresAtTs", getI64Encoder13()]
|
|
809
853
|
]);
|
|
810
854
|
}
|
|
811
855
|
function getSubscriptionDelegationDecoder() {
|
|
812
|
-
return
|
|
856
|
+
return getStructDecoder16([
|
|
813
857
|
["header", getHeaderDecoder()],
|
|
814
858
|
["terms", getPlanTermsDecoder()],
|
|
815
859
|
["amountPulledInPeriod", getU64Decoder9()],
|
|
816
|
-
["currentPeriodStartTs",
|
|
817
|
-
["expiresAtTs",
|
|
860
|
+
["currentPeriodStartTs", getI64Decoder13()],
|
|
861
|
+
["expiresAtTs", getI64Decoder13()]
|
|
818
862
|
]);
|
|
819
863
|
}
|
|
820
864
|
function getSubscriptionDelegationCodec() {
|
|
821
|
-
return
|
|
865
|
+
return combineCodec18(getSubscriptionDelegationEncoder(), getSubscriptionDelegationDecoder());
|
|
822
866
|
}
|
|
823
867
|
function decodeSubscriptionDelegation(encodedAccount) {
|
|
824
868
|
return decodeAccount6(encodedAccount, getSubscriptionDelegationDecoder());
|
|
@@ -862,10 +906,10 @@ import {
|
|
|
862
906
|
assertIsInstructionWithAccounts,
|
|
863
907
|
containsBytes,
|
|
864
908
|
extendClient,
|
|
865
|
-
getU8Encoder as
|
|
909
|
+
getU8Encoder as getU8Encoder24,
|
|
866
910
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
867
911
|
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
868
|
-
SolanaError as
|
|
912
|
+
SolanaError as SolanaError19
|
|
869
913
|
} from "@solana/kit";
|
|
870
914
|
import {
|
|
871
915
|
addSelfFetchFunctions,
|
|
@@ -874,10 +918,10 @@ import {
|
|
|
874
918
|
|
|
875
919
|
// src/generated/instructions/cancelSubscription.ts
|
|
876
920
|
import {
|
|
877
|
-
combineCodec as
|
|
921
|
+
combineCodec as combineCodec19,
|
|
878
922
|
getProgramDerivedAddress as getProgramDerivedAddress7,
|
|
879
|
-
getStructDecoder as
|
|
880
|
-
getStructEncoder as
|
|
923
|
+
getStructDecoder as getStructDecoder17,
|
|
924
|
+
getStructEncoder as getStructEncoder17,
|
|
881
925
|
getU8Decoder as getU8Decoder6,
|
|
882
926
|
getU8Encoder as getU8Encoder6,
|
|
883
927
|
getUtf8Encoder as getUtf8Encoder9,
|
|
@@ -894,16 +938,16 @@ function getCancelSubscriptionDiscriminatorBytes() {
|
|
|
894
938
|
return getU8Encoder6().encode(CANCEL_SUBSCRIPTION_DISCRIMINATOR);
|
|
895
939
|
}
|
|
896
940
|
function getCancelSubscriptionInstructionDataEncoder() {
|
|
897
|
-
return transformEncoder(
|
|
941
|
+
return transformEncoder(getStructEncoder17([["discriminator", getU8Encoder6()]]), (value) => ({
|
|
898
942
|
...value,
|
|
899
943
|
discriminator: CANCEL_SUBSCRIPTION_DISCRIMINATOR
|
|
900
944
|
}));
|
|
901
945
|
}
|
|
902
946
|
function getCancelSubscriptionInstructionDataDecoder() {
|
|
903
|
-
return
|
|
947
|
+
return getStructDecoder17([["discriminator", getU8Decoder6()]]);
|
|
904
948
|
}
|
|
905
949
|
function getCancelSubscriptionInstructionDataCodec() {
|
|
906
|
-
return
|
|
950
|
+
return combineCodec19(getCancelSubscriptionInstructionDataEncoder(), getCancelSubscriptionInstructionDataDecoder());
|
|
907
951
|
}
|
|
908
952
|
async function getCancelSubscriptionInstructionAsync(input, config) {
|
|
909
953
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -967,15 +1011,155 @@ function getCancelSubscriptionInstruction(input, config) {
|
|
|
967
1011
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
968
1012
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
969
1013
|
],
|
|
970
|
-
data: getCancelSubscriptionInstructionDataEncoder().encode({}),
|
|
1014
|
+
data: getCancelSubscriptionInstructionDataEncoder().encode({}),
|
|
1015
|
+
programAddress
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
function parseCancelSubscriptionInstruction(instruction) {
|
|
1019
|
+
if (instruction.accounts.length < 5) {
|
|
1020
|
+
throw new SolanaError(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1021
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1022
|
+
expectedAccountMetas: 5
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
let accountIndex = 0;
|
|
1026
|
+
const getNextAccount = () => {
|
|
1027
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1028
|
+
accountIndex += 1;
|
|
1029
|
+
return accountMeta;
|
|
1030
|
+
};
|
|
1031
|
+
return {
|
|
1032
|
+
programAddress: instruction.programAddress,
|
|
1033
|
+
accounts: {
|
|
1034
|
+
subscriber: getNextAccount(),
|
|
1035
|
+
planPda: getNextAccount(),
|
|
1036
|
+
subscriptionPda: getNextAccount(),
|
|
1037
|
+
eventAuthority: getNextAccount(),
|
|
1038
|
+
selfProgram: getNextAccount()
|
|
1039
|
+
},
|
|
1040
|
+
data: getCancelSubscriptionInstructionDataDecoder().decode(instruction.data)
|
|
1041
|
+
};
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
// src/generated/instructions/cancelSubscriptionNow.ts
|
|
1045
|
+
import {
|
|
1046
|
+
combineCodec as combineCodec20,
|
|
1047
|
+
getProgramDerivedAddress as getProgramDerivedAddress8,
|
|
1048
|
+
getStructDecoder as getStructDecoder18,
|
|
1049
|
+
getStructEncoder as getStructEncoder18,
|
|
1050
|
+
getU8Decoder as getU8Decoder7,
|
|
1051
|
+
getU8Encoder as getU8Encoder7,
|
|
1052
|
+
getUtf8Encoder as getUtf8Encoder10,
|
|
1053
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS2,
|
|
1054
|
+
SolanaError as SolanaError2,
|
|
1055
|
+
transformEncoder as transformEncoder2
|
|
1056
|
+
} from "@solana/kit";
|
|
1057
|
+
import {
|
|
1058
|
+
getAccountMetaFactory as getAccountMetaFactory2,
|
|
1059
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount2
|
|
1060
|
+
} from "@solana/program-client-core";
|
|
1061
|
+
var CANCEL_SUBSCRIPTION_NOW_DISCRIMINATOR = 17;
|
|
1062
|
+
function getCancelSubscriptionNowDiscriminatorBytes() {
|
|
1063
|
+
return getU8Encoder7().encode(CANCEL_SUBSCRIPTION_NOW_DISCRIMINATOR);
|
|
1064
|
+
}
|
|
1065
|
+
function getCancelSubscriptionNowInstructionDataEncoder() {
|
|
1066
|
+
return transformEncoder2(
|
|
1067
|
+
getStructEncoder18([
|
|
1068
|
+
["discriminator", getU8Encoder7()],
|
|
1069
|
+
["cancelSubscriptionNowData", getCancelSubscriptionNowDataEncoder()]
|
|
1070
|
+
]),
|
|
1071
|
+
(value) => ({ ...value, discriminator: CANCEL_SUBSCRIPTION_NOW_DISCRIMINATOR })
|
|
1072
|
+
);
|
|
1073
|
+
}
|
|
1074
|
+
function getCancelSubscriptionNowInstructionDataDecoder() {
|
|
1075
|
+
return getStructDecoder18([
|
|
1076
|
+
["discriminator", getU8Decoder7()],
|
|
1077
|
+
["cancelSubscriptionNowData", getCancelSubscriptionNowDataDecoder()]
|
|
1078
|
+
]);
|
|
1079
|
+
}
|
|
1080
|
+
function getCancelSubscriptionNowInstructionDataCodec() {
|
|
1081
|
+
return combineCodec20(
|
|
1082
|
+
getCancelSubscriptionNowInstructionDataEncoder(),
|
|
1083
|
+
getCancelSubscriptionNowInstructionDataDecoder()
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
async function getCancelSubscriptionNowInstructionAsync(input, config) {
|
|
1087
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1088
|
+
const originalAccounts = {
|
|
1089
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1090
|
+
merchant: { value: input.merchant ?? null, isWritable: false },
|
|
1091
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1092
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1093
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1094
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1095
|
+
};
|
|
1096
|
+
const accounts = originalAccounts;
|
|
1097
|
+
const args = { ...input };
|
|
1098
|
+
if (!accounts.subscriptionPda.value) {
|
|
1099
|
+
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1100
|
+
planPda: getAddressFromResolvedInstructionAccount2("planPda", accounts.planPda.value),
|
|
1101
|
+
subscriber: getAddressFromResolvedInstructionAccount2("subscriber", accounts.subscriber.value)
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
if (!accounts.eventAuthority.value) {
|
|
1105
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress8({
|
|
1106
|
+
programAddress,
|
|
1107
|
+
seeds: [getUtf8Encoder10().encode("event_authority")]
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
if (!accounts.selfProgram.value) {
|
|
1111
|
+
accounts.selfProgram.value = programAddress;
|
|
1112
|
+
accounts.selfProgram.isWritable = false;
|
|
1113
|
+
}
|
|
1114
|
+
const getAccountMeta = getAccountMetaFactory2(programAddress, "programId");
|
|
1115
|
+
return Object.freeze({
|
|
1116
|
+
accounts: [
|
|
1117
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1118
|
+
getAccountMeta("merchant", accounts.merchant),
|
|
1119
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1120
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1121
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1122
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1123
|
+
],
|
|
1124
|
+
data: getCancelSubscriptionNowInstructionDataEncoder().encode(args),
|
|
1125
|
+
programAddress
|
|
1126
|
+
});
|
|
1127
|
+
}
|
|
1128
|
+
function getCancelSubscriptionNowInstruction(input, config) {
|
|
1129
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1130
|
+
const originalAccounts = {
|
|
1131
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1132
|
+
merchant: { value: input.merchant ?? null, isWritable: false },
|
|
1133
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1134
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1135
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1136
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1137
|
+
};
|
|
1138
|
+
const accounts = originalAccounts;
|
|
1139
|
+
const args = { ...input };
|
|
1140
|
+
if (!accounts.selfProgram.value) {
|
|
1141
|
+
accounts.selfProgram.value = programAddress;
|
|
1142
|
+
accounts.selfProgram.isWritable = false;
|
|
1143
|
+
}
|
|
1144
|
+
const getAccountMeta = getAccountMetaFactory2(programAddress, "programId");
|
|
1145
|
+
return Object.freeze({
|
|
1146
|
+
accounts: [
|
|
1147
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1148
|
+
getAccountMeta("merchant", accounts.merchant),
|
|
1149
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1150
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1151
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1152
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1153
|
+
],
|
|
1154
|
+
data: getCancelSubscriptionNowInstructionDataEncoder().encode(args),
|
|
971
1155
|
programAddress
|
|
972
1156
|
});
|
|
973
1157
|
}
|
|
974
|
-
function
|
|
975
|
-
if (instruction.accounts.length <
|
|
976
|
-
throw new
|
|
1158
|
+
function parseCancelSubscriptionNowInstruction(instruction) {
|
|
1159
|
+
if (instruction.accounts.length < 6) {
|
|
1160
|
+
throw new SolanaError2(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS2, {
|
|
977
1161
|
actualAccountMetas: instruction.accounts.length,
|
|
978
|
-
expectedAccountMetas:
|
|
1162
|
+
expectedAccountMetas: 6
|
|
979
1163
|
});
|
|
980
1164
|
}
|
|
981
1165
|
let accountIndex = 0;
|
|
@@ -988,42 +1172,43 @@ function parseCancelSubscriptionInstruction(instruction) {
|
|
|
988
1172
|
programAddress: instruction.programAddress,
|
|
989
1173
|
accounts: {
|
|
990
1174
|
subscriber: getNextAccount(),
|
|
1175
|
+
merchant: getNextAccount(),
|
|
991
1176
|
planPda: getNextAccount(),
|
|
992
1177
|
subscriptionPda: getNextAccount(),
|
|
993
1178
|
eventAuthority: getNextAccount(),
|
|
994
1179
|
selfProgram: getNextAccount()
|
|
995
1180
|
},
|
|
996
|
-
data:
|
|
1181
|
+
data: getCancelSubscriptionNowInstructionDataDecoder().decode(instruction.data)
|
|
997
1182
|
};
|
|
998
1183
|
}
|
|
999
1184
|
|
|
1000
1185
|
// src/generated/instructions/closeSubscriptionAuthority.ts
|
|
1001
1186
|
import {
|
|
1002
|
-
combineCodec as
|
|
1003
|
-
getStructDecoder as
|
|
1004
|
-
getStructEncoder as
|
|
1005
|
-
getU8Decoder as
|
|
1006
|
-
getU8Encoder as
|
|
1007
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1008
|
-
SolanaError as
|
|
1009
|
-
transformEncoder as
|
|
1187
|
+
combineCodec as combineCodec21,
|
|
1188
|
+
getStructDecoder as getStructDecoder19,
|
|
1189
|
+
getStructEncoder as getStructEncoder19,
|
|
1190
|
+
getU8Decoder as getU8Decoder8,
|
|
1191
|
+
getU8Encoder as getU8Encoder8,
|
|
1192
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS3,
|
|
1193
|
+
SolanaError as SolanaError3,
|
|
1194
|
+
transformEncoder as transformEncoder3
|
|
1010
1195
|
} from "@solana/kit";
|
|
1011
|
-
import { getAccountMetaFactory as
|
|
1196
|
+
import { getAccountMetaFactory as getAccountMetaFactory3 } from "@solana/program-client-core";
|
|
1012
1197
|
var CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 6;
|
|
1013
1198
|
function getCloseSubscriptionAuthorityDiscriminatorBytes() {
|
|
1014
|
-
return
|
|
1199
|
+
return getU8Encoder8().encode(CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
|
|
1015
1200
|
}
|
|
1016
1201
|
function getCloseSubscriptionAuthorityInstructionDataEncoder() {
|
|
1017
|
-
return
|
|
1202
|
+
return transformEncoder3(getStructEncoder19([["discriminator", getU8Encoder8()]]), (value) => ({
|
|
1018
1203
|
...value,
|
|
1019
1204
|
discriminator: CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
|
|
1020
1205
|
}));
|
|
1021
1206
|
}
|
|
1022
1207
|
function getCloseSubscriptionAuthorityInstructionDataDecoder() {
|
|
1023
|
-
return
|
|
1208
|
+
return getStructDecoder19([["discriminator", getU8Decoder8()]]);
|
|
1024
1209
|
}
|
|
1025
1210
|
function getCloseSubscriptionAuthorityInstructionDataCodec() {
|
|
1026
|
-
return
|
|
1211
|
+
return combineCodec21(
|
|
1027
1212
|
getCloseSubscriptionAuthorityInstructionDataEncoder(),
|
|
1028
1213
|
getCloseSubscriptionAuthorityInstructionDataDecoder()
|
|
1029
1214
|
);
|
|
@@ -1036,7 +1221,7 @@ function getCloseSubscriptionAuthorityInstruction(input, config) {
|
|
|
1036
1221
|
receiver: { value: input.receiver ?? null, isWritable: true }
|
|
1037
1222
|
};
|
|
1038
1223
|
const accounts = originalAccounts;
|
|
1039
|
-
const getAccountMeta =
|
|
1224
|
+
const getAccountMeta = getAccountMetaFactory3(programAddress, "omitted");
|
|
1040
1225
|
return Object.freeze({
|
|
1041
1226
|
accounts: [
|
|
1042
1227
|
getAccountMeta("user", accounts.user),
|
|
@@ -1049,7 +1234,7 @@ function getCloseSubscriptionAuthorityInstruction(input, config) {
|
|
|
1049
1234
|
}
|
|
1050
1235
|
function parseCloseSubscriptionAuthorityInstruction(instruction) {
|
|
1051
1236
|
if (instruction.accounts.length < 2) {
|
|
1052
|
-
throw new
|
|
1237
|
+
throw new SolanaError3(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS3, {
|
|
1053
1238
|
actualAccountMetas: instruction.accounts.length,
|
|
1054
1239
|
expectedAccountMetas: 2
|
|
1055
1240
|
});
|
|
@@ -1079,37 +1264,37 @@ function parseCloseSubscriptionAuthorityInstruction(instruction) {
|
|
|
1079
1264
|
|
|
1080
1265
|
// src/generated/instructions/createFixedDelegation.ts
|
|
1081
1266
|
import {
|
|
1082
|
-
combineCodec as
|
|
1083
|
-
getStructDecoder as
|
|
1084
|
-
getStructEncoder as
|
|
1085
|
-
getU8Decoder as
|
|
1086
|
-
getU8Encoder as
|
|
1087
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1088
|
-
SolanaError as
|
|
1089
|
-
transformEncoder as
|
|
1267
|
+
combineCodec as combineCodec22,
|
|
1268
|
+
getStructDecoder as getStructDecoder20,
|
|
1269
|
+
getStructEncoder as getStructEncoder20,
|
|
1270
|
+
getU8Decoder as getU8Decoder9,
|
|
1271
|
+
getU8Encoder as getU8Encoder9,
|
|
1272
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS4,
|
|
1273
|
+
SolanaError as SolanaError4,
|
|
1274
|
+
transformEncoder as transformEncoder4
|
|
1090
1275
|
} from "@solana/kit";
|
|
1091
|
-
import { getAccountMetaFactory as
|
|
1276
|
+
import { getAccountMetaFactory as getAccountMetaFactory4 } from "@solana/program-client-core";
|
|
1092
1277
|
var CREATE_FIXED_DELEGATION_DISCRIMINATOR = 1;
|
|
1093
1278
|
function getCreateFixedDelegationDiscriminatorBytes() {
|
|
1094
|
-
return
|
|
1279
|
+
return getU8Encoder9().encode(CREATE_FIXED_DELEGATION_DISCRIMINATOR);
|
|
1095
1280
|
}
|
|
1096
1281
|
function getCreateFixedDelegationInstructionDataEncoder() {
|
|
1097
|
-
return
|
|
1098
|
-
|
|
1099
|
-
["discriminator",
|
|
1282
|
+
return transformEncoder4(
|
|
1283
|
+
getStructEncoder20([
|
|
1284
|
+
["discriminator", getU8Encoder9()],
|
|
1100
1285
|
["fixedDelegation", getCreateFixedDelegationDataEncoder()]
|
|
1101
1286
|
]),
|
|
1102
1287
|
(value) => ({ ...value, discriminator: CREATE_FIXED_DELEGATION_DISCRIMINATOR })
|
|
1103
1288
|
);
|
|
1104
1289
|
}
|
|
1105
1290
|
function getCreateFixedDelegationInstructionDataDecoder() {
|
|
1106
|
-
return
|
|
1107
|
-
["discriminator",
|
|
1291
|
+
return getStructDecoder20([
|
|
1292
|
+
["discriminator", getU8Decoder9()],
|
|
1108
1293
|
["fixedDelegation", getCreateFixedDelegationDataDecoder()]
|
|
1109
1294
|
]);
|
|
1110
1295
|
}
|
|
1111
1296
|
function getCreateFixedDelegationInstructionDataCodec() {
|
|
1112
|
-
return
|
|
1297
|
+
return combineCodec22(
|
|
1113
1298
|
getCreateFixedDelegationInstructionDataEncoder(),
|
|
1114
1299
|
getCreateFixedDelegationInstructionDataDecoder()
|
|
1115
1300
|
);
|
|
@@ -1129,7 +1314,7 @@ function getCreateFixedDelegationInstruction(input, config) {
|
|
|
1129
1314
|
if (!accounts.systemProgram.value) {
|
|
1130
1315
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1131
1316
|
}
|
|
1132
|
-
const getAccountMeta =
|
|
1317
|
+
const getAccountMeta = getAccountMetaFactory4(programAddress, "omitted");
|
|
1133
1318
|
return Object.freeze({
|
|
1134
1319
|
accounts: [
|
|
1135
1320
|
getAccountMeta("delegator", accounts.delegator),
|
|
@@ -1145,7 +1330,7 @@ function getCreateFixedDelegationInstruction(input, config) {
|
|
|
1145
1330
|
}
|
|
1146
1331
|
function parseCreateFixedDelegationInstruction(instruction) {
|
|
1147
1332
|
if (instruction.accounts.length < 5) {
|
|
1148
|
-
throw new
|
|
1333
|
+
throw new SolanaError4(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS4, {
|
|
1149
1334
|
actualAccountMetas: instruction.accounts.length,
|
|
1150
1335
|
expectedAccountMetas: 5
|
|
1151
1336
|
});
|
|
@@ -1178,37 +1363,37 @@ function parseCreateFixedDelegationInstruction(instruction) {
|
|
|
1178
1363
|
|
|
1179
1364
|
// src/generated/instructions/createPlan.ts
|
|
1180
1365
|
import {
|
|
1181
|
-
combineCodec as
|
|
1182
|
-
getStructDecoder as
|
|
1183
|
-
getStructEncoder as
|
|
1184
|
-
getU8Decoder as
|
|
1185
|
-
getU8Encoder as
|
|
1186
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1187
|
-
SolanaError as
|
|
1188
|
-
transformEncoder as
|
|
1366
|
+
combineCodec as combineCodec23,
|
|
1367
|
+
getStructDecoder as getStructDecoder21,
|
|
1368
|
+
getStructEncoder as getStructEncoder21,
|
|
1369
|
+
getU8Decoder as getU8Decoder10,
|
|
1370
|
+
getU8Encoder as getU8Encoder10,
|
|
1371
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS5,
|
|
1372
|
+
SolanaError as SolanaError5,
|
|
1373
|
+
transformEncoder as transformEncoder5
|
|
1189
1374
|
} from "@solana/kit";
|
|
1190
|
-
import { getAccountMetaFactory as
|
|
1375
|
+
import { getAccountMetaFactory as getAccountMetaFactory5 } from "@solana/program-client-core";
|
|
1191
1376
|
var CREATE_PLAN_DISCRIMINATOR = 7;
|
|
1192
1377
|
function getCreatePlanDiscriminatorBytes() {
|
|
1193
|
-
return
|
|
1378
|
+
return getU8Encoder10().encode(CREATE_PLAN_DISCRIMINATOR);
|
|
1194
1379
|
}
|
|
1195
1380
|
function getCreatePlanInstructionDataEncoder() {
|
|
1196
|
-
return
|
|
1197
|
-
|
|
1198
|
-
["discriminator",
|
|
1381
|
+
return transformEncoder5(
|
|
1382
|
+
getStructEncoder21([
|
|
1383
|
+
["discriminator", getU8Encoder10()],
|
|
1199
1384
|
["planData", getPlanDataEncoder()]
|
|
1200
1385
|
]),
|
|
1201
1386
|
(value) => ({ ...value, discriminator: CREATE_PLAN_DISCRIMINATOR })
|
|
1202
1387
|
);
|
|
1203
1388
|
}
|
|
1204
1389
|
function getCreatePlanInstructionDataDecoder() {
|
|
1205
|
-
return
|
|
1206
|
-
["discriminator",
|
|
1390
|
+
return getStructDecoder21([
|
|
1391
|
+
["discriminator", getU8Decoder10()],
|
|
1207
1392
|
["planData", getPlanDataDecoder()]
|
|
1208
1393
|
]);
|
|
1209
1394
|
}
|
|
1210
1395
|
function getCreatePlanInstructionDataCodec() {
|
|
1211
|
-
return
|
|
1396
|
+
return combineCodec23(getCreatePlanInstructionDataEncoder(), getCreatePlanInstructionDataDecoder());
|
|
1212
1397
|
}
|
|
1213
1398
|
function getCreatePlanInstruction(input, config) {
|
|
1214
1399
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1217,7 +1402,8 @@ function getCreatePlanInstruction(input, config) {
|
|
|
1217
1402
|
planPda: { value: input.planPda ?? null, isWritable: true },
|
|
1218
1403
|
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1219
1404
|
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
1220
|
-
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
|
|
1405
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1406
|
+
payer: { value: input.payer ?? null, isWritable: true }
|
|
1221
1407
|
};
|
|
1222
1408
|
const accounts = originalAccounts;
|
|
1223
1409
|
const args = { ...input };
|
|
@@ -1227,22 +1413,23 @@ function getCreatePlanInstruction(input, config) {
|
|
|
1227
1413
|
if (!accounts.tokenProgram.value) {
|
|
1228
1414
|
accounts.tokenProgram.value = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
1229
1415
|
}
|
|
1230
|
-
const getAccountMeta =
|
|
1416
|
+
const getAccountMeta = getAccountMetaFactory5(programAddress, "omitted");
|
|
1231
1417
|
return Object.freeze({
|
|
1232
1418
|
accounts: [
|
|
1233
1419
|
getAccountMeta("merchant", accounts.merchant),
|
|
1234
1420
|
getAccountMeta("planPda", accounts.planPda),
|
|
1235
1421
|
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1236
1422
|
getAccountMeta("systemProgram", accounts.systemProgram),
|
|
1237
|
-
getAccountMeta("tokenProgram", accounts.tokenProgram)
|
|
1238
|
-
|
|
1423
|
+
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1424
|
+
getAccountMeta("payer", accounts.payer)
|
|
1425
|
+
].filter((x) => x !== void 0),
|
|
1239
1426
|
data: getCreatePlanInstructionDataEncoder().encode(args),
|
|
1240
1427
|
programAddress
|
|
1241
1428
|
});
|
|
1242
1429
|
}
|
|
1243
1430
|
function parseCreatePlanInstruction(instruction) {
|
|
1244
1431
|
if (instruction.accounts.length < 5) {
|
|
1245
|
-
throw new
|
|
1432
|
+
throw new SolanaError5(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS5, {
|
|
1246
1433
|
actualAccountMetas: instruction.accounts.length,
|
|
1247
1434
|
expectedAccountMetas: 5
|
|
1248
1435
|
});
|
|
@@ -1253,6 +1440,12 @@ function parseCreatePlanInstruction(instruction) {
|
|
|
1253
1440
|
accountIndex += 1;
|
|
1254
1441
|
return accountMeta;
|
|
1255
1442
|
};
|
|
1443
|
+
let optionalAccountsRemaining = instruction.accounts.length - 5;
|
|
1444
|
+
const getNextOptionalAccount = () => {
|
|
1445
|
+
if (optionalAccountsRemaining === 0) return void 0;
|
|
1446
|
+
optionalAccountsRemaining -= 1;
|
|
1447
|
+
return getNextAccount();
|
|
1448
|
+
};
|
|
1256
1449
|
return {
|
|
1257
1450
|
programAddress: instruction.programAddress,
|
|
1258
1451
|
accounts: {
|
|
@@ -1260,7 +1453,8 @@ function parseCreatePlanInstruction(instruction) {
|
|
|
1260
1453
|
planPda: getNextAccount(),
|
|
1261
1454
|
tokenMint: getNextAccount(),
|
|
1262
1455
|
systemProgram: getNextAccount(),
|
|
1263
|
-
tokenProgram: getNextAccount()
|
|
1456
|
+
tokenProgram: getNextAccount(),
|
|
1457
|
+
payer: getNextOptionalAccount()
|
|
1264
1458
|
},
|
|
1265
1459
|
data: getCreatePlanInstructionDataDecoder().decode(instruction.data)
|
|
1266
1460
|
};
|
|
@@ -1268,37 +1462,37 @@ function parseCreatePlanInstruction(instruction) {
|
|
|
1268
1462
|
|
|
1269
1463
|
// src/generated/instructions/createRecurringDelegation.ts
|
|
1270
1464
|
import {
|
|
1271
|
-
combineCodec as
|
|
1272
|
-
getStructDecoder as
|
|
1273
|
-
getStructEncoder as
|
|
1274
|
-
getU8Decoder as
|
|
1275
|
-
getU8Encoder as
|
|
1276
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1277
|
-
SolanaError as
|
|
1278
|
-
transformEncoder as
|
|
1465
|
+
combineCodec as combineCodec24,
|
|
1466
|
+
getStructDecoder as getStructDecoder22,
|
|
1467
|
+
getStructEncoder as getStructEncoder22,
|
|
1468
|
+
getU8Decoder as getU8Decoder11,
|
|
1469
|
+
getU8Encoder as getU8Encoder11,
|
|
1470
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS6,
|
|
1471
|
+
SolanaError as SolanaError6,
|
|
1472
|
+
transformEncoder as transformEncoder6
|
|
1279
1473
|
} from "@solana/kit";
|
|
1280
|
-
import { getAccountMetaFactory as
|
|
1474
|
+
import { getAccountMetaFactory as getAccountMetaFactory6 } from "@solana/program-client-core";
|
|
1281
1475
|
var CREATE_RECURRING_DELEGATION_DISCRIMINATOR = 2;
|
|
1282
1476
|
function getCreateRecurringDelegationDiscriminatorBytes() {
|
|
1283
|
-
return
|
|
1477
|
+
return getU8Encoder11().encode(CREATE_RECURRING_DELEGATION_DISCRIMINATOR);
|
|
1284
1478
|
}
|
|
1285
1479
|
function getCreateRecurringDelegationInstructionDataEncoder() {
|
|
1286
|
-
return
|
|
1287
|
-
|
|
1288
|
-
["discriminator",
|
|
1480
|
+
return transformEncoder6(
|
|
1481
|
+
getStructEncoder22([
|
|
1482
|
+
["discriminator", getU8Encoder11()],
|
|
1289
1483
|
["recurringDelegation", getCreateRecurringDelegationDataEncoder()]
|
|
1290
1484
|
]),
|
|
1291
1485
|
(value) => ({ ...value, discriminator: CREATE_RECURRING_DELEGATION_DISCRIMINATOR })
|
|
1292
1486
|
);
|
|
1293
1487
|
}
|
|
1294
1488
|
function getCreateRecurringDelegationInstructionDataDecoder() {
|
|
1295
|
-
return
|
|
1296
|
-
["discriminator",
|
|
1489
|
+
return getStructDecoder22([
|
|
1490
|
+
["discriminator", getU8Decoder11()],
|
|
1297
1491
|
["recurringDelegation", getCreateRecurringDelegationDataDecoder()]
|
|
1298
1492
|
]);
|
|
1299
1493
|
}
|
|
1300
1494
|
function getCreateRecurringDelegationInstructionDataCodec() {
|
|
1301
|
-
return
|
|
1495
|
+
return combineCodec24(
|
|
1302
1496
|
getCreateRecurringDelegationInstructionDataEncoder(),
|
|
1303
1497
|
getCreateRecurringDelegationInstructionDataDecoder()
|
|
1304
1498
|
);
|
|
@@ -1318,7 +1512,7 @@ function getCreateRecurringDelegationInstruction(input, config) {
|
|
|
1318
1512
|
if (!accounts.systemProgram.value) {
|
|
1319
1513
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1320
1514
|
}
|
|
1321
|
-
const getAccountMeta =
|
|
1515
|
+
const getAccountMeta = getAccountMetaFactory6(programAddress, "omitted");
|
|
1322
1516
|
return Object.freeze({
|
|
1323
1517
|
accounts: [
|
|
1324
1518
|
getAccountMeta("delegator", accounts.delegator),
|
|
@@ -1336,7 +1530,7 @@ function getCreateRecurringDelegationInstruction(input, config) {
|
|
|
1336
1530
|
}
|
|
1337
1531
|
function parseCreateRecurringDelegationInstruction(instruction) {
|
|
1338
1532
|
if (instruction.accounts.length < 5) {
|
|
1339
|
-
throw new
|
|
1533
|
+
throw new SolanaError6(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS6, {
|
|
1340
1534
|
actualAccountMetas: instruction.accounts.length,
|
|
1341
1535
|
expectedAccountMetas: 5
|
|
1342
1536
|
});
|
|
@@ -1369,31 +1563,31 @@ function parseCreateRecurringDelegationInstruction(instruction) {
|
|
|
1369
1563
|
|
|
1370
1564
|
// src/generated/instructions/deletePlan.ts
|
|
1371
1565
|
import {
|
|
1372
|
-
combineCodec as
|
|
1373
|
-
getStructDecoder as
|
|
1374
|
-
getStructEncoder as
|
|
1375
|
-
getU8Decoder as
|
|
1376
|
-
getU8Encoder as
|
|
1377
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1378
|
-
SolanaError as
|
|
1379
|
-
transformEncoder as
|
|
1566
|
+
combineCodec as combineCodec25,
|
|
1567
|
+
getStructDecoder as getStructDecoder23,
|
|
1568
|
+
getStructEncoder as getStructEncoder23,
|
|
1569
|
+
getU8Decoder as getU8Decoder12,
|
|
1570
|
+
getU8Encoder as getU8Encoder12,
|
|
1571
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS7,
|
|
1572
|
+
SolanaError as SolanaError7,
|
|
1573
|
+
transformEncoder as transformEncoder7
|
|
1380
1574
|
} from "@solana/kit";
|
|
1381
|
-
import { getAccountMetaFactory as
|
|
1575
|
+
import { getAccountMetaFactory as getAccountMetaFactory7 } from "@solana/program-client-core";
|
|
1382
1576
|
var DELETE_PLAN_DISCRIMINATOR = 9;
|
|
1383
1577
|
function getDeletePlanDiscriminatorBytes() {
|
|
1384
|
-
return
|
|
1578
|
+
return getU8Encoder12().encode(DELETE_PLAN_DISCRIMINATOR);
|
|
1385
1579
|
}
|
|
1386
1580
|
function getDeletePlanInstructionDataEncoder() {
|
|
1387
|
-
return
|
|
1581
|
+
return transformEncoder7(getStructEncoder23([["discriminator", getU8Encoder12()]]), (value) => ({
|
|
1388
1582
|
...value,
|
|
1389
1583
|
discriminator: DELETE_PLAN_DISCRIMINATOR
|
|
1390
1584
|
}));
|
|
1391
1585
|
}
|
|
1392
1586
|
function getDeletePlanInstructionDataDecoder() {
|
|
1393
|
-
return
|
|
1587
|
+
return getStructDecoder23([["discriminator", getU8Decoder12()]]);
|
|
1394
1588
|
}
|
|
1395
1589
|
function getDeletePlanInstructionDataCodec() {
|
|
1396
|
-
return
|
|
1590
|
+
return combineCodec25(getDeletePlanInstructionDataEncoder(), getDeletePlanInstructionDataDecoder());
|
|
1397
1591
|
}
|
|
1398
1592
|
function getDeletePlanInstruction(input, config) {
|
|
1399
1593
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1402,7 +1596,7 @@ function getDeletePlanInstruction(input, config) {
|
|
|
1402
1596
|
planPda: { value: input.planPda ?? null, isWritable: true }
|
|
1403
1597
|
};
|
|
1404
1598
|
const accounts = originalAccounts;
|
|
1405
|
-
const getAccountMeta =
|
|
1599
|
+
const getAccountMeta = getAccountMetaFactory7(programAddress, "programId");
|
|
1406
1600
|
return Object.freeze({
|
|
1407
1601
|
accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
|
|
1408
1602
|
data: getDeletePlanInstructionDataEncoder().encode({}),
|
|
@@ -1411,7 +1605,7 @@ function getDeletePlanInstruction(input, config) {
|
|
|
1411
1605
|
}
|
|
1412
1606
|
function parseDeletePlanInstruction(instruction) {
|
|
1413
1607
|
if (instruction.accounts.length < 2) {
|
|
1414
|
-
throw new
|
|
1608
|
+
throw new SolanaError7(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS7, {
|
|
1415
1609
|
actualAccountMetas: instruction.accounts.length,
|
|
1416
1610
|
expectedAccountMetas: 2
|
|
1417
1611
|
});
|
|
@@ -1431,34 +1625,34 @@ function parseDeletePlanInstruction(instruction) {
|
|
|
1431
1625
|
|
|
1432
1626
|
// src/generated/instructions/initSubscriptionAuthority.ts
|
|
1433
1627
|
import {
|
|
1434
|
-
combineCodec as
|
|
1435
|
-
getStructDecoder as
|
|
1436
|
-
getStructEncoder as
|
|
1437
|
-
getU8Decoder as
|
|
1438
|
-
getU8Encoder as
|
|
1439
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1440
|
-
SolanaError as
|
|
1441
|
-
transformEncoder as
|
|
1628
|
+
combineCodec as combineCodec26,
|
|
1629
|
+
getStructDecoder as getStructDecoder24,
|
|
1630
|
+
getStructEncoder as getStructEncoder24,
|
|
1631
|
+
getU8Decoder as getU8Decoder13,
|
|
1632
|
+
getU8Encoder as getU8Encoder13,
|
|
1633
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8,
|
|
1634
|
+
SolanaError as SolanaError8,
|
|
1635
|
+
transformEncoder as transformEncoder8
|
|
1442
1636
|
} from "@solana/kit";
|
|
1443
1637
|
import {
|
|
1444
|
-
getAccountMetaFactory as
|
|
1445
|
-
getAddressFromResolvedInstructionAccount as
|
|
1638
|
+
getAccountMetaFactory as getAccountMetaFactory8,
|
|
1639
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount3
|
|
1446
1640
|
} from "@solana/program-client-core";
|
|
1447
1641
|
var INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 0;
|
|
1448
1642
|
function getInitSubscriptionAuthorityDiscriminatorBytes() {
|
|
1449
|
-
return
|
|
1643
|
+
return getU8Encoder13().encode(INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
|
|
1450
1644
|
}
|
|
1451
1645
|
function getInitSubscriptionAuthorityInstructionDataEncoder() {
|
|
1452
|
-
return
|
|
1646
|
+
return transformEncoder8(getStructEncoder24([["discriminator", getU8Encoder13()]]), (value) => ({
|
|
1453
1647
|
...value,
|
|
1454
1648
|
discriminator: INIT_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
|
|
1455
1649
|
}));
|
|
1456
1650
|
}
|
|
1457
1651
|
function getInitSubscriptionAuthorityInstructionDataDecoder() {
|
|
1458
|
-
return
|
|
1652
|
+
return getStructDecoder24([["discriminator", getU8Decoder13()]]);
|
|
1459
1653
|
}
|
|
1460
1654
|
function getInitSubscriptionAuthorityInstructionDataCodec() {
|
|
1461
|
-
return
|
|
1655
|
+
return combineCodec26(
|
|
1462
1656
|
getInitSubscriptionAuthorityInstructionDataEncoder(),
|
|
1463
1657
|
getInitSubscriptionAuthorityInstructionDataDecoder()
|
|
1464
1658
|
);
|
|
@@ -1477,14 +1671,14 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
|
|
|
1477
1671
|
const accounts = originalAccounts;
|
|
1478
1672
|
if (!accounts.subscriptionAuthority.value) {
|
|
1479
1673
|
accounts.subscriptionAuthority.value = await findSubscriptionAuthorityPda({
|
|
1480
|
-
user:
|
|
1481
|
-
tokenMint:
|
|
1674
|
+
user: getAddressFromResolvedInstructionAccount3("owner", accounts.owner.value),
|
|
1675
|
+
tokenMint: getAddressFromResolvedInstructionAccount3("tokenMint", accounts.tokenMint.value)
|
|
1482
1676
|
});
|
|
1483
1677
|
}
|
|
1484
1678
|
if (!accounts.systemProgram.value) {
|
|
1485
1679
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1486
1680
|
}
|
|
1487
|
-
const getAccountMeta =
|
|
1681
|
+
const getAccountMeta = getAccountMetaFactory8(programAddress, "omitted");
|
|
1488
1682
|
return Object.freeze({
|
|
1489
1683
|
accounts: [
|
|
1490
1684
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -1514,7 +1708,7 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
|
|
|
1514
1708
|
if (!accounts.systemProgram.value) {
|
|
1515
1709
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
1516
1710
|
}
|
|
1517
|
-
const getAccountMeta =
|
|
1711
|
+
const getAccountMeta = getAccountMetaFactory8(programAddress, "omitted");
|
|
1518
1712
|
return Object.freeze({
|
|
1519
1713
|
accounts: [
|
|
1520
1714
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -1531,7 +1725,7 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
|
|
|
1531
1725
|
}
|
|
1532
1726
|
function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
1533
1727
|
if (instruction.accounts.length < 6) {
|
|
1534
|
-
throw new
|
|
1728
|
+
throw new SolanaError8(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8, {
|
|
1535
1729
|
actualAccountMetas: instruction.accounts.length,
|
|
1536
1730
|
expectedAccountMetas: 6
|
|
1537
1731
|
});
|
|
@@ -1565,36 +1759,42 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
|
1565
1759
|
|
|
1566
1760
|
// src/generated/instructions/resumeSubscription.ts
|
|
1567
1761
|
import {
|
|
1568
|
-
combineCodec as
|
|
1569
|
-
getProgramDerivedAddress as
|
|
1570
|
-
getStructDecoder as
|
|
1571
|
-
getStructEncoder as
|
|
1572
|
-
getU8Decoder as
|
|
1573
|
-
getU8Encoder as
|
|
1574
|
-
getUtf8Encoder as
|
|
1575
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1576
|
-
SolanaError as
|
|
1577
|
-
transformEncoder as
|
|
1762
|
+
combineCodec as combineCodec27,
|
|
1763
|
+
getProgramDerivedAddress as getProgramDerivedAddress9,
|
|
1764
|
+
getStructDecoder as getStructDecoder25,
|
|
1765
|
+
getStructEncoder as getStructEncoder25,
|
|
1766
|
+
getU8Decoder as getU8Decoder14,
|
|
1767
|
+
getU8Encoder as getU8Encoder14,
|
|
1768
|
+
getUtf8Encoder as getUtf8Encoder11,
|
|
1769
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9,
|
|
1770
|
+
SolanaError as SolanaError9,
|
|
1771
|
+
transformEncoder as transformEncoder9
|
|
1578
1772
|
} from "@solana/kit";
|
|
1579
1773
|
import {
|
|
1580
|
-
getAccountMetaFactory as
|
|
1581
|
-
getAddressFromResolvedInstructionAccount as
|
|
1774
|
+
getAccountMetaFactory as getAccountMetaFactory9,
|
|
1775
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount4
|
|
1582
1776
|
} from "@solana/program-client-core";
|
|
1583
1777
|
var RESUME_SUBSCRIPTION_DISCRIMINATOR = 13;
|
|
1584
1778
|
function getResumeSubscriptionDiscriminatorBytes() {
|
|
1585
|
-
return
|
|
1779
|
+
return getU8Encoder14().encode(RESUME_SUBSCRIPTION_DISCRIMINATOR);
|
|
1586
1780
|
}
|
|
1587
1781
|
function getResumeSubscriptionInstructionDataEncoder() {
|
|
1588
|
-
return
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1782
|
+
return transformEncoder9(
|
|
1783
|
+
getStructEncoder25([
|
|
1784
|
+
["discriminator", getU8Encoder14()],
|
|
1785
|
+
["resumeData", getResumeDataEncoder()]
|
|
1786
|
+
]),
|
|
1787
|
+
(value) => ({ ...value, discriminator: RESUME_SUBSCRIPTION_DISCRIMINATOR })
|
|
1788
|
+
);
|
|
1592
1789
|
}
|
|
1593
1790
|
function getResumeSubscriptionInstructionDataDecoder() {
|
|
1594
|
-
return
|
|
1791
|
+
return getStructDecoder25([
|
|
1792
|
+
["discriminator", getU8Decoder14()],
|
|
1793
|
+
["resumeData", getResumeDataDecoder()]
|
|
1794
|
+
]);
|
|
1595
1795
|
}
|
|
1596
1796
|
function getResumeSubscriptionInstructionDataCodec() {
|
|
1597
|
-
return
|
|
1797
|
+
return combineCodec27(getResumeSubscriptionInstructionDataEncoder(), getResumeSubscriptionInstructionDataDecoder());
|
|
1598
1798
|
}
|
|
1599
1799
|
async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
1600
1800
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1607,23 +1807,24 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
|
1607
1807
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1608
1808
|
};
|
|
1609
1809
|
const accounts = originalAccounts;
|
|
1810
|
+
const args = { ...input };
|
|
1610
1811
|
if (!accounts.subscriptionPda.value) {
|
|
1611
1812
|
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1612
|
-
planPda:
|
|
1613
|
-
subscriber:
|
|
1813
|
+
planPda: getAddressFromResolvedInstructionAccount4("planPda", accounts.planPda.value),
|
|
1814
|
+
subscriber: getAddressFromResolvedInstructionAccount4("subscriber", accounts.subscriber.value)
|
|
1614
1815
|
});
|
|
1615
1816
|
}
|
|
1616
1817
|
if (!accounts.eventAuthority.value) {
|
|
1617
|
-
accounts.eventAuthority.value = await
|
|
1818
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress9({
|
|
1618
1819
|
programAddress,
|
|
1619
|
-
seeds: [
|
|
1820
|
+
seeds: [getUtf8Encoder11().encode("event_authority")]
|
|
1620
1821
|
});
|
|
1621
1822
|
}
|
|
1622
1823
|
if (!accounts.selfProgram.value) {
|
|
1623
1824
|
accounts.selfProgram.value = programAddress;
|
|
1624
1825
|
accounts.selfProgram.isWritable = false;
|
|
1625
1826
|
}
|
|
1626
|
-
const getAccountMeta =
|
|
1827
|
+
const getAccountMeta = getAccountMetaFactory9(programAddress, "programId");
|
|
1627
1828
|
return Object.freeze({
|
|
1628
1829
|
accounts: [
|
|
1629
1830
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1633,7 +1834,7 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
|
1633
1834
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1634
1835
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1635
1836
|
],
|
|
1636
|
-
data: getResumeSubscriptionInstructionDataEncoder().encode(
|
|
1837
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode(args),
|
|
1637
1838
|
programAddress
|
|
1638
1839
|
});
|
|
1639
1840
|
}
|
|
@@ -1648,11 +1849,12 @@ function getResumeSubscriptionInstruction(input, config) {
|
|
|
1648
1849
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1649
1850
|
};
|
|
1650
1851
|
const accounts = originalAccounts;
|
|
1852
|
+
const args = { ...input };
|
|
1651
1853
|
if (!accounts.selfProgram.value) {
|
|
1652
1854
|
accounts.selfProgram.value = programAddress;
|
|
1653
1855
|
accounts.selfProgram.isWritable = false;
|
|
1654
1856
|
}
|
|
1655
|
-
const getAccountMeta =
|
|
1857
|
+
const getAccountMeta = getAccountMetaFactory9(programAddress, "programId");
|
|
1656
1858
|
return Object.freeze({
|
|
1657
1859
|
accounts: [
|
|
1658
1860
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1662,13 +1864,13 @@ function getResumeSubscriptionInstruction(input, config) {
|
|
|
1662
1864
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1663
1865
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1664
1866
|
],
|
|
1665
|
-
data: getResumeSubscriptionInstructionDataEncoder().encode(
|
|
1867
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode(args),
|
|
1666
1868
|
programAddress
|
|
1667
1869
|
});
|
|
1668
1870
|
}
|
|
1669
1871
|
function parseResumeSubscriptionInstruction(instruction) {
|
|
1670
1872
|
if (instruction.accounts.length < 6) {
|
|
1671
|
-
throw new
|
|
1873
|
+
throw new SolanaError9(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9, {
|
|
1672
1874
|
actualAccountMetas: instruction.accounts.length,
|
|
1673
1875
|
expectedAccountMetas: 6
|
|
1674
1876
|
});
|
|
@@ -1695,31 +1897,31 @@ function parseResumeSubscriptionInstruction(instruction) {
|
|
|
1695
1897
|
|
|
1696
1898
|
// src/generated/instructions/revokeAbandonedDelegation.ts
|
|
1697
1899
|
import {
|
|
1698
|
-
combineCodec as
|
|
1699
|
-
getStructDecoder as
|
|
1700
|
-
getStructEncoder as
|
|
1701
|
-
getU8Decoder as
|
|
1702
|
-
getU8Encoder as
|
|
1703
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1704
|
-
SolanaError as
|
|
1705
|
-
transformEncoder as
|
|
1900
|
+
combineCodec as combineCodec28,
|
|
1901
|
+
getStructDecoder as getStructDecoder26,
|
|
1902
|
+
getStructEncoder as getStructEncoder26,
|
|
1903
|
+
getU8Decoder as getU8Decoder15,
|
|
1904
|
+
getU8Encoder as getU8Encoder15,
|
|
1905
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10,
|
|
1906
|
+
SolanaError as SolanaError10,
|
|
1907
|
+
transformEncoder as transformEncoder10
|
|
1706
1908
|
} from "@solana/kit";
|
|
1707
|
-
import { getAccountMetaFactory as
|
|
1909
|
+
import { getAccountMetaFactory as getAccountMetaFactory10 } from "@solana/program-client-core";
|
|
1708
1910
|
var REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR = 15;
|
|
1709
1911
|
function getRevokeAbandonedDelegationDiscriminatorBytes() {
|
|
1710
|
-
return
|
|
1912
|
+
return getU8Encoder15().encode(REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR);
|
|
1711
1913
|
}
|
|
1712
1914
|
function getRevokeAbandonedDelegationInstructionDataEncoder() {
|
|
1713
|
-
return
|
|
1915
|
+
return transformEncoder10(getStructEncoder26([["discriminator", getU8Encoder15()]]), (value) => ({
|
|
1714
1916
|
...value,
|
|
1715
1917
|
discriminator: REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR
|
|
1716
1918
|
}));
|
|
1717
1919
|
}
|
|
1718
1920
|
function getRevokeAbandonedDelegationInstructionDataDecoder() {
|
|
1719
|
-
return
|
|
1921
|
+
return getStructDecoder26([["discriminator", getU8Decoder15()]]);
|
|
1720
1922
|
}
|
|
1721
1923
|
function getRevokeAbandonedDelegationInstructionDataCodec() {
|
|
1722
|
-
return
|
|
1924
|
+
return combineCodec28(
|
|
1723
1925
|
getRevokeAbandonedDelegationInstructionDataEncoder(),
|
|
1724
1926
|
getRevokeAbandonedDelegationInstructionDataDecoder()
|
|
1725
1927
|
);
|
|
@@ -1732,7 +1934,7 @@ function getRevokeAbandonedDelegationInstruction(input, config) {
|
|
|
1732
1934
|
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false }
|
|
1733
1935
|
};
|
|
1734
1936
|
const accounts = originalAccounts;
|
|
1735
|
-
const getAccountMeta =
|
|
1937
|
+
const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
|
|
1736
1938
|
return Object.freeze({
|
|
1737
1939
|
accounts: [
|
|
1738
1940
|
getAccountMeta("payer", accounts.payer),
|
|
@@ -1745,7 +1947,7 @@ function getRevokeAbandonedDelegationInstruction(input, config) {
|
|
|
1745
1947
|
}
|
|
1746
1948
|
function parseRevokeAbandonedDelegationInstruction(instruction) {
|
|
1747
1949
|
if (instruction.accounts.length < 3) {
|
|
1748
|
-
throw new
|
|
1950
|
+
throw new SolanaError10(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10, {
|
|
1749
1951
|
actualAccountMetas: instruction.accounts.length,
|
|
1750
1952
|
expectedAccountMetas: 3
|
|
1751
1953
|
});
|
|
@@ -1769,31 +1971,31 @@ function parseRevokeAbandonedDelegationInstruction(instruction) {
|
|
|
1769
1971
|
|
|
1770
1972
|
// src/generated/instructions/revokeAbandonedSubscription.ts
|
|
1771
1973
|
import {
|
|
1772
|
-
combineCodec as
|
|
1773
|
-
getStructDecoder as
|
|
1774
|
-
getStructEncoder as
|
|
1775
|
-
getU8Decoder as
|
|
1776
|
-
getU8Encoder as
|
|
1777
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1778
|
-
SolanaError as
|
|
1779
|
-
transformEncoder as
|
|
1974
|
+
combineCodec as combineCodec29,
|
|
1975
|
+
getStructDecoder as getStructDecoder27,
|
|
1976
|
+
getStructEncoder as getStructEncoder27,
|
|
1977
|
+
getU8Decoder as getU8Decoder16,
|
|
1978
|
+
getU8Encoder as getU8Encoder16,
|
|
1979
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11,
|
|
1980
|
+
SolanaError as SolanaError11,
|
|
1981
|
+
transformEncoder as transformEncoder11
|
|
1780
1982
|
} from "@solana/kit";
|
|
1781
|
-
import { getAccountMetaFactory as
|
|
1983
|
+
import { getAccountMetaFactory as getAccountMetaFactory11 } from "@solana/program-client-core";
|
|
1782
1984
|
var REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR = 16;
|
|
1783
1985
|
function getRevokeAbandonedSubscriptionDiscriminatorBytes() {
|
|
1784
|
-
return
|
|
1986
|
+
return getU8Encoder16().encode(REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR);
|
|
1785
1987
|
}
|
|
1786
1988
|
function getRevokeAbandonedSubscriptionInstructionDataEncoder() {
|
|
1787
|
-
return
|
|
1989
|
+
return transformEncoder11(getStructEncoder27([["discriminator", getU8Encoder16()]]), (value) => ({
|
|
1788
1990
|
...value,
|
|
1789
1991
|
discriminator: REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR
|
|
1790
1992
|
}));
|
|
1791
1993
|
}
|
|
1792
1994
|
function getRevokeAbandonedSubscriptionInstructionDataDecoder() {
|
|
1793
|
-
return
|
|
1995
|
+
return getStructDecoder27([["discriminator", getU8Decoder16()]]);
|
|
1794
1996
|
}
|
|
1795
1997
|
function getRevokeAbandonedSubscriptionInstructionDataCodec() {
|
|
1796
|
-
return
|
|
1998
|
+
return combineCodec29(
|
|
1797
1999
|
getRevokeAbandonedSubscriptionInstructionDataEncoder(),
|
|
1798
2000
|
getRevokeAbandonedSubscriptionInstructionDataDecoder()
|
|
1799
2001
|
);
|
|
@@ -1807,7 +2009,7 @@ function getRevokeAbandonedSubscriptionInstruction(input, config) {
|
|
|
1807
2009
|
planPda: { value: input.planPda ?? null, isWritable: false }
|
|
1808
2010
|
};
|
|
1809
2011
|
const accounts = originalAccounts;
|
|
1810
|
-
const getAccountMeta =
|
|
2012
|
+
const getAccountMeta = getAccountMetaFactory11(programAddress, "programId");
|
|
1811
2013
|
return Object.freeze({
|
|
1812
2014
|
accounts: [
|
|
1813
2015
|
getAccountMeta("payer", accounts.payer),
|
|
@@ -1821,7 +2023,7 @@ function getRevokeAbandonedSubscriptionInstruction(input, config) {
|
|
|
1821
2023
|
}
|
|
1822
2024
|
function parseRevokeAbandonedSubscriptionInstruction(instruction) {
|
|
1823
2025
|
if (instruction.accounts.length < 4) {
|
|
1824
|
-
throw new
|
|
2026
|
+
throw new SolanaError11(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11, {
|
|
1825
2027
|
actualAccountMetas: instruction.accounts.length,
|
|
1826
2028
|
expectedAccountMetas: 4
|
|
1827
2029
|
});
|
|
@@ -1845,32 +2047,32 @@ function parseRevokeAbandonedSubscriptionInstruction(instruction) {
|
|
|
1845
2047
|
}
|
|
1846
2048
|
|
|
1847
2049
|
// src/generated/instructions/revokeDelegation.ts
|
|
1848
|
-
import {
|
|
1849
|
-
combineCodec as
|
|
1850
|
-
getStructDecoder as
|
|
1851
|
-
getStructEncoder as
|
|
1852
|
-
getU8Decoder as
|
|
1853
|
-
getU8Encoder as
|
|
1854
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1855
|
-
SolanaError as
|
|
1856
|
-
transformEncoder as
|
|
2050
|
+
import {
|
|
2051
|
+
combineCodec as combineCodec30,
|
|
2052
|
+
getStructDecoder as getStructDecoder28,
|
|
2053
|
+
getStructEncoder as getStructEncoder28,
|
|
2054
|
+
getU8Decoder as getU8Decoder17,
|
|
2055
|
+
getU8Encoder as getU8Encoder17,
|
|
2056
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12,
|
|
2057
|
+
SolanaError as SolanaError12,
|
|
2058
|
+
transformEncoder as transformEncoder12
|
|
1857
2059
|
} from "@solana/kit";
|
|
1858
|
-
import { getAccountMetaFactory as
|
|
2060
|
+
import { getAccountMetaFactory as getAccountMetaFactory12 } from "@solana/program-client-core";
|
|
1859
2061
|
var REVOKE_DELEGATION_DISCRIMINATOR = 3;
|
|
1860
2062
|
function getRevokeDelegationDiscriminatorBytes() {
|
|
1861
|
-
return
|
|
2063
|
+
return getU8Encoder17().encode(REVOKE_DELEGATION_DISCRIMINATOR);
|
|
1862
2064
|
}
|
|
1863
2065
|
function getRevokeDelegationInstructionDataEncoder() {
|
|
1864
|
-
return
|
|
2066
|
+
return transformEncoder12(getStructEncoder28([["discriminator", getU8Encoder17()]]), (value) => ({
|
|
1865
2067
|
...value,
|
|
1866
2068
|
discriminator: REVOKE_DELEGATION_DISCRIMINATOR
|
|
1867
2069
|
}));
|
|
1868
2070
|
}
|
|
1869
2071
|
function getRevokeDelegationInstructionDataDecoder() {
|
|
1870
|
-
return
|
|
2072
|
+
return getStructDecoder28([["discriminator", getU8Decoder17()]]);
|
|
1871
2073
|
}
|
|
1872
2074
|
function getRevokeDelegationInstructionDataCodec() {
|
|
1873
|
-
return
|
|
2075
|
+
return combineCodec30(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
|
|
1874
2076
|
}
|
|
1875
2077
|
function getRevokeDelegationInstruction(input, config) {
|
|
1876
2078
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1879,7 +2081,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1879
2081
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
|
|
1880
2082
|
};
|
|
1881
2083
|
const accounts = originalAccounts;
|
|
1882
|
-
const getAccountMeta =
|
|
2084
|
+
const getAccountMeta = getAccountMetaFactory12(programAddress, "programId");
|
|
1883
2085
|
return Object.freeze({
|
|
1884
2086
|
accounts: [
|
|
1885
2087
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -1891,7 +2093,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1891
2093
|
}
|
|
1892
2094
|
function parseRevokeDelegationInstruction(instruction) {
|
|
1893
2095
|
if (instruction.accounts.length < 2) {
|
|
1894
|
-
throw new
|
|
2096
|
+
throw new SolanaError12(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12, {
|
|
1895
2097
|
actualAccountMetas: instruction.accounts.length,
|
|
1896
2098
|
expectedAccountMetas: 2
|
|
1897
2099
|
});
|
|
@@ -1911,34 +2113,34 @@ function parseRevokeDelegationInstruction(instruction) {
|
|
|
1911
2113
|
|
|
1912
2114
|
// src/generated/instructions/revokeSubscriptionAuthority.ts
|
|
1913
2115
|
import {
|
|
1914
|
-
combineCodec as
|
|
1915
|
-
getStructDecoder as
|
|
1916
|
-
getStructEncoder as
|
|
1917
|
-
getU8Decoder as
|
|
1918
|
-
getU8Encoder as
|
|
1919
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1920
|
-
SolanaError as
|
|
1921
|
-
transformEncoder as
|
|
2116
|
+
combineCodec as combineCodec31,
|
|
2117
|
+
getStructDecoder as getStructDecoder29,
|
|
2118
|
+
getStructEncoder as getStructEncoder29,
|
|
2119
|
+
getU8Decoder as getU8Decoder18,
|
|
2120
|
+
getU8Encoder as getU8Encoder18,
|
|
2121
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13,
|
|
2122
|
+
SolanaError as SolanaError13,
|
|
2123
|
+
transformEncoder as transformEncoder13
|
|
1922
2124
|
} from "@solana/kit";
|
|
1923
2125
|
import {
|
|
1924
|
-
getAccountMetaFactory as
|
|
1925
|
-
getAddressFromResolvedInstructionAccount as
|
|
2126
|
+
getAccountMetaFactory as getAccountMetaFactory13,
|
|
2127
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount5
|
|
1926
2128
|
} from "@solana/program-client-core";
|
|
1927
2129
|
var REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 14;
|
|
1928
2130
|
function getRevokeSubscriptionAuthorityDiscriminatorBytes() {
|
|
1929
|
-
return
|
|
2131
|
+
return getU8Encoder18().encode(REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
|
|
1930
2132
|
}
|
|
1931
2133
|
function getRevokeSubscriptionAuthorityInstructionDataEncoder() {
|
|
1932
|
-
return
|
|
2134
|
+
return transformEncoder13(getStructEncoder29([["discriminator", getU8Encoder18()]]), (value) => ({
|
|
1933
2135
|
...value,
|
|
1934
2136
|
discriminator: REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
|
|
1935
2137
|
}));
|
|
1936
2138
|
}
|
|
1937
2139
|
function getRevokeSubscriptionAuthorityInstructionDataDecoder() {
|
|
1938
|
-
return
|
|
2140
|
+
return getStructDecoder29([["discriminator", getU8Decoder18()]]);
|
|
1939
2141
|
}
|
|
1940
2142
|
function getRevokeSubscriptionAuthorityInstructionDataCodec() {
|
|
1941
|
-
return
|
|
2143
|
+
return combineCodec31(
|
|
1942
2144
|
getRevokeSubscriptionAuthorityInstructionDataEncoder(),
|
|
1943
2145
|
getRevokeSubscriptionAuthorityInstructionDataDecoder()
|
|
1944
2146
|
);
|
|
@@ -1956,11 +2158,11 @@ async function getRevokeSubscriptionAuthorityInstructionAsync(input, config) {
|
|
|
1956
2158
|
const accounts = originalAccounts;
|
|
1957
2159
|
if (!accounts.subscriptionAuthority.value) {
|
|
1958
2160
|
accounts.subscriptionAuthority.value = await findSubscriptionAuthorityPda({
|
|
1959
|
-
user:
|
|
1960
|
-
tokenMint:
|
|
2161
|
+
user: getAddressFromResolvedInstructionAccount5("user", accounts.user.value),
|
|
2162
|
+
tokenMint: getAddressFromResolvedInstructionAccount5("tokenMint", accounts.tokenMint.value)
|
|
1961
2163
|
});
|
|
1962
2164
|
}
|
|
1963
|
-
const getAccountMeta =
|
|
2165
|
+
const getAccountMeta = getAccountMetaFactory13(programAddress, "omitted");
|
|
1964
2166
|
return Object.freeze({
|
|
1965
2167
|
accounts: [
|
|
1966
2168
|
getAccountMeta("user", accounts.user),
|
|
@@ -1985,7 +2187,7 @@ function getRevokeSubscriptionAuthorityInstruction(input, config) {
|
|
|
1985
2187
|
receiver: { value: input.receiver ?? null, isWritable: true }
|
|
1986
2188
|
};
|
|
1987
2189
|
const accounts = originalAccounts;
|
|
1988
|
-
const getAccountMeta =
|
|
2190
|
+
const getAccountMeta = getAccountMetaFactory13(programAddress, "omitted");
|
|
1989
2191
|
return Object.freeze({
|
|
1990
2192
|
accounts: [
|
|
1991
2193
|
getAccountMeta("user", accounts.user),
|
|
@@ -2001,7 +2203,7 @@ function getRevokeSubscriptionAuthorityInstruction(input, config) {
|
|
|
2001
2203
|
}
|
|
2002
2204
|
function parseRevokeSubscriptionAuthorityInstruction(instruction) {
|
|
2003
2205
|
if (instruction.accounts.length < 5) {
|
|
2004
|
-
throw new
|
|
2206
|
+
throw new SolanaError13(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13, {
|
|
2005
2207
|
actualAccountMetas: instruction.accounts.length,
|
|
2006
2208
|
expectedAccountMetas: 5
|
|
2007
2209
|
});
|
|
@@ -2034,42 +2236,42 @@ function parseRevokeSubscriptionAuthorityInstruction(instruction) {
|
|
|
2034
2236
|
|
|
2035
2237
|
// src/generated/instructions/subscribe.ts
|
|
2036
2238
|
import {
|
|
2037
|
-
combineCodec as
|
|
2038
|
-
getProgramDerivedAddress as
|
|
2039
|
-
getStructDecoder as
|
|
2040
|
-
getStructEncoder as
|
|
2041
|
-
getU8Decoder as
|
|
2042
|
-
getU8Encoder as
|
|
2043
|
-
getUtf8Encoder as
|
|
2044
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2045
|
-
SolanaError as
|
|
2046
|
-
transformEncoder as
|
|
2239
|
+
combineCodec as combineCodec32,
|
|
2240
|
+
getProgramDerivedAddress as getProgramDerivedAddress10,
|
|
2241
|
+
getStructDecoder as getStructDecoder30,
|
|
2242
|
+
getStructEncoder as getStructEncoder30,
|
|
2243
|
+
getU8Decoder as getU8Decoder19,
|
|
2244
|
+
getU8Encoder as getU8Encoder19,
|
|
2245
|
+
getUtf8Encoder as getUtf8Encoder12,
|
|
2246
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14,
|
|
2247
|
+
SolanaError as SolanaError14,
|
|
2248
|
+
transformEncoder as transformEncoder14
|
|
2047
2249
|
} from "@solana/kit";
|
|
2048
2250
|
import {
|
|
2049
|
-
getAccountMetaFactory as
|
|
2050
|
-
getAddressFromResolvedInstructionAccount as
|
|
2251
|
+
getAccountMetaFactory as getAccountMetaFactory14,
|
|
2252
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount6
|
|
2051
2253
|
} from "@solana/program-client-core";
|
|
2052
2254
|
var SUBSCRIBE_DISCRIMINATOR = 11;
|
|
2053
2255
|
function getSubscribeDiscriminatorBytes() {
|
|
2054
|
-
return
|
|
2256
|
+
return getU8Encoder19().encode(SUBSCRIBE_DISCRIMINATOR);
|
|
2055
2257
|
}
|
|
2056
2258
|
function getSubscribeInstructionDataEncoder() {
|
|
2057
|
-
return
|
|
2058
|
-
|
|
2059
|
-
["discriminator",
|
|
2259
|
+
return transformEncoder14(
|
|
2260
|
+
getStructEncoder30([
|
|
2261
|
+
["discriminator", getU8Encoder19()],
|
|
2060
2262
|
["subscribeData", getSubscribeDataEncoder()]
|
|
2061
2263
|
]),
|
|
2062
2264
|
(value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
|
|
2063
2265
|
);
|
|
2064
2266
|
}
|
|
2065
2267
|
function getSubscribeInstructionDataDecoder() {
|
|
2066
|
-
return
|
|
2067
|
-
["discriminator",
|
|
2268
|
+
return getStructDecoder30([
|
|
2269
|
+
["discriminator", getU8Decoder19()],
|
|
2068
2270
|
["subscribeData", getSubscribeDataDecoder()]
|
|
2069
2271
|
]);
|
|
2070
2272
|
}
|
|
2071
2273
|
function getSubscribeInstructionDataCodec() {
|
|
2072
|
-
return
|
|
2274
|
+
return combineCodec32(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
|
|
2073
2275
|
}
|
|
2074
2276
|
async function getSubscribeInstructionAsync(input, config) {
|
|
2075
2277
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2088,24 +2290,24 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
2088
2290
|
const args = { ...input };
|
|
2089
2291
|
if (!accounts.subscriptionPda.value) {
|
|
2090
2292
|
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
2091
|
-
planPda:
|
|
2092
|
-
subscriber:
|
|
2293
|
+
planPda: getAddressFromResolvedInstructionAccount6("planPda", accounts.planPda.value),
|
|
2294
|
+
subscriber: getAddressFromResolvedInstructionAccount6("subscriber", accounts.subscriber.value)
|
|
2093
2295
|
});
|
|
2094
2296
|
}
|
|
2095
2297
|
if (!accounts.systemProgram.value) {
|
|
2096
2298
|
accounts.systemProgram.value = "11111111111111111111111111111111";
|
|
2097
2299
|
}
|
|
2098
2300
|
if (!accounts.eventAuthority.value) {
|
|
2099
|
-
accounts.eventAuthority.value = await
|
|
2301
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress10({
|
|
2100
2302
|
programAddress,
|
|
2101
|
-
seeds: [
|
|
2303
|
+
seeds: [getUtf8Encoder12().encode("event_authority")]
|
|
2102
2304
|
});
|
|
2103
2305
|
}
|
|
2104
2306
|
if (!accounts.selfProgram.value) {
|
|
2105
2307
|
accounts.selfProgram.value = programAddress;
|
|
2106
2308
|
accounts.selfProgram.isWritable = false;
|
|
2107
2309
|
}
|
|
2108
|
-
const getAccountMeta =
|
|
2310
|
+
const getAccountMeta = getAccountMetaFactory14(programAddress, "omitted");
|
|
2109
2311
|
return Object.freeze({
|
|
2110
2312
|
accounts: [
|
|
2111
2313
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -2144,7 +2346,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
2144
2346
|
accounts.selfProgram.value = programAddress;
|
|
2145
2347
|
accounts.selfProgram.isWritable = false;
|
|
2146
2348
|
}
|
|
2147
|
-
const getAccountMeta =
|
|
2349
|
+
const getAccountMeta = getAccountMetaFactory14(programAddress, "omitted");
|
|
2148
2350
|
return Object.freeze({
|
|
2149
2351
|
accounts: [
|
|
2150
2352
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -2163,7 +2365,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
2163
2365
|
}
|
|
2164
2366
|
function parseSubscribeInstruction(instruction) {
|
|
2165
2367
|
if (instruction.accounts.length < 8) {
|
|
2166
|
-
throw new
|
|
2368
|
+
throw new SolanaError14(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14, {
|
|
2167
2369
|
actualAccountMetas: instruction.accounts.length,
|
|
2168
2370
|
expectedAccountMetas: 8
|
|
2169
2371
|
});
|
|
@@ -2199,39 +2401,39 @@ function parseSubscribeInstruction(instruction) {
|
|
|
2199
2401
|
|
|
2200
2402
|
// src/generated/instructions/transferFixed.ts
|
|
2201
2403
|
import {
|
|
2202
|
-
combineCodec as
|
|
2203
|
-
getProgramDerivedAddress as
|
|
2204
|
-
getStructDecoder as
|
|
2205
|
-
getStructEncoder as
|
|
2206
|
-
getU8Decoder as
|
|
2207
|
-
getU8Encoder as
|
|
2208
|
-
getUtf8Encoder as
|
|
2209
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2210
|
-
SolanaError as
|
|
2211
|
-
transformEncoder as
|
|
2404
|
+
combineCodec as combineCodec33,
|
|
2405
|
+
getProgramDerivedAddress as getProgramDerivedAddress11,
|
|
2406
|
+
getStructDecoder as getStructDecoder31,
|
|
2407
|
+
getStructEncoder as getStructEncoder31,
|
|
2408
|
+
getU8Decoder as getU8Decoder20,
|
|
2409
|
+
getU8Encoder as getU8Encoder20,
|
|
2410
|
+
getUtf8Encoder as getUtf8Encoder13,
|
|
2411
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15,
|
|
2412
|
+
SolanaError as SolanaError15,
|
|
2413
|
+
transformEncoder as transformEncoder15
|
|
2212
2414
|
} from "@solana/kit";
|
|
2213
|
-
import { getAccountMetaFactory as
|
|
2415
|
+
import { getAccountMetaFactory as getAccountMetaFactory15 } from "@solana/program-client-core";
|
|
2214
2416
|
var TRANSFER_FIXED_DISCRIMINATOR = 4;
|
|
2215
2417
|
function getTransferFixedDiscriminatorBytes() {
|
|
2216
|
-
return
|
|
2418
|
+
return getU8Encoder20().encode(TRANSFER_FIXED_DISCRIMINATOR);
|
|
2217
2419
|
}
|
|
2218
2420
|
function getTransferFixedInstructionDataEncoder() {
|
|
2219
|
-
return
|
|
2220
|
-
|
|
2221
|
-
["discriminator",
|
|
2421
|
+
return transformEncoder15(
|
|
2422
|
+
getStructEncoder31([
|
|
2423
|
+
["discriminator", getU8Encoder20()],
|
|
2222
2424
|
["transferData", getTransferDataEncoder()]
|
|
2223
2425
|
]),
|
|
2224
2426
|
(value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
|
|
2225
2427
|
);
|
|
2226
2428
|
}
|
|
2227
2429
|
function getTransferFixedInstructionDataDecoder() {
|
|
2228
|
-
return
|
|
2229
|
-
["discriminator",
|
|
2430
|
+
return getStructDecoder31([
|
|
2431
|
+
["discriminator", getU8Decoder20()],
|
|
2230
2432
|
["transferData", getTransferDataDecoder()]
|
|
2231
2433
|
]);
|
|
2232
2434
|
}
|
|
2233
2435
|
function getTransferFixedInstructionDataCodec() {
|
|
2234
|
-
return
|
|
2436
|
+
return combineCodec33(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
|
|
2235
2437
|
}
|
|
2236
2438
|
async function getTransferFixedInstructionAsync(input, config) {
|
|
2237
2439
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2249,16 +2451,16 @@ async function getTransferFixedInstructionAsync(input, config) {
|
|
|
2249
2451
|
const accounts = originalAccounts;
|
|
2250
2452
|
const args = { ...input };
|
|
2251
2453
|
if (!accounts.eventAuthority.value) {
|
|
2252
|
-
accounts.eventAuthority.value = await
|
|
2454
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress11({
|
|
2253
2455
|
programAddress,
|
|
2254
|
-
seeds: [
|
|
2456
|
+
seeds: [getUtf8Encoder13().encode("event_authority")]
|
|
2255
2457
|
});
|
|
2256
2458
|
}
|
|
2257
2459
|
if (!accounts.selfProgram.value) {
|
|
2258
2460
|
accounts.selfProgram.value = programAddress;
|
|
2259
2461
|
accounts.selfProgram.isWritable = false;
|
|
2260
2462
|
}
|
|
2261
|
-
const getAccountMeta =
|
|
2463
|
+
const getAccountMeta = getAccountMetaFactory15(programAddress, "programId");
|
|
2262
2464
|
return Object.freeze({
|
|
2263
2465
|
accounts: [
|
|
2264
2466
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2294,7 +2496,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
2294
2496
|
accounts.selfProgram.value = programAddress;
|
|
2295
2497
|
accounts.selfProgram.isWritable = false;
|
|
2296
2498
|
}
|
|
2297
|
-
const getAccountMeta =
|
|
2499
|
+
const getAccountMeta = getAccountMetaFactory15(programAddress, "programId");
|
|
2298
2500
|
return Object.freeze({
|
|
2299
2501
|
accounts: [
|
|
2300
2502
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2313,7 +2515,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
2313
2515
|
}
|
|
2314
2516
|
function parseTransferFixedInstruction(instruction) {
|
|
2315
2517
|
if (instruction.accounts.length < 9) {
|
|
2316
|
-
throw new
|
|
2518
|
+
throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15, {
|
|
2317
2519
|
actualAccountMetas: instruction.accounts.length,
|
|
2318
2520
|
expectedAccountMetas: 9
|
|
2319
2521
|
});
|
|
@@ -2343,39 +2545,39 @@ function parseTransferFixedInstruction(instruction) {
|
|
|
2343
2545
|
|
|
2344
2546
|
// src/generated/instructions/transferRecurring.ts
|
|
2345
2547
|
import {
|
|
2346
|
-
combineCodec as
|
|
2347
|
-
getProgramDerivedAddress as
|
|
2348
|
-
getStructDecoder as
|
|
2349
|
-
getStructEncoder as
|
|
2350
|
-
getU8Decoder as
|
|
2351
|
-
getU8Encoder as
|
|
2352
|
-
getUtf8Encoder as
|
|
2353
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2354
|
-
SolanaError as
|
|
2355
|
-
transformEncoder as
|
|
2548
|
+
combineCodec as combineCodec34,
|
|
2549
|
+
getProgramDerivedAddress as getProgramDerivedAddress12,
|
|
2550
|
+
getStructDecoder as getStructDecoder32,
|
|
2551
|
+
getStructEncoder as getStructEncoder32,
|
|
2552
|
+
getU8Decoder as getU8Decoder21,
|
|
2553
|
+
getU8Encoder as getU8Encoder21,
|
|
2554
|
+
getUtf8Encoder as getUtf8Encoder14,
|
|
2555
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16,
|
|
2556
|
+
SolanaError as SolanaError16,
|
|
2557
|
+
transformEncoder as transformEncoder16
|
|
2356
2558
|
} from "@solana/kit";
|
|
2357
|
-
import { getAccountMetaFactory as
|
|
2559
|
+
import { getAccountMetaFactory as getAccountMetaFactory16 } from "@solana/program-client-core";
|
|
2358
2560
|
var TRANSFER_RECURRING_DISCRIMINATOR = 5;
|
|
2359
2561
|
function getTransferRecurringDiscriminatorBytes() {
|
|
2360
|
-
return
|
|
2562
|
+
return getU8Encoder21().encode(TRANSFER_RECURRING_DISCRIMINATOR);
|
|
2361
2563
|
}
|
|
2362
2564
|
function getTransferRecurringInstructionDataEncoder() {
|
|
2363
|
-
return
|
|
2364
|
-
|
|
2365
|
-
["discriminator",
|
|
2565
|
+
return transformEncoder16(
|
|
2566
|
+
getStructEncoder32([
|
|
2567
|
+
["discriminator", getU8Encoder21()],
|
|
2366
2568
|
["transferData", getTransferDataEncoder()]
|
|
2367
2569
|
]),
|
|
2368
2570
|
(value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
|
|
2369
2571
|
);
|
|
2370
2572
|
}
|
|
2371
2573
|
function getTransferRecurringInstructionDataDecoder() {
|
|
2372
|
-
return
|
|
2373
|
-
["discriminator",
|
|
2574
|
+
return getStructDecoder32([
|
|
2575
|
+
["discriminator", getU8Decoder21()],
|
|
2374
2576
|
["transferData", getTransferDataDecoder()]
|
|
2375
2577
|
]);
|
|
2376
2578
|
}
|
|
2377
2579
|
function getTransferRecurringInstructionDataCodec() {
|
|
2378
|
-
return
|
|
2580
|
+
return combineCodec34(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
|
|
2379
2581
|
}
|
|
2380
2582
|
async function getTransferRecurringInstructionAsync(input, config) {
|
|
2381
2583
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2393,16 +2595,16 @@ async function getTransferRecurringInstructionAsync(input, config) {
|
|
|
2393
2595
|
const accounts = originalAccounts;
|
|
2394
2596
|
const args = { ...input };
|
|
2395
2597
|
if (!accounts.eventAuthority.value) {
|
|
2396
|
-
accounts.eventAuthority.value = await
|
|
2598
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress12({
|
|
2397
2599
|
programAddress,
|
|
2398
|
-
seeds: [
|
|
2600
|
+
seeds: [getUtf8Encoder14().encode("event_authority")]
|
|
2399
2601
|
});
|
|
2400
2602
|
}
|
|
2401
2603
|
if (!accounts.selfProgram.value) {
|
|
2402
2604
|
accounts.selfProgram.value = programAddress;
|
|
2403
2605
|
accounts.selfProgram.isWritable = false;
|
|
2404
2606
|
}
|
|
2405
|
-
const getAccountMeta =
|
|
2607
|
+
const getAccountMeta = getAccountMetaFactory16(programAddress, "programId");
|
|
2406
2608
|
return Object.freeze({
|
|
2407
2609
|
accounts: [
|
|
2408
2610
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2438,7 +2640,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
2438
2640
|
accounts.selfProgram.value = programAddress;
|
|
2439
2641
|
accounts.selfProgram.isWritable = false;
|
|
2440
2642
|
}
|
|
2441
|
-
const getAccountMeta =
|
|
2643
|
+
const getAccountMeta = getAccountMetaFactory16(programAddress, "programId");
|
|
2442
2644
|
return Object.freeze({
|
|
2443
2645
|
accounts: [
|
|
2444
2646
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -2457,7 +2659,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
2457
2659
|
}
|
|
2458
2660
|
function parseTransferRecurringInstruction(instruction) {
|
|
2459
2661
|
if (instruction.accounts.length < 9) {
|
|
2460
|
-
throw new
|
|
2662
|
+
throw new SolanaError16(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16, {
|
|
2461
2663
|
actualAccountMetas: instruction.accounts.length,
|
|
2462
2664
|
expectedAccountMetas: 9
|
|
2463
2665
|
});
|
|
@@ -2487,39 +2689,39 @@ function parseTransferRecurringInstruction(instruction) {
|
|
|
2487
2689
|
|
|
2488
2690
|
// src/generated/instructions/transferSubscription.ts
|
|
2489
2691
|
import {
|
|
2490
|
-
combineCodec as
|
|
2491
|
-
getProgramDerivedAddress as
|
|
2492
|
-
getStructDecoder as
|
|
2493
|
-
getStructEncoder as
|
|
2494
|
-
getU8Decoder as
|
|
2495
|
-
getU8Encoder as
|
|
2496
|
-
getUtf8Encoder as
|
|
2497
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2498
|
-
SolanaError as
|
|
2499
|
-
transformEncoder as
|
|
2692
|
+
combineCodec as combineCodec35,
|
|
2693
|
+
getProgramDerivedAddress as getProgramDerivedAddress13,
|
|
2694
|
+
getStructDecoder as getStructDecoder33,
|
|
2695
|
+
getStructEncoder as getStructEncoder33,
|
|
2696
|
+
getU8Decoder as getU8Decoder22,
|
|
2697
|
+
getU8Encoder as getU8Encoder22,
|
|
2698
|
+
getUtf8Encoder as getUtf8Encoder15,
|
|
2699
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS17,
|
|
2700
|
+
SolanaError as SolanaError17,
|
|
2701
|
+
transformEncoder as transformEncoder17
|
|
2500
2702
|
} from "@solana/kit";
|
|
2501
|
-
import { getAccountMetaFactory as
|
|
2703
|
+
import { getAccountMetaFactory as getAccountMetaFactory17 } from "@solana/program-client-core";
|
|
2502
2704
|
var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
|
|
2503
2705
|
function getTransferSubscriptionDiscriminatorBytes() {
|
|
2504
|
-
return
|
|
2706
|
+
return getU8Encoder22().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
|
|
2505
2707
|
}
|
|
2506
2708
|
function getTransferSubscriptionInstructionDataEncoder() {
|
|
2507
|
-
return
|
|
2508
|
-
|
|
2509
|
-
["discriminator",
|
|
2709
|
+
return transformEncoder17(
|
|
2710
|
+
getStructEncoder33([
|
|
2711
|
+
["discriminator", getU8Encoder22()],
|
|
2510
2712
|
["transferData", getTransferDataEncoder()]
|
|
2511
2713
|
]),
|
|
2512
2714
|
(value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
|
|
2513
2715
|
);
|
|
2514
2716
|
}
|
|
2515
2717
|
function getTransferSubscriptionInstructionDataDecoder() {
|
|
2516
|
-
return
|
|
2517
|
-
["discriminator",
|
|
2718
|
+
return getStructDecoder33([
|
|
2719
|
+
["discriminator", getU8Decoder22()],
|
|
2518
2720
|
["transferData", getTransferDataDecoder()]
|
|
2519
2721
|
]);
|
|
2520
2722
|
}
|
|
2521
2723
|
function getTransferSubscriptionInstructionDataCodec() {
|
|
2522
|
-
return
|
|
2724
|
+
return combineCodec35(
|
|
2523
2725
|
getTransferSubscriptionInstructionDataEncoder(),
|
|
2524
2726
|
getTransferSubscriptionInstructionDataDecoder()
|
|
2525
2727
|
);
|
|
@@ -2541,16 +2743,16 @@ async function getTransferSubscriptionInstructionAsync(input, config) {
|
|
|
2541
2743
|
const accounts = originalAccounts;
|
|
2542
2744
|
const args = { ...input };
|
|
2543
2745
|
if (!accounts.eventAuthority.value) {
|
|
2544
|
-
accounts.eventAuthority.value = await
|
|
2746
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress13({
|
|
2545
2747
|
programAddress,
|
|
2546
|
-
seeds: [
|
|
2748
|
+
seeds: [getUtf8Encoder15().encode("event_authority")]
|
|
2547
2749
|
});
|
|
2548
2750
|
}
|
|
2549
2751
|
if (!accounts.selfProgram.value) {
|
|
2550
2752
|
accounts.selfProgram.value = programAddress;
|
|
2551
2753
|
accounts.selfProgram.isWritable = false;
|
|
2552
2754
|
}
|
|
2553
|
-
const getAccountMeta =
|
|
2755
|
+
const getAccountMeta = getAccountMetaFactory17(programAddress, "programId");
|
|
2554
2756
|
return Object.freeze({
|
|
2555
2757
|
accounts: [
|
|
2556
2758
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
@@ -2588,7 +2790,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2588
2790
|
accounts.selfProgram.value = programAddress;
|
|
2589
2791
|
accounts.selfProgram.isWritable = false;
|
|
2590
2792
|
}
|
|
2591
|
-
const getAccountMeta =
|
|
2793
|
+
const getAccountMeta = getAccountMetaFactory17(programAddress, "programId");
|
|
2592
2794
|
return Object.freeze({
|
|
2593
2795
|
accounts: [
|
|
2594
2796
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
@@ -2608,7 +2810,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2608
2810
|
}
|
|
2609
2811
|
function parseTransferSubscriptionInstruction(instruction) {
|
|
2610
2812
|
if (instruction.accounts.length < 10) {
|
|
2611
|
-
throw new
|
|
2813
|
+
throw new SolanaError17(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS17, {
|
|
2612
2814
|
actualAccountMetas: instruction.accounts.length,
|
|
2613
2815
|
expectedAccountMetas: 10
|
|
2614
2816
|
});
|
|
@@ -2639,39 +2841,39 @@ function parseTransferSubscriptionInstruction(instruction) {
|
|
|
2639
2841
|
|
|
2640
2842
|
// src/generated/instructions/updatePlan.ts
|
|
2641
2843
|
import {
|
|
2642
|
-
combineCodec as
|
|
2643
|
-
getProgramDerivedAddress as
|
|
2644
|
-
getStructDecoder as
|
|
2645
|
-
getStructEncoder as
|
|
2646
|
-
getU8Decoder as
|
|
2647
|
-
getU8Encoder as
|
|
2648
|
-
getUtf8Encoder as
|
|
2649
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2650
|
-
SolanaError as
|
|
2651
|
-
transformEncoder as
|
|
2844
|
+
combineCodec as combineCodec36,
|
|
2845
|
+
getProgramDerivedAddress as getProgramDerivedAddress14,
|
|
2846
|
+
getStructDecoder as getStructDecoder34,
|
|
2847
|
+
getStructEncoder as getStructEncoder34,
|
|
2848
|
+
getU8Decoder as getU8Decoder23,
|
|
2849
|
+
getU8Encoder as getU8Encoder23,
|
|
2850
|
+
getUtf8Encoder as getUtf8Encoder16,
|
|
2851
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS18,
|
|
2852
|
+
SolanaError as SolanaError18,
|
|
2853
|
+
transformEncoder as transformEncoder18
|
|
2652
2854
|
} from "@solana/kit";
|
|
2653
|
-
import { getAccountMetaFactory as
|
|
2855
|
+
import { getAccountMetaFactory as getAccountMetaFactory18 } from "@solana/program-client-core";
|
|
2654
2856
|
var UPDATE_PLAN_DISCRIMINATOR = 8;
|
|
2655
2857
|
function getUpdatePlanDiscriminatorBytes() {
|
|
2656
|
-
return
|
|
2858
|
+
return getU8Encoder23().encode(UPDATE_PLAN_DISCRIMINATOR);
|
|
2657
2859
|
}
|
|
2658
2860
|
function getUpdatePlanInstructionDataEncoder() {
|
|
2659
|
-
return
|
|
2660
|
-
|
|
2661
|
-
["discriminator",
|
|
2861
|
+
return transformEncoder18(
|
|
2862
|
+
getStructEncoder34([
|
|
2863
|
+
["discriminator", getU8Encoder23()],
|
|
2662
2864
|
["updatePlanData", getUpdatePlanDataEncoder()]
|
|
2663
2865
|
]),
|
|
2664
2866
|
(value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
|
|
2665
2867
|
);
|
|
2666
2868
|
}
|
|
2667
2869
|
function getUpdatePlanInstructionDataDecoder() {
|
|
2668
|
-
return
|
|
2669
|
-
["discriminator",
|
|
2870
|
+
return getStructDecoder34([
|
|
2871
|
+
["discriminator", getU8Decoder23()],
|
|
2670
2872
|
["updatePlanData", getUpdatePlanDataDecoder()]
|
|
2671
2873
|
]);
|
|
2672
2874
|
}
|
|
2673
2875
|
function getUpdatePlanInstructionDataCodec() {
|
|
2674
|
-
return
|
|
2876
|
+
return combineCodec36(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
|
|
2675
2877
|
}
|
|
2676
2878
|
async function getUpdatePlanInstructionAsync(input, config) {
|
|
2677
2879
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2684,16 +2886,16 @@ async function getUpdatePlanInstructionAsync(input, config) {
|
|
|
2684
2886
|
const accounts = originalAccounts;
|
|
2685
2887
|
const args = { ...input };
|
|
2686
2888
|
if (!accounts.eventAuthority.value) {
|
|
2687
|
-
accounts.eventAuthority.value = await
|
|
2889
|
+
accounts.eventAuthority.value = await getProgramDerivedAddress14({
|
|
2688
2890
|
programAddress,
|
|
2689
|
-
seeds: [
|
|
2891
|
+
seeds: [getUtf8Encoder16().encode("event_authority")]
|
|
2690
2892
|
});
|
|
2691
2893
|
}
|
|
2692
2894
|
if (!accounts.selfProgram.value) {
|
|
2693
2895
|
accounts.selfProgram.value = programAddress;
|
|
2694
2896
|
accounts.selfProgram.isWritable = false;
|
|
2695
2897
|
}
|
|
2696
|
-
const getAccountMeta =
|
|
2898
|
+
const getAccountMeta = getAccountMetaFactory18(programAddress, "programId");
|
|
2697
2899
|
return Object.freeze({
|
|
2698
2900
|
accounts: [
|
|
2699
2901
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -2719,7 +2921,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2719
2921
|
accounts.selfProgram.value = programAddress;
|
|
2720
2922
|
accounts.selfProgram.isWritable = false;
|
|
2721
2923
|
}
|
|
2722
|
-
const getAccountMeta =
|
|
2924
|
+
const getAccountMeta = getAccountMetaFactory18(programAddress, "programId");
|
|
2723
2925
|
return Object.freeze({
|
|
2724
2926
|
accounts: [
|
|
2725
2927
|
getAccountMeta("owner", accounts.owner),
|
|
@@ -2733,7 +2935,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2733
2935
|
}
|
|
2734
2936
|
function parseUpdatePlanInstruction(instruction) {
|
|
2735
2937
|
if (instruction.accounts.length < 4) {
|
|
2736
|
-
throw new
|
|
2938
|
+
throw new SolanaError18(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS18, {
|
|
2737
2939
|
actualAccountMetas: instruction.accounts.length,
|
|
2738
2940
|
expectedAccountMetas: 4
|
|
2739
2941
|
});
|
|
@@ -2785,62 +2987,66 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
|
|
|
2785
2987
|
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeSubscriptionAuthority"] = 14] = "RevokeSubscriptionAuthority";
|
|
2786
2988
|
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedDelegation"] = 15] = "RevokeAbandonedDelegation";
|
|
2787
2989
|
SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedSubscription"] = 16] = "RevokeAbandonedSubscription";
|
|
2990
|
+
SubscriptionsInstruction2[SubscriptionsInstruction2["CancelSubscriptionNow"] = 17] = "CancelSubscriptionNow";
|
|
2788
2991
|
return SubscriptionsInstruction2;
|
|
2789
2992
|
})(SubscriptionsInstruction || {});
|
|
2790
2993
|
function identifySubscriptionsInstruction(instruction) {
|
|
2791
2994
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
2792
|
-
if (containsBytes(data,
|
|
2995
|
+
if (containsBytes(data, getU8Encoder24().encode(0), 0)) {
|
|
2793
2996
|
return 0 /* InitSubscriptionAuthority */;
|
|
2794
2997
|
}
|
|
2795
|
-
if (containsBytes(data,
|
|
2998
|
+
if (containsBytes(data, getU8Encoder24().encode(1), 0)) {
|
|
2796
2999
|
return 1 /* CreateFixedDelegation */;
|
|
2797
3000
|
}
|
|
2798
|
-
if (containsBytes(data,
|
|
3001
|
+
if (containsBytes(data, getU8Encoder24().encode(2), 0)) {
|
|
2799
3002
|
return 2 /* CreateRecurringDelegation */;
|
|
2800
3003
|
}
|
|
2801
|
-
if (containsBytes(data,
|
|
3004
|
+
if (containsBytes(data, getU8Encoder24().encode(3), 0)) {
|
|
2802
3005
|
return 3 /* RevokeDelegation */;
|
|
2803
3006
|
}
|
|
2804
|
-
if (containsBytes(data,
|
|
3007
|
+
if (containsBytes(data, getU8Encoder24().encode(4), 0)) {
|
|
2805
3008
|
return 4 /* TransferFixed */;
|
|
2806
3009
|
}
|
|
2807
|
-
if (containsBytes(data,
|
|
3010
|
+
if (containsBytes(data, getU8Encoder24().encode(5), 0)) {
|
|
2808
3011
|
return 5 /* TransferRecurring */;
|
|
2809
3012
|
}
|
|
2810
|
-
if (containsBytes(data,
|
|
3013
|
+
if (containsBytes(data, getU8Encoder24().encode(6), 0)) {
|
|
2811
3014
|
return 6 /* CloseSubscriptionAuthority */;
|
|
2812
3015
|
}
|
|
2813
|
-
if (containsBytes(data,
|
|
3016
|
+
if (containsBytes(data, getU8Encoder24().encode(7), 0)) {
|
|
2814
3017
|
return 7 /* CreatePlan */;
|
|
2815
3018
|
}
|
|
2816
|
-
if (containsBytes(data,
|
|
3019
|
+
if (containsBytes(data, getU8Encoder24().encode(8), 0)) {
|
|
2817
3020
|
return 8 /* UpdatePlan */;
|
|
2818
3021
|
}
|
|
2819
|
-
if (containsBytes(data,
|
|
3022
|
+
if (containsBytes(data, getU8Encoder24().encode(9), 0)) {
|
|
2820
3023
|
return 9 /* DeletePlan */;
|
|
2821
3024
|
}
|
|
2822
|
-
if (containsBytes(data,
|
|
3025
|
+
if (containsBytes(data, getU8Encoder24().encode(10), 0)) {
|
|
2823
3026
|
return 10 /* TransferSubscription */;
|
|
2824
3027
|
}
|
|
2825
|
-
if (containsBytes(data,
|
|
3028
|
+
if (containsBytes(data, getU8Encoder24().encode(11), 0)) {
|
|
2826
3029
|
return 11 /* Subscribe */;
|
|
2827
3030
|
}
|
|
2828
|
-
if (containsBytes(data,
|
|
3031
|
+
if (containsBytes(data, getU8Encoder24().encode(12), 0)) {
|
|
2829
3032
|
return 12 /* CancelSubscription */;
|
|
2830
3033
|
}
|
|
2831
|
-
if (containsBytes(data,
|
|
3034
|
+
if (containsBytes(data, getU8Encoder24().encode(13), 0)) {
|
|
2832
3035
|
return 13 /* ResumeSubscription */;
|
|
2833
3036
|
}
|
|
2834
|
-
if (containsBytes(data,
|
|
3037
|
+
if (containsBytes(data, getU8Encoder24().encode(14), 0)) {
|
|
2835
3038
|
return 14 /* RevokeSubscriptionAuthority */;
|
|
2836
3039
|
}
|
|
2837
|
-
if (containsBytes(data,
|
|
3040
|
+
if (containsBytes(data, getU8Encoder24().encode(15), 0)) {
|
|
2838
3041
|
return 15 /* RevokeAbandonedDelegation */;
|
|
2839
3042
|
}
|
|
2840
|
-
if (containsBytes(data,
|
|
3043
|
+
if (containsBytes(data, getU8Encoder24().encode(16), 0)) {
|
|
2841
3044
|
return 16 /* RevokeAbandonedSubscription */;
|
|
2842
3045
|
}
|
|
2843
|
-
|
|
3046
|
+
if (containsBytes(data, getU8Encoder24().encode(17), 0)) {
|
|
3047
|
+
return 17 /* CancelSubscriptionNow */;
|
|
3048
|
+
}
|
|
3049
|
+
throw new SolanaError19(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
2844
3050
|
instructionData: data,
|
|
2845
3051
|
programName: "subscriptions"
|
|
2846
3052
|
});
|
|
@@ -2955,8 +3161,15 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2955
3161
|
...parseRevokeAbandonedSubscriptionInstruction(instruction)
|
|
2956
3162
|
};
|
|
2957
3163
|
}
|
|
3164
|
+
case 17 /* CancelSubscriptionNow */: {
|
|
3165
|
+
assertIsInstructionWithAccounts(instruction);
|
|
3166
|
+
return {
|
|
3167
|
+
instructionType: 17 /* CancelSubscriptionNow */,
|
|
3168
|
+
...parseCancelSubscriptionNowInstruction(instruction)
|
|
3169
|
+
};
|
|
3170
|
+
}
|
|
2958
3171
|
default:
|
|
2959
|
-
throw new
|
|
3172
|
+
throw new SolanaError19(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
2960
3173
|
instructionType,
|
|
2961
3174
|
programName: "subscriptions"
|
|
2962
3175
|
});
|
|
@@ -2991,7 +3204,8 @@ function subscriptionsProgram() {
|
|
|
2991
3204
|
resumeSubscription: (input) => addSelfPlanAndSendFunctions(client, getResumeSubscriptionInstructionAsync(input)),
|
|
2992
3205
|
revokeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getRevokeSubscriptionAuthorityInstructionAsync(input)),
|
|
2993
3206
|
revokeAbandonedDelegation: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedDelegationInstruction(input)),
|
|
2994
|
-
revokeAbandonedSubscription: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedSubscriptionInstruction(input))
|
|
3207
|
+
revokeAbandonedSubscription: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedSubscriptionInstruction(input)),
|
|
3208
|
+
cancelSubscriptionNow: (input) => addSelfPlanAndSendFunctions(client, getCancelSubscriptionNowInstructionAsync(input))
|
|
2995
3209
|
},
|
|
2996
3210
|
pdas: {
|
|
2997
3211
|
fixedDelegation: findFixedDelegationPda,
|
|
@@ -3000,7 +3214,9 @@ function subscriptionsProgram() {
|
|
|
3000
3214
|
subscriptionAuthority: findSubscriptionAuthorityPda,
|
|
3001
3215
|
subscriptionDelegation: findSubscriptionDelegationPda,
|
|
3002
3216
|
eventAuthority: findEventAuthorityPda
|
|
3003
|
-
}
|
|
3217
|
+
},
|
|
3218
|
+
identifyInstruction: identifySubscriptionsInstruction,
|
|
3219
|
+
parseInstruction: parseSubscriptionsInstruction
|
|
3004
3220
|
}
|
|
3005
3221
|
});
|
|
3006
3222
|
};
|
|
@@ -3078,6 +3294,8 @@ var SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED = 517;
|
|
|
3078
3294
|
var SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS = 518;
|
|
3079
3295
|
var SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH = 519;
|
|
3080
3296
|
var SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND = 520;
|
|
3297
|
+
var SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_APPROVAL = 521;
|
|
3298
|
+
var SUBSCRIPTIONS_ERROR__STALE_PLAN_APPROVAL = 522;
|
|
3081
3299
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY = 600;
|
|
3082
3300
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA = 601;
|
|
3083
3301
|
var SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG = 602;
|
|
@@ -3153,6 +3371,8 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
3153
3371
|
[SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_ON_LANDING_REQUIRES_EXPIRY]: `start_ts of 0 (start on landing) requires a non-zero expiry`,
|
|
3154
3372
|
[SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_GREATER_THAN_EXPIRY]: `start time specified is greater than expiry`,
|
|
3155
3373
|
[SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_IN_PAST]: `Past start time specified`,
|
|
3374
|
+
[SUBSCRIPTIONS_ERROR__STALE_PLAN_APPROVAL]: `Plan update approval does not match the current plan state`,
|
|
3375
|
+
[SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_APPROVAL]: `Subscription approval does not match the current subscription`,
|
|
3156
3376
|
[SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY]: `Delegation init_id does not match current SubscriptionAuthority`,
|
|
3157
3377
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED]: `Subscription already cancelled`,
|
|
3158
3378
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED]: `Subscription cancelled and past valid period`,
|
|
@@ -3193,6 +3413,7 @@ var PLAN_OWNER_OFFSET = 1;
|
|
|
3193
3413
|
var MAX_PLAN_DESTINATIONS = 4;
|
|
3194
3414
|
var MAX_PLAN_PULLERS = 4;
|
|
3195
3415
|
var METADATA_URI_LEN = 128;
|
|
3416
|
+
var UNKNOWN_INIT_ID = -9223372036854775808n;
|
|
3196
3417
|
|
|
3197
3418
|
// src/accounts/decode.ts
|
|
3198
3419
|
function toEncodedAccount(raw, programAddress) {
|
|
@@ -3326,7 +3547,7 @@ import {
|
|
|
3326
3547
|
fetchEncodedAccount as fetchEncodedAccount7,
|
|
3327
3548
|
getAddressDecoder as getAddressDecoder10,
|
|
3328
3549
|
getAddressEncoder as getAddressEncoder15,
|
|
3329
|
-
getProgramDerivedAddress as
|
|
3550
|
+
getProgramDerivedAddress as getProgramDerivedAddress15
|
|
3330
3551
|
} from "@solana/kit";
|
|
3331
3552
|
import { fetchMint, TOKEN_2022_PROGRAM_ADDRESS } from "@solana-program/token-2022";
|
|
3332
3553
|
var DEFAULT_ADDRESS = "11111111111111111111111111111111";
|
|
@@ -3334,7 +3555,7 @@ var EXTRA_ACCOUNT_METAS_SEED = "extra-account-metas";
|
|
|
3334
3555
|
var TLV_HEADER_LEN = 12;
|
|
3335
3556
|
var POD_SLICE_COUNT_LEN = 4;
|
|
3336
3557
|
var EXTRA_ACCOUNT_META_LEN = 35;
|
|
3337
|
-
var
|
|
3558
|
+
var ADDRESS_LEN = 32;
|
|
3338
3559
|
var PDA_PROGRAM_INDEX_OFFSET = 1 << 7;
|
|
3339
3560
|
var EXECUTE_DISCRIMINATOR = Uint8Array.from([105, 37, 101, 197, 75, 251, 102, 26]);
|
|
3340
3561
|
var addressDecoder = getAddressDecoder10();
|
|
@@ -3404,18 +3625,18 @@ async function unpackSeeds(config, previous, instructionData, rpc) {
|
|
|
3404
3625
|
}
|
|
3405
3626
|
return seeds;
|
|
3406
3627
|
}
|
|
3407
|
-
async function
|
|
3628
|
+
async function unpackAddressData(config, previous, instructionData, rpc) {
|
|
3408
3629
|
const rest = config.subarray(1);
|
|
3409
3630
|
if (config[0] === 1) {
|
|
3410
3631
|
const offset = rest[0];
|
|
3411
|
-
return addressDecoder.decode(instructionData.subarray(offset, offset +
|
|
3632
|
+
return addressDecoder.decode(instructionData.subarray(offset, offset + ADDRESS_LEN));
|
|
3412
3633
|
}
|
|
3413
3634
|
if (config[0] === 2) {
|
|
3414
3635
|
const [accountIndex, offset] = [rest[0], rest[1]];
|
|
3415
3636
|
const data = await fetchData(rpc, previous[accountIndex].address);
|
|
3416
|
-
return addressDecoder.decode(data.subarray(offset, offset +
|
|
3637
|
+
return addressDecoder.decode(data.subarray(offset, offset + ADDRESS_LEN));
|
|
3417
3638
|
}
|
|
3418
|
-
throw new Error("transfer hook: invalid
|
|
3639
|
+
throw new Error("transfer hook: invalid address data");
|
|
3419
3640
|
}
|
|
3420
3641
|
async function resolveMeta(meta, previous, instructionData, hookProgram, rpc) {
|
|
3421
3642
|
const role = roleFor(meta.isSigner, meta.isWritable);
|
|
@@ -3423,11 +3644,11 @@ async function resolveMeta(meta, previous, instructionData, hookProgram, rpc) {
|
|
|
3423
3644
|
return { address: addressDecoder.decode(meta.addressConfig), role };
|
|
3424
3645
|
}
|
|
3425
3646
|
if (meta.discriminator === 2) {
|
|
3426
|
-
return { address: await
|
|
3647
|
+
return { address: await unpackAddressData(meta.addressConfig, previous, instructionData, rpc), role };
|
|
3427
3648
|
}
|
|
3428
3649
|
const programId = meta.discriminator === 1 ? hookProgram : previous[meta.discriminator - PDA_PROGRAM_INDEX_OFFSET].address;
|
|
3429
3650
|
const seeds = await unpackSeeds(meta.addressConfig, previous, instructionData, rpc);
|
|
3430
|
-
const [pda] = await
|
|
3651
|
+
const [pda] = await getProgramDerivedAddress15({ programAddress: programId, seeds });
|
|
3431
3652
|
return { address: pda, role };
|
|
3432
3653
|
}
|
|
3433
3654
|
async function resolveTransferHookAccounts(rpc, args) {
|
|
@@ -3438,7 +3659,7 @@ async function resolveTransferHookAccounts(rpc, args) {
|
|
|
3438
3659
|
const hook = extensions.find((extension) => extension.__kind === "TransferHook");
|
|
3439
3660
|
if (!hook || hook.programId === DEFAULT_ADDRESS) return [];
|
|
3440
3661
|
const hookProgram = hook.programId;
|
|
3441
|
-
const [validationPda] = await
|
|
3662
|
+
const [validationPda] = await getProgramDerivedAddress15({
|
|
3442
3663
|
programAddress: hookProgram,
|
|
3443
3664
|
seeds: [EXTRA_ACCOUNT_METAS_SEED, addressEncoder.encode(args.mint)]
|
|
3444
3665
|
});
|
|
@@ -3766,32 +3987,41 @@ async function getCreatePlanOverlayInstructionAsync(input) {
|
|
|
3766
3987
|
{ owner: input.owner.address, planId: input.planId },
|
|
3767
3988
|
pdaConfig(input.programAddress)
|
|
3768
3989
|
);
|
|
3769
|
-
return
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3990
|
+
return appendPayer(
|
|
3991
|
+
getCreatePlanInstruction(
|
|
3992
|
+
{
|
|
3993
|
+
merchant: input.owner,
|
|
3994
|
+
planData: {
|
|
3995
|
+
destinations,
|
|
3996
|
+
endTs: input.endTs,
|
|
3997
|
+
metadataUri: input.metadataUri,
|
|
3998
|
+
mint: input.mint,
|
|
3999
|
+
planId: input.planId,
|
|
4000
|
+
pullers,
|
|
4001
|
+
terms: {
|
|
4002
|
+
amount: input.amount,
|
|
4003
|
+
createdAt: 0n,
|
|
4004
|
+
periodHours: input.periodHours
|
|
4005
|
+
}
|
|
4006
|
+
},
|
|
4007
|
+
planPda,
|
|
4008
|
+
tokenMint: input.mint,
|
|
4009
|
+
tokenProgram: input.tokenProgram
|
|
3784
4010
|
},
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
},
|
|
3789
|
-
pdaConfig(input.programAddress)
|
|
4011
|
+
pdaConfig(input.programAddress)
|
|
4012
|
+
),
|
|
4013
|
+
input.payer
|
|
3790
4014
|
);
|
|
3791
4015
|
}
|
|
3792
4016
|
async function getUpdatePlanOverlayInstruction(input) {
|
|
4017
|
+
if (input.expectedCreatedAt === void 0 || input.expectedEndTs === void 0 || input.expectedPullers === void 0 || input.expectedMetadataUri === void 0) {
|
|
4018
|
+
throw new Error(
|
|
4019
|
+
"getUpdatePlanOverlayInstruction requires expectedCreatedAt, expectedEndTs, expectedPullers, and expectedMetadataUri. Use the plugin client `subscriptions.instructions.updatePlan(...)` to auto-fetch from the live plan."
|
|
4020
|
+
);
|
|
4021
|
+
}
|
|
3793
4022
|
assertMetadataUri(input.metadataUri);
|
|
3794
4023
|
const pullers = padPlanPullers(input.pullers);
|
|
4024
|
+
const expectedPullers = padPlanPullers(input.expectedPullers);
|
|
3795
4025
|
return getUpdatePlanInstruction(
|
|
3796
4026
|
{
|
|
3797
4027
|
...await eventAccounts(input.programAddress),
|
|
@@ -3799,6 +4029,10 @@ async function getUpdatePlanOverlayInstruction(input) {
|
|
|
3799
4029
|
planPda: input.planPda,
|
|
3800
4030
|
updatePlanData: {
|
|
3801
4031
|
endTs: input.endTs,
|
|
4032
|
+
expectedCreatedAt: input.expectedCreatedAt,
|
|
4033
|
+
expectedEndTs: input.expectedEndTs,
|
|
4034
|
+
expectedMetadataUri: input.expectedMetadataUri,
|
|
4035
|
+
expectedPullers,
|
|
3802
4036
|
metadataUri: input.metadataUri,
|
|
3803
4037
|
pullers,
|
|
3804
4038
|
status: input.status
|
|
@@ -3859,6 +4093,19 @@ async function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
|
3859
4093
|
pdaConfig(input.programAddress)
|
|
3860
4094
|
);
|
|
3861
4095
|
}
|
|
4096
|
+
async function getCancelSubscriptionNowOverlayInstructionAsync(input) {
|
|
4097
|
+
return await getCancelSubscriptionNowInstructionAsync(
|
|
4098
|
+
{
|
|
4099
|
+
...await eventAccounts(input.programAddress),
|
|
4100
|
+
cancelSubscriptionNowData: { expectedCurrentPeriodStartTs: input.expectedCurrentPeriodStartTs },
|
|
4101
|
+
merchant: input.merchant,
|
|
4102
|
+
planPda: input.planPda,
|
|
4103
|
+
subscriber: input.subscriber,
|
|
4104
|
+
subscriptionPda: input.subscriptionPda
|
|
4105
|
+
},
|
|
4106
|
+
pdaConfig(input.programAddress)
|
|
4107
|
+
);
|
|
4108
|
+
}
|
|
3862
4109
|
async function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
3863
4110
|
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
3864
4111
|
{ tokenMint: input.tokenMint, user: input.subscriber.address },
|
|
@@ -3868,6 +4115,7 @@ async function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
|
3868
4115
|
{
|
|
3869
4116
|
...await eventAccounts(input.programAddress),
|
|
3870
4117
|
planPda: input.planPda,
|
|
4118
|
+
resumeData: { expectedExpiresAtTs: input.expectedExpiresAtTs },
|
|
3871
4119
|
subscriber: input.subscriber,
|
|
3872
4120
|
subscriptionAuthority,
|
|
3873
4121
|
subscriptionPda: input.subscriptionPda
|
|
@@ -3937,6 +4185,14 @@ function subscriptionsProgram2() {
|
|
|
3937
4185
|
subscriber: input.subscriber ?? client.identity
|
|
3938
4186
|
})
|
|
3939
4187
|
),
|
|
4188
|
+
cancelSubscriptionNow: (input) => addSelfPlanAndSendFunctions2(
|
|
4189
|
+
client,
|
|
4190
|
+
getCancelSubscriptionNowOverlayInstructionAsync({
|
|
4191
|
+
...input,
|
|
4192
|
+
merchant: input.merchant ?? client.payer,
|
|
4193
|
+
subscriber: input.subscriber ?? client.identity
|
|
4194
|
+
})
|
|
4195
|
+
),
|
|
3940
4196
|
closeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions2(
|
|
3941
4197
|
client,
|
|
3942
4198
|
getCloseSubscriptionAuthorityOverlayInstructionAsync({
|
|
@@ -3966,7 +4222,8 @@ function subscriptionsProgram2() {
|
|
|
3966
4222
|
client,
|
|
3967
4223
|
getCreatePlanOverlayInstructionAsync({
|
|
3968
4224
|
...input,
|
|
3969
|
-
owner: input.owner ?? client.identity
|
|
4225
|
+
owner: input.owner ?? client.identity,
|
|
4226
|
+
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3970
4227
|
})
|
|
3971
4228
|
),
|
|
3972
4229
|
createRecurringDelegation: (input) => addSelfPlanAndSendFunctions2(
|
|
@@ -4124,10 +4381,24 @@ function subscriptionsProgram2() {
|
|
|
4124
4381
|
),
|
|
4125
4382
|
updatePlan: (input) => addSelfPlanAndSendFunctions2(
|
|
4126
4383
|
client,
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4384
|
+
(async () => {
|
|
4385
|
+
let { expectedCreatedAt, expectedEndTs, expectedMetadataUri, expectedPullers } = input;
|
|
4386
|
+
if (expectedCreatedAt === void 0 || expectedEndTs === void 0 || expectedPullers === void 0 || expectedMetadataUri === void 0) {
|
|
4387
|
+
const plan = await fetchPlan(c.rpc, input.planPda);
|
|
4388
|
+
expectedCreatedAt = expectedCreatedAt ?? plan.data.data.terms.createdAt;
|
|
4389
|
+
expectedEndTs = expectedEndTs ?? plan.data.data.endTs;
|
|
4390
|
+
expectedMetadataUri = expectedMetadataUri ?? plan.data.data.metadataUri;
|
|
4391
|
+
expectedPullers = expectedPullers ?? [...plan.data.data.pullers];
|
|
4392
|
+
}
|
|
4393
|
+
return await getUpdatePlanOverlayInstruction({
|
|
4394
|
+
...input,
|
|
4395
|
+
expectedCreatedAt,
|
|
4396
|
+
expectedEndTs,
|
|
4397
|
+
expectedMetadataUri,
|
|
4398
|
+
expectedPullers,
|
|
4399
|
+
owner: input.owner ?? client.identity
|
|
4400
|
+
});
|
|
4401
|
+
})()
|
|
4131
4402
|
)
|
|
4132
4403
|
};
|
|
4133
4404
|
return {
|
|
@@ -4144,6 +4415,7 @@ function subscriptionsProgram2() {
|
|
|
4144
4415
|
export {
|
|
4145
4416
|
AccountDiscriminator,
|
|
4146
4417
|
CANCEL_SUBSCRIPTION_DISCRIMINATOR,
|
|
4418
|
+
CANCEL_SUBSCRIPTION_NOW_DISCRIMINATOR,
|
|
4147
4419
|
CLOSE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
|
|
4148
4420
|
CREATE_FIXED_DELEGATION_DISCRIMINATOR,
|
|
4149
4421
|
CREATE_PLAN_DISCRIMINATOR,
|
|
@@ -4237,6 +4509,8 @@ export {
|
|
|
4237
4509
|
SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_ON_LANDING_REQUIRES_EXPIRY,
|
|
4238
4510
|
SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_GREATER_THAN_EXPIRY,
|
|
4239
4511
|
SUBSCRIPTIONS_ERROR__RECURRING_DELEGATION_START_TIME_IN_PAST,
|
|
4512
|
+
SUBSCRIPTIONS_ERROR__STALE_PLAN_APPROVAL,
|
|
4513
|
+
SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_APPROVAL,
|
|
4240
4514
|
SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY,
|
|
4241
4515
|
SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED,
|
|
4242
4516
|
SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED,
|
|
@@ -4256,6 +4530,7 @@ export {
|
|
|
4256
4530
|
TRANSFER_RECURRING_DISCRIMINATOR,
|
|
4257
4531
|
TRANSFER_SUBSCRIPTION_DISCRIMINATOR,
|
|
4258
4532
|
U64_BYTE_SIZE,
|
|
4533
|
+
UNKNOWN_INIT_ID,
|
|
4259
4534
|
UPDATE_PLAN_DISCRIMINATOR,
|
|
4260
4535
|
ValidationError,
|
|
4261
4536
|
ZERO_ADDRESS,
|
|
@@ -4321,6 +4596,16 @@ export {
|
|
|
4321
4596
|
getCancelSubscriptionInstructionDataCodec,
|
|
4322
4597
|
getCancelSubscriptionInstructionDataDecoder,
|
|
4323
4598
|
getCancelSubscriptionInstructionDataEncoder,
|
|
4599
|
+
getCancelSubscriptionNowDataCodec,
|
|
4600
|
+
getCancelSubscriptionNowDataDecoder,
|
|
4601
|
+
getCancelSubscriptionNowDataEncoder,
|
|
4602
|
+
getCancelSubscriptionNowDiscriminatorBytes,
|
|
4603
|
+
getCancelSubscriptionNowInstruction,
|
|
4604
|
+
getCancelSubscriptionNowInstructionAsync,
|
|
4605
|
+
getCancelSubscriptionNowInstructionDataCodec,
|
|
4606
|
+
getCancelSubscriptionNowInstructionDataDecoder,
|
|
4607
|
+
getCancelSubscriptionNowInstructionDataEncoder,
|
|
4608
|
+
getCancelSubscriptionNowOverlayInstructionAsync,
|
|
4324
4609
|
getCancelSubscriptionOverlayInstructionAsync,
|
|
4325
4610
|
getCloseSubscriptionAuthorityDiscriminatorBytes,
|
|
4326
4611
|
getCloseSubscriptionAuthorityInstruction,
|
|
@@ -4389,6 +4674,9 @@ export {
|
|
|
4389
4674
|
getRecurringDelegationCodec,
|
|
4390
4675
|
getRecurringDelegationDecoder,
|
|
4391
4676
|
getRecurringDelegationEncoder,
|
|
4677
|
+
getResumeDataCodec,
|
|
4678
|
+
getResumeDataDecoder,
|
|
4679
|
+
getResumeDataEncoder,
|
|
4392
4680
|
getResumeSubscriptionDiscriminatorBytes,
|
|
4393
4681
|
getResumeSubscriptionInstruction,
|
|
4394
4682
|
getResumeSubscriptionInstructionAsync,
|
|
@@ -4474,6 +4762,7 @@ export {
|
|
|
4474
4762
|
identifySubscriptionsInstruction,
|
|
4475
4763
|
isSubscriptionsError,
|
|
4476
4764
|
parseCancelSubscriptionInstruction,
|
|
4765
|
+
parseCancelSubscriptionNowInstruction,
|
|
4477
4766
|
parseCloseSubscriptionAuthorityInstruction,
|
|
4478
4767
|
parseCreateFixedDelegationInstruction,
|
|
4479
4768
|
parseCreatePlanInstruction,
|