@solana/subscriptions 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -42,6 +42,7 @@ __export(index_exports, {
42
42
  PLAN_SIZE: () => PLAN_SIZE,
43
43
  PROGRAM_ID: () => PROGRAM_ID,
44
44
  PlanStatus: () => PlanStatus,
45
+ RESUME_SUBSCRIPTION_DISCRIMINATOR: () => RESUME_SUBSCRIPTION_DISCRIMINATOR,
45
46
  REVOKE_DELEGATION_DISCRIMINATOR: () => REVOKE_DELEGATION_DISCRIMINATOR,
46
47
  SUBSCRIBE_DISCRIMINATOR: () => SUBSCRIBE_DISCRIMINATOR,
47
48
  SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE: () => SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
@@ -259,6 +260,13 @@ __export(index_exports, {
259
260
  getRecurringDelegationCodec: () => getRecurringDelegationCodec,
260
261
  getRecurringDelegationDecoder: () => getRecurringDelegationDecoder,
261
262
  getRecurringDelegationEncoder: () => getRecurringDelegationEncoder,
263
+ getResumeSubscriptionDiscriminatorBytes: () => getResumeSubscriptionDiscriminatorBytes,
264
+ getResumeSubscriptionInstruction: () => getResumeSubscriptionInstruction,
265
+ getResumeSubscriptionInstructionAsync: () => getResumeSubscriptionInstructionAsync,
266
+ getResumeSubscriptionInstructionDataCodec: () => getResumeSubscriptionInstructionDataCodec,
267
+ getResumeSubscriptionInstructionDataDecoder: () => getResumeSubscriptionInstructionDataDecoder,
268
+ getResumeSubscriptionInstructionDataEncoder: () => getResumeSubscriptionInstructionDataEncoder,
269
+ getResumeSubscriptionOverlayInstructionAsync: () => getResumeSubscriptionOverlayInstructionAsync,
262
270
  getRevokeDelegationDiscriminatorBytes: () => getRevokeDelegationDiscriminatorBytes,
263
271
  getRevokeDelegationInstruction: () => getRevokeDelegationInstruction,
264
272
  getRevokeDelegationInstructionDataCodec: () => getRevokeDelegationInstructionDataCodec,
@@ -322,6 +330,7 @@ __export(index_exports, {
322
330
  parseCreateRecurringDelegationInstruction: () => parseCreateRecurringDelegationInstruction,
323
331
  parseDeletePlanInstruction: () => parseDeletePlanInstruction,
324
332
  parseInitSubscriptionAuthorityInstruction: () => parseInitSubscriptionAuthorityInstruction,
333
+ parseResumeSubscriptionInstruction: () => parseResumeSubscriptionInstruction,
325
334
  parseRevokeDelegationInstruction: () => parseRevokeDelegationInstruction,
326
335
  parseSubscribeInstruction: () => parseSubscribeInstruction,
327
336
  parseSubscriptionsInstruction: () => parseSubscriptionsInstruction,
@@ -335,7 +344,7 @@ __export(index_exports, {
335
344
  module.exports = __toCommonJS(index_exports);
336
345
 
337
346
  // src/accounts/decode.ts
338
- var import_kit38 = require("@solana/kit");
347
+ var import_kit39 = require("@solana/kit");
339
348
 
340
349
  // src/generated/accounts/eventAuthority.ts
341
350
  var import_kit7 = require("@solana/kit");
@@ -504,14 +513,16 @@ function getCreateFixedDelegationDataEncoder() {
504
513
  return (0, import_kit9.getStructEncoder)([
505
514
  ["nonce", (0, import_kit9.getU64Encoder)()],
506
515
  ["amount", (0, import_kit9.getU64Encoder)()],
507
- ["expiryTs", (0, import_kit9.getI64Encoder)()]
516
+ ["expiryTs", (0, import_kit9.getI64Encoder)()],
517
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit9.getI64Encoder)()]
508
518
  ]);
509
519
  }
510
520
  function getCreateFixedDelegationDataDecoder() {
511
521
  return (0, import_kit9.getStructDecoder)([
512
522
  ["nonce", (0, import_kit9.getU64Decoder)()],
513
523
  ["amount", (0, import_kit9.getU64Decoder)()],
514
- ["expiryTs", (0, import_kit9.getI64Decoder)()]
524
+ ["expiryTs", (0, import_kit9.getI64Decoder)()],
525
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit9.getI64Decoder)()]
515
526
  ]);
516
527
  }
517
528
  function getCreateFixedDelegationDataCodec() {
@@ -526,7 +537,8 @@ function getCreateRecurringDelegationDataEncoder() {
526
537
  ["amountPerPeriod", (0, import_kit10.getU64Encoder)()],
527
538
  ["periodLengthS", (0, import_kit10.getU64Encoder)()],
528
539
  ["startTs", (0, import_kit10.getI64Encoder)()],
529
- ["expiryTs", (0, import_kit10.getI64Encoder)()]
540
+ ["expiryTs", (0, import_kit10.getI64Encoder)()],
541
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit10.getI64Encoder)()]
530
542
  ]);
531
543
  }
532
544
  function getCreateRecurringDelegationDataDecoder() {
@@ -535,7 +547,8 @@ function getCreateRecurringDelegationDataDecoder() {
535
547
  ["amountPerPeriod", (0, import_kit10.getU64Decoder)()],
536
548
  ["periodLengthS", (0, import_kit10.getU64Decoder)()],
537
549
  ["startTs", (0, import_kit10.getI64Decoder)()],
538
- ["expiryTs", (0, import_kit10.getI64Decoder)()]
550
+ ["expiryTs", (0, import_kit10.getI64Decoder)()],
551
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit10.getI64Decoder)()]
539
552
  ]);
540
553
  }
541
554
  function getCreateRecurringDelegationDataCodec() {
@@ -644,7 +657,8 @@ function getSubscribeDataEncoder() {
644
657
  ["expectedMint", (0, import_kit15.getAddressEncoder)()],
645
658
  ["expectedAmount", (0, import_kit15.getU64Encoder)()],
646
659
  ["expectedPeriodHours", (0, import_kit15.getU64Encoder)()],
647
- ["expectedCreatedAt", (0, import_kit15.getI64Encoder)()]
660
+ ["expectedCreatedAt", (0, import_kit15.getI64Encoder)()],
661
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit15.getI64Encoder)()]
648
662
  ]);
649
663
  }
650
664
  function getSubscribeDataDecoder() {
@@ -654,7 +668,8 @@ function getSubscribeDataDecoder() {
654
668
  ["expectedMint", (0, import_kit15.getAddressDecoder)()],
655
669
  ["expectedAmount", (0, import_kit15.getU64Decoder)()],
656
670
  ["expectedPeriodHours", (0, import_kit15.getU64Decoder)()],
657
- ["expectedCreatedAt", (0, import_kit15.getI64Decoder)()]
671
+ ["expectedCreatedAt", (0, import_kit15.getI64Decoder)()],
672
+ ["expectedSubscriptionAuthorityInitId", (0, import_kit15.getI64Decoder)()]
658
673
  ]);
659
674
  }
660
675
  function getSubscribeDataCodec() {
@@ -986,11 +1001,11 @@ async function fetchMaybeSubscriptionDelegationFromSeeds(rpc, seeds, config = {}
986
1001
  }
987
1002
 
988
1003
  // src/generated/errors/subscriptions.ts
989
- var import_kit37 = require("@solana/kit");
1004
+ var import_kit38 = require("@solana/kit");
990
1005
 
991
1006
  // src/generated/programs/subscriptions.ts
992
- var import_kit36 = require("@solana/kit");
993
- var import_program_client_core14 = require("@solana/program-client-core");
1007
+ var import_kit37 = require("@solana/kit");
1008
+ var import_program_client_core15 = require("@solana/program-client-core");
994
1009
 
995
1010
  // src/generated/instructions/cancelSubscription.ts
996
1011
  var import_kit23 = require("@solana/kit");
@@ -1569,24 +1584,133 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
1569
1584
  };
1570
1585
  }
1571
1586
 
1572
- // src/generated/instructions/revokeDelegation.ts
1587
+ // src/generated/instructions/resumeSubscription.ts
1573
1588
  var import_kit30 = require("@solana/kit");
1574
1589
  var import_program_client_core8 = require("@solana/program-client-core");
