aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rpc.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rpc.js')
-rw-r--r--lib/rpc.js38
1 files changed, 20 insertions, 18 deletions
diff --git a/lib/rpc.js b/lib/rpc.js
index b8a2d0dd..ec2ff879 100644
--- a/lib/rpc.js
+++ b/lib/rpc.js
@@ -4,23 +4,25 @@ export default ({ host, port, wallet, username, password }) =>
new Proxy(
{},
{
- get: (target, prop) => (...params) =>
- ((method, ...params) => {
- let url = `http://${host}:${port}/wallet/${wallet}`;
- return got
- .post(url, {
- json: {
- method,
- params
- },
- headers: {
- authorization: `Basic ${Buffer.from(
- `${username}:${password}`
- ).toString("base64")}`
- }
- })
- .json()
- .then(({ result }) => result);
- })(prop.toLowerCase(), ...params)
+ get:
+ (target, prop) =>
+ (...params) =>
+ ((method, ...params) => {
+ let url = `http://${host}:${port}/wallet/${wallet}`;
+ return got
+ .post(url, {
+ json: {
+ method,
+ params
+ },
+ headers: {
+ authorization: `Basic ${Buffer.from(
+ `${username}:${password}`
+ ).toString("base64")}`
+ }
+ })
+ .json()
+ .then(({ result }) => result);
+ })(prop.toLowerCase(), ...params)
}
);