@neuraiproject/neurai-sign-esp32 0.3.2 → 0.4.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 +40 -2
- package/dist/NeuraiSignESP32.global.js +12662 -0
- package/dist/browser.js +12640 -0
- package/dist/index.cjs +12358 -493
- package/dist/index.d.ts +116 -47
- package/dist/index.js +12640 -0
- package/package.json +21 -13
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -772
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -31,6 +31,21 @@ asset name, transferred amount, destination address, and fee more clearly.
|
|
|
31
31
|
npm i @neuraiproject/neurai-sign-esp32
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
For browser-specific consumption you can also import the explicit browser entry:
|
|
35
|
+
|
|
36
|
+
```javascript
|
|
37
|
+
import { NeuraiESP32 } from "@neuraiproject/neurai-sign-esp32/browser";
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
For classic HTML pages without ESM imports, load the global bundle:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<script src="./dist/NeuraiSignESP32.global.js"></script>
|
|
44
|
+
<script>
|
|
45
|
+
const device = new window.NeuraiSignESP32.NeuraiESP32();
|
|
46
|
+
</script>
|
|
47
|
+
```
|
|
48
|
+
|
|
34
49
|
## How to use
|
|
35
50
|
|
|
36
51
|
### Full transaction flow
|
|
@@ -191,6 +206,30 @@ if (!NeuraiESP32.isSupported()) {
|
|
|
191
206
|
}
|
|
192
207
|
```
|
|
193
208
|
|
|
209
|
+
## Manual browser smoke test
|
|
210
|
+
|
|
211
|
+
There is a minimal browser smoke harness at
|
|
212
|
+
[`examples/browser-smoke.html`](/home/mark/src/AAA-experimento/neurai-sign-esp32/examples/browser-smoke.html)
|
|
213
|
+
that imports the generated browser ESM bundle from `dist/browser.js`.
|
|
214
|
+
|
|
215
|
+
Suggested flow:
|
|
216
|
+
|
|
217
|
+
1. Run `npm run build`.
|
|
218
|
+
2. Serve the repository root over HTTP, for example `python3 -m http.server 8000`.
|
|
219
|
+
3. Open `http://localhost:8000/examples/browser-smoke.html` in Chrome or Edge.
|
|
220
|
+
4. Confirm the startup checks render in the page.
|
|
221
|
+
5. Click `Request Serial Port` and verify the port picker, `getInfo()` response and clean disconnect.
|
|
222
|
+
|
|
223
|
+
## Build outputs
|
|
224
|
+
|
|
225
|
+
After `npm run build`, the package publishes:
|
|
226
|
+
|
|
227
|
+
- `dist/index.js`: primary ESM entry
|
|
228
|
+
- `dist/index.cjs`: CommonJS entry
|
|
229
|
+
- `dist/browser.js`: explicit browser ESM entry
|
|
230
|
+
- `dist/NeuraiSignESP32.global.js`: IIFE bundle exposing `globalThis.NeuraiSignESP32`
|
|
231
|
+
- `dist/index.d.ts`: public types
|
|
232
|
+
|
|
194
233
|
## UTXO requirements
|
|
195
234
|
|
|
196
235
|
Each UTXO requires the `rawTxHex` field — the full raw hex of the previous
|
|
@@ -220,8 +259,7 @@ firmware's `Serial.read()` loop cannot drain the buffer fast enough if the
|
|
|
220
259
|
host flushes several kilobytes at once.
|
|
221
260
|
|
|
222
261
|
This library works around the problem by splitting every outgoing message into
|
|
223
|
-
**
|
|
224
|
-
approach used in the reference web wallet (`NeuraiHWSerial.writeChunked`).
|
|
262
|
+
**256-byte chunks** with a **8 ms pause** between each one.
|
|
225
263
|
|
|
226
264
|
The newline terminator (`\n`) is sent separately after all chunks, so the
|
|
227
265
|
firmware only processes the command once the full JSON has arrived.
|