quantumcoin 7.0.11 → 7.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-SDK.md +16 -0
- package/README.md +13 -0
- package/examples/node_modules/.package-lock.json +18 -109
- package/examples/node_modules/get-tsconfig/dist/index.cjs +4 -4
- package/examples/node_modules/get-tsconfig/dist/index.mjs +7 -7
- package/examples/node_modules/get-tsconfig/package.json +1 -1
- package/examples/node_modules/quantum-coin-js-sdk/README.md +113 -103
- package/examples/node_modules/quantum-coin-js-sdk/example/example.js +2 -2
- package/examples/node_modules/quantum-coin-js-sdk/example/package-lock.json +1 -1
- package/examples/node_modules/quantum-coin-js-sdk/index.d.ts +1031 -1024
- package/examples/node_modules/quantum-coin-js-sdk/index.js +169 -87
- package/examples/node_modules/quantum-coin-js-sdk/package.json +1 -1
- package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.test.js +705 -2
- package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.js +2 -2
- package/examples/package-lock.json +1 -1
- package/generate-sdk.js +1 -1
- package/package.json +1 -1
- package/src/wallet/wallet.d.ts +5 -0
- package/src/wallet/wallet.js +20 -0
- package/test/unit/address-wallet.test.js +141 -0
- package/test/unit/address-wallet.test.ts +141 -0
- package/SPEC.md +0 -3784
- package/examples/node_modules/quantum-coin-js-sdk/.github/workflows/publish-npmjs.yaml +0 -22
|
@@ -38,10 +38,11 @@ Example Project: https://github.com/quantumcoinproject/quantum-coin-js-sdk/tree/
|
|
|
38
38
|
* [.readApiKey](#module_quantum-coin-js-sdk..Config+readApiKey) : <code>string</code>
|
|
39
39
|
* [.writeApiKey](#module_quantum-coin-js-sdk..Config+writeApiKey) : <code>string</code>
|
|
40
40
|
* [~Wallet](#module_quantum-coin-js-sdk..Wallet)
|
|
41
|
-
* [new Wallet(address, privateKey, publicKey)](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
41
|
+
* [new Wallet(address, privateKey, publicKey, [preExpansionSeed])](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
42
42
|
* [.address](#module_quantum-coin-js-sdk..Wallet+address) : <code>string</code>
|
|
43
43
|
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey) : <code>Array.<number></code>
|
|
44
44
|
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey) : <code>Array.<number></code>
|
|
45
|
+
* [.preExpansionSeed](#module_quantum-coin-js-sdk..Wallet+preExpansionSeed) : <code>Uint8Array</code> \| <code>Array.<number></code> \| <code>null</code>
|
|
45
46
|
* [~BlockDetails](#module_quantum-coin-js-sdk..BlockDetails)
|
|
46
47
|
* [.blockNumber](#module_quantum-coin-js-sdk..BlockDetails+blockNumber) : <code>number</code>
|
|
47
48
|
* [~LatestBlockDetailsResult](#module_quantum-coin-js-sdk..LatestBlockDetailsResult)
|
|
@@ -136,46 +137,46 @@ Example Project: https://github.com/quantumcoinproject/quantum-coin-js-sdk/tree/
|
|
|
136
137
|
* [.error](#module_quantum-coin-js-sdk..EventLogEncodeResult+error) : <code>string</code>
|
|
137
138
|
* [.result](#module_quantum-coin-js-sdk..EventLogEncodeResult+result) : <code>Object</code> \| <code>null</code>
|
|
138
139
|
* [~circl](#module_quantum-coin-js-sdk..circl)
|
|
139
|
-
* [~initialize(clientConfig)](#module_quantum-coin-js-sdk..initialize)
|
|
140
|
-
* [~isAddressValid(address)](#module_quantum-coin-js-sdk..isAddressValid)
|
|
141
|
-
* [~getKeyTypeFromPrivateKey(privateKey)](#module_quantum-coin-js-sdk..getKeyTypeFromPrivateKey)
|
|
142
|
-
* [~getKeyTypeFromPublicKey(publicKey)](#module_quantum-coin-js-sdk..getKeyTypeFromPublicKey)
|
|
143
|
-
* [~toUint8Array(key)](#module_quantum-coin-js-sdk..toUint8Array)
|
|
144
|
-
* [~newWallet(keyType)](#module_quantum-coin-js-sdk..newWallet)
|
|
145
|
-
* [~
|
|
146
|
-
* [~openWalletFromSeed(seedArray)](#module_quantum-coin-js-sdk..openWalletFromSeed)
|
|
147
|
-
* [~openWalletFromSeedWords(seedWordList)](#module_quantum-coin-js-sdk..openWalletFromSeedWords)
|
|
148
|
-
* [~deserializeEncryptedWallet(walletJsonString, passphrase)](#module_quantum-coin-js-sdk..deserializeEncryptedWallet)
|
|
149
|
-
* [~serializeEncryptedWallet(wallet, passphrase)](#module_quantum-coin-js-sdk..serializeEncryptedWallet)
|
|
150
|
-
* [~serializeSeedAsEncryptedWallet(seedArray, passphrase)](#module_quantum-coin-js-sdk..serializeSeedAsEncryptedWallet)
|
|
151
|
-
* [~verifyWallet(wallet)](#module_quantum-coin-js-sdk..verifyWallet)
|
|
152
|
-
* [~serializeWallet(wallet)](#module_quantum-coin-js-sdk..serializeWallet)
|
|
153
|
-
* [~deserializeWallet(walletJson)](#module_quantum-coin-js-sdk..deserializeWallet)
|
|
154
|
-
* [~postTransaction(txnData)](#module_quantum-coin-js-sdk..postTransaction)
|
|
155
|
-
* [~getLatestBlockDetails()](#module_quantum-coin-js-sdk..getLatestBlockDetails)
|
|
156
|
-
* [~getAccountDetails(address)](#module_quantum-coin-js-sdk..getAccountDetails)
|
|
157
|
-
* [~getTransactionDetails(txnHash)](#module_quantum-coin-js-sdk..getTransactionDetails)
|
|
158
|
-
* [~listAccountTransactions(address, pageNumber)](#module_quantum-coin-js-sdk..listAccountTransactions)
|
|
159
|
-
* ~~[~signSendCoinTransaction(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..signSendCoinTransaction)
|
|
160
|
-
* ~~[~signTransaction(wallet, toAddress, coins, nonce, data)](#module_quantum-coin-js-sdk..signTransaction)
|
|
161
|
-
* [~hexStringToUint8Array(hex)](#module_quantum-coin-js-sdk..hexStringToUint8Array)
|
|
162
|
-
* [~signRawTransaction(transactionSigningRequest)](#module_quantum-coin-js-sdk..signRawTransaction)
|
|
163
|
-
* [~sign(privateKey, message, [signingContext])](#module_quantum-coin-js-sdk..sign)
|
|
164
|
-
* [~verify(publicKey, signature, message)](#module_quantum-coin-js-sdk..verify)
|
|
165
|
-
* ~~[~sendCoins(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..sendCoins)
|
|
166
|
-
* [~publicKeyFromSignature(digest, signature)](#module_quantum-coin-js-sdk..publicKeyFromSignature)
|
|
167
|
-
* [~publicKeyFromPrivateKey(privateKey)](#module_quantum-coin-js-sdk..publicKeyFromPrivateKey)
|
|
168
|
-
* [~addressFromPublicKey(publicKey)](#module_quantum-coin-js-sdk..addressFromPublicKey)
|
|
169
|
-
* [~combinePublicKeySignature(publicKey, signature)](#module_quantum-coin-js-sdk..combinePublicKeySignature)
|
|
170
|
-
* [~packMethodData(abiJSON, methodName, ...args)](#module_quantum-coin-js-sdk..packMethodData)
|
|
171
|
-
* [~unpackMethodData(abiJSON, methodName, hexData)](#module_quantum-coin-js-sdk..unpackMethodData)
|
|
172
|
-
* [~packCreateContractData(abiJSON, bytecode, ...args)](#module_quantum-coin-js-sdk..packCreateContractData)
|
|
173
|
-
* [~encodeEventLog(abiJSON, eventName, ...args)](#module_quantum-coin-js-sdk..encodeEventLog)
|
|
174
|
-
* [~decodeEventLog(abiJSON, eventName, topics, data)](#module_quantum-coin-js-sdk..decodeEventLog)
|
|
175
|
-
* [~encodeRlp(value)](#module_quantum-coin-js-sdk..encodeRlp)
|
|
176
|
-
* [~decodeRlp(data)](#module_quantum-coin-js-sdk..decodeRlp)
|
|
177
|
-
* [~createAddress(address, nonce)](#module_quantum-coin-js-sdk..createAddress)
|
|
178
|
-
* [~createAddress2(address, salt, initHash)](#module_quantum-coin-js-sdk..createAddress2)
|
|
140
|
+
* [~initialize(clientConfig)](#module_quantum-coin-js-sdk..initialize) ⇒ <code>Promise.<boolean></code>
|
|
141
|
+
* [~isAddressValid(address)](#module_quantum-coin-js-sdk..isAddressValid) ⇒ <code>boolean</code>
|
|
142
|
+
* [~getKeyTypeFromPrivateKey(privateKey)](#module_quantum-coin-js-sdk..getKeyTypeFromPrivateKey) ⇒ <code>number</code> \| <code>null</code>
|
|
143
|
+
* [~getKeyTypeFromPublicKey(publicKey)](#module_quantum-coin-js-sdk..getKeyTypeFromPublicKey) ⇒ <code>number</code> \| <code>null</code>
|
|
144
|
+
* [~toUint8Array(key)](#module_quantum-coin-js-sdk..toUint8Array) ⇒ <code>Uint8Array</code>
|
|
145
|
+
* [~newWallet(keyType)](#module_quantum-coin-js-sdk..newWallet) ⇒ <code>Wallet</code> \| <code>number</code>
|
|
146
|
+
* [~newWalletSeedWords(keyType)](#module_quantum-coin-js-sdk..newWalletSeedWords) ⇒ <code>Array.<string></code> \| <code>number</code> \| <code>null</code>
|
|
147
|
+
* [~openWalletFromSeed(seedArray)](#module_quantum-coin-js-sdk..openWalletFromSeed) ⇒ <code>Wallet</code> \| <code>number</code> \| <code>null</code>
|
|
148
|
+
* [~openWalletFromSeedWords(seedWordList)](#module_quantum-coin-js-sdk..openWalletFromSeedWords) ⇒ <code>Wallet</code> \| <code>number</code> \| <code>null</code>
|
|
149
|
+
* [~deserializeEncryptedWallet(walletJsonString, passphrase)](#module_quantum-coin-js-sdk..deserializeEncryptedWallet) ⇒ <code>Wallet</code>
|
|
150
|
+
* [~serializeEncryptedWallet(wallet, passphrase)](#module_quantum-coin-js-sdk..serializeEncryptedWallet) ⇒ <code>string</code>
|
|
151
|
+
* [~serializeSeedAsEncryptedWallet(seedArray, passphrase)](#module_quantum-coin-js-sdk..serializeSeedAsEncryptedWallet) ⇒ <code>string</code> \| <code>number</code> \| <code>null</code>
|
|
152
|
+
* [~verifyWallet(wallet)](#module_quantum-coin-js-sdk..verifyWallet) ⇒ <code>boolean</code>
|
|
153
|
+
* [~serializeWallet(wallet)](#module_quantum-coin-js-sdk..serializeWallet) ⇒ <code>string</code>
|
|
154
|
+
* [~deserializeWallet(walletJson)](#module_quantum-coin-js-sdk..deserializeWallet) ⇒ <code>Wallet</code> \| <code>null</code>
|
|
155
|
+
* [~postTransaction(txnData)](#module_quantum-coin-js-sdk..postTransaction) ⇒ <code>Promise.<SendResult></code>
|
|
156
|
+
* [~getLatestBlockDetails()](#module_quantum-coin-js-sdk..getLatestBlockDetails) ⇒ <code>Promise.<LatestBlockDetailsResult></code>
|
|
157
|
+
* [~getAccountDetails(address)](#module_quantum-coin-js-sdk..getAccountDetails) ⇒ <code>Promise.<AccountDetailsResult></code>
|
|
158
|
+
* [~getTransactionDetails(txnHash)](#module_quantum-coin-js-sdk..getTransactionDetails) ⇒ <code>Promise.<TransactionDetailsResult></code>
|
|
159
|
+
* [~listAccountTransactions(address, pageNumber)](#module_quantum-coin-js-sdk..listAccountTransactions) ⇒ <code>Promise.<AccountTransactionsResult></code>
|
|
160
|
+
* ~~[~signSendCoinTransaction(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..signSendCoinTransaction) ⇒ <code>Promise.<SignResult></code>~~
|
|
161
|
+
* ~~[~signTransaction(wallet, toAddress, coins, nonce, data)](#module_quantum-coin-js-sdk..signTransaction) ⇒ <code>Promise.<SignResult></code>~~
|
|
162
|
+
* [~hexStringToUint8Array(hex)](#module_quantum-coin-js-sdk..hexStringToUint8Array) ⇒ <code>Uint8Array</code>
|
|
163
|
+
* [~signRawTransaction(transactionSigningRequest)](#module_quantum-coin-js-sdk..signRawTransaction) ⇒ <code>SignResult</code>
|
|
164
|
+
* [~sign(privateKey, message, [signingContext])](#module_quantum-coin-js-sdk..sign) ⇒ <code>Object</code>
|
|
165
|
+
* [~verify(publicKey, signature, message)](#module_quantum-coin-js-sdk..verify) ⇒ <code>Object</code>
|
|
166
|
+
* ~~[~sendCoins(wallet, toAddress, coins, nonce)](#module_quantum-coin-js-sdk..sendCoins) ⇒ <code>Promise.<SendResult></code>~~
|
|
167
|
+
* [~publicKeyFromSignature(digest, signature)](#module_quantum-coin-js-sdk..publicKeyFromSignature) ⇒ <code>string</code>
|
|
168
|
+
* [~publicKeyFromPrivateKey(privateKey)](#module_quantum-coin-js-sdk..publicKeyFromPrivateKey) ⇒ <code>string</code>
|
|
169
|
+
* [~addressFromPublicKey(publicKey)](#module_quantum-coin-js-sdk..addressFromPublicKey) ⇒ <code>string</code>
|
|
170
|
+
* [~combinePublicKeySignature(publicKey, signature)](#module_quantum-coin-js-sdk..combinePublicKeySignature) ⇒ <code>string</code>
|
|
171
|
+
* [~packMethodData(abiJSON, methodName, ...args)](#module_quantum-coin-js-sdk..packMethodData) ⇒ <code>PackUnpackResult</code>
|
|
172
|
+
* [~unpackMethodData(abiJSON, methodName, hexData)](#module_quantum-coin-js-sdk..unpackMethodData) ⇒ <code>PackUnpackResult</code>
|
|
173
|
+
* [~packCreateContractData(abiJSON, bytecode, ...args)](#module_quantum-coin-js-sdk..packCreateContractData) ⇒ <code>PackUnpackResult</code>
|
|
174
|
+
* [~encodeEventLog(abiJSON, eventName, ...args)](#module_quantum-coin-js-sdk..encodeEventLog) ⇒ <code>EventLogEncodeResult</code>
|
|
175
|
+
* [~decodeEventLog(abiJSON, eventName, topics, data)](#module_quantum-coin-js-sdk..decodeEventLog) ⇒ <code>PackUnpackResult</code>
|
|
176
|
+
* [~encodeRlp(value)](#module_quantum-coin-js-sdk..encodeRlp) ⇒ <code>PackUnpackResult</code>
|
|
177
|
+
* [~decodeRlp(data)](#module_quantum-coin-js-sdk..decodeRlp) ⇒ <code>PackUnpackResult</code>
|
|
178
|
+
* [~createAddress(address, nonce)](#module_quantum-coin-js-sdk..createAddress) ⇒ <code>string</code> \| <code>null</code>
|
|
179
|
+
* [~createAddress2(address, salt, initHash)](#module_quantum-coin-js-sdk..createAddress2) ⇒ <code>string</code> \| <code>null</code>
|
|
179
180
|
|
|
180
181
|
<a name="module_quantum-coin-js-sdk..Config"></a>
|
|
181
182
|
|
|
@@ -251,22 +252,24 @@ This class represents a Wallet. Use the verifyWallet function to verify if a wal
|
|
|
251
252
|
**Access**: public
|
|
252
253
|
|
|
253
254
|
* [~Wallet](#module_quantum-coin-js-sdk..Wallet)
|
|
254
|
-
* [new Wallet(address, privateKey, publicKey)](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
255
|
+
* [new Wallet(address, privateKey, publicKey, [preExpansionSeed])](#new_module_quantum-coin-js-sdk..Wallet_new)
|
|
255
256
|
* [.address](#module_quantum-coin-js-sdk..Wallet+address) : <code>string</code>
|
|
256
257
|
* [.privateKey](#module_quantum-coin-js-sdk..Wallet+privateKey) : <code>Array.<number></code>
|
|
257
258
|
* [.publicKey](#module_quantum-coin-js-sdk..Wallet+publicKey) : <code>Array.<number></code>
|
|
259
|
+
* [.preExpansionSeed](#module_quantum-coin-js-sdk..Wallet+preExpansionSeed) : <code>Uint8Array</code> \| <code>Array.<number></code> \| <code>null</code>
|
|
258
260
|
|
|
259
261
|
<a name="new_module_quantum-coin-js-sdk..Wallet_new"></a>
|
|
260
262
|
|
|
261
|
-
#### new Wallet(address, privateKey, publicKey)
|
|
263
|
+
#### new Wallet(address, privateKey, publicKey, [preExpansionSeed])
|
|
262
264
|
Creates a Wallet class. The constructor does not verify the wallet. To verify a wallet, call the verifyWallet function explicitly.
|
|
263
265
|
|
|
264
266
|
|
|
265
|
-
| Param | Type | Description |
|
|
266
|
-
| --- | --- | --- |
|
|
267
|
-
| address | <code>string</code> | Address of the wallet |
|
|
268
|
-
| privateKey | <code>Array.<number></code> | Private Key byte array of the wallet |
|
|
269
|
-
| publicKey | <code>Array.<number></code> |
|
|
267
|
+
| Param | Type | Default | Description |
|
|
268
|
+
| --- | --- | --- | --- |
|
|
269
|
+
| address | <code>string</code> | | Address of the wallet |
|
|
270
|
+
| privateKey | <code>Array.<number></code> | | Private Key byte array of the wallet |
|
|
271
|
+
| publicKey | <code>Array.<number></code> | | Public Key byte array of the wallet |
|
|
272
|
+
| [preExpansionSeed] | <code>Uint8Array</code> \| <code>Array.<number></code> \| <code>null</code> | <code></code> | Optional pre-expansion seed bytes. Non-null only for seed-derived wallets. |
|
|
270
273
|
|
|
271
274
|
<a name="module_quantum-coin-js-sdk..Wallet+address"></a>
|
|
272
275
|
|
|
@@ -287,6 +290,13 @@ Private Key byte array of the wallet. Is 4064 bytes in length (if the wallet is
|
|
|
287
290
|
#### wallet.publicKey : <code>Array.<number></code>
|
|
288
291
|
Public Key byte array of the wallet. Is 1408 bytes in length (if the wallet is valid).
|
|
289
292
|
|
|
293
|
+
**Kind**: instance property of [<code>Wallet</code>](#module_quantum-coin-js-sdk..Wallet)
|
|
294
|
+
**Access**: public
|
|
295
|
+
<a name="module_quantum-coin-js-sdk..Wallet+preExpansionSeed"></a>
|
|
296
|
+
|
|
297
|
+
#### wallet.preExpansionSeed : <code>Uint8Array</code> \| <code>Array.<number></code> \| <code>null</code>
|
|
298
|
+
Pre-expansion seed bytes. Can be null if the wallet was not created from a seed.
|
|
299
|
+
|
|
290
300
|
**Kind**: instance property of [<code>Wallet</code>](#module_quantum-coin-js-sdk..Wallet)
|
|
291
301
|
**Access**: public
|
|
292
302
|
<a name="module_quantum-coin-js-sdk..BlockDetails"></a>
|
|
@@ -1109,7 +1119,7 @@ CIRCL WASM namespace (set after InitAccountsWebAssembly). Use getCircl() for acc
|
|
|
1109
1119
|
**Kind**: inner property of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1110
1120
|
<a name="module_quantum-coin-js-sdk..initialize"></a>
|
|
1111
1121
|
|
|
1112
|
-
### quantum-coin-js-sdk~initialize(clientConfig)
|
|
1122
|
+
### quantum-coin-js-sdk~initialize(clientConfig) ⇒ <code>Promise.<boolean></code>
|
|
1113
1123
|
The initialize function has to be called before attempting to invoke any other function. This function should be called only once.
|
|
1114
1124
|
|
|
1115
1125
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1121,7 +1131,7 @@ The initialize function has to be called before attempting to invoke any other f
|
|
|
1121
1131
|
|
|
1122
1132
|
<a name="module_quantum-coin-js-sdk..isAddressValid"></a>
|
|
1123
1133
|
|
|
1124
|
-
### quantum-coin-js-sdk~isAddressValid(address)
|
|
1134
|
+
### quantum-coin-js-sdk~isAddressValid(address) ⇒ <code>boolean</code>
|
|
1125
1135
|
The isAddressValid function validates whether an address is valid or not. An address is of length 66 characters including 0x.
|
|
1126
1136
|
|
|
1127
1137
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1133,7 +1143,7 @@ The isAddressValid function validates whether an address is valid or not. An add
|
|
|
1133
1143
|
|
|
1134
1144
|
<a name="module_quantum-coin-js-sdk..getKeyTypeFromPrivateKey"></a>
|
|
1135
1145
|
|
|
1136
|
-
### quantum-coin-js-sdk~getKeyTypeFromPrivateKey(privateKey)
|
|
1146
|
+
### quantum-coin-js-sdk~getKeyTypeFromPrivateKey(privateKey) ⇒ <code>number</code> \| <code>null</code>
|
|
1137
1147
|
Internal: get key type (KEY_TYPE_HYBRIDEDMLDSASLHDSA or KEY_TYPE_HYBRIDEDMLDSASLHDSA5) from private key length.
|
|
1138
1148
|
|
|
1139
1149
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1145,7 +1155,7 @@ Internal: get key type (KEY_TYPE_HYBRIDEDMLDSASLHDSA or KEY_TYPE_HYBRIDEDMLDSASL
|
|
|
1145
1155
|
|
|
1146
1156
|
<a name="module_quantum-coin-js-sdk..getKeyTypeFromPublicKey"></a>
|
|
1147
1157
|
|
|
1148
|
-
### quantum-coin-js-sdk~getKeyTypeFromPublicKey(publicKey)
|
|
1158
|
+
### quantum-coin-js-sdk~getKeyTypeFromPublicKey(publicKey) ⇒ <code>number</code> \| <code>null</code>
|
|
1149
1159
|
Internal: get key type (KEY_TYPE_HYBRIDEDMLDSASLHDSA or KEY_TYPE_HYBRIDEDMLDSASLHDSA5) from public key length.
|
|
1150
1160
|
|
|
1151
1161
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1157,7 +1167,7 @@ Internal: get key type (KEY_TYPE_HYBRIDEDMLDSASLHDSA or KEY_TYPE_HYBRIDEDMLDSASL
|
|
|
1157
1167
|
|
|
1158
1168
|
<a name="module_quantum-coin-js-sdk..toUint8Array"></a>
|
|
1159
1169
|
|
|
1160
|
-
### quantum-coin-js-sdk~toUint8Array(key)
|
|
1170
|
+
### quantum-coin-js-sdk~toUint8Array(key) ⇒ <code>Uint8Array</code>
|
|
1161
1171
|
Convert key (number[] or Uint8Array) to Uint8Array for CIRCL.
|
|
1162
1172
|
|
|
1163
1173
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1168,7 +1178,7 @@ Convert key (number[] or Uint8Array) to Uint8Array for CIRCL.
|
|
|
1168
1178
|
|
|
1169
1179
|
<a name="module_quantum-coin-js-sdk..newWallet"></a>
|
|
1170
1180
|
|
|
1171
|
-
### quantum-coin-js-sdk~newWallet(keyType)
|
|
1181
|
+
### quantum-coin-js-sdk~newWallet(keyType) ⇒ <code>Wallet</code> \| <code>number</code>
|
|
1172
1182
|
The newWallet function creates a new Wallet.
|
|
1173
1183
|
|
|
1174
1184
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1178,13 +1188,13 @@ The newWallet function creates a new Wallet.
|
|
|
1178
1188
|
| --- | --- | --- |
|
|
1179
1189
|
| keyType | <code>number</code> \| <code>null</code> | Optional. KEY_TYPE_HYBRIDEDMLDSASLHDSA (3) or KEY_TYPE_HYBRIDEDMLDSASLHDSA5 (5). null/undefined defaults to 3. |
|
|
1180
1190
|
|
|
1181
|
-
<a name="module_quantum-coin-js-sdk..
|
|
1191
|
+
<a name="module_quantum-coin-js-sdk..newWalletSeedWords"></a>
|
|
1182
1192
|
|
|
1183
|
-
### quantum-coin-js-sdk~
|
|
1184
|
-
The
|
|
1193
|
+
### quantum-coin-js-sdk~newWalletSeedWords(keyType) ⇒ <code>Array.<string></code> \| <code>number</code> \| <code>null</code>
|
|
1194
|
+
The newWalletSeedWords function creates a new wallet seed word list. The returned array can then be passed to the openWalletFromSeedWords function to create a new wallet.
|
|
1185
1195
|
|
|
1186
1196
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1187
|
-
**Returns**: <code>
|
|
1197
|
+
**Returns**: <code>Array.<string></code> \| <code>number</code> \| <code>null</code> - Returns an array of seed words (32 or 36 words depending on keyType). Returns -1000 if not initialized, null on failure.
|
|
1188
1198
|
|
|
1189
1199
|
| Param | Type | Description |
|
|
1190
1200
|
| --- | --- | --- |
|
|
@@ -1192,12 +1202,12 @@ The newWalletSeed function creates a new Wallet seed word list. The return array
|
|
|
1192
1202
|
|
|
1193
1203
|
<a name="module_quantum-coin-js-sdk..openWalletFromSeed"></a>
|
|
1194
1204
|
|
|
1195
|
-
### quantum-coin-js-sdk~openWalletFromSeed(seedArray)
|
|
1205
|
+
### quantum-coin-js-sdk~openWalletFromSeed(seedArray) ⇒ <code>Wallet</code> \| <code>number</code> \| <code>null</code>
|
|
1196
1206
|
The openWalletFromSeed function creates a wallet from a raw seed byte array.
|
|
1197
1207
|
Determines the key scheme from the array length: 96 bytes (hybrideds), 72 bytes (hybrid5), or 64 bytes (hybrid).
|
|
1198
1208
|
|
|
1199
1209
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1200
|
-
**Returns**: <code>Wallet</code> \| <code>number</code> - Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
|
|
1210
|
+
**Returns**: <code>Wallet</code> \| <code>number</code> \| <code>null</code> - Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
|
|
1201
1211
|
|
|
1202
1212
|
| Param | Type | Description |
|
|
1203
1213
|
| --- | --- | --- |
|
|
@@ -1205,20 +1215,20 @@ Determines the key scheme from the array length: 96 bytes (hybrideds), 72 bytes
|
|
|
1205
1215
|
|
|
1206
1216
|
<a name="module_quantum-coin-js-sdk..openWalletFromSeedWords"></a>
|
|
1207
1217
|
|
|
1208
|
-
### quantum-coin-js-sdk~openWalletFromSeedWords(seedWordList)
|
|
1218
|
+
### quantum-coin-js-sdk~openWalletFromSeedWords(seedWordList) ⇒ <code>Wallet</code> \| <code>number</code> \| <code>null</code>
|
|
1209
1219
|
The openWalletFromSeedWords function creates a wallet from a seed word list. The seed word list is available for wallets created from Desktop/Web/Mobile wallets.
|
|
1210
1220
|
Supports 48 words (hybrideds), 36 words (hybrid5), or 32 words (hybrid) per seed length.
|
|
1211
1221
|
|
|
1212
1222
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1213
|
-
**Returns**: <code>Wallet</code> \| <code>number</code> - Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
|
|
1223
|
+
**Returns**: <code>Wallet</code> \| <code>number</code> \| <code>null</code> - Returns a Wallet object. Returns -1000 if not initialized, null if the operation failed.
|
|
1214
1224
|
|
|
1215
1225
|
| Param | Type | Description |
|
|
1216
1226
|
| --- | --- | --- |
|
|
1217
|
-
| seedWordList | <code>
|
|
1227
|
+
| seedWordList | <code>Array.<string></code> | An array of seed words. Length 48, 36, or 32 depending on scheme. |
|
|
1218
1228
|
|
|
1219
1229
|
<a name="module_quantum-coin-js-sdk..deserializeEncryptedWallet"></a>
|
|
1220
1230
|
|
|
1221
|
-
### quantum-coin-js-sdk~deserializeEncryptedWallet(walletJsonString, passphrase)
|
|
1231
|
+
### quantum-coin-js-sdk~deserializeEncryptedWallet(walletJsonString, passphrase) ⇒ <code>Wallet</code>
|
|
1222
1232
|
The deserializeEncryptedWallet function opens a wallet backed-up using an application such as the Desktop/Mobile/CLI/Web wallet. This function can take upto a minute or so to execute. You should open wallets only from trusted sources.
|
|
1223
1233
|
|
|
1224
1234
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1231,7 +1241,7 @@ The deserializeEncryptedWallet function opens a wallet backed-up using an applic
|
|
|
1231
1241
|
|
|
1232
1242
|
<a name="module_quantum-coin-js-sdk..serializeEncryptedWallet"></a>
|
|
1233
1243
|
|
|
1234
|
-
### quantum-coin-js-sdk~serializeEncryptedWallet(wallet, passphrase)
|
|
1244
|
+
### quantum-coin-js-sdk~serializeEncryptedWallet(wallet, passphrase) ⇒ <code>string</code>
|
|
1235
1245
|
The serializeEncryptedWallet function encrypts and serializes a Wallet object to a JSON string readable by the Desktop/Mobile/Web/CLI wallet applications. You can save this string to a file and open the file in one of these wallet applications. You may also open this string using the deserializeEncryptedWallet function. If you loose the passphrase, you will be unable to open the wallet. This function can take upto a minute or so to execute.
|
|
1236
1246
|
|
|
1237
1247
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1244,7 +1254,7 @@ The serializeEncryptedWallet function encrypts and serializes a Wallet object to
|
|
|
1244
1254
|
|
|
1245
1255
|
<a name="module_quantum-coin-js-sdk..serializeSeedAsEncryptedWallet"></a>
|
|
1246
1256
|
|
|
1247
|
-
### quantum-coin-js-sdk~serializeSeedAsEncryptedWallet(seedArray, passphrase)
|
|
1257
|
+
### quantum-coin-js-sdk~serializeSeedAsEncryptedWallet(seedArray, passphrase) ⇒ <code>string</code> \| <code>number</code> \| <code>null</code>
|
|
1248
1258
|
The serializeSeedAsEncryptedWallet function encrypts a raw seed byte array into a wallet JSON string
|
|
1249
1259
|
that can be opened with deserializeEncryptedWallet or Desktop/Mobile/Web/CLI wallet applications.
|
|
1250
1260
|
The seed is stored in its pre-expansion form (version 5 wallet format). This function can take
|
|
@@ -1260,7 +1270,7 @@ up to a minute or so to execute due to key derivation.
|
|
|
1260
1270
|
|
|
1261
1271
|
<a name="module_quantum-coin-js-sdk..verifyWallet"></a>
|
|
1262
1272
|
|
|
1263
|
-
### quantum-coin-js-sdk~verifyWallet(wallet)
|
|
1273
|
+
### quantum-coin-js-sdk~verifyWallet(wallet) ⇒ <code>boolean</code>
|
|
1264
1274
|
The verifyWallet function verifies whether a Wallet is valid or not. To mitigate spoofing and other attachs, it is highly recommended to verify a wallet, especially if it is from an untrusted source.
|
|
1265
1275
|
|
|
1266
1276
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1272,7 +1282,7 @@ The verifyWallet function verifies whether a Wallet is valid or not. To mitigate
|
|
|
1272
1282
|
|
|
1273
1283
|
<a name="module_quantum-coin-js-sdk..serializeWallet"></a>
|
|
1274
1284
|
|
|
1275
|
-
### quantum-coin-js-sdk~serializeWallet(wallet)
|
|
1285
|
+
### quantum-coin-js-sdk~serializeWallet(wallet) ⇒ <code>string</code>
|
|
1276
1286
|
The serializeWallet function serializes a Wallet object to a JSON string. You should encrypt the string before saving it to disk or a database.
|
|
1277
1287
|
|
|
1278
1288
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1284,19 +1294,19 @@ The serializeWallet function serializes a Wallet object to a JSON string. You sh
|
|
|
1284
1294
|
|
|
1285
1295
|
<a name="module_quantum-coin-js-sdk..deserializeWallet"></a>
|
|
1286
1296
|
|
|
1287
|
-
### quantum-coin-js-sdk~deserializeWallet(walletJson)
|
|
1297
|
+
### quantum-coin-js-sdk~deserializeWallet(walletJson) ⇒ <code>Wallet</code> \| <code>null</code>
|
|
1288
1298
|
The deserializeWallet function creates a Wallet object from a JSON string.
|
|
1289
1299
|
|
|
1290
1300
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1291
|
-
**Returns**: <code>Wallet</code> - Returns the Wallet corresponding to the walletJson. If the wallet is invalid, null is returned.
|
|
1301
|
+
**Returns**: <code>Wallet</code> \| <code>null</code> - Returns the Wallet corresponding to the walletJson. If the wallet is invalid or the JSON is malformed, null is returned.
|
|
1292
1302
|
|
|
1293
1303
|
| Param | Type | Description |
|
|
1294
1304
|
| --- | --- | --- |
|
|
1295
|
-
| walletJson | <code>string</code> | A
|
|
1305
|
+
| walletJson | <code>string</code> | A JSON string representing the wallet to deserialize. |
|
|
1296
1306
|
|
|
1297
1307
|
<a name="module_quantum-coin-js-sdk..postTransaction"></a>
|
|
1298
1308
|
|
|
1299
|
-
### quantum-coin-js-sdk~postTransaction(txnData)
|
|
1309
|
+
### quantum-coin-js-sdk~postTransaction(txnData) ⇒ <code>Promise.<SendResult></code>
|
|
1300
1310
|
The postTransaction function posts a signed transaction to the blockchain.
|
|
1301
1311
|
This method can be used in conjunction with the signSendCoinTransaction method to submit a transaction that was signed using a cold wallet (offline or disconnected or air-gapped wallet).
|
|
1302
1312
|
|
|
@@ -1309,14 +1319,14 @@ This method can be used in conjunction with the signSendCoinTransaction method t
|
|
|
1309
1319
|
|
|
1310
1320
|
<a name="module_quantum-coin-js-sdk..getLatestBlockDetails"></a>
|
|
1311
1321
|
|
|
1312
|
-
### quantum-coin-js-sdk~getLatestBlockDetails()
|
|
1322
|
+
### quantum-coin-js-sdk~getLatestBlockDetails() ⇒ <code>Promise.<LatestBlockDetailsResult></code>
|
|
1313
1323
|
The getLatestBlockDetails function returns details of the latest block of the blockchain.
|
|
1314
1324
|
|
|
1315
1325
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1316
|
-
**Returns**: <code>Promise.<LatestBlockDetailsResult></code> - Returns a promise of an object of type
|
|
1326
|
+
**Returns**: <code>Promise.<LatestBlockDetailsResult></code> - Returns a promise of an object of type LatestBlockDetailsResult.
|
|
1317
1327
|
<a name="module_quantum-coin-js-sdk..getAccountDetails"></a>
|
|
1318
1328
|
|
|
1319
|
-
### quantum-coin-js-sdk~getAccountDetails(address)
|
|
1329
|
+
### quantum-coin-js-sdk~getAccountDetails(address) ⇒ <code>Promise.<AccountDetailsResult></code>
|
|
1320
1330
|
The getAccountDetails function returns details of an account corresponding to the address.
|
|
1321
1331
|
|
|
1322
1332
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1328,7 +1338,7 @@ The getAccountDetails function returns details of an account corresponding to th
|
|
|
1328
1338
|
|
|
1329
1339
|
<a name="module_quantum-coin-js-sdk..getTransactionDetails"></a>
|
|
1330
1340
|
|
|
1331
|
-
### quantum-coin-js-sdk~getTransactionDetails(txnHash)
|
|
1341
|
+
### quantum-coin-js-sdk~getTransactionDetails(txnHash) ⇒ <code>Promise.<TransactionDetailsResult></code>
|
|
1332
1342
|
The getTransactionDetails function returns details of a transaction posted to the blockchain.
|
|
1333
1343
|
Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for reading.
|
|
1334
1344
|
Some transactions that have lower balance than the minimum required for gas fees may be discarded.
|
|
@@ -1337,7 +1347,7 @@ You should consider the transaction as succeeded only if the status field of the
|
|
|
1337
1347
|
The transactionReceipt field can be null unless the transaction is registered with the blockchain.
|
|
1338
1348
|
|
|
1339
1349
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1340
|
-
**Returns**: <code>Promise.<TransactionDetailsResult></code> - Returns a promise of type
|
|
1350
|
+
**Returns**: <code>Promise.<TransactionDetailsResult></code> - Returns a promise of type TransactionDetailsResult.
|
|
1341
1351
|
|
|
1342
1352
|
| Param | Type | Description |
|
|
1343
1353
|
| --- | --- | --- |
|
|
@@ -1345,17 +1355,17 @@ The transactionReceipt field can be null unless the transaction is registered wi
|
|
|
1345
1355
|
|
|
1346
1356
|
<a name="module_quantum-coin-js-sdk..listAccountTransactions"></a>
|
|
1347
1357
|
|
|
1348
|
-
### quantum-coin-js-sdk~listAccountTransactions(address, pageNumber)
|
|
1358
|
+
### quantum-coin-js-sdk~listAccountTransactions(address, pageNumber) ⇒ <code>Promise.<AccountTransactionsResult></code>
|
|
1349
1359
|
The listAccountTransactions function returns a list of transactions for a specific account.
|
|
1350
1360
|
Transactions may take a while to get registered in the blockchain. After a transaction is submitted, it may take a while before it is available for listing.
|
|
1351
1361
|
Some transactions that have lower balance than the minimum required for gas fees may be discarded.
|
|
1352
1362
|
In these cases, the transactions may not be returned when invoking the listAccountTransactions function.
|
|
1353
|
-
You should consider the transaction as succeeded only if the status field
|
|
1363
|
+
You should consider the transaction as succeeded only if the status field of the AccountTransactionCompact object is 0x1 (success).
|
|
1354
1364
|
Both transactions from and transactions to the address will be returned in the list.
|
|
1355
1365
|
Use the getTransactionDetails function, passing the hash of the transaction to get detailed information about the transaction.
|
|
1356
1366
|
|
|
1357
1367
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1358
|
-
**Returns**: <code>Promise.<
|
|
1368
|
+
**Returns**: <code>Promise.<AccountTransactionsResult></code> - Returns a promise of type AccountTransactionsResult.
|
|
1359
1369
|
|
|
1360
1370
|
| Param | Type | Description |
|
|
1361
1371
|
| --- | --- | --- |
|
|
@@ -1364,7 +1374,7 @@ Use the getTransactionDetails function, passing the hash of the transaction to g
|
|
|
1364
1374
|
|
|
1365
1375
|
<a name="module_quantum-coin-js-sdk..signSendCoinTransaction"></a>
|
|
1366
1376
|
|
|
1367
|
-
### ~~quantum-coin-js-sdk~signSendCoinTransaction(wallet, toAddress, coins, nonce)
|
|
1377
|
+
### ~~quantum-coin-js-sdk~signSendCoinTransaction(wallet, toAddress, coins, nonce) ⇒ <code>Promise.<SignResult></code>~~
|
|
1368
1378
|
***Use signRawTransaction instead.***
|
|
1369
1379
|
|
|
1370
1380
|
The signSendCoinTransaction function returns a signed transaction. The chainId used for signing should be provided in the initialize() function.
|
|
@@ -1373,7 +1383,7 @@ This function is useful for offline (cold storage) wallets, where you can sign a
|
|
|
1373
1383
|
Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
|
|
1374
1384
|
|
|
1375
1385
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1376
|
-
**Returns**: <code>SignResult
|
|
1386
|
+
**Returns**: <code>Promise.<SignResult></code> - Returns a promise of type SignResult.
|
|
1377
1387
|
|
|
1378
1388
|
| Param | Type | Description |
|
|
1379
1389
|
| --- | --- | --- |
|
|
@@ -1384,7 +1394,7 @@ Another usecase for this function is when you want to first store a signed trans
|
|
|
1384
1394
|
|
|
1385
1395
|
<a name="module_quantum-coin-js-sdk..signTransaction"></a>
|
|
1386
1396
|
|
|
1387
|
-
### ~~quantum-coin-js-sdk~signTransaction(wallet, toAddress, coins, nonce, data)
|
|
1397
|
+
### ~~quantum-coin-js-sdk~signTransaction(wallet, toAddress, coins, nonce, data) ⇒ <code>Promise.<SignResult></code>~~
|
|
1388
1398
|
***Use signRawTransaction instead.***
|
|
1389
1399
|
|
|
1390
1400
|
The signTransaction function returns a signed transaction. The chainId used for signing should be provided in the initialize() function.
|
|
@@ -1393,7 +1403,7 @@ This function is useful for offline (cold storage) wallets, where you can sign a
|
|
|
1393
1403
|
Another usecase for this function is when you want to first store a signed transaction to a database, then queue it and finally submit the transaction by calling the postTransaction function.
|
|
1394
1404
|
|
|
1395
1405
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
1396
|
-
**Returns**: <code>SignResult
|
|
1406
|
+
**Returns**: <code>Promise.<SignResult></code> - Returns a promise of type SignResult.
|
|
1397
1407
|
|
|
1398
1408
|
| Param | Type | Description |
|
|
1399
1409
|
| --- | --- | --- |
|
|
@@ -1401,11 +1411,11 @@ Another usecase for this function is when you want to first store a signed trans
|
|
|
1401
1411
|
| toAddress | <code>string</code> | The address to which the coins should be sent. |
|
|
1402
1412
|
| 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 |
|
|
1403
1413
|
| 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. |
|
|
1404
|
-
| data | <code>
|
|
1414
|
+
| data | <code>string</code> | Ignored. This parameter is accepted but not used. Use signRawTransaction to pass contract data. |
|
|
1405
1415
|
|
|
1406
1416
|
<a name="module_quantum-coin-js-sdk..hexStringToUint8Array"></a>
|
|
1407
1417
|
|
|
1408
|
-
### quantum-coin-js-sdk~hexStringToUint8Array(hex)
|
|
1418
|
+
### quantum-coin-js-sdk~hexStringToUint8Array(hex) ⇒ <code>Uint8Array</code>
|
|
1409
1419
|
Helper function to convert a hex string to Uint8Array
|
|
1410
1420
|
|
|
1411
1421
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1417,7 +1427,7 @@ Helper function to convert a hex string to Uint8Array
|
|
|
1417
1427
|
|
|
1418
1428
|
<a name="module_quantum-coin-js-sdk..signRawTransaction"></a>
|
|
1419
1429
|
|
|
1420
|
-
### quantum-coin-js-sdk~signRawTransaction(transactionSigningRequest)
|
|
1430
|
+
### quantum-coin-js-sdk~signRawTransaction(transactionSigningRequest) ⇒ <code>SignResult</code>
|
|
1421
1431
|
The signRawTransaction function returns a signed transaction. The chainId used for signing can be provided in the TransactionSigningRequest, or if null, the chainId specified in the initialize() function will be used.
|
|
1422
1432
|
With this function, you can set the gasLimit explicitly compared to signTransaction.
|
|
1423
1433
|
You can also pass data to be signed, such as when creating or invoking a smart contract.
|
|
@@ -1434,7 +1444,7 @@ Another usecase for this function is when you want to first store a signed trans
|
|
|
1434
1444
|
|
|
1435
1445
|
<a name="module_quantum-coin-js-sdk..sign"></a>
|
|
1436
1446
|
|
|
1437
|
-
### quantum-coin-js-sdk~sign(privateKey, message, [signingContext])
|
|
1447
|
+
### quantum-coin-js-sdk~sign(privateKey, message, [signingContext]) ⇒ <code>Object</code>
|
|
1438
1448
|
Sign a message with a private key. Optional signingContext selects algorithm (same pattern as signRawTransaction); if null/omitted, derived from private key type.
|
|
1439
1449
|
|
|
1440
1450
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1448,7 +1458,7 @@ Sign a message with a private key. Optional signingContext selects algorithm (sa
|
|
|
1448
1458
|
|
|
1449
1459
|
<a name="module_quantum-coin-js-sdk..verify"></a>
|
|
1450
1460
|
|
|
1451
|
-
### quantum-coin-js-sdk~verify(publicKey, signature, message)
|
|
1461
|
+
### quantum-coin-js-sdk~verify(publicKey, signature, message) ⇒ <code>Object</code>
|
|
1452
1462
|
Verify a signature over a message with a public key. Algorithm is determined by the first byte of the signature: 1=hybrideds verifyCompact, 2=hybrideds verify, 3=hybridedmldsaslhdsa verifyCompact, 4=hybridedmldsaslhdsa verify, 5=hybridedmldsaslhdsa5 verify.
|
|
1453
1463
|
|
|
1454
1464
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1462,7 +1472,7 @@ Verify a signature over a message with a public key. Algorithm is determined by
|
|
|
1462
1472
|
|
|
1463
1473
|
<a name="module_quantum-coin-js-sdk..sendCoins"></a>
|
|
1464
1474
|
|
|
1465
|
-
### ~~quantum-coin-js-sdk~sendCoins(wallet, toAddress, coins, nonce)
|
|
1475
|
+
### ~~quantum-coin-js-sdk~sendCoins(wallet, toAddress, coins, nonce) ⇒ <code>Promise.<SendResult></code>~~
|
|
1466
1476
|
***Use signRawTransaction and postTransaction instead.***
|
|
1467
1477
|
|
|
1468
1478
|
The sendCoins function posts a send-coin transaction to the blockchain. The chainId used for signing should be provided in the initialize() function.
|
|
@@ -1482,7 +1492,7 @@ Transactions are usually committed in less than 30 seconds.
|
|
|
1482
1492
|
|
|
1483
1493
|
<a name="module_quantum-coin-js-sdk..publicKeyFromSignature"></a>
|
|
1484
1494
|
|
|
1485
|
-
### quantum-coin-js-sdk~publicKeyFromSignature(digest, signature)
|
|
1495
|
+
### quantum-coin-js-sdk~publicKeyFromSignature(digest, signature) ⇒ <code>string</code>
|
|
1486
1496
|
The publicKeyFromSignature extracts the public key from a signature.
|
|
1487
1497
|
|
|
1488
1498
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1495,7 +1505,7 @@ The publicKeyFromSignature extracts the public key from a signature.
|
|
|
1495
1505
|
|
|
1496
1506
|
<a name="module_quantum-coin-js-sdk..publicKeyFromPrivateKey"></a>
|
|
1497
1507
|
|
|
1498
|
-
### quantum-coin-js-sdk~publicKeyFromPrivateKey(privateKey)
|
|
1508
|
+
### quantum-coin-js-sdk~publicKeyFromPrivateKey(privateKey) ⇒ <code>string</code>
|
|
1499
1509
|
The publicKeyFromPrivateKey extracts the public key from a private key.
|
|
1500
1510
|
|
|
1501
1511
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1507,7 +1517,7 @@ The publicKeyFromPrivateKey extracts the public key from a private key.
|
|
|
1507
1517
|
|
|
1508
1518
|
<a name="module_quantum-coin-js-sdk..addressFromPublicKey"></a>
|
|
1509
1519
|
|
|
1510
|
-
### quantum-coin-js-sdk~addressFromPublicKey(publicKey)
|
|
1520
|
+
### quantum-coin-js-sdk~addressFromPublicKey(publicKey) ⇒ <code>string</code>
|
|
1511
1521
|
The addressFromPublicKey returns the address corresponding to the public key.
|
|
1512
1522
|
|
|
1513
1523
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1519,7 +1529,7 @@ The addressFromPublicKey returns the address corresponding to the public key.
|
|
|
1519
1529
|
|
|
1520
1530
|
<a name="module_quantum-coin-js-sdk..combinePublicKeySignature"></a>
|
|
1521
1531
|
|
|
1522
|
-
### quantum-coin-js-sdk~combinePublicKeySignature(publicKey, signature)
|
|
1532
|
+
### quantum-coin-js-sdk~combinePublicKeySignature(publicKey, signature) ⇒ <code>string</code>
|
|
1523
1533
|
The combinePublicKeySignature combines the public key and signature.
|
|
1524
1534
|
|
|
1525
1535
|
**Kind**: inner method of [<code>quantum-coin-js-sdk</code>](#module_quantum-coin-js-sdk)
|
|
@@ -1532,7 +1542,7 @@ The combinePublicKeySignature combines the public key and signature.
|
|
|
1532
1542
|
|
|
1533
1543
|
<a name="module_quantum-coin-js-sdk..packMethodData"></a>
|
|
1534
1544
|
|
|
1535
|
-
### quantum-coin-js-sdk~packMethodData(abiJSON, methodName, ...args)
|
|
1545
|
+
### quantum-coin-js-sdk~packMethodData(abiJSON, methodName, ...args) ⇒ <code>PackUnpackResult</code>
|
|
1536
1546
|
The packMethodData function packs a Solidity method call with the given ABI, method name, and arguments.
|
|
1537
1547
|
It returns the transaction data as a hex string that can be included in a transaction.
|
|
1538
1548
|
|
|
@@ -1547,7 +1557,7 @@ It returns the transaction data as a hex string that can be included in a transa
|
|
|
1547
1557
|
|
|
1548
1558
|
<a name="module_quantum-coin-js-sdk..unpackMethodData"></a>
|
|
1549
1559
|
|
|
1550
|
-
### quantum-coin-js-sdk~unpackMethodData(abiJSON, methodName, hexData)
|
|
1560
|
+
### quantum-coin-js-sdk~unpackMethodData(abiJSON, methodName, hexData) ⇒ <code>PackUnpackResult</code>
|
|
1551
1561
|
The unpackMethodData function unpacks the return values of a Solidity method call.
|
|
1552
1562
|
It returns the unpacked values as a JavaScript array or object.
|
|
1553
1563
|
|
|
@@ -1562,7 +1572,7 @@ It returns the unpacked values as a JavaScript array or object.
|
|
|
1562
1572
|
|
|
1563
1573
|
<a name="module_quantum-coin-js-sdk..packCreateContractData"></a>
|
|
1564
1574
|
|
|
1565
|
-
### quantum-coin-js-sdk~packCreateContractData(abiJSON, bytecode, ...args)
|
|
1575
|
+
### quantum-coin-js-sdk~packCreateContractData(abiJSON, bytecode, ...args) ⇒ <code>PackUnpackResult</code>
|
|
1566
1576
|
The packCreateContractData function packs constructor data for contract creation.
|
|
1567
1577
|
It combines the contract bytecode with the ABI-encoded constructor parameters.
|
|
1568
1578
|
This matches the Go pattern: Pack("", params...) and append(bytecode, input...)
|
|
@@ -1578,7 +1588,7 @@ This matches the Go pattern: Pack("", params...) and append(bytecode, input...)
|
|
|
1578
1588
|
|
|
1579
1589
|
<a name="module_quantum-coin-js-sdk..encodeEventLog"></a>
|
|
1580
1590
|
|
|
1581
|
-
### quantum-coin-js-sdk~encodeEventLog(abiJSON, eventName, ...args)
|
|
1591
|
+
### quantum-coin-js-sdk~encodeEventLog(abiJSON, eventName, ...args) ⇒ <code>EventLogEncodeResult</code>
|
|
1582
1592
|
The encodeEventLog function encodes event parameters into topics and data according to the ABI specification.
|
|
1583
1593
|
It returns the topics array and data hex string that can be used to create event logs.
|
|
1584
1594
|
|
|
@@ -1593,7 +1603,7 @@ It returns the topics array and data hex string that can be used to create event
|
|
|
1593
1603
|
|
|
1594
1604
|
<a name="module_quantum-coin-js-sdk..decodeEventLog"></a>
|
|
1595
1605
|
|
|
1596
|
-
### quantum-coin-js-sdk~decodeEventLog(abiJSON, eventName, topics, data)
|
|
1606
|
+
### quantum-coin-js-sdk~decodeEventLog(abiJSON, eventName, topics, data) ⇒ <code>PackUnpackResult</code>
|
|
1597
1607
|
The decodeEventLog function decodes event log topics and data back into event parameters.
|
|
1598
1608
|
It returns the decoded values as a JavaScript object.
|
|
1599
1609
|
|
|
@@ -1609,7 +1619,7 @@ It returns the decoded values as a JavaScript object.
|
|
|
1609
1619
|
|
|
1610
1620
|
<a name="module_quantum-coin-js-sdk..encodeRlp"></a>
|
|
1611
1621
|
|
|
1612
|
-
### quantum-coin-js-sdk~encodeRlp(value)
|
|
1622
|
+
### quantum-coin-js-sdk~encodeRlp(value) ⇒ <code>PackUnpackResult</code>
|
|
1613
1623
|
The encodeRlp function encodes a JavaScript value to RLP (Recursive Length Prefix) format.
|
|
1614
1624
|
Supports: strings, numbers, booleans, arrays, objects (maps), and hex-encoded bytes.
|
|
1615
1625
|
Returns a hex-encoded string of the RLP-encoded data.
|
|
@@ -1623,7 +1633,7 @@ Returns a hex-encoded string of the RLP-encoded data.
|
|
|
1623
1633
|
|
|
1624
1634
|
<a name="module_quantum-coin-js-sdk..decodeRlp"></a>
|
|
1625
1635
|
|
|
1626
|
-
### quantum-coin-js-sdk~decodeRlp(data)
|
|
1636
|
+
### quantum-coin-js-sdk~decodeRlp(data) ⇒ <code>PackUnpackResult</code>
|
|
1627
1637
|
The decodeRlp function decodes RLP-encoded data back to a JavaScript-compatible value.
|
|
1628
1638
|
Takes a hex-encoded string and returns a JSON string representation of the decoded value.
|
|
1629
1639
|
|
|
@@ -1636,7 +1646,7 @@ Takes a hex-encoded string and returns a JSON string representation of the decod
|
|
|
1636
1646
|
|
|
1637
1647
|
<a name="module_quantum-coin-js-sdk..createAddress"></a>
|
|
1638
1648
|
|
|
1639
|
-
### quantum-coin-js-sdk~createAddress(address, nonce)
|
|
1649
|
+
### quantum-coin-js-sdk~createAddress(address, nonce) ⇒ <code>string</code> \| <code>null</code>
|
|
1640
1650
|
The createAddress function calculates the contract address that will be created by a transaction.
|
|
1641
1651
|
This uses the CREATE opcode address calculation: keccak256(RLP(sender, nonce))
|
|
1642
1652
|
|
|
@@ -1650,7 +1660,7 @@ This uses the CREATE opcode address calculation: keccak256(RLP(sender, nonce))
|
|
|
1650
1660
|
|
|
1651
1661
|
<a name="module_quantum-coin-js-sdk..createAddress2"></a>
|
|
1652
1662
|
|
|
1653
|
-
### quantum-coin-js-sdk~createAddress2(address, salt, initHash)
|
|
1663
|
+
### quantum-coin-js-sdk~createAddress2(address, salt, initHash) ⇒ <code>string</code> \| <code>null</code>
|
|
1654
1664
|
The createAddress2 function calculates the contract address using the CREATE2 opcode.
|
|
1655
1665
|
This allows deterministic contract address calculation: keccak256(0xff || sender || salt || keccak256(init_code))
|
|
1656
1666
|
|
|
@@ -366,9 +366,9 @@ qcsdk.initialize(clientConfigVal).then((initResult) => {
|
|
|
366
366
|
});
|
|
367
367
|
|
|
368
368
|
//Create a new seed word list
|
|
369
|
-
let seedWords = qcsdk.
|
|
369
|
+
let seedWords = qcsdk.newWalletSeedWords();
|
|
370
370
|
if (seedWords === null) {
|
|
371
|
-
console.error("
|
|
371
|
+
console.error("newWalletSeedWords failed");
|
|
372
372
|
return;
|
|
373
373
|
}
|
|
374
374
|
console.log ("SeedWords: " + seedWords);
|