essential-eth 0.4.6 → 0.4.9-beta.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/..eslintrc.js.un~ +0 -0
- package/..npmignore.un~ +0 -0
- package/.env +1 -0
- package/.eslintignore +4 -0
- package/.eslintrc.js +34 -0
- package/.gitattributes +1 -0
- package/.github/workflows/.test.yml.un~ +0 -0
- package/.github/workflows/test.yml +29 -0
- package/.package.json.un~ +0 -0
- package/.prettierignore +7 -0
- package/.travis.yml +5 -0
- package/jest.config.js +9 -0
- package/package.json +34 -20
- package/readme.md +1 -2
- package/scripts/build-website.sh +4 -0
- package/scripts/bump-minor.sh +4 -0
- package/scripts/bump-patch.sh +4 -0
- package/scripts/fetch-chains-info.ts +70 -0
- package/scripts/pre-commit.sh +5 -0
- package/src/classes/Contract.ts +161 -0
- package/src/classes/test/Contract/crv-abi.ts +488 -0
- package/src/classes/test/Contract/crv.test.ts +56 -0
- package/src/classes/test/Contract/ens-abi.ts +452 -0
- package/src/classes/test/Contract/ens.test.ts +39 -0
- package/src/classes/test/Contract/fei-abi.ts +526 -0
- package/src/classes/test/Contract/fei.test.ts +86 -0
- package/src/classes/test/Contract/foo-abi.ts +42 -0
- package/src/classes/test/Contract/foo.test.ts +33 -0
- package/src/classes/test/Contract/uni.test.ts +72 -0
- package/src/classes/test/Contract/uniswap-abi.ts +121 -0
- package/src/classes/utils/clean-block.ts +49 -0
- package/src/classes/utils/clean-transaction.ts +35 -0
- package/src/classes/utils/encode-decode-transaction.ts +126 -0
- package/src/classes/utils/fetchers.ts +27 -0
- package/{lib/cjs/classes/utils/hex-to-decimal.d.ts → src/classes/utils/hex-to-decimal.ts} +3 -1
- package/src/index.ts +27 -0
- package/src/providers/JsonRpcProvider.ts +94 -0
- package/src/providers/test/get-block.test.ts +63 -0
- package/src/providers/test/get-network.test.ts +34 -0
- package/src/providers/utils/chains-info.ts +1079 -0
- package/src/shared/tiny-big/helpers.test.ts +30 -0
- package/src/shared/tiny-big/helpers.ts +89 -0
- package/src/shared/tiny-big/tiny-big.test.ts +10 -0
- package/src/shared/tiny-big/tiny-big.ts +36 -0
- package/src/shared/validate-type.ts +20 -0
- package/src/types/.Contract.types.ts.un~ +0 -0
- package/src/types/Block.types.ts +50 -0
- package/src/types/Contract.types.ts +67 -0
- package/src/types/Network.types.ts +8 -0
- package/src/types/Transaction.types.ts +35 -0
- package/{lib/cjs/utils/ether-to-wei.d.ts → src/utils/ether-to-wei.ts} +10 -2
- package/src/utils/index.ts +6 -0
- package/src/utils/is-address.ts +16 -0
- package/src/utils/tests/ether-to-wei.test.ts +65 -0
- package/src/utils/tests/is-address.test.ts +52 -0
- package/src/utils/tests/to-checksum-address.test.ts +43 -0
- package/src/utils/tests/wei-to-ether.test.ts +72 -0
- package/src/utils/to-checksum-address.ts +47 -0
- package/{lib/cjs/utils/wei-to-ether.d.ts → src/utils/wei-to-ether.ts} +8 -1
- package/test/global-setup.js +8 -0
- package/test/global-teardown.js +5 -0
- package/test/jest.setup-after-env.js +1 -0
- package/test/server.js +24 -0
- package/tsconfig-cjs.json +8 -0
- package/tsconfig.json +25 -0
- package/typedoc/options-new-version.js +8 -0
- package/typedoc/options.js +9 -0
- package/types/just-omit.d.ts +1 -0
- package/website/.nojekyll +1 -0
- package/website/assets/highlight.css +71 -0
- package/website/assets/icons.css +1043 -0
- package/website/assets/icons.png +0 -0
- package/website/assets/icons@2x.png +0 -0
- package/website/assets/main.js +52 -0
- package/website/assets/search.js +1 -0
- package/website/assets/style.css +1413 -0
- package/website/assets/widgets.png +0 -0
- package/website/assets/widgets@2x.png +0 -0
- package/website/classes/Contract.html +13 -0
- package/website/classes/JsonRpcProvider.html +8 -0
- package/website/classes/TinyBig.html +161 -0
- package/website/index.html +207 -0
- package/website/interfaces/Block.html +1 -0
- package/website/interfaces/JSONABIArgument.html +1 -0
- package/website/interfaces/Network.html +3 -0
- package/website/interfaces/Transaction.html +1 -0
- package/website/modules.html +32 -0
- package/website/versions/0.1.2/assets/highlight.css +57 -0
- package/website/versions/0.1.2/assets/icons.css +1043 -0
- package/website/versions/0.1.2/assets/icons.png +0 -0
- package/website/versions/0.1.2/assets/icons@2x.png +0 -0
- package/website/versions/0.1.2/assets/main.js +52 -0
- package/website/versions/0.1.2/assets/search.js +1 -0
- package/website/versions/0.1.2/assets/style.css +1341 -0
- package/website/versions/0.1.2/assets/widgets.png +0 -0
- package/website/versions/0.1.2/assets/widgets@2x.png +0 -0
- package/website/versions/0.1.2/classes/TinyBig.html +4 -0
- package/website/versions/0.1.2/index.html +20 -0
- package/website/versions/0.1.2/modules.html +23 -0
- package/website/versions/0.1.3/assets/highlight.css +64 -0
- package/website/versions/0.1.3/assets/icons.css +1043 -0
- package/website/versions/0.1.3/assets/icons.png +0 -0
- package/website/versions/0.1.3/assets/icons@2x.png +0 -0
- package/website/versions/0.1.3/assets/main.js +52 -0
- package/website/versions/0.1.3/assets/search.js +1 -0
- package/website/versions/0.1.3/assets/style.css +1341 -0
- package/website/versions/0.1.3/assets/widgets.png +0 -0
- package/website/versions/0.1.3/assets/widgets@2x.png +0 -0
- package/website/versions/0.1.3/classes/TinyBig.html +4 -0
- package/website/versions/0.1.3/index.html +53 -0
- package/website/versions/0.1.3/modules.html +23 -0
- package/website/versions/0.1.4/assets/highlight.css +64 -0
- package/website/versions/0.1.4/assets/icons.css +1043 -0
- package/website/versions/0.1.4/assets/icons.png +0 -0
- package/website/versions/0.1.4/assets/icons@2x.png +0 -0
- package/website/versions/0.1.4/assets/main.js +52 -0
- package/website/versions/0.1.4/assets/search.js +1 -0
- package/website/versions/0.1.4/assets/style.css +1341 -0
- package/website/versions/0.1.4/assets/widgets.png +0 -0
- package/website/versions/0.1.4/assets/widgets@2x.png +0 -0
- package/website/versions/0.1.4/classes/EssentialEth.html +1 -0
- package/website/versions/0.1.4/classes/TinyBig.html +4 -0
- package/website/versions/0.1.4/index.html +58 -0
- package/website/versions/0.1.4/modules.html +23 -0
- package/website/versions/0.2.0/assets/highlight.css +64 -0
- package/website/versions/0.2.0/assets/icons.css +1043 -0
- package/website/versions/0.2.0/assets/icons.png +0 -0
- package/website/versions/0.2.0/assets/icons@2x.png +0 -0
- package/website/versions/0.2.0/assets/main.js +52 -0
- package/website/versions/0.2.0/assets/search.js +1 -0
- package/website/versions/0.2.0/assets/style.css +1341 -0
- package/website/versions/0.2.0/assets/widgets.png +0 -0
- package/website/versions/0.2.0/assets/widgets@2x.png +0 -0
- package/website/versions/0.2.0/classes/EssentialEth.html +5 -0
- package/website/versions/0.2.0/classes/TinyBig.html +146 -0
- package/website/versions/0.2.0/index.html +89 -0
- package/website/versions/0.2.0/modules.html +25 -0
- package/website/versions/0.2.1/assets/highlight.css +64 -0
- package/website/versions/0.2.1/assets/icons.css +1043 -0
- package/website/versions/0.2.1/assets/icons.png +0 -0
- package/website/versions/0.2.1/assets/icons@2x.png +0 -0
- package/website/versions/0.2.1/assets/main.js +52 -0
- package/website/versions/0.2.1/assets/search.js +1 -0
- package/website/versions/0.2.1/assets/style.css +1341 -0
- package/website/versions/0.2.1/assets/widgets.png +0 -0
- package/website/versions/0.2.1/assets/widgets@2x.png +0 -0
- package/website/versions/0.2.1/classes/EssentialEth.html +5 -0
- package/website/versions/0.2.1/classes/TinyBig.html +146 -0
- package/website/versions/0.2.1/index.html +96 -0
- package/website/versions/0.2.1/modules.html +29 -0
- package/website/versions/0.2.2/assets/highlight.css +64 -0
- package/website/versions/0.2.2/assets/icons.css +1043 -0
- package/website/versions/0.2.2/assets/icons.png +0 -0
- package/website/versions/0.2.2/assets/icons@2x.png +0 -0
- package/website/versions/0.2.2/assets/main.js +52 -0
- package/website/versions/0.2.2/assets/search.js +1 -0
- package/website/versions/0.2.2/assets/style.css +1341 -0
- package/website/versions/0.2.2/assets/widgets.png +0 -0
- package/website/versions/0.2.2/assets/widgets@2x.png +0 -0
- package/website/versions/0.2.2/classes/EssentialEth.html +5 -0
- package/website/versions/0.2.2/classes/TinyBig.html +146 -0
- package/website/versions/0.2.2/index.html +96 -0
- package/website/versions/0.2.2/modules.html +29 -0
- package/website/versions/0.3.0/.nojekyll +1 -0
- package/website/versions/0.3.0/assets/highlight.css +71 -0
- package/website/versions/0.3.0/assets/icons.css +1043 -0
- package/website/versions/0.3.0/assets/icons.png +0 -0
- package/website/versions/0.3.0/assets/icons@2x.png +0 -0
- package/website/versions/0.3.0/assets/main.js +52 -0
- package/website/versions/0.3.0/assets/search.js +1 -0
- package/website/versions/0.3.0/assets/style.css +1384 -0
- package/website/versions/0.3.0/assets/widgets.png +0 -0
- package/website/versions/0.3.0/assets/widgets@2x.png +0 -0
- package/website/versions/0.3.0/classes/Contract.html +15 -0
- package/website/versions/0.3.0/classes/TinyBig.html +156 -0
- package/website/versions/0.3.0/index.html +123 -0
- package/website/versions/0.3.0/modules.html +32 -0
- package/website/versions/0.3.1/.nojekyll +1 -0
- package/website/versions/0.3.1/assets/highlight.css +71 -0
- package/website/versions/0.3.1/assets/icons.css +1043 -0
- package/website/versions/0.3.1/assets/icons.png +0 -0
- package/website/versions/0.3.1/assets/icons@2x.png +0 -0
- package/website/versions/0.3.1/assets/main.js +52 -0
- package/website/versions/0.3.1/assets/search.js +1 -0
- package/website/versions/0.3.1/assets/style.css +1384 -0
- package/website/versions/0.3.1/assets/widgets.png +0 -0
- package/website/versions/0.3.1/assets/widgets@2x.png +0 -0
- package/website/versions/0.3.1/classes/Contract.html +15 -0
- package/website/versions/0.3.1/classes/TinyBig.html +156 -0
- package/website/versions/0.3.1/index.html +123 -0
- package/website/versions/0.3.1/modules.html +32 -0
- package/website/versions/0.3.2/.nojekyll +1 -0
- package/website/versions/0.3.2/assets/highlight.css +71 -0
- package/website/versions/0.3.2/assets/icons.css +1043 -0
- package/website/versions/0.3.2/assets/icons.png +0 -0
- package/website/versions/0.3.2/assets/icons@2x.png +0 -0
- package/website/versions/0.3.2/assets/main.js +52 -0
- package/website/versions/0.3.2/assets/search.js +1 -0
- package/website/versions/0.3.2/assets/style.css +1384 -0
- package/website/versions/0.3.2/assets/widgets.png +0 -0
- package/website/versions/0.3.2/assets/widgets@2x.png +0 -0
- package/website/versions/0.3.2/classes/Contract.html +15 -0
- package/website/versions/0.3.2/classes/JsonRpcProvider.html +5 -0
- package/website/versions/0.3.2/classes/TinyBig.html +156 -0
- package/website/versions/0.3.2/index.html +123 -0
- package/website/versions/0.3.2/modules.html +32 -0
- package/website/versions/0.3.3/.nojekyll +1 -0
- package/website/versions/0.3.3/assets/highlight.css +71 -0
- package/website/versions/0.3.3/assets/icons.css +1043 -0
- package/website/versions/0.3.3/assets/icons.png +0 -0
- package/website/versions/0.3.3/assets/icons@2x.png +0 -0
- package/website/versions/0.3.3/assets/main.js +52 -0
- package/website/versions/0.3.3/assets/search.js +1 -0
- package/website/versions/0.3.3/assets/style.css +1384 -0
- package/website/versions/0.3.3/assets/widgets.png +0 -0
- package/website/versions/0.3.3/assets/widgets@2x.png +0 -0
- package/website/versions/0.3.3/classes/Contract.html +15 -0
- package/website/versions/0.3.3/classes/JsonRpcProvider.html +5 -0
- package/website/versions/0.3.3/classes/TinyBig.html +156 -0
- package/website/versions/0.3.3/index.html +123 -0
- package/website/versions/0.3.3/interfaces/Block.html +1 -0
- package/website/versions/0.3.3/interfaces/Transaction.html +1 -0
- package/website/versions/0.3.3/modules.html +32 -0
- package/website/versions/0.4.0/.nojekyll +1 -0
- package/website/versions/0.4.0/assets/highlight.css +71 -0
- package/website/versions/0.4.0/assets/icons.css +1043 -0
- package/website/versions/0.4.0/assets/icons.png +0 -0
- package/website/versions/0.4.0/assets/icons@2x.png +0 -0
- package/website/versions/0.4.0/assets/main.js +52 -0
- package/website/versions/0.4.0/assets/search.js +1 -0
- package/website/versions/0.4.0/assets/style.css +1384 -0
- package/website/versions/0.4.0/assets/widgets.png +0 -0
- package/website/versions/0.4.0/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.0/classes/Contract.html +15 -0
- package/website/versions/0.4.0/classes/JsonRpcProvider.html +6 -0
- package/website/versions/0.4.0/classes/TinyBig.html +156 -0
- package/website/versions/0.4.0/index.html +148 -0
- package/website/versions/0.4.0/interfaces/Block.html +1 -0
- package/website/versions/0.4.0/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.0/modules.html +32 -0
- package/website/versions/0.4.1/.nojekyll +1 -0
- package/website/versions/0.4.1/assets/highlight.css +71 -0
- package/website/versions/0.4.1/assets/icons.css +1043 -0
- package/website/versions/0.4.1/assets/icons.png +0 -0
- package/website/versions/0.4.1/assets/icons@2x.png +0 -0
- package/website/versions/0.4.1/assets/main.js +52 -0
- package/website/versions/0.4.1/assets/search.js +1 -0
- package/website/versions/0.4.1/assets/style.css +1384 -0
- package/website/versions/0.4.1/assets/widgets.png +0 -0
- package/website/versions/0.4.1/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.1/classes/Contract.html +15 -0
- package/website/versions/0.4.1/classes/JsonRpcProvider.html +6 -0
- package/website/versions/0.4.1/classes/TinyBig.html +156 -0
- package/website/versions/0.4.1/index.html +148 -0
- package/website/versions/0.4.1/interfaces/Block.html +1 -0
- package/website/versions/0.4.1/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.1/modules.html +32 -0
- package/website/versions/0.4.2/.nojekyll +1 -0
- package/website/versions/0.4.2/assets/highlight.css +71 -0
- package/website/versions/0.4.2/assets/icons.css +1043 -0
- package/website/versions/0.4.2/assets/icons.png +0 -0
- package/website/versions/0.4.2/assets/icons@2x.png +0 -0
- package/website/versions/0.4.2/assets/main.js +52 -0
- package/website/versions/0.4.2/assets/search.js +1 -0
- package/website/versions/0.4.2/assets/style.css +1384 -0
- package/website/versions/0.4.2/assets/widgets.png +0 -0
- package/website/versions/0.4.2/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.2/classes/Contract.html +15 -0
- package/website/versions/0.4.2/classes/JsonRpcProvider.html +8 -0
- package/website/versions/0.4.2/classes/TinyBig.html +156 -0
- package/website/versions/0.4.2/index.html +199 -0
- package/website/versions/0.4.2/interfaces/Block.html +1 -0
- package/website/versions/0.4.2/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.2/modules.html +34 -0
- package/website/versions/0.4.3/.nojekyll +1 -0
- package/website/versions/0.4.3/assets/highlight.css +71 -0
- package/website/versions/0.4.3/assets/icons.css +1043 -0
- package/website/versions/0.4.3/assets/icons.png +0 -0
- package/website/versions/0.4.3/assets/icons@2x.png +0 -0
- package/website/versions/0.4.3/assets/main.js +52 -0
- package/website/versions/0.4.3/assets/search.js +1 -0
- package/website/versions/0.4.3/assets/style.css +1384 -0
- package/website/versions/0.4.3/assets/widgets.png +0 -0
- package/website/versions/0.4.3/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.3/classes/Contract.html +15 -0
- package/website/versions/0.4.3/classes/JsonRpcProvider.html +8 -0
- package/website/versions/0.4.3/classes/TinyBig.html +159 -0
- package/website/versions/0.4.3/index.html +199 -0
- package/website/versions/0.4.3/interfaces/Block.html +1 -0
- package/website/versions/0.4.3/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.3/modules.html +34 -0
- package/website/versions/0.4.6/.nojekyll +1 -0
- package/website/versions/0.4.6/assets/highlight.css +71 -0
- package/website/versions/0.4.6/assets/icons.css +1043 -0
- package/website/versions/0.4.6/assets/icons.png +0 -0
- package/website/versions/0.4.6/assets/icons@2x.png +0 -0
- package/website/versions/0.4.6/assets/main.js +52 -0
- package/website/versions/0.4.6/assets/search.js +1 -0
- package/website/versions/0.4.6/assets/style.css +1413 -0
- package/website/versions/0.4.6/assets/widgets.png +0 -0
- package/website/versions/0.4.6/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.6/classes/Contract.html +15 -0
- package/website/versions/0.4.6/classes/JsonRpcProvider.html +8 -0
- package/website/versions/0.4.6/classes/TinyBig.html +159 -0
- package/website/versions/0.4.6/index.html +207 -0
- package/website/versions/0.4.6/interfaces/Block.html +1 -0
- package/website/versions/0.4.6/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.6/modules.html +34 -0
- package/website/versions/0.4.8/.nojekyll +1 -0
- package/website/versions/0.4.8/assets/highlight.css +71 -0
- package/website/versions/0.4.8/assets/icons.css +1043 -0
- package/website/versions/0.4.8/assets/icons.png +0 -0
- package/website/versions/0.4.8/assets/icons@2x.png +0 -0
- package/website/versions/0.4.8/assets/main.js +52 -0
- package/website/versions/0.4.8/assets/search.js +1 -0
- package/website/versions/0.4.8/assets/style.css +1413 -0
- package/website/versions/0.4.8/assets/widgets.png +0 -0
- package/website/versions/0.4.8/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.8/classes/Contract.html +15 -0
- package/website/versions/0.4.8/classes/JsonRpcProvider.html +8 -0
- package/website/versions/0.4.8/classes/TinyBig.html +161 -0
- package/website/versions/0.4.8/index.html +207 -0
- package/website/versions/0.4.8/interfaces/Block.html +1 -0
- package/website/versions/0.4.8/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.8/modules.html +34 -0
- package/website/versions/0.4.9-beta.0/.nojekyll +1 -0
- package/website/versions/0.4.9-beta.0/assets/highlight.css +71 -0
- package/website/versions/0.4.9-beta.0/assets/icons.css +1043 -0
- package/website/versions/0.4.9-beta.0/assets/icons.png +0 -0
- package/website/versions/0.4.9-beta.0/assets/icons@2x.png +0 -0
- package/website/versions/0.4.9-beta.0/assets/main.js +52 -0
- package/website/versions/0.4.9-beta.0/assets/search.js +1 -0
- package/website/versions/0.4.9-beta.0/assets/style.css +1413 -0
- package/website/versions/0.4.9-beta.0/assets/widgets.png +0 -0
- package/website/versions/0.4.9-beta.0/assets/widgets@2x.png +0 -0
- package/website/versions/0.4.9-beta.0/classes/Contract.html +13 -0
- package/website/versions/0.4.9-beta.0/classes/JsonRpcProvider.html +8 -0
- package/website/versions/0.4.9-beta.0/classes/TinyBig.html +161 -0
- package/website/versions/0.4.9-beta.0/index.html +207 -0
- package/website/versions/0.4.9-beta.0/interfaces/Block.html +1 -0
- package/website/versions/0.4.9-beta.0/interfaces/JSONABIArgument.html +1 -0
- package/website/versions/0.4.9-beta.0/interfaces/Network.html +3 -0
- package/website/versions/0.4.9-beta.0/interfaces/Transaction.html +1 -0
- package/website/versions/0.4.9-beta.0/modules.html +32 -0
- package/website/versions/versions/0.1.2/assets/highlight.css +57 -0
- package/website/versions/versions/0.1.2/assets/icons.css +1043 -0
- package/website/versions/versions/0.1.2/assets/icons.png +0 -0
- package/website/versions/versions/0.1.2/assets/icons@2x.png +0 -0
- package/website/versions/versions/0.1.2/assets/main.js +52 -0
- package/website/versions/versions/0.1.2/assets/search.js +1 -0
- package/website/versions/versions/0.1.2/assets/style.css +1341 -0
- package/website/versions/versions/0.1.2/assets/widgets.png +0 -0
- package/website/versions/versions/0.1.2/assets/widgets@2x.png +0 -0
- package/website/versions/versions/0.1.2/classes/TinyBig.html +4 -0
- package/website/versions/versions/0.1.2/index.html +20 -0
- package/website/versions/versions/0.1.2/modules.html +23 -0
- package/website/versions/versions/0.1.3/assets/highlight.css +64 -0
- package/website/versions/versions/0.1.3/assets/icons.css +1043 -0
- package/website/versions/versions/0.1.3/assets/icons.png +0 -0
- package/website/versions/versions/0.1.3/assets/icons@2x.png +0 -0
- package/website/versions/versions/0.1.3/assets/main.js +52 -0
- package/website/versions/versions/0.1.3/assets/search.js +1 -0
- package/website/versions/versions/0.1.3/assets/style.css +1341 -0
- package/website/versions/versions/0.1.3/assets/widgets.png +0 -0
- package/website/versions/versions/0.1.3/assets/widgets@2x.png +0 -0
- package/website/versions/versions/0.1.3/classes/TinyBig.html +4 -0
- package/website/versions/versions/0.1.3/index.html +53 -0
- package/website/versions/versions/0.1.3/modules.html +23 -0
- package/website/versions/versions/0.1.4/assets/highlight.css +64 -0
- package/website/versions/versions/0.1.4/assets/icons.css +1043 -0
- package/website/versions/versions/0.1.4/assets/icons.png +0 -0
- package/website/versions/versions/0.1.4/assets/icons@2x.png +0 -0
- package/website/versions/versions/0.1.4/assets/main.js +52 -0
- package/website/versions/versions/0.1.4/assets/search.js +1 -0
- package/website/versions/versions/0.1.4/assets/style.css +1341 -0
- package/website/versions/versions/0.1.4/assets/widgets.png +0 -0
- package/website/versions/versions/0.1.4/assets/widgets@2x.png +0 -0
- package/website/versions/versions/0.1.4/classes/TinyBig.html +4 -0
- package/website/versions/versions/0.1.4/index.html +58 -0
- package/website/versions/versions/0.1.4/modules.html +23 -0
- package/lib/cjs/classes/Contract.d.ts +0 -72
- package/lib/cjs/classes/Contract.js +0 -126
- package/lib/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/crv-abi.js +0 -488
- package/lib/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/ens-abi.js +0 -453
- package/lib/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/fei-abi.js +0 -526
- package/lib/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/foo-abi.js +0 -42
- package/lib/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/lib/cjs/classes/test/Contract/uniswap-abi.js +0 -121
- package/lib/cjs/classes/utils/clean-block.d.ts +0 -6
- package/lib/cjs/classes/utils/clean-block.js +0 -46
- package/lib/cjs/classes/utils/clean-transaction.d.ts +0 -5
- package/lib/cjs/classes/utils/clean-transaction.js +0 -38
- package/lib/cjs/classes/utils/encode-decode-transaction.d.ts +0 -3
- package/lib/cjs/classes/utils/encode-decode-transaction.js +0 -113
- package/lib/cjs/classes/utils/fetchers.d.ts +0 -9
- package/lib/cjs/classes/utils/fetchers.js +0 -33
- package/lib/cjs/classes/utils/hex-to-decimal.js +0 -11
- package/lib/cjs/index.d.ts +0 -12
- package/lib/cjs/index.js +0 -19
- package/lib/cjs/providers/JsonRpcProvider.d.ts +0 -22
- package/lib/cjs/providers/JsonRpcProvider.js +0 -69
- package/lib/cjs/providers/utils/chains-info.d.ts +0 -338
- package/lib/cjs/providers/utils/chains-info.js +0 -1015
- package/lib/cjs/shared/tiny-big/helpers.d.ts +0 -1
- package/lib/cjs/shared/tiny-big/helpers.js +0 -71
- package/lib/cjs/shared/tiny-big/tiny-big.d.ts +0 -19
- package/lib/cjs/shared/tiny-big/tiny-big.js +0 -41
- package/lib/cjs/shared/validate-type.d.ts +0 -3
- package/lib/cjs/shared/validate-type.js +0 -9
- package/lib/cjs/types/Block.types.d.ts +0 -47
- package/lib/cjs/types/Block.types.js +0 -2
- package/lib/cjs/types/Contract.types.d.ts +0 -24
- package/lib/cjs/types/Contract.types.js +0 -2
- package/lib/cjs/types/Network.types.d.ts +0 -8
- package/lib/cjs/types/Network.types.js +0 -2
- package/lib/cjs/types/Transaction.types.d.ts +0 -34
- package/lib/cjs/types/Transaction.types.js +0 -2
- package/lib/cjs/utils/ether-to-wei.js +0 -32
- package/lib/cjs/utils/is-address.d.ts +0 -5
- package/lib/cjs/utils/is-address.js +0 -20
- package/lib/cjs/utils/to-checksum-address.d.ts +0 -17
- package/lib/cjs/utils/to-checksum-address.js +0 -46
- package/lib/cjs/utils/wei-to-ether.js +0 -34
- package/lib/esm/classes/Contract.d.ts +0 -12
- package/lib/esm/classes/Contract.js +0 -63
- package/lib/esm/classes/test/Contract/crv-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/crv-abi.js +0 -470
- package/lib/esm/classes/test/Contract/ens-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/ens-abi.js +0 -435
- package/lib/esm/classes/test/Contract/fei-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/fei-abi.js +0 -521
- package/lib/esm/classes/test/Contract/foo-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/foo-abi.js +0 -33
- package/lib/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/lib/esm/classes/test/Contract/uniswap-abi.js +0 -116
- package/lib/esm/classes/utils/clean-block.d.ts +0 -3
- package/lib/esm/classes/utils/clean-block.js +0 -35
- package/lib/esm/classes/utils/clean-transaction.d.ts +0 -2
- package/lib/esm/classes/utils/clean-transaction.js +0 -29
- package/lib/esm/classes/utils/encode-decode-transaction.d.ts +0 -3
- package/lib/esm/classes/utils/encode-decode-transaction.js +0 -98
- package/lib/esm/classes/utils/fetchers.d.ts +0 -9
- package/lib/esm/classes/utils/fetchers.js +0 -25
- package/lib/esm/classes/utils/hex-to-decimal.d.ts +0 -1
- package/lib/esm/classes/utils/hex-to-decimal.js +0 -3
- package/lib/esm/index.d.ts +0 -12
- package/lib/esm/index.js +0 -8
- package/lib/esm/providers/JsonRpcProvider.d.ts +0 -9
- package/lib/esm/providers/JsonRpcProvider.js +0 -49
- package/lib/esm/providers/utils/chains-info.d.ts +0 -338
- package/lib/esm/providers/utils/chains-info.js +0 -1011
- package/lib/esm/shared/tiny-big/helpers.d.ts +0 -1
- package/lib/esm/shared/tiny-big/helpers.js +0 -58
- package/lib/esm/shared/tiny-big/tiny-big.d.ts +0 -8
- package/lib/esm/shared/tiny-big/tiny-big.js +0 -22
- package/lib/esm/shared/validate-type.d.ts +0 -3
- package/lib/esm/shared/validate-type.js +0 -5
- package/lib/esm/types/Block.types.d.ts +0 -47
- package/lib/esm/types/Block.types.js +0 -1
- package/lib/esm/types/Contract.types.d.ts +0 -24
- package/lib/esm/types/Contract.types.js +0 -1
- package/lib/esm/types/Network.types.d.ts +0 -5
- package/lib/esm/types/Network.types.js +0 -1
- package/lib/esm/types/Transaction.types.d.ts +0 -34
- package/lib/esm/types/Transaction.types.js +0 -1
- package/lib/esm/utils/ether-to-wei.d.ts +0 -3
- package/lib/esm/utils/ether-to-wei.js +0 -7
- package/lib/esm/utils/is-address.d.ts +0 -1
- package/lib/esm/utils/is-address.js +0 -12
- package/lib/esm/utils/to-checksum-address.d.ts +0 -1
- package/lib/esm/utils/to-checksum-address.js +0 -25
- package/lib/esm/utils/wei-to-ether.d.ts +0 -3
- package/lib/esm/utils/wei-to-ether.js +0 -7
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function scientificStrToDecimalStr(scientificString: string): string;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.scientificStrToDecimalStr = void 0;
|
|
4
|
-
// strips both leading and trailing zeroes
|
|
5
|
-
function stripTrailingZeroes(numberString) {
|
|
6
|
-
const isNegative = numberString.startsWith('-');
|
|
7
|
-
numberString = numberString.replace('-', '');
|
|
8
|
-
numberString = numberString.replace(/\.0*$/g, '' /* for numbers like "1.0" -> "1" */);
|
|
9
|
-
numberString = numberString.replace(/^0+/, '');
|
|
10
|
-
// for numbers like "1.10" -> "1.1"
|
|
11
|
-
if (numberString.includes('.')) {
|
|
12
|
-
numberString = numberString.replace(/0+$/, '');
|
|
13
|
-
}
|
|
14
|
-
if (numberString.startsWith('.')) {
|
|
15
|
-
// so that ".1" returns as "0.1"
|
|
16
|
-
numberString = `0${numberString}`;
|
|
17
|
-
}
|
|
18
|
-
return `${isNegative ? '-' : ''}${numberString}`;
|
|
19
|
-
}
|
|
20
|
-
function scientificStrToDecimalStr(scientificString) {
|
|
21
|
-
// Does not contain "e" nor "E"
|
|
22
|
-
if (!scientificString.match(/e/i /* lowercase and uppercase E */)) {
|
|
23
|
-
return stripTrailingZeroes(scientificString);
|
|
24
|
-
}
|
|
25
|
-
// eslint-disable-next-line prefer-const
|
|
26
|
-
let [base, power] = scientificString.split(/e/i /* lowercase and uppercase E */);
|
|
27
|
-
// remove the leading "-" if negative
|
|
28
|
-
const isNegative = Number(base) < 0;
|
|
29
|
-
base = base.replace('-', '');
|
|
30
|
-
base = stripTrailingZeroes(base);
|
|
31
|
-
const [wholeNumber, fraction /* move decimal this many places */ = ''] = base.split('.');
|
|
32
|
-
if (Number(power) === 0) {
|
|
33
|
-
return `${isNegative ? '-' : ''}${stripTrailingZeroes(base)}`;
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const includesDecimal = base.includes('.');
|
|
37
|
-
if (!includesDecimal) {
|
|
38
|
-
base = `${base}.`;
|
|
39
|
-
}
|
|
40
|
-
base = base.replace('.', '');
|
|
41
|
-
const baseLength = base.length;
|
|
42
|
-
let splitPaddedNumber;
|
|
43
|
-
if (Number(power) < 0) {
|
|
44
|
-
// move decimal left
|
|
45
|
-
if (wholeNumber.length < Math.abs(Number(power))) {
|
|
46
|
-
base = base.padStart(baseLength + Math.abs(Number(power)) - wholeNumber.length, '0');
|
|
47
|
-
}
|
|
48
|
-
splitPaddedNumber = base.split('');
|
|
49
|
-
if (wholeNumber.length < Math.abs(Number(power))) {
|
|
50
|
-
// starts with zeroes
|
|
51
|
-
splitPaddedNumber = ['.', ...splitPaddedNumber];
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
splitPaddedNumber.splice(splitPaddedNumber.length - Math.abs(Number(power)), 0, '.');
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// move decimal right
|
|
59
|
-
if (fraction.length < Math.abs(Number(power))) {
|
|
60
|
-
base = base.padEnd(baseLength + Math.abs(Number(power)) - fraction.length, '0');
|
|
61
|
-
}
|
|
62
|
-
splitPaddedNumber = base.split('');
|
|
63
|
-
if (fraction.length > Math.abs(Number(power))) {
|
|
64
|
-
splitPaddedNumber.splice(splitPaddedNumber.length - Math.abs(Number(power)), 0, '.');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const toReturn = stripTrailingZeroes(splitPaddedNumber.join(''));
|
|
68
|
-
return `${isNegative ? '-' : ''}${toReturn}`;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
exports.scientificStrToDecimalStr = scientificStrToDecimalStr;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Big from 'big.js';
|
|
2
|
-
/**
|
|
3
|
-
* A wrapper around big.js which expands scientific notation and creates a "toHexString" function.
|
|
4
|
-
* This is the return type of every operation on ether, wei, etc.
|
|
5
|
-
*/
|
|
6
|
-
export declare class TinyBig extends Big {
|
|
7
|
-
constructor(value: string | number | TinyBig | Big);
|
|
8
|
-
/**
|
|
9
|
-
* Used anytime you're passing in "value" to ethers or web3
|
|
10
|
-
* For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
|
|
11
|
-
*/
|
|
12
|
-
toHexString(): string;
|
|
13
|
-
toNumber(): number;
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
|
|
18
|
-
*/
|
|
19
|
-
export declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.tinyBig = exports.TinyBig = void 0;
|
|
7
|
-
const big_js_1 = __importDefault(require("big.js"));
|
|
8
|
-
const helpers_1 = require("./helpers");
|
|
9
|
-
/**
|
|
10
|
-
* A wrapper around big.js which expands scientific notation and creates a "toHexString" function.
|
|
11
|
-
* This is the return type of every operation on ether, wei, etc.
|
|
12
|
-
*/
|
|
13
|
-
class TinyBig extends big_js_1.default {
|
|
14
|
-
constructor(value) {
|
|
15
|
-
super(value);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Used anytime you're passing in "value" to ethers or web3
|
|
19
|
-
* For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
|
|
20
|
-
*/
|
|
21
|
-
toHexString() {
|
|
22
|
-
return `0x${BigInt(this.toString()).toString(16)}`;
|
|
23
|
-
}
|
|
24
|
-
toNumber() {
|
|
25
|
-
return Number((0, helpers_1.scientificStrToDecimalStr)(super.toString()));
|
|
26
|
-
}
|
|
27
|
-
toString() {
|
|
28
|
-
if (this.toNumber() === 0) {
|
|
29
|
-
return '0';
|
|
30
|
-
}
|
|
31
|
-
return (0, helpers_1.scientificStrToDecimalStr)(super.toString());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.TinyBig = TinyBig;
|
|
35
|
-
/**
|
|
36
|
-
* Helper factory function so that you don't have to type "new" when instantiating a new TinyBig
|
|
37
|
-
*/
|
|
38
|
-
function tinyBig(value) {
|
|
39
|
-
return new TinyBig(value);
|
|
40
|
-
}
|
|
41
|
-
exports.tinyBig = tinyBig;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateType = void 0;
|
|
4
|
-
const validateType = (value, allowedTypes) => {
|
|
5
|
-
if (!allowedTypes.includes(typeof value)) {
|
|
6
|
-
throw new Error(`${allowedTypes.join(' or ')} required. Received ${typeof value}`);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
exports.validateType = validateType;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { RPCTransaction, Transaction } from './Transaction.types';
|
|
2
|
-
export interface Block {
|
|
3
|
-
baseFeePerGas: string;
|
|
4
|
-
difficulty: number;
|
|
5
|
-
extraData: string;
|
|
6
|
-
gasLimit: number;
|
|
7
|
-
gasUsed: number;
|
|
8
|
-
hash: string;
|
|
9
|
-
logsBloom: string;
|
|
10
|
-
miner: string;
|
|
11
|
-
mixHash: string;
|
|
12
|
-
nonce: string;
|
|
13
|
-
number: number;
|
|
14
|
-
parentHash: string;
|
|
15
|
-
receiptsRoot: string;
|
|
16
|
-
sha3Uncles: string;
|
|
17
|
-
size: number;
|
|
18
|
-
stateRoot: string;
|
|
19
|
-
timestamp: number;
|
|
20
|
-
totalDifficulty: number;
|
|
21
|
-
transactions: string[] | Transaction[];
|
|
22
|
-
transactionsRoot: string;
|
|
23
|
-
uncles: unknown[];
|
|
24
|
-
}
|
|
25
|
-
export interface RPCBlock {
|
|
26
|
-
baseFeePerGas: string;
|
|
27
|
-
difficulty: string;
|
|
28
|
-
extraData: string;
|
|
29
|
-
gasLimit: string;
|
|
30
|
-
gasUsed: string;
|
|
31
|
-
hash: string;
|
|
32
|
-
logsBloom: string;
|
|
33
|
-
miner: string;
|
|
34
|
-
mixHash: string;
|
|
35
|
-
nonce: string;
|
|
36
|
-
number: string;
|
|
37
|
-
parentHash: string;
|
|
38
|
-
receiptsRoot: string;
|
|
39
|
-
sha3Uncles: string;
|
|
40
|
-
size: string;
|
|
41
|
-
stateRoot: string;
|
|
42
|
-
timestamp: string;
|
|
43
|
-
totalDifficulty: string;
|
|
44
|
-
transactions: Array<string> | Array<RPCTransaction>;
|
|
45
|
-
transactionsRoot: string;
|
|
46
|
-
uncles: unknown[];
|
|
47
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
|
|
2
|
-
export declare type ContractInterface = JSONABI;
|
|
3
|
-
export declare type ContractFunction<T = any> = (...args: Array<any>) => Promise<T>;
|
|
4
|
-
export declare type JSONABIArgument = {
|
|
5
|
-
anonymous?: false;
|
|
6
|
-
inputs: {
|
|
7
|
-
internalType?: ContractTypes | string;
|
|
8
|
-
name: string;
|
|
9
|
-
type: ContractTypes;
|
|
10
|
-
indexed?: boolean;
|
|
11
|
-
}[];
|
|
12
|
-
name?: string;
|
|
13
|
-
outputs?: {
|
|
14
|
-
internalType?: ContractTypes | string;
|
|
15
|
-
name: string;
|
|
16
|
-
type: ContractTypes;
|
|
17
|
-
}[];
|
|
18
|
-
stateMutability?: 'view' | 'nonpayable' | string;
|
|
19
|
-
type: 'function' | 'event' | 'constructor' | 'error';
|
|
20
|
-
gas?: number;
|
|
21
|
-
constant?: boolean;
|
|
22
|
-
payable?: boolean;
|
|
23
|
-
};
|
|
24
|
-
export declare type JSONABI = JSONABIArgument[];
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface Transaction {
|
|
2
|
-
blockHash: string;
|
|
3
|
-
blockNumber: number;
|
|
4
|
-
from: string;
|
|
5
|
-
gas: number;
|
|
6
|
-
gasPrice: string;
|
|
7
|
-
hash: string;
|
|
8
|
-
input: string;
|
|
9
|
-
nonce: number;
|
|
10
|
-
r: string;
|
|
11
|
-
s: string;
|
|
12
|
-
to: string;
|
|
13
|
-
transactionIndex: number;
|
|
14
|
-
type: number;
|
|
15
|
-
v: string;
|
|
16
|
-
value: string;
|
|
17
|
-
}
|
|
18
|
-
export interface RPCTransaction {
|
|
19
|
-
blockHash: string;
|
|
20
|
-
blockNumber: string;
|
|
21
|
-
from: string;
|
|
22
|
-
gas: string;
|
|
23
|
-
gasPrice: string;
|
|
24
|
-
hash: string;
|
|
25
|
-
input: string;
|
|
26
|
-
nonce: string;
|
|
27
|
-
r: string;
|
|
28
|
-
s: string;
|
|
29
|
-
to: string;
|
|
30
|
-
transactionIndex: string;
|
|
31
|
-
type: string;
|
|
32
|
-
v: string;
|
|
33
|
-
value: string;
|
|
34
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.etherToWei = void 0;
|
|
4
|
-
const tiny_big_1 = require("../shared/tiny-big/tiny-big");
|
|
5
|
-
const validate_type_1 = require("../shared/validate-type");
|
|
6
|
-
/**
|
|
7
|
-
* Similar to ["parseEther" in ethers.js](https://docs.ethers.io/v4/api-utils.html#ether-strings-and-wei)
|
|
8
|
-
*
|
|
9
|
-
* Similar to ["toWei" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html?highlight=towei#towei)
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```javascript
|
|
13
|
-
* etherToWei('1000').toString()
|
|
14
|
-
* // '1000000000000000000000'
|
|
15
|
-
* etherToWei(1000).toString()
|
|
16
|
-
* // '1000000000000000000000'
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```javascript
|
|
21
|
-
* etherToWei('1000').toNumber()
|
|
22
|
-
* // 1000000000000000000000
|
|
23
|
-
* etherToWei(1000).toNumber()
|
|
24
|
-
* // 1000000000000000000000
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
function etherToWei(etherQuantity) {
|
|
28
|
-
(0, validate_type_1.validateType)(etherQuantity, ['string', 'number', 'object']);
|
|
29
|
-
const result = (0, tiny_big_1.tinyBig)(etherQuantity).times('1000000000000000000');
|
|
30
|
-
return (0, tiny_big_1.tinyBig)(result);
|
|
31
|
-
}
|
|
32
|
-
exports.etherToWei = etherToWei;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isAddress = void 0;
|
|
4
|
-
const __1 = require("..");
|
|
5
|
-
const validate_type_1 = require("../shared/validate-type");
|
|
6
|
-
/**
|
|
7
|
-
* Returns a boolean as to whether the input is a valid address.
|
|
8
|
-
* Does NOT support ICAP addresses
|
|
9
|
-
*/
|
|
10
|
-
function isAddress(address) {
|
|
11
|
-
(0, validate_type_1.validateType)(address, ['string']);
|
|
12
|
-
try {
|
|
13
|
-
(0, __1.toChecksumAddress)(address);
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.isAddress = isAddress;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns an Ethereum address in proper mixed-case checksum.
|
|
3
|
-
* Does NOT support ICAP
|
|
4
|
-
*
|
|
5
|
-
* @param address - An Ethereum address. Mixed, lower, and uppercase are all valid
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```javascript
|
|
9
|
-
* toChecksumAddress('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359');
|
|
10
|
-
* // '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v4/api-utils.html#utils-getaddress)
|
|
14
|
-
*
|
|
15
|
-
* Similar to ["toChecksumAddress" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#tochecksumaddress)
|
|
16
|
-
*/
|
|
17
|
-
export declare function toChecksumAddress(address: string): string;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toChecksumAddress = void 0;
|
|
4
|
-
const sha3_1 = require("sha3");
|
|
5
|
-
const validate_type_1 = require("../shared/validate-type");
|
|
6
|
-
/**
|
|
7
|
-
* Returns an Ethereum address in proper mixed-case checksum.
|
|
8
|
-
* Does NOT support ICAP
|
|
9
|
-
*
|
|
10
|
-
* @param address - An Ethereum address. Mixed, lower, and uppercase are all valid
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```javascript
|
|
14
|
-
* toChecksumAddress('0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359');
|
|
15
|
-
* // '0xfB6916095ca1df60bB79Ce92cE3Ea74c37c5d359'
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* Similar to ["getAddress" in ethers.js](https://docs.ethers.io/v4/api-utils.html#utils-getaddress)
|
|
19
|
-
*
|
|
20
|
-
* Similar to ["toChecksumAddress" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#tochecksumaddress)
|
|
21
|
-
*/
|
|
22
|
-
function toChecksumAddress(address) {
|
|
23
|
-
(0, validate_type_1.validateType)(address, ['string']);
|
|
24
|
-
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
|
|
25
|
-
throw new Error(`Invalid Ethereum address "${address}"`);
|
|
26
|
-
}
|
|
27
|
-
const _address = address.toLowerCase().replace(/^0x/i, '');
|
|
28
|
-
const keccak = new sha3_1.Keccak(256);
|
|
29
|
-
const addressHash = keccak.update(_address).digest('hex').replace(/^0x/i, '');
|
|
30
|
-
let checksumAddress = '0x';
|
|
31
|
-
for (let i = 0; i < _address.length; i++) {
|
|
32
|
-
// If ith character is 8 to f then make it uppercase
|
|
33
|
-
if (parseInt(addressHash[i], 16) > 7) {
|
|
34
|
-
checksumAddress += _address[i].toUpperCase();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
checksumAddress += _address[i];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) &&
|
|
41
|
-
checksumAddress !== address) {
|
|
42
|
-
throw new Error(`Invalid Checksum address for "${address}"`);
|
|
43
|
-
}
|
|
44
|
-
return checksumAddress;
|
|
45
|
-
}
|
|
46
|
-
exports.toChecksumAddress = toChecksumAddress;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.weiToEther = void 0;
|
|
4
|
-
const tiny_big_1 = require("../shared/tiny-big/tiny-big");
|
|
5
|
-
const validate_type_1 = require("../shared/validate-type");
|
|
6
|
-
/**
|
|
7
|
-
* Convert from Ether to Wei
|
|
8
|
-
*
|
|
9
|
-
* Similar to ["formatEther" in ethers.js](https://docs.ethers.io/v4/api-utils.html#ether-strings-and-wei)
|
|
10
|
-
*
|
|
11
|
-
* Similar to ["fromWei" in web3](https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#fromwei)
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```javascript
|
|
15
|
-
* etherToWei('1000').toString()
|
|
16
|
-
* // '1000000000000000000000'
|
|
17
|
-
* etherToWei(1000).toString()
|
|
18
|
-
* '1000000000000000000000'
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```javascript
|
|
23
|
-
* etherToWei('1000').toNumber()
|
|
24
|
-
* // 1000000000000000000000
|
|
25
|
-
* etherToWei(1000).toNumber()
|
|
26
|
-
* // 1000000000000000000000
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
function weiToEther(weiQuantity) {
|
|
30
|
-
(0, validate_type_1.validateType)(weiQuantity, ['string', 'number', 'object']);
|
|
31
|
-
const result = (0, tiny_big_1.tinyBig)(weiQuantity).div('1000000000000000000');
|
|
32
|
-
return (0, tiny_big_1.tinyBig)(result);
|
|
33
|
-
}
|
|
34
|
-
exports.weiToEther = weiToEther;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { JsonRpcProvider } from '../providers/JsonRpcProvider';
|
|
2
|
-
import { ContractInterface } from '../types/Contract.types';
|
|
3
|
-
export declare class BaseContract {
|
|
4
|
-
readonly _address: string;
|
|
5
|
-
readonly _contractInterface: ContractInterface;
|
|
6
|
-
readonly _provider: JsonRpcProvider;
|
|
7
|
-
constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
|
|
8
|
-
}
|
|
9
|
-
export declare function defineReadOnly<T>(object: T, name: string, value: any): void;
|
|
10
|
-
export declare class Contract extends BaseContract {
|
|
11
|
-
readonly [key: string]: any;
|
|
12
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { decodeRPCResponse, encodeData, } from './utils/encode-decode-transaction';
|
|
11
|
-
import { buildRPCPostBody, post } from './utils/fetchers';
|
|
12
|
-
function estimateGas(txnData) {
|
|
13
|
-
txnData.split('').reduce((previousValue, currentValue) => {
|
|
14
|
-
const characterCost = currentValue === '0' ? 4 : 68;
|
|
15
|
-
return previousValue + characterCost;
|
|
16
|
-
}, 0);
|
|
17
|
-
}
|
|
18
|
-
export class BaseContract {
|
|
19
|
-
constructor(addressOrName, contractInterface, signerOrProvider) {
|
|
20
|
-
this._address = addressOrName;
|
|
21
|
-
this._contractInterface = contractInterface;
|
|
22
|
-
this._provider = signerOrProvider;
|
|
23
|
-
contractInterface
|
|
24
|
-
.filter((jsonABIArgument) => jsonABIArgument.type === 'function')
|
|
25
|
-
.forEach((jsonABIArgument) => {
|
|
26
|
-
if ('name' in jsonABIArgument &&
|
|
27
|
-
typeof jsonABIArgument.name === 'string') {
|
|
28
|
-
defineReadOnly(this, jsonABIArgument.name, (..._args) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
let functionArguments = _args;
|
|
30
|
-
let options = {};
|
|
31
|
-
const lastArg = _args[_args.length - 1];
|
|
32
|
-
if (!Array.isArray(lastArg) && typeof lastArg === 'object') {
|
|
33
|
-
options = lastArg;
|
|
34
|
-
functionArguments = _args.slice(0, _args.length - 1);
|
|
35
|
-
}
|
|
36
|
-
const data = encodeData(jsonABIArgument, functionArguments);
|
|
37
|
-
const decimalGas = typeof options.gasLimit === 'number'
|
|
38
|
-
? options.gasLimit
|
|
39
|
-
: typeof (jsonABIArgument === null || jsonABIArgument === void 0 ? void 0 : jsonABIArgument.gas) ===
|
|
40
|
-
'number'
|
|
41
|
-
? estimateGas(data)
|
|
42
|
-
: null;
|
|
43
|
-
const nodeResponse = yield post(this._provider._rpcUrl, buildRPCPostBody('eth_call', [
|
|
44
|
-
Object.assign({ to: this._address.toLowerCase(), data: data }, (decimalGas
|
|
45
|
-
? { gas: `0x${decimalGas.toString(16)}` }
|
|
46
|
-
: {})),
|
|
47
|
-
'latest',
|
|
48
|
-
]));
|
|
49
|
-
return decodeRPCResponse(jsonABIArgument, nodeResponse);
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export function defineReadOnly(object, name, value) {
|
|
56
|
-
Object.defineProperty(object, name, {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
value: value,
|
|
59
|
-
writable: false,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
export class Contract extends BaseContract {
|
|
63
|
-
}
|