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

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 (104) 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 +64 -0
  7. package/dist/modal/components/Account/AccountProfile.d.ts +4 -1
  8. package/dist/modal/components/Account/AccountProfile.js +114 -27
  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/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +1 -1
  28. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +17 -12
  29. package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +1 -1
  30. package/dist/modal/components/Footer/Footer.js +26 -57
  31. package/dist/modal/components/Header/Header.js +46 -8
  32. package/dist/modal/components/Header/hooks/useStepTitle.d.ts +4 -0
  33. package/dist/modal/components/Header/hooks/useStepTitle.js +48 -15
  34. package/dist/modal/components/IFrameStep/IFrameStep.js +22 -10
  35. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +16 -10
  36. package/dist/modal/components/ModalContent/ModalContent.d.ts +4 -3
  37. package/dist/modal/components/ModalContent/ModalContent.js +5 -1
  38. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +1 -1
  39. package/dist/modal/components/OAuth/OAuth.js +1 -1
  40. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +2 -2
  41. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +3 -3
  42. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +1 -1
  43. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +1 -1
  44. package/dist/modal/components/Waiting/Waiting.js +1 -1
  45. package/dist/modal/components/WalletCard/WalletCard.d.ts +6 -3
  46. package/dist/modal/components/WalletCard/WalletCard.js +41 -15
  47. package/dist/modal/components/WalletSelect/WalletSelect.d.ts +11 -0
  48. package/dist/modal/components/WalletSelect/WalletSelect.js +153 -0
  49. package/dist/modal/components/common.d.ts +9 -4
  50. package/dist/modal/components/common.js +67 -13
  51. package/dist/modal/constants/constants.d.ts +7 -12
  52. package/dist/modal/constants/constants.js +7 -1
  53. package/dist/modal/constants/oAuthLogos.d.ts +2 -6
  54. package/dist/modal/constants/oAuthLogos.js +45 -43
  55. package/dist/modal/hooks/useGoBack.js +9 -0
  56. package/dist/modal/types/commonTypes.d.ts +9 -0
  57. package/dist/modal/utils/getWalletDisplayName.js +3 -6
  58. package/dist/modal/utils/icons.d.ts +5 -0
  59. package/dist/modal/utils/icons.js +17 -0
  60. package/dist/provider/ParaProvider.js +24 -129
  61. package/dist/provider/ParaProviderMin.d.ts +4 -0
  62. package/dist/provider/ParaProviderMin.js +140 -0
  63. package/dist/provider/components/CosmosWalletWrapper.d.ts +1 -1
  64. package/dist/provider/components/EvmWalletWrapper.d.ts +1 -1
  65. package/dist/provider/components/ExternalWalletWrapper.js +3 -36
  66. package/dist/provider/components/SolanaWalletWrapper.d.ts +1 -1
  67. package/dist/provider/hooks/mutations/useCreateWallet.d.ts +3 -3
  68. package/dist/provider/hooks/mutations/useCreateWallet.js +1 -1
  69. package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +3 -3
  70. package/dist/provider/hooks/mutations/useCreateWalletPerType.js +1 -1
  71. package/dist/provider/hooks/mutations/useIssueJwt.d.ts +3 -3
  72. package/dist/provider/hooks/mutations/useIssueJwt.js +1 -1
  73. package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +6 -6
  74. package/dist/provider/hooks/mutations/useResendVerificationCode.js +1 -1
  75. package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +4 -42
  76. package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +3 -3
  77. package/dist/provider/hooks/mutations/useVerifyFarcaster.js +1 -1
  78. package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +6 -0
  79. package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +3 -3
  80. package/dist/provider/hooks/mutations/useWaitForLogin.js +1 -1
  81. package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +3 -3
  82. package/dist/provider/hooks/mutations/useWaitForSignup.js +1 -1
  83. package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +3 -3
  84. package/dist/provider/hooks/mutations/useWaitForWalletCreation.js +1 -1
  85. package/dist/provider/index.d.ts +1 -0
  86. package/dist/provider/index.js +3 -1
  87. package/dist/provider/providers/AccountLinkProvider.js +8 -4
  88. package/dist/provider/providers/AuthProvider.js +28 -14
  89. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +1 -1
  90. package/dist/provider/providers/CosmosExternalWalletProvider.js +3 -0
  91. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +1 -1
  92. package/dist/provider/providers/EvmExternalWalletProvider.js +3 -0
  93. package/dist/provider/providers/ExternalWalletProvider.js +1 -1
  94. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +1 -1
  95. package/dist/provider/providers/SolanaExternalWalletProvider.js +3 -0
  96. package/dist/provider/stores/slices/modal.js +16 -12
  97. package/dist/provider/utils/constants.d.ts +5 -0
  98. package/dist/provider/utils/constants.js +64 -1
  99. package/dist/public/PPMori-Regular.woff2 +0 -0
  100. package/dist/public/PPMori-SemiBold.woff2 +0 -0
  101. package/package.json +8 -8
  102. package/dist/modal/components/Controls/Selects.js +0 -173
  103. package/dist/provider/utils/externalWalletDefaults.d.ts +0 -6
  104. package/dist/provider/utils/externalWalletDefaults.js +0 -33
@@ -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
- };