thirdweb 5.32.2-nightly-a6ed6e66dae7f2fa239c76a57e93b545e5d8da8d-20240704000330 → 5.32.2
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/gas/fee-data.js +13 -6
- package/dist/cjs/gas/fee-data.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +1 -0
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js +5 -0
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/react/core/hooks/auth/useSiweAuth.js +4 -1
- package/dist/cjs/react/core/hooks/auth/useSiweAuth.js.map +1 -1
- package/dist/cjs/react/native/ui/components/Header.js +1 -1
- package/dist/cjs/react/native/ui/components/Header.js.map +1 -1
- package/dist/cjs/react/native/ui/components/button.js +1 -1
- package/dist/cjs/react/native/ui/components/button.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectButton.js +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +7 -8
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/InAppWalletUI.js +1 -1
- package/dist/cjs/react/native/ui/connect/InAppWalletUI.js.map +1 -1
- package/dist/cjs/react/native/ui/icons/svgs.js +5 -5
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +2 -2
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +12 -2
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +19 -5
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.js +5 -4
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +5 -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 +11 -7
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalInline.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalInline.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.js +12 -12
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletEntryButton.js +3 -5
- package/dist/cjs/react/web/ui/ConnectWallet/WalletEntryButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js +24 -14
- package/dist/cjs/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +144 -87
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.js +49 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +32 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +1 -1
- 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 +1 -1
- 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/FiatTxDetailsTable.js +6 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -4
- 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/swap/ConfirmationScreen.js +18 -17
- 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/PayWithCrypto.js +2 -6
- 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/WalletSwitcherDrawerContent.js +26 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +12 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +8 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/types.js +3 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/types.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js +55 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.js +78 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js +3 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js +31 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/PayEmbed.js +3 -17
- package/dist/cjs/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/cjs/react/web/ui/components/CopyIcon.js +1 -1
- package/dist/cjs/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/cjs/react/web/ui/components/Drawer.js +51 -17
- package/dist/cjs/react/web/ui/components/Drawer.js.map +1 -1
- package/dist/cjs/react/web/ui/components/SwitchNetwork.js +1 -3
- package/dist/cjs/react/web/ui/components/SwitchNetwork.js.map +1 -1
- package/dist/cjs/react/web/ui/components/WalletImage.js +1 -0
- package/dist/cjs/react/web/ui/components/WalletImage.js.map +1 -1
- package/dist/cjs/react/web/ui/components/buttons.js +5 -1
- package/dist/cjs/react/web/ui/components/buttons.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +2 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +2 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletSelectionUI.js +2 -2
- package/dist/cjs/react/web/wallets/in-app/InAppWalletSelectionUI.js.map +1 -1
- package/dist/cjs/utils/formatNumber.js +4 -1
- package/dist/cjs/utils/formatNumber.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/gas/fee-data.js +13 -6
- package/dist/esm/gas/fee-data.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -0
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js +5 -0
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/react/core/hooks/auth/useSiweAuth.js +4 -1
- package/dist/esm/react/core/hooks/auth/useSiweAuth.js.map +1 -1
- package/dist/esm/react/native/ui/components/Header.js +1 -1
- package/dist/esm/react/native/ui/components/Header.js.map +1 -1
- package/dist/esm/react/native/ui/components/button.js +1 -1
- package/dist/esm/react/native/ui/components/button.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectButton.js +1 -1
- package/dist/esm/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +8 -9
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/InAppWalletUI.js +1 -1
- package/dist/esm/react/native/ui/connect/InAppWalletUI.js.map +1 -1
- package/dist/esm/react/native/ui/icons/svgs.js +5 -5
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +2 -2
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +12 -2
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +20 -6
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.js +5 -4
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectEmbed.js +2 -2
- 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 +11 -7
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalInline.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalInline.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.js +12 -12
- package/dist/esm/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletEntryButton.js +2 -4
- package/dist/esm/react/web/ui/ConnectWallet/WalletEntryButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js +25 -15
- package/dist/esm/react/web/ui/ConnectWallet/WalletSelector.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/es.js +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +145 -88
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.js +46 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js +29 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +1 -1
- 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 +1 -1
- 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/FiatTxDetailsTable.js +6 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +2 -4
- 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/swap/ConfirmationScreen.js +18 -17
- 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/PayWithCrypto.js +3 -7
- 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/WalletSwitcherDrawerContent.js +23 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +12 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js +8 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/types.js +2 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/types.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js +52 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.js +75 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js +4 -5
- package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js +28 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.js.map +1 -0
- package/dist/esm/react/web/ui/PayEmbed.js +3 -17
- package/dist/esm/react/web/ui/PayEmbed.js.map +1 -1
- package/dist/esm/react/web/ui/components/CopyIcon.js +1 -1
- package/dist/esm/react/web/ui/components/CopyIcon.js.map +1 -1
- package/dist/esm/react/web/ui/components/Drawer.js +54 -20
- package/dist/esm/react/web/ui/components/Drawer.js.map +1 -1
- package/dist/esm/react/web/ui/components/SwitchNetwork.js +1 -3
- package/dist/esm/react/web/ui/components/SwitchNetwork.js.map +1 -1
- package/dist/esm/react/web/ui/components/WalletImage.js +1 -0
- package/dist/esm/react/web/ui/components/WalletImage.js.map +1 -1
- package/dist/esm/react/web/ui/components/buttons.js +5 -1
- package/dist/esm/react/web/ui/components/buttons.js.map +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +2 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +2 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletSelectionUI.js +2 -2
- package/dist/esm/react/web/wallets/in-app/InAppWalletSelectionUI.js.map +1 -1
- package/dist/esm/utils/formatNumber.js +4 -1
- package/dist/esm/utils/formatNumber.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/gas/fee-data.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts +5 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getPostOnRampQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +4 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/auth/useSiweAuth.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/Header.d.ts +1 -1
- package/dist/types/react/native/ui/components/Header.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/button.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/InAppWalletUI.d.ts.map +1 -1
- package/dist/types/react/native/ui/icons/svgs.d.ts +3 -3
- package/dist/types/react/native/ui/icons/svgs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +21 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/AllWalletsUI.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.d.ts +0 -2
- package/dist/types/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectEmbed.d.ts +6 -0
- 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.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModalContent.d.ts +7 -3
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModalContent.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.d.ts +0 -2
- package/dist/types/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletEntryButton.d.ts +3 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletEntryButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/WalletSelector.d.ts +7 -5
- package/dist/types/react/web/ui/ConnectWallet/WalletSelector.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/en.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/es.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/ja.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/tl.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/types.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts +5 -4
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.d.ts +8 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts +13 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts +2 -0
- 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/FiatTxDetailsTable.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +2 -0
- 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 +2 -0
- 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 +12 -3
- 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/swap/ConfirmationScreen.d.ts +2 -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/PayWithCrypto.d.ts +2 -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 +2 -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/WalletSwitcherDrawerContent.d.ts +12 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/types.d.ts +9 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/types.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.d.ts +9 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/SignatureScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/SignatureScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.d.ts +25 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/types.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts +1 -1
- package/dist/types/react/web/ui/PayEmbed.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/CopyIcon.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/Drawer.d.ts +2 -1
- package/dist/types/react/web/ui/components/Drawer.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/SwitchNetwork.d.ts +1 -2
- package/dist/types/react/web/ui/components/SwitchNetwork.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/WalletImage.d.ts +1 -0
- package/dist/types/react/web/ui/components/WalletImage.d.ts.map +1 -1
- package/dist/types/react/web/ui/components/buttons.d.ts.map +1 -1
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletConnectUI.d.ts +0 -2
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletConnectUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/InAppWalletConnectUI.d.ts +0 -2
- package/dist/types/react/web/wallets/in-app/InAppWalletConnectUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/InAppWalletSelectionUI.d.ts +0 -2
- package/dist/types/react/web/wallets/in-app/InAppWalletSelectionUI.d.ts.map +1 -1
- package/dist/types/utils/formatNumber.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/gas/fee-data.ts +14 -6
- package/src/pay/buyWithCrypto/getQuote.ts +7 -3
- package/src/pay/buyWithFiat/getPostOnRampQuote.ts +5 -0
- package/src/pay/buyWithFiat/getQuote.ts +4 -0
- package/src/react/core/hooks/auth/useSiweAuth.ts +4 -1
- package/src/react/native/ui/components/Header.tsx +2 -2
- package/src/react/native/ui/components/button.tsx +6 -1
- package/src/react/native/ui/connect/ConnectButton.tsx +1 -1
- package/src/react/native/ui/connect/ConnectModal.tsx +9 -4
- package/src/react/native/ui/connect/InAppWalletUI.tsx +24 -20
- package/src/react/native/ui/icons/svgs.ts +5 -5
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +30 -17
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +12 -1
- package/src/react/web/ui/ConnectWallet/Details.tsx +73 -2
- package/src/react/web/ui/ConnectWallet/Modal/AllWalletsUI.tsx +2 -0
- package/src/react/web/ui/ConnectWallet/Modal/AnyWalletConnectUI.tsx +3 -6
- package/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx +3 -2
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModal.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx +17 -10
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModalInline.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/Modal/SmartWalletConnectUI.tsx +14 -15
- package/src/react/web/ui/ConnectWallet/WalletEntryButton.tsx +12 -13
- package/src/react/web/ui/ConnectWallet/WalletSelector.tsx +35 -20
- package/src/react/web/ui/ConnectWallet/locale/en.ts +1 -0
- package/src/react/web/ui/ConnectWallet/locale/es.ts +1 -0
- package/src/react/web/ui/ConnectWallet/locale/ja.ts +1 -0
- package/src/react/web/ui/ConnectWallet/locale/tl.ts +1 -0
- package/src/react/web/ui/ConnectWallet/locale/types.ts +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +435 -266
- package/src/react/web/ui/ConnectWallet/screens/Buy/ReceiverWalletSelectionScreen.tsx +118 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/WalletSelectorButton.tsx +86 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +2 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +23 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +4 -5
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +15 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +43 -32
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/PayWithCrypto.tsx +4 -7
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapFlow.tsx +3 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletSwitcherDrawerContent.tsx +66 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +16 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/FiatDetailsScreen.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/SwapDetailsScreen.tsx +27 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/TxDetailsScreen.tsx +3 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/types.ts +9 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/usePayerSetup.tsx +63 -0
- package/src/react/web/ui/ConnectWallet/screens/Details/WalletManagerScreen.tsx +203 -0
- package/src/react/web/ui/ConnectWallet/screens/SendFunds.tsx +1 -13
- package/src/react/web/ui/ConnectWallet/screens/SignatureScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/WalletSwitcherConnectionScreen.tsx +83 -0
- package/src/react/web/ui/ConnectWallet/screens/types.ts +2 -1
- package/src/react/web/ui/PayEmbed.tsx +7 -29
- package/src/react/web/ui/components/CopyIcon.tsx +5 -1
- package/src/react/web/ui/components/Drawer.tsx +91 -40
- package/src/react/web/ui/components/SwitchNetwork.tsx +2 -5
- package/src/react/web/ui/components/WalletImage.tsx +2 -0
- package/src/react/web/ui/components/buttons.tsx +5 -1
- package/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx +2 -3
- package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +2 -3
- package/src/react/web/wallets/in-app/InAppWalletSelectionUI.tsx +3 -3
- package/src/utils/format-number.test.ts +23 -8
- package/src/utils/formatNumber.ts +4 -1
- package/src/version.ts +1 -1
@@ -21,15 +21,14 @@ import { useBuyWithCryptoQuote } from "../../../../../core/hooks/pay/useBuyWithC
|
|
21
21
|
import { useBuyWithFiatQuote } from "../../../../../core/hooks/pay/useBuyWithFiatQuote.js";
|
22
22
|
import type { SupportedTokens } from "../../../../../core/utils/defaultTokens.js";
|
23
23
|
import { useActiveAccount } from "../../../../hooks/wallets/useActiveAccount.js";
|
24
|
-
import { useActiveWalletChain } from "../../../../hooks/wallets/useActiveWalletChain.js";
|
25
24
|
import { LoadingScreen } from "../../../../wallets/shared/LoadingScreen.js";
|
25
|
+
import type { PayEmbedConnectOptions } from "../../../PayEmbed.js";
|
26
26
|
import { ChainName } from "../../../components/ChainName.js";
|
27
27
|
import {
|
28
28
|
Drawer,
|
29
29
|
DrawerOverlay,
|
30
30
|
useDrawer,
|
31
31
|
} from "../../../components/Drawer.js";
|
32
|
-
import { DynamicHeight } from "../../../components/DynamicHeight.js";
|
33
32
|
import { Skeleton } from "../../../components/Skeleton.js";
|
34
33
|
import { Spacer } from "../../../components/Spacer.js";
|
35
34
|
import { Spinner } from "../../../components/Spinner.js";
|
@@ -39,10 +38,12 @@ import { Container, Line, ModalHeader } from "../../../components/basic.js";
|
|
39
38
|
import { Button } from "../../../components/buttons.js";
|
40
39
|
import { Text } from "../../../components/text.js";
|
41
40
|
import { TokenSymbol } from "../../../components/token/TokenSymbol.js";
|
41
|
+
import { ConnectButton } from "../../ConnectButton.js";
|
42
42
|
import { ChainButton, NetworkSelectorContent } from "../../NetworkSelector.js";
|
43
43
|
import { CoinsIcon } from "../../icons/CoinsIcon.js";
|
44
44
|
import type { ConnectLocale } from "../../locale/types.js";
|
45
45
|
import { TokenSelector } from "../TokenSelector.js";
|
46
|
+
import { WalletSwitcherConnectionScreen } from "../WalletSwitcherConnectionScreen.js";
|
46
47
|
import {
|
47
48
|
type ERC20OrNativeToken,
|
48
49
|
NATIVE_TOKEN,
|
@@ -51,6 +52,8 @@ import {
|
|
51
52
|
import { EstimatedTimeAndFees } from "./EstimatedTimeAndFees.js";
|
52
53
|
import { PayTokenIcon } from "./PayTokenIcon.js";
|
53
54
|
import { PayWithCreditCard } from "./PayWIthCreditCard.js";
|
55
|
+
import { ReceiverWalletDrawerScreen } from "./ReceiverWalletSelectionScreen.js";
|
56
|
+
import { WalletSelectorButton } from "./WalletSelectorButton.js";
|
54
57
|
import { CurrencySelection } from "./fiat/CurrencySelection.js";
|
55
58
|
import { FiatFlow } from "./fiat/FiatFlow.js";
|
56
59
|
import type { CurrencyMeta } from "./fiat/currencies.js";
|
@@ -63,26 +66,29 @@ import { BuyTokenInput } from "./swap/BuyTokenInput.js";
|
|
63
66
|
import { FiatFees, SwapFees } from "./swap/Fees.js";
|
64
67
|
import { PayWithCrypto } from "./swap/PayWithCrypto.js";
|
65
68
|
import { SwapFlow } from "./swap/SwapFlow.js";
|
69
|
+
import { WalletSwitcherDrawerContent } from "./swap/WalletSwitcherDrawerContent.js";
|
66
70
|
import { addPendingTx } from "./swap/pendingSwapTx.js";
|
67
71
|
import {
|
68
72
|
type SupportedChainAndTokens,
|
69
73
|
useBuySupportedDestinations,
|
70
74
|
useBuySupportedSources,
|
71
75
|
} from "./swap/useSwapSupportedChains.js";
|
76
|
+
import type { PayerInfo } from "./types.js";
|
77
|
+
import { usePayerSetup } from "./usePayerSetup.js";
|
72
78
|
|
73
79
|
// NOTE: Must not use useConnectUI here because this UI can be used outside connect ui
|
74
80
|
|
75
81
|
export type BuyScreenProps = {
|
76
|
-
onBack
|
77
|
-
supportedTokens
|
82
|
+
onBack: (() => void) | undefined;
|
83
|
+
supportedTokens: SupportedTokens | undefined;
|
78
84
|
onViewPendingTx: () => void;
|
79
85
|
client: ThirdwebClient;
|
80
86
|
connectLocale: ConnectLocale;
|
81
|
-
buyForTx
|
87
|
+
buyForTx: BuyForTx | undefined;
|
82
88
|
payOptions: PayUIOptions;
|
83
89
|
theme: "light" | "dark" | Theme;
|
84
90
|
onDone: () => void;
|
85
|
-
|
91
|
+
connectOptions: PayEmbedConnectOptions | undefined;
|
86
92
|
isEmbed: boolean;
|
87
93
|
};
|
88
94
|
|
@@ -117,35 +123,10 @@ type BuyScreenContentProps = {
|
|
117
123
|
theme: "light" | "dark" | Theme;
|
118
124
|
payOptions: PayUIOptions;
|
119
125
|
onDone: () => void;
|
120
|
-
|
126
|
+
connectOptions: PayEmbedConnectOptions | undefined;
|
121
127
|
isEmbed: boolean;
|
122
128
|
};
|
123
129
|
|
124
|
-
function useBuyScreenStates() {
|
125
|
-
const [screen, setScreen] = useState<SelectedScreen>({
|
126
|
-
id: "main",
|
127
|
-
});
|
128
|
-
|
129
|
-
const [drawerScreen, setDrawerScreen] = useState<React.ReactNode>();
|
130
|
-
const { drawerRef, drawerOverlayRef, onClose } = useDrawer();
|
131
|
-
|
132
|
-
function closeDrawer() {
|
133
|
-
onClose(() => {
|
134
|
-
setDrawerScreen(undefined);
|
135
|
-
});
|
136
|
-
}
|
137
|
-
|
138
|
-
return {
|
139
|
-
screen,
|
140
|
-
setScreen,
|
141
|
-
drawerScreen,
|
142
|
-
setDrawerScreen,
|
143
|
-
drawerRef,
|
144
|
-
drawerOverlayRef,
|
145
|
-
closeDrawer,
|
146
|
-
};
|
147
|
-
}
|
148
|
-
|
149
130
|
/**
|
150
131
|
* @internal
|
151
132
|
*/
|
@@ -153,19 +134,12 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
153
134
|
const { client, supportedDestinations, connectLocale, payOptions, buyForTx } =
|
154
135
|
props;
|
155
136
|
|
156
|
-
const
|
157
|
-
const
|
137
|
+
const activeAccount = useActiveAccount();
|
138
|
+
const { payer, setPayer } = usePayerSetup();
|
158
139
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
setScreen,
|
163
|
-
drawerScreen,
|
164
|
-
setDrawerScreen,
|
165
|
-
drawerRef,
|
166
|
-
drawerOverlayRef,
|
167
|
-
closeDrawer,
|
168
|
-
} = useBuyScreenStates();
|
140
|
+
const [screen, setScreen] = useState<SelectedScreen>({
|
141
|
+
id: "main",
|
142
|
+
});
|
169
143
|
|
170
144
|
// UI selection
|
171
145
|
const {
|
@@ -221,8 +195,84 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
221
195
|
|
222
196
|
// screens ----------------------------
|
223
197
|
|
224
|
-
if (screen.id === "
|
225
|
-
return
|
198
|
+
if (screen.id === "connect-payer-wallet") {
|
199
|
+
return (
|
200
|
+
<WalletSwitcherConnectionScreen
|
201
|
+
accountAbstraction={props.connectOptions?.accountAbstraction}
|
202
|
+
appMetadata={props.connectOptions?.appMetadata}
|
203
|
+
chain={props.connectOptions?.chain}
|
204
|
+
chains={props.connectOptions?.chains}
|
205
|
+
client={props.client}
|
206
|
+
connectLocale={props.connectLocale}
|
207
|
+
isEmbed={props.isEmbed}
|
208
|
+
onBack={() => setScreen(screen.backScreen)}
|
209
|
+
onSelect={(w) => {
|
210
|
+
const account = w.getAccount();
|
211
|
+
const chain = w.getChain();
|
212
|
+
if (w && account && chain) {
|
213
|
+
setPayer({
|
214
|
+
account,
|
215
|
+
chain,
|
216
|
+
wallet: w,
|
217
|
+
});
|
218
|
+
}
|
219
|
+
}}
|
220
|
+
recommendedWallets={props.connectOptions?.recommendedWallets}
|
221
|
+
showAllWallets={!!props.connectOptions?.showAllWallets}
|
222
|
+
walletConnect={props.connectOptions?.walletConnect}
|
223
|
+
wallets={props.connectOptions?.wallets}
|
224
|
+
/>
|
225
|
+
);
|
226
|
+
}
|
227
|
+
|
228
|
+
if (screen.id === "swap-flow" && payer) {
|
229
|
+
return (
|
230
|
+
<SwapFlow
|
231
|
+
isBuyForTx={!!props.buyForTx}
|
232
|
+
isEmbed={props.isEmbed}
|
233
|
+
client={client}
|
234
|
+
onBack={() => {
|
235
|
+
setScreen({
|
236
|
+
id: "buy-with-crypto",
|
237
|
+
});
|
238
|
+
}}
|
239
|
+
buyWithCryptoQuote={screen.quote}
|
240
|
+
payer={payer}
|
241
|
+
onViewPendingTx={props.onViewPendingTx}
|
242
|
+
isFiatFlow={false}
|
243
|
+
onDone={props.onDone}
|
244
|
+
onTryAgain={() => {
|
245
|
+
setScreen({
|
246
|
+
id: "buy-with-crypto",
|
247
|
+
});
|
248
|
+
}}
|
249
|
+
/>
|
250
|
+
);
|
251
|
+
}
|
252
|
+
|
253
|
+
if (screen.id === "fiat-flow" && payer) {
|
254
|
+
return (
|
255
|
+
<FiatFlow
|
256
|
+
isBuyForTx={!!props.buyForTx}
|
257
|
+
quote={screen.quote}
|
258
|
+
onBack={() => {
|
259
|
+
setScreen({
|
260
|
+
id: "buy-with-fiat",
|
261
|
+
});
|
262
|
+
}}
|
263
|
+
client={client}
|
264
|
+
testMode={
|
265
|
+
props.payOptions.buyWithFiat !== false &&
|
266
|
+
props.payOptions.buyWithFiat?.testMode === true
|
267
|
+
}
|
268
|
+
theme={typeof props.theme === "string" ? props.theme : props.theme.type}
|
269
|
+
onViewPendingTx={props.onViewPendingTx}
|
270
|
+
openedWindow={screen.openedWindow}
|
271
|
+
onDone={props.onDone}
|
272
|
+
isEmbed={props.isEmbed}
|
273
|
+
payer={payer}
|
274
|
+
/>
|
275
|
+
);
|
226
276
|
}
|
227
277
|
|
228
278
|
if (screen.id === "select-currency") {
|
@@ -338,34 +388,11 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
338
388
|
|
339
389
|
return (
|
340
390
|
<Container animate="fadein">
|
341
|
-
|
342
|
-
<div
|
343
|
-
onClick={(e) => {
|
344
|
-
if (
|
345
|
-
drawerScreen &&
|
346
|
-
drawerRef.current &&
|
347
|
-
!drawerRef.current.contains(e.target as Node)
|
348
|
-
) {
|
349
|
-
e.preventDefault();
|
350
|
-
e.stopPropagation();
|
351
|
-
closeDrawer();
|
352
|
-
}
|
353
|
-
}}
|
354
|
-
>
|
355
|
-
{/* Drawer */}
|
356
|
-
{drawerScreen && (
|
357
|
-
<>
|
358
|
-
<DrawerOverlay ref={drawerOverlayRef} />
|
359
|
-
<Drawer ref={drawerRef} close={closeDrawer}>
|
360
|
-
<DynamicHeight>{drawerScreen}</DynamicHeight>
|
361
|
-
</Drawer>
|
362
|
-
</>
|
363
|
-
)}
|
364
|
-
|
391
|
+
<div>
|
365
392
|
{screen.id === "main" && (
|
366
393
|
<MainScreen
|
367
|
-
|
368
|
-
buyForTx={buyForTx
|
394
|
+
payerAccount={payer?.account}
|
395
|
+
buyForTx={buyForTx}
|
369
396
|
client={client}
|
370
397
|
onSelectBuyToken={() =>
|
371
398
|
setScreen({ id: "select-to-token", backScreen: screen })
|
@@ -375,88 +402,94 @@ function BuyScreenContent(props: BuyScreenContentProps) {
|
|
375
402
|
toChain={toChain}
|
376
403
|
toToken={toToken}
|
377
404
|
tokenAmount={tokenAmount}
|
378
|
-
|
405
|
+
connectOptions={props.connectOptions}
|
379
406
|
onViewPendingTx={props.onViewPendingTx}
|
380
407
|
setScreen={setScreen}
|
381
408
|
supportedDestinations={supportedDestinations}
|
409
|
+
onBack={props.onBack}
|
410
|
+
theme={props.theme}
|
382
411
|
/>
|
383
412
|
)}
|
384
413
|
|
385
414
|
{(screen.id === "select-payment-method" ||
|
386
415
|
screen.id === "buy-with-crypto" ||
|
387
|
-
screen.id === "buy-with-fiat") &&
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
416
|
+
screen.id === "buy-with-fiat") &&
|
417
|
+
payer && (
|
418
|
+
<TokenSelectedLayout
|
419
|
+
selectedChain={toChain}
|
420
|
+
selectedToken={toToken}
|
421
|
+
tokenAmount={tokenAmount}
|
422
|
+
client={client}
|
423
|
+
onBack={() => {
|
424
|
+
if (
|
425
|
+
screen.id === "buy-with-crypto" ||
|
426
|
+
screen.id === "buy-with-fiat"
|
427
|
+
) {
|
428
|
+
setScreen({ id: "select-payment-method" });
|
429
|
+
} else if (screen.id === "select-payment-method") {
|
430
|
+
setScreen({ id: "main" });
|
431
|
+
}
|
432
|
+
}}
|
433
|
+
>
|
434
|
+
{screen.id === "select-payment-method" && (
|
435
|
+
<PaymentMethodSelection setScreen={(id) => setScreen({ id })} />
|
436
|
+
)}
|
437
|
+
|
438
|
+
{screen.id === "buy-with-crypto" && activeAccount && (
|
439
|
+
<SwapScreenContent
|
440
|
+
setScreen={setScreen}
|
441
|
+
tokenAmount={deferredTokenAmount}
|
442
|
+
toChain={toChain}
|
443
|
+
toToken={toToken}
|
444
|
+
fromChain={fromChain}
|
445
|
+
fromToken={fromToken}
|
446
|
+
showFromTokenSelector={() => {
|
447
|
+
setScreen({
|
448
|
+
id: "select-from-token",
|
449
|
+
backScreen: screen,
|
450
|
+
});
|
451
|
+
}}
|
452
|
+
payer={payer}
|
453
|
+
buyForTx={buyForTx || null}
|
454
|
+
client={client}
|
455
|
+
isEmbed={props.isEmbed}
|
456
|
+
onDone={props.onDone}
|
457
|
+
onViewPendingTx={props.onViewPendingTx}
|
458
|
+
payOptions={payOptions}
|
459
|
+
connectLocale={connectLocale}
|
460
|
+
connectOptions={props.connectOptions}
|
461
|
+
setPayer={setPayer}
|
462
|
+
// pass it even though we are passing payer, because payer might be different
|
463
|
+
activeAccount={activeAccount}
|
464
|
+
/>
|
465
|
+
)}
|
466
|
+
|
467
|
+
{screen.id === "buy-with-fiat" && (
|
468
|
+
<FiatScreenContent
|
469
|
+
setScreen={setScreen}
|
470
|
+
tokenAmount={deferredTokenAmount}
|
471
|
+
toChain={toChain}
|
472
|
+
toToken={toToken}
|
473
|
+
selectedCurrency={selectedCurrency}
|
474
|
+
buyForTx={buyForTx || null}
|
475
|
+
client={client}
|
476
|
+
isEmbed={props.isEmbed}
|
477
|
+
onDone={props.onDone}
|
478
|
+
onViewPendingTx={props.onViewPendingTx}
|
479
|
+
payOptions={payOptions}
|
480
|
+
theme={props.theme}
|
481
|
+
showCurrencySelector={() => {
|
482
|
+
setScreen({
|
483
|
+
id: "select-currency",
|
484
|
+
backScreen: screen,
|
485
|
+
});
|
486
|
+
}}
|
487
|
+
payer={payer}
|
488
|
+
setTokenAmount={setTokenAmount}
|
489
|
+
/>
|
490
|
+
)}
|
491
|
+
</TokenSelectedLayout>
|
492
|
+
)}
|
460
493
|
</div>
|
461
494
|
</Container>
|
462
495
|
);
|
@@ -480,7 +513,7 @@ function SelectedTokenInfo(props: {
|
|
480
513
|
>
|
481
514
|
<Container flex="row" gap="xs" center="y">
|
482
515
|
<Text color="primaryText" data-testid="tokenAmount" size="xxl">
|
483
|
-
{formatNumber(Number(props.tokenAmount),
|
516
|
+
{formatNumber(Number(props.tokenAmount), 5)}
|
484
517
|
</Text>
|
485
518
|
|
486
519
|
<Container flex="row" gap="xxs" center="y">
|
@@ -511,19 +544,21 @@ function SelectedTokenInfo(props: {
|
|
511
544
|
}
|
512
545
|
|
513
546
|
function MainScreen(props: {
|
514
|
-
buyForTx: BuyForTx |
|
547
|
+
buyForTx: BuyForTx | undefined;
|
515
548
|
client: ThirdwebClient;
|
516
549
|
setTokenAmount: (amount: string) => void;
|
517
|
-
|
550
|
+
payerAccount: Account | undefined;
|
518
551
|
tokenAmount: string;
|
519
552
|
payOptions: PayUIOptions;
|
520
553
|
toToken: ERC20OrNativeToken;
|
521
554
|
toChain: Chain;
|
522
555
|
onSelectBuyToken: () => void;
|
523
|
-
|
556
|
+
connectOptions: PayEmbedConnectOptions | undefined;
|
524
557
|
onViewPendingTx: () => void;
|
525
558
|
setScreen: (screen: SelectedScreen) => void;
|
526
559
|
supportedDestinations: SupportedChainAndTokens;
|
560
|
+
onBack: (() => void) | undefined;
|
561
|
+
theme: "light" | "dark" | Theme;
|
527
562
|
}) {
|
528
563
|
const { showPaymentSelection, buyWithCryptoEnabled, buyWithFiatEnabled } =
|
529
564
|
useEnabledPaymentMethods({
|
@@ -537,7 +572,7 @@ function MainScreen(props: {
|
|
537
572
|
const {
|
538
573
|
buyForTx,
|
539
574
|
setTokenAmount,
|
540
|
-
|
575
|
+
payerAccount,
|
541
576
|
client,
|
542
577
|
tokenAmount,
|
543
578
|
payOptions,
|
@@ -548,9 +583,9 @@ function MainScreen(props: {
|
|
548
583
|
// Buy Transaction flow states
|
549
584
|
const { amountNeeded } = useBuyTxStates({
|
550
585
|
setTokenAmount,
|
551
|
-
buyForTx,
|
586
|
+
buyForTx: buyForTx || null,
|
552
587
|
hasEditedAmount,
|
553
|
-
account,
|
588
|
+
account: payerAccount || null,
|
554
589
|
});
|
555
590
|
|
556
591
|
const disableContinue = !tokenAmount;
|
@@ -561,6 +596,7 @@ function MainScreen(props: {
|
|
561
596
|
title={
|
562
597
|
props.buyForTx ? `Not enough ${props.buyForTx.tokenSymbol}` : "Buy"
|
563
598
|
}
|
599
|
+
onBack={props.onBack}
|
564
600
|
/>
|
565
601
|
|
566
602
|
{/* Amount needed for Send Tx */}
|
@@ -602,8 +638,19 @@ function MainScreen(props: {
|
|
602
638
|
|
603
639
|
{/* Continue */}
|
604
640
|
<Container flex="column" gap="sm">
|
605
|
-
{!
|
606
|
-
<div>
|
641
|
+
{!payerAccount ? (
|
642
|
+
<div>
|
643
|
+
<ConnectButton
|
644
|
+
{...props.connectOptions}
|
645
|
+
client={props.client}
|
646
|
+
theme={props.theme}
|
647
|
+
connectButton={{
|
648
|
+
style: {
|
649
|
+
width: "100%",
|
650
|
+
},
|
651
|
+
}}
|
652
|
+
/>
|
653
|
+
</div>
|
607
654
|
) : (
|
608
655
|
<Button
|
609
656
|
variant="accent"
|
@@ -627,7 +674,7 @@ function MainScreen(props: {
|
|
627
674
|
)}
|
628
675
|
|
629
676
|
{/* Do we want to remove this? */}
|
630
|
-
{
|
677
|
+
{payerAccount && (
|
631
678
|
<Button
|
632
679
|
variant="outline"
|
633
680
|
fullWidth
|
@@ -747,7 +794,6 @@ function PaymentMethodSelection(props: {
|
|
747
794
|
}
|
748
795
|
|
749
796
|
function SwapScreenContent(props: {
|
750
|
-
setDrawerScreen: (screen: React.ReactNode) => void;
|
751
797
|
setScreen: (screen: SelectedScreen) => void;
|
752
798
|
tokenAmount: string;
|
753
799
|
toToken: ERC20OrNativeToken;
|
@@ -755,19 +801,21 @@ function SwapScreenContent(props: {
|
|
755
801
|
fromChain: Chain;
|
756
802
|
fromToken: ERC20OrNativeToken;
|
757
803
|
showFromTokenSelector: () => void;
|
758
|
-
|
759
|
-
activeChain: Chain;
|
804
|
+
payer: PayerInfo;
|
760
805
|
client: ThirdwebClient;
|
761
806
|
payOptions: PayUIOptions;
|
762
807
|
buyForTx: BuyForTx | null;
|
763
808
|
isEmbed: boolean;
|
764
809
|
onViewPendingTx: () => void;
|
765
810
|
onDone: () => void;
|
811
|
+
connectOptions: PayEmbedConnectOptions | undefined;
|
812
|
+
connectLocale: ConnectLocale;
|
813
|
+
setPayer: (payer: PayerInfo) => void;
|
814
|
+
activeAccount: Account;
|
766
815
|
}) {
|
767
816
|
const {
|
768
|
-
setDrawerScreen,
|
769
817
|
setScreen,
|
770
|
-
|
818
|
+
payer,
|
771
819
|
client,
|
772
820
|
toChain,
|
773
821
|
tokenAmount,
|
@@ -778,8 +826,16 @@ function SwapScreenContent(props: {
|
|
778
826
|
payOptions,
|
779
827
|
} = props;
|
780
828
|
|
829
|
+
const [receiverAddress, setReceiverAddress] = useState(
|
830
|
+
props.activeAccount.address,
|
831
|
+
);
|
832
|
+
const { drawerRef, drawerOverlayRef, isOpen, setIsOpen } = useDrawer();
|
833
|
+
const [drawerScreen, setDrawerScreen] = useState<
|
834
|
+
"fees" | "receiver" | "payer"
|
835
|
+
>("fees");
|
836
|
+
|
781
837
|
const fromTokenBalanceQuery = useWalletBalance({
|
782
|
-
address: account.address,
|
838
|
+
address: payer.account.address,
|
783
839
|
chain: fromChain,
|
784
840
|
tokenAddress: isNativeToken(fromToken) ? undefined : fromToken.address,
|
785
841
|
client,
|
@@ -788,8 +844,9 @@ function SwapScreenContent(props: {
|
|
788
844
|
const quoteParams: GetBuyWithCryptoQuoteParams | undefined =
|
789
845
|
tokenAmount && !(fromChain.id === toChain.id && fromToken === toToken)
|
790
846
|
? {
|
791
|
-
//
|
792
|
-
fromAddress: account.address,
|
847
|
+
// wallets
|
848
|
+
fromAddress: payer.account.address,
|
849
|
+
toAddress: receiverAddress,
|
793
850
|
// from
|
794
851
|
fromChainId: fromChain.id,
|
795
852
|
fromTokenAddress: isNativeToken(fromToken)
|
@@ -821,7 +878,7 @@ function SwapScreenContent(props: {
|
|
821
878
|
Number(fromTokenBalanceQuery.data.displayValue) < Number(sourceTokenAmount);
|
822
879
|
|
823
880
|
const disableContinue = !quoteQuery.data || isNotEnoughBalance;
|
824
|
-
const switchChainRequired = props.
|
881
|
+
const switchChainRequired = props.payer.chain.id !== fromChain.id;
|
825
882
|
|
826
883
|
function getErrorMessage(err: Error) {
|
827
884
|
const defaultMessage = "Unable to get price quote";
|
@@ -844,30 +901,8 @@ function SwapScreenContent(props: {
|
|
844
901
|
}
|
845
902
|
|
846
903
|
setScreen({
|
847
|
-
id: "
|
848
|
-
|
849
|
-
<SwapFlow
|
850
|
-
isBuyForTx={!!props.buyForTx}
|
851
|
-
isEmbed={props.isEmbed}
|
852
|
-
client={client}
|
853
|
-
onBack={() => {
|
854
|
-
setScreen({
|
855
|
-
id: "buy-with-crypto",
|
856
|
-
});
|
857
|
-
}}
|
858
|
-
buyWithCryptoQuote={quoteQuery.data}
|
859
|
-
account={account}
|
860
|
-
onViewPendingTx={props.onViewPendingTx}
|
861
|
-
isFiatFlow={false}
|
862
|
-
onDone={props.onDone}
|
863
|
-
onTryAgain={() => {
|
864
|
-
setScreen({
|
865
|
-
id: "buy-with-crypto",
|
866
|
-
});
|
867
|
-
quoteQuery.refetch();
|
868
|
-
}}
|
869
|
-
/>
|
870
|
-
),
|
904
|
+
id: "swap-flow",
|
905
|
+
quote: quoteQuery.data,
|
871
906
|
});
|
872
907
|
}
|
873
908
|
|
@@ -876,15 +911,8 @@ function SwapScreenContent(props: {
|
|
876
911
|
return;
|
877
912
|
}
|
878
913
|
|
879
|
-
|
880
|
-
|
881
|
-
<Text size="lg" color="primaryText">
|
882
|
-
Fees
|
883
|
-
</Text>
|
884
|
-
<Spacer y="lg" />
|
885
|
-
<SwapFees quote={quoteQuery.data} align="left" />
|
886
|
-
</div>,
|
887
|
-
);
|
914
|
+
setIsOpen(true);
|
915
|
+
setDrawerScreen("fees");
|
888
916
|
}
|
889
917
|
|
890
918
|
const prefillSource =
|
@@ -894,8 +922,79 @@ function SwapScreenContent(props: {
|
|
894
922
|
|
895
923
|
return (
|
896
924
|
<Container flex="column" gap="md" animate="fadein">
|
925
|
+
{isOpen && (
|
926
|
+
<>
|
927
|
+
<DrawerOverlay ref={drawerOverlayRef} />
|
928
|
+
<Drawer ref={drawerRef} close={() => setIsOpen(false)}>
|
929
|
+
{drawerScreen === "fees" && quoteQuery.data && (
|
930
|
+
<div>
|
931
|
+
<Text size="lg" color="primaryText">
|
932
|
+
Fees
|
933
|
+
</Text>
|
934
|
+
<Spacer y="lg" />
|
935
|
+
<SwapFees quote={quoteQuery.data} align="left" />
|
936
|
+
</div>
|
937
|
+
)}
|
938
|
+
|
939
|
+
{drawerScreen === "receiver" && (
|
940
|
+
<ReceiverWalletDrawerScreen
|
941
|
+
client={props.client}
|
942
|
+
onSelect={(x) => setReceiverAddress(x)}
|
943
|
+
receiverAddress={receiverAddress}
|
944
|
+
onBack={() => setIsOpen(false)}
|
945
|
+
/>
|
946
|
+
)}
|
947
|
+
|
948
|
+
{drawerScreen === "payer" && (
|
949
|
+
<WalletSwitcherDrawerContent
|
950
|
+
client={client}
|
951
|
+
onSelect={(w) => {
|
952
|
+
const chain = w.getChain();
|
953
|
+
const account = w.getAccount();
|
954
|
+
if (chain && account) {
|
955
|
+
props.setPayer({
|
956
|
+
account,
|
957
|
+
chain,
|
958
|
+
wallet: w,
|
959
|
+
});
|
960
|
+
}
|
961
|
+
}}
|
962
|
+
showAllWallets={!!props.connectOptions?.showAllWallets}
|
963
|
+
wallets={props.connectOptions?.wallets}
|
964
|
+
onBack={() => {
|
965
|
+
setIsOpen(false);
|
966
|
+
}}
|
967
|
+
onConnect={() => {
|
968
|
+
setScreen({
|
969
|
+
id: "connect-payer-wallet",
|
970
|
+
backScreen: {
|
971
|
+
id: "buy-with-crypto",
|
972
|
+
},
|
973
|
+
});
|
974
|
+
}}
|
975
|
+
selectedAddress={payer.account.address}
|
976
|
+
/>
|
977
|
+
)}
|
978
|
+
</Drawer>
|
979
|
+
</>
|
980
|
+
)}
|
981
|
+
|
897
982
|
{/* Quote info */}
|
898
983
|
<div>
|
984
|
+
<WalletSelectorButton
|
985
|
+
client={props.client}
|
986
|
+
onClick={() => {
|
987
|
+
setIsOpen(true);
|
988
|
+
setDrawerScreen("payer");
|
989
|
+
}}
|
990
|
+
address={props.payer.account.address}
|
991
|
+
walletId={props.payer.wallet.id}
|
992
|
+
containerStyle={{
|
993
|
+
borderBottomRightRadius: 0,
|
994
|
+
borderBottomLeftRadius: 0,
|
995
|
+
}}
|
996
|
+
/>
|
997
|
+
|
899
998
|
<PayWithCrypto
|
900
999
|
value={sourceTokenAmount || ""}
|
901
1000
|
onSelectToken={showFromTokenSelector}
|
@@ -907,6 +1006,7 @@ function SwapScreenContent(props: {
|
|
907
1006
|
prefillSource?.allowEdits?.chain === false &&
|
908
1007
|
prefillSource?.allowEdits?.token === false
|
909
1008
|
}
|
1009
|
+
payerAccount={props.payer.account}
|
910
1010
|
/>
|
911
1011
|
<EstimatedTimeAndFees
|
912
1012
|
quoteIsLoading={quoteQuery.isLoading}
|
@@ -915,6 +1015,19 @@ function SwapScreenContent(props: {
|
|
915
1015
|
}
|
916
1016
|
onViewFees={showFees}
|
917
1017
|
/>
|
1018
|
+
|
1019
|
+
<Spacer y="md" />
|
1020
|
+
<Text size="sm">Send to</Text>
|
1021
|
+
<Spacer y="xs" />
|
1022
|
+
<WalletSelectorButton
|
1023
|
+
client={props.client}
|
1024
|
+
onClick={() => {
|
1025
|
+
setIsOpen(true);
|
1026
|
+
setDrawerScreen("receiver");
|
1027
|
+
}}
|
1028
|
+
address={receiverAddress}
|
1029
|
+
walletId={undefined}
|
1030
|
+
/>
|
918
1031
|
</div>
|
919
1032
|
|
920
1033
|
{/* Error */}
|
@@ -929,7 +1042,13 @@ function SwapScreenContent(props: {
|
|
929
1042
|
!quoteQuery.isLoading &&
|
930
1043
|
!isNotEnoughBalance &&
|
931
1044
|
!quoteQuery.error ? (
|
932
|
-
<SwitchNetworkButton
|
1045
|
+
<SwitchNetworkButton
|
1046
|
+
variant="accent"
|
1047
|
+
fullWidth
|
1048
|
+
switchChain={async () => {
|
1049
|
+
await props.payer.wallet.switchChain(fromChain);
|
1050
|
+
}}
|
1051
|
+
/>
|
933
1052
|
) : (
|
934
1053
|
<Button
|
935
1054
|
variant={disableContinue ? "outline" : "accent"}
|
@@ -960,14 +1079,12 @@ function SwapScreenContent(props: {
|
|
960
1079
|
}
|
961
1080
|
|
962
1081
|
function FiatScreenContent(props: {
|
963
|
-
setDrawerScreen: (screen: React.ReactNode) => void;
|
964
1082
|
setScreen: (screen: SelectedScreen) => void;
|
965
1083
|
tokenAmount: string;
|
966
1084
|
toToken: ERC20OrNativeToken;
|
967
1085
|
toChain: Chain;
|
968
1086
|
selectedCurrency: CurrencyMeta;
|
969
1087
|
showCurrencySelector: () => void;
|
970
|
-
account: Account;
|
971
1088
|
payOptions: PayUIOptions;
|
972
1089
|
theme: "light" | "dark" | Theme;
|
973
1090
|
buyForTx: BuyForTx | null;
|
@@ -975,14 +1092,21 @@ function FiatScreenContent(props: {
|
|
975
1092
|
onViewPendingTx: () => void;
|
976
1093
|
onDone: () => void;
|
977
1094
|
isEmbed: boolean;
|
1095
|
+
payer: PayerInfo;
|
1096
|
+
setTokenAmount: (amount: string) => void;
|
978
1097
|
}) {
|
1098
|
+
const [receiverAddress, setReceiverAddress] = useState(
|
1099
|
+
props.payer.account.address,
|
1100
|
+
);
|
1101
|
+
const { drawerRef, drawerOverlayRef, isOpen, setIsOpen } = useDrawer();
|
1102
|
+
const [drawerScreen, setDrawerScreen] = useState<"fees" | "receiver">("fees");
|
1103
|
+
|
979
1104
|
const {
|
980
1105
|
toToken,
|
981
1106
|
tokenAmount,
|
982
|
-
|
1107
|
+
payer,
|
983
1108
|
client,
|
984
1109
|
setScreen,
|
985
|
-
setDrawerScreen,
|
986
1110
|
toChain,
|
987
1111
|
showCurrencySelector,
|
988
1112
|
selectedCurrency,
|
@@ -995,7 +1119,7 @@ function FiatScreenContent(props: {
|
|
995
1119
|
? {
|
996
1120
|
fromCurrencySymbol: selectedCurrency.shorthand,
|
997
1121
|
toChainId: toChain.id,
|
998
|
-
toAddress:
|
1122
|
+
toAddress: receiverAddress,
|
999
1123
|
toTokenAddress: isNativeToken(toToken)
|
1000
1124
|
? NATIVE_TOKEN_ADDRESS
|
1001
1125
|
: toToken.address,
|
@@ -1003,7 +1127,7 @@ function FiatScreenContent(props: {
|
|
1003
1127
|
client,
|
1004
1128
|
isTestMode: buyWithFiatOptions?.testMode,
|
1005
1129
|
purchaseData: props.payOptions.purchaseData,
|
1006
|
-
fromAddress: account.address,
|
1130
|
+
fromAddress: payer.account.address,
|
1007
1131
|
}
|
1008
1132
|
: undefined,
|
1009
1133
|
);
|
@@ -1029,31 +1153,9 @@ function FiatScreenContent(props: {
|
|
1029
1153
|
}
|
1030
1154
|
|
1031
1155
|
setScreen({
|
1032
|
-
id: "
|
1033
|
-
|
1034
|
-
|
1035
|
-
isBuyForTx={!!props.buyForTx}
|
1036
|
-
quote={fiatQuoteQuery.data}
|
1037
|
-
onBack={() => {
|
1038
|
-
setScreen({
|
1039
|
-
id: "buy-with-fiat",
|
1040
|
-
});
|
1041
|
-
}}
|
1042
|
-
client={client}
|
1043
|
-
testMode={
|
1044
|
-
buyWithFiatOptions !== false
|
1045
|
-
? buyWithFiatOptions?.testMode || false
|
1046
|
-
: false
|
1047
|
-
}
|
1048
|
-
theme={
|
1049
|
-
typeof props.theme === "string" ? props.theme : props.theme.type
|
1050
|
-
}
|
1051
|
-
onViewPendingTx={props.onViewPendingTx}
|
1052
|
-
openedWindow={openedWindow}
|
1053
|
-
onDone={props.onDone}
|
1054
|
-
isEmbed={props.isEmbed}
|
1055
|
-
/>
|
1056
|
-
),
|
1156
|
+
id: "fiat-flow",
|
1157
|
+
quote: fiatQuoteQuery.data,
|
1158
|
+
openedWindow,
|
1057
1159
|
});
|
1058
1160
|
}
|
1059
1161
|
|
@@ -1062,20 +1164,12 @@ function FiatScreenContent(props: {
|
|
1062
1164
|
return;
|
1063
1165
|
}
|
1064
1166
|
|
1065
|
-
setDrawerScreen(
|
1066
|
-
|
1067
|
-
<Text size="lg" color="primaryText">
|
1068
|
-
Fees
|
1069
|
-
</Text>
|
1070
|
-
|
1071
|
-
<Spacer y="lg" />
|
1072
|
-
<FiatFees quote={fiatQuoteQuery.data} />
|
1073
|
-
</div>,
|
1074
|
-
);
|
1167
|
+
setDrawerScreen("fees");
|
1168
|
+
setIsOpen(true);
|
1075
1169
|
}
|
1076
1170
|
|
1077
1171
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
1078
|
-
function getErrorMessage(err: any)
|
1172
|
+
function getErrorMessage(err: any) {
|
1079
1173
|
type AmountTooLowError = {
|
1080
1174
|
code: "MINIMUM_PURCHASE_AMOUNT";
|
1081
1175
|
data: {
|
@@ -1088,20 +1182,71 @@ function FiatScreenContent(props: {
|
|
1088
1182
|
try {
|
1089
1183
|
if (err.error.code === "MINIMUM_PURCHASE_AMOUNT") {
|
1090
1184
|
const obj = err.error as AmountTooLowError;
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1185
|
+
|
1186
|
+
const minAmountUSD = obj.data.minimumAmountUSDCents;
|
1187
|
+
const currentAmountUSD = obj.data.requestedAmountUSDCents;
|
1188
|
+
const currentAmountToken = Number(props.tokenAmount);
|
1189
|
+
const minAmountToken =
|
1190
|
+
(minAmountUSD * currentAmountToken) / currentAmountUSD;
|
1191
|
+
const minAmountTokenWithBuffer = minAmountToken * 1.2; // 20% buffer
|
1192
|
+
const formattedNum = formatNumber(minAmountTokenWithBuffer, 3);
|
1193
|
+
|
1194
|
+
return {
|
1195
|
+
msg: [`Minimum purchase amount is ${formattedNum}`],
|
1196
|
+
minAmount: formattedNum,
|
1197
|
+
};
|
1095
1198
|
}
|
1096
1199
|
} catch {}
|
1097
1200
|
|
1098
|
-
return
|
1201
|
+
return {
|
1202
|
+
msg: [defaultMessage],
|
1203
|
+
};
|
1099
1204
|
}
|
1100
1205
|
|
1101
1206
|
const disableSubmit = !fiatQuoteQuery.data;
|
1102
1207
|
|
1208
|
+
// TODO: API should just not return a quote if fromAddress !== toAddress and a swap is required after onramp and return an error message with a specific error id
|
1209
|
+
|
1210
|
+
// TODO: if the receiver wallet is frozen by the developer, we need to stop the user from clicking continue here
|
1211
|
+
|
1212
|
+
// Selecting Reciever wallet only allowed if no swap required after onramp
|
1213
|
+
const enableReceiverSelection =
|
1214
|
+
fiatQuoteQuery.data && !isSwapRequiredPostOnramp(fiatQuoteQuery.data);
|
1215
|
+
|
1216
|
+
const errorMsg =
|
1217
|
+
!fiatQuoteQuery.isLoading && fiatQuoteQuery.error
|
1218
|
+
? getErrorMessage(fiatQuoteQuery.error)
|
1219
|
+
: undefined;
|
1220
|
+
|
1103
1221
|
return (
|
1104
1222
|
<Container flex="column" gap="md" animate="fadein">
|
1223
|
+
{isOpen && fiatQuoteQuery.data && (
|
1224
|
+
<>
|
1225
|
+
<DrawerOverlay ref={drawerOverlayRef} />
|
1226
|
+
<Drawer ref={drawerRef} close={() => setIsOpen(false)}>
|
1227
|
+
{drawerScreen === "fees" && (
|
1228
|
+
<div>
|
1229
|
+
<Text size="lg" color="primaryText">
|
1230
|
+
Fees
|
1231
|
+
</Text>
|
1232
|
+
|
1233
|
+
<Spacer y="lg" />
|
1234
|
+
<FiatFees quote={fiatQuoteQuery.data} />
|
1235
|
+
</div>
|
1236
|
+
)}
|
1237
|
+
|
1238
|
+
{drawerScreen === "receiver" && (
|
1239
|
+
<ReceiverWalletDrawerScreen
|
1240
|
+
client={props.client}
|
1241
|
+
onSelect={(x) => setReceiverAddress(x)}
|
1242
|
+
receiverAddress={receiverAddress}
|
1243
|
+
onBack={() => setIsOpen(false)}
|
1244
|
+
/>
|
1245
|
+
)}
|
1246
|
+
</Drawer>
|
1247
|
+
</>
|
1248
|
+
)}
|
1249
|
+
|
1105
1250
|
<div>
|
1106
1251
|
<PayWithCreditCard
|
1107
1252
|
isLoading={fiatQuoteQuery.isLoading}
|
@@ -1116,12 +1261,25 @@ function FiatScreenContent(props: {
|
|
1116
1261
|
estimatedSeconds={fiatQuoteQuery.data?.estimatedDurationSeconds}
|
1117
1262
|
onViewFees={showFees}
|
1118
1263
|
/>
|
1264
|
+
<Spacer y="md" />
|
1265
|
+
<Text size="sm">Send to</Text>
|
1266
|
+
<Spacer y="xs" />
|
1267
|
+
<WalletSelectorButton
|
1268
|
+
client={props.client}
|
1269
|
+
onClick={() => {
|
1270
|
+
setDrawerScreen("receiver");
|
1271
|
+
setIsOpen(true);
|
1272
|
+
}}
|
1273
|
+
address={receiverAddress}
|
1274
|
+
disabled={!enableReceiverSelection}
|
1275
|
+
walletId={undefined}
|
1276
|
+
/>
|
1119
1277
|
</div>
|
1120
1278
|
|
1121
1279
|
{/* Error message */}
|
1122
|
-
{
|
1280
|
+
{errorMsg && (
|
1123
1281
|
<div>
|
1124
|
-
{
|
1282
|
+
{errorMsg.msg.map((msg) => (
|
1125
1283
|
<Text color="danger" size="sm" center multiline key={msg}>
|
1126
1284
|
{msg}
|
1127
1285
|
</Text>
|
@@ -1129,24 +1287,35 @@ function FiatScreenContent(props: {
|
|
1129
1287
|
</div>
|
1130
1288
|
)}
|
1131
1289
|
|
1132
|
-
{
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1290
|
+
{errorMsg?.minAmount ? (
|
1291
|
+
<Button
|
1292
|
+
variant="accent"
|
1293
|
+
fullWidth
|
1294
|
+
onClick={() => {
|
1295
|
+
props.setTokenAmount(String(errorMsg.minAmount));
|
1296
|
+
}}
|
1297
|
+
>
|
1298
|
+
Set Minimum
|
1299
|
+
</Button>
|
1300
|
+
) : (
|
1301
|
+
<Button
|
1302
|
+
variant={disableSubmit ? "outline" : "accent"}
|
1303
|
+
data-disabled={disableSubmit}
|
1304
|
+
disabled={disableSubmit}
|
1305
|
+
fullWidth
|
1306
|
+
onClick={handleSubmit}
|
1307
|
+
gap="xs"
|
1308
|
+
>
|
1309
|
+
{fiatQuoteQuery.isLoading ? (
|
1310
|
+
<>
|
1311
|
+
Getting price quote
|
1312
|
+
<Spinner size="sm" color="accentText" />
|
1313
|
+
</>
|
1314
|
+
) : (
|
1315
|
+
"Continue"
|
1316
|
+
)}
|
1317
|
+
</Button>
|
1318
|
+
)}
|
1150
1319
|
</Container>
|
1151
1320
|
);
|
1152
1321
|
}
|