| title | extend_ttl |
|---|---|
| description | Extends the time-to-live of plan and subscription storage entries on the Soroban ledger, preventing them from being archived and ensuring data availability. |
fn extend_ttl(env: Env, plan_id: u64, sub_id: u64)Extends the TTL (time-to-live) of plan and subscription persistent storage entries. This prevents these entries from being archived by the Soroban ledger when their TTL expires.
Soroban persistent storage entries have a finite TTL. When the TTL expires, the entry is **archived** - it still exists but cannot be accessed until restored. Calling `extend_ttl` refreshes the TTL window, keeping the data accessible. This is critical for long-running subscriptions that span months or years.| Name | Type | Description |
|---|---|---|
plan_id |
u64 |
The plan ID whose TTL to extend. |
sub_id |
u64 |
The subscription ID whose TTL to extend. |
None. Anyone can extend the TTL of any entry. This is safe because extending TTL only keeps data accessible longer - it does not modify the data.
None (void).
None.
None. If the plan or subscription does not exist, the function is a no-op.
```typescript import { VowenaClient, NETWORKS } from "@vowena/sdk";
const client = new VowenaClient({
contractId: NETWORKS.testnet.contractId,
rpcUrl: NETWORKS.testnet.rpcUrl,
networkPassphrase: NETWORKS.testnet.networkPassphrase,
});
// Extend TTL for plan 1 and subscription 5
const tx = await client.buildExtendTtl(
1, // Plan ID
5 // Subscription ID
);
const signedXdr = await signTransaction(tx);
await client.submitTransaction(signedXdr);
```
For Vowena, this means a subscription that hasn't been touched in several months could become inaccessible. The `extend_ttl` function prevents this by refreshing the TTL window.
Since the function is permissionless, anyone can extend TTL for any entry - there is no access control needed because extending TTL only keeps data alive longer.
- **Instance storage** (admin, counters): ~30 day threshold, ~90 day extend
- **Persistent storage** (plans, subscriptions, indexes): ~30 day threshold, ~120 day extend
The `extend_ttl` function refreshes persistent entries to the ~120 day extend window.