thirdweb 5.100.2-nightly-5ab59ff400cc32caa414354855fa07831ed90f3a-20250523000413 → 5.100.2

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 (89) hide show
  1. package/dist/cjs/engine/get-status.js +1 -0
  2. package/dist/cjs/engine/get-status.js.map +1 -1
  3. package/dist/cjs/engine/server-wallet.js +4 -1
  4. package/dist/cjs/engine/server-wallet.js.map +1 -1
  5. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +27 -0
  6. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +1 -0
  7. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +17 -16
  8. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  9. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -1
  10. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  11. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +6 -9
  12. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +1 -1
  13. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js +9 -0
  14. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
  15. package/dist/cjs/react/web/wallets/in-app/CountrySelector.js +10 -8
  16. package/dist/cjs/react/web/wallets/in-app/CountrySelector.js.map +1 -1
  17. package/dist/cjs/react/web/wallets/in-app/InputSelectionUI.js +6 -2
  18. package/dist/cjs/react/web/wallets/in-app/InputSelectionUI.js.map +1 -1
  19. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
  20. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  21. package/dist/cjs/utils/bytecode/resolveImplementation.js +1 -1
  22. package/dist/cjs/version.js +1 -1
  23. package/dist/cjs/version.js.map +1 -1
  24. package/dist/esm/engine/get-status.js +1 -0
  25. package/dist/esm/engine/get-status.js.map +1 -1
  26. package/dist/esm/engine/server-wallet.js +4 -1
  27. package/dist/esm/engine/server-wallet.js.map +1 -1
  28. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +23 -0
  29. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +1 -0
  30. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +17 -16
  31. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  32. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -1
  33. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
  34. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +6 -9
  35. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +1 -1
  36. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js +8 -0
  37. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
  38. package/dist/esm/react/web/wallets/in-app/CountrySelector.js +10 -8
  39. package/dist/esm/react/web/wallets/in-app/CountrySelector.js.map +1 -1
  40. package/dist/esm/react/web/wallets/in-app/InputSelectionUI.js +6 -2
  41. package/dist/esm/react/web/wallets/in-app/InputSelectionUI.js.map +1 -1
  42. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
  43. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  44. package/dist/esm/utils/bytecode/resolveImplementation.js +1 -1
  45. package/dist/esm/version.js +1 -1
  46. package/dist/esm/version.js.map +1 -1
  47. package/dist/types/engine/get-status.d.ts.map +1 -1
  48. package/dist/types/engine/server-wallet.d.ts.map +1 -1
  49. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +1 -0
  50. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  51. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts +12 -0
  52. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts.map +1 -0
  53. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts +1 -1
  54. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +1 -1
  55. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +1 -1
  56. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts +2 -1
  57. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts.map +1 -1
  58. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts +6 -0
  59. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts.map +1 -1
  60. package/dist/types/react/web/wallets/in-app/CountrySelector.d.ts +2 -1
  61. package/dist/types/react/web/wallets/in-app/CountrySelector.d.ts.map +1 -1
  62. package/dist/types/react/web/wallets/in-app/InputSelectionUI.d.ts +1 -0
  63. package/dist/types/react/web/wallets/in-app/InputSelectionUI.d.ts.map +1 -1
  64. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  65. package/dist/types/utils/bytecode/resolveImplementation.d.ts +1 -1
  66. package/dist/types/version.d.ts +1 -1
  67. package/dist/types/version.d.ts.map +1 -1
  68. package/dist/types/wallets/ecosystem/types.d.ts +4 -0
  69. package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
  70. package/dist/types/wallets/in-app/core/wallet/types.d.ts +4 -0
  71. package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
  72. package/package.json +1 -1
  73. package/src/engine/get-status.ts +1 -0
  74. package/src/engine/server-wallet.test.ts +16 -16
  75. package/src/engine/server-wallet.ts +4 -1
  76. package/src/react/core/hooks/connection/ConnectButtonProps.ts +1 -0
  77. package/src/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.tsx +68 -0
  78. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +27 -36
  79. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +2 -1
  80. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.tsx +30 -33
  81. package/src/react/web/ui/ConnectWallet/screens/Buy/utils.ts +9 -0
  82. package/src/react/web/wallets/in-app/CountrySelector.tsx +14 -7
  83. package/src/react/web/wallets/in-app/InputSelectionUI.test.tsx +23 -0
  84. package/src/react/web/wallets/in-app/InputSelectionUI.tsx +7 -1
  85. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -0
  86. package/src/utils/bytecode/resolveImplementation.ts +1 -1
  87. package/src/version.ts +1 -1
  88. package/src/wallets/ecosystem/types.ts +5 -0
  89. package/src/wallets/in-app/core/wallet/types.ts +5 -0
@@ -1,3 +1,12 @@
1
1
  export function getBuyTokenAmountFontSize(value: string) {
2
2
  return value.length > 10 ? "26px" : value.length > 6 ? "34px" : "50px";
3
3
  }
