thirdweb 5.42.0 → 5.43.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.
Files changed (203) hide show
  1. package/dist/cjs/adapters/ethers5.js +36 -27
  2. package/dist/cjs/adapters/ethers5.js.map +1 -1
  3. package/dist/cjs/cli/bin.js +13 -0
  4. package/dist/cjs/cli/bin.js.map +1 -1
  5. package/dist/cjs/exports/react.js +3 -1
  6. package/dist/cjs/exports/react.js.map +1 -1
  7. package/dist/cjs/extensions/marketplace/direct-listings/write/createListing.js +5 -1
  8. package/dist/cjs/extensions/marketplace/direct-listings/write/createListing.js.map +1 -1
  9. package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
  10. package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js +1 -1
  11. package/dist/cjs/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
  12. package/dist/cjs/react/core/hooks/wallets/useActiveWallet.js +1 -1
  13. package/dist/cjs/react/core/hooks/wallets/useActiveWallet.js.map +1 -1
  14. package/dist/cjs/react/core/hooks/wallets/useActiveWalletChain.js +1 -1
  15. package/dist/cjs/react/core/hooks/wallets/useActiveWalletChain.js.map +1 -1
  16. package/dist/cjs/react/core/hooks/wallets/useActiveWalletConnectionStatus.js +1 -1
  17. package/dist/cjs/react/core/hooks/wallets/useActiveWalletConnectionStatus.js.map +1 -1
  18. package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js +4 -2
  19. package/dist/cjs/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
  20. package/dist/cjs/react/core/hooks/wallets/useConnect.js +1 -1
  21. package/dist/cjs/react/core/hooks/wallets/useConnect.js.map +1 -1
  22. package/dist/cjs/react/core/hooks/wallets/useConnectedWallets.js +1 -1
  23. package/dist/cjs/react/core/hooks/wallets/useConnectedWallets.js.map +1 -1
  24. package/dist/cjs/react/core/hooks/wallets/useDisconnect.js +1 -1
  25. package/dist/cjs/react/core/hooks/wallets/useDisconnect.js.map +1 -1
  26. package/dist/cjs/react/core/hooks/wallets/useIsAutoConnecting.js +1 -1
  27. package/dist/cjs/react/core/hooks/wallets/useIsAutoConnecting.js.map +1 -1
  28. package/dist/cjs/react/core/hooks/wallets/useSetActiveWallet.js +1 -1
  29. package/dist/cjs/react/core/hooks/wallets/useSetActiveWallet.js.map +1 -1
  30. package/dist/cjs/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js +1 -1
  31. package/dist/cjs/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js.map +1 -1
  32. package/dist/cjs/react/core/hooks/wallets/useSwitchActiveWalletChain.js +1 -1
  33. package/dist/cjs/react/core/hooks/wallets/useSwitchActiveWalletChain.js.map +1 -1
  34. package/dist/cjs/react/core/providers/connection-manager.js +14 -2
  35. package/dist/cjs/react/core/providers/connection-manager.js.map +1 -1
  36. package/dist/cjs/react/web/ui/ConnectWallet/locale/de.js +114 -0
  37. package/dist/cjs/react/web/ui/ConnectWallet/locale/de.js.map +1 -0
  38. package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
  39. package/dist/cjs/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
  40. package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +2 -0
  41. package/dist/cjs/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
  42. package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +118 -0
  43. package/dist/cjs/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -0
  44. package/dist/cjs/react/web/wallets/injected/locale/de.js +27 -0
  45. package/dist/cjs/react/web/wallets/injected/locale/de.js.map +1 -0
  46. package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
  47. package/dist/cjs/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
  48. package/dist/cjs/react/web/wallets/shared/locale/de.js +55 -0
  49. package/dist/cjs/react/web/wallets/shared/locale/de.js.map +1 -0
  50. package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
  51. package/dist/cjs/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
  52. package/dist/cjs/react/web/wallets/smartWallet/locale/de.js +13 -0
  53. package/dist/cjs/react/web/wallets/smartWallet/locale/de.js.map +1 -0
  54. package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
  55. package/dist/cjs/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
  56. package/dist/cjs/react/web/wallets/walletConnect/locale.js +4 -0
  57. package/dist/cjs/react/web/wallets/walletConnect/locale.js.map +1 -1
  58. package/dist/cjs/version.js +1 -1
  59. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +11 -5
  60. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  61. package/dist/cjs/wallets/in-app/native/auth/native-auth.js +2 -1
  62. package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -1
  63. package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js +3 -1
  64. package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
  65. package/dist/cjs/wallets/in-app/native/native-connector.js +2 -2
  66. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  67. package/dist/esm/adapters/ethers5.js +36 -27
  68. package/dist/esm/adapters/ethers5.js.map +1 -1
  69. package/dist/esm/cli/bin.js +13 -0
  70. package/dist/esm/cli/bin.js.map +1 -1
  71. package/dist/esm/exports/react.js +1 -0
  72. package/dist/esm/exports/react.js.map +1 -1
  73. package/dist/esm/extensions/marketplace/direct-listings/write/createListing.js +5 -1
  74. package/dist/esm/extensions/marketplace/direct-listings/write/createListing.js.map +1 -1
  75. package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
  76. package/dist/esm/react/core/hooks/wallets/useActiveAccount.js +2 -2
  77. package/dist/esm/react/core/hooks/wallets/useActiveAccount.js.map +1 -1
  78. package/dist/esm/react/core/hooks/wallets/useActiveWallet.js +2 -2
  79. package/dist/esm/react/core/hooks/wallets/useActiveWallet.js.map +1 -1
  80. package/dist/esm/react/core/hooks/wallets/useActiveWalletChain.js +2 -2
  81. package/dist/esm/react/core/hooks/wallets/useActiveWalletChain.js.map +1 -1
  82. package/dist/esm/react/core/hooks/wallets/useActiveWalletConnectionStatus.js +2 -2
  83. package/dist/esm/react/core/hooks/wallets/useActiveWalletConnectionStatus.js.map +1 -1
  84. package/dist/esm/react/core/hooks/wallets/useAutoConnect.js +5 -3
  85. package/dist/esm/react/core/hooks/wallets/useAutoConnect.js.map +1 -1
  86. package/dist/esm/react/core/hooks/wallets/useConnect.js +2 -2
  87. package/dist/esm/react/core/hooks/wallets/useConnect.js.map +1 -1
  88. package/dist/esm/react/core/hooks/wallets/useConnectedWallets.js +2 -2
  89. package/dist/esm/react/core/hooks/wallets/useConnectedWallets.js.map +1 -1
  90. package/dist/esm/react/core/hooks/wallets/useDisconnect.js +2 -2
  91. package/dist/esm/react/core/hooks/wallets/useDisconnect.js.map +1 -1
  92. package/dist/esm/react/core/hooks/wallets/useIsAutoConnecting.js +2 -2
  93. package/dist/esm/react/core/hooks/wallets/useIsAutoConnecting.js.map +1 -1
  94. package/dist/esm/react/core/hooks/wallets/useSetActiveWallet.js +2 -2
  95. package/dist/esm/react/core/hooks/wallets/useSetActiveWallet.js.map +1 -1
  96. package/dist/esm/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js +2 -2
  97. package/dist/esm/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.js.map +1 -1
  98. package/dist/esm/react/core/hooks/wallets/useSwitchActiveWalletChain.js +2 -2
  99. package/dist/esm/react/core/hooks/wallets/useSwitchActiveWalletChain.js.map +1 -1
  100. package/dist/esm/react/core/providers/connection-manager.js +13 -2
  101. package/dist/esm/react/core/providers/connection-manager.js.map +1 -1
  102. package/dist/esm/react/web/ui/ConnectWallet/locale/de.js +112 -0
  103. package/dist/esm/react/web/ui/ConnectWallet/locale/de.js.map +1 -0
  104. package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js +3 -0
  105. package/dist/esm/react/web/ui/ConnectWallet/locale/getConnectLocale.js.map +1 -1
  106. package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js +2 -0
  107. package/dist/esm/react/web/ui/prebuilt/thirdweb/ClaimButton/index.js.map +1 -1
  108. package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js +115 -0
  109. package/dist/esm/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.js.map +1 -0
  110. package/dist/esm/react/web/wallets/injected/locale/de.js +25 -0
  111. package/dist/esm/react/web/wallets/injected/locale/de.js.map +1 -0
  112. package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js +2 -0
  113. package/dist/esm/react/web/wallets/injected/locale/getInjectedWalletLocale.js.map +1 -1
  114. package/dist/esm/react/web/wallets/shared/locale/de.js +53 -0
  115. package/dist/esm/react/web/wallets/shared/locale/de.js.map +1 -0
  116. package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js +2 -0
  117. package/dist/esm/react/web/wallets/shared/locale/getConnectLocale.js.map +1 -1
  118. package/dist/esm/react/web/wallets/smartWallet/locale/de.js +11 -0
  119. package/dist/esm/react/web/wallets/smartWallet/locale/de.js.map +1 -0
  120. package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js +2 -0
  121. package/dist/esm/react/web/wallets/smartWallet/locale/getSmartWalletLocale.js.map +1 -1
  122. package/dist/esm/react/web/wallets/walletConnect/locale.js +4 -0
  123. package/dist/esm/react/web/wallets/walletConnect/locale.js.map +1 -1
  124. package/dist/esm/version.js +1 -1
  125. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +11 -5
  126. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  127. package/dist/esm/wallets/in-app/native/auth/native-auth.js +2 -1
  128. package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -1
  129. package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js +4 -2
  130. package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
  131. package/dist/esm/wallets/in-app/native/native-connector.js +2 -2
  132. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  133. package/dist/types/adapters/ethers5.d.ts.map +1 -1
  134. package/dist/types/exports/react.d.ts +1 -0
  135. package/dist/types/exports/react.d.ts.map +1 -1
  136. package/dist/types/extensions/marketplace/direct-listings/write/createListing.d.ts +5 -1
  137. package/dist/types/extensions/marketplace/direct-listings/write/createListing.d.ts.map +1 -1
  138. package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
  139. package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
  140. package/dist/types/react/core/hooks/wallets/useAutoConnect.d.ts.map +1 -1
  141. package/dist/types/react/core/providers/connection-manager.d.ts +21 -0
  142. package/dist/types/react/core/providers/connection-manager.d.ts.map +1 -1
  143. package/dist/types/react/web/ui/ConnectWallet/locale/de.d.ts +4 -0
  144. package/dist/types/react/web/ui/ConnectWallet/locale/de.d.ts.map +1 -0
  145. package/dist/types/react/web/ui/ConnectWallet/locale/getConnectLocale.d.ts.map +1 -1
  146. package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts +2 -0
  147. package/dist/types/react/web/ui/prebuilt/thirdweb/ClaimButton/index.d.ts.map +1 -1
  148. package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts +37 -0
  149. package/dist/types/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.d.ts.map +1 -0
  150. package/dist/types/react/web/ui/types.d.ts +1 -1
  151. package/dist/types/react/web/ui/types.d.ts.map +1 -1
  152. package/dist/types/react/web/wallets/injected/locale/de.d.ts +7 -0
  153. package/dist/types/react/web/wallets/injected/locale/de.d.ts.map +1 -0
  154. package/dist/types/react/web/wallets/injected/locale/getInjectedWalletLocale.d.ts.map +1 -1
  155. package/dist/types/react/web/wallets/shared/locale/de.d.ts +54 -0
  156. package/dist/types/react/web/wallets/shared/locale/de.d.ts.map +1 -0
  157. package/dist/types/react/web/wallets/shared/locale/getConnectLocale.d.ts.map +1 -1
  158. package/dist/types/react/web/wallets/smartWallet/locale/de.d.ts +4 -0
  159. package/dist/types/react/web/wallets/smartWallet/locale/de.d.ts.map +1 -0
  160. package/dist/types/react/web/wallets/smartWallet/locale/getSmartWalletLocale.d.ts.map +1 -1
  161. package/dist/types/react/web/wallets/walletConnect/locale.d.ts.map +1 -1
  162. package/dist/types/version.d.ts +1 -1
  163. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +3 -2
  164. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
  165. package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -1
  166. package/dist/types/wallets/in-app/native/helpers/auth/middleware.d.ts.map +1 -1
  167. package/package.json +1 -1
  168. package/src/adapters/ethers5.ts +48 -28
  169. package/src/cli/bin.ts +18 -0
  170. package/src/exports/react.ts +4 -0
  171. package/src/extensions/marketplace/direct-listings/write/createListing.ts +5 -1
  172. package/src/pay/buyWithCrypto/getStatus.ts +2 -1
  173. package/src/react/core/hooks/wallets/useActiveAccount.ts +2 -2
  174. package/src/react/core/hooks/wallets/useActiveWallet.ts +2 -2
  175. package/src/react/core/hooks/wallets/useActiveWalletChain.ts +2 -2
  176. package/src/react/core/hooks/wallets/useActiveWalletConnectionStatus.ts +2 -2
  177. package/src/react/core/hooks/wallets/useAutoConnect.ts +5 -3
  178. package/src/react/core/hooks/wallets/useConnect.ts +2 -2
  179. package/src/react/core/hooks/wallets/useConnectedWallets.ts +2 -2
  180. package/src/react/core/hooks/wallets/useDisconnect.ts +2 -2
  181. package/src/react/core/hooks/wallets/useIsAutoConnecting.ts +2 -2
  182. package/src/react/core/hooks/wallets/useSetActiveWallet.ts +2 -2
  183. package/src/react/core/hooks/wallets/useSetActiveWalletConnectionStatus.ts +2 -2
  184. package/src/react/core/hooks/wallets/useSwitchActiveWalletChain.ts +2 -2
  185. package/src/react/core/providers/connection-manager.tsx +15 -2
  186. package/src/react/web/ui/ConnectWallet/locale/de.ts +117 -0
  187. package/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts +3 -0
  188. package/src/react/web/ui/prebuilt/thirdweb/ClaimButton/index.tsx +2 -0
  189. package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/CreateDirectListingButton.test.tsx +29 -0
  190. package/src/react/web/ui/prebuilt/thirdweb/CreateDirectListingButton/index.tsx +165 -0
  191. package/src/react/web/ui/types.ts +7 -1
  192. package/src/react/web/wallets/injected/locale/de.ts +27 -0
  193. package/src/react/web/wallets/injected/locale/getInjectedWalletLocale.ts +2 -0
  194. package/src/react/web/wallets/shared/locale/de.ts +58 -0
  195. package/src/react/web/wallets/shared/locale/getConnectLocale.ts +2 -0
  196. package/src/react/web/wallets/smartWallet/locale/de.ts +13 -0
  197. package/src/react/web/wallets/smartWallet/locale/getSmartWalletLocale.ts +2 -0
  198. package/src/react/web/wallets/walletConnect/locale.ts +4 -0
  199. package/src/version.ts +1 -1
  200. package/src/wallets/in-app/core/authentication/getLoginPath.ts +14 -5
  201. package/src/wallets/in-app/native/auth/native-auth.ts +2 -1
  202. package/src/wallets/in-app/native/helpers/auth/middleware.ts +7 -2
  203. package/src/wallets/in-app/native/native-connector.ts +2 -2
