rpc-client/dist/query/simple.js

22 lines
637 B
JavaScript
Raw Normal View History

2022-08-28 06:33:49 +00:00
import RpcQueryBase from "./base.js";
export default class SimpleRpcQuery extends RpcQueryBase {
_relay;
constructor(network, relay, query, options) {
super(network, query, options);
this._relay = relay;
}
checkResponses() {
if (Object.keys(this._responses).length) {
this.resolve(Object.values(this._responses).pop());
return;
}
if (Object.keys(this._errors).length) {
2022-09-10 02:13:47 +00:00
const error = Object.values(this._errors).pop();
this.resolve(error, error === "timeout");
2022-08-28 06:33:49 +00:00
}
}
getRelays() {
return [this._relay];
}
}