quantum-coin-js-sdk 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/example/README.md +0 -9
- package/example/example.js +53 -3
- package/example/package-lock.json +3 -3
- package/index.js +97 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ Installation:
|
|
|
27
27
|
* [.resultCode](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+resultCode) : <code>number</code>
|
|
28
28
|
* [.blockDetails](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+blockDetails) : <code>BlockDetails</code>
|
|
29
29
|
* [.response](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+response) : <code>Object</code>
|
|
30
|
+
* [.requestId](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+requestId) : <code>string</code>
|
|
30
31
|
* [~AccountDetails](#module_quantum-coin-js-sdk..AccountDetails)
|
|
31
32
|
* [.address](#module_quantum-coin-js-sdk..AccountDetails+address) : <code>string</code>
|
|
32
33
|
* [.balance](#module_quantum-coin-js-sdk..AccountDetails+balance) : <code>string</code>
|
|
@@ -36,6 +37,7 @@ Installation:
|
|
|
36
37
|
* [.resultCode](#module_quantum-coin-js-sdk..AccountDetailsResult+resultCode) : <code>number</code>
|
|
37
38
|
* [.accountDetails](#module_quantum-coin-js-sdk..AccountDetailsResult+accountDetails) : <code>AccountDetails</code>
|
|
38
39
|
* [.response](#module_quantum-coin-js-sdk..AccountDetailsResult+response) : <code>Object</code>
|
|
40
|
+
* [.requestId](#module_quantum-coin-js-sdk..AccountDetailsResult+requestId) : <code>string</code>
|
|
39
41
|
* [~SignResult](#module_quantum-coin-js-sdk..SignResult)
|
|
40
42
|
* [.resultCode](#module_quantum-coin-js-sdk..SignResult+resultCode) : <code>number</code>
|
|
41
43
|
* [.txnHash](#module_quantum-coin-js-sdk..SignResult+txnHash) : <code>string</code>
|
|
@@ -44,6 +46,7 @@ Installation:
|
|
|
44
46
|
* [.resultCode](#module_quantum-coin-js-sdk..SendResult+resultCode) : <code>number</code>
|
|
45
47
|
* [.txnHash](#module_quantum-coin-js-sdk..SendResult+txnHash) : <code>string</code>
|
|
46
48
|
* [.response](#module_quantum-coin-js-sdk..SendResult+response) : <code>Object</code>
|
|
49
|
+
* [.requestId](#module_quantum-coin-js-sdk..SendResult+requestId) : <code>string</code>
|
|
47
50
|
* [~TransactionReceipt](#module_quantum-coin-js-sdk..TransactionReceipt)
|
|
48
51
|
* [.cumulativeGasUsed](#module_quantum-coin-js-sdk..TransactionReceipt+cumulativeGasUsed) : <code>string</code>
|
|
49
52
|
* [.effectiveGasPrice](#module_quantum-coin-js-sdk..TransactionReceipt+effectiveGasPrice) : <code>string</code>
|
|
@@ -67,6 +70,7 @@ Installation:
|
|
|
67
70
|
* [.resultCode](#module_quantum-coin-js-sdk..TransactionDetailsResult+resultCode) : <code>number</code>
|
|
68
71
|
* [.transactionDetails](#module_quantum-coin-js-sdk..TransactionDetailsResult+transactionDetails) : <code>TransactionDetails</code>
|
|
69
72
|
* [.response](#module_quantum-coin-js-sdk..TransactionDetailsResult+response) : <code>Object</code>
|
|
73
|
+
* [.requestId](#module_quantum-coin-js-sdk..TransactionDetailsResult+requestId) : <code>string</code>
|
|
70
74
|
* [~AccountTransactionCompact](#module_quantum-coin-js-sdk..AccountTransactionCompact)
|
|
71
75
|
* [.blockNumber](#module_quantum-coin-js-sdk..AccountTransactionCompact+blockNumber) : <code>number</code>
|
|
72
76
|
* [.from](#module_quantum-coin-js-sdk..AccountTransactionCompact+from) : <code>string</code>
|
|
@@ -81,6 +85,7 @@ Installation:
|
|
|
81
85
|
* [.resultCode](#module_quantum-coin-js-sdk..AccountTransactionsResult+resultCode) : <code>number</code>
|
|
82
86
|
* [.listAccountTransactionsResponse](#module_quantum-coin-js-sdk..AccountTransactionsResult+listAccountTransactionsResponse) : <code>ListAccountTransactionsResponse</code>
|
|
83
87
|
* [.response](#module_quantum-coin-js-sdk..AccountTransactionsResult+response) : <code>Object</code>
|
|
88
|
+
* [.requestId](#module_quantum-coin-js-sdk..AccountTransactionsResult+requestId) : <code>string</code>
|
|
84
89
|
* [~initialize(clientConfig)](#module_quantum-coin-js-sdk..initialize) ⇒ <code>Promise.<boolean></code>
|
|
85
90
|
* [~isAddressValid(address)](#module_quantum-coin-js-sdk..isAddressValid) ⇒ <code>boolean</code>
|
|
86
91
|
* [~newWallet()](#module_quantum-coin-js-sdk..newWallet) ⇒ <code>Wallet</code>
|
|
@@ -233,6 +238,7 @@ This class represents a result from invoking the getLatestBlock function.
|
|
|
233
238
|
* [.resultCode](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+resultCode) : <code>number</code>
|
|
234
239
|
* [.blockDetails](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+blockDetails) : <code>BlockDetails</code>
|
|
235
240
|
* [.response](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+response) : <code>Object</code>
|
|
241
|
+
* [.requestId](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+requestId) : <code>string</code>
|
|
236
242
|
|
|
237
243
|
<a name="module_quantum-coin-js-sdk..LatestBlockDetailsResult+resultCode"></a>
|
|
238
244
|
|
|
@@ -253,6 +259,13 @@ An object of type BlockDetails representing the block. This value is null if the
|
|
|
253
259
|
#### latestBlockDetailsResult.response : <code>Object</code>
|
|
254
260
|
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.
|
|
255
261
|
|
|
262
|
+
**Kind**: instance property of [<code>LatestBlockDetailsResult</code>](#module_quantum-coin-js-sdk..LatestBlockDetailsResult)
|
|
263
|
+
**Access**: public
|
|
264
|
+
<a name="module_quantum-coin-js-sdk..LatestBlockDetailsResult+requestId"></a>
|
|
265
|
+
|
|
266
|
+
#### latestBlockDetailsResult.requestId : <code>string</code>
|
|
267
|
+
An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
268
|
+
|
|
256
269
|
**Kind**: instance property of [<code>LatestBlockDetailsResult</code>](#module_quantum-coin-js-sdk..LatestBlockDetailsResult)
|
|
257
270
|
**Access**: public
|
|
258
271
|
<a name="module_quantum-coin-js-sdk..AccountDetails"></a>
|
|
@@ -309,6 +322,7 @@ This class represents a result from invoking the getAccountDetails function.
|
|
|
309
322
|
* [.resultCode](#module_quantum-coin-js-sdk..AccountDetailsResult+resultCode) : <code>number</code>
|
|
310
323
|
* [.accountDetails](#module_quantum-coin-js-sdk..AccountDetailsResult+accountDetails) : <code>AccountDetails</code>
|
|
311
324
|
* [.response](#module_quantum-coin-js-sdk..AccountDetailsResult+response) : <code>Object</code>
|
|
325
|
+
* [.requestId](#module_quantum-coin-js-sdk..AccountDetailsResult+requestId) : <code>string</code>
|
|
312
326
|
|
|
313
327
|
<a name="module_quantum-coin-js-sdk..AccountDetailsResult+resultCode"></a>
|
|
314
328
|
|
|
@@ -329,6 +343,13 @@ An object of type AccountDetails representing the block. This value is null if t
|
|
|
329
343
|
#### accountDetailsResult.response : <code>Object</code>
|
|
330
344
|
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.
|
|
331
345
|
|
|
346
|
+
**Kind**: instance property of [<code>AccountDetailsResult</code>](#module_quantum-coin-js-sdk..AccountDetailsResult)
|
|
347
|
+
**Access**: public
|
|
348
|
+
<a name="module_quantum-coin-js-sdk..AccountDetailsResult+requestId"></a>
|
|
349
|
+
|
|
350
|
+
#### accountDetailsResult.requestId : <code>string</code>
|
|
351
|
+
An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
352
|
+
|
|
332
353
|
**Kind**: instance property of [<code>AccountDetailsResult</code>](#module_quantum-coin-js-sdk..AccountDetailsResult)
|
|
333
354
|
**Access**: public
|
|
334
355
|
<a name="module_quantum-coin-js-sdk..SignResult"></a>
|
|
@@ -377,6 +398,7 @@ This class represents a result from invoking the sendCoins function.
|
|
|
377
398
|
* [.resultCode](#module_quantum-coin-js-sdk..SendResult+resultCode) : <code>number</code>
|
|
378
399
|
* [.txnHash](#module_quantum-coin-js-sdk..SendResult+txnHash) : <code>string</code>
|
|
379
400
|
* [.response](#module_quantum-coin-js-sdk..SendResult+response) : <code>Object</code>
|
|
401
|
+
* [.requestId](#module_quantum-coin-js-sdk..SendResult+requestId) : <code>string</code>
|
|
380
402
|
|
|
381
403
|
<a name="module_quantum-coin-js-sdk..SendResult+resultCode"></a>
|
|
382
404
|
|
|
@@ -397,6 +419,13 @@ Hash of the Transaction, to uniquely identify it. Is 66 bytes in length includin
|
|
|
397
419
|
#### sendResult.response : <code>Object</code>
|
|
398
420
|
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.
|
|
399
421
|
|
|
422
|
+
**Kind**: instance property of [<code>SendResult</code>](#module_quantum-coin-js-sdk..SendResult)
|
|
423
|
+
**Access**: public
|
|
424
|
+
<a name="module_quantum-coin-js-sdk..SendResult+requestId"></a>
|
|
425
|
+
|
|
426
|
+
#### sendResult.requestId : <code>string</code>
|
|
427
|
+
An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
428
|
+
|
|
400
429
|
**Kind**: instance property of [<code>SendResult</code>](#module_quantum-coin-js-sdk..SendResult)
|
|
401
430
|
**Access**: public
|
|
402
431
|
<a name="module_quantum-coin-js-sdk..TransactionReceipt"></a>
|
|
@@ -567,6 +596,7 @@ This class represents a result from invoking the getTransactionDetails function.
|
|
|
567
596
|
* [.resultCode](#module_quantum-coin-js-sdk..TransactionDetailsResult+resultCode) : <code>number</code>
|
|
568
597
|
* [.transactionDetails](#module_quantum-coin-js-sdk..TransactionDetailsResult+transactionDetails) : <code>TransactionDetails</code>
|
|
569
598
|
* [.response](#module_quantum-coin-js-sdk..TransactionDetailsResult+response) : <code>Object</code>
|
|
599
|
+
* [.requestId](#module_quantum-coin-js-sdk..TransactionDetailsResult+requestId) : <code>string</code>
|
|
570
600
|
|
|
571
601
|
<a name="module_quantum-coin-js-sdk..TransactionDetailsResult+resultCode"></a>
|
|
572
602
|
|
|
@@ -587,6 +617,13 @@ An object of type TransactionDetails representing the transaction. This value is
|
|
|
587
617
|
#### transactionDetailsResult.response : <code>Object</code>
|
|
588
618
|
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.
|
|
589
619
|
|
|
620
|
+
**Kind**: instance property of [<code>TransactionDetailsResult</code>](#module_quantum-coin-js-sdk..TransactionDetailsResult)
|
|
621
|
+
**Access**: public
|
|
622
|
+
<a name="module_quantum-coin-js-sdk..TransactionDetailsResult+requestId"></a>
|
|
623
|
+
|
|
624
|
+
#### transactionDetailsResult.requestId : <code>string</code>
|
|
625
|
+
An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
626
|
+
|
|
590
627
|
**Kind**: instance property of [<code>TransactionDetailsResult</code>](#module_quantum-coin-js-sdk..TransactionDetailsResult)
|
|
591
628
|
**Access**: public
|
|
592
629
|
<a name="module_quantum-coin-js-sdk..AccountTransactionCompact"></a>
|
|
@@ -685,6 +722,7 @@ This class represents a result from invoking the listAccountTransactionDetails f
|
|
|
685
722
|
* [.resultCode](#module_quantum-coin-js-sdk..AccountTransactionsResult+resultCode) : <code>number</code>
|
|
686
723
|
* [.listAccountTransactionsResponse](#module_quantum-coin-js-sdk..AccountTransactionsResult+listAccountTransactionsResponse) : <code>ListAccountTransactionsResponse</code>
|
|
687
724
|
* [.response](#module_quantum-coin-js-sdk..AccountTransactionsResult+response) : <code>Object</code>
|
|
725
|
+
* [.requestId](#module_quantum-coin-js-sdk..AccountTransactionsResult+requestId) : <code>string</code>
|
|
688
726
|
|
|
689
727
|
<a name="module_quantum-coin-js-sdk..AccountTransactionsResult+resultCode"></a>
|
|
690
728
|
|
|
@@ -705,6 +743,13 @@ An object of type ListAccountTransactionsResponse representing the list of trans
|
|
|
705
743
|
#### accountTransactionsResult.response : <code>Object</code>
|
|
706
744
|
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.
|
|
707
745
|
|
|
746
|
+
**Kind**: instance property of [<code>AccountTransactionsResult</code>](#module_quantum-coin-js-sdk..AccountTransactionsResult)
|
|
747
|
+
**Access**: public
|
|
748
|
+
<a name="module_quantum-coin-js-sdk..AccountTransactionsResult+requestId"></a>
|
|
749
|
+
|
|
750
|
+
#### accountTransactionsResult.requestId : <code>string</code>
|
|
751
|
+
An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
752
|
+
|
|
708
753
|
**Kind**: instance property of [<code>AccountTransactionsResult</code>](#module_quantum-coin-js-sdk..AccountTransactionsResult)
|
|
709
754
|
**Access**: public
|
|
710
755
|
<a name="module_quantum-coin-js-sdk..initialize"></a>
|
package/example/README.md
CHANGED
package/example/example.js
CHANGED
|
@@ -9,13 +9,25 @@ var clientConfigVal = new qcsdk.Config("https://t4-relayread.quantumcoin.org", "
|
|
|
9
9
|
//var clientConfigVal = new qcsdk.Config("https://relayread.quantumcoin.org", "https://relaywrite.quantumcoin.org", 123123, "", ""); //Mainnet
|
|
10
10
|
//Mainnet Block Explorer: https://scan.quantumcoin.org
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
//Conversion examples
|
|
14
|
+
let hexValue = "0x56BC75E2D63100000";
|
|
15
|
+
let weiValueExample = BigInt(hexValue).toString(); //convert hex to wei
|
|
16
|
+
console.log("hex to wei example: hex:" + hexValue + ", wei: " + weiValueExample);
|
|
17
|
+
|
|
18
|
+
let ethValueExample = ethers.formatEther(weiValueExample); //convert wei to eth
|
|
19
|
+
console.log("wei to eth example: wei:" + weiValueExample + ", eth (coins): " + ethValueExample);
|
|
20
|
+
|
|
21
|
+
let weiValueExample2 = ethers.parseUnits(ethValueExample, "ether"); //convert eth to wei
|
|
22
|
+
console.log("eth to wei example: eth (coins):" + ethValueExample + ", wei: " + weiValueExample2);
|
|
23
|
+
|
|
12
24
|
//Initialize the SDK
|
|
13
25
|
qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
14
26
|
if (initResult === false) {
|
|
15
27
|
console.error("Initialize failed");
|
|
16
28
|
return;
|
|
17
29
|
}
|
|
18
|
-
console.log("Initialize succeeded");
|
|
30
|
+
console.log("Initialize succeeded");
|
|
19
31
|
|
|
20
32
|
//Get the account details
|
|
21
33
|
let address = "0x0000000000000000000000000000000000000000000000000000000000001000"; //Just an example address https://t4.scan.quantumcoin.org/account/0x0000000000000000000000000000000000000000000000000000000000001000
|
|
@@ -43,7 +55,7 @@ qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
|
43
55
|
|
|
44
56
|
console.log(" balance (wei): " + accountDetailsResult.accountDetails.balance);
|
|
45
57
|
var etherValue = ethers.formatEther(accountDetailsResult.accountDetails.balance)
|
|
46
|
-
console.log(" balance coins: " + etherValue);
|
|
58
|
+
console.log(" balance coins (ether): " + etherValue);
|
|
47
59
|
|
|
48
60
|
console.log(" nonce: " + accountDetailsResult.accountDetails.nonce);
|
|
49
61
|
|
|
@@ -231,10 +243,48 @@ qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
|
231
243
|
console.log(" Transaction Hash: " + txn.hash);
|
|
232
244
|
console.log(" From Address: " + txn.from);
|
|
233
245
|
console.log(" To Address: " + txn.to);
|
|
234
|
-
|
|
246
|
+
|
|
247
|
+
let weiValueExample = BigInt(txn.value).toString(); //value is in hex. convert hex to wei
|
|
248
|
+
let ethValueExample = ethers.formatEther(weiValueExample); //convert wei to eth
|
|
249
|
+
console.log(" Value (hex): " + txn.value + " , (wei): " + weiValueExample + " , coins (eth): " + ethValueExample);
|
|
250
|
+
|
|
235
251
|
console.log(" Status: " + txn.status);
|
|
236
252
|
console.log(" Block Number: " + txn.blockNumber);
|
|
237
253
|
}
|
|
238
254
|
});
|
|
255
|
+
|
|
256
|
+
//Offline sign a transaction from existing wallet. This is typically called from an offline device hosting a cold storage wallet
|
|
257
|
+
let walletJsonExample = '{"address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7BVwGb6vYGs7r8h6/iALRBoVdqGzb05OaFkZwUoAQBGBNKJgPRkfU6DNRpH4XIpcFgutE4aMWwk6sDpAri90fNgSgubFvZWPrztCTgQOgNdhbUlP2+jKC184Jsc3Sz62j+dGNk2muC/H0frCEGUYJetU2LfJ7mPI9gWbYWzFhXFWv2L4qOU6butU6X4hMDKScdcdPMniM1amn6JdF4rWTXNr4EkvXMh3NxFh60KHRFINMUljNtSsywg7+wVBYXHcShzR7ZnpF591QCwyJI5zuz/Fh9T7ucNsWWUIM9qeEeSu1wB/ZlyL7hQR2mKv9Axv1m4bPQsVzkldaIhVhToFr3NYANSVOGrYPwp0xtwZ1HeUQwD/Pj29uUXqb2acU80JqpsNtw5Ir1EtinKXpJ3lQec6jn+p2nFk3MlNPKw90cLRHg6QmllYVP4O+4ekNnvAVgNNs29Otf1Rh+3qfAKCSZdFged3fXgvTFigQD5tE+AFg9GNIkfnrZfq8G29OWKvbOlqNmogKOHQSHpcUODPiv/DwpbA9O04hCHoCIINZ0b8PxZNXaC/6+e2B6AkBMCnl9TZic4bNo+vs63ydTiuvJMSpWkbt2lnrJ7iKpiSAJ17ZBsXyZQCZ1+Zwe+HEBrA0hW02xVqy+dm3D0d1fnF5D+LdaUrH6UgaUy1bYI4KVq+LTOk2dC4nKkhVlYdG2JLtu16Olq/mpbLY/WeS3svKchXo69oq4lTogVxmc5DCl2gMHqVdK+v/4A7ObhCMftGKSD9BxXurBIhP5CQlYsEVO1tOagm0p7DcAI1O5QeKOCXgL1IrwNuW5gkuRM1MUyvKwnIl8FDBOVvzZRKfBSwAum4CEn6T+ja064ldZDigVACIWl9P9m9zmLXblWcZCi9e8ym+dg=="}';
|
|
258
|
+
let walletExample = qcsdk.deserializeWallet(walletJsonExample);
|
|
259
|
+
|
|
260
|
+
var toAddressExample = "0x8293cd9b6ac502d2fe077b0c157dad39f36a5e546525b053151dced633634612";
|
|
261
|
+
var nonceExample = 0;
|
|
262
|
+
var coinsExample = "10"; //in ethers and not in wei
|
|
263
|
+
|
|
264
|
+
qcsdk.signSendCoinTransaction(walletExample, toAddressExample, coinsExample, nonceExample).then((signResult) => {
|
|
265
|
+
console.log("signSendCoinTransaction resultCode: " + signResult.resultCode);
|
|
266
|
+
console.log("signSendCoinTransaction hash: " + signResult.txnHash);
|
|
267
|
+
console.log("signSendCoinTransaction txnData: " + signResult.txnData); //txnData is to be sent to postTransaction
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
//Post a transaction that was signed offline (output of signSendCoinTransaction)
|
|
271
|
+
let txnData = '0x00f90fbb8304bc348082520801a08293cd9b6ac502d2fe077b0c157dad39f36a5e546525b053151dced633634612888ac7230489e800008080c001b9058024465471a06b7a491a1492305f51fafcae8df96363dcb3b1f13569e655b08266f8a969dc1af98647beb680d6458e9ff1b930e3942e9dadce261b8fa6694a2a9fcac646bdfa101bdcf31c72467d74c6495fc560ca3567fca4170fbe72d8cbc1f949e0342c2b152507a64ae9fc58362f9387d314e8253ef52e7f626f2187357c1ca7567188b8d235c19e08fbb1ff89220fb6ca1d4ac073de8efd78b2f628ab22287ba653c708c74884621de9059a9c4077b7a13cb00c76c0fac206c298aab30dcc993b488042d4d9336e60833320fb04cdd13006587ea016730d4d0d9137bc2e5f4c1c1ef76da2006f3778b1280b25def23c224e5742b622227282d6797d8c8628516de0e5f8f96c0ed280a28721e38a00fc277f97059942c73622e153b727f406c5ff7e21354a9309e81e1a976b0edba77421c8571f40b6575ce67d7bcb0b1a804443f554d421eba5eed532e500e014cee7f09cbf9dfc3edb505710861e990d14d1a4d19f2864344deff81e9cd8b6408339b8cd3b8b412cbce8b0fa24891fec7ad7913e15ff24c8cc54036ceb0edc955736f2390c9bf0890ac4023d44da84e24a4b09868a0a9b4f4ae7ae5195fd27323568ae1133cf336087498aabaa7638339550317ef1e77bd2c2269f8d5040a9d27baad03e88248835a1a62eee75ce56b226026d5718c4905f1cdda7d15b3640f81f3c659b48a1ff36c8c3ca5523846ab49acd7fa41ea9b7fa8de46f7f3abdcd4c26f667de59998b9e73f2006d179093ca60630019b6d64cbdaec66db3152a120d1d3334b10d8bac706aae5ff1e41afb1617179ad8c40721afcdd21c2e8a50df8c5fe2292da4578d5c51ef2e86f8f52954f6a2b54a48bcb8875f33dda93090efec4792070ca35d0248626307ee077446376bb1cf7bfbeac0594f9919ebec2c5730784b7a99a0ef5bb5b1e2387d5ebd7c7aac9df78a99dccbf17881f9d8e6508643fc45e0a00c76ad6845b786bf72c4bffb0ee8c2c13e4295b261a0d089d965ecf0cdba2625f03c9fb6e0546c367b055c066fabd81aceebf21ebf8802d106855da86cdbd3939a16467052801004604d28980f4647d4e83351a47e1722970582eb44e1a316c24eac0e902b8bdd1f3604a0b9b16f6563ebced0938103a035d85b5253f6fa3282d7ce09b1cdd2cfada3f9d18d9369ae0bf1f47eb0841946097ad5362df27b98f23d8166d85b31615c55afd8be2a394e9bbad53a5f884c0ca49c75c74f32788cd5a9a7e89745e2b5935cdaf8124bd7321dcdc4587ad0a1d114834c5258cdb52b32c20efec150585c771287347b667a45e7dd500b0c89239ceecff161f53eee70db1659420cf6a784792bb5c01fd99722fb85047698abfd031bf59b86cf42c57392575a2215614e816bdcd60035254e1ab60fc29d31b706751de510c03fcf8f6f6e517a9bd9a714f3426aa6c36dc3922bd44b629ca5e927795079cea39fea769c593732534f2b0f7470b44783a4269656153f83bee1e90d9ef01580d36cdbd3ad7f5461fb7a9f00a09265d16079dddf5e0bd31628100f9b44f80160f4634891f9eb65fabc1b6f4e58abdb3a5a8d9a880a3874121e97143833e2bff0f0a5b03d3b4e21087a02208359d1bf0fc59357682ffaf9ed81e809013029e5f536627386cda3ebeceb7c9d4e2baf24c4a95a46edda59eb27b88aa62480275ed906c5f2650099d7e6707be1c406b034856d36c55ab2f9d9b70f47757e71790fe2dd694ac7e9481a532d5b608e0a56af8b4ce936742e272a4855958746d892edbb5e8e96afe6a5b2d8fd6792decbca7215e8ebda2ae254e8815c667390c297680c1ea55d2bebffe00ece6e108c7ed18a483f41c57bab04884fe4242562c1153b5b4e6a09b4a7b0dc008d4ee5078a3825e02f522bc0db96e6092e44cd4c532bcac27225f050c1395bf365129f052c00ba6e02127e93fa36b4eb895d6438a05400885a5f4ff66f7398b5db9567190a2f5ef329be76b909fe01202412c7a8a885c2f8630f91f10e64e6d2b76d72ee9c5384299c0996a6d42d98897de70ca4c2d10a399a9934fb08cb82642facf4d4e0dcd1c704400d72107fb603d844cad149577da3660bc6c70176cf1e737d475e200aa200e92f9c10fb09e1a0dcfb201c5d09492f1f22724c4611eda9b9888ddaf7d30a8d830229c34c3c80c33ce4bb95d99dcd3caaa8b398de0bb2f8d21096ef4950a0733c285943bc210043a0b42f6259c65f8bc558c0e6befc76fb5a986339911d58b14a18d8303275996944dc5f4035177b7fa826c1a4d3fa4dacaef89f10f8e55f05a912b1b6ce22b021dc2d4ad59c0fab7340f47a40dc2c39b07477925939cad57ad21dbce761bda1fb6c70f15621c9fb1e90e5a8552d43f9d9998bb7add63015e648b3d3c92ca1f097503d8406d974a49e4d7a070816c5bf965a18721fb8a001fecd5a77d2f07fab9398d4aae40294d6fd6631ce2b45848bb7adfc2a4efa60c848ae9ba8517e06cf5e5f3bfdc512c1e2b747ff7e94856db6e9a70c3aa98666ac7f5694b97561d10c192d28d679ea6916f94b2219925a8e16b753a66cc8d814ce2b7e3d06977951df8f59932bb9b976fdf8a33e92bb53f827347ffcbd912c50556467cbe9ff01ccba26c94a50e58c485edd7db5be95a2ad4335023d3b914337cbdb9a477b1c01025a44e0c3efb71368f90824c026346046ede03c90d21ab2ce636d0a93d7b8e76201f355946b05c30af17ad9770100f5994072de23f95009f6aaf5ae47aef2ccc4f754d54cdf3a1b8b7861ccb6bf76b2943fb729f58216e235e6440caad27c481ce397aa249575fb66ed38f742967551bf05e4876310612a112117282303bb539675757e9b9da6513890dffda231c93f84dc6980a93d4304c09a81b14701e40c21fecfd19ea69399372f634b6750dd4deee2eea2812745c47ba38ec7edea3a211fbeab29c3932f37ccb639b7aa79e011fcaff5a2310cc038cd58a5e24eed507104b6c90f87db1c8db6df2adfcb4a9f051109f7c1c31fec403b367e5b4990537517d343dc5a3fc3fd5061dfd0dd0032ffd937e4fd384105861306a7426bf2298ba7ecb7eee46cba8553377e3e6654e6ca66df1f1fa1823e03490d23fbbf3986b078cb5d6ce7227318f257972f1a81db2b401ded74603e51bc968cdcbede1baa89389e8e38d1ab379bb2f94e8a463889c502ab4d0b622c6f86265d1bd9a5d1b08c6a201a2859ecbf7a9414992273137d3370ed79274faf7d954c725aaf1632a1a5509147a54c6bcf7adc11848936e6b5e3e9aa367e924d03af4afb030dfe909df2670d37d8dc666d5cd6bae496137a90b07992f95519254dc47ba625d48a6d0d6af3ac2c29303260d9cc05821684e396a9e91046aa295bd8e25fbe09c25bb3339e83b41d796e339300952f1525404e61b14965c6bfd621eaaae713522482542da88b1c1d8af90979ae7668c052b74b35d0e7ebfce5f3b916ebfad838e9539e435eb5505aa119b34e61230557b8a4a501179e17640694b23a2caa09fb5526c8f8fc3c11ef333725c4d0310a3da932b91feb7e0c4284d4f4f5ff5e7c0a4fa5a18c2f1bd964ed3096375a21b3edab9f5c54e02387cdc2ad9894c8a3f4666b2d429ee46f8078529dc7af5ff3518d5e75d12c7f91cd7d7865e260ef33621c7a2c410821c81b1dd701cf4205d64a77bc77d5e715bb4554d465b2a1c03be9cc47fdcce0ce67ca8952ec5b0c7afb811931edd64e51bde041f220144b6d7bb06755a265d63314670bd262bc8dd9b806a35a059471f9fb50c97e2d4efefc3db51c4b31c279fa59b3377c32029be252c37f3eecf207545e5436cba14c4e4f5166dd6e7108b4c2c7ddb13e1f878888f4cfe9a921967ae2c732a9e317f417d5b4b5609d86f5bf685ae399ecedcef3acd1e81ec36a9638091f9ec3df3be493f71c27e2622d93cc4831a6898eb7542345f0bf23132e43bd80924e82df8ab0bc5113c61bf2c04c1ab142affa2ffd4eeda42e91f924852ff2b6606ec9d254ead8de534a90cc665e7ed6e457688f1c40a47ea690ab3974e280a74f696edad9f04c944ef664e453934faad8afff5f47d87a5b399d18f33de4288c7a3681980aaf92f34c9fdcac30c5a86801b9d04c6bb7482d351f8571d18d19991f63254b8f85ac8c9ea348a8afd5cda4c86d00aca6f482bb2bd616a20cbdd9d887a40baa32ebc44df867ab92a843da463ccfa5a7faa1222baafba19cfac9c50811eca087d5dbc2b895197420ba6874886270fe2c26d3f251f5bbf4a63c88ff7d9990439f573412eb2482a2099faf19d31ae0450081983390a1e1a73aad06e2913b52fc92388a995305e1b076a6057eadd4853a8f2b14075d27866c6fba28112791d8b5a42a8c5505cbe901eb1faeb72e0fb0f4de35d8e8cd0f5cf532368d4a49807ff9a80fff1a0dfbc5905b9636d3525c05200a2ca8bedcba9089534ac3e20575812f6d0a994ed4785d80daba4bb5bc48bd23928f37b955a951afb44730c829cc078ef2f878f371851fd67ba8884849d176f37390c6b3bc9990c260a706d40bb51e85514662fc77688a341fea074374c757ce4c67a0c069942935b31cb822c4df7d95c5589e6edeeb7830243175a0782ce2a5e31784a3acd60967384f76d991c53fbbdf98cd6cc8c52b76271077de9417d26b706b89db5f82abb33d61f39d83ee773698b77a7052555aad4f581bfbd7ce467229e4b0107d6c90961dffff4130c3baa5647c7115ba6060e4ccd3b7564ed7b859a2e288d41f63d259ac8a04e221a8102dad00d1cd4cc199875f4aafb11bb0a93479af32734a4a9dab9c78a319eed69e6b6229f201576c9a91e4aa4398499de51a7ecf6e54ec0eea3183adcd92ec657ab4a5e417944aaddd13df019ef419c74f9a9c7b39570e70eb289fd09f3c940b306e98f61643d66a9fc2d444c4d3b592e15ffe297e02ae8d50e3696933604a43b8fda8974d3558220b8626c17b65b46ef9b476f025612b194638387115812ecbdf62da668b28e04f71771ecb17a467e1db8cf2f700b7ed16f96f7d6bfdf586e217f7bdea69b33f3a3abb3d4c5d74088479544ca94ffff9c8b06a4d1d85a51bbcb6869726f180a3dc387633f0133fe56d409e6a65f51f887636db36a7892b42f755b734686ba9de501e19059d495fbb26826d0a4af1728e29c2d368da0f7a335c016d5045722d2eb1ecb6ebc0dd09606b7fb3998d828437982300a145d12b541ed0ccb1156e260cf94be043b1548c729bd3c0d2318a9bf0694709d93825fd00b988241ec284d1a7aa8008fd064669599781fb49a4936652658844d7f374fb9ebadd3153e8bc379c41774b985790bfa295ee47d4d04eff00cc623775bb42b32404597533ca28185b1fb5f0f39757081517188b0f2a2b4047485f8187b3bbcad0e7eff52d50567b8fb0cad5e2eefbfd2d435a7b7d9dacb4bdbec5d6e6f0002a4447484d5968829198b5b7d3dbe4fa000000000000000000000000000000000000000000101c2a3b46254236b647c19702639f4f6880a542bf7e06b3245ff77ef0c90a7cbb9e5b7c445bb99f059fa5db48bde3af7fef4da6ed6679417af85b683f859f9b4440a269061e5bddd3e3ee41';
|
|
272
|
+
qcsdk.postTransaction(txnData).then((sendResult) => {
|
|
273
|
+
if (sendResult === null) {
|
|
274
|
+
console.error(" postTransaction failed : sendResult is null");
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (sendResult.resultCode !== 0) {
|
|
279
|
+
console.log(" postTransaction failed. resultCode is " + sendResult.resultCode);
|
|
280
|
+
if (sendResult.response !== null) {
|
|
281
|
+
console.log(" postTransaction response statusText " + JSON.stringify(sendResult.response.statusText));
|
|
282
|
+
console.log(" postTransaction ensure account has adequate gas and nonce is correct");
|
|
283
|
+
}
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
console.log(" postTransaction succeeded. This does not necessarily mean that the transaction has succeded. txnHash " + sendResult.txnHash);
|
|
288
|
+
});
|
|
239
289
|
});
|
|
240
290
|
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
"integrity": "sha512-7Q5YlFvaXoP+MK+yn4KH4MYvJDkyGoGUU/zKYsRxR1mVqddqGUsGvz2JTsfH5B/Gkk97gMMh3PQ7MmkM8iJA5Q=="
|
|
87
87
|
},
|
|
88
88
|
"node_modules/quantum-coin-js-sdk": {
|
|
89
|
-
"version": "1.0.
|
|
90
|
-
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.
|
|
91
|
-
"integrity": "sha512-
|
|
89
|
+
"version": "1.0.10",
|
|
90
|
+
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.10.tgz",
|
|
91
|
+
"integrity": "sha512-aq33/C0ahFCsjXOkqAip79nFgeIM1L+hgXcnSS+1rxIGT9xDi+DMYxd8vdXcrbcvku1Q2kjH4cc2CR/F6ZcXOA==",
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"pqc-js-sdk": "^1.0.0"
|
|
94
94
|
}
|
package/index.js
CHANGED
|
@@ -152,7 +152,7 @@ class BlockDetails {
|
|
|
152
152
|
* @classdesc This class represents a result from invoking the getLatestBlock function.
|
|
153
153
|
*/
|
|
154
154
|
class LatestBlockDetailsResult {
|
|
155
|
-
constructor(resultCode, blockDetails, response) {
|
|
155
|
+
constructor(resultCode, blockDetails, response, requestId) {
|
|
156
156
|
/**
|
|
157
157
|
* 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.
|
|
158
158
|
* @type {number}
|
|
@@ -173,6 +173,13 @@ class LatestBlockDetailsResult {
|
|
|
173
173
|
* @public
|
|
174
174
|
*/
|
|
175
175
|
this.response = response;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
179
|
+
* @type {string}
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
this.requestId = requestId;
|
|
176
183
|
}
|
|
177
184
|
}
|
|
178
185
|
|
|
@@ -221,7 +228,7 @@ class AccountDetails {
|
|
|
221
228
|
* @classdesc This class represents a result from invoking the getAccountDetails function.
|
|
222
229
|
*/
|
|
223
230
|
class AccountDetailsResult {
|
|
224
|
-
constructor(resultCode, accountDetails, response) {
|
|
231
|
+
constructor(resultCode, accountDetails, response, requestId) {
|
|
225
232
|
/**
|
|
226
233
|
* 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.
|
|
227
234
|
* @type {number}
|
|
@@ -242,6 +249,13 @@ class AccountDetailsResult {
|
|
|
242
249
|
* @public
|
|
243
250
|
*/
|
|
244
251
|
this.response = response;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
255
|
+
* @type {string}
|
|
256
|
+
* @public
|
|
257
|
+
*/
|
|
258
|
+
this.requestId = requestId;
|
|
245
259
|
}
|
|
246
260
|
}
|
|
247
261
|
|
|
@@ -285,7 +299,7 @@ class SignResult {
|
|
|
285
299
|
* @classdesc This class represents a result from invoking the sendCoins function.
|
|
286
300
|
*/
|
|
287
301
|
class SendResult {
|
|
288
|
-
constructor(resultCode, txnHash, response) {
|
|
302
|
+
constructor(resultCode, txnHash, response, requestId) {
|
|
289
303
|
/**
|
|
290
304
|
* 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.
|
|
291
305
|
* @type {number}
|
|
@@ -306,6 +320,13 @@ class SendResult {
|
|
|
306
320
|
* @public
|
|
307
321
|
*/
|
|
308
322
|
this.response = response;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
326
|
+
* @type {string}
|
|
327
|
+
* @public
|
|
328
|
+
*/
|
|
329
|
+
this.requestId = requestId;
|
|
309
330
|
}
|
|
310
331
|
}
|
|
311
332
|
|
|
@@ -440,7 +461,6 @@ class TransactionDetails {
|
|
|
440
461
|
*/
|
|
441
462
|
this.value = null;
|
|
442
463
|
|
|
443
|
-
|
|
444
464
|
/**
|
|
445
465
|
* The receipt of the transaction. This field will be null while the transaction is pending (not yet registered in the blockchain).
|
|
446
466
|
* @type {TransactionReceipt}
|
|
@@ -458,7 +478,7 @@ class TransactionDetails {
|
|
|
458
478
|
* @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).
|
|
459
479
|
*/
|
|
460
480
|
class TransactionDetailsResult {
|
|
461
|
-
constructor(resultCode, transactionDetails, response) {
|
|
481
|
+
constructor(resultCode, transactionDetails, response, requestId) {
|
|
462
482
|
/**
|
|
463
483
|
* 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.
|
|
464
484
|
* @type {number}
|
|
@@ -480,6 +500,13 @@ class TransactionDetailsResult {
|
|
|
480
500
|
* @public
|
|
481
501
|
*/
|
|
482
502
|
this.response = response;
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
506
|
+
* @type {string}
|
|
507
|
+
* @public
|
|
508
|
+
*/
|
|
509
|
+
this.requestId = requestId;
|
|
483
510
|
}
|
|
484
511
|
}
|
|
485
512
|
|
|
@@ -568,7 +595,7 @@ class ListAccountTransactionsResponse {
|
|
|
568
595
|
* @classdesc This class represents a result from invoking the listAccountTransactionDetails function.
|
|
569
596
|
*/
|
|
570
597
|
class AccountTransactionsResult {
|
|
571
|
-
constructor(resultCode, listAccountTransactionsResponse, response) {
|
|
598
|
+
constructor(resultCode, listAccountTransactionsResponse, response, requestId) {
|
|
572
599
|
/**
|
|
573
600
|
* 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.
|
|
574
601
|
* @type {number}
|
|
@@ -589,6 +616,13 @@ class AccountTransactionsResult {
|
|
|
589
616
|
* @public
|
|
590
617
|
*/
|
|
591
618
|
this.response = response;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* An unique id to represent the request. This can be null if request failed before it could be sent.
|
|
622
|
+
* @type {string}
|
|
623
|
+
* @public
|
|
624
|
+
*/
|
|
625
|
+
this.requestId = requestId;
|
|
592
626
|
}
|
|
593
627
|
}
|
|
594
628
|
|
|
@@ -852,7 +886,7 @@ async function postTransaction(txnData) {
|
|
|
852
886
|
}
|
|
853
887
|
|
|
854
888
|
if (txnData == null) {
|
|
855
|
-
return new SendResult(-600, null, null);
|
|
889
|
+
return new SendResult(-600, null, null, null);
|
|
856
890
|
}
|
|
857
891
|
var url = config.writeUrl + "/transactions";
|
|
858
892
|
|
|
@@ -875,14 +909,14 @@ async function postTransaction(txnData) {
|
|
|
875
909
|
});
|
|
876
910
|
|
|
877
911
|
if (response == null) {
|
|
878
|
-
return new SendResult(-601, null, null);
|
|
912
|
+
return new SendResult(-601, null, null, requestId);
|
|
879
913
|
}
|
|
880
914
|
|
|
881
915
|
if (response.status == 200 || response.status == 204) {
|
|
882
|
-
return new SendResult(0, null, response);
|
|
916
|
+
return new SendResult(0, null, response, requestId);
|
|
883
917
|
}
|
|
884
918
|
|
|
885
|
-
return new SendResult(-602, null, response);
|
|
919
|
+
return new SendResult(-602, null, response, requestId);
|
|
886
920
|
}
|
|
887
921
|
|
|
888
922
|
/**
|
|
@@ -914,33 +948,33 @@ async function getLatestBlockDetails() {
|
|
|
914
948
|
});
|
|
915
949
|
|
|
916
950
|
if (response == null) {
|
|
917
|
-
return new LatestBlockDetailsResult(-100, null, response);
|
|
951
|
+
return new LatestBlockDetailsResult(-100, null, response, requestId);
|
|
918
952
|
}
|
|
919
953
|
if (response.status !== 200) {
|
|
920
|
-
return new LatestBlockDetailsResult(-101, null, response);
|
|
954
|
+
return new LatestBlockDetailsResult(-101, null, response, requestId);
|
|
921
955
|
}
|
|
922
956
|
|
|
923
957
|
const jsonObj = await response.json();
|
|
924
958
|
if (jsonObj == null) {
|
|
925
|
-
return new LatestBlockDetailsResult(-102, null, response);
|
|
959
|
+
return new LatestBlockDetailsResult(-102, null, response, requestId);
|
|
926
960
|
}
|
|
927
961
|
const result = jsonObj.result;
|
|
928
962
|
|
|
929
963
|
if (result == null) {
|
|
930
|
-
return new LatestBlockDetailsResult(-103, null, response);
|
|
964
|
+
return new LatestBlockDetailsResult(-103, null, response, requestId);
|
|
931
965
|
}
|
|
932
966
|
|
|
933
967
|
if (result.blockNumber == null) {
|
|
934
|
-
return new LatestBlockDetailsResult(-104, null, response);
|
|
968
|
+
return new LatestBlockDetailsResult(-104, null, response, requestId);
|
|
935
969
|
}
|
|
936
970
|
|
|
937
971
|
let blockNumber = parseInt(result.blockNumber);
|
|
938
972
|
if (Number.isInteger(blockNumber) == false) {
|
|
939
|
-
return new LatestBlockDetailsResult(-105, null, response);
|
|
973
|
+
return new LatestBlockDetailsResult(-105, null, response, requestId);
|
|
940
974
|
}
|
|
941
975
|
|
|
942
976
|
var blockDetails = new BlockDetails(blockNumber);
|
|
943
|
-
return new LatestBlockDetailsResult(0, blockDetails, response);
|
|
977
|
+
return new LatestBlockDetailsResult(0, blockDetails, response, requestId);
|
|
944
978
|
}
|
|
945
979
|
|
|
946
980
|
/**
|
|
@@ -957,10 +991,10 @@ async function getAccountDetails(address) {
|
|
|
957
991
|
}
|
|
958
992
|
|
|
959
993
|
if (address == null) {
|
|
960
|
-
return new AccountDetailsResult(-200, null, null);
|
|
994
|
+
return new AccountDetailsResult(-200, null, null, null);
|
|
961
995
|
}
|
|
962
996
|
if (isAddressValid(address) == false) {
|
|
963
|
-
return new AccountDetailsResult(-201, null, null);
|
|
997
|
+
return new AccountDetailsResult(-201, null, null, null);
|
|
964
998
|
}
|
|
965
999
|
|
|
966
1000
|
let nonce = 0;
|
|
@@ -983,29 +1017,29 @@ async function getAccountDetails(address) {
|
|
|
983
1017
|
});
|
|
984
1018
|
|
|
985
1019
|
if(response == null) {
|
|
986
|
-
return new AccountDetailsResult(-202, null, response);
|
|
1020
|
+
return new AccountDetailsResult(-202, null, response, requestId);
|
|
987
1021
|
}
|
|
988
1022
|
if (response.status !== 200) {
|
|
989
|
-
return new AccountDetailsResult(-203, null, response);
|
|
1023
|
+
return new AccountDetailsResult(-203, null, response, requestId);
|
|
990
1024
|
}
|
|
991
1025
|
|
|
992
1026
|
const jsonObj = await response.json();
|
|
993
1027
|
if (jsonObj == null) {
|
|
994
|
-
return new AccountDetailsResult(-204, null, response);
|
|
1028
|
+
return new AccountDetailsResult(-204, null, response, requestId);
|
|
995
1029
|
}
|
|
996
1030
|
const result = jsonObj.result;
|
|
997
1031
|
|
|
998
1032
|
if (result == null) {
|
|
999
|
-
return new AccountDetailsResult(-205, null, response);
|
|
1033
|
+
return new AccountDetailsResult(-205, null, response, requestId);
|
|
1000
1034
|
}
|
|
1001
1035
|
|
|
1002
1036
|
if(result.blockNumber == null) {
|
|
1003
|
-
return new AccountDetailsResult(-206, null, response);
|
|
1037
|
+
return new AccountDetailsResult(-206, null, response, requestId);
|
|
1004
1038
|
}
|
|
1005
1039
|
|
|
1006
1040
|
let blockNumber = parseInt(result.blockNumber);
|
|
1007
1041
|
if (Number.isInteger(blockNumber) == false) {
|
|
1008
|
-
return new AccountDetailsResult(-207, null, response);
|
|
1042
|
+
return new AccountDetailsResult(-207, null, response, requestId);
|
|
1009
1043
|
}
|
|
1010
1044
|
|
|
1011
1045
|
if (result.nonce === null) {
|
|
@@ -1015,23 +1049,23 @@ async function getAccountDetails(address) {
|
|
|
1015
1049
|
if (Number.isInteger(tempNonce) == true) {
|
|
1016
1050
|
nonce = tempNonce;
|
|
1017
1051
|
if (nonce < 0) {
|
|
1018
|
-
return new AccountDetailsResult(-208, null, response);
|
|
1052
|
+
return new AccountDetailsResult(-208, null, response, requestId);
|
|
1019
1053
|
}
|
|
1020
1054
|
} else {
|
|
1021
|
-
return new AccountDetailsResult(-209, null, response);
|
|
1055
|
+
return new AccountDetailsResult(-209, null, response, requestId);
|
|
1022
1056
|
}
|
|
1023
1057
|
}
|
|
1024
1058
|
|
|
1025
1059
|
if (result.balance != null) {
|
|
1026
1060
|
if (isLargeNumber(result.balance) == false) {
|
|
1027
|
-
return new AccountDetailsResult(-210, null, response);
|
|
1061
|
+
return new AccountDetailsResult(-210, null, response, requestId);
|
|
1028
1062
|
} else {
|
|
1029
1063
|
balance = result.balance;
|
|
1030
1064
|
}
|
|
1031
1065
|
}
|
|
1032
1066
|
|
|
1033
1067
|
var accountDetails = new AccountDetails(address, balance, nonce, blockNumber);
|
|
1034
|
-
return new AccountDetailsResult(0, accountDetails, response);
|
|
1068
|
+
return new AccountDetailsResult(0, accountDetails, response, requestId);
|
|
1035
1069
|
}
|
|
1036
1070
|
|
|
1037
1071
|
/**
|
|
@@ -1052,10 +1086,10 @@ async function getTransactionDetails(txnHash) {
|
|
|
1052
1086
|
}
|
|
1053
1087
|
|
|
1054
1088
|
if (txnHash == null) {
|
|
1055
|
-
return new TransactionDetailsResult(-300, null, null);
|
|
1089
|
+
return new TransactionDetailsResult(-300, null, null, null);
|
|
1056
1090
|
}
|
|
1057
1091
|
if (isAddressValid(txnHash) == false) {
|
|
1058
|
-
return new TransactionDetailsResult(-301, null, null);
|
|
1092
|
+
return new TransactionDetailsResult(-301, null, null, null);
|
|
1059
1093
|
}
|
|
1060
1094
|
|
|
1061
1095
|
let requestId = getRandomRequestId();
|
|
@@ -1075,20 +1109,20 @@ async function getTransactionDetails(txnHash) {
|
|
|
1075
1109
|
});
|
|
1076
1110
|
|
|
1077
1111
|
if (response == null) {
|
|
1078
|
-
return new TransactionDetailsResult(-302, null, response);
|
|
1112
|
+
return new TransactionDetailsResult(-302, null, response, requestId);
|
|
1079
1113
|
}
|
|
1080
1114
|
if (response.status !== 200) {
|
|
1081
|
-
return new TransactionDetailsResult(-303, null, response);
|
|
1115
|
+
return new TransactionDetailsResult(-303, null, response, requestId);
|
|
1082
1116
|
}
|
|
1083
1117
|
|
|
1084
1118
|
const jsonObj = await response.json();
|
|
1085
1119
|
if (jsonObj == null) {
|
|
1086
|
-
return new TransactionDetailsResult(-304, null, response);
|
|
1120
|
+
return new TransactionDetailsResult(-304, null, response, requestId);
|
|
1087
1121
|
}
|
|
1088
1122
|
const result = jsonObj.result;
|
|
1089
1123
|
|
|
1090
1124
|
if (result == null) {
|
|
1091
|
-
return new TransactionDetailsResult(-305, null, response);
|
|
1125
|
+
return new TransactionDetailsResult(-305, null, response, requestId);
|
|
1092
1126
|
}
|
|
1093
1127
|
|
|
1094
1128
|
var transactionDetails = new TransactionDetails();
|
|
@@ -1099,7 +1133,7 @@ async function getTransactionDetails(txnHash) {
|
|
|
1099
1133
|
transactionDetails.blockNumber = tempBlockNumber;
|
|
1100
1134
|
}
|
|
1101
1135
|
if (tempBlockNumber < 0) {
|
|
1102
|
-
return new TransactionDetailsResult(-306, null, response);
|
|
1136
|
+
return new TransactionDetailsResult(-306, null, response, requestId);
|
|
1103
1137
|
}
|
|
1104
1138
|
}
|
|
1105
1139
|
|
|
@@ -1123,7 +1157,7 @@ async function getTransactionDetails(txnHash) {
|
|
|
1123
1157
|
transactionDetails.receipt.type = result.receipt.type;
|
|
1124
1158
|
}
|
|
1125
1159
|
|
|
1126
|
-
return new TransactionDetailsResult(0, transactionDetails, response);
|
|
1160
|
+
return new TransactionDetailsResult(0, transactionDetails, response, requestId);
|
|
1127
1161
|
}
|
|
1128
1162
|
|
|
1129
1163
|
/**
|
|
@@ -1146,16 +1180,16 @@ async function listAccountTransactions(address, pageNumber) {
|
|
|
1146
1180
|
}
|
|
1147
1181
|
|
|
1148
1182
|
if (address === null) {
|
|
1149
|
-
return new AccountTransactionsResult(-700, null, null);
|
|
1183
|
+
return new AccountTransactionsResult(-700, null, null, null);
|
|
1150
1184
|
}
|
|
1151
1185
|
if (isAddressValid(address) === false) {
|
|
1152
|
-
return new AccountTransactionsResult(-701, null, null);
|
|
1186
|
+
return new AccountTransactionsResult(-701, null, null, null);
|
|
1153
1187
|
}
|
|
1154
1188
|
|
|
1155
1189
|
if (pageNumber === null) {
|
|
1156
1190
|
pageNumber = 0;
|
|
1157
1191
|
} else if (Number.isInteger(pageNumber) === false) {
|
|
1158
|
-
return new AccountTransactionsResult(-702, null, null);
|
|
1192
|
+
return new AccountTransactionsResult(-702, null, null, null);
|
|
1159
1193
|
}
|
|
1160
1194
|
|
|
1161
1195
|
let requestId = getRandomRequestId();
|
|
@@ -1176,21 +1210,21 @@ async function listAccountTransactions(address, pageNumber) {
|
|
|
1176
1210
|
});
|
|
1177
1211
|
|
|
1178
1212
|
if (response === null) {
|
|
1179
|
-
return new AccountTransactionsResult(-703, null, response);
|
|
1213
|
+
return new AccountTransactionsResult(-703, null, response, requestId);
|
|
1180
1214
|
}
|
|
1181
1215
|
if (response.status !== 200) {
|
|
1182
|
-
return new AccountTransactionsResult(-704, null, response);
|
|
1216
|
+
return new AccountTransactionsResult(-704, null, response, requestId);
|
|
1183
1217
|
}
|
|
1184
1218
|
|
|
1185
1219
|
const jsonObj = await response.json();
|
|
1186
1220
|
|
|
1187
1221
|
if (jsonObj === null) {
|
|
1188
|
-
return new AccountTransactionsResult(-705, null, response);
|
|
1222
|
+
return new AccountTransactionsResult(-705, null, response, requestId);
|
|
1189
1223
|
}
|
|
1190
1224
|
const result = jsonObj;
|
|
1191
1225
|
|
|
1192
1226
|
if (result.pageCount === null) {
|
|
1193
|
-
return new AccountTransactionsResult(-706, null, response);
|
|
1227
|
+
return new AccountTransactionsResult(-706, null, response, requestId);
|
|
1194
1228
|
}
|
|
1195
1229
|
|
|
1196
1230
|
var listAccountDetailsResponse = new ListAccountTransactionsResponse();
|
|
@@ -1202,7 +1236,7 @@ async function listAccountTransactions(address, pageNumber) {
|
|
|
1202
1236
|
|
|
1203
1237
|
if (result.items !== null) {
|
|
1204
1238
|
if (Array.isArray(result.items) === false) {
|
|
1205
|
-
return new AccountTransactionsResult(-707, null, response);
|
|
1239
|
+
return new AccountTransactionsResult(-707, null, response, requestId);
|
|
1206
1240
|
}
|
|
1207
1241
|
listAccountDetailsResponse.items = new Array();
|
|
1208
1242
|
for (const item of result.items) {
|
|
@@ -1217,7 +1251,7 @@ async function listAccountTransactions(address, pageNumber) {
|
|
|
1217
1251
|
}
|
|
1218
1252
|
}
|
|
1219
1253
|
|
|
1220
|
-
return new AccountTransactionsResult(0, listAccountDetailsResponse, response);
|
|
1254
|
+
return new AccountTransactionsResult(0, listAccountDetailsResponse, response, requestId);
|
|
1221
1255
|
}
|
|
1222
1256
|
|
|
1223
1257
|
/**
|
|
@@ -1307,61 +1341,65 @@ async function sendCoins(wallet, toAddress, coins, nonce) {
|
|
|
1307
1341
|
}
|
|
1308
1342
|
|
|
1309
1343
|
if (wallet == null || toAddress == null || coins == null || nonce == null) {
|
|
1310
|
-
return new SendResult(-1, null, null);
|
|
1344
|
+
return new SendResult(-1, null, null, null);
|
|
1311
1345
|
}
|
|
1312
1346
|
|
|
1313
1347
|
if (isAddressValid(toAddress) == false) {
|
|
1314
|
-
return new SendResult(-2, null, null);
|
|
1348
|
+
return new SendResult(-2, null, null, null);
|
|
1315
1349
|
}
|
|
1316
1350
|
|
|
1317
1351
|
if (verifyWallet(wallet) == false) {
|
|
1318
|
-
return new SendResult(-3, null, null);
|
|
1352
|
+
return new SendResult(-3, null, null, null);
|
|
1319
1353
|
}
|
|
1320
1354
|
|
|
1321
1355
|
if (isLargeNumber(coins) == false) {
|
|
1322
|
-
return new SendResult(-4, null, null);
|
|
1356
|
+
return new SendResult(-4, null, null, null);
|
|
1323
1357
|
}
|
|
1324
1358
|
|
|
1325
1359
|
let tempNonce = parseInt(nonce);
|
|
1326
1360
|
if (Number.isInteger(tempNonce) == false) {
|
|
1327
|
-
return new SendResult(-5, null, null);
|
|
1361
|
+
return new SendResult(-5, null, null, null);
|
|
1328
1362
|
}
|
|
1329
1363
|
nonce = tempNonce;
|
|
1330
1364
|
if (nonce < 0) {
|
|
1331
|
-
return new SendResult(-6, null, null);
|
|
1365
|
+
return new SendResult(-6, null, null, null);
|
|
1332
1366
|
}
|
|
1333
1367
|
|
|
1334
1368
|
let accountDetailsResult = await getAccountDetails(wallet.address);
|
|
1335
|
-
if (accountDetailsResult === null
|
|
1336
|
-
return new SendResult(-7, null, null);
|
|
1369
|
+
if (accountDetailsResult === null) {
|
|
1370
|
+
return new SendResult(-7, null, null, null);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
if (accountDetailsResult.resultCode !== 0) {
|
|
1374
|
+
return new SendResult(-7, null, null, null);
|
|
1337
1375
|
}
|
|
1338
1376
|
|
|
1339
1377
|
if (accountDetailsResult.accountDetails.nonce !== nonce) {
|
|
1340
|
-
return new SendResult(-8, null, null);
|
|
1378
|
+
return new SendResult(-8, null, null, null);
|
|
1341
1379
|
}
|
|
1342
1380
|
|
|
1343
1381
|
const contractData = null;
|
|
1344
1382
|
|
|
1345
1383
|
var txSigningHash = transactionGetSigningHash(wallet.address, nonce, toAddress, coins, DEFAULT_GAS, config.chainId, contractData)
|
|
1346
1384
|
if (txSigningHash == null) {
|
|
1347
|
-
return new SendResult(-9, null, null);
|
|
1385
|
+
return new SendResult(-9, null, null, null);
|
|
1348
1386
|
}
|
|
1349
1387
|
|
|
1350
1388
|
var quantumSig = pqc.cryptoSign(txSigningHash, wallet.privateKey);
|
|
1351
1389
|
|
|
1352
1390
|
var verifyResult = pqc.cryptoVerify(txSigningHash, quantumSig, wallet.publicKey);
|
|
1353
1391
|
if (verifyResult !== true) {
|
|
1354
|
-
return new SendResult(-10, null, null);
|
|
1392
|
+
return new SendResult(-10, null, null, null);
|
|
1355
1393
|
}
|
|
1356
1394
|
|
|
1357
1395
|
var txHashHex = transactionGetTransactionHash(wallet.address, nonce, toAddress, coins, DEFAULT_GAS, config.chainId, contractData, wallet.publicKey, quantumSig);
|
|
1358
1396
|
if (txHashHex == null) {
|
|
1359
|
-
return new SendResult(-11, null, null);
|
|
1397
|
+
return new SendResult(-11, null, null, null);
|
|
1360
1398
|
}
|
|
1361
1399
|
|
|
1362
1400
|
var txnData = transactionGetData(wallet.address, nonce, toAddress, coins, DEFAULT_GAS, config.chainId, contractData, wallet.publicKey, quantumSig);
|
|
1363
1401
|
if (txnData == null) {
|
|
1364
|
-
return new SendResult(-12, null, null);
|
|
1402
|
+
return new SendResult(-12, null, null, null);
|
|
1365
1403
|
}
|
|
1366
1404
|
|
|
1367
1405
|
let sendResult = await postTransaction(txnData);
|