@@ -0,0 +1,165 @@
1
+ "use client";
2
+
3
+ import { useCallback } from "react";
4
+ import type { Chain } from "../../../../../../chains/types.js";
5
+ import type { ThirdwebClient } from "../../../../../../client/client.js";
6
+ import { getContract } from "../../../../../../contract/contract.js";
7
+ import { getApprovalForTransaction } from "../../../../../../extensions/erc20/write/getApprovalForTransaction.js";
8
+ import {
9
+ type CreateListingParams,
10
+ createListing,
11
+ } from "../../../../../../extensions/marketplace/direct-listings/write/createListing.js";
12
+ import type { BaseTransactionOptions } from "../../../../../../transaction/types.js";
13
+ import { useReadContract } from "../../../../../core/hooks/contract/useReadContract.js";
14
+ import type { TransactionButtonProps } from "../../../../../core/hooks/transaction/transaction-button-utils.js";
15
+ import { useSendAndConfirmTransaction } from "../../../../../core/hooks/transaction/useSendAndConfirmTransaction.js";
16
+ import { useActiveAccount } from "../../../../../core/hooks/wallets/useActiveAccount.js";
17
+ import { TransactionButton } from "../../../TransactionButton/index.js";
18
+
19
+ export type CreateDirectListingButtonProps = Omit<
20
+ TransactionButtonProps,
21
+ "transaction"
22
+ > &
23
+ CreateListingParams & {
24
+ contractAddress: string;
25
+ chain: Chain;
26
+ client: ThirdwebClient;
27
+ };
28
+
29
+ /**
30
+ * This button is used to create Direct listings for the thirdweb Marketplace v3 contract
31
+ *
32
+ * It uses the [`TransactionButton`](https://portal.thirdweb.com/references/typescript/v5/TransactionButton)
33
+ * and the [`createListing` extension](https://portal.thirdweb.com/references/typescript/v5/marketplace/createListing) under the hood
34
+ * which means it inherits all the props of those 2 components.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { CreateDirectListingButton } from "thirdweb/react";
39
+ *
40
+ * <CreateDirectListingButton
41
+ * contractAddress="0x..." // contract address for the marketplace-v3
42
+ * chain={...} // the chain which the marketplace contract is deployed on
43
+ *
44
+ * // These props below are the same props for `createListing`
45
+ * // to get the full list, check the docs link above
46
+ * tokenId={0n}
47
+ * assetContractAddress="0x..." // The NFT contract address whose NFT(s) you want to sell
48
+ * pricePerToken={"0.1"} // sell for 0.1 <native token>
49
+ * >
50
+ * Sell NFT
51
+ * </CreateDirectListingButton>
52
+ * ```
53
+ * @component
54
+ */
55
+ export function CreateDirectListingButton(
56
+ props: CreateDirectListingButtonProps,
57
+ ) {
58
+ const {
59
+ contractAddress,
60
+ chain,
61
+ client,
62
+ children,
63
+ payModal,
64
+ assetContractAddress,
65
+ tokenId,
66
+ } = props;
67
+ const marketplaceContract = getContract({
68
+ address: contractAddress,
69
+ chain,
70
+ client,
71
+ });
72
+ const account = useActiveAccount();
73
+ const defaultPayModalMetadata = payModal ? payModal.metadata : undefined;
74
+ const { data: payMetadata } = useReadContract(getPayMetadata, {
75
+ contract: getContract({
76
+ address: assetContractAddress,
77
+ chain,
78
+ client,
79
+ }),
80
+ tokenId,
81
+ queryOptions: {
82
+ enabled: !defaultPayModalMetadata,
83
+ },
84
+ });
85
+ const { mutateAsync } = useSendAndConfirmTransaction();
86
+
87
+ const prepareTransaction = useCallback(async () => {
88
+ if (!account) {
89
+ throw new Error("No account detected");
90
+ }
91
+ const listingTx = createListing({
92
+ contract: marketplaceContract,
93
+ ...props,
94
+ });
95
+ const approveTx = await getApprovalForTransaction({
96
+ transaction: listingTx,
97
+ account,
98
+ });
99
+ if (approveTx) {
100
+ await mutateAsync(approveTx);
101
+ }
102
+ return listingTx;
103
+ }, [marketplaceContract, props, account, mutateAsync]);
104
+
105
+ return (
106
+ <TransactionButton
107
+ transaction={() => prepareTransaction()}
108
+ payModal={{
109
+ metadata: defaultPayModalMetadata || payMetadata,
110
+ ...payModal,
111
+ }}
112
+ {...props}
113
+ >
114
+ {children}
115
+ </TransactionButton>
116
+ );
117
+ }
118
+
119
+ /**
120
+ * @internal
121
+ */
122
+ async function getPayMetadata(
123
+ options: BaseTransactionOptions<{
124
+ tokenId: bigint;
125
+ }>,
126
+ ): Promise<{ name?: string; image?: string }> {
127
+ const [
128
+ { isERC721 },
129
+ { isERC1155 },
130
+ { getContractMetadata },
131
+ { getNFT: getERC721 },
132
+ { getNFT: getERC1155 },
133
+ ] = await Promise.all([
134
+ import("../../../../../../extensions/erc721/read/isERC721.js"),
135
+ import("../../../../../../extensions/erc1155/read/isERC1155.js"),
136
+ import("../../../../../../extensions/common/read/getContractMetadata.js"),
137
+ import("../../../../../../extensions/erc721/read/getNFT.js"),
138
+ import("../../../../../../extensions/erc1155/read/getNFT.js"),
139
+ ]);
140
+ const [is721, is1155, contractMetadata] = await Promise.all([
141
+ isERC721(options),
142
+ isERC1155(options),
143
+ getContractMetadata(options),
144
+ ]);
145
+ if (is721) {
146
+ const nft = await getERC721(options);
147
+ return {
148
+ image: nft?.metadata?.image,
149
+ name: nft?.metadata?.name,
150
+ };
151
+ }
152
+
153
+ if (is1155) {
154
+ const nft = await getERC1155(options);
155
+ return {
156
+ image: nft?.metadata?.image,
157
+ name: nft?.metadata?.name,
158
+ };
159
+ }
160
+
161
+ return {
162
+ image: contractMetadata?.image,
163
+ name: contractMetadata?.name,
164
+ };
165
+ }
@@ -1,2 +1,8 @@
1
1
  // valid combinations of ISO language code and ISO country code
