Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e6d121fb8 | ||
|
|
bfcd05fcbb | ||
|
|
819b1ace5c | ||
|
|
4b331148d9 | ||
|
|
7adcf3b154 | ||
|
|
630656e949 | ||
|
|
8681cd5969 | ||
|
|
470551e4ee | ||
|
|
d395d16fa3 | ||
|
|
8077ce0aae | ||
|
|
2fe78ad7e3 | ||
|
|
5f1f2c5e2c | ||
|
|
3c79ee8cef | ||
|
|
772067a3c9 | ||
|
|
621897f249 | ||
|
|
d3b7130ed6 | ||
|
|
dad3829c2e | ||
|
|
de4d683f6d | ||
|
|
ebe4cc90f5 | ||
|
|
35e3bf9d11 | ||
|
|
2d717dcef8 | ||
|
|
3316468e3e | ||
|
|
5144acf456 | ||
|
|
aadc5cd3d6 | ||
|
|
6e088099ad | ||
|
|
b6370f1360 | ||
|
|
26464c5425 | ||
|
|
37a9c77ab2 | ||
|
|
4898e7baac | ||
|
|
c71bbbe7db | ||
|
|
c8fecbbc29 | ||
|
|
b4df28dddd | ||
|
|
483d67f55c | ||
|
|
987bec87af | ||
|
|
a9cdbe1238 | ||
|
|
4e9abfdee4 | ||
|
|
3bb5fbf533 | ||
|
|
cadccc3060 | ||
|
|
65196097f6 | ||
|
|
8e22e0260e | ||
|
|
de7da421b3 | ||
|
|
a9f7957550 | ||
|
|
bd2d44eecf | ||
|
|
bd05aed070 | ||
|
|
ce8f1e4015 | ||
|
|
58488e78f9 | ||
|
|
29116593ba | ||
|
|
51f0e1a52f | ||
|
|
c086962302 | ||
|
|
c0daf437f7 | ||
|
|
8eaeba35f5 | ||
|
|
4a44865a8c |
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: Bug report
|
||||
name: Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: investigate
|
||||
@@ -9,6 +9,8 @@ assignees: ''
|
||||
|
||||
Note: Not all sections may be relevant, but please be as thorough while remaining concise as possible. Remove this Notice and any sections that don't feel pertinent.
|
||||
|
||||
If you are unsure if something is a bug, start a thread in the *"discussions"* tab above..
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
@@ -19,4 +21,4 @@ Please include code snippets, with console.log output, any contract ABI, contrac
|
||||
Please include anything that may be useful in diagnosing the issue. Node vs Browser? Geth vs Parity vs Ganache? Third Party tools, like Hardhat? Mobile vs. Desktop?
|
||||
|
||||
**Search Terms**
|
||||
Often similar issues have come up before. Include any search terms you have tried in this repository's Issues (including closed issues) and Discussions, so if there are matching issues, we can be sure to add those keywords to make it easier for people to find in the future.
|
||||
Often similar issues have come up before. Include any search terms you have tried in this repository's Issues (including closed issues) and *"Discussions"*, so if there are matching issues, we can be sure to add those keywords and link this issue to it, making it easier for people to find in the future.
|
||||
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
|
||||
16
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/documentation.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Documentation
|
||||
about: Documentation request or suggestion
|
||||
title: ''
|
||||
labels: documentation
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Please include anything about the [documentation](https://docs.ethers.io) you would like to see improved.
|
||||
|
||||
- Missing information or details?
|
||||
- Wrong Information?
|
||||
- Dead or wrong links?
|
||||
- Something needs code examples?
|
||||
- General feedback or anything else?
|
||||
16
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
16
.github/ISSUE_TEMPLATE/other.md
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
name: Other
|
||||
about: Something else
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
Generally this issue template should be used.
|
||||
|
||||
If your issue is **not** a **Feature Request**, a **Bug Report** or problem with the **Documentation** you should probably be using the *"Discussion"* tab at the top.
|
||||
|
||||
But for truly exceptional issues, please include the details here.
|
||||
|
||||
Please also include any search terms you used when searching issues and discussions, so we can better tag those in the future.
|
||||
47
CHANGELOG.md
47
CHANGELOG.md
@@ -3,6 +3,53 @@ Changelog
|
||||
|
||||
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.3.0 (2021-05-31 18:41)
|
||||
--------------------------------
|
||||
|
||||
- Added MinInt256 and MaxInt256 constants. ([#1576](https://github.com/ethers-io/ethers.js/issues/1576); [bfcd05f](https://github.com/ethers-io/ethers.js/commit/bfcd05fcbb132d456d6f22f70c8ac9cf5b1826f7))
|
||||
- Version bumps for bn.js and hash.js to match elliptic and fix some build tools. ([#1478](https://github.com/ethers-io/ethers.js/issues/1478); [819b1ac](https://github.com/ethers-io/ethers.js/commit/819b1ace5c9b16e29dc354ad80e0e5b71ac63c52))
|
||||
- Removed Hangul checks in shims which crashes Android. ([#1519](https://github.com/ethers-io/ethers.js/issues/1519); [4b33114](https://github.com/ethers-io/ethers.js/commit/4b331148d980e3056ceaabdcd6e50a2aa1beb40d))
|
||||
- Fixed ENS namehash with leading and trailing dots. ([#1605](https://github.com/ethers-io/ethers.js/issues/1605); [7adcf3b](https://github.com/ethers-io/ethers.js/commit/7adcf3b154669d9d1a0a66d5e15dabfbf6618180))
|
||||
- Fixed broken variable in template string. ([#1624](https://github.com/ethers-io/ethers.js/issues/1624), [#1626](https://github.com/ethers-io/ethers.js/issues/1626); [630656e](https://github.com/ethers-io/ethers.js/commit/630656e949a8ffd940e4b66ec93ec07cd6ec2634))
|
||||
- Fixed FixedNumber rounding for non-default formats. ([#1629](https://github.com/ethers-io/ethers.js/issues/1629); [8681cd5](https://github.com/ethers-io/ethers.js/commit/8681cd59698d02d040871aa889fc6ccc8550df98))
|
||||
- Update ws dependency version to fix security. ([#1633](https://github.com/ethers-io/ethers.js/issues/1633), [#1634](https://github.com/ethers-io/ethers.js/issues/1634); [470551e](https://github.com/ethers-io/ethers.js/commit/470551e4ee3f1e343a26fc0775f9d9f7489129f8))
|
||||
|
||||
ethers/v5.2.0 (2021-05-17 16:18)
|
||||
--------------------------------
|
||||
|
||||
- More aggresively check for mempool transactions sent from JsonRpcSigner. ([3316468](https://github.com/ethers-io/ethers.js/commit/3316468e3e0a5925cbecad85d894cc7d622394e7))
|
||||
- Added initial support for detecting replacement transactions. ([#1477](https://github.com/ethers-io/ethers.js/issues/1477); [987bec8](https://github.com/ethers-io/ethers.js/commit/987bec87afaa365f291290a0136cedbc2b1992f2), [5144acf](https://github.com/ethers-io/ethers.js/commit/5144acf456b51c95bbe3950bd37609abecc7ebc7))
|
||||
- Added convenience method for HD path derivation. ([aadc5cd](https://github.com/ethers-io/ethers.js/commit/aadc5cd3d65421e13ebd4e4d7c293ac3ece5e178))
|
||||
- Added mnemonicPath option to cli. ([6e08809](https://github.com/ethers-io/ethers.js/commit/6e088099adabd7c5d2e6710062ebc62b316ba0f1))
|
||||
- Added some popular Ethereum-compatible chains to networks. ([b6370f1](https://github.com/ethers-io/ethers.js/commit/b6370f13600a0c444342cbf16a83f010a929976b))
|
||||
- Added debug event to Web3Provider. ([26464c5](https://github.com/ethers-io/ethers.js/commit/26464c54258f98c321638475d6cf11595186e76d))
|
||||
- Abstracted EtherscanProivder to more easily fascilitate other Etherscan-supported chains. ([#1204](https://github.com/ethers-io/ethers.js/issues/1204), [#1473](https://github.com/ethers-io/ethers.js/issues/1473); [37a9c77](https://github.com/ethers-io/ethers.js/commit/37a9c77ab2acb7f75e1fc4cc918810d2fe59dd76))
|
||||
- Added Custom Contract Errors. ([#1498](https://github.com/ethers-io/ethers.js/issues/1498); [6519609](https://github.com/ethers-io/ethers.js/commit/65196097f6626401638d85cf19e3d628a6223d5d), [483d67f](https://github.com/ethers-io/ethers.js/commit/483d67f55c15a76bcd853e889a0e35815d9850f7))
|
||||
- More flexible FixedNumber input and output for strings with no decimals. ([#1019](https://github.com/ethers-io/ethers.js/issues/1019), [#1291](https://github.com/ethers-io/ethers.js/issues/1291), [#1463](https://github.com/ethers-io/ethers.js/issues/1463); [a9cdbe1](https://github.com/ethers-io/ethers.js/commit/a9cdbe1238c149a7167c6bb1a78f314805b52755))
|
||||
- Added hex support for bigint. ([#1472](https://github.com/ethers-io/ethers.js/issues/1472); [4e9abfd](https://github.com/ethers-io/ethers.js/commit/4e9abfdee478a8423da4d55feea8c1aae78a8eb4))
|
||||
- Added support for null entries in EventFilter. ([#1499](https://github.com/ethers-io/ethers.js/issues/1499); [3bb5fbf](https://github.com/ethers-io/ethers.js/commit/3bb5fbf533107e880377ecc14f30f314a5028e56))
|
||||
- Add bigint to allowed BigNumberish types. ([#1472](https://github.com/ethers-io/ethers.js/issues/1472); [cadccc3](https://github.com/ethers-io/ethers.js/commit/cadccc3060b88ab2ca64aeb302717d2d1c95a897))
|
||||
- Minor version bump. ([8e22e02](https://github.com/ethers-io/ethers.js/commit/8e22e0260eb70713c943c9e99ee8d66d71ebe56d))
|
||||
|
||||
ethers/v5.1.4 (2021-04-22 06:33)
|
||||
--------------------------------
|
||||
|
||||
- Do not throw on ABI "error" type. ([#1493](https://github.com/ethers-io/ethers.js/issues/1493), [#1497](https://github.com/ethers-io/ethers.js/issues/1497); [bd05aed](https://github.com/ethers-io/ethers.js/commit/bd05aed070ac9e1421a3e2bff2ceea150bedf9b7))
|
||||
|
||||
ethers/v5.1.3 (2021-04-19 21:01)
|
||||
--------------------------------
|
||||
|
||||
- Fixed JsonRpcProvider event-loop caching when using any network. ([#1484](https://github.com/ethers-io/ethers.js/issues/1484); [58488e7](https://github.com/ethers-io/ethers.js/commit/58488e78f9ef79715693e19b42663335aad88c03))
|
||||
- Updated experimental Eip1193Bridge to support final EIP-1193 API. ([2911659](https://github.com/ethers-io/ethers.js/commit/29116593ba6c9c0fa491b13787cca8b233d4218c))
|
||||
- Fail early for ABI decoding that will obviously run out of data. ([#1486](https://github.com/ethers-io/ethers.js/issues/1486); [51f0e1a](https://github.com/ethers-io/ethers.js/commit/51f0e1a52fb885e6f146f7b3b70ed487fd1c8f5a))
|
||||
- Fixed BigNumber toBigInt return type. ([#1485](https://github.com/ethers-io/ethers.js/issues/1485); [c086962](https://github.com/ethers-io/ethers.js/commit/c0869623024bbf3671938dad03b131ff2ac54345))
|
||||
|
||||
ethers/v5.1.2 (2021-04-18 19:31)
|
||||
--------------------------------
|
||||
|
||||
- Increase provider tests gas price for sending a transaction. ([8eaeba3](https://github.com/ethers-io/ethers.js/commit/8eaeba35f550c3d9aa1ae62eb8d8e0c912818f7f))
|
||||
- Fixed run-checking non-filter Contract events. ([#1458](https://github.com/ethers-io/ethers.js/issues/1458); [4a44865](https://github.com/ethers-io/ethers.js/commit/4a44865a8c22adb9c55d5c37a81ee46ebc68228c))
|
||||
|
||||
ethers/v5.1.1 (2021-04-18 02:47)
|
||||
--------------------------------
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ Installing
|
||||
**browser (UMD)**
|
||||
|
||||
```
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js" type="text/javascript">
|
||||
<script src="https://cdn.ethers.io/lib/ethers-5.1.umd.min.js" type="text/javascript">
|
||||
</script>
|
||||
```
|
||||
|
||||
@@ -52,7 +52,7 @@ Installing
|
||||
|
||||
```
|
||||
<script type="module">
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.0.esm.min.js";
|
||||
import { ethers } from "https://cdn.ethers.io/lib/ethers-5.1.esm.min.js";
|
||||
</script>
|
||||
```
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ function codeContextify(context) {
|
||||
|
||||
module.exports = {
|
||||
title: "ethers",
|
||||
subtitle: "v5.0",
|
||||
subtitle: "v5.2",
|
||||
description: "Documentation for ethers, a complete, tiny and simple Ethereum library.",
|
||||
logo: "logo.svg",
|
||||
|
||||
@@ -204,7 +204,8 @@ module.exports = {
|
||||
"link-rtd": "https:/\/github.com/readthedocs/sphinx_rtd_theme",
|
||||
"link-semver": { name: "semver", url: "https:/\/semver.org" },
|
||||
"link-solidity": { name: "Solidity" , url: "https:/\/solidity.readthedocs.io/" },
|
||||
"link-solidity-events": "https:/\/docs.soliditylang.org/en/v0.8.1/abi-spec.html#events",
|
||||
"link-solidity-errors": "https:/\/docs.soliditylang.org/en/v0.8.4/abi-spec.html#errors",
|
||||
"link-solidity-events": "https:/\/docs.soliditylang.org/en/v0.8.4/abi-spec.html#events",
|
||||
"link-sphinx": { name: "Sphinx", url: "https:/\/www.sphinx-doc.org/" },
|
||||
|
||||
"link-alchemy-signup": "https:/\/dashboard.alchemyapi.io/signup?referral=55a35117-028e-4b7c-9e47-e275ad0acc6d",
|
||||
@@ -246,7 +247,7 @@ module.exports = {
|
||||
|
||||
"link-ethersio": "https:/\/ethers.io/",
|
||||
"link-ethers-docs": "https:/\/docs.ethers.io/",
|
||||
"link-ethers-js": "https:/\/cdn.ethers.io/lib/ethers-5.0.esm.min.js",
|
||||
"link-ethers-js": "https:/\/cdn.ethers.io/lib/ethers-5.1.esm.min.js",
|
||||
"link-ethers-npm": "https:/\/www.npmjs.com/search?q=%40ethersproject%2F",
|
||||
"link-ethers-asm-grammar": "https:/\/github.com/ethers-io/ethers.js/blob/master/packages/asm/grammar.jison",
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ of uses.
|
||||
|
||||
_heading: MIT License
|
||||
|
||||
//Copyright © 2019 [Richard Moore](mailto:me@ricmoo.com).//
|
||||
//Copyright © 2019-2021 [Richard Moore](mailto:me@ricmoo.com).//
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -35,7 +35,12 @@ module.exports = function(config) {
|
||||
// Cloudflare will block (on the testnet endpoints) any traffic
|
||||
// from a headless chome (based on the user agent), so we lie
|
||||
// This was take from Safari, because that is what I had on-hand
|
||||
'--user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15']
|
||||
'--user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15',
|
||||
|
||||
// https://stackoverflow.com/questions/58484124/karma-disconnectedreconnect-failed-before-timeout-of-with-chromeheadless
|
||||
'--disable-gpu',
|
||||
'--no-sandbox'
|
||||
],
|
||||
}
|
||||
},
|
||||
/*
|
||||
|
||||
@@ -36,7 +36,12 @@ module.exports = function(config) {
|
||||
// Cloudflare will block (on the testnet endpoints) any traffic
|
||||
// from a headless chome (based on the user agent), so we lie
|
||||
// This was take from Safari, because that is what I had on-hand
|
||||
'--user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15']
|
||||
'--user-agent', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.1 Safari/605.1.15',
|
||||
|
||||
// https://stackoverflow.com/questions/58484124/karma-disconnectedreconnect-failed-before-timeout-of-with-chromeheadless
|
||||
'--disable-gpu',
|
||||
'--no-sandbox'
|
||||
]
|
||||
}
|
||||
},
|
||||
/*
|
||||
|
||||
@@ -25,15 +25,15 @@ const Words = fs_1.default.readFileSync("/usr/share/dict/words").toString().spli
|
||||
accessing addresses aligned autofill called cancelled changed censored
|
||||
clamping compiled computed configured consumed creating decoded decoding
|
||||
decreased decrypt decrypted decrypting deployed deploying deprecated detected
|
||||
discontinued earliest email enabled encoded encoder encoding encrypt
|
||||
discontinued earliest email emitted enabled encoded encoder encoding encrypt
|
||||
encrypted encrypting entries euro exceeded existing expected
|
||||
expired failed fetches formatted formatting funding generated
|
||||
hardened has highly ignoring implemented implementer imported including instantiate
|
||||
joined keyword labelled larger lookup matches mined modified modifies multi
|
||||
named needed nested neutered numeric offline optimizer overriding owned packed
|
||||
padded parsed parsing passed payload placeholder processing properties prototyping reached
|
||||
recommended recovered redacted remaining replaced required reverted
|
||||
serializes shared signed signing skipped stored supported tagging targetted
|
||||
recommended recovered redacted remaining replaced repriced required reverted
|
||||
serializes shared signed signing skipped stats stored supported tagging targetted
|
||||
throttled transactions typed uninstall unstake unsubscribe untyped
|
||||
using verifies verifying website
|
||||
|
||||
@@ -41,7 +41,7 @@ using verifies verifying website
|
||||
bech BIP BIP39 BIP44 btc bzz crypto eip etc hashes hmac icap
|
||||
keccak ltc namehash ripemd RLP scrypt secp sha xdai
|
||||
|
||||
blockhash
|
||||
blockhash bnb bnbt ethprice matic txlist
|
||||
|
||||
bitcoin ethereum finney gwei kwei mwei satoshi szabo wei weth
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@ const Words = fs.readFileSync("/usr/share/dict/words").toString().split("\n").re
|
||||
accessing addresses aligned autofill called cancelled changed censored
|
||||
clamping compiled computed configured consumed creating decoded decoding
|
||||
decreased decrypt decrypted decrypting deployed deploying deprecated detected
|
||||
discontinued earliest email enabled encoded encoder encoding encrypt
|
||||
discontinued earliest email emitted enabled encoded encoder encoding encrypt
|
||||
encrypted encrypting entries euro exceeded existing expected
|
||||
expired failed fetches formatted formatting funding generated
|
||||
hardened has highly ignoring implemented implementer imported including instantiate
|
||||
joined keyword labelled larger lookup matches mined modified modifies multi
|
||||
named needed nested neutered numeric offline optimizer overriding owned packed
|
||||
padded parsed parsing passed payload placeholder processing properties prototyping reached
|
||||
recommended recovered redacted remaining replaced required reverted
|
||||
serializes shared signed signing skipped stored supported tagging targetted
|
||||
recommended recovered redacted remaining replaced repriced required reverted
|
||||
serializes shared signed signing skipped stats stored supported tagging targetted
|
||||
throttled transactions typed uninstall unstake unsubscribe untyped
|
||||
using verifies verifying website
|
||||
|
||||
@@ -32,7 +32,7 @@ using verifies verifying website
|
||||
bech BIP BIP39 BIP44 btc bzz crypto eip etc hashes hmac icap
|
||||
keccak ltc namehash ripemd RLP scrypt secp sha xdai
|
||||
|
||||
blockhash
|
||||
blockhash bnb bnbt ethprice matic txlist
|
||||
|
||||
bitcoin ethereum finney gwei kwei mwei satoshi szabo wei weth
|
||||
|
||||
|
||||
1186
package-lock.json
generated
1186
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -69,7 +69,7 @@
|
||||
"diff": "4.0.1",
|
||||
"flatworm": "0.0.2-beta.5",
|
||||
"jison": "0.4.18",
|
||||
"karma": "5.2.3",
|
||||
"karma": "6.3.2",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-mocha": "2.0.1",
|
||||
"libnpmpublish": "3.0.1",
|
||||
@@ -92,13 +92,13 @@
|
||||
"@types/mocha": "^5.2.0",
|
||||
"aes-js": "3.0.0",
|
||||
"bech32": "1.1.4",
|
||||
"bn.js": "^4.4.0",
|
||||
"bn.js": "^4.11.9",
|
||||
"elliptic": "6.5.4",
|
||||
"hash.js": "1.1.3",
|
||||
"hash.js": "1.1.7",
|
||||
"js-sha3": "0.5.7",
|
||||
"scrypt-js": "3.0.1",
|
||||
"solc": "0.7.1",
|
||||
"tiny-inflate": "1.0.3",
|
||||
"ws": "7.2.3"
|
||||
"ws": "7.4.6"
|
||||
}
|
||||
}
|
||||
|
||||
2
packages/abi/lib.esm/_version.d.ts
vendored
2
packages/abi/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abi/5.1.0";
|
||||
export declare const version = "abi/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "abi/5.1.0";
|
||||
export const version = "abi/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src.ts/coders/array.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGjE,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE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,EAAE,MAAM,CAAC;gBAEZ,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAS3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAoBjD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAsB9B"}
|
||||
@@ -185,6 +185,17 @@ export class ArrayCoder extends Coder {
|
||||
let count = this.length;
|
||||
if (count === -1) {
|
||||
count = reader.readValue().toNumber();
|
||||
// Check that there is *roughly* enough data to ensure
|
||||
// stray random data is not being read as a length. Each
|
||||
// slot requires at least 32 bytes for their value (or 32
|
||||
// bytes as a link to the data). This could use a much
|
||||
// tighter bound, but we are erroring on the side of safety.
|
||||
if (count * 32 > reader._data.length) {
|
||||
logger.throwError("insufficient data length", Logger.errors.BUFFER_OVERRUN, {
|
||||
length: reader._data.length,
|
||||
count: count
|
||||
});
|
||||
}
|
||||
}
|
||||
let coders = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
packages/abi/lib.esm/fragments.d.ts
vendored
7
packages/abi/lib.esm/fragments.d.ts
vendored
@@ -74,4 +74,11 @@ export declare class FunctionFragment extends ConstructorFragment {
|
||||
static fromString(value: string): FunctionFragment;
|
||||
static isFunctionFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
export declare class ErrorFragment extends Fragment {
|
||||
format(format?: string): string;
|
||||
static from(value: ErrorFragment | JsonFragment | string): ErrorFragment;
|
||||
static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment;
|
||||
static fromString(value: string): ErrorFragment;
|
||||
static isErrorFragment(value: any): value is ErrorFragment;
|
||||
}
|
||||
//# sourceMappingURL=fragments.d.ts.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../src.ts/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rD,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAE3B,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IAoD/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,MAAM,GAAG,gBAAgB;IAO9E,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,YAAY,GAAG,gBAAgB;IAuB3E,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAmClD,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGnE;AAaD,qBAAa,aAAc,SAAQ,QAAQ;IAEvC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IA2B/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,aAAa;IAOxE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,aAAa;IAgBrE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAgB/C,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa;CAG7D"}
|
||||
@@ -354,6 +354,8 @@ export class Fragment {
|
||||
return EventFragment.fromObject(value);
|
||||
case "constructor":
|
||||
return ConstructorFragment.fromObject(value);
|
||||
case "error":
|
||||
return ErrorFragment.fromObject(value);
|
||||
case "fallback":
|
||||
case "receive":
|
||||
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
||||
@@ -375,6 +377,9 @@ export class Fragment {
|
||||
else if (value.split("(")[0].trim() === "constructor") {
|
||||
return ConstructorFragment.fromString(value.trim());
|
||||
}
|
||||
else if (value.split(" ")[0] === "error") {
|
||||
return ErrorFragment.fromString(value.substring(5).trim());
|
||||
}
|
||||
return logger.throwArgumentError("unsupported fragment", "value", value);
|
||||
}
|
||||
static isFragment(value) {
|
||||
@@ -730,10 +735,74 @@ export class FunctionFragment extends ConstructorFragment {
|
||||
return (value && value._isFragment && value.type === "function");
|
||||
}
|
||||
}
|
||||
//export class ErrorFragment extends Fragment {
|
||||
//}
|
||||
//export class StructFragment extends Fragment {
|
||||
//}
|
||||
function checkForbidden(fragment) {
|
||||
const sig = fragment.format();
|
||||
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
||||
logger.throwArgumentError(`cannot specify user defined ${sig} error`, "fragment", fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
export class ErrorFragment extends Fragment {
|
||||
format(format) {
|
||||
if (!format) {
|
||||
format = FormatTypes.sighash;
|
||||
}
|
||||
if (!FormatTypes[format]) {
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
name: this.name,
|
||||
inputs: this.inputs.map((input) => JSON.parse(input.format(format))),
|
||||
});
|
||||
}
|
||||
let result = "";
|
||||
if (format !== FormatTypes.sighash) {
|
||||
result += "error ";
|
||||
}
|
||||
result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") ";
|
||||
return result.trim();
|
||||
}
|
||||
static from(value) {
|
||||
if (typeof (value) === "string") {
|
||||
return ErrorFragment.fromString(value);
|
||||
}
|
||||
return ErrorFragment.fromObject(value);
|
||||
}
|
||||
static fromObject(value) {
|
||||
if (ErrorFragment.isErrorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "error") {
|
||||
logger.throwArgumentError("invalid error object", "value", value);
|
||||
}
|
||||
const params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : [])
|
||||
};
|
||||
return checkForbidden(new ErrorFragment(_constructorGuard, params));
|
||||
}
|
||||
static fromString(value) {
|
||||
let params = { type: "error" };
|
||||
let parens = value.match(regexParen);
|
||||
if (!parens) {
|
||||
logger.throwArgumentError("invalid error signature", "value", value);
|
||||
}
|
||||
params.name = parens[1].trim();
|
||||
if (params.name) {
|
||||
verifyIdentifier(params.name);
|
||||
}
|
||||
params.inputs = parseParams(parens[2], false);
|
||||
return checkForbidden(ErrorFragment.fromObject(params));
|
||||
}
|
||||
static isErrorFragment(value) {
|
||||
return (value && value._isFragment && value.type === "error");
|
||||
}
|
||||
}
|
||||
function verifyType(type) {
|
||||
// These need to be transformed to their full description
|
||||
if (type.match(/^uint($|[^1-9])/)) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
packages/abi/lib.esm/index.d.ts
vendored
4
packages/abi/lib.esm/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"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AAC"}
|
||||
@@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
|
||||
import { AbiCoder, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAU,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAUP,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAkC,SAAS,EAAE,MAAM,aAAa,CAAC;AACpK,OAAO,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAU,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAUP,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
7
packages/abi/lib.esm/interface.d.ts
vendored
7
packages/abi/lib.esm/interface.d.ts
vendored
@@ -3,7 +3,7 @@ import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
@@ -28,7 +28,7 @@ export declare class Indexed extends Description<Indexed> {
|
||||
export declare class Interface {
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
readonly errors: {
|
||||
[name: string]: any;
|
||||
[name: string]: ErrorFragment;
|
||||
};
|
||||
readonly events: {
|
||||
[name: string]: EventFragment;
|
||||
@@ -46,10 +46,11 @@ export declare class Interface {
|
||||
format(format?: string): string | Array<string>;
|
||||
static getAbiCoder(): AbiCoder;
|
||||
static getAddress(address: string): string;
|
||||
static getSighash(functionFragment: FunctionFragment): string;
|
||||
static getSighash(fragment: ErrorFragment | FunctionFragment): string;
|
||||
static getEventTopic(eventFragment: EventFragment): string;
|
||||
getFunction(nameOrSignatureOrSighash: string): FunctionFragment;
|
||||
getEvent(nameOrSignatureOrTopic: string): EventFragment;
|
||||
getError(nameOrSignatureOrSighash: string): ErrorFragment;
|
||||
getSighash(functionFragment: FunctionFragment | string): string;
|
||||
getEventTopic(eventFragment: EventFragment | string): string;
|
||||
_decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src.ts/interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAY,SAAS,EAA0D,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAkB,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAe,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMnI,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC,qBAAa,cAAe,SAAQ,WAAW,CAAC,cAAc,CAAC;IAC3D,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACxB;AAED,qBAAa,sBAAuB,SAAQ,WAAW,CAAC,sBAAsB,CAAC;IAC3E,QAAQ,CAAC,gBAAgB,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
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
||||
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
||||
};
|
||||
function wrapAccessError(property, error) {
|
||||
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
|
||||
wrap.error = error;
|
||||
@@ -78,6 +82,9 @@ export class Interface {
|
||||
//checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = this.events;
|
||||
break;
|
||||
case "error":
|
||||
bucket = this.errors;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -118,8 +125,8 @@ export class Interface {
|
||||
static getAddress(address) {
|
||||
return getAddress(address);
|
||||
}
|
||||
static getSighash(functionFragment) {
|
||||
return hexDataSlice(id(functionFragment.format()), 0, 4);
|
||||
static getSighash(fragment) {
|
||||
return hexDataSlice(id(fragment.format()), 0, 4);
|
||||
}
|
||||
static getEventTopic(eventFragment) {
|
||||
return id(eventFragment.format());
|
||||
@@ -183,6 +190,37 @@ export class Interface {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
getError(nameOrSignatureOrSighash) {
|
||||
if (isHexString(nameOrSignatureOrSighash)) {
|
||||
const getSighash = getStatic(this.constructor, "getSighash");
|
||||
for (const name in this.errors) {
|
||||
const error = this.errors[name];
|
||||
if (nameOrSignatureOrSighash === getSighash(error)) {
|
||||
return this.errors[name];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
const name = nameOrSignatureOrSighash.trim();
|
||||
const matching = Object.keys(this.errors).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching error", "name", name);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching errors", "name", name);
|
||||
}
|
||||
return this.errors[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
||||
getSighash(functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@@ -234,6 +272,8 @@ export class Interface {
|
||||
}
|
||||
let bytes = arrayify(data);
|
||||
let reason = null;
|
||||
let errorArgs = null;
|
||||
let errorName = null;
|
||||
let errorSignature = null;
|
||||
switch (bytes.length % this._abiCoder._getWordSize()) {
|
||||
case 0:
|
||||
@@ -242,18 +282,34 @@ export class Interface {
|
||||
}
|
||||
catch (error) { }
|
||||
break;
|
||||
case 4:
|
||||
if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
errorSignature = "Error(string)";
|
||||
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
case 4: {
|
||||
const selector = hexlify(bytes.slice(0, 4));
|
||||
const builtin = BuiltinErrors[selector];
|
||||
if (builtin) {
|
||||
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
||||
errorName = builtin.name;
|
||||
errorSignature = builtin.signature;
|
||||
if (builtin.reason) {
|
||||
reason = errorArgs[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
const error = this.getError(selector);
|
||||
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
||||
errorName = error.name;
|
||||
errorSignature = error.format();
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logger.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [reason],
|
||||
reason: reason
|
||||
errorArgs, errorName, errorSignature, reason
|
||||
});
|
||||
}
|
||||
// Encode the result for a function call (e.g. for eth_call)
|
||||
@@ -459,6 +515,8 @@ export class Interface {
|
||||
value: BigNumber.from(tx.value || "0"),
|
||||
});
|
||||
}
|
||||
// @TODO
|
||||
//parseCallResult(data: BytesLike): ??
|
||||
// Given an event log, find the matching event fragment (if any) and
|
||||
// determine all its properties and values
|
||||
parseLog(log) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
packages/abi/lib/_version.d.ts
vendored
2
packages/abi/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abi/5.1.0";
|
||||
export declare const version = "abi/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abi/5.1.0";
|
||||
exports.version = "abi/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src.ts/coders/array.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAGjE,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;CAAE,GAAG,MAAM,CAuEzH;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAiFnE;AAGD,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,Q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var count = this.length;
|
||||
if (count === -1) {
|
||||
count = reader.readValue().toNumber();
|
||||
// Check that there is *roughly* enough data to ensure
|
||||
// stray random data is not being read as a length. Each
|
||||
// slot requires at least 32 bytes for their value (or 32
|
||||
// bytes as a link to the data). This could use a much
|
||||
// tighter bound, but we are erroring on the side of safety.
|
||||
if (count * 32 > reader._data.length) {
|
||||
logger.throwError("insufficient data length", logger_1.Logger.errors.BUFFER_OVERRUN, {
|
||||
length: reader._data.length,
|
||||
count: count
|
||||
});
|
||||
}
|
||||
}
|
||||
var coders = [];
|
||||
for (var i = 0; i < count; i++) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
7
packages/abi/lib/fragments.d.ts
vendored
7
packages/abi/lib/fragments.d.ts
vendored
@@ -74,4 +74,11 @@ export declare class FunctionFragment extends ConstructorFragment {
|
||||
static fromString(value: string): FunctionFragment;
|
||||
static isFunctionFragment(value: any): value is FunctionFragment;
|
||||
}
|
||||
export declare class ErrorFragment extends Fragment {
|
||||
format(format?: string): string;
|
||||
static from(value: ErrorFragment | JsonFragment | string): ErrorFragment;
|
||||
static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment;
|
||||
static fromString(value: string): ErrorFragment;
|
||||
static isErrorFragment(value: any): value is ErrorFragment;
|
||||
}
|
||||
//# sourceMappingURL=fragments.d.ts.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../src.ts/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAOrD,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED,MAAM,WAA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AAK,EAAE,MAAM,GAAG,gBAAgB;IAmClD,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAGnE;AAaD,qBAAa,aAAc,SAAQ,QAAQ;IAEvC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;IA2B/B,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,aAAa;IAOxE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,YAAY,GAAG,aAAa;IAgBrE,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAgB/C,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa;CAG7D"}
|
||||
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FunctionFragment = exports.ConstructorFragment = exports.EventFragment = exports.Fragment = exports.ParamType = exports.FormatTypes = void 0;
|
||||
exports.ErrorFragment = exports.FunctionFragment = exports.ConstructorFragment = exports.EventFragment = exports.Fragment = exports.ParamType = exports.FormatTypes = void 0;
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
@@ -373,6 +373,8 @@ var Fragment = /** @class */ (function () {
|
||||
return EventFragment.fromObject(value);
|
||||
case "constructor":
|
||||
return ConstructorFragment.fromObject(value);
|
||||
case "error":
|
||||
return ErrorFragment.fromObject(value);
|
||||
case "fallback":
|
||||
case "receive":
|
||||
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
||||
@@ -394,6 +396,9 @@ var Fragment = /** @class */ (function () {
|
||||
else if (value.split("(")[0].trim() === "constructor") {
|
||||
return ConstructorFragment.fromString(value.trim());
|
||||
}
|
||||
else if (value.split(" ")[0] === "error") {
|
||||
return ErrorFragment.fromString(value.substring(5).trim());
|
||||
}
|
||||
return logger.throwArgumentError("unsupported fragment", "value", value);
|
||||
};
|
||||
Fragment.isFragment = function (value) {
|
||||
@@ -769,10 +774,80 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
return FunctionFragment;
|
||||
}(ConstructorFragment));
|
||||
exports.FunctionFragment = FunctionFragment;
|
||||
//export class ErrorFragment extends Fragment {
|
||||
//}
|
||||
//export class StructFragment extends Fragment {
|
||||
//}
|
||||
function checkForbidden(fragment) {
|
||||
var sig = fragment.format();
|
||||
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
||||
logger.throwArgumentError("cannot specify user defined " + sig + " error", "fragment", fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
var ErrorFragment = /** @class */ (function (_super) {
|
||||
__extends(ErrorFragment, _super);
|
||||
function ErrorFragment() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
ErrorFragment.prototype.format = function (format) {
|
||||
if (!format) {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
name: this.name,
|
||||
inputs: this.inputs.map(function (input) { return JSON.parse(input.format(format)); }),
|
||||
});
|
||||
}
|
||||
var result = "";
|
||||
if (format !== exports.FormatTypes.sighash) {
|
||||
result += "error ";
|
||||
}
|
||||
result += this.name + "(" + this.inputs.map(function (input) { return input.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ") ";
|
||||
return result.trim();
|
||||
};
|
||||
ErrorFragment.from = function (value) {
|
||||
if (typeof (value) === "string") {
|
||||
return ErrorFragment.fromString(value);
|
||||
}
|
||||
return ErrorFragment.fromObject(value);
|
||||
};
|
||||
ErrorFragment.fromObject = function (value) {
|
||||
if (ErrorFragment.isErrorFragment(value)) {
|
||||
return value;
|
||||
}
|
||||
if (value.type !== "error") {
|
||||
logger.throwArgumentError("invalid error object", "value", value);
|
||||
}
|
||||
var params = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : [])
|
||||
};
|
||||
return checkForbidden(new ErrorFragment(_constructorGuard, params));
|
||||
};
|
||||
ErrorFragment.fromString = function (value) {
|
||||
var params = { type: "error" };
|
||||
var parens = value.match(regexParen);
|
||||
if (!parens) {
|
||||
logger.throwArgumentError("invalid error signature", "value", value);
|
||||
}
|
||||
params.name = parens[1].trim();
|
||||
if (params.name) {
|
||||
verifyIdentifier(params.name);
|
||||
}
|
||||
params.inputs = parseParams(parens[2], false);
|
||||
return checkForbidden(ErrorFragment.fromObject(params));
|
||||
};
|
||||
ErrorFragment.isErrorFragment = function (value) {
|
||||
return (value && value._isFragment && value.type === "error");
|
||||
};
|
||||
return ErrorFragment;
|
||||
}(Fragment));
|
||||
exports.ErrorFragment = ErrorFragment;
|
||||
function verifyType(type) {
|
||||
// These need to be transformed to their full description
|
||||
if (type.match(/^uint($|[^1-9])/)) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
4
packages/abi/lib/index.d.ts
vendored
4
packages/abi/lib/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
export { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, CoerceFunc, JsonFragment, JsonFragmentType, Result, checkResultErrors, LogDescription, TransactionDescription };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpK,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEpH,OAAO,EACH,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,WAAW,EAEX,QAAQ,EACR,eAAe,EAEf,SAAS,EACT,OAAO,EAKP,UAAU,EACV,YAAY,EACZ,gBAAgB,EAEhB,MAAM,EACN,iBAAiB,EAEjB,cAAc,EACd,sBAAsB,EACzB,CAAC"}
|
||||
@@ -1,8 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TransactionDescription = exports.LogDescription = exports.checkResultErrors = exports.Indexed = exports.Interface = exports.defaultAbiCoder = exports.AbiCoder = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ConstructorFragment = void 0;
|
||||
exports.TransactionDescription = exports.LogDescription = exports.checkResultErrors = exports.Indexed = exports.Interface = exports.defaultAbiCoder = exports.AbiCoder = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = void 0;
|
||||
var fragments_1 = require("./fragments");
|
||||
Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_1.ConstructorFragment; } });
|
||||
Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_1.ErrorFragment; } });
|
||||
Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return fragments_1.EventFragment; } });
|
||||
Object.defineProperty(exports, "FormatTypes", { enumerable: true, get: function () { return fragments_1.FormatTypes; } });
|
||||
Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return fragments_1.Fragment; } });
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yCAAqJ;AAKjJ,oGALK,+BAAmB,OAKL;AACnB,8FAN0B,yBAAa,OAM1B;AAIb,4FAVyC,uBAAW,OAUzC;AAHX,yFAPsD,oBAAQ,OAOtD;AACR,iGARgE,4BAAgB,OAQhE;AAChB,0FATkH,qBAAS,OASlH;AARb,yCAAoE;AAWhE,yFAXK,oBAAQ,OAWL;AACR,gGAZ2B,2BAAe,OAY3B;AAXnB,yCAAoH;AAwBhH,kGAxBK,6BAAiB,OAwBL;AAVjB,wFAdwB,mBAAO,OAcxB;AADP,0FAbiC,qBAAS,OAajC;AAaT,+FA1B4C,0BAAc,OA0B5C;AACd,uGA3BoE,kCAAsB,OA2BpE"}
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yCAAoK;AAKhK,oGALK,+BAAmB,OAKL;AACnB,8FAN0B,yBAAa,OAM1B;AACb,8FAPyC,yBAAa,OAOzC;AAIb,4FAXwD,uBAAW,OAWxD;AAHX,yFARqE,oBAAQ,OAQrE;AACR,iGAT+E,4BAAgB,OAS/E;AAChB,0FAViI,qBAAS,OAUjI;AATb,yCAAoE;AAYhE,yFAZK,oBAAQ,OAYL;AACR,gGAb2B,2BAAe,OAa3B;AAZnB,yCAAoH;AAyBhH,kGAzBK,6BAAiB,OAyBL;AAVjB,wFAfwB,mBAAO,OAexB;AADP,0FAdiC,qBAAS,OAcjC;AAaT,+FA3B4C,0BAAc,OA2B5C;AACd,uGA5BoE,kCAAsB,OA4BpE"}
|
||||
7
packages/abi/lib/interface.d.ts
vendored
7
packages/abi/lib/interface.d.ts
vendored
@@ -3,7 +3,7 @@ import { BytesLike } from "@ethersproject/bytes";
|
||||
import { Description } from "@ethersproject/properties";
|
||||
import { AbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
export { checkResultErrors, Result };
|
||||
export declare class LogDescription extends Description<LogDescription> {
|
||||
readonly eventFragment: EventFragment;
|
||||
@@ -28,7 +28,7 @@ export declare class Indexed extends Description<Indexed> {
|
||||
export declare class Interface {
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
readonly errors: {
|
||||
[name: string]: any;
|
||||
[name: string]: ErrorFragment;
|
||||
};
|
||||
readonly events: {
|
||||
[name: string]: EventFragment;
|
||||
@@ -46,10 +46,11 @@ export declare class Interface {
|
||||
format(format?: string): string | Array<string>;
|
||||
static getAbiCoder(): AbiCoder;
|
||||
static getAddress(address: string): string;
|
||||
static getSighash(functionFragment: FunctionFragment): string;
|
||||
static getSighash(fragment: ErrorFragment | FunctionFragment): string;
|
||||
static getEventTopic(eventFragment: EventFragment): string;
|
||||
getFunction(nameOrSignatureOrSighash: string): FunctionFragment;
|
||||
getEvent(nameOrSignatureOrTopic: string): EventFragment;
|
||||
getError(nameOrSignatureOrSighash: string): ErrorFragment;
|
||||
getSighash(functionFragment: FunctionFragment | string): string;
|
||||
getEventTopic(eventFragment: EventFragment | string): string;
|
||||
_decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src.ts/interface.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAY,SAAS,EAA0D,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAkB,WAAW,EAAa,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAe,QAAQ,E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CAAC,MAAM,CAAC,GAAG,MAAM;IA0F9G,gBAAgB,CAAC,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,YAAY,CAAA;KAAE,GAAG,sBAAsB;IAoBpF,QAAQ,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,GAAG,cAAc;IAgCrE,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD"}
|
||||
@@ -56,6 +56,10 @@ var Indexed = /** @class */ (function (_super) {
|
||||
return Indexed;
|
||||
}(properties_1.Description));
|
||||
exports.Indexed = Indexed;
|
||||
var BuiltinErrors = {
|
||||
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: ["string"], reason: true },
|
||||
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: ["uint256"] }
|
||||
};
|
||||
function wrapAccessError(property, error) {
|
||||
var wrap = new Error("deferred error during ABI decoding triggered accessing " + property);
|
||||
wrap.error = error;
|
||||
@@ -115,6 +119,9 @@ var Interface = /** @class */ (function () {
|
||||
//checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = _this.events;
|
||||
break;
|
||||
case "error":
|
||||
bucket = _this.errors;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -155,8 +162,8 @@ var Interface = /** @class */ (function () {
|
||||
Interface.getAddress = function (address) {
|
||||
return address_1.getAddress(address);
|
||||
};
|
||||
Interface.getSighash = function (functionFragment) {
|
||||
return bytes_1.hexDataSlice(hash_1.id(functionFragment.format()), 0, 4);
|
||||
Interface.getSighash = function (fragment) {
|
||||
return bytes_1.hexDataSlice(hash_1.id(fragment.format()), 0, 4);
|
||||
};
|
||||
Interface.getEventTopic = function (eventFragment) {
|
||||
return hash_1.id(eventFragment.format());
|
||||
@@ -220,6 +227,37 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
Interface.prototype.getError = function (nameOrSignatureOrSighash) {
|
||||
if (bytes_1.isHexString(nameOrSignatureOrSighash)) {
|
||||
var getSighash = properties_1.getStatic(this.constructor, "getSighash");
|
||||
for (var name_5 in this.errors) {
|
||||
var error = this.errors[name_5];
|
||||
if (nameOrSignatureOrSighash === getSighash(error)) {
|
||||
return this.errors[name_5];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
var name_6 = nameOrSignatureOrSighash.trim();
|
||||
var matching = Object.keys(this.errors).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_6); });
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching error", "name", name_6);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching errors", "name", name_6);
|
||||
}
|
||||
return this.errors[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
var result = this.errors[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
||||
Interface.prototype.getSighash = function (functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@@ -271,6 +309,8 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
var bytes = bytes_1.arrayify(data);
|
||||
var reason = null;
|
||||
var errorArgs = null;
|
||||
var errorName = null;
|
||||
var errorSignature = null;
|
||||
switch (bytes.length % this._abiCoder._getWordSize()) {
|
||||
case 0:
|
||||
@@ -279,18 +319,34 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
catch (error) { }
|
||||
break;
|
||||
case 4:
|
||||
if (bytes_1.hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
errorSignature = "Error(string)";
|
||||
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
|
||||
case 4: {
|
||||
var selector = bytes_1.hexlify(bytes.slice(0, 4));
|
||||
var builtin = BuiltinErrors[selector];
|
||||
if (builtin) {
|
||||
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
||||
errorName = builtin.name;
|
||||
errorSignature = builtin.signature;
|
||||
if (builtin.reason) {
|
||||
reason = errorArgs[0];
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
var error = this.getError(selector);
|
||||
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
||||
errorName = error.name;
|
||||
errorSignature = error.format();
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [reason],
|
||||
reason: reason
|
||||
errorArgs: errorArgs, errorName: errorName, errorSignature: errorSignature, reason: reason
|
||||
});
|
||||
};
|
||||
// Encode the result for a function call (e.g. for eth_call)
|
||||
@@ -501,6 +557,8 @@ var Interface = /** @class */ (function () {
|
||||
value: bignumber_1.BigNumber.from(tx.value || "0"),
|
||||
});
|
||||
};
|
||||
// @TODO
|
||||
//parseCallResult(data: BytesLike): ??
|
||||
// Given an event log, find the matching event fragment (if any) and
|
||||
// determine all its properties and values
|
||||
Interface.prototype.parseLog = function (log) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"@ethersproject/address": "^5.1.0",
|
||||
"@ethersproject/bignumber": "^5.1.0",
|
||||
"@ethersproject/bytes": "^5.1.0",
|
||||
"@ethersproject/constants": "^5.1.0",
|
||||
"@ethersproject/hash": "^5.1.0",
|
||||
"@ethersproject/keccak256": "^5.1.0",
|
||||
"@ethersproject/logger": "^5.1.0",
|
||||
"@ethersproject/properties": "^5.1.0",
|
||||
"@ethersproject/strings": "^5.1.0"
|
||||
"@ethersproject/address": "^5.3.0",
|
||||
"@ethersproject/bignumber": "^5.3.0",
|
||||
"@ethersproject/bytes": "^5.3.0",
|
||||
"@ethersproject/constants": "^5.3.0",
|
||||
"@ethersproject/hash": "^5.3.0",
|
||||
"@ethersproject/keccak256": "^5.3.0",
|
||||
"@ethersproject/logger": "^5.3.0",
|
||||
"@ethersproject/properties": "^5.3.0",
|
||||
"@ethersproject/strings": "^5.3.0"
|
||||
},
|
||||
"description": "Utilities and Classes for parsing, formatting and managing Ethereum ABIs.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -43,7 +43,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x1268f244b9c48541e6ac01c961ac81782d8dc8212aa3a00f570f8e4a5ebb541b",
|
||||
"tarballHash": "0xffd3d7fde3b357efa0d4e00e3cd0984aa73e2d13e036c9df204bd172f64a83a0",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "abi/5.1.0";
|
||||
export const version = "abi/5.3.0";
|
||||
|
||||
@@ -212,8 +212,19 @@ export class ArrayCoder extends Coder {
|
||||
let count = this.length;
|
||||
if (count === -1) {
|
||||
count = reader.readValue().toNumber();
|
||||
}
|
||||
|
||||
// Check that there is *roughly* enough data to ensure
|
||||
// stray random data is not being read as a length. Each
|
||||
// slot requires at least 32 bytes for their value (or 32
|
||||
// bytes as a link to the data). This could use a much
|
||||
// tighter bound, but we are erroring on the side of safety.
|
||||
if (count * 32 > reader._data.length) {
|
||||
logger.throwError("insufficient data length", Logger.errors.BUFFER_OVERRUN, {
|
||||
length: reader._data.length,
|
||||
count: count
|
||||
});
|
||||
}
|
||||
}
|
||||
let coders = [];
|
||||
for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }
|
||||
|
||||
|
||||
@@ -445,6 +445,8 @@ export abstract class Fragment {
|
||||
return EventFragment.fromObject(value);
|
||||
case "constructor":
|
||||
return ConstructorFragment.fromObject(value);
|
||||
case "error":
|
||||
return ErrorFragment.fromObject(value);
|
||||
case "fallback":
|
||||
case "receive":
|
||||
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
|
||||
@@ -466,6 +468,8 @@ export abstract class Fragment {
|
||||
return FunctionFragment.fromString(value.substring(8).trim());
|
||||
} else if (value.split("(")[0].trim() === "constructor") {
|
||||
return ConstructorFragment.fromString(value.trim());
|
||||
} else if (value.split(" ")[0] === "error") {
|
||||
return ErrorFragment.fromString(value.substring(5).trim());
|
||||
}
|
||||
|
||||
return logger.throwArgumentError("unsupported fragment", "value", value);
|
||||
@@ -927,12 +931,90 @@ export class FunctionFragment extends ConstructorFragment {
|
||||
}
|
||||
}
|
||||
|
||||
//export class ErrorFragment extends Fragment {
|
||||
//}
|
||||
|
||||
//export class StructFragment extends Fragment {
|
||||
//}
|
||||
|
||||
function checkForbidden(fragment: ErrorFragment): ErrorFragment {
|
||||
const sig = fragment.format();
|
||||
if (sig === "Error(string)" || sig === "Panic(uint256)") {
|
||||
logger.throwArgumentError(`cannot specify user defined ${ sig } error`, "fragment", fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
export class ErrorFragment extends Fragment {
|
||||
|
||||
format(format?: string): string {
|
||||
if (!format) { format = FormatTypes.sighash; }
|
||||
if (!FormatTypes[format]) {
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
|
||||
if (format === FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
type: "error",
|
||||
name: this.name,
|
||||
inputs: this.inputs.map((input) => JSON.parse(input.format(format))),
|
||||
});
|
||||
}
|
||||
|
||||
let result = "";
|
||||
|
||||
if (format !== FormatTypes.sighash) {
|
||||
result += "error ";
|
||||
}
|
||||
|
||||
result += this.name + "(" + this.inputs.map(
|
||||
(input) => input.format(format)
|
||||
).join((format === FormatTypes.full) ? ", ": ",") + ") ";
|
||||
|
||||
return result.trim();
|
||||
}
|
||||
|
||||
static from(value: ErrorFragment | JsonFragment | string): ErrorFragment {
|
||||
if (typeof(value) === "string") {
|
||||
return ErrorFragment.fromString(value);
|
||||
}
|
||||
return ErrorFragment.fromObject(value);
|
||||
}
|
||||
|
||||
static fromObject(value: ErrorFragment | JsonFragment): ErrorFragment {
|
||||
if (ErrorFragment.isErrorFragment(value)) { return value; }
|
||||
|
||||
if (value.type !== "error") {
|
||||
logger.throwArgumentError("invalid error object", "value", value);
|
||||
}
|
||||
|
||||
const params: TypeCheck<_Fragment> = {
|
||||
type: value.type,
|
||||
name: verifyIdentifier(value.name),
|
||||
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject): [])
|
||||
};
|
||||
|
||||
return checkForbidden(new ErrorFragment(_constructorGuard, params));
|
||||
}
|
||||
|
||||
static fromString(value: string): ErrorFragment {
|
||||
let params: any = { type: "error" };
|
||||
|
||||
let parens = value.match(regexParen);
|
||||
if (!parens) {
|
||||
logger.throwArgumentError("invalid error signature", "value", value);
|
||||
}
|
||||
|
||||
params.name = parens[1].trim();
|
||||
if (params.name) { verifyIdentifier(params.name); }
|
||||
|
||||
params.inputs = parseParams(parens[2], false);
|
||||
|
||||
return checkForbidden(ErrorFragment.fromObject(params));
|
||||
}
|
||||
|
||||
static isErrorFragment(value: any): value is ErrorFragment {
|
||||
return (value && value._isFragment && value.type === "error");
|
||||
}
|
||||
}
|
||||
|
||||
function verifyType(type: string): string {
|
||||
|
||||
// These need to be transformed to their full description
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, JsonFragmentType, ParamType } from "./fragments";
|
||||
import { AbiCoder, CoerceFunc, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Indexed, Interface, LogDescription, Result, TransactionDescription } from "./interface";
|
||||
|
||||
export {
|
||||
ConstructorFragment,
|
||||
ErrorFragment,
|
||||
EventFragment,
|
||||
Fragment,
|
||||
FunctionFragment,
|
||||
|
||||
@@ -9,7 +9,7 @@ import { defineReadOnly, Description, getStatic } from "@ethersproject/propertie
|
||||
|
||||
import { AbiCoder, defaultAbiCoder } from "./abi-coder";
|
||||
import { checkResultErrors, Result } from "./coders/abstract-coder";
|
||||
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
import { ConstructorFragment, ErrorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, JsonFragment, ParamType } from "./fragments";
|
||||
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
import { version } from "./_version";
|
||||
@@ -43,6 +43,11 @@ export class Indexed extends Description<Indexed> {
|
||||
}
|
||||
}
|
||||
|
||||
const BuiltinErrors: Record<string, { signature: string, inputs: Array<string>, name: string, reason?: boolean }> = {
|
||||
"0x08c379a0": { signature: "Error(string)", name: "Error", inputs: [ "string" ], reason: true },
|
||||
"0x4e487b71": { signature: "Panic(uint256)", name: "Panic", inputs: [ "uint256" ] }
|
||||
}
|
||||
|
||||
function wrapAccessError(property: string, error: Error): Error {
|
||||
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${ property }`);
|
||||
(<any>wrap).error = error;
|
||||
@@ -65,7 +70,7 @@ function checkNames(fragment: Fragment, type: "input" | "output", params: Array<
|
||||
export class Interface {
|
||||
readonly fragments: ReadonlyArray<Fragment>;
|
||||
|
||||
readonly errors: { [ name: string ]: any };
|
||||
readonly errors: { [ name: string ]: ErrorFragment };
|
||||
readonly events: { [ name: string ]: EventFragment };
|
||||
readonly functions: { [ name: string ]: FunctionFragment };
|
||||
readonly structs: { [ name: string ]: any };
|
||||
@@ -118,6 +123,9 @@ export class Interface {
|
||||
//checkNames(fragment, "input", fragment.inputs);
|
||||
bucket = this.events;
|
||||
break;
|
||||
case "error":
|
||||
bucket = this.errors;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -167,8 +175,8 @@ export class Interface {
|
||||
return getAddress(address);
|
||||
}
|
||||
|
||||
static getSighash(functionFragment: FunctionFragment): string {
|
||||
return hexDataSlice(id(functionFragment.format()), 0, 4);
|
||||
static getSighash(fragment: ErrorFragment | FunctionFragment): string {
|
||||
return hexDataSlice(id(fragment.format()), 0, 4);
|
||||
}
|
||||
|
||||
static getEventTopic(eventFragment: EventFragment): string {
|
||||
@@ -240,6 +248,40 @@ export class Interface {
|
||||
return result;
|
||||
}
|
||||
|
||||
// Find a function definition by any means necessary (unless it is ambiguous)
|
||||
getError(nameOrSignatureOrSighash: string): ErrorFragment {
|
||||
if (isHexString(nameOrSignatureOrSighash)) {
|
||||
const getSighash = getStatic<(f: ErrorFragment | FunctionFragment) => string>(this.constructor, "getSighash");
|
||||
for (const name in this.errors) {
|
||||
const error = this.errors[name];
|
||||
if (nameOrSignatureOrSighash === getSighash(error)) {
|
||||
return this.errors[name];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
const name = nameOrSignatureOrSighash.trim();
|
||||
const matching = Object.keys(this.errors).filter((f) => (f.split("("/* fix:) */)[0] === name));
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching error", "name", name);
|
||||
} else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching errors", "name", name);
|
||||
}
|
||||
|
||||
return this.errors[matching[0]];
|
||||
}
|
||||
|
||||
// Normlize the signature and lookup the function
|
||||
const result = this.errors[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
|
||||
getSighash(functionFragment: FunctionFragment | string): string {
|
||||
if (typeof(functionFragment) === "string") {
|
||||
@@ -304,9 +346,11 @@ export class Interface {
|
||||
functionFragment = this.getFunction(functionFragment);
|
||||
}
|
||||
|
||||
let bytes = arrayify(data);
|
||||
let bytes = arrayify(data);
|
||||
|
||||
let reason: string = null;
|
||||
let errorArgs: Result = null;
|
||||
let errorName: string = null;
|
||||
let errorSignature: string = null;
|
||||
switch (bytes.length % this._abiCoder._getWordSize()) {
|
||||
case 0:
|
||||
@@ -315,19 +359,31 @@ export class Interface {
|
||||
} catch (error) { }
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
||||
errorSignature = "Error(string)";
|
||||
reason = this._abiCoder.decode([ "string" ], bytes.slice(4))[0];
|
||||
case 4: {
|
||||
const selector = hexlify(bytes.slice(0, 4));
|
||||
const builtin = BuiltinErrors[selector];
|
||||
if (builtin) {
|
||||
errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4));
|
||||
errorName = builtin.name;
|
||||
errorSignature = builtin.signature;
|
||||
if (builtin.reason) { reason = errorArgs[0]; }
|
||||
} else {
|
||||
try {
|
||||
const error = this.getError(selector);
|
||||
errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4));
|
||||
errorName = error.name;
|
||||
errorSignature = error.format();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return logger.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [ reason ],
|
||||
reason: reason
|
||||
errorArgs, errorName, errorSignature, reason
|
||||
});
|
||||
}
|
||||
|
||||
@@ -547,6 +603,9 @@ export class Interface {
|
||||
});
|
||||
}
|
||||
|
||||
// @TODO
|
||||
//parseCallResult(data: BytesLike): ??
|
||||
|
||||
// Given an event log, find the matching event fragment (if any) and
|
||||
// determine all its properties and values
|
||||
parseLog(log: { topics: Array<string>, data: string}): LogDescription {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-provider/5.1.0";
|
||||
export declare const version = "abstract-provider/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "abstract-provider/5.1.0";
|
||||
export const version = "abstract-provider/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -75,7 +75,7 @@ export interface TransactionReceipt {
|
||||
}
|
||||
export interface EventFilter {
|
||||
address?: string;
|
||||
topics?: Array<string | Array<string>>;
|
||||
topics?: Array<string | Array<string> | null>;
|
||||
}
|
||||
export interface Filter extends EventFilter {
|
||||
fromBlock?: BlockTag;
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
packages/abstract-provider/lib/_version.d.ts
vendored
2
packages/abstract-provider/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-provider/5.1.0";
|
||||
export declare const version = "abstract-provider/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abstract-provider/5.1.0";
|
||||
exports.version = "abstract-provider/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/abstract-provider/lib/index.d.ts
vendored
2
packages/abstract-provider/lib/index.d.ts
vendored
@@ -75,7 +75,7 @@ export interface TransactionReceipt {
|
||||
}
|
||||
export interface EventFilter {
|
||||
address?: string;
|
||||
topics?: Array<string | Array<string>>;
|
||||
topics?: Array<string | Array<string> | null>;
|
||||
}
|
||||
export interface Filter extends EventFilter {
|
||||
fromBlock?: BlockTag;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.1.0",
|
||||
"@ethersproject/bytes": "^5.1.0",
|
||||
"@ethersproject/logger": "^5.1.0",
|
||||
"@ethersproject/networks": "^5.1.0",
|
||||
"@ethersproject/properties": "^5.1.0",
|
||||
"@ethersproject/transactions": "^5.1.0",
|
||||
"@ethersproject/web": "^5.1.0"
|
||||
"@ethersproject/bignumber": "^5.3.0",
|
||||
"@ethersproject/bytes": "^5.3.0",
|
||||
"@ethersproject/logger": "^5.3.0",
|
||||
"@ethersproject/networks": "^5.3.0",
|
||||
"@ethersproject/properties": "^5.3.0",
|
||||
"@ethersproject/transactions": "^5.3.0",
|
||||
"@ethersproject/web": "^5.3.0"
|
||||
},
|
||||
"description": "An Abstract Class for describing an Ethereum Provider for ethers.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -41,7 +41,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x9a2ee9005c813b52689b7d87a01f6ce29010ef3f899c5fc500e6ae3ea0f03ea2",
|
||||
"tarballHash": "0xbe087cfc8ee43f3154f8006b382424ca7394b04d34fc089372ade08ba9cb65b6",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "abstract-provider/5.1.0";
|
||||
export const version = "abstract-provider/5.3.0";
|
||||
|
||||
@@ -114,7 +114,7 @@ export interface TransactionReceipt {
|
||||
|
||||
export interface EventFilter {
|
||||
address?: string;
|
||||
topics?: Array<string | Array<string>>;
|
||||
topics?: Array<string | Array<string> | null>;
|
||||
}
|
||||
|
||||
export interface Filter extends EventFilter {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-signer/5.1.0";
|
||||
export declare const version = "abstract-signer/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "abstract-signer/5.1.0";
|
||||
export const version = "abstract-signer/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/abstract-signer/lib/_version.d.ts
vendored
2
packages/abstract-signer/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "abstract-signer/5.1.0";
|
||||
export declare const version = "abstract-signer/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "abstract-signer/5.1.0";
|
||||
exports.version = "abstract-signer/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"@ethersproject/abstract-provider": "^5.1.0",
|
||||
"@ethersproject/bignumber": "^5.1.0",
|
||||
"@ethersproject/bytes": "^5.1.0",
|
||||
"@ethersproject/logger": "^5.1.0",
|
||||
"@ethersproject/properties": "^5.1.0"
|
||||
"@ethersproject/abstract-provider": "^5.3.0",
|
||||
"@ethersproject/bignumber": "^5.3.0",
|
||||
"@ethersproject/bytes": "^5.3.0",
|
||||
"@ethersproject/logger": "^5.3.0",
|
||||
"@ethersproject/properties": "^5.3.0"
|
||||
},
|
||||
"description": "An Abstract Class for desribing an Ethereum Signer for ethers.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -39,7 +39,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x56d53f21cca4bb8b1b1f7c25edf66e7633dbe56c90164546110f4702c6d0650e",
|
||||
"tarballHash": "0x2123b325684a93493b8ba0e346cd2e9c4bc8aa2137c217ab428e6069b86d8885",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "abstract-signer/5.1.0";
|
||||
export const version = "abstract-signer/5.3.0";
|
||||
|
||||
2
packages/address/lib.esm/_version.d.ts
vendored
2
packages/address/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "address/5.1.0";
|
||||
export declare const version = "address/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "address/5.1.0";
|
||||
export const version = "address/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/address/lib/_version.d.ts
vendored
2
packages/address/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "address/5.1.0";
|
||||
export declare const version = "address/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "address/5.1.0";
|
||||
exports.version = "address/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"@ethersproject/bignumber": "^5.1.0",
|
||||
"@ethersproject/bytes": "^5.1.0",
|
||||
"@ethersproject/keccak256": "^5.1.0",
|
||||
"@ethersproject/logger": "^5.1.0",
|
||||
"@ethersproject/rlp": "^5.1.0"
|
||||
"@ethersproject/bignumber": "^5.3.0",
|
||||
"@ethersproject/bytes": "^5.3.0",
|
||||
"@ethersproject/keccak256": "^5.3.0",
|
||||
"@ethersproject/logger": "^5.3.0",
|
||||
"@ethersproject/rlp": "^5.3.0"
|
||||
},
|
||||
"description": "Utilities for handling Ethereum Addresses for ethers.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -39,7 +39,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0xaa6a2ab1b7c3cad7bd17a3b20fc759b79d7ea911f01963a082af5385c46a14c6",
|
||||
"tarballHash": "0xa82e0a824c8508389be5bde68ac614fa98c1c867708e80c406b050ea75d12ad3",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "address/5.1.0";
|
||||
export const version = "address/5.3.0";
|
||||
|
||||
2
packages/asm/lib.esm/_version.d.ts
vendored
2
packages/asm/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "asm/5.1.0";
|
||||
export declare const version = "asm/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "asm/5.1.0";
|
||||
export const version = "asm/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/asm/lib/_version.d.ts
vendored
2
packages/asm/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "asm/5.1.0";
|
||||
export declare const version = "asm/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "asm/5.1.0";
|
||||
exports.version = "asm/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"ethers": "^5.1.0"
|
||||
"ethers": "^5.3.0"
|
||||
},
|
||||
"description": "ASM libraries and tools for the Ethereum EVM.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -36,7 +36,7 @@
|
||||
"generate": "node ./generate.js",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"tarballHash": "0x08e35b51e252b8780fdd4fb88d2df605fc0ba2731a106f73738660fb263a2827",
|
||||
"tarballHash": "0xc19d11fdfbed4b581cab4b18a2f9c6e1b14e961fc6b80862b6b2eb48565ea394",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "asm/5.1.0";
|
||||
export const version = "asm/5.3.0";
|
||||
|
||||
2
packages/base64/lib.esm/_version.d.ts
vendored
2
packages/base64/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "base64/5.1.0";
|
||||
export declare const version = "base64/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "base64/5.1.0";
|
||||
export const version = "base64/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/base64/lib/_version.d.ts
vendored
2
packages/base64/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "base64/5.1.0";
|
||||
export declare const version = "base64/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "base64/5.1.0";
|
||||
exports.version = "base64/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -7,7 +7,7 @@
|
||||
"./lib/base64": "./lib/browser-base64.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ethersproject/bytes": "^5.1.0"
|
||||
"@ethersproject/bytes": "^5.3.0"
|
||||
},
|
||||
"description": "Base64 coder.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -41,7 +41,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x2f08f73bfb5244fcf334f2e461e7645a74e2b2fa08b034bb9258025827a3ec31",
|
||||
"tarballHash": "0x821a2974aa7e21005ac390712a7c3be0f412dd614c9d73cf8fc92c61acdfd868",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "base64/5.1.0";
|
||||
export const version = "base64/5.3.0";
|
||||
|
||||
2
packages/basex/lib.esm/_version.d.ts
vendored
2
packages/basex/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "basex/5.1.0";
|
||||
export declare const version = "basex/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "basex/5.1.0";
|
||||
export const version = "basex/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
2
packages/basex/lib/_version.d.ts
vendored
2
packages/basex/lib/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "basex/5.1.0";
|
||||
export declare const version = "basex/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = void 0;
|
||||
exports.version = "basex/5.1.0";
|
||||
exports.version = "basex/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"author": "Richard Moore <me@ricmoo.com>",
|
||||
"dependencies": {
|
||||
"@ethersproject/bytes": "^5.1.0",
|
||||
"@ethersproject/properties": "^5.1.0"
|
||||
"@ethersproject/bytes": "^5.3.0",
|
||||
"@ethersproject/properties": "^5.3.0"
|
||||
},
|
||||
"description": "Base-X without Buffer.",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
@@ -36,7 +36,7 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"tarballHash": "0x4d21807d9f84a69f71bf50315cbce419936d0fe374c60f7cdda02aa5a254f1c5",
|
||||
"tarballHash": "0x1757601373adf9bc3152479e9aca168ad2e9f55253923e45f46516fb60a5993d",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.1.0"
|
||||
"version": "5.3.0"
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "basex/5.1.0";
|
||||
export const version = "basex/5.3.0";
|
||||
|
||||
2
packages/bignumber/lib.esm/_version.d.ts
vendored
2
packages/bignumber/lib.esm/_version.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
export declare const version = "bignumber/5.1.0";
|
||||
export declare const version = "bignumber/5.3.0";
|
||||
//# sourceMappingURL=_version.d.ts.map
|
||||
@@ -1,2 +1,2 @@
|
||||
export const version = "bignumber/5.1.0";
|
||||
export const version = "bignumber/5.3.0";
|
||||
//# sourceMappingURL=_version.js.map
|
||||
4
packages/bignumber/lib.esm/bignumber.d.ts
vendored
4
packages/bignumber/lib.esm/bignumber.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { Bytes, Hexable } from "@ethersproject/bytes";
|
||||
export declare type BigNumberish = BigNumber | Bytes | string | number;
|
||||
export declare type BigNumberish = BigNumber | Bytes | bigint | string | number;
|
||||
export declare function isBigNumberish(value: any): value is BigNumberish;
|
||||
export declare class BigNumber implements Hexable {
|
||||
readonly _hex: string;
|
||||
@@ -28,7 +28,7 @@ export declare class BigNumber implements Hexable {
|
||||
isNegative(): boolean;
|
||||
isZero(): boolean;
|
||||
toNumber(): number;
|
||||
toBigInt(): BigInt;
|
||||
toBigInt(): bigint;
|
||||
toString(): string;
|
||||
toHexString(): string;
|
||||
toJSON(key?: string): any;
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"bignumber.d.ts","sourceRoot":"","sources":["../src.ts/bignumber.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAiC,MAAM,sBAAsB,CAAC;AAWrF,oBAAY,YAAY,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAShE;AAKD,qBAAa,SAAU,YAAW,OAAO;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;gBAEnB,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAe9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAIhC,GAAG,IAAI,SAAS;IAOhB,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAInC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQlC,GAAG,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS;IAQnC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;IAO9B,GAAG,CAAC,KAAK,EAAE,MAAM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C,KAAK,EAAE,GAAG,GAAG,SAAS;IAkElC,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS;CAGrD;AAiED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD"}
|
||||
8
packages/bignumber/lib.esm/fixednumber.d.ts
vendored
8
packages/bignumber/lib.esm/fixednumber.d.ts
vendored
@@ -31,10 +31,10 @@ export declare class FixedNumber {
|
||||
toHexString(width?: number): string;
|
||||
toUnsafeFloat(): number;
|
||||
toFormat(format: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string): FixedNumber;
|
||||
static fromValue(value: BigNumber, decimals?: BigNumberish, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromString(value: string, format?: FixedFormat | string | number): FixedNumber;
|
||||
static fromBytes(value: BytesLike, format?: FixedFormat | string | number): FixedNumber;
|
||||
static from(value: any, format?: FixedFormat | string | number): FixedNumber;
|
||||
static isFixedNumber(value: any): value is FixedNumber;
|
||||
}
|
||||
//# sourceMappingURL=fixednumber.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user