thirdweb 5.48.0 → 5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/auth/verify-hash.js +1 -1
- package/dist/cjs/auth/verify-hash.js.map +1 -1
- package/dist/cjs/cli/commands/generate/generate.js +8 -8
- package/dist/cjs/cli/commands/generate/generate.js.map +1 -1
- package/dist/cjs/contract/actions/resolve-abi.js +1 -1
- package/dist/cjs/contract/actions/resolve-abi.js.map +1 -1
- package/dist/cjs/contract/verification/constructor-params.js +1 -1
- package/dist/cjs/contract/verification/constructor-params.js.map +1 -1
- package/dist/cjs/exports/react.js +3 -1
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/extensions/erc20/read/getCurrencyMetadata.js +1 -1
- package/dist/cjs/extensions/erc20/read/getCurrencyMetadata.js.map +1 -1
- package/dist/cjs/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/cjs/extensions/vote/read/proposalExists.js +1 -1
- package/dist/cjs/extensions/vote/read/proposalExists.js.map +1 -1
- package/dist/cjs/react/core/design-system/index.js +4 -4
- package/dist/cjs/react/core/design-system/index.js.map +1 -1
- package/dist/cjs/react/core/hooks/contract/useReadContract.js +4 -0
- package/dist/cjs/react/core/hooks/contract/useReadContract.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSendToken.js +1 -1
- package/dist/cjs/react/core/hooks/wallets/useSendToken.js.map +1 -1
- package/dist/cjs/react/native/ui/components/RNImage.js +8 -2
- package/dist/cjs/react/native/ui/components/RNImage.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +10 -4
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModal.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModal.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +4 -2
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js +10 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/useConnectModal.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +5 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/storage/upload/mobile.js +1 -1
- package/dist/cjs/storage/upload/mobile.js.map +1 -1
- package/dist/cjs/utils/contract/parse-abi-params.js +15 -0
- package/dist/cjs/utils/contract/parse-abi-params.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/fetch-proofs-for-claimers.js +1 -1
- package/dist/cjs/utils/extensions/drops/fetch-proofs-for-claimers.js.map +1 -1
- package/dist/cjs/utils/nft/fetchTokenMetadata.js +1 -1
- package/dist/cjs/utils/nft/fetchTokenMetadata.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js +3 -3
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/storage/local.js +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/storage/local.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +2 -2
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/cjs/wallets/utils/chains.js +1 -1
- package/dist/cjs/wallets/utils/chains.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/index.js +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/index.js.map +1 -1
- package/dist/esm/auth/verify-hash.js +1 -1
- package/dist/esm/auth/verify-hash.js.map +1 -1
- package/dist/esm/cli/commands/generate/generate.js +8 -8
- package/dist/esm/cli/commands/generate/generate.js.map +1 -1
- package/dist/esm/contract/actions/resolve-abi.js +1 -1
- package/dist/esm/contract/actions/resolve-abi.js.map +1 -1
- package/dist/esm/contract/verification/constructor-params.js +1 -1
- package/dist/esm/contract/verification/constructor-params.js.map +1 -1
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/extensions/erc20/read/getCurrencyMetadata.js +1 -1
- package/dist/esm/extensions/erc20/read/getCurrencyMetadata.js.map +1 -1
- package/dist/esm/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/esm/extensions/vote/read/proposalExists.js +1 -1
- package/dist/esm/extensions/vote/read/proposalExists.js.map +1 -1
- package/dist/esm/react/core/design-system/index.js +4 -4
- package/dist/esm/react/core/design-system/index.js.map +1 -1
- package/dist/esm/react/core/hooks/contract/useReadContract.js +4 -0
- package/dist/esm/react/core/hooks/contract/useReadContract.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useSendToken.js +1 -1
- package/dist/esm/react/core/hooks/wallets/useSendToken.js.map +1 -1
- package/dist/esm/react/native/ui/components/RNImage.js +8 -2
- package/dist/esm/react/native/ui/components/RNImage.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +10 -4
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModal.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModal.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +4 -2
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js +10 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/useConnectModal.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/useConnectModal.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +6 -2
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/storage/upload/mobile.js +1 -1
- package/dist/esm/storage/upload/mobile.js.map +1 -1
- package/dist/esm/utils/contract/parse-abi-params.js +15 -0
- package/dist/esm/utils/contract/parse-abi-params.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
- package/dist/esm/utils/extensions/drops/fetch-proofs-for-claimers.js +1 -1
- package/dist/esm/utils/extensions/drops/fetch-proofs-for-claimers.js.map +1 -1
- package/dist/esm/utils/nft/fetchTokenMetadata.js +1 -1
- package/dist/esm/utils/nft/fetchTokenMetadata.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js +3 -3
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/storage/local.js +1 -1
- package/dist/esm/wallets/in-app/native/helpers/storage/local.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +2 -2
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/esm/wallets/utils/chains.js +1 -1
- package/dist/esm/wallets/utils/chains.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/index.js +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/index.js.map +1 -1
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.d.ts.map +1 -1
- package/dist/types/react/core/design-system/index.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectEmbedProps.d.ts +9 -0
- package/dist/types/react/core/hooks/connection/ConnectEmbedProps.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/RNImage.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModal.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModalContent.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModalContent.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletSelector.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/useConnectModal.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/utils/contract/parse-abi-params.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth/verify-hash.ts +1 -1
- package/src/cli/commands/generate/generate.ts +8 -8
- package/src/contract/actions/resolve-abi.ts +1 -1
- package/src/contract/verification/constructor-params.ts +1 -1
- package/src/exports/react.ts +2 -0
- package/src/extensions/erc20/read/getCurrencyMetadata.ts +1 -1
- package/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.ts +0 -1
- package/src/extensions/vote/read/proposalExists.ts +1 -1
- package/src/react/core/design-system/index.ts +7 -4
- package/src/react/core/hooks/connection/ConnectEmbedProps.ts +12 -0
- package/src/react/core/hooks/contract/useReadContract.ts +4 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +1 -1
- package/src/react/core/hooks/wallets/useAutoConnect.ts +1 -1
- package/src/react/core/hooks/wallets/useSendToken.ts +1 -1
- package/src/react/core/utils/timeoutPromise.test.ts +1 -1
- package/src/react/native/ui/components/RNImage.tsx +11 -2
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +0 -1
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +20 -6
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx +1 -2
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +5 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +1 -1
- package/src/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx +16 -6
- package/src/react/web/ui/ConnectWallet/screens/WalletConnectReceiverScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/useConnectModal.tsx +0 -1
- package/src/react/web/wallets/in-app/WalletAuth.tsx +1 -1
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +21 -0
- package/src/storage/upload/mobile.ts +1 -1
- package/src/transaction/read-contract.test.ts +30 -0
- package/src/utils/contract/parse-abi-params.test.ts +12 -0
- package/src/utils/contract/parse-abi-params.ts +17 -0
- package/src/utils/encoding/hex.test.ts +40 -0
- package/src/utils/extensions/airdrop/fetch-proofs-erc1155.ts +1 -1
- package/src/utils/extensions/airdrop/fetch-proofs-erc20.ts +1 -1
- package/src/utils/extensions/airdrop/fetch-proofs-erc721.ts +1 -1
- package/src/utils/extensions/drops/fetch-proofs-for-claimers.ts +1 -1
- package/src/utils/nft/fetchTokenMetadata.ts +1 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/native/helpers/auth/middleware.ts +3 -3
- package/src/wallets/in-app/native/helpers/storage/local.ts +1 -1
- package/src/wallets/in-app/native/helpers/wallet/retrieval.ts +1 -1
- package/src/wallets/smart/index.ts +2 -2
- package/src/wallets/utils/chains.ts +1 -1
- package/src/wallets/wallet-connect/receiver/index.ts +1 -1
@@ -225,7 +225,7 @@ export async function getTotalTxCostForBuy(
|
|
225
225
|
|
226
226
|
// add 10% extra gas cost to the estimate to ensure user buys enough to cover the tx cost
|
227
227
|
return gasCost.wei + bufferCost + (txValue || 0n);
|
228
|
-
} catch
|
228
|
+
} catch {
|
229
229
|
if (from) {
|
230
230
|
// try again without passing from
|
231
231
|
return await getTotalTxCostForBuy(tx);
|
@@ -33,10 +33,19 @@ function getImage(data: string): {
|
|
33
33
|
|
34
34
|
export const RNImage = (props: ImageInfo) => {
|
35
35
|
const { data, size, color, placeholder } = props;
|
36
|
-
|
36
|
+
|
37
|
+
const imageResult = useMemo(() => {
|
38
|
+
if (!data) {
|
39
|
+
return undefined;
|
40
|
+
}
|
41
|
+
return getImage(data);
|
42
|
+
}, [data]);
|
43
|
+
|
44
|
+
if (!imageResult) {
|
37
45
|
return null;
|
38
46
|
}
|
39
|
-
|
47
|
+
|
48
|
+
const { image, type } = imageResult;
|
40
49
|
switch (type) {
|
41
50
|
case "url":
|
42
51
|
case "image":
|
@@ -349,7 +349,6 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
349
349
|
}}
|
350
350
|
welcomeScreen={props.connectModal?.welcomeScreen}
|
351
351
|
size={size}
|
352
|
-
isEmbed={false}
|
353
352
|
localeId={props.locale || "en_US"}
|
354
353
|
onConnect={props.onConnect}
|
355
354
|
recommendedWallets={props.recommendedWallets}
|
@@ -276,7 +276,7 @@ export function ConnectEmbed(props: ConnectEmbedProps) {
|
|
276
276
|
connectLocale={localeQuery.data}
|
277
277
|
size={modalSize}
|
278
278
|
meta={meta}
|
279
|
-
|
279
|
+
header={props.header}
|
280
280
|
localeId={props.locale || "en_US"}
|
281
281
|
onConnect={props.onConnect}
|
282
282
|
recommendedWallets={props.recommendedWallets}
|
@@ -318,7 +318,13 @@ const ConnectEmbedContent = (props: {
|
|
318
318
|
privacyPolicyUrl?: string;
|
319
319
|
};
|
320
320
|
size: "compact" | "wide";
|
321
|
-
|
321
|
+
header:
|
322
|
+
| {
|
323
|
+
title?: string;
|
324
|
+
titleIcon?: string;
|
325
|
+
}
|
326
|
+
| true
|
327
|
+
| undefined;
|
322
328
|
localeId: LocaleId;
|
323
329
|
onConnect: ((wallet: Wallet) => void) | undefined;
|
324
330
|
recommendedWallets: Wallet[] | undefined;
|
@@ -383,10 +389,18 @@ const ConnectEmbedContent = (props: {
|
|
383
389
|
chains={props.chains}
|
384
390
|
client={props.client}
|
385
391
|
connectLocale={props.connectLocale}
|
386
|
-
meta={
|
392
|
+
meta={{
|
393
|
+
...props.meta,
|
394
|
+
title:
|
395
|
+
typeof props.header === "object" ? props.header.title : undefined,
|
396
|
+
titleIconUrl:
|
397
|
+
typeof props.header === "object"
|
398
|
+
? props.header.titleIcon
|
399
|
+
: undefined,
|
400
|
+
}}
|
387
401
|
size={props.size}
|
388
402
|
welcomeScreen={props.welcomeScreen}
|
389
|
-
|
403
|
+
hideHeader={!props.header}
|
390
404
|
onConnect={props.onConnect}
|
391
405
|
recommendedWallets={props.recommendedWallets}
|
392
406
|
showAllWallets={props.showAllWallets}
|
@@ -431,8 +445,8 @@ export const EmbedContainer = /* @__PURE__ */ StyledDiv<{
|
|
431
445
|
overflow: "hidden",
|
432
446
|
fontFamily: theme.fontFamily,
|
433
447
|
"& *::selection": {
|
434
|
-
backgroundColor: theme.colors.
|
435
|
-
color: theme.colors.
|
448
|
+
backgroundColor: theme.colors.selectedTextBg,
|
449
|
+
color: theme.colors.selectedTextColor,
|
436
450
|
},
|
437
451
|
"& *": {
|
438
452
|
boxSizing: "border-box",
|
@@ -37,7 +37,6 @@ type ConnectModalOptions = {
|
|
37
37
|
};
|
38
38
|
connectLocale: ConnectLocale;
|
39
39
|
client: ThirdwebClient;
|
40
|
-
isEmbed: boolean;
|
41
40
|
recommendedWallets: Wallet[] | undefined;
|
42
41
|
localeId: LocaleId;
|
43
42
|
chain: Chain | undefined;
|
@@ -142,7 +141,7 @@ const ConnectModal = (props: ConnectModalOptions) => {
|
|
142
141
|
size={props.size}
|
143
142
|
welcomeScreen={props.welcomeScreen}
|
144
143
|
meta={props.meta}
|
145
|
-
|
144
|
+
hideHeader={false}
|
146
145
|
onConnect={props.onConnect}
|
147
146
|
recommendedWallets={props.recommendedWallets}
|
148
147
|
wallets={props.wallets}
|
@@ -55,7 +55,7 @@ export const ConnectModalContent = (props: {
|
|
55
55
|
welcomeScreen: WelcomeScreen | undefined;
|
56
56
|
connectLocale: ConnectLocale;
|
57
57
|
client: ThirdwebClient;
|
58
|
-
|
58
|
+
hideHeader: boolean;
|
59
59
|
recommendedWallets: Wallet[] | undefined;
|
60
60
|
chain: Chain | undefined;
|
61
61
|
chains: Chain[] | undefined;
|
@@ -149,7 +149,7 @@ export const ConnectModalContent = (props: {
|
|
149
149
|
setModalVisibility={setModalVisibility}
|
150
150
|
client={props.client}
|
151
151
|
connectLocale={props.connectLocale}
|
152
|
-
|
152
|
+
hideHeader={props.hideHeader}
|
153
153
|
recommendedWallets={props.recommendedWallets}
|
154
154
|
accountAbstraction={props.accountAbstraction}
|
155
155
|
chain={props.chain}
|
@@ -71,7 +71,7 @@ export type WalletSelectorProps = {
|
|
71
71
|
client: ThirdwebClient;
|
72
72
|
connectLocale: ConnectLocale;
|
73
73
|
recommendedWallets: Wallet[] | undefined;
|
74
|
-
|
74
|
+
hideHeader: boolean;
|
75
75
|
chain: Chain | undefined;
|
76
76
|
chains: Chain[] | undefined;
|
77
77
|
showAllWallets: boolean | undefined;
|
@@ -472,7 +472,8 @@ const WalletSelectorInner: React.FC<WalletSelectorProps> = (props) => {
|
|
472
472
|
}
|
473
473
|
}
|
474
474
|
|
475
|
-
|
475
|
+
// hide the header for embed - unless it's customized
|
476
|
+
const showHeader = !props.hideHeader || props.modalHeader;
|
476
477
|
|
477
478
|
return (
|
478
479
|
<Container
|
@@ -515,7 +516,7 @@ const WalletSelectorInner: React.FC<WalletSelectorProps> = (props) => {
|
|
515
516
|
}
|
516
517
|
}
|
517
518
|
>
|
518
|
-
{!
|
519
|
+
{!showHeader && isWalletGroupExpanded && (
|
519
520
|
<Container
|
520
521
|
flex="row"
|
521
522
|
center="y"
|
@@ -593,6 +594,7 @@ const WalletSelection: React.FC<{
|
|
593
594
|
<WalletList
|
594
595
|
style={{
|
595
596
|
minHeight: "100%",
|
597
|
+
maxHeight: "370px",
|
596
598
|
}}
|
597
599
|
>
|
598
600
|
{wallets.map((wallet) => {
|
@@ -155,7 +155,7 @@ export async function getTransactionGasCost(
|
|
155
155
|
// Note: get tx.value AFTER estimateGasCost
|
156
156
|
// add 10% extra gas cost to the estimate to ensure user buys enough to cover the tx cost
|
157
157
|
return gasCost.wei + bufferCost;
|
158
|
-
} catch
|
158
|
+
} catch {
|
159
159
|
if (from) {
|
160
160
|
// try again without passing from
|
161
161
|
return await getTransactionGasCost(tx);
|
@@ -108,10 +108,6 @@ export function ViewNFTsContent(props: {
|
|
108
108
|
const activeAccount = useActiveAccount();
|
109
109
|
const activeChain = useActiveWalletChain();
|
110
110
|
|
111
|
-
if (!activeChain?.id || !activeAccount?.address) {
|
112
|
-
return null;
|
113
|
-
}
|
114
|
-
|
115
111
|
const nftList = useMemo(() => {
|
116
112
|
const nfts = [];
|
117
113
|
if (!props.supportedNFTs) return [];
|
@@ -131,11 +127,25 @@ export function ViewNFTsContent(props: {
|
|
131
127
|
const results = useQueries({
|
132
128
|
queries: nftList.map((nft) => ({
|
133
129
|
queryKey: ["readContract", nft.chain.id, nft.address],
|
134
|
-
queryFn: () =>
|
135
|
-
|
130
|
+
queryFn: () => {
|
131
|
+
if (!activeAccount) {
|
132
|
+
throw new Error("No active account");
|
133
|
+
}
|
134
|
+
return fetchNFTs(
|
135
|
+
props.client,
|
136
|
+
nft.chain,
|
137
|
+
nft.address,
|
138
|
+
activeAccount.address,
|
139
|
+
);
|
140
|
+
},
|
141
|
+
enabled: !!activeAccount,
|
136
142
|
})),
|
137
143
|
});
|
138
144
|
|
145
|
+
if (!activeChain?.id || !activeAccount?.address) {
|
146
|
+
return null;
|
147
|
+
}
|
148
|
+
|
139
149
|
return (
|
140
150
|
<>
|
141
151
|
<Container
|
@@ -60,7 +60,7 @@ export function WalletConnectReceiverScreen(props: {
|
|
60
60
|
},
|
61
61
|
});
|
62
62
|
return client;
|
63
|
-
} catch
|
63
|
+
} catch {
|
64
64
|
setErrorConnecting("Failed to establish WalletConnect connection");
|
65
65
|
return;
|
66
66
|
}
|
@@ -164,7 +164,7 @@ export function WalletConnectReceiverScreen(props: {
|
|
164
164
|
uri: value,
|
165
165
|
walletConnectClient,
|
166
166
|
});
|
167
|
-
} catch
|
167
|
+
} catch {
|
168
168
|
setErrorConnecting(
|
169
169
|
"Error creating WalletConnect session",
|
170
170
|
);
|
@@ -103,7 +103,7 @@ export function WalletAuth(props: {
|
|
103
103
|
setModalVisibility={() => {}}
|
104
104
|
client={props.client}
|
105
105
|
connectLocale={props.locale}
|
106
|
-
|
106
|
+
hideHeader={false}
|
107
107
|
recommendedWallets={undefined}
|
108
108
|
chain={wallet.getChain()}
|
109
109
|
showAllWallets={true}
|
@@ -34,6 +34,7 @@ import {
|
|
34
34
|
import { useSetSelectionData } from "../../providers/wallet-ui-states-provider.js";
|
35
35
|
import { WalletTypeRowButton } from "../../ui/ConnectWallet/WalletTypeRowButton.js";
|
36
36
|
import { Img } from "../../ui/components/Img.js";
|
37
|
+
import { Spacer } from "../../ui/components/Spacer.js";
|
37
38
|
import { TextDivider } from "../../ui/components/TextDivider.js";
|
38
39
|
import { Container } from "../../ui/components/basic.js";
|
39
40
|
import { Button } from "../../ui/components/buttons.js";
|
@@ -90,6 +91,13 @@ export const ConnectWalletSocialOptions = (
|
|
90
91
|
) => void;
|
91
92
|
|
92
93
|
const themeObj = useCustomTheme();
|
94
|
+
const optionalImageMetadata = useMemo(
|
95
|
+
() =>
|
96
|
+
props.wallet.id === "inApp"
|
97
|
+
? props.wallet.getConfig()?.metadata?.image
|
98
|
+
: undefined,
|
99
|
+
[props.wallet],
|
100
|
+
);
|
93
101
|
|
94
102
|
const loginMethodsLabel = {
|
95
103
|
google: locale.signInWithGoogle,
|
@@ -261,6 +269,19 @@ export const ConnectWalletSocialOptions = (
|
|
261
269
|
position: "relative",
|
262
270
|
}}
|
263
271
|
>
|
272
|
+
{optionalImageMetadata && (
|
273
|
+
<>
|
274
|
+
<Img
|
275
|
+
client={props.client}
|
276
|
+
src={optionalImageMetadata.src}
|
277
|
+
alt={optionalImageMetadata.alt}
|
278
|
+
width={`${optionalImageMetadata.width}`}
|
279
|
+
height={`${optionalImageMetadata.height}`}
|
280
|
+
style={{ margin: "auto" }}
|
281
|
+
/>
|
282
|
+
<Spacer y="xxs" />
|
283
|
+
</>
|
284
|
+
)}
|
264
285
|
{/* Social Login */}
|
265
286
|
{hasSocialLogins && (
|
266
287
|
<Container
|
@@ -31,4 +31,34 @@ describe.runIf(process.env.TW_SECRET_KEY)("transaction: read", () => {
|
|
31
31
|
);
|
32
32
|
}
|
33
33
|
});
|
34
|
+
|
35
|
+
it("should work with string and number, not just bigint", async () => {
|
36
|
+
/**
|
37
|
+
* The following 3 readContracts all result in the same value because
|
38
|
+
* the param is still parsed and encoded properly downstream by `numberToHex`
|
39
|
+
* See this docs for more context: "../utils/encoding/hex.test.js"
|
40
|
+
*/
|
41
|
+
const [bigintResult, numberResult, stringResult] = await Promise.all([
|
42
|
+
readContract({
|
43
|
+
contract: DOODLES_CONTRACT,
|
44
|
+
method: "function ownerOf(uint256 tokenId) view returns (address)",
|
45
|
+
params: [1n],
|
46
|
+
}),
|
47
|
+
readContract({
|
48
|
+
contract: DOODLES_CONTRACT,
|
49
|
+
method: "function ownerOf(uint256 tokenId) view returns (address)",
|
50
|
+
// @ts-ignore Intentional
|
51
|
+
params: [1], // <- supposed to be a bigint
|
52
|
+
}),
|
53
|
+
readContract({
|
54
|
+
contract: DOODLES_CONTRACT,
|
55
|
+
method: "function ownerOf(uint256 tokenId) view returns (address)",
|
56
|
+
// @ts-ignore Intentional
|
57
|
+
params: ["1"], // <- supposed to be a bigint
|
58
|
+
}),
|
59
|
+
]);
|
60
|
+
|
61
|
+
expect(bigintResult === numberResult).toBe(true);
|
62
|
+
expect(bigintResult === stringResult).toBe(true);
|
63
|
+
});
|
34
64
|
});
|
@@ -156,5 +156,17 @@ describe("parseAbiParams", () => {
|
|
156
156
|
const result = parseAbiParams(["bytes64"], [value]);
|
157
157
|
expect(result).toStrictEqual([value]);
|
158
158
|
});
|
159
|
+
|
160
|
+
it("should return a string for type string", () => {
|
161
|
+
const value = "this is a string";
|
162
|
+
const result = parseAbiParams(["string"], [value]);
|
163
|
+
expect(result).toStrictEqual(["this is a string"]);
|
164
|
+
});
|
165
|
+
|
166
|
+
it("should return the value itself if it falls through to the end", () => {
|
167
|
+
const value = { whatever: true };
|
168
|
+
const result = parseAbiParams(["non-existent-type"], [value]);
|
169
|
+
expect(result).toStrictEqual([{ whatever: true }]);
|
170
|
+
});
|
159
171
|
});
|
160
172
|
});
|
@@ -32,6 +32,17 @@ export function parseAbiParams(
|
|
32
32
|
constructorParamTypes: string[],
|
33
33
|
constructorParamValues: unknown[],
|
34
34
|
): Array<string | bigint | boolean> {
|
35
|
+
/**
|
36
|
+
* Internal Solidity type checklist
|
37
|
+
* 1. tuple, array -> JSON.parse | todo: Recursively parse the content
|
38
|
+
* 2. uint, int -> bigint
|
39
|
+
* 3. address -> string
|
40
|
+
* 4. string -> string
|
41
|
+
* 5. bytes, bytes32 etc. -> string
|
42
|
+
* 6. bool -> boolean
|
43
|
+
* >>> Make sure to return the original value at the end of the function <<<
|
44
|
+
*/
|
45
|
+
|
35
46
|
// Make sure they have the same length
|
36
47
|
if (constructorParamTypes.length !== constructorParamValues.length) {
|
37
48
|
throw new Error(
|
@@ -46,6 +57,9 @@ export function parseAbiParams(
|
|
46
57
|
}
|
47
58
|
return value;
|
48
59
|
}
|
60
|
+
if (type === "string") {
|
61
|
+
return String(value);
|
62
|
+
}
|
49
63
|
if (type === "bytes32") {
|
50
64
|
if (!isHex(value)) {
|
51
65
|
throw new Error(`${value} is not a valid hex string`);
|
@@ -86,5 +100,8 @@ export function parseAbiParams(
|
|
86
100
|
"Invalid boolean value. Expecting either 'true' or 'false'",
|
87
101
|
);
|
88
102
|
}
|
103
|
+
|
104
|
+
// Return the value here if none of the types match
|
105
|
+
return value;
|
89
106
|
});
|
90
107
|
}
|
@@ -8,4 +8,44 @@ describe("hex.ts", () => {
|
|
8
8
|
"0x0000000000000000000000000000000000000000000000000000000000000064",
|
9
9
|
);
|
10
10
|
});
|
11
|
+
|
12
|
+
/**
|
13
|
+
* This test is put here as a docs for the method `numberToHex` because:
|
14
|
+
*
|
15
|
+
* `numberToHex` can still work with number-convertible strings - even tho it only accepts number or bigint
|
16
|
+
* because there's is one line of code that's converting the param into bigint anyway
|
17
|
+
* ```ts
|
18
|
+
* const value = BigInt(value_);
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* As a side effect, the following 3 return the same result:
|
22
|
+
* ```ts
|
23
|
+
* readContract({
|
24
|
+
* contract,
|
25
|
+
* method: "function tokenURI(uint256 tokenId) returns (string)",
|
26
|
+
* params: [1n],
|
27
|
+
* })
|
28
|
+
*
|
29
|
+
* readContract({
|
30
|
+
* contract,
|
31
|
+
* method: "function tokenURI(uint256 tokenId) returns (string)",
|
32
|
+
* // @ts-ignore
|
33
|
+
* params: [1],
|
34
|
+
* })
|
35
|
+
*
|
36
|
+
* readContract({
|
37
|
+
* contract,
|
38
|
+
* method: "function tokenURI(uint256 tokenId) returns (string)",
|
39
|
+
* // @ts-ignore
|
40
|
+
* params: ["1"],
|
41
|
+
* })
|
42
|
+
* ```
|
43
|
+
*/
|
44
|
+
it("should work with string !!!!", () => {
|
45
|
+
// @ts-ignore Intentional
|
46
|
+
const result = numberToHex("100", { size: 32, signed: false });
|
47
|
+
expect(result).toBe(
|
48
|
+
"0x0000000000000000000000000000000000000000000000000000000000000064",
|
49
|
+
);
|
50
|
+
});
|
11
51
|
});
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.48.
|
1
|
+
export const version = "5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343";
|
@@ -64,7 +64,7 @@ export async function postAuth({
|
|
64
64
|
try {
|
65
65
|
// existing device share
|
66
66
|
await getDeviceShare(client.clientId);
|
67
|
-
} catch
|
67
|
+
} catch {
|
68
68
|
const _recoveryCode = await getRecoveryCode(
|
69
69
|
storedToken,
|
70
70
|
client,
|
@@ -116,7 +116,7 @@ export async function postAuthUserManaged(
|
|
116
116
|
try {
|
117
117
|
// existing device share
|
118
118
|
await getDeviceShare(client.clientId);
|
119
|
-
} catch
|
119
|
+
} catch {
|
120
120
|
// trying to recreate device share from recovery code to derive wallet
|
121
121
|
try {
|
122
122
|
await setUpShareForNewDevice({
|
@@ -155,7 +155,7 @@ async function getRecoveryCode(
|
|
155
155
|
}
|
156
156
|
try {
|
157
157
|
return await getCognitoRecoveryPasswordV2(client);
|
158
|
-
} catch
|
158
|
+
} catch {
|
159
159
|
return await getCognitoRecoveryPasswordV1(client).catch(() => {
|
160
160
|
throw new Error("Something went wrong getting cognito recovery code");
|
161
161
|
});
|
@@ -261,7 +261,7 @@ async function createSmartAccount(
|
|
261
261
|
params: [originalMsgHash],
|
262
262
|
});
|
263
263
|
factorySupports712 = true;
|
264
|
-
} catch
|
264
|
+
} catch {
|
265
265
|
// ignore
|
266
266
|
}
|
267
267
|
|
@@ -349,7 +349,7 @@ async function createSmartAccount(
|
|
349
349
|
params: [originalMsgHash],
|
350
350
|
});
|
351
351
|
factorySupports712 = true;
|
352
|
-
} catch
|
352
|
+
} catch {
|
353
353
|
// ignore
|
354
354
|
}
|
355
355
|
|