fema-pf-calc 1.0.6 → 1.0.7
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 +12 -47
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,12 +62,12 @@ That is all a developer needs to do. No RPC key, no math, no guessing.
|
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
64
|
const result = await estimateFee({
|
|
65
|
-
speed: "fast",
|
|
66
|
-
strategy: "balanced",
|
|
67
|
-
protocol: "jupiter",
|
|
65
|
+
speed: "fast", // "slow" | "medium" | "fast"
|
|
66
|
+
strategy: "balanced", // "cheap" | "balanced" | "aggressive"
|
|
67
|
+
protocol: "jupiter", // see supported protocols below
|
|
68
68
|
transaction: myTransaction, // pass your actual tx for automatic protocol detection
|
|
69
|
-
maxFee: 500_000,
|
|
70
|
-
includeStats: true,
|
|
69
|
+
maxFee: 500_000, // optional cap in microLamports
|
|
70
|
+
includeStats: true, // include full distribution in response
|
|
71
71
|
});
|
|
72
72
|
```
|
|
73
73
|
|
|
@@ -138,11 +138,11 @@ const { fee } = await estimateFee({
|
|
|
138
138
|
|
|
139
139
|
```ts
|
|
140
140
|
{
|
|
141
|
-
fee: 253637,
|
|
142
|
-
congestion: "high",
|
|
143
|
-
percentileUsed: 75,
|
|
144
|
-
sampleSize: 1203,
|
|
145
|
-
programFiltered: true,
|
|
141
|
+
fee: 253637, // microLamports per CU — pass directly to setComputeUnitPrice
|
|
142
|
+
congestion: "high", // "low" | "medium" | "high"
|
|
143
|
+
percentileUsed: 75, // which percentile was used
|
|
144
|
+
sampleSize: 1203, // number of transactions analyzed
|
|
145
|
+
programFiltered: true, // true = fee is based on your protocol's txs specifically
|
|
146
146
|
|
|
147
147
|
// only included when includeStats: true
|
|
148
148
|
stats: {
|
|
@@ -169,28 +169,11 @@ The `fee` value is in **microLamports per compute unit** — the exact unit that
|
|
|
169
169
|
|
|
170
170
|
```ts
|
|
171
171
|
init({
|
|
172
|
-
cluster: "mainnet-beta",
|
|
173
|
-
|
|
174
|
-
cacheDurationMs: 7000, // how long to cache results in ms (default: 7000)
|
|
172
|
+
cluster: "mainnet-beta", // "mainnet-beta" | "devnet" (default: "mainnet-beta")
|
|
173
|
+
cacheDurationMs: 7000, // how long to cache results in ms (default: 7000)
|
|
175
174
|
});
|
|
176
175
|
```
|
|
177
176
|
|
|
178
|
-
You can also override the RPC via environment variables:
|
|
179
|
-
|
|
180
|
-
```env
|
|
181
|
-
# Optional: use your own RPC provider (overrides the built-in default)
|
|
182
|
-
SOLANA_RPC_URL=https://your-custom-rpc.com
|
|
183
|
-
|
|
184
|
-
# Or use your own Helius API key
|
|
185
|
-
HELIUS_API_KEY=your-api-key-here
|
|
186
|
-
|
|
187
|
-
# Network: mainnet-beta (default) or devnet
|
|
188
|
-
SOLANA_CLUSTER=mainnet-beta
|
|
189
|
-
|
|
190
|
-
# How long to cache fee data in milliseconds (default: 7000)
|
|
191
|
-
CACHE_DURATION_MS=7000
|
|
192
|
-
```
|
|
193
|
-
|
|
194
177
|
---
|
|
195
178
|
|
|
196
179
|
## Sample Code
|
|
@@ -228,24 +211,6 @@ export default app;
|
|
|
228
211
|
|
|
229
212
|
---
|
|
230
213
|
|
|
231
|
-
## Project Structure
|
|
232
|
-
|
|
233
|
-
```
|
|
234
|
-
src/
|
|
235
|
-
├── index.ts # SDK entry point — estimateFee() and init()
|
|
236
|
-
├── types.ts # TypeScript types and interfaces
|
|
237
|
-
├── config.ts # Configuration and RPC resolution
|
|
238
|
-
├── protocols.ts # Known protocol registry (Jupiter, Raydium, etc.)
|
|
239
|
-
├── engine/
|
|
240
|
-
│ └── feeCalculator.ts # Percentile math, strategy modifiers, outlier filtering
|
|
241
|
-
└── services/
|
|
242
|
-
├── solana.ts # RPC data fetching and block scanning
|
|
243
|
-
├── cache.ts # In-memory TTL cache
|
|
244
|
-
└── database.ts # In-memory snapshot store and fallback
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
214
|
## License
|
|
250
215
|
|
|
251
216
|
MIT
|