This repository has been archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shared_methods.ts
45 lines (25 loc) · 1.22 KB
/
shared_methods.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import Wallet from "./lib/wallet";
import Blockchain from "./lib/blockchain";
import PeerServiceList from "./lib/peer_service_list";
export default interface SharedMethods {
sendMessage(peerIndex: bigint, buffer: Uint8Array): void;
sendMessageToAll(buffer: Uint8Array, exceptions: Array<bigint>): void;
connectToPeer(peerData: any): void;
writeValue(key: string, value: Uint8Array): void;
readValue(key: string): Uint8Array;
loadBlockFileList(): Array<string>;
isExistingFile(key: string): boolean;
removeValue(key: string): void;
disconnectFromPeer(peerIndex: bigint): void;
fetchBlockFromPeer(url: string): Promise<Uint8Array>;
processApiCall(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): Promise<void>;
processApiSuccess(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): void;
processApiError(buffer: Uint8Array, msgIndex: number, peerIndex: bigint): void;
sendInterfaceEvent(event: String, peerIndex: bigint): void;
sendBlockSuccess(hash: String, blockId: bigint): void;
saveWallet(wallet: Wallet): void;
loadWallet(wallet: Wallet): void;
saveBlockchain(blockchain: Blockchain): void;
loadBlockchain(blockchain: Blockchain): void;
getMyServices(): PeerServiceList;
}