Compare commits

..

No commits in common. "33b87a1075441043e7e0219264d66f6610864685" and "4c618a311dc31e036d3670a37df8f835a22b5e11" have entirely different histories.

3 changed files with 29 additions and 1 deletions

11
dist/rpc.d.ts vendored
View File

@ -27,6 +27,16 @@ export interface RPCCacheItem extends RPCResponse {
value: RPCResponse; value: RPCResponse;
signature: string; signature: string;
} }
export interface RPCClearCacheRequest {
request: string;
relays?: string[];
}
export declare type RPCClearCacheResponseRelayList = {
[relay: string]: RPCClearCacheResponse;
};
export interface RPCClearCacheResponse extends RPCResponse {
relays?: RPCClearCacheResponseRelayList;
}
export interface RPCBroadcastRequest { export interface RPCBroadcastRequest {
request: RPCRequest; request: RPCRequest;
relays: string[]; relays: string[];
@ -51,6 +61,7 @@ export declare class RPCServer extends EventEmitter {
export declare class RPCCache extends EventEmitter { export declare class RPCCache extends EventEmitter {
get data(): RPCCacheData; get data(): RPCCacheData;
constructor(server: RPCServer); constructor(server: RPCServer);
getNodeQuery(node: string, queryHash: string): Promise<boolean | RPCResponse>;
signResponse(item: RPCCacheItem): any; signResponse(item: RPCCacheItem): any;
verifyResponse(pubkey: Buffer, item: RPCCacheItem): boolean | Buffer; verifyResponse(pubkey: Buffer, item: RPCCacheItem): boolean | Buffer;
addItem(query: RPCRequest, response: RPCResponse): void; addItem(query: RPCRequest, response: RPCResponse): void;

2
dist/rpc.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC;AAEvC,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC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; signature: string;
} }
export interface RPCClearCacheRequest {
request: string;
relays?: string[];
}
export type RPCClearCacheResponseRelayList = {
[relay: string]: RPCClearCacheResponse;
};
export interface RPCClearCacheResponse extends RPCResponse {
relays?: RPCClearCacheResponseRelayList;
}
export interface RPCBroadcastRequest { export interface RPCBroadcastRequest {
request: RPCRequest; request: RPCRequest;
relays: string[]; relays: string[];
@ -56,6 +69,10 @@ export declare class RPCServer extends EventEmitter {
export declare class RPCCache extends EventEmitter { export declare class RPCCache extends EventEmitter {
get data(): RPCCacheData; get data(): RPCCacheData;
constructor(server: RPCServer); constructor(server: RPCServer);
public getNodeQuery(
node: string,
queryHash: string
): Promise<boolean | RPCResponse>;
public signResponse(item: RPCCacheItem): any; public signResponse(item: RPCCacheItem): any;
public verifyResponse(pubkey: Buffer, item: RPCCacheItem): boolean | Buffer; public verifyResponse(pubkey: Buffer, item: RPCCacheItem): boolean | Buffer;
public addItem(query: RPCRequest, response: RPCResponse): void; public addItem(query: RPCRequest, response: RPCResponse): void;