Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit f14d279

Browse files
committed
its ok to fail
1 parent 225c3e4 commit f14d279

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

docs/react.usecontract.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare function useContract(contractAddress?: string): {
1919
pubishMetadata: null;
2020
} | {
2121
contractType: "custom";
22-
pubishMetadata: PublishedMetadata | null | undefined;
22+
pubishMetadata: PublishedMetadata | undefined;
2323
} | undefined;
2424
error: unknown;
2525
isError: true;
@@ -44,7 +44,7 @@ declare function useContract(contractAddress?: string): {
4444
pubishMetadata: null;
4545
} | {
4646
contractType: "custom";
47-
pubishMetadata: PublishedMetadata | null | undefined;
47+
pubishMetadata: PublishedMetadata | undefined;
4848
} | undefined, unknown>>;
4949
remove: () => void;
5050
fetchStatus: react_query.FetchStatus;
@@ -55,7 +55,7 @@ declare function useContract(contractAddress?: string): {
5555
pubishMetadata: null;
5656
} | {
5757
contractType: "custom";
58-
pubishMetadata: PublishedMetadata | null | undefined;
58+
pubishMetadata: PublishedMetadata | undefined;
5959
} | undefined;
6060
error: null;
6161
isError: false;
@@ -80,7 +80,7 @@ declare function useContract(contractAddress?: string): {
8080
pubishMetadata: null;
8181
} | {
8282
contractType: "custom";
83-
pubishMetadata: PublishedMetadata | null | undefined;
83+
pubishMetadata: PublishedMetadata | undefined;
8484
} | undefined, unknown>>;
8585
remove: () => void;
8686
fetchStatus: react_query.FetchStatus;
@@ -95,7 +95,7 @@ declare function useContract(contractAddress?: string): {
9595

9696
<b>Returns:</b>
9797

98-
{ contract: \_thirdweb\_dev\_sdk.Split \| \_thirdweb\_dev\_sdk.NFTDrop \| \_thirdweb\_dev\_sdk.NFTCollection \| \_thirdweb\_dev\_sdk.EditionDrop \| \_thirdweb\_dev\_sdk.Edition \| \_thirdweb\_dev\_sdk.TokenDrop \| \_thirdweb\_dev\_sdk.Token \| \_thirdweb\_dev\_sdk.Vote \| \_thirdweb\_dev\_sdk.Marketplace \| \_thirdweb\_dev\_sdk.Pack \| SmartContract&lt;any&gt; \| null; data: { contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| null \| undefined; } \| undefined; error: unknown; isError: true; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: &lt;TPageData&gt;(options?: (react\_query.RefetchOptions &amp; react\_query.RefetchQueryFilters&lt;TPageData&gt;) \| undefined) =&gt; Promise&lt;react\_query.QueryObserverResult&lt;{ contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| null \| undefined; } \| undefined, unknown&gt;&gt;; remove: () =&gt; void; fetchStatus: react\_query.FetchStatus; } \| { contract: \_thirdweb\_dev\_sdk.Split \| \_thirdweb\_dev\_sdk.NFTDrop \| \_thirdweb\_dev\_sdk.NFTCollection \| \_thirdweb\_dev\_sdk.EditionDrop \| \_thirdweb\_dev\_sdk.Edition \| \_thirdweb\_dev\_sdk.TokenDrop \| \_thirdweb\_dev\_sdk.Token \| \_thirdweb\_dev\_sdk.Vote \| \_thirdweb\_dev\_sdk.Marketplace \| \_thirdweb\_dev\_sdk.Pack \| SmartContract&lt;any&gt; \| null; data: { contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| null \| undefined; } \| undefined; error: null; isError: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: &lt;TPageData&gt;(options?: (react\_query.RefetchOptions &amp; react\_query.RefetchQueryFilters&lt;TPageData&gt;) \| undefined) =&gt; Promise&lt;react\_query.QueryObserverResult&lt;{ contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| null \| undefined; } \| undefined, unknown&gt;&gt;; remove: () =&gt; void; fetchStatus: react\_query.FetchStatus; } \| null
98+
{ contract: \_thirdweb\_dev\_sdk.Split \| \_thirdweb\_dev\_sdk.NFTDrop \| \_thirdweb\_dev\_sdk.NFTCollection \| \_thirdweb\_dev\_sdk.EditionDrop \| \_thirdweb\_dev\_sdk.Edition \| \_thirdweb\_dev\_sdk.TokenDrop \| \_thirdweb\_dev\_sdk.Token \| \_thirdweb\_dev\_sdk.Vote \| \_thirdweb\_dev\_sdk.Marketplace \| \_thirdweb\_dev\_sdk.Pack \| SmartContract&lt;any&gt; \| null; data: { contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| undefined; } \| undefined; error: unknown; isError: true; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: &lt;TPageData&gt;(options?: (react\_query.RefetchOptions &amp; react\_query.RefetchQueryFilters&lt;TPageData&gt;) \| undefined) =&gt; Promise&lt;react\_query.QueryObserverResult&lt;{ contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| undefined; } \| undefined, unknown&gt;&gt;; remove: () =&gt; void; fetchStatus: react\_query.FetchStatus; } \| { contract: \_thirdweb\_dev\_sdk.Split \| \_thirdweb\_dev\_sdk.NFTDrop \| \_thirdweb\_dev\_sdk.NFTCollection \| \_thirdweb\_dev\_sdk.EditionDrop \| \_thirdweb\_dev\_sdk.Edition \| \_thirdweb\_dev\_sdk.TokenDrop \| \_thirdweb\_dev\_sdk.Token \| \_thirdweb\_dev\_sdk.Vote \| \_thirdweb\_dev\_sdk.Marketplace \| \_thirdweb\_dev\_sdk.Pack \| SmartContract&lt;any&gt; \| null; data: { contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| undefined; } \| undefined; error: null; isError: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: &lt;TPageData&gt;(options?: (react\_query.RefetchOptions &amp; react\_query.RefetchQueryFilters&lt;TPageData&gt;) \| undefined) =&gt; Promise&lt;react\_query.QueryObserverResult&lt;{ contractType: "split" \| "nft-drop" \| "nft-collection" \| "edition-drop" \| "edition" \| "token-drop" \| "token" \| "vote" \| "marketplace" \| "pack" \| undefined; pubishMetadata: null; } \| { contractType: "custom"; pubishMetadata: PublishedMetadata \| undefined; } \| undefined, unknown&gt;&gt;; remove: () =&gt; void; fetchStatus: react\_query.FetchStatus; } \| null
9999

100100
a response object that includes the contract once it is resolved
101101

docs/react.usecontractpublishmetadata.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Use this to get the publish metadata for a deployed contract.
1212
<b>Signature:</b>
1313

1414
```typescript
15-
declare function useContractPublishMetadata(contractAddress?: string): react_query.UseQueryResult<PublishedMetadata | null | undefined, unknown>;
15+
declare function useContractPublishMetadata(contractAddress?: string): react_query.UseQueryResult<PublishedMetadata | undefined, unknown>;
1616
```
1717

1818
## Parameters
@@ -23,7 +23,7 @@ declare function useContractPublishMetadata(contractAddress?: string): react_que
2323

2424
<b>Returns:</b>
2525

26-
react\_query.UseQueryResult&lt;PublishedMetadata \| null \| undefined, unknown&gt;
26+
react\_query.UseQueryResult&lt;PublishedMetadata \| undefined, unknown&gt;
2727

2828
a response object that includes the published metadata (name, abi, bytecode) of the contract
2929

etc/react.api.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export function useContract(contractAddress?: string): {
331331
pubishMetadata: null;
332332
} | {
333333
contractType: "custom";
334-
pubishMetadata: PublishedMetadata | null | undefined;
334+
pubishMetadata: PublishedMetadata | undefined;
335335
} | undefined;
336336
error: unknown;
337337
isError: true;
@@ -356,7 +356,7 @@ export function useContract(contractAddress?: string): {
356356
pubishMetadata: null;
357357
} | {
358358
contractType: "custom";
359-
pubishMetadata: PublishedMetadata | null | undefined;
359+
pubishMetadata: PublishedMetadata | undefined;
360360
} | undefined, unknown>>;
361361
remove: () => void;
362362
fetchStatus: react_query.FetchStatus;
@@ -367,7 +367,7 @@ export function useContract(contractAddress?: string): {
367367
pubishMetadata: null;
368368
} | {
369369
contractType: "custom";
370-
pubishMetadata: PublishedMetadata | null | undefined;
370+
pubishMetadata: PublishedMetadata | undefined;
371371
} | undefined;
372372
error: null;
373373
isError: false;
@@ -392,7 +392,7 @@ export function useContract(contractAddress?: string): {
392392
pubishMetadata: null;
393393
} | {
394394
contractType: "custom";
395-
pubishMetadata: PublishedMetadata | null | undefined;
395+
pubishMetadata: PublishedMetadata | undefined;
396396
} | undefined, unknown>>;
397397
remove: () => void;
398398
fetchStatus: react_query.FetchStatus;
@@ -414,7 +414,7 @@ export function useContractMetadata(contractAddress?: string): react_query.UseQu
414414
} | undefined, unknown>;
415415

