thirdweb 5.34.4-nightly-88fa60d4ad7ee6ce0a8305ce35e023d1a858ea85-20240716000333 → 5.35.0-nightly-39b329a56e9eb031e1799524d827fdf69a92c854-20240717000718
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/exports/extensions/airdrop.js +7 -1
- package/dist/cjs/exports/extensions/airdrop.js.map +1 -1
- package/dist/cjs/exports/thirdweb.js +3 -1
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/extensions/airdrop/write/claimERC20.js +1 -1
- package/dist/cjs/extensions/airdrop/write/claimERC20.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js +2 -5
- package/dist/cjs/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/cjs/react/core/hooks/others/useWalletBalance.js.map +1 -1
- package/dist/cjs/react/core/utils/wallet.js +8 -0
- package/dist/cjs/react/core/utils/wallet.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectButton.js +13 -2
- package/dist/cjs/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +69 -14
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +3 -0
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/WalletLoadingThumbnail.js +5 -3
- package/dist/cjs/react/native/ui/connect/WalletLoadingThumbnail.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +8 -6
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js +11 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/locale/vi.js +112 -0
- package/dist/cjs/react/web/ui/ConnectWallet/locale/vi.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +8 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.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 +1 -6
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +1 -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/ManageWalletScreen.js +3 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewFunds.js +4 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewFunds.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
- package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/injected/locale/vi.js +27 -0
- package/dist/cjs/react/web/wallets/injected/locale/vi.js.map +1 -0
- package/dist/cjs/react/web/wallets/local/locale/getLocalWalletLocale.js +2 -0
- package/dist/cjs/react/web/wallets/local/locale/getLocalWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/local/locale/vi.js +44 -0
- package/dist/cjs/react/web/wallets/local/locale/vi.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
- package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/vi.js +54 -0
- package/dist/cjs/react/web/wallets/shared/locale/vi.js.map +1 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/cjs/react/web/wallets/smartWallet/locale/vi.js +13 -0
- package/dist/cjs/react/web/wallets/smartWallet/locale/vi.js.map +1 -0
- package/dist/cjs/react/web/wallets/walletConnect/locale.js +4 -0
- package/dist/cjs/react/web/wallets/walletConnect/locale.js.map +1 -1
- package/dist/cjs/transaction/extract-error.js +12 -13
- package/dist/cjs/transaction/extract-error.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js +34 -0
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js +36 -2
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js +34 -0
- package/dist/cjs/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/in-app-account.js +12 -8
- package/dist/cjs/wallets/in-app/web/lib/in-app-account.js.map +1 -1
- package/dist/esm/exports/extensions/airdrop.js +3 -0
- package/dist/esm/exports/extensions/airdrop.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +1 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/extensions/airdrop/write/claimERC20.js +2 -2
- package/dist/esm/extensions/airdrop/write/claimERC20.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js +2 -5
- package/dist/esm/pay/buyWithFiat/getPostOnRampQuote.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/esm/react/core/hooks/others/useWalletBalance.js.map +1 -1
- package/dist/esm/react/core/utils/wallet.js +8 -0
- package/dist/esm/react/core/utils/wallet.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectButton.js +13 -2
- package/dist/esm/react/native/ui/connect/ConnectButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +70 -15
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -0
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/WalletLoadingThumbnail.js +5 -3
- package/dist/esm/react/native/ui/connect/WalletLoadingThumbnail.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +8 -6
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js +11 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/en.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/es.js +11 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/es.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js +11 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/ja.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js +11 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/tl.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/locale/vi.js +110 -0
- package/dist/esm/react/web/ui/ConnectWallet/locale/vi.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +8 -10
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.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 +1 -6
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.js +1 -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/ManageWalletScreen.js +3 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/ManageWalletScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewFunds.js +4 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewFunds.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
- package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/injected/locale/vi.js +25 -0
- package/dist/esm/react/web/wallets/injected/locale/vi.js.map +1 -0
- package/dist/esm/react/web/wallets/local/locale/getLocalWalletLocale.js +2 -0
- package/dist/esm/react/web/wallets/local/locale/getLocalWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/local/locale/vi.js +42 -0
- package/dist/esm/react/web/wallets/local/locale/vi.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
- package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/vi.js +52 -0
- package/dist/esm/react/web/wallets/shared/locale/vi.js.map +1 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
- package/dist/esm/react/web/wallets/smartWallet/locale/vi.js +11 -0
- package/dist/esm/react/web/wallets/smartWallet/locale/vi.js.map +1 -0
- package/dist/esm/react/web/wallets/walletConnect/locale.js +4 -0
- package/dist/esm/react/web/wallets/walletConnect/locale.js.map +1 -1
- package/dist/esm/transaction/extract-error.js +12 -13
- package/dist/esm/transaction/extract-error.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js +34 -0
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc1155.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js +35 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc20.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js +34 -0
- package/dist/esm/utils/extensions/airdrop/fetch-proofs-erc721.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/in-app-account.js +12 -8
- package/dist/esm/wallets/in-app/web/lib/in-app-account.js.map +1 -1
- package/dist/types/exports/extensions/airdrop.d.ts +3 -0
- package/dist/types/exports/extensions/airdrop.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +1 -0
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getPostOnRampQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getStatus.d.ts +8 -1
- package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +6 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/others/useWalletBalance.d.ts +7 -1
- package/dist/types/react/core/hooks/others/useWalletBalance.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts +2 -2
- package/dist/types/react/core/utils/wallet.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts +4 -0
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/WalletLoadingThumbnail.d.ts +2 -1
- package/dist/types/react/native/ui/connect/WalletLoadingThumbnail.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.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/getConnectLocale.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 +11 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/types.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/locale/vi.d.ts +4 -0
- package/dist/types/react/web/ui/ConnectWallet/locale/vi.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts +0 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ManageWalletScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewFunds.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewFunds.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts +2 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts.map +1 -1
- package/dist/types/react/web/ui/types.d.ts +1 -1
- package/dist/types/react/web/ui/types.d.ts.map +1 -1
- package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/injected/locale/vi.d.ts +7 -0
- package/dist/types/react/web/wallets/injected/locale/vi.d.ts.map +1 -0
- package/dist/types/react/web/wallets/local/locale/getLocalWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/local/locale/vi.d.ts +4 -0
- package/dist/types/react/web/wallets/local/locale/vi.d.ts.map +1 -0
- package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/vi.d.ts +53 -0
- package/dist/types/react/web/wallets/shared/locale/vi.d.ts.map +1 -0
- package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
- package/dist/types/react/web/wallets/smartWallet/locale/vi.d.ts +4 -0
- package/dist/types/react/web/wallets/smartWallet/locale/vi.d.ts.map +1 -0
- package/dist/types/react/web/wallets/walletConnect/locale.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/fetch-proofs-erc1155.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/fetch-proofs-erc20.d.ts +1 -1
- package/dist/types/utils/extensions/airdrop/fetch-proofs-erc20.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/fetch-proofs-erc721.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/in-app-account.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/extensions/airdrop.ts +3 -0
- package/src/exports/thirdweb.ts +5 -0
- package/src/extensions/airdrop/write/claimERC20.ts +2 -2
- package/src/pay/buyWithFiat/getPostOnRampQuote.ts +2 -5
- package/src/pay/buyWithFiat/getStatus.ts +8 -1
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +7 -0
- package/src/react/core/hooks/others/useWalletBalance.ts +9 -1
- package/src/react/core/utils/wallet.ts +10 -2
- package/src/react/native/ui/connect/ConnectButton.tsx +16 -4
- package/src/react/native/ui/connect/ConnectModal.tsx +181 -19
- package/src/react/native/ui/connect/ConnectedModal.tsx +3 -0
- package/src/react/native/ui/connect/WalletLoadingThumbnail.tsx +18 -13
- package/src/react/web/ui/ConnectWallet/Details.tsx +8 -2
- package/src/react/web/ui/ConnectWallet/locale/en.ts +11 -0
- package/src/react/web/ui/ConnectWallet/locale/es.ts +11 -0
- package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
- package/src/react/web/ui/ConnectWallet/locale/ja.ts +11 -0
- package/src/react/web/ui/ConnectWallet/locale/tl.ts +11 -0
- package/src/react/web/ui/ConnectWallet/locale/types.ts +11 -0
- package/src/react/web/ui/ConnectWallet/locale/vi.ts +114 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +15 -17
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +0 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +0 -23
- package/src/react/web/ui/ConnectWallet/screens/Buy/tx-history/BuyTxHistory.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/ManageWalletScreen.tsx +10 -3
- package/src/react/web/ui/ConnectWallet/screens/ViewFunds.tsx +9 -3
- package/src/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx +8 -1
- package/src/react/web/ui/ConnectWallet/screens/ViewTokens.tsx +7 -1
- package/src/react/web/ui/types.ts +1 -1
- package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +2 -0
- package/src/react/web/wallets/injected/locale/vi.ts +27 -0
- package/src/react/web/wallets/local/locale/getLocalWalletLocale.ts +2 -0
- package/src/react/web/wallets/local/locale/vi.ts +48 -0
- package/src/react/web/wallets/shared/locale/getConnectLocale.ts +2 -0
- package/src/react/web/wallets/shared/locale/vi.ts +56 -0
- package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +2 -0
- package/src/react/web/wallets/smartWallet/locale/vi.ts +13 -0
- package/src/react/web/wallets/walletConnect/locale.ts +4 -0
- package/src/transaction/extract-error.ts +9 -9
- package/src/utils/extensions/airdrop/fetch-proofs-erc1155.ts +34 -0
- package/src/utils/extensions/airdrop/fetch-proofs-erc20.ts +35 -1
- package/src/utils/extensions/airdrop/fetch-proofs-erc721.ts +34 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/web/lib/in-app-account.ts +12 -8
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ThirdwebContract } from "../../../contract/contract.js";
|
2
2
|
import type { ClaimProofERC20 } from "./types.js";
|
3
|
-
export declare function
|
3
|
+
export declare function fetchProofsERC20(options: {
|
4
4
|
contract: ThirdwebContract;
|
5
5
|
recipient: string;
|
6
6
|
merkleRoot: string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch-proofs-erc20.d.ts","sourceRoot":"","sources":["../../../../../src/utils/extensions/airdrop/fetch-proofs-erc20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOtE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"fetch-proofs-erc20.d.ts","sourceRoot":"","sources":["../../../../../src/utils/extensions/airdrop/fetch-proofs-erc20.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOtE,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,YAAY,CAAC;AAoCpB,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA2ElC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fetch-proofs-erc721.d.ts","sourceRoot":"","sources":["../../../../../src/utils/extensions/airdrop/fetch-proofs-erc721.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMtE,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"fetch-proofs-erc721.d.ts","sourceRoot":"","sources":["../../../../../src/utils/extensions/airdrop/fetch-proofs-erc721.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMtE,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAoCpB,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAoEnC"}
|
package/dist/types/version.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare const version = "5.
|
1
|
+
export declare const version = "5.35.0-nightly-39b329a56e9eb031e1799524d827fdf69a92c854-20240717000718";
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"in-app-account.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/in-app-account.ts"],"names":[],"mappings":"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
|
1
|
+
{"version":3,"file":"in-app-account.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/in-app-account.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.35.0-nightly-39b329a56e9eb031e1799524d827fdf69a92c854-20240717000718",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -13,6 +13,9 @@ export {
|
|
13
13
|
tokenMerkleRoot,
|
14
14
|
type TokenMerkleRootParams,
|
15
15
|
} from "../../extensions/airdrop/__generated__/Airdrop/read/tokenMerkleRoot.js";
|
16
|
+
export { fetchProofsERC721 } from "../../utils/extensions/airdrop/fetch-proofs-erc721.js";
|
17
|
+
export { fetchProofsERC20 } from "../../utils/extensions/airdrop/fetch-proofs-erc20.js";
|
18
|
+
export { fetchProofsERC1155 } from "../../utils/extensions/airdrop/fetch-proofs-erc1155.js";
|
16
19
|
|
17
20
|
/**
|
18
21
|
* Write
|
package/src/exports/thirdweb.ts
CHANGED
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
} from "../../../constants/addresses.js";
|
5
5
|
import type { BaseTransactionOptions } from "../../../transaction/types.js";
|
6
6
|
import type { Address } from "../../../utils/address.js";
|
7
|
-
import {
|
7
|
+
import { fetchProofsERC20 } from "../../../utils/extensions/airdrop/fetch-proofs-erc20.js";
|
8
8
|
import { tokenMerkleRoot } from "../__generated__/Airdrop/read/tokenMerkleRoot.js";
|
9
9
|
import { claimERC20 as generatedClaimERC20 } from "../__generated__/Airdrop/write/claimERC20.js";
|
10
10
|
|
@@ -67,7 +67,7 @@ export function claimERC20(options: BaseTransactionOptions<ClaimERC20Params>) {
|
|
67
67
|
return await getDecimals({ contract: tokenContract });
|
68
68
|
})();
|
69
69
|
|
70
|
-
const merkleProof = await
|
70
|
+
const merkleProof = await fetchProofsERC20({
|
71
71
|
contract: options.contract,
|
72
72
|
recipient: options.recipient,
|
73
73
|
merkleRoot,
|
@@ -67,11 +67,8 @@ export async function getPostOnRampQuote({
|
|
67
67
|
return getBuyWithCryptoQuote({
|
68
68
|
client,
|
69
69
|
intentId: buyWithFiatStatus.intentId,
|
70
|
-
//
|
71
|
-
|
72
|
-
// fiat endpoint should assume this flow and return the quote/status/history accordingly
|
73
|
-
// but for now - we will just not allow doing a fiat flow in Pay UI if payer and receiver wallets are different + requires a swap
|
74
|
-
fromAddress: buyWithFiatStatus.toAddress,
|
70
|
+
// onramp always happens to fromAddress, and then swap is done from - fromAddress to toAddress
|
71
|
+
fromAddress: buyWithFiatStatus.fromAddress,
|
75
72
|
toAddress: buyWithFiatStatus.toAddress,
|
76
73
|
fromChainId: buyWithFiatStatus.quote.onRampToken.chainId,
|
77
74
|
fromTokenAddress: buyWithFiatStatus.quote.onRampToken.tokenAddress,
|
@@ -70,9 +70,16 @@ export type BuyWithFiatStatus =
|
|
70
70
|
| "CRYPTO_SWAP_IN_PROGRESS"
|
71
71
|
| "CRYPTO_SWAP_FAILED";
|
72
72
|
/**
|
73
|
-
* The wallet address to which the tokens are sent to
|
73
|
+
* The wallet address to which the desired tokens are sent to
|
74
74
|
*/
|
75
75
|
toAddress: string;
|
76
|
+
/**
|
77
|
+
* The wallet address that started the transaction.
|
78
|
+
*
|
79
|
+
* If onramp provider supports buying the destination token directly, the tokens are sent to "toAddress" directly.
|
80
|
+
* Otherwise, the tokens are sent to "fromAddress" and a swap is performed by the payer wallet and the tokens are converted to the desired token and sent to "toAddress".
|
81
|
+
*/
|
82
|
+
fromAddress: string;
|
76
83
|
/**
|
77
84
|
* The quote object for the transaction
|
78
85
|
*/
|
@@ -84,6 +84,13 @@ export type PayUIOptions = {
|
|
84
84
|
* This details will be stored with the purchase and can be retrieved later via the status API or Webhook
|
85
85
|
*/
|
86
86
|
purchaseData?: object;
|
87
|
+
|
88
|
+
/**
|
89
|
+
* The address of the recipient of the purchase.
|
90
|
+
*
|
91
|
+
* This address will be used to send the purchased tokens to.
|
92
|
+
*/
|
93
|
+
recipientAddress?: string;
|
87
94
|
};
|
88
95
|
|
89
96
|
/**
|
@@ -3,12 +3,20 @@ import {
|
|
3
3
|
type UseQueryResult,
|
4
4
|
useQuery,
|
5
5
|
} from "@tanstack/react-query";
|
6
|
+
import type { Chain } from "../../../../chains/types.js";
|
7
|
+
import type { Prettify } from "../../../../utils/type-utils.js";
|
6
8
|
import {
|
7
9
|
type GetWalletBalanceOptions,
|
8
10
|
type GetWalletBalanceResult,
|
9
11
|
getWalletBalance,
|
10
12
|
} from "../../../../wallets/utils/getWalletBalance.js";
|
11
13
|
|
14
|
+
export type UseWalletBalanceOptions = Prettify<
|
15
|
+
Omit<GetWalletBalanceOptions, "address" | "chain"> & {
|
16
|
+
address: string | undefined;
|
17
|
+
chain: Chain | undefined;
|
18
|
+
}
|
19
|
+
>;
|
12
20
|
export type UseWalletBalanceQueryOptions = Omit<
|
13
21
|
UseQueryOptions<GetWalletBalanceResult>,
|
14
22
|
"queryFn" | "queryKey" | "enabled"
|
@@ -33,7 +41,7 @@ export type UseWalletBalanceQueryOptions = Omit<
|
|
33
41
|
* @wallet
|
34
42
|
*/
|
35
43
|
export function useWalletBalance(
|
36
|
-
options:
|
44
|
+
options: UseWalletBalanceOptions,
|
37
45
|
queryOptions?: UseWalletBalanceQueryOptions,
|
38
46
|
): UseQueryResult<GetWalletBalanceResult> {
|
39
47
|
const { chain, address, tokenAddress, client } = options;
|
@@ -72,15 +72,19 @@ export function useConnectedWalletDetails(
|
|
72
72
|
* Returns the wallet info for the provided wallet id.
|
73
73
|
* @wallet
|
74
74
|
*/
|
75
|
-
export function useWalletInfo(id: WalletId) {
|
75
|
+
export function useWalletInfo(id: WalletId | undefined) {
|
76
76
|
return useQuery<WalletInfo>({
|
77
77
|
queryKey: ["wallet-info", id],
|
78
78
|
queryFn: () => {
|
79
|
+
if (!id) {
|
80
|
+
throw new Error("Wallet id is required");
|
81
|
+
}
|
79
82
|
return getWalletInfo(id, false);
|
80
83
|
},
|
81
84
|
retry: false,
|
82
85
|
refetchOnWindowFocus: false,
|
83
86
|
refetchOnMount: false,
|
87
|
+
enabled: !!id,
|
84
88
|
});
|
85
89
|
}
|
86
90
|
|
@@ -88,14 +92,18 @@ export function useWalletInfo(id: WalletId) {
|
|
88
92
|
* Returns the wallet image for the provided wallet id.
|
89
93
|
* @wallet
|
90
94
|
*/
|
91
|
-
export function useWalletImage(id: WalletId) {
|
95
|
+
export function useWalletImage(id: WalletId | undefined) {
|
92
96
|
return useQuery({
|
93
97
|
queryKey: ["wallet-image", id],
|
94
98
|
queryFn: () => {
|
99
|
+
if (!id) {
|
100
|
+
throw new Error("Wallet id is required");
|
101
|
+
}
|
95
102
|
return getWalletInfo(id, true);
|
96
103
|
},
|
97
104
|
retry: false,
|
98
105
|
refetchOnWindowFocus: false,
|
99
106
|
refetchOnMount: false,
|
107
|
+
enabled: !!id,
|
100
108
|
});
|
101
109
|
}
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
View,
|
11
11
|
} from "react-native";
|
12
12
|
import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
13
|
+
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
13
14
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
14
15
|
import { useActiveAccount } from "../../hooks/wallets/useActiveAccount.js";
|
15
16
|
import { useActiveWallet } from "../../hooks/wallets/useActiveWallet.js";
|
@@ -43,6 +44,7 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
43
44
|
const wallet = useActiveWallet();
|
44
45
|
const account = useActiveAccount();
|
45
46
|
const status = useActiveWalletConnectionStatus();
|
47
|
+
const siweAuth = useSiweAuth(wallet, props.auth);
|
46
48
|
useAutoConnect(props);
|
47
49
|
|
48
50
|
const fadeAnim = useRef(new Animated.Value(0)); // For background opacity
|
@@ -84,10 +86,14 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
84
86
|
slideAnim.current.setValue(screenHeight);
|
85
87
|
});
|
86
88
|
}, []);
|
89
|
+
const needsAuth = siweAuth.requiresAuth && !siweAuth.isLoggedIn;
|
90
|
+
const isConnected = wallet && account;
|
91
|
+
const isConnectedAndNotAuth = isConnected && needsAuth;
|
92
|
+
const isConnectedAndAuth = isConnected && !needsAuth;
|
87
93
|
|
88
94
|
return (
|
89
95
|
<View>
|
90
|
-
{
|
96
|
+
{isConnectedAndAuth ? (
|
91
97
|
<ConnectedButton
|
92
98
|
openModal={() => openModal()}
|
93
99
|
onClose={closeModal}
|
@@ -97,7 +103,10 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
97
103
|
/>
|
98
104
|
) : (
|
99
105
|
<ThemedButton theme={theme} onPress={() => openModal()}>
|
100
|
-
{status === "connecting"
|
106
|
+
{status === "connecting" ||
|
107
|
+
siweAuth.isLoggingIn ||
|
108
|
+
siweAuth.isLoading ||
|
109
|
+
siweAuth.isLoggingOut ? (
|
101
110
|
<>
|
102
111
|
<ThemedSpinner color={theme.colors.primaryButtonText} />
|
103
112
|
</>
|
@@ -107,7 +116,9 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
107
116
|
type="defaultSemiBold"
|
108
117
|
style={{ color: theme.colors.primaryButtonText }}
|
109
118
|
>
|
110
|
-
{
|
119
|
+
{isConnectedAndNotAuth
|
120
|
+
? props.signInButton?.label || "Sign In"
|
121
|
+
: props.connectButton?.label || "Connect Wallet"}
|
111
122
|
</ThemedText>
|
112
123
|
)}
|
113
124
|
</ThemedButton>
|
@@ -129,7 +140,7 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
129
140
|
>
|
130
141
|
<Pressable style={styles.dismissArea} onPress={closeModal} />
|
131
142
|
<View style={styles.bottomSheetContainer}>
|
132
|
-
{
|
143
|
+
{isConnectedAndAuth ? (
|
133
144
|
<ConnectedModal
|
134
145
|
{...props}
|
135
146
|
theme={theme}
|
@@ -144,6 +155,7 @@ export function ConnectButton(props: ConnectButtonProps) {
|
|
144
155
|
theme={theme}
|
145
156
|
onClose={closeModal}
|
146
157
|
containerType="modal"
|
158
|
+
siweAuth={siweAuth}
|
147
159
|
/>
|
148
160
|
)}
|
149
161
|
</View>
|
@@ -6,11 +6,13 @@ import type { InAppWalletAuth } from "../../../../wallets/in-app/core/wallet/typ
|
|
6
6
|
import type { Wallet } from "../../../../wallets/interfaces/wallet.js";
|
7
7
|
import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
8
8
|
import type { Theme } from "../../../core/design-system/index.js";
|
9
|
+
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
9
10
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
10
11
|
import type { ConnectEmbedProps } from "../../../core/hooks/connection/ConnectEmbedProps.js";
|
11
12
|
import { useWalletInfo } from "../../../core/utils/wallet.js";
|
12
13
|
import { radius, spacing } from "../../design-system/index.js";
|
13
14
|
import { useActiveWallet } from "../../hooks/wallets/useActiveWallet.js";
|
15
|
+
import { useDisconnect } from "../../hooks/wallets/useDisconnect.js";
|
14
16
|
import { connectionManager } from "../../index.js";
|
15
17
|
import { getDefaultWallets } from "../../wallets/defaultWallets.js";
|
16
18
|
import { type ContainerType, Header } from "../components/Header.js";
|
@@ -19,7 +21,7 @@ import {
|
|
19
21
|
WalletImage,
|
20
22
|
getAuthProviderImage,
|
21
23
|
} from "../components/WalletImage.js";
|
22
|
-
import { ThemedButtonWithIcon } from "../components/button.js";
|
24
|
+
import { ThemedButton, ThemedButtonWithIcon } from "../components/button.js";
|
23
25
|
import { Spacer } from "../components/spacer.js";
|
24
26
|
import { ThemedText } from "../components/text.js";
|
25
27
|
import { ThemedView } from "../components/view.js";
|
@@ -34,7 +36,8 @@ export type ModalState =
|
|
34
36
|
| { screen: "connecting"; wallet: Wallet; authMethod?: InAppWalletAuth }
|
35
37
|
| { screen: "error"; error: string }
|
36
38
|
| { screen: "otp"; auth: MultiStepAuthProviderType; wallet: Wallet<"inApp"> }
|
37
|
-
| { screen: "external_wallets" }
|
39
|
+
| { screen: "external_wallets" }
|
40
|
+
| { screen: "auth" };
|
38
41
|
|
39
42
|
/**
|
40
43
|
* A component that allows the user to connect their wallet.
|
@@ -57,12 +60,20 @@ export type ModalState =
|
|
57
60
|
export function ConnectEmbed(props: ConnectEmbedProps) {
|
58
61
|
const theme = parseTheme(props.theme);
|
59
62
|
const wallet = useActiveWallet();
|
63
|
+
const siweAuth = useSiweAuth(wallet, props.auth);
|
64
|
+
const needsAuth = siweAuth.requiresAuth && !siweAuth.isLoggedIn;
|
65
|
+
const isConnected = wallet && !needsAuth;
|
60
66
|
const adaptedProps = {
|
61
67
|
...props,
|
62
68
|
connectModal: { ...props },
|
63
69
|
} as ConnectButtonProps;
|
64
|
-
return
|
65
|
-
<ConnectModal
|
70
|
+
return isConnected ? null : (
|
71
|
+
<ConnectModal
|
72
|
+
{...adaptedProps}
|
73
|
+
theme={theme}
|
74
|
+
containerType="embed"
|
75
|
+
siweAuth={siweAuth}
|
76
|
+
/>
|
66
77
|
);
|
67
78
|
}
|
68
79
|
|
@@ -71,6 +82,7 @@ export function ConnectModal(
|
|
71
82
|
theme: Theme;
|
72
83
|
onClose?: () => void;
|
73
84
|
containerType: ContainerType;
|
85
|
+
siweAuth: ReturnType<typeof useSiweAuth>;
|
74
86
|
},
|
75
87
|
) {
|
76
88
|
const {
|
@@ -80,8 +92,20 @@ export function ConnectModal(
|
|
80
92
|
accountAbstraction,
|
81
93
|
onConnect,
|
82
94
|
onClose,
|
95
|
+
siweAuth,
|
83
96
|
} = props;
|
84
|
-
const
|
97
|
+
const wallet = useActiveWallet();
|
98
|
+
const needsAuth = wallet && siweAuth.requiresAuth && !siweAuth.isLoggedIn;
|
99
|
+
const [modalState, setModalState] = useState<ModalState>(
|
100
|
+
needsAuth ? { screen: "auth" } : { screen: "base" },
|
101
|
+
);
|
102
|
+
const wallets = props.wallets || getDefaultWallets(props);
|
103
|
+
const inAppWallet = wallets.find((wallet) => wallet.id === "inApp") as
|
104
|
+
| Wallet<"inApp">
|
105
|
+
| undefined;
|
106
|
+
const externalWallets = wallets.filter((wallet) => wallet.id !== "inApp");
|
107
|
+
const showBranding = props.connectModal?.showThirdwebBranding !== false;
|
108
|
+
|
85
109
|
const connector = useCallback(
|
86
110
|
async (args: {
|
87
111
|
wallet: Wallet;
|
@@ -100,22 +124,30 @@ export function ConnectModal(
|
|
100
124
|
accountAbstraction,
|
101
125
|
onConnect,
|
102
126
|
});
|
103
|
-
|
127
|
+
if (siweAuth.requiresAuth && !siweAuth.isLoggedIn) {
|
128
|
+
// if in-app wallet, signin headlessly
|
129
|
+
// TODO (rn) handle signless smart wallets as well
|
130
|
+
if (w.id === "inApp") {
|
131
|
+
await siweAuth.doLogin();
|
132
|
+
onClose?.();
|
133
|
+
} else {
|
134
|
+
setModalState({
|
135
|
+
screen: "auth",
|
136
|
+
});
|
137
|
+
}
|
138
|
+
} else {
|
139
|
+
onClose?.();
|
140
|
+
}
|
104
141
|
} catch (error) {
|
105
142
|
setModalState({
|
106
143
|
screen: "error",
|
107
|
-
error: (error as Error)?.message || "
|
144
|
+
error: (error as Error)?.message || "Unknown error",
|
108
145
|
});
|
109
146
|
}
|
110
147
|
},
|
111
|
-
[client, accountAbstraction, onConnect, onClose],
|
148
|
+
[client, accountAbstraction, onConnect, onClose, siweAuth],
|
112
149
|
);
|
113
|
-
|
114
|
-
const inAppWallet = wallets.find((wallet) => wallet.id === "inApp") as
|
115
|
-
| Wallet<"inApp">
|
116
|
-
| undefined;
|
117
|
-
const externalWallets = wallets.filter((wallet) => wallet.id !== "inApp");
|
118
|
-
const showBranding = props.connectModal?.showThirdwebBranding !== false;
|
150
|
+
|
119
151
|
let content: JSX.Element;
|
120
152
|
|
121
153
|
switch (modalState.screen) {
|
@@ -192,7 +224,7 @@ export function ConnectModal(
|
|
192
224
|
) : (
|
193
225
|
<Spacer size="lg" />
|
194
226
|
)}
|
195
|
-
<
|
227
|
+
<WalletLoadingView
|
196
228
|
theme={theme}
|
197
229
|
wallet={modalState.wallet}
|
198
230
|
authProvider={modalState.authMethod}
|
@@ -206,6 +238,37 @@ export function ConnectModal(
|
|
206
238
|
);
|
207
239
|
break;
|
208
240
|
}
|
241
|
+
case "auth": {
|
242
|
+
content = (
|
243
|
+
<>
|
244
|
+
<Header
|
245
|
+
theme={theme}
|
246
|
+
onClose={props.onClose}
|
247
|
+
containerType={containerType}
|
248
|
+
onBack={props.onClose}
|
249
|
+
title={props.connectModal?.title || "Sign in"}
|
250
|
+
/>
|
251
|
+
{containerType === "modal" ? (
|
252
|
+
<View style={{ flex: 1 }} />
|
253
|
+
) : (
|
254
|
+
<Spacer size="lg" />
|
255
|
+
)}
|
256
|
+
<SignInView
|
257
|
+
theme={theme}
|
258
|
+
siweAuth={siweAuth}
|
259
|
+
onSignIn={() => props.onClose?.()}
|
260
|
+
onError={(error) => setModalState({ screen: "error", error })}
|
261
|
+
onDisconnect={() => setModalState({ screen: "base" })}
|
262
|
+
/>
|
263
|
+
{containerType === "modal" ? (
|
264
|
+
<View style={{ flex: 1 }} />
|
265
|
+
) : (
|
266
|
+
<Spacer size="md" />
|
267
|
+
)}
|
268
|
+
</>
|
269
|
+
);
|
270
|
+
break;
|
271
|
+
}
|
209
272
|
case "error": {
|
210
273
|
content = (
|
211
274
|
<>
|
@@ -319,11 +382,15 @@ export function ConnectModal(
|
|
319
382
|
);
|
320
383
|
}
|
321
384
|
|
322
|
-
function
|
385
|
+
function WalletLoadingView({
|
323
386
|
theme,
|
324
387
|
wallet,
|
325
388
|
authProvider,
|
326
|
-
}: {
|
389
|
+
}: {
|
390
|
+
theme: Theme;
|
391
|
+
wallet: Wallet;
|
392
|
+
authProvider?: InAppWalletAuth;
|
393
|
+
}) {
|
327
394
|
const walletInfo = useWalletInfo(wallet.id);
|
328
395
|
return (
|
329
396
|
<View
|
@@ -335,7 +402,7 @@ function LoadingView({
|
|
335
402
|
paddingVertical: spacing.xl,
|
336
403
|
}}
|
337
404
|
>
|
338
|
-
<WalletLoadingThumbnail theme={theme} imageSize={100}>
|
405
|
+
<WalletLoadingThumbnail theme={theme} imageSize={100} animate={true}>
|
339
406
|
{authProvider ? (
|
340
407
|
<View
|
341
408
|
style={{
|
@@ -363,13 +430,108 @@ function LoadingView({
|
|
363
430
|
<Spacer size="sm" />
|
364
431
|
<ThemedText theme={theme} type="subtext">
|
365
432
|
{authProvider
|
366
|
-
? `
|
433
|
+
? `Signing into your ${capitalizeFirstLetter(authProvider)} account`
|
367
434
|
: `Accept the connection request in ${walletInfo.data?.name}`}
|
368
435
|
</ThemedText>
|
369
436
|
</View>
|
370
437
|
);
|
371
438
|
}
|
372
439
|
|
440
|
+
function SignInView({
|
441
|
+
theme,
|
442
|
+
siweAuth,
|
443
|
+
onSignIn,
|
444
|
+
onError,
|
445
|
+
onDisconnect,
|
446
|
+
}: {
|
447
|
+
theme: Theme;
|
448
|
+
siweAuth: ReturnType<typeof useSiweAuth>;
|
449
|
+
onSignIn: () => void;
|
450
|
+
onError: (error: string) => void;
|
451
|
+
onDisconnect: () => void;
|
452
|
+
}) {
|
453
|
+
const wallet = useActiveWallet();
|
454
|
+
const walletInfo = useWalletInfo(wallet?.id);
|
455
|
+
const { disconnect } = useDisconnect();
|
456
|
+
const isSigningIn = siweAuth.isLoggingIn || siweAuth.isLoading;
|
457
|
+
return (
|
458
|
+
wallet && (
|
459
|
+
<View
|
460
|
+
style={{
|
461
|
+
flexDirection: "column",
|
462
|
+
flex: 1,
|
463
|
+
alignItems: "center",
|
464
|
+
justifyContent: "center",
|
465
|
+
padding: spacing.xl,
|
466
|
+
}}
|
467
|
+
>
|
468
|
+
<WalletLoadingThumbnail
|
469
|
+
theme={theme}
|
470
|
+
imageSize={100}
|
471
|
+
animate={isSigningIn}
|
472
|
+
>
|
473
|
+
<WalletImage theme={theme} size={90} wallet={wallet} />
|
474
|
+
</WalletLoadingThumbnail>
|
475
|
+
<Spacer size="xl" />
|
476
|
+
<ThemedText theme={theme} type="subtitle">
|
477
|
+
{"Complete sign in"}
|
478
|
+
</ThemedText>
|
479
|
+
<Spacer size="xs" />
|
480
|
+
<ThemedText theme={theme} type="subtext">
|
481
|
+
Sign login request in {walletInfo.data?.name} to continue
|
482
|
+
</ThemedText>
|
483
|
+
<Spacer size="xl" />
|
484
|
+
<ThemedButton
|
485
|
+
theme={theme}
|
486
|
+
variant="accent"
|
487
|
+
disabled={isSigningIn}
|
488
|
+
style={{ width: "100%" }}
|
489
|
+
onPress={async () => {
|
490
|
+
try {
|
491
|
+
await siweAuth.doLogin();
|
492
|
+
onSignIn();
|
493
|
+
} catch (e) {
|
494
|
+
onError((e as Error)?.message || "Unknown error");
|
495
|
+
}
|
496
|
+
}}
|
497
|
+
>
|
498
|
+
<ThemedText
|
499
|
+
theme={theme}
|
500
|
+
type="defaultSemiBold"
|
501
|
+
style={{
|
502
|
+
color: theme.colors.accentButtonText,
|
503
|
+
}}
|
504
|
+
>
|
505
|
+
Sign Login Request
|
506
|
+
</ThemedText>
|
507
|
+
</ThemedButton>
|
508
|
+
<Spacer size="md" />
|
509
|
+
<ThemedButton
|
510
|
+
theme={theme}
|
511
|
+
variant="secondary"
|
512
|
+
disabled={isSigningIn}
|
513
|
+
style={{ width: "100%" }}
|
514
|
+
onPress={async () => {
|
515
|
+
disconnect(wallet);
|
516
|
+
siweAuth.doLogout();
|
517
|
+
onDisconnect();
|
518
|
+
}}
|
519
|
+
>
|
520
|
+
<ThemedText
|
521
|
+
theme={theme}
|
522
|
+
type="defaultSemiBold"
|
523
|
+
style={{
|
524
|
+
color: theme.colors.accentButtonText,
|
525
|
+
}}
|
526
|
+
>
|
527
|
+
Disconnect
|
528
|
+
</ThemedText>
|
529
|
+
</ThemedButton>
|
530
|
+
</View>
|
531
|
+
)
|
532
|
+
);
|
533
|
+
}
|
534
|
+
|
373
535
|
function OrDivider({ theme }: { theme: Theme }) {
|
374
536
|
return (
|
375
537
|
<View
|
@@ -5,6 +5,7 @@ import { getContract } from "../../../../contract/contract.js";
|
|
5
5
|
import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
|
6
6
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
7
7
|
import type { Theme } from "../../../core/design-system/index.js";
|
8
|
+
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
8
9
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
9
10
|
import { useChainName } from "../../../core/hooks/others/useChainQuery.js";
|
10
11
|
import { hasSmartAccount } from "../../../core/utils/isSmartWallet.js";
|
@@ -290,12 +291,14 @@ const ViewFunds = (props: ConnectedModalPropsInner) => {
|
|
290
291
|
const DisconnectWallet = (props: ConnectedModalProps) => {
|
291
292
|
const { wallet, theme, onClose } = props;
|
292
293
|
const { disconnect } = useDisconnect();
|
294
|
+
const siweAuth = useSiweAuth(wallet, props.auth);
|
293
295
|
return (
|
294
296
|
<TouchableOpacity
|
295
297
|
style={styles.walletMenuRow}
|
296
298
|
onPress={() => {
|
297
299
|
onClose?.();
|
298
300
|
disconnect(wallet);
|
301
|
+
siweAuth.doLogout();
|
299
302
|
}}
|
300
303
|
>
|
301
304
|
<RNImage
|