2
- export type LocaleId = "en_US" | "es_ES" | "ja_JP" | "tl_PH" | "vi_VN";
2
+ export type LocaleId =
3
+ | "en_US"
4
+ | "es_ES"
5
+ | "ja_JP"
6
+ | "tl_PH"
7
+ | "vi_VN"
8
+ | "de_DE";
@@ -0,0 +1,27 @@
1
+ import type { InjectedWalletLocale } from "./types.js";
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ const injectedWalletLocaleEn = (wallet: string): InjectedWalletLocale => ({
7
+ connectionScreen: {
8
+ inProgress: "Verbindung wird hergestellt",
9
+ failed: "Verbindung fehlgeschlagen",
10
+ instruction: `Akzeptiere die Verbindung in ${wallet}`,
11
+ retry: "Erneut versuchen",
12
+ },
13
+ getStartedScreen: {
14
+ instruction: `Scanne den QR Code um ${wallet} herunterzuladen`,
15
+ },
16
+ scanScreen: {
17
+ instruction: `Scanne den QR Code um ${wallet} zu verbinden`,
18
+ },
19
+ getStartedLink: `Du hast ${wallet} nicht?`,
20
+ download: {
21
+ chrome: "Chrome Extension installieren",
22
+ android: "Von Google Play herunterladen",
23
+ iOS: "Von App Store herunterladen",
24
+ },
25
+ });
26
+
27
+ export default injectedWalletLocaleEn;
@@ -16,6 +16,8 @@ export async function getInjectedWalletLocale(
16
16
  return (await import("./tl.js")).default;
17
17
  case "vi_VN":
18
18
  return (await import("./vi.js")).default;
19
+ case "de_DE":
20
+ return (await import("./de.js")).default;
19
21
  default:
20
22
  return (await import("./en.js")).default;
21
23
  }
