@@ -13,6 +13,10 @@ import {
13
13
} from "thirdweb/utils" ;
14
14
import { fetchDeployMetadata } from "./fetchDeployMetadata" ;
15
15
16
+ type ZkSolcMetadata = {
17
+ source_metadata : { settings : { compilationTarget : Record < string , string > } } ;
18
+ } ;
19
+
16
20
export async function fetchPublishedContractsFromDeploy ( options : {
17
21
contract : ThirdwebContract ;
18
22
client : ThirdwebClient ;
@@ -32,26 +36,24 @@ export async function fetchPublishedContractsFromDeploy(options: {
32
36
// Try fetching using contract name from compiler metadata for zksolc variants
33
37
// TODO: ContractPublisher should handle multiple metadata uri for a published version
34
38
if ( publishURIs . length === 0 && ( await isZkSyncChain ( contract . chain ) ) ) {
35
- const deployMetadata = await download ( {
36
- uri : contractUri ,
37
- client,
38
- } )
39
- // biome-ignore lint/suspicious/noExplicitAny:
40
- . then ( ( res ) => res . json ( ) as any )
41
- . catch ( ) ;
42
- const contractId = Object . values (
43
- deployMetadata ?. source_metadata . settings ?. compilationTarget ,
44
- ) ;
45
-
46
- await fetchPublishedContract ( {
47
- client,
48
- contractId : contractId [ 0 ] as string ,
49
- publisherAddress : THIRDWEB_DEPLOYER_ADDRESS ,
50
- } )
51
- . then ( ( published ) => {
52
- publishURIs = [ published . publishMetadataUri ] ;
53
- } )
54
- . catch ( ) ;
39
+ try {
40
+ const deployMetadata = await download ( {
41
+ uri : contractUri ,
42
+ client,
43
+ } ) . then ( ( res ) => res . json ( ) as unknown as ZkSolcMetadata ) ;
44
+
45
+ const contractId = Object . values (
46
+ deployMetadata . source_metadata . settings . compilationTarget ,
47
+ ) ;
48
+
49
+ const published = await fetchPublishedContract ( {
50
+ client,
51
+ contractId : contractId [ 0 ] as string ,
52
+ publisherAddress : THIRDWEB_DEPLOYER_ADDRESS ,
53
+ } ) ;
54
+
55
+ publishURIs = [ published . publishMetadataUri ] ;
56
+ } catch { }
55
57
}
56
58
57
59
return await Promise . all (
0 commit comments