@solana/subscriptions 0.4.0-rc.1 → 0.4.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -862,10 +862,10 @@ import {
862
862
  assertIsInstructionWithAccounts,
863
863
  containsBytes,
864
864
  extendClient,
865
- getU8Encoder as getU8Encoder22,
865
+ getU8Encoder as getU8Encoder23,
866
866
  SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
867
867
  SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
868
- SolanaError as SolanaError17
868
+ SolanaError as SolanaError18
869
869
  } from "@solana/kit";
870
870
  import {
871
871
  addSelfFetchFunctions,
@@ -875,10 +875,12 @@ import {
875
875
  // src/generated/instructions/cancelSubscription.ts
876
876
  import {
877
877
  combineCodec as combineCodec17,
878
+ getProgramDerivedAddress as getProgramDerivedAddress7,
878
879
  getStructDecoder as getStructDecoder15,
879
880
  getStructEncoder as getStructEncoder15,
880
881
  getU8Decoder as getU8Decoder6,
881
882
  getU8Encoder as getU8Encoder6,
883
+ getUtf8Encoder as getUtf8Encoder9,
882
884
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
883
885
  SolanaError,
884
886
  transformEncoder
@@ -920,10 +922,14 @@ async function getCancelSubscriptionInstructionAsync(input, config) {
920
922
  });
921
923
  }
922
924
  if (!accounts.eventAuthority.value) {
923
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
925
+ accounts.eventAuthority.value = await getProgramDerivedAddress7({
926
+ programAddress,
927
+ seeds: [getUtf8Encoder9().encode("event_authority")]
928
+ });
924
929
  }
925
930
  if (!accounts.selfProgram.value) {
926
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
931
+ accounts.selfProgram.value = programAddress;
932
+ accounts.selfProgram.isWritable = false;
927
933
  }
928
934
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
929
935
  return Object.freeze({
@@ -948,11 +954,9 @@ function getCancelSubscriptionInstruction(input, config) {
948
954
  selfProgram: { value: input.selfProgram ?? null, isWritable: false }
949
955
  };
950
956
  const accounts = originalAccounts;
951
- if (!accounts.eventAuthority.value) {
952
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
953
- }
954
957
  if (!accounts.selfProgram.value) {
955
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
958
+ accounts.selfProgram.value = programAddress;
959
+ accounts.selfProgram.isWritable = false;
956
960
  }
957
961
  const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
958
962
  return Object.freeze({
@@ -1028,15 +1032,17 @@ function getCloseSubscriptionAuthorityInstruction(input, config) {
1028
1032
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1029
1033
  const originalAccounts = {
1030
1034
  user: { value: input.user ?? null, isWritable: true },
1031
- subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true }
1035
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
1036
+ receiver: { value: input.receiver ?? null, isWritable: true }
1032
1037
  };
1033
1038
  const accounts = originalAccounts;
1034
- const getAccountMeta = getAccountMetaFactory2(programAddress, "programId");
1039
+ const getAccountMeta = getAccountMetaFactory2(programAddress, "omitted");
1035
1040
  return Object.freeze({
1036
1041
  accounts: [
1037
1042
  getAccountMeta("user", accounts.user),
1038
- getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority)
1039
- ],
1043
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1044
+ getAccountMeta("receiver", accounts.receiver)
1045
+ ].filter((x) => x !== void 0),
1040
1046
  data: getCloseSubscriptionAuthorityInstructionDataEncoder().encode({}),
1041
1047
  programAddress
1042
1048
  });
@@ -1054,9 +1060,19 @@ function parseCloseSubscriptionAuthorityInstruction(instruction) {
1054
1060
  accountIndex += 1;
1055
1061
  return accountMeta;
1056
1062
  };
1063
+ let optionalAccountsRemaining = instruction.accounts.length - 2;
1064
+ const getNextOptionalAccount = () => {
1065
+ if (optionalAccountsRemaining === 0) return void 0;
1066
+ optionalAccountsRemaining -= 1;
1067
+ return getNextAccount();
1068
+ };
1057
1069
  return {
1058
1070
  programAddress: instruction.programAddress,
1059
- accounts: { user: getNextAccount(), subscriptionAuthority: getNextAccount() },
1071
+ accounts: {
1072
+ user: getNextAccount(),
1073
+ subscriptionAuthority: getNextAccount(),
1074
+ receiver: getNextOptionalAccount()
1075
+ },
1060
1076
  data: getCloseSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
1061
1077
  };
1062
1078
  }
@@ -1105,22 +1121,24 @@ function getCreateFixedDelegationInstruction(input, config) {
1105
1121
  subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1106
1122
  delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
1107
1123
  delegatee: { value: input.delegatee ?? null, isWritable: false },
1108
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1124
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1125
+ payer: { value: input.payer ?? null, isWritable: true }
1109
1126
  };
1110
1127
  const accounts = originalAccounts;
1111
1128
  const args = { ...input };
1112
1129
  if (!accounts.systemProgram.value) {
1113
1130
  accounts.systemProgram.value = "11111111111111111111111111111111";
1114
1131
  }
1115
- const getAccountMeta = getAccountMetaFactory3(programAddress, "programId");
1132
+ const getAccountMeta = getAccountMetaFactory3(programAddress, "omitted");
1116
1133
  return Object.freeze({
1117
1134
  accounts: [
1118
1135
  getAccountMeta("delegator", accounts.delegator),
1119
1136
  getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1120
1137
  getAccountMeta("delegationAccount", accounts.delegationAccount),
1121
1138
  getAccountMeta("delegatee", accounts.delegatee),
1122
- getAccountMeta("systemProgram", accounts.systemProgram)
1123
- ],
1139
+ getAccountMeta("systemProgram", accounts.systemProgram),
1140
+ getAccountMeta("payer", accounts.payer)
1141
+ ].filter((x) => x !== void 0),
1124
1142
  data: getCreateFixedDelegationInstructionDataEncoder().encode(args),
1125
1143
  programAddress
1126
1144
  });
@@ -1138,6 +1156,12 @@ function parseCreateFixedDelegationInstruction(instruction) {
1138
1156
  accountIndex += 1;
1139
1157
  return accountMeta;
1140
1158
  };
1159
+ let optionalAccountsRemaining = instruction.accounts.length - 5;
1160
+ const getNextOptionalAccount = () => {
1161
+ if (optionalAccountsRemaining === 0) return void 0;
1162
+ optionalAccountsRemaining -= 1;
1163
+ return getNextAccount();
1164
+ };
1141
1165
  return {
1142
1166
  programAddress: instruction.programAddress,
1143
1167
  accounts: {
@@ -1145,7 +1169,8 @@ function parseCreateFixedDelegationInstruction(instruction) {
1145
1169
  subscriptionAuthority: getNextAccount(),
1146
1170
  delegationAccount: getNextAccount(),
1147
1171
  delegatee: getNextAccount(),
1148
- systemProgram: getNextAccount()
1172
+ systemProgram: getNextAccount(),
1173
+ payer: getNextOptionalAccount()
1149
1174
  },
1150
1175
  data: getCreateFixedDelegationInstructionDataDecoder().decode(instruction.data)
1151
1176
  };
@@ -1285,22 +1310,24 @@ function getCreateRecurringDelegationInstruction(input, config) {
1285
1310
  subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1286
1311
  delegationAccount: { value: input.delegationAccount ?? null, isWritable: true },
1287
1312
  delegatee: { value: input.delegatee ?? null, isWritable: false },
1288
- systemProgram: { value: input.systemProgram ?? null, isWritable: false }
1313
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1314
+ payer: { value: input.payer ?? null, isWritable: true }
1289
1315
  };
1290
1316
  const accounts = originalAccounts;
1291
1317
  const args = { ...input };
1292
1318
  if (!accounts.systemProgram.value) {
1293
1319
  accounts.systemProgram.value = "11111111111111111111111111111111";
1294
1320
  }
1295
- const getAccountMeta = getAccountMetaFactory5(programAddress, "programId");
1321
+ const getAccountMeta = getAccountMetaFactory5(programAddress, "omitted");
1296
1322
  return Object.freeze({
1297
1323
  accounts: [
1298
1324
  getAccountMeta("delegator", accounts.delegator),
1299
1325
  getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1300
1326
  getAccountMeta("delegationAccount", accounts.delegationAccount),
1301
1327
  getAccountMeta("delegatee", accounts.delegatee),
1302
- getAccountMeta("systemProgram", accounts.systemProgram)
1303
- ],
1328
+ getAccountMeta("systemProgram", accounts.systemProgram),
1329
+ getAccountMeta("payer", accounts.payer)
1330
+ ].filter((x) => x !== void 0),
1304
1331
  data: getCreateRecurringDelegationInstructionDataEncoder().encode(
1305
1332
  args
1306
1333
  ),
@@ -1320,6 +1347,12 @@ function parseCreateRecurringDelegationInstruction(instruction) {
1320
1347
  accountIndex += 1;
1321
1348
  return accountMeta;
1322
1349
  };
1350
+ let optionalAccountsRemaining = instruction.accounts.length - 5;
1351
+ const getNextOptionalAccount = () => {
1352
+ if (optionalAccountsRemaining === 0) return void 0;
1353
+ optionalAccountsRemaining -= 1;
1354
+ return getNextAccount();
1355
+ };
1323
1356
  return {
1324
1357
  programAddress: instruction.programAddress,
1325
1358
  accounts: {
@@ -1327,7 +1360,8 @@ function parseCreateRecurringDelegationInstruction(instruction) {
1327
1360
  subscriptionAuthority: getNextAccount(),
1328
1361
  delegationAccount: getNextAccount(),
1329
1362
  delegatee: getNextAccount(),
1330
- systemProgram: getNextAccount()
1363
+ systemProgram: getNextAccount(),
1364
+ payer: getNextOptionalAccount()
1331
1365
  },
1332
1366
  data: getCreateRecurringDelegationInstructionDataDecoder().decode(instruction.data)
1333
1367
  };
@@ -1437,7 +1471,8 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
1437
1471
  tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1438
1472
  userAta: { value: input.userAta ?? null, isWritable: true },
1439
1473
  systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1440
- tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1474
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1475
+ payer: { value: input.payer ?? null, isWritable: true }
1441
1476
  };
1442
1477
  const accounts = originalAccounts;
1443
1478
  if (!accounts.subscriptionAuthority.value) {
@@ -1449,7 +1484,7 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
1449
1484
  if (!accounts.systemProgram.value) {
1450
1485
  accounts.systemProgram.value = "11111111111111111111111111111111";
1451
1486
  }
1452
- const getAccountMeta = getAccountMetaFactory7(programAddress, "programId");
1487
+ const getAccountMeta = getAccountMetaFactory7(programAddress, "omitted");
1453
1488
  return Object.freeze({
1454
1489
  accounts: [
1455
1490
  getAccountMeta("owner", accounts.owner),
@@ -1457,8 +1492,9 @@ async function getInitSubscriptionAuthorityInstructionAsync(input, config) {
1457
1492
  getAccountMeta("tokenMint", accounts.tokenMint),
1458
1493
  getAccountMeta("userAta", accounts.userAta),
1459
1494
  getAccountMeta("systemProgram", accounts.systemProgram),
1460
- getAccountMeta("tokenProgram", accounts.tokenProgram)
1461
- ],
1495
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
1496
+ getAccountMeta("payer", accounts.payer)
1497
+ ].filter((x) => x !== void 0),
1462
1498
  data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
1463
1499
  programAddress
1464
1500
  });
@@ -1471,13 +1507,14 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
1471
1507
  tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1472
1508
  userAta: { value: input.userAta ?? null, isWritable: true },
1473
1509
  systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1474
- tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1510
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1511
+ payer: { value: input.payer ?? null, isWritable: true }
1475
1512
  };
1476
1513
  const accounts = originalAccounts;
1477
1514
  if (!accounts.systemProgram.value) {
1478
1515
  accounts.systemProgram.value = "11111111111111111111111111111111";
1479
1516
  }
1480
- const getAccountMeta = getAccountMetaFactory7(programAddress, "programId");
1517
+ const getAccountMeta = getAccountMetaFactory7(programAddress, "omitted");
1481
1518
  return Object.freeze({
1482
1519
  accounts: [
1483
1520
  getAccountMeta("owner", accounts.owner),
@@ -1485,8 +1522,9 @@ function getInitSubscriptionAuthorityInstruction(input, config) {
1485
1522
  getAccountMeta("tokenMint", accounts.tokenMint),
1486
1523
  getAccountMeta("userAta", accounts.userAta),
1487
1524
  getAccountMeta("systemProgram", accounts.systemProgram),
1488
- getAccountMeta("tokenProgram", accounts.tokenProgram)
1489
- ],
1525
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
1526
+ getAccountMeta("payer", accounts.payer)
1527
+ ].filter((x) => x !== void 0),
1490
1528
  data: getInitSubscriptionAuthorityInstructionDataEncoder().encode({}),
1491
1529
  programAddress
1492
1530
  });
@@ -1504,6 +1542,12 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
1504
1542
  accountIndex += 1;
1505
1543
  return accountMeta;
1506
1544
  };
1545
+ let optionalAccountsRemaining = instruction.accounts.length - 6;
1546
+ const getNextOptionalAccount = () => {
1547
+ if (optionalAccountsRemaining === 0) return void 0;
1548
+ optionalAccountsRemaining -= 1;
1549
+ return getNextAccount();
1550
+ };
1507
1551
  return {
1508
1552
  programAddress: instruction.programAddress,
1509
1553
  accounts: {
@@ -1512,7 +1556,8 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
1512
1556
  tokenMint: getNextAccount(),
1513
1557
  userAta: getNextAccount(),
1514
1558
  systemProgram: getNextAccount(),
1515
- tokenProgram: getNextAccount()
1559
+ tokenProgram: getNextAccount(),
1560
+ payer: getNextOptionalAccount()
1516
1561
  },
1517
1562
  data: getInitSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
1518
1563
  };
@@ -1521,10 +1566,12 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
1521
1566
  // src/generated/instructions/resumeSubscription.ts
1522
1567
  import {
1523
1568
  combineCodec as combineCodec24,
1569
+ getProgramDerivedAddress as getProgramDerivedAddress8,
1524
1570
  getStructDecoder as getStructDecoder22,
1525
1571
  getStructEncoder as getStructEncoder22,
1526
1572
  getU8Decoder as getU8Decoder13,
1527
1573
  getU8Encoder as getU8Encoder13,
1574
+ getUtf8Encoder as getUtf8Encoder10,
1528
1575
  SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8,
1529
1576
  SolanaError as SolanaError8,
1530
1577
  transformEncoder as transformEncoder8
@@ -1555,6 +1602,7 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
1555
1602
  subscriber: { value: input.subscriber ?? null, isWritable: false },
1556
1603
  planPda: { value: input.planPda ?? null, isWritable: false },
1557
1604
  subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1605
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1558
1606
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1559
1607
  selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1560
1608
  };
@@ -1566,10 +1614,14 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
1566
1614
  });
