forked from orbs-network/ton-access
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
47 lines (47 loc) · 1.42 KB
/
index.d.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
46
47
declare module "nodes" {
import "isomorphic-fetch";
interface Node {
Name: string;
Ip: string;
Healthy: string;
}
export class Nodes {
committee: Set<string>;
topology: Node[];
nodeIndex: number;
constructor();
init(nodesUrl: string): Promise<void>;
getNextNode(committeeOnly?: boolean): Node;
getRandomNode(committeeOnly?: boolean): Node;
}
}
declare module "index" {
import { Nodes } from "nodes";
type EdgeProtocol = "toncenter-api-v2" | "ton-api-v4" | "adnl-proxy";
type Network = "mainnet" | "testnet";
export interface Config {
host?: string;
accessVersion?: number;
network?: Network;
protocol?: "default" | "json-rpc" | "rest";
}
export class Access {
nodes: Nodes;
host: string;
urlVersion: number;
constructor();
init(): Promise<void>;
buildUrls(network?: Network, edgeProtocol?: EdgeProtocol, suffix?: string): string[];
}
export function getHttpEndpoints(config?: Config): Promise<string[]>;
export function getHttpEndpoint(config?: Config): Promise<string>;
export function getTonApiV4Endpoints(config?: Config): Promise<string[]>;
export function getTonApiV4Endpoint(config?: Config): Promise<string>;
}
declare module "web" {
global {
interface Window {
TonAccess: object;
}
}
}