fema-pf-calc 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +41 -35
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@ Supports **mainnet-beta** and **devnet**.
8
8
 
9
9
  ## The Problem
10
10
 
11
- Every Solana transaction can include a priority fee a tip paid to validators to land the transaction faster. Set it too low and your transaction gets stuck or dropped. Set it too high and you overpay.
11
+ Every Solana transaction can include a priority fee, a tip paid to validators to land the transaction faster. Set it too low and your transaction gets stuck or dropped. Set it too high and you overpay.
12
12
 
13
13
  The fee you need also depends on what kind of transaction you are sending. A Jupiter swap competes with other Jupiter swaps. An NFT mint competes with other NFT mints. They are not in the same queue, so they should not use the same fee.
14
14
 
@@ -65,30 +65,30 @@ That is all a developer needs to do. No RPC calls, no math, no guessing.
65
65
 
66
66
  ```ts
67
67
  const result = await estimateFee({
68
- speed: "fast", // "slow" | "medium" | "fast"
69
- strategy: "balanced", // "cheap" | "balanced" | "aggressive"
70
- protocol: "jupiter", // see supported protocols below
71
- transaction: myTransaction, // pass your actual tx for automatic protocol detection
72
- maxFee: 500_000, // optional cap in microLamports
73
- includeStats: true, // include full distribution in response
68
+ speed: "fast", // "slow" | "medium" | "fast"
69
+ strategy: "balanced", // "cheap" | "balanced" | "aggressive"
70
+ protocol: "jupiter", // see supported protocols below
71
+ transaction: myTransaction, // pass your actual tx for automatic protocol detection
72
+ maxFee: 500_000, // optional cap in microLamports
73
+ includeStats: true, // include full distribution in response
74
74
  });
75
75
  ```
76
76
 
77
77
  ### Speed
78
78
 
79
- | Speed | Percentile | What it means |
80
- |-------|-----------|---------------|
81
- | `slow` | p25 | Cheaper. May take a few blocks to land. |
82
- | `medium` | p50 | Balanced. Lands within a couple of blocks. |
83
- | `fast` | p75 | More expensive. Designed to land in the next block. |
79
+ | Speed | Percentile | What it means |
80
+ | -------- | ---------- | --------------------------------------------------- |
81
+ | `slow` | p25 | Cheaper. May take a few blocks to land. |
82
+ | `medium` | p50 | Balanced. Lands within a couple of blocks. |
83
+ | `fast` | p75 | More expensive. Designed to land in the next block. |
84
84
 
85
85
  ### Strategy
86
86
 
87
- | Strategy | Adjustment | What it means |
88
- |----------|-----------|---------------|
89
- | `cheap` | −10 percentile points | Slightly undercut the target. Risk: might not land if the network spikes. |
90
- | `balanced` | none | Hit the target exactly. Safe default for most use cases. |
91
- | `aggressive` | +15 percentile points | Slightly overpay to guarantee landing. |
87
+ | Strategy | Adjustment | What it means |
88
+ | ------------ | --------------------- | ------------------------------------------------------------------------- |
89
+ | `cheap` | −10 percentile points | Slightly undercut the target. Risk: might not land if the network spikes. |
90
+ | `balanced` | none | Hit the target exactly. Safe default for most use cases. |
91
+ | `aggressive` | +15 percentile points | Slightly overpay to guarantee landing. |
92
92
 
93
93
  ---
94
94
 
@@ -98,13 +98,19 @@ The most powerful feature of FEMA. When you specify a protocol, FEMA filters the
98
98
 
99
99
  ```ts
100
100
  // Jupiter swap
101
- const { fee: swapFee } = await estimateFee({ speed: "fast", protocol: "jupiter" });
101
+ const { fee: swapFee } = await estimateFee({
102
+ speed: "fast",
103
+ protocol: "jupiter",
104
+ });
102
105
 
103
106
  // NFT mint
104
107
  const { fee: nftFee } = await estimateFee({ speed: "fast", protocol: "nft" });
105
108
 
106
109
  // Pump.fun trade
107
- const { fee: pumpFee } = await estimateFee({ speed: "fast", protocol: "pumpfun" });
110
+ const { fee: pumpFee } = await estimateFee({
111
+ speed: "fast",
112
+ protocol: "pumpfun",
113
+ });
108
114
  ```
109
115
 
110
116
  Alternatively, pass your actual transaction and FEMA will detect the protocol automatically:
@@ -118,16 +124,16 @@ const { fee } = await estimateFee({
118
124
 
119
125
  ### Supported Protocols
120
126
 
121
- | Protocol | Programs Included |
122
- |----------|------------------|
123
- | `jupiter` | Jupiter V4, Jupiter V6 |
124
- | `raydium` | Raydium AMM V4, AMM V5, CLMM |
125
- | `orca` | Orca Whirlpool, Orca V1 |
126
- | `nft` | Token Metadata, Candy Machine V2/V3, Auction House |
127
- | `pumpfun` | Pump.fun |
128
- | `openbook` | OpenBook V1, OpenBook V2 |
129
- | `system` | System Program (SOL transfers) |
130
- | `token` | Token Program, Token 2022, Associated Token Program |
127
+ | Protocol | Programs Included |
128
+ | ---------- | --------------------------------------------------- |
129
+ | `jupiter` | Jupiter V4, Jupiter V6 |
130
+ | `raydium` | Raydium AMM V4, AMM V5, CLMM |
131
+ | `orca` | Orca Whirlpool, Orca V1 |
132
+ | `nft` | Token Metadata, Candy Machine V2/V3, Auction House |
133
+ | `pumpfun` | Pump.fun |
134
+ | `openbook` | OpenBook V1, OpenBook V2 |
135
+ | `system` | System Program (SOL transfers) |
136
+ | `token` | Token Program, Token 2022, Associated Token Program |
131
137
 
132
138
  ---
133
139
 
@@ -166,18 +172,18 @@ The `fee` value is in **microLamports per compute unit** — the exact unit that
166
172
 
167
173
  ```ts
168
174
  init({
169
- cluster: "mainnet-beta", // "mainnet-beta" | "devnet" (default: "mainnet-beta")
170
- rpcUrl: "https://your-rpc.com", // optional — overrides the cluster default
171
- cacheDurationMs: 7000, // how long to cache results in ms (default: 7000)
175
+ cluster: "mainnet-beta", // "mainnet-beta" | "devnet" (default: "mainnet-beta")
176
+ rpcUrl: "https://your-rpc.com", // optional — overrides the cluster default
177
+ cacheDurationMs: 7000, // how long to cache results in ms (default: 7000)
172
178
  });
173
179
  ```
174
180
 
175
181
  ### Cluster RPC defaults
176
182
 
177
- | Cluster | Default RPC |
178
- |---------|-------------|
183
+ | Cluster | Default RPC |
184
+ | -------------- | ------------------------------------- |
179
185
  | `mainnet-beta` | `https://api.mainnet-beta.solana.com` |
180
- | `devnet` | `https://api.devnet.solana.com` |
186
+ | `devnet` | `https://api.devnet.solana.com` |
181
187
 
182
188
  Or configure via `.env`:
183
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fema-pf-calc",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Intelligent Solana priority fee estimation engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",