ens-proxy/README.md

102 lines
1.7 KiB
Markdown
Raw Normal View History

2022-08-18 16:25:00 +02:00
# Proxy API for ENS requests
2022-08-18 15:51:38 +02:00
## Running Locally
```
npm install
npm i -g vercel
vercel dev
```
## Example Requests
### Get Ens Name
```
2022-08-22 13:19:02 +02:00
GET http://localhost:3000/api/name?accountId=0x99840Df5Cb42faBE0Feb8811Aaa4BC99cA6C84e0
2022-08-18 15:51:38 +02:00
```
Example response:
```
{
2022-08-22 13:19:02 +02:00
"name": "jellymcjellyfish.eth"
2022-08-18 15:51:38 +02:00
}
```
### Get Ens Address
```
2022-08-22 13:19:02 +02:00
GET http://localhost:3000/api/address?name=jellymcjellyfish.eth
2022-08-18 15:51:38 +02:00
```
Example response:
```
2022-08-24 15:52:33 +02:00
{
"address": "0x99840Df5Cb42faBE0Feb8811Aaa4BC99cA6C84e0"
}
2022-08-18 15:51:38 +02:00
```
### Get Ens Text Records
```
GET http://localhost:3000/api/text?name=jellymcjellyfish.eth
```
Example response:
2022-08-18 16:23:04 +02:00
```
{
2022-08-24 15:52:33 +02:00
"records": [
2022-08-18 16:23:04 +02:00
{
"key": "url",
"value": "https://oceanprotocol.com"
},
{
2022-08-24 15:52:33 +02:00
"key": "avatar",
"value": "https://raw.githubusercontent.com/oceanprotocol/art/main/logo/favicon-white.png"
2022-08-18 16:23:04 +02:00
},
{
"key": "com.twitter",
"value": "oceanprotocol"
2022-08-24 15:52:33 +02:00
},
{
"key": "com.github",
"value": "oceanprotocol"
2022-08-18 16:23:04 +02:00
}
]
}
```
2022-08-24 15:52:33 +02:00
### Get ENS Profile
```
GET http://localhost:3000/api/profile?address=0x99840Df5Cb42faBE0Feb8811Aaa4BC99cA6C84e0
```
Example response:
```
{
"profile": {
"name": "jellymcjellyfish.eth",
"avatar": "https://metadata.ens.domains/mainnet/avatar/jellymcjellyfish.eth",
"links": [
{
"key": "url",
"value": "https://oceanprotocol.com"
},
{
"key": "com.twitter",
"value": "oceanprotocol"
},
{
"key": "com.github",
"value": "oceanprotocol"
}
]
}
}
```