nimiq-rpc-client-ts
Version:
A Nimiq RPC client for TypeScript
43 lines (40 loc) • 1.26 kB
text/typescript
import { n as Auth } from './nimiq-rpc-client-ts.BvvqdQ38.mjs';
interface HttpOptions {
timeout?: number | false;
url?: string | URL;
auth?: Auth;
abortController?: AbortController;
/**
* The request object that was used to make the request. It will override any other
* parameters that are passed to the function from the library.
*
* Useful if you want to pass custom headers or other options to the request.
*/
request?: HttpRequest;
}
interface SendTxOptions extends HttpOptions {
waitForConfirmationTimeout?: number;
}
interface HttpRequest {
method: 'POST';
headers: HeadersInit;
body: {
method: string;
params: any[];
id: number;
jsonrpc: string;
};
timestamp: number;
url: string;
abortController: AbortController;
}
type HttpRpcResultSuccess<T> = [true, undefined, T, {
request: HttpRequest;
metadata?: any;
}];
type HttpRpcResultError = [false, string, undefined, {
request: HttpRequest;
metadata?: any;
}];
type HttpRpcResult<T> = HttpRpcResultSuccess<T> | HttpRpcResultError;
export type { HttpOptions as H, SendTxOptions as S, HttpRequest as a, HttpRpcResultSuccess as b, HttpRpcResultError as c, HttpRpcResult as d };