*Update StreamingRpcQuery result to handle connectModule properly
This commit is contained in:
parent
b3e6290a73
commit
1e3e8f35bc
14
src/index.ts
14
src/index.ts
|
@ -6,6 +6,7 @@ import {
|
||||||
StreamingRpcQueryOptions,
|
StreamingRpcQueryOptions,
|
||||||
} from "@lumeweb/dht-rpc-client";
|
} from "@lumeweb/dht-rpc-client";
|
||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
|
import { DataFn } from "libskynet/dist";
|
||||||
|
|
||||||
const RPC_MODULE = "AQDaEPIo_lpdvz7AKbeafERBHR331RiyvweJ6OrFTplzyg";
|
const RPC_MODULE = "AQDaEPIo_lpdvz7AKbeafERBHR331RiyvweJ6OrFTplzyg";
|
||||||
|
|
||||||
|
@ -267,6 +268,19 @@ export class StreamingRpcQuery extends SimpleRpcQuery {
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get result(): Promise<RPCResponse> {
|
||||||
|
return (this._promise as Promise<any>)
|
||||||
|
.then(
|
||||||
|
(result): [sendUpdate: DataFn, response: Promise<ErrTuple>] => result[1]
|
||||||
|
)
|
||||||
|
.then((response: any) => {
|
||||||
|
if (response[1]) {
|
||||||
|
return { error: response[1] };
|
||||||
|
}
|
||||||
|
return response[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class WisdomRpcQuery extends RpcQueryBase {
|
export class WisdomRpcQuery extends RpcQueryBase {
|
||||||
|
|
Loading…
Reference in New Issue