@xyo-network/xl1-sdk 1.28.0 → 1.28.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.
- package/README.md +170 -6
- package/package.json +65 -65
package/README.md
CHANGED
|
@@ -1,24 +1,188 @@
|
|
|
1
|
+
[![logo][]][logo-link]
|
|
2
|
+
|
|
1
3
|
# @xyo-network/xl1-sdk
|
|
2
4
|
|
|
3
|
-
[![npm
|
|
4
|
-
[![license
|
|
5
|
+
[![npm-badge][]][npm-link]
|
|
6
|
+
[![license-badge][]][license-link]
|
|
7
|
+
|
|
8
|
+
> The official TypeScript SDK for the XL1 blockchain — gateways, providers, RPC, and protocol primitives in one install.
|
|
9
|
+
|
|
10
|
+
## Table of Contents
|
|
11
|
+
|
|
12
|
+
- [Description](#description)
|
|
13
|
+
- [Install](#install)
|
|
14
|
+
- [Quick Start](#quick-start)
|
|
15
|
+
- [Subpath Exports](#subpath-exports)
|
|
16
|
+
- [API Surface](#api-surface)
|
|
17
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
18
|
+
- [Building Locally](#building-locally)
|
|
19
|
+
- [Maintainers](#maintainers)
|
|
20
|
+
- [License](#license)
|
|
21
|
+
- [Credits](#credits)
|
|
22
|
+
|
|
23
|
+
## Description
|
|
24
|
+
|
|
25
|
+
XL1 is the XYO Layer One blockchain — a proof-of-origin, proof-of-perfect chain built on the XYO Protocol. This package is the primary entry point for **non-React** TypeScript and JavaScript developers — Node.js services, CLIs, indexers, scripts, and any code that needs to read from or write to XL1.
|
|
26
|
+
|
|
27
|
+
It's a single barrel re-exporting six focused sub-packages:
|
|
28
|
+
|
|
29
|
+
- `@xyo-network/xl1-protocol` — type definitions, schemas, and validation
|
|
30
|
+
- `@xyo-network/xl1-protocol-sdk` — config (cosmiconfig), caching (LRU), helpers
|
|
31
|
+
- `@xyo-network/xl1-rpc` — JSON-RPC method handlers and schemas
|
|
32
|
+
- `@xyo-network/xl1-providers` — neutral / Node / browser providers
|
|
33
|
+
- `@xyo-network/xl1-gateway` — `GatewayBuilder` and the read/write gateway runtime
|
|
34
|
+
- `@xyo-network/xl1-wrappers` — payload and bound-witness wrappers
|
|
5
35
|
|
|
6
|
-
|
|
36
|
+
Install it once and you have everything you need to construct a gateway, read chain state, and submit transactions. For React-specific bindings (providers, hooks, MUI components), use [`@xyo-network/xl1-react-client-sdk`](https://www.npmjs.com/package/@xyo-network/xl1-react-client-sdk) instead.
|
|
7
37
|
|
|
8
38
|
## Install
|
|
9
39
|
|
|
40
|
+
Using npm:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm i --save @xyo-network/xl1-sdk
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Using yarn:
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
yarn add @xyo-network/xl1-sdk
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Using pnpm:
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pnpm add @xyo-network/xl1-sdk
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Using bun:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
bun add @xyo-network/xl1-sdk
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
Construct a read-only gateway and query the current block:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { GatewayBuilder } from '@xyo-network/xl1-sdk'
|
|
70
|
+
|
|
71
|
+
const gateway = await new GatewayBuilder()
|
|
72
|
+
.rpcUrl('https://beta.api.chain.xyo.network/rpc')
|
|
73
|
+
.build()
|
|
74
|
+
|
|
75
|
+
const viewer = gateway.connection.viewer
|
|
76
|
+
const blockNumber = await viewer.block.currentBlockNumber()
|
|
77
|
+
|
|
78
|
+
console.log(`Current block on sequence: ${blockNumber}`)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The `viewer` exposes typed query interfaces for blocks, accounts, transactions, and time. To submit transactions, attach a signer with `.signer(account)` on the builder — that promotes the result to an `XyoGatewayRunner`, which extends the read-only `XyoGateway` with write methods.
|
|
82
|
+
|
|
83
|
+
Common public endpoints:
|
|
84
|
+
|
|
85
|
+
- Mainnet — `https://api.chain.xyo.network/rpc`
|
|
86
|
+
- Sequence (testnet) — `https://beta.api.chain.xyo.network/rpc`
|
|
87
|
+
- Local rpc-server — `http://localhost:8080/rpc`
|
|
88
|
+
|
|
89
|
+
For programmatic network selection use `DefaultNetworks` from the barrel rather than hard-coding URLs.
|
|
90
|
+
|
|
91
|
+
## Subpath Exports
|
|
92
|
+
|
|
93
|
+
- `@xyo-network/xl1-sdk` — flat barrel of all six sub-packages
|
|
94
|
+
- `@xyo-network/xl1-sdk/test` — shared test utilities (stub block viewers, fixtures) for use in your own integration tests
|
|
95
|
+
|
|
96
|
+
## API Surface
|
|
97
|
+
|
|
98
|
+
The barrel re-exports the full surface of each sub-package. The handful of symbols most consumers reach for first:
|
|
99
|
+
|
|
100
|
+
**Gateway construction**
|
|
101
|
+
|
|
102
|
+
- `GatewayBuilder` — fluent factory; produces an `XyoGateway` (read-only) or `XyoGatewayRunner` (read + write, when a signer is attached)
|
|
103
|
+
- `XyoGateway`, `XyoGatewayRunner` — runtime interfaces with `.connection.viewer` for queries
|
|
104
|
+
|
|
105
|
+
**Viewers (under `gateway.connection.viewer`)**
|
|
106
|
+
|
|
107
|
+
- `viewer.block` — `currentBlockNumber()`, `block(id)`, etc.
|
|
108
|
+
- `viewer.account` — balances, nonces, account state
|
|
109
|
+
- `viewer.transaction` — transaction lookup
|
|
110
|
+
- `viewer.time` — chain time queries
|
|
111
|
+
|
|
112
|
+
**Providers**
|
|
113
|
+
|
|
114
|
+
- Neutral/Node/Browser provider variants for transports, with OpenTelemetry hooks built in
|
|
115
|
+
|
|
116
|
+
**Wrappers**
|
|
117
|
+
|
|
118
|
+
- Payload and bound-witness wrappers from `xl1-wrappers` for working with raw protocol messages
|
|
119
|
+
|
|
120
|
+
See the generated `.d.ts` files for the full surface, or the per-package `CLAUDE.md` files in the monorepo for deeper patterns.
|
|
121
|
+
|
|
122
|
+
## Peer Dependencies
|
|
123
|
+
|
|
124
|
+
This package declares its runtime stack via `peerDependencies` so the host app controls the versions. Headline peers:
|
|
125
|
+
|
|
126
|
+
- `ethers` `>=6.16.0 <7`
|
|
127
|
+
- `@metamask/json-rpc-engine`, `@metamask/providers`, `@metamask/utils`
|
|
128
|
+
- `@opentelemetry/api`, `@opentelemetry/sdk-trace-base`
|
|
129
|
+
- `@xyo-network/sdk-js`, `@xyo-network/sdk-protocol-js`, `@xyo-network/account`, `@xyo-network/payload-*`, `@xyo-network/boundwitness-*`
|
|
130
|
+
- `zod`, `ajv`, `cosmiconfig`, `lru-cache`
|
|
131
|
+
|
|
132
|
+
The full list — including the supporting `@xylabs/*` and `@xyo-network/*` packages — is in [`package.json`](./package.json). If your build complains about an unsatisfied peer, install it with the version range shown there.
|
|
133
|
+
|
|
134
|
+
## Building Locally
|
|
135
|
+
|
|
136
|
+
From the repo root:
|
|
137
|
+
|
|
10
138
|
```sh
|
|
11
|
-
|
|
139
|
+
xy build # tsup + tsc + publint
|
|
140
|
+
xy test # vitest
|
|
141
|
+
xy lint # eslint
|
|
12
142
|
```
|
|
13
143
|
|
|
144
|
+
Scope to this package by appending its name: `xy build @xyo-network/xl1-sdk`.
|
|
145
|
+
|
|
146
|
+
## Maintainers
|
|
147
|
+
|
|
148
|
+
<table>
|
|
149
|
+
<tr>
|
|
150
|
+
<td align="center" valign="top" width="120">
|
|
151
|
+
<a href="https://github.com/arietrouw">
|
|
152
|
+
<img src="https://github.com/arietrouw.png" width="80" height="80" alt="Arie Trouw" /><br />
|
|
153
|
+
<sub><b>Arie Trouw</b></sub>
|
|
154
|
+
</a>
|
|
155
|
+
<br />
|
|
156
|
+
<a href="https://arietrouw.com">arietrouw.com</a>
|
|
157
|
+
</td>
|
|
158
|
+
<td align="center" valign="top" width="120">
|
|
159
|
+
<a href="https://github.com/jonesmac">
|
|
160
|
+
<img src="https://github.com/jonesmac.png" width="80" height="80" alt="Matt Jones" /><br />
|
|
161
|
+
<sub><b>Matt Jones</b></sub>
|
|
162
|
+
</a>
|
|
163
|
+
</td>
|
|
164
|
+
<td align="center" valign="top" width="120">
|
|
165
|
+
<a href="https://github.com/JoelBCarter">
|
|
166
|
+
<img src="https://github.com/JoelBCarter.png" width="80" height="80" alt="Joel Carter" /><br />
|
|
167
|
+
<sub><b>Joel Carter</b></sub>
|
|
168
|
+
</a>
|
|
169
|
+
</td>
|
|
170
|
+
</tr>
|
|
171
|
+
</table>
|
|
14
172
|
|
|
15
173
|
## License
|
|
16
174
|
|
|
17
|
-
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
175
|
+
See the [LICENSE](./LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
176
|
+
|
|
177
|
+
## Credits
|
|
18
178
|
|
|
179
|
+
[Made with 🔥 and ❄️ by XYO](https://xyo.network)
|
|
19
180
|
|
|
181
|
+
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
182
|
+
[logo-link]: https://xyo.network
|
|
20
183
|
|
|
21
184
|
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/xl1-sdk.svg
|
|
22
185
|
[npm-link]: https://www.npmjs.com/package/@xyo-network/xl1-sdk
|
|
186
|
+
|
|
23
187
|
[license-badge]: https://img.shields.io/npm/l/@xyo-network/xl1-sdk.svg
|
|
24
|
-
[license-link]:
|
|
188
|
+
[license-link]: ./LICENSE
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/xl1-sdk",
|
|
4
|
-
"version": "1.28.
|
|
4
|
+
"version": "1.28.2",
|
|
5
5
|
"description": "XYO Layer One Protocol",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"README.md"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@xyo-network/xl1-gateway": "~1.28.
|
|
43
|
-
"@xyo-network/xl1-protocol": "~1.28.
|
|
44
|
-
"@xyo-network/xl1-protocol-sdk": "~1.28.
|
|
45
|
-
"@xyo-network/xl1-
|
|
46
|
-
"@xyo-network/xl1-
|
|
47
|
-
"@xyo-network/xl1-
|
|
42
|
+
"@xyo-network/xl1-gateway": "~1.28.2",
|
|
43
|
+
"@xyo-network/xl1-protocol": "~1.28.2",
|
|
44
|
+
"@xyo-network/xl1-protocol-sdk": "~1.28.2",
|
|
45
|
+
"@xyo-network/xl1-wrappers": "~1.28.2",
|
|
46
|
+
"@xyo-network/xl1-providers": "~1.28.2",
|
|
47
|
+
"@xyo-network/xl1-rpc": "~1.28.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@bitauth/libauth": "~3.0.0",
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"@xylabs/geo": "^5.1.1",
|
|
60
60
|
"@xylabs/sdk-js": "^5.1.1",
|
|
61
61
|
"@xylabs/threads": "~5.1.1",
|
|
62
|
-
"@xylabs/toolchain": "~7.13.
|
|
63
|
-
"@xylabs/tsconfig": "~7.13.
|
|
62
|
+
"@xylabs/toolchain": "~7.13.13",
|
|
63
|
+
"@xylabs/tsconfig": "~7.13.13",
|
|
64
64
|
"@xylabs/vitest-extended": "^5.1.1",
|
|
65
65
|
"@xyo-network/account": "~5.6.1",
|
|
66
66
|
"@xyo-network/account-model": "~5.6.2",
|
|
@@ -106,64 +106,64 @@
|
|
|
106
106
|
"wasm-feature-detect": "~1.8.0",
|
|
107
107
|
"webextension-polyfill": "^0.12.0",
|
|
108
108
|
"zod": "~4.4.3",
|
|
109
|
-
"@xyo-network/xl1-protocol-
|
|
110
|
-
"@xyo-network/xl1-
|
|
111
|
-
"@xyo-network/xl1-
|
|
112
|
-
"@xyo-network/xl1-
|
|
113
|
-
"@xyo-network/xl1-test": "~1.28.
|
|
114
|
-
"@xyo-network/xl1-
|
|
109
|
+
"@xyo-network/xl1-protocol-lib": "~1.28.2",
|
|
110
|
+
"@xyo-network/xl1-network-model": "~1.28.2",
|
|
111
|
+
"@xyo-network/xl1-protocol-model": "~1.28.2",
|
|
112
|
+
"@xyo-network/xl1-schema": "~1.28.2",
|
|
113
|
+
"@xyo-network/xl1-test": "~1.28.2",
|
|
114
|
+
"@xyo-network/xl1-validation": "~1.28.2"
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
|
-
"@bitauth/libauth": "
|
|
118
|
-
"@metamask/json-rpc-engine": "
|
|
119
|
-
"@metamask/providers": "
|
|
120
|
-
"@metamask/utils": "
|
|
121
|
-
"@opentelemetry/api": "
|
|
122
|
-
"@opentelemetry/sdk-trace-base": "
|
|
123
|
-
"@scure/base": "
|
|
124
|
-
"@scure/bip39": "
|
|
125
|
-
"@xylabs/fetch": "
|
|
126
|
-
"@xylabs/geo": "
|
|
127
|
-
"@xylabs/sdk-js": "
|
|
128
|
-
"@xylabs/threads": "
|
|
129
|
-
"@xyo-network/account": "
|
|
130
|
-
"@xyo-network/account-model": "
|
|
131
|
-
"@xyo-network/api": "
|
|
132
|
-
"@xyo-network/api-models": "
|
|
133
|
-
"@xyo-network/boundwitness-builder": "
|
|
134
|
-
"@xyo-network/boundwitness-model": "
|
|
135
|
-
"@xyo-network/boundwitness-wrapper": "
|
|
136
|
-
"@xyo-network/config-payload-plugin": "
|
|
137
|
-
"@xyo-network/huri": "
|
|
138
|
-
"@xyo-network/manifest-model": "
|
|
139
|
-
"@xyo-network/payload-builder": "
|
|
140
|
-
"@xyo-network/payload-model": "
|
|
141
|
-
"@xyo-network/payload-plugin": "
|
|
142
|
-
"@xyo-network/payload-wrapper": "
|
|
143
|
-
"@xyo-network/query-payload-plugin": "
|
|
144
|
-
"@xyo-network/sdk-js": "
|
|
145
|
-
"@xyo-network/sdk-protocol-js": "
|
|
146
|
-
"@xyo-network/wallet": "
|
|
147
|
-
"@xyo-network/wallet-model": "
|
|
148
|
-
"ajv": "
|
|
149
|
-
"async-mutex": "
|
|
150
|
-
"bn.js": "
|
|
151
|
-
"buffer": "
|
|
152
|
-
"chalk": "
|
|
153
|
-
"cosmiconfig": "
|
|
154
|
-
"debug": "
|
|
155
|
-
"ethers": "
|
|
156
|
-
"hash-wasm": "
|
|
157
|
-
"idb": "
|
|
158
|
-
"lru-cache": "
|
|
159
|
-
"mapbox-gl": "
|
|
160
|
-
"observable-fns": "
|
|
161
|
-
"pako": "
|
|
162
|
-
"store2": "
|
|
163
|
-
"uuid": "
|
|
164
|
-
"wasm-feature-detect": "
|
|
165
|
-
"webextension-polyfill": "
|
|
166
|
-
"zod": "
|
|
117
|
+
"@bitauth/libauth": "~3.0",
|
|
118
|
+
"@metamask/json-rpc-engine": "^10.3",
|
|
119
|
+
"@metamask/providers": "^22.1",
|
|
120
|
+
"@metamask/utils": "^11.11",
|
|
121
|
+
"@opentelemetry/api": "^1.9",
|
|
122
|
+
"@opentelemetry/sdk-trace-base": "^2.7",
|
|
123
|
+
"@scure/base": "~2.2",
|
|
124
|
+
"@scure/bip39": "~2.2",
|
|
125
|
+
"@xylabs/fetch": "^5.1",
|
|
126
|
+
"@xylabs/geo": "^5.1",
|
|
127
|
+
"@xylabs/sdk-js": "^5.1",
|
|
128
|
+
"@xylabs/threads": "~5.1",
|
|
129
|
+
"@xyo-network/account": "~5.6",
|
|
130
|
+
"@xyo-network/account-model": "~5.6",
|
|
131
|
+
"@xyo-network/api": "~5.6",
|
|
132
|
+
"@xyo-network/api-models": "~5.6",
|
|
133
|
+
"@xyo-network/boundwitness-builder": "~5.6",
|
|
134
|
+
"@xyo-network/boundwitness-model": "~5.6",
|
|
135
|
+
"@xyo-network/boundwitness-wrapper": "~5.6",
|
|
136
|
+
"@xyo-network/config-payload-plugin": "~5.6",
|
|
137
|
+
"@xyo-network/huri": "~5.6",
|
|
138
|
+
"@xyo-network/manifest-model": "~5.6",
|
|
139
|
+
"@xyo-network/payload-builder": "~5.6",
|
|
140
|
+
"@xyo-network/payload-model": "~5.6",
|
|
141
|
+
"@xyo-network/payload-plugin": "~5.6",
|
|
142
|
+
"@xyo-network/payload-wrapper": "~5.6",
|
|
143
|
+
"@xyo-network/query-payload-plugin": "~5.6",
|
|
144
|
+
"@xyo-network/sdk-js": "^5.6",
|
|
145
|
+
"@xyo-network/sdk-protocol-js": "~5.6",
|
|
146
|
+
"@xyo-network/wallet": "~5.6",
|
|
147
|
+
"@xyo-network/wallet-model": "^5.6",
|
|
148
|
+
"ajv": "^8.20",
|
|
149
|
+
"async-mutex": "^0.5",
|
|
150
|
+
"bn.js": "^5.2",
|
|
151
|
+
"buffer": "^6.0",
|
|
152
|
+
"chalk": "^5.6",
|
|
153
|
+
"cosmiconfig": "^9.0",
|
|
154
|
+
"debug": "~4.4",
|
|
155
|
+
"ethers": "^6.16",
|
|
156
|
+
"hash-wasm": "~4.12",
|
|
157
|
+
"idb": "^8.0",
|
|
158
|
+
"lru-cache": "^11.3",
|
|
159
|
+
"mapbox-gl": "^3.23",
|
|
160
|
+
"observable-fns": "~0.6",
|
|
161
|
+
"pako": "^2.1",
|
|
162
|
+
"store2": "~2.14",
|
|
163
|
+
"uuid": "~14.0",
|
|
164
|
+
"wasm-feature-detect": "~1.8",
|
|
165
|
+
"webextension-polyfill": "^0.12",
|
|
166
|
+
"zod": "~4.4"
|
|
167
167
|
},
|
|
168
168
|
"engines": {
|
|
169
169
|
"node": ">=22.3"
|