19 lines
547 B
TypeScript
Raw Normal View History

import RPCNode from '../rpc';
import RPCClient from '../rpc/client';
2018-01-29 20:41:59 -05:00
import { CustomNodeConfig } from 'types/node';
export default class CustomNode extends RPCNode {
constructor(config: CustomNodeConfig) {
const endpoint = `${config.url}:${config.port}`;
super(endpoint);
const headers: { [key: string]: string } = {};
if (config.auth) {
const { username, password } = config.auth;
headers.Authorization = `Basic ${btoa(`${username}:${password}`)}`;
}
this.client = new RPCClient(endpoint, headers);
}
}