@blazephoenix/sdk 0.5.2 → 1.0.1
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 +135 -153
- package/dist/index.cjs +6276 -407
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3955 -470
- package/dist/index.d.ts +3955 -470
- package/dist/index.js +6227 -402
- package/dist/index.js.map +1 -1
- package/llms.txt +49 -0
- package/package.json +14 -12
package/llms.txt
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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, every remote-sourced set is verified on your RPC before first use, and `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
|
+
## Optional
|
|
46
|
+
|
|
47
|
+
- [npm package](https://www.npmjs.com/package/@blazephoenix/sdk): published versions
|
|
48
|
+
- [telegram-bot.ts](https://raw.githubusercontent.com/blazephoenixxyz-crypto/SDK/main/examples/telegram-bot.ts): a minimal Telegram quote bot
|
|
49
|
+
- [Site llms.txt](https://blazephoenix.xyz/llms.txt): the integration guide for the whole project
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazephoenix/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Official TypeScript SDK for BlazePhoenix — the on-chain DEX aggregator. Quote, build,
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
7
7
|
"bzpx",
|
|
@@ -13,9 +13,14 @@
|
|
|
13
13
|
"ethereum",
|
|
14
14
|
"optimism",
|
|
15
15
|
"arbitrum",
|
|
16
|
-
"quote-api",
|
|
17
16
|
"telegram-bot",
|
|
18
|
-
"viem"
|
|
17
|
+
"viem",
|
|
18
|
+
"byo-rpc",
|
|
19
|
+
"self-hosted",
|
|
20
|
+
"on-chain-quoter",
|
|
21
|
+
"mcp",
|
|
22
|
+
"robinhood-chain",
|
|
23
|
+
"llms-txt"
|
|
19
24
|
],
|
|
20
25
|
"license": "MIT",
|
|
21
26
|
"repository": {
|
|
@@ -38,7 +43,8 @@
|
|
|
38
43
|
"files": [
|
|
39
44
|
"dist",
|
|
40
45
|
"README.md",
|
|
41
|
-
"LICENSE"
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"llms.txt"
|
|
42
48
|
],
|
|
43
49
|
"sideEffects": false,
|
|
44
50
|
"engines": {
|
|
@@ -49,15 +55,11 @@
|
|
|
49
55
|
"test": "tsx scripts/test.ts",
|
|
50
56
|
"typecheck": "tsc --noEmit",
|
|
51
57
|
"prepare": "npm run build",
|
|
52
|
-
"prepublishOnly": "npm run typecheck && npm run build && npm test"
|
|
58
|
+
"prepublishOnly": "npm run typecheck && npm run build && npm test",
|
|
59
|
+
"gen:abis": "node scripts/gen-abis.mjs ../Blaze-Phoenix-Dex"
|
|
53
60
|
},
|
|
54
61
|
"peerDependencies": {
|
|
55
|
-
"viem": "
|
|
56
|
-
},
|
|
57
|
-
"peerDependenciesMeta": {
|
|
58
|
-
"viem": {
|
|
59
|
-
"optional": true
|
|
60
|
-
}
|
|
62
|
+
"viem": "^2.21.0"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
65
|
"@types/node": "^22.10.2",
|