@toon-protocol/client 0.10.0 → 0.12.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 +1 -26
- package/dist/index.d.ts +576 -385
- package/dist/index.js +483 -193
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/dist/anon-proxy-W3KMM7GU.js +0 -23
- package/dist/anon-proxy-W3KMM7GU.js.map +0 -1
- package/dist/chunk-WHAEQLIW.js +0 -276
- package/dist/chunk-WHAEQLIW.js.map +0 -1
- package/dist/gateway-QOK47RKS.js +0 -13
- package/dist/gateway-QOK47RKS.js.map +0 -1
- package/dist/socks5-WTJBYGME.js +0 -136
- package/dist/socks5-WTJBYGME.js.map +0 -1
package/README.md
CHANGED
|
@@ -23,7 +23,6 @@ This client handles:
|
|
|
23
23
|
- **Unified Identity**: One Nostr key = one EVM address (both secp256k1, derived automatically) — or a single BIP-39 **mnemonic** to derive a full multi-chain identity
|
|
24
24
|
- **Multi-Chain Settlement**: Sign payment-channel claims on EVM (EIP-712), Solana (Ed25519), and Mina (Pallas) from one mnemonic. A Townhouse apex validates the claim and redeems it on-chain on the matching chain (EVM/Solana credit the recipient; Mina redeems each claim on-chain with recipient credit-at-close deferred — see [Multi-Chain Settlement notes](#identity--multi-chain-settlement))
|
|
25
25
|
- **Multi-Hop Routing**: Publish to any destination address (`destination` / `destinationAddress`), not just your direct peer
|
|
26
|
-
- **Private Transport**: Optionally reach a townhouse apex at its ATOR `.anyone` address through a SOCKS5h proxy (see [Connecting over `.anyone`](#connecting-to-an-apex-over-anyone))
|
|
27
26
|
- **Network Bootstrap**: Automatically discover and register with ILP peers via NIP-02 follow lists
|
|
28
27
|
- **TOON Encoding**: Native binary format for agent-friendly event encoding
|
|
29
28
|
|
|
@@ -44,8 +43,7 @@ pnpm add mina-signer
|
|
|
44
43
|
- **A TOON apex to pay.** You don't run any node yourself; you connect to a running
|
|
45
44
|
[`@toon-protocol/townhouse`](https://www.npmjs.com/package/@toon-protocol/townhouse) apex (or any
|
|
46
45
|
TOON connector) and pay it. From its operator you need:
|
|
47
|
-
- a **connector endpoint** —
|
|
48
|
-
through a **SOCKS5h** proxy (see [Connecting over `.anyone`](#connecting-to-an-apex-over-anyone));
|
|
46
|
+
- a **connector endpoint** — an HTTP `connectorUrl` and/or a BTP WebSocket `btpUrl`;
|
|
49
47
|
- a **settlement-chain RPC URL** and a **funded key** on that chain, so the client can open a
|
|
50
48
|
payment channel and sign EIP-712 claims;
|
|
51
49
|
- the **token** and **TokenNetwork** contract addresses that apex accepts on that chain (e.g. USDC).
|
|
@@ -256,29 +254,6 @@ const client = new ToonClient({
|
|
|
256
254
|
|
|
257
255
|
---
|
|
258
256
|
|
|
259
|
-
## Connecting to an apex over `.anyone`
|
|
260
|
-
|
|
261
|
-
In production a townhouse apex is reachable at an ATOR `.anyone` hidden-service address rather than a plain `ws://` host. To dial it, route the client's BTP/HTTP traffic through a **SOCKS5h** proxy via the `transport` option. The `socks5h://` scheme is required so DNS resolution happens at the proxy (no DNS leaks):
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
const client = new ToonClient({
|
|
265
|
-
connectorUrl: 'http://localhost:8080', // local connector admin, if any
|
|
266
|
-
secretKey,
|
|
267
|
-
ilpInfo: { pubkey, ilpAddress: `g.toon.${pubkey.slice(0, 8)}`, btpEndpoint: 'ws://abc...xyz.anyone:3000' },
|
|
268
|
-
btpUrl: 'ws://abc...xyz.anyone:3000', // the apex's BTP endpoint at its .anyone address
|
|
269
|
-
destinationAddress: 'g.townhouse', // pay the apex; it forwards to the town/dvm/mill child
|
|
270
|
-
toonEncoder: encodeEventToToon,
|
|
271
|
-
toonDecoder: decodeEventFromToon,
|
|
272
|
-
|
|
273
|
-
// Route the connection through a SOCKS5h proxy (Node.js only).
|
|
274
|
-
transport: { type: 'socks5', socksProxy: 'socks5h://127.0.0.1:9050' },
|
|
275
|
-
});
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
In the browser, use `transport: { type: 'gateway', gatewayUrl: 'https://…' }` to proxy through an ator gateway server-side instead. (Default is `{ type: 'direct' }`.)
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
257
|
## Documentation
|
|
283
258
|
|
|
284
259
|
- **[API Reference](docs/api-reference.md)** — Constructor, config interface, and all methods
|