@getpara/react-sdk 1.2.0 → 1.3.1-dev.1

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 (205) hide show
  1. package/dist/cli/cli.mjs +43 -0
  2. package/dist/index.js +6428 -5
  3. package/dist/index.js.br +0 -0
  4. package/dist/index.js.gz +0 -0
  5. package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
  6. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
  7. package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
  8. package/dist/modal/components/Controls/Selects.d.ts +1 -1
  9. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
  10. package/dist/modal/components/Footer/Footer.d.ts +1 -1
  11. package/dist/modal/components/WalletCard/WalletCard.d.ts +2 -2
  12. package/dist/modal/components/common.d.ts +2 -2
  13. package/dist/modal/index.d.ts +0 -1
  14. package/dist/modal/stores/index.d.ts +0 -1
  15. package/dist/modal/stores/modal/useModalStore.d.ts +6 -3
  16. package/dist/modal/types/modalProps.d.ts +1 -27
  17. package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
  18. package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
  19. package/dist/modal/utils/openPopup.d.ts +1 -1
  20. package/dist/provider/ParaProvider.d.ts +3 -1
  21. package/dist/provider/actions/checkIfUserExists.d.ts +2 -7
  22. package/dist/provider/actions/createUser.d.ts +2 -10
  23. package/dist/provider/actions/getAccount.d.ts +9 -6
  24. package/dist/provider/actions/getWallet.d.ts +1 -1
  25. package/dist/provider/actions/logout.d.ts +4 -1
  26. package/dist/provider/actions/waitForLoginAndSetup.d.ts +1 -1
  27. package/dist/provider/components/CosmosWalletWrapper.d.ts +12 -0
  28. package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
  29. package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
  30. package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
  31. package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
  32. package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
  33. package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
  34. package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +10 -0
  35. package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
  36. package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +6 -0
  37. package/dist/provider/hooks/mutations/useLogout.d.ts +3 -2
  38. package/dist/provider/hooks/queries/useAccount.d.ts +4 -3
  39. package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
  40. package/dist/provider/hooks/utils/useClient.d.ts +1 -1
  41. package/dist/provider/hooks/utils/useWalletState.d.ts +2 -2
  42. package/dist/provider/index.d.ts +1 -0
  43. package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
  44. package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
  45. package/dist/{modal/providers/ExternalWalletContext.d.ts → provider/providers/ExternalWalletProvider.d.ts} +20 -29
  46. package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
  47. package/dist/provider/stores/getters.d.ts +3 -3
  48. package/dist/provider/stores/setters.d.ts +1 -0
  49. package/dist/provider/stores/slices/config.d.ts +3 -0
  50. package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
  51. package/dist/provider/stores/slices/index.d.ts +1 -0
  52. package/dist/provider/stores/types.d.ts +43 -1
  53. package/dist/provider/types/externalWalletProviders.d.ts +12 -0
  54. package/dist/provider/types/provider.d.ts +115 -16
  55. package/dist/provider/types/utils.d.ts +1 -0
  56. package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
  57. package/package.json +33 -9
  58. package/dist/modal/ParaModal.js +0 -281
  59. package/dist/modal/components/Account/Account.js +0 -60
  60. package/dist/modal/components/AddFunds/AddFunds.js +0 -147
  61. package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
  62. package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
  63. package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
  64. package/dist/modal/components/AddFunds/index.js +0 -3
  65. package/dist/modal/components/AuthInput/AuthInput.js +0 -221
  66. package/dist/modal/components/AuthInput/countryCodes.js +0 -40
  67. package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
  68. package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
  69. package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
  70. package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
  71. package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
  72. package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
  73. package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
  74. package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
  75. package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
  76. package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
  77. package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
  78. package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
  79. package/dist/modal/components/Body/Body.js +0 -232
  80. package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
  81. package/dist/modal/components/ChainSwitch/config.js +0 -11
  82. package/dist/modal/components/Controls/Controls.js +0 -54
  83. package/dist/modal/components/Controls/Selects.js +0 -159
  84. package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
  85. package/dist/modal/components/ExternalWalletStep/config.js +0 -11
  86. package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
  87. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -7
  88. package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
  89. package/dist/modal/components/Footer/Footer.js +0 -71
  90. package/dist/modal/components/Header/Header.js +0 -24
  91. package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
  92. package/dist/modal/components/Hero/Hero.js +0 -119
  93. package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
  94. package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
  95. package/dist/modal/components/ModalContent/ModalContent.js +0 -282
  96. package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
  97. package/dist/modal/components/OAuth/OAuth.js +0 -125
  98. package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
  99. package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
  100. package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
  101. package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
  102. package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
  103. package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
  104. package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
  105. package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
  106. package/dist/modal/components/Waiting/Waiting.js +0 -6
  107. package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
  108. package/dist/modal/components/WalletCard/WalletCard.js +0 -93
  109. package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
  110. package/dist/modal/components/common.js +0 -67
  111. package/dist/modal/components/index.js +0 -1
  112. package/dist/modal/constants/constants.js +0 -93
  113. package/dist/modal/constants/defaults.js +0 -5
  114. package/dist/modal/constants/oAuthLogos.js +0 -18
  115. package/dist/modal/hooks/useActiveWallet.d.ts +0 -1
  116. package/dist/modal/hooks/useActiveWallet.js +0 -11
  117. package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
  118. package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
  119. package/dist/modal/hooks/useGoBack.js +0 -34
  120. package/dist/modal/index.js +0 -9
  121. package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -29
  122. package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
  123. package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -33
  124. package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
  125. package/dist/modal/providers/ExternalWalletContext.js +0 -253
  126. package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -21
  127. package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
  128. package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
  129. package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
  130. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -20
  131. package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
  132. package/dist/modal/stores/index.js +0 -3
  133. package/dist/modal/stores/modal/actions.js +0 -64
  134. package/dist/modal/stores/modal/useModalStore.js +0 -41
  135. package/dist/modal/stores/para/actions.d.ts +0 -3
  136. package/dist/modal/stores/para/actions.js +0 -5
  137. package/dist/modal/stores/para/useParaStore.d.ts +0 -10
  138. package/dist/modal/stores/para/useParaStore.js +0 -3
  139. package/dist/modal/stores/theme/actions.d.ts +0 -3
  140. package/dist/modal/stores/theme/actions.js +0 -24
  141. package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
  142. package/dist/modal/stores/theme/useThemeStore.js +0 -14
  143. package/dist/modal/stores/userInfo/actions.js +0 -34
  144. package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
  145. package/dist/modal/types/commonTypes.js +0 -1
  146. package/dist/modal/types/externalWallets.js +0 -21
  147. package/dist/modal/types/modalProps.js +0 -7
  148. package/dist/modal/utils/authLayoutHelpers.js +0 -2
  149. package/dist/modal/utils/getMailtoLink.js +0 -5
  150. package/dist/modal/utils/getTileButtonFlex.js +0 -15
  151. package/dist/modal/utils/isPasskeySupported.js +0 -10
  152. package/dist/modal/utils/openPopup.js +0 -55
  153. package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
  154. package/dist/modal/utils/steps.js +0 -215
  155. package/dist/modal/utils/stringFormatters.js +0 -12
  156. package/dist/modal/utils/validateOnRampConfig.js +0 -26
  157. package/dist/provider/ParaProvider.js +0 -17
  158. package/dist/provider/actions/checkIfUserExists.js +0 -26
  159. package/dist/provider/actions/createUser.js +0 -30
  160. package/dist/provider/actions/getAccount.js +0 -24
  161. package/dist/provider/actions/getWallet.js +0 -16
  162. package/dist/provider/actions/initiateLogin.js +0 -23
  163. package/dist/provider/actions/keepSessionAlive.js +0 -23
  164. package/dist/provider/actions/logout.js +0 -20
  165. package/dist/provider/actions/signMessage.js +0 -23
  166. package/dist/provider/actions/signTransaction.js +0 -23
  167. package/dist/provider/actions/waitForAccountCreation.js +0 -24
  168. package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
  169. package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
  170. package/dist/provider/hooks/index.js +0 -3
  171. package/dist/provider/hooks/mutations/index.js +0 -10
  172. package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
  173. package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
  174. package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
  175. package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
  176. package/dist/provider/hooks/mutations/useLogout.js +0 -33
  177. package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
  178. package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
  179. package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
  180. package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
  181. package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
  182. package/dist/provider/hooks/queries/index.js +0 -2
  183. package/dist/provider/hooks/queries/useAccount.js +0 -23
  184. package/dist/provider/hooks/queries/useWallet.js +0 -24
  185. package/dist/provider/hooks/utils/index.js +0 -3
  186. package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
  187. package/dist/provider/hooks/utils/useClient.js +0 -8
  188. package/dist/provider/hooks/utils/useEventListeners.js +0 -87
  189. package/dist/provider/hooks/utils/useInternalClient.js +0 -9
  190. package/dist/provider/hooks/utils/useModal.js +0 -15
  191. package/dist/provider/hooks/utils/useWalletState.js +0 -33
  192. package/dist/provider/index.js +0 -3
  193. package/dist/provider/stores/getters.js +0 -5
  194. package/dist/provider/stores/slices/client.js +0 -4
  195. package/dist/provider/stores/slices/index.js +0 -3
  196. package/dist/provider/stores/slices/modal.js +0 -4
  197. package/dist/provider/stores/slices/wallet.js +0 -6
  198. package/dist/provider/stores/types.js +0 -1
  199. package/dist/provider/stores/useStore.js +0 -14
  200. package/dist/provider/types/provider.js +0 -1
  201. package/dist/provider/types/query.js +0 -1
  202. package/dist/provider/types/utils.js +0 -1
  203. package/dist/provider/utils/renameMutations.js +0 -19
  204. /package/dist/{modal/css → css}/modal.css +0 -0
  205. /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
