Skip to content

Commit

Permalink
ENS: add offchain support and fix bugs (#2156)
Browse files Browse the repository at this point in the history
* ens: add offchain support and fix bugs

Fixes #2136

* fix ts
  • Loading branch information
tom2drum committed Aug 21, 2024
1 parent cec56f1 commit 283e292
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 212 deletions.
14 changes: 14 additions & 0 deletions mocks/ens/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export const ensDomainA: bens.DetailedDomain = {
NEAR: 'a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near',
},
protocol: protocolA,
resolver_address: {
hash: '0xD578780f1dA7404d9CC0eEbC9D684c140CC4b638',
},
resolved_with_wildcard: true,
stored_offchain: true,
wrapped_owner: {
hash: '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401',
},
};

export const ensDomainB: bens.DetailedDomain = {
Expand All @@ -81,6 +89,8 @@ export const ensDomainB: bens.DetailedDomain = {
expiry_date: undefined,
other_addresses: {},
protocol: undefined,
resolved_with_wildcard: false,
stored_offchain: false,
};

export const ensDomainC: bens.DetailedDomain = {
Expand All @@ -101,6 +111,8 @@ export const ensDomainC: bens.DetailedDomain = {
expiry_date: '2022-11-01T13:10:36.000Z',
other_addresses: {},
protocol: undefined,
resolved_with_wildcard: false,
stored_offchain: false,
};

export const ensDomainD: bens.DetailedDomain = {
Expand All @@ -119,4 +131,6 @@ export const ensDomainD: bens.DetailedDomain = {
expiry_date: '2027-09-23T13:10:36.000Z',
other_addresses: {},
protocol: undefined,
resolved_with_wildcard: false,
stored_offchain: false,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"monitoring:grafana:local": "docker run -d -p 4000:3000 --name=blockscout_grafana --user $(id -u) --volume $(pwd)/grafana:/var/lib/grafana grafana/grafana-enterprise"
},
"dependencies": {
"@blockscout/bens-types": "1.3.4",
"@blockscout/bens-types": "1.4.1",
"@blockscout/stats-types": "1.6.0",
"@blockscout/visualizer-types": "0.2.0",
"@chakra-ui/react": "2.7.1",
Expand Down
2 changes: 2 additions & 0 deletions stubs/ENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const ENS_DOMAIN: bens.DetailedDomain = {
ETH: ADDRESS_HASH,
},
protocol: undefined,
resolved_with_wildcard: false,
stored_offchain: false,
};

export const ENS_DOMAIN_EVENT: bens.DomainEvent = {
Expand Down
6 changes: 3 additions & 3 deletions ui/address/ensDomains/AddressEnsDomains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import PopoverTriggerTooltip from 'ui/shared/PopoverTriggerTooltip';
interface Props {
query: UseQueryResult<bens.LookupAddressResponse, ResourceError<unknown>>;
addressHash: string;
mainDomainName: string | null;
mainDomainName: string | null | undefined;
}

const DomainsGrid = ({ data }: { data: Array<bens.Domain> }) => {
Expand Down Expand Up @@ -64,9 +64,9 @@ const AddressEnsDomains = ({ query, addressHash, mainDomainName }: Props) => {
return null;
}

const mainDomain = data.items.find((domain) => domain.name === mainDomainName);
const mainDomain = data.items.find((domain) => mainDomainName && domain.name === mainDomainName);
const ownedDomains = data.items.filter((domain) => {
if (domain.name === mainDomainName) {
if (mainDomainName && domain.name === mainDomainName) {
return false;
}

Expand Down
Loading

0 comments on commit 283e292

Please sign in to comment.