bdcontract-sdk-javascript/types/types.d.ts
2023-03-15 01:15:57 +08:00

85 lines
2.0 KiB
TypeScript

export type ClientResponse<Data> = Omit<Response, 'data'> & {
data?: Data;
};
export type PingResponse = ClientResponse<'pong'>;
export interface SaveFileRequest {
content: string;
isAppend: boolean;
isPrivate: boolean;
path: string;
}
export interface ListProjectPermissionRequest {
isPrivate: boolean;
path: string;
}
export interface ListProjectPermissionResponseData {
permissions: string[];
ypk: string;
}
export interface StartContractByYpkRequest {
isPrivate: boolean;
path: string;
script: string;
}
export interface ListAllUsersResponseDataListItem {
key: string;
value: string;
}
export interface ListAllUsersResponseData {
kv: ListAllUsersResponseDataListItem[];
time: ListAllUsersResponseDataListItem[];
}
export interface OnlineContractsItem {
contractID: string;
contractName: string;
isMaster: boolean;
type: string;
yjsType: string;
[key: string]: unknown;
}
export interface OnlineItem {
cimanager: string;
contractVersion: number;
events: number;
ipPort: string;
masterAddress: string;
nodeName: string;
peerID: string;
pubKey: string;
contracts: OnlineContractsItem[];
}
export interface ListNodesResponse {
action: string;
offline: string[];
online: OnlineItem[];
}
export interface DistributeContractResponse {
action: string;
progress: string;
}
export interface ExecuteContractArgs extends RequestInit {
method?: 'POST' | 'GET';
withSignature?: boolean;
withDynamicAnalysis?: boolean;
}
export interface ExecuteContractResponse<Data> {
status?: boolean;
data?: Data;
executeTime?: number;
cid?: string;
isPrivate?: boolean;
[key: string]: unknown;
}
export interface ConfigNodeArgs {
nodeName?: string;
dataChain?: string;
masterAddress?: string;
nodeCenter?: string;
LHSProxyAddress?: string;
[K: string]: string | undefined;
}
export interface LoadNodeConfigResponseData {
doipConfig: string;
[K: string]: string;
}