@solana/subscriptions 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.cjs +411 -177
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +140 -71
- package/dist/index.d.ts +140 -71
- package/dist/index.js +393 -156
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -227,14 +227,16 @@ function getCreateFixedDelegationDataEncoder() {
|
|
|
227
227
|
return getStructEncoder2([
|
|
228
228
|
["nonce", getU64Encoder4()],
|
|
229
229
|
["amount", getU64Encoder4()],
|
|
230
|
-
["expiryTs", getI64Encoder()]
|
|
230
|
+
["expiryTs", getI64Encoder()],
|
|
231
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder()]
|
|
231
232
|
]);
|
|
232
233
|
}
|
|
233
234
|
function getCreateFixedDelegationDataDecoder() {
|
|
234
235
|
return getStructDecoder2([
|
|
235
236
|
["nonce", getU64Decoder()],
|
|
236
237
|
["amount", getU64Decoder()],
|
|
237
|
-
["expiryTs", getI64Decoder()]
|
|
238
|
+
["expiryTs", getI64Decoder()],
|
|
239
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder()]
|
|
238
240
|
]);
|
|
239
241
|
}
|
|
240
242
|
function getCreateFixedDelegationDataCodec() {
|
|
@@ -257,7 +259,8 @@ function getCreateRecurringDelegationDataEncoder() {
|
|
|
257
259
|
["amountPerPeriod", getU64Encoder5()],
|
|
258
260
|
["periodLengthS", getU64Encoder5()],
|
|
259
261
|
["startTs", getI64Encoder2()],
|
|
260
|
-
["expiryTs", getI64Encoder2()]
|
|
262
|
+
["expiryTs", getI64Encoder2()],
|
|
263
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder2()]
|
|
261
264
|
]);
|
|
262
265
|
}
|
|
263
266
|
function getCreateRecurringDelegationDataDecoder() {
|
|
@@ -266,7 +269,8 @@ function getCreateRecurringDelegationDataDecoder() {
|
|
|
266
269
|
["amountPerPeriod", getU64Decoder2()],
|
|
267
270
|
["periodLengthS", getU64Decoder2()],
|
|
268
271
|
["startTs", getI64Decoder2()],
|
|
269
|
-
["expiryTs", getI64Decoder2()]
|
|
272
|
+
["expiryTs", getI64Decoder2()],
|
|
273
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder2()]
|
|
270
274
|
]);
|
|
271
275
|
}
|
|
272
276
|
function getCreateRecurringDelegationDataCodec() {
|
|
@@ -425,7 +429,8 @@ function getSubscribeDataEncoder() {
|
|
|
425
429
|
["expectedMint", getAddressEncoder8()],
|
|
426
430
|
["expectedAmount", getU64Encoder8()],
|
|
427
431
|
["expectedPeriodHours", getU64Encoder8()],
|
|
428
|
-
["expectedCreatedAt", getI64Encoder6()]
|
|
432
|
+
["expectedCreatedAt", getI64Encoder6()],
|
|
433
|
+
["expectedSubscriptionAuthorityInitId", getI64Encoder6()]
|
|
429
434
|
]);
|
|
430
435
|
}
|
|
431
436
|
function getSubscribeDataDecoder() {
|
|
@@ -435,7 +440,8 @@ function getSubscribeDataDecoder() {
|
|
|
435
440
|
["expectedMint", getAddressDecoder3()],
|
|
436
441
|
["expectedAmount", getU64Decoder5()],
|
|
437
442
|
["expectedPeriodHours", getU64Decoder5()],
|
|
438
|
-
["expectedCreatedAt", getI64Decoder6()]
|
|
443
|
+
["expectedCreatedAt", getI64Decoder6()],
|
|
444
|
+
["expectedSubscriptionAuthorityInitId", getI64Decoder6()]
|
|
439
445
|
]);
|
|
440
446
|
}
|
|
441
447
|
function getSubscribeDataCodec() {
|
|
@@ -856,10 +862,10 @@ import {
|
|
|
856
862
|
assertIsInstructionWithAccounts,
|
|
857
863
|
containsBytes,
|
|
858
864
|
extendClient,
|
|
859
|
-
getU8Encoder as
|
|
865
|
+
getU8Encoder as getU8Encoder20,
|
|
860
866
|
SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION,
|
|
861
867
|
SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE,
|
|
862
|
-
SolanaError as
|
|
868
|
+
SolanaError as SolanaError15
|
|
863
869
|
} from "@solana/kit";
|
|
864
870
|
import {
|
|
865
871
|
addSelfFetchFunctions,
|
|
@@ -1512,7 +1518,7 @@ function parseInitSubscriptionAuthorityInstruction(instruction) {
|
|
|
1512
1518
|
};
|
|
1513
1519
|
}
|
|
1514
1520
|
|
|
1515
|
-
// src/generated/instructions/
|
|
1521
|
+
// src/generated/instructions/resumeSubscription.ts
|
|
1516
1522
|
import {
|
|
1517
1523
|
combineCodec as combineCodec24,
|
|
1518
1524
|
getStructDecoder as getStructDecoder22,
|
|
@@ -1523,22 +1529,143 @@ import {
|
|
|
1523
1529
|
SolanaError as SolanaError8,
|
|
1524
1530
|
transformEncoder as transformEncoder8
|
|
1525
1531
|
} from "@solana/kit";
|
|
1526
|
-
import {
|
|
1532
|
+
import {
|
|
1533
|
+
getAccountMetaFactory as getAccountMetaFactory8,
|
|
1534
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount3
|
|
1535
|
+
} from "@solana/program-client-core";
|
|
1536
|
+
var RESUME_SUBSCRIPTION_DISCRIMINATOR = 13;
|
|
1537
|
+
function getResumeSubscriptionDiscriminatorBytes() {
|
|
1538
|
+
return getU8Encoder13().encode(RESUME_SUBSCRIPTION_DISCRIMINATOR);
|
|
1539
|
+
}
|
|
1540
|
+
function getResumeSubscriptionInstructionDataEncoder() {
|
|
1541
|
+
return transformEncoder8(getStructEncoder22([["discriminator", getU8Encoder13()]]), (value) => ({
|
|
1542
|
+
...value,
|
|
1543
|
+
discriminator: RESUME_SUBSCRIPTION_DISCRIMINATOR
|
|
1544
|
+
}));
|
|
1545
|
+
}
|
|
1546
|
+
function getResumeSubscriptionInstructionDataDecoder() {
|
|
1547
|
+
return getStructDecoder22([["discriminator", getU8Decoder13()]]);
|
|
1548
|
+
}
|
|
1549
|
+
function getResumeSubscriptionInstructionDataCodec() {
|
|
1550
|
+
return combineCodec24(getResumeSubscriptionInstructionDataEncoder(), getResumeSubscriptionInstructionDataDecoder());
|
|
1551
|
+
}
|
|
1552
|
+
async function getResumeSubscriptionInstructionAsync(input, config) {
|
|
1553
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1554
|
+
const originalAccounts = {
|
|
1555
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1556
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1557
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1558
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1559
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1560
|
+
};
|
|
1561
|
+
const accounts = originalAccounts;
|
|
1562
|
+
if (!accounts.subscriptionPda.value) {
|
|
1563
|
+
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1564
|
+
planPda: getAddressFromResolvedInstructionAccount3("planPda", accounts.planPda.value),
|
|
1565
|
+
subscriber: getAddressFromResolvedInstructionAccount3("subscriber", accounts.subscriber.value)
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
if (!accounts.eventAuthority.value) {
|
|
1569
|
+
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1570
|
+
}
|
|
1571
|
+
if (!accounts.selfProgram.value) {
|
|
1572
|
+
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1573
|
+
}
|
|
1574
|
+
const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
|
|
1575
|
+
return Object.freeze({
|
|
1576
|
+
accounts: [
|
|
1577
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1578
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1579
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1580
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1581
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1582
|
+
],
|
|
1583
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode({}),
|
|
1584
|
+
programAddress
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
function getResumeSubscriptionInstruction(input, config) {
|
|
1588
|
+
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
1589
|
+
const originalAccounts = {
|
|
1590
|
+
subscriber: { value: input.subscriber ?? null, isWritable: false },
|
|
1591
|
+
planPda: { value: input.planPda ?? null, isWritable: false },
|
|
1592
|
+
subscriptionPda: { value: input.subscriptionPda ?? null, isWritable: true },
|
|
1593
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1594
|
+
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
1595
|
+
};
|
|
1596
|
+
const accounts = originalAccounts;
|
|
1597
|
+
if (!accounts.eventAuthority.value) {
|
|
1598
|
+
accounts.eventAuthority.value = "3Hnj4BYoDgtpBuqXfiy7Y8cNa3jXaNd4oqgSXBzkMcH7";
|
|
1599
|
+
}
|
|
1600
|
+
if (!accounts.selfProgram.value) {
|
|
1601
|
+
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1602
|
+
}
|
|
1603
|
+
const getAccountMeta = getAccountMetaFactory8(programAddress, "programId");
|
|
1604
|
+
return Object.freeze({
|
|
1605
|
+
accounts: [
|
|
1606
|
+
getAccountMeta("subscriber", accounts.subscriber),
|
|
1607
|
+
getAccountMeta("planPda", accounts.planPda),
|
|
1608
|
+
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
1609
|
+
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1610
|
+
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
1611
|
+
],
|
|
1612
|
+
data: getResumeSubscriptionInstructionDataEncoder().encode({}),
|
|
1613
|
+
programAddress
|
|
1614
|
+
});
|
|
1615
|
+
}
|
|
1616
|
+
function parseResumeSubscriptionInstruction(instruction) {
|
|
1617
|
+
if (instruction.accounts.length < 5) {
|
|
1618
|
+
throw new SolanaError8(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS8, {
|
|
1619
|
+
actualAccountMetas: instruction.accounts.length,
|
|
1620
|
+
expectedAccountMetas: 5
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
let accountIndex = 0;
|
|
1624
|
+
const getNextAccount = () => {
|
|
1625
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
1626
|
+
accountIndex += 1;
|
|
1627
|
+
return accountMeta;
|
|
1628
|
+
};
|
|
1629
|
+
return {
|
|
1630
|
+
programAddress: instruction.programAddress,
|
|
1631
|
+
accounts: {
|
|
1632
|
+
subscriber: getNextAccount(),
|
|
1633
|
+
planPda: getNextAccount(),
|
|
1634
|
+
subscriptionPda: getNextAccount(),
|
|
1635
|
+
eventAuthority: getNextAccount(),
|
|
1636
|
+
selfProgram: getNextAccount()
|
|
1637
|
+
},
|
|
1638
|
+
data: getResumeSubscriptionInstructionDataDecoder().decode(instruction.data)
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
// src/generated/instructions/revokeDelegation.ts
|
|
1643
|
+
import {
|
|
1644
|
+
combineCodec as combineCodec25,
|
|
1645
|
+
getStructDecoder as getStructDecoder23,
|
|
1646
|
+
getStructEncoder as getStructEncoder23,
|
|
1647
|
+
getU8Decoder as getU8Decoder14,
|
|
1648
|
+
getU8Encoder as getU8Encoder14,
|
|
1649
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9,
|
|
1650
|
+
SolanaError as SolanaError9,
|
|
1651
|
+
transformEncoder as transformEncoder9
|
|
1652
|
+
} from "@solana/kit";
|
|
1653
|
+
import { getAccountMetaFactory as getAccountMetaFactory9 } from "@solana/program-client-core";
|
|
1527
1654
|
var REVOKE_DELEGATION_DISCRIMINATOR = 3;
|
|
1528
1655
|
function getRevokeDelegationDiscriminatorBytes() {
|
|
1529
|
-
return
|
|
1656
|
+
return getU8Encoder14().encode(REVOKE_DELEGATION_DISCRIMINATOR);
|
|
1530
1657
|
}
|
|
1531
1658
|
function getRevokeDelegationInstructionDataEncoder() {
|
|
1532
|
-
return
|
|
1659
|
+
return transformEncoder9(getStructEncoder23([["discriminator", getU8Encoder14()]]), (value) => ({
|
|
1533
1660
|
...value,
|
|
1534
1661
|
discriminator: REVOKE_DELEGATION_DISCRIMINATOR
|
|
1535
1662
|
}));
|
|
1536
1663
|
}
|
|
1537
1664
|
function getRevokeDelegationInstructionDataDecoder() {
|
|
1538
|
-
return
|
|
1665
|
+
return getStructDecoder23([["discriminator", getU8Decoder14()]]);
|
|
1539
1666
|
}
|
|
1540
1667
|
function getRevokeDelegationInstructionDataCodec() {
|
|
1541
|
-
return
|
|
1668
|
+
return combineCodec25(getRevokeDelegationInstructionDataEncoder(), getRevokeDelegationInstructionDataDecoder());
|
|
1542
1669
|
}
|
|
1543
1670
|
function getRevokeDelegationInstruction(input, config) {
|
|
1544
1671
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1547,7 +1674,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1547
1674
|
delegationAccount: { value: input.delegationAccount ?? null, isWritable: true }
|
|
1548
1675
|
};
|
|
1549
1676
|
const accounts = originalAccounts;
|
|
1550
|
-
const getAccountMeta =
|
|
1677
|
+
const getAccountMeta = getAccountMetaFactory9(programAddress, "programId");
|
|
1551
1678
|
return Object.freeze({
|
|
1552
1679
|
accounts: [
|
|
1553
1680
|
getAccountMeta("authority", accounts.authority),
|
|
@@ -1559,7 +1686,7 @@ function getRevokeDelegationInstruction(input, config) {
|
|
|
1559
1686
|
}
|
|
1560
1687
|
function parseRevokeDelegationInstruction(instruction) {
|
|
1561
1688
|
if (instruction.accounts.length < 2) {
|
|
1562
|
-
throw new
|
|
1689
|
+
throw new SolanaError9(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS9, {
|
|
1563
1690
|
actualAccountMetas: instruction.accounts.length,
|
|
1564
1691
|
expectedAccountMetas: 2
|
|
1565
1692
|
});
|
|
@@ -1579,40 +1706,40 @@ function parseRevokeDelegationInstruction(instruction) {
|
|
|
1579
1706
|
|
|
1580
1707
|
// src/generated/instructions/subscribe.ts
|
|
1581
1708
|
import {
|
|
1582
|
-
combineCodec as
|
|
1583
|
-
getStructDecoder as
|
|
1584
|
-
getStructEncoder as
|
|
1585
|
-
getU8Decoder as
|
|
1586
|
-
getU8Encoder as
|
|
1587
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1588
|
-
SolanaError as
|
|
1589
|
-
transformEncoder as
|
|
1709
|
+
combineCodec as combineCodec26,
|
|
1710
|
+
getStructDecoder as getStructDecoder24,
|
|
1711
|
+
getStructEncoder as getStructEncoder24,
|
|
1712
|
+
getU8Decoder as getU8Decoder15,
|
|
1713
|
+
getU8Encoder as getU8Encoder15,
|
|
1714
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10,
|
|
1715
|
+
SolanaError as SolanaError10,
|
|
1716
|
+
transformEncoder as transformEncoder10
|
|
1590
1717
|
} from "@solana/kit";
|
|
1591
1718
|
import {
|
|
1592
|
-
getAccountMetaFactory as
|
|
1593
|
-
getAddressFromResolvedInstructionAccount as
|
|
1719
|
+
getAccountMetaFactory as getAccountMetaFactory10,
|
|
1720
|
+
getAddressFromResolvedInstructionAccount as getAddressFromResolvedInstructionAccount4
|
|
1594
1721
|
} from "@solana/program-client-core";
|
|
1595
1722
|
var SUBSCRIBE_DISCRIMINATOR = 11;
|
|
1596
1723
|
function getSubscribeDiscriminatorBytes() {
|
|
1597
|
-
return
|
|
1724
|
+
return getU8Encoder15().encode(SUBSCRIBE_DISCRIMINATOR);
|
|
1598
1725
|
}
|
|
1599
1726
|
function getSubscribeInstructionDataEncoder() {
|
|
1600
|
-
return
|
|
1601
|
-
|
|
1602
|
-
["discriminator",
|
|
1727
|
+
return transformEncoder10(
|
|
1728
|
+
getStructEncoder24([
|
|
1729
|
+
["discriminator", getU8Encoder15()],
|
|
1603
1730
|
["subscribeData", getSubscribeDataEncoder()]
|
|
1604
1731
|
]),
|
|
1605
1732
|
(value) => ({ ...value, discriminator: SUBSCRIBE_DISCRIMINATOR })
|
|
1606
1733
|
);
|
|
1607
1734
|
}
|
|
1608
1735
|
function getSubscribeInstructionDataDecoder() {
|
|
1609
|
-
return
|
|
1610
|
-
["discriminator",
|
|
1736
|
+
return getStructDecoder24([
|
|
1737
|
+
["discriminator", getU8Decoder15()],
|
|
1611
1738
|
["subscribeData", getSubscribeDataDecoder()]
|
|
1612
1739
|
]);
|
|
1613
1740
|
}
|
|
1614
1741
|
function getSubscribeInstructionDataCodec() {
|
|
1615
|
-
return
|
|
1742
|
+
return combineCodec26(getSubscribeInstructionDataEncoder(), getSubscribeInstructionDataDecoder());
|
|
1616
1743
|
}
|
|
1617
1744
|
async function getSubscribeInstructionAsync(input, config) {
|
|
1618
1745
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1630,8 +1757,8 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1630
1757
|
const args = { ...input };
|
|
1631
1758
|
if (!accounts.subscriptionPda.value) {
|
|
1632
1759
|
accounts.subscriptionPda.value = await findSubscriptionDelegationPda({
|
|
1633
|
-
planPda:
|
|
1634
|
-
subscriber:
|
|
1760
|
+
planPda: getAddressFromResolvedInstructionAccount4("planPda", accounts.planPda.value),
|
|
1761
|
+
subscriber: getAddressFromResolvedInstructionAccount4("subscriber", accounts.subscriber.value)
|
|
1635
1762
|
});
|
|
1636
1763
|
}
|
|
1637
1764
|
if (!accounts.systemProgram.value) {
|
|
@@ -1643,7 +1770,7 @@ async function getSubscribeInstructionAsync(input, config) {
|
|
|
1643
1770
|
if (!accounts.selfProgram.value) {
|
|
1644
1771
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1645
1772
|
}
|
|
1646
|
-
const getAccountMeta =
|
|
1773
|
+
const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
|
|
1647
1774
|
return Object.freeze({
|
|
1648
1775
|
accounts: [
|
|
1649
1776
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1682,7 +1809,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
1682
1809
|
if (!accounts.selfProgram.value) {
|
|
1683
1810
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1684
1811
|
}
|
|
1685
|
-
const getAccountMeta =
|
|
1812
|
+
const getAccountMeta = getAccountMetaFactory10(programAddress, "programId");
|
|
1686
1813
|
return Object.freeze({
|
|
1687
1814
|
accounts: [
|
|
1688
1815
|
getAccountMeta("subscriber", accounts.subscriber),
|
|
@@ -1700,7 +1827,7 @@ function getSubscribeInstruction(input, config) {
|
|
|
1700
1827
|
}
|
|
1701
1828
|
function parseSubscribeInstruction(instruction) {
|
|
1702
1829
|
if (instruction.accounts.length < 8) {
|
|
1703
|
-
throw new
|
|
1830
|
+
throw new SolanaError10(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS10, {
|
|
1704
1831
|
actualAccountMetas: instruction.accounts.length,
|
|
1705
1832
|
expectedAccountMetas: 8
|
|
1706
1833
|
});
|
|
@@ -1729,37 +1856,37 @@ function parseSubscribeInstruction(instruction) {
|
|
|
1729
1856
|
|
|
1730
1857
|
// src/generated/instructions/transferFixed.ts
|
|
1731
1858
|
import {
|
|
1732
|
-
combineCodec as
|
|
1733
|
-
getStructDecoder as
|
|
1734
|
-
getStructEncoder as
|
|
1735
|
-
getU8Decoder as
|
|
1736
|
-
getU8Encoder as
|
|
1737
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1738
|
-
SolanaError as
|
|
1739
|
-
transformEncoder as
|
|
1859
|
+
combineCodec as combineCodec27,
|
|
1860
|
+
getStructDecoder as getStructDecoder25,
|
|
1861
|
+
getStructEncoder as getStructEncoder25,
|
|
1862
|
+
getU8Decoder as getU8Decoder16,
|
|
1863
|
+
getU8Encoder as getU8Encoder16,
|
|
1864
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11,
|
|
1865
|
+
SolanaError as SolanaError11,
|
|
1866
|
+
transformEncoder as transformEncoder11
|
|
1740
1867
|
} from "@solana/kit";
|
|
1741
|
-
import { getAccountMetaFactory as
|
|
1868
|
+
import { getAccountMetaFactory as getAccountMetaFactory11 } from "@solana/program-client-core";
|
|
1742
1869
|
var TRANSFER_FIXED_DISCRIMINATOR = 4;
|
|
1743
1870
|
function getTransferFixedDiscriminatorBytes() {
|
|
1744
|
-
return
|
|
1871
|
+
return getU8Encoder16().encode(TRANSFER_FIXED_DISCRIMINATOR);
|
|
1745
1872
|
}
|
|
1746
1873
|
function getTransferFixedInstructionDataEncoder() {
|
|
1747
|
-
return
|
|
1748
|
-
|
|
1749
|
-
["discriminator",
|
|
1874
|
+
return transformEncoder11(
|
|
1875
|
+
getStructEncoder25([
|
|
1876
|
+
["discriminator", getU8Encoder16()],
|
|
1750
1877
|
["transferData", getTransferDataEncoder()]
|
|
1751
1878
|
]),
|
|
1752
1879
|
(value) => ({ ...value, discriminator: TRANSFER_FIXED_DISCRIMINATOR })
|
|
1753
1880
|
);
|
|
1754
1881
|
}
|
|
1755
1882
|
function getTransferFixedInstructionDataDecoder() {
|
|
1756
|
-
return
|
|
1757
|
-
["discriminator",
|
|
1883
|
+
return getStructDecoder25([
|
|
1884
|
+
["discriminator", getU8Decoder16()],
|
|
1758
1885
|
["transferData", getTransferDataDecoder()]
|
|
1759
1886
|
]);
|
|
1760
1887
|
}
|
|
1761
1888
|
function getTransferFixedInstructionDataCodec() {
|
|
1762
|
-
return
|
|
1889
|
+
return combineCodec27(getTransferFixedInstructionDataEncoder(), getTransferFixedInstructionDataDecoder());
|
|
1763
1890
|
}
|
|
1764
1891
|
function getTransferFixedInstruction(input, config) {
|
|
1765
1892
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1768,6 +1895,7 @@ function getTransferFixedInstruction(input, config) {
|
|
|
1768
1895
|
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1769
1896
|
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
1770
1897
|
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
1898
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1771
1899
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1772
1900
|
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
1773
1901
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
@@ -1781,13 +1909,14 @@ function getTransferFixedInstruction(input, config) {
|
|
|
1781
1909
|
if (!accounts.selfProgram.value) {
|
|
1782
1910
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1783
1911
|
}
|
|
1784
|
-
const getAccountMeta =
|
|
1912
|
+
const getAccountMeta = getAccountMetaFactory11(programAddress, "programId");
|
|
1785
1913
|
return Object.freeze({
|
|
1786
1914
|
accounts: [
|
|
1787
1915
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
1788
1916
|
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1789
1917
|
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
1790
1918
|
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
1919
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1791
1920
|
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1792
1921
|
getAccountMeta("delegatee", accounts.delegatee),
|
|
1793
1922
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
@@ -1798,10 +1927,10 @@ function getTransferFixedInstruction(input, config) {
|
|
|
1798
1927
|
});
|
|
1799
1928
|
}
|
|
1800
1929
|
function parseTransferFixedInstruction(instruction) {
|
|
1801
|
-
if (instruction.accounts.length <
|
|
1802
|
-
throw new
|
|
1930
|
+
if (instruction.accounts.length < 9) {
|
|
1931
|
+
throw new SolanaError11(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS11, {
|
|
1803
1932
|
actualAccountMetas: instruction.accounts.length,
|
|
1804
|
-
expectedAccountMetas:
|
|
1933
|
+
expectedAccountMetas: 9
|
|
1805
1934
|
});
|
|
1806
1935
|
}
|
|
1807
1936
|
let accountIndex = 0;
|
|
@@ -1817,6 +1946,7 @@ function parseTransferFixedInstruction(instruction) {
|
|
|
1817
1946
|
subscriptionAuthority: getNextAccount(),
|
|
1818
1947
|
delegatorAta: getNextAccount(),
|
|
1819
1948
|
receiverAta: getNextAccount(),
|
|
1949
|
+
tokenMint: getNextAccount(),
|
|
1820
1950
|
tokenProgram: getNextAccount(),
|
|
1821
1951
|
delegatee: getNextAccount(),
|
|
1822
1952
|
eventAuthority: getNextAccount(),
|
|
@@ -1828,37 +1958,37 @@ function parseTransferFixedInstruction(instruction) {
|
|
|
1828
1958
|
|
|
1829
1959
|
// src/generated/instructions/transferRecurring.ts
|
|
1830
1960
|
import {
|
|
1831
|
-
combineCodec as
|
|
1832
|
-
getStructDecoder as
|
|
1833
|
-
getStructEncoder as
|
|
1834
|
-
getU8Decoder as
|
|
1835
|
-
getU8Encoder as
|
|
1836
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1837
|
-
SolanaError as
|
|
1838
|
-
transformEncoder as
|
|
1961
|
+
combineCodec as combineCodec28,
|
|
1962
|
+
getStructDecoder as getStructDecoder26,
|
|
1963
|
+
getStructEncoder as getStructEncoder26,
|
|
1964
|
+
getU8Decoder as getU8Decoder17,
|
|
1965
|
+
getU8Encoder as getU8Encoder17,
|
|
1966
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12,
|
|
1967
|
+
SolanaError as SolanaError12,
|
|
1968
|
+
transformEncoder as transformEncoder12
|
|
1839
1969
|
} from "@solana/kit";
|
|
1840
|
-
import { getAccountMetaFactory as
|
|
1970
|
+
import { getAccountMetaFactory as getAccountMetaFactory12 } from "@solana/program-client-core";
|
|
1841
1971
|
var TRANSFER_RECURRING_DISCRIMINATOR = 5;
|
|
1842
1972
|
function getTransferRecurringDiscriminatorBytes() {
|
|
1843
|
-
return
|
|
1973
|
+
return getU8Encoder17().encode(TRANSFER_RECURRING_DISCRIMINATOR);
|
|
1844
1974
|
}
|
|
1845
1975
|
function getTransferRecurringInstructionDataEncoder() {
|
|
1846
|
-
return
|
|
1847
|
-
|
|
1848
|
-
["discriminator",
|
|
1976
|
+
return transformEncoder12(
|
|
1977
|
+
getStructEncoder26([
|
|
1978
|
+
["discriminator", getU8Encoder17()],
|
|
1849
1979
|
["transferData", getTransferDataEncoder()]
|
|
1850
1980
|
]),
|
|
1851
1981
|
(value) => ({ ...value, discriminator: TRANSFER_RECURRING_DISCRIMINATOR })
|
|
1852
1982
|
);
|
|
1853
1983
|
}
|
|
1854
1984
|
function getTransferRecurringInstructionDataDecoder() {
|
|
1855
|
-
return
|
|
1856
|
-
["discriminator",
|
|
1985
|
+
return getStructDecoder26([
|
|
1986
|
+
["discriminator", getU8Decoder17()],
|
|
1857
1987
|
["transferData", getTransferDataDecoder()]
|
|
1858
1988
|
]);
|
|
1859
1989
|
}
|
|
1860
1990
|
function getTransferRecurringInstructionDataCodec() {
|
|
1861
|
-
return
|
|
1991
|
+
return combineCodec28(getTransferRecurringInstructionDataEncoder(), getTransferRecurringInstructionDataDecoder());
|
|
1862
1992
|
}
|
|
1863
1993
|
function getTransferRecurringInstruction(input, config) {
|
|
1864
1994
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -1867,6 +1997,7 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
1867
1997
|
subscriptionAuthority: { value: input.subscriptionAuthority ?? null, isWritable: false },
|
|
1868
1998
|
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
1869
1999
|
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
2000
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1870
2001
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1871
2002
|
delegatee: { value: input.delegatee ?? null, isWritable: false },
|
|
1872
2003
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
@@ -1880,13 +2011,14 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
1880
2011
|
if (!accounts.selfProgram.value) {
|
|
1881
2012
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1882
2013
|
}
|
|
1883
|
-
const getAccountMeta =
|
|
2014
|
+
const getAccountMeta = getAccountMetaFactory12(programAddress, "programId");
|
|
1884
2015
|
return Object.freeze({
|
|
1885
2016
|
accounts: [
|
|
1886
2017
|
getAccountMeta("delegationPda", accounts.delegationPda),
|
|
1887
2018
|
getAccountMeta("subscriptionAuthority", accounts.subscriptionAuthority),
|
|
1888
2019
|
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
1889
2020
|
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
2021
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1890
2022
|
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1891
2023
|
getAccountMeta("delegatee", accounts.delegatee),
|
|
1892
2024
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
@@ -1897,10 +2029,10 @@ function getTransferRecurringInstruction(input, config) {
|
|
|
1897
2029
|
});
|
|
1898
2030
|
}
|
|
1899
2031
|
function parseTransferRecurringInstruction(instruction) {
|
|
1900
|
-
if (instruction.accounts.length <
|
|
1901
|
-
throw new
|
|
2032
|
+
if (instruction.accounts.length < 9) {
|
|
2033
|
+
throw new SolanaError12(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS12, {
|
|
1902
2034
|
actualAccountMetas: instruction.accounts.length,
|
|
1903
|
-
expectedAccountMetas:
|
|
2035
|
+
expectedAccountMetas: 9
|
|
1904
2036
|
});
|
|
1905
2037
|
}
|
|
1906
2038
|
let accountIndex = 0;
|
|
@@ -1916,6 +2048,7 @@ function parseTransferRecurringInstruction(instruction) {
|
|
|
1916
2048
|
subscriptionAuthority: getNextAccount(),
|
|
1917
2049
|
delegatorAta: getNextAccount(),
|
|
1918
2050
|
receiverAta: getNextAccount(),
|
|
2051
|
+
tokenMint: getNextAccount(),
|
|
1919
2052
|
tokenProgram: getNextAccount(),
|
|
1920
2053
|
delegatee: getNextAccount(),
|
|
1921
2054
|
eventAuthority: getNextAccount(),
|
|
@@ -1927,37 +2060,37 @@ function parseTransferRecurringInstruction(instruction) {
|
|
|
1927
2060
|
|
|
1928
2061
|
// src/generated/instructions/transferSubscription.ts
|
|
1929
2062
|
import {
|
|
1930
|
-
combineCodec as
|
|
1931
|
-
getStructDecoder as
|
|
1932
|
-
getStructEncoder as
|
|
1933
|
-
getU8Decoder as
|
|
1934
|
-
getU8Encoder as
|
|
1935
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
1936
|
-
SolanaError as
|
|
1937
|
-
transformEncoder as
|
|
2063
|
+
combineCodec as combineCodec29,
|
|
2064
|
+
getStructDecoder as getStructDecoder27,
|
|
2065
|
+
getStructEncoder as getStructEncoder27,
|
|
2066
|
+
getU8Decoder as getU8Decoder18,
|
|
2067
|
+
getU8Encoder as getU8Encoder18,
|
|
2068
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13,
|
|
2069
|
+
SolanaError as SolanaError13,
|
|
2070
|
+
transformEncoder as transformEncoder13
|
|
1938
2071
|
} from "@solana/kit";
|
|
1939
|
-
import { getAccountMetaFactory as
|
|
2072
|
+
import { getAccountMetaFactory as getAccountMetaFactory13 } from "@solana/program-client-core";
|
|
1940
2073
|
var TRANSFER_SUBSCRIPTION_DISCRIMINATOR = 10;
|
|
1941
2074
|
function getTransferSubscriptionDiscriminatorBytes() {
|
|
1942
|
-
return
|
|
2075
|
+
return getU8Encoder18().encode(TRANSFER_SUBSCRIPTION_DISCRIMINATOR);
|
|
1943
2076
|
}
|
|
1944
2077
|
function getTransferSubscriptionInstructionDataEncoder() {
|
|
1945
|
-
return
|
|
1946
|
-
|
|
1947
|
-
["discriminator",
|
|
2078
|
+
return transformEncoder13(
|
|
2079
|
+
getStructEncoder27([
|
|
2080
|
+
["discriminator", getU8Encoder18()],
|
|
1948
2081
|
["transferData", getTransferDataEncoder()]
|
|
1949
2082
|
]),
|
|
1950
2083
|
(value) => ({ ...value, discriminator: TRANSFER_SUBSCRIPTION_DISCRIMINATOR })
|
|
1951
2084
|
);
|
|
1952
2085
|
}
|
|
1953
2086
|
function getTransferSubscriptionInstructionDataDecoder() {
|
|
1954
|
-
return
|
|
1955
|
-
["discriminator",
|
|
2087
|
+
return getStructDecoder27([
|
|
2088
|
+
["discriminator", getU8Decoder18()],
|
|
1956
2089
|
["transferData", getTransferDataDecoder()]
|
|
1957
2090
|
]);
|
|
1958
2091
|
}
|
|
1959
2092
|
function getTransferSubscriptionInstructionDataCodec() {
|
|
1960
|
-
return
|
|
2093
|
+
return combineCodec29(
|
|
1961
2094
|
getTransferSubscriptionInstructionDataEncoder(),
|
|
1962
2095
|
getTransferSubscriptionInstructionDataDecoder()
|
|
1963
2096
|
);
|
|
@@ -1971,6 +2104,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
1971
2104
|
delegatorAta: { value: input.delegatorAta ?? null, isWritable: true },
|
|
1972
2105
|
receiverAta: { value: input.receiverAta ?? null, isWritable: true },
|
|
1973
2106
|
caller: { value: input.caller ?? null, isWritable: false },
|
|
2107
|
+
tokenMint: { value: input.tokenMint ?? null, isWritable: false },
|
|
1974
2108
|
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
1975
2109
|
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
1976
2110
|
selfProgram: { value: input.selfProgram ?? null, isWritable: false }
|
|
@@ -1983,7 +2117,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
1983
2117
|
if (!accounts.selfProgram.value) {
|
|
1984
2118
|
accounts.selfProgram.value = "De1egAFMkMWZSN5rYXRj9CAdheBamobVNubTsi9avR44";
|
|
1985
2119
|
}
|
|
1986
|
-
const getAccountMeta =
|
|
2120
|
+
const getAccountMeta = getAccountMetaFactory13(programAddress, "programId");
|
|
1987
2121
|
return Object.freeze({
|
|
1988
2122
|
accounts: [
|
|
1989
2123
|
getAccountMeta("subscriptionPda", accounts.subscriptionPda),
|
|
@@ -1992,6 +2126,7 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
1992
2126
|
getAccountMeta("delegatorAta", accounts.delegatorAta),
|
|
1993
2127
|
getAccountMeta("receiverAta", accounts.receiverAta),
|
|
1994
2128
|
getAccountMeta("caller", accounts.caller),
|
|
2129
|
+
getAccountMeta("tokenMint", accounts.tokenMint),
|
|
1995
2130
|
getAccountMeta("tokenProgram", accounts.tokenProgram),
|
|
1996
2131
|
getAccountMeta("eventAuthority", accounts.eventAuthority),
|
|
1997
2132
|
getAccountMeta("selfProgram", accounts.selfProgram)
|
|
@@ -2001,10 +2136,10 @@ function getTransferSubscriptionInstruction(input, config) {
|
|
|
2001
2136
|
});
|
|
2002
2137
|
}
|
|
2003
2138
|
function parseTransferSubscriptionInstruction(instruction) {
|
|
2004
|
-
if (instruction.accounts.length <
|
|
2005
|
-
throw new
|
|
2139
|
+
if (instruction.accounts.length < 10) {
|
|
2140
|
+
throw new SolanaError13(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS13, {
|
|
2006
2141
|
actualAccountMetas: instruction.accounts.length,
|
|
2007
|
-
expectedAccountMetas:
|
|
2142
|
+
expectedAccountMetas: 10
|
|
2008
2143
|
});
|
|
2009
2144
|
}
|
|
2010
2145
|
let accountIndex = 0;
|
|
@@ -2022,6 +2157,7 @@ function parseTransferSubscriptionInstruction(instruction) {
|
|
|
2022
2157
|
delegatorAta: getNextAccount(),
|
|
2023
2158
|
receiverAta: getNextAccount(),
|
|
2024
2159
|
caller: getNextAccount(),
|
|
2160
|
+
tokenMint: getNextAccount(),
|
|
2025
2161
|
tokenProgram: getNextAccount(),
|
|
2026
2162
|
eventAuthority: getNextAccount(),
|
|
2027
2163
|
selfProgram: getNextAccount()
|
|
@@ -2032,37 +2168,37 @@ function parseTransferSubscriptionInstruction(instruction) {
|
|
|
2032
2168
|
|
|
2033
2169
|
// src/generated/instructions/updatePlan.ts
|
|
2034
2170
|
import {
|
|
2035
|
-
combineCodec as
|
|
2036
|
-
getStructDecoder as
|
|
2037
|
-
getStructEncoder as
|
|
2038
|
-
getU8Decoder as
|
|
2039
|
-
getU8Encoder as
|
|
2040
|
-
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as
|
|
2041
|
-
SolanaError as
|
|
2042
|
-
transformEncoder as
|
|
2171
|
+
combineCodec as combineCodec30,
|
|
2172
|
+
getStructDecoder as getStructDecoder28,
|
|
2173
|
+
getStructEncoder as getStructEncoder28,
|
|
2174
|
+
getU8Decoder as getU8Decoder19,
|
|
2175
|
+
getU8Encoder as getU8Encoder19,
|
|
2176
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS as SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14,
|
|
2177
|
+
SolanaError as SolanaError14,
|
|
2178
|
+
transformEncoder as transformEncoder14
|
|
2043
2179
|
} from "@solana/kit";
|
|
2044
|
-
import { getAccountMetaFactory as
|
|
2180
|
+
import { getAccountMetaFactory as getAccountMetaFactory14 } from "@solana/program-client-core";
|
|
2045
2181
|
var UPDATE_PLAN_DISCRIMINATOR = 8;
|
|
2046
2182
|
function getUpdatePlanDiscriminatorBytes() {
|
|
2047
|
-
return
|
|
2183
|
+
return getU8Encoder19().encode(UPDATE_PLAN_DISCRIMINATOR);
|
|
2048
2184
|
}
|
|
2049
2185
|
function getUpdatePlanInstructionDataEncoder() {
|
|
2050
|
-
return
|
|
2051
|
-
|
|
2052
|
-
["discriminator",
|
|
2186
|
+
return transformEncoder14(
|
|
2187
|
+
getStructEncoder28([
|
|
2188
|
+
["discriminator", getU8Encoder19()],
|
|
2053
2189
|
["updatePlanData", getUpdatePlanDataEncoder()]
|
|
2054
2190
|
]),
|
|
2055
2191
|
(value) => ({ ...value, discriminator: UPDATE_PLAN_DISCRIMINATOR })
|
|
2056
2192
|
);
|
|
2057
2193
|
}
|
|
2058
2194
|
function getUpdatePlanInstructionDataDecoder() {
|
|
2059
|
-
return
|
|
2060
|
-
["discriminator",
|
|
2195
|
+
return getStructDecoder28([
|
|
2196
|
+
["discriminator", getU8Decoder19()],
|
|
2061
2197
|
["updatePlanData", getUpdatePlanDataDecoder()]
|
|
2062
2198
|
]);
|
|
2063
2199
|
}
|
|
2064
2200
|
function getUpdatePlanInstructionDataCodec() {
|
|
2065
|
-
return
|
|
2201
|
+
return combineCodec30(getUpdatePlanInstructionDataEncoder(), getUpdatePlanInstructionDataDecoder());
|
|
2066
2202
|
}
|
|
2067
2203
|
function getUpdatePlanInstruction(input, config) {
|
|
2068
2204
|
const programAddress = config?.programAddress ?? SUBSCRIPTIONS_PROGRAM_ADDRESS;
|
|
@@ -2072,7 +2208,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2072
2208
|
};
|
|
2073
2209
|
const accounts = originalAccounts;
|
|
2074
2210
|
const args = { ...input };
|
|
2075
|
-
const getAccountMeta =
|
|
2211
|
+
const getAccountMeta = getAccountMetaFactory14(programAddress, "programId");
|
|
2076
2212
|
return Object.freeze({
|
|
2077
2213
|
accounts: [getAccountMeta("owner", accounts.owner), getAccountMeta("planPda", accounts.planPda)],
|
|
2078
2214
|
data: getUpdatePlanInstructionDataEncoder().encode(args),
|
|
@@ -2081,7 +2217,7 @@ function getUpdatePlanInstruction(input, config) {
|
|
|
2081
2217
|
}
|
|
2082
2218
|
function parseUpdatePlanInstruction(instruction) {
|
|
2083
2219
|
if (instruction.accounts.length < 2) {
|
|
2084
|
-
throw new
|
|
2220
|
+
throw new SolanaError14(SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS14, {
|
|
2085
2221
|
actualAccountMetas: instruction.accounts.length,
|
|
2086
2222
|
expectedAccountMetas: 2
|
|
2087
2223
|
});
|
|
@@ -2124,50 +2260,54 @@ var SubscriptionsInstruction = /* @__PURE__ */ ((SubscriptionsInstruction2) => {
|
|
|
2124
2260
|
SubscriptionsInstruction2[SubscriptionsInstruction2["TransferSubscription"] = 10] = "TransferSubscription";
|
|
2125
2261
|
SubscriptionsInstruction2[SubscriptionsInstruction2["Subscribe"] = 11] = "Subscribe";
|
|
2126
2262
|
SubscriptionsInstruction2[SubscriptionsInstruction2["CancelSubscription"] = 12] = "CancelSubscription";
|
|
2263
|
+
SubscriptionsInstruction2[SubscriptionsInstruction2["ResumeSubscription"] = 13] = "ResumeSubscription";
|
|
2127
2264
|
return SubscriptionsInstruction2;
|
|
2128
2265
|
})(SubscriptionsInstruction || {});
|
|
2129
2266
|
function identifySubscriptionsInstruction(instruction) {
|
|
2130
2267
|
const data = "data" in instruction ? instruction.data : instruction;
|
|
2131
|
-
if (containsBytes(data,
|
|
2268
|
+
if (containsBytes(data, getU8Encoder20().encode(0), 0)) {
|
|
2132
2269
|
return 0 /* InitSubscriptionAuthority */;
|
|
2133
2270
|
}
|
|
2134
|
-
if (containsBytes(data,
|
|
2271
|
+
if (containsBytes(data, getU8Encoder20().encode(1), 0)) {
|
|
2135
2272
|
return 1 /* CreateFixedDelegation */;
|
|
2136
2273
|
}
|
|
2137
|
-
if (containsBytes(data,
|
|
2274
|
+
if (containsBytes(data, getU8Encoder20().encode(2), 0)) {
|
|
2138
2275
|
return 2 /* CreateRecurringDelegation */;
|
|
2139
2276
|
}
|
|
2140
|
-
if (containsBytes(data,
|
|
2277
|
+
if (containsBytes(data, getU8Encoder20().encode(3), 0)) {
|
|
2141
2278
|
return 3 /* RevokeDelegation */;
|
|
2142
2279
|
}
|
|
2143
|
-
if (containsBytes(data,
|
|
2280
|
+
if (containsBytes(data, getU8Encoder20().encode(4), 0)) {
|
|
2144
2281
|
return 4 /* TransferFixed */;
|
|
2145
2282
|
}
|
|
2146
|
-
if (containsBytes(data,
|
|
2283
|
+
if (containsBytes(data, getU8Encoder20().encode(5), 0)) {
|
|
2147
2284
|
return 5 /* TransferRecurring */;
|
|
2148
2285
|
}
|
|
2149
|
-
if (containsBytes(data,
|
|
2286
|
+
if (containsBytes(data, getU8Encoder20().encode(6), 0)) {
|
|
2150
2287
|
return 6 /* CloseSubscriptionAuthority */;
|
|
2151
2288
|
}
|
|
2152
|
-
if (containsBytes(data,
|
|
2289
|
+
if (containsBytes(data, getU8Encoder20().encode(7), 0)) {
|
|
2153
2290
|
return 7 /* CreatePlan */;
|
|
2154
2291
|
}
|
|
2155
|
-
if (containsBytes(data,
|
|
2292
|
+
if (containsBytes(data, getU8Encoder20().encode(8), 0)) {
|
|
2156
2293
|
return 8 /* UpdatePlan */;
|
|
2157
2294
|
}
|
|
2158
|
-
if (containsBytes(data,
|
|
2295
|
+
if (containsBytes(data, getU8Encoder20().encode(9), 0)) {
|
|
2159
2296
|
return 9 /* DeletePlan */;
|
|
2160
2297
|
}
|
|
2161
|
-
if (containsBytes(data,
|
|
2298
|
+
if (containsBytes(data, getU8Encoder20().encode(10), 0)) {
|
|
2162
2299
|
return 10 /* TransferSubscription */;
|
|
2163
2300
|
}
|
|
2164
|
-
if (containsBytes(data,
|
|
2301
|
+
if (containsBytes(data, getU8Encoder20().encode(11), 0)) {
|
|
2165
2302
|
return 11 /* Subscribe */;
|
|
2166
2303
|
}
|
|
2167
|
-
if (containsBytes(data,
|
|
2304
|
+
if (containsBytes(data, getU8Encoder20().encode(12), 0)) {
|
|
2168
2305
|
return 12 /* CancelSubscription */;
|
|
2169
2306
|
}
|
|
2170
|
-
|
|
2307
|
+
if (containsBytes(data, getU8Encoder20().encode(13), 0)) {
|
|
2308
|
+
return 13 /* ResumeSubscription */;
|
|
2309
|
+
}
|
|
2310
|
+
throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__FAILED_TO_IDENTIFY_INSTRUCTION, {
|
|
2171
2311
|
instructionData: data,
|
|
2172
2312
|
programName: "subscriptions"
|
|
2173
2313
|
});
|
|
@@ -2254,8 +2394,15 @@ function parseSubscriptionsInstruction(instruction) {
|
|
|
2254
2394
|
...parseCancelSubscriptionInstruction(instruction)
|
|
2255
2395
|
};
|
|
2256
2396
|
}
|
|
2397
|
+
case 13 /* ResumeSubscription */: {
|
|
2398
|
+
assertIsInstructionWithAccounts(instruction);
|
|
2399
|
+
return {
|
|
2400
|
+
instructionType: 13 /* ResumeSubscription */,
|
|
2401
|
+
...parseResumeSubscriptionInstruction(instruction)
|
|
2402
|
+
};
|
|
2403
|
+
}
|
|
2257
2404
|
default:
|
|
2258
|
-
throw new
|
|
2405
|
+
throw new SolanaError15(SOLANA_ERROR__PROGRAM_CLIENTS__UNRECOGNIZED_INSTRUCTION_TYPE, {
|
|
2259
2406
|
instructionType,
|
|
2260
2407
|
programName: "subscriptions"
|
|
2261
2408
|
});
|
|
@@ -2286,7 +2433,8 @@ function subscriptionsProgram() {
|
|
|
2286
2433
|
deletePlan: (input) => addSelfPlanAndSendFunctions(client, getDeletePlanInstruction(input)),
|
|
2287
2434
|
transferSubscription: (input) => addSelfPlanAndSendFunctions(client, getTransferSubscriptionInstruction(input)),
|
|
2288
2435
|
subscribe: (input) => addSelfPlanAndSendFunctions(client, getSubscribeInstructionAsync(input)),
|
|
2289
|
-
cancelSubscription: (input) => addSelfPlanAndSendFunctions(client, getCancelSubscriptionInstructionAsync(input))
|
|
2436
|
+
cancelSubscription: (input) => addSelfPlanAndSendFunctions(client, getCancelSubscriptionInstructionAsync(input)),
|
|
2437
|
+
resumeSubscription: (input) => addSelfPlanAndSendFunctions(client, getResumeSubscriptionInstructionAsync(input))
|
|
2290
2438
|
},
|
|
2291
2439
|
pdas: {
|
|
2292
2440
|
fixedDelegation: findFixedDelegationPda,
|
|
@@ -2444,7 +2592,7 @@ if (process.env["NODE_ENV"] !== "production") {
|
|
|
2444
2592
|
[SUBSCRIPTIONS_ERROR__STALE_SUBSCRIPTION_AUTHORITY]: `Delegation init_id does not match current SubscriptionAuthority`,
|
|
2445
2593
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_ALREADY_CANCELLED]: `Subscription already cancelled`,
|
|
2446
2594
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_CANCELLED]: `Subscription cancelled and past valid period`,
|
|
2447
|
-
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription
|
|
2595
|
+
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_NOT_CANCELLED]: `Subscription is not cancelled`,
|
|
2448
2596
|
[SUBSCRIPTIONS_ERROR__SUBSCRIPTION_PLAN_MISMATCH]: `Subscription does not belong to this plan`,
|
|
2449
2597
|
[SUBSCRIPTIONS_ERROR__SUNSET_REQUIRES_END_TS]: `Sunset requires a non-zero end timestamp`,
|
|
2450
2598
|
[SUBSCRIPTIONS_ERROR__UNAUTHORIZED]: `Caller not authorized for this action`,
|
|
@@ -2689,6 +2837,11 @@ async function getCloseSubscriptionAuthorityOverlayInstructionAsync(input) {
|
|
|
2689
2837
|
}
|
|
2690
2838
|
async function getCreateFixedDelegationOverlayInstructionAsync(input) {
|
|
2691
2839
|
assertPositive(input.amount, "amount");
|
|
2840
|
+
if (input.expectedSubscriptionAuthorityInitId === void 0) {
|
|
2841
|
+
throw new Error(
|
|
2842
|
+
"getCreateFixedDelegationOverlayInstructionAsync requires expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.createFixedDelegation(...)` to auto-fetch from the live authority."
|
|
2843
|
+
);
|
|
2844
|
+
}
|
|
2692
2845
|
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
2693
2846
|
{ tokenMint: input.tokenMint, user: input.delegator.address },
|
|
2694
2847
|
pdaConfig(input.programAddress)
|
|
@@ -2710,6 +2863,7 @@ async function getCreateFixedDelegationOverlayInstructionAsync(input) {
|
|
|
2710
2863
|
delegator: input.delegator,
|
|
2711
2864
|
fixedDelegation: {
|
|
2712
2865
|
amount: input.amount,
|
|
2866
|
+
expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
|
|
2713
2867
|
expiryTs: input.expiryTs,
|
|
2714
2868
|
nonce: input.nonce
|
|
2715
2869
|
},
|
|
@@ -2723,6 +2877,11 @@ async function getCreateFixedDelegationOverlayInstructionAsync(input) {
|
|
|
2723
2877
|
async function getCreateRecurringDelegationOverlayInstructionAsync(input) {
|
|
2724
2878
|
assertPositive(input.amountPerPeriod, "amountPerPeriod");
|
|
2725
2879
|
assertPositive(input.periodLengthS, "periodLengthS");
|
|
2880
|
+
if (input.expectedSubscriptionAuthorityInitId === void 0) {
|
|
2881
|
+
throw new Error(
|
|
2882
|
+
"getCreateRecurringDelegationOverlayInstructionAsync requires expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.createRecurringDelegation(...)` to auto-fetch from the live authority."
|
|
2883
|
+
);
|
|
2884
|
+
}
|
|
2726
2885
|
const [subscriptionAuthority] = await findSubscriptionAuthorityPda(
|
|
2727
2886
|
{ tokenMint: input.tokenMint, user: input.delegator.address },
|
|
2728
2887
|
pdaConfig(input.programAddress)
|
|
@@ -2744,6 +2903,7 @@ async function getCreateRecurringDelegationOverlayInstructionAsync(input) {
|
|
|
2744
2903
|
delegator: input.delegator,
|
|
2745
2904
|
recurringDelegation: {
|
|
2746
2905
|
amountPerPeriod: input.amountPerPeriod,
|
|
2906
|
+
expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
|
|
2747
2907
|
expiryTs: input.expiryTs,
|
|
2748
2908
|
nonce: input.nonce,
|
|
2749
2909
|
periodLengthS: input.periodLengthS,
|
|
@@ -2798,6 +2958,7 @@ async function getTransferDelegationOverlayInstructionAsync(input, getInstructio
|
|
|
2798
2958
|
delegatorAta: input.delegatorAta,
|
|
2799
2959
|
receiverAta: input.receiverAta,
|
|
2800
2960
|
subscriptionAuthority,
|
|
2961
|
+
tokenMint: input.tokenMint,
|
|
2801
2962
|
tokenProgram: input.tokenProgram,
|
|
2802
2963
|
transferData: {
|
|
2803
2964
|
amount: input.amount,
|
|
@@ -2833,6 +2994,7 @@ async function getTransferSubscriptionOverlayInstructionAsync(input) {
|
|
|
2833
2994
|
receiverAta: input.receiverAta,
|
|
2834
2995
|
subscriptionAuthority,
|
|
2835
2996
|
subscriptionPda: input.subscriptionPda,
|
|
2997
|
+
tokenMint: input.tokenMint,
|
|
2836
2998
|
tokenProgram: input.tokenProgram,
|
|
2837
2999
|
transferData: {
|
|
2838
3000
|
amount: input.amount,
|
|
@@ -2897,9 +3059,9 @@ function getDeletePlanOverlayInstruction(input) {
|
|
|
2897
3059
|
return getDeletePlanInstruction({ owner: input.owner, planPda: input.planPda }, pdaConfig(input.programAddress));
|
|
2898
3060
|
}
|
|
2899
3061
|
async function getSubscribeOverlayInstructionAsync(input) {
|
|
2900
|
-
if (input.expectedAmount === void 0 || input.expectedPeriodHours === void 0 || input.expectedCreatedAt === void 0) {
|
|
3062
|
+
if (input.expectedAmount === void 0 || input.expectedPeriodHours === void 0 || input.expectedCreatedAt === void 0 || input.expectedSubscriptionAuthorityInitId === void 0) {
|
|
2901
3063
|
throw new Error(
|
|
2902
|
-
"getSubscribeOverlayInstructionAsync requires expectedAmount, expectedPeriodHours, and
|
|
3064
|
+
"getSubscribeOverlayInstructionAsync requires expectedAmount, expectedPeriodHours, expectedCreatedAt, and expectedSubscriptionAuthorityInitId. Use the plugin client `subscriptions.instructions.subscribe(...)` to auto-fetch from the live plan and authority."
|
|
2903
3065
|
);
|
|
2904
3066
|
}
|
|
2905
3067
|
const [planPda, planBump] = await findPlanPda(
|
|
@@ -2920,6 +3082,7 @@ async function getSubscribeOverlayInstructionAsync(input) {
|
|
|
2920
3082
|
expectedCreatedAt: input.expectedCreatedAt,
|
|
2921
3083
|
expectedMint: input.tokenMint,
|
|
2922
3084
|
expectedPeriodHours: input.expectedPeriodHours,
|
|
3085
|
+
expectedSubscriptionAuthorityInitId: input.expectedSubscriptionAuthorityInitId,
|
|
2923
3086
|
planBump,
|
|
2924
3087
|
planId: input.planId
|
|
2925
3088
|
},
|
|
@@ -2941,6 +3104,16 @@ function getCancelSubscriptionOverlayInstructionAsync(input) {
|
|
|
2941
3104
|
pdaConfig(input.programAddress)
|
|
2942
3105
|
);
|
|
2943
3106
|
}
|
|
3107
|
+
function getResumeSubscriptionOverlayInstructionAsync(input) {
|
|
3108
|
+
return getResumeSubscriptionInstructionAsync(
|
|
3109
|
+
{
|
|
3110
|
+
planPda: input.planPda,
|
|
3111
|
+
subscriber: input.subscriber,
|
|
3112
|
+
subscriptionPda: input.subscriptionPda
|
|
3113
|
+
},
|
|
3114
|
+
pdaConfig(input.programAddress)
|
|
3115
|
+
);
|
|
3116
|
+
}
|
|
2944
3117
|
function subscriptionsProgram2() {
|
|
2945
3118
|
return (client) => {
|
|
2946
3119
|
return pipe(client, subscriptionsProgram(), (c) => {
|
|
@@ -2966,6 +3139,20 @@ function subscriptionsProgram2() {
|
|
|
2966
3139
|
},
|
|
2967
3140
|
plansForOwner: (owner) => fetchPlansForOwner(c.rpc, owner)
|
|
2968
3141
|
};
|
|
3142
|
+
const resolveExpectedSubscriptionAuthorityInitId = async (tokenMint, user, programAddress, expectedSubscriptionAuthorityInitId) => {
|
|
3143
|
+
if (expectedSubscriptionAuthorityInitId !== void 0) {
|
|
3144
|
+
return expectedSubscriptionAuthorityInitId;
|
|
3145
|
+
}
|
|
3146
|
+
const [subscriptionAuthorityPda] = await findSubscriptionAuthorityPda(
|
|
3147
|
+
{ tokenMint, user },
|
|
3148
|
+
pdaConfig(programAddress)
|
|
3149
|
+
);
|
|
3150
|
+
const subscriptionAuthority = await fetchMaybeSubscriptionAuthority(c.rpc, subscriptionAuthorityPda);
|
|
3151
|
+
if (!subscriptionAuthority.exists) {
|
|
3152
|
+
throw new Error("SubscriptionAuthority is not initialized for this delegator and token mint.");
|
|
3153
|
+
}
|
|
3154
|
+
return subscriptionAuthority.data.initId;
|
|
3155
|
+
};
|
|
2969
3156
|
const instructions = {
|
|
2970
3157
|
cancelSubscription: (input) => addSelfPlanAndSendFunctions2(
|
|
2971
3158
|
client,
|
|
@@ -2983,11 +3170,21 @@ function subscriptionsProgram2() {
|
|
|
2983
3170
|
),
|
|
2984
3171
|
createFixedDelegation: (input) => addSelfPlanAndSendFunctions2(
|
|
2985
3172
|
client,
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
3173
|
+
(async () => {
|
|
3174
|
+
const delegator = input.delegator ?? client.identity;
|
|
3175
|
+
const expectedSubscriptionAuthorityInitId = await resolveExpectedSubscriptionAuthorityInitId(
|
|
3176
|
+
input.tokenMint,
|
|
3177
|
+
delegator.address,
|
|
3178
|
+
input.programAddress,
|
|
3179
|
+
input.expectedSubscriptionAuthorityInitId
|
|
3180
|
+
);
|
|
3181
|
+
return await getCreateFixedDelegationOverlayInstructionAsync({
|
|
3182
|
+
...input,
|
|
3183
|
+
delegator,
|
|
3184
|
+
expectedSubscriptionAuthorityInitId,
|
|
3185
|
+
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3186
|
+
});
|
|
3187
|
+
})()
|
|
2991
3188
|
),
|
|
2992
3189
|
createPlan: (input) => addSelfPlanAndSendFunctions2(
|
|
2993
3190
|
client,
|
|
@@ -2998,11 +3195,21 @@ function subscriptionsProgram2() {
|
|
|
2998
3195
|
),
|
|
2999
3196
|
createRecurringDelegation: (input) => addSelfPlanAndSendFunctions2(
|
|
3000
3197
|
client,
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3198
|
+
(async () => {
|
|
3199
|
+
const delegator = input.delegator ?? client.identity;
|
|
3200
|
+
const expectedSubscriptionAuthorityInitId = await resolveExpectedSubscriptionAuthorityInitId(
|
|
3201
|
+
input.tokenMint,
|
|
3202
|
+
delegator.address,
|
|
3203
|
+
input.programAddress,
|
|
3204
|
+
input.expectedSubscriptionAuthorityInitId
|
|
3205
|
+
);
|
|
3206
|
+
return await getCreateRecurringDelegationOverlayInstructionAsync({
|
|
3207
|
+
...input,
|
|
3208
|
+
delegator,
|
|
3209
|
+
expectedSubscriptionAuthorityInitId,
|
|
3210
|
+
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3211
|
+
});
|
|
3212
|
+
})()
|
|
3006
3213
|
),
|
|
3007
3214
|
deletePlan: (input) => addSelfPlanAndSendFunctions2(
|
|
3008
3215
|
client,
|
|
@@ -3019,6 +3226,13 @@ function subscriptionsProgram2() {
|
|
|
3019
3226
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer)
|
|
3020
3227
|
})
|
|
3021
3228
|
),
|
|
3229
|
+
resumeSubscription: (input) => addSelfPlanAndSendFunctions2(
|
|
3230
|
+
client,
|
|
3231
|
+
getResumeSubscriptionOverlayInstructionAsync({
|
|
3232
|
+
...input,
|
|
3233
|
+
subscriber: input.subscriber ?? client.identity
|
|
3234
|
+
})
|
|
3235
|
+
),
|
|
3022
3236
|
revokeDelegation: (input) => addSelfPlanAndSendFunctions2(
|
|
3023
3237
|
client,
|
|
3024
3238
|
getRevokeDelegationOverlayInstruction({
|
|
@@ -3036,9 +3250,14 @@ function subscriptionsProgram2() {
|
|
|
3036
3250
|
subscribe: (input) => addSelfPlanAndSendFunctions2(
|
|
3037
3251
|
client,
|
|
3038
3252
|
(async () => {
|
|
3039
|
-
|
|
3253
|
+
const subscriber = input.subscriber ?? client.identity;
|
|
3254
|
+
let {
|
|
3255
|
+
expectedAmount,
|
|
3256
|
+
expectedCreatedAt,
|
|
3257
|
+
expectedPeriodHours,
|
|
3258
|
+
expectedSubscriptionAuthorityInitId
|
|
3259
|
+
} = input;
|
|
3040
3260
|
if (expectedAmount === void 0 || expectedPeriodHours === void 0 || expectedCreatedAt === void 0) {
|
|
3041
|
-
const subscriber = input.subscriber ?? client.identity;
|
|
3042
3261
|
const [planPda] = await findPlanPda(
|
|
3043
3262
|
{ owner: input.merchant, planId: input.planId },
|
|
3044
3263
|
pdaConfig(input.programAddress)
|
|
@@ -3047,22 +3266,31 @@ function subscriptionsProgram2() {
|
|
|
3047
3266
|
expectedAmount = expectedAmount ?? plan.data.data.terms.amount;
|
|
3048
3267
|
expectedPeriodHours = expectedPeriodHours ?? plan.data.data.terms.periodHours;
|
|
3049
3268
|
expectedCreatedAt = expectedCreatedAt ?? plan.data.data.terms.createdAt;
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3269
|
+
}
|
|
3270
|
+
if (expectedSubscriptionAuthorityInitId === void 0) {
|
|
3271
|
+
const [subscriptionAuthorityPda] = await findSubscriptionAuthorityPda(
|
|
3272
|
+
{ tokenMint: input.tokenMint, user: subscriber.address },
|
|
3273
|
+
pdaConfig(input.programAddress)
|
|
3274
|
+
);
|
|
3275
|
+
const subscriptionAuthority = await fetchMaybeSubscriptionAuthority(
|
|
3276
|
+
c.rpc,
|
|
3277
|
+
subscriptionAuthorityPda
|
|
3278
|
+
);
|
|
3279
|
+
if (!subscriptionAuthority.exists) {
|
|
3280
|
+
throw new Error(
|
|
3281
|
+
"SubscriptionAuthority is not initialized for this subscriber and token mint."
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3284
|
+
expectedSubscriptionAuthorityInitId = subscriptionAuthority.data.initId;
|
|
3058
3285
|
}
|
|
3059
3286
|
return await getSubscribeOverlayInstructionAsync({
|
|
3060
3287
|
...input,
|
|
3061
3288
|
expectedAmount,
|
|
3062
3289
|
expectedCreatedAt,
|
|
3063
3290
|
expectedPeriodHours,
|
|
3291
|
+
expectedSubscriptionAuthorityInitId,
|
|
3064
3292
|
payer: input.payer ?? (client.payer === client.identity ? void 0 : client.payer),
|
|
3065
|
-
subscriber
|
|
3293
|
+
subscriber
|
|
3066
3294
|
});
|
|
3067
3295
|
})()
|
|
3068
3296
|
),
|
|
@@ -3129,6 +3357,7 @@ export {
|
|
|
3129
3357
|
PLAN_SIZE,
|
|
3130
3358
|
PROGRAM_ID,
|
|
3131
3359
|
PlanStatus,
|
|
3360
|
+
RESUME_SUBSCRIPTION_DISCRIMINATOR,
|
|
3132
3361
|
REVOKE_DELEGATION_DISCRIMINATOR,
|
|
3133
3362
|
SUBSCRIBE_DISCRIMINATOR,
|
|
3134
3363
|
SUBSCRIPTIONS_ERROR__ACCOUNT_NOT_WRITABLE,
|
|
@@ -3346,6 +3575,13 @@ export {
|
|
|
3346
3575
|
getRecurringDelegationCodec,
|
|
3347
3576
|
getRecurringDelegationDecoder,
|
|
3348
3577
|
getRecurringDelegationEncoder,
|
|
3578
|
+
getResumeSubscriptionDiscriminatorBytes,
|
|
3579
|
+
getResumeSubscriptionInstruction,
|
|
3580
|
+
getResumeSubscriptionInstructionAsync,
|
|
3581
|
+
getResumeSubscriptionInstructionDataCodec,
|
|
3582
|
+
getResumeSubscriptionInstructionDataDecoder,
|
|
3583
|
+
getResumeSubscriptionInstructionDataEncoder,
|
|
3584
|
+
getResumeSubscriptionOverlayInstructionAsync,
|
|
3349
3585
|
getRevokeDelegationDiscriminatorBytes,
|
|
3350
3586
|
getRevokeDelegationInstruction,
|
|
3351
3587
|
getRevokeDelegationInstructionDataCodec,
|
|
@@ -3409,6 +3645,7 @@ export {
|
|
|
3409
3645
|
parseCreateRecurringDelegationInstruction,
|
|
3410
3646
|
parseDeletePlanInstruction,
|
|
3411
3647
|
parseInitSubscriptionAuthorityInstruction,
|
|
3648
|
+
parseResumeSubscriptionInstruction,
|
|
3412
3649
|
parseRevokeDelegationInstruction,
|
|
3413
3650
|
parseSubscribeInstruction,
|
|
3414
3651
|
parseSubscriptionsInstruction,
|