57 lines
2.8 KiB
TypeScript
57 lines
2.8 KiB
TypeScript
import type { KeyPairHex } from 'sm-crypto';
|
|
import type { OnOpenHandler, WsHandler } from './wssocket';
|
|
interface ResponseData {
|
|
action: string;
|
|
responseID?: string;
|
|
status: true | false | string;
|
|
result?: unknown;
|
|
data: string;
|
|
[K: string]: unknown;
|
|
}
|
|
export declare class WsClient {
|
|
private readonly sm2Key;
|
|
private readonly wssocket;
|
|
private readonly promiseCallbackPairs;
|
|
private readonly sessionPromise;
|
|
private sessionResolve;
|
|
private readonly loginPromise;
|
|
private loginResolve;
|
|
constructor(url: string, onopen: OnOpenHandler, handler: WsHandler, sm2Key?: KeyPairHex);
|
|
status(): WebSocket['CLOSED' | 'CLOSING' | 'CONNECTING' | 'OPEN'];
|
|
sessionReceived(): Promise<string>;
|
|
login(): Promise<boolean>;
|
|
loggedIn(): Promise<boolean>;
|
|
matchCID(contractID: string): Promise<ResponseData>;
|
|
getMetabyCID(contractID: string): Promise<ResponseData>;
|
|
getMetabyReadme(keyword: string, page?: string, pageSize?: string): Promise<ResponseData>;
|
|
getMetabyPubkey(pubkey: string): Promise<ResponseData>;
|
|
segmentWord(words: string): Promise<ResponseData>;
|
|
getMetabyOwner(owner: string, page?: string, pageSize?: string): Promise<ResponseData>;
|
|
getDependentContract(contractName: string): Promise<ResponseData>;
|
|
queryContractLogByDate(start: number): Promise<ResponseData>;
|
|
queryDataByHash(hash: string): Promise<ResponseData>;
|
|
executeContract(contractID: string, method: string, arg: unknown): Promise<ResponseData>;
|
|
getSessionID(): Promise<ResponseData>;
|
|
listTheContractProcess(contractID: string): Promise<ResponseData>;
|
|
getMask(contractID: string): Promise<ResponseData>;
|
|
setMask(contractID: string, operation: string, arg: string): Promise<ResponseData>;
|
|
getMock(contractID: string): Promise<ResponseData>;
|
|
setMock(contractID: string, operation: string, arg: string): Promise<ResponseData>;
|
|
queryHashByOffset(offset: number, count: number): Promise<ResponseData>;
|
|
loadNodeConfig(): Promise<ResponseData>;
|
|
queryUserStat(): Promise<ResponseData>;
|
|
listNodes(): Promise<ResponseData>;
|
|
killContractProcess(id: string): Promise<ResponseData>;
|
|
distributeYPK(projectName: string, nodeIDs: string): Promise<ResponseData>;
|
|
listYPKs(): Promise<ResponseData>;
|
|
deleteFile(file: string): Promise<ResponseData>;
|
|
startContractByYPK(project: string): Promise<ResponseData>;
|
|
initBDServer(host: string, username: string, password: string, name: string, clusterHost: string): Promise<ResponseData>;
|
|
initBDCluster(host: string, username: string, password: string, name: string, sm2Key: string, agents: []): Promise<ResponseData>;
|
|
listCompiledFiles(): Promise<ResponseData>;
|
|
getManagerPubkey(): Promise<ResponseData>;
|
|
getClusterName(): Promise<ResponseData>;
|
|
setClusterName(name: string): Promise<ResponseData>;
|
|
}
|
|
export {};
|