@getpara/react-common 2.0.0-alpha.20 → 2.0.0-alpha.22
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/classes/ParaInternal.d.ts +10 -4
- package/dist/classes/ParaInternal.js +7 -1
- package/dist/components/HeroSpinner.d.ts +2 -2
- package/dist/components/HeroSpinner.js +15 -7
- package/dist/types/externalWalletCommon.d.ts +51 -42
- package/dist/types/externalWalletCommon.js +0 -36
- package/package.json +4 -4
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
2
|
-
export declare class ParaInternal extends ParaWeb {
|
|
1
|
+
import ParaWeb, { InternalInterface } from '@getpara/web-sdk';
|
|
2
|
+
export declare class ParaInternal extends ParaWeb implements InternalInterface {
|
|
3
3
|
setupAfterLogin: ({ temporaryShares, skipSessionRefresh, }?: {
|
|
4
4
|
temporaryShares?: any[];
|
|
5
5
|
skipSessionRefresh?: boolean;
|
|
6
6
|
}) => Promise<void>;
|
|
7
|
-
getSupportedCreateAuthMethods: () => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
|
|
8
7
|
getTransmissionKeyShares: ({ isForNewDevice }?: {
|
|
9
8
|
isForNewDevice?: boolean;
|
|
10
9
|
}) => Promise<any>;
|
|
@@ -16,10 +15,17 @@ export declare class ParaInternal extends ParaWeb {
|
|
|
16
15
|
extras?: import("@getpara/web-sdk").AuthExtras;
|
|
17
16
|
userId?: string;
|
|
18
17
|
}) => Promise<typeof this.authInfo>;
|
|
19
|
-
supportedAuthMethods: (auth: import("@getpara/
|
|
18
|
+
supportedAuthMethods: (auth: import("@getpara/web-sdk").Auth<import("@getpara/user-management-client").PrimaryAuthType | "userId">) => Promise<Set<import("@getpara/web-sdk").AuthMethod>>;
|
|
20
19
|
constructPortalUrl: (type: import("@getpara/core-sdk/dist/types/types").PortalUrlType, opts?: import("@getpara/core-sdk/dist/types/types").PortalUrlOptions) => Promise<string>;
|
|
21
20
|
getNewCredentialAndUrl: ({ authMethod, isForNewDevice, portalTheme, shorten, }?: import("@getpara/core-sdk/dist/types/types").NewCredentialUrlParams) => Promise<{
|
|
22
21
|
credentialId: string;
|
|
23
22
|
url?: string;
|
|
24
23
|
}>;
|
|
24
|
+
linkAccount: (opts: import("@getpara/web-sdk").InternalMethodParams<"linkAccount">) => import("@getpara/web-sdk").InternalMethodResponse<"linkAccount">;
|
|
25
|
+
unlinkAccount: ({ linkedAccountId, }: import("@getpara/web-sdk").InternalMethodParams<"unlinkAccount">) => import("@getpara/web-sdk").InternalMethodResponse<"unlinkAccount">;
|
|
26
|
+
verifyEmailOrPhoneLink: ({ verificationCode, }: import("@getpara/web-sdk").InternalMethodParams<"verifyEmailOrPhoneLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyEmailOrPhoneLink">;
|
|
27
|
+
verifyOAuthLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyOAuthLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyOAuthLink">;
|
|
28
|
+
verifyTelegramLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyTelegramLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyTelegramLink">;
|
|
29
|
+
verifyFarcasterLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyFarcasterLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyFarcasterLink">;
|
|
30
|
+
verifyExternalWalletLink: (opts: import("@getpara/web-sdk").InternalMethodParams<"verifyExternalWalletLink">) => import("@getpara/web-sdk").InternalMethodResponse<"verifyExternalWalletLink">;
|
|
25
31
|
}
|
|
@@ -5,7 +5,6 @@ class ParaInternal extends ParaWeb {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.setupAfterLogin = super.setupAfterLogin;
|
|
8
|
-
this.getSupportedCreateAuthMethods = super.getSupportedCreateAuthMethods;
|
|
9
8
|
this.getTransmissionKeyShares = super.getTransmissionKeyShares;
|
|
10
9
|
this.userSetupAfterLogin = super.userSetupAfterLogin;
|
|
11
10
|
this.setLoginEncryptionKeyPair = super.setLoginEncryptionKeyPair;
|
|
@@ -15,6 +14,13 @@ class ParaInternal extends ParaWeb {
|
|
|
15
14
|
this.supportedAuthMethods = super.supportedAuthMethods;
|
|
16
15
|
this.constructPortalUrl = super.constructPortalUrl;
|
|
17
16
|
this.getNewCredentialAndUrl = super.getNewCredentialAndUrl;
|
|
17
|
+
this.linkAccount = super.linkAccount;
|
|
18
|
+
this.unlinkAccount = super.unlinkAccount;
|
|
19
|
+
this.verifyEmailOrPhoneLink = super.verifyEmailOrPhoneLink;
|
|
20
|
+
this.verifyOAuthLink = super.verifyOAuthLink;
|
|
21
|
+
this.verifyTelegramLink = super.verifyTelegramLink;
|
|
22
|
+
this.verifyFarcasterLink = super.verifyFarcasterLink;
|
|
23
|
+
this.verifyExternalWalletLink = super.verifyExternalWalletLink;
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
export {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IconType } from '@getpara/react-components';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
type Status = '
|
|
3
|
+
type Status = 'pending' | 'error' | 'idle' | 'success';
|
|
4
4
|
export declare function HeroSpinner({ icon, status, text, }: PropsWithChildren<{
|
|
5
|
-
icon?: IconType;
|
|
5
|
+
icon?: IconType | ReactNode;
|
|
6
6
|
status?: Status;
|
|
7
7
|
text?: ReactNode;
|
|
8
8
|
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,27 +5,34 @@ import { CpslIcon, CpslSpinner, CpslText } from "@getpara/react-components";
|
|
|
5
5
|
import { safeStyled } from "../utils/index.js";
|
|
6
6
|
function HeroSpinner({
|
|
7
7
|
icon,
|
|
8
|
-
status = "
|
|
8
|
+
status = "idle",
|
|
9
9
|
text
|
|
10
10
|
}) {
|
|
11
11
|
return /* @__PURE__ */ jsxs(Root, { children: [
|
|
12
12
|
/* @__PURE__ */ jsxs(Hero, { children: [
|
|
13
|
-
/* @__PURE__ */ jsx(Spinner, { size:
|
|
14
|
-
icon
|
|
13
|
+
/* @__PURE__ */ jsx(Spinner, { size: 155, barWidth: 8, variant: status }),
|
|
14
|
+
typeof icon === "string" ? /* @__PURE__ */ jsx(CpslIcon, { icon, size: "80px" }) : icon
|
|
15
15
|
] }),
|
|
16
16
|
/* @__PURE__ */ jsxs(Text, { status, children: [
|
|
17
17
|
status === "error" && /* @__PURE__ */ jsx(CpslIcon, { icon: "alertCircle", size: "16px", style: { stroke: "currentColor" } }),
|
|
18
|
-
/* @__PURE__ */ jsx(
|
|
18
|
+
status === "success" && /* @__PURE__ */ jsx(CpslIcon, { icon: "checkCircle", size: "16px", style: { stroke: "currentColor" } }),
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
CpslText,
|
|
21
|
+
{
|
|
22
|
+
variant: "bodyM",
|
|
23
|
+
weight: "semiBold",
|
|
24
|
+
color: status === "error" ? "error" : status === "success" ? "success" : "primary",
|
|
25
|
+
children: text
|
|
26
|
+
}
|
|
27
|
+
)
|
|
19
28
|
] })
|
|
20
29
|
] });
|
|
21
30
|
}
|
|
22
31
|
const Root = safeStyled.div`
|
|
23
|
-
height: 276px;
|
|
24
32
|
display: flex;
|
|
25
33
|
flex-direction: column;
|
|
26
34
|
justify-content: center;
|
|
27
35
|
align-items: center;
|
|
28
|
-
gap: 16px;
|
|
29
36
|
`;
|
|
30
37
|
const Hero = safeStyled.div`
|
|
31
38
|
width: 150px;
|
|
@@ -40,7 +47,7 @@ const Text = safeStyled.div`
|
|
|
40
47
|
display: flex;
|
|
41
48
|
gap: 4px;
|
|
42
49
|
align-items: center;
|
|
43
|
-
color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : "auto"};
|
|
50
|
+
color: ${({ status }) => status === "error" ? "var(--cpsl-color-utility-red)" : status === "success" ? "var(--cpsl-color-utility-green)" : "auto"};
|
|
44
51
|
`;
|
|
45
52
|
const Spinner = safeStyled(CpslSpinner)`
|
|
46
53
|
position: absolute;
|
|
@@ -49,6 +56,7 @@ const Spinner = safeStyled(CpslSpinner)`
|
|
|
49
56
|
top: 0;
|
|
50
57
|
left: 0;
|
|
51
58
|
right: 0;
|
|
59
|
+
transition: 0.2s color;
|
|
52
60
|
`;
|
|
53
61
|
export {
|
|
54
62
|
HeroSpinner
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AuthStateLogin, AuthStateVerify, TWalletType } from '@getpara/web-sdk';
|
|
1
|
+
import ParaWeb, { AuthStateLogin, AuthStateVerify, ExternalWalletInfo, TExternalWallet, TWalletType, Wallet } from '@getpara/web-sdk';
|
|
2
2
|
export type WalletMetadata = {
|
|
3
3
|
id: string;
|
|
4
|
+
internalId: TExternalWallet;
|
|
4
5
|
name: string;
|
|
5
6
|
iconUrl: string;
|
|
6
7
|
rdns?: string;
|
|
@@ -47,45 +48,53 @@ export type CommonChain = {
|
|
|
47
48
|
id: string | number;
|
|
48
49
|
name: string;
|
|
49
50
|
};
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
COINBASE = "COINBASE",
|
|
54
|
-
WALLETCONNECT = "WALLETCONNECT",
|
|
55
|
-
ZERION = "ZERION",
|
|
56
|
-
SAFE = "SAFE",
|
|
57
|
-
RABBY = "RABBY",
|
|
58
|
-
OKX = "OKX",
|
|
59
|
-
HAHA = "HAHA",
|
|
60
|
-
BACKPACK = "BACKPACK"
|
|
61
|
-
}
|
|
62
|
-
export declare enum SolanaWallet {
|
|
63
|
-
PHANTOM = "PHANTOM",
|
|
64
|
-
GLOW = "GLOW",
|
|
65
|
-
BACKPACK = "BACKPACK",
|
|
66
|
-
SOLFLARE = "SOLFLARE"
|
|
67
|
-
}
|
|
68
|
-
export declare enum CosmosWallet {
|
|
69
|
-
KEPLR = "KEPLR",
|
|
70
|
-
LEAP = "LEAP",
|
|
71
|
-
COSMOSTATION = "COSMOSTATION"
|
|
72
|
-
}
|
|
73
|
-
export declare const ExternalWallet: {
|
|
74
|
-
KEPLR: CosmosWallet.KEPLR;
|
|
75
|
-
LEAP: CosmosWallet.LEAP;
|
|
76
|
-
COSMOSTATION: CosmosWallet.COSMOSTATION;
|
|
77
|
-
PHANTOM: SolanaWallet.PHANTOM;
|
|
78
|
-
GLOW: SolanaWallet.GLOW;
|
|
79
|
-
BACKPACK: SolanaWallet.BACKPACK;
|
|
80
|
-
SOLFLARE: SolanaWallet.SOLFLARE;
|
|
81
|
-
METAMASK: EvmWallet.METAMASK;
|
|
82
|
-
RAINBOW: EvmWallet.RAINBOW;
|
|
83
|
-
COINBASE: EvmWallet.COINBASE;
|
|
84
|
-
WALLETCONNECT: EvmWallet.WALLETCONNECT;
|
|
85
|
-
ZERION: EvmWallet.ZERION;
|
|
86
|
-
SAFE: EvmWallet.SAFE;
|
|
87
|
-
RABBY: EvmWallet.RABBY;
|
|
88
|
-
OKX: EvmWallet.OKX;
|
|
89
|
-
HAHA: EvmWallet.HAHA;
|
|
51
|
+
export type SignArgs = {
|
|
52
|
+
message: string;
|
|
53
|
+
externalWallet?: ExternalWalletInfo;
|
|
90
54
|
};
|
|
91
|
-
export type
|
|
55
|
+
export type SignResult = {
|
|
56
|
+
address?: string;
|
|
57
|
+
signature?: string;
|
|
58
|
+
error?: string;
|
|
59
|
+
};
|
|
60
|
+
export type SwitchChainResult = {
|
|
61
|
+
error: string[];
|
|
62
|
+
} | void;
|
|
63
|
+
export type ConnectParaEmbedded = {
|
|
64
|
+
connectParaEmbedded: () => Promise<{
|
|
65
|
+
result?: unknown;
|
|
66
|
+
error?: string;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export type ChainManagement<ChainId, R extends SwitchChainResult = SwitchChainResult> = {
|
|
70
|
+
chains: CommonChain[];
|
|
71
|
+
chainId?: ChainId;
|
|
72
|
+
switchChain: (_: ChainId) => Promise<R>;
|
|
73
|
+
};
|
|
74
|
+
export type BalanceManagement<B = string> = {
|
|
75
|
+
balance?: B;
|
|
76
|
+
getWalletBalance: () => Promise<B | undefined>;
|
|
77
|
+
};
|
|
78
|
+
export type ExternalWalletContextType<S extends SignResult = SignResult> = {
|
|
79
|
+
wallets: CommonWallet[];
|
|
80
|
+
disconnect: () => Promise<void>;
|
|
81
|
+
signMessage: (_: SignArgs) => Promise<S>;
|
|
82
|
+
signVerificationMessage: () => Promise<S>;
|
|
83
|
+
requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
|
|
84
|
+
disconnectBase: (_?: TExternalWallet) => Promise<void>;
|
|
85
|
+
};
|
|
86
|
+
export type ExternalWalletProviderConfigBase = {
|
|
87
|
+
onSwitchWallet?: (args: {
|
|
88
|
+
address?: string;
|
|
89
|
+
error?: string;
|
|
90
|
+
}) => void;
|
|
91
|
+
para: ParaWeb;
|
|
92
|
+
walletsWithFullAuth: TExternalWallet[];
|
|
93
|
+
includeWalletVerification?: boolean;
|
|
94
|
+
connectionOnly?: boolean;
|
|
95
|
+
connectedWallet?: Omit<Wallet, 'signer'> | null;
|
|
96
|
+
};
|
|
97
|
+
export type ExternalWalletProviderConfig<W, P = {}> = ExternalWalletProviderConfigBase & {
|
|
98
|
+
wallets: W[];
|
|
99
|
+
} & P;
|
|
100
|
+
export { type TExternalWallet };
|
|
@@ -1,37 +1 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__spreadValues
|
|
4
|
-
} from "../chunk-GOCCUU3Z.js";
|
|
5
|
-
var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
|
|
6
|
-
EvmWallet2["METAMASK"] = "METAMASK";
|
|
7
|
-
EvmWallet2["RAINBOW"] = "RAINBOW";
|
|
8
|
-
EvmWallet2["COINBASE"] = "COINBASE";
|
|
9
|
-
EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
|
|
10
|
-
EvmWallet2["ZERION"] = "ZERION";
|
|
11
|
-
EvmWallet2["SAFE"] = "SAFE";
|
|
12
|
-
EvmWallet2["RABBY"] = "RABBY";
|
|
13
|
-
EvmWallet2["OKX"] = "OKX";
|
|
14
|
-
EvmWallet2["HAHA"] = "HAHA";
|
|
15
|
-
EvmWallet2["BACKPACK"] = "BACKPACK";
|
|
16
|
-
return EvmWallet2;
|
|
17
|
-
})(EvmWallet || {});
|
|
18
|
-
var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
|
|
19
|
-
SolanaWallet2["PHANTOM"] = "PHANTOM";
|
|
20
|
-
SolanaWallet2["GLOW"] = "GLOW";
|
|
21
|
-
SolanaWallet2["BACKPACK"] = "BACKPACK";
|
|
22
|
-
SolanaWallet2["SOLFLARE"] = "SOLFLARE";
|
|
23
|
-
return SolanaWallet2;
|
|
24
|
-
})(SolanaWallet || {});
|
|
25
|
-
var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
26
|
-
CosmosWallet2["KEPLR"] = "KEPLR";
|
|
27
|
-
CosmosWallet2["LEAP"] = "LEAP";
|
|
28
|
-
CosmosWallet2["COSMOSTATION"] = "COSMOSTATION";
|
|
29
|
-
return CosmosWallet2;
|
|
30
|
-
})(CosmosWallet || {});
|
|
31
|
-
const ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
|
|
32
|
-
export {
|
|
33
|
-
CosmosWallet,
|
|
34
|
-
EvmWallet,
|
|
35
|
-
ExternalWallet,
|
|
36
|
-
SolanaWallet
|
|
37
|
-
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"*.css"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
15
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
14
|
+
"@getpara/react-components": "2.0.0-alpha.22",
|
|
15
|
+
"@getpara/web-sdk": "2.0.0-alpha.22",
|
|
16
16
|
"@moonpay/moonpay-react": "^1.8.3",
|
|
17
17
|
"@ramp-network/ramp-instant-sdk": "^4.0.5",
|
|
18
18
|
"libphonenumber-js": "^1.11.1",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"resolutions": {
|
|
41
41
|
"styled-components": "^6"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e23258f6af4d3445bf4717a9e524c63e0088e159"
|
|
44
44
|
}
|