@getpara/react-sdk-lite 2.0.0-dev.6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.mjs +26 -1
- package/dist/modal/ParaModal.js +16 -11
- package/dist/modal/components/Account/Account.js +42 -4
- package/dist/modal/components/Account/AccountHeader.js +10 -16
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -1
- package/dist/modal/components/Account/AccountProfile.js +82 -210
- package/dist/modal/components/Account/AccountProfileEntry.d.ts +12 -0
- package/dist/modal/components/Account/AccountProfileEntry.js +220 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +15 -4
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendAsset.js +94 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendForm.js +343 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNetwork.js +53 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.d.ts +1 -0
- package/dist/modal/components/Account/AccountSend/AccountSendNoAssets.js +56 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.d.ts +5 -0
- package/dist/modal/components/Account/AccountSend/AssetNetwork.js +36 -0
- package/dist/modal/components/Account/AccountSend/context.d.ts +38 -0
- package/dist/modal/components/Account/AccountSend/context.js +418 -0
- package/dist/modal/components/Account/AccountSend/index.d.ts +4 -0
- package/dist/modal/components/Account/AccountSend/index.js +67 -0
- package/dist/modal/components/Account/AccountWallet.d.ts +1 -0
- package/dist/modal/components/Account/AccountWallet.js +133 -0
- package/dist/modal/components/{WalletSelect/WalletSelect.d.ts → Account/AccountWalletSelect.d.ts} +1 -1
- package/dist/modal/components/{WalletSelect/WalletSelect.js → Account/AccountWalletSelect.js} +20 -6
- package/dist/modal/components/AddFunds/AddFunds.js +3 -2
- package/dist/modal/components/AddFunds/AddFundsAsset.js +7 -6
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +5 -5
- package/dist/modal/components/AddFunds/AddFundsProvider.js +1 -2
- package/dist/modal/components/AddFunds/AddFundsSettings.js +13 -54
- package/dist/modal/components/AddFunds/common.d.ts +0 -14
- package/dist/modal/components/AddFunds/common.js +1 -8
- package/dist/modal/components/AuthInput/AuthInput.js +2 -2
- package/dist/modal/components/AwaitingAccountStep/AwaitingAccountStep.js +10 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +8 -33
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +5 -2
- package/dist/modal/components/Body/Body.js +81 -48
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +8 -5
- package/dist/modal/components/Controls/ChainSelect.js +1 -2
- package/dist/modal/components/Controls/Controls.js +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +5 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +48 -19
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +5 -2
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +63 -33
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +3 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +22 -12
- package/dist/modal/components/Footer/Footer.js +4 -5
- package/dist/modal/components/Header/Header.js +1 -2
- package/dist/modal/components/Header/hooks/useStepTitle.js +53 -37
- package/dist/modal/components/Hero/Hero.js +5 -3
- package/dist/modal/components/IFrameStep/IFrameStep.js +13 -12
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +4 -1
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +6 -5
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +34 -18
- package/dist/modal/components/OnRampComponents/AddingFunds.js +1 -1
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +1 -2
- package/dist/modal/components/QuantityInput.d.ts +9 -0
- package/dist/modal/components/QuantityInput.js +91 -0
- package/dist/modal/components/SearchableButtonList.d.ts +34 -0
- package/dist/modal/components/SearchableButtonList.js +223 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +4 -1
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.d.ts +1 -0
- package/dist/modal/components/SwitchWalletsStep/SwitchWalletsStep.js +10 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +13 -2
- package/dist/modal/components/Waiting/Waiting.d.ts +1 -1
- package/dist/modal/components/Waiting/Waiting.js +7 -2
- package/dist/modal/components/WalletCard/WalletCard.js +2 -3
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.d.ts +7 -1
- package/dist/modal/components/WalletSelectOld/WalletSelectOld.js +33 -12
- package/dist/modal/components/common.d.ts +8 -10
- package/dist/modal/components/common.js +16 -36
- package/dist/modal/hooks/index.d.ts +4 -0
- package/dist/modal/hooks/index.js +5 -0
- package/dist/modal/hooks/useDebounce.d.ts +4 -0
- package/dist/modal/hooks/useDebounce.js +16 -0
- package/dist/modal/hooks/useFarcasterLogin.js +8 -1
- package/dist/modal/hooks/useTelegramLogin.js +4 -0
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +1 -1
- package/dist/modal/stores/modal/actions.js +9 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +9 -1
- package/dist/modal/stores/modal/useModalStore.js +6 -2
- package/dist/modal/types/modalProps.d.ts +5 -1
- package/dist/modal/utils/authInputHelpers.js +1 -1
- package/dist/modal/utils/countryCodes.js +50 -1
- package/dist/modal/utils/getWalletDisplayName.js +1 -1
- package/dist/modal/utils/openPopup.d.ts +1 -1
- package/dist/modal/utils/openPopup.js +6 -2
- package/dist/modal/utils/renderTextWithLinks.d.ts +2 -0
- package/dist/modal/utils/renderTextWithLinks.js +34 -0
- package/dist/modal/utils/steps.d.ts +24 -3
- package/dist/modal/utils/steps.js +51 -5
- package/dist/modal/utils/stringFormatters.d.ts +2 -3
- package/dist/modal/utils/stringFormatters.js +11 -7
- package/dist/modal/utils/validatePortalOrigin.d.ts +2 -0
- package/dist/modal/utils/validatePortalOrigin.js +14 -0
- package/dist/provider/ParaProviderMin.js +13 -5
- package/dist/provider/actions/getEmbeddedAccount.d.ts +3 -2
- package/dist/provider/actions/getEmbeddedAccount.js +13 -4
- package/dist/provider/actions/index.d.ts +11 -9
- package/dist/provider/actions/index.js +4 -0
- package/dist/provider/components/CosmosWalletWrapper.js +3 -3
- package/dist/provider/components/EvmWalletWrapper.js +3 -3
- package/dist/provider/components/ExternalWalletWrapper.js +7 -1
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +3 -1
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +3 -1
- package/dist/provider/hooks/mutations/index.d.ts +2 -0
- package/dist/provider/hooks/mutations/index.js +4 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.d.ts +42 -0
- package/dist/provider/hooks/mutations/useAddAuthMethod.js +59 -0
- package/dist/provider/hooks/mutations/useClaimPregenWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateGuestWallets.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreatePregenWallet.d.ts +5 -5
- package/dist/provider/hooks/mutations/useCreatePregenWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useCreateWalletPerType.d.ts +2 -2
- package/dist/provider/hooks/mutations/useEnable2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useExportPrivateKey.d.ts +15 -0
- package/dist/provider/hooks/mutations/useExportPrivateKey.js +32 -0
- package/dist/provider/hooks/mutations/useHasPregenWallet.d.ts +2 -2
- package/dist/provider/hooks/mutations/useIssueJwt.d.ts +2 -2
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +2 -2
- package/dist/provider/hooks/mutations/useLoginExternalWallet.d.ts +8 -2
- package/dist/provider/hooks/mutations/useLogout.d.ts +2 -2
- package/dist/provider/hooks/mutations/useResendVerificationCode.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSetup2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSignUpOrLogIn.d.ts +2 -2
- package/dist/provider/hooks/mutations/useSwitchWallets.d.ts +57 -0
- package/dist/provider/hooks/mutations/useSwitchWallets.js +30 -0
- package/dist/provider/hooks/mutations/useUpdatePregenWalletIdentifier.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerify2fa.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyExternalWallet.d.ts +18 -27
- package/dist/provider/hooks/mutations/useVerifyFarcaster.d.ts +5 -5
- package/dist/provider/hooks/mutations/useVerifyNewAccount.d.ts +14 -11
- package/dist/provider/hooks/mutations/useVerifyOAuth.d.ts +2 -2
- package/dist/provider/hooks/mutations/useVerifyTelegram.d.ts +5 -5
- package/dist/provider/hooks/mutations/useWaitForLogin.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForSignup.d.ts +2 -2
- package/dist/provider/hooks/mutations/useWaitForWalletCreation.d.ts +2 -2
- package/dist/provider/hooks/queries/index.d.ts +1 -0
- package/dist/provider/hooks/queries/index.js +2 -0
- package/dist/provider/hooks/queries/useAccount.js +58 -24
- package/dist/provider/hooks/queries/useLinkedAccounts.js +4 -2
- package/dist/provider/hooks/queries/useProfileBalance.d.ts +29 -0
- package/dist/provider/hooks/queries/useProfileBalance.js +65 -0
- package/dist/provider/hooks/utils/useAssetInfo.d.ts +3 -0
- package/dist/provider/hooks/utils/useAssetInfo.js +21 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +22 -5
- package/dist/provider/hooks/utils/useModal.js +3 -3
- package/dist/provider/hooks/utils/useWalletState.d.ts +2 -1
- package/dist/provider/hooks/utils/useWalletState.js +2 -1
- package/dist/provider/providers/AccountLinkProvider.js +18 -11
- package/dist/provider/providers/AssetsProvider.d.ts +14 -0
- package/dist/provider/providers/AssetsProvider.js +68 -0
- package/dist/provider/providers/AuthProvider.d.ts +6 -1
- package/dist/provider/providers/AuthProvider.js +204 -44
- package/dist/provider/providers/ExternalWalletProvider.d.ts +19 -5
- package/dist/provider/providers/ExternalWalletProvider.js +363 -44
- package/dist/provider/stores/getters.d.ts +2 -2
- package/dist/provider/stores/slices/modal.js +4 -1
- package/dist/provider/stores/types.d.ts +6 -3
- package/package.json +8 -8
- package/dist/modal/constants/constants.d.ts +0 -35
- package/dist/modal/constants/constants.js +0 -148
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EnabledFlow } from '@getpara/
|
|
1
|
+
import { EnabledFlow } from '@getpara/core-sdk/src/types/config.js';
|
|
2
2
|
export declare enum ModalStep {
|
|
3
3
|
AUTH_MAIN = "AUTH_MAIN",
|
|
4
4
|
AUTH_MORE = "AUTH_MORE",
|
|
@@ -39,8 +39,18 @@ export declare enum ModalStep {
|
|
|
39
39
|
ACCOUNT_PROFILE_ADD = "ACCOUNT_PROFILE_ADD",
|
|
40
40
|
ACCOUNT_PROFILE_LIST = "ACCOUNT_PROFILE_LIST",
|
|
41
41
|
ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE",
|
|
42
|
+
ACCOUNT_WALLET = "ACCOUNT_WALLET",
|
|
42
43
|
AWAITING_ACCOUNT = "AWAITING_ACCOUNT",
|
|
43
|
-
|
|
44
|
+
SWITCH_WALLETS = "SWITCH_WALLETS",
|
|
45
|
+
SWITCH_WALLETS_IFRAME = "SWITCH_WALLETS_IFRAME",
|
|
46
|
+
OTP = "OTP",
|
|
47
|
+
ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
|
|
48
|
+
ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
|
|
49
|
+
ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT",
|
|
50
|
+
LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT",
|
|
51
|
+
ACCOUNT_SEND = "ACCOUNT_SEND",
|
|
52
|
+
ACCOUNT_SEND_ASSET = "ACCOUNT_SEND_ASSET",
|
|
53
|
+
ACCOUNT_SEND_NETWORK = "ACCOUNT_SEND_NETWORK"
|
|
44
54
|
}
|
|
45
55
|
export type ModalStepPropU = keyof typeof ModalStep | ModalStep;
|
|
46
56
|
export type ModalStepPropL = Lowercase<ModalStepPropU>;
|
|
@@ -58,7 +68,18 @@ declare enum AccountStep {
|
|
|
58
68
|
ACCOUNT_PROFILE = "ACCOUNT_PROFILE",
|
|
59
69
|
ACCOUNT_PROFILE_ADD = "ACCOUNT_PROFILE_ADD",
|
|
60
70
|
ACCOUNT_PROFILE_LIST = "ACCOUNT_PROFILE_LIST",
|
|
61
|
-
ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE"
|
|
71
|
+
ACCOUNT_PROFILE_REMOVE = "ACCOUNT_PROFILE_REMOVE",
|
|
72
|
+
ACCOUNT_WALLET = "ACCOUNT_WALLET",
|
|
73
|
+
SWITCH_WALLETS = "SWITCH_WALLETS",
|
|
74
|
+
SWITCH_WALLETS_IFRAME = "SWITCH_WALLETS_IFRAME",
|
|
75
|
+
EXTERNAL_WALLET_VERIFICATION = "EXTERNAL_WALLET_VERIFICATION",
|
|
76
|
+
ADD_EX_WALLET_MORE = "ADD_EX_WALLET_MORE",
|
|
77
|
+
ADD_EX_WALLET_SELECTED = "ADD_EX_WALLET_SELECTED",
|
|
78
|
+
ADD_EX_WALLET_NETWORK_SELECT = "ADD_EX_WALLET_NETWORK_SELECT",
|
|
79
|
+
LINK_EX_WALLET_NETWORK_SELECT = "LINK_EX_WALLET_NETWORK_SELECT",
|
|
80
|
+
ACCOUNT_SEND = "ACCOUNT_SEND",
|
|
81
|
+
ACCOUNT_SEND_ASSET = "ACCOUNT_SEND_ASSET",
|
|
82
|
+
ACCOUNT_SEND_NETWORK = "ACCOUNT_SEND_NETWORK"
|
|
62
83
|
}
|
|
63
84
|
export declare const RESET_TO_AUTH_STEPS: ModalStep[];
|
|
64
85
|
export declare const RESET_TO_ACCOUNT_STEPS: ModalStep[];
|
|
@@ -40,8 +40,18 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
|
|
|
40
40
|
ModalStep2["ACCOUNT_PROFILE_ADD"] = "ACCOUNT_PROFILE_ADD";
|
|
41
41
|
ModalStep2["ACCOUNT_PROFILE_LIST"] = "ACCOUNT_PROFILE_LIST";
|
|
42
42
|
ModalStep2["ACCOUNT_PROFILE_REMOVE"] = "ACCOUNT_PROFILE_REMOVE";
|
|
43
|
+
ModalStep2["ACCOUNT_WALLET"] = "ACCOUNT_WALLET";
|
|
43
44
|
ModalStep2["AWAITING_ACCOUNT"] = "AWAITING_ACCOUNT";
|
|
45
|
+
ModalStep2["SWITCH_WALLETS"] = "SWITCH_WALLETS";
|
|
46
|
+
ModalStep2["SWITCH_WALLETS_IFRAME"] = "SWITCH_WALLETS_IFRAME";
|
|
44
47
|
ModalStep2["OTP"] = "OTP";
|
|
48
|
+
ModalStep2["ADD_EX_WALLET_MORE"] = "ADD_EX_WALLET_MORE";
|
|
49
|
+
ModalStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
|
|
50
|
+
ModalStep2["ADD_EX_WALLET_NETWORK_SELECT"] = "ADD_EX_WALLET_NETWORK_SELECT";
|
|
51
|
+
ModalStep2["LINK_EX_WALLET_NETWORK_SELECT"] = "LINK_EX_WALLET_NETWORK_SELECT";
|
|
52
|
+
ModalStep2["ACCOUNT_SEND"] = "ACCOUNT_SEND";
|
|
53
|
+
ModalStep2["ACCOUNT_SEND_ASSET"] = "ACCOUNT_SEND_ASSET";
|
|
54
|
+
ModalStep2["ACCOUNT_SEND_NETWORK"] = "ACCOUNT_SEND_NETWORK";
|
|
45
55
|
return ModalStep2;
|
|
46
56
|
})(ModalStep || {});
|
|
47
57
|
var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
|
|
@@ -58,10 +68,20 @@ var AccountStep = /* @__PURE__ */ ((AccountStep2) => {
|
|
|
58
68
|
AccountStep2["ACCOUNT_PROFILE_ADD"] = "ACCOUNT_PROFILE_ADD";
|
|
59
69
|
AccountStep2["ACCOUNT_PROFILE_LIST"] = "ACCOUNT_PROFILE_LIST";
|
|
60
70
|
AccountStep2["ACCOUNT_PROFILE_REMOVE"] = "ACCOUNT_PROFILE_REMOVE";
|
|
71
|
+
AccountStep2["ACCOUNT_WALLET"] = "ACCOUNT_WALLET";
|
|
72
|
+
AccountStep2["SWITCH_WALLETS"] = "SWITCH_WALLETS";
|
|
73
|
+
AccountStep2["SWITCH_WALLETS_IFRAME"] = "SWITCH_WALLETS_IFRAME";
|
|
74
|
+
AccountStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
|
|
75
|
+
AccountStep2["ADD_EX_WALLET_MORE"] = "ADD_EX_WALLET_MORE";
|
|
76
|
+
AccountStep2["ADD_EX_WALLET_SELECTED"] = "ADD_EX_WALLET_SELECTED";
|
|
77
|
+
AccountStep2["ADD_EX_WALLET_NETWORK_SELECT"] = "ADD_EX_WALLET_NETWORK_SELECT";
|
|
78
|
+
AccountStep2["LINK_EX_WALLET_NETWORK_SELECT"] = "LINK_EX_WALLET_NETWORK_SELECT";
|
|
79
|
+
AccountStep2["ACCOUNT_SEND"] = "ACCOUNT_SEND";
|
|
80
|
+
AccountStep2["ACCOUNT_SEND_ASSET"] = "ACCOUNT_SEND_ASSET";
|
|
81
|
+
AccountStep2["ACCOUNT_SEND_NETWORK"] = "ACCOUNT_SEND_NETWORK";
|
|
61
82
|
return AccountStep2;
|
|
62
83
|
})(AccountStep || {});
|
|
63
84
|
const RESET_TO_AUTH_STEPS = [
|
|
64
|
-
"EX_WALLET_MORE" /* EX_WALLET_MORE */,
|
|
65
85
|
"EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
|
|
66
86
|
"EX_WALLET_NETWORK_SELECT" /* EX_WALLET_NETWORK_SELECT */,
|
|
67
87
|
"VERIFICATIONS" /* VERIFICATIONS */,
|
|
@@ -84,7 +104,6 @@ const RESET_TO_AUTH_STEPS = [
|
|
|
84
104
|
"SETUP_2FA" /* SETUP_2FA */,
|
|
85
105
|
"VERIFY_2FA" /* VERIFY_2FA */,
|
|
86
106
|
"TWO_FACTOR_DONE" /* TWO_FACTOR_DONE */,
|
|
87
|
-
"LOGIN_DONE" /* LOGIN_DONE */,
|
|
88
107
|
"OTP" /* OTP */
|
|
89
108
|
];
|
|
90
109
|
const RESET_TO_ACCOUNT_STEPS = [
|
|
@@ -99,7 +118,18 @@ const RESET_TO_ACCOUNT_STEPS = [
|
|
|
99
118
|
"ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
100
119
|
"ACCOUNT_PROFILE_ADD" /* ACCOUNT_PROFILE_ADD */,
|
|
101
120
|
"ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
|
|
102
|
-
"ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE
|
|
121
|
+
"ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */,
|
|
122
|
+
"ACCOUNT_SEND" /* ACCOUNT_SEND */,
|
|
123
|
+
"ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */,
|
|
124
|
+
"ACCOUNT_SEND_NETWORK" /* ACCOUNT_SEND_NETWORK */,
|
|
125
|
+
"ACCOUNT_WALLET" /* ACCOUNT_WALLET */,
|
|
126
|
+
"SWITCH_WALLETS" /* SWITCH_WALLETS */,
|
|
127
|
+
"SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */,
|
|
128
|
+
"ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
|
|
129
|
+
"ADD_EX_WALLET_SELECTED" /* ADD_EX_WALLET_SELECTED */,
|
|
130
|
+
"ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */,
|
|
131
|
+
"LINK_EX_WALLET_NETWORK_SELECT" /* LINK_EX_WALLET_NETWORK_SELECT */,
|
|
132
|
+
"EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */
|
|
103
133
|
];
|
|
104
134
|
const AccountPreviousStep = {
|
|
105
135
|
["ACCOUNT_MAIN" /* ACCOUNT_MAIN */]: void 0,
|
|
@@ -114,7 +144,18 @@ const AccountPreviousStep = {
|
|
|
114
144
|
["ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */]: "ACCOUNT_MAIN" /* ACCOUNT_MAIN */,
|
|
115
145
|
["ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
116
146
|
["ACCOUNT_PROFILE_ADD" /* ACCOUNT_PROFILE_ADD */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
|
|
117
|
-
["ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE
|
|
147
|
+
["ACCOUNT_PROFILE_REMOVE" /* ACCOUNT_PROFILE_REMOVE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
148
|
+
["ACCOUNT_WALLET" /* ACCOUNT_WALLET */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
149
|
+
["SWITCH_WALLETS" /* SWITCH_WALLETS */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
150
|
+
["SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
151
|
+
["EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */]: "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
|
|
152
|
+
["ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */]: "ACCOUNT_PROFILE" /* ACCOUNT_PROFILE */,
|
|
153
|
+
["ADD_EX_WALLET_SELECTED" /* ADD_EX_WALLET_SELECTED */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
|
|
154
|
+
["ADD_EX_WALLET_NETWORK_SELECT" /* ADD_EX_WALLET_NETWORK_SELECT */]: "ADD_EX_WALLET_MORE" /* ADD_EX_WALLET_MORE */,
|
|
155
|
+
["LINK_EX_WALLET_NETWORK_SELECT" /* LINK_EX_WALLET_NETWORK_SELECT */]: "ACCOUNT_PROFILE_LIST" /* ACCOUNT_PROFILE_LIST */,
|
|
156
|
+
["ACCOUNT_SEND" /* ACCOUNT_SEND */]: "ACCOUNT_MAIN" /* ACCOUNT_MAIN */,
|
|
157
|
+
["ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */]: "ACCOUNT_SEND" /* ACCOUNT_SEND */,
|
|
158
|
+
["ACCOUNT_SEND_NETWORK" /* ACCOUNT_SEND_NETWORK */]: "ACCOUNT_SEND_ASSET" /* ACCOUNT_SEND_ASSET */
|
|
118
159
|
};
|
|
119
160
|
var SignUpModalStep = /* @__PURE__ */ ((SignUpModalStep2) => {
|
|
120
161
|
SignUpModalStep2["AUTH_MAIN"] = "AUTH_MAIN";
|
|
@@ -270,7 +311,12 @@ function getAddFundsStep(currentTab) {
|
|
|
270
311
|
return "ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */;
|
|
271
312
|
}
|
|
272
313
|
}
|
|
273
|
-
const IFrameSteps = [
|
|
314
|
+
const IFrameSteps = [
|
|
315
|
+
"PASSWORD_CREATION" /* PASSWORD_CREATION */,
|
|
316
|
+
"EMBEDDED_PASSWORD_LOGIN" /* EMBEDDED_PASSWORD_LOGIN */,
|
|
317
|
+
"OTP" /* OTP */,
|
|
318
|
+
"SWITCH_WALLETS_IFRAME" /* SWITCH_WALLETS_IFRAME */
|
|
319
|
+
];
|
|
274
320
|
export {
|
|
275
321
|
AccountPreviousStep,
|
|
276
322
|
GuestPreviousStep,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const formatNetworkList: (networks:
|
|
1
|
+
import { TNetwork } from '@getpara/web-sdk';
|
|
2
|
+
export declare const formatNetworkList: (networks: TNetwork[]) => string;
|
|
3
3
|
export declare const formatWalletCreatedDate: (date: string) => string;
|
|
4
4
|
export declare const camelToSnakeCase: (str: string) => string;
|
|
5
|
-
export declare const formatBalanceString: (str: string) => string;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import "../../chunk-MMUBH76A.js";
|
|
3
|
-
import { getNetworkName } from "
|
|
3
|
+
import { getNetworkName } from "@getpara/react-common";
|
|
4
4
|
import { format } from "date-fns";
|
|
5
5
|
const formatNetworkList = (networks) => {
|
|
6
|
-
|
|
6
|
+
if (networks.length === 0) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
if (networks.length === 1) {
|
|
10
|
+
return getNetworkName(networks[0]);
|
|
11
|
+
}
|
|
12
|
+
const networkNames = networks.map((id) => getNetworkName(id));
|
|
13
|
+
const allButLast = networkNames.slice(0, -1);
|
|
14
|
+
const last = networkNames[networkNames.length - 1];
|
|
15
|
+
return `${allButLast.join(", ")}${networks.length > 2 ? "," : ""} and ${last}`;
|
|
7
16
|
};
|
|
8
17
|
const formatWalletCreatedDate = (date) => `${format(new Date(date), "M/d/y")}`;
|
|
9
18
|
const camelToSnakeCase = (str) => str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
|
|
10
|
-
const formatBalanceString = (str) => {
|
|
11
|
-
const numericBalance = parseFloat(str);
|
|
12
|
-
return `$${numericBalance.toLocaleString(void 0, { maximumFractionDigits: 2 })}`;
|
|
13
|
-
};
|
|
14
19
|
export {
|
|
15
20
|
camelToSnakeCase,
|
|
16
|
-
formatBalanceString,
|
|
17
21
|
formatNetworkList,
|
|
18
22
|
formatWalletCreatedDate
|
|
19
23
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { getPortalBaseURL } from "@getpara/web-sdk";
|
|
4
|
+
const validatePortalOrigin = (event, paraCtx) => {
|
|
5
|
+
const portalBase = getPortalBaseURL(paraCtx);
|
|
6
|
+
const portalLocalBase = getPortalBaseURL(paraCtx, true);
|
|
7
|
+
if (event.origin !== portalBase && event.origin !== portalLocalBase) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
validatePortalOrigin
|
|
14
|
+
};
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useEffect, useState } from "react";
|
|
8
8
|
import { useStore } from "./stores/useStore.js";
|
|
9
|
+
import { useModalStore } from "../modal/stores/index.js";
|
|
9
10
|
import { useAutoSessionKeepAlive } from "./hooks/utils/useAutoSessionKeepAlive.js";
|
|
10
11
|
import { useEventListeners } from "./hooks/utils/useEventListeners.js";
|
|
11
12
|
import { ExternalWalletWrapper } from "./components/ExternalWalletWrapper.js";
|
|
@@ -15,6 +16,7 @@ import ParaWeb from "@getpara/web-sdk";
|
|
|
15
16
|
import { EXTERNAL_WALLET_TYPES } from "@getpara/web-sdk";
|
|
16
17
|
import { AuthProvider } from "./providers/AuthProvider.js";
|
|
17
18
|
import { AccountLinkProvider } from "./providers/AccountLinkProvider.js";
|
|
19
|
+
import { AssetsProvider } from "./providers/AssetsProvider.js";
|
|
18
20
|
const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, config, externalWalletConfig, paraModalConfig }, ref) => {
|
|
19
21
|
useEventListeners(callbacks);
|
|
20
22
|
useAutoSessionKeepAlive({ disabled: config.disableAutoSessionKeepAlive });
|
|
@@ -37,6 +39,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
37
39
|
const rpcUrl = useStore((state) => state.rpcUrl);
|
|
38
40
|
const setRpcUrl = useStore((state) => state.setRpcUrl);
|
|
39
41
|
const setProviderProps = useStore((state) => state.setProviderProps);
|
|
42
|
+
const setModalError = useModalStore((state) => state.setModalError);
|
|
40
43
|
const [isClientReady, setIsClientReady] = useState(client == null ? void 0 : client.isReady);
|
|
41
44
|
useEffect(() => {
|
|
42
45
|
setProviderProps(__spreadProps(__spreadValues(__spreadValues(__spreadValues({}, config), externalWalletConfig), paraModalConfig), {
|
|
@@ -88,9 +91,7 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
88
91
|
console.warn("createLinkedEmbeddedForExternalWallets has no effect when using connection only external wallets");
|
|
89
92
|
setExternalWalletsWithFullAuth([]);
|
|
90
93
|
} else {
|
|
91
|
-
setExternalWalletsWithFullAuth(
|
|
92
|
-
(externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) === "ALL" ? [...EXTERNAL_WALLET_TYPES] : (_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []
|
|
93
|
-
);
|
|
94
|
+
setExternalWalletsWithFullAuth((_b = externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets) != null ? _b : []);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
}, [externalWalletConfig == null ? void 0 : externalWalletConfig.createLinkedEmbeddedForExternalWallets]);
|
|
@@ -99,6 +100,8 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
99
100
|
throw new Error("Invalid Para config");
|
|
100
101
|
}
|
|
101
102
|
const newClient = isParaWeb(paraClientConfig) ? paraClientConfig : new ParaWeb(paraClientConfig.env, paraClientConfig.apiKey, paraClientConfig.opts);
|
|
103
|
+
newClient.setModalError = setModalError;
|
|
104
|
+
newClient.portalTheme = paraModalConfig == null ? void 0 : paraModalConfig.theme;
|
|
102
105
|
if (newClient.isReady) {
|
|
103
106
|
setIsClientReady(true);
|
|
104
107
|
} else {
|
|
@@ -106,6 +109,11 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
106
109
|
}
|
|
107
110
|
setClient(newClient);
|
|
108
111
|
}, [paraClientConfig]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (client) {
|
|
114
|
+
client.portalTheme = paraModalConfig == null ? void 0 : paraModalConfig.theme;
|
|
115
|
+
}
|
|
116
|
+
}, [paraModalConfig == null ? void 0 : paraModalConfig.theme, client]);
|
|
109
117
|
useEffect(() => {
|
|
110
118
|
if (client && !client.isReady) {
|
|
111
119
|
client.ready().then(() => {
|
|
@@ -128,10 +136,10 @@ const ParaProviderMin = forwardRef(({ children, paraClientConfig, callbacks, con
|
|
|
128
136
|
login: paraModalConfig == null ? void 0 : paraModalConfig.loginTransitionOverride,
|
|
129
137
|
createWallets: paraModalConfig == null ? void 0 : paraModalConfig.createWalletOverride
|
|
130
138
|
},
|
|
131
|
-
children: /* @__PURE__ */ jsx(ExternalWalletWrapper, { config: externalWalletConfig, children: /* @__PURE__ */ jsxs(AccountLinkProvider, { children: [
|
|
139
|
+
children: /* @__PURE__ */ jsx(AssetsProvider, { children: /* @__PURE__ */ jsx(ExternalWalletWrapper, { config: externalWalletConfig, children: /* @__PURE__ */ jsxs(AccountLinkProvider, { children: [
|
|
132
140
|
children,
|
|
133
141
|
!config.disableEmbeddedModal && client.isReady && /* @__PURE__ */ jsx(ParaModal, { ref })
|
|
134
|
-
] }) })
|
|
142
|
+
] }) }) })
|
|
135
143
|
}
|
|
136
144
|
);
|
|
137
145
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ParaWeb, { PrimaryAuthInfo } from '@getpara/web-sdk';
|
|
1
|
+
import ParaWeb, { AuthMethod, PrimaryAuthInfo } from '@getpara/web-sdk';
|
|
2
2
|
type AccountValue = PrimaryAuthInfo & {
|
|
3
3
|
email?: string;
|
|
4
4
|
phone?: `+${number}`;
|
|
@@ -7,6 +7,7 @@ type AccountValue = PrimaryAuthInfo & {
|
|
|
7
7
|
externalWalletAddress?: string;
|
|
8
8
|
wallets: (typeof ParaWeb.prototype)['availableWallets'];
|
|
9
9
|
userId?: string;
|
|
10
|
+
authMethods?: Set<AuthMethod>;
|
|
10
11
|
};
|
|
11
12
|
export type Account = ({
|
|
12
13
|
isConnected: false;
|
|
@@ -22,5 +23,5 @@ export type Account = ({
|
|
|
22
23
|
isConnected: true;
|
|
23
24
|
isGuestMode: false;
|
|
24
25
|
} & AccountValue);
|
|
25
|
-
export declare const getEmbeddedAccount: (para: ParaWeb | undefined, isFullyLoggedIn: boolean | undefined) => Account
|
|
26
|
+
export declare const getEmbeddedAccount: (para: ParaWeb | undefined, isFullyLoggedIn: boolean | undefined) => Promise<Account>;
|
|
26
27
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getEmbeddedAccount = (para, isFullyLoggedIn) => __async(void 0, null, function* () {
|
|
4
6
|
switch (true) {
|
|
5
7
|
case !para:
|
|
6
8
|
case !(para == null ? void 0 : para.isReady):
|
|
@@ -20,6 +22,12 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
|
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
24
|
const authInfo = para.authInfo;
|
|
25
|
+
let authMethods;
|
|
26
|
+
try {
|
|
27
|
+
authMethods = yield para.supportedUserAuthMethods();
|
|
28
|
+
} catch (e) {
|
|
29
|
+
authMethods = /* @__PURE__ */ new Set();
|
|
30
|
+
}
|
|
23
31
|
const value = {
|
|
24
32
|
auth: authInfo == null ? void 0 : authInfo.auth,
|
|
25
33
|
authType: authInfo == null ? void 0 : authInfo.authType,
|
|
@@ -27,7 +35,8 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
|
|
|
27
35
|
userId: para.userId,
|
|
28
36
|
wallets: para.availableWallets,
|
|
29
37
|
isConnected: true,
|
|
30
|
-
isGuestMode: false
|
|
38
|
+
isGuestMode: false,
|
|
39
|
+
authMethods
|
|
31
40
|
};
|
|
32
41
|
if (authInfo) {
|
|
33
42
|
switch (authInfo.authType) {
|
|
@@ -51,7 +60,7 @@ const getEmbeddedAccount = (para, isFullyLoggedIn) => {
|
|
|
51
60
|
}
|
|
52
61
|
}
|
|
53
62
|
return value;
|
|
54
|
-
};
|
|
63
|
+
});
|
|
55
64
|
export {
|
|
56
65
|
getEmbeddedAccount
|
|
57
66
|
};
|
|
@@ -28,20 +28,22 @@ export declare const getWalletBalance: import("./utils.js").CoreAction<"getWalle
|
|
|
28
28
|
export declare const issueJwt: import("./utils.js").CoreAction<"issueJwt">;
|
|
29
29
|
export declare const getLinkedAccounts: import("./utils.js").CoreAction<"getLinkedAccounts">;
|
|
30
30
|
export declare const accountLinkInProgress: import("./utils.js").CoreAction<"accountLinkInProgress">;
|
|
31
|
+
export declare const addCredential: import("./utils.js").CoreAction<"addCredential">;
|
|
31
32
|
export declare const linkAccount: (_?: import("@getpara/core-sdk").default, __?: {
|
|
32
|
-
auth: import("@getpara/
|
|
33
|
+
auth: import("@getpara/shared").VerifiedAuth;
|
|
33
34
|
} | {
|
|
34
|
-
externalWallet: import("@getpara/
|
|
35
|
+
externalWallet: import("@getpara/shared").ExternalWalletInfo;
|
|
35
36
|
} | {
|
|
36
|
-
type: import("@getpara/
|
|
37
|
+
type: import("@getpara/shared").TLinkedAccountType | "X";
|
|
37
38
|
} | undefined) => Promise<import("@getpara/core-sdk").AccountLinkInProgress>;
|
|
38
39
|
export declare const unlinkAccount: (_?: import("@getpara/core-sdk").default, __?: {
|
|
39
40
|
linkedAccountId: string;
|
|
40
|
-
} | undefined) => Promise<import("@getpara/
|
|
41
|
+
} | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
41
42
|
export declare const verifyEmailOrPhoneLink: (_?: import("@getpara/core-sdk").default, __?: {
|
|
42
43
|
verificationCode?: string;
|
|
43
|
-
} | undefined) => Promise<import("@getpara/
|
|
44
|
-
export declare const verifyFarcasterLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").FarcasterParams | undefined) => Promise<import("@getpara/
|
|
45
|
-
export declare const verifyTelegramLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").TelegramParams | undefined) => Promise<import("@getpara/
|
|
46
|
-
export declare const verifyOAuthLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").OAuthParams | undefined) => Promise<import("@getpara/
|
|
47
|
-
export declare const verifyExternalWalletLink: (_?: import("@getpara/core-sdk").default, __?: Omit<import("@getpara/
|
|
44
|
+
} | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
45
|
+
export declare const verifyFarcasterLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").FarcasterParams | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
46
|
+
export declare const verifyTelegramLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").TelegramParams | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
47
|
+
export declare const verifyOAuthLink: (_?: import("@getpara/core-sdk").default, __?: import("@getpara/core-sdk/dist/types/types/methods.js").OAuthParams | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
48
|
+
export declare const verifyExternalWalletLink: (_?: import("@getpara/core-sdk").default, __?: Omit<import("@getpara/shared").VerifyExternalWalletParams, "externalWallet"> | undefined) => Promise<import("@getpara/shared").LinkedAccounts>;
|
|
49
|
+
export declare const exportPrivateKey: import("./utils.js").CoreAction<"exportPrivateKey">;
|
|
@@ -31,6 +31,7 @@ const getWalletBalance = generateCoreAction("getWalletBalance");
|
|
|
31
31
|
const issueJwt = generateCoreAction("issueJwt");
|
|
32
32
|
const getLinkedAccounts = generateCoreAction("getLinkedAccounts");
|
|
33
33
|
const accountLinkInProgress = generateCoreAction("accountLinkInProgress");
|
|
34
|
+
const addCredential = generateCoreAction("addCredential");
|
|
34
35
|
const linkAccount = generateInternalAction("linkAccount");
|
|
35
36
|
const unlinkAccount = generateInternalAction("unlinkAccount");
|
|
36
37
|
const verifyEmailOrPhoneLink = generateInternalAction("verifyEmailOrPhoneLink");
|
|
@@ -38,8 +39,10 @@ const verifyFarcasterLink = generateInternalAction("verifyFarcasterLink");
|
|
|
38
39
|
const verifyTelegramLink = generateInternalAction("verifyTelegramLink");
|
|
39
40
|
const verifyOAuthLink = generateInternalAction("verifyOAuthLink");
|
|
40
41
|
const verifyExternalWalletLink = generateInternalAction("verifyExternalWalletLink");
|
|
42
|
+
const exportPrivateKey = generateCoreAction("exportPrivateKey");
|
|
41
43
|
export {
|
|
42
44
|
accountLinkInProgress,
|
|
45
|
+
addCredential,
|
|
43
46
|
claimPregenWallets,
|
|
44
47
|
createGuestWallets,
|
|
45
48
|
createPregenWallet,
|
|
@@ -47,6 +50,7 @@ export {
|
|
|
47
50
|
createWallet,
|
|
48
51
|
createWalletPerType,
|
|
49
52
|
enable2fa,
|
|
53
|
+
exportPrivateKey,
|
|
50
54
|
getLinkedAccounts,
|
|
51
55
|
getWalletBalance,
|
|
52
56
|
hasPregenWallet,
|
|
@@ -5,7 +5,7 @@ import { CosmosExternalWalletProvider } from "../providers/CosmosExternalWalletP
|
|
|
5
5
|
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
6
|
import { useStore } from "../stores/useStore.js";
|
|
7
7
|
import { COSMOS_WALLETS } from "@getpara/web-sdk";
|
|
8
|
-
import {
|
|
8
|
+
import { useWalletState } from "../hooks/index.js";
|
|
9
9
|
const CosmosWalletWrapper = ({
|
|
10
10
|
children,
|
|
11
11
|
cosmosConnectorConfig,
|
|
@@ -13,7 +13,7 @@ const CosmosWalletWrapper = ({
|
|
|
13
13
|
onSwitchWallet
|
|
14
14
|
}) => {
|
|
15
15
|
const para = useInternalClient();
|
|
16
|
-
const {
|
|
16
|
+
const { selectedWallet } = useWalletState();
|
|
17
17
|
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
18
18
|
const wallets = useStore((state) => state.externalWallets);
|
|
19
19
|
const isUsing = wallets.some((w) => w in COSMOS_WALLETS);
|
|
@@ -27,7 +27,7 @@ const CosmosWalletWrapper = ({
|
|
|
27
27
|
onSwitchWallet,
|
|
28
28
|
para,
|
|
29
29
|
walletsWithFullAuth: externalWalletsWithFullAuth,
|
|
30
|
-
connectedWallet:
|
|
30
|
+
connectedWallet: (selectedWallet == null ? void 0 : selectedWallet.id) ? { id: selectedWallet.id, type: selectedWallet.type } : null,
|
|
31
31
|
connectionOnly,
|
|
32
32
|
includeWalletVerification
|
|
33
33
|
},
|
|
@@ -5,7 +5,7 @@ import { EvmExternalWalletProvider } from "../providers/EvmExternalWalletProvide
|
|
|
5
5
|
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
6
|
import { useStore } from "../stores/useStore.js";
|
|
7
7
|
import { EVM_WALLETS } from "@getpara/web-sdk";
|
|
8
|
-
import {
|
|
8
|
+
import { useWalletState } from "../hooks/index.js";
|
|
9
9
|
const EvmWalletWrapper = ({
|
|
10
10
|
children,
|
|
11
11
|
evmProviderConfig,
|
|
@@ -13,7 +13,7 @@ const EvmWalletWrapper = ({
|
|
|
13
13
|
onSwitchWallet
|
|
14
14
|
}) => {
|
|
15
15
|
const para = useInternalClient();
|
|
16
|
-
const {
|
|
16
|
+
const { selectedWallet } = useWalletState();
|
|
17
17
|
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
18
18
|
const wallets = useStore((state) => state.externalWallets);
|
|
19
19
|
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
@@ -27,7 +27,7 @@ const EvmWalletWrapper = ({
|
|
|
27
27
|
onSwitchWallet,
|
|
28
28
|
para,
|
|
29
29
|
walletsWithFullAuth: externalWalletsWithFullAuth,
|
|
30
|
-
connectedWallet:
|
|
30
|
+
connectedWallet: (selectedWallet == null ? void 0 : selectedWallet.id) ? { id: selectedWallet.id, type: selectedWallet.type } : null,
|
|
31
31
|
connectionOnly,
|
|
32
32
|
includeWalletVerification
|
|
33
33
|
},
|
|
@@ -11,6 +11,8 @@ import { EvmWalletWrapper } from "./EvmWalletWrapper.js";
|
|
|
11
11
|
import { CosmosWalletWrapper } from "./CosmosWalletWrapper.js";
|
|
12
12
|
import { SolanaWalletWrapper } from "./SolanaWalletWrapper.js";
|
|
13
13
|
import { useStore } from "../stores/useStore.js";
|
|
14
|
+
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
15
|
+
import { EVM_WALLETS } from "@getpara/web-sdk";
|
|
14
16
|
const ExternalWalletWrapper = ({
|
|
15
17
|
children,
|
|
16
18
|
config
|
|
@@ -20,8 +22,12 @@ const ExternalWalletWrapper = ({
|
|
|
20
22
|
const appName = useStore((state) => state.appName);
|
|
21
23
|
const resetModalState = useModalStore((state) => state.resetState);
|
|
22
24
|
const wallets = useStore((state) => state.externalWallets);
|
|
25
|
+
const para = useInternalClient();
|
|
23
26
|
useEffect(() => {
|
|
24
|
-
if (!!wallets.length && !(walletConnect == null ? void 0 : walletConnect.projectId)) {
|
|
27
|
+
if (!!wallets.length && !(walletConnect == null ? void 0 : walletConnect.projectId) && wallets.some((wallet) => EVM_WALLETS.includes(wallet))) {
|
|
28
|
+
para.displayModalError(
|
|
29
|
+
"It is recommended to provide a WalletConnect project id to ensure wallet connection works as expected. Refer to our docs at [https://docs.getpara.com/v2/react/guides/external-wallets/evm#configure-the-providers](https://docs.getpara.com/v2/react/guides/external-wallets/evm#configure-the-providers) for configuration details and sign up for your free key at [https://cloud.walletconnect.com/sign-in](https://cloud.walletconnect.com/sign-in)"
|
|
30
|
+
);
|
|
25
31
|
console.warn(
|
|
26
32
|
"It is recommended to provide a WalletConnect project id to ensure wallet connection works as expected. Sign up for your free key at https://cloud.walletconnect.com/sign-in"
|
|
27
33
|
);
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { defaultCosmosExternalWallet } from "@getpara/react-common";
|
|
4
4
|
import { createContext } from "react";
|
|
5
|
-
const CosmosExternalWalletContext = createContext(
|
|
5
|
+
const CosmosExternalWalletContext = createContext(
|
|
6
|
+
defaultCosmosExternalWallet
|
|
7
|
+
);
|
|
6
8
|
export {
|
|
7
9
|
CosmosExternalWalletContext
|
|
8
10
|
};
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { createContext } from "react";
|
|
4
4
|
import { defaultEvmExternalWallet } from "@getpara/react-common";
|
|
5
|
-
const EvmExternalWalletContext = createContext(
|
|
5
|
+
const EvmExternalWalletContext = createContext(
|
|
6
|
+
defaultEvmExternalWallet
|
|
7
|
+
);
|
|
6
8
|
export {
|
|
7
9
|
EvmExternalWalletContext
|
|
8
10
|
};
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import "../../../chunk-MMUBH76A.js";
|
|
3
3
|
import { createContext } from "react";
|
|
4
4
|
import { defaultSolanaExternalWallet } from "@getpara/react-common";
|
|
5
|
-
const SolanaExternalWalletContext = createContext(
|
|
5
|
+
const SolanaExternalWalletContext = createContext(
|
|
6
|
+
defaultSolanaExternalWallet
|
|
7
|
+
);
|
|
6
8
|
export {
|
|
7
9
|
SolanaExternalWalletContext
|
|
8
10
|
};
|
|
@@ -26,4 +26,6 @@ export { useCreateGuestWallets } from './useCreateGuestWallets.js';
|
|
|
26
26
|
export { useSignMessage } from './useSignMessage.js';
|
|
27
27
|
export { useSignTransaction } from './useSignTransaction.js';
|
|
28
28
|
export { useIssueJwt } from './useIssueJwt.js';
|
|
29
|
+
export { useAddAuthMethod } from './useAddAuthMethod.js';
|
|
30
|
+
export { useExportPrivateKey } from './useExportPrivateKey.js';
|
|
29
31
|
export declare const useCreateGuestWalletsState: import("../../types/utils.js").CoreMethodMutationStateHook<"createGuestWallets">;
|
|
@@ -29,8 +29,11 @@ import { useCreateGuestWallets } from "./useCreateGuestWallets.js";
|
|
|
29
29
|
import { useSignMessage } from "./useSignMessage.js";
|
|
30
30
|
import { useSignTransaction } from "./useSignTransaction.js";
|
|
31
31
|
import { useIssueJwt } from "./useIssueJwt.js";
|
|
32
|
+
import { useAddAuthMethod } from "./useAddAuthMethod.js";
|
|
33
|
+
import { useExportPrivateKey } from "./useExportPrivateKey.js";
|
|
32
34
|
const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
|
|
33
35
|
export {
|
|
36
|
+
useAddAuthMethod,
|
|
34
37
|
useClaimPregenWallets,
|
|
35
38
|
useCreateGuestWallets,
|
|
36
39
|
useCreateGuestWalletsState,
|
|
@@ -39,6 +42,7 @@ export {
|
|
|
39
42
|
useCreateWallet,
|
|
40
43
|
useCreateWalletPerType,
|
|
41
44
|
useEnable2fa,
|
|
45
|
+
useExportPrivateKey,
|
|
42
46
|
useHasPregenWallet,
|
|
43
47
|
useIssueJwt,
|
|
44
48
|
useKeepSessionAlive,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const ADD_CREDENTIAL_KEY = "ADD_CREDENTIAL";
|
|
2
|
+
/**
|
|
3
|
+
* React hook to add a new auth method to a user's account. Useful for move a user's account away from basic login.
|
|
4
|
+
*
|
|
5
|
+
* Returns a mutation result object with all standard fields from `useMutation`, except:
|
|
6
|
+
* - `mutate` and `mutateAsync` are replaced by:
|
|
7
|
+
* - `addAuthMethod`: function to trigger the mutation (same as `mutate`)
|
|
8
|
+
* - `addAuthMethodAsync`: async function to trigger the mutation (same as `mutateAsync`)
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { addAuthMethod, addAuthMethodAsync } = useAddAuthMethod();
|
|
12
|
+
* // sync and with defined auth method to add
|
|
13
|
+
* addAuthMethod({ authMethod: 'PASSKEY' });
|
|
14
|
+
* // or async and without defined auth method to add (gives the user the option to choose)
|
|
15
|
+
* await addAuthMethodAsync();
|
|
16
|
+
*/
|
|
17
|
+
export declare const useAddAuthMethod: ({ openPopup }?: {
|
|
18
|
+
openPopup: boolean;
|
|
19
|
+
}) => {
|
|
20
|
+
status: "idle" | "pending" | "error" | "success";
|
|
21
|
+
error: Error | null;
|
|
22
|
+
data: string | undefined;
|
|
23
|
+
isSuccess: boolean;
|
|
24
|
+
variables: void | {
|
|
25
|
+
authMethod?: import("@getpara/web-sdk").TAuthMethod | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
isError: boolean;
|
|
28
|
+
isIdle: boolean;
|
|
29
|
+
isPending: boolean;
|
|
30
|
+
reset: () => void;
|
|
31
|
+
context: unknown;
|
|
32
|
+
failureCount: number;
|
|
33
|
+
failureReason: Error | null;
|
|
34
|
+
isPaused: boolean;
|
|
35
|
+
submittedAt: number;
|
|
36
|
+
addAuthMethod: import("@tanstack/react-query").UseMutateFunction<string, Error, void | {
|
|
37
|
+
authMethod?: import("@getpara/web-sdk").TAuthMethod | undefined;
|
|
38
|
+
}, unknown>;
|
|
39
|
+
addAuthMethodAsync: import("@tanstack/react-query").UseMutateAsyncFunction<string, Error, void | {
|
|
40
|
+
authMethod?: import("@getpara/web-sdk").TAuthMethod | undefined;
|
|
41
|
+
}, unknown>;
|
|
42
|
+
};
|