@getpara/react-sdk-lite 2.0.0-alpha.39 → 2.0.0-alpha.40

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 (102) hide show
  1. package/dist/css/modal.css +14 -1
  2. package/dist/modal/ParaModal.js +29 -6
  3. package/dist/modal/components/Account/Account.d.ts +1 -5
  4. package/dist/modal/components/Account/Account.js +53 -71
  5. package/dist/modal/components/Account/AccountHeader.d.ts +3 -0
  6. package/dist/modal/components/Account/AccountHeader.js +63 -0
  7. package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
  8. package/dist/modal/components/Account/AccountProfile.js +108 -21
  9. package/dist/modal/components/AddFunds/AddFunds.js +11 -6
  10. package/dist/modal/components/AddFunds/AddFundsAsset.js +5 -32
  11. package/dist/modal/components/AddFunds/AddFundsDone.js +1 -1
  12. package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -1
  13. package/dist/modal/components/AddFunds/AddFundsReceive.js +8 -53
  14. package/dist/modal/components/AuthMainStep/AuthMainStep.js +3 -5
  15. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +4 -3
  16. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +4 -1
  17. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +7 -5
  18. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +4 -4
  19. package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +1 -0
  20. package/dist/modal/components/Body/AnimatedHeightWrapper.js +2 -2
  21. package/dist/modal/components/Body/Body.d.ts +3 -1
  22. package/dist/modal/components/Body/Body.js +40 -47
  23. package/dist/modal/components/ChainSwitch/ChainSwitch.js +13 -21
  24. package/dist/modal/components/Controls/{Selects.d.ts → ChainSelect.d.ts} +0 -1
  25. package/dist/modal/components/Controls/ChainSelect.js +88 -0
  26. package/dist/modal/components/Controls/Controls.js +10 -20
  27. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +17 -12
  28. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
  29. package/dist/modal/components/Footer/Footer.js +26 -57
  30. package/dist/modal/components/Header/Header.js +46 -8
  31. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
  32. package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
  33. package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
  34. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
  35. package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
  36. package/dist/modal/components/ModalContent/ModalContent.js +5 -1
  37. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
  38. package/dist/modal/components/OAuth/OAuth.js +1 -1
  39. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
  40. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
  41. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
  42. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
  43. package/dist/modal/components/Waiting/Waiting.js +1 -1
  44. package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
  45. package/dist/modal/components/WalletCard/WalletCard.js +41 -15
  46. package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
  47. package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
  48. package/dist/modal/components/common.d.ts +9 -4
  49. package/dist/modal/components/common.js +57 -13
  50. package/dist/modal/constants/constants.d.ts +7 -12
  51. package/dist/modal/constants/constants.js +7 -1
  52. package/dist/modal/constants/oAuthLogos.d.ts +2 -6
  53. package/dist/modal/constants/oAuthLogos.js +42 -40
  54. package/dist/modal/hooks/useGoBack.js +9 -0
  55. package/dist/modal/types/commonTypes.d.ts +8 -0
  56. package/dist/modal/utils/getWalletDisplayName.js +3 -6
  57. package/dist/modal/utils/icons.d.ts +5 -0
  58. package/dist/modal/utils/icons.js +17 -0
  59. package/dist/provider/ParaProvider.js +24 -129
  60. package/dist/provider/ParaProviderMin.d.ts +4 -0
  61. package/dist/provider/ParaProviderMin.js +140 -0
  62. package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
  63. package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
  64. package/dist/provider/components/ExternalWalletWrapper.js +3 -36
  65. package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
  66. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
  67. package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
  68. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
  69. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
  70. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
  71. package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
  72. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
  73. package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
  74. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +6 -0
  75. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
  76. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
  77. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
  78. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
  79. package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
  80. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
  81. package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
  82. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
  83. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
  84. package/dist/provider/index.d.ts +1 -0
  85. package/dist/provider/index.js +3 -1
  86. package/dist/provider/providers/AuthProvider.js +23 -13
  87. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
  88. package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
  89. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
  90. package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
  91. package/dist/provider/providers/ExternalWalletProvider.js +1 -1
  92. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
  93. package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
  94. package/dist/provider/stores/slices/modal.js +16 -12
  95. package/dist/provider/utils/constants.d.ts +5 -0
  96. package/dist/provider/utils/constants.js +64 -1
  97. package/dist/public/PPMori-Regular.woff2 +0 -0
  98. package/dist/public/PPMori-SemiBold.woff2 +0 -0
  99. package/package.json +8 -8
  100. package/dist/modal/components/Controls/Selects.js +0 -173
  101. package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
  102. package/dist/provider/utils/externalWalletDefaults.js +0 -33
