/
accountApi.ts
199 lines (178 loc) · 7.06 KB
/
accountApi.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
import {TransactionList} from '../transactionList';
import {SubscriptionList} from '../subscriptionList';
import {UnconfirmedTransactionList} from '../unconfirmedTransactionList';
import {Balance} from '../balance';
import {AliasList} from '../aliasList';
import {Account} from '../account';
import {TransactionId} from '../transactionId';
import {
CommitmentArgs,
GetAccountBlocksArgs,
GetAccountTransactionsArgs,
SetRewardRecipientArgs,
GetAccountArgs,
SetAccountInfoArgs,
SetAliasArgs, GetTradeHistoryPerAccountArgs
} from '../args';
import {RewardRecipient} from '../rewardRecipient';
import {BlockList} from '../blockList';
import {UnsignedTransaction} from '../unsignedTransaction';
import {TradeHistory} from '../tradeHistory';
import {GetAliasesArgs} from '../args/getAliasesArgs';
/**
* Account API
*
* @module core.api
*/
export interface AccountApi {
/**
* Get transactions of given account
* @param {GetAccountTransactionsArgs} args The arguments
* @return {Promise<TransactionList>} List of transactions
*/
getAccountTransactions: (args: GetAccountTransactionsArgs) => Promise<TransactionList>;
/**
* Get _unconfirmed_ transactions of given account
* @param {string} accountId The numeric accountId
* @param {boolean?} includeIndirect Includes indirect transaction, i.e. multi out payments.
* For BRS Versions before 2.3.2 this must be `undefined`
* @return {Promise<UnconfirmedTransactionList>} List of unconfirmed transactions
*/
getUnconfirmedAccountTransactions: (
accountId: string,
includeIndirect?: boolean
) => Promise<UnconfirmedTransactionList>;
/**
* Get the balance of an account
* @param {string} accountId
* @return {Promise<Balance>} The account's balance
*/
getAccountBalance: (accountId: string) => Promise<Balance>;
/**
* Get an account given an ID
* @param {GetAccountArgs} args The arguments
* @return {Promise<Account>} The account from the backend, not including transactions
*/
getAccount: (args: GetAccountArgs) => Promise<Account>;
/**
* Get blocks forged by an account
* @param {GetAccountBlocksArgs} args The arguments
* @return {Promise<Block[]>} The list of blocks
*/
getAccountBlocks: (args: GetAccountBlocksArgs) => Promise<BlockList>;
/**
* Get blockIds forged by an account
* @param {GetAccountBlocksArgs} args The arguments
* @return {Promise<string[]>} The list of blocks
*/
getAccountBlockIds: (args: GetAccountBlocksArgs) => Promise<string[]>;
/**
* Get QR Code image for a given BURST address
* @param {string} receiverId The recipient burst
* @param {number?} amountNQT The amount (in NQT) to request (Default = 0)
* @param {string?} feeSuggestionType The fee suggestion type string (Default = 'standard')
* @param {number?} feeNQT The fee amount (in NQT)
* @param {immutable?} immutable Whether to allow this to be modified
* @return {Promise<ArrayBufferLike>} QR code image data
*/
generateSendTransactionQRCode: (
receiverId: string,
amountNQT?: number,
feeSuggestionType?: string,
feeNQT?: number,
immutable?: boolean
) => Promise<ArrayBufferLike>;
/**
* Generate the URL for a QR Code for a given BURST address. Useful for IMG tags in HTML.
* @param {string} receiverId The recipient burst address
* @param {number?} amountNQT The amount (in NQT) to request (Default = 0)
* @param {string?} feeSuggestionType The fee suggestion type string (Default = 'standard')
* @param {number?} feeNQT The fee amount (in NQT)
* @param {immutable?} immutable Whether to allow this to be modified
* @return {Promise<string>} The url
*/
generateSendTransactionQRCodeAddress: (
receiverId: string,
amountNQT?: number,
feeSuggestionType?: string,
feeNQT?: number,
immutable?: boolean
) => Promise<string>;
/**
* Sets or Updates an Alias
* @param {SetAliasArgs} args The arguments
*
* @return The Transaction Id or Unsigned Bytes as Hex String if no private key was sent
*/
setAlias: (args: SetAliasArgs) => Promise<TransactionId | UnsignedTransaction>;
/**
* Sets account information for an account
* @param {SetAccountInfoArgs} args The arguments
*
* @return The Transaction Id or Unsigned Bytes as Hex String if no private key was sent
*/
setAccountInfo: (args: SetAccountInfoArgs) => Promise<TransactionId | UnsignedTransaction>;
/**
* Assigns a reward recipient for an account
*
* This function is usually used to bind an account to a mining pool.
*
* @param {SetRewardRecipientArgs} args The arguments
* @return The Transaction Id or Unsigned Bytes as Hex String if no private key was sent
**/
setRewardRecipient: (args: SetRewardRecipientArgs) => Promise<TransactionId | UnsignedTransaction>;
/**
* Gets a list of subscriptions for this account (sender)
*
* @param accountId The sender account Id
* @return List of Subscriptions
*/
getAccountSubscriptions: (accountId: string) => Promise<SubscriptionList>;
/**
* Gets a list of subscriptions paying to the given account (recipient)
*
* @param accountId The recipient account Id
* @return List of Subscriptions
*/
getSubscriptionsToAccount: (accountId: string) => Promise<SubscriptionList>;
/**
* Gets the reward recipient for an account
*
* So you can see, if an account is bound to a pool.
*
* @param {string} account The account Id
* @return The Reward Recipient
*/
getRewardRecipient: ( accountId: string ) => Promise<RewardRecipient>;
/**
* Adds an additional amount as commitment
*
* The commitment is part of the PoC+ consensus, and allows miners
* to improve their mining power through additionally locked amount
*
* @param {CommitmentArgs} args The args
* @return The Transaction Id or Unsigned Bytes as Hex String if no private key was sent
* @see [[AccountApi.removeCommitment]]
*/
addCommitment: (args: CommitmentArgs) => Promise<TransactionId | UnsignedTransaction>;
/**
* Removes/Reduces a miners commitment
*
* The commitment is part of the PoC+ consensus, and allows miners
* to improve their mining power through additionally locked amount
*
* @param {CommitmentArgs} args The args
* @return The Transaction Id or Unsigned Bytes as Hex String if no private key was sent
* @see [[AccountApi.addCommitment]]
*/
removeCommitment: (args: CommitmentArgs) => Promise<TransactionId | UnsignedTransaction>;
/**
* The trade history is a journal about open/filled and/or cancelled trades for a given account and
* optionally set asset
*
* @param {GetTradeHistoryPerAccountArgs} args The args object
*
* @param The trade history
*/
getTradeHistoryPerAccount: (args: GetTradeHistoryPerAccountArgs) => Promise<TradeHistory>;
}