thirdweb 5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343 → 5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351
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/exports/pay.js +3 -1
- package/dist/cjs/exports/pay.js.map +1 -1
- package/dist/cjs/exports/thirdweb.js +3 -1
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js +3 -0
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -0
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/cjs/pay/utils/definitions.js +7 -1
- package/dist/cjs/pay/utils/definitions.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +9 -0
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +9 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +34 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +118 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +7 -76
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/stories/ConnectButton.stories.js +28 -0
- package/dist/cjs/stories/ConnectButton.stories.js.map +1 -0
- package/dist/cjs/stories/PayEmbed.stories.js +38 -0
- package/dist/cjs/stories/PayEmbed.stories.js.map +1 -0
- package/dist/cjs/stories/utils.js +27 -0
- package/dist/cjs/stories/utils.js.map +1 -0
- package/dist/cjs/transaction/actions/send-transaction.js.map +1 -1
- package/dist/cjs/utils/fetch.js +2 -1
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/utils/signatures/sign-message.js +13 -19
- package/dist/cjs/utils/signatures/sign-message.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/constants.js +6 -0
- package/dist/cjs/wallets/smart/lib/constants.js.map +1 -1
- package/dist/esm/exports/pay.js +2 -0
- package/dist/esm/exports/pay.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +2 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/commonTypes.js +2 -0
- package/dist/esm/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +92 -0
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/esm/pay/utils/definitions.js +5 -0
- package/dist/esm/pay/utils/definitions.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +5 -0
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +8 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +35 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +115 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +8 -77
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/stories/ConnectButton.stories.js +25 -0
- package/dist/esm/stories/ConnectButton.stories.js.map +1 -0
- package/dist/esm/stories/PayEmbed.stories.js +35 -0
- package/dist/esm/stories/PayEmbed.stories.js.map +1 -0
- package/dist/esm/stories/utils.js +24 -0
- package/dist/esm/stories/utils.js.map +1 -0
- package/dist/esm/transaction/actions/send-transaction.js.map +1 -1
- package/dist/esm/utils/fetch.js +2 -1
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/utils/signatures/sign-message.js +13 -19
- package/dist/esm/utils/signatures/sign-message.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/smart/lib/constants.js +6 -0
- package/dist/esm/wallets/smart/lib/constants.js.map +1 -1
- package/dist/types/exports/pay.d.ts +3 -1
- package/dist/types/exports/pay.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +3 -1
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +36 -0
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts +1 -24
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts +85 -0
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/utils/definitions.d.ts +5 -0
- package/dist/types/pay/utils/definitions.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +15 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/TokenListScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts +3 -0
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +2 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +3 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts +20 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +5 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
- package/dist/types/stories/ConnectButton.stories.d.ts +18 -0
- package/dist/types/stories/ConnectButton.stories.d.ts.map +1 -0
- package/dist/types/stories/PayEmbed.stories.d.ts +19 -0
- package/dist/types/stories/PayEmbed.stories.d.ts.map +1 -0
- package/dist/types/stories/utils.d.ts +5 -0
- package/dist/types/stories/utils.d.ts.map +1 -0
- package/dist/types/transaction/actions/send-transaction.d.ts +12 -2
- package/dist/types/transaction/actions/send-transaction.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/utils/signatures/sign-message.d.ts +26 -3
- package/dist/types/utils/signatures/sign-message.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +1 -2
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -8
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +1 -5
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/constants.d.ts.map +1 -1
- package/package.json +15 -2
- package/src/exports/pay.ts +11 -2
- package/src/exports/thirdweb.ts +11 -2
- package/src/pay/buyWithCrypto/commonTypes.ts +40 -0
- package/src/pay/buyWithCrypto/getQuote.ts +8 -42
- package/src/pay/buyWithCrypto/getStatus.ts +1 -1
- package/src/pay/buyWithCrypto/getTransfer.ts +185 -0
- package/src/pay/buyWithFiat/getQuote.ts +1 -1
- package/src/pay/utils/definitions.ts +7 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +16 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +3 -0
- package/src/react/native/ui/connect/ConnectedButton.tsx +6 -1
- package/src/react/native/ui/connect/ConnectedModal.tsx +2 -1
- package/src/react/native/ui/connect/TokenListScreen.tsx +6 -1
- package/src/react/web/ui/ConnectWallet/Details.tsx +93 -77
- package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +21 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +9 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +47 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +26 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +284 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +29 -220
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +3 -1
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -2
- package/src/react/web/wallets/shared/SocialLogin.tsx +7 -2
- package/src/stories/ConnectButton.stories.ts +31 -0
- package/src/stories/PayEmbed.stories.ts +42 -0
- package/src/stories/utils.tsx +29 -0
- package/src/transaction/actions/send-transaction.ts +12 -3
- package/src/utils/fetch.ts +4 -1
- package/src/utils/signatures/sign-message.test.ts +78 -50
- package/src/utils/signatures/sign-message.ts +44 -9
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +1 -2
- package/src/wallets/in-app/core/authentication/getLoginPath.ts +11 -9
- package/src/wallets/in-app/core/authentication/types.ts +1 -8
- package/src/wallets/in-app/core/interfaces/connector.ts +5 -1
- package/src/wallets/in-app/core/wallet/index.ts +6 -2
- package/src/wallets/in-app/core/wallet/types.ts +1 -5
- package/src/wallets/in-app/native/auth/native-auth.ts +1 -1
- package/src/wallets/in-app/web/lib/auth/index.ts +7 -2
- package/src/wallets/in-app/web/lib/auth/oauth.ts +5 -5
- package/src/wallets/in-app/web/lib/web-connector.ts +9 -3
- package/src/wallets/smart/lib/constants.ts +6 -0
- package/src/wallets/smart/smart-wallet-dev.test.ts +86 -0
@@ -14,6 +14,7 @@ import type { Chain } from "../../../../chains/types.js";
|
|
14
14
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
15
15
|
import { getContract } from "../../../../contract/contract.js";
|
16
16
|
import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
|
17
|
+
import { formatNumber } from "../../../../utils/formatNumber.js";
|
17
18
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
18
19
|
import type { SmartWalletOptions } from "../../../../wallets/smart/types.js";
|
19
20
|
import type { AppMetadata } from "../../../../wallets/types.js";
|
@@ -246,9 +247,7 @@ export const ConnectedWalletDetails: React.FC<{
|
|
246
247
|
color="secondaryText"
|
247
248
|
weight={400}
|
248
249
|
>
|
249
|
-
{Number.
|
250
|
-
Number(balanceQuery.data.displayValue).toFixed(3),
|
251
|
-
)}{" "}
|
250
|
+
{formatBalanceOnButton(Number(balanceQuery.data.displayValue))}{" "}
|
252
251
|
{balanceQuery.data.symbol}
|
253
252
|
</Text>
|
254
253
|
) : (
|
@@ -352,9 +351,7 @@ function DetailsModal(props: {
|
|
352
351
|
{chainNameQuery.name || `Unknown chain #${walletChain?.id}`}
|
353
352
|
<Text color="secondaryText" size="xs">
|
354
353
|
{balanceQuery.data ? (
|
355
|
-
Number.
|
356
|
-
Number(balanceQuery.data.displayValue).toFixed(3),
|
357
|
-
)
|
354
|
+
formatNumber(Number(balanceQuery.data.displayValue), 5)
|
358
355
|
) : (
|
359
356
|
<Skeleton height="1em" width="100px" />
|
360
357
|
)}{" "}
|
@@ -374,84 +371,91 @@ function DetailsModal(props: {
|
|
374
371
|
</MenuButton>
|
375
372
|
);
|
376
373
|
|
374
|
+
const avatarContent = (
|
375
|
+
<Container
|
376
|
+
style={{
|
377
|
+
position: "relative",
|
378
|
+
height: `${iconSize.xl}px`,
|
379
|
+
width: `${iconSize.xl}px`,
|
380
|
+
}}
|
381
|
+
>
|
382
|
+
<Container
|
383
|
+
style={{
|
384
|
+
width: "100%",
|
385
|
+
height: "100%",
|
386
|
+
borderRadius: "100%",
|
387
|
+
overflow: "hidden",
|
388
|
+
}}
|
389
|
+
>
|
390
|
+
{ensAvatarQuery.data ? (
|
391
|
+
<img
|
392
|
+
src={ensAvatarQuery.data}
|
393
|
+
style={{
|
394
|
+
width: iconSize.xxl,
|
395
|
+
height: iconSize.xxl,
|
396
|
+
}}
|
397
|
+
alt=""
|
398
|
+
/>
|
399
|
+
) : (
|
400
|
+
activeAccount && (
|
401
|
+
<Blobbie
|
402
|
+
address={activeAccount.address}
|
403
|
+
size={Number(iconSize.xxl)}
|
404
|
+
/>
|
405
|
+
)
|
406
|
+
)}
|
407
|
+
</Container>
|
408
|
+
<Container
|
409
|
+
style={{
|
410
|
+
position: "absolute",
|
411
|
+
bottom: -2,
|
412
|
+
right: -2,
|
413
|
+
}}
|
414
|
+
>
|
415
|
+
<IconContainer
|
416
|
+
style={{
|
417
|
+
background: theme.colors.modalBg,
|
418
|
+
}}
|
419
|
+
padding="4px"
|
420
|
+
>
|
421
|
+
{activeWallet && (
|
422
|
+
<WalletImage
|
423
|
+
style={{ borderRadius: 0 }}
|
424
|
+
id={activeWallet.id}
|
425
|
+
client={client}
|
426
|
+
size="12"
|
427
|
+
/>
|
428
|
+
)}
|
429
|
+
</IconContainer>
|
430
|
+
</Container>
|
431
|
+
</Container>
|
432
|
+
);
|
433
|
+
|
377
434
|
let content = (
|
378
435
|
<div>
|
379
436
|
<Spacer y="xs" />
|
380
437
|
<Container p="lg" gap="sm" flex="row" center="y">
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
onKeyDown={(e) => {
|
387
|
-
if (e.key === "w") {
|
388
|
-
setScreen("wallet-manager");
|
389
|
-
}
|
390
|
-
}}
|
391
|
-
onClick={() => {
|
392
|
-
setScreen("wallet-manager");
|
393
|
-
}}
|
394
|
-
>
|
395
|
-
<Container
|
438
|
+
{props.detailsModal?.hideSwitchWallet ? (
|
439
|
+
avatarContent
|
440
|
+
) : (
|
441
|
+
<ToolTip tip="Switch wallet">
|
442
|
+
<div
|
396
443
|
style={{
|
397
|
-
|
398
|
-
|
399
|
-
|
444
|
+
cursor: "pointer",
|
445
|
+
}}
|
446
|
+
onKeyDown={(e) => {
|
447
|
+
if (e.key === "w") {
|
448
|
+
setScreen("wallet-manager");
|
449
|
+
}
|
450
|
+
}}
|
451
|
+
onClick={() => {
|
452
|
+
setScreen("wallet-manager");
|
400
453
|
}}
|
401
454
|
>
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
borderRadius: "100%",
|
407
|
-
overflow: "hidden",
|
408
|
-
}}
|
409
|
-
>
|
410
|
-
{ensAvatarQuery.data ? (
|
411
|
-
<img
|
412
|
-
src={ensAvatarQuery.data}
|
413
|
-
style={{
|
414
|
-
width: iconSize.xxl,
|
415
|
-
height: iconSize.xxl,
|
416
|
-
}}
|
417
|
-
alt=""
|
418
|
-
/>
|
419
|
-
) : (
|
420
|
-
activeAccount && (
|
421
|
-
<Blobbie
|
422
|
-
address={activeAccount.address}
|
423
|
-
size={Number(iconSize.xxl)}
|
424
|
-
/>
|
425
|
-
)
|
426
|
-
)}
|
427
|
-
</Container>
|
428
|
-
<Container
|
429
|
-
style={{
|
430
|
-
position: "absolute",
|
431
|
-
bottom: -2,
|
432
|
-
right: -2,
|
433
|
-
}}
|
434
|
-
>
|
435
|
-
<IconContainer
|
436
|
-
style={{
|
437
|
-
background: theme.colors.modalBg,
|
438
|
-
}}
|
439
|
-
padding="4px"
|
440
|
-
>
|
441
|
-
{activeWallet && (
|
442
|
-
<WalletImage
|
443
|
-
style={{ borderRadius: 0 }}
|
444
|
-
id={activeWallet.id}
|
445
|
-
client={client}
|
446
|
-
size="12"
|
447
|
-
/>
|
448
|
-
)}
|
449
|
-
</IconContainer>
|
450
|
-
</Container>
|
451
|
-
</Container>
|
452
|
-
</div>
|
453
|
-
</ToolTip>
|
454
|
-
|
455
|
+
{avatarContent}
|
456
|
+
</div>
|
457
|
+
</ToolTip>
|
458
|
+
)}
|
455
459
|
<Container flex="column" gap="3xs">
|
456
460
|
<div
|
457
461
|
style={{
|
@@ -909,6 +913,10 @@ function DetailsModal(props: {
|
|
909
913
|
);
|
910
914
|
}
|
911
915
|
|
916
|
+
function formatBalanceOnButton(num: number) {
|
917
|
+
return formatNumber(num, num < 1 ? 5 : 4);
|
918
|
+
}
|
919
|
+
|
912
920
|
const WalletInfoButton = /* @__PURE__ */ StyledButton((_) => {
|
913
921
|
const theme = useCustomTheme();
|
914
922
|
return {
|
@@ -1257,6 +1265,13 @@ export type UseWalletDetailsModalOptions = {
|
|
1257
1265
|
*/
|
1258
1266
|
hideDisconnect?: boolean;
|
1259
1267
|
|
1268
|
+
/**
|
1269
|
+
* Hide the "Switch Wallet" button in the Wallet Details Modal.
|
1270
|
+
*
|
1271
|
+
* By default it is `false`
|
1272
|
+
*/
|
1273
|
+
hideSwitchWallet?: boolean;
|
1274
|
+
|
1260
1275
|
/**
|
1261
1276
|
* Callback to be called when a wallet is disconnected by clicking the "Disconnect Wallet" button in the Wallet Details Modal.
|
1262
1277
|
*
|
@@ -1363,6 +1378,7 @@ export function useWalletDetailsModal() {
|
|
1363
1378
|
detailsModal={{
|
1364
1379
|
footer: props.footer,
|
1365
1380
|
hideDisconnect: props.hideDisconnect,
|
1381
|
+
hideSwitchWallet: props.hideSwitchWallet,
|
1366
1382
|
networkSelector: props.networkSelector,
|
1367
1383
|
payOptions: props.payOptions,
|
1368
1384
|
showTestnetFaucet: props.showTestnetFaucet,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { IconFC } from "../types.js";
|
2
|
+
|
3
|
+
export const JPYIcon: IconFC = (props) => {
|
4
|
+
return (
|
5
|
+
<svg
|
6
|
+
width={props.size}
|
7
|
+
height={props.size}
|
8
|
+
viewBox="0 0 32 32"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
role="presentation"
|
11
|
+
>
|
12
|
+
<g fill="none" fill-rule="evenodd">
|
13
|
+
<circle cx="16" cy="16" fill="#a81b1b" r="16" />
|
14
|
+
<path
|
15
|
+
d="M17.548 18.711v1.878h5.063v2.288h-5.063V25.5h-3.096v-2.623H9.389v-2.288h5.063v-1.878H9.389v-2.288h4.171L7.5 7.5h3.752l4.8 7.534L20.853 7.5H24.5l-6.086 8.923h4.197v2.288z"
|
16
|
+
fill="#ffffff"
|
17
|
+
/>
|
18
|
+
</g>
|
19
|
+
</svg>
|
20
|
+
);
|
21
|
+
};
|
@@ -325,12 +325,19 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
325
325
|
onBack={goBack}
|
326
326
|
payer={payer}
|
327
327
|
client={props.client}
|
328
|
-
onDone={onDone}
|
329
328
|
chain={toChain}
|
330
329
|
token={toToken}
|
331
330
|
tokenAmount={tokenAmount}
|
332
331
|
receiverAddress={receiverAddress}
|
333
332
|
transactionMode={props.payOptions.mode === "transaction"}
|
333
|
+
isEmbed={props.isEmbed}
|
334
|
+
onDone={onDone}
|
335
|
+
onTryAgain={() => {
|
336
|
+
setScreen({
|
337
|
+
id: "buy-with-crypto",
|
338
|
+
});
|
339
|
+
}}
|
340
|
+
onSuccess={onSwapSuccess}
|
334
341
|
/>
|
335
342
|
);
|
336
343
|
}
|
@@ -2,23 +2,24 @@ import { RadiobuttonIcon } from "@radix-ui/react-icons";
|
|
2
2
|
import { CADIcon } from "../../../icons/currencies/CADIcon.js";
|
3
3
|
import { EURIcon } from "../../../icons/currencies/EURIcon.js";
|
4
4
|
import { GBPIcon } from "../../../icons/currencies/GBPIcon.js";
|
5
|
+
import { JPYIcon } from "../../../icons/currencies/JPYIcon.js";
|
5
6
|
import { USDIcon } from "../../../icons/currencies/USDIcon.js";
|
6
7
|
import type { IconFC } from "../../../icons/types.js";
|
7
8
|
|
8
9
|
export type CurrencyMeta = {
|
9
|
-
shorthand: "USD" | "CAD" | "GBP" | "EUR";
|
10
|
+
shorthand: "USD" | "CAD" | "GBP" | "EUR" | "JPY";
|
10
11
|
name: string;
|
11
12
|
icon: IconFC;
|
12
13
|
};
|
13
14
|
|
14
|
-
export const
|
15
|
+
export const usdCurrency: CurrencyMeta = {
|
15
16
|
shorthand: "USD",
|
16
17
|
name: "US Dollar",
|
17
18
|
icon: USDIcon,
|
18
19
|
};
|
19
20
|
|
20
21
|
export const currencies: CurrencyMeta[] = [
|
21
|
-
|
22
|
+
usdCurrency,
|
22
23
|
{
|
23
24
|
shorthand: "CAD",
|
24
25
|
name: "Canadian Dollar",
|
@@ -34,6 +35,11 @@ export const currencies: CurrencyMeta[] = [
|
|
34
35
|
name: "Euro",
|
35
36
|
icon: EURIcon,
|
36
37
|
},
|
38
|
+
{
|
39
|
+
shorthand: "JPY",
|
40
|
+
name: "Japanese Yen",
|
41
|
+
icon: JPYIcon,
|
42
|
+
},
|
37
43
|
];
|
38
44
|
|
39
45
|
export function getCurrencyMeta(shorthand: string): CurrencyMeta {
|
@@ -8,7 +8,11 @@ import type {
|
|
8
8
|
import { useActiveWalletChain } from "../../../../../../core/hooks/wallets/useActiveWalletChain.js";
|
9
9
|
import { useDebouncedValue } from "../../../../hooks/useDebouncedValue.js";
|
10
10
|
import { type ERC20OrNativeToken, NATIVE_TOKEN } from "../../nativeToken.js";
|
11
|
-
import {
|
11
|
+
import {
|
12
|
+
type CurrencyMeta,
|
13
|
+
currencies,
|
14
|
+
usdCurrency,
|
15
|
+
} from "../fiat/currencies.js";
|
12
16
|
import type { SupportedChainAndTokens } from "../swap/useSwapSupportedChains.js";
|
13
17
|
|
14
18
|
// handle states for token and chain selection
|
@@ -71,10 +75,17 @@ export function useUISelectionStates(options: {
|
|
71
75
|
);
|
72
76
|
|
73
77
|
// --------------------------------------------------------------------------
|
78
|
+
const devSpecifiedDefaultCurrency =
|
79
|
+
payOptions.buyWithFiat !== false
|
80
|
+
? payOptions.buyWithFiat?.prefillSource?.currency
|
81
|
+
: undefined;
|
82
|
+
|
83
|
+
const defaultSelectedCurrencyShorthand =
|
84
|
+
devSpecifiedDefaultCurrency || getDefaultCurrencyBasedOnLocation();
|
74
85
|
|
75
|
-
// stripe only supports USD, so not using a state right now
|
76
86
|
const [selectedCurrency, setSelectedCurrency] = useState(
|
77
|
-
|
87
|
+
currencies.find((x) => x.shorthand === defaultSelectedCurrencyShorthand) ||
|
88
|
+
usdCurrency,
|
78
89
|
);
|
79
90
|
|
80
91
|
return {
|
@@ -95,3 +106,36 @@ export function useUISelectionStates(options: {
|
|
95
106
|
setSelectedCurrency,
|
96
107
|
};
|
97
108
|
}
|
109
|
+
|
110
|
+
function getDefaultCurrencyBasedOnLocation(): CurrencyMeta["shorthand"] {
|
111
|
+
// if Intl is not supported - browser throws
|
112
|
+
try {
|
113
|
+
const timeZone = Intl.DateTimeFormat()
|
114
|
+
.resolvedOptions()
|
115
|
+
.timeZone.toLowerCase();
|
116
|
+
|
117
|
+
// Europe/London -> GBP
|
118
|
+
if (timeZone.includes("london")) {
|
119
|
+
return "GBP";
|
120
|
+
}
|
121
|
+
|
122
|
+
// Europe/* -> EUR
|
123
|
+
if (timeZone.includes("europe")) {
|
124
|
+
return "EUR";
|
125
|
+
}
|
126
|
+
|
127
|
+
// Japan
|
128
|
+
if (timeZone.includes("japan")) {
|
129
|
+
return "JPY";
|
130
|
+
}
|
131
|
+
|
132
|
+
// canada
|
133
|
+
if (timeZone.includes("canada")) {
|
134
|
+
return "CAD";
|
135
|
+
}
|
136
|
+
|
137
|
+
return "USD";
|
138
|
+
} catch {
|
139
|
+
return "USD";
|
140
|
+
}
|
141
|
+
}
|
@@ -100,7 +100,9 @@ export function SwapTxDetailsTable(
|
|
100
100
|
) {
|
101
101
|
let uiData: SwapTxDetailsData;
|
102
102
|
let showStatusRow = true;
|
103
|
+
let isTransfer = false;
|
103
104
|
if (props.type === "status") {
|
105
|
+
isTransfer = props.status.swapType === "TRANSFER";
|
104
106
|
const status = props.status;
|
105
107
|
if (props.hideStatusRow) {
|
106
108
|
showStatusRow = false;
|
@@ -189,6 +191,30 @@ export function SwapTxDetailsTable(
|
|
189
191
|
</>
|
190
192
|
);
|
191
193
|
|
194
|
+
if (isTransfer) {
|
195
|
+
return (
|
196
|
+
<div>
|
197
|
+
{/* source chain Tx hash link */}
|
198
|
+
{fromChainExplorers.explorers?.[0]?.url && sourceTxHash && (
|
199
|
+
<ButtonLink
|
200
|
+
fullWidth
|
201
|
+
variant="outline"
|
202
|
+
href={`${fromChainExplorers.explorers[0].url}/tx/${sourceTxHash}`}
|
203
|
+
target="_blank"
|
204
|
+
gap="xs"
|
205
|
+
style={{
|
206
|
+
fontSize: fontSize.sm,
|
207
|
+
padding: spacing.sm,
|
208
|
+
}}
|
209
|
+
>
|
210
|
+
View on {fromChainName.name} Explorer
|
211
|
+
<ExternalLinkIcon width={iconSize.sm} height={iconSize.sm} />
|
212
|
+
</ButtonLink>
|
213
|
+
)}
|
214
|
+
</div>
|
215
|
+
);
|
216
|
+
}
|
217
|
+
|
192
218
|
return (
|
193
219
|
<div>
|
194
220
|
{isPartialSuccess && gotToken ? (
|
@@ -26,7 +26,7 @@ export function SwapStatusScreen(props: {
|
|
26
26
|
onDone: () => void;
|
27
27
|
transactionMode: boolean;
|
28
28
|
isEmbed: boolean;
|
29
|
-
quote: BuyWithCryptoQuote;
|
29
|
+
quote: BuyWithCryptoQuote | undefined;
|
30
30
|
onSuccess: ((status: BuyWithCryptoStatus) => void) | undefined;
|
31
31
|
}) {
|
32
32
|
const { onSuccess } = props;
|
@@ -82,13 +82,13 @@ export function SwapStatusScreen(props: {
|
|
82
82
|
hideStatusRow={true}
|
83
83
|
client={props.client}
|
84
84
|
/>
|
85
|
-
) : (
|
85
|
+
) : props.quote ? (
|
86
86
|
<SwapTxDetailsTable
|
87
87
|
type="quote"
|
88
88
|
quote={props.quote}
|
89
89
|
client={props.client}
|
90
90
|
/>
|
91
|
-
);
|
91
|
+
) : null;
|
92
92
|
|
93
93
|
return (
|
94
94
|
<Container animate="fadein">
|