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
@@ -0,0 +1,270 @@
|
|
1
|
+
import type { Address as ox__Address } from "ox";
|
2
|
+
import { defineChain } from "../chains/utils.js";
|
3
|
+
import type { ThirdwebClient } from "../client/client.js";
|
4
|
+
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
5
|
+
import { getClientFetch } from "../utils/fetch.js";
|
6
|
+
import { stringify } from "../utils/json.js";
|
7
|
+
import type { PreparedQuote } from "./types/Quote.js";
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Prepares a **finalized** Universal Bridge quote for the provided transfer request with transaction data.
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* ```typescript
|
14
|
+
* import { Bridge, NATIVE_TOKEN_ADDRESS } from "thirdweb";
|
15
|
+
*
|
16
|
+
* const quote = await Bridge.Transfer.prepare({
|
17
|
+
* chainId: 1,
|
18
|
+
* tokenAddress: NATIVE_TOKEN_ADDRESS,
|
19
|
+
* amount: toWei("0.01"),
|
20
|
+
* sender: "0x...",
|
21
|
+
* receiver: "0x...",
|
22
|
+
* client: thirdwebClient,
|
23
|
+
* });
|
24
|
+
* ```
|
25
|
+
*
|
26
|
+
* This will return a quote that might look like:
|
27
|
+
* ```typescript
|
28
|
+
* {
|
29
|
+
* originAmount: 10000026098875381n,
|
30
|
+
* destinationAmount: 10000000000000000n,
|
31
|
+
* blockNumber: 22026509n,
|
32
|
+
* timestamp: 1741730936680,
|
33
|
+
* estimatedExecutionTimeMs: 1000
|
34
|
+
* steps: [
|
35
|
+
* {
|
36
|
+
* originToken: {
|
37
|
+
* chainId: 1,
|
38
|
+
* address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
39
|
+
* symbol: "ETH",
|
40
|
+
* name: "Ethereum",
|
41
|
+
* decimals: 18,
|
42
|
+
* priceUsd: 2000,
|
43
|
+
* iconUri: "https://..."
|
44
|
+
* },
|
45
|
+
* destinationToken: {
|
46
|
+
* chainId: 1,
|
47
|
+
* address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
48
|
+
* symbol: "ETH",
|
49
|
+
* name: "Ethereum",
|
50
|
+
* decimals: 18,
|
51
|
+
* priceUsd: 2000,
|
52
|
+
* iconUri: "https://..."
|
53
|
+
* },
|
54
|
+
* originAmount: 10000026098875381n,
|
55
|
+
* destinationAmount: 10000000000000000n,
|
56
|
+
* estimatedExecutionTimeMs: 1000
|
57
|
+
* transactions: [
|
58
|
+
* {
|
59
|
+
* action: "approval",
|
60
|
+
* id: "0x",
|
61
|
+
* to: "0x...",
|
62
|
+
* data: "0x...",
|
63
|
+
* chainId: 1,
|
64
|
+
* type: "eip1559"
|
65
|
+
* },
|
66
|
+
* {
|
67
|
+
* action: "transfer",
|
68
|
+
* to: "0x...",
|
69
|
+
* value: 10000026098875381n,
|
70
|
+
* data: "0x...",
|
71
|
+
* chainId: 1,
|
72
|
+
* type: "eip1559"
|
73
|
+
* }
|
74
|
+
* ]
|
75
|
+
* }
|
76
|
+
* ],
|
77
|
+
* expiration: 1741730936680,
|
78
|
+
* intent: {
|
79
|
+
* chainId: 1,
|
80
|
+
* tokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
|
81
|
+
* amount: 10000000000000000n,
|
82
|
+
* sender: "0x...",
|
83
|
+
* receiver: "0x..."
|
84
|
+
* }
|
85
|
+
* }
|
86
|
+
* ```
|
87
|
+
*
|
88
|
+
* ## Sending the transactions
|
89
|
+
* The `transactions` array is a series of [ox](https://oxlib.sh) EIP-1559 transactions that must be executed one after the other in order to fulfill the complete route. There are a few things to keep in mind when executing these transactions:
|
90
|
+
* - Approvals will have the `approval` action specified. You can perform approvals with `sendAndConfirmTransaction`, then proceed to the next transaction.
|
91
|
+
* - All transactions are assumed to be executed by the `sender` address, regardless of which chain they are on. The final transaction will use the `receiver` as the recipient address.
|
92
|
+
* - If an `expiration` timestamp is provided, all transactions must be executed before that time to guarantee successful execution at the specified price.
|
93
|
+
*
|
94
|
+
* NOTE: To get the status of each non-approval transaction, use `Bridge.status` rather than checking for transaction inclusion. This function will ensure full completion of the transfer.
|
95
|
+
*
|
96
|
+
* You can access this functions input and output types with `Transfer.prepare.Options` and `Transfer.prepare.Result`, respectively.
|
97
|
+
*
|
98
|
+
* You can include arbitrary data to be included on any webhooks and status responses with the `purchaseData` option.
|
99
|
+
*
|
100
|
+
* ```ts
|
101
|
+
* const quote = await Bridge.Transfer.prepare({
|
102
|
+
* chainId: 1,
|
103
|
+
* tokenAddress: NATIVE_TOKEN_ADDRESS,
|
104
|
+
* amount: toWei("0.01"),
|
105
|
+
* sender: "0x...",
|
106
|
+
* receiver: "0x...",
|
107
|
+
* purchaseData: {
|
108
|
+
* reference: "payment-123",
|
109
|
+
* metadata: {
|
110
|
+
* note: "Transfer to Alice"
|
111
|
+
* }
|
112
|
+
* },
|
113
|
+
* client: thirdwebClient,
|
114
|
+
* });
|
115
|
+
* ```
|
116
|
+
*
|
117
|
+
* ## Fees
|
118
|
+
* There may be fees associated with the transfer. These fees are paid by the `feePayer` address, which defaults to the `sender` address. You can specify a different address with the `feePayer` option. If you do not specify an option or explicitly specify `sender`, the fees will be added to the input amount. If you specify the `receiver` as the fee payer the fees will be subtracted from the destination amount.
|
119
|
+
*
|
120
|
+
* For example, if you were to request a transfer with `feePayer` set to `receiver`:
|
121
|
+
* ```typescript
|
122
|
+
* const quote = await Bridge.Transfer.prepare({
|
123
|
+
* chainId: 1,
|
124
|
+
* tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
125
|
+
* amount: 100_000_000n, // 100 USDC
|
126
|
+
* sender: "0x...",
|
127
|
+
* receiver: "0x...",
|
128
|
+
* feePayer: "receiver",
|
129
|
+
* client: thirdwebClient,
|
130
|
+
* });
|
131
|
+
* ```
|
132
|
+
*
|
133
|
+
* The returned quote might look like:
|
134
|
+
* ```typescript
|
135
|
+
* {
|
136
|
+
* originAmount: 100_000_000n, // 100 USDC
|
137
|
+
* destinationAmount: 99_970_000n, // 99.97 USDC
|
138
|
+
* ...
|
139
|
+
* }
|
140
|
+
* ```
|
141
|
+
*
|
142
|
+
* If you were to request a transfer with `feePayer` set to `sender`:
|
143
|
+
* ```typescript
|
144
|
+
* const quote = await Bridge.Transfer.prepare({
|
145
|
+
* chainId: 1,
|
146
|
+
* tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
|
147
|
+
* amount: 100_000_000n, // 100 USDC
|
148
|
+
* sender: "0x...",
|
149
|
+
* receiver: "0x...",
|
150
|
+
* feePayer: "sender",
|
151
|
+
* client: thirdwebClient,
|
152
|
+
* });
|
153
|
+
* ```
|
154
|
+
*
|
155
|
+
* The returned quote might look like:
|
156
|
+
* ```typescript
|
157
|
+
* {
|
158
|
+
* originAmount: 100_030_000n, // 100.03 USDC
|
159
|
+
* destinationAmount: 100_000_000n, // 100 USDC
|
160
|
+
* ...
|
161
|
+
* }
|
162
|
+
* ```
|
163
|
+
*
|
164
|
+
* @param options - The options for the quote.
|
165
|
+
* @param options.chainId - The chain ID of the token.
|
166
|
+
* @param options.tokenAddress - The address of the token.
|
167
|
+
* @param options.amount - The amount of the token to transfer.
|
168
|
+
* @param options.sender - The address of the sender.
|
169
|
+
* @param options.receiver - The address of the recipient.
|
170
|
+
* @param options.purchaseData - Arbitrary data to be passed to the transfer function and included with any webhooks or status calls.
|
171
|
+
* @param options.client - Your thirdweb client.
|
172
|
+
* @param [options.feePayer] - The address that will pay the fees for the transfer. If not specified, the sender will be used. Values can be "sender" or "receiver".
|
173
|
+
*
|
174
|
+
* @returns A promise that resolves to a finalized quote and transactions for the requested transfer.
|
175
|
+
*
|
176
|
+
* @throws Will throw an error if there is an issue fetching the quote.
|
177
|
+
* @bridge Transfer
|
178
|
+
* @beta
|
179
|
+
*/
|
180
|
+
export async function prepare(
|
181
|
+
options: prepare.Options,
|
182
|
+
): Promise<prepare.Result> {
|
183
|
+
const {
|
184
|
+
chainId,
|
185
|
+
tokenAddress,
|
186
|
+
sender,
|
187
|
+
receiver,
|
188
|
+
client,
|
189
|
+
amount,
|
190
|
+
purchaseData,
|
191
|
+
feePayer,
|
192
|
+
} = options;
|
193
|
+
|
194
|
+
const clientFetch = getClientFetch(client);
|
195
|
+
const url = new URL(`${getThirdwebBaseUrl("bridge")}/v1/transfer/prepare`);
|
196
|
+
|
197
|
+
const response = await clientFetch(url.toString(), {
|
198
|
+
method: "POST",
|
199
|
+
headers: {
|
200
|
+
"Content-Type": "application/json",
|
201
|
+
},
|
202
|
+
body: stringify({
|
203
|
+
transferAmountWei: amount.toString(), // legacy
|
204
|
+
amount: amount.toString(),
|
205
|
+
chainId: chainId.toString(),
|
206
|
+
tokenAddress,
|
207
|
+
sender,
|
208
|
+
receiver,
|
209
|
+
purchaseData,
|
210
|
+
feePayer,
|
211
|
+
}),
|
212
|
+
});
|
213
|
+
if (!response.ok) {
|
214
|
+
const errorJson = await response.json();
|
215
|
+
throw new Error(
|
216
|
+
`${errorJson.code} | ${errorJson.message} - ${errorJson.correlationId}`,
|
217
|
+
);
|
218
|
+
}
|
219
|
+
|
220
|
+
const { data }: { data: PreparedQuote } = await response.json();
|
221
|
+
return {
|
222
|
+
originAmount: BigInt(data.originAmount),
|
223
|
+
destinationAmount: BigInt(data.destinationAmount),
|
224
|
+
blockNumber: data.blockNumber ? BigInt(data.blockNumber) : undefined,
|
225
|
+
timestamp: data.timestamp,
|
226
|
+
estimatedExecutionTimeMs: data.estimatedExecutionTimeMs,
|
227
|
+
steps: data.steps.map((step) => ({
|
228
|
+
...step,
|
229
|
+
transactions: step.transactions.map((transaction) => ({
|
230
|
+
...transaction,
|
231
|
+
value: transaction.value ? BigInt(transaction.value) : undefined,
|
232
|
+
client,
|
233
|
+
chain: defineChain(transaction.chainId),
|
234
|
+
})),
|
235
|
+
})),
|
236
|
+
intent: {
|
237
|
+
chainId,
|
238
|
+
tokenAddress,
|
239
|
+
amount,
|
240
|
+
sender,
|
241
|
+
receiver,
|
242
|
+
feePayer,
|
243
|
+
},
|
244
|
+
};
|
245
|
+
}
|
246
|
+
|
247
|
+
export declare namespace prepare {
|
248
|
+
type Options = {
|
249
|
+
chainId: number;
|
250
|
+
tokenAddress: ox__Address.Address;
|
251
|
+
sender: ox__Address.Address;
|
252
|
+
receiver: ox__Address.Address;
|
253
|
+
amount: bigint;
|
254
|
+
client: ThirdwebClient;
|
255
|
+
purchaseData?: unknown;
|
256
|
+
feePayer?: "sender" | "receiver";
|
257
|
+
};
|
258
|
+
|
259
|
+
type Result = PreparedQuote & {
|
260
|
+
intent: {
|
261
|
+
chainId: number;
|
262
|
+
tokenAddress: ox__Address.Address;
|
263
|
+
amount: bigint;
|
264
|
+
sender: ox__Address.Address;
|
265
|
+
receiver: ox__Address.Address;
|
266
|
+
purchaseData?: unknown;
|
267
|
+
feePayer?: "sender" | "receiver";
|
268
|
+
};
|
269
|
+
};
|
270
|
+
}
|
package/src/bridge/index.ts
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
export * as Buy from "./Buy.js";
|
2
2
|
export * as Sell from "./Sell.js";
|
3
|
+
export * as Transfer from "./Transfer.js";
|
4
|
+
export * as Onramp from "./Onramp.js";
|
3
5
|
export { status } from "./Status.js";
|
4
6
|
export { routes } from "./Routes.js";
|
5
7
|
export { chains } from "./Chains.js";
|
6
8
|
|
7
|
-
export type { Status } from "./types/Status.js";
|
8
|
-
export type { Route } from "./types/Route.js";
|
9
|
-
export type { Quote, PreparedQuote } from "./types/Quote.js";
|
10
9
|
export type { Chain } from "./types/Chain.js";
|
10
|
+
export type { Quote, PreparedQuote } from "./types/Quote.js";
|
11
|
+
export type {
|
12
|
+
Route,
|
13
|
+
RouteQuoteStep,
|
14
|
+
RouteStep,
|
15
|
+
RouteTransaction,
|
16
|
+
} from "./types/Route.js";
|
17
|
+
export type { Status } from "./types/Status.js";
|
18
|
+
export type { Token } from "./types/Token.js";
|
19
|
+
export type { BridgeAction } from "./types/BridgeAction.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
export type BridgeAction = "approval" | "transfer" | "buy" | "sell";
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import type {
|
2
|
-
import type { Chain } from "../../chains/types.js";
|
3
|
-
import type { ThirdwebClient } from "../../client/client.js";
|
1
|
+
import type { RouteQuoteStep, RouteStep } from "./Route.js";
|
4
2
|
|
5
3
|
export type Quote = {
|
6
4
|
/**
|
@@ -26,29 +24,7 @@ export type Quote = {
|
|
26
24
|
/**
|
27
25
|
* The steps required to complete the quote.
|
28
26
|
*/
|
29
|
-
steps:
|
30
|
-
originToken: {
|
31
|
-
chainId: number;
|
32
|
-
address: ox__Hex.Hex;
|
33
|
-
symbol: string;
|
34
|
-
name: string;
|
35
|
-
decimals: number;
|
36
|
-
priceUsd: number;
|
37
|
-
iconUri: string;
|
38
|
-
};
|
39
|
-
destinationToken: {
|
40
|
-
chainId: number;
|
41
|
-
address: ox__Hex.Hex;
|
42
|
-
symbol: string;
|
43
|
-
name: string;
|
44
|
-
decimals: number;
|
45
|
-
priceUsd: number;
|
46
|
-
iconUri: string;
|
47
|
-
};
|
48
|
-
originAmount: bigint;
|
49
|
-
destinationAmount: bigint;
|
50
|
-
estimatedExecutionTimeMs: number;
|
51
|
-
}>;
|
27
|
+
steps: RouteQuoteStep[];
|
52
28
|
};
|
53
29
|
|
54
30
|
export type PreparedQuote = {
|
@@ -79,43 +55,5 @@ export type PreparedQuote = {
|
|
79
55
|
/**
|
80
56
|
* A series of steps required to complete the quote, along with the transactions to execute in order.
|
81
57
|
*/
|
82
|
-
steps:
|
83
|
-
originToken: {
|
84
|
-
chainId: number;
|
85
|
-
address: ox__Hex.Hex;
|
86
|
-
symbol: string;
|
87
|
-
name: string;
|
88
|
-
decimals: number;
|
89
|
-
priceUsd: number;
|
90
|
-
iconUri: string;
|
91
|
-
};
|
92
|
-
destinationToken: {
|
93
|
-
chainId: number;
|
94
|
-
address: ox__Hex.Hex;
|
95
|
-
symbol: string;
|
96
|
-
name: string;
|
97
|
-
decimals: number;
|
98
|
-
priceUsd: number;
|
99
|
-
iconUri: string;
|
100
|
-
};
|
101
|
-
originAmount: bigint;
|
102
|
-
destinationAmount: bigint;
|
103
|
-
estimatedExecutionTimeMs: number;
|
104
|
-
transactions: Array<{
|
105
|
-
data: ox__Hex.Hex;
|
106
|
-
to: ox__Hex.Hex;
|
107
|
-
value?: bigint | undefined;
|
108
|
-
chainId: number;
|
109
|
-
/**
|
110
|
-
* The action this transaction performs. This can be "approval", "transfer", "buy", or "sell".
|
111
|
-
*/
|
112
|
-
action: "approval" | "transfer" | "buy" | "sell";
|
113
|
-
/**
|
114
|
-
* The transaction ID, used for tracking purposes.
|
115
|
-
*/
|
116
|
-
id: ox__Hex.Hex;
|
117
|
-
client: ThirdwebClient;
|
118
|
-
chain: Chain;
|
119
|
-
}>;
|
120
|
-
}>;
|
58
|
+
steps: RouteStep[];
|
121
59
|
};
|
@@ -1,20 +1,45 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Hex as ox__Hex } from "ox";
|
2
|
+
import type { Chain } from "../../chains/types.js";
|
3
|
+
import type { ThirdwebClient } from "../../client/client.js";
|
4
|
+
import type { BridgeAction } from "./BridgeAction.js";
|
5
|
+
import type { Token } from "./Token.js";
|
2
6
|
|
3
7
|
export type Route = {
|
4
|
-
originToken:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
originToken: Token;
|
9
|
+
destinationToken: Token;
|
10
|
+
};
|
11
|
+
|
12
|
+
export type RouteQuoteStep = {
|
13
|
+
originToken: Token;
|
14
|
+
destinationToken: Token;
|
15
|
+
originAmount: bigint;
|
16
|
+
destinationAmount: bigint;
|
17
|
+
estimatedExecutionTimeMs: number;
|
18
|
+
};
|
19
|
+
|
20
|
+
export type RouteStep = {
|
21
|
+
originToken: Token;
|
22
|
+
destinationToken: Token;
|
23
|
+
originAmount: bigint;
|
24
|
+
destinationAmount: bigint;
|
25
|
+
estimatedExecutionTimeMs: number;
|
26
|
+
transactions: RouteTransaction[];
|
27
|
+
};
|
28
|
+
|
29
|
+
export type RouteTransaction = {
|
30
|
+
data: ox__Hex.Hex;
|
31
|
+
to: ox__Hex.Hex;
|
32
|
+
value?: bigint | undefined;
|
33
|
+
chainId: number;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The action this transaction performs. This can be "approval", "transfer", "buy", or "sell".
|
37
|
+
*/
|
38
|
+
action: BridgeAction;
|
39
|
+
/**
|
40
|
+
* The transaction ID, used for tracking purposes.
|
41
|
+
*/
|
42
|
+
id: ox__Hex.Hex;
|
43
|
+
client: ThirdwebClient;
|
44
|
+
chain: Chain;
|
20
45
|
};
|
@@ -1,14 +1,19 @@
|
|
1
1
|
import type { Address as ox__Address, Hex as ox__Hex } from "ox";
|
2
|
-
|
2
|
+
import type { Token } from "./Token.js";
|
3
3
|
export type Status =
|
4
4
|
| {
|
5
5
|
status: "COMPLETED";
|
6
|
+
paymentId: string;
|
6
7
|
originAmount: bigint;
|
7
8
|
destinationAmount: bigint;
|
8
9
|
originChainId: number;
|
9
10
|
destinationChainId: number;
|
10
11
|
originTokenAddress: ox__Address.Address;
|
11
12
|
destinationTokenAddress: ox__Address.Address;
|
13
|
+
originToken: Token;
|
14
|
+
destinationToken: Token;
|
15
|
+
sender: ox__Address.Address;
|
16
|
+
receiver: ox__Address.Address;
|
12
17
|
transactions: Array<{
|
13
18
|
chainId: number;
|
14
19
|
transactionHash: ox__Hex.Hex;
|
@@ -17,24 +22,33 @@ export type Status =
|
|
17
22
|
}
|
18
23
|
| {
|
19
24
|
status: "PENDING";
|
25
|
+
paymentId: string;
|
20
26
|
originAmount: bigint;
|
21
27
|
originChainId: number;
|
22
28
|
destinationChainId: number;
|
23
29
|
originTokenAddress: ox__Address.Address;
|
24
30
|
destinationTokenAddress: ox__Address.Address;
|
31
|
+
originToken: Token;
|
32
|
+
destinationToken: Token;
|
33
|
+
sender: ox__Address.Address;
|
34
|
+
receiver: ox__Address.Address;
|
25
35
|
transactions: Array<{
|
26
36
|
chainId: number;
|
27
37
|
transactionHash: ox__Hex.Hex;
|
28
38
|
}>;
|
39
|
+
purchaseData?: unknown;
|
29
40
|
}
|
30
41
|
| {
|
31
42
|
status: "FAILED";
|
43
|
+
paymentId: string;
|
32
44
|
transactions: Array<{
|
33
45
|
chainId: number;
|
34
46
|
transactionHash: ox__Hex.Hex;
|
35
47
|
}>;
|
48
|
+
purchaseData?: unknown;
|
36
49
|
}
|
37
50
|
| {
|
38
51
|
status: "NOT_FOUND";
|
52
|
+
paymentId: string;
|
39
53
|
transactions: [];
|
40
54
|
};
|
@@ -4,7 +4,6 @@ import * as ox__Bytes from "ox/Bytes";
|
|
4
4
|
import * as ox__Ens from "ox/Ens";
|
5
5
|
import * as ox__Hash from "ox/Hash";
|
6
6
|
import * as ox__Hex from "ox/Hex";
|
7
|
-
import { keccak256 } from "viem";
|
8
7
|
import type { Chain } from "../../chains/types.js";
|
9
8
|
import type { ThirdwebClient } from "../../client/client.js";
|
10
9
|
import { getContract } from "../../contract/contract.js";
|
@@ -47,7 +46,6 @@ const convertReverseNodeToBytes = (address: Address, chainId: number) => {
|
|
47
46
|
[reverseNode, addressNode],
|
48
47
|
),
|
49
48
|
);
|
50
|
-
keccak256;
|
51
49
|
return addressReverseNode;
|
52
50
|
};
|
53
51
|
|
@@ -10,16 +10,6 @@ export type QuoteTokenInfo = {
|
|
10
10
|
symbol?: string;
|
11
11
|
};
|
12
12
|
|
13
|
-
export type QuoteTransactionRequest = {
|
14
|
-
data: string;
|
15
|
-
to: string;
|
16
|
-
value: string;
|
17
|
-
from: string;
|
18
|
-
chainId: number;
|
19
|
-
gasPrice: string;
|
20
|
-
gasLimit: string;
|
21
|
-
};
|
22
|
-
|
23
13
|
export type QuoteApprovalInfo = {
|
24
14
|
chainId: number;
|
25
15
|
tokenAddress: string;
|