@lifi/perps-sdk-provider-lighter 22.1.0 → 22.1.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 +20 -1
- package/dist/cjs/signers/generated/wasmExecRuntime.d.ts +4 -1
- package/dist/cjs/signers/generated/wasmExecRuntime.d.ts.map +1 -1
- package/dist/cjs/signers/generated/wasmExecRuntime.js +470 -566
- package/dist/cjs/signers/generated/wasmExecRuntime.js.map +1 -1
- package/dist/cjs/signers/wasmLoader.d.ts.map +1 -1
- package/dist/cjs/signers/wasmLoader.js +1 -3
- package/dist/cjs/signers/wasmLoader.js.map +1 -1
- package/dist/esm/signers/generated/wasmExecRuntime.d.ts +5 -7
- package/dist/esm/signers/generated/wasmExecRuntime.d.ts.map +1 -1
- package/dist/esm/signers/generated/wasmExecRuntime.js +507 -571
- package/dist/esm/signers/generated/wasmExecRuntime.js.map +1 -1
- package/dist/esm/signers/wasmLoader.d.ts.map +1 -1
- package/dist/esm/signers/wasmLoader.js +2 -11
- package/dist/esm/signers/wasmLoader.js.map +1 -1
- package/dist/types/signers/generated/wasmExecRuntime.d.ts +5 -7
- package/dist/types/signers/generated/wasmExecRuntime.d.ts.map +1 -1
- package/dist/types/signers/wasmLoader.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/signers/generated/wasmExecRuntime.ts +570 -572
- package/src/signers/wasmLoader.ts +2 -17
package/README.md
CHANGED
|
@@ -53,7 +53,11 @@ Each provider instance shares one request hold across its Lighter API clients, p
|
|
|
53
53
|
|
|
54
54
|
## WASM signer loading
|
|
55
55
|
|
|
56
|
-
The Go signer binary ships as a separate asset
|
|
56
|
+
The Go signer binary ships as a separate asset that the package resolves itself. The ESM build uses `new URL('../../wasm/lighter-signer.wasm', import.meta.url)`. Webpack, Turbopack, and Vite production builds rewrite this expression into an emitted asset URL. Node reads the installed binary from disk. The loader checks the WASM preamble of the response. Vite's dependency optimizer can relocate the package into `.vite/deps`, which invalidates the static URL. The loader then resolves the asset through the bundler's own asset pipeline.
|
|
57
|
+
|
|
58
|
+
Go's `wasm_exec.js` ships inside a generated initializer that compiles into both CommonJS and ESM. Package imports do not initialize Go or install its globals. `loadLighterWasm()` initializes the runtime after reading the binary, so callers can install required polyfills after import. The package evaluates no script text.
|
|
59
|
+
|
|
60
|
+
Under a Content Security Policy, `script-src` must include `'wasm-unsafe-eval'` so the browser can run `WebAssembly.instantiate`. `'unsafe-eval'` is not required.
|
|
57
61
|
|
|
58
62
|
Applications need no `optimizeDeps.exclude`, no `?url`/`?raw` imports, no `public/` copy step, no caller-supplied URL and no bundler configuration. `loadLighterWasm()` is exported for hosts that want to warm the signer up (and its 12.9 MB download) before the user's first trade:
|
|
59
63
|
|
|
@@ -63,6 +67,21 @@ import { loadLighterWasm } from '@lifi/perps-sdk-provider-lighter'
|
|
|
63
67
|
await loadLighterWasm()
|
|
64
68
|
```
|
|
65
69
|
|
|
70
|
+
## Consumer verification
|
|
71
|
+
|
|
72
|
+
Run these commands from the repository root:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
pnpm --filter @lifi/perps-sdk-provider-lighter exec playwright install chromium
|
|
76
|
+
pnpm --filter @lifi/perps-sdk-provider-lighter test:consumers
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
On Linux systems without browser libraries, use `playwright install --with-deps chromium` for the installation step.
|
|
80
|
+
|
|
81
|
+
The four Next targets execute the client probe in headless Chromium. They cover development and production with webpack and Turbopack. Browser exceptions, failed probes, missing results, and invalid WASM responses fail the checks. The checks also verify the emitted asset and its chunk reference.
|
|
82
|
+
|
|
83
|
+
Playwright is a development dependency. SDK consumers do not need it.
|
|
84
|
+
|
|
66
85
|
## Documentation
|
|
67
86
|
|
|
68
87
|
- [`@lifi/perps-sdk` README](https://www.npmjs.com/package/@lifi/perps-sdk) — client setup, options, and the WebSocket API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wasmExecRuntime.d.ts","sourceRoot":"","sources":["../../../../src/signers/generated/wasmExecRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wasmExecRuntime.d.ts","sourceRoot":"","sources":["../../../../src/signers/generated/wasmExecRuntime.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,IAAI;IACjC,YAAY,EAAE,WAAW,CAAC,OAAO,CAAA;IACjC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD,CAojBA"}
|