quantumswap 0.0.1

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 (77) hide show
  1. package/.github/workflows/publish-npmjs.yaml +22 -0
  2. package/LICENSE +21 -0
  3. package/README.md +287 -0
  4. package/examples/_test-wallet.js +17 -0
  5. package/examples/deploy-IERC20.js +23 -0
  6. package/examples/deploy-QuantumSwapV2ERC20.js +23 -0
  7. package/examples/deploy-QuantumSwapV2Factory.js +23 -0
  8. package/examples/deploy-QuantumSwapV2Pair.js +23 -0
  9. package/examples/deploy-QuantumSwapV2Router02.js +23 -0
  10. package/examples/deploy-WQ.js +23 -0
  11. package/examples/events-IERC20.js +20 -0
  12. package/examples/events-QuantumSwapV2ERC20.js +20 -0
  13. package/examples/events-QuantumSwapV2Factory.js +20 -0
  14. package/examples/events-QuantumSwapV2Pair.js +20 -0
  15. package/examples/events-QuantumSwapV2Router02.js +20 -0
  16. package/examples/events-WQ.js +20 -0
  17. package/examples/offline-signing-IERC20.js +29 -0
  18. package/examples/offline-signing-QuantumSwapV2ERC20.js +29 -0
  19. package/examples/offline-signing-QuantumSwapV2Factory.js +29 -0
  20. package/examples/offline-signing-QuantumSwapV2Pair.js +29 -0
  21. package/examples/offline-signing-QuantumSwapV2Router02.js +29 -0
  22. package/examples/offline-signing-WQ.js +29 -0
  23. package/examples/read-operations-IERC20.js +19 -0
  24. package/examples/read-operations-QuantumSwapV2ERC20.js +19 -0
  25. package/examples/read-operations-QuantumSwapV2Factory.js +19 -0
  26. package/examples/read-operations-QuantumSwapV2Pair.js +19 -0
  27. package/examples/read-operations-QuantumSwapV2Router02.js +19 -0
  28. package/examples/read-operations-WQ.js +19 -0
  29. package/examples/walkthrough-dex-full-flow.js +226 -0
  30. package/examples/walkthrough-dex-full-flow.ts +231 -0
  31. package/examples/write-operations-IERC20.js +22 -0
  32. package/examples/write-operations-QuantumSwapV2ERC20.js +22 -0
  33. package/examples/write-operations-QuantumSwapV2Factory.js +22 -0
  34. package/examples/write-operations-QuantumSwapV2Pair.js +22 -0
  35. package/examples/write-operations-QuantumSwapV2Router02.js +22 -0
  36. package/examples/write-operations-WQ.js +22 -0
  37. package/index.d.ts +1 -0
  38. package/index.js +45 -0
  39. package/package.json +35 -0
  40. package/src/IERC20.d.ts +24 -0
  41. package/src/IERC20.js +348 -0
  42. package/src/IERC20__factory.d.ts +10 -0
  43. package/src/IERC20__factory.js +29 -0
  44. package/src/QuantumSwapV2ERC20.d.ts +24 -0
  45. package/src/QuantumSwapV2ERC20.js +353 -0
  46. package/src/QuantumSwapV2ERC20__factory.d.ts +10 -0
  47. package/src/QuantumSwapV2ERC20__factory.js +29 -0
  48. package/src/QuantumSwapV2Factory.d.ts +24 -0
  49. package/src/QuantumSwapV2Factory.js +310 -0
  50. package/src/QuantumSwapV2Factory__factory.d.ts +10 -0
  51. package/src/QuantumSwapV2Factory__factory.js +29 -0
  52. package/src/QuantumSwapV2Pair.d.ts +44 -0
  53. package/src/QuantumSwapV2Pair.js +847 -0
  54. package/src/QuantumSwapV2Pair__factory.d.ts +10 -0
  55. package/src/QuantumSwapV2Pair__factory.js +29 -0
  56. package/src/QuantumSwapV2Router02.d.ts +47 -0
  57. package/src/QuantumSwapV2Router02.js +1109 -0
  58. package/src/QuantumSwapV2Router02__factory.d.ts +10 -0
  59. package/src/QuantumSwapV2Router02__factory.js +29 -0
  60. package/src/WQ.d.ts +28 -0
  61. package/src/WQ.js +435 -0
  62. package/src/WQ__factory.d.ts +10 -0
  63. package/src/WQ__factory.js +29 -0
  64. package/src/index.d.ts +14 -0
  65. package/src/index.js +15 -0
  66. package/src/quantumcoin-shims.d.ts +25 -0
  67. package/src/types.d.ts +3 -0
  68. package/src/types.js +3 -0
  69. package/test/e2e/IERC20.e2e.test.js +79 -0
  70. package/test/e2e/QuantumSwapV2ERC20.e2e.test.js +79 -0
  71. package/test/e2e/QuantumSwapV2Factory.e2e.test.js +79 -0
  72. package/test/e2e/QuantumSwapV2Pair.e2e.test.js +79 -0
  73. package/test/e2e/QuantumSwapV2Router02.e2e.test.js +79 -0
  74. package/test/e2e/WQ.e2e.test.js +79 -0
  75. package/test/e2e/all-contracts.e2e.test.js +103 -0
  76. package/test/e2e/dex-full-flow.e2e.test.js +353 -0
  77. package/tsconfig.json +14 -0
