thirdweb 5.99.3 → 5.100.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/bridge/Buy.js +17 -13
- package/dist/cjs/bridge/Buy.js.map +1 -1
- package/dist/cjs/bridge/Chains.js +2 -2
- package/dist/cjs/bridge/Chains.js.map +1 -1
- package/dist/cjs/bridge/Onramp.js +152 -0
- package/dist/cjs/bridge/Onramp.js.map +1 -0
- package/dist/cjs/bridge/OnrampStatus.js +78 -0
- package/dist/cjs/bridge/OnrampStatus.js.map +1 -0
- package/dist/cjs/bridge/Routes.js +2 -2
- package/dist/cjs/bridge/Routes.js.map +1 -1
- package/dist/cjs/bridge/Sell.js +18 -14
- package/dist/cjs/bridge/Sell.js.map +1 -1
- package/dist/cjs/bridge/Status.js +15 -2
- package/dist/cjs/bridge/Status.js.map +1 -1
- package/dist/cjs/bridge/Transfer.js +229 -0
- package/dist/cjs/bridge/Transfer.js.map +1 -0
- package/dist/cjs/bridge/index.js +3 -1
- package/dist/cjs/bridge/index.js.map +1 -1
- package/dist/cjs/bridge/types/BridgeAction.js +3 -0
- package/dist/cjs/bridge/types/BridgeAction.js.map +1 -0
- package/dist/cjs/bridge/types/Token.js +3 -0
- package/dist/cjs/bridge/types/Token.js.map +1 -0
- package/dist/cjs/extensions/ens/resolve-l2-name.js +0 -2
- package/dist/cjs/extensions/ens/resolve-l2-name.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +159 -53
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js +160 -14
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -37
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +129 -33
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getStatus.js +71 -20
- package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/cjs/pay/utils/commonTypes.js +1 -1
- package/dist/cjs/pay/utils/commonTypes.js.map +1 -1
- package/dist/cjs/pay/utils/definitions.js +1 -43
- package/dist/cjs/pay/utils/definitions.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -3
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +44 -38
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +15 -0
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/cjs/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -23
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +0 -177
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +5 -8
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +0 -15
- 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/statusMeta.js +0 -60
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +4 -4
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +83 -34
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js +133 -0
- package/dist/cjs/react/web/ui/TransactionButton/DepositScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +4 -3
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js +9 -1
- package/dist/cjs/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/constants.js +1 -0
- package/dist/cjs/utils/any-evm/zksync/constants.js.map +1 -1
- package/dist/cjs/utils/domains.js +3 -0
- package/dist/cjs/utils/domains.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/bridge/Buy.js +17 -13
- package/dist/esm/bridge/Buy.js.map +1 -1
- package/dist/esm/bridge/Chains.js +2 -2
- package/dist/esm/bridge/Chains.js.map +1 -1
- package/dist/esm/bridge/Onramp.js +147 -0
- package/dist/esm/bridge/Onramp.js.map +1 -0
- package/dist/esm/bridge/OnrampStatus.js +75 -0
- package/dist/esm/bridge/OnrampStatus.js.map +1 -0
- package/dist/esm/bridge/Routes.js +2 -2
- package/dist/esm/bridge/Routes.js.map +1 -1
- package/dist/esm/bridge/Sell.js +18 -14
- package/dist/esm/bridge/Sell.js.map +1 -1
- package/dist/esm/bridge/Status.js +15 -2
- package/dist/esm/bridge/Status.js.map +1 -1
- package/dist/esm/bridge/Transfer.js +226 -0
- package/dist/esm/bridge/Transfer.js.map +1 -0
- package/dist/esm/bridge/index.js +2 -0
- package/dist/esm/bridge/index.js.map +1 -1
- package/dist/esm/bridge/types/BridgeAction.js +2 -0
- package/dist/esm/bridge/types/BridgeAction.js.map +1 -0
- package/dist/esm/bridge/types/Token.js +2 -0
- package/dist/esm/bridge/types/Token.js.map +1 -0
- package/dist/esm/extensions/ens/resolve-l2-name.js +0 -2
- package/dist/esm/extensions/ens/resolve-l2-name.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +159 -53
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js +160 -14
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +95 -37
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +129 -33
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getStatus.js +71 -20
- package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/esm/pay/utils/commonTypes.js +1 -1
- package/dist/esm/pay/utils/commonTypes.js.map +1 -1
- package/dist/esm/pay/utils/definitions.js +0 -35
- package/dist/esm/pay/utils/definitions.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -3
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +44 -38
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +15 -0
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js +1 -1
- package/dist/esm/react/web/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +1 -23
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +4 -180
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -10
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js +5 -8
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +2 -16
- 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/statusMeta.js +0 -59
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js +84 -34
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js +130 -0
- package/dist/esm/react/web/ui/TransactionButton/DepositScreen.js.map +1 -0
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +4 -3
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js +9 -1
- package/dist/esm/react/web/ui/TransactionButton/TransactionModal.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/constants.js +1 -0
- package/dist/esm/utils/any-evm/zksync/constants.js.map +1 -1
- package/dist/esm/utils/domains.js +3 -0
- package/dist/esm/utils/domains.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/bridge/Buy.d.ts +11 -9
- package/dist/types/bridge/Buy.d.ts.map +1 -1
- package/dist/types/bridge/Onramp.d.ts +123 -0
- package/dist/types/bridge/Onramp.d.ts.map +1 -0
- package/dist/types/bridge/OnrampStatus.d.ts +108 -0
- package/dist/types/bridge/OnrampStatus.d.ts.map +1 -0
- package/dist/types/bridge/Sell.d.ts +13 -11
- package/dist/types/bridge/Sell.d.ts.map +1 -1
- package/dist/types/bridge/Status.d.ts.map +1 -1
- package/dist/types/bridge/Transfer.d.ts +199 -0
- package/dist/types/bridge/Transfer.d.ts.map +1 -0
- package/dist/types/bridge/index.d.ts +7 -3
- package/dist/types/bridge/index.d.ts.map +1 -1
- package/dist/types/bridge/types/BridgeAction.d.ts +2 -0
- package/dist/types/bridge/types/BridgeAction.d.ts.map +1 -0
- package/dist/types/bridge/types/Quote.d.ts +3 -65
- package/dist/types/bridge/types/Quote.d.ts.map +1 -1
- package/dist/types/bridge/types/Route.d.ts +38 -17
- package/dist/types/bridge/types/Route.d.ts.map +1 -1
- package/dist/types/bridge/types/Status.d.ts +15 -0
- package/dist/types/bridge/types/Status.d.ts.map +1 -1
- package/dist/types/bridge/types/Token.d.ts +11 -0
- package/dist/types/bridge/types/Token.d.ts.map +1 -0
- package/dist/types/extensions/ens/resolve-l2-name.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +0 -9
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getStatus.d.ts +1 -12
- package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts.map +1 -1
- package/dist/types/pay/utils/definitions.d.ts +0 -35
- package/dist/types/pay/utils/definitions.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +1 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/web/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/TransactionsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +1 -30
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +2 -0
- 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 +2 -0
- 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/pay-transactions/SwapDetailsScreen.d.ts +0 -5
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts +1 -3
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts +8 -4
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts +15 -0
- package/dist/types/react/web/ui/TransactionButton/DepositScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts +1 -0
- package/dist/types/react/web/ui/TransactionButton/TransactionModal.d.ts.map +1 -1
- package/dist/types/utils/any-evm/zksync/constants.d.ts.map +1 -1
- package/dist/types/utils/domains.d.ts +6 -0
- package/dist/types/utils/domains.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 +15 -15
- package/src/bridge/Buy.ts +19 -13
- package/src/bridge/Chains.ts +2 -2
- package/src/bridge/Onramp.test.ts +118 -0
- package/src/bridge/Onramp.ts +244 -0
- package/src/bridge/OnrampStatus.ts +133 -0
- package/src/bridge/Routes.ts +2 -2
- package/src/bridge/Sell.ts +20 -14
- package/src/bridge/Status.ts +15 -2
- package/src/bridge/Transfer.test.ts +76 -0
- package/src/bridge/Transfer.ts +270 -0
- package/src/bridge/index.ts +12 -3
- package/src/bridge/types/BridgeAction.ts +1 -0
- package/src/bridge/types/Quote.ts +3 -65
- package/src/bridge/types/Route.ts +42 -17
- package/src/bridge/types/Status.ts +15 -1
- package/src/bridge/types/Token.ts +11 -0
- package/src/extensions/ens/resolve-l2-name.ts +0 -2
- package/src/pay/buyWithCrypto/commonTypes.ts +0 -10
- package/src/pay/buyWithCrypto/getQuote.ts +210 -100
- package/src/pay/buyWithCrypto/getStatus.ts +213 -20
- package/src/pay/buyWithCrypto/getTransfer.ts +129 -61
- package/src/pay/buyWithFiat/getQuote.ts +184 -33
- package/src/pay/buyWithFiat/getStatus.ts +101 -42
- package/src/pay/convert/cryptoToFiat.test.ts +7 -5
- package/src/pay/convert/fiatToCrypto.test.ts +6 -4
- package/src/pay/utils/commonTypes.ts +1 -1
- package/src/pay/utils/definitions.ts +0 -48
- package/src/react/core/hooks/pay/useBuyWithFiatStatus.ts +0 -2
- package/src/react/core/hooks/transaction/useSendTransaction.ts +53 -52
- package/src/react/core/utils/wallet.ts +15 -0
- package/src/react/web/hooks/transaction/useSendTransaction.tsx +1 -0
- package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +5 -64
- package/src/react/web/ui/ConnectWallet/locale/en.ts +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +3 -510
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +2 -12
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +2 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useBuyTxStates.ts +19 -20
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +1 -37
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.test.ts +1 -95
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/statusMeta.ts +0 -69
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +3 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/fetchBalancesForWallet.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/pendingSwapTx.ts +1 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/useSwapSupportedChains.ts +118 -63
- package/src/react/web/ui/TransactionButton/DepositScreen.tsx +295 -0
- package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +4 -5
- package/src/react/web/ui/TransactionButton/TransactionModal.tsx +20 -1
- package/src/utils/any-evm/zksync/constants.ts +1 -0
- package/src/utils/domain.test.ts +1 -0
- package/src/utils/domains.ts +8 -0
- package/src/version.ts +1 -1
- package/dist/cjs/bridge/constants.js +0 -5
- package/dist/cjs/bridge/constants.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +0 -37
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +0 -86
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +0 -25
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +0 -54
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +0 -52
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +0 -81
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +0 -17
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +0 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js +0 -138
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +0 -1
- package/dist/esm/bridge/constants.js +0 -2
- package/dist/esm/bridge/constants.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +0 -34
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js +0 -83
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js +0 -22
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js +0 -51
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js +0 -48
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js +0 -78
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js +0 -14
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.js.map +0 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js +0 -135
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.js.map +0 -1
- package/dist/types/bridge/constants.d.ts +0 -2
- package/dist/types/bridge/constants.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts +0 -26
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts +0 -16
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts +0 -23
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts +0 -10
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.d.ts +0 -9
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts +0 -14
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.d.ts.map +0 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts +0 -21
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.d.ts.map +0 -1
- package/src/bridge/constants.ts +0 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +0 -142
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwap.tsx +0 -170
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/PostOnRampSwapFlow.tsx +0 -63
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistory.tsx +0 -163
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/BuyTxHistoryButton.tsx +0 -127
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/FiatDetailsScreen.tsx +0 -138
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/TxDetailsScreen.tsx +0 -45
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/useBuyTransactionsToShow.ts +0 -191
@@ -1,519 +1,15 @@
|
|
1
|
-
import {
|
2
|
-
Cross1Icon,
|
3
|
-
ExternalLinkIcon,
|
4
|
-
TriangleDownIcon,
|
5
|
-
} from "@radix-ui/react-icons";
|
6
|
-
import { useMemo } from "react";
|
7
|
-
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
8
|
-
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
9
|
-
import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.js";
|
10
|
-
import type { BuyWithFiatStatus } from "../../../../../../../pay/buyWithFiat/getStatus.js";
|
11
|
-
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
12
|
-
import { formatExplorerTxUrl } from "../../../../../../../utils/url.js";
|
1
|
+
import { Cross1Icon } from "@radix-ui/react-icons";
|
13
2
|
import {
|
14
3
|
type Theme,
|
15
|
-
fontSize,
|
16
4
|
iconSize,
|
17
5
|
radius,
|
18
6
|
spacing,
|
19
7
|
} from "../../../../../../core/design-system/index.js";
|
20
|
-
import {
|
21
|
-
useChainExplorers,
|
22
|
-
useChainName,
|
23
|
-
} from "../../../../../../core/hooks/others/useChainQuery.js";
|
24
|
-
import type { TokenInfo } from "../../../../../../core/utils/defaultTokens.js";
|
25
|
-
import { Spacer } from "../../../../components/Spacer.js";
|
26
8
|
import { Spinner } from "../../../../components/Spinner.js";
|
27
|
-
import { Container
|
28
|
-
import { Button, ButtonLink } from "../../../../components/buttons.js";
|
9
|
+
import { Container } from "../../../../components/basic.js";
|
29
10
|
import { Text } from "../../../../components/text.js";
|
30
|
-
import { TokenSymbol } from "../../../../components/token/TokenSymbol.js";
|
31
|
-
import { type ERC20OrNativeToken, NATIVE_TOKEN } from "../../nativeToken.js";
|
32
|
-
import { PayTokenIcon } from "../PayTokenIcon.js";
|
33
11
|
import { StepIcon } from "../Stepper.js";
|
34
|
-
import {
|
35
|
-
type FiatStatusMeta,
|
36
|
-
getBuyWithFiatStatusMeta,
|
37
|
-
} from "../pay-transactions/statusMeta.js";
|
38
|
-
import { getCurrencyMeta, getFiatIcon } from "./currencies.js";
|
39
|
-
|
40
|
-
export type BuyWithFiatPartialQuote = {
|
41
|
-
fromCurrencySymbol: string;
|
42
|
-
fromCurrencyAmount: string;
|
43
|
-
onRampTokenAmount: string;
|
44
|
-
toTokenAmount: string;
|
45
|
-
onRampToken: {
|
46
|
-
tokenAddress: string;
|
47
|
-
name?: string;
|
48
|
-
symbol?: string;
|
49
|
-
chainId: number;
|
50
|
-
};
|
51
|
-
|
52
|
-
toToken: {
|
53
|
-
tokenAddress: string;
|
54
|
-
name?: string;
|
55
|
-
symbol?: string;
|
56
|
-
chainId: number;
|
57
|
-
};
|
58
|
-
};
|
59
|
-
|
60
|
-
export function FiatSteps(props: {
|
61
|
-
title: string;
|
62
|
-
partialQuote: BuyWithFiatPartialQuote;
|
63
|
-
status?: BuyWithFiatStatus;
|
64
|
-
onBack: () => void;
|
65
|
-
client: ThirdwebClient;
|
66
|
-
step: number;
|
67
|
-
onContinue: () => void;
|
68
|
-
}) {
|
69
|
-
const statusMeta = props.status
|
70
|
-
? getBuyWithFiatStatusMeta(props.status)
|
71
|
-
: undefined;
|
72
|
-
|
73
|
-
const {
|
74
|
-
toToken: toTokenMeta,
|
75
|
-
onRampToken: onRampTokenMeta,
|
76
|
-
onRampTokenAmount,
|
77
|
-
fromCurrencySymbol,
|
78
|
-
fromCurrencyAmount,
|
79
|
-
toTokenAmount,
|
80
|
-
} = props.partialQuote;
|
81
|
-
|
82
|
-
const currency = getCurrencyMeta(fromCurrencySymbol);
|
83
|
-
const isPartialSuccess = statusMeta?.progressStatus === "partialSuccess";
|
84
|
-
|
85
|
-
const toChain = useMemo(
|
86
|
-
() => getCachedChain(toTokenMeta.chainId),
|
87
|
-
[toTokenMeta.chainId],
|
88
|
-
);
|
89
|
-
|
90
|
-
const destinationChain = useMemo(() => {
|
91
|
-
if (props.status?.status !== "NOT_FOUND" && props.status?.destination) {
|
92
|
-
return getCachedChain(props.status?.destination.token.chainId);
|
93
|
-
}
|
94
|
-
|
95
|
-
return undefined;
|
96
|
-
}, [props.status]);
|
97
|
-
|
98
|
-
const toToken: ERC20OrNativeToken = useMemo(() => {
|
99
|
-
if (toTokenMeta.tokenAddress === NATIVE_TOKEN_ADDRESS) {
|
100
|
-
return NATIVE_TOKEN;
|
101
|
-
}
|
102
|
-
|
103
|
-
const tokenInfo: TokenInfo = {
|
104
|
-
address: toTokenMeta.tokenAddress,
|
105
|
-
name: toTokenMeta.name || "",
|
106
|
-
symbol: toTokenMeta.symbol || "",
|
107
|
-
// TODO: when icon is available in endpoint
|
108
|
-
// icon: toTokenMeta.icon
|
109
|
-
};
|
110
|
-
return tokenInfo;
|
111
|
-
}, [toTokenMeta]);
|
112
|
-
|
113
|
-
const onRampChain = useMemo(
|
114
|
-
() => getCachedChain(onRampTokenMeta.chainId),
|
115
|
-
[onRampTokenMeta.chainId],
|
116
|
-
);
|
117
|
-
|
118
|
-
const onRampToken: ERC20OrNativeToken = useMemo(() => {
|
119
|
-
if (onRampTokenMeta.tokenAddress === NATIVE_TOKEN_ADDRESS) {
|
120
|
-
return NATIVE_TOKEN;
|
121
|
-
}
|
122
|
-
|
123
|
-
const tokenInfo: TokenInfo = {
|
124
|
-
address: onRampTokenMeta.tokenAddress,
|
125
|
-
name: onRampTokenMeta.name || "",
|
126
|
-
symbol: onRampTokenMeta.symbol || "",
|
127
|
-
// TODO: when icon is available in endpoint
|
128
|
-
// icon: onRampTokenMeta.icon,
|
129
|
-
};
|
130
|
-
return tokenInfo;
|
131
|
-
}, [onRampTokenMeta]);
|
132
|
-
|
133
|
-
const onRampName = useChainName(onRampChain);
|
134
|
-
const onRampExplorers = useChainExplorers(onRampChain);
|
135
|
-
const toChainName = useChainName(toChain);
|
136
|
-
const toChainExplorers = useChainExplorers(toChain);
|
137
|
-
const destinationName = useChainName(destinationChain);
|
138
|
-
|
139
|
-
const onRampTokenInfo = (
|
140
|
-
<div>
|
141
|
-
<Text color="primaryText" size="sm">
|
142
|
-
{formatNumber(Number(onRampTokenAmount), 6)}{" "}
|
143
|
-
<TokenSymbol token={onRampToken} chain={onRampChain} size="sm" inline />
|
144
|
-
</Text>
|
145
|
-
</div>
|
146
|
-
);
|
147
|
-
|
148
|
-
const fiatIcon = getFiatIcon(currency, "sm");
|
149
|
-
|
150
|
-
const onRampTokenIcon = (
|
151
|
-
<PayTokenIcon
|
152
|
-
token={onRampToken}
|
153
|
-
chain={onRampChain}
|
154
|
-
size="sm"
|
155
|
-
client={props.client}
|
156
|
-
/>
|
157
|
-
);
|
158
|
-
|
159
|
-
const toTokenIcon = (
|
160
|
-
<PayTokenIcon
|
161
|
-
token={toToken}
|
162
|
-
chain={toChain}
|
163
|
-
size="sm"
|
164
|
-
client={props.client}
|
165
|
-
/>
|
166
|
-
);
|
167
|
-
|
168
|
-
const onRampChainInfo = <Text size="xs">{onRampName.name}</Text>;
|
169
|
-
|
170
|
-
const partialSuccessToTokenInfo =
|
171
|
-
props.status?.status === "CRYPTO_SWAP_FALLBACK" &&
|
172
|
-
props.status.destination ? (
|
173
|
-
<div>
|
174
|
-
<Text
|
175
|
-
color="secondaryText"
|
176
|
-
size="sm"
|
177
|
-
inline
|
178
|
-
style={{
|
179
|
-
textDecoration: "line-through",
|
180
|
-
}}
|
181
|
-
>
|
182
|
-
{formatNumber(Number(toTokenAmount), 6)}{" "}
|
183
|
-
<TokenSymbol
|
184
|
-
token={toToken}
|
185
|
-
chain={toChain}
|
186
|
-
size="sm"
|
187
|
-
inline
|
188
|
-
color="secondaryText"
|
189
|
-
/>
|
190
|
-
</Text>{" "}
|
191
|
-
<Text color="danger" size="sm" inline>
|
192
|
-
{formatNumber(Number(props.status.destination.amount), 6)}{" "}
|
193
|
-
<TokenSymbol
|
194
|
-
token={{
|
195
|
-
address: props.status.destination.token.tokenAddress,
|
196
|
-
name: props.status.destination.token.name || "",
|
197
|
-
symbol: props.status.destination.token.symbol || "",
|
198
|
-
}}
|
199
|
-
chain={toChain}
|
200
|
-
size="sm"
|
201
|
-
inline
|
202
|
-
color="danger"
|
203
|
-
/>
|
204
|
-
</Text>
|
205
|
-
</div>
|
206
|
-
) : null;
|
207
|
-
|
208
|
-
const toTokenInfo = partialSuccessToTokenInfo || (
|
209
|
-
<Text color="primaryText" size="sm">
|
210
|
-
{formatNumber(Number(toTokenAmount), 6)}{" "}
|
211
|
-
<TokenSymbol token={toToken} chain={toChain} size="sm" inline />
|
212
|
-
</Text>
|
213
|
-
);
|
214
|
-
|
215
|
-
const partialSuccessToChainInfo =
|
216
|
-
props.status?.status === "CRYPTO_SWAP_FALLBACK" &&
|
217
|
-
props.status.destination &&
|
218
|
-
props.status.destination.token.chainId !==
|
219
|
-
props.status.quote.toToken.chainId ? (
|
220
|
-
<div>
|
221
|
-
<Text
|
222
|
-
size="xs"
|
223
|
-
inline
|
224
|
-
style={{
|
225
|
-
textDecoration: "line-through",
|
226
|
-
}}
|
227
|
-
>
|
228
|
-
{toChainName.name}
|
229
|
-
</Text>{" "}
|
230
|
-
<Text size="xs" inline>
|
231
|
-
{destinationName.name}
|
232
|
-
</Text>
|
233
|
-
</div>
|
234
|
-
) : null;
|
235
|
-
|
236
|
-
const toTokehChainInfo = partialSuccessToChainInfo || (
|
237
|
-
<Text size="xs">{toChainName.name}</Text>
|
238
|
-
);
|
239
|
-
|
240
|
-
const onRampTxHash =
|
241
|
-
props.status?.status !== "NOT_FOUND"
|
242
|
-
? props.status?.source?.transactionHash
|
243
|
-
: undefined;
|
244
|
-
|
245
|
-
const toTokenTxHash =
|
246
|
-
props.status?.status !== "NOT_FOUND"
|
247
|
-
? props.status?.destination?.transactionHash
|
248
|
-
: undefined;
|
249
|
-
|
250
|
-
const showContinueBtn =
|
251
|
-
!props.status ||
|
252
|
-
props.status.status === "CRYPTO_SWAP_REQUIRED" ||
|
253
|
-
props.status.status === "CRYPTO_SWAP_FAILED";
|
254
|
-
|
255
|
-
function getStep1State(): FiatStatusMeta["progressStatus"] {
|
256
|
-
if (!statusMeta) {
|
257
|
-
if (props.step === 2) {
|
258
|
-
return "completed";
|
259
|
-
}
|
260
|
-
return "actionRequired";
|
261
|
-
}
|
262
|
-
|
263
|
-
if (statusMeta.step === 2) {
|
264
|
-
return "completed";
|
265
|
-
}
|
266
|
-
|
267
|
-
return statusMeta.progressStatus;
|
268
|
-
}
|
269
|
-
|
270
|
-
function getStep2State(): FiatStatusMeta["progressStatus"] | undefined {
|
271
|
-
if (!statusMeta) {
|
272
|
-
if (props.step === 2) {
|
273
|
-
return "actionRequired";
|
274
|
-
}
|
275
|
-
return undefined;
|
276
|
-
}
|
277
|
-
|
278
|
-
if (statusMeta.step === 2) {
|
279
|
-
return statusMeta.progressStatus;
|
280
|
-
}
|
281
|
-
|
282
|
-
return undefined;
|
283
|
-
}
|
284
|
-
|
285
|
-
return (
|
286
|
-
<Container p="lg">
|
287
|
-
<ModalHeader title={props.title} onBack={props.onBack} />
|
288
|
-
<Spacer y="lg" />
|
289
|
-
|
290
|
-
{/* Step 1 */}
|
291
|
-
<PaymentStep
|
292
|
-
title={
|
293
|
-
<Text color="primaryText" size="md">
|
294
|
-
Get{" "}
|
295
|
-
<TokenSymbol
|
296
|
-
token={onRampToken}
|
297
|
-
chain={onRampChain}
|
298
|
-
size="md"
|
299
|
-
inline
|
300
|
-
/>{" "}
|
301
|
-
with {props.partialQuote.fromCurrencySymbol}
|
302
|
-
</Text>
|
303
|
-
}
|
304
|
-
step={1}
|
305
|
-
from={{
|
306
|
-
icon: fiatIcon,
|
307
|
-
primaryText: (
|
308
|
-
<Text color="primaryText" size="sm">
|
309
|
-
{formatNumber(Number(fromCurrencyAmount), 6)} {fromCurrencySymbol}
|
310
|
-
</Text>
|
311
|
-
),
|
312
|
-
}}
|
313
|
-
to={{
|
314
|
-
icon: onRampTokenIcon,
|
315
|
-
primaryText: onRampTokenInfo,
|
316
|
-
secondaryText: onRampChainInfo,
|
317
|
-
}}
|
318
|
-
state={getStep1State()}
|
319
|
-
explorer={
|
320
|
-
onRampExplorers.explorers[0]?.url && onRampTxHash
|
321
|
-
? {
|
322
|
-
label: "View on Explorer",
|
323
|
-
url: formatExplorerTxUrl(
|
324
|
-
onRampExplorers.explorers[0]?.url,
|
325
|
-
onRampTxHash,
|
326
|
-
),
|
327
|
-
}
|
328
|
-
: undefined
|
329
|
-
}
|
330
|
-
/>
|
331
|
-
|
332
|
-
<Spacer y="md" />
|
333
|
-
|
334
|
-
<PaymentStep
|
335
|
-
title={
|
336
|
-
<Text color="primaryText" size="md">
|
337
|
-
Convert{" "}
|
338
|
-
<TokenSymbol
|
339
|
-
token={onRampToken}
|
340
|
-
chain={onRampChain}
|
341
|
-
size="md"
|
342
|
-
inline
|
343
|
-
/>{" "}
|
344
|
-
to <TokenSymbol token={toToken} chain={toChain} size="md" inline />
|
345
|
-
</Text>
|
346
|
-
}
|
347
|
-
step={2}
|
348
|
-
from={{
|
349
|
-
icon: onRampTokenIcon,
|
350
|
-
primaryText: onRampTokenInfo,
|
351
|
-
secondaryText: onRampChainInfo,
|
352
|
-
}}
|
353
|
-
to={{
|
354
|
-
icon: toTokenIcon,
|
355
|
-
primaryText: toTokenInfo,
|
356
|
-
secondaryText: toTokehChainInfo,
|
357
|
-
}}
|
358
|
-
state={getStep2State()}
|
359
|
-
explorer={
|
360
|
-
toChainExplorers.explorers[0]?.url && toTokenTxHash
|
361
|
-
? {
|
362
|
-
label: "View on Explorer",
|
363
|
-
url: formatExplorerTxUrl(
|
364
|
-
toChainExplorers.explorers[0]?.url,
|
365
|
-
toTokenTxHash,
|
366
|
-
),
|
367
|
-
}
|
368
|
-
: undefined
|
369
|
-
}
|
370
|
-
/>
|
371
|
-
|
372
|
-
{isPartialSuccess &&
|
373
|
-
props.status &&
|
374
|
-
props.status.status !== "NOT_FOUND" &&
|
375
|
-
props.status.source &&
|
376
|
-
props.status.destination && (
|
377
|
-
<>
|
378
|
-
<Spacer y="md" />
|
379
|
-
<Text color="danger" size="sm" center>
|
380
|
-
Expected {props.status.source?.token.symbol}, Got{" "}
|
381
|
-
{props.status.destination?.token.symbol} instead
|
382
|
-
</Text>
|
383
|
-
<Spacer y="sm" />
|
384
|
-
</>
|
385
|
-
)}
|
386
|
-
|
387
|
-
{showContinueBtn && (
|
388
|
-
<>
|
389
|
-
<Spacer y="md" />
|
390
|
-
<Button variant="accent" onClick={props.onContinue} fullWidth>
|
391
|
-
Continue
|
392
|
-
</Button>
|
393
|
-
</>
|
394
|
-
)}
|
395
|
-
</Container>
|
396
|
-
);
|
397
|
-
}
|
398
|
-
|
399
|
-
function PaymentStep(props: {
|
400
|
-
step: number;
|
401
|
-
title: React.ReactNode;
|
402
|
-
state?: FiatStatusMeta["progressStatus"];
|
403
|
-
from: {
|
404
|
-
icon: React.ReactNode;
|
405
|
-
primaryText: React.ReactNode;
|
406
|
-
secondaryText?: React.ReactNode;
|
407
|
-
};
|
408
|
-
to: {
|
409
|
-
icon: React.ReactNode;
|
410
|
-
primaryText: React.ReactNode;
|
411
|
-
secondaryText?: React.ReactNode;
|
412
|
-
};
|
413
|
-
iconText?: string;
|
414
|
-
explorer?: {
|
415
|
-
label: string;
|
416
|
-
url: string;
|
417
|
-
};
|
418
|
-
}) {
|
419
|
-
return (
|
420
|
-
<StepContainer state={props.state}>
|
421
|
-
<Text size="sm">Step {props.step}</Text>
|
422
|
-
<Spacer y="sm" />
|
423
|
-
{props.title}
|
424
|
-
<Spacer y="sm" />
|
425
|
-
<Line />
|
426
|
-
<Spacer y="md" />
|
427
|
-
|
428
|
-
<PaymentSubStep {...props.from} />
|
429
|
-
|
430
|
-
<Container
|
431
|
-
color="borderColor"
|
432
|
-
style={{
|
433
|
-
paddingLeft: "18px",
|
434
|
-
position: "relative",
|
435
|
-
marginBlock: "3px",
|
436
|
-
}}
|
437
|
-
>
|
438
|
-
{/* TODO - replace this with SVG */}
|
439
|
-
<div
|
440
|
-
style={{
|
441
|
-
height: "18px",
|
442
|
-
width: "2px",
|
443
|
-
backgroundColor: "currentColor",
|
444
|
-
transform: "translateX(-50%)",
|
445
|
-
}}
|
446
|
-
/>
|
447
|
-
<TriangleDownIcon
|
448
|
-
width={iconSize.sm}
|
449
|
-
height={iconSize.sm}
|
450
|
-
style={{
|
451
|
-
position: "absolute",
|
452
|
-
bottom: "0",
|
453
|
-
transform: "translate(-50%, 50%)",
|
454
|
-
}}
|
455
|
-
/>
|
456
|
-
</Container>
|
457
|
-
|
458
|
-
<PaymentSubStep {...props.to} />
|
459
|
-
|
460
|
-
{props.explorer && (
|
461
|
-
<>
|
462
|
-
<Spacer y="md" />
|
463
|
-
<ButtonLink
|
464
|
-
variant="outline"
|
465
|
-
fullWidth
|
466
|
-
href={props.explorer.url}
|
467
|
-
style={{
|
468
|
-
fontSize: fontSize.xs,
|
469
|
-
padding: spacing.xs,
|
470
|
-
}}
|
471
|
-
gap="xxs"
|
472
|
-
target="_blank"
|
473
|
-
>
|
474
|
-
{props.explorer.label}
|
475
|
-
<ExternalLinkIcon width={iconSize.xs} height={iconSize.xs} />
|
476
|
-
</ButtonLink>
|
477
|
-
</>
|
478
|
-
)}
|
479
|
-
</StepContainer>
|
480
|
-
);
|
481
|
-
}
|
482
|
-
|
483
|
-
function PaymentSubStep(props: {
|
484
|
-
icon: React.ReactNode;
|
485
|
-
primaryText: React.ReactNode;
|
486
|
-
secondaryText?: React.ReactNode;
|
487
|
-
}) {
|
488
|
-
return (
|
489
|
-
<Container
|
490
|
-
flex="row"
|
491
|
-
gap="sm"
|
492
|
-
center="y"
|
493
|
-
style={{
|
494
|
-
flexWrap: "nowrap",
|
495
|
-
}}
|
496
|
-
>
|
497
|
-
{/* icon */}
|
498
|
-
<Container
|
499
|
-
p="xs"
|
500
|
-
borderColor="borderColor"
|
501
|
-
flex="row"
|
502
|
-
center="both"
|
503
|
-
style={{
|
504
|
-
borderStyle: "solid",
|
505
|
-
borderWidth: "1.5px",
|
506
|
-
borderRadius: radius.lg,
|
507
|
-
}}
|
508
|
-
>
|
509
|
-
{props.icon}
|
510
|
-
</Container>
|
511
|
-
<Container flex="column" gap="xxs">
|
512
|
-
{props.primaryText} {props.secondaryText}
|
513
|
-
</Container>
|
514
|
-
</Container>
|
515
|
-
);
|
516
|
-
}
|
12
|
+
import type { FiatStatusMeta } from "../pay-transactions/statusMeta.js";
|
517
13
|
|
518
14
|
export function StepContainer(props: {
|
519
15
|
state?: FiatStatusMeta["progressStatus"];
|
@@ -535,9 +31,6 @@ export function StepContainer(props: {
|
|
535
31
|
} else if (props.state === "failed") {
|
536
32
|
color = "danger";
|
537
33
|
text = "Failed";
|
538
|
-
} else if (props.state === "partialSuccess") {
|
539
|
-
color = "danger";
|
540
|
-
text = "Incomplete";
|
541
34
|
}
|
542
35
|
|
543
36
|
return (
|
@@ -496,19 +496,12 @@ function useOnRampStatus(props: {
|
|
496
496
|
|
497
497
|
switch (statusQuery.data?.status) {
|
498
498
|
case "ON_RAMP_TRANSFER_COMPLETED":
|
499
|
-
case "CRYPTO_SWAP_COMPLETED":
|
500
|
-
case "CRYPTO_SWAP_REQUIRED":
|
501
499
|
uiStatus = "completed";
|
502
500
|
break;
|
503
|
-
case "CRYPTO_SWAP_FALLBACK":
|
504
|
-
uiStatus = "partialSuccess";
|
505
|
-
break;
|
506
|
-
case "ON_RAMP_TRANSFER_FAILED":
|
507
501
|
case "PAYMENT_FAILED":
|
508
502
|
uiStatus = "failed";
|
509
503
|
break;
|
510
504
|
case "PENDING_PAYMENT":
|
511
|
-
case "ON_RAMP_TRANSFER_IN_PROGRESS":
|
512
505
|
uiStatus = "pending";
|
513
506
|
break;
|
514
507
|
default:
|
@@ -522,10 +515,7 @@ function useOnRampStatus(props: {
|
|
522
515
|
return;
|
523
516
|
}
|
524
517
|
|
525
|
-
if (
|
526
|
-
statusQuery.data &&
|
527
|
-
(uiStatus === "completed" || uiStatus === "partialSuccess")
|
528
|
-
) {
|
518
|
+
if (statusQuery.data && uiStatus === "completed") {
|
529
519
|
purchaseCbCalled.current = true;
|
530
520
|
props.onSuccess(statusQuery.data);
|
531
521
|
}
|
@@ -537,7 +527,7 @@ function useOnRampStatus(props: {
|
|
537
527
|
return;
|
538
528
|
}
|
539
529
|
|
540
|
-
if (uiStatus === "completed"
|
530
|
+
if (uiStatus === "completed") {
|
541
531
|
try {
|
542
532
|
if (props.openedWindow && !props.openedWindow.closed) {
|
543
533
|
props.openedWindow.close();
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { ChainMetadata } from "../../../../../../../chains/types.js";
|
1
2
|
import type { BuyWithCryptoQuote } from "../../../../../../../pay/buyWithCrypto/getQuote.js";
|
2
3
|
import type { BuyWithFiatQuote } from "../../../../../../../pay/buyWithFiat/getQuote.js";
|
3
4
|
import type { GetWalletBalanceResult } from "../../../../../../../wallets/utils/getWalletBalance.js";
|
@@ -9,6 +10,7 @@ export type TransactionCostAndData = {
|
|
9
10
|
walletBalance: GetWalletBalanceResult;
|
10
11
|
transactionValueWei: bigint;
|
11
12
|
gasCostWei: bigint;
|
13
|
+
chainMetadata: ChainMetadata;
|
12
14
|
};
|
13
15
|
|
14
16
|
export type SelectedScreen =
|
@@ -18,6 +18,7 @@ export function useTransactionCostAndData(args: {
|
|
18
18
|
transaction: PreparedTransaction;
|
19
19
|
account: Account | undefined;
|
20
20
|
supportedDestinations: SupportedChainAndTokens;
|
21
|
+
refetchIntervalMs?: number;
|
21
22
|
}) {
|
22
23
|
const { transaction, account, supportedDestinations } = args;
|
23
24
|
// Compute query key of the transaction first
|
@@ -62,22 +63,24 @@ export function useTransactionCostAndData(args: {
|
|
62
63
|
|
63
64
|
const erc20Value = await resolvePromisedValue(transaction.erc20Value);
|
64
65
|
if (erc20Value) {
|
65
|
-
const [tokenBalance, tokenMeta, gasCostWei] =
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
client: transaction.client,
|
70
|
-
tokenAddress: erc20Value.tokenAddress,
|
71
|
-
}),
|
72
|
-
getCurrencyMetadata({
|
73
|
-
contract: getContract({
|
74
|
-
address: erc20Value.tokenAddress,
|
66
|
+
const [tokenBalance, tokenMeta, gasCostWei, chainMetadata] =
|
67
|
+
await Promise.all([
|
68
|
+
getWalletBalance({
|
69
|
+
address: account.address,
|
75
70
|
chain: transaction.chain,
|
76
71
|
client: transaction.client,
|
72
|
+
tokenAddress: erc20Value.tokenAddress,
|
77
73
|
}),
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
getCurrencyMetadata({
|
75
|
+
contract: getContract({
|
76
|
+
address: erc20Value.tokenAddress,
|
77
|
+
chain: transaction.chain,
|
78
|
+
client: transaction.client,
|
79
|
+
}),
|
80
|
+
}),
|
81
|
+
getTransactionGasCost(transaction, account?.address),
|
82
|
+
getChainMetadata(transaction.chain),
|
83
|
+
]);
|
81
84
|
const transactionValueWei = erc20Value.amountWei;
|
82
85
|
const walletBalance = tokenBalance;
|
83
86
|
const currency = {
|
@@ -95,6 +98,7 @@ export function useTransactionCostAndData(args: {
|
|
95
98
|
return {
|
96
99
|
token: currency,
|
97
100
|
decimals: tokenMeta.decimals,
|
101
|
+
chainMetadata,
|
98
102
|
walletBalance,
|
99
103
|
gasCostWei,
|
100
104
|
transactionValueWei,
|
@@ -121,6 +125,7 @@ export function useTransactionCostAndData(args: {
|
|
121
125
|
symbol: chainMetadata.nativeCurrency.symbol,
|
122
126
|
icon: chainMetadata.icon?.url,
|
123
127
|
},
|
128
|
+
chainMetadata,
|
124
129
|
decimals: 18,
|
125
130
|
walletBalance,
|
126
131
|
gasCostWei,
|
@@ -128,12 +133,6 @@ export function useTransactionCostAndData(args: {
|
|
128
133
|
} satisfies TransactionCostAndData;
|
129
134
|
},
|
130
135
|
enabled: !!transaction && !!txQueryKey,
|
131
|
-
refetchInterval:
|
132
|
-
if (transaction.erc20Value) {
|
133
|
-
// if erc20 value is set, we don't need to poll
|
134
|
-
return undefined;
|
135
|
-
}
|
136
|
-
return 30_000;
|
137
|
-
},
|
136
|
+
refetchInterval: args.refetchIntervalMs || 30_000,
|
138
137
|
});
|
139
138
|
}
|