@otoplo/wallet-common 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +869 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +211 -193
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
- package/src/services/rostrum.ts +42 -22
- package/src/services/wallet.ts +83 -70
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/persistence/index.d.ts +0 -3
- package/dist/types/persistence/index.d.ts.map +0 -1
- package/dist/types/persistence/repository.d.ts +0 -43
- package/dist/types/persistence/repository.d.ts.map +0 -1
- package/dist/types/persistence/wallet-db.d.ts +0 -44
- package/dist/types/persistence/wallet-db.d.ts.map +0 -1
- package/dist/types/services/asset.d.ts +0 -21
- package/dist/types/services/asset.d.ts.map +0 -1
- package/dist/types/services/cache.d.ts +0 -14
- package/dist/types/services/cache.d.ts.map +0 -1
- package/dist/types/services/discovery.d.ts +0 -18
- package/dist/types/services/discovery.d.ts.map +0 -1
- package/dist/types/services/index.d.ts +0 -10
- package/dist/types/services/index.d.ts.map +0 -1
- package/dist/types/services/key.d.ts +0 -17
- package/dist/types/services/key.d.ts.map +0 -1
- package/dist/types/services/market.d.ts +0 -33
- package/dist/types/services/market.d.ts.map +0 -1
- package/dist/types/services/rostrum.d.ts +0 -39
- package/dist/types/services/rostrum.d.ts.map +0 -1
- package/dist/types/services/session.d.ts +0 -48
- package/dist/types/services/session.d.ts.map +0 -1
- package/dist/types/services/transaction.d.ts +0 -41
- package/dist/types/services/transaction.d.ts.map +0 -1
- package/dist/types/services/tx-transformer.d.ts +0 -22
- package/dist/types/services/tx-transformer.d.ts.map +0 -1
- package/dist/types/services/wallet.d.ts +0 -103
- package/dist/types/services/wallet.d.ts.map +0 -1
- package/dist/types/types/dapp.types.d.ts +0 -19
- package/dist/types/types/dapp.types.d.ts.map +0 -1
- package/dist/types/types/db.types.d.ts +0 -138
- package/dist/types/types/db.types.d.ts.map +0 -1
- package/dist/types/types/index.d.ts +0 -6
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/types/notification.types.d.ts +0 -21
- package/dist/types/types/notification.types.d.ts.map +0 -1
- package/dist/types/types/rostrum.types.d.ts +0 -132
- package/dist/types/types/rostrum.types.d.ts.map +0 -1
- package/dist/types/types/wallet.types.d.ts +0 -80
- package/dist/types/types/wallet.types.d.ts.map +0 -1
- package/dist/types/utils/asset.d.ts +0 -5
- package/dist/types/utils/asset.d.ts.map +0 -1
- package/dist/types/utils/common.d.ts +0 -64
- package/dist/types/utils/common.d.ts.map +0 -1
- package/dist/types/utils/enums.d.ts +0 -16
- package/dist/types/utils/enums.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -7
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/keypath.d.ts +0 -5
- package/dist/types/utils/keypath.d.ts.map +0 -1
- package/dist/types/utils/seed.d.ts +0 -5
- package/dist/types/utils/seed.d.ts.map +0 -1
- package/dist/types/utils/vault.d.ts +0 -10
- package/dist/types/utils/vault.d.ts.map +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,869 @@
|
|
|
1
|
+
import { DAppInfo, DAppProvider, SessionDetails } from "wallet-comms-sdk";
|
|
2
|
+
import { RequestResponse, TransportScheme } from "@otoplo/electrum-client";
|
|
3
|
+
import { AddressType, HDPrivateKey, PublicKey, Script, ScriptElement, Transaction } from "libnexa-ts";
|
|
4
|
+
export declare enum AccountType {
|
|
5
|
+
MAIN = 0,
|
|
6
|
+
VAULT = 1,
|
|
7
|
+
DAPP = 2
|
|
8
|
+
}
|
|
9
|
+
export declare enum KeySpace {
|
|
10
|
+
RECEIVE = 0,
|
|
11
|
+
CHANGE = 1
|
|
12
|
+
}
|
|
13
|
+
export declare enum SessionRequestType {
|
|
14
|
+
SignMessage = "signMessage",
|
|
15
|
+
AddToken = "addToken",
|
|
16
|
+
SignTransaction = "signTransaction",
|
|
17
|
+
SendTransaction = "sendTransaction"
|
|
18
|
+
}
|
|
19
|
+
interface KeyPath {
|
|
20
|
+
account: AccountType;
|
|
21
|
+
type: KeySpace;
|
|
22
|
+
index: number;
|
|
23
|
+
}
|
|
24
|
+
interface AddressKey {
|
|
25
|
+
keyPath: string;
|
|
26
|
+
address: string;
|
|
27
|
+
balance: Balance;
|
|
28
|
+
tokensBalance: Record<string, Balance>;
|
|
29
|
+
}
|
|
30
|
+
interface Balance {
|
|
31
|
+
confirmed: string;
|
|
32
|
+
unconfirmed: string;
|
|
33
|
+
}
|
|
34
|
+
interface Account {
|
|
35
|
+
id: number;
|
|
36
|
+
name: string;
|
|
37
|
+
address: string;
|
|
38
|
+
balance: Balance;
|
|
39
|
+
tokensBalance: Record<string, Balance>;
|
|
40
|
+
sessions: Record<string, SessionInfo>;
|
|
41
|
+
}
|
|
42
|
+
interface VaultInfo {
|
|
43
|
+
address: string;
|
|
44
|
+
balance: Balance;
|
|
45
|
+
block: number;
|
|
46
|
+
index: number;
|
|
47
|
+
}
|
|
48
|
+
interface SessionInfo {
|
|
49
|
+
details: SessionDetails;
|
|
50
|
+
appInfo: DAppInfo;
|
|
51
|
+
}
|
|
52
|
+
interface AssetBase {
|
|
53
|
+
token: string;
|
|
54
|
+
tokenIdHex: string;
|
|
55
|
+
parent: string;
|
|
56
|
+
}
|
|
57
|
+
interface TokenAsset {
|
|
58
|
+
name: string;
|
|
59
|
+
ticker: string;
|
|
60
|
+
iconUrl: string;
|
|
61
|
+
decimals: number;
|
|
62
|
+
}
|
|
63
|
+
interface NFTAsset {
|
|
64
|
+
name: string;
|
|
65
|
+
series: string;
|
|
66
|
+
collection: string;
|
|
67
|
+
author: string;
|
|
68
|
+
public: string;
|
|
69
|
+
front: string;
|
|
70
|
+
back: string;
|
|
71
|
+
thumb: string;
|
|
72
|
+
}
|
|
73
|
+
type AssetType = 'token' | 'nft';
|
|
74
|
+
type AssetInfo = (AssetBase & {
|
|
75
|
+
type: 'token';
|
|
76
|
+
data: TokenAsset;
|
|
77
|
+
}) | (AssetBase & {
|
|
78
|
+
type: 'nft';
|
|
79
|
+
data: NFTAsset;
|
|
80
|
+
});
|
|
81
|
+
interface MarketData {
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
symbol: string;
|
|
85
|
+
image: string;
|
|
86
|
+
price: number;
|
|
87
|
+
priceChange?: number | null;
|
|
88
|
+
priceChangePercentage?: number | null;
|
|
89
|
+
marketCap?: number | null;
|
|
90
|
+
fdv?: number | null;
|
|
91
|
+
circSupply?: number | null;
|
|
92
|
+
totalSupply?: number | null;
|
|
93
|
+
maxSupply?: number | null;
|
|
94
|
+
totalVolume?: number | null;
|
|
95
|
+
}
|
|
96
|
+
interface AssetMovement {
|
|
97
|
+
address: string;
|
|
98
|
+
nexaAmount: string;
|
|
99
|
+
assetId: string;
|
|
100
|
+
assetAmount: string;
|
|
101
|
+
}
|
|
102
|
+
type TransactionType = 'receive' | 'send' | 'swap' | 'self';
|
|
103
|
+
interface TransactionDTO {
|
|
104
|
+
accountId: number;
|
|
105
|
+
txIdem: string;
|
|
106
|
+
txId: string;
|
|
107
|
+
time: number;
|
|
108
|
+
height: number;
|
|
109
|
+
type: TransactionType;
|
|
110
|
+
fee: string;
|
|
111
|
+
othersOutputs: AssetMovement[];
|
|
112
|
+
myOutputs: AssetMovement[];
|
|
113
|
+
myInputs: AssetMovement[];
|
|
114
|
+
}
|
|
115
|
+
interface TransactionEntity {
|
|
116
|
+
accountId: number;
|
|
117
|
+
txIdem: string;
|
|
118
|
+
txId: string;
|
|
119
|
+
time: number;
|
|
120
|
+
height: number;
|
|
121
|
+
type: TransactionType;
|
|
122
|
+
fee: string;
|
|
123
|
+
othersOutputs: string;
|
|
124
|
+
myOutputs: string;
|
|
125
|
+
myInputs: string;
|
|
126
|
+
}
|
|
127
|
+
interface AssetTransactionEntity {
|
|
128
|
+
accountId: number;
|
|
129
|
+
assetId: string;
|
|
130
|
+
txIdem: string;
|
|
131
|
+
time: number;
|
|
132
|
+
}
|
|
133
|
+
interface AssetEntity {
|
|
134
|
+
accountId: number;
|
|
135
|
+
tokenIdHex: string;
|
|
136
|
+
type: AssetType;
|
|
137
|
+
addedTime: number;
|
|
138
|
+
}
|
|
139
|
+
interface TokenEntity {
|
|
140
|
+
token: string;
|
|
141
|
+
tokenIdHex: string;
|
|
142
|
+
name: string;
|
|
143
|
+
ticker: string;
|
|
144
|
+
iconUrl: string;
|
|
145
|
+
decimals: number;
|
|
146
|
+
parent: string;
|
|
147
|
+
}
|
|
148
|
+
interface NftEntity {
|
|
149
|
+
token: string;
|
|
150
|
+
tokenIdHex: string;
|
|
151
|
+
name: string;
|
|
152
|
+
parent: string;
|
|
153
|
+
collection: string;
|
|
154
|
+
series: string;
|
|
155
|
+
author: string;
|
|
156
|
+
public: string;
|
|
157
|
+
front: string;
|
|
158
|
+
back: string;
|
|
159
|
+
thumb: string;
|
|
160
|
+
}
|
|
161
|
+
interface SessionEntity {
|
|
162
|
+
sessionId: string;
|
|
163
|
+
accountId: number;
|
|
164
|
+
uri: string;
|
|
165
|
+
}
|
|
166
|
+
interface AccountDTO {
|
|
167
|
+
id: number;
|
|
168
|
+
name: string;
|
|
169
|
+
address: string;
|
|
170
|
+
height: number;
|
|
171
|
+
hidden: number;
|
|
172
|
+
statusHash: string;
|
|
173
|
+
balance: Balance;
|
|
174
|
+
tokensBalance: Record<string, Balance>;
|
|
175
|
+
type: AccountType;
|
|
176
|
+
}
|
|
177
|
+
interface AccountEntity {
|
|
178
|
+
id: number;
|
|
179
|
+
name: string;
|
|
180
|
+
address: string;
|
|
181
|
+
height: number;
|
|
182
|
+
hidden: number;
|
|
183
|
+
statusHash: string;
|
|
184
|
+
balance: string;
|
|
185
|
+
tokensBalance: string;
|
|
186
|
+
}
|
|
187
|
+
interface AddressDTO {
|
|
188
|
+
address: string;
|
|
189
|
+
space: number;
|
|
190
|
+
idx: number;
|
|
191
|
+
used: boolean;
|
|
192
|
+
height: number;
|
|
193
|
+
statusHash: string;
|
|
194
|
+
balance: Balance;
|
|
195
|
+
tokensBalance: Record<string, Balance>;
|
|
196
|
+
type: AccountType;
|
|
197
|
+
}
|
|
198
|
+
interface AddressEntity {
|
|
199
|
+
address: string;
|
|
200
|
+
space: number;
|
|
201
|
+
idx: number;
|
|
202
|
+
used: boolean;
|
|
203
|
+
height: number;
|
|
204
|
+
statusHash: string;
|
|
205
|
+
balance: string;
|
|
206
|
+
tokensBalance: string;
|
|
207
|
+
}
|
|
208
|
+
interface VaultDTO {
|
|
209
|
+
address: string;
|
|
210
|
+
idx: number;
|
|
211
|
+
block: number;
|
|
212
|
+
height: number;
|
|
213
|
+
statusHash: string;
|
|
214
|
+
balance: Balance;
|
|
215
|
+
tokensBalance: Record<string, Balance>;
|
|
216
|
+
type: AccountType;
|
|
217
|
+
}
|
|
218
|
+
interface VaultEntity {
|
|
219
|
+
address: string;
|
|
220
|
+
idx: number;
|
|
221
|
+
block: number;
|
|
222
|
+
height: number;
|
|
223
|
+
statusHash: string;
|
|
224
|
+
balance: string;
|
|
225
|
+
tokensBalance: string;
|
|
226
|
+
}
|
|
227
|
+
interface SettingEntity {
|
|
228
|
+
name: string;
|
|
229
|
+
value: string;
|
|
230
|
+
}
|
|
231
|
+
export interface Repository {
|
|
232
|
+
clearData(): Promise<void>;
|
|
233
|
+
initSchema(): Promise<boolean>;
|
|
234
|
+
upsertTransaction(txEntry: TransactionEntity): Promise<void>;
|
|
235
|
+
upsertAssetTransaction(assetTx: AssetTransactionEntity): Promise<void>;
|
|
236
|
+
getTransactions(account: number, tokenId?: string): Promise<TransactionEntity[]>;
|
|
237
|
+
getPageTransactions(account: number, pageNum: number, pageSize: number, tokenId?: string): Promise<TransactionEntity[]>;
|
|
238
|
+
countTransactions(account: number, tokenId?: string): Promise<number>;
|
|
239
|
+
clearTransactions(account: number): Promise<void>;
|
|
240
|
+
countTokens(account: number): Promise<number>;
|
|
241
|
+
upsertToken(token: TokenEntity): Promise<void>;
|
|
242
|
+
getTokens(account: number, pageNum: number, pageSize: number): Promise<TokenEntity[]>;
|
|
243
|
+
getToken(id: string): Promise<TokenEntity | null | undefined>;
|
|
244
|
+
deleteToken(id: string): Promise<void>;
|
|
245
|
+
countNfts(account: number): Promise<number>;
|
|
246
|
+
upsertNft(nft: NftEntity): Promise<void>;
|
|
247
|
+
getNfts(account: number, pageNum: number, pageSize: number): Promise<NftEntity[]>;
|
|
248
|
+
getNft(id: string): Promise<NftEntity | null | undefined>;
|
|
249
|
+
deleteNft(id: string): Promise<void>;
|
|
250
|
+
upsertAsset(asset: AssetEntity): Promise<void>;
|
|
251
|
+
getAssets(account: number, type: AssetType): Promise<AssetEntity[]>;
|
|
252
|
+
deleteAsset(account: number, id: string): Promise<void>;
|
|
253
|
+
countAssetsById(id: string): Promise<number>;
|
|
254
|
+
upsertAccount(account: AccountEntity): Promise<void>;
|
|
255
|
+
getAccounts(): Promise<AccountEntity[]>;
|
|
256
|
+
countAccounts(): Promise<number>;
|
|
257
|
+
updateAccountName(account: number, name: string): Promise<void>;
|
|
258
|
+
upsertSession(session: SessionEntity): Promise<void>;
|
|
259
|
+
getSessionsByAccount(accountId: number): Promise<SessionEntity[]>;
|
|
260
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
261
|
+
upsertAddress(address: AddressEntity): Promise<void>;
|
|
262
|
+
getReceiveAddresses(): Promise<AddressEntity[]>;
|
|
263
|
+
getChangeAddresses(): Promise<AddressEntity[]>;
|
|
264
|
+
countAddresses(): Promise<number>;
|
|
265
|
+
upsertVault(vault: VaultEntity): Promise<void>;
|
|
266
|
+
getVaults(): Promise<VaultEntity[]>;
|
|
267
|
+
getSetting(name: string): Promise<string | null | undefined>;
|
|
268
|
+
saveSetting(name: string, value: string): Promise<void>;
|
|
269
|
+
deleteSetting(name: string): Promise<void>;
|
|
270
|
+
}
|
|
271
|
+
export declare class WalletDB {
|
|
272
|
+
private readonly repository;
|
|
273
|
+
constructor(repository: Repository);
|
|
274
|
+
initSchema(): Promise<boolean>;
|
|
275
|
+
clearData(): Promise<void>;
|
|
276
|
+
upsertTransaction(tx: TransactionDTO): Promise<void>;
|
|
277
|
+
upsertAssetTransaction(assetTx: AssetTransactionEntity): Promise<void>;
|
|
278
|
+
getTransactions(account: number, tokenId?: string): Promise<TransactionEntity[]>;
|
|
279
|
+
getPageTransactions(account: number, pageNum: number, pageSize: number, tokenId?: string): Promise<TransactionEntity[]>;
|
|
280
|
+
countTransactions(account: number, tokenId?: string): Promise<number>;
|
|
281
|
+
clearTransactions(account: number): Promise<void>;
|
|
282
|
+
saveToken(account: number, token: TokenEntity): Promise<void>;
|
|
283
|
+
getTokens(account: number, pageNum: number, pageSize: number): Promise<TokenEntity[]>;
|
|
284
|
+
getToken(id: string): Promise<TokenEntity | null | undefined>;
|
|
285
|
+
deleteToken(account: number, tokenId: string): Promise<void>;
|
|
286
|
+
saveNft(account: number, nft: NftEntity, time: number): Promise<void>;
|
|
287
|
+
getNfts(account: number, pageNum: number, pageSize: number): Promise<NftEntity[]>;
|
|
288
|
+
getNft(id: string): Promise<NftEntity | null | undefined>;
|
|
289
|
+
deleteNft(account: number, tokenId: string): Promise<void>;
|
|
290
|
+
countNfts(account: number): Promise<number>;
|
|
291
|
+
getAssets(account: number, type: AssetType): Promise<AssetEntity[]>;
|
|
292
|
+
saveAsset(asset: AssetEntity): Promise<void>;
|
|
293
|
+
removeAsset(account: number, id: string): Promise<void>;
|
|
294
|
+
saveAccount(account: AccountDTO): Promise<void>;
|
|
295
|
+
getAccounts(): Promise<AccountDTO[]>;
|
|
296
|
+
countAccounts(): Promise<number>;
|
|
297
|
+
updateAccountName(account: number, name: string): Promise<void>;
|
|
298
|
+
saveSession(session: SessionEntity): Promise<void>;
|
|
299
|
+
getAccountSessions(accountId: number): Promise<SessionEntity[]>;
|
|
300
|
+
removeSession(sessionId: string): Promise<void>;
|
|
301
|
+
saveAddress(address: AddressDTO): Promise<void>;
|
|
302
|
+
getReceiveAddresses(): Promise<AddressDTO[]>;
|
|
303
|
+
getChangeAddresses(): Promise<AddressDTO[]>;
|
|
304
|
+
countAddresses(): Promise<number>;
|
|
305
|
+
getVaults(): Promise<VaultDTO[]>;
|
|
306
|
+
saveVault(vault: VaultDTO): Promise<void>;
|
|
307
|
+
getSetting(name: string): Promise<string | null | undefined>;
|
|
308
|
+
saveSetting(name: string, value: string): Promise<void>;
|
|
309
|
+
removeSetting(name: string): Promise<void>;
|
|
310
|
+
}
|
|
311
|
+
export declare class WalletCache {
|
|
312
|
+
private readonly walletDb;
|
|
313
|
+
private readonly tokens;
|
|
314
|
+
private readonly nfts;
|
|
315
|
+
constructor(walletDb: WalletDB);
|
|
316
|
+
clear(): void;
|
|
317
|
+
getToken(id: string): Promise<TokenEntity | null | undefined>;
|
|
318
|
+
getNft(id: string): Promise<NftEntity | null | undefined>;
|
|
319
|
+
removeToken(id: string): void;
|
|
320
|
+
removeNft(id: string): void;
|
|
321
|
+
}
|
|
322
|
+
interface RostrumParams {
|
|
323
|
+
scheme: TransportScheme;
|
|
324
|
+
host: string;
|
|
325
|
+
port: number;
|
|
326
|
+
label: string;
|
|
327
|
+
}
|
|
328
|
+
interface ServerFeatures {
|
|
329
|
+
genesis_hash: string;
|
|
330
|
+
server_version: string;
|
|
331
|
+
script_index?: boolean;
|
|
332
|
+
}
|
|
333
|
+
interface BlockTip {
|
|
334
|
+
height: number;
|
|
335
|
+
hex: string;
|
|
336
|
+
}
|
|
337
|
+
interface IFirstUse {
|
|
338
|
+
block_hash: string;
|
|
339
|
+
block_height: number;
|
|
340
|
+
height: number;
|
|
341
|
+
tx_hash: string;
|
|
342
|
+
}
|
|
343
|
+
interface ITokensBalance {
|
|
344
|
+
cursor?: any;
|
|
345
|
+
confirmed: Record<string, string | number>;
|
|
346
|
+
unconfirmed: Record<string, string | number>;
|
|
347
|
+
}
|
|
348
|
+
interface ITemplateScript {
|
|
349
|
+
scriptpubkey: string;
|
|
350
|
+
scripthash: string;
|
|
351
|
+
}
|
|
352
|
+
interface ITokenUtxo {
|
|
353
|
+
group: string;
|
|
354
|
+
height: number;
|
|
355
|
+
outpoint_hash: string;
|
|
356
|
+
token_amount: number | string;
|
|
357
|
+
token_id_hex: string;
|
|
358
|
+
tx_hash: string;
|
|
359
|
+
tx_pos: number;
|
|
360
|
+
value: number;
|
|
361
|
+
}
|
|
362
|
+
interface IListUnspentRecord {
|
|
363
|
+
has_token: boolean;
|
|
364
|
+
height: number;
|
|
365
|
+
outpoint_hash: string;
|
|
366
|
+
tx_hash: string;
|
|
367
|
+
tx_pos: number;
|
|
368
|
+
value: number;
|
|
369
|
+
}
|
|
370
|
+
interface IUtxo {
|
|
371
|
+
addresses: string[];
|
|
372
|
+
amount: number;
|
|
373
|
+
group: string;
|
|
374
|
+
group_authority: string | number;
|
|
375
|
+
group_quantity: string | number;
|
|
376
|
+
height: number;
|
|
377
|
+
scripthash: string;
|
|
378
|
+
scriptpubkey: string;
|
|
379
|
+
spent: ISpent;
|
|
380
|
+
status: string;
|
|
381
|
+
template_argumenthash: string;
|
|
382
|
+
template_scripthash: string;
|
|
383
|
+
token_id_hex: string;
|
|
384
|
+
tx_hash: string;
|
|
385
|
+
tx_idem: string;
|
|
386
|
+
tx_pos: number;
|
|
387
|
+
}
|
|
388
|
+
interface ISpent {
|
|
389
|
+
height: number;
|
|
390
|
+
tx_hash: string;
|
|
391
|
+
tx_pos: number;
|
|
392
|
+
}
|
|
393
|
+
interface ITransaction {
|
|
394
|
+
blockhash: string;
|
|
395
|
+
blocktime: number;
|
|
396
|
+
confirmations: number;
|
|
397
|
+
fee: number;
|
|
398
|
+
fee_satoshi: number;
|
|
399
|
+
hash: string;
|
|
400
|
+
height: number;
|
|
401
|
+
hex: string;
|
|
402
|
+
locktime: number;
|
|
403
|
+
size: number;
|
|
404
|
+
time: number;
|
|
405
|
+
txid: string;
|
|
406
|
+
txidem: string;
|
|
407
|
+
version: number;
|
|
408
|
+
vin: ITXInput[];
|
|
409
|
+
vout: ITXOutput[];
|
|
410
|
+
}
|
|
411
|
+
interface ITXInput {
|
|
412
|
+
outpoint: string;
|
|
413
|
+
scriptSig: IScriptSig;
|
|
414
|
+
sequence: number;
|
|
415
|
+
value: number;
|
|
416
|
+
value_satoshi: string | number;
|
|
417
|
+
addresses: string[];
|
|
418
|
+
group: string;
|
|
419
|
+
groupAuthority: string | number;
|
|
420
|
+
groupQuantity: string | number;
|
|
421
|
+
token_id_hex?: string;
|
|
422
|
+
}
|
|
423
|
+
interface ITXOutput {
|
|
424
|
+
n: number;
|
|
425
|
+
outpoint_hash: string;
|
|
426
|
+
scriptPubKey: IScriptPubKey;
|
|
427
|
+
type: number;
|
|
428
|
+
value: number;
|
|
429
|
+
value_satoshi: string | number;
|
|
430
|
+
}
|
|
431
|
+
interface IScriptSig {
|
|
432
|
+
asm: string;
|
|
433
|
+
hex: string;
|
|
434
|
+
}
|
|
435
|
+
interface IScriptPubKey {
|
|
436
|
+
addresses: string[];
|
|
437
|
+
argHash: string;
|
|
438
|
+
asm: string;
|
|
439
|
+
group: string;
|
|
440
|
+
groupAuthority: string | number;
|
|
441
|
+
groupQuantity: string | number;
|
|
442
|
+
hex: string;
|
|
443
|
+
scriptHash: string;
|
|
444
|
+
token_id_hex?: string;
|
|
445
|
+
type: string;
|
|
446
|
+
}
|
|
447
|
+
interface ITXHistory {
|
|
448
|
+
fee?: number;
|
|
449
|
+
height: number;
|
|
450
|
+
tx_hash: string;
|
|
451
|
+
}
|
|
452
|
+
export type RostrumEvent = {
|
|
453
|
+
type: 'connected';
|
|
454
|
+
} | {
|
|
455
|
+
type: 'disconnected';
|
|
456
|
+
};
|
|
457
|
+
export type RostrumUpdateCallback = (event: RostrumEvent) => void;
|
|
458
|
+
export declare class RostrumService {
|
|
459
|
+
private readonly walletDb;
|
|
460
|
+
private client?;
|
|
461
|
+
private updateCallback?;
|
|
462
|
+
constructor(walletDb: WalletDB);
|
|
463
|
+
onUpdate(callback: RostrumUpdateCallback): void;
|
|
464
|
+
private notify;
|
|
465
|
+
isConnected(): boolean;
|
|
466
|
+
getFeatures(): Promise<ServerFeatures>;
|
|
467
|
+
getBlockTip(): Promise<BlockTip>;
|
|
468
|
+
getBalance(address: string): Promise<Balance>;
|
|
469
|
+
getTransactionsHistory(address: string, fromHeight?: number): Promise<ITXHistory[]>;
|
|
470
|
+
listTemplateScripts(template: string, constraint?: string | null): Promise<ITemplateScript[]>;
|
|
471
|
+
getFirstUse(address: string): Promise<IFirstUse>;
|
|
472
|
+
isAddressUsed(address: string): Promise<boolean>;
|
|
473
|
+
getTransaction(id: string, verbose?: boolean): Promise<ITransaction>;
|
|
474
|
+
getUtxo(outpoint: string): Promise<IUtxo>;
|
|
475
|
+
getNexaUtxos(address: string): Promise<IListUnspentRecord[]>;
|
|
476
|
+
getTokenUtxos(address: string, token: string): Promise<ITokenUtxo[]>;
|
|
477
|
+
getTokensBalance(address: string): Promise<Record<string, Balance>>;
|
|
478
|
+
broadcast(txHex: string): Promise<string>;
|
|
479
|
+
subscribeHeaders(handler: (block: number) => void): Promise<RequestResponse>;
|
|
480
|
+
subscribeAddress(address: string, handler: (address: string, status: string | null) => void): Promise<RequestResponse>;
|
|
481
|
+
getLatency(): Promise<number>;
|
|
482
|
+
connect(params?: RostrumParams): Promise<void>;
|
|
483
|
+
disconnect(): Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* Walk a cursor-paginated rostrum query: start with "start" and follow the returned cursor until it is null.
|
|
486
|
+
* If the cursor expires mid-walk (e.g. reorg / mempool change), the walk is restarted from the beginning.
|
|
487
|
+
*/
|
|
488
|
+
private paginate;
|
|
489
|
+
private execute;
|
|
490
|
+
private waitForConnection;
|
|
491
|
+
setCurrentInstance(params: RostrumParams): Promise<void>;
|
|
492
|
+
resetCurrentInstance(): Promise<void>;
|
|
493
|
+
getCurrentInstance(): Promise<RostrumParams>;
|
|
494
|
+
static getPredefinedInstances(): RostrumParams[];
|
|
495
|
+
}
|
|
496
|
+
export declare class KeyManager {
|
|
497
|
+
static readonly GAP_LIMIT = 20;
|
|
498
|
+
private seed?;
|
|
499
|
+
private masterKey?;
|
|
500
|
+
private accountKeys;
|
|
501
|
+
private walletKeys;
|
|
502
|
+
init(mnemonic: string | Uint8Array): void;
|
|
503
|
+
reset(): void;
|
|
504
|
+
clear(): void;
|
|
505
|
+
private getAccountKey;
|
|
506
|
+
deriveAddress(account: AccountType, space: KeySpace, index: number): string;
|
|
507
|
+
getKey(keyPath: string | KeyPath): HDPrivateKey;
|
|
508
|
+
}
|
|
509
|
+
export declare class AssetService {
|
|
510
|
+
private readonly walletDb;
|
|
511
|
+
private readonly walletCache;
|
|
512
|
+
constructor(walletDb: WalletDB, walletCache: WalletCache);
|
|
513
|
+
getAssetInfo(assetId: string): Promise<AssetInfo | undefined>;
|
|
514
|
+
handleNftReceive(accountId: number, tokenIdHex: string, time: number): Promise<void>;
|
|
515
|
+
syncTokens(accountId: number, tokenBalances: Record<string, Balance>): Promise<void>;
|
|
516
|
+
syncNfts(accountId: number, tokensBalance: Record<string, Balance>): Promise<void>;
|
|
517
|
+
saveToken(accountId: number, token: TokenEntity): Promise<void>;
|
|
518
|
+
deleteToken(accountId: number, tokenId: string): Promise<void>;
|
|
519
|
+
saveNft(accountId: number, nft: NftEntity, time: number): Promise<void>;
|
|
520
|
+
deleteNft(accountId: number, tokenId: string): Promise<void>;
|
|
521
|
+
getAssetFile(token: string, asset: string): Promise<Uint8Array>;
|
|
522
|
+
private getAssetMetadata;
|
|
523
|
+
private performGet;
|
|
524
|
+
}
|
|
525
|
+
export interface TxTemplateData {
|
|
526
|
+
templateScript: Script;
|
|
527
|
+
constraintScript: Script;
|
|
528
|
+
visibleArgs: any[];
|
|
529
|
+
publicKey: PublicKey;
|
|
530
|
+
}
|
|
531
|
+
export interface TxOptions {
|
|
532
|
+
isConsolidate?: boolean;
|
|
533
|
+
templateData?: TxTemplateData;
|
|
534
|
+
feeFromAmount?: boolean;
|
|
535
|
+
}
|
|
536
|
+
export declare class TransactionService {
|
|
537
|
+
private readonly rostrumService;
|
|
538
|
+
private readonly keyManager;
|
|
539
|
+
private readonly walletDb;
|
|
540
|
+
private readonly MAX_INPUTS_OUTPUTS;
|
|
541
|
+
constructor(rostrumService: RostrumService, keysManager: KeyManager, walletDb: WalletDB);
|
|
542
|
+
broadcastTransaction(txHex: string): Promise<string>;
|
|
543
|
+
fetchTransactionsHistory(address: string, fromHeight: number): Promise<{
|
|
544
|
+
txs: ITXHistory[];
|
|
545
|
+
lastHeight: number;
|
|
546
|
+
}>;
|
|
547
|
+
fetchVaultTransactions(address: string): Promise<TransactionDTO[]>;
|
|
548
|
+
classifyAndSaveTransaction(accountId: number, txHash: string, myAddresses: string[]): Promise<void>;
|
|
549
|
+
private classifyTransaction;
|
|
550
|
+
buildAndSignTransferTransaction(from: AddressKey[], toAddr: string, toChange: string, amount: string, feeFromAmount?: boolean, token?: string, feePerByte?: number, data?: string): Promise<Transaction>;
|
|
551
|
+
buildAndSignConsolidateTransaction(from: AddressKey[], toChange: string, templateData?: TxTemplateData): Promise<Transaction>;
|
|
552
|
+
private prepareTransaction;
|
|
553
|
+
private populateNexaInputsAndChange;
|
|
554
|
+
private populateTokenInputsAndChange;
|
|
555
|
+
private finalizeTransaction;
|
|
556
|
+
printTransactionJson(tx?: Transaction | null): string;
|
|
557
|
+
}
|
|
558
|
+
interface DappRpcRequest {
|
|
559
|
+
type: SessionRequestType;
|
|
560
|
+
accountId: number;
|
|
561
|
+
sessionId: string;
|
|
562
|
+
request: any;
|
|
563
|
+
}
|
|
564
|
+
interface TransactionDetails {
|
|
565
|
+
tx: Transaction;
|
|
566
|
+
send: MovementDetails[];
|
|
567
|
+
receive: MovementDetails[];
|
|
568
|
+
}
|
|
569
|
+
interface MovementDetails {
|
|
570
|
+
asset?: AssetInfo;
|
|
571
|
+
amount: bigint;
|
|
572
|
+
}
|
|
573
|
+
type NotificationAction = {
|
|
574
|
+
type: 'DAPP_REQUEST';
|
|
575
|
+
account: number;
|
|
576
|
+
sessionId: string;
|
|
577
|
+
payload: string;
|
|
578
|
+
} | {
|
|
579
|
+
type: 'DISPATCH';
|
|
580
|
+
actionType: string;
|
|
581
|
+
payload?: any;
|
|
582
|
+
} | {
|
|
583
|
+
type: 'NONE';
|
|
584
|
+
};
|
|
585
|
+
interface AppNotification {
|
|
586
|
+
id: string;
|
|
587
|
+
type: 'wallet' | 'web3';
|
|
588
|
+
title: string;
|
|
589
|
+
message?: string;
|
|
590
|
+
createdAt: number;
|
|
591
|
+
action?: NotificationAction;
|
|
592
|
+
}
|
|
593
|
+
type MethodHandler = {
|
|
594
|
+
resolve: (value: any) => void;
|
|
595
|
+
reject: (value: any) => void;
|
|
596
|
+
};
|
|
597
|
+
export type SessionEvent = {
|
|
598
|
+
type: 'session_added';
|
|
599
|
+
accountId: number;
|
|
600
|
+
sessionInfo: SessionInfo;
|
|
601
|
+
} | {
|
|
602
|
+
type: 'session_removed';
|
|
603
|
+
accountId: number;
|
|
604
|
+
sessionId: string;
|
|
605
|
+
} | {
|
|
606
|
+
type: 'sessions_cleared';
|
|
607
|
+
accountId: number;
|
|
608
|
+
} | {
|
|
609
|
+
type: 'new_notification';
|
|
610
|
+
notification: AppNotification;
|
|
611
|
+
} | {
|
|
612
|
+
type: 'new_request';
|
|
613
|
+
request: DappRpcRequest;
|
|
614
|
+
};
|
|
615
|
+
export type SessionUpdateCallback = (event: SessionEvent) => void;
|
|
616
|
+
export declare class SessionManager {
|
|
617
|
+
private readonly walletDb;
|
|
618
|
+
private readonly keyManager;
|
|
619
|
+
private readonly providers;
|
|
620
|
+
private readonly handlers;
|
|
621
|
+
private removeOnClose;
|
|
622
|
+
private updateCallback?;
|
|
623
|
+
constructor(walletDb: WalletDB, keyManager: KeyManager);
|
|
624
|
+
onUpdate(callback: SessionUpdateCallback): void;
|
|
625
|
+
private notify;
|
|
626
|
+
getHandler(request: string): MethodHandler | undefined;
|
|
627
|
+
add(account: AccountDTO, provider: DAppProvider, sessionInfo: SessionInfo): void;
|
|
628
|
+
remove(accountId: number, sessionId: string): void;
|
|
629
|
+
reload(accounts: Map<number, AccountDTO>): Promise<void>;
|
|
630
|
+
clear(): void;
|
|
631
|
+
revoke(accountId: number, sessionId: string): Promise<void>;
|
|
632
|
+
replayMessage(accountId: number, sessionId: string, payload: string): Promise<void>;
|
|
633
|
+
private registerHandlers;
|
|
634
|
+
}
|
|
635
|
+
export declare class TransactionTransformer {
|
|
636
|
+
private readonly rostrumService;
|
|
637
|
+
private readonly keyManager;
|
|
638
|
+
private readonly assetService;
|
|
639
|
+
constructor(rostrumService: RostrumService, keyManager: KeyManager, assetService: AssetService);
|
|
640
|
+
transformRawTransaction(hex: string, addressKey: AddressKey): Promise<TransactionDetails>;
|
|
641
|
+
private createContext;
|
|
642
|
+
private processInputs;
|
|
643
|
+
private processInput;
|
|
644
|
+
private processOutputs;
|
|
645
|
+
private signInputs;
|
|
646
|
+
private validateAndGetSubscript;
|
|
647
|
+
private processSignatureCoverage;
|
|
648
|
+
private checkSignatureCoverage;
|
|
649
|
+
private processAssetMovements;
|
|
650
|
+
private processAssetMovement;
|
|
651
|
+
}
|
|
652
|
+
type WalletAddress = AccountDTO | AddressDTO | VaultDTO;
|
|
653
|
+
export interface AddressHistory {
|
|
654
|
+
address: WalletAddress;
|
|
655
|
+
txs: ITXHistory[];
|
|
656
|
+
}
|
|
657
|
+
export type WalletEvent = {
|
|
658
|
+
type: 'new_tip';
|
|
659
|
+
tip: number;
|
|
660
|
+
} | {
|
|
661
|
+
type: 'new_account';
|
|
662
|
+
account: Account;
|
|
663
|
+
} | {
|
|
664
|
+
type: 'new_vault';
|
|
665
|
+
vault: VaultInfo;
|
|
666
|
+
} | {
|
|
667
|
+
type: 'sync_wallet';
|
|
668
|
+
loading: boolean;
|
|
669
|
+
} | {
|
|
670
|
+
type: 'clear_wallet';
|
|
671
|
+
} | {
|
|
672
|
+
type: 'account_balance_updated';
|
|
673
|
+
accountId: number;
|
|
674
|
+
balance: Balance;
|
|
675
|
+
tokensBalance: Record<string, Balance>;
|
|
676
|
+
} | {
|
|
677
|
+
type: 'vault_balance_updated';
|
|
678
|
+
address: string;
|
|
679
|
+
balance: Balance;
|
|
680
|
+
};
|
|
681
|
+
export type WalletUpdateCallback = (event: WalletEvent) => void;
|
|
682
|
+
export declare class WalletManager {
|
|
683
|
+
private readonly keyManager;
|
|
684
|
+
private readonly walletDb;
|
|
685
|
+
private readonly rostrumService;
|
|
686
|
+
private readonly assetService;
|
|
687
|
+
private readonly transactionService;
|
|
688
|
+
private readonly sessionManager;
|
|
689
|
+
private static readonly DEBOUNCE_MS;
|
|
690
|
+
accounts: Map<number, AccountDTO>;
|
|
691
|
+
accountsAddressToId: Map<string, number>;
|
|
692
|
+
receiveAddresses: AddressDTO[];
|
|
693
|
+
changeAddresses: AddressDTO[];
|
|
694
|
+
vaults: Map<string, VaultDTO>;
|
|
695
|
+
private pendingUpdates;
|
|
696
|
+
private updateTimer?;
|
|
697
|
+
private updatesStarted;
|
|
698
|
+
private updateCallback?;
|
|
699
|
+
private isConnected;
|
|
700
|
+
private isSubscribed;
|
|
701
|
+
private readonly discoveryService;
|
|
702
|
+
constructor(keyManager: KeyManager, walletDb: WalletDB, rostrumService: RostrumService, assetService: AssetService, transactionService: TransactionService, sessionManager: SessionManager);
|
|
703
|
+
clear(): void;
|
|
704
|
+
onUpdate(callback: WalletUpdateCallback): void;
|
|
705
|
+
private notify;
|
|
706
|
+
private getAllAddresses;
|
|
707
|
+
getMainAddresses(): AddressDTO[];
|
|
708
|
+
getReceiveAddress(accountId?: number): string;
|
|
709
|
+
getChangeAddress(accountId?: number): string;
|
|
710
|
+
getUsedAddressKeys(accountId?: number): AddressKey[];
|
|
711
|
+
reloadRostrum(params?: RostrumParams): Promise<void>;
|
|
712
|
+
initRostrum(): Promise<void>;
|
|
713
|
+
disconnectRostrum(): Promise<void>;
|
|
714
|
+
discoverWallet(): Promise<void>;
|
|
715
|
+
loadWallet(): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* First sync after discovery: subscriptions only queue updates, which are then processed
|
|
718
|
+
* in one batch before the update loop starts.
|
|
719
|
+
*/
|
|
720
|
+
initialSync(): Promise<void>;
|
|
721
|
+
reconnectSync(): Promise<[void, void]>;
|
|
722
|
+
private subscribeAllAddresses;
|
|
723
|
+
private initState;
|
|
724
|
+
private deriveAddresses;
|
|
725
|
+
private deriveAccounts;
|
|
726
|
+
private saveAddresses;
|
|
727
|
+
private saveAccounts;
|
|
728
|
+
private saveVaults;
|
|
729
|
+
/**
|
|
730
|
+
* The subscribe callback (onSubscribeEvent) receives each address's initial status,
|
|
731
|
+
* so changed addresses are registered for update from there.
|
|
732
|
+
*/
|
|
733
|
+
private subscribeAddresses;
|
|
734
|
+
private onSubscribeEvent;
|
|
735
|
+
private registerUpdate;
|
|
736
|
+
private scheduleUpdates;
|
|
737
|
+
private startUpdates;
|
|
738
|
+
private stopUpdates;
|
|
739
|
+
private processPendingUpdates;
|
|
740
|
+
private postProcessWalletUpdate;
|
|
741
|
+
private postProcessAccountsUpdate;
|
|
742
|
+
private postProcessActivity;
|
|
743
|
+
private fetchAndUpdateAddress;
|
|
744
|
+
private fetchAndUpdateAccount;
|
|
745
|
+
private fetchAndUpdateVault;
|
|
746
|
+
private checkGapLimit;
|
|
747
|
+
addNewAccount(id: number, name: string): Promise<void>;
|
|
748
|
+
updateAccountName(id: number, name: string): Promise<void>;
|
|
749
|
+
rescanAccount(id: number): void;
|
|
750
|
+
rescanVaults(): Promise<AddressHistory[]>;
|
|
751
|
+
getVaultNextIndex(): number;
|
|
752
|
+
addNewVault(address: string, block: number, index: number): Promise<void>;
|
|
753
|
+
private addVault;
|
|
754
|
+
recoverVaults(): Promise<boolean>;
|
|
755
|
+
private recoverTokens;
|
|
756
|
+
private isVaultAddress;
|
|
757
|
+
private isAccountAddress;
|
|
758
|
+
private isMainAddress;
|
|
759
|
+
}
|
|
760
|
+
export declare const HD_WALLET_ID = -1;
|
|
761
|
+
export declare const MAX_INT64 = 9223372036854775807n;
|
|
762
|
+
export declare const CURRENCIES: {
|
|
763
|
+
readonly usd: {
|
|
764
|
+
readonly symbol: "$";
|
|
765
|
+
readonly name: "US Dollar";
|
|
766
|
+
};
|
|
767
|
+
readonly eur: {
|
|
768
|
+
readonly symbol: "€";
|
|
769
|
+
readonly name: "Euro";
|
|
770
|
+
};
|
|
771
|
+
readonly gbp: {
|
|
772
|
+
readonly symbol: "£";
|
|
773
|
+
readonly name: "British Pound";
|
|
774
|
+
};
|
|
775
|
+
readonly aud: {
|
|
776
|
+
readonly symbol: "A$";
|
|
777
|
+
readonly name: "Australian Dollar";
|
|
778
|
+
};
|
|
779
|
+
readonly cad: {
|
|
780
|
+
readonly symbol: "CA$";
|
|
781
|
+
readonly name: "Canadian Dollar";
|
|
782
|
+
};
|
|
783
|
+
readonly chf: {
|
|
784
|
+
readonly symbol: "CHF";
|
|
785
|
+
readonly name: "Swiss Franc";
|
|
786
|
+
};
|
|
787
|
+
readonly inr: {
|
|
788
|
+
readonly symbol: "₹";
|
|
789
|
+
readonly name: "Indian Rupee";
|
|
790
|
+
};
|
|
791
|
+
readonly cny: {
|
|
792
|
+
readonly symbol: "CN¥";
|
|
793
|
+
readonly name: "Chinese Yuan";
|
|
794
|
+
};
|
|
795
|
+
readonly jpy: {
|
|
796
|
+
readonly symbol: "¥";
|
|
797
|
+
readonly name: "Japanese Yen";
|
|
798
|
+
};
|
|
799
|
+
};
|
|
800
|
+
export type CurrencyCode = keyof typeof CURRENCIES;
|
|
801
|
+
export declare const currencyCodes: CurrencyCode[];
|
|
802
|
+
export declare function isTestnet(): boolean;
|
|
803
|
+
export declare function isGenesisHashValid(hash: string): boolean;
|
|
804
|
+
export declare function isValidNexaAddress(address: string, type?: AddressType): boolean;
|
|
805
|
+
export declare function getExplorerUrl(): string;
|
|
806
|
+
export declare function currentTimestamp(): number;
|
|
807
|
+
export declare function isNullOrEmpty(arg?: string | any[] | null): arg is undefined | [] | null | '';
|
|
808
|
+
export declare function truncateStringMiddle(str?: string, maxLength?: number): string;
|
|
809
|
+
export declare function capitalizeFirstLetter(str: string): string;
|
|
810
|
+
export declare function getAddressBuffer(address: string): Uint8Array;
|
|
811
|
+
export declare function tokenIdToHex(token: string): string;
|
|
812
|
+
export declare function tokenHexToAddr(token: string): string;
|
|
813
|
+
export declare function tokenAmountToAssetAmount(amount?: string | number | bigint): string;
|
|
814
|
+
export declare function sumBalance(balances: Balance[]): Balance;
|
|
815
|
+
export declare function sumTokensBalance(balances: Record<string, Balance>[]): Record<string, Balance>;
|
|
816
|
+
export declare function getFileMediaType(filename: string): 'video' | 'audio' | 'image' | 'unknown';
|
|
817
|
+
export declare function getFileMimeType(filename: string): string;
|
|
818
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
819
|
+
export declare function prettifyAmount(amount: string | number | bigint): string;
|
|
820
|
+
export declare function calculateFiatValue(amount: string | number, price: number, currency: CurrencyCode, locale?: string): string;
|
|
821
|
+
export type MarketEvent = {
|
|
822
|
+
type: 'market_data_updated';
|
|
823
|
+
currency: CurrencyCode;
|
|
824
|
+
data: Record<string, MarketData>;
|
|
825
|
+
} | {
|
|
826
|
+
type: 'currency_updated';
|
|
827
|
+
currency: CurrencyCode;
|
|
828
|
+
};
|
|
829
|
+
export type MarketUpdateCallback = (event: MarketEvent) => void;
|
|
830
|
+
export declare class MarketService {
|
|
831
|
+
private static readonly POLL_INTERVAL_MS;
|
|
832
|
+
private static readonly CURRENCY_SETTING;
|
|
833
|
+
private static readonly SUPPORTED_TOKENS;
|
|
834
|
+
private readonly walletDb;
|
|
835
|
+
private currency;
|
|
836
|
+
private running;
|
|
837
|
+
private pollTimer?;
|
|
838
|
+
private updateCallback?;
|
|
839
|
+
constructor(walletDb: WalletDB);
|
|
840
|
+
onUpdate(callback: MarketUpdateCallback): void;
|
|
841
|
+
private notify;
|
|
842
|
+
init(): Promise<void>;
|
|
843
|
+
stop(): void;
|
|
844
|
+
getCurrency(): CurrencyCode;
|
|
845
|
+
setCurrency(currency: CurrencyCode): Promise<void>;
|
|
846
|
+
private poll;
|
|
847
|
+
private scheduleNext;
|
|
848
|
+
private fetchMarketData;
|
|
849
|
+
}
|
|
850
|
+
export declare function transformTokenIconUrl(icon: string, documentUrl: string): string;
|
|
851
|
+
export declare function parseTokenDataUrl(data?: string): string | null;
|
|
852
|
+
export declare function getAssetMetadataUrl(token: string): string;
|
|
853
|
+
export declare function getAssetFileUrl(token: string, asset: string): string;
|
|
854
|
+
export declare function generateNewMnemonic(size?: 12 | 24): string;
|
|
855
|
+
export declare function isMnemonicValid(mnemonic: string): boolean;
|
|
856
|
+
export declare function encryptMnemonic(phrase: string, password: string): Promise<string>;
|
|
857
|
+
export declare function validateAndDecryptMnemonic(encSeed: string, password: string): Promise<string | false>;
|
|
858
|
+
export declare const VAULT_FIRST_BLOCK = 274710;
|
|
859
|
+
export declare function getVaultTemplate(): Script;
|
|
860
|
+
export declare function getVaultTemplateHash(): Uint8Array;
|
|
861
|
+
export declare function generateVaultConstraint(pubKey: PublicKey): Script;
|
|
862
|
+
export declare function getVaultConstraintHash(pubKey: PublicKey): Uint8Array;
|
|
863
|
+
export declare function generateVaultVisibleArgs(args: number[]): ScriptElement[];
|
|
864
|
+
export declare function generateVaultAddress(pubKey: PublicKey, args: number[]): string | undefined;
|
|
865
|
+
export declare function estimateDateByFutureBlock(current: number, future: number): string;
|
|
866
|
+
export declare function keyPathToString(account: AccountType, type: KeySpace, index: number): string;
|
|
867
|
+
export declare function stringToKeyPath(path: string): KeyPath;
|
|
868
|
+
export type { Account, AccountDTO, AccountEntity, AddressDTO, AddressEntity, AddressKey, AppNotification, AssetBase, AssetEntity, AssetInfo, AssetMovement, AssetTransactionEntity, AssetType, Balance, BlockTip, DappRpcRequest, IFirstUse, IListUnspentRecord, IScriptPubKey, IScriptSig, ISpent, ITXHistory, ITXInput, ITXOutput, ITemplateScript, ITokenUtxo, ITokensBalance, ITransaction, IUtxo, KeyPath, MarketData, MovementDetails, NFTAsset, NftEntity, NotificationAction, RostrumParams, ServerFeatures, SessionEntity, SessionInfo, SettingEntity, TokenAsset, TokenEntity, TransactionDTO, TransactionDetails, TransactionEntity, TransactionType, VaultDTO, VaultEntity, VaultInfo };
|
|
869
|
+
//# sourceMappingURL=index.d.ts.map
|