@ensdomains/ethers-patch-v6 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -66,7 +66,12 @@ import_ethers.AbstractProvider.prototype.resolveName = async function(name, coin
66
66
  coinType = (0, import_ethers.getBigInt)(coinType, "coinType");
67
67
  const fwd = await this.getResolver(name);
68
68
  if (!fwd) return null;
69
- return fetchAddress(fwd, coinType).catch(() => null);
69
+ try {
70
+ const a = await fetchAddress(fwd, coinType);
71
+ if (!/^0x0+$/.test(a)) return a;
72
+ } catch {
73
+ }
74
+ return null;
70
75
  };
71
76
  import_ethers.AbstractProvider.prototype.lookupAddress = async function(address, coinType = COIN_TYPE_ETH) {
72
77
  if (coinType === "old") return lookupAddress.call(this, address);
@@ -117,14 +122,13 @@ import_ethers.AbstractProvider.prototype.lookupAddress = async function(address,
117
122
  async function fetchAddress(resolver, coinType) {
118
123
  if (coinType === COIN_TYPE_ETH) {
119
124
  return callResolver(resolver, "addr(bytes32)");
120
- } else {
121
- const a = await callResolver(
122
- resolver,
123
- "addr(bytes32,uint256)",
124
- coinType
125
- );
126
- return isEVMCoinType(coinType) ? a === "0x" ? a.padEnd(42) : (0, import_ethers.getAddress)(a) : a;
127
125
  }
126
+ const a = await callResolver(
127
+ resolver,
128
+ "addr(bytes32,uint256)",
129
+ coinType
130
+ );
131
+ return isEVMCoinType(coinType) ? a === "0x" ? a.padEnd(42) : (0, import_ethers.getAddress)(a) : a;
128
132
  }
129
133
  async function callResolver(resolver, fragment, ...args) {
130
134
  const f = ABI.getFunction(fragment);
package/dist/index.js CHANGED
@@ -62,7 +62,12 @@ AbstractProvider.prototype.resolveName = async function(name, coinType = COIN_TY
62
62
  coinType = getBigInt(coinType, "coinType");
63
63
  const fwd = await this.getResolver(name);
64
64
  if (!fwd) return null;
65
- return fetchAddress(fwd, coinType).catch(() => null);
65
+ try {
66
+ const a = await fetchAddress(fwd, coinType);
67
+ if (!/^0x0+$/.test(a)) return a;
68
+ } catch {
69
+ }
70
+ return null;
66
71
  };
67
72
  AbstractProvider.prototype.lookupAddress = async function(address, coinType = COIN_TYPE_ETH) {
68
73
  if (coinType === "old") return lookupAddress.call(this, address);
@@ -113,14 +118,13 @@ AbstractProvider.prototype.lookupAddress = async function(address, coinType = CO
113
118
  async function fetchAddress(resolver, coinType) {
114
119
  if (coinType === COIN_TYPE_ETH) {
115
120
  return callResolver(resolver, "addr(bytes32)");
116
- } else {
117
- const a = await callResolver(
118
- resolver,
119
- "addr(bytes32,uint256)",
120
- coinType
121
- );
122
- return isEVMCoinType(coinType) ? a === "0x" ? a.padEnd(42) : getAddress(a) : a;
123
121
  }
122
+ const a = await callResolver(
123
+ resolver,
124
+ "addr(bytes32,uint256)",
125
+ coinType
126
+ );
127
+ return isEVMCoinType(coinType) ? a === "0x" ? a.padEnd(42) : getAddress(a) : a;
124
128
  }
125
129
  async function callResolver(resolver, fragment, ...args) {
126
130
  const f = ABI.getFunction(fragment);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensdomains/ethers-patch-v6",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -15,10 +15,8 @@
15
15
  }
16
16
  },
17
17
  "peerDependencies": {
18
- "typescript": "^5"
19
- },
20
- "dependencies": {
21
- "ethers": "^6.0.0"
18
+ "typescript": "^5",
19
+ "ethers": "6"
22
20
  },
23
21
  "publishConfig": {
24
22
  "access": "public"