quantumswap 0.0.1 → 0.0.3

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.
Files changed (47) hide show
  1. package/README.md +73 -53
  2. package/examples/README.md +46 -0
  3. package/examples/deploy-IERC20.js +5 -3
  4. package/examples/deploy-QuantumSwapV2ERC20.js +5 -3
  5. package/examples/deploy-QuantumSwapV2Factory.js +5 -3
  6. package/examples/deploy-QuantumSwapV2Pair.js +5 -3
  7. package/examples/deploy-QuantumSwapV2Router02.js +5 -3
  8. package/examples/deploy-WQ.js +5 -3
  9. package/examples/events-IERC20.js +5 -3
  10. package/examples/events-QuantumSwapV2ERC20.js +5 -3
  11. package/examples/events-QuantumSwapV2Factory.js +5 -3
  12. package/examples/events-QuantumSwapV2Pair.js +5 -3
  13. package/examples/events-QuantumSwapV2Router02.js +5 -3
  14. package/examples/events-WQ.js +5 -3
  15. package/examples/offline-signing-IERC20.js +5 -3
  16. package/examples/offline-signing-QuantumSwapV2ERC20.js +5 -3
  17. package/examples/offline-signing-QuantumSwapV2Factory.js +5 -3
  18. package/examples/offline-signing-QuantumSwapV2Pair.js +5 -3
  19. package/examples/offline-signing-QuantumSwapV2Router02.js +5 -3
  20. package/examples/offline-signing-WQ.js +5 -3
  21. package/examples/package-lock.json +62 -0
  22. package/examples/package.json +14 -0
  23. package/examples/read-operations-IERC20.js +5 -3
  24. package/examples/read-operations-QuantumSwapV2ERC20.js +5 -3
  25. package/examples/read-operations-QuantumSwapV2Factory.js +5 -3
  26. package/examples/read-operations-QuantumSwapV2Pair.js +5 -3
  27. package/examples/read-operations-QuantumSwapV2Router02.js +5 -3
  28. package/examples/read-operations-WQ.js +5 -3
  29. package/examples/run-dex-flow-custom.js +493 -0
  30. package/examples/run-dex-flow-custom.ts +556 -0
  31. package/examples/write-operations-IERC20.js +5 -3
  32. package/examples/write-operations-QuantumSwapV2ERC20.js +5 -3
  33. package/examples/write-operations-QuantumSwapV2Factory.js +5 -3
  34. package/examples/write-operations-QuantumSwapV2Pair.js +5 -3
  35. package/examples/write-operations-QuantumSwapV2Router02.js +5 -3
  36. package/examples/write-operations-WQ.js +5 -3
  37. package/package.json +8 -9
  38. package/test/e2e/IERC20.e2e.test.js +2 -2
  39. package/test/e2e/QuantumSwapV2ERC20.e2e.test.js +2 -2
  40. package/test/e2e/QuantumSwapV2Factory.e2e.test.js +2 -2
  41. package/test/e2e/QuantumSwapV2Pair.e2e.test.js +2 -2
  42. package/test/e2e/QuantumSwapV2Router02.e2e.test.js +2 -2
  43. package/test/e2e/WQ.e2e.test.js +2 -2
  44. package/test/e2e/all-contracts.e2e.test.js +103 -72
  45. package/test/e2e/dex-full-flow.e2e.test.js +276 -47
  46. package/examples/walkthrough-dex-full-flow.js +0 -226
  47. package/examples/walkthrough-dex-full-flow.ts +0 -231
@@ -1,7 +1,9 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider, Wallet, getCreateAddress } = require("quantumcoin");
3
+ const { getProvider, Wallet, getCreateAddress } = require("quantumcoin");
3
4
  const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
4
- const { WQ__factory, WQ } = require("..");
5
+ const parentQswapPath = path.join(__dirname, "..");
6
+ const { WQ__factory, WQ } = require(parentQswapPath);
5
7
 
