Skip to content

Commit

Permalink
filter names that have no address set
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonmanRolls committed Jan 16, 2024
1 parent 4605273 commit fdada83
Show file tree
Hide file tree
Showing 5 changed files with 4,653 additions and 5,011 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"@ensdomains/thorin": "0.2.0",
"@ensdomains/web3modal": "1.10.1",
"@ethersproject/bytes": "latest",
"@myetherwallet/mewconnect-web-client": "2.2.0-beta.14",
"@portis/web3": "4.0.5",
"@sentry/react": "6.14.1",
"@sentry/tracing": "6.14.1",
Expand Down
21 changes: 14 additions & 7 deletions src/utils/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import {
getReverseRecordsAddress,
} from "./consts";
import { getCanDelegateBySig } from "./utils";
import { BigNumber } from "ethers/lib";

const ETH_ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";

export function useQueryString() {
return new URLSearchParams(useLocation().search);
Expand Down Expand Up @@ -83,19 +86,23 @@ const processENSDelegateContractResults = (
);
});
return {
avatar: data.avatar,
profile: data.profile,
address: data.addr,
votes: data.votes,
avatar: data?.avatar,
profile: data?.profile,
address: data?.addr,
votes: data?.votes || BigNumber.from(0),
name: reverseRecordOnlyResult?.domain?.name,
};
});

const filterDelegateData = (results) => {
return results
.filter((data) => data.addr?.id)
.filter((data) => data.texts?.includes("avatar"))
.filter((data) => data.address === data.domain.resolver.address);
.filter((data) => {
return data.addr?.id || data.addr?.id === ETH_ZERO_ADDRESS;
})
.filter((data) => {
return data?.texts?.includes("avatar");
})
.filter((data) => data?.address === data?.domain?.resolver?.address);
};

const bigNumberToDecimal = (bigNumber) =>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const formatTokenAmount = (tokenAmount, length = 6) =>
export function imageUrl(url, name, networkId) {
const _network = networkIdToName(networkId);
const _protocol = supportedAvatarProtocols.find((proto) =>
url.startsWith(proto)
url?.startsWith(proto)
);
// check if given uri is supported
// provided network name is valid,
Expand Down
27 changes: 13 additions & 14 deletions src/web3modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { getClaimData } from "./utils/utils";
import { initLocalStorage } from "./pages/ENSConstitution/constitutionHelpers";

export const rpcUrl = 'https://web3.ens.domains/v1/mainnet'
export const rpcUrl = "https://web3.ens.domains/v1/mainnet";

const PORTIS_ID = "57e5d6ca-e408-4925-99c4-e7da3bdb8bf5";

Expand All @@ -31,8 +31,8 @@ const option = {
packageFactory: true,
options: {
rpc: {
1: rpcUrl
}
1: rpcUrl,
},
},
},
walletlink: {
Expand All @@ -43,14 +43,15 @@ const option = {
jsonRpcUrl: rpcUrl,
},
},
mewconnect: {
package: () => import("@myetherwallet/mewconnect-web-client"),
packageFactory: true,
options: {
rpc: rpcUrl,
description: " ",
},
},
/* Remove until wrtc can be built on M1 mac, see: https://github.com/MyEtherWallet/MEWconnect-web-client/issues/75 */
// mewconnect: {
// package: () => import("@myetherwallet/mewconnect-web-client"),
// packageFactory: true,
// options: {
// rpc: rpcUrl,
// description: " ",
// },
// },
portis: {
package: () => import("@portis/web3"),
packageFactory: true,
Expand Down Expand Up @@ -114,9 +115,7 @@ export const initWeb3Read = async () => {
await initWeb3(false);
}
if (!ethersProvider) {
ethersProvider = new ethers.providers.JsonRpcProvider(
rpcUrl
);
ethersProvider = new ethers.providers.JsonRpcProvider(rpcUrl);
isConnected(true);
const net = await ethersProvider.getNetwork();
network(net.chainId);
Expand Down
Loading

0 comments on commit fdada83

Please sign in to comment.