forked from tornado-packages/ethers.js
Compare commits
142 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e5e5322c4 | ||
|
|
8fcbd9cac4 | ||
|
|
f701f390cc | ||
|
|
df685b1bd9 | ||
|
|
47f9d16eb7 | ||
|
|
cdb34b0184 | ||
|
|
44ba4a0073 | ||
|
|
c3bc38b567 | ||
|
|
d8efa7b77c | ||
|
|
a1d52c3579 | ||
|
|
b70c66ee24 | ||
|
|
e315e1a74c | ||
|
|
0f9f385a19 | ||
|
|
35c0c01a27 | ||
|
|
db550971c0 | ||
|
|
10e03e095b | ||
|
|
6b9305886f | ||
|
|
91a84102d6 | ||
|
|
bacd48cd5c | ||
|
|
a9b3edd2be | ||
|
|
4e478e625d | ||
|
|
0802b70a72 | ||
|
|
c764e9a10b | ||
|
|
8c5973e3a9 | ||
|
|
e4e951124f | ||
|
|
c58ab3a976 | ||
|
|
9060dede49 | ||
|
|
9cb2a9d89b | ||
|
|
a851b24d0a | ||
|
|
356ff2becb | ||
|
|
50b74b8806 | ||
|
|
130204dd3b | ||
|
|
ffaafc0ce1 | ||
|
|
9373864742 | ||
|
|
88e8124c37 | ||
|
|
c05a84aa65 | ||
|
|
603d47496e | ||
|
|
d661f70f3f | ||
|
|
62c798ce33 | ||
|
|
0cfeed2633 | ||
|
|
30ffa78d14 | ||
|
|
6e01e5448f | ||
|
|
d2e683e8eb | ||
|
|
2e3802a83b | ||
|
|
0816d54dd5 | ||
|
|
d4af1046c8 | ||
|
|
0a9e4cd67d | ||
|
|
e03390130c | ||
|
|
7d3af512c7 | ||
|
|
5318b939fd | ||
|
|
f06a445247 | ||
|
|
e11d4c1c20 | ||
|
|
fcf6c8fcee | ||
|
|
3ad4273b8b | ||
|
|
6315e78ea3 | ||
|
|
7eaf3c4e8b | ||
|
|
8a02029c00 | ||
|
|
4a581b9944 | ||
|
|
47ef3ebde3 | ||
|
|
f61ad27a8e | ||
|
|
c220fe2ea7 | ||
|
|
8136a6476b | ||
|
|
02a0aad612 | ||
|
|
278f841744 | ||
|
|
5f2678fb05 | ||
|
|
abeaa74da0 | ||
|
|
26a830eef5 | ||
|
|
dced2b7dac | ||
|
|
06aa30363f | ||
|
|
a32af3adc1 | ||
|
|
287d94fc45 | ||
|
|
fe1f04c6e5 | ||
|
|
f1a810dcb5 | ||
|
|
76fab923da | ||
|
|
4f2d1e1c7b | ||
|
|
ba967875f7 | ||
|
|
0d417ff2a9 | ||
|
|
20bbd12819 | ||
|
|
388edf6abc | ||
|
|
3a0d8685ca | ||
|
|
b993f7c3b6 | ||
|
|
51e72b98a2 | ||
|
|
8298e8599f | ||
|
|
fb3dffcc12 | ||
|
|
77a7323119 | ||
|
|
5a3c10a29c | ||
|
|
f9eed4cdb1 | ||
|
|
981a962543 | ||
|
|
f61a78fceb | ||
|
|
405fbbdea8 | ||
|
|
d5f360d12a | ||
|
|
09805afad5 | ||
|
|
5853530bdb | ||
|
|
5715d611e7 | ||
|
|
b39e955eb6 | ||
|
|
399356b912 | ||
|
|
4512e97f9b | ||
|
|
762c2f34ea | ||
|
|
48bbef7ade | ||
|
|
4665fb4c68 | ||
|
|
b1bb69356a | ||
|
|
a8afb72fbb | ||
|
|
085a9054f3 | ||
|
|
ddaa87a2e6 | ||
|
|
5afe840552 | ||
|
|
4d9b29de75 | ||
|
|
e1e0929348 | ||
|
|
92def9c148 | ||
|
|
557c7d4224 | ||
|
|
83957dc283 | ||
|
|
179e6ca520 | ||
|
|
2a30facb2b | ||
|
|
9b508a4656 | ||
|
|
6372a46b1b | ||
|
|
2ba4a17255 | ||
|
|
37bf4fb555 | ||
|
|
400d57621b | ||
|
|
314595113c | ||
|
|
0bf53d7804 | ||
|
|
ef84706312 | ||
|
|
6c338c1c5b | ||
|
|
8d5a13faea | ||
|
|
24e13fc0f2 | ||
|
|
faa556c1e5 | ||
|
|
1c5e1e8201 | ||
|
|
3f7dbe75ad | ||
|
|
a0f272973d | ||
|
|
b67ad79264 | ||
|
|
ccb9a0643e | ||
|
|
d0ed91840c | ||
|
|
32b1e7827a | ||
|
|
522fd16f68 | ||
|
|
803e8f9821 | ||
|
|
2cba1c7781 | ||
|
|
0b92fed9ed | ||
|
|
0a740c470d | ||
|
|
90afd9bd81 | ||
|
|
a646e4332e | ||
|
|
6cae18328d | ||
|
|
de2b1f66c6 | ||
|
|
b3f615a1b2 | ||
|
|
0e8a34805f |
81
.github/ISSUE_TEMPLATE/bug-report-legacy.yml
vendored
Normal file
81
.github/ISSUE_TEMPLATE/bug-report-legacy.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: "Bug Report v5 (legacy)"
|
||||
description: "Open an issue for a bug in Ethers v5 (legacy)"
|
||||
title: "Add Bug Title Here"
|
||||
labels: [ "investigate", "v5" ]
|
||||
assignees:
|
||||
- ricmoo
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**READ THIS FIRST** and follow all instructions, please. `:)`
|
||||
|
||||
Thank you for taking the time to report an issue. This form is for reporting **bugs within ethers**, specifically for the legacy v5 branch.
|
||||
|
||||
If you are **new to ethers** or *uncertain* whether this is a bug in ethers, a bug in another framework or a bug in your own code, please [start a discussion](https://github.com/ethers-io/ethers.js/discussions) first.
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Ethers Version
|
||||
description: What version of ethers are you using? Before opening an issue, please make sure you are up to date.
|
||||
placeholder: 5.y.z
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: search-terms
|
||||
attributes:
|
||||
label: Search Terms
|
||||
description: Have you searched for answers [in the documentation](https://docs.ethers.org), through [the issues](https://github.com/ethers-io/ethers.js/issues) and [on the discusions](https://github.com/ethers-io/ethers.js/discussions)? Please include the search terms you have tried. This helps us add more keywords where needed.
|
||||
placeholder: e.g. abi, network, utf8
|
||||
- type: textarea
|
||||
id: about-the-bug
|
||||
attributes:
|
||||
label: Describe the Problem
|
||||
description: Please describe what you expected to happen vs what did happen?
|
||||
placeholder: What happened?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: code-snippet
|
||||
attributes:
|
||||
label: Code Snippet
|
||||
description: If possible, please include a **short and concise** code snippets that can reproduce this issue. Ideally code that can be pasted into the [Ethers Playground](https://playground.ethers.org).
|
||||
placeholder: e.g. provider.getBlockNumber()
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: contract-abi
|
||||
attributes:
|
||||
label: Contract ABI
|
||||
description: If this involves a contract, please include any **concise and relevant** ABI fragments.
|
||||
placeholder: e.g. [ 'function balanceOf(address owner) view returns (uint)' ]
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: errors
|
||||
attributes:
|
||||
label: Errors
|
||||
description: If there is an error, please include the **entire error** (redacting any sensitive information).
|
||||
placeholder: "e.g. Error: invalid name (code='INVALID_ARGUMENT, ...)"
|
||||
render: shell
|
||||
- type: dropdown
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: What environment, platforms or frameworks are you using? Select all that apply.
|
||||
multiple: true
|
||||
options:
|
||||
- Ethereum (mainnet/ropsten/rinkeby/goerli)
|
||||
- Altcoin - Please specify (e.g. Polygon)
|
||||
- node.js (v12 or newer)
|
||||
- node.js (older than v12)
|
||||
- Browser (Chrome, Safari, etc)
|
||||
- React Native/Expo/JavaScriptCore
|
||||
- Hardhat
|
||||
- Geth
|
||||
- Parity
|
||||
- Ganache
|
||||
- Other (please specify)
|
||||
- type: input
|
||||
id: other-envrionment
|
||||
attributes:
|
||||
label: Environment (Other)
|
||||
placeholder: anything else?
|
||||
81
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
81
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: "Bug Report v6 (latest)"
|
||||
description: "Open an issue for a bug in Ethers v6 (latest)"
|
||||
title: "Add Bug Title Here"
|
||||
labels: [ "investigate", "v6" ]
|
||||
assignees:
|
||||
- ricmoo
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
**READ THIS FIRST** and follow all instructions, please. `:)`
|
||||
|
||||
Thank you for taking the time to report an issue. This form is for reporting **bugs within ethers**.
|
||||
|
||||
If you are **new to ethers** or *uncertain* whether this is a bug in ethers, a bug in another framework or a bug in your own code, please [start a discussion](https://github.com/ethers-io/ethers.js/discussions) first.
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: Ethers Version
|
||||
description: What version of ethers are you using? Before opening an issue, please make sure you are up to date.
|
||||
placeholder: 6.y.z
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: search-terms
|
||||
attributes:
|
||||
label: Search Terms
|
||||
description: Have you searched for answers [in the documentation](https://docs.ethers.org), through [the issues](https://github.com/ethers-io/ethers.js/issues) and [on the discusions](https://github.com/ethers-io/ethers.js/discussions)? Please include the search terms you have tried. This helps us add more keywords where needed.
|
||||
placeholder: e.g. abi, network, utf8
|
||||
- type: textarea
|
||||
id: about-the-bug
|
||||
attributes:
|
||||
label: Describe the Problem
|
||||
description: Please describe what you expected to happen vs what did happen?
|
||||
placeholder: What happened?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: code-snippet
|
||||
attributes:
|
||||
label: Code Snippet
|
||||
description: If possible, please include a **short and concise** code snippets that can reproduce this issue. Ideally code that can be pasted into the [Ethers Playground](https://playground.ethers.org).
|
||||
placeholder: e.g. provider.getBlockNumber()
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: contract-abi
|
||||
attributes:
|
||||
label: Contract ABI
|
||||
description: If this involves a contract, please include any **concise and relevant** ABI fragments.
|
||||
placeholder: e.g. [ 'function balanceOf(address owner) view returns (uint)' ]
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: errors
|
||||
attributes:
|
||||
label: Errors
|
||||
description: If there is an error, please include the **entire error** (redacting any sensitive information).
|
||||
placeholder: "e.g. Error: invalid name (code='INVALID_ARGUMENT, ...)"
|
||||
render: shell
|
||||
- type: dropdown
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: What environment, platforms or frameworks are you using? Select all that apply.
|
||||
multiple: true
|
||||
options:
|
||||
- Ethereum (mainnet/ropsten/rinkeby/goerli)
|
||||
- Altcoin - Please specify (e.g. Polygon)
|
||||
- node.js (v12 or newer)
|
||||
- node.js (older than v12)
|
||||
- Browser (Chrome, Safari, etc)
|
||||
- React Native/Expo/JavaScriptCore
|
||||
- Hardhat
|
||||
- Geth
|
||||
- Parity
|
||||
- Ganache
|
||||
- Other (please specify)
|
||||
- type: input
|
||||
id: other-envrionment
|
||||
attributes:
|
||||
label: Environment (Other)
|
||||
placeholder: anything else?
|
||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: false
|
||||
23
.github/ISSUE_TEMPLATE/documentation.yml
vendored
Normal file
23
.github/ISSUE_TEMPLATE/documentation.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Documentation
|
||||
description: Documentation update, change or suggestion
|
||||
title: "Documentation Title"
|
||||
labels: ["documentation"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Please include anything about the [documentation](https://docs.ethers.org) you would like to see improved.
|
||||
|
||||
- Missing information or details?
|
||||
- Spelling or Grammar mistakes?
|
||||
- Wrong Information?
|
||||
- Dead or wrong links?
|
||||
- Something needs code examples?
|
||||
- General feedback or anything else?
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: Suggestion
|
||||
placeholder: e.g. please add an example for ropsten
|
||||
validations:
|
||||
required: true
|
||||
26
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
26
.github/ISSUE_TEMPLATE/feature-request.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Feature Request
|
||||
description: Suggest a new feature or addition to Ethers
|
||||
title: "Feature Request Title"
|
||||
labels: [ "enhancement" ]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
The best place to start a new feature request is by starting an [Idea discussion](https://github.com/ethers-io/ethers.js/discussions), to mull over the feature, discuss current options and think through the impact on the overall library.
|
||||
|
||||
Keep in mind that features increase the library size, and may require additional dependencies. Ethers strives to remain lean and the number of dependencies low, so many features may make more sense as ancillary packages.
|
||||
- type: textarea
|
||||
id: about-the-feature
|
||||
attributes:
|
||||
label: Describe the Feature
|
||||
description: Please describe the feature, the problem it is solving, your solution and alternatives you've considered.
|
||||
placeholder: e.g. I want Ethers to be more/less magical.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: code-example
|
||||
attributes:
|
||||
label: Code Example
|
||||
description: Optionally, provide an example of how the feature would be used in code.
|
||||
placeholder: e.g. provider.doMagic()
|
||||
render: shell
|
||||
48
.github/workflows/generate-docs.yml
vendored
Normal file
48
.github/workflows/generate-docs.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Generate Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "src.ts/**"
|
||||
- "docs.wrm/**"
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
name: Generate Documentation
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
environment: ethers-tests
|
||||
env:
|
||||
FAUCET_PRIVATEKEY: ${{ secrets.FAUCET_PRIVATEKEY }}
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: "0"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Flatworm
|
||||
run: npm install --no-save 'https://github.com/ricmoo/flatworm.git#tsdocs'
|
||||
|
||||
- name: Build Documentation
|
||||
run: node node_modules/flatworm/lib/cli-test ./docs.wrm/config.js
|
||||
|
||||
- name: Upload documentation to to docs.ethers.org
|
||||
uses: ethers-io/sync-s3-action@main
|
||||
with:
|
||||
aws_access_key_id: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY}}
|
||||
aws_s3_bucket: ethers.org
|
||||
source_folder: 'output/docs/'
|
||||
destination_prefix: 'docs/'
|
||||
aws_cloudfront_id: ${{ secrets.DOCS_AWS_CLOUDFRONT_ID }}
|
||||
56
.github/workflows/test-ci.yml
vendored
56
.github/workflows/test-ci.yml
vendored
@@ -3,7 +3,9 @@ name: CI Tests
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- v6
|
||||
- main
|
||||
paths:
|
||||
- "src.ts/**"
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -30,10 +32,11 @@ jobs:
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install and run Geth
|
||||
uses: ethers-io/run-geth-action@main
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "v6"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@@ -63,10 +66,11 @@ jobs:
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Install and run Geth
|
||||
uses: ethers-io/run-geth-action@main
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "v6"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@@ -101,45 +105,3 @@ jobs:
|
||||
source_folder: 'output/'
|
||||
destination_prefix: 'build/output/'
|
||||
aws_cloudfront_id: ${{ secrets.BUILD_AWS_CLOUDFRONT_ID }}
|
||||
|
||||
docs:
|
||||
|
||||
name: Generate Documentation
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
environment: ethers-tests
|
||||
env:
|
||||
FAUCET_PRIVATEKEY: ${{ secrets.FAUCET_PRIVATEKEY }}
|
||||
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: "v6"
|
||||
fetch-depth: "0"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Flatworm
|
||||
run: npm install --no-save 'https://github.com/ricmoo/flatworm.git#tsdocs'
|
||||
|
||||
- name: Build Documentation
|
||||
run: node node_modules/flatworm/lib/test-api-index ./docs.wrm/config.js
|
||||
|
||||
- name: Upload documentation to to docs.ethers.org
|
||||
uses: ethers-io/sync-s3-action@main
|
||||
with:
|
||||
aws_access_key_id: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY}}
|
||||
aws_s3_bucket: ethers.org
|
||||
source_folder: 'output/docs/'
|
||||
destination_prefix: 'docs/'
|
||||
aws_cloudfront_id: ${{ secrets.DOCS_AWS_CLOUDFRONT_ID }}
|
||||
|
||||
48
.github/workflows/test-env.yml
vendored
Normal file
48
.github/workflows/test-env.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Environment Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
|
||||
test-env:
|
||||
name: Test Environments
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
npm_config_registry: http://localhost:8043
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
test: [ "ts-import-cjs-node16", "ts-import-esm-node16", "ts-import-cjs", "ts-import-esm" ]
|
||||
|
||||
steps:
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 18.x
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: "faux_modules/ethers"
|
||||
|
||||
- name: Install and run Faux Registry
|
||||
uses: ethers-io/hijack-npm-action@main
|
||||
|
||||
- name: Copy tests to working directory
|
||||
run: cp faux_modules/ethers/testcases/test-env/${{ matrix.test }}/* .
|
||||
|
||||
- name: Install packages
|
||||
run: npm install
|
||||
|
||||
- name: Dump Faux Logs
|
||||
run: cat .fauxNpm.log
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
|
||||
@@ -4,6 +4,8 @@ tsconfig.*.json
|
||||
tsconfig.tsbuildinfo
|
||||
rollup.config.js
|
||||
output/**
|
||||
docs.wrm/**
|
||||
.github/**
|
||||
|
||||
# Ignore admin scripts and files
|
||||
src.ts/_admin/**
|
||||
|
||||
125
CHANGELOG.md
Normal file
125
CHANGELOG.md
Normal file
@@ -0,0 +1,125 @@
|
||||
Change Log
|
||||
==========
|
||||
|
||||
This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated.
|
||||
|
||||
ethers/v6.3.1 (2023-04-22 18:55)
|
||||
--------------------------------
|
||||
|
||||
- Support transitive dependants that use non-node16 moduleResolution ([#3920](https://github.com/ethers-io/ethers.js/issues/3920); [df685b1](https://github.com/ethers-io/ethers.js/commit/df685b1bd9ad346ee7863beb6c3ca3f4e94932a2)).
|
||||
- Populate any missing log.removed with false ([#3959](https://github.com/ethers-io/ethers.js/issues/3959); [4e478e6](https://github.com/ethers-io/ethers.js/commit/4e478e625d5648f2172631eef5fda5776ee776b0)).
|
||||
|
||||
ethers/v6.3.0 (2023-04-06 04:35)
|
||||
--------------------------------
|
||||
|
||||
- Added support for legacy ABI JSON fragments ([#3932](https://github.com/ethers-io/ethers.js/issues/3932); [8c5973e](https://github.com/ethers-io/ethers.js/commit/8c5973e3a9b8d4d4ed80bdf209d8a0b6cc6b8d6d)).
|
||||
- Add _in_ operator support for contract and contract.filters ([#3901](https://github.com/ethers-io/ethers.js/issues/3901); [c58ab3a](https://github.com/ethers-io/ethers.js/commit/c58ab3a97687e15a3ffe30b038089c5f4b570bb9)).
|
||||
- Fixed TypedData unsigned value range ([#3873](https://github.com/ethers-io/ethers.js/issues/3873); [a851b24](https://github.com/ethers-io/ethers.js/commit/a851b24d0af009ecf277766d2a5f81f9b3e7f9f8)).
|
||||
- Added missing export for getIndexedAccountPath ([#3875](https://github.com/ethers-io/ethers.js/issues/3875); [356ff2b](https://github.com/ethers-io/ethers.js/commit/356ff2becb4f4d3622b281d3825770af5caf71ca)).
|
||||
- Fixed TypedData payloads for JSON-restricted chainId field ([#3836](https://github.com/ethers-io/ethers.js/issues/3836); [50b74b8](https://github.com/ethers-io/ethers.js/commit/50b74b8806ef2064f2764b09f89c7ac75fda3a3c)).
|
||||
|
||||
ethers/v6.2.3 (2023-03-27 21:22)
|
||||
--------------------------------
|
||||
|
||||
- Fixed events when emitted in WebSocketProvider ([#3767](https://github.com/ethers-io/ethers.js/issues/3767), [#3922](https://github.com/ethers-io/ethers.js/issues/3922); [ffaafc0](https://github.com/ethers-io/ethers.js/commit/ffaafc0ce1cf40d1d76d8d814c9c445057bf6989)).
|
||||
|
||||
ethers/v6.2.2 (2023-03-24 00:49)
|
||||
--------------------------------
|
||||
|
||||
- Fixed FetchRequest when using credentials ([#3897](https://github.com/ethers-io/ethers.js/issues/3897); [88e8124](https://github.com/ethers-io/ethers.js/commit/88e8124c37d377628f9b8abdf140fc07ad06259f)).
|
||||
|
||||
ethers/v6.2.1 (2023-03-23 17:33)
|
||||
--------------------------------
|
||||
|
||||
- Stall block polling bootstrap when the network is down ([#3924](https://github.com/ethers-io/ethers.js/issues/3924); [603d474](https://github.com/ethers-io/ethers.js/commit/603d47496e2b667c15b72f315261d6e299381848)).
|
||||
|
||||
ethers/v6.2.0 (2023-03-20 15:53)
|
||||
--------------------------------
|
||||
|
||||
- Added extra details in the error info field for RPC errors ([30ffa78](https://github.com/ethers-io/ethers.js/commit/30ffa78d1441fa033677fa09237fc135a314f373)).
|
||||
- Remove Ankr as a deafult for now as the provided API key is failing ([6e01e54](https://github.com/ethers-io/ethers.js/commit/6e01e5448f4a3e2d30288d4c8447db295c3a2e7a)).
|
||||
- Fixed deferred filters after unsafe-eval changes ([#3749](https://github.com/ethers-io/ethers.js/issues/3749), [#3763](https://github.com/ethers-io/ethers.js/issues/3763); [2e3802a](https://github.com/ethers-io/ethers.js/commit/2e3802a83b8ad2f5a6269d79fbd1c83c9f2d1047)).
|
||||
- Remove use of Function sub-class to address unsafe-eval issues ([#3749](https://github.com/ethers-io/ethers.js/issues/3749), [#3763](https://github.com/ethers-io/ethers.js/issues/3763); [7d3af51](https://github.com/ethers-io/ethers.js/commit/7d3af512c75b4c24027ec2daef1e9f4c1064194a)).
|
||||
- Added verifyTypedData utility (reported on Farcaster) ([f06a445](https://github.com/ethers-io/ethers.js/commit/f06a445247f3b294f9fc805cc8fe0752accb8edc)).
|
||||
- Removed stray logging in IpcProvider ([#3908](https://github.com/ethers-io/ethers.js/issues/3908), [#3909](https://github.com/ethers-io/ethers.js/issues/3909); [e11d4c1](https://github.com/ethers-io/ethers.js/commit/e11d4c1c20cc5b6fd5803cf9636c4f5bc082dab7)).
|
||||
- Fixed legacy serialization for implicit chainId transactions ([#3898](https://github.com/ethers-io/ethers.js/issues/3898), [#3899](https://github.com/ethers-io/ethers.js/issues/3899); [fcf6c8f](https://github.com/ethers-io/ethers.js/commit/fcf6c8fcee95ec412aaafba8ec84d5049b077a4e)).
|
||||
- Fix Webpack issue (reported on discord) ([3ad4273](https://github.com/ethers-io/ethers.js/commit/3ad4273b8b714bff344ccbfb1eb71ed8a8b7cfa4)).
|
||||
- Fix some bundlers which cannot handle recursive pkg.exports ([#3848](https://github.com/ethers-io/ethers.js/issues/3848); [6315e78](https://github.com/ethers-io/ethers.js/commit/6315e78ea32147653b72ca06f6800f3e2df6ffbf)).
|
||||
- Fixed typo in signature.s error ([#3891](https://github.com/ethers-io/ethers.js/issues/3891); [47ef3eb](https://github.com/ethers-io/ethers.js/commit/47ef3ebde37bfa0c015c258c3d8a6800d751e147)).
|
||||
- Fixed stray unreachable code ([#3890](https://github.com/ethers-io/ethers.js/issues/3890); [c220fe2](https://github.com/ethers-io/ethers.js/commit/c220fe2ea747ccc80cd3c4020e0278e3daf3c4fc)).
|
||||
- Move all wrapping to proper _wrap functions ([#3818](https://github.com/ethers-io/ethers.js/issues/3818); [02a0aad](https://github.com/ethers-io/ethers.js/commit/02a0aad61212c35e8d2723a8ae589989b97dae3e)).
|
||||
|
||||
ethers/v6.1.0 (2023-03-07 02:10)
|
||||
--------------------------------
|
||||
|
||||
- Fixed ethers imported in web workers ([#3856](https://github.com/ethers-io/ethers.js/issues/3856); [5f2678f](https://github.com/ethers-io/ethers.js/commit/5f2678fb059d643638b9cc1dc59cbfc61ce7a7b8)).
|
||||
- Added Sepolia support ([#3863](https://github.com/ethers-io/ethers.js/issues/3863); [abeaa74](https://github.com/ethers-io/ethers.js/commit/abeaa74da04fbe25e837a2ffa7d1e9c1257a5da5)).
|
||||
- Added missing exports ([#3734](https://github.com/ethers-io/ethers.js/issues/3734); [06aa303](https://github.com/ethers-io/ethers.js/commit/06aa30363f88144db672376d39012d7fe3f86c33)).
|
||||
- Allow null values for TypedData domain ([#3623](https://github.com/ethers-io/ethers.js/issues/3623); [a32af3a](https://github.com/ethers-io/ethers.js/commit/a32af3adc104c4b07a45097a4a3725a4ce9e0be6)).
|
||||
- Added listAccounts to JsonRpcProvider ([#3778](https://github.com/ethers-io/ethers.js/issues/3778); [287d94f](https://github.com/ethers-io/ethers.js/commit/287d94fc454d03f1b3086ea98745131cdf40129a)).
|
||||
- Allow BigInt for blockTag ([#3780](https://github.com/ethers-io/ethers.js/issues/3780); [fe1f04c](https://github.com/ethers-io/ethers.js/commit/fe1f04c6e5fb4254a100f492d7dcbdc3cf19a446)).
|
||||
- Fixed typo in error messages ([#3822](https://github.com/ethers-io/ethers.js/issues/3822), [#3824](https://github.com/ethers-io/ethers.js/issues/3824); [f1a810d](https://github.com/ethers-io/ethers.js/commit/f1a810dcb56df54b1e1567f2a59c73500619472f)).
|
||||
- Re-adding definition files to require exports ([#3703](https://github.com/ethers-io/ethers.js/issues/3703); [76fab92](https://github.com/ethers-io/ethers.js/commit/76fab923da33e71e6bb751bb0b5e3ba3faa27ab2)).
|
||||
|
||||
ethers/v6.0.8 (2023-02-23 06:30)
|
||||
--------------------------------
|
||||
|
||||
- Fix matic-mumbai network and include aliases to legacy names ([#3811](https://github.com/ethers-io/ethers.js/issues/3811); [20bbd12](https://github.com/ethers-io/ethers.js/commit/20bbd1281911d31b360f6f5032251c9257943541)).
|
||||
- Fixed getSigner bug ([#3821](https://github.com/ethers-io/ethers.js/issues/3821); [388edf6](https://github.com/ethers-io/ethers.js/commit/388edf6abc168f89f1ca609e9e5b025dc9205add)).
|
||||
|
||||
ethers/v6.0.7 (2023-02-23 01:41)
|
||||
--------------------------------
|
||||
|
||||
- Fixed getContentHash ([#3819](https://github.com/ethers-io/ethers.js/issues/3819); [b993f7c](https://github.com/ethers-io/ethers.js/commit/b993f7c3b6c0e135c460c8b8dc5943215628231a)).
|
||||
|
||||
ethers/v6.0.6 (2023-02-22 21:53)
|
||||
--------------------------------
|
||||
|
||||
- Added chain parameters for Arbitrum and Optimism ([#3811](https://github.com/ethers-io/ethers.js/issues/3811); [77a7323](https://github.com/ethers-io/ethers.js/commit/77a7323119923e596f4def4f1bc90beae5447320)).
|
||||
- Fix NonceManager race condition ([#3812](https://github.com/ethers-io/ethers.js/issues/3812), [#3813](https://github.com/ethers-io/ethers.js/issues/3813); [5a3c10a](https://github.com/ethers-io/ethers.js/commit/5a3c10a29c047609a50828adb620d88aa8cf0014)).
|
||||
- Add UMD output to dist builds ([#3814](https://github.com/ethers-io/ethers.js/issues/3814); [f9eed4c](https://github.com/ethers-io/ethers.js/commit/f9eed4cdb190b06dd4ddaa2382c1de42e8e98de6)).
|
||||
|
||||
ethers/v6.0.5 (2023-02-18 22:36)
|
||||
--------------------------------
|
||||
|
||||
- Fixed Result to behave correctly like an array using slice and toArray ([#3787](https://github.com/ethers-io/ethers.js/issues/3787); [399356b](https://github.com/ethers-io/ethers.js/commit/399356b91227db04e496628af60c4b8e38207760)).
|
||||
- Replaced substring from 0 index with startsWith ([#3691](https://github.com/ethers-io/ethers.js/issues/3691); [4512e97](https://github.com/ethers-io/ethers.js/commit/4512e97f9b55607ce388aa6eb63a37fc196a5d9d)).
|
||||
- Fixed inverted assert in duplicate name detection for ABI encoding ([#3792](https://github.com/ethers-io/ethers.js/issues/3792); [762c2f3](https://github.com/ethers-io/ethers.js/commit/762c2f34eac848c5464389f11d1697dcd8ebcbb5)).
|
||||
- Fixed missing property during transaction copy ([#3793](https://github.com/ethers-io/ethers.js/issues/3793); [48bbef7](https://github.com/ethers-io/ethers.js/commit/48bbef7ade69bcfe86542f752f15049cc62f4141)).
|
||||
- Add support for Wallet private keys without 0x prefix ([#3768](https://github.com/ethers-io/ethers.js/issues/3768); [4665fb4](https://github.com/ethers-io/ethers.js/commit/4665fb4c6886c8b344dee316ba9f4fde57ce7557)).
|
||||
- Fixed quicknode property for defaultProvider ([#3741](https://github.com/ethers-io/ethers.js/issues/3741); [a8afb72](https://github.com/ethers-io/ethers.js/commit/a8afb72fbbceb6a5024c1edb85badb72099787ea)).
|
||||
- Fixed exports field order ([#3703](https://github.com/ethers-io/ethers.js/issues/3703), [#3755](https://github.com/ethers-io/ethers.js/issues/3755); [085a905](https://github.com/ethers-io/ethers.js/commit/085a9054f349afb816ca1a123737293ec9bd2532)).
|
||||
|
||||
ethers/v6.0.4 (2023-02-16 08:55)
|
||||
--------------------------------
|
||||
|
||||
- Fixed custom error decoding ([#3785](https://github.com/ethers-io/ethers.js/issues/3785); [4d9b29d](https://github.com/ethers-io/ethers.js/commit/4d9b29de751e2387c143e474bb96d271da892ea6)).
|
||||
- Removed stray debug logging ([e1e0929](https://github.com/ethers-io/ethers.js/commit/e1e09293483a9d07fd8e8f96552aa958b5ec45ed)).
|
||||
- Fixed lookupAddress when bad resolver is present ([#3782](https://github.com/ethers-io/ethers.js/issues/3782); [92def9c](https://github.com/ethers-io/ethers.js/commit/92def9c1489bb35ad13fe58a1cd107ee3a05a112)).
|
||||
- Fixed FallbackProvider median calculation ([#3746](https://github.com/ethers-io/ethers.js/issues/3746); [83957dc](https://github.com/ethers-io/ethers.js/commit/83957dc283043b9af8f6e89920faac3e09ca69fc)).
|
||||
- Move the xnf normalize variant to pkg.browser instead of import ([#3724](https://github.com/ethers-io/ethers.js/issues/3724); [179e6ca](https://github.com/ethers-io/ethers.js/commit/179e6ca520392177c7dea5e477b29930952ed637)).
|
||||
|
||||
ethers/v6.0.3 (2023-02-12 22:45)
|
||||
--------------------------------
|
||||
|
||||
- Allow null type in transaction receipt for legacy type 0 networks ([#3459](https://github.com/ethers-io/ethers.js/issues/3459); [6372a46](https://github.com/ethers-io/ethers.js/commit/6372a46b1b273db3e4c1189daebb4b888bd588bc)).
|
||||
- Fixed events when slicing immutable Result ([#3765](https://github.com/ethers-io/ethers.js/issues/3765); [2ba4a17](https://github.com/ethers-io/ethers.js/commit/2ba4a172555b7e17ac01fedfc944549defab61bc)).
|
||||
- More robust support on networks which throw when filters are not supported ([#3767](https://github.com/ethers-io/ethers.js/issues/3767); [37bf4fb](https://github.com/ethers-io/ethers.js/commit/37bf4fb55563d7ff66edee15c7515c8a0d6a2266)).
|
||||
- Fixed ignored polling override for JsonRpcApiProvider ([400d576](https://github.com/ethers-io/ethers.js/commit/400d57621b3e9a33679a528b5072449699f0a068)).
|
||||
|
||||
ethers/v6.0.2 (2023-02-04 08:50)
|
||||
--------------------------------
|
||||
|
||||
- Fixed crossed assert in Fetch ([#3733](https://github.com/ethers-io/ethers.js/issues/3733); [6c338c1](https://github.com/ethers-io/ethers.js/commit/6c338c1c5b4013db9754c9d1a33dcbf54330e5c7)).
|
||||
|
||||
ethers/v6.0.1 (2023-02-04 04:06)
|
||||
--------------------------------
|
||||
|
||||
- Fix Subscriber model when removed within emit callback ([d0ed918](https://github.com/ethers-io/ethers.js/commit/d0ed91840c9f51c7ce9061ebb1d36727dbdd51a4)).
|
||||
- Fixed human-readable parser when identifier begins with valid type prefix ([#3728](https://github.com/ethers-io/ethers.js/issues/3728); [522fd16](https://github.com/ethers-io/ethers.js/commit/522fd16f68aabc53e4dc8745d4128e0d61260ed5)).
|
||||
- Update to latest secp256k1 library ([#3719](https://github.com/ethers-io/ethers.js/issues/3719); [803e8f9](https://github.com/ethers-io/ethers.js/commit/803e8f9821950b83efa876d64b1cfb35f6bccc38)).
|
||||
|
||||
ethers/v6.0.0 (2023-02-02 22:48)
|
||||
--------------------------------
|
||||
|
||||
- Initial release ([90afd9b](https://github.com/ethers-io/ethers.js/commit/90afd9bd81ed1408421a0247fa0845a74c9eb319)).
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2023 Richard Moore
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
43
README.md
43
README.md
@@ -1,30 +1,11 @@
|
||||
The Ethers Project
|
||||
==================
|
||||
|
||||
```
|
||||
This branch (i.e. v6-beta-exports) is still experimental and a
|
||||
playground for new ideas for the upcoming v6 release. Please
|
||||
don't use it in production yet.
|
||||
|
||||
To install:
|
||||
npm install ethers@beta-exports
|
||||
|
||||
Please try it out and report any bugs you find using the v6-beta
|
||||
template in the GitHub issues.
|
||||
|
||||
Documentation is coming, but will still take a bit of time.
|
||||
|
||||
In general, please be a patient as there is lots to do.
|
||||
|
||||
|
||||
Thanks! :)
|
||||
```
|
||||
|
||||
[](https://www.npmjs.com/package/ethers)
|
||||
[](https://github.com/ethers-io/ethers.js/actions/workflows/test-ci.yml)
|
||||
[](https://www.gitpoap.io/gh/ethers-io/ethers.js)
|
||||

|
||||
[](https://github.com/ethers-io/ethers.js/actions/workflows/test-ci.yml)
|
||||

|
||||

|
||||
[](https://www.gitpoap.io/gh/ethers-io/ethers.js)
|
||||
[](https://twitter.com/ricmoo)
|
||||
|
||||
-----
|
||||
@@ -43,7 +24,7 @@ in [TypeScript](https://www.typescriptlang.org).
|
||||
- **Tiny** (~120kb compressed; 400kb uncompressed)
|
||||
- **Tree-shaking** focused; include only what you need during bundling
|
||||
- **Complete** functionality for all your Ethereum desires
|
||||
- Extensive [documentation](https://docs.ethers.io/v5/)
|
||||
- Extensive [documentation](https://docs.ethers.org/v6/)
|
||||
- Large collection of **test cases** which are maintained and added to
|
||||
- Fully written in **TypeScript**, with strict types for security
|
||||
- **MIT License** (including ALL dependencies); completely open source to do with as you please
|
||||
@@ -57,10 +38,11 @@ For the latest news and advisories, please follow the
|
||||
non-marketing, important information only) as well as watch this GitHub project.
|
||||
|
||||
For the latest changes, see the
|
||||
[CHANGELOG](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md).
|
||||
[CHANGELOG](https://github.com/ethers-io/ethers.js/blob/main/CHANGELOG.md).
|
||||
|
||||
**Summaries**
|
||||
|
||||
- [September 2022](https://blog.ricmoo.com/highlights-ethers-js-september-2022-d7bda0fc37ed)
|
||||
- [June 2022](https://blog.ricmoo.com/highlights-ethers-js-june-2022-f5328932e35d)
|
||||
- [March 2022](https://blog.ricmoo.com/highlights-ethers-js-march-2022-f511fe1e88a1)
|
||||
- [December 2021](https://blog.ricmoo.com/highlights-ethers-js-december-2021-dc1adb779d1a)
|
||||
@@ -77,7 +59,7 @@ Installing
|
||||
**NodeJS**
|
||||
|
||||
```
|
||||
/home/ricmoo/some_project> npm install ethers@beta-exports
|
||||
/home/ricmoo/some_project> npm install ethers
|
||||
```
|
||||
|
||||
**Browser (ESM)**
|
||||
@@ -94,12 +76,10 @@ The bundled library is available in the `./dist/` folder in this repo.
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
**Note: The v6 docs are not available yet**
|
||||
Browse the [documentation](https://docs.ethers.org) online:
|
||||
|
||||
Browse the [documentation](https://docs.ethers.io) online:
|
||||
|
||||
- [Getting Started](https://docs.ethers.io/v5/getting-started/)
|
||||
- [Full API Documentation](https://docs.ethers.io/v5/api/)
|
||||
- [Getting Started](https://docs.ethers.org/v6/getting-started/)
|
||||
- [Full API Documentation](https://docs.ethers.org/v6/api/)
|
||||
- [Various Ethereum Articles](https://blog.ricmoo.com/)
|
||||
|
||||
|
||||
@@ -121,12 +101,13 @@ responses, more capacity, analytics and other features like archival
|
||||
data.
|
||||
|
||||
When you are ready to sign up and start using for your own keys, please
|
||||
check out the [Provider API Keys](https://docs.ethers.io/v5/api-keys/) in
|
||||
check out the [Provider API Keys](https://docs.ethers.org/v5/api-keys/) in
|
||||
the documentation.
|
||||
|
||||
A special thanks to these services for providing community resources:
|
||||
|
||||
- [Ankr](https://www.ankr.com/)
|
||||
- [QuickNode](https://www.quicknode.com/)
|
||||
- [Etherscan](https://etherscan.io/)
|
||||
- [INFURA](https://infura.io/)
|
||||
- [Alchemy](https://dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d)
|
||||
|
||||
34
SECURITY.md
Normal file
34
SECURITY.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Maintaining multiple versions of the library is quite time consuming, so
|
||||
the majority of the effort is focused on the latest major release.
|
||||
|
||||
If you do require a version outside of this chart updated with patch fix,
|
||||
please [contact me](mailto:github@ricmoo.com).
|
||||
|
||||
| Version | Supported | Initial Release |
|
||||
| ------- | ------------------------------------------ | ----------------- |
|
||||
| 6.0.x | :white_check_mark: | 2023-02-02 |
|
||||
| 5.0.x | :white_check_mark: (security updates) | 2020-06-12 |
|
||||
| 4.0.x | :x: | 2018-10-01 |
|
||||
| 3.0.x | :x: | 2018-03-05 |
|
||||
| 2.2.x | :x: | 2018-01-11 |
|
||||
| 2.1.x | :x: | 2017-05-22 |
|
||||
| 2.0.x | :x: | 2017-04-05 |
|
||||
| 1.0.x | :x: | 2016-08-23 |
|
||||
| 0.0.x | :x: | 2016-07-14 |
|
||||
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you identify a security vulnerability with this library (or any dependency),
|
||||
please do not hesitate to contact [github@ricmoo.com](mailto:github@ricmoo.com)
|
||||
immediately.
|
||||
|
||||
I try to respond within the same day and will address any concern as quickly
|
||||
as possible (including code fixes and publishing to NPM).
|
||||
|
||||
Any vulnerability will also be published to this file, along with credits,
|
||||
pertinent information and links to fixes.
|
||||
22
dist/README.md
vendored
Normal file
22
dist/README.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
Distribution Folder
|
||||
===================
|
||||
|
||||
The contents of this folder are for using `import` in ESM
|
||||
browser-base projects.
|
||||
|
||||
The `ethers.js` (and `ethers.min.js`) files only include the
|
||||
English wordlist to conserve space.
|
||||
|
||||
For additional Wordlist support, the `wordlist-extra.js` (and
|
||||
`wordlist-extra.min.js`) should be imported too.
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
The contents are generated via the `npm build dist` target using
|
||||
`rollup` and the `/rollup.config.js` configuration.
|
||||
|
||||
Do not modify the files in this folder. They are deleted on `build-clean`.
|
||||
|
||||
To modify this `README.md`, see the `/output/post-build/dist`.
|
||||
4796
dist/ethers.js
vendored
4796
dist/ethers.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.js.map
vendored
2
dist/ethers.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
23848
dist/ethers.umd.js
vendored
Normal file
23848
dist/ethers.umd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/ethers.umd.js.map
vendored
Normal file
1
dist/ethers.umd.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/ethers.umd.min.js
vendored
Normal file
1
dist/ethers.umd.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
34
dist/wordlists-extra.js
vendored
34
dist/wordlists-extra.js
vendored
@@ -42,9 +42,9 @@ const assert$1 = {
|
||||
|
||||
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
||||
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
||||
// big-endian hardware is rare. Just in case someone still decides to run hashes:
|
||||
// early-throw an error because we don't support BE yet.
|
||||
const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
||||
// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
|
||||
// So, just to be sure not to corrupt anything.
|
||||
if (!isLE)
|
||||
throw new Error('Non little-endian hardware is not supported');
|
||||
Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
|
||||
@@ -145,7 +145,11 @@ const u64 = {
|
||||
add, add3L, add3H, add4L, add4H, add5H, add5L,
|
||||
};
|
||||
|
||||
const version = "6.0.0";
|
||||
/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
const version = "6.3.1";
|
||||
|
||||
/**
|
||||
* Property helper functions.
|
||||
@@ -278,7 +282,7 @@ function makeError(message, code, info) {
|
||||
}
|
||||
defineProperties(error, { code });
|
||||
if (info) {
|
||||
defineProperties(error, info);
|
||||
Object.assign(error, info);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
@@ -426,7 +430,21 @@ function replaceFunc(reason, offset, bytes, output, badCodepoint) {
|
||||
// Otherwise, process as if ignoring errors
|
||||
return ignoreFunc(reason, offset, bytes);
|
||||
}
|
||||
// Common error handing strategies
|
||||
/**
|
||||
* A handful of popular, built-in UTF-8 error handling strategies.
|
||||
*
|
||||
* **``"error"``** - throws on ANY illegal UTF-8 sequence or
|
||||
* non-canonical (overlong) codepoints (this is the default)
|
||||
*
|
||||
* **``"ignore"``** - silently drops any illegal UTF-8 sequence
|
||||
* and accepts non-canonical (overlong) codepoints
|
||||
*
|
||||
* **``"replace"``** - replace any illegal UTF-8 sequence with the
|
||||
* UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts
|
||||
* non-canonical (overlong) codepoints
|
||||
*
|
||||
* @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc>
|
||||
*/
|
||||
const Utf8ErrorFuncs = Object.freeze({
|
||||
error: errorFunc,
|
||||
ignore: ignoreFunc,
|
||||
@@ -571,7 +589,7 @@ function _toUtf8String(codePoints) {
|
||||
*
|
||||
* When %%onError%% function is specified, it is called on UTF-8
|
||||
* errors allowing recovery using the [[Utf8ErrorFunc]] API.
|
||||
* (default: [error](Utf8ErrorFuncs-error))
|
||||
* (default: [error](Utf8ErrorFuncs))
|
||||
*/
|
||||
function toUtf8String(bytes, onError) {
|
||||
return _toUtf8String(getUtf8CodePoints(bytes, onError));
|
||||
@@ -828,7 +846,7 @@ Object.freeze(keccak256);
|
||||
|
||||
/**
|
||||
* A simple hashing function which operates on UTF-8 strings to
|
||||
* compute an 32-byte irentifier.
|
||||
* compute an 32-byte identifier.
|
||||
*
|
||||
* This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes
|
||||
* the [[keccak256]].
|
||||
@@ -897,7 +915,7 @@ function decodeOwl(data) {
|
||||
|
||||
/**
|
||||
* A Wordlist represents a collection of language-specific
|
||||
* words used to encode and devoce [[BIP-39]] encoded data
|
||||
* words used to encode and devoce [[link-bip-39]] encoded data
|
||||
* by mapping words to 11-bit values and vice versa.
|
||||
*/
|
||||
class Wordlist {
|
||||
|
||||
2
dist/wordlists-extra.js.map
vendored
2
dist/wordlists-extra.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/wordlists-extra.min.js
vendored
2
dist/wordlists-extra.min.js
vendored
File diff suppressed because one or more lines are too long
5
docs.wrm/README.md
Normal file
5
docs.wrm/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Documentation Source
|
||||
====================
|
||||
|
||||
This folder contains all the Flatworm source for the documentation.
|
||||
|
||||
@@ -13,11 +13,26 @@ const subtitle = (function(version) {
|
||||
return version.substring(dash + 1);
|
||||
})(version);
|
||||
|
||||
const extraLinks = function() {
|
||||
return [
|
||||
`link-cdnjs [ethers.min.js](https:/\/cdnjs.cloudflare.com/ajax/libs/ethers/${ version }/ethers.min.js)`,
|
||||
`link-cdnjs-wordlists [wordlists-extra.min.js](https:/\/cdnjs.cloudflare.com/ajax/libs/ethers/${ version }/wordlists-extra.min.js)`,
|
||||
];
|
||||
}
|
||||
|
||||
export default {
|
||||
title, subtitle,
|
||||
|
||||
// Where all the basic documentation is
|
||||
docRoot: ".",
|
||||
|
||||
// Where all the code is for the jsdocs API crawler
|
||||
codeRoot: "../src.ts/index.ts",
|
||||
|
||||
// Place all files in the /v6/ folder
|
||||
prefix: "v6",
|
||||
|
||||
// Prepare the context for running the examples
|
||||
contextify: function(context) {
|
||||
Object.assign(context, ethers);
|
||||
context.provider = new ethers.InfuraProvider();
|
||||
@@ -42,22 +57,28 @@ export default {
|
||||
};
|
||||
},
|
||||
|
||||
// The base URL to use for the <src> links
|
||||
srcBaseUrl: "https:/\/github.com/ethers-io/ethers.js/blob/main/src.ts/{FILENAME}#L{LINENO}",
|
||||
|
||||
// Used at the bottom of each page to indicate the last-modified-time.
|
||||
// This uses the most recent time in the repo that the file was
|
||||
// updated.
|
||||
getTimestamp: function(path) {
|
||||
return getModifiedTime(path);
|
||||
},
|
||||
|
||||
docRoot: ".",
|
||||
|
||||
codeRoot: "../src.ts/index.ts",
|
||||
// All the links to pull in
|
||||
links: [
|
||||
"./links/javascript.txt",
|
||||
"./links/npm.txt",
|
||||
"./links/projects.txt",
|
||||
"./links/ricmoo.txt",
|
||||
"./links/specs.txt",
|
||||
"./links/wiki.txt"
|
||||
"./links/wiki.txt",
|
||||
extraLinks
|
||||
],
|
||||
|
||||
// Extra files to copy over to the /static folder
|
||||
staticFiles: [
|
||||
"logo.svg",
|
||||
"social.jpg"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
_section: Contributings and Hacking @<about-contrib> @priority<-90>
|
||||
_section: Contributions and Hacking @<about-contrib> @priority<-90>
|
||||
|
||||
Pull requests are welcome, but please keep the following in mind:
|
||||
|
||||
@@ -93,7 +93,7 @@ _subsection: Adding Features @<about-contrib-feature>
|
||||
|
||||
Contributing new features usually require a deeper understanding
|
||||
of the internal interactions with Ethers and its components, and
|
||||
generally requires a minor version bumpincludes anything w
|
||||
generally requires a minor version bump.
|
||||
|
||||
When making any of the following changes, you must first open a
|
||||
[[link-discussion]] as the minor version will need to be bumped.
|
||||
|
||||
@@ -21,7 +21,7 @@ more fine-grained importing.
|
||||
|
||||
Generally this documentation will presume all exports from ethers
|
||||
have been imported in the code examples, but you may import the
|
||||
necessary objects any way you wish.
|
||||
necessary objects in any way you wish.
|
||||
|
||||
_code: importing in Node.js @lang<script>
|
||||
// Import everything
|
||||
@@ -48,7 +48,7 @@ objects available and what they are responsible for, at a high level.
|
||||
_heading: Provider
|
||||
|
||||
A [[Provider]] is a read-only connection to the blockchain, which allows
|
||||
querying the blockchain state, such as accout, block or transaction details,
|
||||
querying the blockchain state, such as account, block or transaction details,
|
||||
querying event logs or evaluating read-only code using call.
|
||||
|
||||
If you are coming from Web3.js, you are used to a **Provider** offering
|
||||
@@ -70,7 +70,7 @@ permission from the user and receiving authorization.
|
||||
_heading: Transaction
|
||||
|
||||
To make any state changes to the blockchain, a transaction is required,
|
||||
which requires a fee be paid, where the fee covers the associated costs
|
||||
which requires a fee to be paid, where the fee covers the associated costs
|
||||
with executing the transaction (such as reading the disk and performing
|
||||
maths) and storing the updated information.
|
||||
|
||||
@@ -118,7 +118,7 @@ extension that injects objects into the ``window``, providing:
|
||||
- authenticated write access backed by a private key (a [[Signer]])
|
||||
|
||||
When requesting access to the authenticated methods, such as
|
||||
sending a transaction or even requesting the private key addess,
|
||||
sending a transaction or even requesting the private key address,
|
||||
MetaMask will show a pop-up to the user asking for permission.
|
||||
|
||||
_code: @lang<script>
|
||||
@@ -172,7 +172,7 @@ _code: connecting to a JSON-RPC URL @lang<script>
|
||||
_subsection: User Interaction @<starting-display>
|
||||
|
||||
All units in Ethereum tend to be integer values, since dealing with
|
||||
decimals and floating points can lead to inprecise and non-obvious
|
||||
decimals and floating points can lead to imprecise and non-obvious
|
||||
results when performing mathematic operations.
|
||||
|
||||
As a result, the internal units used (e.g. wei) which are suited for
|
||||
@@ -180,7 +180,7 @@ machine-readable purposes and maths are often very large and not
|
||||
terribly human-readable.
|
||||
|
||||
For example, imagine dealing with dollars and cents; you would show
|
||||
values like ``"$2.56"``. In the blockchain world we would keep all
|
||||
values like ``"$2.56"``. In the blockchain world, we would keep all
|
||||
values as cents, so that would be ``256`` cents, internally.
|
||||
|
||||
So, when accepting data that a user types, it must be converted from
|
||||
@@ -272,7 +272,7 @@ _subsection: Contracts @<starting-contracts>
|
||||
|
||||
A **Contract** is a meta-class, which means that its definition
|
||||
its derived at run-time, based on the ABI it is passed, which then
|
||||
determined what mehods and properties are available on it.
|
||||
determined what methods and properties are available on it.
|
||||
|
||||
_heading: Application Binary Interface (ABI)
|
||||
|
||||
@@ -291,7 +291,7 @@ Any methods or events that are not needed can be safely excluded.
|
||||
There are several common formats available to describe an ABI. The
|
||||
Solidity compiler usually dumps a JSON representation but when typing
|
||||
an ABI by hand it is often easier (and more readable) to use the
|
||||
human-readable ABI, which is just the Solidity signautre.
|
||||
human-readable ABI, which is just the Solidity signature.
|
||||
|
||||
_code: simplified ERC-20 ABI @lang<script>
|
||||
abi = [
|
||||
@@ -410,7 +410,7 @@ _code: listen for ERC-20 events @lang<script>
|
||||
|
||||
// The `event.log` has the entire EventLog
|
||||
|
||||
// Optionally, convenience method to stop listening
|
||||
// Optionally, stop listening
|
||||
event.removeListener();
|
||||
});
|
||||
|
||||
@@ -478,7 +478,7 @@ it. It can also be used to sign other forms of data, which are then able
|
||||
to be validated for other purposes.
|
||||
|
||||
For example, signing **a message** can be used to prove ownership of an
|
||||
account which a website could use to authenicate a user and log them in.
|
||||
account which a website could use to authenticate a user and log them in.
|
||||
|
||||
_code: @lang<javascript>
|
||||
|
||||
|
||||
@@ -1,35 +1,28 @@
|
||||
_section: Documentation (BETA) @<about-home> @nav<Documentation>
|
||||
|
||||
**NOTE:** This documentation is for the **beta branch** (i.e. ``v6-beta-exports``), which
|
||||
is still undergoing minor changes.
|
||||
|
||||
To try it out:
|
||||
|
||||
_code:
|
||||
/home/ricmoo> npm install ethers@beta-exports
|
||||
|
||||
_null:
|
||||
|
||||
Please [report any v6 issues](link-issue) and I will get to them right away.
|
||||
|
||||
If you are looking v5 docs, please see the [v5 documentation here](link-docs-v5).
|
||||
|
||||
_subsection: What is Ethers?
|
||||
_section: Documentation @<about-home> @nav<Documentation>
|
||||
|
||||
The ethers.js library aims to be a complete and compact library
|
||||
for interacting with the Ethereum Blockchain and its ecosystem.
|
||||
|
||||
It is ofen used to create decentralized applications (dapps),
|
||||
It is often used to create decentralized applications (dapps),
|
||||
wallets (such as [[link-metamask]] and [[link-tally]]) and
|
||||
other tools and simple scripts that require reading and writing
|
||||
to the blockchain.
|
||||
|
||||
|
||||
_subsection: About this documentation?
|
||||
|
||||
These docs are still under construction, and are being expanded
|
||||
every day.
|
||||
|
||||
Developers new to Ethers shoud be sure to read through the
|
||||
Developers new to Ethers should be sure to read through the
|
||||
[[getting-started]] section.
|
||||
|
||||
And the [[about-api]] is available for drilling down into more details.
|
||||
And the [[about-api]] is available for drilling down into more details
|
||||
about the entire Application Programming Interface.
|
||||
|
||||
|
||||
_subsection: Older Documentation
|
||||
|
||||
- [v5 documentation](link-docs-v5)
|
||||
- [v4 documentation](link-docs-v4)
|
||||
- [v3 documentation](link-docs-v3)
|
||||
|
||||
@@ -24,7 +24,7 @@ link-tally [Tally](https://tallyho.org)
|
||||
# Project-specific
|
||||
link-alchemy-signup [Alchemy Signup](https://dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d)
|
||||
link-ankr-public [link-ankr-public](https://www.ankr.com/protocol/public/)
|
||||
link-ankr-premium [link-ankr-premium](https://www.ankr.com/protocol/plan/)
|
||||
link-ankr-signup [link-ankr-premium](https://www.ankr.com/protocol/plan/)
|
||||
link-etherscan-signup [Etherscan Signup](https://etherscan.io/apis)
|
||||
link-etherscan-ratelimit [link-etherscan-ratelimit](https://info.etherscan.com/api-return-errors/)
|
||||
link-infura-signup [INFURA Signup](https://infura.io/register)
|
||||
@@ -34,7 +34,7 @@ link-infura-secret [link-infura-secret](https://infura.io/docs/gettingStarted/au
|
||||
link-parity-trace [link-parity-trace](https://openethereum.github.io/wiki/JSONRPC-trace-module)
|
||||
link-parity-rpc [link-parity-rpc](https://openethereum.github.io/wiki/JSONRPC)
|
||||
link-pocket-signup [link-pocket-signup](https://pokt.network/pocket-gateway-ethereum-mainnet/)
|
||||
link-web3 [link-web3](https://github.com/ethereum/web3.js)
|
||||
link-web3js [link-web3](https://github.com/ethereum/web3.js)
|
||||
link-web3-http [link-web3-http](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http)
|
||||
link-web3-ipc [link-web3-ipc](https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-ipc)
|
||||
link-web3-send [link-web3-send](https://github.com/ethereum/web3.js/blob/1.x/packages/web3-providers-http/types/index.d.ts#L57)
|
||||
|
||||
@@ -6,9 +6,9 @@ link-ci [Ethers CI](https://github.com/ethers-io/ethers.js/actions/runs/15800690
|
||||
link-discussion [Ethers Discussion](https://github.com/ethers-io/ethers.js/discussions)
|
||||
link-issue [Open Ethers Issue](https://github.com/ethers-io/ethers.js/issues/new/choose)
|
||||
link-issues [Ethers Issues](https://github.com/ethers-io/ethers.js/issues)
|
||||
link-docs-v3 [V3 Documentation](https://docs.ethers.io/v3/)
|
||||
link-docs-v4 [V4 Documentation](https://docs.ethers.io/v4/)
|
||||
link-docs-v5 [V5 Documentation](https://docs.ethers.io/v5/)
|
||||
link-docs-v3 [V3 Documentation](https://docs.ethers.org/v3/)
|
||||
link-docs-v4 [V4 Documentation](https://docs.ethers.org/v4/)
|
||||
link-docs-v5 [V5 Documentation](https://docs.ethers.org/v5/)
|
||||
|
||||
# Social profiles
|
||||
link-repo [GitHub Repo](https://github.com/ethers-io/ethers.js)
|
||||
|
||||
@@ -26,6 +26,7 @@ link-eip-1014 [EIP-1014](https://eips.ethereum.org/EIPS/eip-1014)
|
||||
link-eip-1193 [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193)
|
||||
link-eip-1559 [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559)
|
||||
link-eip-1577 [EIP-1577](https://eips.ethereum.org/EIPS/eip-1577)
|
||||
link-eip-2070 [EIP-2930](https://eips.ethereum.org/EIPS/eip-2070)
|
||||
link-eip-2098 [EIP-2098](https://eips.ethereum.org/EIPS/eip-2098)
|
||||
link-eip-2304 [EIP-2304](https://eips.ethereum.org/EIPS/eip-2304)
|
||||
link-eip-2718 [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718)
|
||||
@@ -39,8 +40,9 @@ link-icap [ICAP Address](https://github.com/ethereum/wiki/wiki/Inter-exchange-Cl
|
||||
link-jsonrpc [link-jsonrpc](https://github.com/ethereum/wiki/wiki/JSON-RPC)
|
||||
link-mit [MIT License](https://en.m.wikipedia.org/wiki/MIT_License)
|
||||
link-namehash [namehash](https://docs.ens.domains/contract-api-reference/name-processing#hashing-names)
|
||||
link-rlp [Recursive-Length Prefix](https://github.com/ethereum/wiki/wiki/RLP)
|
||||
link-rlp [Recursive-Length Prefix](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/)
|
||||
link-pbkdf2 [PBKDF2](https://en.wikipedia.org/wiki/PBKDF2)
|
||||
link-solc-abi [ABI Specification](https://docs.soliditylang.org/en/v0.8.19/abi-spec.html#formal-specification-of-the-encoding)
|
||||
link-solc-errors [Solidity Custom Errors](https://docs.soliditylang.org/en/v0.8.4/abi-spec.html#errors)
|
||||
link-solc-events [Solidity Events](https://docs.soliditylang.org/en/v0.8.4/abi-spec.html#events)
|
||||
link-solc-output [solc standard output](https://solidity.readthedocs.io/en/v0.6.0/using-the-compiler.html#output-description)
|
||||
|
||||
@@ -10,7 +10,11 @@ so a lot of changes are largely internal.
|
||||
- [BigNumbers](migrate-bigint)
|
||||
- [Contracts](migrate-contracts)
|
||||
- [Importing](migrate-importing)
|
||||
- [Odds and Ends](migrate-other)
|
||||
- [Providers](migrate-providers)
|
||||
- [Signatures](migrate-signatures)
|
||||
- [Transactions](migrate-transactions)
|
||||
- [Utilities](migrate-utils)
|
||||
- [Removed Items](migrate-missing)
|
||||
|
||||
|
||||
_subsection: Big Numbers @<migrate-bigint>
|
||||
@@ -32,7 +36,7 @@ _code: creating large numbers @lang<script>
|
||||
// Using BigNumber in v5
|
||||
value = BigNumber.from("1000")
|
||||
|
||||
// Using BigInt in v6 (ysing literal notation).
|
||||
// Using BigInt in v6 (using literal notation).
|
||||
// Notice the suffix n
|
||||
value = 1000n
|
||||
|
||||
@@ -132,7 +136,7 @@ _code: other operations in v5 @lang<script>
|
||||
contract.functions.foo(addr)
|
||||
|
||||
// Forces using call
|
||||
contract.staticCall.foo(addr)
|
||||
contract.callStatic.foo(addr)
|
||||
|
||||
// Estimate the gas
|
||||
contract.estimateGas.foo(addr)
|
||||
@@ -193,10 +197,105 @@ _code: importing in v6 @lang<script>
|
||||
import { InfuraProvider } from "ethers/providers"
|
||||
|
||||
|
||||
_subsection: Odds and Ends @<migrate-other>
|
||||
_subsection: Providers @<migrate-providers>
|
||||
|
||||
In addition to all the ``ethers.providers.*`` being moved to
|
||||
``ethers.*``, the biggest change developers need to keep in
|
||||
mind is that ``Web3Provider`` (which historically was used
|
||||
to wrap [[link-web3js]] providers) is now called
|
||||
[[BrowserProvider]] which is designed to wrap EIP-1193
|
||||
providers, which is the standard that both modern Web3.js and
|
||||
injected providers offer.
|
||||
|
||||
_code: wrapping EIP-1193 providers @lang<script>
|
||||
// v5
|
||||
provider = new ethers.providers.Web3Provider(window.ethereum)
|
||||
|
||||
// v6:
|
||||
provider = new ethers.BrowserProvider(window.ethereum)
|
||||
|
||||
Also, the method for broadcasting transactions to the network has
|
||||
changed:
|
||||
|
||||
_code: broadcasting transactions @lang<script>
|
||||
// v5
|
||||
provider.sendTransaction(signedTx)
|
||||
|
||||
// v6
|
||||
provider.broadcastTransaction(signedTx)
|
||||
|
||||
|
||||
_code: default AbiCoder @lang<script>
|
||||
_subsection: Signatures @<migrate-signatures>
|
||||
|
||||
The Signature is now a class which facilitates all the parsing
|
||||
and serializing.
|
||||
|
||||
_code: signature manipulation
|
||||
// v5
|
||||
splitSig = splitSignature(sigBytes)
|
||||
sigBytes = joinSignature(splitSig)
|
||||
|
||||
// v6
|
||||
splitSig = ethers.Signature.from(sigBytes)
|
||||
sigBytes = ethers.Signature.from(splitSig).serialized
|
||||
|
||||
|
||||
_subsection: Transactions @<migrate-transactions>
|
||||
|
||||
The transaction helpers present in v5 were all wrapped into a
|
||||
[[Transaction]] class, which can handle any supported transaction
|
||||
format to be further processed
|
||||
|
||||
_code: parsing transactions @lang<script>
|
||||
|
||||
// v5
|
||||
tx = parseTransaction(txBytes)
|
||||
txBytes = serializeTransaction(tx)
|
||||
txBytes = serializeTransaction(tx, sig)
|
||||
|
||||
// v6
|
||||
tx = Transaction.from(txBytes)
|
||||
|
||||
// v6 (the tx can optionally include the signature)
|
||||
txBytes = Transaction.from(tx).serialized
|
||||
|
||||
|
||||
_subsection: Utilities @<migrate-utils>
|
||||
|
||||
_code: Bytes32 string helpers @lang<script>
|
||||
// In v5:
|
||||
bytes32 = ethers.utils.formatBytes32String(text)
|
||||
text = ethers.utils.parseBytes32String(bytes32)
|
||||
|
||||
// In v6:
|
||||
bytes32 = ethers.encodeBytes32String(text)
|
||||
text = ethers.decodeBytes32String(bytes32)
|
||||
|
||||
_code: constants @lang<script>
|
||||
// v5:
|
||||
ethers.constants.AddressZero
|
||||
ethers.constants.HashZero
|
||||
|
||||
// v6:
|
||||
ethers.ZeroAddress
|
||||
ethers.ZeroHash
|
||||
|
||||
_code: data manipulation @lang<script>
|
||||
// v5
|
||||
slice = ethers.utils.hexDataSlice(value, start, end)
|
||||
padded = ethers.utils.hexZeroPad(value, length)
|
||||
|
||||
// v5; converting numbers to hexstrings
|
||||
hex = hexlify(35)
|
||||
|
||||
// v6
|
||||
slice = ethers.dataSlice(value, start, end)
|
||||
padded = ethers.zeroPadValue(value, length)
|
||||
|
||||
// v6; converting numbers to hexstrings
|
||||
hex = toBeHex(35)
|
||||
|
||||
_code: defaultAbiCoder @lang<script>
|
||||
// In v5, it is a property of AbiCoder
|
||||
coder = AbiCoder.defaultAbiCoder
|
||||
|
||||
@@ -206,3 +305,65 @@ _code: default AbiCoder @lang<script>
|
||||
// instance is returned.
|
||||
coder = AbiCoder.defaultAbiCoder()
|
||||
|
||||
_code: fetching content @lang<script>
|
||||
// v5, with a body and no weird things
|
||||
data = await ethers.utils.fetchJson(url, json, processFunc)
|
||||
|
||||
// v5 with Connection overrides
|
||||
req = {
|
||||
url, user: "username", password: "password"
|
||||
// etc. properties have FetchRequest equivalents
|
||||
};
|
||||
data = await ethers.utils.detchJson(req, json, processFunc)
|
||||
|
||||
// v6
|
||||
req = new ethers.FetchRequest(url)
|
||||
|
||||
// set a body; optional
|
||||
req.body = json
|
||||
|
||||
// set credentials; optional
|
||||
req.setCredentials("username", "password")
|
||||
|
||||
// set a processFunc; optional
|
||||
req.processFunc = processFunc
|
||||
|
||||
// send the request!
|
||||
resp = await req.send()
|
||||
|
||||
// Get the response body; depending on desired format
|
||||
data = resp.body // Uint8Array
|
||||
data = resp.bodyText // Utf8String; throws if invalid
|
||||
data = resp.bodyJson // Object; throws if invalid
|
||||
|
||||
_code: hex conversion @lang<script>
|
||||
// v5
|
||||
hex = ethers.utils.hexValue(value)
|
||||
array = ethers.utils.arrayify(value)
|
||||
|
||||
// v6
|
||||
hex = ethers.toQuantity(value)
|
||||
array = ethers.getBytes(value)
|
||||
|
||||
_code: solidity non-standard packed @lang<script>
|
||||
// v5
|
||||
ethers.utils.solidityPack(types, values)
|
||||
|
||||
// v6
|
||||
ethers.solidityPacked(types, values)
|
||||
|
||||
_code: property manipulation @lang<script>
|
||||
// v5
|
||||
ethers.utils.defineReadOnly(obj, "name", value)
|
||||
|
||||
// v6
|
||||
ethers.defineProperties(obj, { name: value });
|
||||
|
||||
|
||||
_subsection: Removed Classes and functions @<migrate-missing>
|
||||
|
||||
The **Logger** class has been replaced by
|
||||
[several Error utility functions](about-errors).
|
||||
|
||||
The ``checkProperties`` and ``shallowCopy`` have been
|
||||
removed in favor of using ``.map`` and ``Object.assign``.
|
||||
|
||||
16
lib.commonjs/README.md
Normal file
16
lib.commonjs/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
CommonJS Files
|
||||
==============
|
||||
|
||||
The contents of this folder are for using `require` in CommonJS
|
||||
projects.
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
The contents are generated via the `npm run build-commonjs` target
|
||||
using `tsc` and the `/tsconfig.commonjs.json` configuration.
|
||||
|
||||
Do not modify the files in this folder. They are deleted on `build-clean`.
|
||||
|
||||
To modify this `README.md`, see the `/output/post-build/lib.commonjs`.
|
||||
84
lib.commonjs/_tests/blockchain-data.d.ts
vendored
Normal file
84
lib.commonjs/_tests/blockchain-data.d.ts
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
export type TestBlockchainNetwork = "mainnet" | "goerli";
|
||||
export interface TestBlockchainAddress {
|
||||
test: string;
|
||||
address: string;
|
||||
code?: string;
|
||||
nonce?: number;
|
||||
name?: string;
|
||||
balance?: bigint;
|
||||
storage?: Record<string, string>;
|
||||
}
|
||||
export interface TestBlockchainBlock {
|
||||
test: string;
|
||||
hash: string;
|
||||
parentHash: string;
|
||||
number: number;
|
||||
timestamp: number;
|
||||
nonce: string;
|
||||
difficulty: bigint;
|
||||
gasLimit: bigint;
|
||||
gasUsed: bigint;
|
||||
miner: string;
|
||||
extraData: string;
|
||||
transactions: Array<string>;
|
||||
baseFeePerGas?: bigint;
|
||||
}
|
||||
export interface TestBlockchainTransaction {
|
||||
test: string;
|
||||
hash: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
type: number;
|
||||
from: string;
|
||||
gasPrice: bigint;
|
||||
gasLimit: bigint;
|
||||
to: string;
|
||||
value: bigint;
|
||||
nonce: number;
|
||||
data: string;
|
||||
signature: {
|
||||
r: string;
|
||||
s: string;
|
||||
yParity: 0 | 1;
|
||||
v: number;
|
||||
networkV: null | bigint;
|
||||
};
|
||||
creates: null | string;
|
||||
chainId: bigint;
|
||||
accessList?: Array<Record<string, Array<string>>>;
|
||||
maxPriorityFeePerGas?: bigint;
|
||||
maxFeePerGas?: bigint;
|
||||
}
|
||||
export interface TestBlockchainReceipt {
|
||||
test: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
type: number;
|
||||
contractAddress: null | string;
|
||||
cumulativeGasUsed: bigint;
|
||||
from: string;
|
||||
gasUsed: bigint;
|
||||
gasPrice: bigint;
|
||||
logs: Array<{
|
||||
address: string;
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
data: string;
|
||||
index: number;
|
||||
topics: Array<string>;
|
||||
transactionHash: string;
|
||||
transactionIndex: number;
|
||||
}>;
|
||||
logsBloom: string;
|
||||
root: null | string;
|
||||
status: null | number;
|
||||
to: string;
|
||||
hash: string;
|
||||
index: number;
|
||||
}
|
||||
export declare const testAddress: Record<TestBlockchainNetwork, Array<TestBlockchainAddress>>;
|
||||
export declare const testBlock: Record<TestBlockchainNetwork, Array<TestBlockchainBlock>>;
|
||||
export declare const testTransaction: Record<TestBlockchainNetwork, Array<TestBlockchainTransaction>>;
|
||||
export declare const testReceipt: Record<TestBlockchainNetwork, Array<TestBlockchainReceipt>>;
|
||||
export declare const networkNames: Array<TestBlockchainNetwork>;
|
||||
export declare function networkFeatureAtBlock(feature: string, block: number): boolean;
|
||||
7
lib.commonjs/_tests/create-provider.d.ts
vendored
Normal file
7
lib.commonjs/_tests/create-provider.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { AbstractProvider } from "../index.js";
|
||||
export declare function setupProviders(): void;
|
||||
export declare const providerNames: readonly string[];
|
||||
export declare function getProviderNetworks(provider: string): Array<string>;
|
||||
export declare function getProvider(provider: string, network: string): null | AbstractProvider;
|
||||
export declare function checkProvider(provider: string, network: string): boolean;
|
||||
export declare function connect(network: string): AbstractProvider;
|
||||
@@ -13,13 +13,15 @@ const ProviderCreators = [
|
||||
return new index_js_1.AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM");
|
||||
}
|
||||
},
|
||||
/*
|
||||
{
|
||||
name: "AnkrProvider",
|
||||
networks: ethNetworks.concat(["matic", "arbitrum"]),
|
||||
create: function (network) {
|
||||
return new index_js_1.AnkrProvider(network);
|
||||
networks: ethNetworks.concat([ "matic", "arbitrum" ]),
|
||||
create: function(network: string) {
|
||||
return new AnkrProvider(network);
|
||||
}
|
||||
},
|
||||
*/
|
||||
/*
|
||||
{
|
||||
name: "CloudflareProvider",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../src.ts/_tests/create-provider.ts"],"names":[],"mappings":";;;AAAA,0CAWqB;AAQpB,CAAC;AAEF,MAAM,WAAW,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AC,CAAC;IACrC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;AAC7B,CAAC;AAHD,sCAGC;AAED,SAAgB,OAAO,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAyB,OAAQ,EAAE,CAAC,CAAC;KAAE;IAC/E,OAAO,QAAQ,CAAC;AACpB,CAAC;AAJD,0BAIC"}
|
||||
1
lib.commonjs/_tests/test-abi.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-abi.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -120,4 +120,138 @@ describe("Test Interface", function () {
|
||||
assert_1.default.equal(log.args[2], BigInt(234));
|
||||
});
|
||||
});
|
||||
describe("Tests Legacy ABI formats", function () {
|
||||
// See: #3932
|
||||
const iface = new index_js_1.Interface([
|
||||
{
|
||||
name: "implicitView",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"constant": true,
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "implicitSendNonpay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"constant": false,
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "implicitSendPay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"constant": false,
|
||||
"payable": true,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "implicitSendImplicitPay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"constant": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "implicitSendExplicitPay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
payable: true,
|
||||
type: "function"
|
||||
},
|
||||
{
|
||||
name: "implicitSendExplicitNonpay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
payable: false,
|
||||
type: "function"
|
||||
},
|
||||
{
|
||||
name: "implicitAll",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "explicitView",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"constant": true,
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "explicitPure",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"stateMutability": "pure",
|
||||
"constant": true,
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "explicitPay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"stateMutability": "payable",
|
||||
"constant": true,
|
||||
"payable": true,
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
name: "explicitNonpay",
|
||||
outputs: [],
|
||||
inputs: [
|
||||
{ type: "int128", name: "arg0" }
|
||||
],
|
||||
"stateMutability": "nonpayable",
|
||||
"constant": true,
|
||||
"payable": false,
|
||||
"type": "function"
|
||||
},
|
||||
]);
|
||||
function test(name, isConst, payable, stateMutability) {
|
||||
it(`tests ABI configuration: ${name}`, function () {
|
||||
const f = iface.getFunction(name);
|
||||
assert_1.default.ok(!!f, `missing ${name}`);
|
||||
assert_1.default.equal(f.constant, isConst, `${name}.constant`);
|
||||
assert_1.default.equal(f.stateMutability, stateMutability, `${name}.stateMutability`);
|
||||
assert_1.default.equal(f.payable, payable, `${name}.payable`);
|
||||
});
|
||||
}
|
||||
test("explicitView", true, false, "view");
|
||||
test("explicitPure", true, false, "pure");
|
||||
test("explicitPay", false, true, "payable");
|
||||
test("explicitNonpay", false, false, "nonpayable");
|
||||
test("implicitView", true, false, "view");
|
||||
test("implicitSendNonpay", false, false, "nonpayable");
|
||||
test("implicitSendPay", false, true, "payable");
|
||||
test("implicitSendImplicitPay", false, true, "payable");
|
||||
test("implicitSendExplicitPay", false, true, "payable");
|
||||
test("implicitSendExplicitNonpay", false, false, "nonpayable");
|
||||
test("implicitAll", false, true, "payable");
|
||||
});
|
||||
//# sourceMappingURL=test-abi.js.map
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-address.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-address.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-contract-integ.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-contract-integ.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
80
lib.commonjs/_tests/test-contract-integ.js
Normal file
80
lib.commonjs/_tests/test-contract-integ.js
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = __importDefault(require("assert"));
|
||||
const index_js_1 = require("../index.js");
|
||||
describe("Tests contract integration", function () {
|
||||
const provider = new index_js_1.ethers.JsonRpcProvider("http:/\/127.0.0.1:8545");
|
||||
const abi = [
|
||||
"constructor(address owner, uint maxSupply)",
|
||||
"function mint(address target) returns (bool minted)",
|
||||
"function totalSupply() view returns (uint supply)",
|
||||
"function balanceOf(address target) view returns (uint balance)",
|
||||
"event Minted(address target)"
|
||||
];
|
||||
let address = null;
|
||||
it("deploys a contract", async function () {
|
||||
this.timeout(10000);
|
||||
const bytecode = "0x60c060405234801561001057600080fd5b506040516105863803806105868339818101604052810190610032919061010e565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508060a08181525050505061014e565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a58261007a565b9050919050565b6100b58161009a565b81146100c057600080fd5b50565b6000815190506100d2816100ac565b92915050565b6000819050919050565b6100eb816100d8565b81146100f657600080fd5b50565b600081519050610108816100e2565b92915050565b6000806040838503121561012557610124610075565b5b6000610133858286016100c3565b9250506020610144858286016100f9565b9150509250929050565b60805160a051610414610172600039600060fa0152600061021f01526104146000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806318160ddd146100515780636a6278421461006f57806370a082311461009f5780638da5cb5b146100cf575b600080fd5b6100596100ed565b604051610066919061025c565b60405180910390f35b610089600480360381019061008491906102da565b6100f6565b6040516100969190610322565b60405180910390f35b6100b960048036038101906100b491906102da565b6101d2565b6040516100c6919061025c565b60405180910390f35b6100d761021b565b6040516100e4919061034c565b60405180910390f35b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000000000006000541061012657600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061017690610396565b919050555060008081548092919061018d90610396565b91905055507f90ddedd5a25821bba11fbb98de02ec1f75c1be90ae147d6450ce873e7b78b5d8826040516101c1919061034c565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b6000819050919050565b61025681610243565b82525050565b6000602082019050610271600083018461024d565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102a78261027c565b9050919050565b6102b78161029c565b81146102c257600080fd5b50565b6000813590506102d4816102ae565b92915050565b6000602082840312156102f0576102ef610277565b5b60006102fe848285016102c5565b91505092915050565b60008115159050919050565b61031c81610307565b82525050565b60006020820190506103376000830184610313565b92915050565b6103468161029c565b82525050565b6000602082019050610361600083018461033d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103a182610243565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103d3576103d2610367565b5b60018201905091905056fea26469706673582212200a979ea2bfdf429b5546fa25906c9d20a3d67ef5fbe531f31d2cc83533e3239564736f6c63430008120033";
|
||||
const signer = await provider.getSigner(0);
|
||||
const factory = new index_js_1.ethers.ContractFactory(abi, bytecode, signer);
|
||||
const contract = await factory.deploy(signer, 100);
|
||||
address = await contract.getAddress();
|
||||
await contract.waitForDeployment();
|
||||
const deployed = await provider.getCode(address);
|
||||
assert_1.default.ok(deployed != "0x", "has bytescode");
|
||||
});
|
||||
it("runs contract operations", async function () {
|
||||
this.timeout(10000);
|
||||
assert_1.default.ok(address != null);
|
||||
const signer = await provider.getSigner(0);
|
||||
const CustomContract = index_js_1.ethers.BaseContract.buildClass(abi);
|
||||
const contract = new CustomContract(address, signer); //ethers.Contract.from<ContractAbi>(address, abi, signer);
|
||||
// Test implicit staticCall (i.e. view/pure)
|
||||
{
|
||||
const supply0 = await contract.totalSupply();
|
||||
assert_1.default.equal(supply0, BigInt(0), "initial supply 0; default");
|
||||
}
|
||||
// Test explicit staticCall
|
||||
{
|
||||
const supply0 = await contract.totalSupply.staticCall();
|
||||
assert_1.default.equal(supply0, BigInt(0), "initial supply 0; staticCall");
|
||||
}
|
||||
// Test staticCallResult (positional and named)
|
||||
{
|
||||
const supply0 = await contract.totalSupply.staticCallResult();
|
||||
assert_1.default.equal(supply0[0], BigInt(0), "initial supply 0; staticCallResult");
|
||||
assert_1.default.equal(supply0.supply, BigInt(0), "initial supply 0; staticCallResult");
|
||||
}
|
||||
// Test populateTransaction
|
||||
const txInfo = await contract.mint.populateTransaction(signer);
|
||||
assert_1.default.equal(txInfo.to, address, "populateTransaction.to");
|
||||
const txInfoData = index_js_1.ethers.hexlify(index_js_1.ethers.concat([
|
||||
"0x6a627842",
|
||||
index_js_1.ethers.zeroPadValue(await signer.getAddress(), 32)
|
||||
]));
|
||||
assert_1.default.equal(txInfo.data, txInfoData, "populateTransaction.data");
|
||||
// Test minting (default)
|
||||
const tx = await contract.mint(signer);
|
||||
const receipt = await tx.wait();
|
||||
assert_1.default.ok(receipt, "receipt");
|
||||
// Check the receipt has parsed the events
|
||||
assert_1.default.equal(receipt.logs.length, 1, "logs.length");
|
||||
assert_1.default.ok(receipt instanceof index_js_1.ethers.ContractTransactionReceipt, "receipt typeof");
|
||||
assert_1.default.ok(receipt.logs[0] instanceof index_js_1.ethers.EventLog, "receipt.log typeof");
|
||||
assert_1.default.equal(receipt.logs[0].fragment && receipt.logs[0].fragment.name, "Minted", "logs[0].fragment.name");
|
||||
assert_1.default.equal(receipt.logs[0].args[0], await signer.getAddress(), "logs[0].args[0]");
|
||||
assert_1.default.equal(receipt.logs[0].args.target, await signer.getAddress(), "logs[0].args.target");
|
||||
// Check the state has been adjusted
|
||||
assert_1.default.equal(await contract.totalSupply(), BigInt(1), "initial supply 1; default");
|
||||
assert_1.default.equal(await contract.balanceOf(signer), BigInt(1), "balanceOf(signer)");
|
||||
// Test minting (explicit)
|
||||
const tx2 = await contract.mint.send(signer);
|
||||
await tx2.wait();
|
||||
// Check the state has been adjusted
|
||||
assert_1.default.equal(await contract.totalSupply(), BigInt(2), "initial supply 2; default");
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test-contract-integ.js.map
|
||||
1
lib.commonjs/_tests/test-contract-integ.js.map
Normal file
1
lib.commonjs/_tests/test-contract-integ.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"test-contract-integ.js","sourceRoot":"","sources":["../../src.ts/_tests/test-contract-integ.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAG5B,0CAAqC;AAQrC,QAAQ,CAAC,4BAA4B,EAAE;IACnC,MAAM,QAAQ,GAAG,IAAI,iBAAM,CA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E,mBAAmB,CAAC,CAAC;QAE/E,0BAA0B;QAC1B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,oCAAoC;QACpC,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
||||
1
lib.commonjs/_tests/test-contract.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-contract.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -147,6 +147,34 @@ describe("Test Contract", function () {
|
||||
await specificEvent;
|
||||
await allEvents;
|
||||
});
|
||||
it("tests the _in_ operator for functions", function () {
|
||||
const contract = new index_js_1.Contract(addr, abi);
|
||||
assert_1.default.equal("testCallAdd" in contract, true, "has(testCallAdd)");
|
||||
assert_1.default.equal("nonExist" in contract, false, "has(nonExist)");
|
||||
{
|
||||
const sig = "function testCallAdd(uint256 a, uint256 b) pure returns (uint256 result)";
|
||||
assert_1.default.equal(sig in contract, true, `has(${sig})`);
|
||||
assert_1.default.equal("function nonExist()" in contract, false, "has(function nonExist())");
|
||||
}
|
||||
assert_1.default.equal("0xf24684e5" in contract, true, "has(0xf24684e5)");
|
||||
assert_1.default.equal("0xbad01234" in contract, false, "has(0xbad01234)");
|
||||
});
|
||||
it("tests the _in_ operator for events", function () {
|
||||
const contract = new index_js_1.Contract(addr, abi);
|
||||
assert_1.default.equal("EventUint256" in contract.filters, true, "has(EventUint256)");
|
||||
assert_1.default.equal("NonExist" in contract.filters, false, "has(NonExist)");
|
||||
{
|
||||
const sig = "event EventUint256(uint256 indexed value)";
|
||||
assert_1.default.equal(sig in contract.filters, true, `has(${sig})`);
|
||||
assert_1.default.equal("event NonExist()" in contract.filters, false, "has(event NonExist())");
|
||||
}
|
||||
{
|
||||
const hash = "0x85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea337";
|
||||
const badHash = "0xbad01234567890ffbad01234567890ffbad01234567890ffbad01234567890ff";
|
||||
assert_1.default.equal(hash in contract.filters, true, `has(${hash})`);
|
||||
assert_1.default.equal(badHash in contract.filters, false, `has(${badHash})`);
|
||||
}
|
||||
});
|
||||
});
|
||||
describe("Test Typed Contract Interaction", function () {
|
||||
const tests = [
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-crypto-algoswap.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-crypto-algoswap.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-crypto.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-crypto.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-hash-typeddata.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-hash-typeddata.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-hash.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-hash.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-providers-avatar.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-avatar.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-providers-ccip.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-ccip.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-providers-data.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-data.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -189,11 +189,19 @@ describe("Test Provider Transaction operations", function () {
|
||||
assert_1.default.ok(receipt != null, "receipt != null");
|
||||
// Cloudflare doesn't return the root in legacy receipts; but it isn't
|
||||
// *actually* that important, so we'll give it a pass...
|
||||
if (providerName === "CloudflareProvider") {
|
||||
if (providerName === "CloudflareProvider" || providerName === "AnkrProvider" || providerName === "PocketProvider") {
|
||||
test = Object.assign({}, test, { root: undefined });
|
||||
}
|
||||
//if (providerName === "PocketProvider") {
|
||||
//}
|
||||
assertReceipt(receipt, test);
|
||||
};
|
||||
});
|
||||
forEach("test lookupAddress(addr) == null", blockchain_data_js_1.testReceipt, (providerName, test) => {
|
||||
return async (provider) => {
|
||||
const name = await provider.lookupAddress("0x0123456789012345678901234567890123456789");
|
||||
assert_1.default.ok(name == null, "name == null");
|
||||
};
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=test-providers-data.js.map
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-providers-errors.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-errors.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -36,6 +36,7 @@ describe("Tests Provider Call Exception", function () {
|
||||
(0, index_js_1.dataSlice)((0, index_js_1.id)("testPanic(uint256)"), 0, 4),
|
||||
(0, index_js_1.zeroPadValue)((0, index_js_1.toBeArray)(code), 32)
|
||||
]);
|
||||
await (0, utils_js_1.stall)(1000);
|
||||
const tx = { to: testAddr, data };
|
||||
try {
|
||||
const result = await (method === "call" ? provider.call(tx) : provider.estimateGas(tx));
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-providers-extra.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-extra.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-providers-send.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-send.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-providers-wildcard.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-providers-wildcard.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-rlp.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-rlp.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-transaction.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-transaction.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-utils-maths.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-utils-maths.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -170,4 +170,25 @@ describe("Tests Bad Math Values", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("Tests Twos Compliemnts Functions", function () {
|
||||
const tests = [
|
||||
{ width: 8, value: 0, twos: 0 },
|
||||
{ width: 8, value: 1, twos: 1 },
|
||||
{ width: 8, value: -1, twos: 0xff },
|
||||
{ width: 8, value: 127, twos: 127 },
|
||||
{ width: 8, value: -128, twos: 0x80 },
|
||||
];
|
||||
for (const { twos, width, value } of tests) {
|
||||
it(`computes twos compliment values: ${value}[${width} bits]`, function () {
|
||||
const result = (0, index_js_1.toTwos)(value, width);
|
||||
assert_1.default.equal(result, twos);
|
||||
});
|
||||
}
|
||||
for (const { twos, width, value } of tests) {
|
||||
it(`computes values from twos compliment: ${value}[${width} bits]`, function () {
|
||||
const result = (0, index_js_1.fromTwos)(twos, width);
|
||||
assert_1.default.equal(result, value);
|
||||
});
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=test-utils-maths.js.map
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-utils-misc.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-utils-misc.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-utils-units.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-utils-units.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
12
lib.commonjs/_tests/test-utils-utf8.d.ts
vendored
Normal file
12
lib.commonjs/_tests/test-utils-utf8.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
export type TestCaseBadString = {
|
||||
name: string;
|
||||
bytes: Uint8Array;
|
||||
ignore: string;
|
||||
replace: string;
|
||||
error: string;
|
||||
};
|
||||
export type TestCaseCodePoints = {
|
||||
name: string;
|
||||
text: string;
|
||||
codepoints: Array<number>;
|
||||
};
|
||||
1
lib.commonjs/_tests/test-wallet-hd.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-wallet-hd.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -7,6 +7,13 @@ const assert_1 = __importDefault(require("assert"));
|
||||
const wordlists_js_1 = require("../wordlists/wordlists.js");
|
||||
const utils_js_1 = require("./utils.js");
|
||||
const index_js_1 = require("../index.js");
|
||||
/*
|
||||
declare global {
|
||||
class TextDecoder {
|
||||
decode(data: Uint8Array): string;
|
||||
}
|
||||
}
|
||||
*/
|
||||
const decoder = new TextDecoder();
|
||||
function fromHex(hex) {
|
||||
const data = Buffer.from(hex.substring(2), "hex");
|
||||
|
||||
File diff suppressed because one or more lines are too long
1
lib.commonjs/_tests/test-wallet-json.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-wallet-json.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-wallet-mnemonic.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-wallet-mnemonic.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-wallet.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-wallet.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
1
lib.commonjs/_tests/test-wordlists.d.ts
vendored
Normal file
1
lib.commonjs/_tests/test-wordlists.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
216
lib.commonjs/_tests/types.d.ts
vendored
Normal file
216
lib.commonjs/_tests/types.d.ts
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
export type TestCaseAbiVerbose = {
|
||||
type: "address" | "hexstring" | "number" | "string";
|
||||
value: string;
|
||||
} | {
|
||||
type: "boolean";
|
||||
value: boolean;
|
||||
} | {
|
||||
type: "array";
|
||||
value: Array<TestCaseAbiVerbose>;
|
||||
} | {
|
||||
type: "object";
|
||||
value: Array<TestCaseAbiVerbose>;
|
||||
};
|
||||
export interface TestCaseAbi {
|
||||
name: string;
|
||||
type: string;
|
||||
value: any;
|
||||
verbose: TestCaseAbiVerbose;
|
||||
bytecode: string;
|
||||
encoded: string;
|
||||
}
|
||||
export interface TestCaseAccount {
|
||||
name: string;
|
||||
privateKey: string;
|
||||
address: string;
|
||||
icap: string;
|
||||
}
|
||||
export type TestCaseCreate = {
|
||||
sender: string;
|
||||
creates: Array<{
|
||||
name: string;
|
||||
nonce: number;
|
||||
address: string;
|
||||
}>;
|
||||
};
|
||||
export type TestCaseCreate2 = {
|
||||
sender: string;
|
||||
creates: Array<{
|
||||
name: string;
|
||||
salt: string;
|
||||
initCode: string;
|
||||
initCodeHash: string;
|
||||
address: string;
|
||||
}>;
|
||||
};
|
||||
export interface TestCaseHash {
|
||||
name: string;
|
||||
data: string;
|
||||
sha256: string;
|
||||
sha512: string;
|
||||
ripemd160: string;
|
||||
keccak256: string;
|
||||
}
|
||||
export interface TestCasePbkdf {
|
||||
name: string;
|
||||
password: string;
|
||||
salt: string;
|
||||
dkLen: number;
|
||||
pbkdf2: {
|
||||
iterations: number;
|
||||
algorithm: "sha256" | "sha512";
|
||||
key: string;
|
||||
};
|
||||
scrypt: {
|
||||
N: number;
|
||||
r: number;
|
||||
p: number;
|
||||
key: string;
|
||||
};
|
||||
}
|
||||
export interface TestCaseHmac {
|
||||
name: string;
|
||||
data: string;
|
||||
key: string;
|
||||
algorithm: "sha256" | "sha512";
|
||||
hmac: string;
|
||||
}
|
||||
export interface TestCaseHash {
|
||||
name: string;
|
||||
data: string;
|
||||
sha256: string;
|
||||
sha512: string;
|
||||
ripemd160: string;
|
||||
keccak256: string;
|
||||
}
|
||||
export interface TestCaseNamehash {
|
||||
name: string;
|
||||
ensName: string;
|
||||
error?: string;
|
||||
namehash?: string;
|
||||
}
|
||||
export interface TestCaseTypedDataDomain {
|
||||
name?: string;
|
||||
version?: string;
|
||||
chainId?: number;
|
||||
verifyingContract?: string;
|
||||
salt?: string;
|
||||
}
|
||||
export interface TestCaseTypedDataType {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
export interface TestCaseTypedData {
|
||||
name: string;
|
||||
domain: TestCaseTypedDataDomain;
|
||||
primaryType: string;
|
||||
types: Record<string, Array<TestCaseTypedDataType>>;
|
||||
data: any;
|
||||
encoded: string;
|
||||
digest: string;
|
||||
privateKey?: string;
|
||||
signature?: string;
|
||||
}
|
||||
export interface TestCaseSolidityHash {
|
||||
name: string;
|
||||
types: Array<string>;
|
||||
keccak256: string;
|
||||
ripemd160: string;
|
||||
sha256: string;
|
||||
values: Array<any>;
|
||||
}
|
||||
export interface TestCaseUnit {
|
||||
name: string;
|
||||
wei: string;
|
||||
ethers: string;
|
||||
ether_format: string;
|
||||
kwei?: string;
|
||||
mwei?: string;
|
||||
gwei?: string;
|
||||
szabo?: string;
|
||||
finney?: string;
|
||||
finney_format?: string;
|
||||
szabo_format?: string;
|
||||
gwei_format?: string;
|
||||
mwei_format?: string;
|
||||
kwei_format?: string;
|
||||
}
|
||||
export type NestedHexString = string | Array<string | NestedHexString>;
|
||||
export interface TestCaseRlp {
|
||||
name: string;
|
||||
encoded: string;
|
||||
decoded: NestedHexString;
|
||||
}
|
||||
export interface TestCaseTransactionTx {
|
||||
to?: string;
|
||||
nonce?: number;
|
||||
gasLimit?: string;
|
||||
gasPrice?: string;
|
||||
maxFeePerGas?: string;
|
||||
maxPriorityFeePerGas?: string;
|
||||
data?: string;
|
||||
value?: string;
|
||||
accessList?: Array<{
|
||||
address: string;
|
||||
storageKeys: Array<string>;
|
||||
}>;
|
||||
chainId?: string;
|
||||
}
|
||||
export interface TestCaseTransactionSig {
|
||||
r: string;
|
||||
s: string;
|
||||
v: string;
|
||||
}
|
||||
export interface TestCaseTransaction {
|
||||
name: string;
|
||||
transaction: TestCaseTransactionTx;
|
||||
privateKey: string;
|
||||
unsignedLegacy: string;
|
||||
signedLegacy: string;
|
||||
unsignedEip155: string;
|
||||
signedEip155: string;
|
||||
unsignedBerlin: string;
|
||||
signedBerlin: string;
|
||||
unsignedLondon: string;
|
||||
signedLondon: string;
|
||||
signatureLegacy: TestCaseTransactionSig;
|
||||
signatureEip155: TestCaseTransactionSig;
|
||||
signatureBerlin: TestCaseTransactionSig;
|
||||
signatureLondon: TestCaseTransactionSig;
|
||||
}
|
||||
export interface TestCaseMnemonicNode {
|
||||
path: string;
|
||||
chainCode: string;
|
||||
depth: number;
|
||||
index: number;
|
||||
parentFingerprint: string;
|
||||
fingerprint: string;
|
||||
publicKey: string;
|
||||
privateKey: string;
|
||||
xpriv: string;
|
||||
xpub: string;
|
||||
}
|
||||
export interface TestCaseMnemonic {
|
||||
name: string;
|
||||
phrase: string;
|
||||
phraseHash: string;
|
||||
password: string;
|
||||
locale: string;
|
||||
entropy: string;
|
||||
seed: string;
|
||||
nodes: Array<TestCaseMnemonicNode>;
|
||||
}
|
||||
export interface TestCaseWallet {
|
||||
name: string;
|
||||
filename: string;
|
||||
type: string;
|
||||
address: string;
|
||||
password: string;
|
||||
content: string;
|
||||
}
|
||||
export interface TestCaseWordlist {
|
||||
name: string;
|
||||
filename: string;
|
||||
locale: string;
|
||||
content: string;
|
||||
}
|
||||
8
lib.commonjs/_tests/utils.d.ts
vendored
Normal file
8
lib.commonjs/_tests/utils.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export declare function loadTests<T>(tag: string): Array<T>;
|
||||
export declare function log(context: any, text: string): void;
|
||||
export declare function stall(duration: number): Promise<void>;
|
||||
export interface MochaRunnable {
|
||||
timeout: (value: number) => void;
|
||||
skip: () => void;
|
||||
}
|
||||
export declare function retryIt(name: string, func: (this: MochaRunnable) => Promise<void>): Promise<void>;
|
||||
4
lib.commonjs/_version.d.ts
vendored
Normal file
4
lib.commonjs/_version.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
export declare const version: string;
|
||||
@@ -1,5 +1,9 @@
|
||||
"use strict";
|
||||
/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "6.0.0";
|
||||
/**
|
||||
* The current version of Ethers.
|
||||
*/
|
||||
exports.version = "6.3.1";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAW,OAAO,CAAC"}
|
||||
{"version":3,"file":"_version.js","sourceRoot":"","sources":["../src.ts/_version.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;AAEnE;;GAEG;AACU,QAAA,OAAO,GAAW,OAAO,CAAC"}
|
||||
58
lib.commonjs/abi/abi-coder.d.ts
vendored
Normal file
58
lib.commonjs/abi/abi-coder.d.ts
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* When sending values to or receiving values from a [[Contract]], the
|
||||
* data is generally encoded using the [ABI standard](link-solc-abi).
|
||||
*
|
||||
* The AbiCoder provides a utility to encode values to ABI data and
|
||||
* decode values from ABI data.
|
||||
*
|
||||
* Most of the time, developers should favour the [[Contract]] class,
|
||||
* which further abstracts a lot of the finer details of ABI data.
|
||||
*
|
||||
* @_section api/abi/abi-coder:ABI Encoding
|
||||
*/
|
||||
import { Result } from "./coders/abstract-coder.js";
|
||||
import { ParamType } from "./fragments.js";
|
||||
import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js";
|
||||
/**
|
||||
* About AbiCoder
|
||||
*/
|
||||
export declare class AbiCoder {
|
||||
#private;
|
||||
/**
|
||||
* Get the default values for the given %%types%%.
|
||||
*
|
||||
* For example, a ``uint`` is by default ``0`` and ``bool``
|
||||
* is by default ``false``.
|
||||
*/
|
||||
getDefaultValue(types: ReadonlyArray<string | ParamType>): Result;
|
||||
/**
|
||||
* Encode the %%values%% as the %%types%% into ABI data.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
*/
|
||||
encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string;
|
||||
/**
|
||||
* Decode the ABI %%data%% as the %%types%% into values.
|
||||
*
|
||||
* If %%loose%% decoding is enabled, then strict padding is
|
||||
* not enforced. Some older versions of Solidity incorrectly
|
||||
* padded event data emitted from ``external`` functions.
|
||||
*/
|
||||
decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result;
|
||||
/**
|
||||
* Returns the shared singleton instance of a default [[AbiCoder]].
|
||||
*
|
||||
* On the first call, the instance is created internally.
|
||||
*/
|
||||
static defaultAbiCoder(): AbiCoder;
|
||||
/**
|
||||
* Returns an ethers-compatible [[CallExceptionError]] Error for the given
|
||||
* result %%data%% for the [[CallExceptionAction]] %%action%% against
|
||||
* the Transaction %%tx%%.
|
||||
*/
|
||||
static getBuiltinCallException(action: CallExceptionAction, tx: {
|
||||
to?: null | string;
|
||||
from?: null | string;
|
||||
data?: string;
|
||||
}, data: null | BytesLike): CallExceptionError;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
/**
|
||||
* When sending values to or receiving values from a [[Contract]], the
|
||||
* data is generally encoded using the [ABI standard](solc-abi-standard).
|
||||
* data is generally encoded using the [ABI standard](link-solc-abi).
|
||||
*
|
||||
* The AbiCoder provides a utility to encode values to ABI data and
|
||||
* decode values from ABI data.
|
||||
@@ -52,7 +52,11 @@ function getBuiltinCallException(action, tx, data, abiCoder) {
|
||||
message = "execution reverted";
|
||||
const bytes = (0, index_js_3.getBytes)(data);
|
||||
data = (0, index_js_3.hexlify)(data);
|
||||
if (bytes.length % 32 !== 4) {
|
||||
if (bytes.length === 0) {
|
||||
message += " (no data present; likely require(false) occurred";
|
||||
reason = "require(false)";
|
||||
}
|
||||
else if (bytes.length % 32 !== 4) {
|
||||
message += " (could not decode reason; invalid data length)";
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
@@ -67,8 +71,7 @@ function getBuiltinCallException(action, tx, data, abiCoder) {
|
||||
message += `: ${JSON.stringify(reason)}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode reason; invalid data)";
|
||||
message += " (could not decode reason; invalid string data)";
|
||||
}
|
||||
}
|
||||
else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") {
|
||||
@@ -84,8 +87,7 @@ function getBuiltinCallException(action, tx, data, abiCoder) {
|
||||
message += `: ${reason}`;
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
message += " (could not decode panic reason)";
|
||||
message += " (could not decode panic code)";
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -190,7 +192,7 @@ class AbiCoder {
|
||||
return defaultCoder;
|
||||
}
|
||||
/**
|
||||
* Returns an ethers-compatible [[CALL_EXCEPTION]] Error for the given
|
||||
* Returns an ethers-compatible [[CallExceptionError]] Error for the given
|
||||
* result %%data%% for the [[CallExceptionAction]] %%action%% against
|
||||
* the Transaction %%tx%%.
|
||||
*/
|
||||
|
||||
File diff suppressed because one or more lines are too long
14
lib.commonjs/abi/bytes32.d.ts
vendored
Normal file
14
lib.commonjs/abi/bytes32.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* About bytes32 strings...
|
||||
*
|
||||
* @_docloc: api/utils:Bytes32 Strings
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Encodes %%text%% as a Bytes32 string.
|
||||
*/
|
||||
export declare function encodeBytes32String(text: string): string;
|
||||
/**
|
||||
* Encodes the Bytes32-encoded %%bytes%% into a string.
|
||||
*/
|
||||
export declare function decodeBytes32String(_bytes: BytesLike): string;
|
||||
116
lib.commonjs/abi/coders/abstract-coder.d.ts
vendored
Normal file
116
lib.commonjs/abi/coders/abstract-coder.d.ts
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
import type { BigNumberish, BytesLike } from "../../utils/index.js";
|
||||
/**
|
||||
* @_ignore:
|
||||
*/
|
||||
export declare const WordSize: number;
|
||||
/**
|
||||
* A [[Result]] is a sub-class of Array, which allows accessing any
|
||||
* of its values either positionally by its index or, if keys are
|
||||
* provided by its name.
|
||||
*
|
||||
* @_docloc: api/abi
|
||||
*/
|
||||
export declare class Result extends Array<any> {
|
||||
#private;
|
||||
[K: string | number]: any;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(...args: Array<any>);
|
||||
/**
|
||||
* Returns the Result as a normal Array.
|
||||
*
|
||||
* This will throw if there are any outstanding deferred
|
||||
* errors.
|
||||
*/
|
||||
toArray(): Array<any>;
|
||||
/**
|
||||
* Returns the Result as an Object with each name-value pair.
|
||||
*
|
||||
* This will throw if any value is unnamed, or if there are
|
||||
* any outstanding deferred errors.
|
||||
*/
|
||||
toObject(): Record<string, any>;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
slice(start?: number | undefined, end?: number | undefined): Result;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result;
|
||||
/**
|
||||
* Returns the value for %%name%%.
|
||||
*
|
||||
* Since it is possible to have a key whose name conflicts with
|
||||
* a method on a [[Result]] or its superclass Array, or any
|
||||
* JavaScript keyword, this ensures all named values are still
|
||||
* accessible by name.
|
||||
*/
|
||||
getValue(name: string): any;
|
||||
/**
|
||||
* Creates a new [[Result]] for %%items%% with each entry
|
||||
* also accessible by its corresponding name in %%keys%%.
|
||||
*/
|
||||
static fromItems(items: Array<any>, keys?: Array<null | string>): Result;
|
||||
}
|
||||
/**
|
||||
* Returns all errors found in a [[Result]].
|
||||
*
|
||||
* Since certain errors encountered when creating a [[Result]] do
|
||||
* not impact the ability to continue parsing data, they are
|
||||
* deferred until they are actually accessed. Hence a faulty string
|
||||
* in an Event that is never used does not impact the program flow.
|
||||
*
|
||||
* However, sometimes it may be useful to access, identify or
|
||||
* validate correctness of a [[Result]].
|
||||
*
|
||||
* @_docloc api/abi
|
||||
*/
|
||||
export declare function checkResultErrors(result: Result): Array<{
|
||||
path: Array<string | number>;
|
||||
error: Error;
|
||||
}>;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare abstract class Coder {
|
||||
readonly name: string;
|
||||
readonly type: string;
|
||||
readonly localName: string;
|
||||
readonly dynamic: boolean;
|
||||
constructor(name: string, type: string, localName: string, dynamic: boolean);
|
||||
_throwError(message: string, value: any): never;
|
||||
abstract encode(writer: Writer, value: any): number;
|
||||
abstract decode(reader: Reader): any;
|
||||
abstract defaultValue(): any;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class Writer {
|
||||
#private;
|
||||
constructor();
|
||||
get data(): string;
|
||||
get length(): number;
|
||||
appendWriter(writer: Writer): number;
|
||||
writeBytes(value: BytesLike): number;
|
||||
writeValue(value: BigNumberish): number;
|
||||
writeUpdatableValue(): (value: BigNumberish) => void;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class Reader {
|
||||
#private;
|
||||
readonly allowLoose: boolean;
|
||||
constructor(data: BytesLike, allowLoose?: boolean);
|
||||
get data(): string;
|
||||
get dataLength(): number;
|
||||
get consumed(): number;
|
||||
get bytes(): Uint8Array;
|
||||
subReader(offset: number): Reader;
|
||||
readBytes(length: number, loose?: boolean): Uint8Array;
|
||||
readValue(): bigint;
|
||||
readIndex(): number;
|
||||
}
|
||||
@@ -112,12 +112,14 @@ class Result extends Array {
|
||||
* errors.
|
||||
*/
|
||||
toArray() {
|
||||
const result = [];
|
||||
this.forEach((item, index) => {
|
||||
if (item instanceof Error) {
|
||||
throwError(`index ${index}`, item);
|
||||
}
|
||||
result.push(item);
|
||||
});
|
||||
return Array.of(this);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Returns the Result as an Object with each name-value pair.
|
||||
@@ -144,9 +146,24 @@ class Result extends Array {
|
||||
if (start == null) {
|
||||
start = 0;
|
||||
}
|
||||
if (start < 0) {
|
||||
start += this.length;
|
||||
if (start < 0) {
|
||||
start = 0;
|
||||
}
|
||||
}
|
||||
if (end == null) {
|
||||
end = this.length;
|
||||
}
|
||||
if (end < 0) {
|
||||
end += this.length;
|
||||
if (end < 0) {
|
||||
end = 0;
|
||||
}
|
||||
}
|
||||
if (end > this.length) {
|
||||
end = this.length;
|
||||
}
|
||||
const result = [], names = [];
|
||||
for (let i = start; i < end; i++) {
|
||||
result.push(this[i]);
|
||||
|
||||
File diff suppressed because one or more lines are too long
12
lib.commonjs/abi/coders/address.d.ts
vendored
Normal file
12
lib.commonjs/abi/coders/address.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class AddressCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: string | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
14
lib.commonjs/abi/coders/anonymous.d.ts
vendored
Normal file
14
lib.commonjs/abi/coders/anonymous.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* Clones the functionality of an existing Coder, but without a localName
|
||||
*
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class AnonymousCoder extends Coder {
|
||||
private coder;
|
||||
constructor(coder: Coder);
|
||||
defaultValue(): any;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
24
lib.commonjs/abi/coders/array.d.ts
vendored
Normal file
24
lib.commonjs/abi/coders/array.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder, Result, Writer } from "./abstract-coder.js";
|
||||
import type { Reader } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare function pack(writer: Writer, coders: ReadonlyArray<Coder>, values: Array<any> | {
|
||||
[name: string]: any;
|
||||
}): number;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare function unpack(reader: Reader, coders: ReadonlyArray<Coder>): Result;
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class ArrayCoder extends Coder {
|
||||
readonly coder: Coder;
|
||||
readonly length: number;
|
||||
constructor(coder: Coder, length: number, localName: string);
|
||||
defaultValue(): Array<any>;
|
||||
encode(writer: Writer, _value: Array<any> | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
@@ -18,7 +18,7 @@ function pack(writer, coders, values) {
|
||||
arrayValues = coders.map((coder) => {
|
||||
const name = coder.localName;
|
||||
(0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
(0, index_js_1.assert)(unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
(0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values });
|
||||
unique[name] = true;
|
||||
return values[name];
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
12
lib.commonjs/abi/coders/boolean.d.ts
vendored
Normal file
12
lib.commonjs/abi/coders/boolean.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class BooleanCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): boolean;
|
||||
encode(writer: Writer, _value: boolean | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
18
lib.commonjs/abi/coders/bytes.d.ts
vendored
Normal file
18
lib.commonjs/abi/coders/bytes.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class DynamicBytesCoder extends Coder {
|
||||
constructor(type: string, localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class BytesCoder extends DynamicBytesCoder {
|
||||
constructor(localName: string);
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
14
lib.commonjs/abi/coders/fixed-bytes.d.ts
vendored
Normal file
14
lib.commonjs/abi/coders/fixed-bytes.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { BytesLike } from "../../utils/index.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class FixedBytesCoder extends Coder {
|
||||
readonly size: number;
|
||||
constructor(size: number, localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: BytesLike | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
11
lib.commonjs/abi/coders/null.d.ts
vendored
Normal file
11
lib.commonjs/abi/coders/null.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class NullCoder extends Coder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): null;
|
||||
encode(writer: Writer, value: any): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
15
lib.commonjs/abi/coders/number.d.ts
vendored
Normal file
15
lib.commonjs/abi/coders/number.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { Coder } from "./abstract-coder.js";
|
||||
import type { BigNumberish } from "../../utils/index.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class NumberCoder extends Coder {
|
||||
readonly size: number;
|
||||
readonly signed: boolean;
|
||||
constructor(size: number, signed: boolean, localName: string);
|
||||
defaultValue(): number;
|
||||
encode(writer: Writer, _value: BigNumberish | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
12
lib.commonjs/abi/coders/string.d.ts
vendored
Normal file
12
lib.commonjs/abi/coders/string.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Typed } from "../typed.js";
|
||||
import { DynamicBytesCoder } from "./bytes.js";
|
||||
import type { Reader, Writer } from "./abstract-coder.js";
|
||||
/**
|
||||
* @_ignore
|
||||
*/
|
||||
export declare class StringCoder extends DynamicBytesCoder {
|
||||
constructor(localName: string);
|
||||
defaultValue(): string;
|
||||
encode(writer: Writer, _value: string | Typed): number;
|
||||
decode(reader: Reader): any;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user