@@ -1,67 +0,0 @@
1
- import { CpslIcon, CpslInput, CpslText, CpslTileButton } from '@getpara/react-components';
2
- import { styled } from 'styled-components';
3
- export const SpinnerContainer = styled.div `
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- `;
8
- export const QRContainer = styled.div `
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- width: 286px;
13
- height: 286px;
14
- `;
15
- export const InfoBoxContent = styled.div `
16
- display: flex;
17
- flex-direction: column;
18
- gap: 8px;
19
- `;
20
- export const InfoBoxHeader = styled.div `
21
- display: flex;
22
- align-items: center;
23
- gap: 4px;
24
-
25
- cpsl-icon {
26
- --height: 20px;
27
- --width: 20px;
28
- }
29
- `;
30
- export const FilledDisabledInput = styled(CpslInput) `
31
- --container-border-color: var(--cpsl-color-input-border-placeholder);
32
- --container-background-color: var(--cpsl-color-background-0);
33
- --input-background-color: transparent;
34
- --input-font-weight: 500;
35
- --input-color: var(--cpsl-color-text-secondary);
36
- `;
37
- export const FullWidthFilledDisabledInput = styled(FilledDisabledInput) `
38
- width: 100%;
39
- `;
40
- export const CenteredText = styled(CpslText) `
41
- width: 100%;
42
- text-align: center;
43
- `;
44
- export const InnerStepContainer = styled.div `
45
- width: 100%;
46
- height: 100%;
47
- align-self: center;
48
- display: flex;
49
- flex-direction: column;
50
- align-items: center;
51
- gap: 8px;
52
- `;
53
- export const StepContainer = styled(InnerStepContainer) `
54
- gap: ${({ $wide }) => ($wide ? '32px' : '24px')};
55
- `;
56
- export const Heading = styled(CenteredText) ``;
57
- export const StyledCpslTileButton = styled(CpslTileButton) `
58
- --button-width: 100%;
59
- --button-height: 87px;
60
- --button-icon-height: 32px;
61
- --button-icon-width: 32px;
62
- `;
63
- export const HeroIcon = styled(CpslIcon) `
64
- --height: 80px;
65
- --width: 80px;
66
- --icon-color: var(--cpsl-color-text-primary);
67
- `;
@@ -1 +0,0 @@
1
- export * from './ModalContent/ModalContent.js';
@@ -1,93 +0,0 @@
1
- import { Network, OnRampAsset, OnRampMethod, OnRampProvider } from '@getpara/core-sdk';
2
- export const PARA_CONNECT = 'https://connect.getpara.com/';
3
- export const PARA_TERMS_AND_CONDITIONS = 'https://getpara.com/terms';
4
- export const ON_RAMP_PROVIDERS = {
5
- [OnRampProvider.STRIPE]: {
6
- name: 'Stripe',
7
- feeLower: 0.99,
8
- feeUpper: 4.49,
9
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
10
- icon: 'stripeBrand',
11
- backgroundColors: ['#6772E5', '#808AF4'],
12
- },
13
- [OnRampProvider.RAMP]: {
14
- name: 'Ramp',
15
- feeLower: 0.99,
16
- feeUpper: 4.49,
17
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
18
- icon: 'rampNetworkBrand',
19
- backgroundColors: ['#21BF73', '#3AE492'],
20
- },
21
- [OnRampProvider.MOONPAY]: {
22
- name: 'MoonPay',
23
- feeLower: 1.0,
24
- feeUpper: 4.5,
25
- methods: [OnRampMethod.ACH, OnRampMethod.DEBIT, OnRampMethod.CREDIT],
26
- icon: 'moonpayBrand',
27
- backgroundColors: ['#7715F5', '#9647fd'],
28
- },
29
- };
30
- export const NETWORKS = {
31
- [Network.ETHEREUM]: { name: 'Ethereum', icon: 'ethereum' },
32
- [Network.SEPOLIA]: { name: 'Sepolia', icon: 'ethereum' },
33
- [Network.ARBITRUM]: { name: 'Arbitrum', icon: 'arbitrumBrand' },
34
- [Network.BASE]: { name: 'Base', icon: 'baseBrand' },
35
- [Network.OPTIMISM]: { name: 'Optimism', icon: 'optimismBrand' },
36
- [Network.POLYGON]: { name: 'Polygon', icon: 'polygonBrand' },
37
- [Network.SOLANA]: { name: 'Solana', icon: 'solana' },
38
- [Network.COSMOS]: { name: 'Cosmos', icon: 'cosmos' },
39
- [Network.CELO]: { name: 'Celo', icon: 'celoBrand' },
40
- [Network.NOBLE]: { name: 'Noble', icon: 'nobleBrand' },
41
- };
42
- export const ON_RAMP_ASSETS = {
43
- [OnRampAsset.ETHEREUM]: { name: 'Ethereum', code: 'ETH', icon: 'ethereum' },
44
- [OnRampAsset.USDC]: { name: 'USDC', code: 'USDC', icon: 'usdcBrand' },
45
- [OnRampAsset.POLYGON]: { name: 'Polygon', code: 'MATIC', icon: 'polygonBrand' },
46
- [OnRampAsset.SOLANA]: { name: 'Solana', code: 'SOL', icon: 'solana' },
47
- [OnRampAsset.ATOM]: { name: 'Atom', code: 'ATOM', icon: 'cosmos' },
48
- [OnRampAsset.CELO]: { name: 'Celo', code: 'CELO', icon: 'celoBrand' },
49
- [OnRampAsset.TETHER]: { name: 'Tether', code: 'USDT', icon: 'tetherBrand' },
50
- [OnRampAsset.CUSD]: { name: 'Celo Dollar', code: 'CUSD', icon: 'celoBrand' },
51
- [OnRampAsset.CEUR]: { name: 'Celo Euro', code: 'CEUR', icon: 'celoBrand' },
52
- [OnRampAsset.CREAL]: { name: 'Celo Real', code: 'CREAL', icon: 'celoBrand' },
53
- };
54
- export function getNetworkName(str) {
55
- var _a, _b;
56
- return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : `${str[0]}${str.slice(1).toLowerCase()}`;
57
- }
58
- export function getNetworkIcon(str) {
59
- var _a, _b;
60
- return (_b = (_a = NETWORKS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'globe';
61
- }
62
- export function getAssetName(str) {
63
- var _a, _b;
64
- return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : str;
65
- }
66
- export function getAssetIcon(str) {
67
- var _a, _b;
68
- return (_b = (_a = ON_RAMP_ASSETS[str]) === null || _a === void 0 ? void 0 : _a.icon) !== null && _b !== void 0 ? _b : 'emptyCircle';
69
- }
70
- export const MOBILE_SIZE = 480;
71
- export const NETWORK_NOT_SUPPORTED_ERROR = 'network not supported';
72
- export const EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
73
- export const BODY_MOTION_VARIANTS = {
74
- enter: (direction) => {
75
- return {
76
- scale: direction > 0 ? 0.9 : 1.1,
77
- opacity: 0,
78
- };
79
- },
80
- center: {
81
- scale: 1,
82
- opacity: 1,
83
- },
84
- exit: (direction) => {
85
- return {
86
- scale: direction < 0 ? 0.9 : 1.1,
87
- opacity: 0,
88
- };
89
- },
90
- };
91
- export const BODY_TRANSITION = {
92
- duration: 0.2,
93
- };
@@ -1,5 +0,0 @@
1
- export const DEFAULTS = {
2
- LOGGIN_POLLING_DELAY_MS: 5000,
3
- POLLING_INTERVAL_MS: 2000,
4
- ANIMATION_DURATION: 0.15,
5
- };
@@ -1,18 +0,0 @@
1
- export const brandedOAuthLogos = {
2
- GOOGLE: 'googleBrand',
3
- TWITTER: 'twitter',
4
- APPLE: 'apple',
5
- DISCORD: 'discordBrand',
6
- FACEBOOK: 'facebookBrand',
7
- FARCASTER: 'farcasterBrand',
8
- TELEGRAM: 'telegramBrand',
9
- };
10
- export const oAuthLogos = {
11
- GOOGLE: 'google',
12
- TWITTER: 'twitter',
13
- APPLE: 'apple',
14
- DISCORD: 'discord',
15
- FACEBOOK: 'facebook',
16
- FARCASTER: 'farcaster',
17
- TELEGRAM: 'telegram',
18
- };
@@ -1 +0,0 @@
1
- export declare function useActiveWallet(): Omit<import("@getpara/core-sdk").Wallet, "signer">;
@@ -1,11 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useWalletState } from '../../provider/index.js';
3
- import { useInternalClient } from '../../provider/hooks/utils/useInternalClient.js';
4
- // TODO: remove this hook in favor of the useAccount hook once we force the use of the ParaProvider
5
- export function useActiveWallet() {
6
- const client = useInternalClient();
7
- const { selectedWallet } = useWalletState();
8
- return useMemo(() => {
9
- return client.findWallet(selectedWallet.id, selectedWallet.type, { forbidPregen: true });
10
- }, [client, selectedWallet]);
11
- }
@@ -1 +0,0 @@
1
- export declare const useEmbeddedExternalConnection: () => () => Promise<void>;
@@ -1,46 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { useExternalWalletProviderStore } from '../stores/externalWalletProvider/useExternalWalletProviderStore.js';
11
- export const useEmbeddedExternalConnection = () => {
12
- // Get the connectParaEvmWallet action if available. This is used to trigger Para as an active connection when the user logs in using a non external wallet method.
13
- const connectParaEvmWallet = useExternalWalletProviderStore(state => state.connectParaEvmWallet);
14
- const EvmProvider = useExternalWalletProviderStore(state => state.EvmProvider);
15
- const evmContext = useExternalWalletProviderStore(state => state.evmContext);
16
- const connectParaCosmosWallet = useExternalWalletProviderStore(state => state.connectParaCosmosWallet);
17
- const CosmosProvider = useExternalWalletProviderStore(state => state.CosmosProvider);
18
- const cosmosContext = useExternalWalletProviderStore(state => state.cosmosContext);
19
- const connectEmbeddedToExternalConnectors = () => __awaiter(void 0, void 0, void 0, function* () {
20
- // If we're in the ParaEvmProvider context call the connect method to trigger Para as an active connection
21
- if (evmContext && EvmProvider && connectParaEvmWallet) {
22
- try {
23
- const { error } = yield connectParaEvmWallet();
24
- if (error) {
25
- console.warn('Failed to connect Para EVM wallet to Wagmi:', error);
26
- }
27
- }
28
- catch (err) {
29
- console.warn('Error calling connectParaEvmWallet:', err);
30
- }
31
- }
32
- // If we're in the ParaCosmosProvider context call the connect method to trigger Para as an active connection
33
- if (cosmosContext && CosmosProvider && connectParaCosmosWallet) {
34
- try {
35
- const { error } = yield connectParaCosmosWallet();
36
- if (error) {
37
- console.warn('Failed to connect Para Cosmos wallet to Graz:', error);
38
- }
39
- }
40
- catch (err) {
41
- console.warn('Error calling connectParaCosmosWallet:', err);
42
- }
43
- }
44
- });
45
- return connectEmbeddedToExternalConnectors;
46
- };
@@ -1,34 +0,0 @@
1
- import { useExternalWallets } from '../providers/ExternalWalletContext.js';
2
- import { useModalStore } from '../stores/index.js';
3
- import { getAddFundsStep, ModalStep } from '../utils/steps.js';
4
- export const useGoBack = () => {
5
- const currentStep = useModalStore(state => state.step);
6
- const setStep = useModalStore(state => state.setStep);
7
- const accountAddFundTab = useModalStore(state => state.accountAddFundTab);
8
- const decrementStep = useModalStore(state => state.decrementStep);
9
- const resetState = useModalStore(state => state.resetState);
10
- const { setChainIdSwitchingTo } = useExternalWallets();
11
- const goBack = () => {
12
- if (currentStep === ModalStep.ADD_FUNDS_AWAITING) {
13
- setStep(getAddFundsStep(accountAddFundTab));
14
- }
15
- else {
16
- decrementStep();
17
- }
18
- switch (currentStep) {
19
- case ModalStep.VERIFY_2FA:
20
- case ModalStep.BIOMETRIC_CREATION:
21
- case ModalStep.BIOMETRIC_LOGIN: {
22
- resetState();
23
- break;
24
- }
25
- }
26
- switch (currentStep) {
27
- case ModalStep.CHAIN_SWITCH: {
28
- setChainIdSwitchingTo();
29
- break;
30
- }
31
- }
32
- };
33
- return goBack;
34
- };
@@ -1,9 +0,0 @@
1
- export * from './ParaModal.js';
2
- export { ModalStep } from './utils/steps.js';
3
- export { AuthLayout } from './types/modalProps.js';
4
- export * from './utils/openPopup.js';
5
- export { ON_RAMP_PROVIDERS, ON_RAMP_ASSETS, NETWORKS, getAssetIcon, getAssetName, getNetworkIcon, getNetworkName, } from './constants/constants.js';
6
- export { SaveRecoverySecret } from './components/RecoverySecretStep/RecoverySecretStep.js';
7
- export * from './utils/validateOnRampConfig.js';
8
- export * from './types/externalWallets.js';
9
- export { useExternalWalletProviderStore } from './stores/externalWalletProvider/useExternalWalletProviderStore.js';
@@ -1,29 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { CommonChain, CommonWallet } from '../types/commonTypes.js';
3
- import ParaWeb from '@getpara/web-sdk';
4
- export declare const defaultCosmosExternalWallet: {
5
- wallets: any[];
6
- chains: any[];
7
- chainId: any;
8
- disconnect: () => Promise<void>;
9
- switchChain: () => Promise<{}>;
10
- };
11
- export type CosmosExternalWalletContextType = {
12
- wallets: CommonWallet[];
13
- chains: CommonChain[];
14
- chainId: string;
15
- disconnect: () => Promise<void>;
16
- switchChain: (chainId: string) => Promise<{
17
- error?: string[];
18
- }>;
19
- };
20
- export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
21
- export interface CosmosExternalWalletProviderProps {
22
- children: ReactNode;
23
- para: ParaWeb;
24
- onSwitchWallet: (args: {
25
- address?: string;
26
- error?: string;
27
- }) => void;
28
- }
29
- export declare function CosmosExternalWalletProvider({ children }: CosmosExternalWalletProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useMemo } from 'react';
3
- export const defaultCosmosExternalWallet = {
4
- wallets: [],
5
- chains: [],
6
- chainId: undefined,
7
- disconnect: () => Promise.resolve(),
8
- switchChain: () => Promise.resolve({}),
9
- };
10
- export const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
11
- export function CosmosExternalWalletProvider({ children }) {
12
- const wallets = [];
13
- const chains = [];
14
- const chainId = undefined;
15
- const disconnect = () => Promise.resolve();
16
- const switchChain = () => Promise.resolve({});
17
- return (_jsx(CosmosExternalWalletContext.Provider, { value: useMemo(() => ({ wallets, chains, chainId, disconnect, switchChain }), [wallets, chains, chainId, disconnect, switchChain]), children: children }));
18
- }
@@ -1,33 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { CommonChain, CommonWallet } from '../types/commonTypes.js';
3
- import ParaWeb from '@getpara/web-sdk';
4
- export declare const defaultEvmExternalWallet: {
5
- wallets: any[];
6
- chains: any[];
7
- chainId: any;
8
- username: any;
9
- avatar: any;
10
- disconnect: () => Promise<void>;
11
- switchChain: () => Promise<{}>;
12
- };
13
- export type EvmExternalWalletContextType = {
14
- wallets: CommonWallet[];
15
- chains: CommonChain[];
16
- chainId: number;
17
- username: string;
18
- avatar?: string;
19
- disconnect: () => Promise<void>;
20
- switchChain: (chainId: number) => Promise<{
21
- error?: string[];
22
- }>;
23
- };
24
- export declare const EvmExternalWalletContext: import("react").Context<EvmExternalWalletContextType>;
25
- export interface EvmExternalWalletProviderProps {
26
- children: ReactNode;
27
- para: ParaWeb;
28
- onSwitchWallet: (args: {
29
- address?: string;
30
- error?: string;
31
- }) => void;
32
- }
33
- export declare function EvmExternalWalletProvider({ children }: EvmExternalWalletProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useMemo } from 'react';
3
- export const defaultEvmExternalWallet = {
4
- wallets: [],
5
- chains: [],
6
- chainId: undefined,
7
- username: undefined,
8
- avatar: undefined,
9
- disconnect: () => Promise.resolve(),
10
- switchChain: () => Promise.resolve({}),
11
- };
12
- export const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
13
- export function EvmExternalWalletProvider({ children }) {
14
- const wallets = [];
15
- const chains = [];
16
- const chainId = undefined;
17
- const username = undefined;
18
- const avatar = undefined;
19
- const disconnect = () => Promise.resolve();
20
- const switchChain = () => Promise.resolve({});
21
- return (_jsx(EvmExternalWalletContext.Provider, { value: useMemo(() => ({ wallets, chains, chainId, username, avatar, disconnect, switchChain }), [wallets, chains, chainId, username, avatar, disconnect, switchChain]), children: children }));
22
- }
@@ -1,253 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
12
- import { useModalStore } from '../stores/index.js';
13
- import { ModalStep } from '../utils/steps.js';
14
- import { WalletType, isIOS, isIOSWebview, isMobile, truncateAddress } from '@getpara/web-sdk';
15
- import { useInternalClient } from '../../provider/hooks/utils/useInternalClient.js';
16
- export const defaultExternalWallet = {
17
- wallets: [],
18
- chains: [],
19
- chainId: undefined,
20
- wallet: undefined,
21
- qrUri: undefined,
22
- chainIdSwitchingTo: undefined,
23
- walletDisplayHelpers: {
24
- showExtension: false,
25
- showMobile: false,
26
- isSolanaMobileIOS: false,
27
- isCosmosMobileWallet: false,
28
- },
29
- username: undefined,
30
- avatar: undefined,
31
- connectExternalWallet: () => { },
32
- disconnectExternalWallet: () => Promise.resolve(),
33
- switchChain: () => Promise.resolve(),
34
- setChainIdSwitchingTo: () => { },
35
- };
36
- export const ExternalWalletContext = createContext(defaultExternalWallet);
37
- export function ExternalWalletProvider({ children, evmContext, solanaContext, cosmosContext, walletSort, }) {
38
- const { wallets: evmWallets, disconnect: evmDisconnect, chains: evmChains, chainId: evmChainId, switchChain: evmSwitchChain, username: evmUsername, avatar: evmAvatar, } = useContext(evmContext);
39
- const { wallets: solanaWallets, disconnect: solanaDisconnect } = useContext(solanaContext);
40
- const { wallets: cosmosWallets, disconnect: cosmosDisconnect, chains: cosmosChains, chainId: cosmosChainId, switchChain: cosmosSwitchChain, } = useContext(cosmosContext);
41
- const setStep = useModalStore(state => state.setStep);
42
- const setStepDirection = useModalStore(state => state.setStepDirection);
43
- const setIsExternalWalletConnecting = useModalStore(state => state.setIsExternalWalletConnecting);
44
- const isExternalWalletConnecting = useModalStore(state => state.isExternalWalletConnecting);
45
- const setSelectedExternalWalletId = useModalStore(state => state.setSelectedExternalWalletId);
46
- const selectedExternalWalletId = useModalStore(state => state.selectedExternalWalletId);
47
- const setExternalWalletError = useModalStore(state => state.setExternalWalletError);
48
- const setIsUsingMobileConnector = useModalStore(state => state.setIsUsingMobileConnector);
49
- const isUsingMobileConnector = useModalStore(state => state.isUsingMobileConnector);
50
- const para = useInternalClient();
51
- const [qrUri, setQrUri] = useState();
52
- const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
53
- // Filter any wallets that aren't included in the sort array, sort by the array then sort by installed extensions
54
- const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets]
55
- .filter(w => walletSort.includes(w.id.toUpperCase()))
56
- .sort((a, b) => walletSort.indexOf(a.id.toUpperCase()) -
57
- walletSort.indexOf(b.id.toUpperCase()))
58
- .sort((a, b) => (a.installed === b.installed ? 0 : a.installed ? -1 : 1));
59
- const wallet = useMemo(() => wallets.find(w => w.id === selectedExternalWalletId), [wallets, selectedExternalWalletId]);
60
- const updateQrUri = () => __awaiter(this, void 0, void 0, function* () {
61
- var _a;
62
- const uri = yield ((_a = wallet === null || wallet === void 0 ? void 0 : wallet.getQrUri) === null || _a === void 0 ? void 0 : _a.call(wallet));
63
- setQrUri(uri);
64
- });
65
- useEffect(() => {
66
- if (wallet) {
67
- if (!qrUri) {
68
- updateQrUri();
69
- }
70
- }
71
- else if (qrUri) {
72
- setQrUri(undefined);
73
- }
74
- }, [wallet]);
75
- const chains = useMemo(() => {
76
- var _a, _b, _c;
77
- const walletType = (_c = para.externalWallets[(_b = (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.type;
78
- switch (walletType) {
79
- case WalletType.COSMOS: {
80
- return cosmosChains;
81
- }
82
- case WalletType.EVM: {
83
- return evmChains;
84
- }
85
- default: {
86
- return [];
87
- }
88
- }
89
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
90
- const chainId = useMemo(() => {
91
- var _a, _b, _c;
92
- const walletType = (_c = para.externalWallets[(_b = (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.type;
93
- switch (walletType) {
94
- case WalletType.COSMOS: {
95
- return cosmosChainId;
96
- }
97
- case WalletType.EVM: {
98
- return evmChainId === null || evmChainId === void 0 ? void 0 : evmChainId.toString();
99
- }
100
- default: {
101
- return undefined;
102
- }
103
- }
104
- }, [cosmosChains, evmChains, selectedExternalWalletId]);
105
- const switchChain = useCallback((chainId) => __awaiter(this, void 0, void 0, function* () {
106
- var _a, _b, _c;
107
- const walletType = (_c = para.externalWallets[(_b = (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.type;
108
- if (walletType) {
109
- let resp;
110
- setExternalWalletError();
111
- setChainIdSwitchingTo(chainId);
112
- switch (walletType) {
113
- case WalletType.COSMOS: {
114
- setStep(ModalStep.CHAIN_SWITCH);
115
- resp = yield cosmosSwitchChain(chainId);
116
- break;
117
- }
118
- case WalletType.EVM: {
119
- setStep(ModalStep.CHAIN_SWITCH);
120
- resp = yield evmSwitchChain(parseInt(chainId));
121
- break;
122
- }
123
- default: {
124
- break;
125
- }
126
- }
127
- if (resp.error) {
128
- setExternalWalletError(resp.error);
129
- }
130
- else {
131
- setChainIdSwitchingTo(undefined);
132
- setStepDirection(-1);
133
- setStep(ModalStep.ACCOUNT_MAIN);
134
- }
135
- }
136
- }), [evmSwitchChain, cosmosSwitchChain]);
137
- const connectExternalWallet = useCallback((wallet, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __awaiter(this, void 0, void 0, function* () {
138
- // If triggering the WC modal manually from desktop, disconnect the current connection attempt to trigger the mobile connection attempt
139
- if (isExternalWalletConnecting && isManualWalletConnect) {
140
- yield evmDisconnect();
141
- yield solanaDisconnect();
142
- yield cosmosDisconnect();
143
- setQrUri(undefined);
144
- setIsExternalWalletConnecting(false);
145
- }
146
- if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
147
- setExternalWalletError();
148
- setIsExternalWalletConnecting(true);
149
- setIsUsingMobileConnector(isMobileConnect);
150
- const { address, error } = yield (isMobileConnect ? wallet.connectMobile(isManualWalletConnect) : wallet.connect());
151
- if (error) {
152
- setExternalWalletError([error]);
153
- setIsUsingMobileConnector();
154
- // If triggering the WC modal manually from desktop, attempt desktop reconnect on connection rejection
155
- if (isManualWalletConnect && error === 'Connection request rejected') {
156
- setExternalWalletError();
157
- yield connectExternalWallet(wallet, false, false, true);
158
- yield updateQrUri();
159
- return;
160
- }
161
- }
162
- else if (address) {
163
- setStep(ModalStep.LOGIN_DONE);
164
- }
165
- setIsExternalWalletConnecting(false);
166
- }
167
- }), [isExternalWalletConnecting]);
168
- const disconnectExternalWallet = () => __awaiter(this, void 0, void 0, function* () {
169
- yield evmDisconnect();
170
- yield solanaDisconnect();
171
- yield cosmosDisconnect();
172
- setSelectedExternalWalletId();
173
- });
174
- const walletDisplayHelpers = {
175
- // Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
176
- // Also show the extension connection if on desktop for a solana wallet (no walletConnect)
177
- showExtension: !isMobile() && (((wallet === null || wallet === void 0 ? void 0 : wallet.isExtension) && (wallet === null || wallet === void 0 ? void 0 : wallet.installed)) || !(wallet === null || wallet === void 0 ? void 0 : wallet.isMobile) || (wallet === null || wallet === void 0 ? void 0 : wallet.type) === WalletType.SOLANA),
178
- // Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
179
- showMobile: (isMobile() && (wallet === null || wallet === void 0 ? void 0 : wallet.isMobile)) || (!isMobile() && !(wallet === null || wallet === void 0 ? void 0 : wallet.installed)),
180
- isSolanaMobileIOS: isIOS() && isMobile() && !isIOSWebview() && (wallet === null || wallet === void 0 ? void 0 : wallet.type) === WalletType.SOLANA,
181
- isCosmosMobileWallet: (wallet === null || wallet === void 0 ? void 0 : wallet.type) === WalletType.COSMOS && isUsingMobileConnector,
182
- };
183
- const username = useMemo(() => {
184
- var _a, _b;
185
- let username;
186
- const storedExternalWallet = para.externalWallets[(_b = (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : ''];
187
- if (storedExternalWallet) {
188
- const walletType = storedExternalWallet === null || storedExternalWallet === void 0 ? void 0 : storedExternalWallet.type;
189
- switch (walletType) {
190
- case WalletType.EVM: {
191
- // If evmUsername is an EVM address, format it, else return it since it should be an ENS name
192
- username = evmUsername
193
- ? evmUsername.startsWith('0x')
194
- ? truncateAddress(evmUsername, 'EVM')
195
- : evmUsername
196
- : undefined;
197
- break;
198
- }
199
- default: {
200
- username = storedExternalWallet.address
201
- ? truncateAddress(storedExternalWallet.address, storedExternalWallet.type)
202
- : undefined;
203
- break;
204
- }
205
- }
206
- }
207
- return username;
208
- }, [evmUsername, wallet]);
209
- const avatar = useMemo(() => {
210
- var _a, _b, _c;
211
- const walletType = (_c = para.externalWallets[(_b = (_a = para.currentExternalWalletAddresses) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.type;
212
- if (walletType) {
213
- switch (walletType) {
214
- case WalletType.EVM: {
215
- return evmAvatar;
216
- }
217
- default: {
218
- return undefined;
219
- }
220
- }
221
- }
222
- }, [evmAvatar, wallet]);
223
- return (_jsx(ExternalWalletContext.Provider, { value: useMemo(() => ({
224
- wallets,
225
- chains,
226
- chainId,
227
- wallet,
228
- qrUri,
229
- walletDisplayHelpers,
230
- chainIdSwitchingTo,
231
- username,
232
- avatar,
233
- connectExternalWallet,
234
- disconnectExternalWallet,
235
- switchChain,
236
- setChainIdSwitchingTo,
237
- }), [
238
- wallets,
239
- chains,
240
- chainId,
241
- wallet,
242
- qrUri,
243
- walletDisplayHelpers,
244
- chainIdSwitchingTo,
245
- username,
246
- avatar,
247
- disconnectExternalWallet,
248
- connectExternalWallet,
249
- switchChain,
250
- setChainIdSwitchingTo,
251
- ]), children: children }));
252
- }
253
- export const useExternalWallets = () => useContext(ExternalWalletContext);