416416
// @beta
417-
export function useContractPublishMetadata(contractAddress?: string): react_query.UseQueryResult<PublishedMetadata | null | undefined, unknown>;
417+
export function useContractPublishMetadata(contractAddress?: string): react_query.UseQueryResult<PublishedMetadata | undefined, unknown>;
418418

419419
// @beta
420420
export function useContractType(contractAddress?: string): react_query.UseQueryResult<"split" | "custom" | "nft-drop" | "nft-collection" | "edition-drop" | "edition" | "token-drop" | "token" | "vote" | "marketplace" | "pack" | undefined, unknown>;

src/hooks/async/contracts.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,10 @@ async function fetchContractPublishMetadata(
2323
if (!contractAddress || !sdk) {
2424
return;
2525
}
26-
try {
27-
return await (
28-
await sdk.getPublisher()
29-
).fetchContractMetadataFromAddress(contractAddress);
30-
} catch (err) {
31-
console.info("failed to load contract publish metadata", err);
32-
return null;
33-
}
26+
27+
return await (
28+
await sdk.getPublisher()
29+
).fetchContractMetadataFromAddress(contractAddress);
3430
}
3531
async function fetchContractTypeAndPublishMetadata(
3632
queryClient: QueryClient,

0 commit comments

Comments
 (0)