@solana/subscriptions 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.cjs +298 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +93 -48
- package/dist/index.d.ts +93 -48
- package/dist/index.js +280 -121
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
PLAN_SIZE: () => PLAN_SIZE,
|
|
43
43
|
PROGRAM_ID: () => PROGRAM_ID,
|
|
44
44
|
PlanStatus: () => PlanStatus,
|
|
45
|
+
RESUME_SUBSCRIPTION_DISCRIMINATOR: () => RESUME_SUBSCRIPTION_DISCRIMINATOR,
|
|
45
46
|
REVOKE_DELEGATION_DISCRIMINATOR: () => REVOKE_DELEGATION_DISCRIMINATOR,
|
|
46
47
|
SUBSCRIBE_DISCRIMINATOR: () => SUBSCRIBE_DISCRIMINATOR,
|
|
47
48
|
SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE: () => SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
|
|
@@ -259,6 +260,13 @@ __export(index_exports, {
|
|
|
259
260
|
getRecurringDelegationCodec: () => getRecurringDelegationCodec,
|
|
260
261
|
getRecurringDelegationDecoder: () => getRecurringDelegationDecoder,
|
|
261
262
|
getRecurringDelegationEncoder: () => getRecurringDelegationEncoder,
|
|
263
|
+
getResumeSubscriptionDiscriminatorBytes: () => getResumeSubscriptionDiscriminatorBytes,
|
|
264
|
+
getResumeSubscriptionInstruction: () => getResumeSubscriptionInstruction,
|
|
265
|
+
getResumeSubscriptionInstructionAsync: () => getResumeSubscriptionInstructionAsync,
|
|
266
|
+
getResumeSubscriptionInstructionDataCodec: () => getResumeSubscriptionInstructionDataCodec,
|
|
267
|
+
getResumeSubscriptionInstructionDataDecoder: () => getResumeSubscriptionInstructionDataDecoder,
|
|
268
|
+
getResumeSubscriptionInstructionDataEncoder: () => getResumeSubscriptionInstructionDataEncoder,
|
|
269
|
+
getResumeSubscriptionOverlayInstructionAsync: () => getResumeSubscriptionOverlayInstructionAsync,
|
|
262
270
|
getRevokeDelegationDiscriminatorBytes: () => getRevokeDelegationDiscriminatorBytes,
|
|
263
271
|
getRevokeDelegationInstruction: () => getRevokeDelegationInstruction,
|
|
264
272
|
getRevokeDelegationInstructionDataCodec: () => getRevokeDelegationInstructionDataCodec,
|
|
@@ -322,6 +330,7 @@ __export(index_exports, {
|
|
|
322
330
|
parseCreateRecurringDelegationInstruction: () => parseCreateRecurringDelegationInstruction,
|
|
323
331
|
parseDeletePlanInstruction: () => parseDeletePlanInstruction,
|
|
324
332
|
parseInitSubscriptionAuthorityInstruction: () => parseInitSubscriptionAuthorityInstruction,
|
|
333
|
+
parseResumeSubscriptionInstruction: () => parseResumeSubscriptionInstruction,
|
|
325
334
|
parseRevokeDelegationInstruction: () => parseRevokeDelegationInstruction,
|
|
326
335
|
parseSubscribeInstruction: () => parseSubscribeInstruction,
|
|
327
336
|
parseSubscriptionsInstruction: () => parseSubscriptionsInstruction,
|
|
@@ -335,7 +344,7 @@ __export(index_exports, {
|
|
|
335
344
|
module.exports = __toCommonJS(index_exports);
|
|
336
345
|
|
|
337
346
|
// src/accounts/decode.ts
|
|
338
|
-
var
|
|
347
|
+
var import_kit39 = require("@solana/kit");
|
|
339
348
|
|
|
340
349
|
// src/generated/accounts/eventAuthority.ts
|
|
341
350
|
var import_kit7 = require("@solana/kit");
|
|
@@ -986,11 +995,11 @@ async function fetchMaybeSubscriptionDelegationFromSeeds(rpc, seeds, config = {}
|
|
|
986
995
|
}
|
|
987
996
|
|
|
988
997
|
// src/generated/errors/subscriptions.ts
|
|
989
|
-
var
|
|
998
|
+
var import_kit38 = require("@solana/kit");
|
|
990
999
|
|
|
991
1000
|
// src/generated/programs/subscriptions.ts
|
|
992
|
-
var
|
|
993
|
-
var
|
|
1001
|
+
var import_kit37 = require("@solana/kit");
|
|
1002
|
+
var import_program_client_core15 = require("@solana/program-client-core");
|
|
994
1003
|
|
|
995
1004
|
// src/generated/instructions/cancelSubscription.ts
|
|
996
1005
|
var import_kit23 = require("@solana/kit");
|
|
@@ -1569,24 +1578,133 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
|
1569
1578
|
};
|
|
1570
1579
|
}
|
|
1571
1580
|
|
|
1572
|
-
// src/generated/instructions/
|
|
1581
|
+
// src/generated/instructions/resumeSubscription.ts
|
|
1573
1582
|
var import_kit30 = require("@solana/kit");
|
|
1574
1583
|
var import_program_client_core8 = require("@solana/program-client-core");
|
|
1584
|
+
var RESUME_SUBSCRIPTION_DISCRIMINATOR = 13;
|
|
1585
|
+
function getResumeSubscriptionDiscriminatorBytes() {
|
|
1586
|
+
return (0, import_kit30.getU8Encoder)().encode(RESUME_SUBSCRIPTION_DISCRIMINATOR);
|
|
1587
|
+
}
|
|
1588
|
+
function getResumeSubscriptionInstructionDataEncoder() {
|
|
1589
|
+
return (0, import_kit30.transformEncoder)((0, import_kit30.getStructEncoder)([["discriminator", (0, import_kit30.getU8Encoder)()]]), (value) => ({
|
|
1590
|
+
...value,
|
|
1591
|
+
discriminator: RESUME_SUBSCRIPTION_DISCRIMINATOR
|
|
1592
|
+
}));
|
|
1593
|
+
}
|
|
1594
|
+
function getResumeSubscriptionInstructionDataDecoder() {
|
|
1595
|
+
return (0, import_kit30.getStructDecoder)([["discriminator", (0, import_kit30.getU8Decoder)()]]);
|
|
1596
|
+
}
|
|
1597
|
+
function getResumeSubscriptionInstructionDataCodec() {
|
|
1598
|
+
return (0, import_kit30.combineCodec)(getResumeSubscriptionInstructionDataEncoder(), getResumeSubscriptionInstructionDataDecoder());
|
|
1599
|
+
}
|
|
1600
|
+
async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
1601
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1602
|
+
const originalAccounts = {
|
|
1603
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1604
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1605
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1606
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1607
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1608
|
+
};
|
|
1609
|
+
const accounts = originalAccounts;
|
|
1610
|
+
if (!accounts.subscriptionPda.value) {
|
|
1611
|
+
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1612
|
+
planPda: (0, import_program_client_core8.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
|
|
1613
|
+
subscriber: (0, import_program_client_core8.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
if (!accounts.eventAuthority.value) {
|
|
1617
|
+
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1618
|
+
}
|
|
1619
|
+
if (!accounts.selfProgram.value) {
|
|
1620
|
+
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1621
|
+
}
|
|
1622
|
+
const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
|
|
1623
|
+
return Object.freeze({
|
|
1624
|
+
accounts: [
|
|
1625
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1626
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1627
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1628
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1629
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1630
|
+
],
|
|
1631
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode({}),
|
|
1632
|
+
programAddress
|
|
1633
|
+
});
|
|
1634
|
+
}
|
|
1635
|
+
function getResumeSubscriptionInstruction(input, config) {
|
|
1636
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1637
|
+
const originalAccounts = {
|
|
1638
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1639
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1640
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1641
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1642
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1643
|
+
};
|
|
1644
|
+
const accounts = originalAccounts;
|
|
1645
|
+
if (!accounts.eventAuthority.value) {
|
|
1646
|
+
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1647
|
+
}
|
|
1648
|
+
if (!accounts.selfProgram.value) {
|
|
1649
|
+
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1650
|
+
}
|
|
1651
|
+
const getAccountMeta = (0, import_program_client_core8.getAccountMetaFactory)(programAddress, "programId");
|
|
1652
|
+
return Object.freeze({
|
|
1653
|
+
accounts: [
|
|
1654
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1655
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1656
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1657
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1658
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1659
|
+
],
|
|
1660
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode({}),
|
|
1661
|
+
programAddress
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
function parseResumeSubscriptionInstruction(instruction) {
|
|
1665
|
+
if (instruction.accounts.length < 5) {
|
|
1666
|
+
throw new import_kit30.SolanaError(import_kit30.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1667
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1668
|
+
expectedAccountMetas: 5
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1671
|
+
let accountIndex = 0;
|
|
1672
|
+
const getNextAccount = () => {
|
|
1673
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1674
|
+
accountIndex += 1;
|
|
1675
|
+
return accountMeta;
|
|
1676
|
+
};
|
|
1677
|
+
return {
|
|
1678
|
+
programAddress: instruction.programAddress,
|
|
1679
|
+
accounts: {
|
|
1680
|
+
subscriber: getNextAccount(),
|
|
1681
|
+
planPda: getNextAccount(),
|
|
1682
|
+
subscriptionPda: getNextAccount(),
|
|
1683
|
+
eventAuthority: getNextAccount(),
|
|
1684
|
+
selfProgram: getNextAccount()
|
|
1685
|
+
},
|
|
1686
|
+
data: getResumeSubscriptionInstructionDataDecoder().decode(instruction.data)
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/generated/instructions/revokeDelegation.ts
|
|
1691
|
+
var import_kit31 = require("@solana/kit");
|
|
1692
|
+
var import_program_client_core9 = require("@solana/program-client-core");
|
|
1575
1693
|
var REVOKE_DELEGATION_DISCRIMINATOR = 3;
|
|
1576
1694
|
function getRevokeDelegationDiscriminatorBytes() {
|
|
1577
|
-
return (0,
|
|
1695
|
+
return (0, import_kit31.getU8Encoder)().encode(REVOKE_DELEGATION_DISCRIMINATOR);
|
|
1578
1696
|
}
|
|
1579
1697
|
function getRevokeDelegationInstructionDataEncoder() {
|
|
1580
|
-
return (0,
|
|
1698
|
+
return (0, import_kit31.transformEncoder)((0, import_kit31.getStructEncoder)([["discriminator", (0, import_kit31.getU8Encoder)()]]), (value) => ({
|
|
1581
1699
|
...value,
|
|
1582
1700
|
discriminator: REVOKE_DELEGATION_DISCRIMINATOR
|
|
1583
1701
|
}));
|
|
1584
1702
|
}
|
|
1585
1703
|
function getRevokeDelegationInstructionDataDecoder() {
|
|
1586
|
-
return (0,
|
|
1704
|
+
return (0, import_kit31.getStructDecoder)([["discriminator", (0, import_kit31.getU8Decoder)()]]);
|
|
1587
1705
|
}
|
|
1588
1706
|
function getRevokeDelegationInstructionDataCodec() {
|
|
1589
|
-
return (0,
|
|
1707
|
+
return (0, import_kit31.combineCodec)(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
|
|
1590
1708
|
}
|
|
1591
1709
|
function getRevokeDelegationInstruction(input, config) {
|
|
1592
1710
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1595,7 +1713,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1595
1713
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
|
|
1596
1714
|
};
|
|
1597
1715
|
const accounts = originalAccounts;
|
|
1598
|
-
const getAccountMeta = (0,
|
|
1716
|
+
const getAccountMeta = (0, import_program_client_core9.getAccountMetaFactory)(programAddress, "programId");
|
|
1599
1717
|
return Object.freeze({
|
|
1600
1718
|
accounts: [
|
|
1601
1719
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -1607,7 +1725,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1607
1725
|
}
|
|
1608
1726
|
function parseRevokeDelegationInstruction(instruction) {
|
|
1609
1727
|
if (instruction.accounts.length < 2) {
|
|
1610
|
-
throw new
|
|
1728
|
+
throw new import_kit31.SolanaError(import_kit31.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1611
1729
|
actualAccountMetas: instruction.accounts.length,
|
|
1612
1730
|
expectedAccountMetas: 2
|
|
1613
1731
|
});
|
|
@@ -1626,29 +1744,29 @@ function parseRevokeDelegationInstruction(instruction) {
|
|
|
1626
1744
|
}
|
|
1627
1745
|
|
|
1628
1746
|
// src/generated/instructions/subscribe.ts
|
|
1629
|
-
var
|
|
1630
|
-
var
|
|
1747
|
+
var import_kit32 = require("@solana/kit");
|
|
1748
|
+
var import_program_client_core10 = require("@solana/program-client-core");
|
|
1631
1749
|
var SUBSCRIBE_DISCRIMINATOR = 11;
|
|
1632
1750
|
function getSubscribeDiscriminatorBytes() {
|
|
1633
|
-
return (0,
|
|
1751
|
+
return (0, import_kit32.getU8Encoder)().encode(SUBSCRIBE_DISCRIMINATOR);
|
|
1634
1752
|
}
|
|
1635
1753
|
function getSubscribeInstructionDataEncoder() {
|
|
1636
|
-
return (0,
|
|
1637
|
-
(0,
|
|
1638
|
-
["discriminator", (0,
|
|
1754
|
+
return (0, import_kit32.transformEncoder)(
|
|
1755
|
+
(0, import_kit32.getStructEncoder)([
|
|
1756
|
+
["discriminator", (0, import_kit32.getU8Encoder)()],
|
|
1639
1757
|
["subscribeData", getSubscribeDataEncoder()]
|
|
1640
1758
|
]),
|
|
1641
1759
|
(value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
|
|
1642
1760
|
);
|
|
1643
1761
|
}
|
|
1644
1762
|
function getSubscribeInstructionDataDecoder() {
|
|
1645
|
-
return (0,
|
|
1646
|
-
["discriminator", (0,
|
|
1763
|
+
return (0, import_kit32.getStructDecoder)([
|
|
1764
|
+
["discriminator", (0, import_kit32.getU8Decoder)()],
|
|
1647
1765
|
["subscribeData", getSubscribeDataDecoder()]
|
|
1648
1766
|
]);
|
|
1649
1767
|
}
|
|
1650
1768
|
function getSubscribeInstructionDataCodec() {
|
|
1651
|
-
return (0,
|
|
1769
|
+
return (0, import_kit32.combineCodec)(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
|
|
1652
1770
|
}
|
|
1653
1771
|
async function getSubscribeInstructionAsync(input, config) {
|
|
1654
1772
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1666,8 +1784,8 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1666
1784
|
const args = { ...input };
|
|
1667
1785
|
if (!accounts.subscriptionPda.value) {
|
|
1668
1786
|
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1669
|
-
planPda: (0,
|
|
1670
|
-
subscriber: (0,
|
|
1787
|
+
planPda: (0, import_program_client_core10.getAddressFromResolvedInstructionAccount)("planPda", accounts.planPda.value),
|
|
1788
|
+
subscriber: (0, import_program_client_core10.getAddressFromResolvedInstructionAccount)("subscriber", accounts.subscriber.value)
|
|
1671
1789
|
});
|
|
1672
1790
|
}
|
|
1673
1791
|
if (!accounts.systemProgram.value) {
|
|
@@ -1679,7 +1797,7 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1679
1797
|
if (!accounts.selfProgram.value) {
|
|
1680
1798
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1681
1799
|
}
|
|
1682
|
-
const getAccountMeta = (0,
|
|
1800
|
+
const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
|
|
1683
1801
|
return Object.freeze({
|
|
1684
1802
|
accounts: [
|
|
1685
1803
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1718,7 +1836,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
1718
1836
|
if (!accounts.selfProgram.value) {
|
|
1719
1837
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1720
1838
|
}
|
|
1721
|
-
const getAccountMeta = (0,
|
|
1839
|
+
const getAccountMeta = (0, import_program_client_core10.getAccountMetaFactory)(programAddress, "programId");
|
|
1722
1840
|
return Object.freeze({
|
|
1723
1841
|
accounts: [
|
|
1724
1842
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1736,7 +1854,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
1736
1854
|
}
|
|
1737
1855
|
function parseSubscribeInstruction(instruction) {
|
|
1738
1856
|
if (instruction.accounts.length < 8) {
|
|
1739
|
-
throw new
|
|
1857
|
+
throw new import_kit32.SolanaError(import_kit32.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1740
1858
|
actualAccountMetas: instruction.accounts.length,
|
|
1741
1859
|
expectedAccountMetas: 8
|
|
1742
1860
|
});
|
|
@@ -1764,29 +1882,29 @@ function parseSubscribeInstruction(instruction) {
|
|
|
1764
1882
|
}
|
|
1765
1883
|
|
|
1766
1884
|
// src/generated/instructions/transferFixed.ts
|
|
1767
|
-
var
|
|
1768
|
-
var
|
|
1885
|
+
var import_kit33 = require("@solana/kit");
|
|
1886
|
+
var import_program_client_core11 = require("@solana/program-client-core");
|
|
1769
1887
|
var TRANSFER_FIXED_DISCRIMINATOR = 4;
|
|
1770
1888
|
function getTransferFixedDiscriminatorBytes() {
|
|
1771
|
-
return (0,
|
|
1889
|
+
return (0, import_kit33.getU8Encoder)().encode(TRANSFER_FIXED_DISCRIMINATOR);
|
|
1772
1890
|
}
|
|
1773
1891
|
function getTransferFixedInstructionDataEncoder() {
|
|
1774
|
-
return (0,
|
|
1775
|
-
(0,
|
|
1776
|
-
["discriminator", (0,
|
|
1892
|
+
return (0, import_kit33.transformEncoder)(
|
|
1893
|
+
(0, import_kit33.getStructEncoder)([
|
|
1894
|
+
["discriminator", (0, import_kit33.getU8Encoder)()],
|
|
1777
1895
|
["transferData", getTransferDataEncoder()]
|
|
1778
1896
|
]),
|
|
1779
1897
|
(value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
|
|
1780
1898
|
);
|
|
1781
1899
|
}
|
|
1782
1900
|
function getTransferFixedInstructionDataDecoder() {
|
|
1783
|
-
return (0,
|
|
1784
|
-
["discriminator", (0,
|
|
1901
|
+
return (0, import_kit33.getStructDecoder)([
|
|
1902
|
+
["discriminator", (0, import_kit33.getU8Decoder)()],
|
|
1785
1903
|
["transferData", getTransferDataDecoder()]
|
|
1786
1904
|
]);
|
|
1787
1905
|
}
|
|
1788
1906
|
function getTransferFixedInstructionDataCodec() {
|
|
1789
|
-
return (0,
|
|
1907
|
+
return (0, import_kit33.combineCodec)(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
|
|
1790
1908
|
}
|
|
1791
1909
|
function getTransferFixedInstruction(input, config) {
|
|
1792
1910
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1808,7 +1926,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
1808
1926
|
if (!accounts.selfProgram.value) {
|
|
1809
1927
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1810
1928
|
}
|
|
1811
|
-
const getAccountMeta = (0,
|
|
1929
|
+
const getAccountMeta = (0, import_program_client_core11.getAccountMetaFactory)(programAddress, "programId");
|
|
1812
1930
|
return Object.freeze({
|
|
1813
1931
|
accounts: [
|
|
1814
1932
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -1826,7 +1944,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
1826
1944
|
}
|
|
1827
1945
|
function parseTransferFixedInstruction(instruction) {
|
|
1828
1946
|
if (instruction.accounts.length < 8) {
|
|
1829
|
-
throw new
|
|
1947
|
+
throw new import_kit33.SolanaError(import_kit33.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1830
1948
|
actualAccountMetas: instruction.accounts.length,
|
|
1831
1949
|
expectedAccountMetas: 8
|
|
1832
1950
|
});
|
|
@@ -1854,29 +1972,29 @@ function parseTransferFixedInstruction(instruction) {
|
|
|
1854
1972
|
}
|
|
1855
1973
|
|
|
1856
1974
|
// src/generated/instructions/transferRecurring.ts
|
|
1857
|
-
var
|
|
1858
|
-
var
|
|
1975
|
+
var import_kit34 = require("@solana/kit");
|
|
1976
|
+
var import_program_client_core12 = require("@solana/program-client-core");
|
|
1859
1977
|
var TRANSFER_RECURRING_DISCRIMINATOR = 5;
|
|
1860
1978
|
function getTransferRecurringDiscriminatorBytes() {
|
|
1861
|
-
return (0,
|
|
1979
|
+
return (0, import_kit34.getU8Encoder)().encode(TRANSFER_RECURRING_DISCRIMINATOR);
|
|
1862
1980
|
}
|
|
1863
1981
|
function getTransferRecurringInstructionDataEncoder() {
|
|
1864
|
-
return (0,
|
|
1865
|
-
(0,
|
|
1866
|
-
["discriminator", (0,
|
|
1982
|
+
return (0, import_kit34.transformEncoder)(
|
|
1983
|
+
(0, import_kit34.getStructEncoder)([
|
|
1984
|
+
["discriminator", (0, import_kit34.getU8Encoder)()],
|
|
1867
1985
|
["transferData", getTransferDataEncoder()]
|
|
1868
1986
|
]),
|
|
1869
1987
|
(value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
|
|
1870
1988
|
);
|
|
1871
1989
|
}
|
|
1872
1990
|
function getTransferRecurringInstructionDataDecoder() {
|
|
1873
|
-
return (0,
|
|
1874
|
-
["discriminator", (0,
|
|
1991
|
+
return (0, import_kit34.getStructDecoder)([
|
|
1992
|
+
["discriminator", (0, import_kit34.getU8Decoder)()],
|
|
1875
1993
|
["transferData", getTransferDataDecoder()]
|
|
1876
1994
|
]);
|
|
1877
1995
|
}
|
|
1878
1996
|
function getTransferRecurringInstructionDataCodec() {
|
|
1879
|
-
return (0,
|
|
1997
|
+
return (0, import_kit34.combineCodec)(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
|
|
1880
1998
|
}
|
|
1881
1999
|
function getTransferRecurringInstruction(input, config) {
|
|
1882
2000
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1898,7 +2016,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
1898
2016
|
if (!accounts.selfProgram.value) {
|
|
1899
2017
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1900
2018
|
}
|
|
1901
|
-
const getAccountMeta = (0,
|
|
2019
|
+
const getAccountMeta = (0, import_program_client_core12.getAccountMetaFactory)(programAddress, "programId");
|
|
1902
2020
|
return Object.freeze({
|
|
1903
2021
|
accounts: [
|
|
1904
2022
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
@@ -1916,7 +2034,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
1916
2034
|
}
|
|
1917
2035
|
function parseTransferRecurringInstruction(instruction) {
|
|
1918
2036
|
if (instruction.accounts.length < 8) {
|
|
1919
|
-
throw new
|
|
2037
|
+
throw new import_kit34.SolanaError(import_kit34.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
1920
2038
|
actualAccountMetas: instruction.accounts.length,
|
|
1921
2039
|
expectedAccountMetas: 8
|
|
1922
2040
|
});
|
|
@@ -1944,29 +2062,29 @@ function parseTransferRecurringInstruction(instruction) {
|
|
|
1944
2062
|
}
|
|
1945
2063
|
|
|
1946
2064
|
// src/generated/instructions/transferSubscription.ts
|
|
1947
|
-
var
|
|
1948
|
-
var
|
|
2065
|
+
var import_kit35 = require("@solana/kit");
|
|
2066
|
+
var import_program_client_core13 = require("@solana/program-client-core");
|
|
1949
2067
|
var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
|
|
1950
2068
|
function getTransferSubscriptionDiscriminatorBytes() {
|
|
1951
|
-
return (0,
|
|
2069
|
+
return (0, import_kit35.getU8Encoder)().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
|
|
1952
2070
|
}
|
|
1953
2071
|
function getTransferSubscriptionInstructionDataEncoder() {
|
|
1954
|
-
return (0,
|
|
1955
|
-
(0,
|
|
1956
|
-
["discriminator", (0,
|
|
2072
|
+
return (0, import_kit35.transformEncoder)(
|
|
2073
|
+
(0, import_kit35.getStructEncoder)([
|
|
2074
|
+
["discriminator", (0, import_kit35.getU8Encoder)()],
|
|
1957
2075
|
["transferData", getTransferDataEncoder()]
|
|
1958
2076
|
]),
|
|
1959
2077
|
(value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
|
|
1960
2078
|
);
|
|
1961
2079
|
}
|
|
1962
2080
|
function getTransferSubscriptionInstructionDataDecoder() {
|
|
1963
|
-
return (0,
|
|
1964
|
-
["discriminator", (0,
|
|
2081
|
+
return (0, import_kit35.getStructDecoder)([
|
|
2082
|
+
["discriminator", (0, import_kit35.getU8Decoder)()],
|
|
1965
2083
|
["transferData", getTransferDataDecoder()]
|
|
1966
2084
|
]);
|
|
1967
2085
|
}
|
|
1968
2086
|
function getTransferSubscriptionInstructionDataCodec() {
|
|
1969
|
-
return (0,
|
|
2087
|
+
return (0, import_kit35.combineCodec)(
|
|
1970
2088
|
getTransferSubscriptionInstructionDataEncoder(),
|
|
1971
2089
|
getTransferSubscriptionInstructionDataDecoder()
|
|
1972
2090
|
);
|
|
@@ -1992,7 +2110,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
1992
2110
|
if (!accounts.selfProgram.value) {
|
|
1993
2111
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1994
2112
|
}
|
|
1995
|
-
const getAccountMeta = (0,
|
|
2113
|
+
const getAccountMeta = (0, import_program_client_core13.getAccountMetaFactory)(programAddress, "programId");
|
|
1996
2114
|
return Object.freeze({
|
|
1997
2115
|
accounts: [
|
|
1998
2116
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
@@ -2011,7 +2129,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2011
2129
|
}
|
|
2012
2130
|
function parseTransferSubscriptionInstruction(instruction) {
|
|
2013
2131
|
if (instruction.accounts.length < 9) {
|
|
2014
|
-
throw new
|
|
2132
|
+
throw new import_kit35.SolanaError(import_kit35.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2015
2133
|
actualAccountMetas: instruction.accounts.length,
|
|
2016
2134
|
expectedAccountMetas: 9
|
|
2017
2135
|
});
|
|
@@ -2040,29 +2158,29 @@ function parseTransferSubscriptionInstruction(instruction) {
|
|
|
2040
2158
|
}
|
|
2041
2159
|
|
|
2042
2160
|
// src/generated/instructions/updatePlan.ts
|
|
2043
|
-
var
|
|
2044
|
-
var
|
|
2161
|
+
var import_kit36 = require("@solana/kit");
|
|
2162
|
+
var import_program_client_core14 = require("@solana/program-client-core");
|
|
2045
2163
|
var UPDATE_PLAN_DISCRIMINATOR = 8;
|
|
2046
2164
|
function getUpdatePlanDiscriminatorBytes() {
|
|
2047
|
-
return (0,
|
|
2165
|
+
return (0, import_kit36.getU8Encoder)().encode(UPDATE_PLAN_DISCRIMINATOR);
|
|
2048
2166
|
}
|
|
2049
2167
|
function getUpdatePlanInstructionDataEncoder() {
|
|
2050
|
-
return (0,
|
|
2051
|
-
(0,
|
|
2052
|
-
["discriminator", (0,
|
|
2168
|
+
return (0, import_kit36.transformEncoder)(
|
|
2169
|
+
(0, import_kit36.getStructEncoder)([
|
|
2170
|
+
["discriminator", (0, import_kit36.getU8Encoder)()],
|
|
2053
2171
|
["updatePlanData", getUpdatePlanDataEncoder()]
|
|
2054
2172
|
]),
|
|
2055
2173
|
(value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
|
|
2056
2174
|
);
|
|
2057
2175
|
}
|
|
2058
2176
|
function getUpdatePlanInstructionDataDecoder() {
|
|
2059
|
-
return (0,
|
|
2060
|
-
["discriminator", (0,
|
|
2177
|
+
return (0, import_kit36.getStructDecoder)([
|
|
2178
|
+
["discriminator", (0, import_kit36.getU8Decoder)()],
|
|
2061
2179
|
["updatePlanData", getUpdatePlanDataDecoder()]
|
|
2062
2180
|
]);
|
|
2063
2181
|
}
|
|
2064
2182
|
function getUpdatePlanInstructionDataCodec() {
|
|
2065
|
-
return (0,
|
|
2183
|
+
return (0, import_kit36.combineCodec)(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
|
|
2066
2184
|
}
|
|
2067
2185
|
function getUpdatePlanInstruction(input, config) {
|
|
2068
2186
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2072,7 +2190,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2072
2190
|
};
|
|
2073
2191
|
const accounts = originalAccounts;
|
|
2074
2192
|
const args = { ...input };
|
|
2075
|
-
const getAccountMeta = (0,
|
|
2193
|
+
const getAccountMeta = (0, import_program_client_core14.getAccountMetaFactory)(programAddress, "programId");
|
|
2076
2194
|
return Object.freeze({
|
|
2077
2195
|
accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
|
|
2078
2196
|
data: getUpdatePlanInstructionDataEncoder().encode(args),
|
|
@@ -2081,7 +2199,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2081
2199
|
}
|
|
2082
2200
|
function parseUpdatePlanInstruction(instruction) {
|
|
2083
2201
|
if (instruction.accounts.length < 2) {
|
|
2084
|
-
throw new
|
|
2202
|
+
throw new import_kit36.SolanaError(import_kit36.SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, {
|
|
2085
2203
|
actualAccountMetas: instruction.accounts.length,
|
|
2086
2204
|
expectedAccountMetas: 2
|
|
2087
2205
|
});
|
|
@@ -2124,50 +2242,54 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
|
|
|
2124
2242
|
SubscriptionsInstruction2[SubscriptionsInstruction2["TransferSubscription"] = 10] = "TransferSubscription";
|
|
2125
2243
|
SubscriptionsInstruction2[SubscriptionsInstruction2["Subscribe"] = 11] = "Subscribe";
|
|
2126
2244
|
SubscriptionsInstruction2[SubscriptionsInstruction2["CancelSubscription"] = 12] = "CancelSubscription";
|
|
2245
|
+
SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
|
|
2127
2246
|
return SubscriptionsInstruction2;
|
|
2128
2247
|
})(SubscriptionsInstruction || {});
|
|
2129
2248
|
function identifySubscriptionsInstruction(instruction) {
|
|
2130
2249
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
2131
|
-
if ((0,
|
|
2250
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(0), 0)) {
|
|
2132
2251
|
return 0 /* InitSubscriptionAuthority */;
|
|
2133
2252
|
}
|
|
2134
|
-
if ((0,
|
|
2253
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(1), 0)) {
|
|
2135
2254
|
return 1 /* CreateFixedDelegation */;
|
|
2136
2255
|
}
|
|
2137
|
-
if ((0,
|
|
2256
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(2), 0)) {
|
|
2138
2257
|
return 2 /* CreateRecurringDelegation */;
|
|
2139
2258
|
}
|
|
2140
|
-
if ((0,
|
|
2259
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(3), 0)) {
|
|
2141
2260
|
return 3 /* RevokeDelegation */;
|
|
2142
2261
|
}
|
|
2143
|
-
if ((0,
|
|
2262
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(4), 0)) {
|
|
2144
2263
|
return 4 /* TransferFixed */;
|
|
2145
2264
|
}
|
|
2146
|
-
if ((0,
|
|
2265
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(5), 0)) {
|
|
2147
2266
|
return 5 /* TransferRecurring */;
|
|
2148
2267
|
}
|
|
2149
|
-
if ((0,
|
|
2268
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(6), 0)) {
|
|
2150
2269
|
return 6 /* CloseSubscriptionAuthority */;
|
|
2151
2270
|
}
|
|
2152
|
-
if ((0,
|
|
2271
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(7), 0)) {
|
|
2153
2272
|
return 7 /* CreatePlan */;
|
|
2154
2273
|
}
|
|
2155
|
-
if ((0,
|
|
2274
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(8), 0)) {
|
|
2156
2275
|
return 8 /* UpdatePlan */;
|
|
2157
2276
|
}
|
|
2158
|
-
if ((0,
|
|
2277
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(9), 0)) {
|
|
2159
2278
|
return 9 /* DeletePlan */;
|
|
2160
2279
|
}
|
|
2161
|
-
if ((0,
|
|
2280
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(10), 0)) {
|
|
2162
2281
|
return 10 /* TransferSubscription */;
|
|
2163
2282
|
}
|
|
2164
|
-
if ((0,
|
|
2283
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(11), 0)) {
|
|
2165
2284
|
return 11 /* Subscribe */;
|
|
2166
2285
|
}
|
|
2167
|
-
if ((0,
|
|
2286
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(12), 0)) {
|
|
2168
2287
|
return 12 /* CancelSubscription */;
|
|
2169
2288
|
}
|
|
2170
|
-
|
|
2289
|
+
if ((0, import_kit37.containsBytes)(data, (0, import_kit37.getU8Encoder)().encode(13), 0)) {
|
|
2290
|
+
return 13 /* ResumeSubscription */;
|
|
2291
|
+
}
|
|
2292
|
+
throw new import_kit37.SolanaError(import_kit37.SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
2171
2293
|
instructionData: data,
|
|
2172
2294
|
programName: "subscriptions"
|
|
2173
2295
|
});
|
|
@@ -2176,86 +2298,93 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2176
2298
|
const instructionType = identifySubscriptionsInstruction(instruction);
|
|
2177
2299
|
switch (instructionType) {
|
|
2178
2300
|
case 0 /* InitSubscriptionAuthority */: {
|
|
2179
|
-
(0,
|
|
2301
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2180
2302
|
return {
|
|
2181
2303
|
instructionType: 0 /* InitSubscriptionAuthority */,
|
|
2182
2304
|
...parseInitSubscriptionAuthorityInstruction(instruction)
|
|
2183
2305
|
};
|
|
2184
2306
|
}
|
|
2185
2307
|
case 1 /* CreateFixedDelegation */: {
|
|
2186
|
-
(0,
|
|
2308
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2187
2309
|
return {
|
|
2188
2310
|
instructionType: 1 /* CreateFixedDelegation */,
|
|
2189
2311
|
...parseCreateFixedDelegationInstruction(instruction)
|
|
2190
2312
|
};
|
|
2191
2313
|
}
|
|
2192
2314
|
case 2 /* CreateRecurringDelegation */: {
|
|
2193
|
-
(0,
|
|
2315
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2194
2316
|
return {
|
|
2195
2317
|
instructionType: 2 /* CreateRecurringDelegation */,
|
|
2196
2318
|
...parseCreateRecurringDelegationInstruction(instruction)
|
|
2197
2319
|
};
|
|
2198
2320
|
}
|
|
2199
2321
|
case 3 /* RevokeDelegation */: {
|
|
2200
|
-
(0,
|
|
2322
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2201
2323
|
return {
|
|
2202
2324
|
instructionType: 3 /* RevokeDelegation */,
|
|
2203
2325
|
...parseRevokeDelegationInstruction(instruction)
|
|
2204
2326
|
};
|
|
2205
2327
|
}
|
|
2206
2328
|
case 4 /* TransferFixed */: {
|
|
2207
|
-
(0,
|
|
2329
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2208
2330
|
return {
|
|
2209
2331
|
instructionType: 4 /* TransferFixed */,
|
|
2210
2332
|
...parseTransferFixedInstruction(instruction)
|
|
2211
2333
|
};
|
|
2212
2334
|
}
|
|
2213
2335
|
case 5 /* TransferRecurring */: {
|
|
2214
|
-
(0,
|
|
2336
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2215
2337
|
return {
|
|
2216
2338
|
instructionType: 5 /* TransferRecurring */,
|
|
2217
2339
|
...parseTransferRecurringInstruction(instruction)
|
|
2218
2340
|
};
|
|
2219
2341
|
}
|
|
2220
2342
|
case 6 /* CloseSubscriptionAuthority */: {
|
|
2221
|
-
(0,
|
|
2343
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2222
2344
|
return {
|
|
2223
2345
|
instructionType: 6 /* CloseSubscriptionAuthority */,
|
|
2224
2346
|
...parseCloseSubscriptionAuthorityInstruction(instruction)
|
|
2225
2347
|
};
|
|
2226
2348
|
}
|
|
2227
2349
|
case 7 /* CreatePlan */: {
|
|
2228
|
-
(0,
|
|
2350
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2229
2351
|
return { instructionType: 7 /* CreatePlan */, ...parseCreatePlanInstruction(instruction) };
|
|
2230
2352
|
}
|
|
2231
2353
|
case 8 /* UpdatePlan */: {
|
|
2232
|
-
(0,
|
|
2354
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2233
2355
|
return { instructionType: 8 /* UpdatePlan */, ...parseUpdatePlanInstruction(instruction) };
|
|
2234
2356
|
}
|
|
2235
2357
|
case 9 /* DeletePlan */: {
|
|
2236
|
-
(0,
|
|
2358
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2237
2359
|
return { instructionType: 9 /* DeletePlan */, ...parseDeletePlanInstruction(instruction) };
|
|
2238
2360
|
}
|
|
2239
2361
|
case 10 /* TransferSubscription */: {
|
|
2240
|
-
(0,
|
|
2362
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2241
2363
|
return {
|
|
2242
2364
|
instructionType: 10 /* TransferSubscription */,
|
|
2243
2365
|
...parseTransferSubscriptionInstruction(instruction)
|
|
2244
2366
|
};
|
|
2245
2367
|
}
|
|
2246
2368
|
case 11 /* Subscribe */: {
|
|
2247
|
-
(0,
|
|
2369
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2248
2370
|
return { instructionType: 11 /* Subscribe */, ...parseSubscribeInstruction(instruction) };
|
|
2249
2371
|
}
|
|
2250
2372
|
case 12 /* CancelSubscription */: {
|
|
2251
|
-
(0,
|
|
2373
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2252
2374
|
return {
|
|
2253
2375
|
instructionType: 12 /* CancelSubscription */,
|
|
2254
2376
|
...parseCancelSubscriptionInstruction(instruction)
|
|
2255
2377
|
};
|
|
2256
2378
|
}
|
|
2379
|
+
case 13 /* ResumeSubscription */: {
|
|
2380
|
+
(0, import_kit37.assertIsInstructionWithAccounts)(instruction);
|
|
2381
|
+
return {
|
|
2382
|
+
instructionType: 13 /* ResumeSubscription */,
|
|
2383
|
+
...parseResumeSubscriptionInstruction(instruction)
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2257
2386
|
default:
|
|
2258
|
-
throw new
|
|
2387
|
+
throw new import_kit37.SolanaError(import_kit37.SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
2259
2388
|
instructionType,
|
|
2260
2389
|
programName: "subscriptions"
|
|
2261
2390
|
});
|
|
@@ -2263,30 +2392,31 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2263
2392
|
}
|
|
2264
2393
|
function subscriptionsProgram() {
|
|
2265
2394
|
return (client) => {
|
|
2266
|
-
return (0,
|
|
2395
|
+
return (0, import_kit37.extendClient)(client, {
|
|
2267
2396
|
subscriptions: {
|
|
2268
2397
|
accounts: {
|
|
2269
|
-
fixedDelegation: (0,
|
|
2270
|
-
plan: (0,
|
|
2271
|
-
recurringDelegation: (0,
|
|
2272
|
-
subscriptionAuthority: (0,
|
|
2273
|
-
subscriptionDelegation: (0,
|
|
2274
|
-
eventAuthority: (0,
|
|
2398
|
+
fixedDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getFixedDelegationCodec()),
|
|
2399
|
+
plan: (0, import_program_client_core15.addSelfFetchFunctions)(client, getPlanCodec()),
|
|
2400
|
+
recurringDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getRecurringDelegationCodec()),
|
|
2401
|
+
subscriptionAuthority: (0, import_program_client_core15.addSelfFetchFunctions)(client, getSubscriptionAuthorityCodec()),
|
|
2402
|
+
subscriptionDelegation: (0, import_program_client_core15.addSelfFetchFunctions)(client, getSubscriptionDelegationCodec()),
|
|
2403
|
+
eventAuthority: (0, import_program_client_core15.addSelfFetchFunctions)(client, getEventAuthorityCodec())
|
|
2275
2404
|
},
|
|
2276
2405
|
instructions: {
|
|
2277
|
-
initSubscriptionAuthority: (input) => (0,
|
|
2278
|
-
createFixedDelegation: (input) => (0,
|
|
2279
|
-
createRecurringDelegation: (input) => (0,
|
|
2280
|
-
revokeDelegation: (input) => (0,
|
|
2281
|
-
transferFixed: (input) => (0,
|
|
2282
|
-
transferRecurring: (input) => (0,
|
|
2283
|
-
closeSubscriptionAuthority: (input) => (0,
|
|
2284
|
-
createPlan: (input) => (0,
|
|
2285
|
-
updatePlan: (input) => (0,
|
|
2286
|
-
deletePlan: (input) => (0,
|
|
2287
|
-
transferSubscription: (input) => (0,
|
|
2288
|
-
subscribe: (input) => (0,
|
|
2289
|
-
cancelSubscription: (input) => (0,
|
|
2406
|
+
initSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getInitSubscriptionAuthorityInstructionAsync(input)),
|
|
2407
|
+
createFixedDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreateFixedDelegationInstruction(input)),
|
|
2408
|
+
createRecurringDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreateRecurringDelegationInstruction(input)),
|
|
2409
|
+
revokeDelegation: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getRevokeDelegationInstruction(input)),
|
|
2410
|
+
transferFixed: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferFixedInstruction(input)),
|
|
2411
|
+
transferRecurring: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferRecurringInstruction(input)),
|
|
2412
|
+
closeSubscriptionAuthority: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCloseSubscriptionAuthorityInstruction(input)),
|
|
2413
|
+
createPlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCreatePlanInstruction(input)),
|
|
2414
|
+
updatePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getUpdatePlanInstruction(input)),
|
|
2415
|
+
deletePlan: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getDeletePlanInstruction(input)),
|
|
2416
|
+
transferSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getTransferSubscriptionInstruction(input)),
|
|
2417
|
+
subscribe: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getSubscribeInstructionAsync(input)),
|
|
2418
|
+
cancelSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getCancelSubscriptionInstructionAsync(input)),
|
|
2419
|
+
resumeSubscription: (input) => (0, import_program_client_core15.addSelfPlanAndSendFunctions)(client, getResumeSubscriptionInstructionAsync(input))
|
|
2290
2420
|
},
|
|
2291
2421
|
pdas: {
|
|
2292
2422
|
fixedDelegation: findFixedDelegationPda,
|
|
@@ -2444,7 +2574,7 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
2444
2574
|
[SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY]: `Delegation init_id does not match current SubscriptionAuthority`,
|
|
2445
2575
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED]: `Subscription already cancelled`,
|
|
2446
2576
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED]: `Subscription cancelled and past valid period`,
|
|
2447
|
-
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription
|
|
2577
|
+
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription is not cancelled`,
|
|
2448
2578
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
|
|
2449
2579
|
[SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
|
|
2450
2580
|
[SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
|
|
@@ -2458,7 +2588,7 @@ function getSubscriptionsErrorMessage(code) {
|
|
|
2458
2588
|
return "Error message not available in production bundles.";
|
|
2459
2589
|
}
|
|
2460
2590
|
function isSubscriptionsError(error, transactionMessage, code) {
|
|
2461
|
-
return (0,
|
|
2591
|
+
return (0, import_kit38.isProgramError)(error, transactionMessage, SUBSCRIPTIONS_PROGRAM_ADDRESS, code);
|
|
2462
2592
|
}
|
|
2463
2593
|
|
|
2464
2594
|
// src/constants.ts
|
|
@@ -2483,7 +2613,7 @@ var METADATA_URI_LEN = 128;
|
|
|
2483
2613
|
|
|
2484
2614
|
// src/accounts/decode.ts
|
|
2485
2615
|
function toEncodedAccount(raw, programAddress) {
|
|
2486
|
-
const base64Encoder = (0,
|
|
2616
|
+
const base64Encoder = (0, import_kit39.getBase64Encoder)();
|
|
2487
2617
|
const data = base64Encoder.encode(raw.account.data[0]);
|
|
2488
2618
|
return {
|
|
2489
2619
|
address: raw.pubkey,
|
|
@@ -2600,8 +2730,8 @@ async function fetchSubscriptionsForUser(rpc, user, programAddress) {
|
|
|
2600
2730
|
}
|
|
2601
2731
|
|
|
2602
2732
|
// src/plugin.ts
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2733
|
+
var import_kit40 = require("@solana/kit");
|
|
2734
|
+
var import_program_client_core16 = require("@solana/program-client-core");
|
|
2605
2735
|
var import_token = require("@solana-program/token");
|
|
2606
2736
|
|
|
2607
2737
|
// src/validators.ts
|
|
@@ -2651,7 +2781,7 @@ function appendPayer(instruction, payer) {
|
|
|
2651
2781
|
return withTrailing(instruction, [
|
|
2652
2782
|
{
|
|
2653
2783
|
address: payer.address,
|
|
2654
|
-
role:
|
|
2784
|
+
role: import_kit40.AccountRole.WRITABLE_SIGNER,
|
|
2655
2785
|
signer: payer
|
|
2656
2786
|
}
|
|
2657
2787
|
]);
|
|
@@ -2680,7 +2810,7 @@ async function getCloseSubscriptionAuthorityOverlayInstructionAsync(input) {
|
|
|
2680
2810
|
pdaConfig(input.programAddress)
|
|
2681
2811
|
);
|
|
2682
2812
|
if (input.receiver) {
|
|
2683
|
-
ix = withTrailing(ix, [{ address: input.receiver, role:
|
|
2813
|
+
ix = withTrailing(ix, [{ address: input.receiver, role: import_kit40.AccountRole.WRITABLE }]);
|
|
2684
2814
|
}
|
|
2685
2815
|
return ix;
|
|
2686
2816
|
}
|
|
@@ -2762,14 +2892,14 @@ function getRevokeDelegationOverlayInstruction(input) {
|
|
|
2762
2892
|
pdaConfig(input.programAddress)
|
|
2763
2893
|
);
|
|
2764
2894
|
if (input.receiver) {
|
|
2765
|
-
ix = withTrailing(ix, [{ address: input.receiver, role:
|
|
2895
|
+
ix = withTrailing(ix, [{ address: input.receiver, role: import_kit40.AccountRole.WRITABLE }]);
|
|
2766
2896
|
}
|
|
2767
2897
|
return ix;
|
|
2768
2898
|
}
|
|
2769
2899
|
function getRevokeSubscriptionOverlayInstruction(input) {
|
|
2770
|
-
const trailing = [{ address: input.planPda, role:
|
|
2900
|
+
const trailing = [{ address: input.planPda, role: import_kit40.AccountRole.READONLY }];
|
|
2771
2901
|
if (input.receiver) {
|
|
2772
|
-
trailing.push({ address: input.receiver, role:
|
|
2902
|
+
trailing.push({ address: input.receiver, role: import_kit40.AccountRole.WRITABLE });
|
|
2773
2903
|
}
|
|
2774
2904
|
return withTrailing(
|
|
2775
2905
|
getRevokeDelegationInstruction(
|
|
@@ -2938,9 +3068,19 @@ function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
|
2938
3068
|
pdaConfig(input.programAddress)
|
|
2939
3069
|
);
|
|
2940
3070
|
}
|
|
3071
|
+
function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
3072
|
+
return getResumeSubscriptionInstructionAsync(
|
|
3073
|
+
{
|
|
3074
|
+
planPda: input.planPda,
|
|
3075
|
+
subscriber: input.subscriber,
|
|
3076
|
+
subscriptionPda: input.subscriptionPda
|
|
3077
|
+
},
|
|
3078
|
+
pdaConfig(input.programAddress)
|
|
3079
|
+
);
|
|
3080
|
+
}
|
|
2941
3081
|
function subscriptionsProgram2() {
|
|
2942
3082
|
return (client) => {
|
|
2943
|
-
return (0,
|
|
3083
|
+
return (0, import_kit40.pipe)(client, subscriptionsProgram(), (c) => {
|
|
2944
3084
|
const queries = {
|
|
2945
3085
|
activeDelegationSummary: async (wallet) => {
|
|
2946
3086
|
const delegations = await fetchDelegationsByDelegator(c.rpc, wallet);
|
|
@@ -2964,21 +3104,21 @@ function subscriptionsProgram2() {
|
|
|
2964
3104
|
plansForOwner: (owner) => fetchPlansForOwner(c.rpc, owner)
|
|
2965
3105
|
};
|
|
2966
3106
|
const instructions = {
|
|
2967
|
-
cancelSubscription: (input) => (0,
|
|
3107
|
+
cancelSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
2968
3108
|
client,
|
|
2969
3109
|
getCancelSubscriptionOverlayInstructionAsync({
|
|
2970
3110
|
...input,
|
|
2971
3111
|
subscriber: input.subscriber ?? client.identity
|
|
2972
3112
|
})
|
|
2973
3113
|
),
|
|
2974
|
-
closeSubscriptionAuthority: (input) => (0,
|
|
3114
|
+
closeSubscriptionAuthority: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
2975
3115
|
client,
|
|
2976
3116
|
getCloseSubscriptionAuthorityOverlayInstructionAsync({
|
|
2977
3117
|
...input,
|
|
2978
3118
|
user: input.user ?? client.identity
|
|
2979
3119
|
})
|
|
2980
3120
|
),
|
|
2981
|
-
createFixedDelegation: (input) => (0,
|
|
3121
|
+
createFixedDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
2982
3122
|
client,
|
|
2983
3123
|
getCreateFixedDelegationOverlayInstructionAsync({
|
|
2984
3124
|
...input,
|
|
@@ -2986,14 +3126,14 @@ function subscriptionsProgram2() {
|
|
|
2986
3126
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
2987
3127
|
})
|
|
2988
3128
|
),
|
|
2989
|
-
createPlan: (input) => (0,
|
|
3129
|
+
createPlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
2990
3130
|
client,
|
|
2991
3131
|
getCreatePlanOverlayInstructionAsync({
|
|
2992
3132
|
...input,
|
|
2993
3133
|
owner: input.owner ?? client.identity
|
|
2994
3134
|
})
|
|
2995
3135
|
),
|
|
2996
|
-
createRecurringDelegation: (input) => (0,
|
|
3136
|
+
createRecurringDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
2997
3137
|
client,
|
|
2998
3138
|
getCreateRecurringDelegationOverlayInstructionAsync({
|
|
2999
3139
|
...input,
|
|
@@ -3001,14 +3141,14 @@ function subscriptionsProgram2() {
|
|
|
3001
3141
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3002
3142
|
})
|
|
3003
3143
|
),
|
|
3004
|
-
deletePlan: (input) => (0,
|
|
3144
|
+
deletePlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3005
3145
|
client,
|
|
3006
3146
|
getDeletePlanOverlayInstruction({
|
|
3007
3147
|
...input,
|
|
3008
3148
|
owner: input.owner ?? client.identity
|
|
3009
3149
|
})
|
|
3010
3150
|
),
|
|
3011
|
-
initSubscriptionAuthority: (input) => (0,
|
|
3151
|
+
initSubscriptionAuthority: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3012
3152
|
client,
|
|
3013
3153
|
getInitSubscriptionAuthorityOverlayInstructionAsync({
|
|
3014
3154
|
...input,
|
|
@@ -3016,21 +3156,28 @@ function subscriptionsProgram2() {
|
|
|
3016
3156
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3017
3157
|
})
|
|
3018
3158
|
),
|
|
3019
|
-
|
|
3159
|
+
resumeSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3160
|
+
client,
|
|
3161
|
+
getResumeSubscriptionOverlayInstructionAsync({
|
|
3162
|
+
...input,
|
|
3163
|
+
subscriber: input.subscriber ?? client.identity
|
|
3164
|
+
})
|
|
3165
|
+
),
|
|
3166
|
+
revokeDelegation: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3020
3167
|
client,
|
|
3021
3168
|
getRevokeDelegationOverlayInstruction({
|
|
3022
3169
|
...input,
|
|
3023
3170
|
authority: input.authority ?? client.identity
|
|
3024
3171
|
})
|
|
3025
3172
|
),
|
|
3026
|
-
revokeSubscription: (input) => (0,
|
|
3173
|
+
revokeSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3027
3174
|
client,
|
|
3028
3175
|
getRevokeSubscriptionOverlayInstruction({
|
|
3029
3176
|
...input,
|
|
3030
3177
|
authority: input.authority ?? client.identity
|
|
3031
3178
|
})
|
|
3032
3179
|
),
|
|
3033
|
-
subscribe: (input) => (0,
|
|
3180
|
+
subscribe: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3034
3181
|
client,
|
|
3035
3182
|
(async () => {
|
|
3036
3183
|
let { expectedAmount, expectedPeriodHours, expectedCreatedAt } = input;
|
|
@@ -3063,28 +3210,28 @@ function subscriptionsProgram2() {
|
|
|
3063
3210
|
});
|
|
3064
3211
|
})()
|
|
3065
3212
|
),
|
|
3066
|
-
transferFixed: (input) => (0,
|
|
3213
|
+
transferFixed: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3067
3214
|
client,
|
|
3068
3215
|
getTransferFixedOverlayInstructionAsync({
|
|
3069
3216
|
...input,
|
|
3070
3217
|
delegatee: input.delegatee ?? client.identity
|
|
3071
3218
|
})
|
|
3072
3219
|
),
|
|
3073
|
-
transferRecurring: (input) => (0,
|
|
3220
|
+
transferRecurring: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3074
3221
|
client,
|
|
3075
3222
|
getTransferRecurringOverlayInstructionAsync({
|
|
3076
3223
|
...input,
|
|
3077
3224
|
delegatee: input.delegatee ?? client.identity
|
|
3078
3225
|
})
|
|
3079
3226
|
),
|
|
3080
|
-
transferSubscription: (input) => (0,
|
|
3227
|
+
transferSubscription: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3081
3228
|
client,
|
|
3082
3229
|
getTransferSubscriptionOverlayInstructionAsync({
|
|
3083
3230
|
...input,
|
|
3084
3231
|
caller: input.caller ?? client.identity
|
|
3085
3232
|
})
|
|
3086
3233
|
),
|
|
3087
|
-
updatePlan: (input) => (0,
|
|
3234
|
+
updatePlan: (input) => (0, import_program_client_core16.addSelfPlanAndSendFunctions)(
|
|
3088
3235
|
client,
|
|
3089
3236
|
getUpdatePlanOverlayInstruction({
|
|
3090
3237
|
...input,
|
|
@@ -3127,6 +3274,7 @@ function subscriptionsProgram2() {
|
|
|
3127
3274
|
PLAN_SIZE,
|
|
3128
3275
|
PROGRAM_ID,
|
|
3129
3276
|
PlanStatus,
|
|
3277
|
+
RESUME_SUBSCRIPTION_DISCRIMINATOR,
|
|
3130
3278
|
REVOKE_DELEGATION_DISCRIMINATOR,
|
|
3131
3279
|
SUBSCRIBE_DISCRIMINATOR,
|
|
3132
3280
|
SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
|
|
@@ -3344,6 +3492,13 @@ function subscriptionsProgram2() {
|
|
|
3344
3492
|
getRecurringDelegationCodec,
|
|
3345
3493
|
getRecurringDelegationDecoder,
|
|
3346
3494
|
getRecurringDelegationEncoder,
|
|
3495
|
+
getResumeSubscriptionDiscriminatorBytes,
|
|
3496
|
+
getResumeSubscriptionInstruction,
|
|
3497
|
+
getResumeSubscriptionInstructionAsync,
|
|
3498
|
+
getResumeSubscriptionInstructionDataCodec,
|
|
3499
|
+
getResumeSubscriptionInstructionDataDecoder,
|
|
3500
|
+
getResumeSubscriptionInstructionDataEncoder,
|
|
3501
|
+
getResumeSubscriptionOverlayInstructionAsync,
|
|
3347
3502
|
getRevokeDelegationDiscriminatorBytes,
|
|
3348
3503
|
getRevokeDelegationInstruction,
|
|
3349
3504
|
getRevokeDelegationInstructionDataCodec,
|
|
@@ -3407,6 +3562,7 @@ function subscriptionsProgram2() {
|
|
|
3407
3562
|
parseCreateRecurringDelegationInstruction,
|
|
3408
3563
|
parseDeletePlanInstruction,
|
|
3409
3564
|
parseInitSubscriptionAuthorityInstruction,
|
|
3565
|
+
parseResumeSubscriptionInstruction,
|
|
3410
3566
|
parseRevokeDelegationInstruction,
|
|
3411
3567
|
parseSubscribeInstruction,
|
|
3412
3568
|
parseSubscriptionsInstruction,
|