quantum-coin-js-sdk 1.0.20 → 1.0.21

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 CHANGED
Binary file
@@ -0,0 +1,43 @@
1
+ const qcsdk = require('quantum-coin-js-sdk');
2
+
3
+ var clientConfigVal = new qcsdk.Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //Mainnet
4
+
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
+
19
+ //Initialize the SDK
20
+ qcsdk.initialize(clientConfigVal).then((initResult) => {
21
+ if (initResult === false) {
22
+ console.error("Initialize failed");
23
+ return;
24
+ }
25
+
26
+ let examplePassphrase = "helloworld123";
27
+
28
+ //Save to an encrypted wallet that can then be restored into an external wallet application such as Desktop/Web/CLI/Mobile wallet
29
+ let walletObj2 = qcsdk.newWallet();
30
+ let walletEncryptedJson2 = qcsdk.serializeEncryptedWallet(walletObj2, examplePassphrase);
31
+ if (walletEncryptedJson2 === null) {
32
+ throw new Error("serializeEncryptedWallet failed");
33
+ }
34
+ let walletEncryptedJson3 = qcsdk.serializeEncryptedWallet(walletObj2, examplePassphrase);
35
+ if (walletEncryptedJson3 === null) {
36
+ throw new Error("serializeEncryptedWallet failed");
37
+ }
38
+ console.log("Serialized wallet A: " + walletEncryptedJson2); //just an example for demonstration, do not actually log to console
39
+ console.log("Serialized wallet B: " + walletEncryptedJson3); //just an example for demonstration, do not actually log to console
40
+
41
+
42
+ });
43
+
@@ -15,9 +15,10 @@
15
15
  }
16
16
  },
17
17
  "..": {
18
- "version": "1.0.20",
18
+ "version": "1.0.21",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
+ "jsdoc-to-markdown": "^9.1.2",
21
22
  "quantum-coin-pqc-js-sdk": "^1.0.0",
22
23
  "seed-words": "^1.0.1"
23
24
  }
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * @async
5
5
  * @function initialize
6
- * @param {Config} clientConfig - A configuration represented by the Config class
6
+ * @param {Config} clientConfig - A configuration represented by the Config class. A default configuration is used, if not specified.
7
7
  * @return {Promise<boolean>} Returns a promise of type boolean; true if the initialization succeeded, else false.
8
8
  */
9
9
  export function initialize(clientConfig: Config): Promise<boolean>;
package/index.js CHANGED
@@ -694,15 +694,19 @@ async function InitAccountsWebAssembly() {
694
694
  *
695
695
  * @async
696
696
  * @function initialize
697
- * @param {Config} clientConfig - A configuration represented by the Config class
697
+ * @param {Config} clientConfig - A configuration represented by the Config class. A default configuration is used, if not specified.
698
698
  * @return {Promise<boolean>} Returns a promise of type boolean; true if the initialization succeeded, else false.
699
699
  */
700
700
  async function initialize(clientConfig) {
701
701
  if (isInitialized === true) {
702
702
  return false;
703
703
  }
704
- if (clientConfig === null || clientConfig.readUrl === null || clientConfig.writeUrl === null || clientConfig.chainId === null) {
705
- return false;
704
+ if (clientConfig === null || clientConfig === undefined) {
705
+ clientConfig = Config("https://sdk.readrelay.quantumcoinapi.com", "https://sdk.writerelay.quantumcoinapi.com", 123123, "", ""); //default
706
+ } else {
707
+ if (clientConfig.readUrl === null || clientConfig.writeUrl === null || clientConfig.chainId === null) {
708
+ return false;
709
+ }
706
710
  }
707
711
  await InitAccountsWebAssembly();
708
712
  config = clientConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quantum-coin-js-sdk",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Quantum Coin - Q SDK in JavaScript",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "homepage": "https://github.com/quantumcoinproject/quantum-coin-js-sdk#readme",
31
31
  "dependencies": {
32
+ "jsdoc-to-markdown": "^9.1.2",
32
33
  "quantum-coin-pqc-js-sdk": "^1.0.0",
33
34
  "seed-words": "^1.0.1"
34
35
  }