Instance Method
send(_:path:)
Sends a JSON-RPC request directly to the in-process bitcoin_rpc() C bridge.
func send(_ request: JSONRPCRequest, path: String?) async throws -> Data
Discussion
bitcoin_rpc() is synchronous and may block indefinitely waiting for internal locks (e.g. cs_main during initial block download). To honor Swift concurrency’s forward-progress contract, the blocking call is dispatched to a GCD thread and bridged back via a checked continuation.
If the call does not complete within timeout seconds, the continuation resumes with a timeout error. The underlying C call continues on its GCD thread — its memory is freed when it returns.
Wallet-scoped calls (non-nil path) are not supported over the direct transport and throw RPCClientError.walletPathNotSupported.