@@ -0,0 +1,58 @@
1
+ import type { InAppWalletLocale } from "./types.js";
2
+
3
+ export default {
4
+ signInWithGoogle: "Google",
5
+ signInWithFacebook: "Facebook",
6
+ signInWithApple: "Apple",
7
+ signInWithDiscord: "Discord",
8
+ emailPlaceholder: "E-Mail Adresse",
9
+ submitEmail: "Weiter",
10
+ signIn: "Anmelden",
11
+ or: "Oder",
12
+ emailRequired: "E-Mail Adresse ist erforderlich",
13
+ invalidEmail: "Ungültige E-Mail Adresse",
14
+ maxAccountsExceeded:
15
+ "Maximale Anzahl von Konten überschritten. Bitte informiere den App-Entwickler.",
16
+ socialLoginScreen: {
17
+ title: "Anmelden",
18
+ instruction: "Melde dich im Popup Fenster an",
19
+ failed: "Anmeldung fehlgeschlagen",
20
+ retry: "Erneut versuchen",
21
+ },
22
+ emailLoginScreen: {
23
+ title: "Anmelden",
24
+ enterCodeSendTo: "Gib den Bestätigungscode ein. Gesendet an",
25
+ newDeviceDetected: "Neues Gerät erkannt",
26
+ enterRecoveryCode:
27
+ "Gib den Wiederherstellungscode ein, der dir per E-Mail zugesandt wurde, als du dich zum ersten Mal angemeldet hast",
28
+ invalidCode: "Ungültiger Bestätigungscode",
29
+ invalidCodeOrRecoveryCode:
30
+ "Ungültiger Bestätigungscode oder Wiederherstellungscode",
31
+ verify: "Bestätigen",
32
+ failedToSendCode: "Bestätigungscode konnte nicht gesendet werden",
33
+ sendingCode: "Bestätigungscode wird gesendet",
34
+ resendCode: "Bestätigungscode erneut senden",
35
+ },
36
+ createPassword: {
37
+ title: "Passwort erstellen",
38
+ instruction:
39
+ "Lege ein Passwort für dein Konto fest. Du benötigst dieses Passwort, um dich von einem neuen Gerät aus anzumelden.",
40
+ saveInstruction: "Stelle sicher, dass du es gespeichert hast",
41
+ inputPlaceholder: "Gib dein Passwort ein",
42
+ confirmation: "Ich habe mein Passwort gespeichert",
43
+ submitButton: "Passwort festlegen",
44
+ failedToSetPassword: "Passwort festlegen fehlgeschlagen",
45
+ },
46
+ enterPassword: {
47
+ title: "Passwort eingeben",
48
+ instruction: "Gib das Passwort für dein Konto ein",
49
+ inputPlaceholder: "Gib dein Passwort ein",
50
+ submitButton: "Überprüfen",
51
+ wrongPassword: "Falsches Passwort",
52
+ },
53
+ signInWithEmail: "Mit E-Mail Adresse anmelden",
54
+ invalidPhone: "Ungültige Telefonnummer",
55
+ phonePlaceholder: "Telefonnummer",
56
+ signInWithPhone: "Mit Telefonnummer anmelden",
57
+ phoneRequired: "Telefonnummer ist erforderlich",
58
+ } satisfies InAppWalletLocale;
@@ -16,6 +16,8 @@ export async function getInAppWalletLocale(
16
16
  return (await import("./tl.js")).default;
17
17
  case "vi_VN":
18
18
  return (await import("./vi.js")).default;
19
+ case "de_DE":
20
+ return (await import("./de.js")).default;
19
21
  default:
20
22
  return (await import("./en.js")).default;
21
23
  }
