-
Notifications
You must be signed in to change notification settings - Fork 366
docs(subscriptions): document mainnet release changes #1562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9af66b5
docs(subscriptions): document mainnet release changes
dev-jodee d4ec95e
docs(subscriptions): tighten prose into leads + bullets
dev-jodee 4bf15e3
docs(subscriptions): generalize supported tokens, drop PYUSD example
dev-jodee 9cc5fa4
docs(subscriptions): drop transfer hook clause from supported tokens …
dev-jodee 08de411
docs(subscriptions): scope hook forwarding to transfer-hook mints
dev-jodee 2140e5d
docs(subscriptions): drop rust field-name aside from startTs note
dev-jodee 1d4d1dc
docs(subscriptions): add revoke-abandoned-subscription, fix update_pl…
dev-jodee ec0573b
docs(subscriptions): pin client install to 0.4.0 for prod release
dev-jodee 3efdcb8
docs(subscriptions): drop comment from update_plan rust example
dev-jodee 6addbe4
docs(subscriptions): document resume, events, update_plan rules, expi…
dev-jodee afcfa86
docs(subscriptions): describe events and update_plan as current state…
dev-jodee e914448
docs(subscriptions): drop update_plan account-list note from plan rules
dev-jodee 28eeb28
docs(subscriptions): fix review findings from code verification
dev-jodee 9fc111a
docs(subscriptions): note token program choice for Token-2022 mints i…
dev-jodee becb1e8
docs(subscriptions): address PR review feedback
dev-jodee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
apps/docs/content/docs/en/payments/subscriptions/revoke-abandoned-delegation.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| --- | ||
| title: Revoke Abandoned Delegation | ||
| description: | ||
| Guide for reclaiming rent from a fixed or recurring delegation whose | ||
| Subscription Authority is gone. | ||
| --- | ||
|
|
||
| A fixed or recurring delegation holds rent that normally returns to its recorded | ||
| payer on revoke. If a sponsor funded it and the user later closes or replaces | ||
| their Subscription Authority, the delegation is stranded and its rent stuck. | ||
| `RevokeAbandonedDelegation` lets the recorded payer reclaim it. | ||
|
|
||
| ## When It Applies | ||
|
|
||
| Allowed only when the delegation is provably dead — its Subscription Authority | ||
| was closed, or closed and recreated (so `init_id` no longer matches). A live | ||
| delegation can never be closed this way. | ||
|
|
||
| It's the recorded payer's only recovery path for a never-expiring delegation | ||
| (`expiry_ts == 0`) that isn't fully spent: ordinary | ||
| [revoke](/docs/payments/subscriptions/recurring-delegation#revoke-the-delegation) | ||
| fires for the payer only on expiry or, for a fixed delegation, full spend. | ||
|
|
||
| ## Reclaim The Rent | ||
|
|
||
| The recorded payer signs. Pass the dead delegation PDA and its recorded | ||
| Subscription Authority (which may already be closed). Rent returns to the payer. | ||
|
|
||
| <Tabs items={["TypeScript", "Rust"]}> | ||
| <Tab value="TypeScript"> | ||
| ```ts | ||
| import { getRevokeAbandonedDelegationInstruction } from '@solana/subscriptions'; | ||
|
|
||
| // Build the instruction and send it in a transaction like any other. | ||
| const revokeAbandonedIx = getRevokeAbandonedDelegationInstruction({ | ||
| payer: payerSigner, | ||
| delegationAccount: delegationPda, | ||
| subscriptionAuthority: subscriptionAuthorityPda, | ||
| }); | ||
| ``` | ||
|
|
||
| </Tab> | ||
|
|
||
| <Tab value="Rust"> | ||
| ```rust | ||
| use solana_address::{address, Address}; | ||
| use subscriptions::generated::instructions::*; | ||
|
|
||
| let payer: Address = address!("PAYER_THAT_FUNDED_RENT_HERE"); | ||
| let delegation_pda: Address = address!("DELEGATION_PDA_ADDRESS_HERE"); | ||
| let subscription_authority: Address = address!("RECORDED_SUBSCRIPTION_AUTHORITY_HERE"); | ||
|
|
||
| let revoke_abandoned_ix = RevokeAbandonedDelegationBuilder::new() | ||
| .payer(payer) | ||
| .delegation_account(delegation_pda) | ||
| .subscription_authority(subscription_authority) | ||
| .instruction(); | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Notes | ||
|
|
||
| - The recorded payer signs, not the delegator or delegatee. | ||
| - The instruction fails if the Subscription Authority is still live and matches | ||
| the delegation — use ordinary revoke for delegations that can still expire. | ||
| - It works for both fixed and recurring delegations. |
75 changes: 75 additions & 0 deletions
75
apps/docs/content/docs/en/payments/subscriptions/revoke-abandoned-subscription.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| title: Revoke Abandoned Subscription | ||
| description: | ||
| Guide for reclaiming rent from a subscription whose Subscription Authority is | ||
| gone. | ||
| --- | ||
|
|
||
| A subscription PDA holds rent that normally returns to its recorded payer when | ||
| the subscriber revokes it. If a sponsor funded the subscription and the user | ||
| later closes or replaces their Subscription Authority, the subscription is | ||
| stranded and its rent stuck. `RevokeAbandonedSubscription` lets the recorded | ||
| payer reclaim it. | ||
|
|
||
| ## When It Applies | ||
|
|
||
| Allowed only when the subscriber's Subscription Authority for the plan's mint is | ||
| provably terminal — closed, or closed and recreated (so `init_id` no longer | ||
| matches). The mint is read from the bound plan, so an unrelated authority cannot | ||
| be substituted to force a close. A live subscription can never be closed this | ||
| way. | ||
|
|
||
| This is the subscription-plan counterpart to | ||
| [Revoke Abandoned Delegation](/docs/payments/subscriptions/revoke-abandoned-delegation), | ||
| which covers fixed and recurring delegations. | ||
|
|
||
| ## Reclaim The Rent | ||
|
|
||
| The recorded payer signs. Pass the abandoned subscription PDA, its recorded | ||
| Subscription Authority (which may already be closed), and the plan the | ||
| subscription belongs to. Rent returns to the payer. | ||
|
|
||
| <Tabs items={["TypeScript", "Rust"]}> | ||
| <Tab value="TypeScript"> | ||
| ```ts | ||
| import { getRevokeAbandonedSubscriptionInstruction } from '@solana/subscriptions'; | ||
|
|
||
| // Build the instruction and send it in a transaction like any other. | ||
| const revokeAbandonedIx = getRevokeAbandonedSubscriptionInstruction({ | ||
| payer: payerSigner, | ||
| subscriptionAccount: subscriptionPda, | ||
| subscriptionAuthority: subscriptionAuthorityPda, | ||
| planPda, | ||
| }); | ||
| ``` | ||
|
|
||
| </Tab> | ||
|
|
||
| <Tab value="Rust"> | ||
| ```rust | ||
| use solana_address::{address, Address}; | ||
| use subscriptions::generated::instructions::*; | ||
|
|
||
| let payer: Address = address!("PAYER_THAT_FUNDED_RENT_HERE"); | ||
| let subscription_pda: Address = address!("SUBSCRIPTION_PDA_ADDRESS_HERE"); | ||
| let subscription_authority: Address = address!("RECORDED_SUBSCRIPTION_AUTHORITY_HERE"); | ||
| let plan_pda: Address = address!("PLAN_PDA_ADDRESS_HERE"); | ||
|
|
||
| let revoke_abandoned_ix = RevokeAbandonedSubscriptionBuilder::new() | ||
| .payer(payer) | ||
| .subscription_account(subscription_pda) | ||
| .subscription_authority(subscription_authority) | ||
| .plan_pda(plan_pda) | ||
| .instruction(); | ||
| ``` | ||
|
|
||
| </Tab> | ||
| </Tabs> | ||
|
|
||
| ## Notes | ||
|
|
||
| - The recorded payer signs, not the subscriber. | ||
| - The mint is read from the bound plan, blocking abandonment spoofing with an | ||
| unrelated authority. | ||
| - The instruction fails if the subscriber's Subscription Authority is still live | ||
| for the plan's mint — use ordinary cancel and revoke for active subscriptions. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.