mirror of
https://github.com/oceanprotocol/ens-proxy.git
synced 2024-12-02 05:57:34 +01:00
Updted readme & error handling
This commit is contained in:
parent
9a36f47c9b
commit
926384840e
29
README.md
29
README.md
@ -64,3 +64,32 @@ Example response:
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Get ENS Profile
|
||||||
|
|
||||||
|
```
|
||||||
|
GET http://localhost:3000/api/profile?address=0x99840Df5Cb42faBE0Feb8811Aaa4BC99cA6C84e0
|
||||||
|
```
|
||||||
|
|
||||||
|
Example response:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"name": "jellymcjellyfish.eth",
|
||||||
|
"avatar": "https://metadata.ens.domains/mainnet/avatar/jellymcjellyfish.eth",
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"key": "url",
|
||||||
|
"value": "https://oceanprotocol.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "com.github",
|
||||||
|
"value": "oceanprotocol"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "com.twitter",
|
||||||
|
"value": "oceanprotocol"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@ -7,10 +7,9 @@ export default async function getEnsAddress(
|
|||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const ensName = request.query.name
|
const ensName = request.query.name
|
||||||
console.log('ensName', ensName)
|
|
||||||
const ens = await getEns()
|
const ens = await getEns()
|
||||||
const address = await ens.name(ensName).getAddress()
|
const address = await ens.name(ensName).getAddress()
|
||||||
console.log('address', address)
|
if (!address) throw `No address found for "${ensName}"`
|
||||||
|
|
||||||
response.setHeader('Cache-Control', 's-maxage=86400')
|
response.setHeader('Cache-Control', 's-maxage=86400')
|
||||||
response.status(200).send(address)
|
response.status(200).send(address)
|
||||||
|
@ -63,7 +63,6 @@ export default async function EnsProfileApi(
|
|||||||
try {
|
try {
|
||||||
const accountId = String(request.query.address)
|
const accountId = String(request.query.address)
|
||||||
const profile = await getEnsProfile(accountId)
|
const profile = await getEnsProfile(accountId)
|
||||||
console.log('profile', profile)
|
|
||||||
|
|
||||||
response.setHeader('Cache-Control', 's-maxage=86400')
|
response.setHeader('Cache-Control', 's-maxage=86400')
|
||||||
response.status(200).send(profile)
|
response.status(200).send(profile)
|
||||||
|
Loading…
Reference in New Issue
Block a user