@@ -0,0 +1,13 @@
1
+ import type { SmartWalletLocale } from "./types.js";
2
+
3
+ const smartWalletLocalEn: SmartWalletLocale = {
4
+ connecting: "Verbindung zum Smart Account wird hergestellt",
5
+ failedToConnect: "Verbindung zum Smart Account fehlgeschlagen",
6
+ wrongNetworkScreen: {
7
+ title: "Falsches Netzwerk",
8
+ subtitle: "Dein Wallet ist nicht mit dem erforderlichen Netzwerk verbunden",
9
+ failedToSwitch: "Netzwerkwechsel fehlgeschlagen",
10
+ },
11
+ };
12
+
13
+ export default smartWalletLocalEn;
@@ -16,6 +16,8 @@ export async function getSmartWalletLocale(
16
16
  return (await import("./tl.js")).default;
17
17
  case "vi_VN":
18
18
  return (await import("./vi.js")).default;
19
+ case "de_DE":
20
+ return (await import("./de.js")).default;
19
21
  default:
20
22
  return (await import("./en.js")).default;
21
23
  }
@@ -29,4 +29,8 @@ export const walletConnectLocales: Record<LocaleId, WalletConnectLocale> = {
29
29
  scanInstruction: "Quét mã QR bằng ứng dụng ví để kết nối",
30
30
  openWCModal: "Mở giao diện WalletConnect",
31
31
  },
