quantumcoin 7.0.2 → 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 -756
- package/README.md +165 -152
- package/SPEC.md +3845 -3845
- 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 -0
- 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 -1383
- 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 -105
- package/src/contract/contract.js +354 -312
- 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 -1201
- 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 -196
- package/src/providers/provider.js +392 -359
- 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 -361
- 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 -144
- 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 -402
- 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 -98
- 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 -0
- 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
package/src/providers/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
declare const _exports: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
getProvider(endpoint?: string | undefined, chainId?: number | undefined): import("./provider").AbstractProvider;
|
|
3
|
+
WebSocketProvider: typeof import("./extra-providers").WebSocketProvider;
|
|
4
|
+
IpcSocketProvider: typeof import("./extra-providers").IpcSocketProvider;
|
|
5
|
+
BrowserProvider: typeof import("./extra-providers").BrowserProvider;
|
|
6
|
+
FallbackProvider: typeof import("./extra-providers").FallbackProvider;
|
|
7
|
+
FilterByBlockHash: typeof import("./extra-providers").FilterByBlockHash;
|
|
8
|
+
JsonRpcProvider: typeof import("./json-rpc-provider").JsonRpcProvider;
|
|
9
|
+
JsonRpcApiProvider: typeof import("./json-rpc-provider").JsonRpcApiProvider;
|
|
10
|
+
Provider: typeof import("./provider").Provider;
|
|
11
|
+
AbstractProvider: typeof import("./provider").AbstractProvider;
|
|
12
|
+
Block: typeof import("./provider").Block;
|
|
13
|
+
TransactionResponse: typeof import("./provider").TransactionResponse;
|
|
14
|
+
TransactionReceipt: typeof import("./provider").TransactionReceipt;
|
|
15
|
+
Log: typeof import("./provider").Log;
|
|
16
|
+
};
|
|
17
|
+
export = _exports;
|
package/src/providers/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Provider exports.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
...require("./provider"),
|
|
7
|
-
...require("./json-rpc-provider"),
|
|
8
|
-
...require("./extra-providers"),
|
|
9
|
-
};
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Provider exports.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
...require("./provider"),
|
|
7
|
+
...require("./json-rpc-provider"),
|
|
8
|
+
...require("./extra-providers"),
|
|
9
|
+
};
|
|
10
|
+
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export class JsonRpcProvider extends AbstractProvider {
|
|
2
|
-
/**
|
|
3
|
-
* @param {string=} url RPC endpoint (defaults to Config.rpcEndpoint or https://public.rpc.quantumcoinapi.com)
|
|
4
|
-
* @param {number=} chainId Chain ID (defaults to 123123)
|
|
5
|
-
*/
|
|
6
|
-
constructor(url?: string | undefined, chainId?: number | undefined);
|
|
7
|
-
url: string;
|
|
8
|
-
chainId: number;
|
|
9
|
-
}
|
|
10
|
-
export class JsonRpcApiProvider extends JsonRpcProvider {
|
|
11
|
-
}
|
|
12
|
-
import { AbstractProvider } from "./provider";
|
|
1
|
+
export class JsonRpcProvider extends AbstractProvider {
|
|
2
|
+
/**
|
|
3
|
+
* @param {string=} url RPC endpoint (defaults to Config.rpcEndpoint or https://public.rpc.quantumcoinapi.com)
|
|
4
|
+
* @param {number=} chainId Chain ID (defaults to 123123)
|
|
5
|
+
*/
|
|
6
|
+
constructor(url?: string | undefined, chainId?: number | undefined);
|
|
7
|
+
url: string;
|
|
8
|
+
chainId: number;
|
|
9
|
+
}
|
|
10
|
+
export class JsonRpcApiProvider extends JsonRpcProvider {
|
|
11
|
+
}
|
|
12
|
+
import { AbstractProvider } from "./provider";
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview JsonRpcProvider implementation.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const { AbstractProvider } = require("./provider");
|
|
6
|
-
const { makeError } = require("../errors");
|
|
7
|
-
const { Config, getConfig, isInitialized } = require("../../config");
|
|
8
|
-
|
|
9
|
-
let _rpcId = 1;
|
|
10
|
-
|
|
11
|
-
class JsonRpcProvider extends AbstractProvider {
|
|
12
|
-
/**
|
|
13
|
-
* @param {string=} url RPC endpoint (defaults to Config.rpcEndpoint or https://public.rpc.quantumcoinapi.com)
|
|
14
|
-
* @param {number=} chainId Chain ID (defaults to 123123)
|
|
15
|
-
*/
|
|
16
|
-
constructor(url, chainId) {
|
|
17
|
-
super();
|
|
18
|
-
// If not provided, attempt to use initialized config.js defaults.
|
|
19
|
-
const active = isInitialized() ? getConfig() : null;
|
|
20
|
-
const cfg = active || new Config();
|
|
21
|
-
this.url = url || cfg.rpcEndpoint;
|
|
22
|
-
this.chainId = chainId == null ? cfg.chainId : chainId;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Internal JSON-RPC call.
|
|
27
|
-
* @param {string} method
|
|
28
|
-
* @param {any[]=} params
|
|
29
|
-
* @returns {Promise<any>}
|
|
30
|
-
*/
|
|
31
|
-
async _perform(method, params) {
|
|
32
|
-
const id = _rpcId++;
|
|
33
|
-
const body = JSON.stringify({
|
|
34
|
-
jsonrpc: "2.0",
|
|
35
|
-
id,
|
|
36
|
-
method,
|
|
37
|
-
params: params || [],
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const controller = new AbortController();
|
|
41
|
-
const timeout = setTimeout(() => controller.abort(), 30_000);
|
|
42
|
-
try {
|
|
43
|
-
const resp = await fetch(this.url, {
|
|
44
|
-
method: "POST",
|
|
45
|
-
headers: { "content-type": "application/json" },
|
|
46
|
-
body,
|
|
47
|
-
signal: controller.signal,
|
|
48
|
-
});
|
|
49
|
-
const json = await resp.json().catch(() => null);
|
|
50
|
-
if (!resp.ok) {
|
|
51
|
-
throw makeError("JSON-RPC HTTP error", "UNKNOWN_ERROR", {
|
|
52
|
-
status: resp.status,
|
|
53
|
-
statusText: resp.statusText,
|
|
54
|
-
method,
|
|
55
|
-
url: this.url,
|
|
56
|
-
body: json || null,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
if (!json) throw makeError("invalid JSON-RPC response", "UNKNOWN_ERROR", { method });
|
|
60
|
-
if (json.error) {
|
|
61
|
-
throw makeError("JSON-RPC error", "UNKNOWN_ERROR", { method, error: json.error });
|
|
62
|
-
}
|
|
63
|
-
return json.result;
|
|
64
|
-
} catch (e) {
|
|
65
|
-
if (e && e.name === "AbortError") {
|
|
66
|
-
throw makeError("JSON-RPC request timeout", "UNKNOWN_ERROR", { method, url: this.url });
|
|
67
|
-
}
|
|
68
|
-
throw e;
|
|
69
|
-
} finally {
|
|
70
|
-
clearTimeout(timeout);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// In ethers v6 this is a base for specific API providers; we alias for compatibility.
|
|
76
|
-
class JsonRpcApiProvider extends JsonRpcProvider {}
|
|
77
|
-
|
|
78
|
-
module.exports = { JsonRpcProvider, JsonRpcApiProvider };
|
|
79
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview JsonRpcProvider implementation.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { AbstractProvider } = require("./provider");
|
|
6
|
+
const { makeError } = require("../errors");
|
|
7
|
+
const { Config, getConfig, isInitialized } = require("../../config");
|
|
8
|
+
|
|
9
|
+
let _rpcId = 1;
|
|
10
|
+
|
|
11
|
+
class JsonRpcProvider extends AbstractProvider {
|
|
12
|
+
/**
|
|
13
|
+
* @param {string=} url RPC endpoint (defaults to Config.rpcEndpoint or https://public.rpc.quantumcoinapi.com)
|
|
14
|
+
* @param {number=} chainId Chain ID (defaults to 123123)
|
|
15
|
+
*/
|
|
16
|
+
constructor(url, chainId) {
|
|
17
|
+
super();
|
|
18
|
+
// If not provided, attempt to use initialized config.js defaults.
|
|
19
|
+
const active = isInitialized() ? getConfig() : null;
|
|
20
|
+
const cfg = active || new Config();
|
|
21
|
+
this.url = url || cfg.rpcEndpoint;
|
|
22
|
+
this.chainId = chainId == null ? cfg.chainId : chainId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal JSON-RPC call.
|
|
27
|
+
* @param {string} method
|
|
28
|
+
* @param {any[]=} params
|
|
29
|
+
* @returns {Promise<any>}
|
|
30
|
+
*/
|
|
31
|
+
async _perform(method, params) {
|
|
32
|
+
const id = _rpcId++;
|
|
33
|
+
const body = JSON.stringify({
|
|
34
|
+
jsonrpc: "2.0",
|
|
35
|
+
id,
|
|
36
|
+
method,
|
|
37
|
+
params: params || [],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const controller = new AbortController();
|
|
41
|
+
const timeout = setTimeout(() => controller.abort(), 30_000);
|
|
42
|
+
try {
|
|
43
|
+
const resp = await fetch(this.url, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { "content-type": "application/json" },
|
|
46
|
+
body,
|
|
47
|
+
signal: controller.signal,
|
|
48
|
+
});
|
|
49
|
+
const json = await resp.json().catch(() => null);
|
|
50
|
+
if (!resp.ok) {
|
|
51
|
+
throw makeError("JSON-RPC HTTP error", "UNKNOWN_ERROR", {
|
|
52
|
+
status: resp.status,
|
|
53
|
+
statusText: resp.statusText,
|
|
54
|
+
method,
|
|
55
|
+
url: this.url,
|
|
56
|
+
body: json || null,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (!json) throw makeError("invalid JSON-RPC response", "UNKNOWN_ERROR", { method });
|
|
60
|
+
if (json.error) {
|
|
61
|
+
throw makeError("JSON-RPC error", "UNKNOWN_ERROR", { method, error: json.error });
|
|
62
|
+
}
|
|
63
|
+
return json.result;
|
|
64
|
+
} catch (e) {
|
|
65
|
+
if (e && e.name === "AbortError") {
|
|
66
|
+
throw makeError("JSON-RPC request timeout", "UNKNOWN_ERROR", { method, url: this.url });
|
|
67
|
+
}
|
|
68
|
+
throw e;
|
|
69
|
+
} finally {
|
|
70
|
+
clearTimeout(timeout);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// In ethers v6 this is a base for specific API providers; we alias for compatibility.
|
|
76
|
+
class JsonRpcApiProvider extends JsonRpcProvider {}
|
|
77
|
+
|
|
78
|
+
module.exports = { JsonRpcProvider, JsonRpcApiProvider };
|
|
79
|
+
|
|
@@ -1,196 +1,207 @@
|
|
|
1
|
-
export type BytesLike = import("../
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* @
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* @
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
* @
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
* @
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* @param {
|
|
112
|
-
* @
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
1
|
+
export type BytesLike = import("../utils/encoding").BytesLike;
|
|
2
|
+
export type TransactionRequest = {
|
|
3
|
+
to?: string | undefined;
|
|
4
|
+
from?: string | undefined;
|
|
5
|
+
value?: (bigint | string | number) | undefined;
|
|
6
|
+
data?: string | undefined;
|
|
7
|
+
gasLimit?: (bigint | string | number) | undefined;
|
|
8
|
+
gasPrice?: (bigint | string | number) | undefined;
|
|
9
|
+
nonce?: number | undefined;
|
|
10
|
+
chainId?: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Optional remark field (hex, max 32 bytes)
|
|
13
|
+
*/
|
|
14
|
+
remarks?: string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Optional signing context (0, 1, 2, or null). Passed to SDK TransactionSigningRequest; default null.
|
|
17
|
+
*/
|
|
18
|
+
signingContext?: (number | null) | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type Filter = {
|
|
21
|
+
address?: (string | string[]) | undefined;
|
|
22
|
+
topics?: (string | string[] | null)[] | undefined;
|
|
23
|
+
fromBlock?: (number | string) | undefined;
|
|
24
|
+
toBlock?: (number | string) | undefined;
|
|
25
|
+
blockHash?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Base Provider class.
|
|
29
|
+
*/
|
|
30
|
+
export class Provider {
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* AbstractProvider base class (ethers-like).
|
|
34
|
+
*/
|
|
35
|
+
export class AbstractProvider extends Provider {
|
|
36
|
+
/**
|
|
37
|
+
* Implemented by subclasses to perform JSON-RPC.
|
|
38
|
+
* @param {string} method
|
|
39
|
+
* @param {any[]=} params
|
|
40
|
+
* @returns {Promise<any>}
|
|
41
|
+
*/
|
|
42
|
+
_perform(method: string, params?: any[] | undefined): Promise<any>;
|
|
43
|
+
getBlockNumber(): Promise<number>;
|
|
44
|
+
/**
|
|
45
|
+
* @param {number|"latest"} blockNumber
|
|
46
|
+
* @returns {Promise<Block>}
|
|
47
|
+
*/
|
|
48
|
+
getBlock(blockNumber: number | "latest"): Promise<Block>;
|
|
49
|
+
/**
|
|
50
|
+
* @param {string} txHash
|
|
51
|
+
* @returns {Promise<TransactionResponse>}
|
|
52
|
+
*/
|
|
53
|
+
getTransaction(txHash: string): Promise<TransactionResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* @param {string} txHash
|
|
56
|
+
* @returns {Promise<TransactionReceipt>}
|
|
57
|
+
*/
|
|
58
|
+
getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
|
|
59
|
+
/**
|
|
60
|
+
* @param {string} address
|
|
61
|
+
* @returns {Promise<bigint>}
|
|
62
|
+
*/
|
|
63
|
+
getBalance(address: string): Promise<bigint>;
|
|
64
|
+
/**
|
|
65
|
+
* @param {string} address
|
|
66
|
+
* @param {string=} blockTag
|
|
67
|
+
* @returns {Promise<number>}
|
|
68
|
+
*/
|
|
69
|
+
getTransactionCount(address: string, blockTag?: string | undefined): Promise<number>;
|
|
70
|
+
/**
|
|
71
|
+
* Broadcasts a signed transaction.
|
|
72
|
+
* @param {TransactionRequest|string} tx
|
|
73
|
+
* @returns {Promise<TransactionResponse>}
|
|
74
|
+
*/
|
|
75
|
+
sendTransaction(tx: TransactionRequest | string): Promise<TransactionResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Broadcast a signed raw transaction.
|
|
78
|
+
* Alias of sendTransaction(rawTx) for clarity when doing offline signing flows.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} rawTx
|
|
81
|
+
* @returns {Promise<TransactionResponse>}
|
|
82
|
+
*/
|
|
83
|
+
sendRawTransaction(rawTx: string): Promise<TransactionResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Perform a call (read-only) and return hex data.
|
|
86
|
+
* @param {TransactionRequest} tx
|
|
87
|
+
* @param {string=} blockTag
|
|
88
|
+
* @returns {Promise<string>}
|
|
89
|
+
*/
|
|
90
|
+
call(tx: TransactionRequest, blockTag?: string | undefined): Promise<string>;
|
|
91
|
+
/**
|
|
92
|
+
* Estimate gas for a call/transaction.
|
|
93
|
+
* @param {TransactionRequest} tx
|
|
94
|
+
* @returns {Promise<bigint>}
|
|
95
|
+
*/
|
|
96
|
+
estimateGas(tx: TransactionRequest): Promise<bigint>;
|
|
97
|
+
/**
|
|
98
|
+
* @param {string} address
|
|
99
|
+
* @param {string=} blockTag
|
|
100
|
+
* @returns {Promise<string>}
|
|
101
|
+
*/
|
|
102
|
+
getCode(address: string, blockTag?: string | undefined): Promise<string>;
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} address
|
|
105
|
+
* @param {bigint} position
|
|
106
|
+
* @param {string=} blockTag
|
|
107
|
+
* @returns {Promise<string>}
|
|
108
|
+
*/
|
|
109
|
+
getStorageAt(address: string, position: bigint, blockTag?: string | undefined): Promise<string>;
|
|
110
|
+
/**
|
|
111
|
+
* @param {Filter} filter
|
|
112
|
+
* @returns {Promise<Log[]>}
|
|
113
|
+
*/
|
|
114
|
+
getLogs(filter: Filter): Promise<Log[]>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Minimal Block wrapper (ethers-like).
|
|
118
|
+
*/
|
|
119
|
+
export class Block {
|
|
120
|
+
/**
|
|
121
|
+
* @param {any} block
|
|
122
|
+
* @param {AbstractProvider=} provider
|
|
123
|
+
*/
|
|
124
|
+
constructor(block: any, provider?: AbstractProvider | undefined);
|
|
125
|
+
provider: AbstractProvider;
|
|
126
|
+
hash: any;
|
|
127
|
+
parentHash: any;
|
|
128
|
+
number: number;
|
|
129
|
+
timestamp: number;
|
|
130
|
+
transactions: any;
|
|
131
|
+
getTransaction(indexOrHash: any): Promise<TransactionResponse>;
|
|
132
|
+
getTransactionReceipt(indexOrHash: any): Promise<TransactionReceipt>;
|
|
133
|
+
getPrefetchedTransactions(): any[];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Minimal TransactionResponse wrapper (ethers-like).
|
|
137
|
+
*/
|
|
138
|
+
export class TransactionResponse {
|
|
139
|
+
/**
|
|
140
|
+
* @param {any} tx
|
|
141
|
+
* @param {AbstractProvider=} provider
|
|
142
|
+
*/
|
|
143
|
+
constructor(tx: any, provider?: AbstractProvider | undefined);
|
|
144
|
+
provider: AbstractProvider;
|
|
145
|
+
hash: any;
|
|
146
|
+
to: any;
|
|
147
|
+
from: any;
|
|
148
|
+
nonce: number;
|
|
149
|
+
data: any;
|
|
150
|
+
value: any;
|
|
151
|
+
gasLimit: any;
|
|
152
|
+
gasPrice: any;
|
|
153
|
+
chainId: number;
|
|
154
|
+
blockNumber: number;
|
|
155
|
+
remarks: string;
|
|
156
|
+
/**
|
|
157
|
+
* Wait for confirmations.
|
|
158
|
+
* @param {number=} confirmations
|
|
159
|
+
* @param {number=} timeoutMs
|
|
160
|
+
* @returns {Promise<TransactionReceipt>}
|
|
161
|
+
*/
|
|
162
|
+
wait(confirmations?: number | undefined, timeoutMs?: number | undefined): Promise<TransactionReceipt>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Minimal TransactionReceipt wrapper (ethers-like).
|
|
166
|
+
*/
|
|
167
|
+
export class TransactionReceipt {
|
|
168
|
+
/**
|
|
169
|
+
* @param {any} receipt
|
|
170
|
+
* @param {AbstractProvider=} provider
|
|
171
|
+
*/
|
|
172
|
+
constructor(receipt: any, provider?: AbstractProvider | undefined);
|
|
173
|
+
provider: AbstractProvider;
|
|
174
|
+
to: any;
|
|
175
|
+
from: any;
|
|
176
|
+
contractAddress: any;
|
|
177
|
+
transactionHash: any;
|
|
178
|
+
blockHash: any;
|
|
179
|
+
blockNumber: number;
|
|
180
|
+
transactionIndex: number;
|
|
181
|
+
gasUsed: any;
|
|
182
|
+
status: number;
|
|
183
|
+
logs: any;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Minimal Log wrapper (ethers-like).
|
|
187
|
+
*/
|
|
188
|
+
export class Log {
|
|
189
|
+
/**
|
|
190
|
+
* @param {any} log
|
|
191
|
+
* @param {AbstractProvider=} provider
|
|
192
|
+
*/
|
|
193
|
+
constructor(log: any, provider?: AbstractProvider | undefined);
|
|
194
|
+
provider: AbstractProvider;
|
|
195
|
+
address: any;
|
|
196
|
+
topics: any;
|
|
197
|
+
data: any;
|
|
198
|
+
blockHash: any;
|
|
199
|
+
blockNumber: number;
|
|
200
|
+
transactionHash: any;
|
|
201
|
+
transactionIndex: number;
|
|
202
|
+
logIndex: number;
|
|
203
|
+
removed: boolean;
|
|
204
|
+
getBlock(): Promise<Block>;
|
|
205
|
+
getTransaction(): Promise<TransactionResponse>;
|
|
206
|
+
getTransactionReceipt(): Promise<TransactionReceipt>;
|
|
207
|
+
}
|