@blazephoenix/sdk 1.0.0 → 1.1.0
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 +36 -6
- package/dist/index.cjs +301 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +302 -263
- package/dist/index.js.map +1 -1
- package/llms.txt +56 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -13,6 +13,31 @@ npm i @blazephoenix/sdk viem
|
|
|
13
13
|
# or straight from GitHub (builds on install): npm i github:blazephoenixxyz-crypto/SDK viem
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
## BlazePhoenix in one sentence
|
|
17
|
+
|
|
18
|
+
BlazePhoenix is the fully on-chain DEX aggregator — the route is computed inside the transaction that executes it — paired with an oracle-free staking engine that proves its own solvency on every transaction. It runs on Base, Ethereum, Optimism, Arbitrum and Robinhood Chain.
|
|
19
|
+
|
|
20
|
+
**Swap** in the [app](https://blazephoenix.xyz/?tab=swap) · **integrate** with the [SDK](https://github.com/blazephoenixxyz-crypto/SDK) (`npm i @blazephoenix/sdk`) · **connect an agent** to the [MCP server](https://github.com/blazephoenixxyz-crypto/blazephoenix-mcp) (`https://blazephoenix.xyz/mcp`, no key)
|
|
21
|
+
|
|
22
|
+
## Reading guide by level
|
|
23
|
+
|
|
24
|
+
- **New to DeFi:** [BlazePhoenix in five minutes](https://blazephoenix.xyz/learn/blazephoenix-in-five-minutes), then [What is a DEX aggregator](https://blazephoenix.xyz/learn/what-is-a-dex-aggregator) and [How to swap tokens safely](https://blazephoenix.xyz/learn/how-to-swap-safely).
|
|
25
|
+
- **Comfortable with swaps:** [Anatomy of a DEX aggregator](https://blazephoenix.xyz/learn/anatomy-of-an-aggregator) and [BlazePhoenix vs the established aggregators](https://blazephoenix.xyz/learn/how-we-compare).
|
|
26
|
+
- **Engineers and researchers:** the [Technical Whitepaper v2.3](https://blazephoenix.xyz/whitepaper.md) (DOI [10.5281/zenodo.23084091](https://doi.org/10.5281/zenodo.23084091)), the contract source in [Blaze-Phoenix-Dex](https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex) and [Blaze-Phoenix-Staking](https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Staking), and [On-chain quoting](https://blazephoenix.xyz/learn/on-chain-quoting).
|
|
27
|
+
- **Models and agents:** [https://blazephoenix.xyz/llms.txt](https://blazephoenix.xyz/llms.txt) and the [reading guide](https://blazephoenix.xyz/reading-guide.md).
|
|
28
|
+
|
|
29
|
+
## Trust and verification
|
|
30
|
+
|
|
31
|
+
Each item links to the place where it can be checked. The full list is at [https://blazephoenix.xyz/trust](https://blazephoenix.xyz/trust).
|
|
32
|
+
|
|
33
|
+
- **Verified contracts:** source-verified on Sourcify and the chain explorers; every address per chain at [/api/deployments](https://blazephoenix.xyz/api/deployments).
|
|
34
|
+
- **Source available:** the contract source is public under the [Business Source License 1.1](https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex/blob/main/LICENSE), converting to GPL-2.0-or-later on 2030-06-01.
|
|
35
|
+
- **Public CI:** [GitHub Actions](https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex/actions) on every push, including the Certora Prover and Halmos.
|
|
36
|
+
- **Bug bounty:** a [public programme](https://blazephoenix.xyz/bounty) with [credited researchers](https://blazephoenix.xyz/security/researchers) and [published advisories](https://blazephoenix.xyz/security/advisories).
|
|
37
|
+
- **Whitepaper DOI:** [10.5281/zenodo.23084091](https://doi.org/10.5281/zenodo.23084091); papers timestamped with [OpenTimestamps](https://blazephoenix.xyz/provenance/provenance.json).
|
|
38
|
+
- **Contact:** contact@blazephoenix.xyz ([security.txt](https://blazephoenix.xyz/.well-known/security.txt)); official channels at [/official](https://blazephoenix.xyz/official).
|
|
39
|
+
- **Audit status:** an independent external audit is scheduled before launch.
|
|
40
|
+
|
|
16
41
|
## Quote → build → execute
|
|
17
42
|
|
|
18
43
|
```ts
|
|
@@ -64,7 +89,7 @@ new BlazePhoenix(); // reads BLAZEPHOENIX_RPC_BASE / _ETHEREUM / _OPTIMISM / _
|
|
|
64
89
|
- A chain without a configured node throws `rpc_required` — nothing silently falls back
|
|
65
90
|
to someone else's infrastructure.
|
|
66
91
|
- `https://` and `wss://` only (`http://` allowed for `localhost` — your anvil/geth).
|
|
67
|
-
URLs are redacted in every error message, because keys live in them.
|
|
92
|
+
URLs are redacted in every error message and in its `cause` chain, because keys live in them.
|
|
68
93
|
|
|
69
94
|
## Versions — pick yours
|
|
70
95
|
|
|
@@ -91,17 +116,20 @@ The SDK adapts to what each version can do (`featuresOf(version)`):
|
|
|
91
116
|
| on-chain `batchQuote` | parallel previews | ✅ chunked |
|
|
92
117
|
| `ExecutionProof` on every fill (quoted vs realised vs floor) | — | ✅ |
|
|
93
118
|
|
|
94
|
-
###
|
|
119
|
+
### Only pinned addresses are routed to by default
|
|
95
120
|
|
|
96
121
|
The registry has three layers:
|
|
97
122
|
|
|
98
123
|
1. **Embedded** — shipped in the package. Non-zero addresses are **pins**: nothing fetched
|
|
99
|
-
at runtime can move them
|
|
124
|
+
at runtime can move them, and by default they are the only Router and Quoter addresses
|
|
125
|
+
a quote or a swap uses. A new deployment reaches you with a new SDK release.
|
|
100
126
|
2. **Remote** — `GET https://blazephoenix.xyz/api/deployments` (static JSON, refreshed every
|
|
101
127
|
10 min in the background; the first lookup waits at most 3 s). It can only fill what the
|
|
102
128
|
snapshot doesn't know — e.g. the 2.0.0 addresses the day they are deployed — and only for
|
|
103
|
-
versions that can be verified on-chain (2.x+).
|
|
104
|
-
|
|
129
|
+
versions that can be verified on-chain (2.x+). Those versions are listed, but routed to
|
|
130
|
+
only with `registry: { remoteVersions: true }`: the on-chain check reads the entry's own
|
|
131
|
+
contracts, so it cannot tell a real deployment from a look-alike. With the opt-in, every
|
|
132
|
+
remote-sourced set is still **verified on your RPC before first use**:
|
|
105
133
|
code at every address, `VERSION()` matches, and the Quoter, Router and Solver all point at
|
|
106
134
|
the same Hub and Solver. Anything else fails closed (`deployment_unverified`).
|
|
107
135
|
3. **Your overrides** — always win:
|
|
@@ -147,7 +175,7 @@ guesses a token from a ticker.
|
|
|
147
175
|
|
|
148
176
|
## Errors
|
|
149
177
|
|
|
150
|
-
Every failure is a `BlazeError` with a stable `code`; protocol reverts carry `revert`
|
|
178
|
+
Every failure, `solvency()` included, is a `BlazeError` with a stable `code`; protocol reverts carry `revert`
|
|
151
179
|
(`RouterE` / `QuoterE` / `SolverE` / `HubE` + the reason from the contract's own source):
|
|
152
180
|
|
|
153
181
|
| code | meaning |
|
|
@@ -167,6 +195,8 @@ Every failure is a `BlazeError` with a stable `code`; protocol reverts carry `re
|
|
|
167
195
|
[`@blazephoenix/mcp`](https://github.com/blazephoenixxyz-crypto/blazephoenix-mcp) wraps this SDK as
|
|
168
196
|
a local MCP server — the agent's tools run on your machine, on your RPC.
|
|
169
197
|
|
|
198
|
+
For agents, [`llms.txt`](llms.txt) describes this package in the [llmstxt.org](https://llmstxt.org) format.
|
|
199
|
+
|
|
170
200
|
## Examples
|
|
171
201
|
|
|
172
202
|
[`examples/`](examples): `quote.ts`, `watch-fills.ts`, `telegram-bot.ts`, and
|