4
+
5
+ /**
6
+ *
7
+ * @param str accepts any string but expects a fully upppercased string / type FiatProvider
8
+ * @returns Fiat provider label to be rendered used within presentation logic
9
+ */
10
+ export function getProviderLabel(str: string) {
11
+ return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
12
+ }
@@ -21,19 +21,26 @@ export function getCountrySelector(countryIsoCode: SupportedSmsCountry) {
21
21
  export function CountrySelector({
22
22
  countryCode,
23
23
  setCountryCode,
24
+ allowedCountryCodes,
24
25
  }: {
25
26
  countryCode: string;
26
27
  setCountryCode: React.Dispatch<React.SetStateAction<string>>;
28
+ allowedCountryCodes?: SupportedSmsCountry[];
27
29
  }) {
28
30
  const selectRef = useRef<HTMLSelectElement>(null);
29
31
 
30
- const supportedCountriesForSms = supportedSmsCountries ?? [
31
- {
32
- countryIsoCode: "US",
33
- countryName: "United States",
34
- phoneNumberCode: 1,
35
- },
36
- ];
32
+ const supportedCountriesForSms =
33
+ allowedCountryCodes && allowedCountryCodes.length > 0
34
+ ? supportedSmsCountries.filter((c) =>
35
+ allowedCountryCodes.includes(c.countryIsoCode as SupportedSmsCountry),
36
+ )
37
+ : (supportedSmsCountries ?? [
38
+ {
39
+ countryIsoCode: "US",
40
+ countryName: "United States",
41
+ phoneNumberCode: 1,
42
+ },
43
+ ]);
37
44
 
38
45
  return (
39
46
  <>
@@ -42,4 +42,27 @@ describe("InputSelectionUI", () => {
42
42
 
43
43
  expect(screen.getByRole("combobox")).toHaveValue("US +1");
44
44
  });
45
+
46
+ it("should filter countries based on allowedSmsCountryCodes", () => {
47
+ const mockGetCountrySelector = vi.mocked(getCountrySelector);
48
+ mockGetCountrySelector.mockReturnValue("IN +91");
49
+
50
+ render(
51
+ <InputSelectionUI
52
+ onSelect={vi.fn()}
53
+ placeholder=""
54
+ name=""
55
+ type=""
56
+ submitButtonText=""
57
+ format="phone"
58
+ allowedSmsCountryCodes={["IN", "BR"]}
59
+ />,
60
+ );
61
+
62
+ const options = screen.getAllByRole("option");
63
+ const optionTexts = options.map((o) => o.textContent);
64
+ expect(optionTexts.some((t) => t?.includes("India"))).toBe(true);
65
+ expect(optionTexts.some((t) => t?.includes("Brazil"))).toBe(true);
66
+ expect(optionTexts.some((t) => t?.includes("United States"))).toBe(false);
67
+ });
45
68
  });
@@ -24,11 +24,16 @@ export function InputSelectionUI(props: {
24
24
  format?: "phone";
25
25
  disabled?: boolean;
26
26
  defaultSmsCountryCode?: SupportedSmsCountry;
27
+ allowedSmsCountryCodes?: SupportedSmsCountry[];
27
28
  }) {
28
29
  const [countryCodeInfo, setCountryCodeInfo] = useState(
29
30
  props.defaultSmsCountryCode
30
31
  ? getCountrySelector(props.defaultSmsCountryCode)
31
- : "US +1",
32
+ : props.allowedSmsCountryCodes &&
33
+ props.allowedSmsCountryCodes.length > 0 &&
34
+ props.allowedSmsCountryCodes[0]
35
+ ? getCountrySelector(props.allowedSmsCountryCodes[0])
36
+ : "US +1",
32
37
  );
33
38
  const [input, setInput] = useState("");
34
39
  const [error, setError] = useState<string | undefined>();
@@ -69,6 +74,7 @@ export function InputSelectionUI(props: {
69
74
  <CountrySelector
70
75
  countryCode={countryCodeInfo}
71
76
  setCountryCode={setCountryCodeInfo}
77
+ allowedCountryCodes={props.allowedSmsCountryCodes}
72
78
  />
73
79
  )}
74
80
  <Input
@@ -451,6 +451,9 @@ export const ConnectWalletSocialOptions = (
451
451
  defaultSmsCountryCode={
452
452
  wallet.getConfig()?.auth?.defaultSmsCountryCode
453
453
  }
454
+ allowedSmsCountryCodes={
455
+ wallet.getConfig()?.auth?.allowedSmsCountryCodes
456
+ }
454
457
  />
455
458
  ) : (
456
459
  <WalletTypeRowButton
@@ -18,7 +18,7 @@ const ZERO_BYTES32 =
18
18
  * @returns A promise that resolves to an object containing the implementation address and bytecode.
19
19
  * @example
20
20
  * ```ts
21
- * import { resolveImplementation } from "thirdweb";
21
+ * import { resolveImplementation } from "thirdweb/utils";
22
22
  * const implementation = await resolveImplementation(contract);
23
23
  * ```
24
24
  * @contract
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.100.2-nightly-5ab59ff400cc32caa414354855fa07831ed90f3a-20250523000413";
1
+ export const version = "5.100.2";
@@ -19,6 +19,11 @@ export type EcosystemWalletCreationOptions = {
19
19
  * The default country code to use for SMS authentication
20
20
  */
21
21
  defaultSmsCountryCode?: SupportedSmsCountry;
22
+
23
+ /**
24
+ * The list of allowed country codes to display in the country selector
25
+ */
26
+ allowedSmsCountryCodes?: SupportedSmsCountry[];
22
27
  };
23
28
  /**
24
29
  * The partnerId of the ecosystem wallet to connect to
@@ -83,6 +83,11 @@ export type InAppWalletCreationOptions =
83
83
  * The default country code to use for SMS authentication
84
84
  */
85
85
  defaultSmsCountryCode?: SupportedSmsCountry;
86
+
87
+ /**
88
+ * The list of allowed country codes to display in the country selector
89
+ */
90
+ allowedSmsCountryCodes?: SupportedSmsCountry[];
86
91
  };
87
92
  /**
88
93
  * Metadata to display in the Connect Modal