@@ -215,6 +215,16 @@ function AuthProvider({
215
215
  setAuthStepRoute(ModalStep.PASSWORD_CREATION);
216
216
  }
217
217
  break;
218
+ case AuthMethod.PIN:
219
+ setupListener();
220
+ if (isIFrameReady) {
221
+ setStep(ModalStep.PASSWORD_CREATION);
222
+ } else {
223
+ setIFrameUrl(authState.pinUrl);
224
+ setIsIFrameReady(false);
225
+ setAuthStepRoute(ModalStep.PASSWORD_CREATION);
226
+ }
227
+ break;
218
228
  }
219
229
  },
220
230
  [isIFrameReady]
@@ -224,7 +234,7 @@ function AuthProvider({
224
234
  setStep(ModalStep.BIOMETRIC_LOGIN);
225
235
  } else {
226
236
  setupListener();
227
- setIFrameUrl(authState.passwordUrl);
237
+ setIFrameUrl(authState.passwordUrl || authState.pinUrl);
228
238
  setIsIFrameReady(false);
229
239
  setStep(ModalStep.EMBEDDED_PASSWORD_LOGIN);
230
240
  }
@@ -272,7 +282,7 @@ function AuthProvider({
272
282
  };
273
283
  const presentLoginUi = useCallback(
274
284
  (method, authState) => {
275
- const isPasskey = method === AuthMethod.PASSKEY, isPassword = !isPasskey;
285
+ const isPassword = method === AuthMethod.PASSWORD, isPIN = method === AuthMethod.PIN;
276
286
  if (overrides.login) {
277
287
  function loginOverride() {
278
288
  return __async(this, null, function* () {
@@ -286,12 +296,12 @@ function AuthProvider({
286
296
  return;
287
297
  }
288
298
  refs.popupWindow.current = openPopup({
289
- url: isPassword ? authState.passwordUrl : authState.passkeyUrl,
290
- target: isPassword ? "ParaPassword" : "ParaPasskey",
291
- type: isPassword ? "LOGIN_PASSWORD" : "LOGIN_PASSKEY",
299
+ url: isPIN ? authState.pinUrl : isPassword ? authState.passwordUrl : authState.passkeyUrl,
300
+ target: isPIN ? "ParaPIN" : isPassword ? "ParaPassword" : "ParaPasskey",
301
+ type: isPIN ? "LOGIN_PASSWORD" : isPassword ? "LOGIN_PASSWORD" : "LOGIN_PASSKEY",
292
302
  current: refs.popupWindow.current
293
303
  });
294
- setStep(isPassword ? ModalStep.AWAITING_PASSWORD_LOGIN : ModalStep.AWAITING_BIOMETRIC_LOGIN);
304
+ setStep(isPassword || isPIN ? ModalStep.AWAITING_PASSWORD_LOGIN : ModalStep.AWAITING_BIOMETRIC_LOGIN);
295
305
  },
296
306
  [loginState, biometricHints]
297
307
  );
@@ -311,14 +321,14 @@ function AuthProvider({
311
321
  break;
312
322
  case "signup":
313
323
  {
314
- const isPassword = !!authState.passwordUrl, isPasswordOnly = isPassword && (!authState.passkeyUrl || (userAgent == null ? void 0 : userAgent.device.type) === "mobile" && !authState.isPasskeySupported);
315
- if (isPassword) {
316
- setIFrameUrl(authState.passwordUrl);
324
+ const isPassword = !!authState.passwordUrl, isPIN = !!authState.pinUrl, isPasswordOrPIN = isPassword || isPIN, isPasswordOrPINOnly = isPasswordOrPIN && (!authState.passkeyUrl || (userAgent == null ? void 0 : userAgent.device.type) === "mobile" && !authState.isPasskeySupported);
325
+ if (isPasswordOrPIN) {
326
+ setIFrameUrl(authState.passwordUrl || authState.pinUrl);
317
327
  setIsIFrameReady(false);
318
328
  }
319
329
  signup();
320
- if (isPasswordOnly) {
321
- presentSignupUi(AuthMethod.PASSWORD, authState);
330
+ if (isPasswordOrPINOnly) {
331
+ presentSignupUi(isPassword ? AuthMethod.PASSWORD : AuthMethod.PIN, authState);
322
332
  } else {
323
333
  setStep(ModalStep.BIOMETRIC_CREATION);
324
334
  }
@@ -521,12 +531,12 @@ function AuthProvider({
521
531
  ]
522
532
  );
523
533
  useEffect(() => {
524
- if (!!authStepRoute && isIFrameReady && refs.currentStep.current !== authStepRoute) {
534
+ if (!!authStepRoute && refs.currentStep.current !== authStepRoute) {
525
535
  setTimeout(() => {
526
536
  setStep(authStepRoute);
527
537
  }, 200);
528
538
  }
529
- }, [authStepRoute, isIFrameReady]);
539
+ }, [authStepRoute]);
530
540
  useEffect(() => {
531
541
  refs.currentStep.current = currentStep;
532
542
  }, [currentStep]);
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
2
2
  import { ExternalWalletProviderCommon, ParaCosmosProviderConfigNoWallets } from '../types/externalWalletProviders.js';
3
3
  import { ParaCosmosProviderProps } from '@getpara/cosmos-wallet-connectors';
4
4
  export declare function CosmosExternalWalletProvider({ children, isUsing, wallets: walletsFromProps, ...rest }: Omit<ParaCosmosProviderProps, 'config'> & {
5
- config: ParaCosmosProviderConfigNoWallets;
5
+ config: ParaCosmosProviderConfigNoWallets | undefined;
6
6
  } & PropsWithChildren & ExternalWalletProviderCommon): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
7
7
  export declare const MemoizedCosmosExternalWalletProvider: import("react").MemoExoticComponent<typeof CosmosExternalWalletProvider>;
@@ -52,6 +52,9 @@ function CosmosExternalWalletProvider(_a) {
52
52
  if (isLoadingLib) {
53
53
  return null;
54
54
  }
55
+ if (!rest.config) {
56
+ return children;
57
+ }
55
58
  if (CosmosProvider) {
56
59
  return /* @__PURE__ */ jsx(CosmosProvider, __spreadProps(__spreadValues({}, rest), { config: __spreadProps(__spreadValues({}, rest == null ? void 0 : rest.config), { wallets: filteredWallets }), children }));
57
60
  } else if (isUsing) {
@@ -3,5 +3,5 @@ import { ParaEvmProviderProps } from '@getpara/evm-wallet-connectors';
3
3
  import { Chain, Transport } from 'viem';
4
4
  import { ExternalWalletProviderCommon, ParaEvmProviderConfigNoWallets } from '../types/externalWalletProviders.js';
5
5
  export declare function EvmExternalWalletProvider<const chains extends readonly [Chain, ...Chain[]], transports extends Record<chains[number]['id'], Transport>>({ children, isUsing, wallets: walletsFromProps, ...rest }: Omit<ParaEvmProviderProps<chains, transports>, 'config'> & {
6
- config: ParaEvmProviderConfigNoWallets<chains, transports>;
6
+ config: ParaEvmProviderConfigNoWallets<chains, transports> | undefined;
7
7
  } & PropsWithChildren & ExternalWalletProviderCommon): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
@@ -62,6 +62,9 @@ function EvmExternalWalletProvider(_a) {
62
62
  if (isLoadingLib) {
63
63
  return null;
64
64
  }
65
+ if (!rest.config) {
66
+ return children;
67
+ }
65
68
  if (EvmProvider) {
66
69
  return /* @__PURE__ */ jsx(EvmProvider, __spreadProps(__spreadValues({}, rest), { config: __spreadProps(__spreadValues({}, rest == null ? void 0 : rest.config), { wallets: filteredWallets }), children }));
67
70
  } else if (isUsing) {
@@ -474,7 +474,7 @@ function ExternalWalletProvider({ children }) {
474
474
  }
475
475
  });
476
476
  const disconnectExternalWallet = () => __async(this, null, function* () {
477
- yield para.logout();
477
+ if (para.isExternalWalletAuth) yield para.logout();
478
478
  yield evmDisconnect();
479
479
  yield cosmosDisconnect();
480
480
  setSelectedExternalWallet();
@@ -2,6 +2,6 @@ import { PropsWithChildren } from 'react';
2
2
  import { ParaSolanaProviderProps } from '@getpara/solana-wallet-connectors';
3
3
  import { ExternalWalletProviderCommon, ParaSolanaProviderConfigNoWallets } from '../types/externalWalletProviders.js';
4
4
  export declare function SolanaExternalWalletProvider({ children, isUsing, wallets: walletsFromProps, ...rest }: Omit<ParaSolanaProviderProps, 'config'> & {
5
- config: ParaSolanaProviderConfigNoWallets;
5
+ config: ParaSolanaProviderConfigNoWallets | undefined;
6
6
  } & PropsWithChildren & ExternalWalletProviderCommon): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
7
7
  export declare const MemoizedSolanaExternalWalletProvider: import("react").MemoExoticComponent<typeof SolanaExternalWalletProvider>;
@@ -52,6 +52,9 @@ function SolanaExternalWalletProvider(_a) {
52
52
  if (isLoadingLib) {
53
53
  return null;
54
54
  }
55
+ if (!rest.config) {
56
+ return children;
57
+ }
55
58
  if (SolanaProvider) {
56
59
  return /* @__PURE__ */ jsx(SolanaProvider, __spreadProps(__spreadValues({}, rest), { config: __spreadProps(__spreadValues({}, rest == null ? void 0 : rest.config), { wallets: filteredWallets }), children }));
57
60
  } else if (isUsing) {
@@ -1,18 +1,22 @@
1
1
  "use client";
2
2
  import "../../../chunk-MMUBH76A.js";
3
3
  import { createRef } from "react";
4
- const createModalSlice = (set, get) => {
5
- var _a, _b, _c, _d, _e, _f, _g;
6
- return {
7
- modalConfig: void 0,
8
- setModalConfig: (modalConfig) => set({ modalConfig }),
9
- isDarkTheme: ((_c = (_b = (_a = get()) == null ? void 0 : _a.modalConfig) == null ? void 0 : _b.theme) == null ? void 0 : _c.mode) === "dark",
10
- oAuthLogoVariant: (_g = (_f = (_e = (_d = get()) == null ? void 0 : _d.modalConfig) == null ? void 0 : _e.theme) == null ? void 0 : _f.oAuthLogoVariant) != null ? _g : "default",
11
- isOpen: false,
12
- setIsOpen: (isOpen) => set({ isOpen }),
13
- openedToStep: createRef()
14
- };
15
- };
4
+ const createModalSlice = (set) => ({
5
+ modalConfig: void 0,
6
+ setModalConfig: (modalConfig) => {
7
+ var _a, _b, _c;
8
+ return set({
9
+ modalConfig,
10
+ isDarkTheme: ((_a = modalConfig == null ? void 0 : modalConfig.theme) == null ? void 0 : _a.mode) === "dark",
11
+ oAuthLogoVariant: (_c = (_b = modalConfig == null ? void 0 : modalConfig.theme) == null ? void 0 : _b.oAuthLogoVariant) != null ? _c : "default"
12
+ });
13
+ },
14
+ isDarkTheme: false,
15
+ oAuthLogoVariant: "default",
16
+ isOpen: false,
17
+ setIsOpen: (isOpen) => set({ isOpen }),
18
+ openedToStep: createRef()
19
+ });
16
20
  export {
17
21
  createModalSlice
18
22
  };
@@ -1,5 +1,10 @@
1
+ import { Chain, Transport } from 'viem';
2
+ import { ParaCosmosProviderConfigNoWallets, ParaEvmProviderConfigNoWallets, ParaSolanaProviderConfigNoWallets } from '../types/externalWalletProviders.js';
1
3
  export declare const EXTERNAL_WALLET_PACKAGE_BY_TYPE: {
2
4
  EVM: string;
3
5
  COSMOS: string;
4
6
  SOLANA: string;
5
7
  };
8
+ export declare const EVM_CONFIG_DEFAULT: Omit<ParaEvmProviderConfigNoWallets<readonly [Chain, ...Chain[]], Record<[Chain, ...Chain[]][number]['id'], Transport>>, 'appName' | 'appDescription' | 'appUrl' | 'appIcon' | 'projectId'>;
9
+ export declare const COSMOS_CONFIG_DEFAULT: ParaCosmosProviderConfigNoWallets;
10
+ export declare const SOLANA_CONFIG_DEFAULT: Omit<ParaSolanaProviderConfigNoWallets, 'appIdentity'>;
@@ -5,6 +5,69 @@ const EXTERNAL_WALLET_PACKAGE_BY_TYPE = {
5
5
  COSMOS: "Graz",
6
6
  SOLANA: "@solana/wallet-adapter-react"
7
7
  };
8
+ const EVM_CONFIG_DEFAULT = {
9
+ chains: [
10
+ {
11
+ id: 11155111,
12
+ name: "Sepolia",
13
+ nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
14
+ rpcUrls: { default: { http: ["https://rpc.sepolia.org"] } },
15
+ blockExplorers: {
16
+ default: {
17
+ name: "Etherscan",
18
+ url: "https://sepolia.etherscan.io",
19
+ apiUrl: "https://api-sepolia.etherscan.io/api"
20
+ }
21
+ },
22
+ contracts: {
23
+ multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 751532 },
24
+ ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
25
+ ensUniversalResolver: { address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC", blockCreated: 5317080 }
26
+ },
27
+ testnet: true
28
+ }
29
+ ]
30
+ };
31
+ const COSMOS_CONFIG_DEFAULT = {
32
+ chains: [
33
+ {
34
+ chainId: "theta-testnet-001",
35
+ currencies: [{ coinDenom: "atom", coinMinimalDenom: "uatom", coinDecimals: 6 }],
36
+ rest: "https://cosmoshubt.lava.build",
37
+ rpc: "https://cosmoshubt.tendermintrpc.lava.build:443",
38
+ bech32Config: {
39
+ bech32PrefixAccAddr: "cosmos",
40
+ bech32PrefixAccPub: "cosmospub",
41
+ bech32PrefixValAddr: "cosmosvaloper",
42
+ bech32PrefixValPub: "cosmosvaloperpub",
43
+ bech32PrefixConsAddr: "cosmosvalcons",
44
+ bech32PrefixConsPub: "cosmosvalconspub"
45
+ },
46
+ chainName: "cosmoshubtestnet",
47
+ feeCurrencies: [
48
+ {
49
+ coinDenom: "atom",
50
+ coinMinimalDenom: "uatom",
51
+ coinDecimals: 6,
52
+ coinGeckoId: "",
53
+ gasPriceStep: { low: 0.01, average: 0.025, high: 0.03 }
54
+ }
55
+ ],
56
+ stakeCurrency: { coinDenom: "atom", coinMinimalDenom: "uatom", coinDecimals: 6 },
57
+ bip44: { coinType: 118 }
58
+ }
59
+ ],
60
+ onSwitchChain: () => {
61
+ },
62
+ selectedChainId: "theta-testnet-001"
63
+ };
64
+ const SOLANA_CONFIG_DEFAULT = {
65
+ chain: "devnet",
66
+ endpoint: "https://api.devnet.solana.com"
67
+ };
8
68
  export {
9
- EXTERNAL_WALLET_PACKAGE_BY_TYPE
69
+ COSMOS_CONFIG_DEFAULT,
70
+ EVM_CONFIG_DEFAULT,
71
+ EXTERNAL_WALLET_PACKAGE_BY_TYPE,
72
+ SOLANA_CONFIG_DEFAULT
10
73
  };
Binary file
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/react-sdk-lite",
3
- "version": "2.0.0-alpha.39",
3
+ "version": "2.0.0-alpha.40",
4
4
  "bin": {
5
5
  "setup-para": "dist/cli/cli.mjs"
6
6
  },
7
7
  "dependencies": {
8
- "@getpara/react-common": "2.0.0-alpha.39",
9
- "@getpara/react-components": "2.0.0-alpha.39",
10
- "@getpara/web-sdk": "2.0.0-alpha.39",
8
+ "@getpara/react-common": "2.0.0-alpha.40",
9
+ "@getpara/react-components": "2.0.0-alpha.40",
10
+ "@getpara/web-sdk": "2.0.0-alpha.40",
11
11
  "date-fns": "^3.6.0",
12
12
  "framer-motion": "^11.3.31",
13
13
  "libphonenumber-js": "^1.11.7",
@@ -16,9 +16,9 @@
16
16
  "zustand-sync-tabs": "^0.2.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.39",
20
- "@getpara/evm-wallet-connectors": "2.0.0-alpha.39",
21
- "@getpara/solana-wallet-connectors": "2.0.0-alpha.39",
19
+ "@getpara/cosmos-wallet-connectors": "2.0.0-alpha.40",
20
+ "@getpara/evm-wallet-connectors": "2.0.0-alpha.40",
21
+ "@getpara/solana-wallet-connectors": "2.0.0-alpha.40",
22
22
  "@tanstack/react-query": "^5.74.0",
23
23
  "@testing-library/dom": "^10.4.0",
24
24
  "@testing-library/react": "^16.3.0",
@@ -38,7 +38,7 @@
38
38
  "package.json",
39
39
  "styles.css"
40
40
  ],
41
- "gitHead": "51cb61b1dd8c0b89ab7e779eb1d08e893883396b",
41
+ "gitHead": "2506044cd3ed127774fb7d537ae850b43acfe8b7",
42
42
  "main": "dist/index.js",
43
43
  "peerDependencies": {
44
44
  "@tanstack/react-query": ">=5.0.0",
@@ -1,173 +0,0 @@
1
- "use client";
2
- import {
3
- __async,
4
- __spreadProps,
5
- __spreadValues
6
- } from "../../../chunk-MMUBH76A.js";
7
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { CpslButton, CpslIcon, CpslIdenticon, CpslText } from "@getpara/react-components";
9
- import { safeStyled } from "@getpara/react-common";
10
- import { truncateAddress } from "@getpara/web-sdk";
11
- import { useEffect, useRef } from "react";
12
- import { useDropdownPosition } from "../AuthInput/hooks/useDropdownPosition.js";
13
- import { useAccount, useWallet, useWalletState } from "../../../provider/index.js";
14
- import { HeaderSelect, HeaderSelectContainer, HeaderSelectItem } from "../common.js";
15
- import { useInternalClient } from "../../../provider/hooks/utils/useInternalClient.js";
16
- import { useExternalWallets } from "../../../provider/providers/ExternalWalletProvider.js";
17
- import { useStore } from "../../../provider/stores/useStore.js";
18
- import { useCopyToClipboard } from "@getpara/react-common";
19
- import { getWalletDisplayName } from "../../utils/getWalletDisplayName.js";
20
- const getValue = (id, type) => {
21
- return id && type ? `${id}~${type}` : void 0;
22
- };
23
- const ChainSelect = () => {
24
- var _a, _b;
25
- const containerRef = useRef(null);
26
- const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
27
- const { data: activeWallet } = useWallet();
28
- const { switchChain, chainId, chains, chainIdSwitchingTo } = useExternalWallets();
29
- useEffect(() => {
30
- if (dropdownMaxHeight && chainId) {
31
- resize();
32
- }
33
- }, [chainId, chainIdSwitchingTo, dropdownMaxHeight]);
34
- const handleChainChange = (chainId2) => __async(void 0, null, function* () {
35
- yield switchChain(chainId2);
36
- });
37
- if (!activeWallet || !activeWallet.isExternal || activeWallet.type === "SOLANA") {
38
- return null;
39
- }
40
- const chainIdToUse = chainIdSwitchingTo != null ? chainIdSwitchingTo : chainId;
41
- const selectedChainName = (_a = chains.find((c) => c.id.toString() === chainIdToUse)) == null ? void 0 : _a.name;
42
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "inputContainer", children: /* @__PURE__ */ jsxs(
43
- HeaderSelect,
44
- {
45
- selectedValue: (_b = chainIdToUse == null ? void 0 : chainIdToUse.toString()) != null ? _b : "",
46
- onCpslSelectValueChange: (e) => {
47
- handleChainChange(e.detail);
48
- },
49
- showFormattedSelectedItem: true,
50
- placeholder: "Choose chain...",
51
- anchorElId: "inputContainer",
52
- dropdownMaxHeight,
53
- $width: dropdownWidth != null ? dropdownWidth : 0,
54
- $top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
55
- autoWidth: true,
56
- selectedItemVariant: "bodyXS",
57
- children: [
58
- chainIdToUse && /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", slot: "selected-item", children: selectedChainName }),
59
- chains == null ? void 0 : chains.map((chain) => /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: chain.id.toString(), children: /* @__PURE__ */ jsx(ChainName, { variant: "bodyXS", color: "contrast", children: chain.name }) }, chain.id))
60
- ]
61
- }
62
- ) }) });
63
- };
64
- const AccountSelect = () => {
65
- var _a;
66
- const hideWallets = useStore((state) => {
67
- var _a2;
68
- return (_a2 = state.modalConfig) == null ? void 0 : _a2.hideWallets;
69
- });
70
- const para = useInternalClient();
71
- const containerRef = useRef(null);
72
- const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
73
- const [isCopied, copy] = useCopyToClipboard();
74
- const { setSelectedWallet } = useWalletState();
75
- const { data: activeWallet } = useWallet();
76
- const { embedded } = useAccount();
77
- const availableWallets = embedded == null ? void 0 : embedded.wallets;
78
- const isGuest = para.isGuestMode && (activeWallet == null ? void 0 : activeWallet.pregenIdentifierType) === "GUEST_ID";
79
- const handleCopy = () => {
80
- copy((activeWallet == null ? void 0 : activeWallet.address) ? para.getDisplayAddress(activeWallet.id, { addressType: activeWallet.type }) : "");
81
- };
82
- const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs(FlexRow, { slot: "selected-item", style: { height: "24px" }, children: [
83
- !isGuest && /* @__PURE__ */ jsx(CpslIdenticon, { variant: "avatar", size: "24px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
84
- /* @__PURE__ */ jsx(WalletName, { variant: "bodyXS", color: "contrast", style: { marginLeft: isGuest ? "8px" : "0px" }, children: isGuest ? "Guest" : getWalletDisplayName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
85
- !hideWallets && /* @__PURE__ */ jsxs(Fragment, { children: [
86
- /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: (_a = activeWallet.ensName) != null ? _a : para.getDisplayAddress(activeWallet.id, { truncate: true, addressType: activeWallet.type }) }),
87
- /* @__PURE__ */ jsx(
88
- CpslButton,
89
- {
90
- id: "ignore-click",
91
- size: "small",
92
- variant: "ghost",
93
- onClick: (e) => {
94
- e.stopPropagation();
95
- e.preventDefault();
96
- handleCopy();
97
- },
98
- children: /* @__PURE__ */ jsx(CpslIcon, { id: "ignore-click", slot: "start", icon: isCopied ? "check" : "copy" })
99
- }
100
- )
101
- ] })
102
- ] }) : null;
103
- useEffect(() => {
104
- if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
105
- resize();
106
- }
107
- }, [activeWallet, availableWallets, dropdownMaxHeight]);
108
- return /* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(HeaderSelectContainer, { ref: containerRef, id: "addressInputContainer", children: availableWallets && availableWallets.length > 1 ? /* @__PURE__ */ jsxs(
109
- HeaderSelect,
110
- {
111
- selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
112
- onCpslSelectValueChange: (e) => {
113
- const [id, type] = e.detail.split("~");
114
- setSelectedWallet({ id, type });
115
- },
116
- showFormattedSelectedItem: true,
117
- placeholder: "Choose wallet...",
118
- anchorElId: "addressInputContainer",
119
- dropdownMaxHeight,
120
- $width: dropdownWidth != null ? dropdownWidth : 0,
121
- $top: (mobileAnchor != null ? mobileAnchor : 0) + 16 + 1,
122
- autoWidth: true,
123
- selectedItemVariant: "bodyXS",
124
- children: [
125
- activeWallet && ActiveWalletNode,
126
- availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
127
- const key = getValue(id, type);
128
- const name = _name != null ? _name : getWalletDisplayName(para, { type, isExternal, isMenu: true, hideWallets });
129
- return /* @__PURE__ */ jsx(HeaderSelectItem, { slot: "items", value: key, children: /* @__PURE__ */ jsxs(FlexRow, { children: [
130
- /* @__PURE__ */ jsx(CpslIdenticon, { size: "40px", hash: para.getIdenticonHash(id, type) }),
131
- /* @__PURE__ */ jsxs(FlexCol, { children: [
132
- name && /* @__PURE__ */ jsx(CpslText, { variant: "bodyS", color: "contrast", children: name }),
133
- !hideWallets && address && type && /* @__PURE__ */ jsx(CpslText, { variant: "bodyXS", color: "secondary", children: truncateAddress(address, type, { prefix: para.cosmosPrefix }) })
134
- ] })
135
- ] }) }, key);
136
- })
137
- ]
138
- }
139
- ) : ActiveWalletNode }) });
140
- };
141
- const Container = safeStyled.div`
142
- flex: 0;
143
- width: 100%;
144
- display: flex;
145
- justify-content: center;
146
- `;
147
- const FlexRow = safeStyled.div`
148
- display: flex;
149
- align-items: center;
150
- gap: 8px;
151
- `;
152
- const FlexCol = safeStyled.div`
153
- display: flex;
154
- flex-direction: column;
155
- align-items: flex-start;
156
- `;
157
- const WalletName = safeStyled(CpslText)`
158
- white-space: nowrap;
159
- `;
160
- const ChainName = safeStyled(CpslText)`
161
- max-width: 150px;
162
- text-transform: capitalize;
163
-
164
- &::part(text-element) {
165
- white-space: nowrap;
166
- text-overflow: ellipsis;
167
- overflow: hidden;
168
- }
169
- `;
170
- export {
171
- AccountSelect,
172
- ChainSelect
173
- };
@@ -1,6 +0,0 @@
1
- import { Chain, Transport } from 'viem';
2
- import { ParaEvmProviderConfigNoWallets } from '../types/externalWalletProviders.js';
3
- export declare const getEVMExternalWalletConfigDefault: ({ appName, projectId, }: {
4
- appName: string;
5
- projectId?: string;
6
- }) => ParaEvmProviderConfigNoWallets<readonly [Chain, ...Chain[]], Record<[Chain, ...Chain[]][number]["id"], Transport>>;
@@ -1,33 +0,0 @@
1
- "use client";
2
- import "../../chunk-MMUBH76A.js";
3
- const getEVMExternalWalletConfigDefault = ({
4
- appName,
5
- projectId
6
- }) => ({
7
- appName,
8
- chains: [
9
- {
10
- id: 11155111,
11
- name: "Sepolia",
12
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
13
- rpcUrls: { default: { http: ["https://rpc.sepolia.org"] } },
14
- blockExplorers: {
15
- default: {
16
- name: "Etherscan",
17
- url: "https://sepolia.etherscan.io",
18
- apiUrl: "https://api-sepolia.etherscan.io/api"
19
- }
20
- },
21
- contracts: {
22
- multicall3: { address: "0xca11bde05977b3631167028862be2a173976ca11", blockCreated: 751532 },
23
- ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
24
- ensUniversalResolver: { address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC", blockCreated: 5317080 }
25
- },
26
- testnet: true
27
- }
28
- ],
29
- projectId: projectId != null ? projectId : ""
30
- });
31
- export {
32
- getEVMExternalWalletConfigDefault
33
- };