thirdweb 5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343 → 5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351
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/pay.js +3 -1
- package/dist/cjs/exports/pay.js.map +1 -1
- package/dist/cjs/exports/thirdweb.js +3 -1
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js +3 -0
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -0
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/cjs/pay/utils/definitions.js +7 -1
- package/dist/cjs/pay/utils/definitions.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +9 -0
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -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/currencies.js +9 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +34 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- 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/swap/SwapStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +118 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +7 -76
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/stories/ConnectButton.stories.js +28 -0
- package/dist/cjs/stories/ConnectButton.stories.js.map +1 -0
- package/dist/cjs/stories/PayEmbed.stories.js +38 -0
- package/dist/cjs/stories/PayEmbed.stories.js.map +1 -0
- package/dist/cjs/stories/utils.js +27 -0
- package/dist/cjs/stories/utils.js.map +1 -0
- package/dist/cjs/transaction/actions/send-transaction.js.map +1 -1
- package/dist/cjs/utils/fetch.js +2 -1
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/utils/signatures/sign-message.js +13 -19
- package/dist/cjs/utils/signatures/sign-message.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/constants.js +6 -0
- package/dist/cjs/wallets/smart/lib/constants.js.map +1 -1
- package/dist/esm/exports/pay.js +2 -0
- package/dist/esm/exports/pay.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +2 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/commonTypes.js +2 -0
- package/dist/esm/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +92 -0
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/esm/pay/utils/definitions.js +5 -0
- package/dist/esm/pay/utils/definitions.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +5 -0
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -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/currencies.js +8 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +35 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- 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/swap/SwapStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +115 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +8 -77
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/stories/ConnectButton.stories.js +25 -0
- package/dist/esm/stories/ConnectButton.stories.js.map +1 -0
- package/dist/esm/stories/PayEmbed.stories.js +35 -0
- package/dist/esm/stories/PayEmbed.stories.js.map +1 -0
- package/dist/esm/stories/utils.js +24 -0
- package/dist/esm/stories/utils.js.map +1 -0
- package/dist/esm/transaction/actions/send-transaction.js.map +1 -1
- package/dist/esm/utils/fetch.js +2 -1
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/utils/signatures/sign-message.js +13 -19
- package/dist/esm/utils/signatures/sign-message.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/smart/lib/constants.js +6 -0
- package/dist/esm/wallets/smart/lib/constants.js.map +1 -1
- package/dist/types/exports/pay.d.ts +3 -1
- package/dist/types/exports/pay.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +3 -1
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +36 -0
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts +1 -24
- 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 +85 -0
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/utils/definitions.d.ts +5 -0
- package/dist/types/pay/utils/definitions.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +15 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedButton.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/TokenListScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts +3 -0
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +2 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +3 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts +20 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +5 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
- package/dist/types/stories/ConnectButton.stories.d.ts +18 -0
- package/dist/types/stories/ConnectButton.stories.d.ts.map +1 -0
- package/dist/types/stories/PayEmbed.stories.d.ts +19 -0
- package/dist/types/stories/PayEmbed.stories.d.ts.map +1 -0
- package/dist/types/stories/utils.d.ts +5 -0
- package/dist/types/stories/utils.d.ts.map +1 -0
- package/dist/types/transaction/actions/send-transaction.d.ts +12 -2
- package/dist/types/transaction/actions/send-transaction.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/utils/signatures/sign-message.d.ts +26 -3
- package/dist/types/utils/signatures/sign-message.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +1 -2
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -8
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +1 -5
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/constants.d.ts.map +1 -1
- package/package.json +15 -2
- package/src/exports/pay.ts +11 -2
- package/src/exports/thirdweb.ts +11 -2
- package/src/pay/buyWithCrypto/commonTypes.ts +40 -0
- package/src/pay/buyWithCrypto/getQuote.ts +8 -42
- package/src/pay/buyWithCrypto/getStatus.ts +1 -1
- package/src/pay/buyWithCrypto/getTransfer.ts +185 -0
- package/src/pay/buyWithFiat/getQuote.ts +1 -1
- package/src/pay/utils/definitions.ts +7 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +16 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +3 -0
- package/src/react/native/ui/connect/ConnectedButton.tsx +6 -1
- package/src/react/native/ui/connect/ConnectedModal.tsx +2 -1
- package/src/react/native/ui/connect/TokenListScreen.tsx +6 -1
- package/src/react/web/ui/ConnectWallet/Details.tsx +93 -77
- package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +21 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +9 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +47 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +26 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +284 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +29 -220
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +3 -1
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -2
- package/src/react/web/wallets/shared/SocialLogin.tsx +7 -2
- package/src/stories/ConnectButton.stories.ts +31 -0
- package/src/stories/PayEmbed.stories.ts +42 -0
- package/src/stories/utils.tsx +29 -0
- package/src/transaction/actions/send-transaction.ts +12 -3
- package/src/utils/fetch.ts +4 -1
- package/src/utils/signatures/sign-message.test.ts +78 -50
- package/src/utils/signatures/sign-message.ts +44 -9
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +1 -2
- package/src/wallets/in-app/core/authentication/getLoginPath.ts +11 -9
- package/src/wallets/in-app/core/authentication/types.ts +1 -8
- package/src/wallets/in-app/core/interfaces/connector.ts +5 -1
- package/src/wallets/in-app/core/wallet/index.ts +6 -2
- package/src/wallets/in-app/core/wallet/types.ts +1 -5
- package/src/wallets/in-app/native/auth/native-auth.ts +1 -1
- package/src/wallets/in-app/web/lib/auth/index.ts +7 -2
- package/src/wallets/in-app/web/lib/auth/oauth.ts +5 -5
- package/src/wallets/in-app/web/lib/web-connector.ts +9 -3
- package/src/wallets/smart/lib/constants.ts +6 -0
- package/src/wallets/smart/smart-wallet-dev.test.ts +86 -0
@@ -24,15 +24,11 @@ export type InAppWalletCreationOptions = {
|
|
24
24
|
/**
|
25
25
|
* Whether to display the social auth prompt in a popup or redirect
|
26
26
|
*/
|
27
|
-
mode?: "popup" | "redirect";
|
27
|
+
mode?: "popup" | "redirect" | "window";
|
28
28
|
/**
|
29
29
|
* Optional url to redirect to after authentication
|
30
30
|
*/
|
31
31
|
redirectUrl?: string;
|
32
|
-
/**
|
33
|
-
* Whether to handle the redirect in a new window
|
34
|
-
*/
|
35
|
-
redirectExternally?: boolean;
|
36
32
|
/**
|
37
33
|
* The domain of the passkey to use for authentication
|
38
34
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/wallet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,4BAA4B,GAAG,CACvC,qBAAqB,GACrB,sBAAsB,CACzB,GAAG;IACF,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,mCAAmC,CAAC;IACjD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC,MAAM,MAAM,0BAA0B,GAClC;IACE,IAAI,CAAC,EAAE;QACL;;WAEG;QACH,OAAO,EAAE,eAAe,EAAE,CAAC;QAC3B;;WAEG;QACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/wallet/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EACV,mCAAmC,EACnC,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,4BAA4B,GAAG,CACvC,qBAAqB,GACrB,sBAAsB,CACzB,GAAG;IACF,MAAM,EAAE,cAAc,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,CAAC,EAAE,mCAAmC,CAAC;IACjD,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC,MAAM,MAAM,0BAA0B,GAClC;IACE,IAAI,CAAC,EAAE;QACL;;WAEG;QACH,OAAO,EAAE,eAAe,EAAE,CAAC;QAC3B;;WAEG;QACH,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAC;QACvC;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB;;WAEG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,KAAK,CAAC,EAAE;YACN,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,GAAG,CAAC,EAAE,MAAM,CAAC;SACd,CAAC;KACH,CAAC;IACF;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;QAEI;IACJ,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,GACD,SAAS,CAAC;AAEd,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EAErB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAyBhD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,0BAA0B,wFAWpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,0BAA0B,+BAMrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,+BAM3E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,iBAG1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,KAAK,CACP,YAAY,GACZ;IACE,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB,CACJ,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,eAAe,EAErB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAyBhD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,0BAA0B,wFAWpC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,0BAA0B,+BAMrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,0BAA0B,+BAM3E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,iBAG1D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,KAAK,CACP,YAAY,GACZ;IACE,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB,CACJ,uFAWF"}
|
@@ -7,7 +7,7 @@ export declare const loginWithOauthRedirect: (options: {
|
|
7
7
|
client: ThirdwebClient;
|
8
8
|
ecosystem?: Ecosystem;
|
9
9
|
redirectUrl?: string;
|
10
|
-
|
10
|
+
mode?: "redirect" | "popup" | "window";
|
11
11
|
}) => void;
|
12
12
|
export declare const loginWithOauth: (options: {
|
13
13
|
authOption: SocialAuthOption;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAuBhD,eAAO,MAAM,sBAAsB,YAAa;IAC9C,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../../../../../../../src/wallets/in-app/web/lib/auth/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAuBhD,eAAO,MAAM,sBAAsB,YAAa;IAC9C,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;CACxC,KAAG,IAUH,CAAC;AAEF,eAAO,MAAM,cAAc,YAAmB;IAC5C,UAAU,EAAE,gBAAgB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACzC,iBAAiB,CAAC,EAAE,CAAC,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAClE,KAAG,OAAO,CAAC,mCAAmC,CA2E9C,CAAC"}
|
@@ -51,7 +51,7 @@ export declare class InAppWebConnector implements InAppConnector {
|
|
51
51
|
getUser(): Promise<GetUser>;
|
52
52
|
getAccount(): Promise<Account>;
|
53
53
|
preAuthenticate(args: MultiStepAuthProviderType): Promise<void>;
|
54
|
-
authenticateWithRedirect(strategy: SocialAuthOption): void;
|
54
|
+
authenticateWithRedirect(strategy: SocialAuthOption, mode?: "redirect" | "popup" | "window", redirectUrl?: string): void;
|
55
55
|
loginWithAuthToken(authResult: AuthStoredTokenWithCookieReturnType): Promise<AuthLoginReturnType>;
|
56
56
|
/**
|
57
57
|
* Authenticates the user and returns the auth token, but does not instantiate their wallet
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAM7D,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mCAAmC,EACxC,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAE5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,CAAC;AAC9G,OAAO,EAAE,IAAI,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKpE;;GAEG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IACtD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IACjC,SAAS,CAAC,OAAO,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO,CAAC,MAAM,CAAe;IAC7B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B,OAAO,CAAC,qBAAqB;IAO7B;;;;OAIG;gBACS,EACV,MAAM,EACN,aAAa,EACb,SAAS,EACT,aAAa,GACd,EAAE,0BAA0B;IAsD7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxB,eAAe,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrE,wBAAwB,
|
1
|
+
{"version":3,"file":"web-connector.d.ts","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/web/lib/web-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAM7D,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,mCAAmC,EACxC,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAE5B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,+DAA+D,CAAC;AAC9G,OAAO,EAAE,IAAI,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKpE;;GAEG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IACtD,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IACjC,SAAS,CAAC,OAAO,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAC;IAEnE,OAAO,CAAC,MAAM,CAAe;IAC7B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,aAAa,CAAC,CAAS;IAE/B,OAAO,CAAC,qBAAqB;IAO7B;;;;OAIG;gBACS,EACV,MAAM,EACN,aAAa,EACb,SAAS,EACT,aAAa,GACd,EAAE,0BAA0B;IAsD7B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIxB,eAAe,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQrE,wBAAwB,CACtB,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,EACtC,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI;IAUD,kBAAkB,CAAC,UAAU,EAAE,mCAAmC;IAIxE;;OAEG;IACG,YAAY,CAChB,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,GACnD,OAAO,CAAC,mCAAmC,CAAC;IA8D/C;;OAEG;IACG,OAAO,CACX,IAAI,EAAE,qBAAqB,GAAG,sBAAsB,GACnD,OAAO,CAAC,mBAAmB,CAAC;IA6CzB,MAAM,IAAI,OAAO,CAAC,gBAAgB,CAAC;YAI3B,WAAW;CA8B1B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAItD,eAAO,MAAM,KAAK,QAAQ,CAAC;AAE3B,eAAO,MAAM,eAAe,yIAC4G,CAAC;AAEzI,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAE/C,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAC/C,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAW,KAAK,
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAItD,eAAO,MAAM,KAAK,QAAQ,CAAC;AAE3B,eAAO,MAAM,eAAe,yIAC4G,CAAC;AAEzI,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAE/C,eAAO,MAAM,uBAAuB,+CACU,CAAC;AAC/C,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,oBAAoB,UAAW,KAAK,WAMhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,UAAW,KAAK,WAMlD,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "thirdweb",
|
3
|
-
"version": "5.48.
|
3
|
+
"version": "5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351",
|
4
4
|
"repository": {
|
5
5
|
"type": "git",
|
6
6
|
"url": "git+https://github.com/thirdweb-dev/js.git#main"
|
@@ -283,9 +283,18 @@
|
|
283
283
|
"devDependencies": {
|
284
284
|
"@aws-sdk/client-lambda": "3.577.0",
|
285
285
|
"@aws-sdk/credential-providers": "3.577.0",
|
286
|
+
"@chromatic-com/storybook": "^1.5.0",
|
286
287
|
"@coinbase/wallet-mobile-sdk": "1.0.13",
|
287
288
|
"@react-native-async-storage/async-storage": "^1.23.1",
|
288
289
|
"@react-native-clipboard/clipboard": "1.14.1",
|
290
|
+
"@storybook/addon-essentials": "^8.2.9",
|
291
|
+
"@storybook/addon-interactions": "^8.2.9",
|
292
|
+
"@storybook/addon-links": "^8.2.9",
|
293
|
+
"@storybook/addon-onboarding": "^8.2.9",
|
294
|
+
"@storybook/blocks": "^8.2.9",
|
295
|
+
"@storybook/react": "^8.2.9",
|
296
|
+
"@storybook/react-vite": "^8.2.9",
|
297
|
+
"@storybook/test": "^8.2.9",
|
289
298
|
"@testing-library/jest-dom": "^6.4.7",
|
290
299
|
"@testing-library/react": "^16.0.0",
|
291
300
|
"@testing-library/user-event": "^14.5.2",
|
@@ -306,6 +315,8 @@
|
|
306
315
|
"react-native-quick-crypto": "0.7.0-rc.6",
|
307
316
|
"react-native-svg": "15.3.0",
|
308
317
|
"typescript": "5.5.4",
|
318
|
+
"storybook": "^8.2.9",
|
319
|
+
"vite": "^5.3.1",
|
309
320
|
"vitest": "1.6.0"
|
310
321
|
},
|
311
322
|
"scripts": {
|
@@ -333,6 +344,8 @@
|
|
333
344
|
"test:dev": "vitest run -c ./test/vitest.config.ts",
|
334
345
|
"test:react": "vitest run -c ./test/vitest.config.ts dev --ui src/react",
|
335
346
|
"typedoc": "bun run scripts/typedoc.mjs",
|
336
|
-
"update-version": "node scripts/version.mjs"
|
347
|
+
"update-version": "node scripts/version.mjs",
|
348
|
+
"storybook": "storybook dev -p 6006",
|
349
|
+
"build-storybook": "storybook build"
|
337
350
|
}
|
338
351
|
}
|
package/src/exports/pay.ts
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
export {
|
2
2
|
getBuyWithCryptoQuote,
|
3
3
|
type BuyWithCryptoQuote,
|
4
|
-
type QuoteApprovalParams,
|
5
|
-
type QuoteTokenInfo,
|
6
4
|
type GetBuyWithCryptoQuoteParams,
|
7
5
|
} from "../pay/buyWithCrypto/getQuote.js";
|
8
6
|
|
7
|
+
export {
|
8
|
+
getBuyWithCryptoTransfer,
|
9
|
+
type BuyWithCryptoTransfer,
|
10
|
+
type GetBuyWithCryptoTransferParams,
|
11
|
+
} from "../pay/buyWithCrypto/getTransfer.js";
|
12
|
+
|
13
|
+
export {
|
14
|
+
type QuoteApprovalParams,
|
15
|
+
type QuoteTokenInfo,
|
16
|
+
} from "../pay/buyWithCrypto/commonTypes.js";
|
17
|
+
|
9
18
|
export {
|
10
19
|
getBuyWithCryptoStatus,
|
11
20
|
type BuyWithCryptoStatus,
|
package/src/exports/thirdweb.ts
CHANGED
@@ -166,11 +166,14 @@ export { toEther, toTokens, toUnits, toWei, fromGwei } from "../utils/units.js";
|
|
166
166
|
export {
|
167
167
|
getBuyWithCryptoQuote,
|
168
168
|
type BuyWithCryptoQuote,
|
169
|
-
type QuoteApprovalParams,
|
170
|
-
type QuoteTokenInfo,
|
171
169
|
type GetBuyWithCryptoQuoteParams,
|
172
170
|
} from "../pay/buyWithCrypto/getQuote.js";
|
173
171
|
|
172
|
+
export {
|
173
|
+
type QuoteApprovalParams,
|
174
|
+
type QuoteTokenInfo,
|
175
|
+
} from "../pay/buyWithCrypto/commonTypes.js";
|
176
|
+
|
174
177
|
export {
|
175
178
|
getBuyWithCryptoStatus,
|
176
179
|
type BuyWithCryptoStatus,
|
@@ -183,6 +186,12 @@ export {
|
|
183
186
|
type BuyWithCryptoHistoryParams,
|
184
187
|
} from "../pay/buyWithCrypto/getHistory.js";
|
185
188
|
|
189
|
+
export {
|
190
|
+
getBuyWithCryptoTransfer,
|
191
|
+
type GetBuyWithCryptoTransferParams,
|
192
|
+
type BuyWithCryptoTransfer,
|
193
|
+
} from "../pay/buyWithCrypto/getTransfer.js";
|
194
|
+
|
186
195
|
export type {
|
187
196
|
PayOnChainTransactionDetails,
|
188
197
|
PayTokenInfo,
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import type { ApproveParams } from "../../extensions/erc20/write/approve.js";
|
2
|
+
import type { BaseTransactionOptions } from "../../transaction/types.js";
|
3
|
+
|
4
|
+
export type QuoteTokenInfo = {
|
5
|
+
chainId: number;
|
6
|
+
tokenAddress: string;
|
7
|
+
decimals: number;
|
8
|
+
priceUSDCents: number;
|
9
|
+
name?: string;
|
10
|
+
symbol?: string;
|
11
|
+
};
|
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
|
+
export type QuoteApprovalInfo = {
|
24
|
+
chainId: number;
|
25
|
+
tokenAddress: string;
|
26
|
+
spenderAddress: string;
|
27
|
+
amountWei: string;
|
28
|
+
};
|
29
|
+
|
30
|
+
export type QuotePaymentToken = {
|
31
|
+
token: QuoteTokenInfo;
|
32
|
+
amountWei: string;
|
33
|
+
amount: string;
|
34
|
+
amountUSDCents: number;
|
35
|
+
};
|
36
|
+
|
37
|
+
/**
|
38
|
+
* @buyCrypto
|
39
|
+
*/
|
40
|
+
export type QuoteApprovalParams = BaseTransactionOptions<ApproveParams>;
|
@@ -2,14 +2,16 @@ import type { Hash } from "viem";
|
|
2
2
|
import { getCachedChain } from "../../chains/utils.js";
|
3
3
|
import type { ThirdwebClient } from "../../client/client.js";
|
4
4
|
import { getContract } from "../../contract/contract.js";
|
5
|
-
import {
|
6
|
-
type ApproveParams,
|
7
|
-
approve,
|
8
|
-
} from "../../extensions/erc20/write/approve.js";
|
5
|
+
import { approve } from "../../extensions/erc20/write/approve.js";
|
9
6
|
import type { PrepareTransactionOptions } from "../../transaction/prepare-transaction.js";
|
10
|
-
import type { BaseTransactionOptions } from "../../transaction/types.js";
|
11
7
|
import { getClientFetch } from "../../utils/fetch.js";
|
12
8
|
import { getPayBuyWithCryptoQuoteEndpoint } from "../utils/definitions.js";
|
9
|
+
import type {
|
10
|
+
QuoteApprovalInfo,
|
11
|
+
QuotePaymentToken,
|
12
|
+
QuoteTokenInfo,
|
13
|
+
QuoteTransactionRequest,
|
14
|
+
} from "./commonTypes.js";
|
13
15
|
|
14
16
|
/**
|
15
17
|
* The parameters for [`getBuyWithCryptoQuote`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoQuote) function
|
@@ -107,40 +109,9 @@ export type GetBuyWithCryptoQuoteParams = {
|
|
107
109
|
/**
|
108
110
|
* @buyCrypto
|
109
111
|
*/
|
110
|
-
export type QuoteTokenInfo = {
|
111
|
-
chainId: number;
|
112
|
-
tokenAddress: string;
|
113
|
-
decimals: number;
|
114
|
-
priceUSDCents: number;
|
115
|
-
name?: string;
|
116
|
-
symbol?: string;
|
117
|
-
};
|
118
|
-
|
119
|
-
type QuotePaymentToken = {
|
120
|
-
token: QuoteTokenInfo;
|
121
|
-
amountWei: string;
|
122
|
-
amount: string;
|
123
|
-
amountUSDCents: number;
|
124
|
-
};
|
125
|
-
|
126
|
-
type QuoteTransactionRequest = {
|
127
|
-
data: string;
|
128
|
-
to: string;
|
129
|
-
value: string;
|
130
|
-
from: string;
|
131
|
-
chainId: number;
|
132
|
-
gasPrice: string;
|
133
|
-
gasLimit: string;
|
134
|
-
};
|
135
|
-
|
136
112
|
type BuyWithCryptoQuoteRouteResponse = {
|
137
113
|
transactionRequest: QuoteTransactionRequest;
|
138
|
-
approval?:
|
139
|
-
chainId: number;
|
140
|
-
tokenAddress: string;
|
141
|
-
spenderAddress: string;
|
142
|
-
amountWei: string;
|
143
|
-
};
|
114
|
+
approval?: QuoteApprovalInfo;
|
144
115
|
|
145
116
|
fromAddress: string;
|
146
117
|
toAddress: string;
|
@@ -173,11 +144,6 @@ type BuyWithCryptoQuoteRouteResponse = {
|
|
173
144
|
bridge?: string;
|
174
145
|
};
|
175
146
|
|
176
|
-
/**
|
177
|
-
* @buyCrypto
|
178
|
-
*/
|
179
|
-
export type QuoteApprovalParams = BaseTransactionOptions<ApproveParams>;
|
180
|
-
|
181
147
|
/**
|
182
148
|
* @buyCrypto
|
183
149
|
*/
|
@@ -56,7 +56,7 @@ export type BuyWithCryptoSubStatuses =
|
|
56
56
|
| "UNKNOWN_ERROR"
|
57
57
|
| "REFUNDED";
|
58
58
|
|
59
|
-
export type SwapType = "SAME_CHAIN" | "CROSS_CHAIN";
|
59
|
+
export type SwapType = "SAME_CHAIN" | "CROSS_CHAIN" | "TRANSFER";
|
60
60
|
|
61
61
|
/**
|
62
62
|
* The object returned by the [`getBuyWithCryptoStatus`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoStatus) function to represent the status of a quoted transaction
|
@@ -0,0 +1,185 @@
|
|
1
|
+
import type { Hash } from "viem";
|
2
|
+
import { getCachedChain } from "../../chains/utils.js";
|
3
|
+
import type { ThirdwebClient } from "../../client/client.js";
|
4
|
+
import { getContract } from "../../contract/contract.js";
|
5
|
+
import { approve } from "../../extensions/erc20/write/approve.js";
|
6
|
+
import type { PrepareTransactionOptions } from "../../transaction/prepare-transaction.js";
|
7
|
+
import type { Address } from "../../utils/address.js";
|
8
|
+
import { getClientFetch } from "../../utils/fetch.js";
|
9
|
+
import { getPayBuyWithCryptoTransferEndpoint } from "../utils/definitions.js";
|
10
|
+
import type {
|
11
|
+
QuoteApprovalInfo,
|
12
|
+
QuotePaymentToken,
|
13
|
+
QuoteTokenInfo,
|
14
|
+
QuoteTransactionRequest,
|
15
|
+
} from "./commonTypes.js";
|
16
|
+
|
17
|
+
/**
|
18
|
+
* The parameters for [`getBuyWithCryptoTransfer`](https://portal.thirdweb.com/references/typescript/v5/getBuyWithCryptoTransfer) function
|
19
|
+
* It facilitates a token transfer.
|
20
|
+
* @buyCrypto
|
21
|
+
*/
|
22
|
+
export type GetBuyWithCryptoTransferParams = {
|
23
|
+
/**
|
24
|
+
* A client is the entry point to the thirdweb SDK. It is required for all other actions.
|
25
|
+
*
|
26
|
+
* You can create a client using the `createThirdwebClient` function.
|
27
|
+
* Refer to the [Creating a Client](https://portal.thirdweb.com/typescript/v5/client) documentation for more information.
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
client: ThirdwebClient;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* The address of wallet that pays for the tokens.
|
34
|
+
*/
|
35
|
+
fromAddress: string;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* The address of the wallet where the tokens are sent
|
39
|
+
*/
|
40
|
+
toAddress: string;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* The chain id of the transfer token.
|
44
|
+
*/
|
45
|
+
chainId: number;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* The token address of the transfer token.
|
49
|
+
*/
|
50
|
+
tokenAddress: string;
|
51
|
+
|
52
|
+
/**
|
53
|
+
* The amount of token to be transferred.
|
54
|
+
*/
|
55
|
+
amount: string;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Extra details to store with the purchase.
|
59
|
+
*
|
60
|
+
* This details will be stored with the purchase and can be retrieved later via the status API or Webhook
|
61
|
+
*/
|
62
|
+
purchaseData?: object;
|
63
|
+
};
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @buyCrypto
|
67
|
+
*/
|
68
|
+
type BuyWithCryptoTransferResponse = {
|
69
|
+
quoteId: string;
|
70
|
+
transactionRequest: QuoteTransactionRequest;
|
71
|
+
approval?: QuoteApprovalInfo;
|
72
|
+
fromAddress: string;
|
73
|
+
toAddress: string;
|
74
|
+
token: QuoteTokenInfo;
|
75
|
+
paymentToken: QuotePaymentToken;
|
76
|
+
processingFee: QuotePaymentToken;
|
77
|
+
estimatedGasCostUSDCents: number;
|
78
|
+
};
|
79
|
+
|
80
|
+
/**
|
81
|
+
* @buyCrypto
|
82
|
+
*/
|
83
|
+
export type BuyWithCryptoTransfer = {
|
84
|
+
transactionRequest: PrepareTransactionOptions;
|
85
|
+
approval?: PrepareTransactionOptions;
|
86
|
+
fromAddress: string;
|
87
|
+
toAddress: string;
|
88
|
+
paymentToken: QuotePaymentToken;
|
89
|
+
processingFee: QuotePaymentToken;
|
90
|
+
estimatedGasCostUSDCents: number;
|
91
|
+
client: ThirdwebClient;
|
92
|
+
};
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Get a quote of type [`BuyWithCryptoTransfer`](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) to facilitate a token transfer transaction.
|
96
|
+
* Using this instead of a native transfer allows you to receive status and webhooks about successful or failed payments.
|
97
|
+
*
|
98
|
+
* Once you have the quote, you can use `prepareTransaction` and prepare the transaction for submission.
|
99
|
+
* @param params - object of type [`GetBuyWithCryptoTransferParams`](https://portal.thirdweb.com/references/typescript/v5/GetBuyWithCryptoTransferParams)
|
100
|
+
* @returns Object of type [`BuyWithCryptoTransfer`](https://portal.thirdweb.com/references/typescript/v5/BuyWithCryptoTransfer) which contains the information about the transfer
|
101
|
+
* @example
|
102
|
+
*
|
103
|
+
* ```ts
|
104
|
+
* import { getBuyWithCryptoTransfer } from "thirdweb/pay";
|
105
|
+
*
|
106
|
+
* const transfer = await getBuyWithCryptoTransfer({
|
107
|
+
* client,
|
108
|
+
* fromAddress: "0x...", // wallet address
|
109
|
+
* toAddress: "0x...", // recipient address - likely to be your wallet
|
110
|
+
* chainId: 10, // chain id of the token
|
111
|
+
* tokenAddress: "0x...", // address of the token
|
112
|
+
* amount: "10", // amount of token to transfer
|
113
|
+
* purchaseData: { // any metadata for you to attribute this purchase
|
114
|
+
* "customerId": "yourId"
|
115
|
+
* }
|
116
|
+
* });
|
117
|
+
* ```
|
118
|
+
* @buyCrypto
|
119
|
+
*/
|
120
|
+
export async function getBuyWithCryptoTransfer(
|
121
|
+
params: GetBuyWithCryptoTransferParams,
|
122
|
+
): Promise<BuyWithCryptoTransfer> {
|
123
|
+
try {
|
124
|
+
const clientFetch = getClientFetch(params.client);
|
125
|
+
|
126
|
+
const response = await clientFetch(getPayBuyWithCryptoTransferEndpoint(), {
|
127
|
+
method: "POST",
|
128
|
+
headers: {
|
129
|
+
Accept: "application/json",
|
130
|
+
"Content-Type": "application/json",
|
131
|
+
},
|
132
|
+
body: JSON.stringify({
|
133
|
+
fromAddress: params.fromAddress,
|
134
|
+
toAddress: params.toAddress,
|
135
|
+
chainId: params.chainId,
|
136
|
+
tokenAddress: params.tokenAddress,
|
137
|
+
amount: params.amount,
|
138
|
+
purchaseData: params.purchaseData,
|
139
|
+
}),
|
140
|
+
});
|
141
|
+
|
142
|
+
if (!response.ok) {
|
143
|
+
const errorObj = await response.json();
|
144
|
+
if (errorObj && "error" in errorObj) {
|
145
|
+
throw errorObj;
|
146
|
+
}
|
147
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
148
|
+
}
|
149
|
+
|
150
|
+
const data: BuyWithCryptoTransferResponse = (await response.json()).result;
|
151
|
+
|
152
|
+
const transfer: BuyWithCryptoTransfer = {
|
153
|
+
transactionRequest: {
|
154
|
+
chain: getCachedChain(data.transactionRequest.chainId),
|
155
|
+
client: params.client,
|
156
|
+
data: data.transactionRequest.data as Hash,
|
157
|
+
to: data.transactionRequest.to as Address,
|
158
|
+
value: BigInt(data.transactionRequest.value),
|
159
|
+
gas: BigInt(data.transactionRequest.gasLimit),
|
160
|
+
},
|
161
|
+
approval: data.approval
|
162
|
+
? approve({
|
163
|
+
contract: getContract({
|
164
|
+
client: params.client,
|
165
|
+
address: data.approval.tokenAddress,
|
166
|
+
chain: getCachedChain(data.approval.chainId),
|
167
|
+
}),
|
168
|
+
spender: data.approval.spenderAddress as Address,
|
169
|
+
amountWei: BigInt(data.approval.amountWei),
|
170
|
+
})
|
171
|
+
: undefined,
|
172
|
+
fromAddress: data.fromAddress,
|
173
|
+
toAddress: data.toAddress,
|
174
|
+
paymentToken: data.paymentToken,
|
175
|
+
processingFee: data.processingFee,
|
176
|
+
estimatedGasCostUSDCents: data.estimatedGasCostUSDCents,
|
177
|
+
client: params.client,
|
178
|
+
};
|
179
|
+
|
180
|
+
return transfer;
|
181
|
+
} catch (error) {
|
182
|
+
console.error("Error getting buy with crypto transfer", error);
|
183
|
+
throw error;
|
184
|
+
}
|
185
|
+
}
|
@@ -38,7 +38,7 @@ export type GetBuyWithFiatQuoteParams = {
|
|
38
38
|
/**
|
39
39
|
* Symbol of the fiat currency to buy the token with.
|
40
40
|
*/
|
41
|
-
fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR";
|
41
|
+
fromCurrencySymbol: "USD" | "CAD" | "GBP" | "EUR" | "JPY";
|
42
42
|
|
43
43
|
/**
|
44
44
|
* The maximum slippage in basis points (bps) allowed for the transaction.
|
@@ -20,6 +20,13 @@ export const getPayBuyWithCryptoStatusUrl = () =>
|
|
20
20
|
export const getPayBuyWithCryptoQuoteEndpoint = () =>
|
21
21
|
`${getPayBaseUrl()}/buy-with-crypto/quote/v1`;
|
22
22
|
|
23
|
+
/**
|
24
|
+
* Endpoint to get "Buy with Crypto" transfer.
|
25
|
+
* @internal
|
26
|
+
*/
|
27
|
+
export const getPayBuyWithCryptoTransferEndpoint = () =>
|
28
|
+
`${getPayBaseUrl()}/buy-with-crypto/transfer/v1`;
|
29
|
+
|
23
30
|
/**
|
24
31
|
* Endpoint to get a "Buy with Fiat" quote.
|
25
32
|
* @internal
|
@@ -82,6 +82,9 @@ export type PayUIOptions = Prettify<
|
|
82
82
|
buyWithFiat?:
|
83
83
|
| {
|
84
84
|
testMode?: boolean;
|
85
|
+
prefillSource?: {
|
86
|
+
currency?: "USD" | "CAD" | "GBP" | "EUR" | "JPY";
|
87
|
+
};
|
85
88
|
}
|
86
89
|
| false;
|
87
90
|
|
@@ -226,6 +229,19 @@ export type ConnectButton_detailsModalOptions = {
|
|
226
229
|
*/
|
227
230
|
networkSelector?: NetworkSelectorProps;
|
228
231
|
|
232
|
+
/**
|
233
|
+
* Hide the "Switch Wallet" button in the `ConnectButton` Details Modal.
|
234
|
+
*
|
235
|
+
* By default it is `false`
|
236
|
+
* @example
|
237
|
+
* ```tsx
|
238
|
+
* <ConnectButton detailsModal={{
|
239
|
+
* hideSwitchWallet: true
|
240
|
+
* }} />
|
241
|
+
* ```
|
242
|
+
*/
|
243
|
+
hideSwitchWallet?: boolean;
|
244
|
+
|
229
245
|
/**
|
230
246
|
* Hide the "Disconnect Wallet" button in the `ConnectButton` Details Modal.
|
231
247
|
*
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { StyleSheet, View } from "react-native";
|
2
|
+
import { formatNumber } from "../../../../utils/formatNumber.js";
|
2
3
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
3
4
|
import { parseTheme } from "../../../core/design-system/CustomThemeProvider.js";
|
4
5
|
import type { ConnectButtonProps } from "../../../core/hooks/connection/ConnectButtonProps.js";
|
@@ -64,7 +65,7 @@ export function ConnectedButton(
|
|
64
65
|
fontSize: fontSize.sm,
|
65
66
|
}}
|
66
67
|
>
|
67
|
-
{Number(balanceQuery.data.displayValue)
|
68
|
+
{formatBalanceOnButton(Number(balanceQuery.data.displayValue))}{" "}
|
68
69
|
{balanceQuery.data?.symbol}
|
69
70
|
</ThemedText>
|
70
71
|
) : (
|
@@ -80,6 +81,10 @@ export function ConnectedButton(
|
|
80
81
|
);
|
81
82
|
}
|
82
83
|
|
84
|
+
function formatBalanceOnButton(num: number) {
|
85
|
+
return formatNumber(num, num < 1 ? 5 : 4);
|
86
|
+
}
|
87
|
+
|
83
88
|
const styles = StyleSheet.create({
|
84
89
|
row: {
|
85
90
|
flexDirection: "row",
|
@@ -3,6 +3,7 @@ import { Linking, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
4
|
import { getContract } from "../../../../contract/contract.js";
|
5
5
|
import { isContractDeployed } from "../../../../utils/bytecode/is-contract-deployed.js";
|
6
|
+
import { formatNumber } from "../../../../utils/formatNumber.js";
|
6
7
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
7
8
|
import type { Theme } from "../../../core/design-system/index.js";
|
8
9
|
import { useSiweAuth } from "../../../core/hooks/auth/useSiweAuth.js";
|
@@ -189,7 +190,7 @@ const AccountHeader = (props: ConnectedModalProps) => {
|
|
189
190
|
fontSize: fontSize.sm,
|
190
191
|
}}
|
191
192
|
>
|
192
|
-
{Number(balanceQuery.data.displayValue)
|
193
|
+
{formatNumber(Number(balanceQuery.data.displayValue), 5)}{" "}
|
193
194
|
{balanceQuery.data?.symbol}
|
194
195
|
</ThemedText>
|
195
196
|
) : (
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { ScrollView, StyleSheet, TouchableOpacity, View } from "react-native";
|
2
2
|
import type { Chain } from "../../../../chains/types.js";
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
|
+
import { formatNumber } from "../../../../utils/formatNumber.js";
|
4
5
|
import type { Theme } from "../../../core/design-system/index.js";
|
5
6
|
import { useWalletBalance } from "../../../core/hooks/others/useWalletBalance.js";
|
6
7
|
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js";
|
@@ -91,7 +92,7 @@ export const TokenRow = (props: {
|
|
91
92
|
<>
|
92
93
|
{balanceQuery.data ? (
|
93
94
|
<ThemedText theme={theme} type="subtext">
|
94
|
-
{Number(balanceQuery.data.displayValue)
|
95
|
+
{formatBalanceOnButton(Number(balanceQuery.data.displayValue))}{" "}
|
95
96
|
{balanceQuery.data?.symbol}
|
96
97
|
</ThemedText>
|
97
98
|
) : (
|
@@ -125,6 +126,10 @@ export const TokenRow = (props: {
|
|
125
126
|
);
|
126
127
|
};
|
127
128
|
|
129
|
+
function formatBalanceOnButton(num: number) {
|
130
|
+
return formatNumber(num, num < 1 ? 5 : 4);
|
131
|
+
}
|
132
|
+
|
128
133
|
const styles = StyleSheet.create({
|
129
134
|
listContainer: {
|
130
135
|
flexDirection: "column",
|