quantumcoin 7.0.14 → 8.0.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/README-SDK.md +46 -0
- package/README.md +1 -1
- package/generate-sdk.js +8 -6
- package/package.json +22 -4
- package/src/abi/interface.d.ts +133 -128
- package/src/abi/js-abi-coder.d.ts +8 -8
- package/src/constants.d.ts +61 -61
- package/src/contract/contract-factory.d.ts +28 -28
- package/src/contract/contract.d.ts +121 -113
- package/src/contract/index.d.ts +1 -0
- package/src/errors/index.d.ts +10 -2
- package/src/errors/index.js +1 -1
- package/src/generator/index.d.ts +109 -81
- package/src/index.d.ts +126 -122
- package/src/internal/event-emitter.d.ts +76 -0
- package/src/internal/event-emitter.js +144 -0
- package/src/internal/hex.d.ts +27 -4
- package/src/internal/hex.js +7 -3
- package/src/providers/extra-providers.d.ts +141 -139
- package/src/providers/extra-providers.js +15 -1
- package/src/providers/index.d.ts +18 -17
- package/src/providers/json-rpc-provider.d.ts +1 -0
- package/src/providers/provider.d.ts +233 -206
- package/src/providers/provider.js +41 -1
- package/src/utils/encoding.js +16 -4
- package/src/utils/fixednumber.d.ts +57 -57
- package/src/utils/hashing.d.ts +79 -76
- package/src/utils/hashing.js +68 -177
- package/src/utils/index.d.ts +1 -1
- package/src/utils/rlp.js +1 -1
- package/src/wallet/wallet.d.ts +54 -19
- package/src/wallet/wallet.js +48 -10
- package/.github/workflows/publish-npmjs.yaml +0 -22
- package/.gitignore +0 -15
- package/examples/AllSolidityTypes.sol +0 -184
- package/examples/SimpleIERC20.sol +0 -74
- package/examples/events.js +0 -41
- package/examples/events.ts +0 -35
- package/examples/example-generated-sdk-js/README.md +0 -65
- package/examples/example-generated-sdk-js/examples/_test-wallet.js +0 -17
- package/examples/example-generated-sdk-js/examples/deploy.js +0 -41
- package/examples/example-generated-sdk-js/examples/events.js +0 -36
- package/examples/example-generated-sdk-js/examples/read-operations.js +0 -46
- package/examples/example-generated-sdk-js/examples/write-operations.js +0 -44
- package/examples/example-generated-sdk-js/index.d.ts +0 -1
- package/examples/example-generated-sdk-js/index.js +0 -15
- package/examples/example-generated-sdk-js/package-lock.json +0 -59
- package/examples/example-generated-sdk-js/package.json +0 -22
- package/examples/example-generated-sdk-js/src/SimpleERC20.d.ts +0 -19
- package/examples/example-generated-sdk-js/src/SimpleERC20.js +0 -353
- package/examples/example-generated-sdk-js/src/SimpleERC20__factory.d.ts +0 -10
- package/examples/example-generated-sdk-js/src/SimpleERC20__factory.js +0 -29
- package/examples/example-generated-sdk-js/src/index.d.ts +0 -4
- package/examples/example-generated-sdk-js/src/index.js +0 -5
- package/examples/example-generated-sdk-js/src/quantumcoin-shims.d.ts +0 -23
- package/examples/example-generated-sdk-js/src/types.d.ts +0 -3
- package/examples/example-generated-sdk-js/src/types.js +0 -3
- package/examples/example-generated-sdk-js/test/e2e/SimpleERC20.e2e.test.js +0 -78
- package/examples/example-generated-sdk-ts/README.md +0 -65
- package/examples/example-generated-sdk-ts/examples/_test-wallet.js +0 -17
- package/examples/example-generated-sdk-ts/examples/deploy.js +0 -41
- package/examples/example-generated-sdk-ts/examples/events.js +0 -36
- package/examples/example-generated-sdk-ts/examples/read-operations.js +0 -46
- package/examples/example-generated-sdk-ts/examples/write-operations.js +0 -44
- package/examples/example-generated-sdk-ts/index.d.ts +0 -1
- package/examples/example-generated-sdk-ts/index.js +0 -15
- package/examples/example-generated-sdk-ts/package-lock.json +0 -59
- package/examples/example-generated-sdk-ts/package.json +0 -23
- package/examples/example-generated-sdk-ts/src/SimpleERC20.ts +0 -334
- package/examples/example-generated-sdk-ts/src/SimpleERC20__factory.ts +0 -28
- package/examples/example-generated-sdk-ts/src/index.ts +0 -4
- package/examples/example-generated-sdk-ts/src/quantumcoin-shims.d.ts +0 -23
- package/examples/example-generated-sdk-ts/src/types.ts +0 -4
- package/examples/example-generated-sdk-ts/test/e2e/SimpleERC20.e2e.test.js +0 -78
- package/examples/example-generated-sdk-ts/tsconfig.json +0 -14
- package/examples/example-generator-sdk-js.js +0 -100
- package/examples/example-generator-sdk-js.ts +0 -77
- package/examples/example-generator-sdk-ts.js +0 -100
- package/examples/example-generator-sdk-ts.ts +0 -77
- package/examples/example.js +0 -67
- package/examples/example.ts +0 -56
- package/examples/node_modules/.bin/esbuild +0 -16
- package/examples/node_modules/.bin/esbuild.cmd +0 -17
- package/examples/node_modules/.bin/esbuild.ps1 +0 -28
- package/examples/node_modules/.bin/sdkgen +0 -16
- package/examples/node_modules/.bin/sdkgen.cmd +0 -17
- package/examples/node_modules/.bin/sdkgen.ps1 +0 -28
- package/examples/node_modules/.bin/tsx +0 -16
- package/examples/node_modules/.bin/tsx.cmd +0 -17
- package/examples/node_modules/.bin/tsx.ps1 +0 -28
- package/examples/node_modules/.package-lock.json +0 -144
- package/examples/node_modules/@esbuild/win32-x64/README.md +0 -3
- package/examples/node_modules/@esbuild/win32-x64/esbuild.exe +0 -0
- package/examples/node_modules/@esbuild/win32-x64/package.json +0 -20
- package/examples/node_modules/esbuild/LICENSE.md +0 -21
- package/examples/node_modules/esbuild/README.md +0 -3
- package/examples/node_modules/esbuild/bin/esbuild +0 -223
- package/examples/node_modules/esbuild/install.js +0 -289
- package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
- package/examples/node_modules/esbuild/lib/main.js +0 -2532
- package/examples/node_modules/esbuild/package.json +0 -49
- package/examples/node_modules/get-tsconfig/LICENSE +0 -21
- package/examples/node_modules/get-tsconfig/README.md +0 -235
- package/examples/node_modules/get-tsconfig/dist/index.cjs +0 -7
- package/examples/node_modules/get-tsconfig/dist/index.d.cts +0 -2088
- package/examples/node_modules/get-tsconfig/dist/index.d.mts +0 -2088
- package/examples/node_modules/get-tsconfig/dist/index.mjs +0 -7
- package/examples/node_modules/get-tsconfig/package.json +0 -46
- package/examples/node_modules/quantum-coin-js-sdk/LICENSE +0 -21
- package/examples/node_modules/quantum-coin-js-sdk/LICENSE-wasm_exec.js.txt +0 -30
- package/examples/node_modules/quantum-coin-js-sdk/README.md +0 -1675
- package/examples/node_modules/quantum-coin-js-sdk/example/README.md +0 -14
- package/examples/node_modules/quantum-coin-js-sdk/example/conversion-example.js +0 -19
- package/examples/node_modules/quantum-coin-js-sdk/example/example-create-contract.js +0 -396
- package/examples/node_modules/quantum-coin-js-sdk/example/example-encode-decode-rlp.js +0 -225
- package/examples/node_modules/quantum-coin-js-sdk/example/example-event-pack-unpack.js +0 -391
- package/examples/node_modules/quantum-coin-js-sdk/example/example-misc.js +0 -101
- package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send-signRawTransaction.js +0 -318
- package/examples/node_modules/quantum-coin-js-sdk/example/example-rpc-send.js +0 -116
- package/examples/node_modules/quantum-coin-js-sdk/example/example-send.js +0 -70
- package/examples/node_modules/quantum-coin-js-sdk/example/example-token-pack-unpack.js +0 -961
- package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet-version4.js +0 -35
- package/examples/node_modules/quantum-coin-js-sdk/example/example-wallet.js +0 -43
- package/examples/node_modules/quantum-coin-js-sdk/example/example.js +0 -405
- package/examples/node_modules/quantum-coin-js-sdk/example/package-lock.json +0 -134
- package/examples/node_modules/quantum-coin-js-sdk/example/package.json +0 -15
- package/examples/node_modules/quantum-coin-js-sdk/index.d.ts +0 -1031
- package/examples/node_modules/quantum-coin-js-sdk/index.js +0 -3144
- package/examples/node_modules/quantum-coin-js-sdk/package.json +0 -34
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-32.json +0 -1
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-36.json +0 -1
- package/examples/node_modules/quantum-coin-js-sdk/tests/encrypted-48.json +0 -1
- package/examples/node_modules/quantum-coin-js-sdk/tests/generate-verify-vectors.js +0 -91
- package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.preinit.test.js +0 -41
- package/examples/node_modules/quantum-coin-js-sdk/tests/non-transactional.test.js +0 -1389
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-keytype5-context-null.test.js +0 -107
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-raw-transaction.test.js +0 -196
- package/examples/node_modules/quantum-coin-js-sdk/tests/sign-verify.test.js +0 -311
- package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.relay.test.js +0 -131
- package/examples/node_modules/quantum-coin-js-sdk/tests/transactional.rpc.test.js +0 -103
- package/examples/node_modules/quantum-coin-js-sdk/tests/verify-vectors.json +0 -95035
- package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.d.ts +0 -9
- package/examples/node_modules/quantum-coin-js-sdk/wasmBase64.js +0 -16
- package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.d.ts +0 -0
- package/examples/node_modules/quantum-coin-js-sdk/wasm_exec.js +0 -587
- package/examples/node_modules/resolve-pkg-maps/LICENSE +0 -21
- package/examples/node_modules/resolve-pkg-maps/README.md +0 -216
- package/examples/node_modules/resolve-pkg-maps/dist/index.cjs +0 -1
- package/examples/node_modules/resolve-pkg-maps/dist/index.d.cts +0 -11
- package/examples/node_modules/resolve-pkg-maps/dist/index.d.mts +0 -11
- package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
- package/examples/node_modules/resolve-pkg-maps/package.json +0 -42
- package/examples/node_modules/seed-words/.github/workflows/publish-npmjs.yaml +0 -22
- package/examples/node_modules/seed-words/BUILD.md +0 -7
- package/examples/node_modules/seed-words/LICENSE +0 -121
- package/examples/node_modules/seed-words/README.md +0 -67
- package/examples/node_modules/seed-words/dist/seedwords.d.ts +0 -39
- package/examples/node_modules/seed-words/package.json +0 -27
- package/examples/node_modules/seed-words/seedwords.js +0 -315
- package/examples/node_modules/seed-words/seedwords.txt +0 -65536
- package/examples/node_modules/seed-words/tsconfig.json +0 -21
- package/examples/node_modules/tsx/LICENSE +0 -21
- package/examples/node_modules/tsx/README.md +0 -32
- package/examples/node_modules/tsx/dist/cjs/api/index.cjs +0 -1
- package/examples/node_modules/tsx/dist/cjs/api/index.d.cts +0 -35
- package/examples/node_modules/tsx/dist/cjs/api/index.d.mts +0 -35
- package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/cjs/index.cjs +0 -1
- package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/cli.cjs +0 -54
- package/examples/node_modules/tsx/dist/cli.mjs +0 -55
- package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
- package/examples/node_modules/tsx/dist/client-D6NvIMSC.cjs +0 -1
- package/examples/node_modules/tsx/dist/esm/api/index.cjs +0 -1
- package/examples/node_modules/tsx/dist/esm/api/index.d.cts +0 -35
- package/examples/node_modules/tsx/dist/esm/api/index.d.mts +0 -35
- package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/esm/index.cjs +0 -2
- package/examples/node_modules/tsx/dist/esm/index.mjs +0 -2
- package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
- package/examples/node_modules/tsx/dist/get-pipe-path-BoR10qr8.cjs +0 -1
- package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +0 -14
- package/examples/node_modules/tsx/dist/index-BWFBUo6r.cjs +0 -1
- package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
- package/examples/node_modules/tsx/dist/index-gckBtVBf.cjs +0 -14
- package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
- package/examples/node_modules/tsx/dist/lexer-DgIbo0BU.cjs +0 -3
- package/examples/node_modules/tsx/dist/loader.cjs +0 -1
- package/examples/node_modules/tsx/dist/loader.mjs +0 -1
- package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
- package/examples/node_modules/tsx/dist/node-features-roYmp9jK.cjs +0 -1
- package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +0 -1
- package/examples/node_modules/tsx/dist/package-Dxt5kIHw.cjs +0 -1
- package/examples/node_modules/tsx/dist/patch-repl.cjs +0 -1
- package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
- package/examples/node_modules/tsx/dist/preflight.cjs +0 -1
- package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
- package/examples/node_modules/tsx/dist/register-2sWVXuRQ.cjs +0 -1
- package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +0 -1
- package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +0 -4
- package/examples/node_modules/tsx/dist/register-D46fvsV_.cjs +0 -4
- package/examples/node_modules/tsx/dist/repl.cjs +0 -3
- package/examples/node_modules/tsx/dist/repl.mjs +0 -3
- package/examples/node_modules/tsx/dist/require-D4F1Lv60.cjs +0 -1
- package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +0 -1
- package/examples/node_modules/tsx/dist/suppress-warnings.cjs +0 -1
- package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
- package/examples/node_modules/tsx/dist/temporary-directory-B83uKxJF.cjs +0 -1
- package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
- package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
- package/examples/node_modules/tsx/package.json +0 -68
- package/examples/offline-signing.js +0 -77
- package/examples/offline-signing.ts +0 -65
- package/examples/package-lock.json +0 -596
- package/examples/package.json +0 -32
- package/examples/read-operations.js +0 -32
- package/examples/read-operations.ts +0 -31
- package/examples/sdk-generator-erc20.inline.json +0 -251
- package/examples/solidity-types.ts +0 -43
- package/examples/wallet-offline.js +0 -36
- package/examples/wallet-offline.ts +0 -26
- package/scripts/copy-declarations.js +0 -31
- package/scripts/run-all-one-by-one.js +0 -151
- package/test/e2e/all-solidity-types.dynamic.test.js +0 -207
- package/test/e2e/all-solidity-types.dynamic.test.ts +0 -191
- package/test/e2e/all-solidity-types.fixtures.js +0 -231
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.js +0 -387
- package/test/e2e/all-solidity-types.generated-sdks.e2e.test.ts +0 -350
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/README.md +0 -83
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.abi.json +0 -12544
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/artifacts/AllSolidityTypes.bin +0 -1
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.js +0 -17
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/_test-wallet.ts +0 -10
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.js +0 -41
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/deploy.ts +0 -41
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.js +0 -36
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/events.ts +0 -36
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.js +0 -82
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/offline-signing.ts +0 -80
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.js +0 -46
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/read-operations.ts +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.js +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/examples/write-operations.ts +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.d.ts +0 -1
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/index.js +0 -21
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package-lock.json +0 -597
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/package.json +0 -25
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.d.ts +0 -1280
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes.js +0 -14021
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.d.ts +0 -11
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/AllSolidityTypes__factory.js +0 -31
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.d.ts +0 -4
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/index.js +0 -5
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/quantumcoin-shims.d.ts +0 -25
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.d.ts +0 -3
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/src/types.js +0 -3
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.e2e.test.js +0 -77
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-js/test/e2e/AllSolidityTypes.extra.test.js +0 -195
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/README.md +0 -83
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.abi.json +0 -12544
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/artifacts/AllSolidityTypes.bin +0 -1
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.js +0 -17
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/_test-wallet.ts +0 -10
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.js +0 -41
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/deploy.ts +0 -41
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.js +0 -36
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/events.ts +0 -36
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.js +0 -82
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/offline-signing.ts +0 -80
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.js +0 -46
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/read-operations.ts +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.js +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/examples/write-operations.ts +0 -44
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.d.ts +0 -1
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/index.js +0 -21
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package-lock.json +0 -597
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/package.json +0 -26
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes.ts +0 -13940
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/AllSolidityTypes__factory.ts +0 -31
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/index.ts +0 -4
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/quantumcoin-shims.d.ts +0 -25
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/src/types.ts +0 -4
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.e2e.test.js +0 -77
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/test/e2e/AllSolidityTypes.extra.test.js +0 -195
- package/test/e2e/generated-sdks/all-solidity-types/all-solidity-types-ts/tsconfig.json +0 -18
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/README.md +0 -74
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.abi.json +0 -245
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/artifacts/SimpleERC20.bin +0 -1
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.js +0 -17
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/_test-wallet.ts +0 -10
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.js +0 -41
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/deploy.ts +0 -41
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.js +0 -36
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/events.ts +0 -36
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.js +0 -82
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/offline-signing.ts +0 -80
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.js +0 -46
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/read-operations.ts +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.js +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/examples/write-operations.ts +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.d.ts +0 -1
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/index.js +0 -16
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package-lock.json +0 -597
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/package.json +0 -25
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.d.ts +0 -24
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20.js +0 -378
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.d.ts +0 -10
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/SimpleERC20__factory.js +0 -31
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.d.ts +0 -4
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/index.js +0 -5
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/quantumcoin-shims.d.ts +0 -25
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.d.ts +0 -3
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/src/types.js +0 -3
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-js/test/e2e/SimpleERC20.e2e.test.js +0 -90
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/README.md +0 -74
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.abi.json +0 -245
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/artifacts/SimpleERC20.bin +0 -1
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.js +0 -17
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/_test-wallet.ts +0 -10
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.js +0 -41
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/deploy.ts +0 -41
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.js +0 -36
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/events.ts +0 -36
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.js +0 -82
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/offline-signing.ts +0 -80
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.js +0 -46
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/read-operations.ts +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.js +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/examples/write-operations.ts +0 -44
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.d.ts +0 -1
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/index.js +0 -16
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package-lock.json +0 -597
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/package.json +0 -26
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20.ts +0 -361
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/SimpleERC20__factory.ts +0 -30
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/index.ts +0 -4
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/quantumcoin-shims.d.ts +0 -25
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/src/types.ts +0 -4
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/test/e2e/SimpleERC20.e2e.test.js +0 -90
- package/test/e2e/generated-sdks/simple-erc20/simple-erc20-ts/tsconfig.json +0 -18
- package/test/e2e/generator-interface.e2e.test.js +0 -165
- package/test/e2e/generator-interface.e2e.test.ts +0 -160
- package/test/e2e/helpers.js +0 -59
- package/test/e2e/signing-context-and-fee.e2e.test.js +0 -141
- package/test/e2e/signing-context-and-fee.e2e.test.ts +0 -128
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.js +0 -168
- package/test/e2e/simple-erc20.generated-sdks.e2e.test.ts +0 -141
- package/test/e2e/transactional.test.js +0 -245
- package/test/e2e/transactional.test.ts +0 -208
- package/test/e2e/typed-generator.e2e.test.js +0 -407
- package/test/e2e/typed-generator.e2e.test.ts +0 -337
- package/test/fixtures/ConstructorParam.sol +0 -23
- package/test/fixtures/MultiContracts.sol +0 -37
- package/test/fixtures/SimpleStorage.sol +0 -18
- package/test/fixtures/StakingContract.abi.json +0 -1
- package/test/integration/ipc-provider.test.js +0 -49
- package/test/integration/ipc-provider.test.ts +0 -44
- package/test/integration/provider.test.js +0 -88
- package/test/integration/provider.test.ts +0 -85
- package/test/integration/ws-provider.test.js +0 -41
- package/test/integration/ws-provider.test.ts +0 -38
- package/test/security/abi-decoder-bounds.test.js +0 -122
- package/test/security/contract-overrides.test.js +0 -112
- package/test/security/generator-injection.test.js +0 -195
- package/test/security/malformed-input.test.js +0 -330
- package/test/security/malformed-input.test.ts +0 -35
- package/test/security/rpc-numeric-bounds.test.js +0 -81
- package/test/security/rpc-trust.test.js +0 -202
- package/test/unit/_encrypted-output.txt +0 -6
- package/test/unit/_log-encrypted-jsons.js +0 -45
- package/test/unit/_write-keystore-fixture.js +0 -16
- package/test/unit/abi-interface.test.js +0 -110
- package/test/unit/abi-interface.test.ts +0 -109
- package/test/unit/address-wallet.test.js +0 -923
- package/test/unit/address-wallet.test.ts +0 -877
- package/test/unit/browser-provider.test.js +0 -85
- package/test/unit/browser-provider.test.ts +0 -79
- package/test/unit/contract.test.js +0 -85
- package/test/unit/contract.test.ts +0 -83
- package/test/unit/encoding-units-rlp.test.js +0 -127
- package/test/unit/encoding-units-rlp.test.ts +0 -91
- package/test/unit/errors.test.js +0 -77
- package/test/unit/errors.test.ts +0 -76
- package/test/unit/filter-by-blockhash.test.js +0 -55
- package/test/unit/filter-by-blockhash.test.ts +0 -54
- package/test/unit/fixednumber.test.js +0 -656
- package/test/unit/fixednumber.test.ts +0 -660
- package/test/unit/fixtures/encrypted-keystores-48-32-36.js +0 -9
- package/test/unit/generate-contract-cli.test.js +0 -42
- package/test/unit/generate-contract-cli.test.ts +0 -41
- package/test/unit/generate-sdk-artifacts-json.test.js +0 -113
- package/test/unit/generate-sdk-artifacts-json.test.ts +0 -110
- package/test/unit/generator.test.js +0 -149
- package/test/unit/generator.test.ts +0 -148
- package/test/unit/hashing.test.js +0 -64
- package/test/unit/hashing.test.ts +0 -63
- package/test/unit/init.test.js +0 -39
- package/test/unit/init.test.ts +0 -38
- package/test/unit/interface.test.js +0 -56
- package/test/unit/interface.test.ts +0 -54
- package/test/unit/internal-hex.test.js +0 -81
- package/test/unit/internal-hex.test.ts +0 -80
- package/test/unit/populate-transaction.test.js +0 -98
- package/test/unit/populate-transaction.test.ts +0 -64
- package/test/unit/providers.test.js +0 -252
- package/test/unit/providers.test.ts +0 -251
- package/test/unit/result.test.js +0 -80
- package/test/unit/result.test.ts +0 -79
- package/test/unit/solidity-types.test.js +0 -49
- package/test/unit/solidity-types.test.ts +0 -39
- package/test/unit/utils.test.js +0 -57
- package/test/unit/utils.test.ts +0 -56
- package/test/verbose-logger.js +0 -74
- package/tsconfig.build.json +0 -14
package/src/index.d.ts
CHANGED
|
@@ -1,122 +1,126 @@
|
|
|
1
|
-
declare const _exports: {
|
|
2
|
-
isError(error: any, code: string): boolean;
|
|
3
|
-
isCallException(error: any): boolean;
|
|
4
|
-
makeError(message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): Error & {
|
|
5
|
-
code: errors.ErrorCode;
|
|
6
|
-
shortMessage: string;
|
|
7
|
-
};
|
|
8
|
-
assert(check: any, message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): void;
|
|
9
|
-
assertArgument(check: any, message: string, name: string, value: any): void;
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
1
|
+
declare const _exports: {
|
|
2
|
+
isError(error: any, code: string): boolean;
|
|
3
|
+
isCallException(error: any): boolean;
|
|
4
|
+
makeError(message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): Error & {
|
|
5
|
+
code: errors.ErrorCode;
|
|
6
|
+
shortMessage: string;
|
|
7
|
+
};
|
|
8
|
+
assert(check: any, message: string, code: errors.ErrorCode, info?: Record<string, any> | undefined): void;
|
|
9
|
+
assertArgument(check: any, message: string, name: string, value: any): void;
|
|
10
|
+
assertSecretArgument(check: any, message: string, name: string): void;
|
|
11
|
+
ProviderError: typeof errors.ProviderError;
|
|
12
|
+
TransactionError: typeof errors.TransactionError;
|
|
13
|
+
ContractError: typeof errors.ContractError;
|
|
14
|
+
FixedNumber: typeof import("./utils/fixednumber").FixedNumber;
|
|
15
|
+
formatUnits(value: import("./utils/units").BigNumberish, decimals?: number | undefined): string;
|
|
16
|
+
parseUnits(value: string, decimals?: number | undefined): bigint;
|
|
17
|
+
formatEther(value: import("./utils/units").BigNumberish): string;
|
|
18
|
+
parseEther(value: string): bigint;
|
|
19
|
+
WeiPerEther: bigint;
|
|
20
|
+
checkResultErrors(result: any): Array<{
|
|
21
|
+
error: Error;
|
|
22
|
+
path: Array<string | number>;
|
|
23
|
+
}>;
|
|
24
|
+
Result: typeof import("./utils/result").Result;
|
|
25
|
+
encodeRlp(value: any): string;
|
|
26
|
+
decodeRlp(data: string): any;
|
|
27
|
+
keccak256(data: string | Uint8Array): string;
|
|
28
|
+
sha256(data: string | Uint8Array): string;
|
|
29
|
+
sha512(data: string | Uint8Array): string;
|
|
30
|
+
ripemd160(data: string | Uint8Array): string;
|
|
31
|
+
id(text: string): string;
|
|
32
|
+
randomBytes(length: number): Uint8Array;
|
|
33
|
+
computeHmac(algorithm: string, key: string | Uint8Array, data: string | Uint8Array): string;
|
|
34
|
+
pbkdf2(password: string | Uint8Array, salt: string | Uint8Array, iterations: number, keylen: number, algorithm?: string | undefined): string;
|
|
35
|
+
scrypt(password: string | Uint8Array, salt: string | Uint8Array, N: number, r: number, p: number, dkLen: number): Promise<string>;
|
|
36
|
+
scryptSync(password: string | Uint8Array, salt: string | Uint8Array, N: number, r: number, p: number, dkLen: number): string;
|
|
37
|
+
toUtf8String(data: import("./utils/encoding").BytesLike): string;
|
|
38
|
+
toUtf8Bytes(str: string): Uint8Array;
|
|
39
|
+
toHex(data: import("./utils/encoding").BytesLike): string;
|
|
40
|
+
hexlify(data: import("./utils/encoding").BytesLike): string;
|
|
41
|
+
arrayify(data: import("./utils/encoding").BytesLike): Uint8Array;
|
|
42
|
+
concat(items: import("./utils/encoding").BytesLike[]): string;
|
|
43
|
+
stripZerosLeft(data: import("./utils/encoding").BytesLike): string;
|
|
44
|
+
encodeBytes32String(text: string): string;
|
|
45
|
+
decodeBytes32String(bytes: import("./utils/encoding").BytesLike): string;
|
|
46
|
+
decodeBase58(data: string): Uint8Array;
|
|
47
|
+
decodeBase64(data: string): Uint8Array;
|
|
48
|
+
encodeBase58(data: import("./utils/encoding").BytesLike): string;
|
|
49
|
+
encodeBase64(data: import("./utils/encoding").BytesLike): string;
|
|
50
|
+
toUtf8CodePoints(str: string): number[];
|
|
51
|
+
isBytesLike(value: any): boolean;
|
|
52
|
+
zeroPad(value: import("./utils/encoding").BytesLike, length: number): string;
|
|
53
|
+
zeroPadValue(value: import("./utils/encoding").BytesLike, length: number): string;
|
|
54
|
+
solidityPacked(): void;
|
|
55
|
+
solidityPackedKeccak256(): void;
|
|
56
|
+
solidityPackedSha256(): void;
|
|
57
|
+
isHexString: typeof import("./internal/hex").isHexString;
|
|
58
|
+
bytesToHex: typeof import("./internal/hex").bytesToHex;
|
|
59
|
+
hexToBytes: typeof import("./internal/hex").hexToBytes;
|
|
60
|
+
isAddress(address: string): boolean;
|
|
61
|
+
getAddress(address: string): string;
|
|
62
|
+
isAddressable(value: any): boolean;
|
|
63
|
+
resolveAddress(target: any): string | Promise<string>;
|
|
64
|
+
getContractAddress(tx: {
|
|
65
|
+
from: string;
|
|
66
|
+
nonce: number;
|
|
67
|
+
}): string;
|
|
68
|
+
getCreateAddress(tx: {
|
|
69
|
+
from: string;
|
|
70
|
+
nonce: number;
|
|
71
|
+
}): string;
|
|
72
|
+
getCreate2Address(from: string, salt: string, initCodeHash: string): string;
|
|
73
|
+
computeAddress(key: string | Uint8Array): string;
|
|
74
|
+
Interface: typeof import("./abi/interface").Interface;
|
|
75
|
+
AbiCoder: typeof import("./abi/interface").AbiCoder;
|
|
76
|
+
Fragment: typeof import("./abi/fragments").Fragment;
|
|
77
|
+
NamedFragment: typeof import("./abi/fragments").NamedFragment;
|
|
78
|
+
FunctionFragment: typeof import("./abi/fragments").FunctionFragment;
|
|
79
|
+
EventFragment: typeof import("./abi/fragments").EventFragment;
|
|
80
|
+
ErrorFragment: typeof import("./abi/fragments").ErrorFragment;
|
|
81
|
+
ConstructorFragment: typeof import("./abi/fragments").ConstructorFragment;
|
|
82
|
+
StructFragment: typeof import("./abi/fragments").StructFragment;
|
|
83
|
+
FallbackFragment: typeof import("./abi/fragments").FallbackFragment;
|
|
84
|
+
ContractFactory: typeof import("./contract/contract-factory").ContractFactory;
|
|
85
|
+
_sanitizeOverrides(overrides: any): Record<string, any>;
|
|
86
|
+
BaseContract: typeof import("./contract/contract").BaseContract;
|
|
87
|
+
Contract: typeof import("./contract/contract").Contract;
|
|
88
|
+
ContractTransactionResponse: typeof import("./contract/contract").ContractTransactionResponse;
|
|
89
|
+
ContractTransactionReceipt: typeof import("./contract/contract").ContractTransactionReceipt;
|
|
90
|
+
EventLog: typeof import("./contract/contract").EventLog;
|
|
91
|
+
SigningKey: typeof import("./wallet/wallet").SigningKey;
|
|
92
|
+
AbstractSigner: typeof import("./wallet/wallet").AbstractSigner;
|
|
93
|
+
BaseWallet: typeof import("./wallet/wallet").BaseWallet;
|
|
94
|
+
Wallet: typeof import("./wallet/wallet").Wallet;
|
|
95
|
+
NonceManager: typeof import("./wallet/wallet").NonceManager;
|
|
96
|
+
JsonRpcSigner: typeof import("./wallet/wallet").JsonRpcSigner;
|
|
97
|
+
VoidSigner: typeof import("./wallet/wallet").VoidSigner;
|
|
98
|
+
getProvider(endpoint?: string | undefined, chainId?: number | undefined): import("./providers/provider").AbstractProvider;
|
|
99
|
+
WebSocketProvider: typeof import("./providers/extra-providers").WebSocketProvider;
|
|
100
|
+
IpcSocketProvider: typeof import("./providers/extra-providers").IpcSocketProvider;
|
|
101
|
+
BrowserProvider: typeof import("./providers/extra-providers").BrowserProvider;
|
|
102
|
+
FallbackProvider: typeof import("./providers/extra-providers").FallbackProvider;
|
|
103
|
+
FilterByBlockHash: typeof import("./providers/extra-providers").FilterByBlockHash;
|
|
104
|
+
JsonRpcProvider: typeof import("./providers/json-rpc-provider").JsonRpcProvider;
|
|
105
|
+
JsonRpcApiProvider: typeof import("./providers/json-rpc-provider").JsonRpcApiProvider;
|
|
106
|
+
Provider: typeof import("./providers/provider").Provider;
|
|
107
|
+
AbstractProvider: typeof import("./providers/provider").AbstractProvider;
|
|
108
|
+
Block: typeof import("./providers/provider").Block;
|
|
109
|
+
TransactionResponse: typeof import("./providers/provider").TransactionResponse;
|
|
110
|
+
TransactionReceipt: typeof import("./providers/provider").TransactionReceipt;
|
|
111
|
+
Log: typeof import("./providers/provider").Log;
|
|
112
|
+
FeeData: typeof import("./providers/provider").FeeData;
|
|
113
|
+
version: string;
|
|
114
|
+
ZeroAddress: string;
|
|
115
|
+
ZeroHash: string;
|
|
116
|
+
MaxUint256: bigint;
|
|
117
|
+
MaxUint160: bigint;
|
|
118
|
+
MinInt256: bigint;
|
|
119
|
+
MaxInt256: bigint;
|
|
120
|
+
NumericFault: string;
|
|
121
|
+
NumericFaultCode: string;
|
|
122
|
+
EtherSymbol: string;
|
|
123
|
+
N: bigint;
|
|
124
|
+
};
|
|
125
|
+
export = _exports;
|
|
126
|
+
import errors = require("./errors");
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export = EventEmitter;
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Minimal, dependency-free EventEmitter.
|
|
4
|
+
*
|
|
5
|
+
* This mirrors the subset of the Node.js `events.EventEmitter` API used by the
|
|
6
|
+
* SDK's providers and contracts, so the main import path does not depend on the
|
|
7
|
+
* Node built-in `events` module and can run in the browser.
|
|
8
|
+
*/
|
|
9
|
+
declare class EventEmitter {
|
|
10
|
+
/** @type {Map<string|symbol, Function[]>} */
|
|
11
|
+
_events: Map<string | symbol, Function[]>;
|
|
12
|
+
/**
|
|
13
|
+
* @param {string|symbol} event
|
|
14
|
+
* @param {Function} listener
|
|
15
|
+
* @returns {this}
|
|
16
|
+
*/
|
|
17
|
+
addListener(event: string | symbol, listener: Function): this;
|
|
18
|
+
/**
|
|
19
|
+
* @param {string|symbol} event
|
|
20
|
+
* @param {Function} listener
|
|
21
|
+
* @returns {this}
|
|
22
|
+
*/
|
|
23
|
+
on(event: string | symbol, listener: Function): this;
|
|
24
|
+
/**
|
|
25
|
+
* @param {string|symbol} event
|
|
26
|
+
* @param {Function} listener
|
|
27
|
+
* @returns {this}
|
|
28
|
+
*/
|
|
29
|
+
prependListener(event: string | symbol, listener: Function): this;
|
|
30
|
+
/**
|
|
31
|
+
* @param {string|symbol} event
|
|
32
|
+
* @param {Function} listener
|
|
33
|
+
* @returns {this}
|
|
34
|
+
*/
|
|
35
|
+
once(event: string | symbol, listener: Function): this;
|
|
36
|
+
/**
|
|
37
|
+
* @param {string|symbol} event
|
|
38
|
+
* @param {Function} listener
|
|
39
|
+
* @returns {this}
|
|
40
|
+
*/
|
|
41
|
+
removeListener(event: string | symbol, listener: Function): this;
|
|
42
|
+
/**
|
|
43
|
+
* @param {string|symbol} event
|
|
44
|
+
* @param {Function} listener
|
|
45
|
+
* @returns {this}
|
|
46
|
+
*/
|
|
47
|
+
off(event: string | symbol, listener: Function): this;
|
|
48
|
+
/**
|
|
49
|
+
* @param {(string|symbol)=} event
|
|
50
|
+
* @returns {this}
|
|
51
|
+
*/
|
|
52
|
+
removeAllListeners(event?: (string | symbol) | undefined): this;
|
|
53
|
+
/**
|
|
54
|
+
* @param {string|symbol} event
|
|
55
|
+
* @param {...any} args
|
|
56
|
+
* @returns {boolean}
|
|
57
|
+
*/
|
|
58
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* @param {string|symbol} event
|
|
61
|
+
* @returns {Function[]}
|
|
62
|
+
*/
|
|
63
|
+
listeners(event: string | symbol): Function[];
|
|
64
|
+
/**
|
|
65
|
+
* @param {string|symbol} event
|
|
66
|
+
* @returns {number}
|
|
67
|
+
*/
|
|
68
|
+
listenerCount(event: string | symbol): number;
|
|
69
|
+
/**
|
|
70
|
+
* @returns {(string|symbol)[]}
|
|
71
|
+
*/
|
|
72
|
+
eventNames(): (string | symbol)[];
|
|
73
|
+
}
|
|
74
|
+
declare namespace EventEmitter {
|
|
75
|
+
export { EventEmitter };
|
|
76
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Minimal, dependency-free EventEmitter.
|
|
3
|
+
*
|
|
4
|
+
* This mirrors the subset of the Node.js `events.EventEmitter` API used by the
|
|
5
|
+
* SDK's providers and contracts, so the main import path does not depend on the
|
|
6
|
+
* Node built-in `events` module and can run in the browser.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
class EventEmitter {
|
|
10
|
+
constructor() {
|
|
11
|
+
/** @type {Map<string|symbol, Function[]>} */
|
|
12
|
+
this._events = new Map();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {string|symbol} event
|
|
17
|
+
* @param {Function} listener
|
|
18
|
+
* @returns {this}
|
|
19
|
+
*/
|
|
20
|
+
addListener(event, listener) {
|
|
21
|
+
return this.on(event, listener);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string|symbol} event
|
|
26
|
+
* @param {Function} listener
|
|
27
|
+
* @returns {this}
|
|
28
|
+
*/
|
|
29
|
+
on(event, listener) {
|
|
30
|
+
if (typeof listener !== "function") throw new TypeError("listener must be a function");
|
|
31
|
+
const list = this._events.get(event);
|
|
32
|
+
if (list) list.push(listener);
|
|
33
|
+
else this._events.set(event, [listener]);
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {string|symbol} event
|
|
39
|
+
* @param {Function} listener
|
|
40
|
+
* @returns {this}
|
|
41
|
+
*/
|
|
42
|
+
prependListener(event, listener) {
|
|
43
|
+
if (typeof listener !== "function") throw new TypeError("listener must be a function");
|
|
44
|
+
const list = this._events.get(event);
|
|
45
|
+
if (list) list.unshift(listener);
|
|
46
|
+
else this._events.set(event, [listener]);
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {string|symbol} event
|
|
52
|
+
* @param {Function} listener
|
|
53
|
+
* @returns {this}
|
|
54
|
+
*/
|
|
55
|
+
once(event, listener) {
|
|
56
|
+
if (typeof listener !== "function") throw new TypeError("listener must be a function");
|
|
57
|
+
const wrapper = (...args) => {
|
|
58
|
+
this.removeListener(event, wrapper);
|
|
59
|
+
listener.apply(this, args);
|
|
60
|
+
};
|
|
61
|
+
// Preserve a reference so removeListener(original) also works.
|
|
62
|
+
wrapper.listener = listener;
|
|
63
|
+
return this.on(event, wrapper);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {string|symbol} event
|
|
68
|
+
* @param {Function} listener
|
|
69
|
+
* @returns {this}
|
|
70
|
+
*/
|
|
71
|
+
removeListener(event, listener) {
|
|
72
|
+
const list = this._events.get(event);
|
|
73
|
+
if (!list) return this;
|
|
74
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
75
|
+
if (list[i] === listener || list[i].listener === listener) {
|
|
76
|
+
list.splice(i, 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (list.length === 0) this._events.delete(event);
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {string|symbol} event
|
|
85
|
+
* @param {Function} listener
|
|
86
|
+
* @returns {this}
|
|
87
|
+
*/
|
|
88
|
+
off(event, listener) {
|
|
89
|
+
return this.removeListener(event, listener);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {(string|symbol)=} event
|
|
94
|
+
* @returns {this}
|
|
95
|
+
*/
|
|
96
|
+
removeAllListeners(event) {
|
|
97
|
+
if (event === undefined) this._events.clear();
|
|
98
|
+
else this._events.delete(event);
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* @param {string|symbol} event
|
|
104
|
+
* @param {...any} args
|
|
105
|
+
* @returns {boolean}
|
|
106
|
+
*/
|
|
107
|
+
emit(event, ...args) {
|
|
108
|
+
const list = this._events.get(event);
|
|
109
|
+
if (!list || list.length === 0) return false;
|
|
110
|
+
// Copy to tolerate mutation (e.g. once listeners) during iteration.
|
|
111
|
+
for (const listener of list.slice()) {
|
|
112
|
+
listener.apply(this, args);
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @param {string|symbol} event
|
|
119
|
+
* @returns {Function[]}
|
|
120
|
+
*/
|
|
121
|
+
listeners(event) {
|
|
122
|
+
const list = this._events.get(event);
|
|
123
|
+
return list ? list.slice() : [];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {string|symbol} event
|
|
128
|
+
* @returns {number}
|
|
129
|
+
*/
|
|
130
|
+
listenerCount(event) {
|
|
131
|
+
const list = this._events.get(event);
|
|
132
|
+
return list ? list.length : 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @returns {(string|symbol)[]}
|
|
137
|
+
*/
|
|
138
|
+
eventNames() {
|
|
139
|
+
return Array.from(this._events.keys());
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
module.exports = EventEmitter;
|
|
144
|
+
module.exports.EventEmitter = EventEmitter;
|
package/src/internal/hex.d.ts
CHANGED
|
@@ -11,12 +11,35 @@ export function isUint8Array(value: any): value is Uint8Array;
|
|
|
11
11
|
*/
|
|
12
12
|
export function normalizeHex(hex: string): string;
|
|
13
13
|
/**
|
|
14
|
-
* Format a number/bigint as a JSON-RPC QUANTITY hex string
|
|
15
|
-
*
|
|
14
|
+
* Format a number/bigint as a JSON-RPC QUANTITY hex string.
|
|
15
|
+
*
|
|
16
|
+
* Per the Ethereum JSON-RPC spec, quantities use the most compact
|
|
17
|
+
* representation with no leading zeros, with the single exception that
|
|
18
|
+
* zero is encoded as "0x0".
|
|
19
|
+
*
|
|
20
|
+
* Use this for block numbers, gas amounts, nonces, balances, and other
|
|
21
|
+
* numeric RPC parameters. Do NOT use it for DATA hex (addresses,
|
|
22
|
+
* bytecode, byte-arrays) — use `normalizeHex` for those.
|
|
23
|
+
*
|
|
24
|
+
* @param {number|bigint} value
|
|
25
|
+
* @returns {string}
|
|
16
26
|
*/
|
|
17
27
|
export function toQuantityHex(value: number | bigint): string;
|
|
18
|
-
/**
|
|
19
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Format a number/bigint as a JSON-RPC QUANTITY hex string.
|
|
30
|
+
*
|
|
31
|
+
* Per the Ethereum JSON-RPC spec, quantities use the most compact
|
|
32
|
+
* representation with no leading zeros, with the single exception that
|
|
33
|
+
* zero is encoded as "0x0".
|
|
34
|
+
*
|
|
35
|
+
* Use this for block numbers, gas amounts, nonces, balances, and other
|
|
36
|
+
* numeric RPC parameters. Do NOT use it for DATA hex (addresses,
|
|
37
|
+
* bytecode, byte-arrays) — use `normalizeHex` for those.
|
|
38
|
+
*
|
|
39
|
+
* @param {number|bigint} value
|
|
40
|
+
* @returns {string}
|
|
41
|
+
*/
|
|
42
|
+
export function toQuantity(value: number | bigint): string;
|
|
20
43
|
/**
|
|
21
44
|
* Returns true if value is a hex string.
|
|
22
45
|
* @param {any} value
|
package/src/internal/hex.js
CHANGED
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
* - All hex strings in this SDK are normalized to lowercase with a `0x` prefix.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// TextEncoder/TextDecoder are available as globals in modern browsers and in
|
|
10
|
+
// Node.js 20+, so we use the platform globals instead of requiring "util".
|
|
11
|
+
// This keeps the module free of Node built-ins and usable in the browser.
|
|
12
|
+
const _TextEncoder = globalThis.TextEncoder;
|
|
13
|
+
const _TextDecoder = globalThis.TextDecoder;
|
|
10
14
|
|
|
11
15
|
/** @type {TextEncoder} */
|
|
12
|
-
const _utf8Encoder = new
|
|
16
|
+
const _utf8Encoder = new _TextEncoder();
|
|
13
17
|
/** @type {TextDecoder} */
|
|
14
|
-
const _utf8Decoder = new
|
|
18
|
+
const _utf8Decoder = new _TextDecoder("utf-8", { fatal: false });
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
21
|
* Return true if `value` is a Uint8Array.
|