quantumcoin 7.0.11 → 7.0.12

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.
@@ -1,1024 +1,1031 @@
1
- /**
2
- * The initialize function has to be called before attempting to invoke any other function. This function should be called only once.
3
- *
4
- * @async
5
- * @function initialize
6
- * @param {Config|undefined} clientConfig - A configuration represented by the Config class. A default configuration is used, if not specified.
7
- * @return {Promise<boolean>} Returns a promise of type boolean; true if the initialization succeeded, else false.
8
- */
9
- export function initialize(clientConfig: Config | undefined): Promise<boolean>;
10
- /**
11
- * The serializeWallet function serializes a Wallet object to a JSON string. You should encrypt the string before saving it to disk or a database.
12
- *
13
- * @function serializeWallet
14
- * @param {Wallet} wallet - A Wallet object representing the wallet to serialize.
15
- * @return {string} Returns the Wallet in JSON string format. If the wallet is invalid, null is returned.
16
- */
17
- export function serializeWallet(wallet: Wallet): string;
18
- /**
19
- * The deserializeWallet function creates a Wallet object from a JSON string.
20
- *
21
- * @function deserializeWallet
22
- * @param {string} walletJson - A Wallet object representing the wallet to deserialize.
23
- * @return {Wallet} Returns the Wallet corresponding to the walletJson. If the wallet is invalid, null is returned.
24
- */
25
- export function deserializeWallet(walletJson: string): Wallet;
26
- /**
27
- * The serializeEncryptedWallet function encrypts and serializes a Wallet object to a JSON string readable by the Desktop/Mobile/Web/CLI wallet applications. You can save this string to a file and open the file in one of these wallet applications. You may also open this string using the deserializeEncryptedWallet function. If you loose the passphrase, you will be unable to open the wallet. This function can take upto a minute or so to execute.
28
- *
29
- * @function serializeEncryptedWallet
30
- * @param {Wallet} wallet - A Wallet object representing the wallet to serialize.
31
- * @param {string} passphrase - A passphrase used to encrypt the wallet. It should atleast be 12 characters long.
32
- * @return {string} Returns the Wallet in JSON string format. If the wallet is invalid, null is returned.
33
- */
34
- export function serializeEncryptedWallet(wallet: Wallet, passphrase: string): string;
35
- /**
36
- * The serializeSeedAsEncryptedWallet function encrypts a raw seed byte array into a wallet JSON string
37
- * that can be opened with deserializeEncryptedWallet or Desktop/Mobile/Web/CLI wallet applications.
38
- * The seed is stored in its pre-expansion form (version 5 wallet format). This function can take
39
- * up to a minute or so to execute due to key derivation.
40
- *
41
- * @function serializeSeedAsEncryptedWallet
42
- * @param {Array<number>|Uint8Array} seedArray - The raw seed bytes. Length must be 96, 72, or 64 depending on scheme.
43
- * @param {string} passphrase - A passphrase used to encrypt the wallet. Must be at least 12 characters long.
44
- * @return {string|number|null} Returns the encrypted wallet JSON string. Returns -1000 if not initialized, null if the operation failed.
45
- */
46
- export function serializeSeedAsEncryptedWallet(seedArray: Array<number> | Uint8Array, passphrase: string): string | number | null;
47
- /**
48
- * The deserializeEncryptedWallet function opens a wallet backed-up using an application such as the Desktop/Mobile/CLI/Web wallet. This function can take upto a minute or so to execute. You should open wallets only from trusted sources.
49
- *
50
- * @function deserializeEncryptedWallet
51
- * @param {string} walletJsonString - The json string from a wallet file.
52
- * @param {string} passphrase - The passphrase used to encrypt the wallet.
53
- * @return {Wallet} Returns a Wallet object. Returns null if opening the wallet fails.
54
- */
55
- export function deserializeEncryptedWallet(walletJsonString: string, passphrase: string): Wallet;
56
- /**
57
- * The verifyWallet function verifies whether a Wallet is valid or not. To mitigate spoofing and other attachs, it is highly recommended to verify a wallet, especially if it is from an untrusted source.
58
- *
59
- * @function verifyWallet
60
- * @param {Wallet} wallet - A Wallet object representing the wallet to verify.
61
- * @return {boolean} Returns true if the Wallet verification succeeded, else returns false.
62
- */
63
- export function verifyWallet(wallet: Wallet): boolean;
64
- /**
65
- * The newWallet function creates a new Wallet.
66
- * @function newWallet
67
- * @param {number|null} keyType - Optional. KEY_TYPE_HYBRIDEDMLDSASLHDSA (3) or KEY_TYPE_HYBRIDEDMLDSASLHDSA5 (5). null/undefined defaults to 3.
68
- * @return {Wallet|number} Returns a Wallet object, or -1000 (not initialized), -1001 (invalid key type), -1002 (crypto failure).
69
- */
70
- export function newWallet(keyType: number | null): Wallet | number;
71
- /**
72
- * The sendCoins function posts a send-coin transaction to the blockchain. The chainId used for signing should be provided in the initialize() function.
73
- * Since the gas fee for sending coins is fixed at 1000 coins, there is no option to set the gas fee explicitly.
74
- * It may take many seconds after submitting a transaction before the transaction is returned by the getTransactionDetails function.
75
- * Transactions are usually committed in less than 30 seconds.
76
- *
77
- * @deprecated Use signRawTransaction and postTransaction instead.
78
- * @async
79
- * @function sendCoins
80
- * @param {Wallet} wallet - A Wallet object from which the transaction has to be sent. The address corresponding to the Wallet should have enough coins to cover gas fees as well. A minimum of 1000 coins (1000000000000000000000 wei) are required for gas fees.
81
- * @param {string} toAddress - The address to which the coins should be sent.
82
- * @param {string} coins - The string representing the number of coins (in ether) to send. To convert between ethers and wei, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
83
- * @param {number} nonce - The nonce of the account retrieved by invoking the getAccountDetails function. You have to carefully manage state of the nonce to avoid sending the coins multiple times, such as when retrying sendCoins after a network error.
84
- * @return {Promise<SendResult>} Returns a promise of type SendResult.
85
- */
86
- export function sendCoins(wallet: Wallet, toAddress: string, coins: string, nonce: number): Promise<SendResult>;
87
- /**
88
- * The getAccountDetails function returns details of an account corresponding to the address.
89
- *
90
- * @async
91
- * @function getAccountDetails
92
- * @param {string} address - The address of the account of which the details have to be retrieved.
93
- * @return {Promise<AccountDetailsResult>} Returns a promise of type AccountDetailsResult.
94
- */
95
- export function getAccountDetails(address: string): Promise<AccountDetailsResult>;
96
- /**
97
- * The getTransactionDetails function returns details of a transaction posted to the blockchain.
98
- * Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for reading.
99
- * Some transactions that have lower balance than the minimum required for gas fees may be discarded.
100
- * In these cases, the transactions may not be returned when invoking the getTransactionDetails function.
101
- * You should consider the transaction as succeeded only if the status field of the transactionReceipt object is 0x1 (success).
102
- * The transactionReceipt field can be null unless the transaction is registered with the blockchain.
103
- * @async
104
- * @function getTransactionDetails
105
- * @param {string} txnHash - The hash of the transaction to retrieve.
106
- * @return {Promise<TransactionDetailsResult>} Returns a promise of type type TransactionDetailsResult.
107
- */
108
- export function getTransactionDetails(txnHash: string): Promise<TransactionDetailsResult>;
109
- /**
110
- * The isAddressValid function validates whether an address is valid or not. An address is of length 66 characters including 0x.
111
- *
112
- * @function isAddressValid
113
- * @param {string} address - A string representing the address to validate.
114
- * @return {boolean} Returns true if the address validation succeeded, else returns false.
115
- */
116
- export function isAddressValid(address: string): boolean;
117
- /**
118
- * The getLatestBlockDetails function returns details of the latest block of the blockchain.
119
- *
120
- * @async
121
- * @function getLatestBlockDetails
122
- * @return {Promise<LatestBlockDetailsResult>} Returns a promise of an object of type BlockDetailsResult.
123
- */
124
- export function getLatestBlockDetails(): Promise<LatestBlockDetailsResult>;
125
- /**
126
- * The signSendCoinTransaction function returns a signed transaction. The chainId used for signing should be provided in the initialize() function.
127
- * Since the gas fee for sending coins is fixed at 1000 coins, there is no option to set the gas fee explicitly.
128
- * This function is useful for offline (cold storage) wallets, where you can sign a transaction offline and then use the postTransaction function to post it on a connected device.
129
- * Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
130
- *
131
- * @deprecated Use signRawTransaction instead.
132
- * @function signSendCoinTransaction
133
- * @param {Wallet} wallet - A Wallet object from which the transaction has to be sent. The address corresponding to the Wallet should have enough coins to cover gas fees as well. A minimum of 1000 coins (1000000000000000000000 wei) are required for gas fees.
134
- * @param {string} toAddress - The address to which the coins should be sent.
135
- * @param {string} coins - The string representing the number of coins (in ether) to send. To convert between ethers and wei, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
136
- * @param {number} nonce - The nonce of the account retrieved by invoking the getAccountDetails function. You have to carefully manage state of the nonce to avoid sending the coins multiple times, such as when retrying sendCoins after a network error.
137
- * @return {SignResult} Returns a promise of type SignResult.
138
- */
139
- export function signSendCoinTransaction(wallet: Wallet, toAddress: string, coins: string, nonce: number): SignResult;
140
- /**
141
- * The listAccountTransactions function returns a list of transactions for a specific account.
142
- * Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for listing.
143
- * Some transactions that have lower balance than the minimum required for gas fees may be discarded.
144
- * In these cases, the transactions may not be returned when invoking the listAccountTransactions function.
145
- * You should consider the transaction as succeeded only if the status field AccountDetailsCompact object is 0x1 (success).
146
- * Both transactions from and transactions to the address will be returned in the list.
147
- * Use the getTransactionDetails function, passing the hash of the transaction to get detailed information about the transaction.
148
- * @async
149
- * @function listAccountTransactions
150
- * @param {string} address - The address for which the transactions have to be listed.
151
- * @param {number} pageNumber - The page number for which the transactions has to be listed for the account. Pass 0 to list the latest page. Pass 1 to list the oldest page. A maximum of 20 transactions are returned in each page. The response of this API includes a field that shows the pageCount (total number of pages available). You can pass any number between 1 to pageCount to get the corresponding page.
152
- * @return {Promise<ListAccountTransactionsResponse>} Returns a promise of type type ListAccountTransactionsResponse.
153
- */
154
- export function listAccountTransactions(address: string, pageNumber: number): Promise<ListAccountTransactionsResponse>;
155
- /**
156
- * The postTransaction function posts a signed transaction to the blockchain.
157
- * This method can be used in conjunction with the signSendCoinTransaction method to submit a transaction that was signed using a cold wallet (offline or disconnected or air-gapped wallet).
158
- *
159
- * @async
160
- * @function postTransaction
161
- * @param {string} txnData - A signed transaction string returned by the signSendCoinTransaction function.
162
- * @return {Promise<SendResult>} Returns a promise of type SendResult. txnHash will be null in SendResult.
163
- */
164
- export function postTransaction(txnData: string): Promise<SendResult>;
165
- /**
166
- * @class
167
- * @constructor
168
- * @public
169
- * @classdesc This is the configuration class required to initialize and interact with Quantum Coin blockchain
170
- */
171
- export class Config {
172
- /**
173
- * Creates a config class
174
- * @param {string} readUrl - The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay. The following URLs are community maintained. Please use your own relay service. Mainnet: https://sdk.readrelay.quantumcoinapi.com
175
- * @param {string} writeUrl - The Write API URL pointing to a write relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay. The following URLs are community maintained. Please use your own relay service. Mainnet: https://sdk.writerelay.quantumcoinapi.com
176
- * @param {number} chainId - The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324.
177
- * @param {string} readApiKey - Optional parameter if authorization is enabled for the relay service. API Key for authorization. Defaults to null which indicates no authorization.
178
- * @param {string} writeApiKey - Optional parameter if authorization is enabled for the relay service. API Key for authorization. Defaults to null which indicates no authorization.
179
- */
180
- constructor(readUrl: string, writeUrl: string, chainId: number, readApiKey: string, writeApiKey: string);
181
- /**
182
- * The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay
183
- * @type {string}
184
- * @public
185
- */
186
- public readUrl: string;
187
- /**
188
- * The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay
189
- * @type {string}
190
- * @public
191
- */
192
- public writeUrl: string;
193
- /**
194
- * The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324.
195
- * @type {number}
196
- * @public
197
- */
198
- public chainId: number;
199
- /**
200
- * API Key for authorization if authorization is enabled for the relay service. Defaults to null which indicates no authorization.
201
- * @type {string}
202
- * @public
203
- */
204
- public readApiKey: string;
205
- /**
206
- * API Key for authorization if authorization is enabled for the relay service. Defaults to null which indicates no authorization.
207
- * @type {string}
208
- * @public
209
- */
210
- public writeApiKey: string;
211
- }
212
- /**
213
- * @class
214
- * @constructor
215
- * @public
216
- * @classdesc This class represents a Wallet. Use the verifyWallet function to verify if a wallet is valid. Verifying the wallet is highly recommended, especially if it comes from an untrusted source. For more details on the underlying cryptography of the Wallet, see https://github.com/QuantumCoinProject/hybrid-pqc
217
- */
218
- export class Wallet {
219
- /**
220
- * Creates a Wallet class. The constructor does not verify the wallet. To verify a wallet, call the verifyWallet function explicitly.
221
- * @param {string} address - Address of the wallet
222
- * @param {number[]} privateKey - Private Key byte array of the wallet
223
- * @param {number[]} publicKey - The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324.
224
- */
225
- constructor(address: string, privateKey: number[], publicKey: number[]);
226
- /**
227
- * Address of the wallet. Is 66 bytes in length including 0x (if the wallet is valid).
228
- * @type {string}
229
- * @public
230
- */
231
- public address: string;
232
- /**
233
- * Private Key byte array of the wallet. Is 4064 bytes in length (if the wallet is valid).
234
- * @type {number[]}
235
- * @public
236
- */
237
- public privateKey: number[];
238
- /**
239
- * Public Key byte array of the wallet. Is 1408 bytes in length (if the wallet is valid).
240
- * @type {number[]}
241
- * @public
242
- */
243
- public publicKey: number[];
244
- }
245
- /**
246
- * @class
247
- * @constructor
248
- * @public
249
- * @classdesc This class represents a Block.
250
- */
251
- export class BlockDetails {
252
- constructor(blockNumber: any);
253
- /**
254
- * Block Number of the block
255
- * @type {number}
256
- * @public
257
- */
258
- public blockNumber: number;
259
- }
260
- /**
261
- * @class
262
- * @constructor
263
- * @public
264
- * @classdesc This class represents a result from invoking the getLatestBlock function.
265
- */
266
- export class LatestBlockDetailsResult {
267
- constructor(resultCode: any, blockDetails: any, response: any, requestId: any, err: any);
268
- /**
269
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
270
- * @type {number}
271
- * @public
272
- */
273
- public resultCode: number;
274
- /**
275
- * An object of type BlockDetails representing the block. This value is null if the value of resultCode is not 0.
276
- * @type {BlockDetails}
277
- * @public
278
- */
279
- public blockDetails: BlockDetails;
280
- /**
281
- * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
282
- * @type {Object}
283
- * @public
284
- */
285
- public response: Object;
286
- /**
287
- * An unique id to represent the request. This can be null if request failed before it could be sent.
288
- * @type {string}
289
- * @public
290
- */
291
- public requestId: string;
292
- /**
293
- * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
294
- * @type {Error}
295
- * @public
296
- */
297
- public err: Error;
298
- }
299
- /**
300
- * @class
301
- * @constructor
302
- * @public
303
- * @classdesc This class represents an Account.
304
- */
305
- export class AccountDetails {
306
- constructor(address: any, balance: any, nonce: any, blockNumber: any);
307
- /**
308
- * Address of the wallet. Is 66 bytes in length including 0x.
309
- * @type {string}
310
- * @public
311
- */
312
- public address: string;
313
- /**
314
- * Balance of the account in wei. To convert this to ethers, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
315
- * @type {string}
316
- * @public
317
- */
318
- public balance: string;
319
- /**
320
- * A monotonically increasing number representing the nonce of the account. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
321
- * @type {number}
322
- * @public
323
- */
324
- public nonce: number;
325
- /**
326
- * The block number as of which the Account details was retrieved.
327
- * @type {number}
328
- * @public
329
- */
330
- public blockNumber: number;
331
- }
332
- /**
333
- * @class
334
- * @constructor
335
- * @public
336
- * @classdesc This class represents a result from invoking the getAccountDetails function.
337
- */
338
- export class AccountDetailsResult {
339
- constructor(resultCode: any, accountDetails: any, response: any, requestId: any, err: any);
340
- /**
341
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
342
- * @type {number}
343
- * @public
344
- */
345
- public resultCode: number;
346
- /**
347
- * An object of type AccountDetails representing the block. This value is null if the value of resultCode is not 0.
348
- * @type {AccountDetails}
349
- * @public
350
- */
351
- public accountDetails: AccountDetails;
352
- /**
353
- * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
354
- * @type {Object}
355
- * @public
356
- */
357
- public response: Object;
358
- /**
359
- * An unique id to represent the request. This can be null if request failed before it could be sent.
360
- * @type {string}
361
- * @public
362
- */
363
- public requestId: string;
364
- /**
365
- * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
366
- * @type {Error}
367
- * @public
368
- */
369
- public err: Error;
370
- }
371
- /**
372
- * @class
373
- * @constructor
374
- * @public
375
- * @classdesc This class represents a result from invoking the sendCoins function.
376
- */
377
- export class SendResult {
378
- constructor(resultCode: any, txnHash: any, response: any, requestId: any, err: any);
379
- /**
380
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
381
- * @type {number}
382
- * @public
383
- */
384
- public resultCode: number;
385
- /**
386
- * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x. This value is null if the value of resultCode is not 0.
387
- * @type {string}
388
- * @public
389
- */
390
- public txnHash: string;
391
- /**
392
- * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
393
- * @type {Object}
394
- * @public
395
- */
396
- public response: Object;
397
- /**
398
- * An unique id to represent the request. This can be null if request failed before it could be sent.
399
- * @type {string}
400
- * @public
401
- */
402
- public requestId: string;
403
- /**
404
- * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
405
- * @type {Error}
406
- * @public
407
- */
408
- public err: Error;
409
- }
410
- /**
411
- * @class
412
- * @constructor
413
- * @public
414
- * @classdesc This class represents a Receipt of a transaction that is registered in the blockchain. The transactionReceipt field can be null unless the transaction is registered with the blockchain.
415
- * While the transaction is pending, this field will be null. You should consider the transaction as succeeded only if the status field's value is 0x1 (success).
416
- */
417
- export class TransactionReceipt {
418
- /**
419
- * A hexadecimal string representing the total amount of gas used when this transaction was executed in the block.
420
- * @type {string}
421
- * @public
422
- */
423
- public cumulativeGasUsed: string;
424
- /**
425
- * A hexadecimal string representing the sum of the base fee and tip paid per unit of gas.
426
- * @type {string}
427
- * @public
428
- */
429
- public effectiveGasPrice: string;
430
- /**
431
- * A hexadecimal string representing the amount of gas used by this specific transaction alone.
432
- * @type {string}
433
- * @public
434
- */
435
- public gasUsed: string;
436
- /**
437
- * A hexadecimal string representing either 0x1 (success) or 0x0 (failure). Failed transactions can also incur gas fee. You should consider the transaction as succeeded only if the status value is 0x1 (success).
438
- * @type {string}
439
- * @public
440
- */
441
- public status: string;
442
- /**
443
- * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x.
444
- * @type {string}
445
- * @public
446
- */
447
- public hash: string;
448
- /**
449
- * A hexadecimal string representing the transaction type. 0x0 is DefaultFeeTxType.
450
- * @type {string}
451
- * @public
452
- */
453
- public type: string;
454
- }
455
- /**
456
- * @class
457
- * @constructor
458
- * @public
459
- * @classdesc This class represents details of a transaction. You should consider the transaction as succeeded only if the status field of the receipt object is 0x1 (success).
460
- */
461
- export class TransactionDetails {
462
- /**
463
- * A hexadecimal string representing the hash of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
464
- * @type {string}
465
- * @public
466
- */
467
- public blockHash: string;
468
- /**
469
- * The number of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
470
- * @type {number}
471
- * @public
472
- */
473
- public blockNumber: number;
474
- /**
475
- * A 66 character hexadecimal string representing the address the transaction is sent from.
476
- * @type {string}
477
- * @public
478
- */
479
- public from: string;
480
- /**
481
- * A hexadecimal string representing the gas provided for the transaction execution.
482
- * @type {string}
483
- * @public
484
- */
485
- public gas: string;
486
- /**
487
- * A hexadecimal string representing the gasPrice used for each paid gas, in Wei.
488
- * @type {string}
489
- * @public
490
- */
491
- public gasPrice: string;
492
- /**
493
- * A 66 character hexadecimal string representing the hash of the transaction.
494
- * @type {string}
495
- * @public
496
- */
497
- public hash: string;
498
- /**
499
- * A hexadecimal string representing the compiled code of a contract OR the hash of the invoked method signature and encoded parameters.
500
- * @type {string}
501
- * @public
502
- */
503
- public input: string;
504
- /**
505
- * A monotonically increasing number representing the nonce of the account. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
506
- * @type {number}
507
- * @public
508
- */
509
- public nonce: number;
510
- /**
511
- * A 66 character hexadecimal string representing address the transaction is directed to.
512
- * @type {string}
513
- * @public
514
- */
515
- public to: string;
516
- /**
517
- * A hexadecimal string representing the value sent with this transaction. The value can be 0 for smart contract transactions, since it only represents the number of coins sent.
518
- * @type {string}
519
- * @public
520
- */
521
- public value: string;
522
- /**
523
- * The receipt of the transaction. This field will be null while the transaction is pending (not yet registered in the blockchain).
524
- * @type {TransactionReceipt}
525
- * @public
526
- */
527
- public receipt: TransactionReceipt;
528
- }
529
- /**
530
- * @class
531
- * @constructor
532
- * @public
533
- * @classdesc This class represents a result from invoking the getTransactionDetails function. If transactions get discarded by the blockchain, for reasons such as due to lower than minimum gas fees or invalid nonce, the resultCode will always contain a non-zero value (failure).
534
- */
535
- export class TransactionDetailsResult {
536
- constructor(resultCode: any, transactionDetails: any, response: any, requestId: any, err: any);
537
- /**
538
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
539
- * @type {number}
540
- * @public
541
- */
542
- public resultCode: number;
543
- /**
544
- * An object of type TransactionDetails representing the transaction. This value is null if the value of resultCode is not 0.
545
- * @type {TransactionDetails}
546
- * @public
547
- */
548
- public transactionDetails: TransactionDetails;
549
- /**
550
- * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
551
- * @type {Object}
552
- * @public
553
- */
554
- public response: Object;
555
- /**
556
- * An unique id to represent the request. This can be null if request failed before it could be sent.
557
- * @type {string}
558
- * @public
559
- */
560
- public requestId: string;
561
- /**
562
- * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
563
- * @type {Error}
564
- * @public
565
- */
566
- public err: Error;
567
- }
568
- /**
569
- * @class
570
- * @constructor
571
- * @public
572
- * @classdesc This class represents a result from invoking the listAccountTransactionDetails function.
573
- */
574
- export class AccountTransactionsResult {
575
- constructor(resultCode: any, listAccountTransactionsResponse: any, response: any, requestId: any, err: any);
576
- /**
577
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
578
- * @type {number}
579
- * @public
580
- */
581
- public resultCode: number;
582
- /**
583
- * An object of type ListAccountTransactionsResponse representing the list of transactions along with metadata. This value is null if the value of resultCode is not 0.
584
- * @type {ListAccountTransactionsResponse}
585
- * @public
586
- */
587
- public listAccountTransactionsResponse: ListAccountTransactionsResponse;
588
- /**
589
- * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
590
- * @type {Object}
591
- * @public
592
- */
593
- public response: Object;
594
- /**
595
- * An unique id to represent the request. This can be null if request failed before it could be sent.
596
- * @type {string}
597
- * @public
598
- */
599
- public requestId: string;
600
- /**
601
- * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
602
- * @type {Error}
603
- * @public
604
- */
605
- public err: Error;
606
- }
607
- /**
608
- * @class
609
- * @constructor
610
- * @public
611
- * @classdesc This class represents a list of account transactions returned by the listAccountTransactionDetails function.
612
- */
613
- export class ListAccountTransactionsResponse {
614
- /**
615
- * The number of pages available for listing.
616
- * @type {number}
617
- * @public
618
- */
619
- public pageCount: number;
620
- /**
621
- * An array of type AccountTransactionCompact, containing the list of transactions. Can be null if no items are available.
622
- * @type {(AccountTransactionCompact|Array)}
623
- * @public
624
- */
625
- public items: (AccountTransactionCompact | any[]);
626
- }
627
- /**
628
- * @class
629
- * @constructor
630
- * @public
631
- * @classdesc This class represents a transaction of an account. You should consider the transaction as succeeded only if the status field is 0x1 (success).
632
- */
633
- export class AccountTransactionCompact {
634
- /**
635
- * The number of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
636
- * @type {number}
637
- * @public
638
- */
639
- public blockNumber: number;
640
- /**
641
- * A 66 character hexadecimal string representing the address the transaction is sent from.
642
- * @type {string}
643
- * @public
644
- */
645
- public from: string;
646
- /**
647
- * A 66 character hexadecimal string representing the hash of the transaction.
648
- * @type {string}
649
- * @public
650
- */
651
- public hash: string;
652
- /**
653
- * A 66 character hexadecimal string representing address the transaction is directed to.
654
- * @type {string}
655
- * @public
656
- */
657
- public to: string;
658
- /**
659
- * A hexadecimal string representing the value sent with this transaction. The value can be 0 for smart contract transactions, since it only represents the number of coins sent.
660
- * @type {string}
661
- * @public
662
- */
663
- public value: string;
664
- /**
665
- * A hexadecimal string representing either 0x1 (success) or 0x0 (failure). Failed transactions can also incur gas fee. You should consider the transaction as succeeded only if the status value is 0x1 (success).
666
- * @type {string}
667
- * @public
668
- */
669
- public status: string;
670
- }
671
- /**
672
- * The newWalletSeed function creates a new Wallet seed word list. The return array can then be passed to the openWalletFromSeedWords function to create a new wallet.
673
- *
674
- * @function newWalletSeed
675
- * @param {number|null} keyType - Optional. KEY_TYPE_HYBRIDEDMLDSASLHDSA (3) or KEY_TYPE_HYBRIDEDMLDSASLHDSA5 (5). null/undefined defaults to 3.
676
- * @return {array|number|null} Returns an array of seed words (32 or 36 words). Returns -1000 if not initialized, null on failure.
677
- */
678
- export function newWalletSeed(keyType: number | null): array | number | null;
679
- /**
680
- * The openWalletFromSeed function creates a wallet from a raw seed byte array.
681
- * Determines the key scheme from the array length: 96 bytes (hybrideds), 72 bytes (hybrid5), or 64 bytes (hybrid).
682
- *
683
- * @function openWalletFromSeed
684
- * @param {Array<number>|Uint8Array} seedArray - The raw seed bytes. Length 96, 72, or 64 depending on scheme.
685
- * @return {Wallet|number} Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
686
- */
687
- export function openWalletFromSeed(seedArray: Array<number> | Uint8Array): Wallet | number;
688
- /**
689
- * The openWalletFromSeedWords function creates a wallet from a seed word list. The seed word list is available for wallets created from Desktop/Web/Mobile wallets.
690
- * Supports 48 words (hybrideds), 36 words (hybrid5), or 32 words (hybrid) per seed length.
691
- *
692
- * @function openWalletFromSeedWords
693
- * @param {array} seedWordList - An array of seed words. Length 48, 36, or 32 depending on scheme.
694
- * @return {Wallet|number} Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
695
- */
696
- export function openWalletFromSeedWords(seedWordList: array): Wallet | number;
697
- /**
698
- * The publicKeyFromSignature extracts the public key from a signature.
699
- *
700
- * @function publicKeyFromSignature
701
- * @param {number[]} digest - An array of bytes containing the digestHash. Should be of length 32.
702
- * @param {number[]} signature - An array of bytes containing the signature.
703
- * @return {string} - Returns the public key as a hex string. Returns null if the operation failed.
704
- */
705
- export function publicKeyFromSignature(digest: number[], signature: number[]): string;
706
- /**
707
- * The publicKeyFromPrivateKey extracts the public key from a private key.
708
- *
709
- * @function publicKeyFromPrivateKey
710
- * @param {number[]} privateKey - An array of bytes containing the privateKey.
711
- * @return {string} - Returns the public key as a hex string. Returns null if the operation failed.
712
- */
713
- export function publicKeyFromPrivateKey(privateKey: number[]): string;
714
- /**
715
- * The addressFromPublicKey returns the address corresponding to the public key.
716
- *
717
- * @function addressFromPublicKey
718
- * @param {number[]} publicKey - An array of bytes containing the public key.
719
- * @return {string} - Returns the address corresponding to the public key as a hex string. Returns null if the operation failed.
720
- */
721
- export function addressFromPublicKey(publicKey: number[]): string;
722
- /**
723
- * The combinePublicKeySignature combines the public key and signature.
724
- *
725
- * @function combinePublicKeySignature
726
- * @param {number[]} publicKey - An array of bytes containing the public key.
727
- * @param {number[]} signature - An array of bytes containing the signature.
728
- * @return {string} - Returns a hex string corresponding to combined signature. Returns null if the operation failed.
729
- */
730
- export function combinePublicKeySignature(publicKey: number[], signature: number[]): string;
731
- /**
732
- * @class
733
- * @constructor
734
- * @public
735
- * @classdesc This class represents a signing request that can be passed to signTransaction.
736
- */
737
- export class TransactionSigningRequest {
738
- /**
739
- * Creates a TransactionSigningRequest class.
740
- * @param {Wallet} wallet - The wallet with which the transaction has to be signed. The constructor does not verify the wallet. To verify a wallet, call the verifyWallet function explicitly.
741
- * @param {string} toAddress - The address to which the transaction request is made. Can be null (for example, for contract creation).
742
- * @param {string|BigInt} valueInWei - The value in wei-units. Can be provided as either a hex string (including 0x prefix) or a BigInt. For example, to represent 1 coin, which is 1000000000000000000 in wei-units, set the value to "0xDE0B6B3A7640000" or BigInt("1000000000000000000"). {@link /example/conversion-example.js|Conversion Examples}
743
- * @param {number} nonce - A monotonically increasing number representing the nonce of the account signing the transaction. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
744
- * @param {string} data - An optional hex string (including 0x) that represents the contract data. Can be null if not invoking or creating a contract.
745
- * @param {number} gasLimit - A limit of gas to be used. Set 21000 for basic non smart contract transactions.
746
- * @param {string} remarks - An optional hex string (including 0x) that represents a remark (such as a comment). Maximum 32 bytes length (in bytes). Warning, do not store any sensitive information in this field.
747
- * @param {number|null} chainId - The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324. If null, the chainId specified in the initialize() function will be used.
748
- * @param {number|null} signingContext - It is recommended that you pass null for this parameter, unless the context needs to be set explicitly. Signing context determines the cryptographic scheme used to sign. The wallet key type should compatible with the signing context. Applicable values are 0,1,2. Default value if not specified will be determined dynamically from the wallet key type. Signing context 1,2 will incur additional gas fee. For information on the schemes, see https://github.com/quantumcoinproject/circl?tab=readme-ov-file#hybrid-schemes
749
- * Signing context 0: Scheme used is hybrid-ed-mldsa-slhdsa compact (scheme id 3)
750
- * Signing context 1: Scheme used is hybrid-ed-mldsa-slhdsa-5 (scheme id 5 : 20x the gas fee of scheme 0)
751
- * Signing context 2: hybrid-ed-mldsa-slhdsa full (scheme id 4 : 30x the gas fee of scheme 0)
752
- */
753
- constructor(wallet: Wallet, toAddress: string, valueInWei: string | bigint, nonce: number, data: string, gasLimit: number, remarks: string, chainId: number | null, signingContext: number | null);
754
- /**
755
- * The wallet that should be used to sign the transaction.
756
- * @type {Wallet}
757
- * @public
758
- */
759
- public wallet: Wallet;
760
- /**
761
- * The address to which the transaction request is made. Can be null (for example, for contract creation).
762
- * @type {string|null}
763
- * @public
764
- */
765
- public toAddress: string | null;
766
- /**
767
- * The value in wei-units. Can be provided as either a hex string (including 0x prefix) or a BigInt. For example, to represent 1 coin, which is 1000000000000000000 in wei-units, set the value to "0xDE0B6B3A7640000" or BigInt("1000000000000000000"). {@link /example/conversion-example.js|Conversion Examples}
768
- * @type {string|BigInt|null}
769
- * @public
770
- */
771
- public valueInWei: string | bigint | null;
772
- /**
773
- * A monotonically increasing number representing the nonce of the account signing the transaction. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
774
- * @type {number}
775
- * @public
776
- */
777
- public nonce: number;
778
- /**
779
- * An optional hex string (including 0x) that represents the contract data. Can be null if not invoking or creating a contract.
780
- * @type {string|null}
781
- * @public
782
- */
783
- public data: string | null;
784
- /**
785
- * A limit of gas to be used. Set 21000 for basic non smart contract transactions.
786
- * @type {number}
787
- * @public
788
- */
789
- public gasLimit: number;
790
- /**
791
- * An optional hex string (including 0x) that represents a remark (such as a comment). Maximum 32 bytes length (in bytes). Warning, do not store any sensitive information in this field.
792
- * @type {string|null}
793
- * @public
794
- */
795
- public remarks: string | null;
796
- /**
797
- * The chain id of the blockchain. Mainnet chainId is 123123. If null, the chainId specified in the initialize() function will be used.
798
- * @type {number|null}
799
- * @public
800
- */
801
- public chainId: number | null;
802
- /**
803
- * It is recommended that you pass null for this parameter, unless the context needs to be set explicitly. Signing context determines the cryptographic scheme used to sign. Gas fee varies by context.
804
- * @type {number|null}
805
- * @public
806
- */
807
- public signingContext: number | null;
808
- }
809
- /**
810
- * The signRawTransaction function returns a signed transaction. The chainId used for signing can be provided in the TransactionSigningRequest, or if null, the chainId specified in the initialize() function will be used.
811
- * With this function, you can set the gasLimit explicitly compared to signTransaction.
812
- * You can also pass data to be signed, such as when creating or invoking a smart contract.
813
- * Since the gas fee is fixed at 1000 coins for 21000 units of gas, there is no option to set the gas fee explicitly.
814
- * This function is useful for offline (cold storage) wallets, where you can sign a transaction offline and then use the postTransaction function to post it on a connected device.
815
- * Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
816
- *
817
- * @function signRawTransaction
818
- * @param {TransactionSigningRequest} transactionSigningRequest - An object of type TransactionSigningRequest with the transaction signing details.
819
- * @return {SignResult} Returns a promise of type SignResult.
820
- */
821
- export function signRawTransaction(transactionSigningRequest: TransactionSigningRequest): SignResult;
822
- /**
823
- * Sign a message with a private key. Optional signingContext selects algorithm (same pattern as signRawTransaction); if null/omitted, derived from private key type.
824
- * @param {number[]|Uint8Array} privateKey - Private key bytes.
825
- * @param {number[]|Uint8Array} message - Message bytes (e.g. 32-byte hash).
826
- * @param {number|null} [signingContext] - Optional. 0 = hybridedmldsaslhdsa compact, 1 = hybridedmldsaslhdsa5, 2 = hybridedmldsaslhdsa full. If null/omitted, derived from private key type.
827
- * @returns {{ resultCode: number, signature: Uint8Array|null }} resultCode 0 on success, signature bytes; negative on error (e.g. -1000 not initialized, -700 invalid args, -701 unknown key type, -702/-703 CIRCL sign error, -704 unsupported key type or context).
828
- */
829
- export function sign(privateKey: number[] | Uint8Array, message: number[] | Uint8Array, signingContext?: number | null): {
830
- resultCode: number;
831
- signature: Uint8Array | null;
832
- };
833
- /**
834
- * Verify a signature over a message with a public key. Algorithm is determined by the first byte of the signature: 1=hybrideds verifyCompact, 2=hybrideds verify, 3=hybridedmldsaslhdsa verifyCompact, 4=hybridedmldsaslhdsa verify, 5=hybridedmldsaslhdsa5 verify.
835
- * @param {number[]|Uint8Array} publicKey - Public key bytes.
836
- * @param {number[]|Uint8Array} signature - Signature bytes from sign(); first byte selects verify function (1-5).
837
- * @param {number[]|Uint8Array} message - Message bytes (same as passed to sign).
838
- * @returns {{ resultCode: number, valid: boolean }} resultCode 0 and valid true if signature is valid; negative on error (e.g. -1000 not initialized, -715 invalid args, -717 CIRCL verify error, -719 signature invalid, -718 unknown signature type).
839
- */
840
- export function verify(publicKey: number[] | Uint8Array, signature: number[] | Uint8Array, message: number[] | Uint8Array): {
841
- resultCode: number;
842
- valid: boolean;
843
- };
844
- /**
845
- * The packMethodData function packs a Solidity method call with the given ABI, method name, and arguments.
846
- * It returns the transaction data as a hex string that can be included in a transaction.
847
- *
848
- * @function packMethodData
849
- * @param {string} abiJSON - The Solidity ABI file content as a JSON string
850
- * @param {string} methodName - The name of the method to call
851
- * @param {...*} args - The parameters to pass to the method (variable arguments)
852
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the packed transaction data as a hex string.
853
- */
854
- export function packMethodData(abiJSON: string, methodName: string, ...args: any[]): PackUnpackResult;
855
- /**
856
- * The unpackMethodData function unpacks the return values of a Solidity method call.
857
- * It returns the unpacked values as a JavaScript array or object.
858
- *
859
- * @function unpackMethodData
860
- * @param {string} abiJSON - The Solidity ABI file content as a JSON string
861
- * @param {string} methodName - The name of the method whose return values to unpack
862
- * @param {string} hexData - The hex-encoded return data (with or without 0x prefix)
863
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the unpacked return values as a JSON string.
864
- */
865
- export function unpackMethodData(abiJSON: string, methodName: string, hexData: string): PackUnpackResult;
866
- /**
867
- * The packCreateContractData function packs constructor data for contract creation.
868
- * It combines the contract bytecode with the ABI-encoded constructor parameters.
869
- * This matches the Go pattern: Pack("", params...) and append(bytecode, input...)
870
- *
871
- * @function packCreateContractData
872
- * @param {string} abiJSON - The Solidity ABI file content as a JSON string
873
- * @param {string} bytecode - The contract bytecode as a hex string (with or without 0x prefix)
874
- * @param {...*} args - The constructor parameters (variable arguments, can be 0 or more)
875
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the packed contract creation data as a hex string.
876
- */
877
- export function packCreateContractData(abiJSON: string, bytecode: string, ...args: any[]): PackUnpackResult;
878
- /**
879
- * The encodeEventLog function encodes event parameters into topics and data according to the ABI specification.
880
- * It returns the topics array and data hex string that can be used to create event logs.
881
- *
882
- * @function encodeEventLog
883
- * @param {string} abiJSON - The Solidity ABI file content as a JSON string
884
- * @param {string} eventName - The name of the event to encode
885
- * @param {...*} args - The event parameter values (variable arguments)
886
- * @return {EventLogEncodeResult} - Returns an EventLogEncodeResult object containing the error (if any) and the encoded event log with topics and data.
887
- */
888
- export function encodeEventLog(abiJSON: string, eventName: string, ...args: any[]): EventLogEncodeResult;
889
- /**
890
- * The decodeEventLog function decodes event log topics and data back into event parameters.
891
- * It returns the decoded values as a JavaScript object.
892
- *
893
- * @function decodeEventLog
894
- * @param {string} abiJSON - The Solidity ABI file content as a JSON string
895
- * @param {string} eventName - The name of the event to decode
896
- * @param {string[]} topics - Array of topic hex strings (with or without 0x prefix)
897
- * @param {string} data - Hex-encoded data string (with or without 0x prefix)
898
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the decoded event parameters as a JSON string.
899
- */
900
- export function decodeEventLog(abiJSON: string, eventName: string, topics: string[], data: string): PackUnpackResult;
901
- /**
902
- * The encodeRlp function encodes a JavaScript value to RLP (Recursive Length Prefix) format.
903
- * Supports: strings, numbers, booleans, arrays, objects (maps), and hex-encoded bytes.
904
- * Returns a hex-encoded string of the RLP-encoded data.
905
- *
906
- * @function encodeRlp
907
- * @param {*} value - The value to encode (can be string, number, boolean, array, object, etc.)
908
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the RLP-encoded data as a hex string.
909
- */
910
- export function encodeRlp(value: any): PackUnpackResult;
911
- /**
912
- * The decodeRlp function decodes RLP-encoded data back to a JavaScript-compatible value.
913
- * Takes a hex-encoded string and returns a JSON string representation of the decoded value.
914
- *
915
- * @function decodeRlp
916
- * @param {string} data - The hex-encoded RLP data (with or without 0x prefix)
917
- * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the decoded value as a JSON string.
918
- */
919
- export function decodeRlp(data: string): PackUnpackResult;
920
- /**
921
- * The createAddress function calculates the contract address that will be created by a transaction.
922
- * This uses the CREATE opcode address calculation: keccak256(RLP(sender, nonce))
923
- *
924
- * @function createAddress
925
- * @param {string} address - The address of the account that will create the contract (hex string with 0x prefix)
926
- * @param {number} nonce - The nonce of the account at the time of contract creation
927
- * @return {string|null} - Returns the contract address as a hex string, or null if an error occurred.
928
- */
929
- export function createAddress(address: string, nonce: number): string | null;
930
- /**
931
- * The createAddress2 function calculates the contract address using the CREATE2 opcode.
932
- * This allows deterministic contract address calculation: keccak256(0xff || sender || salt || keccak256(init_code))
933
- *
934
- * @function createAddress2
935
- * @param {string} address - The address of the account that will create the contract (hex string with 0x prefix)
936
- * @param {string} salt - A 32-byte salt value as a hex string (with 0x prefix)
937
- * @param {string} initHash - The keccak256 hash of the contract initialization code as a hex string (with 0x prefix)
938
- * @return {string|null} - Returns the contract address as a hex string, or null if an error occurred.
939
- */
940
- export function createAddress2(address: string, salt: string, initHash: string): string | null;
941
- /**
942
- * @class
943
- * @constructor
944
- * @public
945
- * @classdesc This class represents a result from invoking the packMethodData or unpackMethodData functions.
946
- */
947
- export class PackUnpackResult {
948
- /**
949
- * Creates a PackUnpackResult class.
950
- * @param {string} error - Error message if any. Empty string if no error.
951
- * @param {string} result - The actual result as a string. Empty string if there was an error.
952
- */
953
- constructor(error: string, result: string);
954
- /**
955
- * Error message if any. Empty string if no error.
956
- * @type {string}
957
- * @public
958
- */
959
- public error: string;
960
- /**
961
- * The actual result as a string. Empty string if there was an error.
962
- * @type {string}
963
- * @public
964
- */
965
- public result: string;
966
- }
967
- /**
968
- * @class EventLogEncodeResult
969
- * @classdesc This class represents a result from invoking the encodeEventLog function.
970
- */
971
- export class EventLogEncodeResult {
972
- /**
973
- * Creates an EventLogEncodeResult class.
974
- * @param {string} error - Error message if any. Empty string if no error.
975
- * @param {Object|null} result - The actual result object with topics and data. Null if there was an error.
976
- * @param {string[]} result.topics - Array of topic hex strings (with 0x prefix)
977
- * @param {string} result.data - Hex-encoded data string (with 0x prefix)
978
- */
979
- constructor(error: string, result: Object | null);
980
- /**
981
- * Error message if any. Empty string if no error.
982
- * @type {string}
983
- * @public
984
- */
985
- public error: string;
986
- /**
987
- * The actual result object with topics and data. Null if there was an error.
988
- * @type {Object|null}
989
- * @property {string[]} topics - Array of topic hex strings (with 0x prefix)
990
- * @property {string} data - Hex-encoded data string (with 0x prefix)
991
- * @public
992
- */
993
- public result: Object | null;
994
- }
995
- /**
996
- * @class
997
- * @constructor
998
- * @public
999
- * @classdesc This class represents a result from invoking the signSendCoinTransaction function.
1000
- */
1001
- declare class SignResult {
1002
- constructor(resultCode: any, txnHash: any, txnData: any);
1003
- /**
1004
- * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
1005
- * @type {number}
1006
- * @public
1007
- */
1008
- public resultCode: number;
1009
- /**
1010
- * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x. This value is null if the value of resultCode is not 0.
1011
- * @type {string}
1012
- * @public
1013
- */
1014
- public txnHash: string;
1015
- /**
1016
- * A payload representing the signed transaction.
1017
- * To actually send a transaction, this payload can then be taken to to a different device that is connected to the blockchain relay and then sent using the postTransaction function.
1018
- * This value is null if the value of resultCode is not 0.
1019
- * @type {string}
1020
- * @public
1021
- */
1022
- public txnData: string;
1023
- }
1024
- export {};
1
+ /**
2
+ * The initialize function has to be called before attempting to invoke any other function. This function should be called only once.
3
+ *
4
+ * @async
5
+ * @function initialize
6
+ * @param {Config|undefined} clientConfig - A configuration represented by the Config class. A default configuration is used, if not specified.
7
+ * @return {Promise<boolean>} Returns a promise of type boolean; true if the initialization succeeded, else false.
8
+ */
9
+ export function initialize(clientConfig: Config | undefined): Promise<boolean>;
10
+ /**
11
+ * The serializeWallet function serializes a Wallet object to a JSON string. You should encrypt the string before saving it to disk or a database.
12
+ *
13
+ * @function serializeWallet
14
+ * @param {Wallet} wallet - A Wallet object representing the wallet to serialize.
15
+ * @return {string} Returns the Wallet in JSON string format. If the wallet is invalid, null is returned.
16
+ */
17
+ export function serializeWallet(wallet: Wallet): string;
18
+ /**
19
+ * The deserializeWallet function creates a Wallet object from a JSON string.
20
+ *
21
+ * @function deserializeWallet
22
+ * @param {string} walletJson - A JSON string representing the wallet to deserialize.
23
+ * @return {Wallet|null} Returns the Wallet corresponding to the walletJson. If the wallet is invalid or the JSON is malformed, null is returned.
24
+ */
25
+ export function deserializeWallet(walletJson: string): Wallet | null;
26
+ /**
27
+ * The serializeEncryptedWallet function encrypts and serializes a Wallet object to a JSON string readable by the Desktop/Mobile/Web/CLI wallet applications. You can save this string to a file and open the file in one of these wallet applications. You may also open this string using the deserializeEncryptedWallet function. If you loose the passphrase, you will be unable to open the wallet. This function can take upto a minute or so to execute.
28
+ *
29
+ * @function serializeEncryptedWallet
30
+ * @param {Wallet} wallet - A Wallet object representing the wallet to serialize.
31
+ * @param {string} passphrase - A passphrase used to encrypt the wallet. It should atleast be 12 characters long.
32
+ * @return {string} Returns the Wallet in JSON string format. If the wallet is invalid, null is returned.
33
+ */
34
+ export function serializeEncryptedWallet(wallet: Wallet, passphrase: string): string;
35
+ /**
36
+ * The serializeSeedAsEncryptedWallet function encrypts a raw seed byte array into a wallet JSON string
37
+ * that can be opened with deserializeEncryptedWallet or Desktop/Mobile/Web/CLI wallet applications.
38
+ * The seed is stored in its pre-expansion form (version 5 wallet format). This function can take
39
+ * up to a minute or so to execute due to key derivation.
40
+ *
41
+ * @function serializeSeedAsEncryptedWallet
42
+ * @param {Array<number>|Uint8Array} seedArray - The raw seed bytes. Length must be 96, 72, or 64 depending on scheme.
43
+ * @param {string} passphrase - A passphrase used to encrypt the wallet. Must be at least 12 characters long.
44
+ * @return {string|number|null} Returns the encrypted wallet JSON string. Returns -1000 if not initialized, null if the operation failed.
45
+ */
46
+ export function serializeSeedAsEncryptedWallet(seedArray: Array<number> | Uint8Array, passphrase: string): string | number | null;
47
+ /**
48
+ * The deserializeEncryptedWallet function opens a wallet backed-up using an application such as the Desktop/Mobile/CLI/Web wallet. This function can take upto a minute or so to execute. You should open wallets only from trusted sources.
49
+ *
50
+ * @function deserializeEncryptedWallet
51
+ * @param {string} walletJsonString - The json string from a wallet file.
52
+ * @param {string} passphrase - The passphrase used to encrypt the wallet.
53
+ * @return {Wallet} Returns a Wallet object. Returns null if opening the wallet fails.
54
+ */
55
+ export function deserializeEncryptedWallet(walletJsonString: string, passphrase: string): Wallet;
56
+ /**
57
+ * The verifyWallet function verifies whether a Wallet is valid or not. To mitigate spoofing and other attachs, it is highly recommended to verify a wallet, especially if it is from an untrusted source.
58
+ *
59
+ * @function verifyWallet
60
+ * @param {Wallet} wallet - A Wallet object representing the wallet to verify.
61
+ * @return {boolean} Returns true if the Wallet verification succeeded, else returns false.
62
+ */
63
+ export function verifyWallet(wallet: Wallet): boolean;
64
+ /**
65
+ * The newWallet function creates a new Wallet.
66
+ * @function newWallet
67
+ * @param {number|null} keyType - Optional. KEY_TYPE_HYBRIDEDMLDSASLHDSA (3) or KEY_TYPE_HYBRIDEDMLDSASLHDSA5 (5). null/undefined defaults to 3.
68
+ * @return {Wallet|number} Returns a Wallet object, or -1000 (not initialized), -1001 (invalid key type), -1002 (crypto failure).
69
+ */
70
+ export function newWallet(keyType: number | null): Wallet | number;
71
+ /**
72
+ * The sendCoins function posts a send-coin transaction to the blockchain. The chainId used for signing should be provided in the initialize() function.
73
+ * Since the gas fee for sending coins is fixed at 1000 coins, there is no option to set the gas fee explicitly.
74
+ * It may take many seconds after submitting a transaction before the transaction is returned by the getTransactionDetails function.
75
+ * Transactions are usually committed in less than 30 seconds.
76
+ *
77
+ * @deprecated Use signRawTransaction and postTransaction instead.
78
+ * @async
79
+ * @function sendCoins
80
+ * @param {Wallet} wallet - A Wallet object from which the transaction has to be sent. The address corresponding to the Wallet should have enough coins to cover gas fees as well. A minimum of 1000 coins (1000000000000000000000 wei) are required for gas fees.
81
+ * @param {string} toAddress - The address to which the coins should be sent.
82
+ * @param {string} coins - The string representing the number of coins (in ether) to send. To convert between ethers and wei, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
83
+ * @param {number} nonce - The nonce of the account retrieved by invoking the getAccountDetails function. You have to carefully manage state of the nonce to avoid sending the coins multiple times, such as when retrying sendCoins after a network error.
84
+ * @return {Promise<SendResult>} Returns a promise of type SendResult.
85
+ */
86
+ export function sendCoins(wallet: Wallet, toAddress: string, coins: string, nonce: number): Promise<SendResult>;
87
+ /**
88
+ * The getAccountDetails function returns details of an account corresponding to the address.
89
+ *
90
+ * @async
91
+ * @function getAccountDetails
92
+ * @param {string} address - The address of the account of which the details have to be retrieved.
93
+ * @return {Promise<AccountDetailsResult>} Returns a promise of type AccountDetailsResult.
94
+ */
95
+ export function getAccountDetails(address: string): Promise<AccountDetailsResult>;
96
+ /**
97
+ * The getTransactionDetails function returns details of a transaction posted to the blockchain.
98
+ * Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for reading.
99
+ * Some transactions that have lower balance than the minimum required for gas fees may be discarded.
100
+ * In these cases, the transactions may not be returned when invoking the getTransactionDetails function.
101
+ * You should consider the transaction as succeeded only if the status field of the transactionReceipt object is 0x1 (success).
102
+ * The transactionReceipt field can be null unless the transaction is registered with the blockchain.
103
+ * @async
104
+ * @function getTransactionDetails
105
+ * @param {string} txnHash - The hash of the transaction to retrieve.
106
+ * @return {Promise<TransactionDetailsResult>} Returns a promise of type TransactionDetailsResult.
107
+ */
108
+ export function getTransactionDetails(txnHash: string): Promise<TransactionDetailsResult>;
109
+ /**
110
+ * The isAddressValid function validates whether an address is valid or not. An address is of length 66 characters including 0x.
111
+ *
112
+ * @function isAddressValid
113
+ * @param {string} address - A string representing the address to validate.
114
+ * @return {boolean} Returns true if the address validation succeeded, else returns false.
115
+ */
116
+ export function isAddressValid(address: string): boolean;
117
+ /**
118
+ * The getLatestBlockDetails function returns details of the latest block of the blockchain.
119
+ *
120
+ * @async
121
+ * @function getLatestBlockDetails
122
+ * @return {Promise<LatestBlockDetailsResult>} Returns a promise of an object of type LatestBlockDetailsResult.
123
+ */
124
+ export function getLatestBlockDetails(): Promise<LatestBlockDetailsResult>;
125
+ /**
126
+ * The signSendCoinTransaction function returns a signed transaction. The chainId used for signing should be provided in the initialize() function.
127
+ * Since the gas fee for sending coins is fixed at 1000 coins, there is no option to set the gas fee explicitly.
128
+ * This function is useful for offline (cold storage) wallets, where you can sign a transaction offline and then use the postTransaction function to post it on a connected device.
129
+ * Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
130
+ *
131
+ * @deprecated Use signRawTransaction instead.
132
+ * @function signSendCoinTransaction
133
+ * @param {Wallet} wallet - A Wallet object from which the transaction has to be sent. The address corresponding to the Wallet should have enough coins to cover gas fees as well. A minimum of 1000 coins (1000000000000000000000 wei) are required for gas fees.
134
+ * @param {string} toAddress - The address to which the coins should be sent.
135
+ * @param {string} coins - The string representing the number of coins (in ether) to send. To convert between ethers and wei, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
136
+ * @param {number} nonce - The nonce of the account retrieved by invoking the getAccountDetails function. You have to carefully manage state of the nonce to avoid sending the coins multiple times, such as when retrying sendCoins after a network error.
137
+ * @return {Promise<SignResult>} Returns a promise of type SignResult.
138
+ */
139
+ export function signSendCoinTransaction(wallet: Wallet, toAddress: string, coins: string, nonce: number): Promise<SignResult>;
140
+ /**
141
+ * The listAccountTransactions function returns a list of transactions for a specific account.
142
+ * Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for listing.
143
+ * Some transactions that have lower balance than the minimum required for gas fees may be discarded.
144
+ * In these cases, the transactions may not be returned when invoking the listAccountTransactions function.
145
+ * You should consider the transaction as succeeded only if the status field of the AccountTransactionCompact object is 0x1 (success).
146
+ * Both transactions from and transactions to the address will be returned in the list.
147
+ * Use the getTransactionDetails function, passing the hash of the transaction to get detailed information about the transaction.
148
+ * @async
149
+ * @function listAccountTransactions
150
+ * @param {string} address - The address for which the transactions have to be listed.
151
+ * @param {number} pageNumber - The page number for which the transactions has to be listed for the account. Pass 0 to list the latest page. Pass 1 to list the oldest page. A maximum of 20 transactions are returned in each page. The response of this API includes a field that shows the pageCount (total number of pages available). You can pass any number between 1 to pageCount to get the corresponding page.
152
+ * @return {Promise<AccountTransactionsResult>} Returns a promise of type AccountTransactionsResult.
153
+ */
154
+ export function listAccountTransactions(address: string, pageNumber: number): Promise<AccountTransactionsResult>;
155
+ /**
156
+ * The postTransaction function posts a signed transaction to the blockchain.
157
+ * This method can be used in conjunction with the signSendCoinTransaction method to submit a transaction that was signed using a cold wallet (offline or disconnected or air-gapped wallet).
158
+ *
159
+ * @async
160
+ * @function postTransaction
161
+ * @param {string} txnData - A signed transaction string returned by the signSendCoinTransaction function.
162
+ * @return {Promise<SendResult>} Returns a promise of type SendResult. txnHash will be null in SendResult.
163
+ */
164
+ export function postTransaction(txnData: string): Promise<SendResult>;
165
+ /**
166
+ * @class
167
+ * @constructor
168
+ * @public
169
+ * @classdesc This is the configuration class required to initialize and interact with Quantum Coin blockchain
170
+ */
171
+ export class Config {
172
+ /**
173
+ * Creates a config class
174
+ * @param {string} readUrl - The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay. The following URLs are community maintained. Please use your own relay service. Mainnet: https://sdk.readrelay.quantumcoinapi.com
175
+ * @param {string} writeUrl - The Write API URL pointing to a write relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay. The following URLs are community maintained. Please use your own relay service. Mainnet: https://sdk.writerelay.quantumcoinapi.com
176
+ * @param {number} chainId - The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324.
177
+ * @param {string} readApiKey - Optional parameter if authorization is enabled for the relay service. API Key for authorization. Defaults to null which indicates no authorization.
178
+ * @param {string} writeApiKey - Optional parameter if authorization is enabled for the relay service. API Key for authorization. Defaults to null which indicates no authorization.
179
+ */
180
+ constructor(readUrl: string, writeUrl: string, chainId: number, readApiKey: string, writeApiKey: string);
181
+ /**
182
+ * The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay
183
+ * @type {string}
184
+ * @public
185
+ */
186
+ public readUrl: string;
187
+ /**
188
+ * The Read API URL pointing to a read relay. See https://github.com/quantumcoinproject/quantum-coin-go/tree/dogep/relay
189
+ * @type {string}
190
+ * @public
191
+ */
192
+ public writeUrl: string;
193
+ /**
194
+ * The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324.
195
+ * @type {number}
196
+ * @public
197
+ */
198
+ public chainId: number;
199
+ /**
200
+ * API Key for authorization if authorization is enabled for the relay service. Defaults to null which indicates no authorization.
201
+ * @type {string}
202
+ * @public
203
+ */
204
+ public readApiKey: string;
205
+ /**
206
+ * API Key for authorization if authorization is enabled for the relay service. Defaults to null which indicates no authorization.
207
+ * @type {string}
208
+ * @public
209
+ */
210
+ public writeApiKey: string;
211
+ }
212
+ /**
213
+ * @class
214
+ * @constructor
215
+ * @public
216
+ * @classdesc This class represents a Wallet. Use the verifyWallet function to verify if a wallet is valid. Verifying the wallet is highly recommended, especially if it comes from an untrusted source. For more details on the underlying cryptography of the Wallet, see https://github.com/QuantumCoinProject/hybrid-pqc
217
+ */
218
+ export class Wallet {
219
+ /**
220
+ * Creates a Wallet class. The constructor does not verify the wallet. To verify a wallet, call the verifyWallet function explicitly.
221
+ * @param {string} address - Address of the wallet
222
+ * @param {number[]} privateKey - Private Key byte array of the wallet
223
+ * @param {number[]} publicKey - Public Key byte array of the wallet
224
+ * @param {Uint8Array|number[]|null} [preExpansionSeed=null] - Optional pre-expansion seed bytes. Non-null only for seed-derived wallets.
225
+ */
226
+ constructor(address: string, privateKey: number[], publicKey: number[], preExpansionSeed?: Uint8Array | number[] | null);
227
+ /**
228
+ * Address of the wallet. Is 66 bytes in length including 0x (if the wallet is valid).
229
+ * @type {string}
230
+ * @public
231
+ */
232
+ public address: string;
233
+ /**
234
+ * Private Key byte array of the wallet. Is 4064 bytes in length (if the wallet is valid).
235
+ * @type {number[]}
236
+ * @public
237
+ */
238
+ public privateKey: number[];
239
+ /**
240
+ * Public Key byte array of the wallet. Is 1408 bytes in length (if the wallet is valid).
241
+ * @type {number[]}
242
+ * @public
243
+ */
244
+ public publicKey: number[];
245
+ /**
246
+ * Pre-expansion seed bytes. Can be null if the wallet was not created from a seed.
247
+ * @type {Uint8Array|number[]|null}
248
+ * @public
249
+ */
250
+ public preExpansionSeed: Uint8Array | number[] | null;
251
+ }
252
+ /**
253
+ * @class
254
+ * @constructor
255
+ * @public
256
+ * @classdesc This class represents a Block.
257
+ */
258
+ export class BlockDetails {
259
+ constructor(blockNumber: any);
260
+ /**
261
+ * Block Number of the block
262
+ * @type {number}
263
+ * @public
264
+ */
265
+ public blockNumber: number;
266
+ }
267
+ /**
268
+ * @class
269
+ * @constructor
270
+ * @public
271
+ * @classdesc This class represents a result from invoking the getLatestBlock function.
272
+ */
273
+ export class LatestBlockDetailsResult {
274
+ constructor(resultCode: any, blockDetails: any, response: any, requestId: any, err: any);
275
+ /**
276
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
277
+ * @type {number}
278
+ * @public
279
+ */
280
+ public resultCode: number;
281
+ /**
282
+ * An object of type BlockDetails representing the block. This value is null if the value of resultCode is not 0.
283
+ * @type {BlockDetails}
284
+ * @public
285
+ */
286
+ public blockDetails: BlockDetails;
287
+ /**
288
+ * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
289
+ * @type {Object}
290
+ * @public
291
+ */
292
+ public response: Object;
293
+ /**
294
+ * An unique id to represent the request. This can be null if request failed before it could be sent.
295
+ * @type {string}
296
+ * @public
297
+ */
298
+ public requestId: string;
299
+ /**
300
+ * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
301
+ * @type {Error}
302
+ * @public
303
+ */
304
+ public err: Error;
305
+ }
306
+ /**
307
+ * @class
308
+ * @constructor
309
+ * @public
310
+ * @classdesc This class represents an Account.
311
+ */
312
+ export class AccountDetails {
313
+ constructor(address: any, balance: any, nonce: any, blockNumber: any);
314
+ /**
315
+ * Address of the wallet. Is 66 bytes in length including 0x.
316
+ * @type {string}
317
+ * @public
318
+ */
319
+ public address: string;
320
+ /**
321
+ * Balance of the account in wei. To convert this to ethers, see https://docs.ethers.org/v4/api-utils.html#ether-strings-and-wei
322
+ * @type {string}
323
+ * @public
324
+ */
325
+ public balance: string;
326
+ /**
327
+ * A monotonically increasing number representing the nonce of the account. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
328
+ * @type {number}
329
+ * @public
330
+ */
331
+ public nonce: number;
332
+ /**
333
+ * The block number as of which the Account details was retrieved.
334
+ * @type {number}
335
+ * @public
336
+ */
337
+ public blockNumber: number;
338
+ }
339
+ /**
340
+ * @class
341
+ * @constructor
342
+ * @public
343
+ * @classdesc This class represents a result from invoking the getAccountDetails function.
344
+ */
345
+ export class AccountDetailsResult {
346
+ constructor(resultCode: any, accountDetails: any, response: any, requestId: any, err: any);
347
+ /**
348
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
349
+ * @type {number}
350
+ * @public
351
+ */
352
+ public resultCode: number;
353
+ /**
354
+ * An object of type AccountDetails representing the block. This value is null if the value of resultCode is not 0.
355
+ * @type {AccountDetails}
356
+ * @public
357
+ */
358
+ public accountDetails: AccountDetails;
359
+ /**
360
+ * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
361
+ * @type {Object}
362
+ * @public
363
+ */
364
+ public response: Object;
365
+ /**
366
+ * An unique id to represent the request. This can be null if request failed before it could be sent.
367
+ * @type {string}
368
+ * @public
369
+ */
370
+ public requestId: string;
371
+ /**
372
+ * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
373
+ * @type {Error}
374
+ * @public
375
+ */
376
+ public err: Error;
377
+ }
378
+ /**
379
+ * @class
380
+ * @constructor
381
+ * @public
382
+ * @classdesc This class represents a result from invoking the sendCoins function.
383
+ */
384
+ export class SendResult {
385
+ constructor(resultCode: any, txnHash: any, response: any, requestId: any, err: any);
386
+ /**
387
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
388
+ * @type {number}
389
+ * @public
390
+ */
391
+ public resultCode: number;
392
+ /**
393
+ * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x. This value is null if the value of resultCode is not 0.
394
+ * @type {string}
395
+ * @public
396
+ */
397
+ public txnHash: string;
398
+ /**
399
+ * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
400
+ * @type {Object}
401
+ * @public
402
+ */
403
+ public response: Object;
404
+ /**
405
+ * An unique id to represent the request. This can be null if request failed before it could be sent.
406
+ * @type {string}
407
+ * @public
408
+ */
409
+ public requestId: string;
410
+ /**
411
+ * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
412
+ * @type {Error}
413
+ * @public
414
+ */
415
+ public err: Error;
416
+ }
417
+ /**
418
+ * @class
419
+ * @constructor
420
+ * @public
421
+ * @classdesc This class represents a Receipt of a transaction that is registered in the blockchain. The transactionReceipt field can be null unless the transaction is registered with the blockchain.
422
+ * While the transaction is pending, this field will be null. You should consider the transaction as succeeded only if the status field's value is 0x1 (success).
423
+ */
424
+ export class TransactionReceipt {
425
+ /**
426
+ * A hexadecimal string representing the total amount of gas used when this transaction was executed in the block.
427
+ * @type {string}
428
+ * @public
429
+ */
430
+ public cumulativeGasUsed: string;
431
+ /**
432
+ * A hexadecimal string representing the sum of the base fee and tip paid per unit of gas.
433
+ * @type {string}
434
+ * @public
435
+ */
436
+ public effectiveGasPrice: string;
437
+ /**
438
+ * A hexadecimal string representing the amount of gas used by this specific transaction alone.
439
+ * @type {string}
440
+ * @public
441
+ */
442
+ public gasUsed: string;
443
+ /**
444
+ * A hexadecimal string representing either 0x1 (success) or 0x0 (failure). Failed transactions can also incur gas fee. You should consider the transaction as succeeded only if the status value is 0x1 (success).
445
+ * @type {string}
446
+ * @public
447
+ */
448
+ public status: string;
449
+ /**
450
+ * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x.
451
+ * @type {string}
452
+ * @public
453
+ */
454
+ public hash: string;
455
+ /**
456
+ * A hexadecimal string representing the transaction type. 0x0 is DefaultFeeTxType.
457
+ * @type {string}
458
+ * @public
459
+ */
460
+ public type: string;
461
+ }
462
+ /**
463
+ * @class
464
+ * @constructor
465
+ * @public
466
+ * @classdesc This class represents details of a transaction. You should consider the transaction as succeeded only if the status field of the receipt object is 0x1 (success).
467
+ */
468
+ export class TransactionDetails {
469
+ /**
470
+ * A hexadecimal string representing the hash of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
471
+ * @type {string}
472
+ * @public
473
+ */
474
+ public blockHash: string;
475
+ /**
476
+ * The number of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
477
+ * @type {number}
478
+ * @public
479
+ */
480
+ public blockNumber: number;
481
+ /**
482
+ * A 66 character hexadecimal string representing the address the transaction is sent from.
483
+ * @type {string}
484
+ * @public
485
+ */
486
+ public from: string;
487
+ /**
488
+ * A hexadecimal string representing the gas provided for the transaction execution.
489
+ * @type {string}
490
+ * @public
491
+ */
492
+ public gas: string;
493
+ /**
494
+ * A hexadecimal string representing the gasPrice used for each paid gas, in Wei.
495
+ * @type {string}
496
+ * @public
497
+ */
498
+ public gasPrice: string;
499
+ /**
500
+ * A 66 character hexadecimal string representing the hash of the transaction.
501
+ * @type {string}
502
+ * @public
503
+ */
504
+ public hash: string;
505
+ /**
506
+ * A hexadecimal string representing the compiled code of a contract OR the hash of the invoked method signature and encoded parameters.
507
+ * @type {string}
508
+ * @public
509
+ */
510
+ public input: string;
511
+ /**
512
+ * A monotonically increasing number representing the nonce of the account. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
513
+ * @type {number}
514
+ * @public
515
+ */
516
+ public nonce: number;
517
+ /**
518
+ * A 66 character hexadecimal string representing address the transaction is directed to.
519
+ * @type {string}
520
+ * @public
521
+ */
522
+ public to: string;
523
+ /**
524
+ * A hexadecimal string representing the value sent with this transaction. The value can be 0 for smart contract transactions, since it only represents the number of coins sent.
525
+ * @type {string}
526
+ * @public
527
+ */
528
+ public value: string;
529
+ /**
530
+ * The receipt of the transaction. This field will be null while the transaction is pending (not yet registered in the blockchain).
531
+ * @type {TransactionReceipt}
532
+ * @public
533
+ */
534
+ public receipt: TransactionReceipt;
535
+ }
536
+ /**
537
+ * @class
538
+ * @constructor
539
+ * @public
540
+ * @classdesc This class represents a result from invoking the getTransactionDetails function. If transactions get discarded by the blockchain, for reasons such as due to lower than minimum gas fees or invalid nonce, the resultCode will always contain a non-zero value (failure).
541
+ */
542
+ export class TransactionDetailsResult {
543
+ constructor(resultCode: any, transactionDetails: any, response: any, requestId: any, err: any);
544
+ /**
545
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
546
+ * @type {number}
547
+ * @public
548
+ */
549
+ public resultCode: number;
550
+ /**
551
+ * An object of type TransactionDetails representing the transaction. This value is null if the value of resultCode is not 0.
552
+ * @type {TransactionDetails}
553
+ * @public
554
+ */
555
+ public transactionDetails: TransactionDetails;
556
+ /**
557
+ * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
558
+ * @type {Object}
559
+ * @public
560
+ */
561
+ public response: Object;
562
+ /**
563
+ * An unique id to represent the request. This can be null if request failed before it could be sent.
564
+ * @type {string}
565
+ * @public
566
+ */
567
+ public requestId: string;
568
+ /**
569
+ * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
570
+ * @type {Error}
571
+ * @public
572
+ */
573
+ public err: Error;
574
+ }
575
+ /**
576
+ * @class
577
+ * @constructor
578
+ * @public
579
+ * @classdesc This class represents a result from invoking the listAccountTransactionDetails function.
580
+ */
581
+ export class AccountTransactionsResult {
582
+ constructor(resultCode: any, listAccountTransactionsResponse: any, response: any, requestId: any, err: any);
583
+ /**
584
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
585
+ * @type {number}
586
+ * @public
587
+ */
588
+ public resultCode: number;
589
+ /**
590
+ * An object of type ListAccountTransactionsResponse representing the list of transactions along with metadata. This value is null if the value of resultCode is not 0.
591
+ * @type {ListAccountTransactionsResponse}
592
+ * @public
593
+ */
594
+ public listAccountTransactionsResponse: ListAccountTransactionsResponse;
595
+ /**
596
+ * An object of representing the raw Response returned by the service. For details, see https://developer.mozilla.org/en-US/docs/Web/API/Response. This value can be null if the value of resultCode is not 0.
597
+ * @type {Object}
598
+ * @public
599
+ */
600
+ public response: Object;
601
+ /**
602
+ * An unique id to represent the request. This can be null if request failed before it could be sent.
603
+ * @type {string}
604
+ * @public
605
+ */
606
+ public requestId: string;
607
+ /**
608
+ * An error object if the operation resulted in an error and there was no response. This property is defined only if the resultCode is -10000.
609
+ * @type {Error}
610
+ * @public
611
+ */
612
+ public err: Error;
613
+ }
614
+ /**
615
+ * @class
616
+ * @constructor
617
+ * @public
618
+ * @classdesc This class represents a list of account transactions returned by the listAccountTransactionDetails function.
619
+ */
620
+ export class ListAccountTransactionsResponse {
621
+ /**
622
+ * The number of pages available for listing.
623
+ * @type {number}
624
+ * @public
625
+ */
626
+ public pageCount: number;
627
+ /**
628
+ * An array of type AccountTransactionCompact, containing the list of transactions. Can be null if no items are available.
629
+ * @type {(AccountTransactionCompact|Array)}
630
+ * @public
631
+ */
632
+ public items: (AccountTransactionCompact | any[]);
633
+ }
634
+ /**
635
+ * @class
636
+ * @constructor
637
+ * @public
638
+ * @classdesc This class represents a transaction of an account. You should consider the transaction as succeeded only if the status field is 0x1 (success).
639
+ */
640
+ export class AccountTransactionCompact {
641
+ /**
642
+ * The number of the block that registered the transaction. This field can be null if the transaction was not registered in the blockchain.
643
+ * @type {number}
644
+ * @public
645
+ */
646
+ public blockNumber: number;
647
+ /**
648
+ * A 66 character hexadecimal string representing the address the transaction is sent from.
649
+ * @type {string}
650
+ * @public
651
+ */
652
+ public from: string;
653
+ /**
654
+ * A 66 character hexadecimal string representing the hash of the transaction.
655
+ * @type {string}
656
+ * @public
657
+ */
658
+ public hash: string;
659
+ /**
660
+ * A 66 character hexadecimal string representing address the transaction is directed to.
661
+ * @type {string}
662
+ * @public
663
+ */
664
+ public to: string;
665
+ /**
666
+ * A hexadecimal string representing the value sent with this transaction. The value can be 0 for smart contract transactions, since it only represents the number of coins sent.
667
+ * @type {string}
668
+ * @public
669
+ */
670
+ public value: string;
671
+ /**
672
+ * A hexadecimal string representing either 0x1 (success) or 0x0 (failure). Failed transactions can also incur gas fee. You should consider the transaction as succeeded only if the status value is 0x1 (success).
673
+ * @type {string}
674
+ * @public
675
+ */
676
+ public status: string;
677
+ }
678
+ /**
679
+ * The newWalletSeedWords function creates a new wallet seed word list. The returned array can then be passed to the openWalletFromSeedWords function to create a new wallet.
680
+ *
681
+ * @function newWalletSeedWords
682
+ * @param {number|null} keyType - Optional. KEY_TYPE_HYBRIDEDMLDSASLHDSA (3) or KEY_TYPE_HYBRIDEDMLDSASLHDSA5 (5). null/undefined defaults to 3.
683
+ * @return {string[]|number|null} Returns an array of seed words (32 or 36 words depending on keyType). Returns -1000 if not initialized, null on failure.
684
+ */
685
+ export function newWalletSeedWords(keyType: number | null): string[] | number | null;
686
+ /**
687
+ * The openWalletFromSeed function creates a wallet from a raw seed byte array.
688
+ * Determines the key scheme from the array length: 96 bytes (hybrideds), 72 bytes (hybrid5), or 64 bytes (hybrid).
689
+ *
690
+ * @function openWalletFromSeed
691
+ * @param {Array<number>|Uint8Array} seedArray - The raw seed bytes. Length 96, 72, or 64 depending on scheme.
692
+ * @return {Wallet|number|null} Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
693
+ */
694
+ export function openWalletFromSeed(seedArray: Array<number> | Uint8Array): Wallet | number | null;
695
+ /**
696
+ * The openWalletFromSeedWords function creates a wallet from a seed word list. The seed word list is available for wallets created from Desktop/Web/Mobile wallets.
697
+ * Supports 48 words (hybrideds), 36 words (hybrid5), or 32 words (hybrid) per seed length.
698
+ *
699
+ * @function openWalletFromSeedWords
700
+ * @param {string[]} seedWordList - An array of seed words. Length 48, 36, or 32 depending on scheme.
701
+ * @return {Wallet|number|null} Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
702
+ */
703
+ export function openWalletFromSeedWords(seedWordList: string[]): Wallet | number | null;
704
+ /**
705
+ * The publicKeyFromSignature extracts the public key from a signature.
706
+ *
707
+ * @function publicKeyFromSignature
708
+ * @param {number[]} digest - An array of bytes containing the digestHash. Should be of length 32.
709
+ * @param {number[]} signature - An array of bytes containing the signature.
710
+ * @return {string} - Returns the public key as a hex string. Returns null if the operation failed.
711
+ */
712
+ export function publicKeyFromSignature(digest: number[], signature: number[]): string;
713
+ /**
714
+ * The publicKeyFromPrivateKey extracts the public key from a private key.
715
+ *
716
+ * @function publicKeyFromPrivateKey
717
+ * @param {number[]} privateKey - An array of bytes containing the privateKey.
718
+ * @return {string} - Returns the public key as a hex string. Returns null if the operation failed.
719
+ */
720
+ export function publicKeyFromPrivateKey(privateKey: number[]): string;
721
+ /**
722
+ * The addressFromPublicKey returns the address corresponding to the public key.
723
+ *
724
+ * @function addressFromPublicKey
725
+ * @param {number[]} publicKey - An array of bytes containing the public key.
726
+ * @return {string} - Returns the address corresponding to the public key as a hex string. Returns null if the operation failed.
727
+ */
728
+ export function addressFromPublicKey(publicKey: number[]): string;
729
+ /**
730
+ * The combinePublicKeySignature combines the public key and signature.
731
+ *
732
+ * @function combinePublicKeySignature
733
+ * @param {number[]} publicKey - An array of bytes containing the public key.
734
+ * @param {number[]} signature - An array of bytes containing the signature.
735
+ * @return {string} - Returns a hex string corresponding to combined signature. Returns null if the operation failed.
736
+ */
737
+ export function combinePublicKeySignature(publicKey: number[], signature: number[]): string;
738
+ /**
739
+ * @class
740
+ * @constructor
741
+ * @public
742
+ * @classdesc This class represents a signing request that can be passed to signTransaction.
743
+ */
744
+ export class TransactionSigningRequest {
745
+ /**
746
+ * Creates a TransactionSigningRequest class.
747
+ * @param {Wallet} wallet - The wallet with which the transaction has to be signed. The constructor does not verify the wallet. To verify a wallet, call the verifyWallet function explicitly.
748
+ * @param {string} toAddress - The address to which the transaction request is made. Can be null (for example, for contract creation).
749
+ * @param {string|BigInt} valueInWei - The value in wei-units. Can be provided as either a hex string (including 0x prefix) or a BigInt. For example, to represent 1 coin, which is 1000000000000000000 in wei-units, set the value to "0xDE0B6B3A7640000" or BigInt("1000000000000000000"). {@link /example/conversion-example.js|Conversion Examples}
750
+ * @param {number} nonce - A monotonically increasing number representing the nonce of the account signing the transaction. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
751
+ * @param {string} data - An optional hex string (including 0x) that represents the contract data. Can be null if not invoking or creating a contract.
752
+ * @param {number} gasLimit - A limit of gas to be used. Set 21000 for basic non smart contract transactions.
753
+ * @param {string} remarks - An optional hex string (including 0x) that represents a remark (such as a comment). Maximum 32 bytes length (in bytes). Warning, do not store any sensitive information in this field.
754
+ * @param {number|null} chainId - The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324. If null, the chainId specified in the initialize() function will be used.
755
+ * @param {number|null} signingContext - It is recommended that you pass null for this parameter, unless the context needs to be set explicitly. Signing context determines the cryptographic scheme used to sign. The wallet key type should compatible with the signing context. Applicable values are 0,1,2. Default value if not specified will be determined dynamically from the wallet key type. Signing context 1,2 will incur additional gas fee. For information on the schemes, see https://github.com/quantumcoinproject/circl?tab=readme-ov-file#hybrid-schemes
756
+ * Signing context 0: Scheme used is hybrid-ed-mldsa-slhdsa compact (scheme id 3)
757
+ * Signing context 1: Scheme used is hybrid-ed-mldsa-slhdsa-5 (scheme id 5 : 20x the gas fee of scheme 0)
758
+ * Signing context 2: hybrid-ed-mldsa-slhdsa full (scheme id 4 : 30x the gas fee of scheme 0)
759
+ */
760
+ constructor(wallet: Wallet, toAddress: string, valueInWei: string | bigint, nonce: number, data: string, gasLimit: number, remarks: string, chainId: number | null, signingContext: number | null);
761
+ /**
762
+ * The wallet that should be used to sign the transaction.
763
+ * @type {Wallet}
764
+ * @public
765
+ */
766
+ public wallet: Wallet;
767
+ /**
768
+ * The address to which the transaction request is made. Can be null (for example, for contract creation).
769
+ * @type {string|null}
770
+ * @public
771
+ */
772
+ public toAddress: string | null;
773
+ /**
774
+ * The value in wei-units. Can be provided as either a hex string (including 0x prefix) or a BigInt. For example, to represent 1 coin, which is 1000000000000000000 in wei-units, set the value to "0xDE0B6B3A7640000" or BigInt("1000000000000000000"). {@link /example/conversion-example.js|Conversion Examples}
775
+ * @type {string|BigInt|null}
776
+ * @public
777
+ */
778
+ public valueInWei: string | bigint | null;
779
+ /**
780
+ * A monotonically increasing number representing the nonce of the account signing the transaction. After each transaction from the account that gets registered in the blockchain, the nonce increases by 1.
781
+ * @type {number}
782
+ * @public
783
+ */
784
+ public nonce: number;
785
+ /**
786
+ * An optional hex string (including 0x) that represents the contract data. Can be null if not invoking or creating a contract.
787
+ * @type {string|null}
788
+ * @public
789
+ */
790
+ public data: string | null;
791
+ /**
792
+ * A limit of gas to be used. Set 21000 for basic non smart contract transactions.
793
+ * @type {number}
794
+ * @public
795
+ */
796
+ public gasLimit: number;
797
+ /**
798
+ * An optional hex string (including 0x) that represents a remark (such as a comment). Maximum 32 bytes length (in bytes). Warning, do not store any sensitive information in this field.
799
+ * @type {string|null}
800
+ * @public
801
+ */
802
+ public remarks: string | null;
803
+ /**
804
+ * The chain id of the blockchain. Mainnet chainId is 123123. If null, the chainId specified in the initialize() function will be used.
805
+ * @type {number|null}
806
+ * @public
807
+ */
808
+ public chainId: number | null;
809
+ /**
810
+ * It is recommended that you pass null for this parameter, unless the context needs to be set explicitly. Signing context determines the cryptographic scheme used to sign. Gas fee varies by context.
811
+ * @type {number|null}
812
+ * @public
813
+ */
814
+ public signingContext: number | null;
815
+ }
816
+ /**
817
+ * The signRawTransaction function returns a signed transaction. The chainId used for signing can be provided in the TransactionSigningRequest, or if null, the chainId specified in the initialize() function will be used.
818
+ * With this function, you can set the gasLimit explicitly compared to signTransaction.
819
+ * You can also pass data to be signed, such as when creating or invoking a smart contract.
820
+ * Since the gas fee is fixed at 1000 coins for 21000 units of gas, there is no option to set the gas fee explicitly.
821
+ * This function is useful for offline (cold storage) wallets, where you can sign a transaction offline and then use the postTransaction function to post it on a connected device.
822
+ * Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
823
+ *
824
+ * @function signRawTransaction
825
+ * @param {TransactionSigningRequest} transactionSigningRequest - An object of type TransactionSigningRequest with the transaction signing details.
826
+ * @return {SignResult} Returns a promise of type SignResult.
827
+ */
828
+ export function signRawTransaction(transactionSigningRequest: TransactionSigningRequest): SignResult;
829
+ /**
830
+ * Sign a message with a private key. Optional signingContext selects algorithm (same pattern as signRawTransaction); if null/omitted, derived from private key type.
831
+ * @param {number[]|Uint8Array} privateKey - Private key bytes.
832
+ * @param {number[]|Uint8Array} message - Message bytes (e.g. 32-byte hash).
833
+ * @param {number|null} [signingContext] - Optional. 0 = hybridedmldsaslhdsa compact, 1 = hybridedmldsaslhdsa5, 2 = hybridedmldsaslhdsa full. If null/omitted, derived from private key type.
834
+ * @returns {{ resultCode: number, signature: Uint8Array|null }} resultCode 0 on success, signature bytes; negative on error (e.g. -1000 not initialized, -700 invalid args, -701 unknown key type, -702/-703 CIRCL sign error, -704 unsupported key type or context).
835
+ */
836
+ export function sign(privateKey: number[] | Uint8Array, message: number[] | Uint8Array, signingContext?: number | null): {
837
+ resultCode: number;
838
+ signature: Uint8Array | null;
839
+ };
840
+ /**
841
+ * Verify a signature over a message with a public key. Algorithm is determined by the first byte of the signature: 1=hybrideds verifyCompact, 2=hybrideds verify, 3=hybridedmldsaslhdsa verifyCompact, 4=hybridedmldsaslhdsa verify, 5=hybridedmldsaslhdsa5 verify.
842
+ * @param {number[]|Uint8Array} publicKey - Public key bytes.
843
+ * @param {number[]|Uint8Array} signature - Signature bytes from sign(); first byte selects verify function (1-5).
844
+ * @param {number[]|Uint8Array} message - Message bytes (same as passed to sign).
845
+ * @returns {{ resultCode: number, valid: boolean }} resultCode 0 and valid true if signature is valid; negative on error (e.g. -1000 not initialized, -715 invalid args, -717 CIRCL verify error, -719 signature invalid, -718 unknown signature type).
846
+ */
847
+ export function verify(publicKey: number[] | Uint8Array, signature: number[] | Uint8Array, message: number[] | Uint8Array): {
848
+ resultCode: number;
849
+ valid: boolean;
850
+ };
851
+ /**
852
+ * The packMethodData function packs a Solidity method call with the given ABI, method name, and arguments.
853
+ * It returns the transaction data as a hex string that can be included in a transaction.
854
+ *
855
+ * @function packMethodData
856
+ * @param {string} abiJSON - The Solidity ABI file content as a JSON string
857
+ * @param {string} methodName - The name of the method to call
858
+ * @param {...*} args - The parameters to pass to the method (variable arguments)
859
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the packed transaction data as a hex string.
860
+ */
861
+ export function packMethodData(abiJSON: string, methodName: string, ...args: any[]): PackUnpackResult;
862
+ /**
863
+ * The unpackMethodData function unpacks the return values of a Solidity method call.
864
+ * It returns the unpacked values as a JavaScript array or object.
865
+ *
866
+ * @function unpackMethodData
867
+ * @param {string} abiJSON - The Solidity ABI file content as a JSON string
868
+ * @param {string} methodName - The name of the method whose return values to unpack
869
+ * @param {string} hexData - The hex-encoded return data (with or without 0x prefix)
870
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the unpacked return values as a JSON string.
871
+ */
872
+ export function unpackMethodData(abiJSON: string, methodName: string, hexData: string): PackUnpackResult;
873
+ /**
874
+ * The packCreateContractData function packs constructor data for contract creation.
875
+ * It combines the contract bytecode with the ABI-encoded constructor parameters.
876
+ * This matches the Go pattern: Pack("", params...) and append(bytecode, input...)
877
+ *
878
+ * @function packCreateContractData
879
+ * @param {string} abiJSON - The Solidity ABI file content as a JSON string
880
+ * @param {string} bytecode - The contract bytecode as a hex string (with or without 0x prefix)
881
+ * @param {...*} args - The constructor parameters (variable arguments, can be 0 or more)
882
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the packed contract creation data as a hex string.
883
+ */
884
+ export function packCreateContractData(abiJSON: string, bytecode: string, ...args: any[]): PackUnpackResult;
885
+ /**
886
+ * The encodeEventLog function encodes event parameters into topics and data according to the ABI specification.
887
+ * It returns the topics array and data hex string that can be used to create event logs.
888
+ *
889
+ * @function encodeEventLog
890
+ * @param {string} abiJSON - The Solidity ABI file content as a JSON string
891
+ * @param {string} eventName - The name of the event to encode
892
+ * @param {...*} args - The event parameter values (variable arguments)
893
+ * @return {EventLogEncodeResult} - Returns an EventLogEncodeResult object containing the error (if any) and the encoded event log with topics and data.
894
+ */
895
+ export function encodeEventLog(abiJSON: string, eventName: string, ...args: any[]): EventLogEncodeResult;
896
+ /**
897
+ * The decodeEventLog function decodes event log topics and data back into event parameters.
898
+ * It returns the decoded values as a JavaScript object.
899
+ *
900
+ * @function decodeEventLog
901
+ * @param {string} abiJSON - The Solidity ABI file content as a JSON string
902
+ * @param {string} eventName - The name of the event to decode
903
+ * @param {string[]} topics - Array of topic hex strings (with or without 0x prefix)
904
+ * @param {string} data - Hex-encoded data string (with or without 0x prefix)
905
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the decoded event parameters as a JSON string.
906
+ */
907
+ export function decodeEventLog(abiJSON: string, eventName: string, topics: string[], data: string): PackUnpackResult;
908
+ /**
909
+ * The encodeRlp function encodes a JavaScript value to RLP (Recursive Length Prefix) format.
910
+ * Supports: strings, numbers, booleans, arrays, objects (maps), and hex-encoded bytes.
911
+ * Returns a hex-encoded string of the RLP-encoded data.
912
+ *
913
+ * @function encodeRlp
914
+ * @param {*} value - The value to encode (can be string, number, boolean, array, object, etc.)
915
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the RLP-encoded data as a hex string.
916
+ */
917
+ export function encodeRlp(value: any): PackUnpackResult;
918
+ /**
919
+ * The decodeRlp function decodes RLP-encoded data back to a JavaScript-compatible value.
920
+ * Takes a hex-encoded string and returns a JSON string representation of the decoded value.
921
+ *
922
+ * @function decodeRlp
923
+ * @param {string} data - The hex-encoded RLP data (with or without 0x prefix)
924
+ * @return {PackUnpackResult} - Returns a PackUnpackResult object containing the error (if any) and the decoded value as a JSON string.
925
+ */
926
+ export function decodeRlp(data: string): PackUnpackResult;
927
+ /**
928
+ * The createAddress function calculates the contract address that will be created by a transaction.
929
+ * This uses the CREATE opcode address calculation: keccak256(RLP(sender, nonce))
930
+ *
931
+ * @function createAddress
932
+ * @param {string} address - The address of the account that will create the contract (hex string with 0x prefix)
933
+ * @param {number} nonce - The nonce of the account at the time of contract creation
934
+ * @return {string|null} - Returns the contract address as a hex string, or null if an error occurred.
935
+ */
936
+ export function createAddress(address: string, nonce: number): string | null;
937
+ /**
938
+ * The createAddress2 function calculates the contract address using the CREATE2 opcode.
939
+ * This allows deterministic contract address calculation: keccak256(0xff || sender || salt || keccak256(init_code))
940
+ *
941
+ * @function createAddress2
942
+ * @param {string} address - The address of the account that will create the contract (hex string with 0x prefix)
943
+ * @param {string} salt - A 32-byte salt value as a hex string (with 0x prefix)
944
+ * @param {string} initHash - The keccak256 hash of the contract initialization code as a hex string (with 0x prefix)
945
+ * @return {string|null} - Returns the contract address as a hex string, or null if an error occurred.
946
+ */
947
+ export function createAddress2(address: string, salt: string, initHash: string): string | null;
948
+ /**
949
+ * @class
950
+ * @constructor
951
+ * @public
952
+ * @classdesc This class represents a result from invoking the packMethodData or unpackMethodData functions.
953
+ */
954
+ export class PackUnpackResult {
955
+ /**
956
+ * Creates a PackUnpackResult class.
957
+ * @param {string} error - Error message if any. Empty string if no error.
958
+ * @param {string} result - The actual result as a string. Empty string if there was an error.
959
+ */
960
+ constructor(error: string, result: string);
961
+ /**
962
+ * Error message if any. Empty string if no error.
963
+ * @type {string}
964
+ * @public
965
+ */
966
+ public error: string;
967
+ /**
968
+ * The actual result as a string. Empty string if there was an error.
969
+ * @type {string}
970
+ * @public
971
+ */
972
+ public result: string;
973
+ }
974
+ /**
975
+ * @class EventLogEncodeResult
976
+ * @classdesc This class represents a result from invoking the encodeEventLog function.
977
+ */
978
+ export class EventLogEncodeResult {
979
+ /**
980
+ * Creates an EventLogEncodeResult class.
981
+ * @param {string} error - Error message if any. Empty string if no error.
982
+ * @param {Object|null} result - The actual result object with topics and data. Null if there was an error.
983
+ * @param {string[]} result.topics - Array of topic hex strings (with 0x prefix)
984
+ * @param {string} result.data - Hex-encoded data string (with 0x prefix)
985
+ */
986
+ constructor(error: string, result: Object | null);
987
+ /**
988
+ * Error message if any. Empty string if no error.
989
+ * @type {string}
990
+ * @public
991
+ */
992
+ public error: string;
993
+ /**
994
+ * The actual result object with topics and data. Null if there was an error.
995
+ * @type {Object|null}
996
+ * @property {string[]} topics - Array of topic hex strings (with 0x prefix)
997
+ * @property {string} data - Hex-encoded data string (with 0x prefix)
998
+ * @public
999
+ */
1000
+ public result: Object | null;
1001
+ }
1002
+ /**
1003
+ * @class
1004
+ * @constructor
1005
+ * @public
1006
+ * @classdesc This class represents a result from invoking the signSendCoinTransaction function.
1007
+ */
1008
+ declare class SignResult {
1009
+ constructor(resultCode: any, txnHash: any, txnData: any);
1010
+ /**
1011
+ * Represents the result of the operation. A value of 0 represents that the operation succeeded. Any other value indicates the operation failed. See the result code section for more details.
1012
+ * @type {number}
1013
+ * @public
1014
+ */
1015
+ public resultCode: number;
1016
+ /**
1017
+ * Hash of the Transaction, to uniquely identify it. Is 66 bytes in length including 0x. This value is null if the value of resultCode is not 0.
1018
+ * @type {string}
1019
+ * @public
1020
+ */
1021
+ public txnHash: string;
1022
+ /**
1023
+ * A payload representing the signed transaction.
1024
+ * To actually send a transaction, this payload can then be taken to to a different device that is connected to the blockchain relay and then sent using the postTransaction function.
1025
+ * This value is null if the value of resultCode is not 0.
1026
+ * @type {string}
1027
+ * @public
1028
+ */
1029
+ public txnData: string;
1030
+ }
1031
+ export {};