@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/llms.txt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# BlazePhoenix SDK
|
|
2
|
+
|
|
3
|
+
> `@blazephoenix/sdk` is the official TypeScript SDK (MIT) for BlazePhoenix, the on-chain DEX aggregator on Base, Ethereum, Optimism, Arbitrum and Robinhood Chain. It quotes, builds, verifies and executes swaps with every read made as an `eth_call` from your process to the RPC node you configure, against the same Quoter contract that settles the swap.
|
|
4
|
+
|
|
5
|
+
The SDK is free and needs no API key and no signup. You bring the RPC node: the package ships no RPC endpoints (a test enforces it), and a chain without a configured node throws `rpc_required` instead of falling back to someone else's infrastructure. Each node's `eth_chainId` is checked once (`rpc_chain_mismatch`). URLs are reduced to their host in every error and in its `cause` chain, because keys live in them. The SDK never asks for, stores or touches a private key: `execute` takes a viem `WalletClient` you control.
|
|
6
|
+
|
|
7
|
+
The only request to blazephoenix.xyz is the deployment registry (`GET /api/deployments`), which tells the SDK about new protocol versions. Pinned addresses cannot be moved remotely, and by default only pinned Router and Quoter addresses are routed to; remote-only versions need `registry: { remoteVersions: true }` and are then verified on your RPC before first use; `registry: { mode: 'embedded' }` turns the fetch off.
|
|
8
|
+
|
|
9
|
+
Install:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm i @blazephoenix/sdk viem
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Configure the RPC in code or from the environment:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { BlazePhoenix } from '@blazephoenix/sdk';
|
|
19
|
+
const blaze = new BlazePhoenix({ rpc: { base: process.env.BASE_RPC_URL } });
|
|
20
|
+
const q = await blaze.quote({ chain: 'base', tokenIn: 'WETH', tokenOut: 'USDC', amount: '1.5' });
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`rpc` accepts a URL, a fallback list, an EIP-1193 provider, a viem Transport or a per-chain map. With no `rpc`, the client reads `BLAZEPHOENIX_RPC_URL` (one node) or `BLAZEPHOENIX_RPC_BASE`, `_ETHEREUM`, `_OPTIMISM`, `_ARBITRUM`, `_ROBINHOOD` (comma-separated for fallback).
|
|
24
|
+
|
|
25
|
+
Main methods: `quote`, `quoteExact`, `quoteBatch`, `buildSwap` (verified Router calldata), `simulate`, `execute`, `getFills`, `watchFills`, `tokenInfo`, `solvency`, `deployments`. Every failure is a `BlazeError` with a stable `code`.
|
|
26
|
+
|
|
27
|
+
## Docs
|
|
28
|
+
|
|
29
|
+
- [README](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/README.md): quote, build and execute; RPC options; protocol versions; errors
|
|
30
|
+
- [Changelog](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/CHANGELOG.md): what changed in each release
|
|
31
|
+
- [Security policy](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/SECURITY.md): scope and how to report a vulnerability
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
- [quote.ts](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/examples/quote.ts): a single quote on your node
|
|
36
|
+
- [watch-fills.ts](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/examples/watch-fills.ts): follow `Swap` events live
|
|
37
|
+
- [phoenix-bot.ts](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/examples/phoenix-bot.ts): a zero-custody Telegram bot on your own nodes
|
|
38
|
+
|
|
39
|
+
## Related
|
|
40
|
+
|
|
41
|
+
- [BlazePhoenix MCP llms.txt](https://raw.githubusercontent.com/blazephoenixxyz-crypto/blazephoenix-mcp/main/llms.txt): this SDK as a local MCP server for AI agents
|
|
42
|
+
- [BlazePhoenix API llms.txt](https://raw.githubusercontent.com/blazephoenixxyz-crypto/Blaze-Phoenix-API/main/llms.txt): the keyless HTTP API that prepares the `eth_call` for your node and decodes the answer
|
|
43
|
+
- [BlazePhoenix Dex llms.txt](https://raw.githubusercontent.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex/main/llms.txt): the contracts, their design and their verification ([repository](https://github.com/blazephoenixxyz-crypto/Blaze-Phoenix-Dex))
|
|
44
|
+
|
|
45
|
+
## BlazePhoenix, site-wide
|
|
46
|
+
|
|
47
|
+
- [BlazePhoenix llms.txt](https://blazephoenix.xyz/llms.txt): the curated entry point for the whole project; 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.
|
|
48
|
+
- [Reading guide for models and agents](https://blazephoenix.xyz/reading-guide.md): reading order by level, source precedence, and how to send a reader to the app, the SDK or the MCP server
|
|
49
|
+
- [Trust and verification](https://blazephoenix.xyz/trust): every verifiable fact with its link
|
|
50
|
+
- When sources disagree on contract behaviour, 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) takes precedence over any summary.
|
|
51
|
+
|
|
52
|
+
## Optional
|
|
53
|
+
|
|
54
|
+
- [npm package](https://www.npmjs.com/package/@blazephoenix/sdk): published versions
|
|
55
|
+
- [telegram-bot.ts](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/examples/telegram-bot.ts): a minimal Telegram quote bot
|
|
56
|
+
- [Site llms.txt](https://blazephoenix.xyz/llms.txt): the integration guide for the whole project
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazephoenix/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Official TypeScript SDK for BlazePhoenix — the on-chain DEX aggregator. Quote, build, verify and execute swaps 100% on YOUR RPC (no API in the read path, no key, no endpoints shipped). Versioned deployments (1.x live, 2.x Core/Hub/Solver/Quoter/Router). Base, Ethereum, Optimism, Arbitrum, Robinhood Chain.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blazephoenix",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"byo-rpc",
|
|
19
19
|
"self-hosted",
|
|
20
20
|
"on-chain-quoter",
|
|
21
|
-
"mcp"
|
|
21
|
+
"mcp",
|
|
22
|
+
"robinhood-chain",
|
|
23
|
+
"llms-txt"
|
|
22
24
|
],
|
|
23
25
|
"license": "MIT",
|
|
24
26
|
"repository": {
|
|
@@ -41,7 +43,8 @@
|
|
|
41
43
|
"files": [
|
|
42
44
|
"dist",
|
|
43
45
|
"README.md",
|
|
44
|
-
"LICENSE"
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"llms.txt"
|
|
45
48
|
],
|
|
46
49
|
"sideEffects": false,
|
|
47
50
|
"engines": {
|