thirdweb 5.39.0 → 5.40.0
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/react.js +7 -2
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/react/core/design-system/index.js +2 -0
- package/dist/cjs/react/core/design-system/index.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +13 -94
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +16 -3
- package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/cjs/react/core/utils/defaultTokens.js +32 -25
- package/dist/cjs/react/core/utils/defaultTokens.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +91 -13
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +18 -127
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +7 -3
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +184 -118
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +104 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +69 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +23 -5
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +132 -45
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
- 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/BuyTxHistory.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
- 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/pay-transactions/TokenInfoRow.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +9 -5
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +8 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.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/TransferFlow.js +84 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +13 -7
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
- package/dist/cjs/react/web/ui/PayEmbed.js +16 -9
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +53 -0
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +33 -0
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +16 -5
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +18 -2
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/{openOauthSignInWindow.js → oauthSignIn.js} +2 -3
- package/dist/cjs/react/web/wallets/shared/oauthSignIn.js.map +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +15 -0
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +10 -0
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +2 -0
- 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 +9 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/get-url-token.js +26 -0
- package/dist/cjs/wallets/in-app/web/lib/get-url-token.js.map +1 -0
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +13 -3
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/exports/react.js +3 -1
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/react/core/design-system/index.js +2 -0
- package/dist/esm/react/core/design-system/index.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +13 -93
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +16 -3
- package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
- package/dist/esm/react/core/utils/defaultTokens.js +31 -25
- package/dist/esm/react/core/utils/defaultTokens.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +88 -13
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +20 -129
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +7 -3
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +188 -122
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js +101 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js +66 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +22 -5
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +4 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +130 -44
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js +2 -5
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +13 -8
- 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/BuyTxHistory.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +1 -1
- 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/pay-transactions/TokenInfoRow.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +7 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js +9 -4
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.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/TransferFlow.js +81 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js +14 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/nativeToken.js.map +1 -1
- package/dist/esm/react/web/ui/PayEmbed.js +16 -9
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +50 -0
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -0
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +29 -0
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +15 -4
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +17 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/{openOauthSignInWindow.js → oauthSignIn.js} +2 -3
- package/dist/esm/react/web/wallets/shared/oauthSignIn.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +15 -0
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +10 -0
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +2 -0
- 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 +7 -0
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/get-url-token.js +23 -0
- package/dist/esm/wallets/in-app/web/lib/get-url-token.js.map +1 -0
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +14 -4
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/types/exports/react.d.ts +3 -2
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/utils.d.ts +1 -0
- package/dist/types/exports/utils.d.ts.map +1 -1
- package/dist/types/react/core/design-system/index.d.ts +2 -0
- package/dist/types/react/core/design-system/index.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +80 -34
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -15
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/hooks/wallets/useAutoConnect.d.ts.map +1 -1
- package/dist/types/react/core/utils/defaultTokens.d.ts +222 -0
- package/dist/types/react/core/utils/defaultTokens.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts +43 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts +2 -4
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +3 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.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/screens/Buy/BuyScreen.d.ts +0 -3
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts +18 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts +18 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts +5 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +14 -8
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts +19 -9
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts +6 -5
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +0 -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/BuyTxHistory.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts +1 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -2
- 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/TransferFlow.d.ts +19 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/nativeToken.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +0 -6
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts +9 -0
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +24 -0
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -0
- 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/react/web/wallets/shared/{openOauthSignInWindow.d.ts → oauthSignIn.d.ts} +1 -2
- package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts.map +1 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +3 -0
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +4 -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 +4 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +10 -0
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +11 -2
- 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 +5 -0
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/get-url-token.d.ts +12 -0
- package/dist/types/wallets/in-app/web/lib/get-url-token.d.ts.map +1 -0
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +4 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/react.ts +14 -2
- package/src/exports/utils.ts +2 -0
- package/src/react/core/design-system/index.ts +2 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +103 -51
- package/src/react/core/hooks/transaction/useSendTransaction.ts +17 -127
- package/src/react/core/hooks/wallets/useAutoConnect.ts +17 -3
- package/src/react/core/utils/defaultTokens.ts +38 -26
- package/src/react/core/utils/wallet.ts +102 -18
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +34 -278
- package/src/react/web/ui/ConnectWallet/Details.tsx +6 -4
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +9 -3
- package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +347 -383
- package/src/react/web/ui/ConnectWallet/screens/Buy/DirectPaymentModeScreen.tsx +266 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/TransactionModeScreen.tsx +253 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx +52 -21
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +3 -6
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +5 -6
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +2 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +2 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +16 -12
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +155 -60
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useEnabledPaymentMethods.ts +8 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +17 -12
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.tsx +2 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TokenInfoRow.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +27 -19
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/Fees.tsx +8 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +12 -5
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +2 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +243 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx +30 -17
- package/src/react/web/ui/ConnectWallet/screens/nativeToken.ts +5 -1
- package/src/react/web/ui/PayEmbed.tsx +31 -32
- package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +127 -0
- package/src/react/web/ui/TransactionButton/TransactionModal.tsx +83 -0
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +18 -4
- package/src/react/web/wallets/shared/SocialLogin.tsx +20 -1
- package/src/react/web/wallets/shared/{openOauthSignInWindow.ts → oauthSignIn.ts} +1 -2
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +3 -0
- package/src/wallets/in-app/core/interfaces/connector.ts +6 -0
- package/src/wallets/in-app/core/wallet/index.ts +22 -0
- package/src/wallets/in-app/core/wallet/types.ts +4 -0
- package/src/wallets/in-app/web/in-app.ts +10 -0
- package/src/wallets/in-app/web/lib/auth/index.ts +14 -3
- package/src/wallets/in-app/web/lib/auth/oauth.ts +12 -0
- package/src/wallets/in-app/web/lib/get-url-token.ts +36 -0
- package/src/wallets/in-app/web/lib/web-connector.ts +18 -4
- package/dist/cjs/react/web/wallets/shared/openOauthSignInWindow.js.map +0 -1
- package/dist/esm/react/web/wallets/shared/openOauthSignInWindow.js.map +0 -1
- package/dist/types/react/web/wallets/shared/openOauthSignInWindow.d.ts.map +0 -1
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
iconSize,
|
14
14
|
} from "../../../../../../core/design-system/index.js";
|
15
15
|
import { useChainName } from "../../../../../../core/hooks/others/useChainQuery.js";
|
16
|
+
import { useEnsName } from "../../../../../../core/utils/wallet.js";
|
16
17
|
import { Skeleton } from "../../../../components/Skeleton.js";
|
17
18
|
import { Spacer } from "../../../../components/Spacer.js";
|
18
19
|
import { Spinner } from "../../../../components/Spinner.js";
|
@@ -61,6 +62,9 @@ export function SwapConfirmationScreen(props: {
|
|
61
62
|
|
62
63
|
const receiver = props.quote.swapDetails.toAddress;
|
63
64
|
const sender = props.quote.swapDetails.fromAddress;
|
65
|
+
const isDifferentRecipient = receiver.toLowerCase() !== sender.toLowerCase();
|
66
|
+
|
67
|
+
const ensName = useEnsName({ client: props.client, address: receiver });
|
64
68
|
|
65
69
|
return (
|
66
70
|
<Container p="lg">
|
@@ -93,15 +97,17 @@ export function SwapConfirmationScreen(props: {
|
|
93
97
|
</ConfirmItem>
|
94
98
|
|
95
99
|
{/* Receive */}
|
96
|
-
|
97
|
-
<
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
{!isDifferentRecipient && (
|
101
|
+
<ConfirmItem label="Receive">
|
102
|
+
<RenderTokenInfo
|
103
|
+
chain={props.toChain}
|
104
|
+
amount={String(formatNumber(Number(props.toAmount), 6))}
|
105
|
+
symbol={props.toTokenSymbol}
|
106
|
+
token={props.toToken}
|
107
|
+
client={props.client}
|
108
|
+
/>
|
109
|
+
</ConfirmItem>
|
110
|
+
)}
|
105
111
|
|
106
112
|
{/* Fees */}
|
107
113
|
<ConfirmItem label="Fees">
|
@@ -110,7 +116,7 @@ export function SwapConfirmationScreen(props: {
|
|
110
116
|
|
111
117
|
{/* Time */}
|
112
118
|
<ConfirmItem label="Time">
|
113
|
-
<Text color="primaryText">
|
119
|
+
<Text size="sm" color="primaryText">
|
114
120
|
~
|
115
121
|
{formatSeconds(
|
116
122
|
props.quote.swapDetails.estimated.durationSeconds || 0,
|
@@ -119,9 +125,11 @@ export function SwapConfirmationScreen(props: {
|
|
119
125
|
</ConfirmItem>
|
120
126
|
|
121
127
|
{/* Send to */}
|
122
|
-
{
|
123
|
-
<ConfirmItem label="
|
124
|
-
<Text color="primaryText">
|
128
|
+
{isDifferentRecipient && (
|
129
|
+
<ConfirmItem label="Seller">
|
130
|
+
<Text color="primaryText" size="sm">
|
131
|
+
{ensName.data || shortenAddress(receiver)}
|
132
|
+
</Text>
|
125
133
|
</ConfirmItem>
|
126
134
|
)}
|
127
135
|
|
@@ -252,7 +260,7 @@ export function SwapConfirmationScreen(props: {
|
|
252
260
|
);
|
253
261
|
}
|
254
262
|
|
255
|
-
const ConnectorLine = /* @__PURE__ */ StyledDiv(() => {
|
263
|
+
export const ConnectorLine = /* @__PURE__ */ StyledDiv(() => {
|
256
264
|
const theme = useCustomTheme();
|
257
265
|
return {
|
258
266
|
height: "4px",
|
@@ -278,21 +286,21 @@ function RenderTokenInfo(props: {
|
|
278
286
|
}}
|
279
287
|
>
|
280
288
|
<Container flex="row" center="y" gap="xs">
|
281
|
-
<Text color="primaryText" size="
|
289
|
+
<Text color="primaryText" size="sm">
|
282
290
|
{props.amount} {props.symbol}
|
283
291
|
</Text>
|
284
292
|
<PayTokenIcon
|
285
293
|
token={props.token}
|
286
294
|
chain={props.chain}
|
287
|
-
size="
|
295
|
+
size="xs"
|
288
296
|
client={props.client}
|
289
297
|
/>
|
290
298
|
</Container>
|
291
299
|
|
292
300
|
{name ? (
|
293
|
-
<Text size="
|
301
|
+
<Text size="xs">{name}</Text>
|
294
302
|
) : (
|
295
|
-
<Skeleton width={"100px"} height={fontSize.
|
303
|
+
<Skeleton width={"100px"} height={fontSize.xs} />
|
296
304
|
)}
|
297
305
|
</Container>
|
298
306
|
);
|
@@ -312,7 +320,7 @@ function ConfirmItem(props: {
|
|
312
320
|
justifyContent: "space-between",
|
313
321
|
}}
|
314
322
|
>
|
315
|
-
<Text size="
|
323
|
+
<Text size="sm" color="secondaryText">
|
316
324
|
{props.label}
|
317
325
|
</Text>
|
318
326
|
{props.children}
|
@@ -25,15 +25,19 @@ export function SwapFees(props: {
|
|
25
25
|
return (
|
26
26
|
<Container
|
27
27
|
key={`${fee.token.chainId}_${fee.token.tokenAddress}_${feeAmount}`}
|
28
|
-
flex="
|
28
|
+
flex="column"
|
29
29
|
gap="xxs"
|
30
30
|
>
|
31
|
-
<Text color="primaryText" size="sm">
|
31
|
+
<Text color="primaryText" size="sm" style={{ textAlign: "right" }}>
|
32
32
|
{feeAmount === 0 ? "~" : ""}
|
33
33
|
{feeAmount} {fee.token.symbol}
|
34
34
|
</Text>
|
35
|
-
<Text
|
36
|
-
|
35
|
+
<Text
|
36
|
+
color="secondaryText"
|
37
|
+
size="xs"
|
38
|
+
style={{ textAlign: "right" }}
|
39
|
+
>
|
40
|
+
${(fee.amountUSDCents / 100).toFixed(2)}
|
37
41
|
</Text>
|
38
42
|
</Container>
|
39
43
|
);
|
@@ -6,6 +6,7 @@ import type { Account } from "../../../../../../../wallets/interfaces/wallet.js"
|
|
6
6
|
import {
|
7
7
|
fontSize,
|
8
8
|
iconSize,
|
9
|
+
radius,
|
9
10
|
spacing,
|
10
11
|
} from "../../../../../../core/design-system/index.js";
|
11
12
|
import { useChainName } from "../../../../../../core/hooks/others/useChainQuery.js";
|
@@ -36,6 +37,7 @@ export function PayWithCrypto(props: {
|
|
36
37
|
client: ThirdwebClient;
|
37
38
|
freezeChainAndTokenSelection?: boolean;
|
38
39
|
payerAccount: Account;
|
40
|
+
swapRequired: boolean;
|
39
41
|
}) {
|
40
42
|
const { name } = useChainName(props.chain);
|
41
43
|
|
@@ -55,11 +57,16 @@ export function PayWithCrypto(props: {
|
|
55
57
|
borderWidth: "1px",
|
56
58
|
borderTopWidth: 0,
|
57
59
|
borderStyle: "solid",
|
58
|
-
borderBottom: "none",
|
59
60
|
flexWrap: "nowrap",
|
60
61
|
justifyContent: "space-between",
|
61
62
|
minHeight: "64px",
|
62
63
|
alignItems: "center",
|
64
|
+
...(props.swapRequired
|
65
|
+
? { borderBottom: "none" }
|
66
|
+
: {
|
67
|
+
borderBottomLeftRadius: radius.md,
|
68
|
+
borderBottomRightRadius: radius.md,
|
69
|
+
}),
|
63
70
|
}}
|
64
71
|
>
|
65
72
|
{/* Left */}
|
@@ -81,13 +88,13 @@ export function PayWithCrypto(props: {
|
|
81
88
|
size="md"
|
82
89
|
client={props.client}
|
83
90
|
/>
|
84
|
-
<Container flex="column" gap="
|
91
|
+
<Container flex="column" gap="3xs">
|
85
92
|
<Container flex="row" gap="xs" center="y" color="primaryText">
|
86
93
|
<TokenSymbol token={props.token} chain={props.chain} size="sm" />
|
87
94
|
<ChevronDownIcon width={iconSize.sm} height={iconSize.sm} />
|
88
95
|
</Container>
|
89
96
|
{name ? (
|
90
|
-
<Text size="xs">
|
97
|
+
<Text size="xs">{name}</Text>
|
91
98
|
) : (
|
92
99
|
<Skeleton width="90px" height={fontSize.xs} />
|
93
100
|
)}
|
@@ -118,7 +125,7 @@ export function PayWithCrypto(props: {
|
|
118
125
|
color={props.value ? "primaryText" : "secondaryText"}
|
119
126
|
style={{}}
|
120
127
|
>
|
121
|
-
{formatNumber(Number(props.value), 6) || "
|
128
|
+
{formatNumber(Number(props.value), 6) || ""}
|
122
129
|
</Text>
|
123
130
|
)}
|
124
131
|
|
@@ -126,7 +133,7 @@ export function PayWithCrypto(props: {
|
|
126
133
|
<GenericWalletIcon size={fontSize.xs} />
|
127
134
|
{balanceQuery.data ? (
|
128
135
|
<Text size="xs" color="secondaryText" weight={500}>
|
129
|
-
{formatTokenBalance(balanceQuery.data,
|
136
|
+
{formatTokenBalance(balanceQuery.data, false)}
|
130
137
|
</Text>
|
131
138
|
) : (
|
132
139
|
<Skeleton width="70px" height={fontSize.xs} />
|
@@ -14,12 +14,11 @@ type SwapFlowProps = {
|
|
14
14
|
onBack?: () => void;
|
15
15
|
buyWithCryptoQuote: BuyWithCryptoQuote;
|
16
16
|
payer: PayerInfo;
|
17
|
-
onViewPendingTx: () => void;
|
18
17
|
client: ThirdwebClient;
|
19
18
|
isFiatFlow: boolean;
|
20
19
|
onDone: () => void;
|
21
20
|
onTryAgain: () => void;
|
22
|
-
|
21
|
+
transactionMode: boolean;
|
23
22
|
isEmbed: boolean;
|
24
23
|
};
|
25
24
|
|
@@ -79,11 +78,10 @@ export function SwapFlow(props: SwapFlowProps) {
|
|
79
78
|
title={props.title}
|
80
79
|
onBack={props.onBack}
|
81
80
|
onTryAgain={props.onTryAgain}
|
82
|
-
onViewPendingTx={props.onViewPendingTx}
|
83
81
|
swapTxHash={swapTxHash}
|
84
82
|
client={props.client}
|
85
83
|
onDone={props.onDone}
|
86
|
-
|
84
|
+
transactionMode={props.transactionMode}
|
87
85
|
isEmbed={props.isEmbed}
|
88
86
|
quote={quote}
|
89
87
|
/>
|
@@ -19,12 +19,11 @@ type UIStatus = "pending" | "success" | "failed" | "partialSuccess";
|
|
19
19
|
export function SwapStatusScreen(props: {
|
20
20
|
title: string;
|
21
21
|
onBack?: () => void;
|
22
|
-
onViewPendingTx: () => void;
|
23
22
|
swapTxHash: string;
|
24
23
|
client: ThirdwebClient;
|
25
24
|
onTryAgain: () => void;
|
26
25
|
onDone: () => void;
|
27
|
-
|
26
|
+
transactionMode: boolean;
|
28
27
|
isEmbed: boolean;
|
29
28
|
quote: BuyWithCryptoQuote;
|
30
29
|
}) {
|
@@ -91,7 +90,7 @@ export function SwapStatusScreen(props: {
|
|
91
90
|
/>
|
92
91
|
<Spacer y="sm" />
|
93
92
|
<Text color={"primaryText"} size="lg">
|
94
|
-
Buy
|
93
|
+
Buy Complete
|
95
94
|
</Text>
|
96
95
|
</Container>
|
97
96
|
|
@@ -100,7 +99,7 @@ export function SwapStatusScreen(props: {
|
|
100
99
|
<Spacer y="sm" />
|
101
100
|
{!props.isEmbed && (
|
102
101
|
<Button variant="accent" fullWidth onClick={props.onDone}>
|
103
|
-
{props.
|
102
|
+
{props.transactionMode ? "Continue Transaction" : "Done"}
|
104
103
|
</Button>
|
105
104
|
)}
|
106
105
|
</>
|
@@ -0,0 +1,243 @@
|
|
1
|
+
import { CheckCircledIcon, CrossCircledIcon } from "@radix-ui/react-icons";
|
2
|
+
import { useState } from "react";
|
3
|
+
import type { Chain } from "../../../../../../../chains/types.js";
|
4
|
+
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
5
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
6
|
+
import { getContract } from "../../../../../../../contract/contract.js";
|
7
|
+
import { transfer } from "../../../../../../../extensions/erc20/write/transfer.js";
|
8
|
+
import { sendAndConfirmTransaction } from "../../../../../../../transaction/actions/send-and-confirm-transaction.js";
|
9
|
+
import { prepareTransaction } from "../../../../../../../transaction/prepare-transaction.js";
|
10
|
+
import { toWei } from "../../../../../../../utils/units.js";
|
11
|
+
import { iconSize } from "../../../../../../core/design-system/index.js";
|
12
|
+
import { useChainSymbol } from "../../../../../../core/hooks/others/useChainQuery.js";
|
13
|
+
import { Spacer } from "../../../../components/Spacer.js";
|
14
|
+
import { Spinner } from "../../../../components/Spinner.js";
|
15
|
+
import { StepBar } from "../../../../components/StepBar.js";
|
16
|
+
import { SwitchNetworkButton } from "../../../../components/SwitchNetwork.js";
|
17
|
+
import { Container, Line, ModalHeader } from "../../../../components/basic.js";
|
18
|
+
import { Button } from "../../../../components/buttons.js";
|
19
|
+
import { Text } from "../../../../components/text.js";
|
20
|
+
import { type ERC20OrNativeToken, isNativeToken } from "../../nativeToken.js";
|
21
|
+
import { Step } from "../Stepper.js";
|
22
|
+
import { WalletRow } from "../WalletSelectorButton.js";
|
23
|
+
import { TokenInfoRow } from "../pay-transactions/TokenInfoRow.js";
|
24
|
+
import type { PayerInfo } from "../types.js";
|
25
|
+
import { ConnectorLine } from "./ConfirmationScreen.js";
|
26
|
+
|
27
|
+
type TrasnferFlowProps = {
|
28
|
+
title: string;
|
29
|
+
onBack?: () => void;
|
30
|
+
payer: PayerInfo;
|
31
|
+
receiverAddress: string;
|
32
|
+
client: ThirdwebClient;
|
33
|
+
onDone: () => void;
|
34
|
+
chain: Chain;
|
35
|
+
token: ERC20OrNativeToken;
|
36
|
+
tokenAmount: string;
|
37
|
+
transactionMode?: boolean;
|
38
|
+
};
|
39
|
+
|
40
|
+
export function TransferFlow(props: TrasnferFlowProps) {
|
41
|
+
const {
|
42
|
+
title,
|
43
|
+
onBack,
|
44
|
+
receiverAddress,
|
45
|
+
client,
|
46
|
+
payer,
|
47
|
+
onDone,
|
48
|
+
chain,
|
49
|
+
token,
|
50
|
+
tokenAmount,
|
51
|
+
transactionMode,
|
52
|
+
} = props;
|
53
|
+
const [step, setStep] = useState<"transfer" | "execute">("transfer");
|
54
|
+
const [status, setStatus] = useState<"idle" | "pending" | "error" | "done">(
|
55
|
+
"idle",
|
56
|
+
);
|
57
|
+
const { symbol } = useChainSymbol(chain);
|
58
|
+
|
59
|
+
return (
|
60
|
+
<Container p="lg">
|
61
|
+
<ModalHeader title={title} onBack={onBack} />
|
62
|
+
<Spacer y="xl" />
|
63
|
+
|
64
|
+
{transactionMode && (
|
65
|
+
<>
|
66
|
+
<StepBar steps={2} currentStep={step === "transfer" ? 1 : 2} />
|
67
|
+
<Spacer y="sm" />
|
68
|
+
<Text size="sm">
|
69
|
+
{step === "transfer"
|
70
|
+
? "Step 1 of 2 - Transfer funds"
|
71
|
+
: "Step 2 of 2 - Finalize transaction"}
|
72
|
+
</Text>
|
73
|
+
<Spacer y="xl" />
|
74
|
+
</>
|
75
|
+
)}
|
76
|
+
|
77
|
+
{/* Sender Address */}
|
78
|
+
<Container
|
79
|
+
flex="row"
|
80
|
+
center="y"
|
81
|
+
style={{
|
82
|
+
justifyContent: "space-between",
|
83
|
+
}}
|
84
|
+
>
|
85
|
+
<Text size="sm">From</Text>
|
86
|
+
<WalletRow address={payer.account.address} client={client} />
|
87
|
+
</Container>
|
88
|
+
|
89
|
+
<Spacer y="md" />
|
90
|
+
<Line />
|
91
|
+
<Spacer y="md" />
|
92
|
+
|
93
|
+
{/* Receiver Address */}
|
94
|
+
<Container
|
95
|
+
flex="row"
|
96
|
+
center="y"
|
97
|
+
style={{
|
98
|
+
justifyContent: "space-between",
|
99
|
+
}}
|
100
|
+
>
|
101
|
+
<Text size="sm">To</Text>
|
102
|
+
<WalletRow address={receiverAddress} client={client} />
|
103
|
+
</Container>
|
104
|
+
|
105
|
+
<Spacer y="md" />
|
106
|
+
<Line />
|
107
|
+
<Spacer y="md" />
|
108
|
+
|
109
|
+
{/* Token Info */}
|
110
|
+
<TokenInfoRow
|
111
|
+
chainId={chain.id}
|
112
|
+
client={client}
|
113
|
+
label={"Amount"}
|
114
|
+
tokenAmount={tokenAmount}
|
115
|
+
tokenSymbol={isNativeToken(token) ? symbol || "" : token.symbol}
|
116
|
+
tokenAddress={
|
117
|
+
isNativeToken(token) ? NATIVE_TOKEN_ADDRESS : token.address
|
118
|
+
}
|
119
|
+
/>
|
120
|
+
|
121
|
+
<Spacer y="lg" />
|
122
|
+
|
123
|
+
{transactionMode && (
|
124
|
+
<>
|
125
|
+
<Spacer y="sm" />
|
126
|
+
<Container
|
127
|
+
gap="sm"
|
128
|
+
flex="row"
|
129
|
+
style={{
|
130
|
+
justifyContent: "space-between",
|
131
|
+
}}
|
132
|
+
center="y"
|
133
|
+
color="accentText"
|
134
|
+
>
|
135
|
+
<Step
|
136
|
+
isDone={step === "execute"}
|
137
|
+
isActive={step === "transfer"}
|
138
|
+
label={step === "transfer" ? "Transfer" : "Done"}
|
139
|
+
/>
|
140
|
+
<ConnectorLine />
|
141
|
+
<Step
|
142
|
+
isDone={false}
|
143
|
+
label="Finalize"
|
144
|
+
isActive={step === "execute"}
|
145
|
+
/>
|
146
|
+
</Container>
|
147
|
+
<Spacer y="lg" />
|
148
|
+
</>
|
149
|
+
)}
|
150
|
+
|
151
|
+
{status === "error" && (
|
152
|
+
<>
|
153
|
+
<Container flex="row" gap="xs" center="both" color="danger">
|
154
|
+
<CrossCircledIcon width={iconSize.sm} height={iconSize.sm} />
|
155
|
+
<Text color="danger" size="sm">
|
156
|
+
{step === "transfer" ? "Failed to Transfer" : "Failed to Execute"}
|
157
|
+
</Text>
|
158
|
+
</Container>
|
159
|
+
<Spacer y="md" />
|
160
|
+
</>
|
161
|
+
)}
|
162
|
+
|
163
|
+
{!transactionMode && step === "execute" && status === "done" && (
|
164
|
+
<>
|
165
|
+
<Container flex="row" gap="xs" center="both" color="success">
|
166
|
+
<CheckCircledIcon width={iconSize.sm} height={iconSize.sm} />
|
167
|
+
<Text color="success" size="sm">
|
168
|
+
{"Payment completed"}
|
169
|
+
</Text>
|
170
|
+
</Container>
|
171
|
+
<Spacer y="md" />
|
172
|
+
</>
|
173
|
+
)}
|
174
|
+
|
175
|
+
{/* Execute */}
|
176
|
+
{payer.chain.id !== chain.id ? (
|
177
|
+
<SwitchNetworkButton
|
178
|
+
fullWidth
|
179
|
+
variant="accent"
|
180
|
+
switchChain={async () => {
|
181
|
+
await props.payer.wallet.switchChain(chain);
|
182
|
+
}}
|
183
|
+
/>
|
184
|
+
) : (
|
185
|
+
<Button
|
186
|
+
variant="accent"
|
187
|
+
fullWidth
|
188
|
+
disabled={status === "pending"}
|
189
|
+
onClick={async () => {
|
190
|
+
if (step === "execute") {
|
191
|
+
onDone();
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
|
195
|
+
try {
|
196
|
+
setStatus("pending");
|
197
|
+
|
198
|
+
const transaction = isNativeToken(token)
|
199
|
+
? prepareTransaction({
|
200
|
+
client,
|
201
|
+
chain,
|
202
|
+
to: receiverAddress,
|
203
|
+
value: toWei(tokenAmount),
|
204
|
+
})
|
205
|
+
: transfer({
|
206
|
+
contract: getContract({
|
207
|
+
address: token.address,
|
208
|
+
chain: chain,
|
209
|
+
client: client,
|
210
|
+
}),
|
211
|
+
to: receiverAddress,
|
212
|
+
amount: tokenAmount,
|
213
|
+
});
|
214
|
+
|
215
|
+
await sendAndConfirmTransaction({
|
216
|
+
account: props.payer.account,
|
217
|
+
transaction,
|
218
|
+
});
|
219
|
+
|
220
|
+
setStep("execute");
|
221
|
+
if (transactionMode) {
|
222
|
+
setStatus("idle");
|
223
|
+
} else {
|
224
|
+
setStatus("done");
|
225
|
+
}
|
226
|
+
} catch (e) {
|
227
|
+
console.error(e);
|
228
|
+
setStatus("error");
|
229
|
+
}
|
230
|
+
}}
|
231
|
+
gap="xs"
|
232
|
+
>
|
233
|
+
{step === "execute" && (status === "done" ? "Done" : "Continue")}
|
234
|
+
{step === "transfer" &&
|
235
|
+
(status === "pending" ? "Confirming" : "Confirm")}
|
236
|
+
{status === "pending" && (
|
237
|
+
<Spinner size="sm" color="accentButtonText" />
|
238
|
+
)}
|
239
|
+
</Button>
|
240
|
+
)}
|
241
|
+
</Container>
|
242
|
+
);
|
243
|
+
}
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import { PlusIcon } from "@radix-ui/react-icons";
|
2
2
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
3
3
|
import type { Wallet } from "../../../../../../../wallets/interfaces/wallet.js";
|
4
|
-
import {
|
4
|
+
import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
|
5
|
+
import {
|
6
|
+
iconSize,
|
7
|
+
radius,
|
8
|
+
spacing,
|
9
|
+
} from "../../../../../../core/design-system/index.js";
|
5
10
|
import { useConnectedWallets } from "../../../../../hooks/wallets/useConnectedWallets.js";
|
6
11
|
import { Spacer } from "../../../../components/Spacer.js";
|
7
12
|
import { Container } from "../../../../components/basic.js";
|
@@ -18,6 +23,7 @@ export function WalletSwitcherDrawerContent(props: {
|
|
18
23
|
onConnect: () => void;
|
19
24
|
selectedAddress: string;
|
20
25
|
}) {
|
26
|
+
const theme = useCustomTheme();
|
21
27
|
const connectedWallets = useConnectedWallets();
|
22
28
|
|
23
29
|
// if all wallets are connected and showAll wallets is disabled, hide the connect button
|
@@ -27,12 +33,6 @@ export function WalletSwitcherDrawerContent(props: {
|
|
27
33
|
|
28
34
|
return (
|
29
35
|
<Container>
|
30
|
-
<Text size="lg" color="primaryText">
|
31
|
-
Pay with
|
32
|
-
</Text>
|
33
|
-
|
34
|
-
<Spacer y="lg" />
|
35
|
-
|
36
36
|
<Container flex="column" gap="xs">
|
37
37
|
{connectedWallets.map((w) => {
|
38
38
|
const address = w.getAccount()?.address;
|
@@ -47,20 +47,33 @@ export function WalletSwitcherDrawerContent(props: {
|
|
47
47
|
props.onBack();
|
48
48
|
}}
|
49
49
|
disableChevron
|
50
|
-
checked={
|
50
|
+
checked={false}
|
51
51
|
/>
|
52
52
|
);
|
53
53
|
})}
|
54
|
+
{!hideConnectButton && (
|
55
|
+
<Button
|
56
|
+
variant="secondary"
|
57
|
+
fullWidth
|
58
|
+
onClick={props.onConnect}
|
59
|
+
gap="xs"
|
60
|
+
bg="tertiaryBg"
|
61
|
+
style={{
|
62
|
+
borderRadius: radius.lg,
|
63
|
+
border: `1px solid ${theme.colors.borderColor}`,
|
64
|
+
padding: spacing.sm,
|
65
|
+
}}
|
66
|
+
>
|
67
|
+
<Container flex="row" gap="sm" center="y" expand>
|
68
|
+
<PlusIcon width={iconSize.md} height={iconSize.md} />
|
69
|
+
<Text size="sm" color="primaryText">
|
70
|
+
Add Another Wallet
|
71
|
+
</Text>
|
72
|
+
</Container>
|
73
|
+
</Button>
|
74
|
+
)}
|
54
75
|
</Container>
|
55
|
-
|
56
|
-
<Spacer y="xxl" />
|
57
|
-
|
58
|
-
{!hideConnectButton && (
|
59
|
-
<Button variant="accent" fullWidth onClick={props.onConnect} gap="xs">
|
60
|
-
<PlusIcon width={iconSize.sm} height={iconSize.sm} />
|
61
|
-
Connect Wallet
|
62
|
-
</Button>
|
63
|
-
)}
|
76
|
+
<Spacer y="sm" />
|
64
77
|
</Container>
|
65
78
|
);
|
66
79
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { NATIVE_TOKEN_ADDRESS } from "../../../../../constants/addresses.js";
|
1
2
|
import type { TokenInfo } from "../../../../core/utils/defaultTokens.js";
|
2
3
|
|
3
4
|
export type NativeToken = { nativeToken: true };
|
@@ -10,7 +11,10 @@ export const NATIVE_TOKEN: NativeToken = { nativeToken: true };
|
|
10
11
|
export function isNativeToken(
|
11
12
|
token: Partial<TokenInfo> | NativeToken,
|
12
13
|
): token is NativeToken {
|
13
|
-
return
|
14
|
+
return (
|
15
|
+
"nativeToken" in token ||
|
16
|
+
token.address?.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase()
|
17
|
+
);
|
14
18
|
}
|
15
19
|
|
16
20
|
export type ERC20OrNativeToken = TokenInfo | NativeToken;
|