Pear Worklet WDK
HRPC and framed JSON-RPC infrastructure for running WDK inside a Bare worklet
Pear Worklet WDK is the low-level transport and handler layer for running WDK inside a Bare worklet. It provides an HRPC client and server helper, a separate framed JSON-RPC server entrypoint for native hosts, and request payloads for WDK, wallet, protocol, and generic-module operations.
Powered by @tetherto/pear-wrk-wdk.
Features
- Bare worklet bridge: Connect a host app to a worklet through the shipped
HRPCclient and generated HRPC schema - Typed lifecycle requests: Initialize WDK with
initializeWDK({ config, encryptionKey, encryptedSeed })and tear it down withdispose() - Selective wallet resets: Re-register only the wallet modules listed in a new worklet
networksconfig usingresetWdkWallets({ config }) - Generic wallet and protocol calls: Call account methods through
callMethod({ methodName, network, accountIndex, args, options }), including Swidge protocols by name - Opt-in method allowlists: Restrict wallet and nested protocol calls for HRPC and JSON-RPC, plus generic-module calls on both transports
- Generic modules on both transports: Construct named modules during WDK initialization, call their methods with
callModule(), and forward declared events to the host - Framed JSON-RPC server: Register a length-prefixed JSON-RPC 2.0 server through
@tetherto/pear-wrk-wdk/jsonrpc - Suspend diagnostics: Opt in to handle snapshots during Bare suspend-to-idle transitions with
registerHandleLeakCheck() - Dynamic registration hooks: Register additional wallets or protocols with
registerWallet()andregisterProtocol()
Why this matters
- You can keep WDK state and signing operations off the main thread in Bare-based apps
- You can reconfigure selected wallet modules without fully disposing the worklet
- You can use one transport layer across custom mobile, desktop, or embedded Bare integrations
- You can host the same wallet and protocol handlers behind HRPC or a native JSON-RPC bridge, within each transport's supported method set
Use this package when you need direct control over the worklet host and RPC layer. If you want generated worklet entry files instead, start with @tetherto/wdk-worklet-bundler.
The top-level package exports the HRPC runtime value. Import registerRpcHandlers() from @tetherto/pear-wrk-wdk/worklet and registerJsonRpcHandlers() from @tetherto/pear-wrk-wdk/jsonrpc.
In v1.0.0-beta.13, a missing wallet or protocol method returns BAD_REQUEST even if the caller supplies options.defaultValue. Handle unsupported methods in the host. The package does not export a pre-built WDK bundle.
Pear Worklet WDK Configuration
Build HRPC or JSON-RPC contexts and configure WDK, wallet, protocol, and generic-module initialization
Pear Worklet WDK API Reference
Review the exported class, server helper, and request shapes