diff --git a/package.json b/package.json index 40ac866e23..91849515f2 100644 --- a/package.json +++ b/package.json @@ -70,12 +70,12 @@ "@jbx-protocol/juice-721-delegate-v3-1": "npm:@jbx-protocol/juice-721-delegate@5.0.2", "@jbx-protocol/juice-721-delegate-v3-2": "npm:@jbx-protocol/juice-721-delegate@6.0.3", "@jbx-protocol/juice-721-delegate-v3-3": "npm:@jbx-protocol/juice-721-delegate@7.0.0", - "@jbx-protocol/juice-721-delegate-v3-4": "npm:@jbx-protocol/juice-721-delegate@8.0.0", + "@jbx-protocol/juice-721-delegate-v3-4": "npm:@jbx-protocol/juice-721-delegate@8.0.1", "@jbx-protocol/juice-contracts-v3": "5.0.1", "@jbx-protocol/juice-delegates-registry": "1.0.3", "@jbx-protocol/juice-v1-token-terminal": "1.0.1", "@jbx-protocol/juice-v3-migration": "1.0.0", - "@jbx-protocol/project-handles": "^2.0.4", + "@jbx-protocol/project-handles": "^2.0.5", "@lingui/cli": "^4.0.0", "@lingui/detect-locale": "^4.0.0", "@lingui/macro": "^4.0.0", diff --git a/src/hooks/JB721Delegate/contracts/useJB721DelegateContractAddress.ts b/src/hooks/JB721Delegate/contracts/useJB721DelegateContractAddress.ts index 6bbdf12541..ace91256b3 100644 --- a/src/hooks/JB721Delegate/contracts/useJB721DelegateContractAddress.ts +++ b/src/hooks/JB721Delegate/contracts/useJB721DelegateContractAddress.ts @@ -23,7 +23,7 @@ const ADDRESSES: { [NetworkName.sepolia]: { JBTiered721DelegateStore: '0xd7F9Ee12b5De2388109C9dD4fAAf39BEfe4C92FB', // the store from 3.3 JBTiered721DelegateProjectDeployer: - '0x79c66fCEC6b9843EEa0c28397609d6DA3e5E1781', + '0x70b59C0ad71b8e7c9B57328bEb7Ad5921b44dB81', }, [NetworkName.mainnet]: { JBTiered721DelegateStore: '0x615B5b50F1Fc591AAAb54e633417640d6F2773Fd', // the store from 3.3 diff --git a/src/pages/api/juicebox/jb-721-delegate/[dataSourceAddress].ts b/src/pages/api/juicebox/jb-721-delegate/[dataSourceAddress].ts index e75b8b11bb..efafbb3801 100644 --- a/src/pages/api/juicebox/jb-721-delegate/[dataSourceAddress].ts +++ b/src/pages/api/juicebox/jb-721-delegate/[dataSourceAddress].ts @@ -47,10 +47,31 @@ async function fetchDeployerOf(dataSourceAddress: string) { readProvider, ) - const [deployerAddress, deployerAddressOldRegistry] = await Promise.all([ - JBDelegatesRegistry.deployerOf(dataSourceAddress), - OldJBDelegatesRegistry.deployerOf(dataSourceAddress), - ]) + const [deployerAddressResult, deployerAddressOldRegistryResult] = + await Promise.allSettled([ + JBDelegatesRegistry.deployerOf(dataSourceAddress), + OldJBDelegatesRegistry.deployerOf(dataSourceAddress), + ]) + if ( + deployerAddressResult.status === 'rejected' && + deployerAddressOldRegistryResult.status === 'rejected' + ) { + logger.error( + { + deployerAddress: deployerAddressResult, + deployerAddressOldRegistry: deployerAddressOldRegistryResult, + }, + 'Failed to resolve deployer', + ) + return null + } + let deployerAddress, deployerAddressOldRegistry + if (deployerAddressResult.status === 'fulfilled') { + deployerAddress = deployerAddressResult.value + } + if (deployerAddressOldRegistryResult.status === 'fulfilled') { + deployerAddressOldRegistry = deployerAddressOldRegistryResult.value + } return deployerAddress || deployerAddressOldRegistry } @@ -131,12 +152,22 @@ async function fetchJB721DelegateVersion(dataSourceAddress: string) { if (isV3) return JB721DelegateVersion.JB721DELEGATE_V3 const deployerAddress = await fetchDeployerOf(dataSourceAddress) - const [isV3_1, isV3_2, isV3_3, isV3_4] = await Promise.all([ + const results = await Promise.allSettled([ isJB721DelegateV3_1(deployerAddress), isJB721DelegateV3_2(deployerAddress), isJB721DelegateV3_3(deployerAddress), isJB721DelegateV3_4(deployerAddress), ]) + const errors = results.filter(result => result.status === 'rejected') + if (errors.length === 4) { + logger.error({ error: errors }, 'Failed to resolve delegate') + return null + } else { + logger.warn({ failures: errors }, 'Failed to resolve delegate') + } + const [isV3_1, isV3_2, isV3_3, isV3_4] = results.map(result => + result.status === 'fulfilled' ? result.value : false, + ) if (isV3_1) return JB721DelegateVersion.JB721DELEGATE_V3_1 if (isV3_2) return JB721DelegateVersion.JB721DELEGATE_V3_2 if (isV3_3) return JB721DelegateVersion.JB721DELEGATE_V3_3 diff --git a/yarn.lock b/yarn.lock index c2df648902..54013a1a42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3621,10 +3621,10 @@ "@paulrberg/contracts" "^3.7.0" prb-math "^2.4.3" -"@jbx-protocol/juice-721-delegate-v3-4@npm:@jbx-protocol/juice-721-delegate@8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@jbx-protocol/juice-721-delegate/-/juice-721-delegate-8.0.0.tgz#99a636424436c7443412bf1cf9a38b3ba39f0351" - integrity sha512-6w5SiZccGp1IyfZNrRuUm2Nika2bYc4H3LoHCE7sM27wZXhoJUGOzIUggYXwMMS6XF/82VfLi1lRqtyaSpXcTQ== +"@jbx-protocol/juice-721-delegate-v3-4@npm:@jbx-protocol/juice-721-delegate@8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@jbx-protocol/juice-721-delegate/-/juice-721-delegate-8.0.1.tgz#28a1cd5c50f9ca0a498eba7b5c15ed0490928d08" + integrity sha512-ge2pnuLZALrF/OgWV9j/GfkS8qXJE5v5gLR40eltOJET8Ui7S/5O0k5v9VzAm+VfK5HnhOSaRZsjSPTXXf80LQ== dependencies: "@jbx-protocol/juice-contracts-v3" "^5.0.0" "@jbx-protocol/juice-delegate-metadata-lib" "https://github.com/jbx-protocol/juice-delegate-metadata-lib.git" @@ -3708,10 +3708,10 @@ resolved "https://registry.yarnpkg.com/@jbx-protocol/juice-v3-migration/-/juice-v3-migration-1.0.0.tgz#008663d8e09005d19a4837d98b519a1058c9060a" integrity sha512-+jmoiGcvVlbYrs510UDGWcUy7r2+pkhP+BI2ZqAjH4numZ7FWMvyRFjyaWLhzVHnKNZCSTUvvTIwU4wH5n6LSg== -"@jbx-protocol/project-handles@^2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@jbx-protocol/project-handles/-/project-handles-2.0.4.tgz#08db2fc1f6fd51419566f0a217c47f5374e839fd" - integrity sha512-NT8G0yt0cnpm1N+IqpKnej6xTC2D42/j9zv/DdLXhvyU+rCXqQ//oUg3cezZdL8AGi2l74rC5odE1j6FFrUrxA== +"@jbx-protocol/project-handles@^2.0.5": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@jbx-protocol/project-handles/-/project-handles-2.0.5.tgz#28b547e94546101275d4844990e1882962731bea" + integrity sha512-mmQAAxGu4aEwzaPZWgKx973AsmtfE/sE/Kj8cveRurDY9EHPZVfapcT+LyW2xnM1DoEFAOh+cobKiu0vpYNOcA== dependencies: "@jbx-protocol/juice-contracts-v3" "^2.0.0"