{"id":15428725,"url":"https://github.com/gskril/ens-api","last_synced_at":"2025-04-19T15:09:40.524Z","repository":{"id":39002817,"uuid":"492415085","full_name":"gskril/ens-api","owner":"gskril","description":"Cloudflare Worker that provides a simple API for fetching ENS profiles and avatars","archived":false,"fork":false,"pushed_at":"2024-12-03T21:46:46.000Z","size":114,"stargazers_count":20,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-29T09:11:38.328Z","etag":null,"topics":["ens"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gskril.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-15T07:15:56.000Z","updated_at":"2025-01-17T17:24:02.000Z","dependencies_parsed_at":"2024-02-22T18:26:24.466Z","dependency_job_id":"8bc125a3-c247-4efc-80ac-ea43294eec10","html_url":"https://github.com/gskril/ens-api","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.375,"last_synced_commit":"e8dc422f599f7c28909d1213d8f68acf3e1f3300"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskril%2Fens-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskril%2Fens-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskril%2Fens-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gskril%2Fens-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gskril","download_url":"https://codeload.github.com/gskril/ens-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249722631,"owners_count":21315857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ens"],"created_at":"2024-10-01T18:06:16.167Z","updated_at":"2025-04-19T15:09:40.505Z","avatar_url":"https://github.com/gskril.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ENS API\n\n\u003e [!NOTE]  \n\u003e This is meant to be self-hosted. Follow the instructions below to deploy it to your own Cloudflare account.\n\nCloudflare Worker that provides a simple API for fetching ENS profiles and avatars. Built with [ENSjs](https://www.npmjs.com/package/@ensdomains/ensjs), heavily inspired by [v3xlabs/enstate](https://github.com/v3xlabs/enstate).\n\nBy default, all endpoints are cached for 10 minutes, then serve a stale response within the following 50 minutes while refreshing the cache in the background. Adjust these settings [here](src/lib/utils.ts#L65-L82). Avatars are cached for longer in most cases.\n\n## Endpoints:\n\n- GET `/name/:name` - Fetch a profile for an ENS name\n  - Params (all optional):\n    - `texts` - keys of text records to fetch (comma-separated)\n    - `coins` - coin types to fetch (comma-separated)\n- GET `/address/:address` - Fetch a profile for an Ethereum address, if it has a primary ENS name\n  - Params (all optional):\n    - `texts` - keys of text records to fetch (comma-separated)\n    - `coins` - coin types to fetch (comma-separated)\n- GET `/avatar/:name` - Fetch an avatar for an ENS name\n  - Params (all optional):\n    - `width` - width of the avatar (default: 256)\n    - `height` - height of the avatar (default: 256)\n    - `fallback` - image URL to use if the ENS name has no avatar\n- POST `/batch/names` - Resolve a list of addresses from ENS names\n  - Body:\n    - `names` - array of ENS names\n    - `coinType` (optional) - coin type to resolve (default: 60)\n- POST `/batch/addresses` - Resolve a list of primary ENS names from ETH addresses\n  - Body:\n    - `addresses` - array of ETH addresses\n\n## How to run locally:\n\nClone this repo\n\n```bash\ngit clone https://github.com/gskril/ens-api.git\n```\n\nInstall dependencies\n\n```bash\nyarn install\n```\n\nSet your environment variables (ETH RPC URL)\n\n```bash\ncp .dev.vars.example .dev.vars\n```\n\nRun the development server\n\n```bash\nyarn run dev\n```\n\n## Deploy to Cloudflare\n\n[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/gskril/ens-api)\n\nSign into the Cloudflare CLI\n\n```bash\nnpx wrangler login\n```\n\nDeploy the Worker\n\n```bash\nyarn \u0026\u0026 yarn run deploy\n```\n\nSet your ETH RPC environment variable\n\n```bash\necho \u003cVALUE\u003e | npx wrangler secret put ETH_RPC\n```\n\nIn order to enable avatar transformations, you will need to configure Cloudflare in a few ways:\n\n- Under \"Images\" \u003e \"Transformations\", navigate to the zone you want to use and enable transformations.\n- Deploy this Worker to your Cloudflare account by following the instructions above.\n- Make your Worker accessible from the zone (domain) you enabled in step 1.\n  - In the domain's DNS page, create an `A` record that points to `192.0.2.0` with any name you want as a subdomain.\n  - Under \"Worker Routes\", add a route that matches the subdomain you created and points to the Worker you deployed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskril%2Fens-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgskril%2Fens-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgskril%2Fens-api/lists"}