quantumswap 0.0.1 → 0.0.2
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 +73 -53
- package/examples/README.md +46 -0
- package/examples/_test-wallet.js +3 -1
- package/examples/deploy-IERC20.js +6 -3
- package/examples/deploy-QuantumSwapV2ERC20.js +6 -3
- package/examples/deploy-QuantumSwapV2Factory.js +6 -3
- package/examples/deploy-QuantumSwapV2Pair.js +6 -3
- package/examples/deploy-QuantumSwapV2Router02.js +6 -3
- package/examples/deploy-WQ.js +6 -3
- package/examples/events-IERC20.js +6 -3
- package/examples/events-QuantumSwapV2ERC20.js +6 -3
- package/examples/events-QuantumSwapV2Factory.js +6 -3
- package/examples/events-QuantumSwapV2Pair.js +6 -3
- package/examples/events-QuantumSwapV2Router02.js +6 -3
- package/examples/events-WQ.js +6 -3
- package/examples/offline-signing-IERC20.js +6 -3
- package/examples/offline-signing-QuantumSwapV2ERC20.js +6 -3
- package/examples/offline-signing-QuantumSwapV2Factory.js +6 -3
- package/examples/offline-signing-QuantumSwapV2Pair.js +6 -3
- package/examples/offline-signing-QuantumSwapV2Router02.js +6 -3
- package/examples/offline-signing-WQ.js +6 -3
- package/examples/package-lock.json +71 -0
- package/examples/package.json +14 -0
- package/examples/read-operations-IERC20.js +6 -3
- package/examples/read-operations-QuantumSwapV2ERC20.js +6 -3
- package/examples/read-operations-QuantumSwapV2Factory.js +6 -3
- package/examples/read-operations-QuantumSwapV2Pair.js +6 -3
- package/examples/read-operations-QuantumSwapV2Router02.js +6 -3
- package/examples/read-operations-WQ.js +6 -3
- package/examples/run-dex-flow-custom.js +484 -0
- package/examples/run-dex-flow-custom.ts +546 -0
- package/examples/write-operations-IERC20.js +6 -3
- package/examples/write-operations-QuantumSwapV2ERC20.js +6 -3
- package/examples/write-operations-QuantumSwapV2Factory.js +6 -3
- package/examples/write-operations-QuantumSwapV2Pair.js +6 -3
- package/examples/write-operations-QuantumSwapV2Router02.js +6 -3
- package/examples/write-operations-WQ.js +6 -3
- package/package.json +8 -8
- package/test/e2e/dex-full-flow.e2e.test.js +232 -36
- package/examples/walkthrough-dex-full-flow.js +0 -226
- package/examples/walkthrough-dex-full-flow.ts +0 -231
package/README.md
CHANGED
|
@@ -4,11 +4,21 @@ QuantumSwap.js SDK for DEX functionality in QuantumCoin blockchain
|
|
|
4
4
|
|
|
5
5
|
> **Note:** This is an experimental SDK. Use at your own risk.
|
|
6
6
|
|
|
7
|
+
## Interacting with QuantumCoin blockchain
|
|
8
|
+
|
|
9
|
+
For general programmatic interaction with the QuantumCoin blockchain (wallets, providers, contracts, encoding, etc.), use **quantumcoin.js**:
|
|
10
|
+
|
|
11
|
+
- **npm:** [quantumcoin](https://www.npmjs.com/package/quantumcoin)
|
|
12
|
+
- **Git:** [quantumcoin.js repository](https://github.com/quantumcoinproject/quantumcoin.js) (see the npm package page for the canonical repo link)
|
|
13
|
+
|
|
14
|
+
QuantumSwap.js depends on `quantumcoin` and uses it for `Initialize`, `JsonRpcProvider`, `Wallet`, `Contract`, and related utilities. Use quantumcoin.js for all non–QuantumSwap-specific blockchain interaction.
|
|
15
|
+
|
|
16
|
+
|
|
7
17
|
## What’s in this package
|
|
8
18
|
|
|
9
|
-
- JavaScript contract wrappers and factories in
|
|
10
|
-
- Transactional tests in
|
|
11
|
-
- Example scripts in
|
|
19
|
+
- JavaScript contract wrappers and factories in [src/](https://github.com/quantumswapdex/QuantumSwap.js/tree/main/src) (TypeScript types via `.d.ts`)
|
|
20
|
+
- Transactional tests in [test/e2e/](https://github.com/quantumswapdex/QuantumSwap.js/tree/main/test/e2e)
|
|
21
|
+
- Example scripts in [examples/](https://github.com/quantumswapdex/QuantumSwap.js/tree/main/examples)
|
|
12
22
|
|
|
13
23
|
## Install
|
|
14
24
|
|
|
@@ -26,6 +36,16 @@ Transactional tests require:
|
|
|
26
36
|
- `QC_RPC_URL` (required for transactional tests)
|
|
27
37
|
- `QC_CHAIN_ID` (optional; defaults are used if omitted)
|
|
28
38
|
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
- **JavaScript:** [examples/run-dex-flow-custom.js](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/run-dex-flow-custom.js)
|
|
42
|
+
- **TypeScript:** [examples/run-dex-flow-custom.ts](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/run-dex-flow-custom.ts)
|
|
43
|
+
|
|
44
|
+
cd examples
|
|
45
|
+
npm install
|
|
46
|
+
$env:QC_RPC_URL="https://public.rpc.quantumcoiapi.com:8545" (export for Linux)
|
|
47
|
+
node run-dex-flow-custom.js
|
|
48
|
+
|
|
29
49
|
### Step by step walkthrough
|
|
30
50
|
|
|
31
51
|
This walkthrough uses **pre-deployed** WQ, V2 Factory, and Swap Router. Do **not** deploy these contracts; use the Test Release (Dec 2025) addresses below.
|
|
@@ -57,24 +77,24 @@ This walkthrough uses **pre-deployed** WQ, V2 Factory, and Swap Router. Do **not
|
|
|
57
77
|
|
|
58
78
|
Runnable scripts that perform all steps above:
|
|
59
79
|
|
|
60
|
-
- **JavaScript:** [examples/
|
|
61
|
-
- **TypeScript:** [examples/
|
|
80
|
+
- **JavaScript:** [examples/run-dex-flow-custom.js](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/run-dex-flow-custom.js)
|
|
81
|
+
- **TypeScript:** [examples/run-dex-flow-custom.ts](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/run-dex-flow-custom.ts)
|
|
62
82
|
|
|
63
83
|
Run with `QC_RPC_URL` set (and optionally `QC_CHAIN_ID`, or `QC_WALLET_JSON` + `QC_WALLET_PASSPHRASE` for your own wallet):
|
|
64
84
|
|
|
65
85
|
```bash
|
|
86
|
+
# Use https://public.rpc.quantumcoinapi.com for mainnet
|
|
87
|
+
|
|
66
88
|
# JavaScript
|
|
67
|
-
QC_RPC_URL=http://your-rpc:8545 node examples/
|
|
89
|
+
QC_RPC_URL=http://your-rpc:8545 node examples/run-dex-flow-custom.js
|
|
68
90
|
|
|
69
91
|
# TypeScript (requires typescript and ts-node: npm install -D typescript ts-node)
|
|
70
|
-
QC_RPC_URL=http://your-rpc:8545 npx ts-node examples/
|
|
92
|
+
QC_RPC_URL=http://your-rpc:8545 npx ts-node examples/run-dex-flow-custom.ts
|
|
71
93
|
```
|
|
72
94
|
|
|
73
|
-
The same flow is covered as an E2E test in [test/e2e/dex-full-flow.e2e.test.js](
|
|
74
|
-
|
|
75
|
-
## Examples
|
|
95
|
+
The same flow is covered as an E2E test in [test/e2e/dex-full-flow.e2e.test.js](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/dex-full-flow.e2e.test.js) (the test can optionally deploy WQ/Factory/Router when not using Test Release addresses).
|
|
76
96
|
|
|
77
|
-
Examples are generated per contract (e.g.
|
|
97
|
+
Examples are generated per contract (e.g. [examples/deploy-<Contract>.js](https://github.com/quantumswapdex/QuantumSwap.js/tree/main/examples)).
|
|
78
98
|
|
|
79
99
|
## Contracts
|
|
80
100
|
|
|
@@ -89,15 +109,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
89
109
|
- **Exports**: `IERC20`, `IERC20__factory`
|
|
90
110
|
- **Constructor**: `constructor()`
|
|
91
111
|
### Files
|
|
92
|
-
- [`src/IERC20.js`](
|
|
93
|
-
- [`src/IERC20__factory.js`](
|
|
112
|
+
- [`src/IERC20.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/IERC20.js)
|
|
113
|
+
- [`src/IERC20__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/IERC20__factory.js)
|
|
94
114
|
### Examples
|
|
95
|
-
- [deploy](
|
|
96
|
-
- [read operations](
|
|
97
|
-
- [write operations](
|
|
98
|
-
- [events](
|
|
115
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-IERC20.js)
|
|
116
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-IERC20.js)
|
|
117
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-IERC20.js)
|
|
118
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-IERC20.js)
|
|
99
119
|
### Tests
|
|
100
|
-
- [transactional test](
|
|
120
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/IERC20.e2e.test.js)
|
|
101
121
|
### Functions
|
|
102
122
|
- `allowance(address owner, address spender) view returns (uint256)`
|
|
103
123
|
- `approve(address spender, uint256 value) returns (bool)`
|
|
@@ -117,15 +137,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
117
137
|
- **Exports**: `QuantumSwapV2ERC20`, `QuantumSwapV2ERC20__factory`
|
|
118
138
|
- **Constructor**: `constructor()`
|
|
119
139
|
### Files
|
|
120
|
-
- [`src/QuantumSwapV2ERC20.js`](
|
|
121
|
-
- [`src/QuantumSwapV2ERC20__factory.js`](
|
|
140
|
+
- [`src/QuantumSwapV2ERC20.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2ERC20.js)
|
|
141
|
+
- [`src/QuantumSwapV2ERC20__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2ERC20__factory.js)
|
|
122
142
|
### Examples
|
|
123
|
-
- [deploy](
|
|
124
|
-
- [read operations](
|
|
125
|
-
- [write operations](
|
|
126
|
-
- [events](
|
|
143
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-QuantumSwapV2ERC20.js)
|
|
144
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-QuantumSwapV2ERC20.js)
|
|
145
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-QuantumSwapV2ERC20.js)
|
|
146
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-QuantumSwapV2ERC20.js)
|
|
127
147
|
### Tests
|
|
128
|
-
- [transactional test](
|
|
148
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/QuantumSwapV2ERC20.e2e.test.js)
|
|
129
149
|
### Functions
|
|
130
150
|
- `allowance(address, address) view returns (uint256)`
|
|
131
151
|
- `approve(address spender, uint256 value) returns (bool)`
|
|
@@ -145,15 +165,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
145
165
|
- **Exports**: `QuantumSwapV2Factory`, `QuantumSwapV2Factory__factory`
|
|
146
166
|
- **Constructor**: `constructor(address _feeToSetter)`
|
|
147
167
|
### Files
|
|
148
|
-
- [`src/QuantumSwapV2Factory.js`](
|
|
149
|
-
- [`src/QuantumSwapV2Factory__factory.js`](
|
|
168
|
+
- [`src/QuantumSwapV2Factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Factory.js)
|
|
169
|
+
- [`src/QuantumSwapV2Factory__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Factory__factory.js)
|
|
150
170
|
### Examples
|
|
151
|
-
- [deploy](
|
|
152
|
-
- [read operations](
|
|
153
|
-
- [write operations](
|
|
154
|
-
- [events](
|
|
171
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-QuantumSwapV2Factory.js)
|
|
172
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-QuantumSwapV2Factory.js)
|
|
173
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-QuantumSwapV2Factory.js)
|
|
174
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-QuantumSwapV2Factory.js)
|
|
155
175
|
### Tests
|
|
156
|
-
- [transactional test](
|
|
176
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/QuantumSwapV2Factory.e2e.test.js)
|
|
157
177
|
### Functions
|
|
158
178
|
- `allPairs(uint256) view returns (address)`
|
|
159
179
|
- `allPairsLength() view returns (uint256)`
|
|
@@ -172,15 +192,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
172
192
|
- **Exports**: `QuantumSwapV2Pair`, `QuantumSwapV2Pair__factory`
|
|
173
193
|
- **Constructor**: `constructor()`
|
|
174
194
|
### Files
|
|
175
|
-
- [`src/QuantumSwapV2Pair.js`](
|
|
176
|
-
- [`src/QuantumSwapV2Pair__factory.js`](
|
|
195
|
+
- [`src/QuantumSwapV2Pair.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Pair.js)
|
|
196
|
+
- [`src/QuantumSwapV2Pair__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Pair__factory.js)
|
|
177
197
|
### Examples
|
|
178
|
-
- [deploy](
|
|
179
|
-
- [read operations](
|
|
180
|
-
- [write operations](
|
|
181
|
-
- [events](
|
|
198
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-QuantumSwapV2Pair.js)
|
|
199
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-QuantumSwapV2Pair.js)
|
|
200
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-QuantumSwapV2Pair.js)
|
|
201
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-QuantumSwapV2Pair.js)
|
|
182
202
|
### Tests
|
|
183
|
-
- [transactional test](
|
|
203
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/QuantumSwapV2Pair.e2e.test.js)
|
|
184
204
|
### Functions
|
|
185
205
|
- `allowance(address, address) view returns (uint256)`
|
|
186
206
|
- `approve(address spender, uint256 value) returns (bool)`
|
|
@@ -218,15 +238,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
218
238
|
- **Exports**: `QuantumSwapV2Router02`, `QuantumSwapV2Router02__factory`
|
|
219
239
|
- **Constructor**: `constructor(address _factory, address _WETH)`
|
|
220
240
|
### Files
|
|
221
|
-
- [`src/QuantumSwapV2Router02.js`](
|
|
222
|
-
- [`src/QuantumSwapV2Router02__factory.js`](
|
|
241
|
+
- [`src/QuantumSwapV2Router02.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Router02.js)
|
|
242
|
+
- [`src/QuantumSwapV2Router02__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/QuantumSwapV2Router02__factory.js)
|
|
223
243
|
### Examples
|
|
224
|
-
- [deploy](
|
|
225
|
-
- [read operations](
|
|
226
|
-
- [write operations](
|
|
227
|
-
- [events](
|
|
244
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-QuantumSwapV2Router02.js)
|
|
245
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-QuantumSwapV2Router02.js)
|
|
246
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-QuantumSwapV2Router02.js)
|
|
247
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-QuantumSwapV2Router02.js)
|
|
228
248
|
### Tests
|
|
229
|
-
- [transactional test](
|
|
249
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/QuantumSwapV2Router02.e2e.test.js)
|
|
230
250
|
### Functions
|
|
231
251
|
- `addLiquidity(address tokenA, address tokenB, uint256 amountADesired, uint256 amountBDesired, uint256 amountAMin, uint256 amountBMin, address to, uint256 deadline) returns (uint256, uint256, uint256)`
|
|
232
252
|
- `addLiquidityETH(address token, uint256 amountTokenDesired, uint256 amountTokenMin, uint256 amountETHMin, address to, uint256 deadline) payable returns (uint256, uint256, uint256)`
|
|
@@ -257,15 +277,15 @@ Examples are generated per contract (e.g. `examples/deploy-<Contract>.js`).
|
|
|
257
277
|
- **Exports**: `WQ`, `WQ__factory`
|
|
258
278
|
- **Constructor**: `constructor()`
|
|
259
279
|
### Files
|
|
260
|
-
- [`src/WQ.js`](
|
|
261
|
-
- [`src/WQ__factory.js`](
|
|
280
|
+
- [`src/WQ.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/WQ.js)
|
|
281
|
+
- [`src/WQ__factory.js`](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/src/WQ__factory.js)
|
|
262
282
|
### Examples
|
|
263
|
-
- [deploy](
|
|
264
|
-
- [read operations](
|
|
265
|
-
- [write operations](
|
|
266
|
-
- [events](
|
|
283
|
+
- [deploy](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/deploy-WQ.js)
|
|
284
|
+
- [read operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/read-operations-WQ.js)
|
|
285
|
+
- [write operations](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/write-operations-WQ.js)
|
|
286
|
+
- [events](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/examples/events-WQ.js)
|
|
267
287
|
### Tests
|
|
268
|
-
- [transactional test](
|
|
288
|
+
- [transactional test](https://github.com/quantumswapdex/QuantumSwap.js/blob/main/test/e2e/WQ.e2e.test.js)
|
|
269
289
|
### Functions
|
|
270
290
|
- `allowance(address, address) view returns (uint256)`
|
|
271
291
|
- `approve(address guy, uint256 wad) returns (bool)`
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# QuantumSwap SDK Examples
|
|
2
|
+
|
|
3
|
+
This folder is a **standalone package** that depends on the QuantumSwap SDK. Examples use `quantumswap` as a dependency instead of the parent repo.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
From this directory:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd examples
|
|
11
|
+
npm install
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This installs `quantumswap` (from the parent via `file:..`) and `quantumcoin`. You can run any example from the `examples/` folder.
|
|
15
|
+
|
|
16
|
+
## Running examples
|
|
17
|
+
|
|
18
|
+
- **Full DEX flow (pre-deployed WQ/Factory/Router, deploy tokens, pair, liquidity, swap):**
|
|
19
|
+
`npm run run-dex-flow` or `node run-dex-flow-custom.js` (JS) / `npx ts-node run-dex-flow-custom.ts` (TS).
|
|
20
|
+
Set `QC_RPC_URL` (default `http://127.0.0.1:8545`), optionally `QC_CHAIN_ID`, `QC_WALLET_JSON`, `QC_WALLET_PASSPHRASE`.
|
|
21
|
+
|
|
22
|
+
- **Contract-specific examples:**
|
|
23
|
+
Deploy: `node deploy-WQ.js`, `node deploy-QuantumSwapV2Factory.js`, etc.
|
|
24
|
+
Read/events/write/offline-signing: `node read-operations-WQ.js`, `node events-WQ.js`, etc.
|
|
25
|
+
|
|
26
|
+
## Package layout
|
|
27
|
+
|
|
28
|
+
- **package.json** — `quantumswap-examples` with dependency `quantumswap` (`file:..`) and `quantumcoin`.
|
|
29
|
+
- **\_test-wallet.js** — Default test wallet helper used by examples (requires `quantumcoin`).
|
|
30
|
+
- All example scripts `require("quantumswap")` for SDK types and factories.
|
|
31
|
+
|
|
32
|
+
## Using a published SDK
|
|
33
|
+
|
|
34
|
+
To use the published npm package instead of the local repo, in `examples/package.json` change:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
"quantumswap": "file:.."
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
to:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"quantumswap": "^0.0.1"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then run `npm install` in `examples/`.
|
package/examples/_test-wallet.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Wallet } = require(parentQcPath);
|
|
2
4
|
|
|
3
5
|
// Hardcoded test wallet (test-only; never use for real funds)
|
|
4
6
|
const TEST_WALLET_ENCRYPTED_JSON =
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { IERC20__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2ERC20__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Factory__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Pair__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Router02__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
package/examples/deploy-WQ.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
3
5
|
const { createTestWallet } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { WQ__factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { IERC20 } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { QuantumSwapV2ERC20 } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { QuantumSwapV2Factory } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { QuantumSwapV2Pair } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { QuantumSwapV2Router02 } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
package/examples/events-WQ.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const {
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider } = require(parentQcPath);
|
|
5
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
6
|
+
const { WQ } = require(parentQswapPath);
|
|
4
7
|
|
|
5
8
|
async function main() {
|
|
6
9
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { IERC20__factory, IERC20 } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2ERC20__factory, QuantumSwapV2ERC20 } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Factory__factory, QuantumSwapV2Factory } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Pair__factory, QuantumSwapV2Pair } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { QuantumSwapV2Router02__factory, QuantumSwapV2Router02 } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const path = require("node:path");
|
|
2
|
+
const parentQcPath = path.join(__dirname, "..", "node_modules", "quantumcoin");
|
|
3
|
+
const { Initialize } = require(path.join(parentQcPath, "config"));
|
|
4
|
+
const { JsonRpcProvider, Wallet, getCreateAddress } = require(parentQcPath);
|
|
3
5
|
const { TEST_WALLET_ENCRYPTED_JSON, TEST_WALLET_PASSPHRASE } = require("./_test-wallet");
|
|
4
|
-
const
|
|
6
|
+
const parentQswapPath = path.join(__dirname, "..");
|
|
7
|
+
const { WQ__factory, WQ } = require(parentQswapPath);
|
|
5
8
|
|
|
6
9
|
async function main() {
|
|
7
10
|
const rpcUrl = process.env.QC_RPC_URL;
|
|
@@ -0,0 +1,71 @@
|
|
|
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.3",
|
|
12
|
+
"quantumswap": "file:.."
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"..": {
|
|
16
|
+
"name": "quantumswap",
|
|
17
|
+
"version": "0.0.2",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"quantum-coin-js-sdk": "^1.0.28",
|
|
21
|
+
"quantum-coin-pqc-js-sdk": "^1.0.5",
|
|
22
|
+
"quantumcoin": "^7.0.3",
|
|
23
|
+
"seed-words": "^1.0.2"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"ts-node": "^10.9.2",
|
|
27
|
+
"typescript": "^5.0.0"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"node_modules/quantum-coin-js-sdk": {
|
|
31
|
+
"version": "1.0.28",
|
|
32
|
+
"resolved": "https://registry.npmjs.org/quantum-coin-js-sdk/-/quantum-coin-js-sdk-1.0.28.tgz",
|
|
33
|
+
"integrity": "sha512-ok3kCoEecSWRLsFw285IDzz8Xvtc772BvBujeCasQ7G2f+Jwly6UFtjivyrh0gDPuZFwYU/hbaKvpb8OtkuM/Q==",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"quantum-coin-pqc-js-sdk": "1.0.5",
|
|
37
|
+
"seed-words": "1.0.2"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"node_modules/quantum-coin-pqc-js-sdk": {
|
|
41
|
+
"version": "1.0.5",
|
|
42
|
+
"resolved": "https://registry.npmjs.org/quantum-coin-pqc-js-sdk/-/quantum-coin-pqc-js-sdk-1.0.5.tgz",
|
|
43
|
+
"integrity": "sha512-9P1YDkca5CqrO7++TnGJZzPvYlBjYARopHgxYbDcEHgPicP7+tA8zD+DE1BooHp7sLEWF9ObklMj6AdaDUjDVw==",
|
|
44
|
+
"license": "MIT"
|
|
45
|
+
},
|
|
46
|
+
"node_modules/quantumcoin": {
|
|
47
|
+
"version": "7.0.3",
|
|
48
|
+
"resolved": "https://registry.npmjs.org/quantumcoin/-/quantumcoin-7.0.3.tgz",
|
|
49
|
+
"integrity": "sha512-czclUCSuLicRIzJSL8KoRg7eB+pC0oi+9iTsaUghkEY8OIsiuY6aOTXzCJBmgyHkqAdaM7W4++dE1KKl5EVOTw==",
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"quantum-coin-js-sdk": "^1.0.28",
|
|
53
|
+
"quantum-coin-pqc-js-sdk": "^1.0.5",
|
|
54
|
+
"seed-words": "^1.0.2"
|
|
55
|
+
},
|
|
56
|
+
"bin": {
|
|
57
|
+
"sdkgen": "generate-sdk.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"node_modules/quantumswap": {
|
|
61
|
+
"resolved": "..",
|
|
62
|
+
"link": true
|
|
63
|
+
},
|
|
64
|
+
"node_modules/seed-words": {
|
|
65
|
+
"version": "1.0.2",
|
|
66
|
+
"resolved": "https://registry.npmjs.org/seed-words/-/seed-words-1.0.2.tgz",
|
|
67
|
+
"integrity": "sha512-ia58deuPjcR8DpJ8uIgZ7gqDnIWD8vnjb4jX/sEsIDcuQaH/AJj9J8L3DXkUHfUGqAq9Y6pVMuG90t3XUJH90g==",
|
|
68
|
+
"license": "MIT"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -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.3"
|
|
13
|
+
}
|
|
14
|
+
}
|