lyra-plugin-onchain 0.1.1 → 0.1.5
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/package.json +2 -2
- package/src/capture-shim.ts +20 -0
- package/src/index.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lyra-plugin-onchain",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Sui on-chain tools for Lyra: SUI transfers, DeepBook market data, Walrus receipts/memory — every write policy-checked, simulated, and recorded on-chain via lyra::policy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@mysten/sui": "^1.40.0",
|
|
49
49
|
"@mysten/walrus": "^0.6.4",
|
|
50
50
|
"@scallop-io/sui-scallop-sdk": "^2.4.5",
|
|
51
|
-
"lyra-core": "^0.1.
|
|
51
|
+
"lyra-core": "^0.1.2",
|
|
52
52
|
"navi-sdk": "^1.7.3",
|
|
53
53
|
"zod": "^3.23.8"
|
|
54
54
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Bun's `Error.captureStackTrace` throws "First argument must be an Error object"
|
|
2
|
+
// for some calls `follow-redirects` makes at module-init time. follow-redirects is
|
|
3
|
+
// pulled in by axios → navi-sdk (imported statically by ./tools/navi), so loading
|
|
4
|
+
// this plugin under Bun used to crash the host (e.g. `lyra` chat, the gateway).
|
|
5
|
+
//
|
|
6
|
+
// Guard captureStackTrace so such calls are a harmless no-op instead of throwing —
|
|
7
|
+
// the affected error objects just won't carry a V8-captured stack. MUST be the
|
|
8
|
+
// first import in this package's entry, before anything pulls in navi-sdk.
|
|
9
|
+
const original = Error.captureStackTrace
|
|
10
|
+
if (typeof original === 'function') {
|
|
11
|
+
Error.captureStackTrace = ((target: object, ctor?: unknown) => {
|
|
12
|
+
try {
|
|
13
|
+
;(original as (t: object, c?: unknown) => void).call(Error, target, ctor)
|
|
14
|
+
} catch {
|
|
15
|
+
// Bun rejects some non-Error targets here — ignore.
|
|
16
|
+
}
|
|
17
|
+
}) as typeof Error.captureStackTrace
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {}
|
package/src/index.ts
CHANGED
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
* nothing — a graceful no-op for unit-test loaders.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
// MUST be first: guards Error.captureStackTrace before ./tools/navi pulls in
|
|
21
|
+
// navi-sdk → axios → follow-redirects, which crashes Bun at import otherwise.
|
|
22
|
+
import './capture-shim'
|
|
20
23
|
import type { NativePlugin, ToolDef } from 'lyra-core'
|
|
21
24
|
import { makeAccountInfo, makeSuiBalance } from './tools/balance'
|
|
22
25
|
import { makeCetusQuote } from './tools/cetus'
|