diff options
| author | Adam Soltys <[email protected]> | 2024-09-08 22:13:49 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-08 22:13:49 -0700 |
| commit | 9473aad794f36a5ce41909f64a9acf4e082466ad (patch) | |
| tree | e8f7cbc1fadb8010c01bb93b77cfa533bc25cdac /lib/rpc.ts | |
| parent | 5c105c8f4738ab1ead3c5b92f465f899cf0a7446 (diff) | |
| download | coinos-server-9473aad794f36a5ce41909f64a9acf4e082466ad.tar.gz coinos-server-9473aad794f36a5ce41909f64a9acf4e082466ad.zip | |
package rpc
Diffstat (limited to 'lib/rpc.ts')
| -rw-r--r-- | lib/rpc.ts | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -1,19 +1,2 @@ -import got from "got"; -import { fail } from "$lib/utils"; -import { err } from "$lib/logging"; - -export default ({ host, port, wallet, username, password }): any => { - let url = `http://${host}:${port}/wallet/${wallet}`; - let token = btoa(`${username}:${password}`); - let headers = { authorization: `Basic ${token}` }; - let p = (json) => got.post(url, { json, headers }).json(); - - let get = - (_, prop: any) => - (...params) => - p({ method: prop.toLowerCase(), params }) - .then((res: any) => res.result) - .catch((e) => (err(e.message), fail(`Failed to call ${prop}`))); - - return new Proxy({}, { get }); -}; +import rpc from "@coinos/rpc"; +export default rpc; |