6
8
  async function main() {
7
9
  const rpcUrl = process.env.QC_RPC_URL;
@@ -9,7 +11,7 @@ async function main() {
9
11
  const chainId = process.env.QC_CHAIN_ID ? Number(process.env.QC_CHAIN_ID) : 123123;
10
12
  await Initialize(null);
11
13
 
12
- const provider = new JsonRpcProvider(rpcUrl, chainId);
14
+ const provider = getProvider(rpcUrl, chainId);
13
15
  const wallet = Wallet.fromEncryptedJsonSync(TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE);
14
16
  const from = wallet.address;
15
17
 
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "quantumswap-examples",
3
+ "version": "0.0.1",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "quantumswap-examples",
9
+ "version": "0.0.1",
10
+ "dependencies": {
11
+ "quantumcoin": "7.0.4",
12
+ "quantumswap": "file:.."
13
+ }
14
+ },
15
+ "..": {
16
+ "name": "quantumswap",
17
+ "version": "0.0.3",
18
+ "license": "MIT",
19
+ "dependencies": {
20
+ "quantum-coin-js-sdk": "^1.0.31",
21
+ "quantumcoin": "^7.0.4",
22
+ "seed-words": "^1.0.2"
23
+ },
24
+ "devDependencies": {
25
+ "ts-node": "^10.9.2",
26
+ "typescript": "^5.0.0"
27
+ }
28
+ },
29
+ "node_modules/quantum-coin-js-sdk": {
30
+ "version": "1.0.31",
31
+ "resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.31.tgz",
32
+ "integrity": "sha512-enXV7IrUSi8Rjxd4xkoTMmQ9C49ev75FPzu+UbJuzo7D4og/FpD7Ycu1xkLau9cQl/YJFzN9MV+F0/GIoPEG4Q==",
33
+ "license": "MIT",
34
+ "dependencies": {
35
+ "seed-words": "1.0.2"
36
+ }
37
+ },
38
+ "node_modules/quantumcoin": {
39
+ "version": "7.0.4",
40
+ "resolved": "https://registry.npmjs.org/quantumcoin/-/quantumcoin-7.0.4.tgz",
41
+ "integrity": "sha512-pQvdnzDKqIxaB4EalILgga5FZxxliV9VedR33eNIB6iAnzqeJPARt4b78Zwe8yN5ZNQDfRJ41SyXpZJjW1lXNA==",
42
+ "license": "MIT",
43
+ "dependencies": {
44
+ "quantum-coin-js-sdk": "1.0.31",
45
+ "seed-words": "^1.0.2"
46
+ },
47
+ "bin": {
48
+ "sdkgen": "generate-sdk.js"
49
+ }
50
+ },
51
+ "node_modules/quantumswap": {
52
+ "resolved": "..",
53
+ "link": true
54
+ },
55
+ "node_modules/seed-words": {
56
+ "version": "1.0.2",
57
+ "resolved": "https://registry.npmjs.org/seed-words/-/seed-words-1.0.2.tgz",
58
+ "integrity": "sha512-ia58deuPjcR8DpJ8uIgZ7gqDnIWD8vnjb4jX/sEsIDcuQaH/AJj9J8L3DXkUHfUGqAq9Y6pVMuG90t3XUJH90g==",
59
+ "license": "MIT"
60
+ }
61
+ }
62
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "quantumswap-examples",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "description": "Example scripts for QuantumSwap SDK (DEX on QuantumCoin)",
6
+ "scripts": {
7
+ "run-dex-flow": "node run-dex-flow-custom.js",
8
+ "run-dex-flow:ts": "npx ts-node run-dex-flow-custom.ts"
9
+ },
10
+ "dependencies": {
11
+ "quantumswap": "file:..",
12
+ "quantumcoin": "7.0.4"
13
+ }
14
+ }
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { IERC20 } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { IERC20 } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = IERC20.connect(address, provider);
15
17
 
16
18
  console.log("IERC20:", contract.target);
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { QuantumSwapV2ERC20 } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { QuantumSwapV2ERC20 } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = QuantumSwapV2ERC20.connect(address, provider);
15
17
 
16
18
  console.log("QuantumSwapV2ERC20:", contract.target);
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { QuantumSwapV2Factory } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { QuantumSwapV2Factory } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = QuantumSwapV2Factory.connect(address, provider);
15
17
 
16
18
  console.log("QuantumSwapV2Factory:", contract.target);
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { QuantumSwapV2Pair } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { QuantumSwapV2Pair } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = QuantumSwapV2Pair.connect(address, provider);
15
17
 
16
18
  console.log("QuantumSwapV2Pair:", contract.target);
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { QuantumSwapV2Router02 } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { QuantumSwapV2Router02 } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = QuantumSwapV2Router02.connect(address, provider);
15
17
 
16
18
  console.log("QuantumSwapV2Router02:", contract.target);
@@ -1,6 +1,8 @@
1
+ const path = require("node:path");
1
2
  const { Initialize } = require("quantumcoin/config");
2
- const { JsonRpcProvider } = require("quantumcoin");
3
- const { WQ } = require("..");
3
+ const { getProvider } = require("quantumcoin");
4
+ const parentQswapPath = path.join(__dirname, "..");
5
+ const { WQ } = require(parentQswapPath);
4
6
 
5
7
  async function main() {
6
8
  const rpcUrl = process.env.QC_RPC_URL;
@@ -10,7 +12,7 @@ async function main() {
10
12
  if (!address) throw new Error("CONTRACT_ADDRESS is required");
11
13
  await Initialize(null);
12
14
 
13
- const provider = new JsonRpcProvider(rpcUrl, chainId);
15
+ const provider = getProvider(rpcUrl, chainId);
14
16
  const contract = WQ.connect(address, provider);
15
17
 
16
18
  console.log("WQ:", contract.target);