@@ -0,0 +1,10 @@
1
+ // Auto-generated by sdkgen
2
+ import { ContractFactory, ContractRunner } from "quantumcoin";
3
+ import { QuantumSwapV2Pair } from "./QuantumSwapV2Pair";
4
+ import type * as Types from "./types";
5
+
6
+ export declare class QuantumSwapV2Pair__factory extends ContractFactory {
7
+ constructor(runner: ContractRunner);
8
+ deploy(overrides?: any): Promise<QuantumSwapV2Pair>;
9
+ static connect(address: string, runner?: ContractRunner): QuantumSwapV2Pair;
10
+ }
@@ -0,0 +1,29 @@
1
+ // Auto-generated by sdkgen
2
+ const { ContractFactory, getCreateAddress } = require("quantumcoin");
3
+ const { QuantumSwapV2Pair } = require("./QuantumSwapV2Pair");
4
+
5
+ class QuantumSwapV2Pair__factory extends ContractFactory {
6
+ constructor(runner) {
7
+ super(QuantumSwapV2Pair.abi, QuantumSwapV2Pair.bytecode, runner);
8
+ }
9
+
10
+ async deploy(overrides) {
11
+ const signer = this.signer;
12
+ if (!signer) { throw new Error("missing signer"); }
13
+ const from = signer.getAddress ? await signer.getAddress() : signer.address;
14
+ const provider = signer.provider;
15
+ if (!provider || !provider.getTransactionCount) { throw new Error("missing provider"); }
16
+ let nonce;
17
+ try { nonce = await provider.getTransactionCount(from, "pending"); } catch { nonce = await provider.getTransactionCount(from, "latest"); }
18
+ const address = getCreateAddress({ from, nonce });
19
+ const txReq = this.getDeployTransaction();
20
+ const tx = await signer.sendTransaction({ ...txReq, ...(overrides || {}), nonce });
21
+ return new QuantumSwapV2Pair(address, signer, tx);
22
+ }
23
+
24
+ static connect(address, runner) {
25
+ return QuantumSwapV2Pair.connect(address, runner);
26
+ }
27
+ }
28
+
29
+ module.exports = { QuantumSwapV2Pair__factory };
@@ -0,0 +1,47 @@
1
+ // Auto-generated by sdkgen
2
+ import { Contract, ContractRunner, ContractTransactionResponse, TransactionResponse } from "quantumcoin";
3
+ import type * as Types from "./types";
4
+
5
+ export declare class QuantumSwapV2Router02 extends Contract {
6
+ static readonly abi: readonly any[];
7
+ static readonly bytecode: string;
8
+ static connect(address: string, runner?: ContractRunner): QuantumSwapV2Router02;
9
+ constructor(address: string, runner?: ContractRunner, _deployTx?: TransactionResponse);
10
+ readonly populateTransaction: {
11
+ addLiquidity(tokenA: Types.AddressLike, tokenB: Types.AddressLike, amountADesired: Types.Uint256Like, amountBDesired: Types.Uint256Like, amountAMin: Types.Uint256Like, amountBMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
12
+ addLiquidityETH(token: Types.AddressLike, amountTokenDesired: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
13
+ removeLiquidity(tokenA: Types.AddressLike, tokenB: Types.AddressLike, liquidity: Types.Uint256Like, amountAMin: Types.Uint256Like, amountBMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
14
+ removeLiquidityETH(token: Types.AddressLike, liquidity: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
15
+ removeLiquidityETHSupportingFeeOnTransferTokens(token: Types.AddressLike, liquidity: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
16
+ swapETHForExactTokens(amountOut: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
17
+ swapExactETHForTokens(amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
18
+ swapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
19
+ swapExactTokensForETH(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
20
+ swapExactTokensForETHSupportingFeeOnTransferTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
21
+ swapExactTokensForTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
22
+ swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
23
+ swapTokensForExactETH(amountOut: Types.Uint256Like, amountInMax: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
24
+ swapTokensForExactTokens(amountOut: Types.Uint256Like, amountInMax: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<import("quantumcoin").TransactionRequest>;
25
+ };
26
+ WETH(): Promise<Types.SolAddress>;
27
+ addLiquidity(tokenA: Types.AddressLike, tokenB: Types.AddressLike, amountADesired: Types.Uint256Like, amountBDesired: Types.Uint256Like, amountAMin: Types.Uint256Like, amountBMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
28
+ addLiquidityETH(token: Types.AddressLike, amountTokenDesired: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
29
+ factory(): Promise<Types.SolAddress>;
30
+ getAmountIn(amountOut: Types.Uint256Like, reserveIn: Types.Uint256Like, reserveOut: Types.Uint256Like): Promise<Types.Uint256>;
31
+ getAmountOut(amountIn: Types.Uint256Like, reserveIn: Types.Uint256Like, reserveOut: Types.Uint256Like): Promise<Types.Uint256>;
32
+ getAmountsIn(amountOut: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>): Promise<Types.SolArray<Types.Uint256>>;
33
+ getAmountsOut(amountIn: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>): Promise<Types.SolArray<Types.Uint256>>;
34
+ quote(amountA: Types.Uint256Like, reserveA: Types.Uint256Like, reserveB: Types.Uint256Like): Promise<Types.Uint256>;
35
+ removeLiquidity(tokenA: Types.AddressLike, tokenB: Types.AddressLike, liquidity: Types.Uint256Like, amountAMin: Types.Uint256Like, amountBMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
36
+ removeLiquidityETH(token: Types.AddressLike, liquidity: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
37
+ removeLiquidityETHSupportingFeeOnTransferTokens(token: Types.AddressLike, liquidity: Types.Uint256Like, amountTokenMin: Types.Uint256Like, amountETHMin: Types.Uint256Like, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
38
+ swapETHForExactTokens(amountOut: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
39
+ swapExactETHForTokens(amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
40
+ swapExactETHForTokensSupportingFeeOnTransferTokens(amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
41
+ swapExactTokensForETH(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
42
+ swapExactTokensForETHSupportingFeeOnTransferTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
43
+ swapExactTokensForTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
44
+ swapExactTokensForTokensSupportingFeeOnTransferTokens(amountIn: Types.Uint256Like, amountOutMin: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
45
+ swapTokensForExactETH(amountOut: Types.Uint256Like, amountInMax: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
46
+ swapTokensForExactTokens(amountOut: Types.Uint256Like, amountInMax: Types.Uint256Like, path: Types.SolArray<Types.AddressLike>, to: Types.AddressLike, deadline: Types.Uint256Like, overrides?: any): Promise<ContractTransactionResponse>;
47
+ }