quantum-coin-js-sdk 1.0.16 → 1.0.18
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 +53 -26
- package/example/example-misc.js +57 -0
- package/example/example-send.js +70 -0
- package/example/example.js +1 -1
- package/example/package-lock.json +31 -23
- package/example/package.json +1 -1
- package/index.d.ts +718 -0
- package/index.js +76 -15
- package/package.json +3 -2
- package/wasm_exec.d.ts +0 -0
package/README.md
CHANGED
|
@@ -19,8 +19,8 @@ Requires Node.js version v20.18.1 or higher
|
|
|
19
19
|
* [~Wallet](#module_quantum-coin-js-sdk..Wallet)
|
|
20
20
|
* [new Wallet(address, privateKey, publicKey)](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
21
21
|
* [.address](#module_quantum-coin-js-sdk..Wallet+address) : <code>string</code>
|
|
22
|
-
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey)
|
|
23
|
-
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey)
|
|
22
|
+
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey) : <code>Array.<number></code>
|
|
23
|
+
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey) : <code>Array.<number></code>
|
|
24
24
|
* [~BlockDetails](#module_quantum-coin-js-sdk..BlockDetails)
|
|
25
25
|
* [.blockNumber](#module_quantum-coin-js-sdk..BlockDetails+blockNumber) : <code>number</code>
|
|
26
26
|
* [~LatestBlockDetailsResult](#module_quantum-coin-js-sdk..LatestBlockDetailsResult)
|
|
@@ -28,7 +28,7 @@ Requires Node.js version v20.18.1 or higher
|
|
|
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
30
|
* [.requestId](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+requestId) : <code>string</code>
|
|
31
|
-
* [.err](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+err) : <code>
|
|
31
|
+
* [.err](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+err) : <code>Error</code>
|
|
32
32
|
* [~AccountDetails](#module_quantum-coin-js-sdk..AccountDetails)
|
|
33
33
|
* [.address](#module_quantum-coin-js-sdk..AccountDetails+address) : <code>string</code>
|
|
34
34
|
* [.balance](#module_quantum-coin-js-sdk..AccountDetails+balance) : <code>string</code>
|
|
@@ -39,7 +39,7 @@ Requires Node.js version v20.18.1 or higher
|
|
|
39
39
|
* [.accountDetails](#module_quantum-coin-js-sdk..AccountDetailsResult+accountDetails) : <code>AccountDetails</code>
|
|
40
40
|
* [.response](#module_quantum-coin-js-sdk..AccountDetailsResult+response) : <code>Object</code>
|
|
41
41
|
* [.requestId](#module_quantum-coin-js-sdk..AccountDetailsResult+requestId) : <code>string</code>
|
|
42
|
-
* [.err](#module_quantum-coin-js-sdk..AccountDetailsResult+err) : <code>
|
|
42
|
+
* [.err](#module_quantum-coin-js-sdk..AccountDetailsResult+err) : <code>Error</code>
|
|
43
43
|
* [~SignResult](#module_quantum-coin-js-sdk..SignResult)
|
|
44
44
|
* [.resultCode](#module_quantum-coin-js-sdk..SignResult+resultCode) : <code>number</code>
|
|
45
45
|
* [.txnHash](#module_quantum-coin-js-sdk..SignResult+txnHash) : <code>string</code>
|
|
@@ -49,7 +49,7 @@ Requires Node.js version v20.18.1 or higher
|
|
|
49
49
|
* [.txnHash](#module_quantum-coin-js-sdk..SendResult+txnHash) : <code>string</code>
|
|
50
50
|
* [.response](#module_quantum-coin-js-sdk..SendResult+response) : <code>Object</code>
|
|
51
51
|
* [.requestId](#module_quantum-coin-js-sdk..SendResult+requestId) : <code>string</code>
|
|
52
|
-
* [.err](#module_quantum-coin-js-sdk..SendResult+err) : <code>
|
|
52
|
+
* [.err](#module_quantum-coin-js-sdk..SendResult+err) : <code>Error</code>
|
|
53
53
|
* [~TransactionReceipt](#module_quantum-coin-js-sdk..TransactionReceipt)
|
|
54
54
|
* [.cumulativeGasUsed](#module_quantum-coin-js-sdk..TransactionReceipt+cumulativeGasUsed) : <code>string</code>
|
|
55
55
|
* [.effectiveGasPrice](#module_quantum-coin-js-sdk..TransactionReceipt+effectiveGasPrice) : <code>string</code>
|
|
@@ -74,7 +74,7 @@ Requires Node.js version v20.18.1 or higher
|
|
|
74
74
|
* [.transactionDetails](#module_quantum-coin-js-sdk..TransactionDetailsResult+transactionDetails) : <code>TransactionDetails</code>
|
|
75
75
|
* [.response](#module_quantum-coin-js-sdk..TransactionDetailsResult+response) : <code>Object</code>
|
|
76
76
|
* [.requestId](#module_quantum-coin-js-sdk..TransactionDetailsResult+requestId) : <code>string</code>
|
|
77
|
-
* [.err](#module_quantum-coin-js-sdk..TransactionDetailsResult+err) : <code>
|
|
77
|
+
* [.err](#module_quantum-coin-js-sdk..TransactionDetailsResult+err) : <code>Error</code>
|
|
78
78
|
* [~AccountTransactionCompact](#module_quantum-coin-js-sdk..AccountTransactionCompact)
|
|
79
79
|
* [.blockNumber](#module_quantum-coin-js-sdk..AccountTransactionCompact+blockNumber) : <code>number</code>
|
|
80
80
|
* [.from](#module_quantum-coin-js-sdk..AccountTransactionCompact+from) : <code>string</code>
|
|
@@ -90,7 +90,7 @@ Requires Node.js version v20.18.1 or higher
|
|
|
90
90
|
* [.listAccountTransactionsResponse](#module_quantum-coin-js-sdk..AccountTransactionsResult+listAccountTransactionsResponse) : <code>ListAccountTransactionsResponse</code>
|
|
91
91
|
* [.response](#module_quantum-coin-js-sdk..AccountTransactionsResult+response) : <code>Object</code>
|
|
92
92
|
* [.requestId](#module_quantum-coin-js-sdk..AccountTransactionsResult+requestId) : <code>string</code>
|
|
93
|
-
* [.err](#module_quantum-coin-js-sdk..AccountTransactionsResult+err) : <code>
|
|
93
|
+
* [.err](#module_quantum-coin-js-sdk..AccountTransactionsResult+err) : <code>Error</code>
|
|
94
94
|
* [~initialize(clientConfig)](#module_quantum-coin-js-sdk..initialize) ⇒ <code>Promise.<boolean></code>
|
|
95
95
|
* [~isAddressValid(address)](#module_quantum-coin-js-sdk..isAddressValid) ⇒ <code>boolean</code>
|
|
96
96
|
* [~newWallet()](#module_quantum-coin-js-sdk..newWallet) ⇒ <code>Wallet</code>
|
|
@@ -102,12 +102,14 @@ Requires Node.js version v20.18.1 or higher
|
|
|
102
102
|
* [~serializeWallet(wallet)](#module_quantum-coin-js-sdk..serializeWallet) ⇒ <code>string</code>
|
|
103
103
|
* [~deserializeWallet(walletJson)](#module_quantum-coin-js-sdk..deserializeWallet) ⇒ <code>Wallet</code>
|
|
104
104
|
* [~postTransaction(txnData)](#module_quantum-coin-js-sdk..postTransaction) ⇒ <code>Promise.<SendResult></code>
|
|
105
|
-
* [~getLatestBlockDetails()](#module_quantum-coin-js-sdk..getLatestBlockDetails) ⇒ <code>Promise.<
|
|
105
|
+
* [~getLatestBlockDetails()](#module_quantum-coin-js-sdk..getLatestBlockDetails) ⇒ <code>Promise.<LatestBlockDetailsResult></code>
|
|
106
106
|
* [~getAccountDetails(address)](#module_quantum-coin-js-sdk..getAccountDetails) ⇒ <code>Promise.<AccountDetailsResult></code>
|
|
107
107
|
* [~getTransactionDetails(txnHash)](#module_quantum-coin-js-sdk..getTransactionDetails) ⇒ <code>Promise.<TransactionDetailsResult></code>
|
|
108
108
|
* [~listAccountTransactions(address, pageNumber)](#module_quantum-coin-js-sdk..listAccountTransactions) ⇒ <code>Promise.<ListAccountTransactionsResponse></code>
|
|
109
109
|
* [~signSendCoinTransaction(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..signSendCoinTransaction) ⇒ <code>SignResult</code>
|
|
110
110
|
* [~sendCoins(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..sendCoins) ⇒ <code>Promise.<SendResult></code>
|
|
111
|
+
* [~publicKeyFromSignature(digest, signature)](#module_quantum-coin-js-sdk..publicKeyFromSignature) ⇒ <code>Array.<number></code>
|
|
112
|
+
* [~publicKeyFromPrivateKey(privateKey)](#module_quantum-coin-js-sdk..publicKeyFromPrivateKey) ⇒ <code>Array.<number></code>
|
|
111
113
|
|
|
112
114
|
<a name="module_quantum-coin-js-sdk..Config"></a>
|
|
113
115
|
|
|
@@ -185,8 +187,8 @@ This class represents a Wallet. Use the verifyWallet function to verify if a wal
|
|
|
185
187
|
* [~Wallet](#module_quantum-coin-js-sdk..Wallet)
|
|
186
188
|
* [new Wallet(address, privateKey, publicKey)](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
187
189
|
* [.address](#module_quantum-coin-js-sdk..Wallet+address) : <code>string</code>
|
|
188
|
-
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey)
|
|
189
|
-
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey)
|
|
190
|
+
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey) : <code>Array.<number></code>
|
|
191
|
+
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey) : <code>Array.<number></code>
|
|
190
192
|
|
|
191
193
|
<a name="new_module_quantum-coin-js-sdk..Wallet_new"></a>
|
|
192
194
|
|
|
@@ -197,8 +199,8 @@ Creates a Wallet class. The constructor does not verify the wallet. To verify a
|
|
|
197
199
|
| Param | Type | Description |
|
|
198
200
|
| --- | --- | --- |
|
|
199
201
|
| address | <code>string</code> | Address of the wallet |
|
|
200
|
-
| privateKey | <code>Array.<
|
|
201
|
-
| publicKey | <code>Array.<
|
|
202
|
+
| privateKey | <code>Array.<number></code> | Private Key byte array of the wallet |
|
|
203
|
+
| publicKey | <code>Array.<number></code> | The chain id of the blockchain. Mainnet chainId is 123123. Testnet T4 chainId is 310324. |
|
|
202
204
|
|
|
203
205
|
<a name="module_quantum-coin-js-sdk..Wallet+address"></a>
|
|
204
206
|
|
|
@@ -209,14 +211,14 @@ Address of the wallet. Is 66 bytes in length including 0x (if the wallet is vali
|
|
|
209
211
|
**Access**: public
|
|
210
212
|
<a name="module_quantum-coin-js-sdk..Wallet+privateKey"></a>
|
|
211
213
|
|
|
212
|
-
#### wallet.privateKey
|
|
214
|
+
#### wallet.privateKey : <code>Array.<number></code>
|
|
213
215
|
Private Key byte array of the wallet. Is 4064 bytes in length (if the wallet is valid).
|
|
214
216
|
|
|
215
217
|
**Kind**: instance property of [<code>Wallet</code>](#module_quantum-coin-js-sdk..Wallet)
|
|
216
218
|
**Access**: public
|
|
217
219
|
<a name="module_quantum-coin-js-sdk..Wallet+publicKey"></a>
|
|
218
220
|
|
|
219
|
-
#### wallet.publicKey
|
|
221
|
+
#### wallet.publicKey : <code>Array.<number></code>
|
|
220
222
|
Public Key byte array of the wallet. Is 1408 bytes in length (if the wallet is valid).
|
|
221
223
|
|
|
222
224
|
**Kind**: instance property of [<code>Wallet</code>](#module_quantum-coin-js-sdk..Wallet)
|
|
@@ -248,7 +250,7 @@ This class represents a result from invoking the getLatestBlock function.
|
|
|
248
250
|
* [.blockDetails](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+blockDetails) : <code>BlockDetails</code>
|
|
249
251
|
* [.response](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+response) : <code>Object</code>
|
|
250
252
|
* [.requestId](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+requestId) : <code>string</code>
|
|
251
|
-
* [.err](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+err) : <code>
|
|
253
|
+
* [.err](#module_quantum-coin-js-sdk..LatestBlockDetailsResult+err) : <code>Error</code>
|
|
252
254
|
|
|
253
255
|
<a name="module_quantum-coin-js-sdk..LatestBlockDetailsResult+resultCode"></a>
|
|
254
256
|
|
|
@@ -280,7 +282,7 @@ An unique id to represent the request. This can be null if request failed before
|
|
|
280
282
|
**Access**: public
|
|
281
283
|
<a name="module_quantum-coin-js-sdk..LatestBlockDetailsResult+err"></a>
|
|
282
284
|
|
|
283
|
-
#### latestBlockDetailsResult.err : <code>
|
|
285
|
+
#### latestBlockDetailsResult.err : <code>Error</code>
|
|
284
286
|
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.
|
|
285
287
|
|
|
286
288
|
**Kind**: instance property of [<code>LatestBlockDetailsResult</code>](#module_quantum-coin-js-sdk..LatestBlockDetailsResult)
|
|
@@ -340,7 +342,7 @@ This class represents a result from invoking the getAccountDetails function.
|
|
|
340
342
|
* [.accountDetails](#module_quantum-coin-js-sdk..AccountDetailsResult+accountDetails) : <code>AccountDetails</code>
|
|
341
343
|
* [.response](#module_quantum-coin-js-sdk..AccountDetailsResult+response) : <code>Object</code>
|
|
342
344
|
* [.requestId](#module_quantum-coin-js-sdk..AccountDetailsResult+requestId) : <code>string</code>
|
|
343
|
-
* [.err](#module_quantum-coin-js-sdk..AccountDetailsResult+err) : <code>
|
|
345
|
+
* [.err](#module_quantum-coin-js-sdk..AccountDetailsResult+err) : <code>Error</code>
|
|
344
346
|
|
|
345
347
|
<a name="module_quantum-coin-js-sdk..AccountDetailsResult+resultCode"></a>
|
|
346
348
|
|
|
@@ -372,7 +374,7 @@ An unique id to represent the request. This can be null if request failed before
|
|
|
372
374
|
**Access**: public
|
|
373
375
|
<a name="module_quantum-coin-js-sdk..AccountDetailsResult+err"></a>
|
|
374
376
|
|
|
375
|
-
#### accountDetailsResult.err : <code>
|
|
377
|
+
#### accountDetailsResult.err : <code>Error</code>
|
|
376
378
|
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.
|
|
377
379
|
|
|
378
380
|
**Kind**: instance property of [<code>AccountDetailsResult</code>](#module_quantum-coin-js-sdk..AccountDetailsResult)
|
|
@@ -424,7 +426,7 @@ This class represents a result from invoking the sendCoins function.
|
|
|
424
426
|
* [.txnHash](#module_quantum-coin-js-sdk..SendResult+txnHash) : <code>string</code>
|
|
425
427
|
* [.response](#module_quantum-coin-js-sdk..SendResult+response) : <code>Object</code>
|
|
426
428
|
* [.requestId](#module_quantum-coin-js-sdk..SendResult+requestId) : <code>string</code>
|
|
427
|
-
* [.err](#module_quantum-coin-js-sdk..SendResult+err) : <code>
|
|
429
|
+
* [.err](#module_quantum-coin-js-sdk..SendResult+err) : <code>Error</code>
|
|
428
430
|
|
|
429
431
|
<a name="module_quantum-coin-js-sdk..SendResult+resultCode"></a>
|
|
430
432
|
|
|
@@ -456,7 +458,7 @@ An unique id to represent the request. This can be null if request failed before
|
|
|
456
458
|
**Access**: public
|
|
457
459
|
<a name="module_quantum-coin-js-sdk..SendResult+err"></a>
|
|
458
460
|
|
|
459
|
-
#### sendResult.err : <code>
|
|
461
|
+
#### sendResult.err : <code>Error</code>
|
|
460
462
|
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.
|
|
461
463
|
|
|
462
464
|
**Kind**: instance property of [<code>SendResult</code>](#module_quantum-coin-js-sdk..SendResult)
|
|
@@ -630,7 +632,7 @@ This class represents a result from invoking the getTransactionDetails function.
|
|
|
630
632
|
* [.transactionDetails](#module_quantum-coin-js-sdk..TransactionDetailsResult+transactionDetails) : <code>TransactionDetails</code>
|
|
631
633
|
* [.response](#module_quantum-coin-js-sdk..TransactionDetailsResult+response) : <code>Object</code>
|
|
632
634
|
* [.requestId](#module_quantum-coin-js-sdk..TransactionDetailsResult+requestId) : <code>string</code>
|
|
633
|
-
* [.err](#module_quantum-coin-js-sdk..TransactionDetailsResult+err) : <code>
|
|
635
|
+
* [.err](#module_quantum-coin-js-sdk..TransactionDetailsResult+err) : <code>Error</code>
|
|
634
636
|
|
|
635
637
|
<a name="module_quantum-coin-js-sdk..TransactionDetailsResult+resultCode"></a>
|
|
636
638
|
|
|
@@ -662,7 +664,7 @@ An unique id to represent the request. This can be null if request failed before
|
|
|
662
664
|
**Access**: public
|
|
663
665
|
<a name="module_quantum-coin-js-sdk..TransactionDetailsResult+err"></a>
|
|
664
666
|
|
|
665
|
-
#### transactionDetailsResult.err : <code>
|
|
667
|
+
#### transactionDetailsResult.err : <code>Error</code>
|
|
666
668
|
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.
|
|
667
669
|
|
|
668
670
|
**Kind**: instance property of [<code>TransactionDetailsResult</code>](#module_quantum-coin-js-sdk..TransactionDetailsResult)
|
|
@@ -764,7 +766,7 @@ This class represents a result from invoking the listAccountTransactionDetails f
|
|
|
764
766
|
* [.listAccountTransactionsResponse](#module_quantum-coin-js-sdk..AccountTransactionsResult+listAccountTransactionsResponse) : <code>ListAccountTransactionsResponse</code>
|
|
765
767
|
* [.response](#module_quantum-coin-js-sdk..AccountTransactionsResult+response) : <code>Object</code>
|
|
766
768
|
* [.requestId](#module_quantum-coin-js-sdk..AccountTransactionsResult+requestId) : <code>string</code>
|
|
767
|
-
* [.err](#module_quantum-coin-js-sdk..AccountTransactionsResult+err) : <code>
|
|
769
|
+
* [.err](#module_quantum-coin-js-sdk..AccountTransactionsResult+err) : <code>Error</code>
|
|
768
770
|
|
|
769
771
|
<a name="module_quantum-coin-js-sdk..AccountTransactionsResult+resultCode"></a>
|
|
770
772
|
|
|
@@ -796,7 +798,7 @@ An unique id to represent the request. This can be null if request failed before
|
|
|
796
798
|
**Access**: public
|
|
797
799
|
<a name="module_quantum-coin-js-sdk..AccountTransactionsResult+err"></a>
|
|
798
800
|
|
|
799
|
-
#### accountTransactionsResult.err : <code>
|
|
801
|
+
#### accountTransactionsResult.err : <code>Error</code>
|
|
800
802
|
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.
|
|
801
803
|
|
|
802
804
|
**Kind**: instance property of [<code>AccountTransactionsResult</code>](#module_quantum-coin-js-sdk..AccountTransactionsResult)
|
|
@@ -927,11 +929,11 @@ The postTransaction function posts a signed transaction to the blockchain.
|
|
|
927
929
|
|
|
928
930
|
<a name="module_quantum-coin-js-sdk..getLatestBlockDetails"></a>
|
|
929
931
|
|
|
930
|
-
### quantum-coin-js-sdk~getLatestBlockDetails() ⇒ <code>Promise.<
|
|
932
|
+
### quantum-coin-js-sdk~getLatestBlockDetails() ⇒ <code>Promise.<LatestBlockDetailsResult></code>
|
|
931
933
|
The getLatestBlockDetails function returns details of the latest block of the blockchain.
|
|
932
934
|
|
|
933
935
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
934
|
-
**Returns**: <code>Promise.<
|
|
936
|
+
**Returns**: <code>Promise.<LatestBlockDetailsResult></code> - Returns a promise of an object of type BlockDetailsResult.
|
|
935
937
|
<a name="module_quantum-coin-js-sdk..getAccountDetails"></a>
|
|
936
938
|
|
|
937
939
|
### quantum-coin-js-sdk~getAccountDetails(address) ⇒ <code>Promise.<AccountDetailsResult></code>
|
|
@@ -999,3 +1001,28 @@ The sendCoins function posts a send-coin transaction to the blockchain.
|
|
|
999
1001
|
| coins | <code>string</code> | 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 |
|
|
1000
1002
|
| nonce | <code>number</code> | 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. |
|
|
1001
1003
|
|
|
1004
|
+
<a name="module_quantum-coin-js-sdk..publicKeyFromSignature"></a>
|
|
1005
|
+
|
|
1006
|
+
### quantum-coin-js-sdk~publicKeyFromSignature(digest, signature) ⇒ <code>Array.<number></code>
|
|
1007
|
+
The publicKeyFromSignature extracts the public key from a signature.
|
|
1008
|
+
|
|
1009
|
+
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1010
|
+
**Returns**: <code>Array.<number></code> - - Returns a byte array containing the public key. Returns null if the operation failed.
|
|
1011
|
+
|
|
1012
|
+
| Param | Type | Description |
|
|
1013
|
+
| --- | --- | --- |
|
|
1014
|
+
| digest | <code>Array.<number></code> | An array of bytes containing the digestHash. Should be of length 32. |
|
|
1015
|
+
| signature | <code>Array.<number></code> | An array of bytes containing the signature. |
|
|
1016
|
+
|
|
1017
|
+
<a name="module_quantum-coin-js-sdk..publicKeyFromPrivateKey"></a>
|
|
1018
|
+
|
|
1019
|
+
### quantum-coin-js-sdk~publicKeyFromPrivateKey(privateKey) ⇒ <code>Array.<number></code>
|
|
1020
|
+
The publicKeyFromPrivateKey extracts the public key from a private key.
|
|
1021
|
+
|
|
1022
|
+
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1023
|
+
**Returns**: <code>Array.<number></code> - - Returns a byte array containing the public key. Returns null if the operation failed.
|
|
1024
|
+
|
|
1025
|
+
| Param | Type | Description |
|
|
1026
|
+
| --- | --- | --- |
|
|
1027
|
+
| privateKey | <code>Array.<number></code> | An array of bytes containing the privateKey. |
|
|
1028
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const qcsdk = require('quantum-coin-js-sdk');
|
|
2
|
+
const ethers = require('ethers');
|
|
3
|
+
|
|
4
|
+
var clientConfigVal = new qcsdk.Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //Mainnet
|
|
5
|
+
|
|
6
|
+
//Initialize the client configuration
|
|
7
|
+
//var clientConfigVal = new qcsdk.Config("https://t4-relayread.quantumcoin.org", "https://t4-relaywrite.quantumcoin.org", 310324, "", ""); //Testnet T4
|
|
8
|
+
//Testnet T4 Block Explorer: https://t4.scan.quantumcoin.org
|
|
9
|
+
|
|
10
|
+
//For mainnet, use the following configuration
|
|
11
|
+
//var clientConfigVal = new qcsdk.Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //Mainnet
|
|
12
|
+
//Mainnet Block Explorer: https://scan.quantumcoin.org
|
|
13
|
+
|
|
14
|
+
//Local testing configuration
|
|
15
|
+
//var clientConfigVal = new qcsdk.Config("http://127.0.0.1:9090", "http://127.0.0.1:9091", 123123, "", ""); //local testing
|
|
16
|
+
//Mainnet Block Explorer: https://scan.quantumcoin.org
|
|
17
|
+
|
|
18
|
+
//Initialize the SDK
|
|
19
|
+
qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
20
|
+
if (initResult === false) {
|
|
21
|
+
console.error("Initialize failed");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const digestHashBase64 = "aGkgdGhlcmVvY2tjaGFpbmJiYmJiYmJiYmJiYmJiYmI=";
|
|
26
|
+
const signatureBase64 = "fg/+CQEgj/gs+rQL9EynRPosPfAk/8XFkxXNALhOcGc4Eb+iRddo8oDfbPMZHEiBWUxeA0urzOZo9eQ388HCdzO5F/2sDp2HvJxC37bSoHGooKHqtRuCEWkdsd5w+GDImLOJVMyU9bJ9kCxX6My1f5DMJ62+S9A1ngh3oZyufnYe9A4h7PaC7zU1uBsBiEdCc9/ao10qlpAws0gdRMyXswdNWv4TrTvqASf+AohIpumz/MUfLSw0gfygjq8KWWMG+IBt4pLFv81MD9N5Nm2iuj3Zzx32U2oT5fYtmPXZcm16UzJHXb2wkdhwGMqsk9HFc5W1gMnpm63zJ2QXG9GX57WpwxsQ4ECcOmux0vWdPQfpW74jIgxy+l5PdYnBE3kKv9rpw9dgVH95pRYcEg7wkk7X+Wl34SbyDwLTmD9NmIZIsxJWRhxLn8E6cikpGM+S/TY3wN2hWBZZhR6s21miuUDbgfUVoaW/60tpqVEOBDioxr/QuE5U+BIRgQfhLfbPEml8GGE/YG2JwpQiQ3hTnHh4+90ftpdYK0G3Cdzlt7NllyZFHFM1mvfWMAXhtJb8bnjqAQ+dQZrWsyrs4K2B1UKiLFSbcyUkr+tLi56gsz/Jz9jMRcmvMxf16W+YQrFTWe7F+Du2BzeSIiJLz5Eq3dInNrLYnM3y+Hn501azjUr4BL2Rpc2y9k4uMtLtlaIYJtwgz3O24F/UXq6MG++0FhcsRNuJ9FTSH5CaJMSR1btjM6F7plcP8q4LsSd7FpcWiboQepqWxKN1Hrfn8tlZule0XC80AZathlBRLwZBejRcchTFsUuIJFBt99P7S2R5PsMB4gQIDmYjmiL2ubXWx/+ylmDnWFkhftzg5XePRs52aOCDZzxhNCfC7O0AudeFZQBeyhCmyJxRp24BAmo+5JN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pFUtJAb4GhyL7QfS4jQ50O0xUA5FMJ4l238Wxv+3rHWnbpFDj6jahYw3yUFlQ==";
|
|
27
|
+
|
|
28
|
+
let digest = base64ToBytes(digestHashBase64);
|
|
29
|
+
let signature = base64ToBytes(signatureBase64);
|
|
30
|
+
|
|
31
|
+
let publicKey = qcsdk.publicKeyFromSignature(digest, signature);
|
|
32
|
+
console.log("publicKeyFromSignature publicKey length: " + publicKey.length);
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
//Open example wallet created using external wallet application such as Desktop/Web/CLI/Mobile wallet
|
|
36
|
+
const walletEncryptedJson = "{\"address\":\"1a846abe71c8b989e8337c55d608be81c28ab3b2e40c83eaa2a68d516049aec6\",\"crypto\":{\"cipher\":\"aes-256-ctr\",\"ciphertext\":\"ab7e620dd66cb55ac201b9c6796de92bbb06f3681b5932eabe099871f1f7d79acabe30921a39ad13bfe74f42c515734882b6723760142aa3e26e011df514a534ae47bd15d86badd9c6f17c48d4c892711d54d441ee3a0ee0e5b060f816e79c7badd13ff4c235934b1986774223ecf6e8761388969bb239c759b54c8c70e6a2e27c93a4b70129c8159f461d271ae8f3573414c78b88e4d0abfa6365ed45456636d4ed971c7a0c6b84e6f0c2621e819268b135e2bcc169a54d1847b39e6ba2ae8ec969b69f330b7db9e785ed02204d5a1185915ae5338b0f40ef2a7f4d5aaf7563d502135e57f4eb89d5ec1efa5c77e374969d6cd85be625a2ed1225d68ecdd84067bfc69adb83ecd5c6050472eca28a5a646fcdd28077165c629975bec8a79fe1457cb53389b788b25e1f8eff8b2ca326d7dfcaba3f8839225a08057c018a458891fd2caa0d2b27632cffd80f592147ccec9a10dc8a08a48fb55047bff5cf85cda39eb089096bef63842fc3686412f298a54a9e4b0bf4ad36907ba373cbd6d32e7ac494af371da5aa9d38a3463220865114c4adc5e4ac258ba9c6af9fa2ddfd1aec2e16887e4b3977c69561df8599ac9d411c9dd2a4d57f92ea4e5c02aae3f49fb3bc83e16673e6c2dbe96bb181c8dfd0f9757ade2e4ff27215a836058c5ffeab042f6f97c7c02339f76a6284680e01b4bb733690eb3347fbfcc26614b8bf755f9dfce3fea9d4e4d15b164983201732c2e87593a86bca6da6972e128490338f76ae68135888070f4e59e90db54d23834769bdbda9769213faf5357f9167a224523975a946367b68f0cec98658575609f58bfd329e420a921c06713326e4cb20a0df1d77f37e78a320a637a96c604ca3fa89e24beb42313751b8f09b14f9c14c77e4fd13fc6382505d27c771bca0d821ec7c3765acffa99d83c50140a56b0b28101c762bd682fe55cb6f23cbeb3f421d7b36021010e45ac27160dd7ead99c864a1b550c7edb1246950fe32dcc049799f9085287f0a747a6ef7a023df46a23a22f3e833bbf8d404f84344870492658256ee1dfc40fda33bb8d48fc72d4520ba9fc820c9123104a045206809037709f2a5f6723fa77d6bac5a573823d4ec3a7f1cb786a52ee2697e622e5d75962fa554d1024a6c355e21f33a63b2b72e6c4742a8b1c373aa532b40518c38c90b5373c2eb8c9d7be2a9e16047a3ee09dc9a6849deac5183ace6cfe91a9bef2ffc0a7df6ccebfd4c858c84b0e0355650d7466971e66f1e3883013e5ad1be33199b1d110b79070ac1b745ccb14cf63a08f8cca3a21c9525e626ff5f0c34746e10750fb742ad51f11f2acae3676c2111853d7250d01b77821a6ba9e04400ba2c543ca9f2d701ae6f47bfad14ffe3039ee9e71f7b2401359ade9938750ddb9c5a8b018a7929ed8d0e717ff1861446ce17535e9b17c187711190aae3388bd9490837a636c25ed4d42d7079ad1a51e13292c683d5d012abcf46965c534b83ab53f2c1f0cf5830ef7582e06863a33c19a70511df632885d63245965047ea96b56f1af5b3b94a54999f784fb9574fdfcd7c1230e07a2aaa04acd3097b2b9f8ddba05ae9734491deb5c1a513c76ed276cb78bbf4839dae3156d76af444a5805129d5df791167a9c8576a1d7f760b2d2797c4658669608706fbd0ace1be2346f74862dfc9ef518e55632e43c043186e5d070deb34d12fb9e5aba84e5cb50213dc88efd39cc35bf42455aa82d5e3b707b3140be3b8623b34fdd81d08615c188ae8438a13881fdf6bf32f2cb9ff5fa625561040c6b71d4b8eccc90bc3b99650d28dd1ee63773e49664e3d48c484996b290943635a6f2eb1ce9796d3fa144a3f00ef82faaa32d6a413668f7b521517cb68b2b017fcf56c79326fa5e4060e643631ca3f0a0dc0ed718798b6f46b130d437c33f64039e887324b6f5e604b1669d613923794edbf04b1b3caea54793b52b44b170173a4f25c7ecef3b71e2aad76e556b1cb9f1d637ec52ececfa950dd31dbb6a60828a3ad34c1beffe09eb4785786d63bad10a0b0f66ea88c57380f38ea85f018dbd7f538cf1ee7624095b9a01ec5edd528f281168af020609e651ff316aa1320a710134ddfca600cc72174dcdb846d2aa29916488aa1b537b66da92e61af526debef4eb38c984569eaf549ff2129449269b492d030cd74d885f6f5785881cc4804b4a8a09ba4ff7aefe9074ac7d0c4f05d51fe4cc0ff7388a772092b9d02d70e5433a5cf3e02f46a6bd6b818d59a07ce3b9fbbf8b5faba74563bcc5240930c2d406c9aaee3e3ce0429bf68ac2b0a57adb09414cff50817d2a48fb9fa624ab863cb0c31a8b8dc5eaf6fa68cc1d7c6c685c5a33edd5c8933b9e8ab628ee428d0743699b2ff17f25586c7ce959280bb0b8c5342251f0a30b53dbc7bf1ee426ac9619c3560f811f2268ee37f189794e2e4b3db3a2fb2e34b649e504fb467438abfd1082619cc4a0b30d66beb831077812e418d2e2148db10cf4d4a29101ca52ec445b8d83519dd7de85a98e0beae9ee537096d3f1a55a7a80cdfa93d25f07c9f98e8af18cde19ec1f99c5dd4588b717a5039ddb7f177717caf0d0fd45420a70dbd6d3146890d9e450d5224146db4c33b779e3c3a04b976c052bad042ac57dd38be45407808c0fb0d7e2a8819e6cd53c6739e6612996ddaa6f066552590aa0343bc1e62b298ff2514a0cef8be21956c2e942816f7a3a3a0935eaf9b37251409ce444c986c3817e82835555fe18239f3ae33469d7965c2bde9991fde556bd07af01df52bbde0c35bb4ef48e3b5d0db53f8ca4ed35b83f760f0a1bc4ed9f86e85d6039a17df373c85402ef956f01db00eb39c4b74bd0660d29ee746714d9780d738e05c6cca414ce3d7b40dda8036a9eea9ab1388805f913eb19bdd3f09d9e161eaa50231bd9caba61971f194332dd28c696a60458c1c6c2cc5da8b1192611c7c553e9e12fe48ce46bbb891be8bb118721c86222e671ddd1da8f0ccb2b68e02f2014b4925e904e88369aaf7466bd7033a60c265d45955944916ecbdb84bf1b522b01b0149c632e04c568a7eb627c5bb90ece052ebcf79166c28b30d23fe52da0a5ab5dea83ca479a3e3b7a9cfbbfea04dbe6137c19d067317c2ec427a8c75a6b06bec6dcd5d5c0edc9aa80b9003b8e17c088b2f3db327d3e42630d82d20120240c3ba56232280787da4aabbf5bc95a864029f00710e195f2a76460a0317d10b552fe1bea097e41d49756c680a41d6ac186e62169b6b6cd7776ea84618b5b752328a5bacaa10aa122ff9b2698b43efe73d852a899db644863c8c9bc8068ea86ea843fd6fe36272b91cdc5d5317083ef3fd1e5462a0b0d0604dc57b3bbfceb0fca4cd349625dd7b25166af30efe5ee6a0af953a74d65f4736c59918ee55a3b0d9d9d42e04c7f8a77e479109f740e20c464d5d7e3d16805f47b61f403ff7f408c9e850d9baacd8067e544536a4953480b0f9ee9cd45f41ebd67b51f78788a6470cb1e5ca72ca346ce8a50d0ca0c921d5576a4455a1afb6d0bc688004712ee122cacdb29c51e84893324c27fa4a3f1917edf5352272b4c97579a6152e4b77663d0ab532915f2eeb6a862de8b696452321b660c3f2449673d086e95a7af28845a5259b763e0fcd09f72acf7b6c811066263060e5aa5b24658e880a01fd56bda4dad5ab604e129290f7d5489728f2a40968c6168b21cebbbcd11727cc9e9160c4e92e04387d3b0d62aab06a61f26daedd9fed11816ef2180172a47f47184ac4032b88758c98a2e0fb200f70e93ba695f5ebb7a1029610ad360d3b7fa1b4640b9dc674d3625eef786da93dff19bc7991b5d6193a3896664763fde479b5dfc04812111a80782854f2cf68ca7d82765cc9eb40fba4b44640710ed6e653abf9f07b466333f4fd22784d53cf40e17120f42caa841eaa24056b237827b0f47f7257c103c35027e9f503e5acfd023e7357b600d3084d361d5ee65ba319b45c153212a54e6fed85af7e43e0a926ebcbc2edf8de7e2ec9528f00bec262ad04d5c9dafccaea06a24748d28bf1799bae0e895543084539c50b5aaa4fb50d7431d6f0c8cee2a54aaf7ee7919b55bf40adb688632e5dbe273cea09e97b19c3d8e1f4de000deb66fa1942ad03a62d3252f51992244366c156000b49c297167a6cbdedea7ebae139d295f0ad298e0864249b905b7eb812886ec70ecdb286702274b5b8574149bf3866f9e46b997ff5ed622b169a0eb071347f18d530db1663906a28f4544ee4e004ab87b65476af30ede118052ff052b8dc986ca2c93dd5d4943266a579c7698ea014f688b3e8063a107feb162d392e2177b01bff77fb5abe5feebd0607158049a5a093325b7c9ee6b4dfa7a9f65c7c2fb628920d3603a1c2dad979eaa047cd661a268af1078c9788d720e64e4ce9d12e68de1e417ef2f293323681e1071f9220e1ee43d2e29d111b870ce3439f5100ecd4551ab65ee74aa1667e564957e9bc0ae1ea193980da2a0ec2698073388c85bec25ef447f0d5e93a5203fa44dff268e5cb799ed3b66e63d5e07b487e7534f24934c73a62a243e0151843a0fd3807711a101eaa7fc71f0ba68aebb9534d57cba41b094eebfb4c31cca8eddfa426f676aa347be8a7023a4e91ddb154b35cd4d5f7dbc2e5db491de99f33fc2cff2d57029ac950e1ccd681980af6a4e8969dfe39b3c7bfcbcf8fac92f1e6ec9fe572bfa6a7d65860eab2ed10ac01a71290b52e3148e84b7376a8605cd2bb0e8681ffc54691ce087685e33921bd44d36c78291713dce17569570f62137e6904f0d68cf53aa2ec395c389a75141f08114fb293ea63950e4ffee55ec6fc83cf44876b8e7f25cdd393ff87b9eda6eb746085b61a6900de191f0ce2cb388d61ece52e78bc47368194e8e00277e0d1631e6b9d4626ef76f8522582ccd5a40be3febc699bb510acc6271d55ff0f4cf3bb7669855a72efd9ca3e1056a2fe592a5bc877cce2b1f63b58383971da87873d2d1349cf5881242cdce4e7e2c5c514755746a0e0a7c2a6d9701cde005ae3420beb17c379a3516662253554f51f0423bb1844b0b90c54ed8177ceb0e1036a6609d836e748ca06c40ca64befadc6443ec286a0ce464678e8d11eb455f7bb305acebf6cb1f50e394a9bfeb752df1687831bac9cdd811f4f112ef6658d0f8799a866374ff96c5e2b79f30e7a74f8a2bc9ed1f88f01f30e30cb78ffb2bff10108f35e910ee3be4463e9e6f0ed910e8d598326e71dfa2277ffe5579d7fe9b6018bfe295b25219eae07b3b0270665c3fa00c3e0d180812b5cd62925585de84a7c48a9a86dba96544a251654d1966e082432dc85b6149cf21e91a46020ec32b66d28ba3b6a90c0617bc6fdd55aea819af2bcf84864ad60c28fe3c9f8339d0aee68b39d97f63b6e082835d86119cf9b9fdc8b827c847ce40aa10e1577a710132316845e825345e95bdf94d0c66ec65a6c4319fce4792313663b5f7a651a6710783e6ab71608ac6cbbf3af6911adf596ccf7c172b9bd5bceb6db379967b32b143bdd11d2ee12ddf64ecef6391e0f8570e6cddd3db95204919362b89b739fa94e7c1bfde799fd5e22aa25ca6ca42e30c08e23aae2385d99ebab441072a880dcefdab74a4c9bd39d363f6d1933d59400fca161d432aa00f23b1b1c19a154be8989699d549b66d44e39896f5523443bc6ddf4a65e91f1f3fb7b52318869a05856a4fc92f3694c81ed833c972fb918f7e5\",\"cipherparams\":{\"iv\":\"8c46d6162cd4c765759aedcbce2a5874\"},\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"82fb6cdc6917609135277badacf15baa31899d08b71a5a0fa33167167c161537\"},\"mac\":\"9187b17f7eca48e6b8c586b0cd790dbe0feb876ac8385f93faa7d5e22a3c8fc7\"},\"id\":\"92caf6ee-2d43-48c0-859e-ffa1e0e23312\",\"version\":3}";
|
|
37
|
+
let examplePassphrase = "QuantumCoinExample123!";
|
|
38
|
+
let walletExample = qcsdk.deserializeEncryptedWallet(walletEncryptedJson, examplePassphrase);
|
|
39
|
+
console.log("walletExample.privateKey length " + walletExample.privateKey.length);
|
|
40
|
+
let publicKey2 = qcsdk.publicKeyFromPrivateKey(walletExample.privateKey);
|
|
41
|
+
console.log("publicKeyFromPrivateKey publicKey length: " + publicKey2.length);
|
|
42
|
+
if (publicKey2.length !== walletExample.publicKey.length) {
|
|
43
|
+
throw new Error("public key length compare failed");
|
|
44
|
+
}
|
|
45
|
+
for (i = 0; i < publicKey2.length; i++) {
|
|
46
|
+
if (publicKey2[i] !== walletExample.publicKey[i]) {
|
|
47
|
+
throw new Error("public key compare failed");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function base64ToBytes(base64) {
|
|
54
|
+
const binString = atob(base64);
|
|
55
|
+
return Uint8Array.from(binString, (m) => m.codePointAt(0));
|
|
56
|
+
}
|
|
57
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const qcsdk = require('quantum-coin-js-sdk');
|
|
2
|
+
const ethers = require('ethers');
|
|
3
|
+
|
|
4
|
+
var clientConfigVal = new qcsdk.Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //Mainnet
|
|
5
|
+
|
|
6
|
+
//Initialize the client configuration
|
|
7
|
+
//var clientConfigVal = new qcsdk.Config("https://t4-relayread.quantumcoin.org", "https://t4-relaywrite.quantumcoin.org", 310324, "", ""); //Testnet T4
|
|
8
|
+
//Testnet T4 Block Explorer: https://t4.scan.quantumcoin.org
|
|
9
|
+
|
|
10
|
+
//For mainnet, use the following configuration
|
|
11
|
+
//var clientConfigVal = new qcsdk.Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //Mainnet
|
|
12
|
+
//Mainnet Block Explorer: https://scan.quantumcoin.org
|
|
13
|
+
|
|
14
|
+
//Local testing configuration
|
|
15
|
+
//var clientConfigVal = new qcsdk.Config("http://127.0.0.1:9090", "http://127.0.0.1:9091", 123123, "", ""); //local testing
|
|
16
|
+
//Mainnet Block Explorer: https://scan.quantumcoin.org
|
|
17
|
+
|
|
18
|
+
//Initialize the SDK
|
|
19
|
+
qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
20
|
+
if (initResult === false) {
|
|
21
|
+
console.error("Initialize failed");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//More examples for sending are in examples.js
|
|
26
|
+
|
|
27
|
+
//Offline sign a transaction from existing wallet. This is typically called from an offline device hosting a cold storage wallet.
|
|
28
|
+
//Another usecase is to first store the signed transaction in a database and then later submit it using the postTransaction function.
|
|
29
|
+
|
|
30
|
+
//Open example wallet created using external wallet application such as Desktop/Web/CLI/Mobile wallet
|
|
31
|
+
const walletEncryptedJson = "{\"address\":\"1a846abe71c8b989e8337c55d608be81c28ab3b2e40c83eaa2a68d516049aec6\",\"crypto\":{\"cipher\":\"aes-256-ctr\",\"ciphertext\":\"ab7e620dd66cb55ac201b9c6796de92bbb06f3681b5932eabe099871f1f7d79acabe30921a39ad13bfe74f42c515734882b6723760142aa3e26e011df514a534ae47bd15d86badd9c6f17c48d4c892711d54d441ee3a0ee0e5b060f816e79c7badd13ff4c235934b1986774223ecf6e8761388969bb239c759b54c8c70e6a2e27c93a4b70129c8159f461d271ae8f3573414c78b88e4d0abfa6365ed45456636d4ed971c7a0c6b84e6f0c2621e819268b135e2bcc169a54d1847b39e6ba2ae8ec969b69f330b7db9e785ed02204d5a1185915ae5338b0f40ef2a7f4d5aaf7563d502135e57f4eb89d5ec1efa5c77e374969d6cd85be625a2ed1225d68ecdd84067bfc69adb83ecd5c6050472eca28a5a646fcdd28077165c629975bec8a79fe1457cb53389b788b25e1f8eff8b2ca326d7dfcaba3f8839225a08057c018a458891fd2caa0d2b27632cffd80f592147ccec9a10dc8a08a48fb55047bff5cf85cda39eb089096bef63842fc3686412f298a54a9e4b0bf4ad36907ba373cbd6d32e7ac494af371da5aa9d38a3463220865114c4adc5e4ac258ba9c6af9fa2ddfd1aec2e16887e4b3977c69561df8599ac9d411c9dd2a4d57f92ea4e5c02aae3f49fb3bc83e16673e6c2dbe96bb181c8dfd0f9757ade2e4ff27215a836058c5ffeab042f6f97c7c02339f76a6284680e01b4bb733690eb3347fbfcc26614b8bf755f9dfce3fea9d4e4d15b164983201732c2e87593a86bca6da6972e128490338f76ae68135888070f4e59e90db54d23834769bdbda9769213faf5357f9167a224523975a946367b68f0cec98658575609f58bfd329e420a921c06713326e4cb20a0df1d77f37e78a320a637a96c604ca3fa89e24beb42313751b8f09b14f9c14c77e4fd13fc6382505d27c771bca0d821ec7c3765acffa99d83c50140a56b0b28101c762bd682fe55cb6f23cbeb3f421d7b36021010e45ac27160dd7ead99c864a1b550c7edb1246950fe32dcc049799f9085287f0a747a6ef7a023df46a23a22f3e833bbf8d404f84344870492658256ee1dfc40fda33bb8d48fc72d4520ba9fc820c9123104a045206809037709f2a5f6723fa77d6bac5a573823d4ec3a7f1cb786a52ee2697e622e5d75962fa554d1024a6c355e21f33a63b2b72e6c4742a8b1c373aa532b40518c38c90b5373c2eb8c9d7be2a9e16047a3ee09dc9a6849deac5183ace6cfe91a9bef2ffc0a7df6ccebfd4c858c84b0e0355650d7466971e66f1e3883013e5ad1be33199b1d110b79070ac1b745ccb14cf63a08f8cca3a21c9525e626ff5f0c34746e10750fb742ad51f11f2acae3676c2111853d7250d01b77821a6ba9e04400ba2c543ca9f2d701ae6f47bfad14ffe3039ee9e71f7b2401359ade9938750ddb9c5a8b018a7929ed8d0e717ff1861446ce17535e9b17c187711190aae3388bd9490837a636c25ed4d42d7079ad1a51e13292c683d5d012abcf46965c534b83ab53f2c1f0cf5830ef7582e06863a33c19a70511df632885d63245965047ea96b56f1af5b3b94a54999f784fb9574fdfcd7c1230e07a2aaa04acd3097b2b9f8ddba05ae9734491deb5c1a513c76ed276cb78bbf4839dae3156d76af444a5805129d5df791167a9c8576a1d7f760b2d2797c4658669608706fbd0ace1be2346f74862dfc9ef518e55632e43c043186e5d070deb34d12fb9e5aba84e5cb50213dc88efd39cc35bf42455aa82d5e3b707b3140be3b8623b34fdd81d08615c188ae8438a13881fdf6bf32f2cb9ff5fa625561040c6b71d4b8eccc90bc3b99650d28dd1ee63773e49664e3d48c484996b290943635a6f2eb1ce9796d3fa144a3f00ef82faaa32d6a413668f7b521517cb68b2b017fcf56c79326fa5e4060e643631ca3f0a0dc0ed718798b6f46b130d437c33f64039e887324b6f5e604b1669d613923794edbf04b1b3caea54793b52b44b170173a4f25c7ecef3b71e2aad76e556b1cb9f1d637ec52ececfa950dd31dbb6a60828a3ad34c1beffe09eb4785786d63bad10a0b0f66ea88c57380f38ea85f018dbd7f538cf1ee7624095b9a01ec5edd528f281168af020609e651ff316aa1320a710134ddfca600cc72174dcdb846d2aa29916488aa1b537b66da92e61af526debef4eb38c984569eaf549ff2129449269b492d030cd74d885f6f5785881cc4804b4a8a09ba4ff7aefe9074ac7d0c4f05d51fe4cc0ff7388a772092b9d02d70e5433a5cf3e02f46a6bd6b818d59a07ce3b9fbbf8b5faba74563bcc5240930c2d406c9aaee3e3ce0429bf68ac2b0a57adb09414cff50817d2a48fb9fa624ab863cb0c31a8b8dc5eaf6fa68cc1d7c6c685c5a33edd5c8933b9e8ab628ee428d0743699b2ff17f25586c7ce959280bb0b8c5342251f0a30b53dbc7bf1ee426ac9619c3560f811f2268ee37f189794e2e4b3db3a2fb2e34b649e504fb467438abfd1082619cc4a0b30d66beb831077812e418d2e2148db10cf4d4a29101ca52ec445b8d83519dd7de85a98e0beae9ee537096d3f1a55a7a80cdfa93d25f07c9f98e8af18cde19ec1f99c5dd4588b717a5039ddb7f177717caf0d0fd45420a70dbd6d3146890d9e450d5224146db4c33b779e3c3a04b976c052bad042ac57dd38be45407808c0fb0d7e2a8819e6cd53c6739e6612996ddaa6f066552590aa0343bc1e62b298ff2514a0cef8be21956c2e942816f7a3a3a0935eaf9b37251409ce444c986c3817e82835555fe18239f3ae33469d7965c2bde9991fde556bd07af01df52bbde0c35bb4ef48e3b5d0db53f8ca4ed35b83f760f0a1bc4ed9f86e85d6039a17df373c85402ef956f01db00eb39c4b74bd0660d29ee746714d9780d738e05c6cca414ce3d7b40dda8036a9eea9ab1388805f913eb19bdd3f09d9e161eaa50231bd9caba61971f194332dd28c696a60458c1c6c2cc5da8b1192611c7c553e9e12fe48ce46bbb891be8bb118721c86222e671ddd1da8f0ccb2b68e02f2014b4925e904e88369aaf7466bd7033a60c265d45955944916ecbdb84bf1b522b01b0149c632e04c568a7eb627c5bb90ece052ebcf79166c28b30d23fe52da0a5ab5dea83ca479a3e3b7a9cfbbfea04dbe6137c19d067317c2ec427a8c75a6b06bec6dcd5d5c0edc9aa80b9003b8e17c088b2f3db327d3e42630d82d20120240c3ba56232280787da4aabbf5bc95a864029f00710e195f2a76460a0317d10b552fe1bea097e41d49756c680a41d6ac186e62169b6b6cd7776ea84618b5b752328a5bacaa10aa122ff9b2698b43efe73d852a899db644863c8c9bc8068ea86ea843fd6fe36272b91cdc5d5317083ef3fd1e5462a0b0d0604dc57b3bbfceb0fca4cd349625dd7b25166af30efe5ee6a0af953a74d65f4736c59918ee55a3b0d9d9d42e04c7f8a77e479109f740e20c464d5d7e3d16805f47b61f403ff7f408c9e850d9baacd8067e544536a4953480b0f9ee9cd45f41ebd67b51f78788a6470cb1e5ca72ca346ce8a50d0ca0c921d5576a4455a1afb6d0bc688004712ee122cacdb29c51e84893324c27fa4a3f1917edf5352272b4c97579a6152e4b77663d0ab532915f2eeb6a862de8b696452321b660c3f2449673d086e95a7af28845a5259b763e0fcd09f72acf7b6c811066263060e5aa5b24658e880a01fd56bda4dad5ab604e129290f7d5489728f2a40968c6168b21cebbbcd11727cc9e9160c4e92e04387d3b0d62aab06a61f26daedd9fed11816ef2180172a47f47184ac4032b88758c98a2e0fb200f70e93ba695f5ebb7a1029610ad360d3b7fa1b4640b9dc674d3625eef786da93dff19bc7991b5d6193a3896664763fde479b5dfc04812111a80782854f2cf68ca7d82765cc9eb40fba4b44640710ed6e653abf9f07b466333f4fd22784d53cf40e17120f42caa841eaa24056b237827b0f47f7257c103c35027e9f503e5acfd023e7357b600d3084d361d5ee65ba319b45c153212a54e6fed85af7e43e0a926ebcbc2edf8de7e2ec9528f00bec262ad04d5c9dafccaea06a24748d28bf1799bae0e895543084539c50b5aaa4fb50d7431d6f0c8cee2a54aaf7ee7919b55bf40adb688632e5dbe273cea09e97b19c3d8e1f4de000deb66fa1942ad03a62d3252f51992244366c156000b49c297167a6cbdedea7ebae139d295f0ad298e0864249b905b7eb812886ec70ecdb286702274b5b8574149bf3866f9e46b997ff5ed622b169a0eb071347f18d530db1663906a28f4544ee4e004ab87b65476af30ede118052ff052b8dc986ca2c93dd5d4943266a579c7698ea014f688b3e8063a107feb162d392e2177b01bff77fb5abe5feebd0607158049a5a093325b7c9ee6b4dfa7a9f65c7c2fb628920d3603a1c2dad979eaa047cd661a268af1078c9788d720e64e4ce9d12e68de1e417ef2f293323681e1071f9220e1ee43d2e29d111b870ce3439f5100ecd4551ab65ee74aa1667e564957e9bc0ae1ea193980da2a0ec2698073388c85bec25ef447f0d5e93a5203fa44dff268e5cb799ed3b66e63d5e07b487e7534f24934c73a62a243e0151843a0fd3807711a101eaa7fc71f0ba68aebb9534d57cba41b094eebfb4c31cca8eddfa426f676aa347be8a7023a4e91ddb154b35cd4d5f7dbc2e5db491de99f33fc2cff2d57029ac950e1ccd681980af6a4e8969dfe39b3c7bfcbcf8fac92f1e6ec9fe572bfa6a7d65860eab2ed10ac01a71290b52e3148e84b7376a8605cd2bb0e8681ffc54691ce087685e33921bd44d36c78291713dce17569570f62137e6904f0d68cf53aa2ec395c389a75141f08114fb293ea63950e4ffee55ec6fc83cf44876b8e7f25cdd393ff87b9eda6eb746085b61a6900de191f0ce2cb388d61ece52e78bc47368194e8e00277e0d1631e6b9d4626ef76f8522582ccd5a40be3febc699bb510acc6271d55ff0f4cf3bb7669855a72efd9ca3e1056a2fe592a5bc877cce2b1f63b58383971da87873d2d1349cf5881242cdce4e7e2c5c514755746a0e0a7c2a6d9701cde005ae3420beb17c379a3516662253554f51f0423bb1844b0b90c54ed8177ceb0e1036a6609d836e748ca06c40ca64befadc6443ec286a0ce464678e8d11eb455f7bb305acebf6cb1f50e394a9bfeb752df1687831bac9cdd811f4f112ef6658d0f8799a866374ff96c5e2b79f30e7a74f8a2bc9ed1f88f01f30e30cb78ffb2bff10108f35e910ee3be4463e9e6f0ed910e8d598326e71dfa2277ffe5579d7fe9b6018bfe295b25219eae07b3b0270665c3fa00c3e0d180812b5cd62925585de84a7c48a9a86dba96544a251654d1966e082432dc85b6149cf21e91a46020ec32b66d28ba3b6a90c0617bc6fdd55aea819af2bcf84864ad60c28fe3c9f8339d0aee68b39d97f63b6e082835d86119cf9b9fdc8b827c847ce40aa10e1577a710132316845e825345e95bdf94d0c66ec65a6c4319fce4792313663b5f7a651a6710783e6ab71608ac6cbbf3af6911adf596ccf7c172b9bd5bceb6db379967b32b143bdd11d2ee12ddf64ecef6391e0f8570e6cddd3db95204919362b89b739fa94e7c1bfde799fd5e22aa25ca6ca42e30c08e23aae2385d99ebab441072a880dcefdab74a4c9bd39d363f6d1933d59400fca161d432aa00f23b1b1c19a154be8989699d549b66d44e39896f5523443bc6ddf4a65e91f1f3fb7b52318869a05856a4fc92f3694c81ed833c972fb918f7e5\",\"cipherparams\":{\"iv\":\"8c46d6162cd4c765759aedcbce2a5874\"},\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"82fb6cdc6917609135277badacf15baa31899d08b71a5a0fa33167167c161537\"},\"mac\":\"9187b17f7eca48e6b8c586b0cd790dbe0feb876ac8385f93faa7d5e22a3c8fc7\"},\"id\":\"92caf6ee-2d43-48c0-859e-ffa1e0e23312\",\"version\":3}";
|
|
32
|
+
let examplePassphrase = "QuantumCoinExample123!";
|
|
33
|
+
let walletExample = qcsdk.deserializeEncryptedWallet(walletEncryptedJson, examplePassphrase);
|
|
34
|
+
|
|
35
|
+
var toAddressExample = "0x8293cd9b6ac502d2fe077b0c157dad39f36a5e546525b053151dced633634612";
|
|
36
|
+
var nonceExample = 0; //use the latest nonce for the address as shown in Block Explorer. If address does not exist, default to 0. You may also get the nonce programatically from qcsdk.getAccountDetails like shown below
|
|
37
|
+
/*
|
|
38
|
+
qcsdk.getAccountDetails(address).then((accountDetailsResult) => {
|
|
39
|
+
var nonceExample = accountDetailsResult.accountDetails.nonce;
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
42
|
+
var coinsExample = "10"; //in ethers and not in wei
|
|
43
|
+
|
|
44
|
+
//Sign a transaction
|
|
45
|
+
qcsdk.signSendCoinTransaction(walletExample, toAddressExample, coinsExample, nonceExample).then((signResult) => {
|
|
46
|
+
console.log("signSendCoinTransaction resultCode: " + signResult.resultCode);
|
|
47
|
+
console.log("signSendCoinTransaction hash: " + signResult.txnHash);
|
|
48
|
+
console.log("signSendCoinTransaction txnData: " + signResult.txnData); //txnData is to be sent to postTransaction
|
|
49
|
+
|
|
50
|
+
//Send a transaction that was signed offline
|
|
51
|
+
qcsdk.postTransaction(signResult.txnData).then((sendResult) => {
|
|
52
|
+
if (sendResult === null) {
|
|
53
|
+
console.error(" postTransaction failed : sendResult is null");
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (sendResult.resultCode !== 0) {
|
|
58
|
+
console.log(" postTransaction failed. resultCode is " + sendResult.resultCode + " , requestId is " + sendResult.requestId);
|
|
59
|
+
if (sendResult.response !== null) {
|
|
60
|
+
console.log(" postTransaction response statusText " + JSON.stringify(sendResult.response.statusText));
|
|
61
|
+
console.log(" postTransaction ensure account has adequate gas and nonce is correct");
|
|
62
|
+
}
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log(" postTransaction succeeded. This does not necessarily mean that the transaction has succeded. txnHash " + signResult.txnHash);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
package/example/example.js
CHANGED
|
@@ -74,7 +74,7 @@ qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
//Get the transaction details
|
|
77
|
-
let txnHash = "
|
|
77
|
+
let txnHash = "0xe6fbabc178adaaab6b9dbda086de53deaced1d6fe40e7db9539fe9e85695d1be"; //Just an example transaction hash https://quantumscan.com/txn/0xe6fbabc178adaaab6b9dbda086de53deaced1d6fe40e7db9539fe9e85695d1be
|
|
78
78
|
|
|
79
79
|
console.log("getTransactionDetails " + txnHash);
|
|
80
80
|
qcsdk.getTransactionDetails(txnHash).then((transactionDetailsResult) => {
|
|
@@ -10,18 +10,20 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"ethers": "^6.13.4",
|
|
13
|
-
"quantum-coin-js-sdk": "^1.0.
|
|
13
|
+
"quantum-coin-js-sdk": "^1.0.17"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"node_modules/@adraffy/ens-normalize": {
|
|
17
17
|
"version": "1.10.1",
|
|
18
18
|
"resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
|
|
19
|
-
"integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="
|
|
19
|
+
"integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==",
|
|
20
|
+
"license": "MIT"
|
|
20
21
|
},
|
|
21
22
|
"node_modules/@noble/curves": {
|
|
22
23
|
"version": "1.2.0",
|
|
23
24
|
"resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz",
|
|
24
25
|
"integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==",
|
|
26
|
+
"license": "MIT",
|
|
25
27
|
"dependencies": {
|
|
26
28
|
"@noble/hashes": "1.3.2"
|
|
27
29
|
},
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
"version": "1.3.2",
|
|
34
36
|
"resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz",
|
|
35
37
|
"integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==",
|
|
38
|
+
"license": "MIT",
|
|
36
39
|
"engines": {
|
|
37
40
|
"node": ">= 16"
|
|
38
41
|
},
|
|
@@ -44,6 +47,7 @@
|
|
|
44
47
|
"version": "22.7.5",
|
|
45
48
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz",
|
|
46
49
|
"integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==",
|
|
50
|
+
"license": "MIT",
|
|
47
51
|
"dependencies": {
|
|
48
52
|
"undici-types": "~6.19.2"
|
|
49
53
|
}
|
|
@@ -51,12 +55,13 @@
|
|
|
51
55
|
"node_modules/aes-js": {
|
|
52
56
|
"version": "4.0.0-beta.5",
|
|
53
57
|
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz",
|
|
54
|
-
"integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q=="
|
|
58
|
+
"integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==",
|
|
59
|
+
"license": "MIT"
|
|
55
60
|
},
|
|
56
61
|
"node_modules/ethers": {
|
|
57
|
-
"version": "6.
|
|
58
|
-
"resolved": "https://registry.npmjs.org/ethers/-/ethers-6.
|
|
59
|
-
"integrity": "sha512-
|
|
62
|
+
"version": "6.14.4",
|
|
63
|
+
"resolved": "https://registry.npmjs.org/ethers/-/ethers-6.14.4.tgz",
|
|
64
|
+
"integrity": "sha512-Jm/dzRs2Z9iBrT6e9TvGxyb5YVKAPLlpna7hjxH7KH/++DSh2T/JVmQUv7iHI5E55hDbp/gEVvstWYXVxXFzsA==",
|
|
60
65
|
"funding": [
|
|
61
66
|
{
|
|
62
67
|
"type": "individual",
|
|
@@ -67,6 +72,7 @@
|
|
|
67
72
|
"url": "https://www.buymeacoffee.com/ricmoo"
|
|
68
73
|
}
|
|
69
74
|
],
|
|
75
|
+
"license": "MIT",
|
|
70
76
|
"dependencies": {
|
|
71
77
|
"@adraffy/ens-normalize": "1.10.1",
|
|
72
78
|
"@noble/curves": "1.2.0",
|
|
@@ -81,34 +87,44 @@
|
|
|
81
87
|
}
|
|
82
88
|
},
|
|
83
89
|
"node_modules/quantum-coin-js-sdk": {
|
|
84
|
-
"version": "1.0.
|
|
85
|
-
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.
|
|
86
|
-
"integrity": "sha512-
|
|
90
|
+
"version": "1.0.17",
|
|
91
|
+
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.17.tgz",
|
|
92
|
+
"integrity": "sha512-PhpNkNDXOmBHOyyakeUUsj8rBnJ/Tr3ZXmpgd6M8n7qvo1vsoiuBjSWEIJR2YvsIiPOpRCIJqq8E59sCJ9+1Zg==",
|
|
87
93
|
"license": "MIT",
|
|
88
94
|
"dependencies": {
|
|
89
|
-
"quantum-coin-pqc-js-sdk": "^1.0.0"
|
|
95
|
+
"quantum-coin-pqc-js-sdk": "^1.0.0",
|
|
96
|
+
"seed-words": "^1.0.1"
|
|
90
97
|
}
|
|
91
98
|
},
|
|
92
99
|
"node_modules/quantum-coin-pqc-js-sdk": {
|
|
93
|
-
"version": "1.0.
|
|
94
|
-
"resolved": "https://registry.npmjs.org/quantum-coin-pqc-js-sdk/-/quantum-coin-pqc-js-sdk-1.0.
|
|
95
|
-
"integrity": "sha512-
|
|
100
|
+
"version": "1.0.5",
|
|
101
|
+
"resolved": "https://registry.npmjs.org/quantum-coin-pqc-js-sdk/-/quantum-coin-pqc-js-sdk-1.0.5.tgz",
|
|
102
|
+
"integrity": "sha512-9P1YDkca5CqrO7++TnGJZzPvYlBjYARopHgxYbDcEHgPicP7+tA8zD+DE1BooHp7sLEWF9ObklMj6AdaDUjDVw==",
|
|
103
|
+
"license": "MIT"
|
|
104
|
+
},
|
|
105
|
+
"node_modules/seed-words": {
|
|
106
|
+
"version": "1.0.2",
|
|
107
|
+
"resolved": "https://registry.npmjs.org/seed-words/-/seed-words-1.0.2.tgz",
|
|
108
|
+
"integrity": "sha512-ia58deuPjcR8DpJ8uIgZ7gqDnIWD8vnjb4jX/sEsIDcuQaH/AJj9J8L3DXkUHfUGqAq9Y6pVMuG90t3XUJH90g==",
|
|
96
109
|
"license": "MIT"
|
|
97
110
|
},
|
|
98
111
|
"node_modules/tslib": {
|
|
99
112
|
"version": "2.7.0",
|
|
100
113
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
|
|
101
|
-
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="
|
|
114
|
+
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==",
|
|
115
|
+
"license": "0BSD"
|
|
102
116
|
},
|
|
103
117
|
"node_modules/undici-types": {
|
|
104
118
|
"version": "6.19.8",
|
|
105
119
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
|
106
|
-
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw=="
|
|
120
|
+
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
|
121
|
+
"license": "MIT"
|
|
107
122
|
},
|
|
108
123
|
"node_modules/ws": {
|
|
109
124
|
"version": "8.17.1",
|
|
110
125
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
|
111
126
|
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
|
127
|
+
"license": "MIT",
|
|
112
128
|
"engines": {
|
|
113
129
|
"node": ">=10.0.0"
|
|
114
130
|
},
|
|
@@ -124,14 +140,6 @@
|
|
|
124
140
|
"optional": true
|
|
125
141
|
}
|
|
126
142
|
}
|
|
127
|
-
},
|
|
128
|
-
"quantum-coin-js-sdk": {
|
|
129
|
-
"version": "1.0.15",
|
|
130
|
-
"extraneous": true,
|
|
131
|
-
"license": "MIT",
|
|
132
|
-
"dependencies": {
|
|
133
|
-
"quantum-coin-pqc-js-sdk": "^1.0.0"
|
|
134
|
-
}
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
145
|
}
|