Skip to content

Commit d307974

Browse files
committed
admin: updated dist files
1 parent ecce861 commit d307974

27 files changed

+858
-149
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Changelog
44
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
55

66

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

10+
- 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))
1011
- 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))
1112
- 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))
1213
- admin: fixed alias script. ([#1494](https://github.com/ethers-io/ethers.js/issues/1494); [8f3d71d](https://github.com/ethers-io/ethers.js/commit/8f3d71dc5fd0e91407737a4b82c58c31269ed2be))

misc/admin/lib/cmds/spell-check.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Words = fs_1.default.readFileSync("/usr/share/dict/words").toString().spli
2222
}, {});
2323
`
2424
// Words missing from the dictionary
25-
accessing addresses aligned autofill called cancelled changed censored
25+
accessing addresses aligned autofill avatar called cancelled changed censored
2626
clamping compiled computed configured consumed creating decoded decoding
2727
decreased decrypt decrypted decrypting deployed deploying deprecated detected
2828
discontinued earliest email emitted enabled encoded encoder encoding encrypt
@@ -58,9 +58,9 @@ ABIEncoder testcase numberish Wordlist
5858
abi addr api app arg arrayify asm backend basex bigint bignumber bn byte
5959
bytecode callback calldata charset checksum ciphertext cli codepoint
6060
commify config
61-
contenthash ctr ctrl debug dd dklen eexist encseed eof eq ethaddr
61+
contenthash ctr ctrl debug dd dklen eexist encseed eof eq erc ethaddr
6262
ethseed ethers eval exec filename func gz gzip hid http https hw iv
63-
info init ipc json kdf kdfparams labelhash lang lib mm multihash nfc
63+
info init ipc json kdf kdfparams labelhash lang lib metadata mm multihash nfc
6464
nfkc nfd nfkd nodehash notok nowait nullish oob opcode pbkdf pc plugin
6565
pragma pre prf recid repl rpc sighash topichash solc stdin stdout subclasses
6666
subnode timeout todo txt typeof ufixed utc utf util url urlencoded uuid vm
@@ -79,6 +79,7 @@ ropsten testnet lb maticmum
7979
8080
// Demo words
8181
args foo eth foo foobar ll localhost passwd ricmoo tx xxx yna
82+
brantly
8283
8384
// nameprep tags
8485
ALCat BiDi LCat nameprep

misc/admin/src.ts/cmds/spell-check.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const Words = fs.readFileSync("/usr/share/dict/words").toString().split("\n").re
1313

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

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ethers/dist/ethers.esm.js

Lines changed: 139 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18705,27 +18705,44 @@ function bytes32ify(value) {
1870518705
function base58Encode(data) {
1870618706
return Base58.encode(concat([data, hexDataSlice(sha256$1(sha256$1(data)), 0, 4)]));
1870718707
}
18708+
const matchers = [
18709+
new RegExp("^(https):/\/(.*)$", "i"),
18710+
new RegExp("^(data):(.*)$", "i"),
18711+
new RegExp("^(ipfs):/\/(.*)$", "i"),
18712+
new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"),
18713+
];
18714+
function _parseString(result) {
18715+
try {
18716+
return toUtf8String(_parseBytes(result));
18717+
}
18718+
catch (error) { }
18719+
return null;
18720+
}
18721+
function _parseBytes(result) {
18722+
if (result === "0x") {
18723+
return null;
18724+
}
18725+
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber();
18726+
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();
18727+
return hexDataSlice(result, offset + 32, offset + 32 + length);
18728+
}
1870818729
class Resolver {
18709-
constructor(provider, address, name) {
18730+
// The resolvedAddress is only for creating a ReverseLookup resolver
18731+
constructor(provider, address, name, resolvedAddress) {
1871018732
defineReadOnly(this, "provider", provider);
1871118733
defineReadOnly(this, "name", name);
1871218734
defineReadOnly(this, "address", provider.formatter.address(address));
18735+
defineReadOnly(this, "_resolvedAddress", resolvedAddress);
1871318736
}
1871418737
_fetchBytes(selector, parameters) {
1871518738
return __awaiter$9(this, void 0, void 0, function* () {
18716-
// keccak256("addr(bytes32,uint256)")
18717-
const transaction = {
18739+
// e.g. keccak256("addr(bytes32,uint256)")
18740+
const tx = {
1871818741
to: this.address,
1871918742
data: hexConcat([selector, namehash(this.name), (parameters || "0x")])
1872018743
};
1872118744
try {
18722-
const result = yield this.provider.call(transaction);
18723-
if (result === "0x") {
18724-
return null;
18725-
}
18726-
const offset = BigNumber.from(hexDataSlice(result, 0, 32)).toNumber();
18727-
const length = BigNumber.from(hexDataSlice(result, offset, offset + 32)).toNumber();
18728-
return hexDataSlice(result, offset + 32, offset + 32 + length);
18745+
return _parseBytes(yield this.provider.call(tx));
1872918746
}
1873018747
catch (error) {
1873118748
if (error.code === Logger.errors.CALL_EXCEPTION) {
@@ -18832,6 +18849,94 @@ class Resolver {
1883218849
return address;
1883318850
});
1883418851
}
18852+
getAvatar() {
18853+
return __awaiter$9(this, void 0, void 0, function* () {
18854+
const linkage = [];
18855+
try {
18856+
const avatar = yield this.getText("avatar");
18857+
if (avatar == null) {
18858+
return null;
18859+
}
18860+
for (let i = 0; i < matchers.length; i++) {
18861+
const match = avatar.match(matchers[i]);
18862+
if (match == null) {
18863+
continue;
18864+
}
18865+
switch (match[1]) {
18866+
case "https":
18867+
linkage.push({ type: "url", content: avatar });
18868+
return { linkage, url: avatar };
18869+
case "data":
18870+
linkage.push({ type: "data", content: avatar });
18871+
return { linkage, url: avatar };
18872+
case "ipfs":
18873+
linkage.push({ type: "ipfs", content: avatar });
18874+
return { linkage, url: `https:/\/gateway.ipfs.io/ipfs/${avatar.substring(7)}` };
18875+
case "erc721":
18876+
case "erc1155": {
18877+
// Depending on the ERC type, use tokenURI(uint256) or url(uint256)
18878+
const selector = (match[1] === "erc721") ? "0xc87b56dd" : "0x0e89341c";
18879+
linkage.push({ type: match[1], content: avatar });
18880+
// The owner of this name
18881+
const owner = (this._resolvedAddress || (yield this.getAddress()));
18882+
const comps = (match[2] || "").split("/");
18883+
if (comps.length !== 2) {
18884+
return null;
18885+
}
18886+
const addr = yield this.provider.formatter.address(comps[0]);
18887+
const tokenId = hexZeroPad(BigNumber.from(comps[1]).toHexString(), 32);
18888+
// Check that this account owns the token
18889+
if (match[1] === "erc721") {
18890+
// ownerOf(uint256 tokenId)
18891+
const tokenOwner = this.provider.formatter.callAddress(yield this.provider.call({
18892+
to: addr, data: hexConcat(["0x6352211e", tokenId])
18893+
}));
18894+
if (owner !== tokenOwner) {
18895+
return null;
18896+
}
18897+
linkage.push({ type: "owner", content: tokenOwner });
18898+
}
18899+
else if (match[1] === "erc1155") {
18900+
// balanceOf(address owner, uint256 tokenId)
18901+
const balance = BigNumber.from(yield this.provider.call({
18902+
to: addr, data: hexConcat(["0x00fdd58e", hexZeroPad(owner, 32), tokenId])
18903+
}));
18904+
if (balance.isZero()) {
18905+
return null;
18906+
}
18907+
linkage.push({ type: "balance", content: balance.toString() });
18908+
}
18909+
// Call the token contract for the metadata URL
18910+
const tx = {
18911+
to: this.provider.formatter.address(comps[0]),
18912+
data: hexConcat([selector, tokenId])
18913+
};
18914+
let metadataUrl = _parseString(yield this.provider.call(tx));
18915+
if (metadataUrl == null) {
18916+
return null;
18917+
}
18918+
linkage.push({ type: "metadata-url", content: metadataUrl });
18919+
// ERC-1155 allows a generic {id} in the URL
18920+
if (match[1] === "erc1155") {
18921+
metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2));
18922+
}
18923+
// Get the token metadata
18924+
const metadata = yield fetchJson(metadataUrl);
18925+
// Pull the image URL out
18926+
if (!metadata || typeof (metadata.image) !== "string" || !metadata.image.match(/^https:\/\//i)) {
18927+
return null;
18928+
}
18929+
linkage.push({ type: "metadata", content: JSON.stringify(metadata) });
18930+
linkage.push({ type: "url", content: metadata.image });
18931+
return { linkage, url: metadata.image };
18932+
}
18933+
}
18934+
}
18935+
}
18936+
catch (error) { }
18937+
return null;
18938+
});
18939+
}
1883518940
getContentHash() {
1883618941
return __awaiter$9(this, void 0, void 0, function* () {
1883718942
// keccak256("contenthash()")
@@ -19994,6 +20099,30 @@ class BaseProvider extends Provider {
1999420099
return name;
1999520100
});
1999620101
}
20102+
getAvatar(nameOrAddress) {
20103+
return __awaiter$9(this, void 0, void 0, function* () {
20104+
let resolver = null;
20105+
if (isHexString(nameOrAddress)) {
20106+
// Address; reverse lookup
20107+
const address = this.formatter.address(nameOrAddress);
20108+
const reverseName = address.substring(2).toLowerCase() + ".addr.reverse";
20109+
const resolverAddress = yield this._getResolver(reverseName);
20110+
if (!resolverAddress) {
20111+
return null;
20112+
}
20113+
resolver = new Resolver(this, resolverAddress, "_", address);
20114+
}
20115+
else {
20116+
// ENS name; forward lookup
20117+
resolver = yield this.getResolver(nameOrAddress);
20118+
}
20119+
const avatar = yield resolver.getAvatar();
20120+
if (avatar == null) {
20121+
return null;
20122+
}
20123+
return avatar.url;
20124+
});
20125+
}
1999720126
perform(method, params) {
1999820127
return logger$t.throwError(method + " not implemented", Logger.errors.NOT_IMPLEMENTED, { operation: method });
1999920128
}

packages/ethers/dist/ethers.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ethers/dist/ethers.esm.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/ethers/dist/ethers.esm.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)