-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.d.ts
146 lines (141 loc) · 4.67 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import { Point, getCurveByName } from "ecurve";
import BigInteger from 'bigi';
declare module "cybexjs" {
class Serializer {
constructor(operation_name: string, types: { [p: string]: any });
fromByteBuffer(b);
appendByteBuffer(b, object);
fromObject(serialized_object);
toObject(
serialized_object,
debug: { use_default?: boolean; annotate?: boolean }
);
compare(a, b);
fromHex(hex);
fromBuffer(buffer);
toHex(object);
toByteBuffer(objectt);
toBuffer(object);
}
const ops: { [op: string]: Serializer };
class Signature {
constructor(r1, s1, i1);
static fromBuffer(buf): Signature;
toBuffer(): Buffer;
recoverPublicKeyFromBuffer(buffer);
static signBuffer(buf, private_key): Signature;
static signBufferSha256(buf_sha256, private_key): Signature;
static sign(string, private_key): Signature;
verifyBuffer(buf, public_key): boolean;
verifyHash(hash, public_key): boolean;
toByteBuffer(): Buffer;
static fromHex(hex): Signature;
toHex(): string;
static signHex(hex, private_key): Signature;
verifyHex(hex, public_key): boolean;
}
type ParamsOfCheck = {
accountName: string;
password: string;
auths: { [x: string]: [string, number][] };
};
class AccountLogin {
checkKeys: (paramsToCheck: ParamsOfCheck) => boolean;
generateKeys(
accountName: string,
password: string,
roles?: string[],
prefix?: string
): any;
signTransaction(tr: any): void;
}
const Login: AccountLogin;
class ChainStoreClass {
resetCache(): void;
init: () => Promise<any>;
subscribe(handler: (obj: object) => any): void;
unsubscribe(handler: (obj: object) => any): void;
fetchFullAccount: any;
getEstimatedChainTimeOffset: any;
subError: any;
subscribed: any;
getObject(id: string): any;
getAsset(symbolOrId: string): any;
getBalanceObjects(id: string | string[]): any;
getAccount(name_or_id: string, autosubscribe?: boolean): any;
}
const ChainStore: ChainStoreClass;
const TransactionBuilder: any;
const FetchChain: (apiMethod: string, ...args: any[]) => Promise<any>;
const TransactionHelper: any;
const Aes: any;
class PublicKey {
/** @param {Point} public key */
constructor(Q);
static fromBinary(bin): PublicKey;
static fromBuffer(buffer): PublicKey;
/**
@arg {string} public_key - like GPHXyz...
@arg {string} address_prefix - like GPH
@return PublicKey or `null` (if the public_key string is invalid)
*/
static fromPublicKeyString(public_key, address_prefix?): PublicKey | null;
static fromStringOrThrow(public_key, address_prefix?): PublicKey | null;
toBuffer(compressed?): Buffer;
static fromPoint(point): PublicKey;
toUncompressed(): PublicKey;
/** cyb::blockchain::address (unique but not a full public key) */
toBlockchainAddress(): string;
/** Alias for {@link toPublicKeyString} */
toString(address_prefix?: string): string;
/**
Full public key
{return} string
*/
toPublicKeyString(address_prefix?: string): string;
toAddressString(address_prefix?: string): string;
toPtsAddy(): string;
child(offset): PublicKey;
toByteBuffer(): Buffer;
static fromHex(hex): PublicKey;
toHex(): string;
static fromPublicKeyStringHex(hex: string): PublicKey;
}
class PrivateKey {
/**
@private see static functions
@param {BigInteger}
*/
constructor(d);
static fromBuffer(buf: Buffer): PrivateKey;
/** @arg {string} seed - any length string. This is private, the same seed produces the same private key every time. */
static fromSeed(seed: string): PrivateKey;
/** @return {string} Wallet Import Format (still a secret, Not encrypted) */
static fromWif(_private_wif: string): PrivateKey;
toWif(): string;
toPublicKeyPoint();
toPublicKey(): PublicKey;
toBuffer(): Buffer;
toByteBuffer(): Buffer;
get_shared_secret(public_key, legacy?: boolean): string;
static fromHex(hex: string): PrivateKey;
child(offset): PrivateKey;
toHex(): string;
}
const ChainTypes: any;
const ChainValidation: {
is_account_name: (value, allow_too_short?) => boolean;
is_object_id: (id: string) => boolean;
is_empty: (value, allow_too_short?) => boolean;
is_account_name_error: (value, allow_too_short?) => boolean;
is_cheap_name: (value, allow_too_short?) => boolean;
is_empty_user_input: (value) => boolean;
is_valid_symbol_error: (value, arg?) => boolean;
required: (value, field_name?) => boolean;
};
const key: {
addresses(pubkey: any): string[];
get_random_key: any;
};
const EmitterInstance: any;
}