-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.d.ts
93 lines (82 loc) · 2.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
import { PrivateKey as PK } from './helpers/PrivateKey'
import { PublicKey as PubK } from './helpers/PublicKey'
import { Signature as Sig } from './helpers/Signature'
import { Memo as MemoType } from './helpers/memo'
declare module 'hive-tx'
export class PrivateKey extends PK {}
export class PublicKey extends PubK {}
export class Signature extends Sig {}
/** Transaction for Hive blockchain */
export class Transaction {
constructor(trx?: object)
/** Broadcast the signed transaction.
* @param {number}timeout - optional - default 5 seconds
* @param {number}retry - optional - default 5 times
*/
broadcast(timeout = 5, retry = 5): Promise<{
id: number
jsonrpc: string
result: { tx_id: string; status: string }
} | {error: object}>
/** Create the transaction by operations
* @param {[Array]} operations
* @param {Number} expiration Optional - Default 60 seconds
*/
create(
operations: any[],
expiration?: number
): Promise<{
expiration: string
extensions: any[]
operations: any[]
ref_block_num: number
ref_block_prefix: number
}>
/** Sign the transaction by key or keys[] (supports multi signature).
* It is also possible to sign with one key at a time for multi signature.
* @param {PrivateKey|[PrivateKey]} keys single key or multiple keys in array
*/
sign(keys: PrivateKey | PrivateKey[]): {
expiration: string
extensions: any[]
operations: any[]
ref_block_num: number
ref_block_prefix: number
signatures: string[]
}
/** Return the transaction hash which can be used to verify against a signature */
digest(): {
digest: Buffer,
txId: string
}
/**
* Add a signature to already created transaction. You can add multiple signatures to one transaction but one at a time.
* This method is used when you sign your transaction with other tools instead of built-in .sign() method.
*/
addSignature(signature: string): {
expiration: string
extensions: any[]
operations: any[]
ref_block_num: number
ref_block_prefix: number
signatures: string[]
}
}
/** hive-tx configurations */
export const config: {
address_prefix: string
chain_id: string
node: string[] | string,
axiosAdapter: null | 'xhr' | 'http' | any,
timeout: number
retry: number
}
/**
* Make calls to a hive node
* @param {string}method - e.g. condenser_api.get_dynamic_global_properties
* @param {[any]|object}params - array or object
* @param {number}timeout - optional - default 5 seconds
* @param {number}retry - optional - default 5 times
*/
export function call(method: string, params?: any[] | object, timeout?: number, retry?: number): Promise<any>
export const Memo: MemoType