Skip to content

Commit

Permalink
Merge pull request #116 from poap-xyz/release/v1.6.12
Browse files Browse the repository at this point in the history
Release v1.6.12
  • Loading branch information
jm42 authored Oct 26, 2023
2 parents 2c1042f + 2f6f276 commit 41aab3c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.6.11",
"version": "1.6.12",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
Expand Down
20 changes: 17 additions & 3 deletions src/loaders/ethereum.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,23 @@ async function resolveEnsNames(
) {
const resolvedAddresses = {}
let errorsTotal = 0
let errors = 0
for (let i = 0; i < addresses.length; i += limit) {
const chunk = addresses.slice(i, i + limit)
const resolved = {}
let chunk = addresses.slice(i, i + limit)
try {
const names = await ensReverseRecordsContract.getNames(chunk)
const resolved = {}
let names = await ensReverseRecordsContract.getNames(chunk)
if (errors > 0) {
const errorsChunk = addresses.slice(i - errors, i - 1)
try {
const errorsNames = await ensReverseRecordsContract.getNames(errorsChunk)
chunk = [...errorsChunk, ...chunk]
names = [...errorsNames, ...names]
} catch (err) {
console.error('resolveEnsNames', err)
}
}
errors = 0
for (let i = 0; i < names.length; i++) {
if (names[i] !== '') {
resolvedAddresses[chunk[i]] = names[i]
Expand All @@ -51,7 +63,9 @@ async function resolveEnsNames(
}
} catch (err) {
errorsTotal += 1
errors += 1
if (errorsTotal > maxErrors) {
console.error('resolveEnsNames', err)
throw new Error(
'Cannot continue retrieving ENS names as the maximum number of error was reached'
)
Expand Down

0 comments on commit 41aab3c

Please sign in to comment.