ensdomains / ens-app

Legacy ENS manager app
https://legacy.ens.domains/
BSD 2-Clause "Simplified" License
224 stars 266 forks source link

Offchain example #1468

Closed makoto closed 2 years ago

makoto commented 2 years ago

Demo

https://offchainexample2.surge.sh/name/offchainexample.eth/details

Please connect to Ropsten and you should see address, email, and description fetched from https://offchain-resolver-example.uc.r.appspot.com/ . You can also see the same results from its subdomains such as https://offchainexample2.surge.sh/name/1.offchainexample.eth/details

Features

Dependencies

NOTE

Currently ui and mock points to non official repo for testing purpose

How to test locally

  1. Setup local node
git clone https://github.com/ensdomains/offchain-resolver.git
cd offchain-resolver
git checkout multicoin
cd packages/contracts
yarn
npx hardhat node

Take notes of ENS registry contract address and the private key of the first account

  1. Start gateway server In differnt terminal
cd offchain-resolver
cd packages/gateway
yarn
yarn && yarn build
yarn start --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --data src/offchainexample.eth.json --port 8080 --ttl 100000000

NOTE: Made ttl super long to prevent timeout because our local app time trip to the future when creating the seed data

  1. Set up ENS app

3.1 clone the repo

git clone https://github.com/ensdomains/ens-app.git
cd ens-app
git checkout offchain2
yarn 

3.2 Create seed data

yarn preTest

3.3 start the server

yarn start:test

Access http://localhost:3000/name/1.offchainexample.eth/details and http://localhost:3000/name/offchainexample.eth/details and see it shows records

Screenshot 2022-04-11 at 16 06 57
netlify[bot] commented 2 years ago

Deploy Preview for epic-meitner-ba2575 ready!

Name Link
Latest commit bf4dcf963e3eaeeb48805d7db51713fc77e1a874
Latest deploy log https://app.netlify.com/sites/epic-meitner-ba2575/deploys/62713f75f332fd000849d292
Deploy Preview https://deploy-preview-1468--epic-meitner-ba2575.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

TateB commented 2 years ago

why are empty records not showing "not set" and instead just blank?

Arachnid commented 2 years ago

We need to think a bit about the best way to decide when to rely on the subgraph; I don't think checking for the resolve method is the best option. Alternate suggestions:

makoto commented 2 years ago

Use the default list if the subgraph doesn't contain any entries for the name.

Is this always a good approach? I remember that in the ERC20 example token balance can both be on l2 or l1. You could write a resolver where a user can store data on both l1 and l2/offchain. One workaround will be that I always call these default list regardless of subgraph returns the result or not

makoto commented 2 years ago

@Arachnid I made the following two changes.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ā†—ļøŽ

Name Status Preview Updated
ens-app āœ… Ready (Inspect) Visit Preview May 17, 2022 at 9:43PM (UTC)
makoto commented 2 years ago

NOTE: I had to disable one failing test related to name wrapper. Tracking it separately at https://github.com/ensdomains/ens-app/issues/1500