quantum-coin-js-sdk 1.0.39 → 2.1.0
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/.gitignore +2 -1
- package/README.md +109 -768
- package/index.d.ts +76 -545
- package/index.js +319 -1194
- package/package.json +20 -5
- package/wasmBase64.js +7 -16
- package/wasm_exec.js +575 -587
- package/.idea/.name +0 -1
- package/.idea/modules.xml +0 -8
- package/.idea/quantum-coin-js-sdk.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.vs/ProjectSettings.json +0 -3
- package/.vs/VSWorkspaceState.json +0 -8
- package/.vs/quantum-coin-js-sdk/FileContentIndex/a9d6de82-cfc3-4c22-ac38-06d706ff3673.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/FileContentIndex/fdc816df-1898-4153-99f2-c69ef4c2283b.vsidx +0 -0
- package/.vs/quantum-coin-js-sdk/config/applicationhost.config +0 -1011
- package/.vs/quantum-coin-js-sdk/v17/.wsuo +0 -0
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.backup.json +0 -39
- package/.vs/quantum-coin-js-sdk/v17/DocumentLayout.json +0 -57
- package/.vs/slnx.sqlite +0 -0
- package/example/README.md +0 -14
- package/example/conversion-example.js +0 -19
- package/example/example-create-contract.js +0 -396
- package/example/example-encode-decode-rlp.js +0 -225
- package/example/example-event-pack-unpack.js +0 -391
- package/example/example-misc.js +0 -100
- package/example/example-rpc-send-signRawTransaction.js +0 -318
- package/example/example-rpc-send.js +0 -115
- package/example/example-send.js +0 -69
- package/example/example-token-pack-unpack.js +0 -960
- package/example/example-wallet-version4.js +0 -34
- package/example/example-wallet.js +0 -43
- package/example/example.js +0 -405
- package/example/node_modules/.bin/sdkgen +0 -16
- package/example/node_modules/.bin/sdkgen.cmd +0 -17
- package/example/node_modules/.bin/sdkgen.ps1 +0 -28
- package/example/node_modules/.package-lock.json +0 -47
- package/example/node_modules/quantumcoin/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/quantumcoin/LICENSE +0 -21
- package/example/node_modules/quantumcoin/README-SDK.md +0 -828
- package/example/node_modules/quantumcoin/README.md +0 -197
- package/example/node_modules/quantumcoin/config.d.ts +0 -50
- package/example/node_modules/quantumcoin/config.js +0 -123
- package/example/node_modules/quantumcoin/examples/AllSolidityTypes.sol +0 -184
- package/example/node_modules/quantumcoin/examples/SimpleIERC20.sol +0 -74
- package/example/node_modules/quantumcoin/examples/events.js +0 -41
- package/example/node_modules/quantumcoin/examples/events.ts +0 -35
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-js.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.js +0 -100
- package/example/node_modules/quantumcoin/examples/example-generator-sdk-ts.ts +0 -77
- package/example/node_modules/quantumcoin/examples/example.js +0 -67
- package/example/node_modules/quantumcoin/examples/example.ts +0 -56
- package/example/node_modules/quantumcoin/examples/offline-signing.js +0 -77
- package/example/node_modules/quantumcoin/examples/offline-signing.ts +0 -65
- package/example/node_modules/quantumcoin/examples/package-lock.json +0 -596
- package/example/node_modules/quantumcoin/examples/package.json +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.js +0 -32
- package/example/node_modules/quantumcoin/examples/read-operations.ts +0 -31
- package/example/node_modules/quantumcoin/examples/sdk-generator-erc20.inline.json +0 -251
- package/example/node_modules/quantumcoin/examples/solidity-types.ts +0 -43
- package/example/node_modules/quantumcoin/examples/wallet-offline.js +0 -36
- package/example/node_modules/quantumcoin/examples/wallet-offline.ts +0 -26
- package/example/node_modules/quantumcoin/generate-sdk.js +0 -1846
- package/example/node_modules/quantumcoin/index.js +0 -12
- package/example/node_modules/quantumcoin/package.json +0 -95
- package/example/node_modules/quantumcoin/scripts/copy-declarations.js +0 -31
- package/example/node_modules/quantumcoin/scripts/run-all-one-by-one.js +0 -151
- package/example/node_modules/quantumcoin/src/abi/fragments.d.ts +0 -42
- package/example/node_modules/quantumcoin/src/abi/fragments.js +0 -63
- package/example/node_modules/quantumcoin/src/abi/index.d.ts +0 -13
- package/example/node_modules/quantumcoin/src/abi/index.js +0 -9
- package/example/node_modules/quantumcoin/src/abi/interface.d.ts +0 -128
- package/example/node_modules/quantumcoin/src/abi/interface.js +0 -605
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.d.ts +0 -8
- package/example/node_modules/quantumcoin/src/abi/js-abi-coder.js +0 -538
- package/example/node_modules/quantumcoin/src/constants.d.ts +0 -61
- package/example/node_modules/quantumcoin/src/constants.js +0 -94
- package/example/node_modules/quantumcoin/src/contract/contract-factory.d.ts +0 -28
- package/example/node_modules/quantumcoin/src/contract/contract-factory.js +0 -111
- package/example/node_modules/quantumcoin/src/contract/contract.d.ts +0 -113
- package/example/node_modules/quantumcoin/src/contract/contract.js +0 -408
- package/example/node_modules/quantumcoin/src/contract/index.d.ts +0 -9
- package/example/node_modules/quantumcoin/src/contract/index.js +0 -9
- package/example/node_modules/quantumcoin/src/errors/index.d.ts +0 -92
- package/example/node_modules/quantumcoin/src/errors/index.js +0 -200
- package/example/node_modules/quantumcoin/src/generator/index.d.ts +0 -81
- package/example/node_modules/quantumcoin/src/generator/index.js +0 -1571
- package/example/node_modules/quantumcoin/src/index.d.ts +0 -122
- package/example/node_modules/quantumcoin/src/index.js +0 -41
- package/example/node_modules/quantumcoin/src/internal/hex.d.ts +0 -68
- package/example/node_modules/quantumcoin/src/internal/hex.js +0 -180
- package/example/node_modules/quantumcoin/src/providers/extra-providers.d.ts +0 -139
- package/example/node_modules/quantumcoin/src/providers/extra-providers.js +0 -614
- package/example/node_modules/quantumcoin/src/providers/index.d.ts +0 -17
- package/example/node_modules/quantumcoin/src/providers/index.js +0 -10
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/providers/json-rpc-provider.js +0 -89
- package/example/node_modules/quantumcoin/src/providers/provider.d.ts +0 -206
- package/example/node_modules/quantumcoin/src/providers/provider.js +0 -524
- package/example/node_modules/quantumcoin/src/types/index.d.ts +0 -214
- package/example/node_modules/quantumcoin/src/types/index.js +0 -9
- package/example/node_modules/quantumcoin/src/utils/address.d.ts +0 -58
- package/example/node_modules/quantumcoin/src/utils/address.js +0 -144
- package/example/node_modules/quantumcoin/src/utils/encoding.d.ts +0 -120
- package/example/node_modules/quantumcoin/src/utils/encoding.js +0 -306
- package/example/node_modules/quantumcoin/src/utils/fixednumber.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/fixednumber.js +0 -366
- package/example/node_modules/quantumcoin/src/utils/hashing.d.ts +0 -76
- package/example/node_modules/quantumcoin/src/utils/hashing.js +0 -298
- package/example/node_modules/quantumcoin/src/utils/index.d.ts +0 -63
- package/example/node_modules/quantumcoin/src/utils/index.js +0 -14
- package/example/node_modules/quantumcoin/src/utils/result.d.ts +0 -57
- package/example/node_modules/quantumcoin/src/utils/result.js +0 -128
- package/example/node_modules/quantumcoin/src/utils/rlp.d.ts +0 -12
- package/example/node_modules/quantumcoin/src/utils/rlp.js +0 -215
- package/example/node_modules/quantumcoin/src/utils/units.d.ts +0 -29
- package/example/node_modules/quantumcoin/src/utils/units.js +0 -107
- package/example/node_modules/quantumcoin/src/wallet/index.d.ts +0 -10
- package/example/node_modules/quantumcoin/src/wallet/index.js +0 -8
- package/example/node_modules/quantumcoin/src/wallet/wallet.d.ts +0 -192
- package/example/node_modules/quantumcoin/src/wallet/wallet.js +0 -713
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.js +0 -207
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.fixtures.js +0 -231
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
- package/example/node_modules/quantumcoin/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.js +0 -165
- package/example/node_modules/quantumcoin/test/e2e/generator-interface.e2e.test.ts +0 -160
- package/example/node_modules/quantumcoin/test/e2e/helpers.js +0 -59
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
- package/example/node_modules/quantumcoin/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
- package/example/node_modules/quantumcoin/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.js +0 -245
- package/example/node_modules/quantumcoin/test/e2e/transactional.test.ts +0 -208
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.js +0 -407
- package/example/node_modules/quantumcoin/test/e2e/typed-generator.e2e.test.ts +0 -337
- package/example/node_modules/quantumcoin/test/fixtures/ConstructorParam.sol +0 -23
- package/example/node_modules/quantumcoin/test/fixtures/MultiContracts.sol +0 -37
- package/example/node_modules/quantumcoin/test/fixtures/SimpleStorage.sol +0 -18
- package/example/node_modules/quantumcoin/test/fixtures/StakingContract.abi.json +0 -1
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.js +0 -49
- package/example/node_modules/quantumcoin/test/integration/ipc-provider.test.ts +0 -44
- package/example/node_modules/quantumcoin/test/integration/provider.test.js +0 -88
- package/example/node_modules/quantumcoin/test/integration/provider.test.ts +0 -85
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.js +0 -41
- package/example/node_modules/quantumcoin/test/integration/ws-provider.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/security/abi-decoder-bounds.test.js +0 -122
- package/example/node_modules/quantumcoin/test/security/contract-overrides.test.js +0 -112
- package/example/node_modules/quantumcoin/test/security/generator-injection.test.js +0 -195
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.js +0 -330
- package/example/node_modules/quantumcoin/test/security/malformed-input.test.ts +0 -35
- package/example/node_modules/quantumcoin/test/security/rpc-numeric-bounds.test.js +0 -81
- package/example/node_modules/quantumcoin/test/security/rpc-trust.test.js +0 -202
- package/example/node_modules/quantumcoin/test/unit/_encrypted-output.txt +0 -6
- package/example/node_modules/quantumcoin/test/unit/_log-encrypted-jsons.js +0 -45
- package/example/node_modules/quantumcoin/test/unit/_write-keystore-fixture.js +0 -16
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.js +0 -110
- package/example/node_modules/quantumcoin/test/unit/abi-interface.test.ts +0 -109
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.js +0 -923
- package/example/node_modules/quantumcoin/test/unit/address-wallet.test.ts +0 -877
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/browser-provider.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/contract.test.js +0 -85
- package/example/node_modules/quantumcoin/test/unit/contract.test.ts +0 -83
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.js +0 -127
- package/example/node_modules/quantumcoin/test/unit/encoding-units-rlp.test.ts +0 -91
- package/example/node_modules/quantumcoin/test/unit/errors.test.js +0 -77
- package/example/node_modules/quantumcoin/test/unit/errors.test.ts +0 -76
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.js +0 -55
- package/example/node_modules/quantumcoin/test/unit/filter-by-blockhash.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.js +0 -656
- package/example/node_modules/quantumcoin/test/unit/fixednumber.test.ts +0 -660
- package/example/node_modules/quantumcoin/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.js +0 -42
- package/example/node_modules/quantumcoin/test/unit/generate-contract-cli.test.ts +0 -41
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.js +0 -113
- package/example/node_modules/quantumcoin/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
- package/example/node_modules/quantumcoin/test/unit/generator.test.js +0 -149
- package/example/node_modules/quantumcoin/test/unit/generator.test.ts +0 -148
- package/example/node_modules/quantumcoin/test/unit/hashing.test.js +0 -64
- package/example/node_modules/quantumcoin/test/unit/hashing.test.ts +0 -63
- package/example/node_modules/quantumcoin/test/unit/init.test.js +0 -39
- package/example/node_modules/quantumcoin/test/unit/init.test.ts +0 -38
- package/example/node_modules/quantumcoin/test/unit/interface.test.js +0 -56
- package/example/node_modules/quantumcoin/test/unit/interface.test.ts +0 -54
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.js +0 -81
- package/example/node_modules/quantumcoin/test/unit/internal-hex.test.ts +0 -80
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.js +0 -98
- package/example/node_modules/quantumcoin/test/unit/populate-transaction.test.ts +0 -64
- package/example/node_modules/quantumcoin/test/unit/providers.test.js +0 -252
- package/example/node_modules/quantumcoin/test/unit/providers.test.ts +0 -251
- package/example/node_modules/quantumcoin/test/unit/result.test.js +0 -80
- package/example/node_modules/quantumcoin/test/unit/result.test.ts +0 -79
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.js +0 -49
- package/example/node_modules/quantumcoin/test/unit/solidity-types.test.ts +0 -39
- package/example/node_modules/quantumcoin/test/unit/utils.test.js +0 -57
- package/example/node_modules/quantumcoin/test/unit/utils.test.ts +0 -56
- package/example/node_modules/quantumcoin/test/verbose-logger.js +0 -74
- package/example/node_modules/quantumcoin/tsconfig.build.json +0 -14
- package/example/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
- package/example/node_modules/seed-words/BUILD.md +0 -7
- package/example/node_modules/seed-words/LICENSE +0 -121
- package/example/node_modules/seed-words/README.md +0 -67
- package/example/node_modules/seed-words/dist/seedwords.d.ts +0 -39
- package/example/node_modules/seed-words/package.json +0 -27
- package/example/node_modules/seed-words/seedwords.js +0 -315
- package/example/node_modules/seed-words/seedwords.txt +0 -65536
- package/example/node_modules/seed-words/tsconfig.json +0 -21
- package/example/package-lock.json +0 -56
- package/example/package.json +0 -15
- package/tests/encrypted-32.json +0 -1
- package/tests/encrypted-36.json +0 -1
- package/tests/encrypted-48.json +0 -1
- package/tests/generate-verify-vectors.js +0 -91
- package/tests/get-gas-price.test.js +0 -59
- package/tests/non-transactional.preinit.test.js +0 -41
- package/tests/non-transactional.test.js +0 -1389
- package/tests/scrypt.test.js +0 -128
- package/tests/sign-raw-keytype5-context-null.test.js +0 -107
- package/tests/sign-raw-transaction.test.js +0 -196
- package/tests/sign-verify.test.js +0 -311
- package/tests/transactional.relay.test.js +0 -131
- package/tests/transactional.rpc.test.js +0 -103
- package/tests/verify-vectors.json +0 -95035
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
const MAX_RESPONSE_SIZE = 16 * 1024 * 1024;
|
|
10
|
-
|
|
11
|
-
function _bigIntReplacer(_key, value) {
|
|
12
|
-
return typeof value === "bigint" ? "0x" + value.toString(16) : value;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
class JsonRpcProvider extends AbstractProvider {
|
|
16
|
-
/**
|
|
17
|
-
* @param {string=} url RPC endpoint (defaults to Config.rpcEndpoint or https://public.rpc.quantumcoinapi.com)
|
|
18
|
-
* @param {number=} chainId Chain ID (defaults to 123123)
|
|
19
|
-
*/
|
|
20
|
-
constructor(url, chainId) {
|
|
21
|
-
super();
|
|
22
|
-
const active = isInitialized() ? getConfig() : null;
|
|
23
|
-
const cfg = active || new Config();
|
|
24
|
-
this.url = url || cfg.rpcEndpoint;
|
|
25
|
-
this.chainId = chainId == null ? cfg.chainId : chainId;
|
|
26
|
-
this._rpcId = 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Internal JSON-RPC call.
|
|
31
|
-
* @param {string} method
|
|
32
|
-
* @param {any[]=} params
|
|
33
|
-
* @returns {Promise<any>}
|
|
34
|
-
*/
|
|
35
|
-
async _perform(method, params) {
|
|
36
|
-
const id = this._rpcId++;
|
|
37
|
-
const body = JSON.stringify({
|
|
38
|
-
jsonrpc: "2.0",
|
|
39
|
-
id,
|
|
40
|
-
method,
|
|
41
|
-
params: params || [],
|
|
42
|
-
}, _bigIntReplacer);
|
|
43
|
-
|
|
44
|
-
const controller = new AbortController();
|
|
45
|
-
const timeout = setTimeout(() => controller.abort(), 30_000);
|
|
46
|
-
try {
|
|
47
|
-
const resp = await fetch(this.url, {
|
|
48
|
-
method: "POST",
|
|
49
|
-
headers: { "content-type": "application/json" },
|
|
50
|
-
body,
|
|
51
|
-
signal: controller.signal,
|
|
52
|
-
});
|
|
53
|
-
const text = await resp.text().catch(() => null);
|
|
54
|
-
if (text && text.length > MAX_RESPONSE_SIZE) {
|
|
55
|
-
throw makeError("JSON-RPC response too large", "UNKNOWN_ERROR", {
|
|
56
|
-
method, url: this.url, size: text.length, limit: MAX_RESPONSE_SIZE,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const json = text ? (() => { try { return JSON.parse(text); } catch { return null; } })() : null;
|
|
60
|
-
if (!resp.ok) {
|
|
61
|
-
throw makeError("JSON-RPC HTTP error", "UNKNOWN_ERROR", {
|
|
62
|
-
status: resp.status,
|
|
63
|
-
statusText: resp.statusText,
|
|
64
|
-
method,
|
|
65
|
-
url: this.url,
|
|
66
|
-
body: json || null,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
if (!json) throw makeError("invalid JSON-RPC response", "UNKNOWN_ERROR", { method });
|
|
70
|
-
if (json.error) {
|
|
71
|
-
throw makeError("JSON-RPC error", "UNKNOWN_ERROR", { method, error: json.error });
|
|
72
|
-
}
|
|
73
|
-
return json.result;
|
|
74
|
-
} catch (e) {
|
|
75
|
-
if (e && e.name === "AbortError") {
|
|
76
|
-
throw makeError("JSON-RPC request timeout", "UNKNOWN_ERROR", { method, url: this.url });
|
|
77
|
-
}
|
|
78
|
-
throw e;
|
|
79
|
-
} finally {
|
|
80
|
-
clearTimeout(timeout);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// In ethers v6 this is a base for specific API providers; we alias for compatibility.
|
|
86
|
-
class JsonRpcApiProvider extends JsonRpcProvider {}
|
|
87
|
-
|
|
88
|
-
module.exports = { JsonRpcProvider, JsonRpcApiProvider };
|
|
89
|
-
|
|
@@ -1,206 +0,0 @@
|
|
|
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
|
-
nonce?: number | undefined;
|
|
9
|
-
chainId?: number | undefined;
|
|
10
|
-
/**
|
|
11
|
-
* Optional remark field (hex, max 32 bytes)
|
|
12
|
-
*/
|
|
13
|
-
remarks?: string | undefined;
|
|
14
|
-
/**
|
|
15
|
-
* Optional signing context (0, 1, 2, or null). Passed to SDK TransactionSigningRequest; default null.
|
|
16
|
-
*/
|
|
17
|
-
signingContext?: (number | null) | undefined;
|
|
18
|
-
};
|
|
19
|
-
export type Filter = {
|
|
20
|
-
address?: (string | string[]) | undefined;
|
|
21
|
-
topics?: (string | string[] | null)[] | undefined;
|
|
22
|
-
fromBlock?: (number | string) | undefined;
|
|
23
|
-
toBlock?: (number | string) | undefined;
|
|
24
|
-
blockHash?: string | undefined;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Base Provider class.
|
|
28
|
-
*/
|
|
29
|
-
export class Provider {
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* AbstractProvider base class (ethers-like).
|
|
33
|
-
*/
|
|
34
|
-
export class AbstractProvider extends Provider {
|
|
35
|
-
/**
|
|
36
|
-
* Implemented by subclasses to perform JSON-RPC.
|
|
37
|
-
* @param {string} method
|
|
38
|
-
* @param {any[]=} params
|
|
39
|
-
* @returns {Promise<any>}
|
|
40
|
-
*/
|
|
41
|
-
_perform(method: string, params?: any[] | undefined): Promise<any>;
|
|
42
|
-
getBlockNumber(): Promise<number>;
|
|
43
|
-
/**
|
|
44
|
-
* @param {number|"latest"} blockNumber
|
|
45
|
-
* @returns {Promise<Block>}
|
|
46
|
-
*/
|
|
47
|
-
getBlock(blockNumber: number | "latest"): Promise<Block>;
|
|
48
|
-
/**
|
|
49
|
-
* @param {string} txHash
|
|
50
|
-
* @returns {Promise<TransactionResponse>}
|
|
51
|
-
*/
|
|
52
|
-
getTransaction(txHash: string): Promise<TransactionResponse>;
|
|
53
|
-
/**
|
|
54
|
-
* @param {string} txHash
|
|
55
|
-
* @returns {Promise<TransactionReceipt>}
|
|
56
|
-
*/
|
|
57
|
-
getTransactionReceipt(txHash: string): Promise<TransactionReceipt>;
|
|
58
|
-
/**
|
|
59
|
-
* @param {string} address
|
|
60
|
-
* @returns {Promise<bigint>}
|
|
61
|
-
*/
|
|
62
|
-
getBalance(address: string): Promise<bigint>;
|
|
63
|
-
/**
|
|
64
|
-
* @param {string} address
|
|
65
|
-
* @param {string=} blockTag
|
|
66
|
-
* @returns {Promise<number>}
|
|
67
|
-
*/
|
|
68
|
-
getTransactionCount(address: string, blockTag?: string | undefined): Promise<number>;
|
|
69
|
-
/**
|
|
70
|
-
* Broadcasts a signed transaction.
|
|
71
|
-
* @param {TransactionRequest|string} tx
|
|
72
|
-
* @returns {Promise<TransactionResponse>}
|
|
73
|
-
*/
|
|
74
|
-
sendTransaction(tx: TransactionRequest | string): Promise<TransactionResponse>;
|
|
75
|
-
/**
|
|
76
|
-
* Broadcast a signed raw transaction.
|
|
77
|
-
* Alias of sendTransaction(rawTx) for clarity when doing offline signing flows.
|
|
78
|
-
*
|
|
79
|
-
* @param {string} rawTx
|
|
80
|
-
* @returns {Promise<TransactionResponse>}
|
|
81
|
-
*/
|
|
82
|
-
sendRawTransaction(rawTx: string): Promise<TransactionResponse>;
|
|
83
|
-
/**
|
|
84
|
-
* Perform a call (read-only) and return hex data.
|
|
85
|
-
* @param {TransactionRequest} tx
|
|
86
|
-
* @param {string=} blockTag
|
|
87
|
-
* @returns {Promise<string>}
|
|
88
|
-
*/
|
|
89
|
-
call(tx: TransactionRequest, blockTag?: string | undefined): Promise<string>;
|
|
90
|
-
/**
|
|
91
|
-
* Estimate gas for a call/transaction.
|
|
92
|
-
* @param {TransactionRequest} tx
|
|
93
|
-
* @returns {Promise<bigint>}
|
|
94
|
-
*/
|
|
95
|
-
estimateGas(tx: TransactionRequest): Promise<bigint>;
|
|
96
|
-
/**
|
|
97
|
-
* @param {string} address
|
|
98
|
-
* @param {string=} blockTag
|
|
99
|
-
* @returns {Promise<string>}
|
|
100
|
-
*/
|
|
101
|
-
getCode(address: string, blockTag?: string | undefined): Promise<string>;
|
|
102
|
-
/**
|
|
103
|
-
* @param {string} address
|
|
104
|
-
* @param {bigint} position
|
|
105
|
-
* @param {string=} blockTag
|
|
106
|
-
* @returns {Promise<string>}
|
|
107
|
-
*/
|
|
108
|
-
getStorageAt(address: string, position: bigint, blockTag?: string | undefined): Promise<string>;
|
|
109
|
-
/**
|
|
110
|
-
* @param {Filter} filter
|
|
111
|
-
* @returns {Promise<Log[]>}
|
|
112
|
-
*/
|
|
113
|
-
getLogs(filter: Filter): Promise<Log[]>;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Minimal Block wrapper (ethers-like).
|
|
117
|
-
*/
|
|
118
|
-
export class Block {
|
|
119
|
-
/**
|
|
120
|
-
* @param {any} block
|
|
121
|
-
* @param {AbstractProvider=} provider
|
|
122
|
-
*/
|
|
123
|
-
constructor(block: any, provider?: AbstractProvider | undefined);
|
|
124
|
-
provider: AbstractProvider;
|
|
125
|
-
hash: any;
|
|
126
|
-
parentHash: any;
|
|
127
|
-
number: number;
|
|
128
|
-
timestamp: number;
|
|
129
|
-
transactions: any;
|
|
130
|
-
getTransaction(indexOrHash: any): Promise<TransactionResponse>;
|
|
131
|
-
getTransactionReceipt(indexOrHash: any): Promise<TransactionReceipt>;
|
|
132
|
-
getPrefetchedTransactions(): any[];
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Minimal TransactionResponse wrapper (ethers-like).
|
|
136
|
-
*/
|
|
137
|
-
export class TransactionResponse {
|
|
138
|
-
/**
|
|
139
|
-
* @param {any} tx
|
|
140
|
-
* @param {AbstractProvider=} provider
|
|
141
|
-
*/
|
|
142
|
-
constructor(tx: any, provider?: AbstractProvider | undefined);
|
|
143
|
-
provider: AbstractProvider;
|
|
144
|
-
hash: any;
|
|
145
|
-
to: any;
|
|
146
|
-
from: any;
|
|
147
|
-
nonce: number;
|
|
148
|
-
data: any;
|
|
149
|
-
value: any;
|
|
150
|
-
gasLimit: any;
|
|
151
|
-
chainId: number;
|
|
152
|
-
blockNumber: number;
|
|
153
|
-
txType: number | null;
|
|
154
|
-
remarks: string;
|
|
155
|
-
/**
|
|
156
|
-
* Wait for confirmations.
|
|
157
|
-
* @param {number=} confirmations
|
|
158
|
-
* @param {number=} timeoutMs
|
|
159
|
-
* @returns {Promise<TransactionReceipt>}
|
|
160
|
-
*/
|
|
161
|
-
wait(confirmations?: number | undefined, timeoutMs?: number | undefined): Promise<TransactionReceipt>;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Minimal TransactionReceipt wrapper (ethers-like).
|
|
165
|
-
*/
|
|
166
|
-
export class TransactionReceipt {
|
|
167
|
-
/**
|
|
168
|
-
* @param {any} receipt
|
|
169
|
-
* @param {AbstractProvider=} provider
|
|
170
|
-
*/
|
|
171
|
-
constructor(receipt: any, provider?: AbstractProvider | undefined);
|
|
172
|
-
provider: AbstractProvider;
|
|
173
|
-
to: any;
|
|
174
|
-
from: any;
|
|
175
|
-
contractAddress: any;
|
|
176
|
-
transactionHash: any;
|
|
177
|
-
blockHash: any;
|
|
178
|
-
blockNumber: number;
|
|
179
|
-
transactionIndex: number;
|
|
180
|
-
gasUsed: any;
|
|
181
|
-
status: number;
|
|
182
|
-
logs: any;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Minimal Log wrapper (ethers-like).
|
|
186
|
-
*/
|
|
187
|
-
export class Log {
|
|
188
|
-
/**
|
|
189
|
-
* @param {any} log
|
|
190
|
-
* @param {AbstractProvider=} provider
|
|
191
|
-
*/
|
|
192
|
-
constructor(log: any, provider?: AbstractProvider | undefined);
|
|
193
|
-
provider: AbstractProvider;
|
|
194
|
-
address: any;
|
|
195
|
-
topics: any;
|
|
196
|
-
data: any;
|
|
197
|
-
blockHash: any;
|
|
198
|
-
blockNumber: number;
|
|
199
|
-
transactionHash: any;
|
|
200
|
-
transactionIndex: number;
|
|
201
|
-
logIndex: number;
|
|
202
|
-
removed: boolean;
|
|
203
|
-
getBlock(): Promise<Block>;
|
|
204
|
-
getTransaction(): Promise<TransactionResponse>;
|
|
205
|
-
getTransactionReceipt(): Promise<TransactionReceipt>;
|
|
206
|
-
}
|