quantumcoin 7.0.3 → 7.0.4
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/.github/workflows/publish-npmjs.yaml +22 -22
- package/.gitignore +15 -15
- package/LICENSE +21 -21
- package/README-SDK.md +756 -754
- package/README.md +165 -150
- package/SPEC.md +3845 -3843
- package/config.d.ts +50 -50
- package/config.js +115 -115
- package/examples/AllSolidityTypes.sol +184 -184
- package/examples/SimpleIERC20.sol +74 -74
- package/examples/events.js +41 -35
- package/examples/events.ts +35 -0
- package/examples/example-generator-sdk-js.js +100 -95
- package/examples/example-generator-sdk-js.ts +77 -0
- package/examples/example-generator-sdk-ts.js +100 -95
- package/examples/example-generator-sdk-ts.ts +77 -0
- package/examples/example.js +72 -61
- package/examples/example.ts +61 -0
- package/examples/offline-signing.js +79 -73
- package/examples/offline-signing.ts +66 -0
- package/examples/package-lock.json +48 -57
- package/examples/package.json +32 -16
- package/examples/read-operations.js +32 -27
- package/examples/read-operations.ts +31 -0
- package/examples/sdk-generator-erc20.inline.json +251 -251
- package/examples/solidity-types.ts +43 -43
- package/examples/wallet-offline.js +35 -29
- package/examples/wallet-offline.ts +34 -0
- package/generate-sdk.js +1824 -1490
- package/index.js +12 -12
- package/package.json +95 -75
- package/scripts/copy-declarations.js +31 -0
- package/scripts/run-all-one-by-one.js +151 -0
- package/src/abi/fragments.d.ts +42 -42
- package/src/abi/fragments.js +63 -63
- package/src/abi/index.d.ts +13 -13
- package/src/abi/index.js +9 -9
- package/src/abi/interface.d.ts +128 -132
- package/src/abi/interface.js +590 -590
- package/src/abi/js-abi-coder.d.ts +8 -0
- package/src/abi/js-abi-coder.js +474 -474
- package/src/constants.d.ts +66 -61
- package/src/constants.js +101 -94
- package/src/contract/contract-factory.d.ts +28 -28
- package/src/contract/contract-factory.js +105 -105
- package/src/contract/contract.d.ts +113 -114
- package/src/contract/contract.js +354 -354
- package/src/contract/index.d.ts +9 -9
- package/src/contract/index.js +9 -9
- package/src/errors/index.d.ts +92 -92
- package/src/errors/index.js +188 -188
- package/src/generator/index.d.ts +74 -0
- package/src/generator/index.js +1404 -1404
- package/src/index.d.ts +125 -127
- package/src/index.js +41 -41
- package/src/internal/hex.d.ts +61 -61
- package/src/internal/hex.js +144 -144
- package/src/providers/extra-providers.d.ts +139 -128
- package/src/providers/extra-providers.js +600 -575
- package/src/providers/index.d.ts +17 -16
- package/src/providers/index.js +10 -10
- package/src/providers/json-rpc-provider.d.ts +12 -12
- package/src/providers/json-rpc-provider.js +79 -79
- package/src/providers/provider.d.ts +207 -203
- package/src/providers/provider.js +392 -371
- package/src/types/index.d.ts +214 -462
- package/src/types/index.js +9 -9
- package/src/utils/address.d.ts +72 -72
- package/src/utils/address.js +181 -182
- package/src/utils/encoding.d.ts +120 -120
- package/src/utils/encoding.js +306 -306
- package/src/utils/hashing.d.ts +82 -76
- package/src/utils/hashing.js +313 -298
- package/src/utils/index.d.ts +65 -55
- package/src/utils/index.js +13 -13
- package/src/utils/result.d.ts +57 -57
- package/src/utils/result.js +128 -128
- package/src/utils/rlp.d.ts +12 -12
- package/src/utils/rlp.js +200 -200
- package/src/utils/units.d.ts +29 -29
- package/src/utils/units.js +107 -107
- package/src/wallet/index.d.ts +10 -10
- package/src/wallet/index.js +8 -8
- package/src/wallet/wallet.d.ts +160 -160
- package/src/wallet/wallet.js +483 -489
- package/test/e2e/all-solidity-types.dynamic.test.js +207 -200
- package/test/e2e/all-solidity-types.dynamic.test.ts +191 -0
- package/test/e2e/all-solidity-types.fixtures.js +231 -231
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +387 -368
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +350 -0
- package/test/e2e/helpers.js +59 -47
- package/test/e2e/signing-context-and-fee.e2e.test.js +137 -0
- package/test/e2e/signing-context-and-fee.e2e.test.ts +128 -0
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.js +168 -151
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +141 -0
- package/test/e2e/transactional.test.js +245 -191
- package/test/e2e/transactional.test.ts +208 -0
- package/test/e2e/typed-generator.e2e.test.js +407 -404
- package/test/e2e/typed-generator.e2e.test.ts +337 -0
- package/test/fixtures/ConstructorParam.sol +23 -23
- package/test/fixtures/MultiContracts.sol +37 -37
- package/test/fixtures/SimpleStorage.sol +18 -18
- package/test/fixtures/StakingContract.abi.json +1 -1
- package/test/integration/ipc-provider.test.js +49 -44
- package/test/integration/ipc-provider.test.ts +44 -0
- package/test/integration/provider.test.js +88 -72
- package/test/integration/provider.test.ts +85 -0
- package/test/integration/ws-provider.test.js +41 -33
- package/test/integration/ws-provider.test.ts +38 -0
- package/test/security/malformed-input.test.js +37 -31
- package/test/security/malformed-input.test.ts +35 -0
- package/test/unit/_encrypted-output.txt +6 -0
- package/test/unit/_log-encrypted-jsons.js +45 -0
- package/test/unit/_write-keystore-fixture.js +16 -0
- package/test/unit/abi-interface.test.js +103 -98
- package/test/unit/abi-interface.test.ts +102 -0
- package/test/unit/address-wallet.test.js +355 -257
- package/test/unit/address-wallet.test.ts +342 -0
- package/test/unit/browser-provider.test.js +85 -82
- package/test/unit/browser-provider.test.ts +79 -0
- package/test/unit/contract.test.js +85 -82
- package/test/unit/contract.test.ts +83 -0
- package/test/unit/encoding-units-rlp.test.js +92 -89
- package/test/unit/encoding-units-rlp.test.ts +91 -0
- package/test/unit/errors.test.js +77 -74
- package/test/unit/errors.test.ts +76 -0
- package/test/unit/filter-by-blockhash.test.js +55 -52
- package/test/unit/filter-by-blockhash.test.ts +54 -0
- package/test/unit/fixtures/encrypted-keystores-48-32-36.js +9 -0
- package/test/unit/generate-contract-cli.test.js +42 -39
- package/test/unit/generate-contract-cli.test.ts +41 -0
- package/test/unit/generate-sdk-artifacts-json.test.js +113 -110
- package/test/unit/generate-sdk-artifacts-json.test.ts +110 -0
- package/test/unit/generator.test.js +102 -99
- package/test/unit/generator.test.ts +101 -0
- package/test/unit/hashing.test.js +68 -54
- package/test/unit/hashing.test.ts +67 -0
- package/test/unit/init.test.js +39 -36
- package/test/unit/init.test.ts +38 -0
- package/test/unit/interface.test.js +56 -53
- package/test/unit/interface.test.ts +54 -0
- package/test/unit/internal-hex.test.js +50 -47
- package/test/unit/internal-hex.test.ts +49 -0
- package/test/unit/populate-transaction.test.js +65 -62
- package/test/unit/populate-transaction.test.ts +64 -0
- package/test/unit/providers.test.js +200 -144
- package/test/unit/providers.test.ts +196 -0
- package/test/unit/result.test.js +80 -77
- package/test/unit/result.test.ts +79 -0
- package/test/unit/solidity-types.test.js +49 -46
- package/test/unit/solidity-types.test.ts +39 -0
- package/test/unit/utils.test.js +57 -54
- package/test/unit/utils.test.ts +56 -0
- package/test/verbose-logger.js +74 -0
- package/tsconfig.build.json +14 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @testCategory e2e
|
|
3
|
+
* @blockchainRequired write
|
|
4
|
+
* @transactional true
|
|
5
|
+
* End-to-end test for the typed contract generator.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, it } from "node:test";
|
|
9
|
+
import assert from "node:assert/strict";
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import os from "node:os";
|
|
13
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
import { getRpcUrl, getChainId, getSolcPath, assertSolcExists, logE2eConfig } from "./helpers";
|
|
16
|
+
import { logSuite, logTest } from "../verbose-logger";
|
|
17
|
+
|
|
18
|
+
function getNpmCmd(): string {
|
|
19
|
+
return process.platform === "win32" ? "npm.cmd" : "npm";
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function run(cmd: string, args: string[], cwd: string, env: NodeJS.ProcessEnv): { status: number | null; stdout: string; stderr: string; error?: Error } {
|
|
23
|
+
const res = spawnSync(cmd, args, {
|
|
24
|
+
cwd,
|
|
25
|
+
env,
|
|
26
|
+
encoding: "utf8",
|
|
27
|
+
stdio: "pipe",
|
|
28
|
+
shell: false,
|
|
29
|
+
windowsHide: true,
|
|
30
|
+
});
|
|
31
|
+
if (res.error) throw res.error;
|
|
32
|
+
return res;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function _quoteIfNeeded(s: unknown): string {
|
|
36
|
+
if (typeof s !== "string") return String(s);
|
|
37
|
+
return /[ \t"]/g.test(s) ? `"${s.replace(/"/g, '\\"')}"` : s;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function runNpm(args: string[], cwd: string, env: NodeJS.ProcessEnv) {
|
|
41
|
+
if (process.platform === "win32") {
|
|
42
|
+
const cmd = `${getNpmCmd()} ${args.map(_quoteIfNeeded).join(" ")}`;
|
|
43
|
+
return run("cmd.exe", ["/d", "/s", "/c", cmd], cwd, env);
|
|
44
|
+
}
|
|
45
|
+
return run(getNpmCmd(), args, cwd, env);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function compileSolidity({ solcPath, solPath, contractName }: { solcPath: string; solPath: string; contractName: string }) {
|
|
49
|
+
const out = execFileSync(solcPath, ["--optimize", "--combined-json", "abi,bin", solPath], { encoding: "utf8" });
|
|
50
|
+
const parsed = JSON.parse(out);
|
|
51
|
+
const key = Object.keys(parsed.contracts || {}).find((k) => k.endsWith(`:${contractName}`));
|
|
52
|
+
if (!key) throw new Error(`Compiled contract ${contractName} not found in solc output`);
|
|
53
|
+
const c = parsed.contracts[key];
|
|
54
|
+
const abi = JSON.parse(c.abi);
|
|
55
|
+
const bin = c.bin || "";
|
|
56
|
+
return { abi, bin };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe("typed contract generator package e2e", () => {
|
|
60
|
+
it("generates a package and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
|
|
61
|
+
logSuite("typed contract generator package e2e");
|
|
62
|
+
logTest("generates a package and runs its transactional tests", {});
|
|
63
|
+
const rpcUrl = getRpcUrl();
|
|
64
|
+
if (!rpcUrl) {
|
|
65
|
+
t.skip("QC_RPC_URL not provided");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
logE2eConfig();
|
|
69
|
+
const chainId = getChainId();
|
|
70
|
+
const solcPath = getSolcPath();
|
|
71
|
+
assertSolcExists(solcPath);
|
|
72
|
+
|
|
73
|
+
const repoRoot = path.resolve(__dirname, "..", "..");
|
|
74
|
+
const fixtureSol = path.join(repoRoot, "test", "fixtures", "ConstructorParam.sol");
|
|
75
|
+
const contractName = "ConstructorParam";
|
|
76
|
+
|
|
77
|
+
const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-"));
|
|
78
|
+
const pkgName = `qcgen-${Date.now()}`;
|
|
79
|
+
const pkgDir = tmpBase;
|
|
80
|
+
const pkgRoot = path.join(pkgDir, pkgName);
|
|
81
|
+
|
|
82
|
+
let succeeded = false;
|
|
83
|
+
try {
|
|
84
|
+
const { abi, bin } = compileSolidity({ solcPath, solPath: fixtureSol, contractName });
|
|
85
|
+
|
|
86
|
+
const abiPath = path.join(tmpBase, `${contractName}.abi.json`);
|
|
87
|
+
const binPath = path.join(tmpBase, `${contractName}.bin`);
|
|
88
|
+
fs.writeFileSync(abiPath, JSON.stringify(abi, null, 2), "utf8");
|
|
89
|
+
fs.writeFileSync(binPath, bin.trim().startsWith("0x") ? bin.trim() : `0x${bin.trim()}`, "utf8");
|
|
90
|
+
|
|
91
|
+
const generatorCli = path.join(repoRoot, "generate-sdk.js");
|
|
92
|
+
const gen = run(
|
|
93
|
+
process.execPath,
|
|
94
|
+
[
|
|
95
|
+
generatorCli,
|
|
96
|
+
"--abi", abiPath,
|
|
97
|
+
"--bin", binPath,
|
|
98
|
+
"--name", contractName,
|
|
99
|
+
"--create-package",
|
|
100
|
+
"--package-dir", pkgDir,
|
|
101
|
+
"--package-name", pkgName,
|
|
102
|
+
"--package-description", "Temporary typed-contract package generated by quantumcoin.js e2e tests",
|
|
103
|
+
"--package-author", "quantumcoin.js test",
|
|
104
|
+
"--package-license", "MIT",
|
|
105
|
+
"--package-version", "0.0.1",
|
|
106
|
+
"--non-interactive",
|
|
107
|
+
],
|
|
108
|
+
repoRoot,
|
|
109
|
+
process.env,
|
|
110
|
+
);
|
|
111
|
+
assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
|
|
112
|
+
|
|
113
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "package.json")));
|
|
114
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "tsconfig.json")));
|
|
115
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", `${contractName}.ts`)));
|
|
116
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", `${contractName}__factory.ts`)));
|
|
117
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", `${contractName}.e2e.test.js`)));
|
|
118
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy.js")));
|
|
119
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "read-operations.js")));
|
|
120
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "write-operations.js")));
|
|
121
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "events.js")));
|
|
122
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
|
|
123
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
|
|
124
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
|
|
125
|
+
|
|
126
|
+
const readme = fs.readFileSync(path.join(pkgRoot, "README.md"), "utf8");
|
|
127
|
+
assert.ok(readme.includes(contractName));
|
|
128
|
+
|
|
129
|
+
if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
|
|
130
|
+
const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
|
|
131
|
+
assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
|
|
135
|
+
const testRun = runNpm(["test"], pkgRoot, env);
|
|
136
|
+
assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
|
|
137
|
+
|
|
138
|
+
succeeded = true;
|
|
139
|
+
} finally {
|
|
140
|
+
if (succeeded) {
|
|
141
|
+
fs.rmSync(tmpBase, { recursive: true, force: true });
|
|
142
|
+
} else {
|
|
143
|
+
console.error("Generated package kept at:", pkgRoot);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}, { timeout: 1_800_000 });
|
|
147
|
+
|
|
148
|
+
it("generates a package from artifacts JSON input (multiple contracts) and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
|
|
149
|
+
const rpcUrl = getRpcUrl();
|
|
150
|
+
if (!rpcUrl) {
|
|
151
|
+
t.skip("QC_RPC_URL not provided");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const chainId = getChainId();
|
|
156
|
+
const solcPath = getSolcPath();
|
|
157
|
+
assertSolcExists(solcPath);
|
|
158
|
+
|
|
159
|
+
const repoRoot = path.resolve(__dirname, "..", "..");
|
|
160
|
+
const fixtureCtorSol = path.join(repoRoot, "test", "fixtures", "ConstructorParam.sol");
|
|
161
|
+
const fixtureMultiSol = path.join(repoRoot, "test", "fixtures", "MultiContracts.sol");
|
|
162
|
+
|
|
163
|
+
const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-json-"));
|
|
164
|
+
const pkgName = `qcgen-json-${Date.now()}`;
|
|
165
|
+
const pkgDir = tmpBase;
|
|
166
|
+
const pkgRoot = path.join(pkgDir, pkgName);
|
|
167
|
+
|
|
168
|
+
let succeeded = false;
|
|
169
|
+
try {
|
|
170
|
+
const ctorName = "ConstructorParam";
|
|
171
|
+
const alphaName = "Alpha";
|
|
172
|
+
|
|
173
|
+
const { abi: ctorAbi, bin: ctorBin } = compileSolidity({ solcPath, solPath: fixtureCtorSol, contractName: ctorName });
|
|
174
|
+
const { abi: alphaAbi, bin: alphaBin } = compileSolidity({ solcPath, solPath: fixtureMultiSol, contractName: alphaName });
|
|
175
|
+
|
|
176
|
+
const ctorAbiPath = path.join(tmpBase, `${ctorName}.abi.json`);
|
|
177
|
+
const ctorBinPath = path.join(tmpBase, `${ctorName}.bin`);
|
|
178
|
+
fs.writeFileSync(ctorAbiPath, JSON.stringify(ctorAbi, null, 2), "utf8");
|
|
179
|
+
fs.writeFileSync(ctorBinPath, ctorBin.trim().startsWith("0x") ? ctorBin.trim() : `0x${ctorBin.trim()}`, "utf8");
|
|
180
|
+
|
|
181
|
+
const alphaAbiPath = path.join(tmpBase, `${alphaName}.abi.json`);
|
|
182
|
+
const alphaBinPath = path.join(tmpBase, `${alphaName}.bin`);
|
|
183
|
+
fs.writeFileSync(alphaAbiPath, JSON.stringify(alphaAbi, null, 2), "utf8");
|
|
184
|
+
fs.writeFileSync(alphaBinPath, alphaBin.trim().startsWith("0x") ? alphaBin.trim() : `0x${alphaBin.trim()}`, "utf8");
|
|
185
|
+
|
|
186
|
+
const artifactsJsonPath = path.join(tmpBase, "artifacts.json");
|
|
187
|
+
fs.writeFileSync(
|
|
188
|
+
artifactsJsonPath,
|
|
189
|
+
JSON.stringify(
|
|
190
|
+
[
|
|
191
|
+
{ abi: path.basename(alphaAbiPath), bin: path.basename(alphaBinPath) },
|
|
192
|
+
{ abi: path.basename(ctorAbiPath), bin: path.basename(ctorBinPath) },
|
|
193
|
+
],
|
|
194
|
+
null,
|
|
195
|
+
2,
|
|
196
|
+
),
|
|
197
|
+
"utf8",
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const generatorCli = path.join(repoRoot, "generate-sdk.js");
|
|
201
|
+
const gen = run(
|
|
202
|
+
process.execPath,
|
|
203
|
+
[
|
|
204
|
+
generatorCli,
|
|
205
|
+
"--artifacts-json", artifactsJsonPath,
|
|
206
|
+
"--create-package",
|
|
207
|
+
"--package-dir", pkgDir,
|
|
208
|
+
"--package-name", pkgName,
|
|
209
|
+
"--package-description", "Temporary typed-contract package generated from artifacts JSON input",
|
|
210
|
+
"--package-author", "quantumcoin.js test",
|
|
211
|
+
"--package-license", "MIT",
|
|
212
|
+
"--package-version", "0.0.1",
|
|
213
|
+
"--non-interactive",
|
|
214
|
+
],
|
|
215
|
+
repoRoot,
|
|
216
|
+
process.env,
|
|
217
|
+
);
|
|
218
|
+
assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
|
|
219
|
+
|
|
220
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha.ts")));
|
|
221
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha__factory.ts")));
|
|
222
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "ConstructorParam.ts")));
|
|
223
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "ConstructorParam__factory.ts")));
|
|
224
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "index.ts")));
|
|
225
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
|
|
226
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
|
|
227
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
|
|
228
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Alpha.e2e.test.js")));
|
|
229
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "ConstructorParam.e2e.test.js")));
|
|
230
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "all-contracts.e2e.test.js")));
|
|
231
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy-Alpha.js")));
|
|
232
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "examples", "deploy-ConstructorParam.js")));
|
|
233
|
+
|
|
234
|
+
const readme = fs.readFileSync(path.join(pkgRoot, "README.md"), "utf8");
|
|
235
|
+
assert.ok(readme.includes("Alpha"));
|
|
236
|
+
assert.ok(readme.includes("ConstructorParam"));
|
|
237
|
+
|
|
238
|
+
if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
|
|
239
|
+
const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
|
|
240
|
+
assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
|
|
244
|
+
const testRun = runNpm(["test"], pkgRoot, env);
|
|
245
|
+
assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
|
|
246
|
+
|
|
247
|
+
succeeded = true;
|
|
248
|
+
} finally {
|
|
249
|
+
if (succeeded) {
|
|
250
|
+
fs.rmSync(tmpBase, { recursive: true, force: true });
|
|
251
|
+
} else {
|
|
252
|
+
console.error("Generated package kept at:", pkgRoot);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, { timeout: 1_800_000 });
|
|
256
|
+
|
|
257
|
+
it("generates a package from Solidity input (multiple contracts) and runs its transactional tests", async (t: { skip: (msg: string) => void }) => {
|
|
258
|
+
const rpcUrl = getRpcUrl();
|
|
259
|
+
if (!rpcUrl) {
|
|
260
|
+
t.skip("QC_RPC_URL not provided");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const chainId = getChainId();
|
|
265
|
+
const solcPath = getSolcPath();
|
|
266
|
+
assertSolcExists(solcPath);
|
|
267
|
+
|
|
268
|
+
const repoRoot = path.resolve(__dirname, "..", "..");
|
|
269
|
+
const fixtureSol = path.join(repoRoot, "test", "fixtures", "MultiContracts.sol");
|
|
270
|
+
|
|
271
|
+
const tmpBase = fs.mkdtempSync(path.join(os.tmpdir(), "qcgen-sol-"));
|
|
272
|
+
const pkgName = `qcgen-sol-${Date.now()}`;
|
|
273
|
+
const pkgDir = tmpBase;
|
|
274
|
+
const pkgRoot = path.join(pkgDir, pkgName);
|
|
275
|
+
|
|
276
|
+
let succeeded = false;
|
|
277
|
+
try {
|
|
278
|
+
const generatorCli = path.join(repoRoot, "generate-sdk.js");
|
|
279
|
+
const gen = run(
|
|
280
|
+
process.execPath,
|
|
281
|
+
[
|
|
282
|
+
generatorCli,
|
|
283
|
+
"--sol", fixtureSol,
|
|
284
|
+
"--solc", solcPath,
|
|
285
|
+
"--create-package",
|
|
286
|
+
"--package-dir", pkgDir,
|
|
287
|
+
"--package-name", pkgName,
|
|
288
|
+
"--package-description", "Temporary typed-contract package generated from Solidity input",
|
|
289
|
+
"--package-author", "quantumcoin.js test",
|
|
290
|
+
"--package-license", "MIT",
|
|
291
|
+
"--package-version", "0.0.1",
|
|
292
|
+
"--non-interactive",
|
|
293
|
+
],
|
|
294
|
+
repoRoot,
|
|
295
|
+
process.env,
|
|
296
|
+
);
|
|
297
|
+
assert.equal(gen.status, 0, `generator failed:\n${gen.stdout}\n${gen.stderr}`);
|
|
298
|
+
|
|
299
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha.ts")));
|
|
300
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Alpha__factory.ts")));
|
|
301
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Beta.ts")));
|
|
302
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "Beta__factory.ts")));
|
|
303
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "src", "index.ts")));
|
|
304
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.js")));
|
|
305
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "index.d.ts")));
|
|
306
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "README.md")));
|
|
307
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Alpha.abi.json")));
|
|
308
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Alpha.bin")));
|
|
309
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Beta.abi.json")));
|
|
310
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "artifacts", "Beta.bin")));
|
|
311
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Alpha.e2e.test.js")));
|
|
312
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "Beta.e2e.test.js")));
|
|
313
|
+
assert.ok(fs.existsSync(path.join(pkgRoot, "test", "e2e", "all-contracts.e2e.test.js")));
|
|
314
|
+
|
|
315
|
+
const alphaTs = fs.readFileSync(path.join(pkgRoot, "src", "Alpha.ts"), "utf8");
|
|
316
|
+
assert.ok(alphaTs.includes("Alpha contract for multi-contract generator test."));
|
|
317
|
+
assert.ok(alphaTs.includes("Set a new value in Alpha."));
|
|
318
|
+
|
|
319
|
+
if (!fs.existsSync(path.join(pkgRoot, "node_modules"))) {
|
|
320
|
+
const install = runNpm(["install", "--no-fund", "--no-audit"], pkgRoot, process.env);
|
|
321
|
+
assert.equal(install.status, 0, `npm install failed:\n${install.stdout}\n${install.stderr}`);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const env = { ...process.env, QC_RPC_URL: rpcUrl, QC_CHAIN_ID: String(chainId) };
|
|
325
|
+
const testRun = runNpm(["test"], pkgRoot, env);
|
|
326
|
+
assert.equal(testRun.status, 0, `generated package tests failed:\n${testRun.stdout}\n${testRun.stderr}`);
|
|
327
|
+
|
|
328
|
+
succeeded = true;
|
|
329
|
+
} finally {
|
|
330
|
+
if (succeeded) {
|
|
331
|
+
fs.rmSync(tmpBase, { recursive: true, force: true });
|
|
332
|
+
} else {
|
|
333
|
+
console.error("Generated package kept at:", pkgRoot);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}, { timeout: 1_800_000 });
|
|
337
|
+
});
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @title ConstructorParam
|
|
6
|
-
* @notice Example contract used by generator E2E tests.
|
|
7
|
-
*/
|
|
8
|
-
contract ConstructorParam {
|
|
9
|
-
uint256 public value;
|
|
10
|
-
|
|
11
|
-
event ValueChanged(uint256 newValue);
|
|
12
|
-
|
|
13
|
-
constructor(uint256 initialValue) {
|
|
14
|
-
value = initialValue;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/// @notice Set a new stored value.
|
|
18
|
-
function set(uint256 newValue) public {
|
|
19
|
-
value = newValue;
|
|
20
|
-
emit ValueChanged(newValue);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @title ConstructorParam
|
|
6
|
+
* @notice Example contract used by generator E2E tests.
|
|
7
|
+
*/
|
|
8
|
+
contract ConstructorParam {
|
|
9
|
+
uint256 public value;
|
|
10
|
+
|
|
11
|
+
event ValueChanged(uint256 newValue);
|
|
12
|
+
|
|
13
|
+
constructor(uint256 initialValue) {
|
|
14
|
+
value = initialValue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/// @notice Set a new stored value.
|
|
18
|
+
function set(uint256 newValue) public {
|
|
19
|
+
value = newValue;
|
|
20
|
+
emit ValueChanged(newValue);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @title Alpha
|
|
6
|
-
* @notice Alpha contract for multi-contract generator test.
|
|
7
|
-
*/
|
|
8
|
-
contract Alpha {
|
|
9
|
-
uint256 public value;
|
|
10
|
-
|
|
11
|
-
constructor(uint256 initialValue) {
|
|
12
|
-
value = initialValue;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/// @notice Set a new value in Alpha.
|
|
16
|
-
function set(uint256 newValue) public {
|
|
17
|
-
value = newValue;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @title Beta
|
|
23
|
-
* @notice Beta contract for multi-contract generator test.
|
|
24
|
-
*/
|
|
25
|
-
contract Beta {
|
|
26
|
-
uint256 public value;
|
|
27
|
-
|
|
28
|
-
constructor(uint256 initialValue) {
|
|
29
|
-
value = initialValue;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/// @notice Set a new value in Beta.
|
|
33
|
-
function set(uint256 newValue) public {
|
|
34
|
-
value = newValue;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @title Alpha
|
|
6
|
+
* @notice Alpha contract for multi-contract generator test.
|
|
7
|
+
*/
|
|
8
|
+
contract Alpha {
|
|
9
|
+
uint256 public value;
|
|
10
|
+
|
|
11
|
+
constructor(uint256 initialValue) {
|
|
12
|
+
value = initialValue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/// @notice Set a new value in Alpha.
|
|
16
|
+
function set(uint256 newValue) public {
|
|
17
|
+
value = newValue;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @title Beta
|
|
23
|
+
* @notice Beta contract for multi-contract generator test.
|
|
24
|
+
*/
|
|
25
|
+
contract Beta {
|
|
26
|
+
uint256 public value;
|
|
27
|
+
|
|
28
|
+
constructor(uint256 initialValue) {
|
|
29
|
+
value = initialValue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// @notice Set a new value in Beta.
|
|
33
|
+
function set(uint256 newValue) public {
|
|
34
|
+
value = newValue;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
-
|
|
4
|
-
contract SimpleStorage {
|
|
5
|
-
uint256 private storedValue;
|
|
6
|
-
|
|
7
|
-
event ValueChanged(uint256 newValue);
|
|
8
|
-
|
|
9
|
-
function set(uint256 value) public {
|
|
10
|
-
storedValue = value;
|
|
11
|
-
emit ValueChanged(value);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function get() public view returns (uint256) {
|
|
15
|
-
return storedValue;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// NOTE: Intentionally no `pragma` to allow compilation with different solc versions.
|
|
3
|
+
|
|
4
|
+
contract SimpleStorage {
|
|
5
|
+
uint256 private storedValue;
|
|
6
|
+
|
|
7
|
+
event ValueChanged(uint256 newValue);
|
|
8
|
+
|
|
9
|
+
function set(uint256 value) public {
|
|
10
|
+
storedValue = value;
|
|
11
|
+
emit ValueChanged(value);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function get() public view returns (uint256) {
|
|
15
|
+
return storedValue;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"oldValidatorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"OnChangeValidator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnCompletePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"netBalance","type":"uint256"}],"name":"OnCompleteWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"OnIncreaseDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnInitiatePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"validatorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTime","type":"uint256"}],"name":"OnNewDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnPauseValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnResumeValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"OnReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"slashedAmount","type":"uint256"}],"name":"OnSlashing","type":"event"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"addDepositorReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"slashAmount","type":"uint256"}],"name":"addDepositorSlashing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"changeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completeWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"didDepositorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"didValidatorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"doesDepositorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"doesValidatorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getDepositorOfValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorSlashings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getNetBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getStakingDetails","outputs":[{"components":[{"internalType":"address","name":"Depositor","type":"address"},{"internalType":"address","name":"Validator","type":"address"},{"internalType":"uint256","name":"Balance","type":"uint256"},{"internalType":"uint256","name":"NetBalance","type":"uint256"},{"internalType":"uint256","name":"BlockRewards","type":"uint256"},{"internalType":"uint256","name":"Slashings","type":"uint256"},{"internalType":"bool","name":"IsValidationPaused","type":"bool"},{"internalType":"uint256","name":"WithdrawalBlock","type":"uint256"},{"internalType":"uint256","name":"WithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"LastNilBlockNumber","type":"uint256"},{"internalType":"uint256","name":"NilBlockCount","type":"uint256"}],"internalType":"struct IStakingContract.StakingDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDepositedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getValidatorOfDepositor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getWithdrawalBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increaseDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"initiatePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"isValidationPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listValidators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"newDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pauseValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"resetNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resumeValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"setNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
|
1
|
+
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"oldValidatorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"OnChangeValidator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnCompletePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"netBalance","type":"uint256"}],"name":"OnCompleteWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"OnIncreaseDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"withdrawalBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"withdrawalQuantity","type":"uint256"}],"name":"OnInitiatePartialWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":true,"internalType":"address","name":"validatorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockNumber","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"blockTime","type":"uint256"}],"name":"OnNewDeposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnPauseValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"address","name":"validatorAddress","type":"address"}],"name":"OnResumeValidation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"OnReward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"depositorAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"slashedAmount","type":"uint256"}],"name":"OnSlashing","type":"event"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"addDepositorReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"},{"internalType":"uint256","name":"slashAmount","type":"uint256"}],"name":"addDepositorSlashing","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newValidatorAddress","type":"address"}],"name":"changeValidator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"completeWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"didDepositorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"didValidatorEverExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"doesDepositorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"doesValidatorExist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDepositorCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getDepositorOfValidator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getDepositorSlashings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getNetBalanceOfDepositor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"getStakingDetails","outputs":[{"components":[{"internalType":"address","name":"Depositor","type":"address"},{"internalType":"address","name":"Validator","type":"address"},{"internalType":"uint256","name":"Balance","type":"uint256"},{"internalType":"uint256","name":"NetBalance","type":"uint256"},{"internalType":"uint256","name":"BlockRewards","type":"uint256"},{"internalType":"uint256","name":"Slashings","type":"uint256"},{"internalType":"bool","name":"IsValidationPaused","type":"bool"},{"internalType":"uint256","name":"WithdrawalBlock","type":"uint256"},{"internalType":"uint256","name":"WithdrawalAmount","type":"uint256"},{"internalType":"uint256","name":"LastNilBlockNumber","type":"uint256"},{"internalType":"uint256","name":"NilBlockCount","type":"uint256"}],"internalType":"struct IStakingContract.StakingDetails","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalDepositedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getValidatorOfDepositor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"depositorAddress","type":"address"}],"name":"getWithdrawalBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"increaseDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"initiatePartialWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"isValidationPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"listValidators","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"newDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"pauseValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"resetNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resumeValidation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"validatorAddress","type":"address"}],"name":"setNilBlock","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|