32
+ de_DE: {
33
+ scanInstruction: "Scanne dies mit deiner Wallet-App, um zu verbinden",
34
+ openWCModal: "Offizielles WalletConnect-Modal öffnen",
35
+ },
32
36
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.42.0";
1
+ export const version = "5.43.0";
@@ -8,11 +8,13 @@ export const getSocialAuthLoginPath = ({
8
8
  client,
9
9
  ecosystem,
10
10
  mode = "popup",
11
+ redirectUrl,
11
12
  }: {
12
13
  authOption: SocialAuthOption;
13
14
  client: ThirdwebClient;
14
15
  ecosystem?: Ecosystem;
15
- mode?: "popup" | "redirect";
16
+ mode?: "popup" | "redirect" | "mobile";
17
+ redirectUrl?: string;
16
18
  }) => {
17
19
  let baseUrl = `${getThirdwebBaseUrl("inAppWallet")}/api/2024-05-05/login/${authOption}?clientId=${client.clientId}`;
18
20
  if (ecosystem?.partnerId) {
@@ -22,10 +24,17 @@ export const getSocialAuthLoginPath = ({
22
24
  }
23
25
 
24
26
  if (mode === "redirect") {
25
- const redirectUrl = new URL(window.location.href);
26
- redirectUrl.searchParams.set("walletId", ecosystem?.id || "inApp");
27
- redirectUrl.searchParams.set("authProvider", authOption);
28
- baseUrl = `${baseUrl}&redirectUrl=${encodeURIComponent(redirectUrl.toString())}`;
27
+ const formattedRedirectUrl = new URL(redirectUrl || window.location.href);
28
+ formattedRedirectUrl.searchParams.set("walletId", ecosystem?.id || "inApp");
29
+ formattedRedirectUrl.searchParams.set("authProvider", authOption);
30
+ baseUrl = `${baseUrl}&redirectUrl=${encodeURIComponent(formattedRedirectUrl.toString())}`;
31
+ }
32
+
33
+ if (mode === "mobile") {
34
+ if (!redirectUrl) {
35
+ throw new Error("Redirect URL is required for mobile authentication");
36
+ }
37
+ baseUrl = `${baseUrl}&redirectUrl=${encodeURIComponent(redirectUrl)}`;
29
38
  }
30
39
 
31
40
  return baseUrl;
@@ -211,7 +211,8 @@ export async function socialLogin(
211
211
  const loginUrl = getSocialAuthLoginPath({
212
212
  authOption: auth.strategy,
213
213
  client,
214
- mode: "popup",
214
+ mode: "mobile",
215
+ redirectUrl: auth.redirectUrl,
215
216
  });
216
217
 
217
218
  const result = await WebBrowser.openAuthSessionAsync(
@@ -11,7 +11,10 @@ import {
11
11
  setWallerUserDetails,
12
12
  } from "../storage/local.js";
13
13
  import { setUpNewUserWallet } from "../wallet/creation.js";
14
- import { getCognitoRecoveryPasswordV2 } from "../wallet/recoveryCode.js";
14
+ import {
15
+ getCognitoRecoveryPasswordV1,
16
+ getCognitoRecoveryPasswordV2,
17
+ } from "../wallet/recoveryCode.js";
15
18
  import { setUpShareForNewDevice } from "../wallet/retrieval.js";
16
19
 
17
20
  export async function preAuth(args: {
@@ -153,7 +156,9 @@ async function getRecoveryCode(
153
156
  try {
154
157
  return await getCognitoRecoveryPasswordV2(client);
155
158
  } catch (e) {
156
- throw new Error("Something went wrong getting cognito recovery code");
159
+ return await getCognitoRecoveryPasswordV1(client).catch(() => {
160
+ throw new Error("Something went wrong getting cognito recovery code");
161
+ });
157
162
  }
158
163
  }
159
164
  } else if (
@@ -113,7 +113,7 @@ export class InAppNativeConnector implements InAppConnector {
113
113
  case "apple": {
114
114
  const ExpoLinking = require("expo-linking");
115
115
  const redirectUrl =
116
- params.redirectUrl || (ExpoLinking.createURL("") as string);
116
+ params.redirectUrl || (ExpoLinking.createURL("") as string); // Will default to the app scheme
117
117
  return this.socialLogin({
118
118
  strategy,
119
119
  redirectUrl,
@@ -167,7 +167,7 @@ export class InAppNativeConnector implements InAppConnector {
167
167
  },
168
168
  };
169
169
  } catch (error) {
170
- console.error(`Error while validating otp: ${error}`);
170
+ console.error(`Error while validating OTP: ${error}`);
171
171
  if (error instanceof Error) {
172
172
  throw new Error(`Error while validating otp: ${error.message}`);
173
173
  }