1567
1615
  }
1568
1616
  if (!accounts.eventAuthority.value) {
1569
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1617
+ accounts.eventAuthority.value = await getProgramDerivedAddress8({
1618
+ programAddress,
1619
+ seeds: [getUtf8Encoder10().encode("event_authority")]
1620
+ });
1570
1621
  }
1571
1622
  if (!accounts.selfProgram.value) {
1572
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1623
+ accounts.selfProgram.value = programAddress;
1624
+ accounts.selfProgram.isWritable = false;
1573
1625
  }
1574
1626
  const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
1575
1627
  return Object.freeze({
@@ -1577,6 +1629,7 @@ async function getResumeSubscriptionInstructionAsync(input, config) {
1577
1629
  getAccountMeta("subscriber", accounts.subscriber),
1578
1630
  getAccountMeta("planPda", accounts.planPda),
1579
1631
  getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1632
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1580
1633
  getAccountMeta("eventAuthority", accounts.eventAuthority),
1581
1634
  getAccountMeta("selfProgram", accounts.selfProgram)
1582
1635
  ],
@@ -1590,15 +1643,14 @@ function getResumeSubscriptionInstruction(input, config) {
1590
1643
  subscriber: { value: input.subscriber ?? null, isWritable: false },
1591
1644
  planPda: { value: input.planPda ?? null, isWritable: false },
1592
1645
  subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
1646
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1593
1647
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1594
1648
  selfProgram: { value: input.selfProgram ?? null, isWritable: false }
1595
1649
  };
1596
1650
  const accounts = originalAccounts;
1597
- if (!accounts.eventAuthority.value) {
1598
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1599
- }
1600
1651
  if (!accounts.selfProgram.value) {
1601
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
1652
+ accounts.selfProgram.value = programAddress;
1653
+ accounts.selfProgram.isWritable = false;
1602
1654
  }
1603
1655
  const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
1604
1656
  return Object.freeze({
@@ -1606,6 +1658,7 @@ function getResumeSubscriptionInstruction(input, config) {
1606
1658
  getAccountMeta("subscriber", accounts.subscriber),
1607
1659
  getAccountMeta("planPda", accounts.planPda),
1608
1660
  getAccountMeta("subscriptionPda", accounts.subscriptionPda),
1661
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1609
1662
  getAccountMeta("eventAuthority", accounts.eventAuthority),
1610
1663
  getAccountMeta("selfProgram", accounts.selfProgram)
1611
1664
  ],
@@ -1614,10 +1667,10 @@ function getResumeSubscriptionInstruction(input, config) {
1614
1667
  });
1615
1668
  }
1616
1669
  function parseResumeSubscriptionInstruction(instruction) {
1617
- if (instruction.accounts.length < 5) {
1670
+ if (instruction.accounts.length < 6) {
1618
1671
  throw new SolanaError8(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8, {
1619
1672
  actualAccountMetas: instruction.accounts.length,
1620
- expectedAccountMetas: 5
1673
+ expectedAccountMetas: 6
1621
1674
  });
1622
1675
  }
1623
1676
  let accountIndex = 0;
@@ -1632,6 +1685,7 @@ function parseResumeSubscriptionInstruction(instruction) {
1632
1685
  subscriber: getNextAccount(),
1633
1686
  planPda: getNextAccount(),
1634
1687
  subscriptionPda: getNextAccount(),
1688
+ subscriptionAuthority: getNextAccount(),
1635
1689
  eventAuthority: getNextAccount(),
1636
1690
  selfProgram: getNextAccount()
1637
1691
  },
@@ -1713,7 +1767,7 @@ function parseRevokeAbandonedDelegationInstruction(instruction) {
1713
1767
  };
1714
1768
  }
1715
1769
 
1716
- // src/generated/instructions/revokeDelegation.ts
1770
+ // src/generated/instructions/revokeAbandonedSubscription.ts
1717
1771
  import {
1718
1772
  combineCodec as combineCodec26,
1719
1773
  getStructDecoder as getStructDecoder24,
@@ -1725,21 +1779,98 @@ import {
1725
1779
  transformEncoder as transformEncoder10
1726
1780
  } from "@solana/kit";
1727
1781
  import { getAccountMetaFactory as getAccountMetaFactory10 } from "@solana/program-client-core";
1782
+ var REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR = 16;
1783
+ function getRevokeAbandonedSubscriptionDiscriminatorBytes() {
1784
+ return getU8Encoder15().encode(REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR);
1785
+ }
1786
+ function getRevokeAbandonedSubscriptionInstructionDataEncoder() {
1787
+ return transformEncoder10(getStructEncoder24([["discriminator", getU8Encoder15()]]), (value) => ({
1788
+ ...value,
1789
+ discriminator: REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR
1790
+ }));
1791
+ }
1792
+ function getRevokeAbandonedSubscriptionInstructionDataDecoder() {
1793
+ return getStructDecoder24([["discriminator", getU8Decoder15()]]);
1794
+ }
1795
+ function getRevokeAbandonedSubscriptionInstructionDataCodec() {
1796
+ return combineCodec26(
1797
+ getRevokeAbandonedSubscriptionInstructionDataEncoder(),
1798
+ getRevokeAbandonedSubscriptionInstructionDataDecoder()
1799
+ );
1800
+ }
1801
+ function getRevokeAbandonedSubscriptionInstruction(input, config) {
1802
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1803
+ const originalAccounts = {
1804
+ payer: { value: input.payer ?? null, isWritable: true },
1805
+ subscriptionAccount: { value: input.subscriptionAccount ?? null, isWritable: true },
1806
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
1807
+ planPda: { value: input.planPda ?? null, isWritable: false }
1808
+ };
1809
+ const accounts = originalAccounts;
1810
+ const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
1811
+ return Object.freeze({
1812
+ accounts: [
1813
+ getAccountMeta("payer", accounts.payer),
1814
+ getAccountMeta("subscriptionAccount", accounts.subscriptionAccount),
1815
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1816
+ getAccountMeta("planPda", accounts.planPda)
1817
+ ],
1818
+ data: getRevokeAbandonedSubscriptionInstructionDataEncoder().encode({}),
1819
+ programAddress
1820
+ });
1821
+ }
1822
+ function parseRevokeAbandonedSubscriptionInstruction(instruction) {
1823
+ if (instruction.accounts.length < 4) {
1824
+ throw new SolanaError10(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10, {
1825
+ actualAccountMetas: instruction.accounts.length,
1826
+ expectedAccountMetas: 4
1827
+ });
1828
+ }
1829
+ let accountIndex = 0;
1830
+ const getNextAccount = () => {
1831
+ const accountMeta = instruction.accounts[accountIndex];
1832
+ accountIndex += 1;
1833
+ return accountMeta;
1834
+ };
1835
+ return {
1836
+ programAddress: instruction.programAddress,
1837
+ accounts: {
1838
+ payer: getNextAccount(),
1839
+ subscriptionAccount: getNextAccount(),
1840
+ subscriptionAuthority: getNextAccount(),
1841
+ planPda: getNextAccount()
1842
+ },
1843
+ data: getRevokeAbandonedSubscriptionInstructionDataDecoder().decode(instruction.data)
1844
+ };
1845
+ }
1846
+
1847
+ // src/generated/instructions/revokeDelegation.ts
1848
+ import {
1849
+ combineCodec as combineCodec27,
1850
+ getStructDecoder as getStructDecoder25,
1851
+ getStructEncoder as getStructEncoder25,
1852
+ getU8Decoder as getU8Decoder16,
1853
+ getU8Encoder as getU8Encoder16,
1854
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11,
1855
+ SolanaError as SolanaError11,
1856
+ transformEncoder as transformEncoder11
1857
+ } from "@solana/kit";
1858
+ import { getAccountMetaFactory as getAccountMetaFactory11 } from "@solana/program-client-core";
1728
1859
  var REVOKE_DELEGATION_DISCRIMINATOR = 3;
1729
1860
  function getRevokeDelegationDiscriminatorBytes() {
1730
- return getU8Encoder15().encode(REVOKE_DELEGATION_DISCRIMINATOR);
1861
+ return getU8Encoder16().encode(REVOKE_DELEGATION_DISCRIMINATOR);
1731
1862
  }
1732
1863
  function getRevokeDelegationInstructionDataEncoder() {
1733
- return transformEncoder10(getStructEncoder24([["discriminator", getU8Encoder15()]]), (value) => ({
1864
+ return transformEncoder11(getStructEncoder25([["discriminator", getU8Encoder16()]]), (value) => ({
1734
1865
  ...value,
1735
1866
  discriminator: REVOKE_DELEGATION_DISCRIMINATOR
1736
1867
  }));
1737
1868
  }
1738
1869
  function getRevokeDelegationInstructionDataDecoder() {
1739
- return getStructDecoder24([["discriminator", getU8Decoder15()]]);
1870
+ return getStructDecoder25([["discriminator", getU8Decoder16()]]);
1740
1871
  }
1741
1872
  function getRevokeDelegationInstructionDataCodec() {
1742
- return combineCodec26(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
1873
+ return combineCodec27(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
1743
1874
  }
1744
1875
  function getRevokeDelegationInstruction(input, config) {
1745
1876
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1748,7 +1879,7 @@ function getRevokeDelegationInstruction(input, config) {
1748
1879
  delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
1749
1880
  };
1750
1881
  const accounts = originalAccounts;
1751
- const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
1882
+ const getAccountMeta = getAccountMetaFactory11(programAddress, "programId");
1752
1883
  return Object.freeze({
1753
1884
  accounts: [
1754
1885
  getAccountMeta("authority", accounts.authority),
@@ -1760,7 +1891,7 @@ function getRevokeDelegationInstruction(input, config) {
1760
1891
  }
1761
1892
  function parseRevokeDelegationInstruction(instruction) {
1762
1893
  if (instruction.accounts.length < 2) {
1763
- throw new SolanaError10(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10, {
1894
+ throw new SolanaError11(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11, {
1764
1895
  actualAccountMetas: instruction.accounts.length,
1765
1896
  expectedAccountMetas: 2
1766
1897
  });
@@ -1780,61 +1911,99 @@ function parseRevokeDelegationInstruction(instruction) {
1780
1911
 
1781
1912
  // src/generated/instructions/revokeSubscriptionAuthority.ts
1782
1913
  import {
1783
- combineCodec as combineCodec27,
1784
- getStructDecoder as getStructDecoder25,
1785
- getStructEncoder as getStructEncoder25,
1786
- getU8Decoder as getU8Decoder16,
1787
- getU8Encoder as getU8Encoder16,
1788
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11,
1789
- SolanaError as SolanaError11,
1790
- transformEncoder as transformEncoder11
1914
+ combineCodec as combineCodec28,
1915
+ getStructDecoder as getStructDecoder26,
1916
+ getStructEncoder as getStructEncoder26,
1917
+ getU8Decoder as getU8Decoder17,
1918
+ getU8Encoder as getU8Encoder17,
1919
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12,
1920
+ SolanaError as SolanaError12,
1921
+ transformEncoder as transformEncoder12
1791
1922
  } from "@solana/kit";
1792
- import { getAccountMetaFactory as getAccountMetaFactory11 } from "@solana/program-client-core";
1923
+ import {
1924
+ getAccountMetaFactory as getAccountMetaFactory12,
1925
+ getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount4
1926
+ } from "@solana/program-client-core";
1793
1927
  var REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR = 14;
1794
1928
  function getRevokeSubscriptionAuthorityDiscriminatorBytes() {
1795
- return getU8Encoder16().encode(REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
1929
+ return getU8Encoder17().encode(REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR);
1796
1930
  }
1797
1931
  function getRevokeSubscriptionAuthorityInstructionDataEncoder() {
1798
- return transformEncoder11(getStructEncoder25([["discriminator", getU8Encoder16()]]), (value) => ({
1932
+ return transformEncoder12(getStructEncoder26([["discriminator", getU8Encoder17()]]), (value) => ({
1799
1933
  ...value,
1800
1934
  discriminator: REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR
1801
1935
  }));
1802
1936
  }
1803
1937
  function getRevokeSubscriptionAuthorityInstructionDataDecoder() {
1804
- return getStructDecoder25([["discriminator", getU8Decoder16()]]);
1938
+ return getStructDecoder26([["discriminator", getU8Decoder17()]]);
1805
1939
  }
1806
1940
  function getRevokeSubscriptionAuthorityInstructionDataCodec() {
1807
- return combineCodec27(
1941
+ return combineCodec28(
1808
1942
  getRevokeSubscriptionAuthorityInstructionDataEncoder(),
1809
1943
  getRevokeSubscriptionAuthorityInstructionDataDecoder()
1810
1944
  );
1811
1945
  }
1946
+ async function getRevokeSubscriptionAuthorityInstructionAsync(input, config) {
1947
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1948
+ const originalAccounts = {
1949
+ user: { value: input.user ?? null, isWritable: true },
1950
+ userAta: { value: input.userAta ?? null, isWritable: true },
1951
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1952
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1953
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
1954
+ receiver: { value: input.receiver ?? null, isWritable: true }
1955
+ };
1956
+ const accounts = originalAccounts;
1957
+ if (!accounts.subscriptionAuthority.value) {
1958
+ accounts.subscriptionAuthority.value = await findSubscriptionAuthorityPda({
1959
+ user: getAddressFromResolvedInstructionAccount4("user", accounts.user.value),
1960
+ tokenMint: getAddressFromResolvedInstructionAccount4("tokenMint", accounts.tokenMint.value)
1961
+ });
1962
+ }
1963
+ const getAccountMeta = getAccountMetaFactory12(programAddress, "omitted");
1964
+ return Object.freeze({
1965
+ accounts: [
1966
+ getAccountMeta("user", accounts.user),
1967
+ getAccountMeta("userAta", accounts.userAta),
1968
+ getAccountMeta("tokenMint", accounts.tokenMint),
1969
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
1970
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1971
+ getAccountMeta("receiver", accounts.receiver)
1972
+ ].filter((x) => x !== void 0),
1973
+ data: getRevokeSubscriptionAuthorityInstructionDataEncoder().encode({}),
1974
+ programAddress
1975
+ });
1976
+ }
1812
1977
  function getRevokeSubscriptionAuthorityInstruction(input, config) {
1813
1978
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
1814
1979
  const originalAccounts = {
1815
- user: { value: input.user ?? null, isWritable: false },
1980
+ user: { value: input.user ?? null, isWritable: true },
1816
1981
  userAta: { value: input.userAta ?? null, isWritable: true },
1817
1982
  tokenMint: { value: input.tokenMint ?? null, isWritable: false },
1818
- tokenProgram: { value: input.tokenProgram ?? null, isWritable: false }
1983
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
1984
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: true },
1985
+ receiver: { value: input.receiver ?? null, isWritable: true }
1819
1986
  };
1820
1987
  const accounts = originalAccounts;
1821
- const getAccountMeta = getAccountMetaFactory11(programAddress, "programId");
1988
+ const getAccountMeta = getAccountMetaFactory12(programAddress, "omitted");
1822
1989
  return Object.freeze({
1823
1990
  accounts: [
1824
1991
  getAccountMeta("user", accounts.user),
1825
1992
  getAccountMeta("userAta", accounts.userAta),
1826
1993
  getAccountMeta("tokenMint", accounts.tokenMint),
1827
- getAccountMeta("tokenProgram", accounts.tokenProgram)
1828
- ],
1994
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
1995
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
1996
+ getAccountMeta("receiver", accounts.receiver)
1997
+ ].filter((x) => x !== void 0),
1829
1998
  data: getRevokeSubscriptionAuthorityInstructionDataEncoder().encode({}),
1830
1999
  programAddress
1831
2000
  });
1832
2001
  }
1833
2002
  function parseRevokeSubscriptionAuthorityInstruction(instruction) {
1834
- if (instruction.accounts.length < 4) {
1835
- throw new SolanaError11(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11, {
2003
+ if (instruction.accounts.length < 5) {
2004
+ throw new SolanaError12(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12, {
1836
2005
  actualAccountMetas: instruction.accounts.length,
1837
- expectedAccountMetas: 4
2006
+ expectedAccountMetas: 5
1838
2007
  });
1839
2008
  }
1840
2009
  let accountIndex = 0;
@@ -1843,13 +2012,21 @@ function parseRevokeSubscriptionAuthorityInstruction(instruction) {
1843
2012
  accountIndex += 1;
1844
2013
  return accountMeta;
1845
2014
  };
2015
+ let optionalAccountsRemaining = instruction.accounts.length - 5;
2016
+ const getNextOptionalAccount = () => {
2017
+ if (optionalAccountsRemaining === 0) return void 0;
2018
+ optionalAccountsRemaining -= 1;
2019
+ return getNextAccount();
2020
+ };
1846
2021
  return {
1847
2022
  programAddress: instruction.programAddress,
1848
2023
  accounts: {
1849
2024
  user: getNextAccount(),
1850
2025
  userAta: getNextAccount(),
1851
2026
  tokenMint: getNextAccount(),
1852
- tokenProgram: getNextAccount()
2027
+ tokenProgram: getNextAccount(),
2028
+ subscriptionAuthority: getNextAccount(),
2029
+ receiver: getNextOptionalAccount()
1853
2030
  },
1854
2031
  data: getRevokeSubscriptionAuthorityInstructionDataDecoder().decode(instruction.data)
1855
2032
  };
@@ -1857,40 +2034,42 @@ function parseRevokeSubscriptionAuthorityInstruction(instruction) {
1857
2034
 
1858
2035
  // src/generated/instructions/subscribe.ts
1859
2036
  import {
1860
- combineCodec as combineCodec28,
1861
- getStructDecoder as getStructDecoder26,
1862
- getStructEncoder as getStructEncoder26,
1863
- getU8Decoder as getU8Decoder17,
1864
- getU8Encoder as getU8Encoder17,
1865
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12,
1866
- SolanaError as SolanaError12,
1867
- transformEncoder as transformEncoder12
2037
+ combineCodec as combineCodec29,
2038
+ getProgramDerivedAddress as getProgramDerivedAddress9,
2039
+ getStructDecoder as getStructDecoder27,
2040
+ getStructEncoder as getStructEncoder27,
2041
+ getU8Decoder as getU8Decoder18,
2042
+ getU8Encoder as getU8Encoder18,
2043
+ getUtf8Encoder as getUtf8Encoder11,
2044
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13,
2045
+ SolanaError as SolanaError13,
2046
+ transformEncoder as transformEncoder13
1868
2047
  } from "@solana/kit";
1869
2048
  import {
1870
- getAccountMetaFactory as getAccountMetaFactory12,
1871
- getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount4
2049
+ getAccountMetaFactory as getAccountMetaFactory13,
2050
+ getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount5
1872
2051
  } from "@solana/program-client-core";
1873
2052
  var SUBSCRIBE_DISCRIMINATOR = 11;
1874
2053
  function getSubscribeDiscriminatorBytes() {
1875
- return getU8Encoder17().encode(SUBSCRIBE_DISCRIMINATOR);
2054
+ return getU8Encoder18().encode(SUBSCRIBE_DISCRIMINATOR);
1876
2055
  }
1877
2056
  function getSubscribeInstructionDataEncoder() {
1878
- return transformEncoder12(
1879
- getStructEncoder26([
1880
- ["discriminator", getU8Encoder17()],
2057
+ return transformEncoder13(
2058
+ getStructEncoder27([
2059
+ ["discriminator", getU8Encoder18()],
1881
2060
  ["subscribeData", getSubscribeDataEncoder()]
1882
2061
  ]),
1883
2062
  (value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
1884
2063
  );
1885
2064
  }
1886
2065
  function getSubscribeInstructionDataDecoder() {
1887
- return getStructDecoder26([
1888
- ["discriminator", getU8Decoder17()],
2066
+ return getStructDecoder27([
2067
+ ["discriminator", getU8Decoder18()],
1889
2068
  ["subscribeData", getSubscribeDataDecoder()]
1890
2069
  ]);
1891
2070
  }
1892
2071
  function getSubscribeInstructionDataCodec() {
1893
- return combineCodec28(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
2072
+ return combineCodec29(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
1894
2073
  }
1895
2074
  async function getSubscribeInstructionAsync(input, config) {
1896
2075
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
@@ -1902,26 +2081,31 @@ async function getSubscribeInstructionAsync(input, config) {
1902
2081
  subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
1903
2082
  systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1904
2083
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1905
- selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2084
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false },
2085
+ payer: { value: input.payer ?? null, isWritable: true }
1906
2086
  };
1907
2087
  const accounts = originalAccounts;
1908
2088
  const args = { ...input };
1909
2089
  if (!accounts.subscriptionPda.value) {
1910
2090
  accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
1911
- planPda: getAddressFromResolvedInstructionAccount4("planPda", accounts.planPda.value),
1912
- subscriber: getAddressFromResolvedInstructionAccount4("subscriber", accounts.subscriber.value)
2091
+ planPda: getAddressFromResolvedInstructionAccount5("planPda", accounts.planPda.value),
2092
+ subscriber: getAddressFromResolvedInstructionAccount5("subscriber", accounts.subscriber.value)
1913
2093
  });
1914
2094
  }
1915
2095
  if (!accounts.systemProgram.value) {
1916
2096
  accounts.systemProgram.value = "11111111111111111111111111111111";
1917
2097
  }
1918
2098
  if (!accounts.eventAuthority.value) {
1919
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2099
+ accounts.eventAuthority.value = await getProgramDerivedAddress9({
2100
+ programAddress,
2101
+ seeds: [getUtf8Encoder11().encode("event_authority")]
2102
+ });
1920
2103
  }
1921
2104
  if (!accounts.selfProgram.value) {
1922
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2105
+ accounts.selfProgram.value = programAddress;
2106
+ accounts.selfProgram.isWritable = false;
1923
2107
  }
1924
- const getAccountMeta = getAccountMetaFactory12(programAddress, "programId");
2108
+ const getAccountMeta = getAccountMetaFactory13(programAddress, "omitted");
1925
2109
  return Object.freeze({
1926
2110
  accounts: [
1927
2111
  getAccountMeta("subscriber", accounts.subscriber),
@@ -1931,8 +2115,9 @@ async function getSubscribeInstructionAsync(input, config) {
1931
2115
  getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
1932
2116
  getAccountMeta("systemProgram", accounts.systemProgram),
1933
2117
  getAccountMeta("eventAuthority", accounts.eventAuthority),
1934
- getAccountMeta("selfProgram", accounts.selfProgram)
1935
- ],
2118
+ getAccountMeta("selfProgram", accounts.selfProgram),
2119
+ getAccountMeta("payer", accounts.payer)
2120
+ ].filter((x) => x !== void 0),
1936
2121
  data: getSubscribeInstructionDataEncoder().encode(args),
1937
2122
  programAddress
1938
2123
  });
@@ -1947,20 +2132,19 @@ function getSubscribeInstruction(input, config) {
1947
2132
  subscriptionAuthorityPda: { value: input.subscriptionAuthorityPda ?? null, isWritable: false },
1948
2133
  systemProgram: { value: input.systemProgram ?? null, isWritable: false },
1949
2134
  eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
1950
- selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2135
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false },
2136
+ payer: { value: input.payer ?? null, isWritable: true }
1951
2137
  };
1952
2138
  const accounts = originalAccounts;
1953
2139
  const args = { ...input };
1954
2140
  if (!accounts.systemProgram.value) {
1955
2141
  accounts.systemProgram.value = "11111111111111111111111111111111";
1956
2142
  }
1957
- if (!accounts.eventAuthority.value) {
1958
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
1959
- }
1960
2143
  if (!accounts.selfProgram.value) {
1961
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2144
+ accounts.selfProgram.value = programAddress;
2145
+ accounts.selfProgram.isWritable = false;
1962
2146
  }
1963
- const getAccountMeta = getAccountMetaFactory12(programAddress, "programId");
2147
+ const getAccountMeta = getAccountMetaFactory13(programAddress, "omitted");
1964
2148
  return Object.freeze({
1965
2149
  accounts: [
1966
2150
  getAccountMeta("subscriber", accounts.subscriber),
@@ -1970,15 +2154,16 @@ function getSubscribeInstruction(input, config) {
1970
2154
  getAccountMeta("subscriptionAuthorityPda", accounts.subscriptionAuthorityPda),
1971
2155
  getAccountMeta("systemProgram", accounts.systemProgram),
1972
2156
  getAccountMeta("eventAuthority", accounts.eventAuthority),
1973
- getAccountMeta("selfProgram", accounts.selfProgram)
1974
- ],
2157
+ getAccountMeta("selfProgram", accounts.selfProgram),
2158
+ getAccountMeta("payer", accounts.payer)
2159
+ ].filter((x) => x !== void 0),
1975
2160
  data: getSubscribeInstructionDataEncoder().encode(args),
1976
2161
  programAddress
1977
2162
  });
1978
2163
  }
1979
2164
  function parseSubscribeInstruction(instruction) {
1980
2165
  if (instruction.accounts.length < 8) {
1981
- throw new SolanaError12(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12, {
2166
+ throw new SolanaError13(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13, {
1982
2167
  actualAccountMetas: instruction.accounts.length,
1983
2168
  expectedAccountMetas: 8
1984
2169
  });
@@ -1989,6 +2174,12 @@ function parseSubscribeInstruction(instruction) {
1989
2174
  accountIndex += 1;
1990
2175
  return accountMeta;
1991
2176
  };
2177
+ let optionalAccountsRemaining = instruction.accounts.length - 8;
2178
+ const getNextOptionalAccount = () => {
2179
+ if (optionalAccountsRemaining === 0) return void 0;
2180
+ optionalAccountsRemaining -= 1;
2181
+ return getNextAccount();
2182
+ };
1992
2183
  return {
1993
2184
  programAddress: instruction.programAddress,
1994
2185
  accounts: {
@@ -1999,7 +2190,8 @@ function parseSubscribeInstruction(instruction) {
1999
2190
  subscriptionAuthorityPda: getNextAccount(),
2000
2191
  systemProgram: getNextAccount(),
2001
2192
  eventAuthority: getNextAccount(),
2002
- selfProgram: getNextAccount()
2193
+ selfProgram: getNextAccount(),
2194
+ payer: getNextOptionalAccount()
2003
2195
  },
2004
2196
  data: getSubscribeInstructionDataDecoder().decode(instruction.data)
2005
2197
  };
@@ -2007,39 +2199,41 @@ function parseSubscribeInstruction(instruction) {
2007
2199
 
2008
2200
  // src/generated/instructions/transferFixed.ts
2009
2201
  import {
2010
- combineCodec as combineCodec29,
2011
- getStructDecoder as getStructDecoder27,
2012
- getStructEncoder as getStructEncoder27,
2013
- getU8Decoder as getU8Decoder18,
2014
- getU8Encoder as getU8Encoder18,
2015
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13,
2016
- SolanaError as SolanaError13,
2017
- transformEncoder as transformEncoder13
2202
+ combineCodec as combineCodec30,
2203
+ getProgramDerivedAddress as getProgramDerivedAddress10,
2204
+ getStructDecoder as getStructDecoder28,
2205
+ getStructEncoder as getStructEncoder28,
2206
+ getU8Decoder as getU8Decoder19,
2207
+ getU8Encoder as getU8Encoder19,
2208
+ getUtf8Encoder as getUtf8Encoder12,
2209
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14,
2210
+ SolanaError as SolanaError14,
2211
+ transformEncoder as transformEncoder14
2018
2212
  } from "@solana/kit";
2019
- import { getAccountMetaFactory as getAccountMetaFactory13 } from "@solana/program-client-core";
2213
+ import { getAccountMetaFactory as getAccountMetaFactory14 } from "@solana/program-client-core";
2020
2214
  var TRANSFER_FIXED_DISCRIMINATOR = 4;
2021
2215
  function getTransferFixedDiscriminatorBytes() {
2022
- return getU8Encoder18().encode(TRANSFER_FIXED_DISCRIMINATOR);
2216
+ return getU8Encoder19().encode(TRANSFER_FIXED_DISCRIMINATOR);
2023
2217
  }
2024
2218
  function getTransferFixedInstructionDataEncoder() {
2025
- return transformEncoder13(
2026
- getStructEncoder27([
2027
- ["discriminator", getU8Encoder18()],
2219
+ return transformEncoder14(
2220
+ getStructEncoder28([
2221
+ ["discriminator", getU8Encoder19()],
2028
2222
  ["transferData", getTransferDataEncoder()]
2029
2223
  ]),
2030
2224
  (value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
2031
2225
  );
2032
2226
  }
2033
2227
  function getTransferFixedInstructionDataDecoder() {
2034
- return getStructDecoder27([
2035
- ["discriminator", getU8Decoder18()],
2228
+ return getStructDecoder28([
2229
+ ["discriminator", getU8Decoder19()],
2036
2230
  ["transferData", getTransferDataDecoder()]
2037
2231
  ]);
2038
2232
  }
2039
2233
  function getTransferFixedInstructionDataCodec() {
2040
- return combineCodec29(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
2234
+ return combineCodec30(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
2041
2235
  }
2042
- function getTransferFixedInstruction(input, config) {
2236
+ async function getTransferFixedInstructionAsync(input, config) {
2043
2237
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2044
2238
  const originalAccounts = {
2045
2239
  delegationPda: { value: input.delegationPda ?? null, isWritable: true },
@@ -2055,12 +2249,52 @@ function getTransferFixedInstruction(input, config) {
2055
2249
  const accounts = originalAccounts;
2056
2250
  const args = { ...input };
2057
2251
  if (!accounts.eventAuthority.value) {
2058
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2252
+ accounts.eventAuthority.value = await getProgramDerivedAddress10({
2253
+ programAddress,
2254
+ seeds: [getUtf8Encoder12().encode("event_authority")]
2255
+ });
2059
2256
  }
2060
2257
  if (!accounts.selfProgram.value) {
2061
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2258
+ accounts.selfProgram.value = programAddress;
2259
+ accounts.selfProgram.isWritable = false;
2260
+ }
2261
+ const getAccountMeta = getAccountMetaFactory14(programAddress, "programId");
2262
+ return Object.freeze({
2263
+ accounts: [
2264
+ getAccountMeta("delegationPda", accounts.delegationPda),
2265
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
2266
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
2267
+ getAccountMeta("receiverAta", accounts.receiverAta),
2268
+ getAccountMeta("tokenMint", accounts.tokenMint),
2269
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
2270
+ getAccountMeta("delegatee", accounts.delegatee),
2271
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2272
+ getAccountMeta("selfProgram", accounts.selfProgram)
2273
+ ],
2274
+ data: getTransferFixedInstructionDataEncoder().encode(args),
2275
+ programAddress
2276
+ });
2277
+ }
2278
+ function getTransferFixedInstruction(input, config) {
2279
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2280
+ const originalAccounts = {
2281
+ delegationPda: { value: input.delegationPda ?? null, isWritable: true },
2282
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
2283
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
2284
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
2285
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
2286
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
2287
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
2288
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2289
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2290
+ };
2291
+ const accounts = originalAccounts;
2292
+ const args = { ...input };
2293
+ if (!accounts.selfProgram.value) {
2294
+ accounts.selfProgram.value = programAddress;
2295
+ accounts.selfProgram.isWritable = false;
2062
2296
  }
2063
- const getAccountMeta = getAccountMetaFactory13(programAddress, "programId");
2297
+ const getAccountMeta = getAccountMetaFactory14(programAddress, "programId");
2064
2298
  return Object.freeze({
2065
2299
  accounts: [
2066
2300
  getAccountMeta("delegationPda", accounts.delegationPda),
@@ -2079,7 +2313,7 @@ function getTransferFixedInstruction(input, config) {
2079
2313
  }
2080
2314
  function parseTransferFixedInstruction(instruction) {
2081
2315
  if (instruction.accounts.length < 9) {
2082
- throw new SolanaError13(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13, {
2316
+ throw new SolanaError14(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14, {
2083
2317
  actualAccountMetas: instruction.accounts.length,
2084
2318
  expectedAccountMetas: 9
2085
2319
  });
@@ -2109,39 +2343,41 @@ function parseTransferFixedInstruction(instruction) {
2109
2343
 
2110
2344
  // src/generated/instructions/transferRecurring.ts
2111
2345
  import {
2112
- combineCodec as combineCodec30,
2113
- getStructDecoder as getStructDecoder28,
2114
- getStructEncoder as getStructEncoder28,
2115
- getU8Decoder as getU8Decoder19,
2116
- getU8Encoder as getU8Encoder19,
2117
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14,
2118
- SolanaError as SolanaError14,
2119
- transformEncoder as transformEncoder14
2346
+ combineCodec as combineCodec31,
2347
+ getProgramDerivedAddress as getProgramDerivedAddress11,
2348
+ getStructDecoder as getStructDecoder29,
2349
+ getStructEncoder as getStructEncoder29,
2350
+ getU8Decoder as getU8Decoder20,
2351
+ getU8Encoder as getU8Encoder20,
2352
+ getUtf8Encoder as getUtf8Encoder13,
2353
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15,
2354
+ SolanaError as SolanaError15,
2355
+ transformEncoder as transformEncoder15
2120
2356
  } from "@solana/kit";
2121
- import { getAccountMetaFactory as getAccountMetaFactory14 } from "@solana/program-client-core";
2357
+ import { getAccountMetaFactory as getAccountMetaFactory15 } from "@solana/program-client-core";
2122
2358
  var TRANSFER_RECURRING_DISCRIMINATOR = 5;
2123
2359
  function getTransferRecurringDiscriminatorBytes() {
2124
- return getU8Encoder19().encode(TRANSFER_RECURRING_DISCRIMINATOR);
2360
+ return getU8Encoder20().encode(TRANSFER_RECURRING_DISCRIMINATOR);
2125
2361
  }
2126
2362
  function getTransferRecurringInstructionDataEncoder() {
2127
- return transformEncoder14(
2128
- getStructEncoder28([
2129
- ["discriminator", getU8Encoder19()],
2363
+ return transformEncoder15(
2364
+ getStructEncoder29([
2365
+ ["discriminator", getU8Encoder20()],
2130
2366
  ["transferData", getTransferDataEncoder()]
2131
2367
  ]),
2132
2368
  (value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
2133
2369
  );
2134
2370
  }
2135
2371
  function getTransferRecurringInstructionDataDecoder() {
2136
- return getStructDecoder28([
2137
- ["discriminator", getU8Decoder19()],
2372
+ return getStructDecoder29([
2373
+ ["discriminator", getU8Decoder20()],
2138
2374
  ["transferData", getTransferDataDecoder()]
2139
2375
  ]);
2140
2376
  }
2141
2377
  function getTransferRecurringInstructionDataCodec() {
2142
- return combineCodec30(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
2378
+ return combineCodec31(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
2143
2379
  }
2144
- function getTransferRecurringInstruction(input, config) {
2380
+ async function getTransferRecurringInstructionAsync(input, config) {
2145
2381
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2146
2382
  const originalAccounts = {
2147
2383
  delegationPda: { value: input.delegationPda ?? null, isWritable: true },
@@ -2157,12 +2393,52 @@ function getTransferRecurringInstruction(input, config) {
2157
2393
  const accounts = originalAccounts;
2158
2394
  const args = { ...input };
2159
2395
  if (!accounts.eventAuthority.value) {
2160
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2396
+ accounts.eventAuthority.value = await getProgramDerivedAddress11({
2397
+ programAddress,
2398
+ seeds: [getUtf8Encoder13().encode("event_authority")]
2399
+ });
2161
2400
  }
2162
2401
  if (!accounts.selfProgram.value) {
2163
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2402
+ accounts.selfProgram.value = programAddress;
2403
+ accounts.selfProgram.isWritable = false;
2164
2404
  }
2165
- const getAccountMeta = getAccountMetaFactory14(programAddress, "programId");
2405
+ const getAccountMeta = getAccountMetaFactory15(programAddress, "programId");
2406
+ return Object.freeze({
2407
+ accounts: [
2408
+ getAccountMeta("delegationPda", accounts.delegationPda),
2409
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
2410
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
2411
+ getAccountMeta("receiverAta", accounts.receiverAta),
2412
+ getAccountMeta("tokenMint", accounts.tokenMint),
2413
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
2414
+ getAccountMeta("delegatee", accounts.delegatee),
2415
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2416
+ getAccountMeta("selfProgram", accounts.selfProgram)
2417
+ ],
2418
+ data: getTransferRecurringInstructionDataEncoder().encode(args),
2419
+ programAddress
2420
+ });
2421
+ }
2422
+ function getTransferRecurringInstruction(input, config) {
2423
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2424
+ const originalAccounts = {
2425
+ delegationPda: { value: input.delegationPda ?? null, isWritable: true },
2426
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
2427
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
2428
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
2429
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
2430
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
2431
+ delegatee: { value: input.delegatee ?? null, isWritable: false },
2432
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2433
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2434
+ };
2435
+ const accounts = originalAccounts;
2436
+ const args = { ...input };
2437
+ if (!accounts.selfProgram.value) {
2438
+ accounts.selfProgram.value = programAddress;
2439
+ accounts.selfProgram.isWritable = false;
2440
+ }
2441
+ const getAccountMeta = getAccountMetaFactory15(programAddress, "programId");
2166
2442
  return Object.freeze({
2167
2443
  accounts: [
2168
2444
  getAccountMeta("delegationPda", accounts.delegationPda),
@@ -2181,7 +2457,7 @@ function getTransferRecurringInstruction(input, config) {
2181
2457
  }
2182
2458
  function parseTransferRecurringInstruction(instruction) {
2183
2459
  if (instruction.accounts.length < 9) {
2184
- throw new SolanaError14(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14, {
2460
+ throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15, {
2185
2461
  actualAccountMetas: instruction.accounts.length,
2186
2462
  expectedAccountMetas: 9
2187
2463
  });
@@ -2211,42 +2487,44 @@ function parseTransferRecurringInstruction(instruction) {
2211
2487
 
2212
2488
  // src/generated/instructions/transferSubscription.ts
2213
2489
  import {
2214
- combineCodec as combineCodec31,
2215
- getStructDecoder as getStructDecoder29,
2216
- getStructEncoder as getStructEncoder29,
2217
- getU8Decoder as getU8Decoder20,
2218
- getU8Encoder as getU8Encoder20,
2219
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15,
2220
- SolanaError as SolanaError15,
2221
- transformEncoder as transformEncoder15
2490
+ combineCodec as combineCodec32,
2491
+ getProgramDerivedAddress as getProgramDerivedAddress12,
2492
+ getStructDecoder as getStructDecoder30,
2493
+ getStructEncoder as getStructEncoder30,
2494
+ getU8Decoder as getU8Decoder21,
2495
+ getU8Encoder as getU8Encoder21,
2496
+ getUtf8Encoder as getUtf8Encoder14,
2497
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16,
2498
+ SolanaError as SolanaError16,
2499
+ transformEncoder as transformEncoder16
2222
2500
  } from "@solana/kit";
2223
- import { getAccountMetaFactory as getAccountMetaFactory15 } from "@solana/program-client-core";
2501
+ import { getAccountMetaFactory as getAccountMetaFactory16 } from "@solana/program-client-core";
2224
2502
  var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
2225
2503
  function getTransferSubscriptionDiscriminatorBytes() {
2226
- return getU8Encoder20().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
2504
+ return getU8Encoder21().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
2227
2505
  }
2228
2506
  function getTransferSubscriptionInstructionDataEncoder() {
2229
- return transformEncoder15(
2230
- getStructEncoder29([
2231
- ["discriminator", getU8Encoder20()],
2507
+ return transformEncoder16(
2508
+ getStructEncoder30([
2509
+ ["discriminator", getU8Encoder21()],
2232
2510
  ["transferData", getTransferDataEncoder()]
2233
2511
  ]),
2234
2512
  (value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
2235
2513
  );
2236
2514
  }
2237
2515
  function getTransferSubscriptionInstructionDataDecoder() {
2238
- return getStructDecoder29([
2239
- ["discriminator", getU8Decoder20()],
2516
+ return getStructDecoder30([
2517
+ ["discriminator", getU8Decoder21()],
2240
2518
  ["transferData", getTransferDataDecoder()]
2241
2519
  ]);
2242
2520
  }
2243
2521
  function getTransferSubscriptionInstructionDataCodec() {
2244
- return combineCodec31(
2522
+ return combineCodec32(
2245
2523
  getTransferSubscriptionInstructionDataEncoder(),
2246
2524
  getTransferSubscriptionInstructionDataDecoder()
2247
2525
  );
2248
2526
  }
2249
- function getTransferSubscriptionInstruction(input, config) {
2527
+ async function getTransferSubscriptionInstructionAsync(input, config) {
2250
2528
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2251
2529
  const originalAccounts = {
2252
2530
  subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
@@ -2263,12 +2541,54 @@ function getTransferSubscriptionInstruction(input, config) {
2263
2541
  const accounts = originalAccounts;
2264
2542
  const args = { ...input };
2265
2543
  if (!accounts.eventAuthority.value) {
2266
- accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
2544
+ accounts.eventAuthority.value = await getProgramDerivedAddress12({
2545
+ programAddress,
2546
+ seeds: [getUtf8Encoder14().encode("event_authority")]
2547
+ });
2267
2548
  }
2268
2549
  if (!accounts.selfProgram.value) {
2269
- accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
2550
+ accounts.selfProgram.value = programAddress;
2551
+ accounts.selfProgram.isWritable = false;
2270
2552
  }
2271
- const getAccountMeta = getAccountMetaFactory15(programAddress, "programId");
2553
+ const getAccountMeta = getAccountMetaFactory16(programAddress, "programId");
2554
+ return Object.freeze({
2555
+ accounts: [
2556
+ getAccountMeta("subscriptionPda", accounts.subscriptionPda),
2557
+ getAccountMeta("planPda", accounts.planPda),
2558
+ getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
2559
+ getAccountMeta("delegatorAta", accounts.delegatorAta),
2560
+ getAccountMeta("receiverAta", accounts.receiverAta),
2561
+ getAccountMeta("caller", accounts.caller),
2562
+ getAccountMeta("tokenMint", accounts.tokenMint),
2563
+ getAccountMeta("tokenProgram", accounts.tokenProgram),
2564
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2565
+ getAccountMeta("selfProgram", accounts.selfProgram)
2566
+ ],
2567
+ data: getTransferSubscriptionInstructionDataEncoder().encode(args),
2568
+ programAddress
2569
+ });
2570
+ }
2571
+ function getTransferSubscriptionInstruction(input, config) {
2572
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2573
+ const originalAccounts = {
2574
+ subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
2575
+ planPda: { value: input.planPda ?? null, isWritable: false },
2576
+ subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
2577
+ delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
2578
+ receiverAta: { value: input.receiverAta ?? null, isWritable: true },
2579
+ caller: { value: input.caller ?? null, isWritable: false },
2580
+ tokenMint: { value: input.tokenMint ?? null, isWritable: false },
2581
+ tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
2582
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2583
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2584
+ };
2585
+ const accounts = originalAccounts;
2586
+ const args = { ...input };
2587
+ if (!accounts.selfProgram.value) {
2588
+ accounts.selfProgram.value = programAddress;
2589
+ accounts.selfProgram.isWritable = false;
2590
+ }
2591
+ const getAccountMeta = getAccountMetaFactory16(programAddress, "programId");
2272
2592
  return Object.freeze({
2273
2593
  accounts: [
2274
2594
  getAccountMeta("subscriptionPda", accounts.subscriptionPda),
@@ -2288,7 +2608,7 @@ function getTransferSubscriptionInstruction(input, config) {
2288
2608
  }
2289
2609
  function parseTransferSubscriptionInstruction(instruction) {
2290
2610
  if (instruction.accounts.length < 10) {
2291
- throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS15, {
2611
+ throw new SolanaError16(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16, {
2292
2612
  actualAccountMetas: instruction.accounts.length,
2293
2613
  expectedAccountMetas: 10
2294
2614
  });
@@ -2319,58 +2639,103 @@ function parseTransferSubscriptionInstruction(instruction) {
2319
2639
 
2320
2640
  // src/generated/instructions/updatePlan.ts
2321
2641
  import {
2322
- combineCodec as combineCodec32,
2323
- getStructDecoder as getStructDecoder30,
2324
- getStructEncoder as getStructEncoder30,
2325
- getU8Decoder as getU8Decoder21,
2326
- getU8Encoder as getU8Encoder21,
2327
- SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16,
2328
- SolanaError as SolanaError16,
2329
- transformEncoder as transformEncoder16
2642
+ combineCodec as combineCodec33,
2643
+ getProgramDerivedAddress as getProgramDerivedAddress13,
2644
+ getStructDecoder as getStructDecoder31,
2645
+ getStructEncoder as getStructEncoder31,
2646
+ getU8Decoder as getU8Decoder22,
2647
+ getU8Encoder as getU8Encoder22,
2648
+ getUtf8Encoder as getUtf8Encoder15,
2649
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS17,
2650
+ SolanaError as SolanaError17,
2651
+ transformEncoder as transformEncoder17
2330
2652
  } from "@solana/kit";
2331
- import { getAccountMetaFactory as getAccountMetaFactory16 } from "@solana/program-client-core";
2653
+ import { getAccountMetaFactory as getAccountMetaFactory17 } from "@solana/program-client-core";
2332
2654
  var UPDATE_PLAN_DISCRIMINATOR = 8;
2333
2655
  function getUpdatePlanDiscriminatorBytes() {
2334
- return getU8Encoder21().encode(UPDATE_PLAN_DISCRIMINATOR);
2656
+ return getU8Encoder22().encode(UPDATE_PLAN_DISCRIMINATOR);
2335
2657
  }
2336
2658
  function getUpdatePlanInstructionDataEncoder() {
2337
- return transformEncoder16(
2338
- getStructEncoder30([
2339
- ["discriminator", getU8Encoder21()],
2659
+ return transformEncoder17(
2660
+ getStructEncoder31([
2661
+ ["discriminator", getU8Encoder22()],
2340
2662
  ["updatePlanData", getUpdatePlanDataEncoder()]
2341
2663
  ]),
2342
2664
  (value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
2343
2665
  );
2344
2666
  }
2345
2667
  function getUpdatePlanInstructionDataDecoder() {
2346
- return getStructDecoder30([
2347
- ["discriminator", getU8Decoder21()],
2668
+ return getStructDecoder31([
2669
+ ["discriminator", getU8Decoder22()],
2348
2670
  ["updatePlanData", getUpdatePlanDataDecoder()]
2349
2671
  ]);
2350
2672
  }
2351
2673
  function getUpdatePlanInstructionDataCodec() {
2352
- return combineCodec32(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
2674
+ return combineCodec33(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
2675
+ }
2676
+ async function getUpdatePlanInstructionAsync(input, config) {
2677
+ const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2678
+ const originalAccounts = {
2679
+ owner: { value: input.owner ?? null, isWritable: false },
2680
+ planPda: { value: input.planPda ?? null, isWritable: true },
2681
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2682
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2683
+ };
2684
+ const accounts = originalAccounts;
2685
+ const args = { ...input };
2686
+ if (!accounts.eventAuthority.value) {
2687
+ accounts.eventAuthority.value = await getProgramDerivedAddress13({
2688
+ programAddress,
2689
+ seeds: [getUtf8Encoder15().encode("event_authority")]
2690
+ });
2691
+ }
2692
+ if (!accounts.selfProgram.value) {
2693
+ accounts.selfProgram.value = programAddress;
2694
+ accounts.selfProgram.isWritable = false;
2695
+ }
2696
+ const getAccountMeta = getAccountMetaFactory17(programAddress, "programId");
2697
+ return Object.freeze({
2698
+ accounts: [
2699
+ getAccountMeta("owner", accounts.owner),
2700
+ getAccountMeta("planPda", accounts.planPda),
2701
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2702
+ getAccountMeta("selfProgram", accounts.selfProgram)
2703
+ ],
2704
+ data: getUpdatePlanInstructionDataEncoder().encode(args),
2705
+ programAddress
2706
+ });
2353
2707
  }
2354
2708
  function getUpdatePlanInstruction(input, config) {
2355
2709
  const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
2356
2710
  const originalAccounts = {
2357
2711
  owner: { value: input.owner ?? null, isWritable: false },
2358
- planPda: { value: input.planPda ?? null, isWritable: true }
2712
+ planPda: { value: input.planPda ?? null, isWritable: true },
2713
+ eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
2714
+ selfProgram: { value: input.selfProgram ?? null, isWritable: false }
2359
2715
  };
2360
2716
  const accounts = originalAccounts;
2361
2717
  const args = { ...input };
2362
- const getAccountMeta = getAccountMetaFactory16(programAddress, "programId");
2718
+ if (!accounts.selfProgram.value) {
2719
+ accounts.selfProgram.value = programAddress;
2720
+ accounts.selfProgram.isWritable = false;
2721
+ }
2722
+ const getAccountMeta = getAccountMetaFactory17(programAddress, "programId");
2363
2723
  return Object.freeze({
2364
- accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
2724
+ accounts: [
2725
+ getAccountMeta("owner", accounts.owner),
2726
+ getAccountMeta("planPda", accounts.planPda),
2727
+ getAccountMeta("eventAuthority", accounts.eventAuthority),
2728
+ getAccountMeta("selfProgram", accounts.selfProgram)
2729
+ ],
2365
2730
  data: getUpdatePlanInstructionDataEncoder().encode(args),
2366
2731
  programAddress
2367
2732
  });
2368
2733
  }
2369
2734
  function parseUpdatePlanInstruction(instruction) {
2370
- if (instruction.accounts.length < 2) {
2371
- throw new SolanaError16(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS16, {
2735
+ if (instruction.accounts.length < 4) {
2736
+ throw new SolanaError17(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS17, {
2372
2737
  actualAccountMetas: instruction.accounts.length,
2373
- expectedAccountMetas: 2
2738
+ expectedAccountMetas: 4
2374
2739
  });
2375
2740
  }
2376
2741
  let accountIndex = 0;
@@ -2381,7 +2746,12 @@ function parseUpdatePlanInstruction(instruction) {
2381
2746
  };
2382
2747
  return {
2383
2748
  programAddress: instruction.programAddress,
2384
- accounts: { owner: getNextAccount(), planPda: getNextAccount() },
2749
+ accounts: {
2750
+ owner: getNextAccount(),
2751
+ planPda: getNextAccount(),
2752
+ eventAuthority: getNextAccount(),
2753
+ selfProgram: getNextAccount()
2754
+ },
2385
2755
  data: getUpdatePlanInstructionDataDecoder().decode(instruction.data)
2386
2756
  };
2387
2757
  }
@@ -2414,59 +2784,63 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
2414
2784
  SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
2415
2785
  SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeSubscriptionAuthority"] = 14] = "RevokeSubscriptionAuthority";
2416
2786
  SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedDelegation"] = 15] = "RevokeAbandonedDelegation";
2787
+ SubscriptionsInstruction2[SubscriptionsInstruction2["RevokeAbandonedSubscription"] = 16] = "RevokeAbandonedSubscription";
2417
2788
  return SubscriptionsInstruction2;
2418
2789
  })(SubscriptionsInstruction || {});
2419
2790
  function identifySubscriptionsInstruction(instruction) {
2420
2791
  const data = "data" in instruction ? instruction.data : instruction;
2421
- if (containsBytes(data, getU8Encoder22().encode(0), 0)) {
2792
+ if (containsBytes(data, getU8Encoder23().encode(0), 0)) {
2422
2793
  return 0 /* InitSubscriptionAuthority */;
2423
2794
  }
2424
- if (containsBytes(data, getU8Encoder22().encode(1), 0)) {
2795
+ if (containsBytes(data, getU8Encoder23().encode(1), 0)) {
2425
2796
  return 1 /* CreateFixedDelegation */;
2426
2797
  }
2427
- if (containsBytes(data, getU8Encoder22().encode(2), 0)) {
2798
+ if (containsBytes(data, getU8Encoder23().encode(2), 0)) {
2428
2799
  return 2 /* CreateRecurringDelegation */;
2429
2800
  }
2430
- if (containsBytes(data, getU8Encoder22().encode(3), 0)) {
2801
+ if (containsBytes(data, getU8Encoder23().encode(3), 0)) {
2431
2802
  return 3 /* RevokeDelegation */;
2432
2803
  }
2433
- if (containsBytes(data, getU8Encoder22().encode(4), 0)) {
2804
+ if (containsBytes(data, getU8Encoder23().encode(4), 0)) {
2434
2805
  return 4 /* TransferFixed */;
2435
2806
  }
2436
- if (containsBytes(data, getU8Encoder22().encode(5), 0)) {
2807
+ if (containsBytes(data, getU8Encoder23().encode(5), 0)) {
2437
2808
  return 5 /* TransferRecurring */;
2438
2809
  }
2439
- if (containsBytes(data, getU8Encoder22().encode(6), 0)) {
2810
+ if (containsBytes(data, getU8Encoder23().encode(6), 0)) {
2440
2811
  return 6 /* CloseSubscriptionAuthority */;
2441
2812
  }
2442
- if (containsBytes(data, getU8Encoder22().encode(7), 0)) {
2813
+ if (containsBytes(data, getU8Encoder23().encode(7), 0)) {
2443
2814
  return 7 /* CreatePlan */;
2444
2815
  }
2445
- if (containsBytes(data, getU8Encoder22().encode(8), 0)) {
2816
+ if (containsBytes(data, getU8Encoder23().encode(8), 0)) {
2446
2817
  return 8 /* UpdatePlan */;
2447
2818
  }
2448
- if (containsBytes(data, getU8Encoder22().encode(9), 0)) {
2819
+ if (containsBytes(data, getU8Encoder23().encode(9), 0)) {
2449
2820
  return 9 /* DeletePlan */;
2450
2821
  }
2451
- if (containsBytes(data, getU8Encoder22().encode(10), 0)) {
2822
+ if (containsBytes(data, getU8Encoder23().encode(10), 0)) {
2452
2823
  return 10 /* TransferSubscription */;
2453
2824
  }
2454
- if (containsBytes(data, getU8Encoder22().encode(11), 0)) {
2825
+ if (containsBytes(data, getU8Encoder23().encode(11), 0)) {
2455
2826
  return 11 /* Subscribe */;
2456
2827
  }
2457
- if (containsBytes(data, getU8Encoder22().encode(12), 0)) {
2828
+ if (containsBytes(data, getU8Encoder23().encode(12), 0)) {
2458
2829
  return 12 /* CancelSubscription */;
2459
2830
  }
2460
- if (containsBytes(data, getU8Encoder22().encode(13), 0)) {
2831
+ if (containsBytes(data, getU8Encoder23().encode(13), 0)) {
2461
2832
  return 13 /* ResumeSubscription */;
2462
2833
  }
2463
- if (containsBytes(data, getU8Encoder22().encode(14), 0)) {
2834
+ if (containsBytes(data, getU8Encoder23().encode(14), 0)) {
2464
2835
  return 14 /* RevokeSubscriptionAuthority */;
2465
2836
  }
2466
- if (containsBytes(data, getU8Encoder22().encode(15), 0)) {
2837
+ if (containsBytes(data, getU8Encoder23().encode(15), 0)) {
2467
2838
  return 15 /* RevokeAbandonedDelegation */;
2468
2839
  }
2469
- throw new SolanaError17(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2840
+ if (containsBytes(data, getU8Encoder23().encode(16), 0)) {
2841
+ return 16 /* RevokeAbandonedSubscription */;
2842
+ }
2843
+ throw new SolanaError18(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
2470
2844
  instructionData: data,
2471
2845
  programName: "subscriptions"
2472
2846
  });
@@ -2574,8 +2948,15 @@ function parseSubscriptionsInstruction(instruction) {
2574
2948
  ...parseRevokeAbandonedDelegationInstruction(instruction)
2575
2949
  };
2576
2950
  }
2951
+ case 16 /* RevokeAbandonedSubscription */: {
2952
+ assertIsInstructionWithAccounts(instruction);
2953
+ return {
2954
+ instructionType: 16 /* RevokeAbandonedSubscription */,
2955
+ ...parseRevokeAbandonedSubscriptionInstruction(instruction)
2956
+ };
2957
+ }
2577
2958
  default:
2578
- throw new SolanaError17(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
2959
+ throw new SolanaError18(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
2579
2960
  instructionType,
2580
2961
  programName: "subscriptions"
2581
2962
  });
@@ -2598,18 +2979,19 @@ function subscriptionsProgram() {
2598
2979
  createFixedDelegation: (input) => addSelfPlanAndSendFunctions(client, getCreateFixedDelegationInstruction(input)),
2599
2980
  createRecurringDelegation: (input) => addSelfPlanAndSendFunctions(client, getCreateRecurringDelegationInstruction(input)),
2600
2981
  revokeDelegation: (input) => addSelfPlanAndSendFunctions(client, getRevokeDelegationInstruction(input)),
2601
- transferFixed: (input) => addSelfPlanAndSendFunctions(client, getTransferFixedInstruction(input)),
2602
- transferRecurring: (input) => addSelfPlanAndSendFunctions(client, getTransferRecurringInstruction(input)),
2982
+ transferFixed: (input) => addSelfPlanAndSendFunctions(client, getTransferFixedInstructionAsync(input)),
2983
+ transferRecurring: (input) => addSelfPlanAndSendFunctions(client, getTransferRecurringInstructionAsync(input)),
2603
2984
  closeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getCloseSubscriptionAuthorityInstruction(input)),
2604
2985
  createPlan: (input) => addSelfPlanAndSendFunctions(client, getCreatePlanInstruction(input)),
2605
- updatePlan: (input) => addSelfPlanAndSendFunctions(client, getUpdatePlanInstruction(input)),
2986
+ updatePlan: (input) => addSelfPlanAndSendFunctions(client, getUpdatePlanInstructionAsync(input)),
2606
2987
  deletePlan: (input) => addSelfPlanAndSendFunctions(client, getDeletePlanInstruction(input)),
2607
- transferSubscription: (input) => addSelfPlanAndSendFunctions(client, getTransferSubscriptionInstruction(input)),
2988
+ transferSubscription: (input) => addSelfPlanAndSendFunctions(client, getTransferSubscriptionInstructionAsync(input)),
2608
2989
  subscribe: (input) => addSelfPlanAndSendFunctions(client, getSubscribeInstructionAsync(input)),
2609
2990
  cancelSubscription: (input) => addSelfPlanAndSendFunctions(client, getCancelSubscriptionInstructionAsync(input)),
2610
2991
  resumeSubscription: (input) => addSelfPlanAndSendFunctions(client, getResumeSubscriptionInstructionAsync(input)),
2611
- revokeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getRevokeSubscriptionAuthorityInstruction(input)),
2612
- revokeAbandonedDelegation: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedDelegationInstruction(input))
2992
+ revokeSubscriptionAuthority: (input) => addSelfPlanAndSendFunctions(client, getRevokeSubscriptionAuthorityInstructionAsync(input)),
2993
+ revokeAbandonedDelegation: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedDelegationInstruction(input)),
2994
+ revokeAbandonedSubscription: (input) => addSelfPlanAndSendFunctions(client, getRevokeAbandonedSubscriptionInstruction(input))
2613
2995
  },
2614
2996
  pdas: {
2615
2997
  fixedDelegation: findFixedDelegationPda,
@@ -2663,7 +3045,6 @@ var SUBSCRIPTIONS_ERROR__MIGRATION_REQUIRED = 134;
2663
3045
  var SUBSCRIPTIONS_ERROR__DELEGATION_ALREADY_EXISTS = 135;
2664
3046
  var SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY = 136;
2665
3047
  var SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS = 137;
2666
- var SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING = 138;
2667
3048
  var SUBSCRIPTIONS_ERROR__AMOUNT_EXCEEDS_LIMIT = 300;
2668
3049
  var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_EXPIRY_IN_PAST = 301;
2669
3050
  var SUBSCRIPTIONS_ERROR__FIXED_DELEGATION_AMOUNT_ZERO = 302;
@@ -2696,10 +3077,12 @@ var SUBSCRIPTIONS_ERROR__PLAN_CLOSED = 516;
2696
3077
  var SUBSCRIPTIONS_ERROR__ALREADY_SUBSCRIBED = 517;
2697
3078
  var SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS = 518;
2698
3079
  var SUBSCRIPTIONS_ERROR__PLAN_TERMS_MISMATCH = 519;
3080
+ var SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND = 520;
2699
3081
  var SUBSCRIPTIONS_ERROR__INVALID_EVENT_AUTHORITY = 600;
2700
3082
  var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DATA = 601;
2701
3083
  var SUBSCRIPTIONS_ERROR__INVALID_EVENT_TAG = 602;
2702
3084
  var SUBSCRIPTIONS_ERROR__INVALID_EVENT_DISCRIMINATOR = 603;
3085
+ var SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM = 604;
2703
3086
  var subscriptionsErrorMessages;
2704
3087
  if (process.env["NODE_ENV"] !== "production") {
2705
3088
  subscriptionsErrorMessages = {
@@ -2736,6 +3119,7 @@ if (process.env["NODE_ENV"] !== "production") {
2736
3119
  [SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH]: `Invalid Period length`,
2737
3120
  [SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA]: `Invalid Plan PDA derivation`,
2738
3121
  [SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS]: `Invalid plan status value`,
3122
+ [SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM]: `Self program account does not match this program`,
2739
3123
  [SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA]: `Invalid subscription-authority PDA derivation`,
2740
3124
  [SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA]: `Invalid subscription PDA derivation`,
2741
3125
  [SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA]: `Invalid Token-2022 mint account data`,
@@ -2759,6 +3143,7 @@ if (process.env["NODE_ENV"] !== "production") {
2759
3143
  [SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED]: `Period has not elapsed yet`,
2760
3144
  [SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS]: `Plan account already exists`,
2761
3145
  [SUBSCRIPTIONS_ERROR__PLAN_CLOSED]: `Plan account has been closed`,
3146
+ [SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND]: `A finite plan end timestamp can only be shortened, not removed or extended`,
2762
3147
  [SUBSCRIPTIONS_ERROR__PLAN_EXPIRED]: `Plan has expired`,
2763
3148
  [SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET]: `Plan cannot be updated after sunset`,
2764
3149
  [SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED]: `Plan must be expired to delete`,
@@ -2775,7 +3160,6 @@ if (process.env["NODE_ENV"] !== "production") {
2775
3160
  [SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
2776
3161
  [SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
2777
3162
  [SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS]: `Too many transfer hook accounts provided`,
2778
- [SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING]: `Transfer hook validation account missing from provided accounts`,
2779
3163
  [SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
2780
3164
  [SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION]: `Destination not in plan whitelist`
2781
3165
  };
@@ -2942,7 +3326,7 @@ import {
2942
3326
  fetchEncodedAccount as fetchEncodedAccount7,
2943
3327
  getAddressDecoder as getAddressDecoder10,
2944
3328
  getAddressEncoder as getAddressEncoder15,
2945
- getProgramDerivedAddress as getProgramDerivedAddress7
3329
+ getProgramDerivedAddress as getProgramDerivedAddress14
2946
3330
  } from "@solana/kit";
2947
3331
  import { fetchMint, TOKEN_2022_PROGRAM_ADDRESS } from "@solana-program/token-2022";
2948
3332
  var DEFAULT_ADDRESS = "11111111111111111111111111111111";
@@ -3043,7 +3427,7 @@ async function resolveMeta(meta, previous, instructionData, hookProgram, rpc) {
3043
3427
  }
3044
3428
  const programId = meta.discriminator === 1 ? hookProgram : previous[meta.discriminator - PDA_PROGRAM_INDEX_OFFSET].address;
3045
3429
  const seeds = await unpackSeeds(meta.addressConfig, previous, instructionData, rpc);
3046
- const [pda] = await getProgramDerivedAddress7({ programAddress: programId, seeds });
3430
+ const [pda] = await getProgramDerivedAddress14({ programAddress: programId, seeds });
3047
3431
  return { address: pda, role };
3048
3432
  }
3049
3433
  async function resolveTransferHookAccounts(rpc, args) {
@@ -3054,7 +3438,7 @@ async function resolveTransferHookAccounts(rpc, args) {
3054
3438
  const hook = extensions.find((extension) => extension.__kind === "TransferHook");
3055
3439
  if (!hook || hook.programId === DEFAULT_ADDRESS) return [];
3056
3440
  const hookProgram = hook.programId;
3057
- const [validationPda] = await getProgramDerivedAddress7({
3441
+ const [validationPda] = await getProgramDerivedAddress14({
3058
3442
  programAddress: hookProgram,
3059
3443
  seeds: [EXTRA_ACCOUNT_METAS_SEED, addressEncoder.encode(args.mint)]
3060
3444
  });
@@ -3118,6 +3502,10 @@ function padPlanPullers(addresses) {
3118
3502
  function pdaConfig(programAddress) {
3119
3503
  return programAddress ? { programAddress } : {};
3120
3504
  }
3505
+ async function eventAccounts(programAddress) {
3506
+ const [eventAuthority] = await findEventAuthorityPda(pdaConfig(programAddress));
3507
+ return { eventAuthority, selfProgram: programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS };
3508
+ }
3121
3509
  function withTrailing(instruction, trailing) {
3122
3510
  if (trailing.length === 0) return instruction;
3123
3511
  const accounts = [
@@ -3170,8 +3558,13 @@ async function getRevokeSubscriptionAuthorityOverlayInstructionAsync(input) {
3170
3558
  owner: input.user.address,
3171
3559
  tokenProgram: input.tokenProgram
3172
3560
  });
3173
- return getRevokeSubscriptionAuthorityInstruction(
3561
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
3562
+ { tokenMint: input.tokenMint, user: input.user.address },
3563
+ pdaConfig(input.programAddress)
3564
+ );
3565
+ let ix = getRevokeSubscriptionAuthorityInstruction(
3174
3566
  {
3567
+ subscriptionAuthority,
3175
3568
  tokenMint: input.tokenMint,
3176
3569
  tokenProgram: input.tokenProgram,
3177
3570
  user: input.user,
@@ -3179,6 +3572,10 @@ async function getRevokeSubscriptionAuthorityOverlayInstructionAsync(input) {
3179
3572
  },
3180
3573
  pdaConfig(input.programAddress)
3181
3574
  );
3575
+ if (input.receiver) {
3576
+ ix = withTrailing(ix, [{ address: input.receiver, role: AccountRole2.WRITABLE }]);
3577
+ }
3578
+ return ix;
3182
3579
  }
3183
3580
  async function getCreateFixedDelegationOverlayInstructionAsync(input) {
3184
3581
  assertPositive(input.amount, "amount");
@@ -3299,6 +3696,7 @@ async function getTransferDelegationOverlayInstructionAsync(input, getInstructio
3299
3696
  return withTrailing(
3300
3697
  getInstruction(
3301
3698
  {
3699
+ ...await eventAccounts(input.programAddress),
3302
3700
  delegatee: input.delegatee,
3303
3701
  delegationPda: input.delegationPda,
3304
3702
  delegatorAta: input.delegatorAta,
@@ -3337,6 +3735,7 @@ async function getTransferSubscriptionOverlayInstructionAsync(input) {
3337
3735
  return withTrailing(
3338
3736
  getTransferSubscriptionInstruction(
3339
3737
  {
3738
+ ...await eventAccounts(input.programAddress),
3340
3739
  caller: input.caller,
3341
3740
  delegatorAta,
3342
3741
  planPda: input.planPda,
@@ -3390,11 +3789,12 @@ async function getCreatePlanOverlayInstructionAsync(input) {
3390
3789
  pdaConfig(input.programAddress)
3391
3790
  );
3392
3791
  }
3393
- function getUpdatePlanOverlayInstruction(input) {
3792
+ async function getUpdatePlanOverlayInstruction(input) {
3394
3793
  assertMetadataUri(input.metadataUri);
3395
3794
  const pullers = padPlanPullers(input.pullers);
3396
3795
  return getUpdatePlanInstruction(
3397
3796
  {
3797
+ ...await eventAccounts(input.programAddress),
3398
3798
  owner: input.owner,
3399
3799
  planPda: input.planPda,
3400
3800
  updatePlanData: {
@@ -3428,6 +3828,7 @@ async function getSubscribeOverlayInstructionAsync(input) {
3428
3828
  return appendPayer(
3429
3829
  await getSubscribeInstructionAsync(
3430
3830
  {
3831
+ ...await eventAccounts(input.programAddress),
3431
3832
  merchant: input.merchant,
3432
3833
  planPda,
3433
3834
  subscribeData: {
@@ -3447,9 +3848,10 @@ async function getSubscribeOverlayInstructionAsync(input) {
3447
3848
  input.payer
3448
3849
  );
3449
3850
  }
3450
- function getCancelSubscriptionOverlayInstructionAsync(input) {
3451
- return getCancelSubscriptionInstructionAsync(
3851
+ async function getCancelSubscriptionOverlayInstructionAsync(input) {
3852
+ return await getCancelSubscriptionInstructionAsync(
3452
3853
  {
3854
+ ...await eventAccounts(input.programAddress),
3453
3855
  planPda: input.planPda,
3454
3856
  subscriber: input.subscriber,
3455
3857
  subscriptionPda: input.subscriptionPda
@@ -3457,11 +3859,17 @@ function getCancelSubscriptionOverlayInstructionAsync(input) {
3457
3859
  pdaConfig(input.programAddress)
3458
3860
  );
3459
3861
  }
3460
- function getResumeSubscriptionOverlayInstructionAsync(input) {
3461
- return getResumeSubscriptionInstructionAsync(
3862
+ async function getResumeSubscriptionOverlayInstructionAsync(input) {
3863
+ const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
3864
+ { tokenMint: input.tokenMint, user: input.subscriber.address },
3865
+ pdaConfig(input.programAddress)
3866
+ );
3867
+ return await getResumeSubscriptionInstructionAsync(
3462
3868
  {
3869
+ ...await eventAccounts(input.programAddress),
3463
3870
  planPda: input.planPda,
3464
3871
  subscriber: input.subscriber,
3872
+ subscriptionAuthority,
3465
3873
  subscriptionPda: input.subscriptionPda
3466
3874
  },
3467
3875
  pdaConfig(input.programAddress)
@@ -3758,6 +4166,7 @@ export {
3758
4166
  PlanStatus,
3759
4167
  RESUME_SUBSCRIPTION_DISCRIMINATOR,
3760
4168
  REVOKE_ABANDONED_DELEGATION_DISCRIMINATOR,
4169
+ REVOKE_ABANDONED_SUBSCRIPTION_DISCRIMINATOR,
3761
4170
  REVOKE_DELEGATION_DISCRIMINATOR,
3762
4171
  REVOKE_SUBSCRIPTION_AUTHORITY_DISCRIMINATOR,
3763
4172
  SUBSCRIBE_DISCRIMINATOR,
@@ -3794,6 +4203,7 @@ export {
3794
4203
  SUBSCRIPTIONS_ERROR__INVALID_PERIOD_LENGTH,
3795
4204
  SUBSCRIPTIONS_ERROR__INVALID_PLAN_PDA,
3796
4205
  SUBSCRIPTIONS_ERROR__INVALID_PLAN_STATUS,
4206
+ SUBSCRIPTIONS_ERROR__INVALID_SELF_PROGRAM,
3797
4207
  SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_AUTHORITY_PDA,
3798
4208
  SUBSCRIPTIONS_ERROR__INVALID_SUBSCRIPTION_PDA,
3799
4209
  SUBSCRIPTIONS_ERROR__INVALID_TOKEN2022_MINT_ACCOUNT_DATA,
@@ -3817,6 +4227,7 @@ export {
3817
4227
  SUBSCRIPTIONS_ERROR__PERIOD_NOT_ELAPSED,
3818
4228
  SUBSCRIPTIONS_ERROR__PLAN_ALREADY_EXISTS,
3819
4229
  SUBSCRIPTIONS_ERROR__PLAN_CLOSED,
4230
+ SUBSCRIPTIONS_ERROR__PLAN_END_TS_CANNOT_EXTEND,
3820
4231
  SUBSCRIPTIONS_ERROR__PLAN_EXPIRED,
3821
4232
  SUBSCRIPTIONS_ERROR__PLAN_IMMUTABLE_AFTER_SUNSET,
3822
4233
  SUBSCRIPTIONS_ERROR__PLAN_NOT_EXPIRED,
@@ -3833,7 +4244,6 @@ export {
3833
4244
  SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH,
3834
4245
  SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS,
3835
4246
  SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_TOO_MANY_ACCOUNTS,
3836
- SUBSCRIPTIONS_ERROR__TRANSFER_HOOK_VALIDATION_ACCOUNT_MISSING,
3837
4247
  SUBSCRIPTIONS_ERROR__UNAUTHORIZED,
3838
4248
  SUBSCRIPTIONS_ERROR__UNAUTHORIZED_DESTINATION,
3839
4249
  SUBSCRIPTIONS_PROGRAM_ADDRESS,
@@ -3991,6 +4401,11 @@ export {
3991
4401
  getRevokeAbandonedDelegationInstructionDataCodec,
3992
4402
  getRevokeAbandonedDelegationInstructionDataDecoder,
3993
4403
  getRevokeAbandonedDelegationInstructionDataEncoder,
4404
+ getRevokeAbandonedSubscriptionDiscriminatorBytes,
4405
+ getRevokeAbandonedSubscriptionInstruction,
4406
+ getRevokeAbandonedSubscriptionInstructionDataCodec,
4407
+ getRevokeAbandonedSubscriptionInstructionDataDecoder,
4408
+ getRevokeAbandonedSubscriptionInstructionDataEncoder,
3994
4409
  getRevokeDelegationDiscriminatorBytes,
3995
4410
  getRevokeDelegationInstruction,
3996
4411
  getRevokeDelegationInstructionDataCodec,
@@ -3999,6 +4414,7 @@ export {
3999
4414
  getRevokeDelegationOverlayInstruction,
4000
4415
  getRevokeSubscriptionAuthorityDiscriminatorBytes,
4001
4416
  getRevokeSubscriptionAuthorityInstruction,
4417
+ getRevokeSubscriptionAuthorityInstructionAsync,
4002
4418
  getRevokeSubscriptionAuthorityInstructionDataCodec,
4003
4419
  getRevokeSubscriptionAuthorityInstructionDataDecoder,
4004
4420
  getRevokeSubscriptionAuthorityInstructionDataEncoder,
@@ -4026,18 +4442,21 @@ export {
4026
4442
  getTransferDataEncoder,
4027
4443
  getTransferFixedDiscriminatorBytes,
4028
4444
  getTransferFixedInstruction,
4445
+ getTransferFixedInstructionAsync,
4029
4446
  getTransferFixedInstructionDataCodec,
4030
4447
  getTransferFixedInstructionDataDecoder,
4031
4448
  getTransferFixedInstructionDataEncoder,
4032
4449
  getTransferFixedOverlayInstructionAsync,
4033
4450
  getTransferRecurringDiscriminatorBytes,
4034
4451
  getTransferRecurringInstruction,
4452
+ getTransferRecurringInstructionAsync,
4035
4453
  getTransferRecurringInstructionDataCodec,
4036
4454
  getTransferRecurringInstructionDataDecoder,
4037
4455
  getTransferRecurringInstructionDataEncoder,
4038
4456
  getTransferRecurringOverlayInstructionAsync,
4039
4457
  getTransferSubscriptionDiscriminatorBytes,
4040
4458
  getTransferSubscriptionInstruction,
4459
+ getTransferSubscriptionInstructionAsync,
4041
4460
  getTransferSubscriptionInstructionDataCodec,
4042
4461
  getTransferSubscriptionInstructionDataDecoder,
4043
4462
  getTransferSubscriptionInstructionDataEncoder,
@@ -4047,6 +4466,7 @@ export {
4047
4466
  getUpdatePlanDataEncoder,
4048
4467
  getUpdatePlanDiscriminatorBytes,
4049
4468
  getUpdatePlanInstruction,
4469
+ getUpdatePlanInstructionAsync,
4050
4470
  getUpdatePlanInstructionDataCodec,
4051
4471
  getUpdatePlanInstructionDataDecoder,
4052
4472
  getUpdatePlanInstructionDataEncoder,
@@ -4062,6 +4482,7 @@ export {
4062
4482
  parseInitSubscriptionAuthorityInstruction,
4063
4483
  parseResumeSubscriptionInstruction,
4064
4484
  parseRevokeAbandonedDelegationInstruction,
4485
+ parseRevokeAbandonedSubscriptionInstruction,
4065
4486
  parseRevokeDelegationInstruction,
4066
4487
  parseRevokeSubscriptionAuthorityInstruction,
4067
4488
  parseSubscribeInstruction,