You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/developer-guides/payments/payment-operations.mdx
+26-3Lines changed: 26 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,29 @@ This requires two transactions and higher gas costs. Use `depositWithPermit` ins
78
78
79
79
</details>
80
80
81
+
### Account Summary
82
+
83
+
Get a comprehensive snapshot of your account's payment state in a single call. This is the recommended way to check account health — it returns derived values like debt, lockup breakdown, and funded-until epoch.
Before uploading, approve the **WarmStorage operator**and fund your account. FWSS requires a 30-day prepayment buffer—when your balance drops below 30 days, the provider may remove your data.
95
+
Before uploading, the **WarmStorage operator**must be approved and your account must be funded. FWSS requires a 30-day prepayment buffer — when your balance drops below 30 days, the provider may remove your data.
96
96
97
-
**Approval Components:**
98
-
99
-
| Component | Purpose | Formula When Adding Storage |
|**Max Lockup Period**| Safety limit on locked funds | constant of 86,400 epochs (30 days) |
97
+
The SDK's `prepare()` method handles all of this automatically. It computes the exact deposit needed, checks whether the FWSS operator is approved, and returns a single transaction that handles both.
105
98
106
99
---
107
100
108
-
## Detailed Calculator Guide
109
-
110
-
Learn how to calculate storage costs, required operator allowances and fund your account for future storage needs.
111
-
112
-
In this guide we will calculate the costs for a 1 GiB storage capacity for 12 months.
113
-
114
-
### Step 1: Calculate Base Storage Costs
101
+
## Querying Upload Costs
115
102
116
-
Get pricing information and calculate the cost per epoch for your storage capacity:
103
+
Use `getUploadCosts()` to preview costs without executing any transaction. This is useful for displaying pricing in a UI or letting users confirm before proceeding.
Calculate cumulative allowances for your new storage, accounting for existing usage.
155
-
156
-
:::note[Understanding Cumulative Allowances]
157
-
Allowances are **cumulative** - you must add your new storage requirements to any existing usage. This is because the WarmStorage operator needs permission to spend on behalf of all your active datasets, not just the new one. Think of it like updating a credit limit to cover both old and new subscriptions.
158
-
159
-
-**Rate Allowance**: Total per-epoch spending across all datasets
160
-
-**Lockup Allowance**: Total 30-day buffer across all datasets
Check balances, calculate deposit amount, and execute the appropriate transaction:
131
+
Use `prepare()` to compute costs and get a ready-to-execute transaction. This is the recommended approach for most use cases — it replaces the previous manual flow of calculating allowances, checking approvals, and branching between deposit/approve methods.
Subsequent uploads with the same `metadata` reuse the same data sets and payment rails.
104
104
105
-
#### Upload with Callbacks
105
+
:::tip[Prepare Before Uploading]
106
+
Before your first upload, call `prepare()` to ensure your account is funded and the storage service is approved. It computes the exact deposit needed and returns a single transaction to execute:
- ✅ Initialized synapse SDK for Filecoin Calibration
131
-
- ✅ Deposited USDFC as payment tokens
132
-
- ✅ Authorized the storage service to use the token
133
+
- ✅ Initialized Synapse SDK for Filecoin Calibration
134
+
- ✅ Computed the exact deposit and approval needed for your data size
135
+
- ✅ Executed a single transaction to fund and approve (if needed)
133
136
- ✅ Uploaded data with 2 copies across independent providers for durability
134
137
- ✅ Retrieved it using only the content address (from any provider that has it)
135
138
@@ -152,28 +155,37 @@ The `source` parameter identifies your application. It is stored as metadata on
152
155
153
156
### 2: Payment Setup
154
157
155
-
Before storing data, you need to deposit USDFC tokens in your payments account. The amount you deposit is entirely up to your anticipated storage and retrieval needs.
158
+
Before storing data, you need to ensure your account is funded and the storage service is approved. The `prepare()` method calculates the exact deposit needed for your data size and returns a single transaction that handles both funding and approval.
159
+
156
160
:::note[Pricing]
157
-
To size your deposit, check the up‑to‑date rates in [**Pricing**](/introduction/about/#pricing) and use the [storage costs calculator](/developer-guides/storage/storage-costs/#detailed-calculator-guide) for a precise estimate.
161
+
To size your deposit, check the up‑to‑date rates in [**Pricing**](/introduction/about/#pricing) and use the [storage costs guide](/developer-guides/storage/storage-costs/) for a detailed breakdown.
0 commit comments