Skip to content

Commit

Permalink
admin: updated dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Oct 19, 2021
1 parent ecce861 commit d307974
Show file tree
Hide file tree
Showing 27 changed files with 858 additions and 149 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Changelog
This change log is managed by `admin/cmds/update-versions` but may be manually updated.


ethers/v5.5.0 (2021-10-17 23:02)
ethers/v5.5.0 (2021-10-19 00:01)
--------------------------------

- Added ENS avatar support to provider. ([#2185](https://github.com/ethers-io/ethers.js/issues/2185); [ecce861](https://github.com/ethers-io/ethers.js/commit/ecce86125d87ef5258406bde2fff5bc8c9ff3141))
- Fixed splitSignature logic for verifying EIP-2930 and EIP-1559 v. ([#2084](https://github.com/ethers-io/ethers.js/issues/2084); [3de1b81](https://github.com/ethers-io/ethers.js/commit/3de1b815014b10d223a42e524fe9c25f9087293b))
- Include events on ContractFactory deployment transactions. ([#1334](https://github.com/ethers-io/ethers.js/issues/1334); [ab319f2](https://github.com/ethers-io/ethers.js/commit/ab319f2f4c365d4cd1b1e17e577ecd18a7a89276))
- admin: fixed alias script. ([#1494](https://github.com/ethers-io/ethers.js/issues/1494); [8f3d71d](https://github.com/ethers-io/ethers.js/commit/8f3d71dc5fd0e91407737a4b82c58c31269ed2be))
Expand Down
7 changes: 4 additions & 3 deletions misc/admin/lib/cmds/spell-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Words = fs_1.default.readFileSync("/usr/share/dict/words").toString().spli
}, {});
`
// Words missing from the dictionary
accessing addresses aligned autofill called cancelled changed censored
accessing addresses aligned autofill avatar called cancelled changed censored
clamping compiled computed configured consumed creating decoded decoding
decreased decrypt decrypted decrypting deployed deploying deprecated detected
discontinued earliest email emitted enabled encoded encoder encoding encrypt
Expand Down Expand Up @@ -58,9 +58,9 @@ ABIEncoder testcase numberish Wordlist
abi addr api app arg arrayify asm backend basex bigint bignumber bn byte
bytecode callback calldata charset checksum ciphertext cli codepoint
commify config
contenthash ctr ctrl debug dd dklen eexist encseed eof eq ethaddr
contenthash ctr ctrl debug dd dklen eexist encseed eof eq erc ethaddr
ethseed ethers eval exec filename func gz gzip hid http https hw iv
info init ipc json kdf kdfparams labelhash lang lib mm multihash nfc
info init ipc json kdf kdfparams labelhash lang lib metadata mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish oob opcode pbkdf pc plugin
pragma pre prf recid repl rpc sighash topichash solc stdin stdout subclasses
subnode timeout todo txt typeof ufixed utc utf util url urlencoded uuid vm
Expand All @@ -79,6 +79,7 @@ ropsten testnet lb maticmum
// Demo words
args foo eth foo foobar ll localhost passwd ricmoo tx xxx yna
brantly
// nameprep tags
ALCat BiDi LCat nameprep
Expand Down
7 changes: 4 additions & 3 deletions misc/admin/src.ts/cmds/spell-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Words = fs.readFileSync("/usr/share/dict/words").toString().split("\n").re

`
// Words missing from the dictionary
accessing addresses aligned autofill called cancelled changed censored
accessing addresses aligned autofill avatar called cancelled changed censored
clamping compiled computed configured consumed creating decoded decoding
decreased decrypt decrypted decrypting deployed deploying deprecated detected
discontinued earliest email emitted enabled encoded encoder encoding encrypt
Expand Down Expand Up @@ -49,9 +49,9 @@ ABIEncoder testcase numberish Wordlist
abi addr api app arg arrayify asm backend basex bigint bignumber bn byte
bytecode callback calldata charset checksum ciphertext cli codepoint
commify config
contenthash ctr ctrl debug dd dklen eexist encseed eof eq ethaddr
contenthash ctr ctrl debug dd dklen eexist encseed eof eq erc ethaddr
ethseed ethers eval exec filename func gz gzip hid http https hw iv
info init ipc json kdf kdfparams labelhash lang lib mm multihash nfc
info init ipc json kdf kdfparams labelhash lang lib metadata mm multihash nfc
nfkc nfd nfkd nodehash notok nowait nullish oob opcode pbkdf pc plugin
pragma pre prf recid repl rpc sighash topichash solc stdin stdout subclasses
subnode timeout todo txt typeof ufixed utc utf util url urlencoded uuid vm
Expand All @@ -70,6 +70,7 @@ ropsten testnet lb maticmum
// Demo words
args foo eth foo foobar ll localhost passwd ricmoo tx xxx yna
brantly
// nameprep tags
ALCat BiDi LCat nameprep
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 139 additions & 10 deletions packages/ethers/dist/ethers.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -18705,27 +18705,44 @@ function bytes32ify(value) {
function base58Encode(data) {
return Base58.encode(concat([data, hexDataSlice(sha256$1(sha256$1(data)), 0, 4)]));
}
const matchers = [
new RegExp("^(https):/\/(.*)$", "i"),
new RegExp("^(data):(.*)$", "i"),
new RegExp("^(ipfs):/\/(.*)$", "i"),
new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"),
];
function _parseString(result) {
try {
return toUtf8String(_parseBytes(result));
}
catch (error) { }
return null;
}
function _parseBytes(result) {
if (result === "0x") {
return null;
}
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber();
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();
return hexDataSlice(result, offset + 32, offset + 32 + length);
}
class Resolver {
constructor(provider, address, name) {
// The resolvedAddress is only for creating a ReverseLookup resolver
constructor(provider, address, name, resolvedAddress) {
defineReadOnly(this, "provider", provider);
defineReadOnly(this, "name", name);
defineReadOnly(this, "address", provider.formatter.address(address));
defineReadOnly(this, "_resolvedAddress", resolvedAddress);
}
_fetchBytes(selector, parameters) {
return __awaiter$9(this, void 0, void 0, function* () {
// keccak256("addr(bytes32,uint256)")
const transaction = {
// e.g. keccak256("addr(bytes32,uint256)")
const tx = {
to: this.address,
data: hexConcat([selector, namehash(this.name), (parameters || "0x")])
};
try {
const result = yield this.provider.call(transaction);
if (result === "0x") {
return null;
}
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber();
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();
return hexDataSlice(result, offset + 32, offset + 32 + length);
return _parseBytes(yield this.provider.call(tx));
}
catch (error) {
if (error.code === Logger.errors.CALL_EXCEPTION) {
Expand Down Expand Up @@ -18832,6 +18849,94 @@ class Resolver {
return address;
});
}
getAvatar() {
return __awaiter$9(this, void 0, void 0, function* () {
const linkage = [];
try {
const avatar = yield this.getText("avatar");
if (avatar == null) {
return null;
}
for (let i = 0; i < matchers.length; i++) {
const match = avatar.match(matchers[i]);
if (match == null) {
continue;
}
switch (match[1]) {
case "https":
linkage.push({ type: "url", content: avatar });
return { linkage, url: avatar };
case "data":
linkage.push({ type: "data", content: avatar });
return { linkage, url: avatar };
case "ipfs":
linkage.push({ type: "ipfs", content: avatar });
return { linkage, url: `https:/\/gateway.ipfs.io/ipfs/${avatar.substring(7)}` };
case "erc721":
case "erc1155": {
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
const selector = (match[1] === "erc721") ? "0xc87b56dd" : "0x0e89341c";
linkage.push({ type: match[1], content: avatar });
// The owner of this name
const owner = (this._resolvedAddress || (yield this.getAddress()));
const comps = (match[2] || "").split("/");
if (comps.length !== 2) {
return null;
}
const addr = yield this.provider.formatter.address(comps[0]);
const tokenId = hexZeroPad(BigNumber.from(comps[1]).toHexString(), 32);
// Check that this account owns the token
if (match[1] === "erc721") {
// ownerOf(uint256 tokenId)
const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({
to: addr, data: hexConcat(["0x6352211e", tokenId])
}));
if (owner !== tokenOwner) {
return null;
}
linkage.push({ type: "owner", content: tokenOwner });
}
else if (match[1] === "erc1155") {
// balanceOf(address owner, uint256 tokenId)
const balance = BigNumber.from(yield this.provider.call({
to: addr, data: hexConcat(["0x00fdd58e", hexZeroPad(owner, 32), tokenId])
}));
if (balance.isZero()) {
return null;
}
linkage.push({ type: "balance", content: balance.toString() });
}
// Call the token contract for the metadata URL
const tx = {
to: this.provider.formatter.address(comps[0]),
data: hexConcat([selector, tokenId])
};
let metadataUrl = _parseString(yield this.provider.call(tx));
if (metadataUrl == null) {
return null;
}
linkage.push({ type: "metadata-url", content: metadataUrl });
// ERC-1155 allows a generic {id} in the URL
if (match[1] === "erc1155") {
metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2));
}
// Get the token metadata
const metadata = yield fetchJson(metadataUrl);
// Pull the image URL out
if (!metadata || typeof (metadata.image) !== "string" || !metadata.image.match(/^https:\/\//i)) {
return null;
}
linkage.push({ type: "metadata", content: JSON.stringify(metadata) });
linkage.push({ type: "url", content: metadata.image });
return { linkage, url: metadata.image };
}
}
}
}
catch (error) { }
return null;
});
}
getContentHash() {
return __awaiter$9(this, void 0, void 0, function* () {
// keccak256("contenthash()")
Expand Down Expand Up @@ -19994,6 +20099,30 @@ class BaseProvider extends Provider {
return name;
});
}
getAvatar(nameOrAddress) {
return __awaiter$9(this, void 0, void 0, function* () {
let resolver = null;
if (isHexString(nameOrAddress)) {
// Address; reverse lookup
const address = this.formatter.address(nameOrAddress);
const reverseName = address.substring(2).toLowerCase() + ".addr.reverse";
const resolverAddress = yield this._getResolver(reverseName);
if (!resolverAddress) {
return null;
}
resolver = new Resolver(this, resolverAddress, "_", address);
}
else {
// ENS name; forward lookup
resolver = yield this.getResolver(nameOrAddress);
}
const avatar = yield resolver.getAvatar();
if (avatar == null) {
return null;
}
return avatar.url;
});
}
perform(method, params) {
return logger$t.throwError(method + " not implemented", Logger.errors.NOT_IMPLEMENTED, { operation: method });
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ethers/dist/ethers.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ethers/dist/ethers.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ethers/dist/ethers.esm.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit d307974

Please sign in to comment.