1590
+ var RESUME_SUBSCRIPTION_DISCRIMINATOR = 13;
1591
+ function getResumeSubscriptionDiscriminatorBytes() {
1592
+ return (0, import_kit30.getU8Encoder)().encode(RESUME_SUBSCRIPTION_DISCRIMINATOR);
1593
+ }
1594
+ function getResumeSubscriptionInstructionDataEncoder() {
1595
+ return (0, import_kit30.transformEncoder)((0, import_kit30.getStructEncoder)([["discriminator", (0, import_kit30.getU8Encoder)()]]), (value) => ({
1596
+ ...value,
1597
+ discriminator: RESUME_SUBSCRIPTION_DISCRIMINATOR
1598
+ }));
1599
+ }
1600
+ function getResumeSubscriptionInstructionDataDecoder() {
1601
+ return (0, import_kit30.getStructDecoder)([["discriminator", (0, import_kit30.getU8Decoder)()]]);
1602
+ }
1603
+ function getResumeSubscriptionInstructionDataCodec() {
1604
+ return (0, import_kit30.combineCodec)(getResumeSubscriptionInstructionDataEncoder(), getResumeSubscriptionInstructionDataDecoder());
1605
+ }
1606
+ async function getResumeSubscriptionInstructionAsync(input, config) {
1607
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1608
+ const originalAccounts = {
1609
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
1610
+ planPda: { value: input.planPda ?? null, isWritable: false },
1611
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1612
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1613
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1614
+ };
1615
+ const accounts = originalAccounts;
1616
+ if (!accounts.subscriptionPda.value) {
1617
+ accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
1618
+ planPda: (0, import_program_client_core8.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
1619
+ subscriber: (0, import_program_client_core8.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
1620
+ });
1621
+ }
1622
+ if (!accounts.eventAuthority.value) {
1623
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1624
+ }
1625
+ if (!accounts.selfProgram.value) {
1626
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1627
+ }
1628
+ const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
1629
+ return Object.freeze({
1630
+ accounts: [
1631
+ getAccountMeta("subscriber", accounts.subscriber),
1632
+ getAccountMeta("planPda", accounts.planPda),
1633
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1634
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1635
+ getAccountMeta("selfProgram", accounts.selfProgram)
1636
+ ],
1637
+ data: getResumeSubscriptionInstructionDataEncoder().encode({}),
1638
+ programAddress
1639
+ });
1640
+ }
1641
+ function getResumeSubscriptionInstruction(input, config) {
1642
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1643
+ const originalAccounts = {
1644
+ subscriber: { value: input.subscriber ?? null, isWritable: false },
1645
+ planPda: { value: input.planPda ?? null, isWritable: false },
1646
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1647
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1648
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1649
+ };
1650
+ const accounts = originalAccounts;
1651
+ if (!accounts.eventAuthority.value) {
1652
+ accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1653
+ }
1654
+ if (!accounts.selfProgram.value) {
1655
+ accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1656
+ }
1657
+ const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
1658
+ return Object.freeze({
1659
+ accounts: [
1660
+ getAccountMeta("subscriber", accounts.subscriber),
1661
+ getAccountMeta("planPda", accounts.planPda),
1662
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1663
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
1664
+ getAccountMeta("selfProgram", accounts.selfProgram)
1665
+ ],
1666
+ data: getResumeSubscriptionInstructionDataEncoder().encode({}),
1667
+ programAddress
1668
+ });
1669
+ }
1670
+ function parseResumeSubscriptionInstruction(instruction) {
1671
+ if (instruction.accounts.length < 5) {
1672
+ throw new import_kit30.SolanaError(import_kit30.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1673
+ actualAccountMetas: instruction.accounts.length,
1674
+ expectedAccountMetas: 5
1675
+ });
1676
+ }
1677
+ let accountIndex = 0;
1678
+ const getNextAccount = () => {
1679
+ const accountMeta = instruction.accounts[accountIndex];
1680
+ accountIndex += 1;
1681
+ return accountMeta;
1682
+ };
1683
+ return {
1684
+ programAddress: instruction.programAddress,
1685
+ accounts: {
1686
+ subscriber: getNextAccount(),
1687
+ planPda: getNextAccount(),
1688
+ subscriptionPda: getNextAccount(),
1689
+ eventAuthority: getNextAccount(),
1690
+ selfProgram: getNextAccount()
1691
+ },
1692
+ data: getResumeSubscriptionInstructionDataDecoder().decode(instruction.data)
1693
+ };
1694
+ }
1695
+
1696
+ // src/generated/instructions/revokeDelegation.ts
1697
+ var import_kit31 = require("@solana/kit");
1698
+ var import_program_client_core9 = require("@solana/program-client-core");
1575
1699
  var REVOKE_DELEGATION_DISCRIMINATOR = 3;
1576
1700
  function getRevokeDelegationDiscriminatorBytes() {
1577
- return (0, import_kit30.getU8Encoder)().encode(REVOKE_DELEGATION_DISCRIMINATOR);
1701
+ return (0, import_kit31.getU8Encoder)().encode(REVOKE_DELEGATION_DISCRIMINATOR);
1578
1702
  }
1579
1703
  function getRevokeDelegationInstructionDataEncoder() {
1580
- return (0, import_kit30.transformEncoder)((0, import_kit30.getStructEncoder)([["discriminator", (0, import_kit30.getU8Encoder)()]]), (value) => ({
1704
+ return (0, import_kit31.transformEncoder)((0, import_kit31.getStructEncoder)([["discriminator", (0, import_kit31.getU8Encoder)()]]), (value) => ({
1581
1705
  ...value,
1582
1706
  discriminator: REVOKE_DELEGATION_DISCRIMINATOR
1583
1707
  }));
1584
1708
  }
1585
1709
  function getRevokeDelegationInstructionDataDecoder() {
1586
- return (0, import_kit30.getStructDecoder)([["discriminator", (0, import_kit30.getU8Decoder)()]]);
1710
+ return (0, import_kit31.getStructDecoder)([["discriminator", (0, import_kit31.getU8Decoder)()]]);
1587
1711
  }
1588
1712
  function getRevokeDelegationInstructionDataCodec() {
1589
- return (0, import_kit30.combineCodec)(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
1713
+ return (0, import_kit31.combineCodec)(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
1590
1714
  }
1591
1715
  function getRevokeDelegationInstruction(input, config) {
1592
1716
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1595,7 +1719,7 @@ function getRevokeDelegationInstruction(input, config) {
1595
1719
  delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
1596
1720
  };
1597
1721
  const accounts = originalAccounts;
1598
- const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
1722
+ const getAccountMeta = (0, import_program_client_core9.getAccountMetaFactory)(programAddress, "programId");
1599
1723
  return Object.freeze({
1600
1724
  accounts: [
1601
1725
  getAccountMeta("authority", accounts.authority),
@@ -1607,7 +1731,7 @@ function getRevokeDelegationInstruction(input, config) {
1607
1731
  }
1608
1732
  function parseRevokeDelegationInstruction(instruction) {
1609
1733
  if (instruction.accounts.length < 2) {
1610
- throw new import_kit30.SolanaError(import_kit30.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1734
+ throw new import_kit31.SolanaError(import_kit31.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1611
1735
  actualAccountMetas: instruction.accounts.length,
1612
1736
  expectedAccountMetas: 2
1613
1737
  });
@@ -1626,29 +1750,29 @@ function parseRevokeDelegationInstruction(instruction) {
1626
1750
  }
1627
1751
 
1628
1752
  // src/generated/instructions/subscribe.ts
1629
- var import_kit31 = require("@solana/kit");
1630
- var import_program_client_core9 = require("@solana/program-client-core");
1753
+ var import_kit32 = require("@solana/kit");
1754
+ var import_program_client_core10 = require("@solana/program-client-core");
1631
1755
  var SUBSCRIBE_DISCRIMINATOR = 11;
1632
1756
  function getSubscribeDiscriminatorBytes() {
1633
- return (0, import_kit31.getU8Encoder)().encode(SUBSCRIBE_DISCRIMINATOR);
1757
+ return (0, import_kit32.getU8Encoder)().encode(SUBSCRIBE_DISCRIMINATOR);
1634
1758
  }
1635
1759
  function getSubscribeInstructionDataEncoder() {
1636
- return (0, import_kit31.transformEncoder)(
1637
- (0, import_kit31.getStructEncoder)([
1638
- ["discriminator", (0, import_kit31.getU8Encoder)()],
1760
+ return (0, import_kit32.transformEncoder)(
1761
+ (0, import_kit32.getStructEncoder)([
1762
+ ["discriminator", (0, import_kit32.getU8Encoder)()],
1639
1763
  ["subscribeData", getSubscribeDataEncoder()]
1640
1764
  ]),
1641
1765
  (value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
1642
1766
  );
1643
1767
  }
1644
1768
  function getSubscribeInstructionDataDecoder() {
1645
- return (0, import_kit31.getStructDecoder)([
1646
- ["discriminator", (0, import_kit31.getU8Decoder)()],
1769
+ return (0, import_kit32.getStructDecoder)([
1770
+ ["discriminator", (0, import_kit32.getU8Decoder)()],
1647
1771
  ["subscribeData", getSubscribeDataDecoder()]
1648
1772
  ]);
1649
1773
  }
1650
1774
  function getSubscribeInstructionDataCodec() {
1651
- return (0, import_kit31.combineCodec)(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
1775
+ return (0, import_kit32.combineCodec)(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
1652
1776
  }
1653
1777
  async function getSubscribeInstructionAsync(input, config) {
1654
1778
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1666,8 +1790,8 @@ async function getSubscribeInstructionAsync(input, config) {
1666
1790
  const args = { ...input };
1667
1791
  if (!accounts.subscriptionPda.value) {
1668
1792
  accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
1669
- planPda: (0, import_program_client_core9.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
1670
- subscriber: (0, import_program_client_core9.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
1793
+ planPda: (0, import_program_client_core10.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
1794
+ subscriber: (0, import_program_client_core10.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
1671
1795
  });
1672
1796
  }
1673
1797
  if (!accounts.systemProgram.value) {
@@ -1679,7 +1803,7 @@ async function getSubscribeInstructionAsync(input, config) {
1679
1803
  if (!accounts.selfProgram.value) {
1680
1804
  accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1681
1805
  }
1682
- const getAccountMeta = (0, import_program_client_core9.getAccountMetaFactory)(programAddress, "programId");
1806
+ const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
1683
1807
  return Object.freeze({
1684
1808
  accounts: [
1685
1809
  getAccountMeta("subscriber", accounts.subscriber),
@@ -1718,7 +1842,7 @@ function getSubscribeInstruction(input, config) {
1718
1842
  if (!accounts.selfProgram.value) {
1719
1843
  accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1720
1844
  }
1721
- const getAccountMeta = (0, import_program_client_core9.getAccountMetaFactory)(programAddress, "programId");
1845
+ const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
1722
1846
  return Object.freeze({
1723
1847
  accounts: [
1724
1848
  getAccountMeta("subscriber", accounts.subscriber),
@@ -1736,7 +1860,7 @@ function getSubscribeInstruction(input, config) {
1736
1860
  }
1737
1861
  function parseSubscribeInstruction(instruction) {
1738
1862
  if (instruction.accounts.length < 8) {
1739
- throw new import_kit31.SolanaError(import_kit31.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1863
+ throw new import_kit32.SolanaError(import_kit32.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1740
1864
  actualAccountMetas: instruction.accounts.length,
1741
1865
  expectedAccountMetas: 8
1742
1866
  });
@@ -1764,29 +1888,29 @@ function parseSubscribeInstruction(instruction) {
1764
1888
  }
1765
1889
 
1766
1890
  // src/generated/instructions/transferFixed.ts
1767
- var import_kit32 = require("@solana/kit");
1768
- var import_program_client_core10 = require("@solana/program-client-core");
1891
+ var import_kit33 = require("@solana/kit");
1892
+ var import_program_client_core11 = require("@solana/program-client-core");
1769
1893
  var TRANSFER_FIXED_DISCRIMINATOR = 4;
1770
1894
  function getTransferFixedDiscriminatorBytes() {
1771
- return (0, import_kit32.getU8Encoder)().encode(TRANSFER_FIXED_DISCRIMINATOR);
1895
+ return (0, import_kit33.getU8Encoder)().encode(TRANSFER_FIXED_DISCRIMINATOR);
1772
1896
  }
1773
1897
  function getTransferFixedInstructionDataEncoder() {
1774
- return (0, import_kit32.transformEncoder)(
1775
- (0, import_kit32.getStructEncoder)([
1776
- ["discriminator", (0, import_kit32.getU8Encoder)()],
1898
+ return (0, import_kit33.transformEncoder)(
1899
+ (0, import_kit33.getStructEncoder)([
1900
+ ["discriminator", (0, import_kit33.getU8Encoder)()],
1777
1901
  ["transferData", getTransferDataEncoder()]
1778
1902
  ]),
1779
1903
  (value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
1780
1904
  );
1781
1905
  }
1782
1906
  function getTransferFixedInstructionDataDecoder() {
1783
- return (0, import_kit32.getStructDecoder)([
1784
- ["discriminator", (0, import_kit32.getU8Decoder)()],
1907
+ return (0, import_kit33.getStructDecoder)([
1908
+ ["discriminator", (0, import_kit33.getU8Decoder)()],
1785
1909
  ["transferData", getTransferDataDecoder()]
1786
1910
  ]);
1787
1911
  }
1788
1912
  function getTransferFixedInstructionDataCodec() {
1789
- return (0, import_kit32.combineCodec)(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
1913
+ return (0, import_kit33.combineCodec)(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
1790
1914
  }
1791
1915
  function getTransferFixedInstruction(input, config) {
1792
1916
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1795,6 +1919,7 @@ function getTransferFixedInstruction(input, config) {
1795
1919
  subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1796
1920
  delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
1797
1921
  receiverAta: { value: input.receiverAta ?? null, isWritable: true },
1922
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1798
1923
  tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1799
1924
  delegatee: { value: input.delegatee ?? null, isWritable: false },
1800
1925
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
@@ -1808,13 +1933,14 @@ function getTransferFixedInstruction(input, config) {
1808
1933
  if (!accounts.selfProgram.value) {
1809
1934
  accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1810
1935
  }
1811
- const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
1936
+ const getAccountMeta = (0, import_program_client_core11.getAccountMetaFactory)(programAddress, "programId");
1812
1937
  return Object.freeze({
1813
1938
  accounts: [
1814
1939
  getAccountMeta("delegationPda", accounts.delegationPda),
1815
1940
  getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1816
1941
  getAccountMeta("delegatorAta", accounts.delegatorAta),
1817
1942
  getAccountMeta("receiverAta", accounts.receiverAta),
1943
+ getAccountMeta("tokenMint", accounts.tokenMint),
1818
1944
  getAccountMeta("tokenProgram", accounts.tokenProgram),
1819
1945
  getAccountMeta("delegatee", accounts.delegatee),
1820
1946
  getAccountMeta("eventAuthority", accounts.eventAuthority),
@@ -1825,10 +1951,10 @@ function getTransferFixedInstruction(input, config) {
1825
1951
  });
1826
1952
  }
1827
1953
  function parseTransferFixedInstruction(instruction) {
1828
- if (instruction.accounts.length < 8) {
1829
- throw new import_kit32.SolanaError(import_kit32.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1954
+ if (instruction.accounts.length < 9) {
1955
+ throw new import_kit33.SolanaError(import_kit33.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1830
1956
  actualAccountMetas: instruction.accounts.length,
1831
- expectedAccountMetas: 8
1957
+ expectedAccountMetas: 9
1832
1958
  });
1833
1959
  }
1834
1960
  let accountIndex = 0;
@@ -1844,6 +1970,7 @@ function parseTransferFixedInstruction(instruction) {
1844
1970
  subscriptionAuthority: getNextAccount(),
1845
1971
  delegatorAta: getNextAccount(),
1846
1972
  receiverAta: getNextAccount(),
1973
+ tokenMint: getNextAccount(),
1847
1974
  tokenProgram: getNextAccount(),
1848
1975
  delegatee: getNextAccount(),
1849
1976
  eventAuthority: getNextAccount(),
@@ -1854,29 +1981,29 @@ function parseTransferFixedInstruction(instruction) {
1854
1981
  }
1855
1982
 
1856
1983
  // src/generated/instructions/transferRecurring.ts
1857
- var import_kit33 = require("@solana/kit");
1858
- var import_program_client_core11 = require("@solana/program-client-core");
1984
+ var import_kit34 = require("@solana/kit");
1985
+ var import_program_client_core12 = require("@solana/program-client-core");
1859
1986
  var TRANSFER_RECURRING_DISCRIMINATOR = 5;
1860
1987
  function getTransferRecurringDiscriminatorBytes() {
1861
- return (0, import_kit33.getU8Encoder)().encode(TRANSFER_RECURRING_DISCRIMINATOR);
1988
+ return (0, import_kit34.getU8Encoder)().encode(TRANSFER_RECURRING_DISCRIMINATOR);
1862
1989
  }
1863
1990
  function getTransferRecurringInstructionDataEncoder() {
1864
- return (0, import_kit33.transformEncoder)(
1865
- (0, import_kit33.getStructEncoder)([
1866
- ["discriminator", (0, import_kit33.getU8Encoder)()],
1991
+ return (0, import_kit34.transformEncoder)(
1992
+ (0, import_kit34.getStructEncoder)([
1993
+ ["discriminator", (0, import_kit34.getU8Encoder)()],
1867
1994
  ["transferData", getTransferDataEncoder()]
1868
1995
  ]),
1869
1996
  (value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
1870
1997
  );
1871
1998
  }
1872
1999
  function getTransferRecurringInstructionDataDecoder() {
1873
- return (0, import_kit33.getStructDecoder)([
1874
- ["discriminator", (0, import_kit33.getU8Decoder)()],
2000
+ return (0, import_kit34.getStructDecoder)([
2001
+ ["discriminator", (0, import_kit34.getU8Decoder)()],
1875
2002
  ["transferData", getTransferDataDecoder()]
1876
2003
  ]);
1877
2004
  }
1878
2005
  function getTransferRecurringInstructionDataCodec() {
1879
- return (0, import_kit33.combineCodec)(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
2006
+ return (0, import_kit34.combineCodec)(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
1880
2007
  }
1881
2008
  function getTransferRecurringInstruction(input, config) {
1882
2009
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1885,6 +2012,7 @@ function getTransferRecurringInstruction(input, config) {
1885
2012
  subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1886
2013
  delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
1887
2014
  receiverAta: { value: input.receiverAta ?? null, isWritable: true },
2015
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1888
2016
  tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1889
2017
  delegatee: { value: input.delegatee ?? null, isWritable: false },
1890
2018
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
@@ -1898,13 +2026,14 @@ function getTransferRecurringInstruction(input, config) {
1898
2026
  if (!accounts.selfProgram.value) {
1899
2027
  accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1900
2028
  }
1901
- const getAccountMeta = (0, import_program_client_core11.getAccountMetaFactory)(programAddress, "programId");
2029
+ const getAccountMeta = (0, import_program_client_core12.getAccountMetaFactory)(programAddress, "programId");
1902
2030
  return Object.freeze({
1903
2031
  accounts: [
1904
2032
  getAccountMeta("delegationPda", accounts.delegationPda),
1905
2033
  getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1906
2034
  getAccountMeta("delegatorAta", accounts.delegatorAta),
1907
2035
  getAccountMeta("receiverAta", accounts.receiverAta),
2036
+ getAccountMeta("tokenMint", accounts.tokenMint),
1908
2037
  getAccountMeta("tokenProgram", accounts.tokenProgram),
1909
2038
  getAccountMeta("delegatee", accounts.delegatee),
1910
2039
  getAccountMeta("eventAuthority", accounts.eventAuthority),
@@ -1915,10 +2044,10 @@ function getTransferRecurringInstruction(input, config) {
1915
2044
  });
1916
2045
  }
1917
2046
  function parseTransferRecurringInstruction(instruction) {
1918
- if (instruction.accounts.length < 8) {
1919
- throw new import_kit33.SolanaError(import_kit33.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
2047
+ if (instruction.accounts.length < 9) {
2048
+ throw new import_kit34.SolanaError(import_kit34.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
1920
2049
  actualAccountMetas: instruction.accounts.length,
1921
- expectedAccountMetas: 8
2050
+ expectedAccountMetas: 9
1922
2051
  });
1923
2052
  }
1924
2053
  let accountIndex = 0;
@@ -1934,6 +2063,7 @@ function parseTransferRecurringInstruction(instruction) {
1934
2063
  subscriptionAuthority: getNextAccount(),
1935
2064
  delegatorAta: getNextAccount(),
1936
2065
  receiverAta: getNextAccount(),
2066
+ tokenMint: getNextAccount(),
1937
2067
  tokenProgram: getNextAccount(),
1938
2068
  delegatee: getNextAccount(),
1939
2069
  eventAuthority: getNextAccount(),
@@ -1944,29 +2074,29 @@ function parseTransferRecurringInstruction(instruction) {
1944
2074
  }
1945
2075
 
1946
2076
  // src/generated/instructions/transferSubscription.ts
1947
- var import_kit34 = require("@solana/kit");
1948
- var import_program_client_core12 = require("@solana/program-client-core");
2077
+ var import_kit35 = require("@solana/kit");
2078
+ var import_program_client_core13 = require("@solana/program-client-core");
1949
2079
  var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
1950
2080
  function getTransferSubscriptionDiscriminatorBytes() {
1951
- return (0, import_kit34.getU8Encoder)().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
2081
+ return (0, import_kit35.getU8Encoder)().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
1952
2082
  }
1953
2083
  function getTransferSubscriptionInstructionDataEncoder() {
1954
- return (0, import_kit34.transformEncoder)(
1955
- (0, import_kit34.getStructEncoder)([
1956
- ["discriminator", (0, import_kit34.getU8Encoder)()],
2084
+ return (0, import_kit35.transformEncoder)(
2085
+ (0, import_kit35.getStructEncoder)([
2086
+ ["discriminator", (0, import_kit35.getU8Encoder)()],
1957
2087
  ["transferData", getTransferDataEncoder()]
1958
2088
  ]),
1959
2089
  (value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
1960
2090
  );
1961
2091
  }
1962
2092
  function getTransferSubscriptionInstructionDataDecoder() {
1963
- return (0, import_kit34.getStructDecoder)([
1964
- ["discriminator", (0, import_kit34.getU8Decoder)()],
2093
+ return (0, import_kit35.getStructDecoder)([
2094
+ ["discriminator", (0, import_kit35.getU8Decoder)()],
1965
2095
  ["transferData", getTransferDataDecoder()]
1966
2096
  ]);
1967
2097
  }
1968
2098
  function getTransferSubscriptionInstructionDataCodec() {
1969
- return (0, import_kit34.combineCodec)(
2099
+ return (0, import_kit35.combineCodec)(
1970
2100
  getTransferSubscriptionInstructionDataEncoder(),
1971
2101
  getTransferSubscriptionInstructionDataDecoder()
1972
2102
  );
@@ -1980,6 +2110,7 @@ function getTransferSubscriptionInstruction(input, config) {
1980
2110
  delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
1981
2111
  receiverAta: { value: input.receiverAta ?? null, isWritable: true },
1982
2112
  caller: { value: input.caller ?? null, isWritable: false },
2113
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1983
2114
  tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1984
2115
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1985
2116
  selfProgram: { value: input.selfProgram ?? null, isWritable: false }
@@ -1992,7 +2123,7 @@ function getTransferSubscriptionInstruction(input, config) {
1992
2123
  if (!accounts.selfProgram.value) {
1993
2124
  accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1994
2125
  }
1995
- const getAccountMeta = (0, import_program_client_core12.getAccountMetaFactory)(programAddress, "programId");
2126
+ const getAccountMeta = (0, import_program_client_core13.getAccountMetaFactory)(programAddress, "programId");
1996
2127
  return Object.freeze({
1997
2128
  accounts: [
1998
2129
  getAccountMeta("subscriptionPda", accounts.subscriptionPda),
@@ -2001,6 +2132,7 @@ function getTransferSubscriptionInstruction(input, config) {
2001
2132
  getAccountMeta("delegatorAta", accounts.delegatorAta),
2002
2133
  getAccountMeta("receiverAta", accounts.receiverAta),
2003
2134
  getAccountMeta("caller", accounts.caller),
2135
+ getAccountMeta("tokenMint", accounts.tokenMint),
2004
2136
  getAccountMeta("tokenProgram", accounts.tokenProgram),
2005
2137
  getAccountMeta("eventAuthority", accounts.eventAuthority),
2006
2138
  getAccountMeta("selfProgram", accounts.selfProgram)
@@ -2010,10 +2142,10 @@ function getTransferSubscriptionInstruction(input, config) {
2010
2142
  });
2011
2143
  }
2012
2144
  function parseTransferSubscriptionInstruction(instruction) {
2013
- if (instruction.accounts.length < 9) {
2014
- throw new import_kit34.SolanaError(import_kit34.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
2145
+ if (instruction.accounts.length < 10) {
2146
+ throw new import_kit35.SolanaError(import_kit35.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
2015
2147
  actualAccountMetas: instruction.accounts.length,
2016
- expectedAccountMetas: 9
2148
+ expectedAccountMetas: 10
2017
2149
  });
2018
2150
  }
2019
2151
  let accountIndex = 0;
@@ -2031,6 +2163,7 @@ function parseTransferSubscriptionInstruction(instruction) {
2031
2163
  delegatorAta: getNextAccount(),
2032
2164
  receiverAta: getNextAccount(),
2033
2165
  caller: getNextAccount(),
2166
+ tokenMint: getNextAccount(),
2034
2167
  tokenProgram: getNextAccount(),
2035
2168
  eventAuthority: getNextAccount(),
2036
2169
  selfProgram: getNextAccount()
@@ -2040,29 +2173,29 @@ function parseTransferSubscriptionInstruction(instruction) {
2040
2173
  }
2041
2174
 
2042
2175
  // src/generated/instructions/updatePlan.ts
2043
- var import_kit35 = require("@solana/kit");
2044
- var import_program_client_core13 = require("@solana/program-client-core");
2176
+ var import_kit36 = require("@solana/kit");
2177
+ var import_program_client_core14 = require("@solana/program-client-core");
2045
2178
  var UPDATE_PLAN_DISCRIMINATOR = 8;
2046
2179
  function getUpdatePlanDiscriminatorBytes() {
2047
- return (0, import_kit35.getU8Encoder)().encode(UPDATE_PLAN_DISCRIMINATOR);
2180
+ return (0, import_kit36.getU8Encoder)().encode(UPDATE_PLAN_DISCRIMINATOR);
2048
2181
  }
2049
2182
  function getUpdatePlanInstructionDataEncoder() {
2050
- return (0, import_kit35.transformEncoder)(
2051
- (0, import_kit35.getStructEncoder)([
2052
- ["discriminator", (0, import_kit35.getU8Encoder)()],
2183
+ return (0, import_kit36.transformEncoder)(
2184
+ (0, import_kit36.getStructEncoder)([
2185
+ ["discriminator", (0, import_kit36.getU8Encoder)()],
2053
2186
  ["updatePlanData", getUpdatePlanDataEncoder()]
2054
2187
  ]),
2055
2188
  (value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
2056
2189
  );
2057
2190
  }
2058
2191
  function getUpdatePlanInstructionDataDecoder() {
2059
- return (0, import_kit35.getStructDecoder)([
2060
- ["discriminator", (0, import_kit35.getU8Decoder)()],
2192
+ return (0, import_kit36.getStructDecoder)([
2193
+ ["discriminator", (0, import_kit36.getU8Decoder)()],
2061
2194
  ["updatePlanData", getUpdatePlanDataDecoder()]
2062
2195
  ]);
2063
2196
  }
2064
2197
  function getUpdatePlanInstructionDataCodec() {
2065
- return (0, import_kit35.combineCodec)(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
2198
+ return (0, import_kit36.combineCodec)(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
2066
2199
  }
2067
2200
  function getUpdatePlanInstruction(input, config) {
2068
2201
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -2072,7 +2205,7 @@ function getUpdatePlanInstruction(input, config) {
2072
2205
  };
2073
2206
  const accounts = originalAccounts;
2074
2207
  const args = { ...input };
2075
- const getAccountMeta = (0, import_program_client_core13.getAccountMetaFactory)(programAddress, "programId");
2208
+ const getAccountMeta = (0, import_program_client_core14.getAccountMetaFactory)(programAddress, "programId");
2076
2209
  return Object.freeze({
2077
2210
  accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
2078
2211
  data: getUpdatePlanInstructionDataEncoder().encode(args),
@@ -2081,7 +2214,7 @@ function getUpdatePlanInstruction(input, config) {
2081
2214
  }
2082
2215
  function parseUpdatePlanInstruction(instruction) {
2083
2216
  if (instruction.accounts.length < 2) {
2084
- throw new import_kit35.SolanaError(import_kit35.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
2217
+ throw new import_kit36.SolanaError(import_kit36.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
2085
2218
  actualAccountMetas: instruction.accounts.length,
2086
2219
  expectedAccountMetas: 2
2087
2220
  });
@@ -2124,50 +2257,54 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
2124
2257
  SubscriptionsInstruction2[SubscriptionsInstruction2["TransferSubscription"] = 10] = "TransferSubscription";
2125
2258
  SubscriptionsInstruction2[SubscriptionsInstruction2["Subscribe"] = 11] = "Subscribe";
2126
2259
  SubscriptionsInstruction2[SubscriptionsInstruction2["CancelSubscription"] = 12] = "CancelSubscription";
2260
+ SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
2127
2261
  return SubscriptionsInstruction2;
2128
2262
  })(SubscriptionsInstruction || {});
2129
2263
  function identifySubscriptionsInstruction(instruction) {
2130
2264
  const data = "data" in instruction ? instruction.data : instruction;
2131
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(0), 0)) {
2265
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(0), 0)) {
2132
2266
  return 0 /* InitSubscriptionAuthority */;
2133
2267
  }
2134
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(1), 0)) {
2268
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(1), 0)) {
2135
2269
  return 1 /* CreateFixedDelegation */;
2136
2270
  }
2137
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(2), 0)) {
2271
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(2), 0)) {
2138
2272
  return 2 /* CreateRecurringDelegation */;
2139
2273
  }
2140
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(3), 0)) {
2274
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(3), 0)) {
2141
2275
  return 3 /* RevokeDelegation */;
2142
2276
  }
2143
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(4), 0)) {
2277
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(4), 0)) {
2144
2278
  return 4 /* TransferFixed */;
2145
2279
  }
2146
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(5), 0)) {
2280
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(5), 0)) {
2147
2281
  return 5 /* TransferRecurring */;
2148
2282
  }
2149
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(6), 0)) {
2283
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(6), 0)) {
2150
2284
  return 6 /* CloseSubscriptionAuthority */;
2151
2285
  }
2152
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(7), 0)) {
2286
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(7), 0)) {
2153
2287
  return 7 /* CreatePlan */;
2154
2288
  }
2155
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(8), 0)) {
2289
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(8), 0)) {
2156
2290
  return 8 /* UpdatePlan */;
2157
2291
  }
2158
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(9), 0)) {
2292
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(9), 0)) {
2159
2293
  return 9 /* DeletePlan */;
2160
2294
  }
2161
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(10), 0)) {
2295
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(10), 0)) {
2162
2296
  return 10 /* TransferSubscription */;
2163
2297
  }
2164
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(11), 0)) {
2298
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(11), 0)) {
2165
2299
  return 11 /* Subscribe */;
2166
2300
  }
2167
- if ((0, import_kit36.containsBytes)(data, (0, import_kit36.getU8Encoder)().encode(12), 0)) {
2301
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(12), 0)) {
2168
2302
  return 12 /* CancelSubscription */;
2169
2303
  }
2170
- throw new import_kit36.SolanaError(import_kit36.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2304
+ if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(13), 0)) {
2305
+ return 13 /* ResumeSubscription */;
2306
+ }
2307
+ throw new import_kit37.SolanaError(import_kit37.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2171
2308
  instructionData: data,
2172
2309
  programName: "subscriptions"
2173
2310
  });
@@ -2176,86 +2313,93 @@ function parseSubscriptionsInstruction(instruction) {
2176
2313
  const instructionType = identifySubscriptionsInstruction(instruction);
2177
2314
  switch (instructionType) {
2178
2315
  case 0 /* InitSubscriptionAuthority */: {
2179
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2316
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2180
2317
  return {
2181
2318
  instructionType: 0 /* InitSubscriptionAuthority */,
2182
2319
  ...parseInitSubscriptionAuthorityInstruction(instruction)
2183
2320
  };
2184
2321
  }
2185
2322
  case 1 /* CreateFixedDelegation */: {
2186
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2323
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2187
2324
  return {
2188
2325
  instructionType: 1 /* CreateFixedDelegation */,
2189
2326
  ...parseCreateFixedDelegationInstruction(instruction)
2190
2327
  };
2191
2328
  }
2192
2329
  case 2 /* CreateRecurringDelegation */: {
2193
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2330
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2194
2331
  return {
2195
2332
  instructionType: 2 /* CreateRecurringDelegation */,
2196
2333
  ...parseCreateRecurringDelegationInstruction(instruction)
2197
2334
  };
2198
2335
  }
2199
2336
  case 3 /* RevokeDelegation */: {
2200
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2337
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2201
2338
  return {
2202
2339
  instructionType: 3 /* RevokeDelegation */,
2203
2340
  ...parseRevokeDelegationInstruction(instruction)
2204
2341
  };
2205
2342
  }
2206
2343
  case 4 /* TransferFixed */: {
2207
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2344
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2208
2345
  return {
2209
2346
  instructionType: 4 /* TransferFixed */,
2210
2347
  ...parseTransferFixedInstruction(instruction)
2211
2348
  };
2212
2349
  }
2213
2350
  case 5 /* TransferRecurring */: {
2214
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2351
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2215
2352
  return {
2216
2353
  instructionType: 5 /* TransferRecurring */,
2217
2354
  ...parseTransferRecurringInstruction(instruction)
2218
2355
  };
2219
2356
  }
2220
2357
  case 6 /* CloseSubscriptionAuthority */: {
2221
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2358
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2222
2359
  return {
2223
2360
  instructionType: 6 /* CloseSubscriptionAuthority */,
2224
2361
  ...parseCloseSubscriptionAuthorityInstruction(instruction)
2225
2362
  };
2226
2363
  }
2227
2364
  case 7 /* CreatePlan */: {
2228
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2365
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2229
2366
  return { instructionType: 7 /* CreatePlan */, ...parseCreatePlanInstruction(instruction) };
2230
2367
  }
2231
2368
  case 8 /* UpdatePlan */: {
2232
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2369
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2233
2370
  return { instructionType: 8 /* UpdatePlan */, ...parseUpdatePlanInstruction(instruction) };
2234
2371
  }
2235
2372
  case 9 /* DeletePlan */: {
2236
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2373
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2237
2374
  return { instructionType: 9 /* DeletePlan */, ...parseDeletePlanInstruction(instruction) };
2238
2375
  }
2239
2376
  case 10 /* TransferSubscription */: {
2240
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2377
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2241
2378
  return {
2242
2379
  instructionType: 10 /* TransferSubscription */,
2243
2380
  ...parseTransferSubscriptionInstruction(instruction)
2244
2381
  };
2245
2382
  }
2246
2383
  case 11 /* Subscribe */: {
2247
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2384
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2248
2385
  return { instructionType: 11 /* Subscribe */, ...parseSubscribeInstruction(instruction) };
2249
2386
  }
2250
2387
  case 12 /* CancelSubscription */: {
2251
- (0, import_kit36.assertIsInstructionWithAccounts)(instruction);
2388
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2252
2389
  return {
2253
2390
  instructionType: 12 /* CancelSubscription */,
2254
2391
  ...parseCancelSubscriptionInstruction(instruction)
2255
2392
  };
2256
2393
  }
2394
+ case 13 /* ResumeSubscription */: {
2395
+ (0, import_kit37.assertIsInstructionWithAccounts)(instruction);
2396
+ return {
2397
+ instructionType: 13 /* ResumeSubscription */,
2398
+ ...parseResumeSubscriptionInstruction(instruction)
2399
+ };
2400
+ }
2257
2401
  default:
2258
- throw new import_kit36.SolanaError(import_kit36.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
2402
+ throw new import_kit37.SolanaError(import_kit37.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
2259
2403
  instructionType,
2260
2404
  programName: "subscriptions"
2261
2405
  });
@@ -2263,30 +2407,31 @@ function parseSubscriptionsInstruction(instruction) {
2263
2407
  }
2264
2408
  function subscriptionsProgram() {
2265
2409
  return (client) => {
2266
- return (0, import_kit36.extendClient)(client, {
2410
+ return (0, import_kit37.extendClient)(client, {
2267
2411
  subscriptions: {
2268
2412
  accounts: {
2269
- fixedDelegation: (0, import_program_client_core14.addSelfFetchFunctions)(client, getFixedDelegationCodec()),
2270
- plan: (0, import_program_client_core14.addSelfFetchFunctions)(client, getPlanCodec()),
2271
- recurringDelegation: (0, import_program_client_core14.addSelfFetchFunctions)(client, getRecurringDelegationCodec()),
2272
- subscriptionAuthority: (0, import_program_client_core14.addSelfFetchFunctions)(client, getSubscriptionAuthorityCodec()),
2273
- subscriptionDelegation: (0, import_program_client_core14.addSelfFetchFunctions)(client, getSubscriptionDelegationCodec()),
2274
- eventAuthority: (0, import_program_client_core14.addSelfFetchFunctions)(client, getEventAuthorityCodec())
2413
+ fixedDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getFixedDelegationCodec()),
2414
+ plan: (0, import_program_client_core15.addSelfFetchFunctions)(client, getPlanCodec()),
2415
+ recurringDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getRecurringDelegationCodec()),
2416
+ subscriptionAuthority: (0, import_program_client_core15.addSelfFetchFunctions)(client, getSubscriptionAuthorityCodec()),
2417
+ subscriptionDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getSubscriptionDelegationCodec()),
2418
+ eventAuthority: (0, import_program_client_core15.addSelfFetchFunctions)(client, getEventAuthorityCodec())
2275
2419
  },
2276
2420
  instructions: {
2277
- initSubscriptionAuthority: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getInitSubscriptionAuthorityInstructionAsync(input)),
2278
- createFixedDelegation: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getCreateFixedDelegationInstruction(input)),
2279
- createRecurringDelegation: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getCreateRecurringDelegationInstruction(input)),
2280
- revokeDelegation: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getRevokeDelegationInstruction(input)),
2281
- transferFixed: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getTransferFixedInstruction(input)),
2282
- transferRecurring: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getTransferRecurringInstruction(input)),
2283
- closeSubscriptionAuthority: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getCloseSubscriptionAuthorityInstruction(input)),
2284
- createPlan: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getCreatePlanInstruction(input)),
2285
- updatePlan: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getUpdatePlanInstruction(input)),
2286
- deletePlan: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getDeletePlanInstruction(input)),
2287
- transferSubscription: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getTransferSubscriptionInstruction(input)),
2288
- subscribe: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getSubscribeInstructionAsync(input)),
2289
- cancelSubscription: (input) => (0, import_program_client_core14.addSelfPlanAndSendFunctions)(client, getCancelSubscriptionInstructionAsync(input))
2421
+ initSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getInitSubscriptionAuthorityInstructionAsync(input)),
2422
+ createFixedDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreateFixedDelegationInstruction(input)),
2423
+ createRecurringDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreateRecurringDelegationInstruction(input)),
2424
+ revokeDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getRevokeDelegationInstruction(input)),
2425
+ transferFixed: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferFixedInstruction(input)),
2426
+ transferRecurring: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferRecurringInstruction(input)),
2427
+ closeSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCloseSubscriptionAuthorityInstruction(input)),
2428
+ createPlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreatePlanInstruction(input)),
2429
+ updatePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getUpdatePlanInstruction(input)),
2430
+ deletePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getDeletePlanInstruction(input)),
2431
+ transferSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferSubscriptionInstruction(input)),
2432
+ subscribe: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getSubscribeInstructionAsync(input)),
2433
+ cancelSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCancelSubscriptionInstructionAsync(input)),
2434
+ resumeSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getResumeSubscriptionInstructionAsync(input))
2290
2435
  },
2291
2436
  pdas: {
2292
2437
  fixedDelegation: findFixedDelegationPda,
@@ -2444,7 +2589,7 @@ if (process.env["NODE_ENV"] !== "production") {
2444
2589
  [SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY]: `Delegation init_id does not match current SubscriptionAuthority`,
2445
2590
  [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED]: `Subscription already cancelled`,
2446
2591
  [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED]: `Subscription cancelled and past valid period`,
2447
- [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription must be cancelled before revoke`,
2592
+ [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription is not cancelled`,
2448
2593
  [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
2449
2594
  [SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
2450
2595
  [SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
@@ -2458,7 +2603,7 @@ function getSubscriptionsErrorMessage(code) {
2458
2603
  return "Error message not available in production bundles.";
2459
2604
  }
2460
2605
  function isSubscriptionsError(error, transactionMessage, code) {
2461
- return (0, import_kit37.isProgramError)(error, transactionMessage, SUBSCRIPTIONS_PROGRAM_ADDRESS, code);
2606
+ return (0, import_kit38.isProgramError)(error, transactionMessage, SUBSCRIPTIONS_PROGRAM_ADDRESS, code);
2462
2607
  }
2463
2608
 
2464
2609
  // src/constants.ts
@@ -2483,7 +2628,7 @@ var METADATA_URI_LEN = 128;
2483
2628
 
2484
2629
  // src/accounts/decode.ts
2485
2630
  function toEncodedAccount(raw, programAddress) {
2486
- const base64Encoder = (0, import_kit38.getBase64Encoder)();
2631
+ const base64Encoder = (0, import_kit39.getBase64Encoder)();
2487
2632
  const data = base64Encoder.encode(raw.account.data[0]);
2488
2633
  return {
2489
2634
  address: raw.pubkey,
@@ -2600,8 +2745,8 @@ async function fetchSubscriptionsForUser(rpc, user, programAddress) {
2600
2745
  }
2601
2746
 
2602
2747
  // src/plugin.ts
2603
- var import_kit39 = require("@solana/kit");
2604
- var import_program_client_core15 = require("@solana/program-client-core");
2748
+ var import_kit40 = require("@solana/kit");
2749
+ var import_program_client_core16 = require("@solana/program-client-core");
2605
2750
  var import_token = require("@solana-program/token");
2606
2751
 
2607
2752
  // src/validators.ts
@@ -2651,7 +2796,7 @@ function appendPayer(instruction, payer) {
2651
2796
  return withTrailing(instruction, [
2652
2797
  {
2653
2798
  address: payer.address,
2654
- role: import_kit39.AccountRole.WRITABLE_SIGNER,
2799
+ role: import_kit40.AccountRole.WRITABLE_SIGNER,
2655
2800
  signer: payer
2656
2801
  }
2657
2802
  ]);
@@ -2680,12 +2825,17 @@ async function getCloseSubscriptionAuthorityOverlayInstructionAsync(input) {
2680
2825
  pdaConfig(input.programAddress)
2681
2826
  );
2682
2827
  if (input.receiver) {
2683
- ix = withTrailing(ix, [{ address: input.receiver, role: import_kit39.AccountRole.WRITABLE }]);
2828
+ ix = withTrailing(ix, [{ address: input.receiver, role: import_kit40.AccountRole.WRITABLE }]);
2684
2829
  }
2685
2830
  return ix;
2686
2831
  }
2687
2832
  async function getCreateFixedDelegationOverlayInstructionAsync(input) {
2688
2833
  assertPositive(input.amount, "amount");
2834
+ if (input.expectedSubscriptionAuthorityInitId === void 0) {
2835
+ throw new Error(
2836
+ "getCreateFixedDelegationOverlayInstructionAsync requires expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.createFixedDelegation(...)` to auto-fetch from the live authority."
2837
+ );
2838
+ }
2689
2839
  const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2690
2840
  { tokenMint: input.tokenMint, user: input.delegator.address },
2691
2841
  pdaConfig(input.programAddress)
@@ -2707,6 +2857,7 @@ async function getCreateFixedDelegationOverlayInstructionAsync(input) {
2707
2857
  delegator: input.delegator,
2708
2858
  fixedDelegation: {
2709
2859
  amount: input.amount,
2860
+ expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
2710
2861
  expiryTs: input.expiryTs,
2711
2862
  nonce: input.nonce
2712
2863
  },
@@ -2720,6 +2871,11 @@ async function getCreateFixedDelegationOverlayInstructionAsync(input) {
2720
2871
  async function getCreateRecurringDelegationOverlayInstructionAsync(input) {
2721
2872
  assertPositive(input.amountPerPeriod, "amountPerPeriod");
2722
2873
  assertPositive(input.periodLengthS, "periodLengthS");
2874
+ if (input.expectedSubscriptionAuthorityInitId === void 0) {
2875
+ throw new Error(
2876
+ "getCreateRecurringDelegationOverlayInstructionAsync requires expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.createRecurringDelegation(...)` to auto-fetch from the live authority."
2877
+ );
2878
+ }
2723
2879
  const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
2724
2880
  { tokenMint: input.tokenMint, user: input.delegator.address },
2725
2881
  pdaConfig(input.programAddress)
@@ -2741,6 +2897,7 @@ async function getCreateRecurringDelegationOverlayInstructionAsync(input) {
2741
2897
  delegator: input.delegator,
2742
2898
  recurringDelegation: {
2743
2899
  amountPerPeriod: input.amountPerPeriod,
2900
+ expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
2744
2901
  expiryTs: input.expiryTs,
2745
2902
  nonce: input.nonce,
2746
2903
  periodLengthS: input.periodLengthS,
@@ -2762,14 +2919,14 @@ function getRevokeDelegationOverlayInstruction(input) {
2762
2919
  pdaConfig(input.programAddress)
2763
2920
  );
2764
2921
  if (input.receiver) {
2765
- ix = withTrailing(ix, [{ address: input.receiver, role: import_kit39.AccountRole.WRITABLE }]);
2922
+ ix = withTrailing(ix, [{ address: input.receiver, role: import_kit40.AccountRole.WRITABLE }]);
2766
2923
  }
2767
2924
  return ix;
2768
2925
  }
2769
2926
  function getRevokeSubscriptionOverlayInstruction(input) {
2770
- const trailing = [{ address: input.planPda, role: import_kit39.AccountRole.READONLY }];
2927
+ const trailing = [{ address: input.planPda, role: import_kit40.AccountRole.READONLY }];
2771
2928
  if (input.receiver) {
2772
- trailing.push({ address: input.receiver, role: import_kit39.AccountRole.WRITABLE });
2929
+ trailing.push({ address: input.receiver, role: import_kit40.AccountRole.WRITABLE });
2773
2930
  }
2774
2931
  return withTrailing(
2775
2932
  getRevokeDelegationInstruction(
@@ -2795,6 +2952,7 @@ async function getTransferDelegationOverlayInstructionAsync(input, getInstructio
2795
2952
  delegatorAta: input.delegatorAta,
2796
2953
  receiverAta: input.receiverAta,
2797
2954
  subscriptionAuthority,
2955
+ tokenMint: input.tokenMint,
2798
2956
  tokenProgram: input.tokenProgram,
2799
2957
  transferData: {
2800
2958
  amount: input.amount,
@@ -2830,6 +2988,7 @@ async function getTransferSubscriptionOverlayInstructionAsync(input) {
2830
2988
  receiverAta: input.receiverAta,
2831
2989
  subscriptionAuthority,
2832
2990
  subscriptionPda: input.subscriptionPda,
2991
+ tokenMint: input.tokenMint,
2833
2992
  tokenProgram: input.tokenProgram,
2834
2993
  transferData: {
2835
2994
  amount: input.amount,
@@ -2894,9 +3053,9 @@ function getDeletePlanOverlayInstruction(input) {
2894
3053
  return getDeletePlanInstruction({ owner: input.owner, planPda: input.planPda }, pdaConfig(input.programAddress));
2895
3054
  }
2896
3055
  async function getSubscribeOverlayInstructionAsync(input) {
2897
- if (input.expectedAmount === void 0 || input.expectedPeriodHours === void 0 || input.expectedCreatedAt === void 0) {
3056
+ if (input.expectedAmount === void 0 || input.expectedPeriodHours === void 0 || input.expectedCreatedAt === void 0 || input.expectedSubscriptionAuthorityInitId === void 0) {
2898
3057
  throw new Error(
2899
- "getSubscribeOverlayInstructionAsync requires expectedAmount, expectedPeriodHours, and expectedCreatedAt. Use the plugin client `subscriptions.instructions.subscribe(...)` to auto-fetch from the live plan."
3058
+ "getSubscribeOverlayInstructionAsync requires expectedAmount, expectedPeriodHours, expectedCreatedAt, and expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.subscribe(...)` to auto-fetch from the live plan and authority."
2900
3059
  );
2901
3060
  }
2902
3061
  const [planPda, planBump] = await findPlanPda(
@@ -2917,6 +3076,7 @@ async function getSubscribeOverlayInstructionAsync(input) {
2917
3076
  expectedCreatedAt: input.expectedCreatedAt,
2918
3077
  expectedMint: input.tokenMint,
2919
3078
  expectedPeriodHours: input.expectedPeriodHours,
3079
+ expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
2920
3080
  planBump,
2921
3081
  planId: input.planId
2922
3082
  },
@@ -2938,9 +3098,19 @@ function getCancelSubscriptionOverlayInstructionAsync(input) {
2938
3098
  pdaConfig(input.programAddress)
2939
3099
  );
2940
3100
  }
3101
+ function getResumeSubscriptionOverlayInstructionAsync(input) {
3102
+ return getResumeSubscriptionInstructionAsync(
3103
+ {
3104
+ planPda: input.planPda,
3105
+ subscriber: input.subscriber,
3106
+ subscriptionPda: input.subscriptionPda
3107
+ },
3108
+ pdaConfig(input.programAddress)
3109
+ );
3110
+ }
2941
3111
  function subscriptionsProgram2() {
2942
3112
  return (client) => {
2943
- return (0, import_kit39.pipe)(client, subscriptionsProgram(), (c) => {
3113
+ return (0, import_kit40.pipe)(client, subscriptionsProgram(), (c) => {
2944
3114
  const queries = {
2945
3115
  activeDelegationSummary: async (wallet) => {
2946
3116
  const delegations = await fetchDelegationsByDelegator(c.rpc, wallet);
@@ -2963,52 +3133,86 @@ function subscriptionsProgram2() {
2963
3133
  },
2964
3134
  plansForOwner: (owner) => fetchPlansForOwner(c.rpc, owner)
2965
3135
  };
3136
+ const resolveExpectedSubscriptionAuthorityInitId = async (tokenMint, user, programAddress, expectedSubscriptionAuthorityInitId) => {
3137
+ if (expectedSubscriptionAuthorityInitId !== void 0) {
3138
+ return expectedSubscriptionAuthorityInitId;
3139
+ }
3140
+ const [subscriptionAuthorityPda] = await findSubscriptionAuthorityPda(
3141
+ { tokenMint, user },
3142
+ pdaConfig(programAddress)
3143
+ );
3144
+ const subscriptionAuthority = await fetchMaybeSubscriptionAuthority(c.rpc, subscriptionAuthorityPda);
3145
+ if (!subscriptionAuthority.exists) {
3146
+ throw new Error("SubscriptionAuthority is not initialized for this delegator and token mint.");
3147
+ }
3148
+ return subscriptionAuthority.data.initId;
3149
+ };
2966
3150
  const instructions = {
2967
- cancelSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3151
+ cancelSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
2968
3152
  client,
2969
3153
  getCancelSubscriptionOverlayInstructionAsync({
2970
3154
  ...input,
2971
3155
  subscriber: input.subscriber ?? client.identity
2972
3156
  })
2973
3157
  ),
2974
- closeSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3158
+ closeSubscriptionAuthority: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
2975
3159
  client,
2976
3160
  getCloseSubscriptionAuthorityOverlayInstructionAsync({
2977
3161
  ...input,
2978
3162
  user: input.user ?? client.identity
2979
3163
  })
2980
3164
  ),
2981
- createFixedDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3165
+ createFixedDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
2982
3166
  client,
2983
- getCreateFixedDelegationOverlayInstructionAsync({
2984
- ...input,
2985
- delegator: input.delegator ?? client.identity,
2986
- payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
2987
- })
3167
+ (async () => {
3168
+ const delegator = input.delegator ?? client.identity;
3169
+ const expectedSubscriptionAuthorityInitId = await resolveExpectedSubscriptionAuthorityInitId(
3170
+ input.tokenMint,
3171
+ delegator.address,
3172
+ input.programAddress,
3173
+ input.expectedSubscriptionAuthorityInitId
3174
+ );
3175
+ return await getCreateFixedDelegationOverlayInstructionAsync({
3176
+ ...input,
3177
+ delegator,
3178
+ expectedSubscriptionAuthorityInitId,
3179
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3180
+ });
3181
+ })()
2988
3182
  ),
2989
- createPlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3183
+ createPlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
2990
3184
  client,
2991
3185
  getCreatePlanOverlayInstructionAsync({
2992
3186
  ...input,
2993
3187
  owner: input.owner ?? client.identity
2994
3188
  })
2995
3189
  ),
2996
- createRecurringDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3190
+ createRecurringDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
2997
3191
  client,
2998
- getCreateRecurringDelegationOverlayInstructionAsync({
2999
- ...input,
3000
- delegator: input.delegator ?? client.identity,
3001
- payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3002
- })
3192
+ (async () => {
3193
+ const delegator = input.delegator ?? client.identity;
3194
+ const expectedSubscriptionAuthorityInitId = await resolveExpectedSubscriptionAuthorityInitId(
3195
+ input.tokenMint,
3196
+ delegator.address,
3197
+ input.programAddress,
3198
+ input.expectedSubscriptionAuthorityInitId
3199
+ );
3200
+ return await getCreateRecurringDelegationOverlayInstructionAsync({
3201
+ ...input,
3202
+ delegator,
3203
+ expectedSubscriptionAuthorityInitId,
3204
+ payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3205
+ });
3206
+ })()
3003
3207
  ),
3004
- deletePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3208
+ deletePlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3005
3209
  client,
3006
3210
  getDeletePlanOverlayInstruction({
3007
3211
  ...input,
3008
3212
  owner: input.owner ?? client.identity
3009
3213
  })
3010
3214
  ),
3011
- initSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3215
+ initSubscriptionAuthority: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3012
3216
  client,
3013
3217
  getInitSubscriptionAuthorityOverlayInstructionAsync({
3014
3218
  ...input,
@@ -3016,26 +3220,38 @@ function subscriptionsProgram2() {
3016
3220
  payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
3017
3221
  })
3018
3222
  ),
3019
- revokeDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3223
+ resumeSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3224
+ client,
3225
+ getResumeSubscriptionOverlayInstructionAsync({
3226
+ ...input,
3227
+ subscriber: input.subscriber ?? client.identity
3228
+ })
3229
+ ),
3230
+ revokeDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3020
3231
  client,
3021
3232
  getRevokeDelegationOverlayInstruction({
3022
3233
  ...input,
3023
3234
  authority: input.authority ?? client.identity
3024
3235
  })
3025
3236
  ),
3026
- revokeSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3237
+ revokeSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3027
3238
  client,
3028
3239
  getRevokeSubscriptionOverlayInstruction({
3029
3240
  ...input,
3030
3241
  authority: input.authority ?? client.identity
3031
3242
  })
3032
3243
  ),
3033
- subscribe: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3244
+ subscribe: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3034
3245
  client,
3035
3246
  (async () => {
3036
- let { expectedAmount, expectedPeriodHours, expectedCreatedAt } = input;
3247
+ const subscriber = input.subscriber ?? client.identity;
3248
+ let {
3249
+ expectedAmount,
3250
+ expectedCreatedAt,
3251
+ expectedPeriodHours,
3252
+ expectedSubscriptionAuthorityInitId
3253
+ } = input;
3037
3254
  if (expectedAmount === void 0 || expectedPeriodHours === void 0 || expectedCreatedAt === void 0) {
3038
- const subscriber = input.subscriber ?? client.identity;
3039
3255
  const [planPda] = await findPlanPda(
3040
3256
  { owner: input.merchant, planId: input.planId },
3041
3257
  pdaConfig(input.programAddress)
@@ -3044,47 +3260,56 @@ function subscriptionsProgram2() {
3044
3260
  expectedAmount = expectedAmount ?? plan.data.data.terms.amount;
3045
3261
  expectedPeriodHours = expectedPeriodHours ?? plan.data.data.terms.periodHours;
3046
3262
  expectedCreatedAt = expectedCreatedAt ?? plan.data.data.terms.createdAt;
3047
- return await getSubscribeOverlayInstructionAsync({
3048
- ...input,
3049
- expectedAmount,
3050
- expectedCreatedAt,
3051
- expectedPeriodHours,
3052
- payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer),
3053
- subscriber
3054
- });
3263
+ }
3264
+ if (expectedSubscriptionAuthorityInitId === void 0) {
3265
+ const [subscriptionAuthorityPda] = await findSubscriptionAuthorityPda(
3266
+ { tokenMint: input.tokenMint, user: subscriber.address },
3267
+ pdaConfig(input.programAddress)
3268
+ );
3269
+ const subscriptionAuthority = await fetchMaybeSubscriptionAuthority(
3270
+ c.rpc,
3271
+ subscriptionAuthorityPda
3272
+ );
3273
+ if (!subscriptionAuthority.exists) {
3274
+ throw new Error(
3275
+ "SubscriptionAuthority is not initialized for this subscriber and token mint."
3276
+ );
3277
+ }
3278
+ expectedSubscriptionAuthorityInitId = subscriptionAuthority.data.initId;
3055
3279
  }
3056
3280
  return await getSubscribeOverlayInstructionAsync({
3057
3281
  ...input,
3058
3282
  expectedAmount,
3059
3283
  expectedCreatedAt,
3060
3284
  expectedPeriodHours,
3285
+ expectedSubscriptionAuthorityInitId,
3061
3286
  payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer),
3062
- subscriber: input.subscriber ?? client.identity
3287
+ subscriber
3063
3288
  });
3064
3289
  })()
3065
3290
  ),
3066
- transferFixed: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3291
+ transferFixed: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3067
3292
  client,
3068
3293
  getTransferFixedOverlayInstructionAsync({
3069
3294
  ...input,
3070
3295
  delegatee: input.delegatee ?? client.identity
3071
3296
  })
3072
3297
  ),
3073
- transferRecurring: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3298
+ transferRecurring: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3074
3299
  client,
3075
3300
  getTransferRecurringOverlayInstructionAsync({
3076
3301
  ...input,
3077
3302
  delegatee: input.delegatee ?? client.identity
3078
3303
  })
3079
3304
  ),
3080
- transferSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3305
+ transferSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3081
3306
  client,
3082
3307
  getTransferSubscriptionOverlayInstructionAsync({
3083
3308
  ...input,
3084
3309
  caller: input.caller ?? client.identity
3085
3310
  })
3086
3311
  ),
3087
- updatePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(
3312
+ updatePlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
3088
3313
  client,
3089
3314
  getUpdatePlanOverlayInstruction({
3090
3315
  ...input,
@@ -3127,6 +3352,7 @@ function subscriptionsProgram2() {
3127
3352
  PLAN_SIZE,
3128
3353
  PROGRAM_ID,
3129
3354
  PlanStatus,
3355
+ RESUME_SUBSCRIPTION_DISCRIMINATOR,
3130
3356
  REVOKE_DELEGATION_DISCRIMINATOR,
3131
3357
  SUBSCRIBE_DISCRIMINATOR,
3132
3358
  SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
@@ -3344,6 +3570,13 @@ function subscriptionsProgram2() {
3344
3570
  getRecurringDelegationCodec,
3345
3571
  getRecurringDelegationDecoder,
3346
3572
  getRecurringDelegationEncoder,
3573
+ getResumeSubscriptionDiscriminatorBytes,
3574
+ getResumeSubscriptionInstruction,
3575
+ getResumeSubscriptionInstructionAsync,
3576
+ getResumeSubscriptionInstructionDataCodec,
3577
+ getResumeSubscriptionInstructionDataDecoder,
3578
+ getResumeSubscriptionInstructionDataEncoder,
3579
+ getResumeSubscriptionOverlayInstructionAsync,
3347
3580
  getRevokeDelegationDiscriminatorBytes,
3348
3581
  getRevokeDelegationInstruction,
3349
3582
  getRevokeDelegationInstructionDataCodec,
@@ -3407,6 +3640,7 @@ function subscriptionsProgram2() {
3407
3640
  parseCreateRecurringDelegationInstruction,
3408
3641
  parseDeletePlanInstruction,
3409
3642
  parseInitSubscriptionAuthorityInstruction,
3643
+ parseResumeSubscriptionInstruction,
3410
3644
  parseRevokeDelegationInstruction,
3411
3645
  parseSubscribeInstruction,
3412
3646
  parseSubscriptionsInstruction,