@getpara/react-common 2.0.0-alpha.7 → 2.0.0-alpha.71
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/README.md +13 -0
- package/dist/{chunk-GOCCUU3Z.js → chunk-MMUBH76A.js} +17 -0
- package/dist/classes/ParaInternal.d.ts +26 -7
- package/dist/classes/ParaInternal.js +22 -2
- package/dist/components/HeroSpinner.d.ts +4 -3
- package/dist/components/HeroSpinner.js +29 -15
- package/dist/components/KnownDevices.js +6 -7
- package/dist/components/MoonPayEmbed.d.ts +4 -2
- package/dist/components/MoonPayEmbed.js +57 -84
- package/dist/components/NetworkSpeedBanner.js +6 -6
- package/dist/components/QRCode.js +8 -8
- package/dist/components/RampEmbed.d.ts +2 -2
- package/dist/components/RampEmbed.js +17 -29
- package/dist/components/UserIdentifier.d.ts +8 -0
- package/dist/components/UserIdentifier.js +30 -22
- package/dist/components/WalletSelect.d.ts +33 -0
- package/dist/components/WalletSelect.js +171 -0
- package/dist/components/WalletTypeIcon.d.ts +9 -0
- package/dist/components/WalletTypeIcon.js +45 -0
- package/dist/components/WarningBanner.d.ts +7 -0
- package/dist/components/WarningBanner.js +60 -0
- package/dist/components/common.d.ts +3 -3
- package/dist/components/common.js +8 -8
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +3 -1
- package/dist/constants/aaguiMetadata.js +1 -1
- package/dist/constants/externalWalletDefaults.d.ts +50 -0
- package/dist/constants/externalWalletDefaults.js +52 -0
- package/dist/constants/index.d.ts +37 -0
- package/dist/constants/index.js +152 -0
- package/dist/constants/oAuthLogos.d.ts +12 -0
- package/dist/constants/oAuthLogos.js +160 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useCopyToClipboard.js +1 -1
- package/dist/hooks/useDropdownPosition.d.ts +7 -0
- package/dist/hooks/useDropdownPosition.js +33 -0
- package/dist/hooks/useUserAgent.d.ts +2 -0
- package/dist/hooks/useUserAgent.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/commonTypes.d.ts +15 -0
- package/dist/types/commonTypes.js +1 -0
- package/dist/types/externalWalletCommon.d.ts +75 -37
- package/dist/types/externalWalletCommon.js +0 -31
- package/dist/types/index.d.ts +8 -5
- package/dist/types/index.js +1 -0
- package/dist/utils/formatBiometricHints.d.ts +1 -1
- package/dist/utils/formatBiometricHints.js +3 -3
- package/dist/utils/getBrowserName.js +1 -1
- package/dist/utils/getDeviceLogo.js +1 -1
- package/dist/utils/getDeviceModelName.js +1 -1
- package/dist/utils/getExternalWalletDisplayName.d.ts +3 -1
- package/dist/utils/getExternalWalletDisplayName.js +7 -15
- package/dist/utils/getExternalWalletIcon.d.ts +5 -0
- package/dist/utils/getExternalWalletIcon.js +17 -0
- package/dist/utils/index.d.ts +18 -16
- package/dist/utils/index.js +27 -31
- package/dist/utils/openMobileUrl.d.ts +1 -0
- package/dist/utils/openMobileUrl.js +34 -0
- package/dist/utils/safeStyled.d.ts +2 -0
- package/dist/utils/safeStyled.js +25 -0
- package/package.json +22 -24
- package/dist/components/StripeEmbed.d.ts +0 -4
- package/dist/components/StripeEmbed.js +0 -138
- package/dist/utils/offRampSend.d.ts +0 -7
- package/dist/utils/offRampSend.js +0 -75
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { AuthStateLogin, AuthStateVerify, TWalletType } from '@getpara/web-sdk';
|
|
1
|
+
import ParaWeb, { AuthStateLogin, AuthStateVerify, ExternalWalletInfo, TExternalWallet, TWalletType, Wallet } from '@getpara/web-sdk';
|
|
2
|
+
export type DisconnectType = 'ACCOUNT_LINKING' | 'ACCOUNT_WIDGET';
|
|
3
|
+
export type MutationStatus = 'idle' | 'pending' | 'error' | 'success';
|
|
4
|
+
export type DisconnectBaseOptions = {
|
|
5
|
+
disconnectType?: DisconnectType;
|
|
6
|
+
};
|
|
2
7
|
export type WalletMetadata = {
|
|
3
8
|
id: string;
|
|
9
|
+
internalId: TExternalWallet;
|
|
4
10
|
name: string;
|
|
5
11
|
iconUrl: string;
|
|
6
12
|
rdns?: string;
|
|
@@ -26,17 +32,18 @@ export type WalletMetadata = {
|
|
|
26
32
|
linux?: string;
|
|
27
33
|
desktop?: string;
|
|
28
34
|
};
|
|
35
|
+
hasIosSafariExtension?: boolean;
|
|
29
36
|
};
|
|
30
37
|
export type CommonWallet = {
|
|
31
|
-
connect: () => Promise<{
|
|
38
|
+
connect: (isConnectionOnly?: boolean) => Promise<{
|
|
32
39
|
address?: string;
|
|
33
|
-
|
|
40
|
+
ethAddress?: string;
|
|
34
41
|
error?: string;
|
|
35
42
|
authState?: AuthStateLogin | AuthStateVerify;
|
|
36
43
|
}>;
|
|
37
|
-
connectMobile: (isManualWalletConnect?: boolean) => Promise<{
|
|
44
|
+
connectMobile: (isManualWalletConnect?: boolean, isConnectionOnly?: boolean) => Promise<{
|
|
38
45
|
address?: string;
|
|
39
|
-
|
|
46
|
+
ethAddress?: string;
|
|
40
47
|
error?: string;
|
|
41
48
|
authState?: AuthStateLogin | AuthStateVerify;
|
|
42
49
|
}>;
|
|
@@ -46,36 +53,67 @@ export type CommonChain = {
|
|
|
46
53
|
id: string | number;
|
|
47
54
|
name: string;
|
|
48
55
|
};
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
export
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
export
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
56
|
+
export type SignArgs = {
|
|
57
|
+
message: string;
|
|
58
|
+
externalWallet?: ExternalWalletInfo;
|
|
59
|
+
};
|
|
60
|
+
export type SignResult = {
|
|
61
|
+
address?: string;
|
|
62
|
+
signature?: string;
|
|
63
|
+
error?: string;
|
|
64
|
+
};
|
|
65
|
+
export type SwitchChainResult = {
|
|
66
|
+
error: string[];
|
|
67
|
+
} | void;
|
|
68
|
+
export type ConnectParaEmbedded = {
|
|
69
|
+
connectParaEmbedded: () => Promise<{
|
|
70
|
+
result?: unknown;
|
|
71
|
+
error?: string;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
74
|
+
export type ChainManagement<ChainId, R extends SwitchChainResult = SwitchChainResult> = {
|
|
75
|
+
chains: CommonChain[];
|
|
76
|
+
chainId?: ChainId;
|
|
77
|
+
switchChain: (_: ChainId) => Promise<R>;
|
|
78
|
+
};
|
|
79
|
+
export type BalanceManagement<B = string> = {
|
|
80
|
+
balance?: B;
|
|
81
|
+
getWalletBalance: () => Promise<B | undefined>;
|
|
82
|
+
};
|
|
83
|
+
export type FarcasterMiniAppManagement = {
|
|
84
|
+
farcasterStatus: {
|
|
85
|
+
isPresent: false;
|
|
86
|
+
} | {
|
|
87
|
+
isPresent: true;
|
|
88
|
+
isConnected: false;
|
|
89
|
+
address?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
isPresent: true;
|
|
92
|
+
isConnected: true;
|
|
93
|
+
address: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
};
|
|
96
|
+
export type ExternalWalletContextType<S extends SignResult = SignResult> = {
|
|
97
|
+
wallets: CommonWallet[];
|
|
98
|
+
disconnect: () => Promise<void>;
|
|
99
|
+
signMessage: (_: SignArgs) => Promise<S>;
|
|
100
|
+
signVerificationMessage: () => Promise<S>;
|
|
101
|
+
requestInfo: (_: string) => Promise<ExternalWalletInfo>;
|
|
102
|
+
disconnectBase: (_?: string, __?: DisconnectBaseOptions) => Promise<void>;
|
|
103
|
+
disconnectStatus: MutationStatus;
|
|
104
|
+
};
|
|
105
|
+
export type ExternalWalletProviderConfigBase = {
|
|
106
|
+
onSwitchWallet?: (args: {
|
|
107
|
+
address?: string;
|
|
108
|
+
error?: string;
|
|
109
|
+
}) => void;
|
|
110
|
+
para: ParaWeb;
|
|
111
|
+
walletsWithFullAuth: TExternalWallet[] | 'ALL';
|
|
112
|
+
includeWalletVerification?: boolean;
|
|
113
|
+
connectionOnly?: boolean;
|
|
114
|
+
connectedWallet?: Pick<Wallet, 'id' | 'type'> | null;
|
|
80
115
|
};
|
|
81
|
-
export type
|
|
116
|
+
export type ExternalWalletProviderConfig<W, P = {}> = ExternalWalletProviderConfigBase & {
|
|
117
|
+
wallets: W[];
|
|
118
|
+
} & P;
|
|
119
|
+
export { type TExternalWallet };
|
|
@@ -1,32 +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
|
-
return EvmWallet2;
|
|
14
|
-
})(EvmWallet || {});
|
|
15
|
-
var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
|
|
16
|
-
SolanaWallet2["PHANTOM"] = "PHANTOM";
|
|
17
|
-
SolanaWallet2["GLOW"] = "GLOW";
|
|
18
|
-
SolanaWallet2["BACKPACK"] = "BACKPACK";
|
|
19
|
-
return SolanaWallet2;
|
|
20
|
-
})(SolanaWallet || {});
|
|
21
|
-
var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
|
|
22
|
-
CosmosWallet2["KEPLR"] = "KEPLR";
|
|
23
|
-
CosmosWallet2["LEAP"] = "LEAP";
|
|
24
|
-
return CosmosWallet2;
|
|
25
|
-
})(CosmosWallet || {});
|
|
26
|
-
const ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
|
|
27
|
-
export {
|
|
28
|
-
CosmosWallet,
|
|
29
|
-
EvmWallet,
|
|
30
|
-
ExternalWallet,
|
|
31
|
-
SolanaWallet
|
|
32
|
-
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { AuthInfo } from '@getpara/user-management-client';
|
|
2
|
-
import
|
|
1
|
+
import { AuthInfo, OnRampPurchaseUpdateParams } from '@getpara/user-management-client';
|
|
2
|
+
import { OfframpDepositRequest, type OnRampConfig, type OnRampPurchase } from '@getpara/web-sdk';
|
|
3
3
|
export * from './externalWalletCommon.js';
|
|
4
|
-
export
|
|
4
|
+
export * from './commonTypes.js';
|
|
5
|
+
export type OnRampProps = {
|
|
5
6
|
appName?: string;
|
|
6
|
-
|
|
7
|
+
email?: string;
|
|
7
8
|
isDark?: boolean;
|
|
8
9
|
isEmbedded?: boolean;
|
|
9
10
|
onClose?: () => void;
|
|
10
11
|
onRampConfig: OnRampConfig;
|
|
11
12
|
onRampPurchase: OnRampPurchase;
|
|
12
|
-
|
|
13
|
+
onDepositRequest: (_: OfframpDepositRequest) => Promise<string>;
|
|
14
|
+
onUpdate: (_: OnRampPurchaseUpdateParams) => Promise<void>;
|
|
15
|
+
onSuccess: (_: OnRampPurchaseUpdateParams) => Promise<void>;
|
|
13
16
|
};
|
|
14
17
|
export type ModalAuthInfo = AuthInfo & Partial<{
|
|
15
18
|
pfpUrl: string | null;
|
package/dist/types/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export type BiometricHints = {
|
|
|
10
10
|
isOnKnownDevice: boolean;
|
|
11
11
|
formattedHints: FormattedBiometricHint[];
|
|
12
12
|
};
|
|
13
|
-
export declare const formatBiometricHints: (hints: BiometricLocationHint[]) => BiometricHints;
|
|
13
|
+
export declare const formatBiometricHints: (hints: BiometricLocationHint[], isPasskeySupported?: boolean) => BiometricHints;
|
|
14
14
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
5
5
|
import { UAParser } from "ua-parser-js";
|
|
6
6
|
import { aaguidMetadata } from "../constants/aaguiMetadata.js";
|
|
7
7
|
const formatStringToUUID = (str) => {
|
|
@@ -10,7 +10,7 @@ const formatStringToUUID = (str) => {
|
|
|
10
10
|
}
|
|
11
11
|
return `${str.slice(0, 8)}-${str.slice(8, 12)}-${str.slice(12, 16)}-${str.slice(16, 20)}-${str.slice(20)}`;
|
|
12
12
|
};
|
|
13
|
-
const formatBiometricHints = (hints) => {
|
|
13
|
+
const formatBiometricHints = (hints, isPasskeySupported = false) => {
|
|
14
14
|
let hasMobileDevice = false, isOnKnownDevice = false;
|
|
15
15
|
const deviceParsedUA = UAParser();
|
|
16
16
|
const formattedHintsByKey = {};
|
|
@@ -24,7 +24,7 @@ const formatBiometricHints = (hints) => {
|
|
|
24
24
|
hasMobileDevice = true;
|
|
25
25
|
}
|
|
26
26
|
if (deviceParsedUA) {
|
|
27
|
-
if (deviceParsedUA.browser.name === parsedUA.browser.name && deviceParsedUA.device.type === parsedUA.device.type && deviceParsedUA.device.vendor === parsedUA.device.vendor && deviceParsedUA.device.model === parsedUA.device.model) {
|
|
27
|
+
if (isPasskeySupported && deviceParsedUA.browser.name === parsedUA.browser.name && deviceParsedUA.device.type === parsedUA.device.type && deviceParsedUA.device.vendor === parsedUA.device.vendor && deviceParsedUA.device.model === parsedUA.device.model) {
|
|
28
28
|
isOnKnownDevice = true;
|
|
29
29
|
isKnownDevice = true;
|
|
30
30
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ExternalWalletInfo } from '@getpara/user-management-client';
|
|
2
|
-
export declare const getExternalWalletDisplayName: ({ address, type, addressBech32 }: ExternalWalletInfo
|
|
2
|
+
export declare const getExternalWalletDisplayName: ({ address, type, providerId, addressBech32 }: ExternalWalletInfo, { withAddress }?: {
|
|
3
|
+
withAddress?: boolean;
|
|
4
|
+
}) => string;
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import "../chunk-
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
3
|
import { truncateAddress } from "@getpara/web-sdk";
|
|
4
|
-
const getExternalWalletDisplayName = ({ address, type, addressBech32 }) => {
|
|
4
|
+
const getExternalWalletDisplayName = ({ address, type, providerId, addressBech32 }, { withAddress = false } = {}) => {
|
|
5
5
|
const walletType = type;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
case "SOLANA":
|
|
12
|
-
walletTypeDisplay = "Solana";
|
|
13
|
-
break;
|
|
14
|
-
case "COSMOS":
|
|
15
|
-
walletTypeDisplay = "Cosmos";
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
return `${walletTypeDisplay} ${truncateAddress(addressBech32 != null ? addressBech32 : address, walletType)}`;
|
|
6
|
+
return `${providerId != null ? providerId : {
|
|
7
|
+
EVM: "EVM",
|
|
8
|
+
SOLANA: "Solana",
|
|
9
|
+
COSMOS: "Cosmos"
|
|
10
|
+
}[type]}${withAddress ? ` ${truncateAddress(addressBech32 != null ? addressBech32 : address, walletType)}` : ""}`;
|
|
19
11
|
};
|
|
20
12
|
export {
|
|
21
13
|
getExternalWalletDisplayName
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { ACCOUNT_TYPES } from "../constants/oAuthLogos.js";
|
|
4
|
+
function getExternalWalletIcon(internalId, { branded = false } = {}) {
|
|
5
|
+
var _a;
|
|
6
|
+
if (!internalId) {
|
|
7
|
+
return "wallet02";
|
|
8
|
+
}
|
|
9
|
+
const data = (_a = ACCOUNT_TYPES) == null ? void 0 : _a[internalId];
|
|
10
|
+
if (!data) {
|
|
11
|
+
return "wallet02";
|
|
12
|
+
}
|
|
13
|
+
return branded ? data.iconBranded || data.icon : data.icon;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
getExternalWalletIcon
|
|
17
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TOnRampAsset, OnRampAssetInfo, OnRampProvider, TNetwork, OnRampPurchaseType, OnRampConfig, TWalletType } from '@getpara/user-management-client';
|
|
2
2
|
export declare function getCurrencyCode({ assetInfo }: OnRampConfig, { network, asset, provider }: {
|
|
3
|
-
network:
|
|
4
|
-
asset:
|
|
3
|
+
network: TNetwork;
|
|
4
|
+
asset: TOnRampAsset;
|
|
5
5
|
provider: OnRampProvider;
|
|
6
6
|
}): string | undefined;
|
|
7
7
|
export declare function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRampNetwork, defaultOnRampAsset }: OnRampConfig, { provider, purchaseType, walletType, }: {
|
|
@@ -12,29 +12,31 @@ export declare function getCurrencyCodes({ assetInfo, allowedAssets, defaultOnRa
|
|
|
12
12
|
currencyCodes: string[];
|
|
13
13
|
defaultCurrencyCode?: string;
|
|
14
14
|
};
|
|
15
|
-
export declare function reverseCurrencyLookup(data: OnRampAssetInfo, provider: OnRampProvider, code: string): [
|
|
15
|
+
export declare function reverseCurrencyLookup(data: OnRampAssetInfo, provider: OnRampProvider, code: string): [TNetwork, TOnRampAsset];
|
|
16
16
|
export declare const TestNetworks: {
|
|
17
|
-
main:
|
|
18
|
-
test:
|
|
17
|
+
main: TNetwork;
|
|
18
|
+
test: TNetwork;
|
|
19
19
|
}[];
|
|
20
|
-
export declare function getNetworkTestEquivalent(network:
|
|
21
|
-
export declare function getNetworkOrMainNetEquivalent(network:
|
|
20
|
+
export declare function getNetworkTestEquivalent(network: TNetwork): TNetwork | undefined;
|
|
21
|
+
export declare function getNetworkOrMainNetEquivalent(network: TNetwork, testMode?: boolean): TNetwork;
|
|
22
22
|
export declare const NetworkChainIds: {
|
|
23
23
|
chainId: string;
|
|
24
|
-
network:
|
|
24
|
+
network: TNetwork;
|
|
25
25
|
}[];
|
|
26
|
-
export declare function getChainId(network:
|
|
27
|
-
export declare function getNetworkFromChainId(chainId?: string | undefined):
|
|
26
|
+
export declare function getChainId(network: TNetwork): string | undefined;
|
|
27
|
+
export declare function getNetworkFromChainId(chainId?: string | undefined): TNetwork | undefined;
|
|
28
28
|
export declare const NetworkAssetAddresses: {
|
|
29
|
-
network:
|
|
30
|
-
asset:
|
|
29
|
+
network: TNetwork;
|
|
30
|
+
asset: TOnRampAsset;
|
|
31
31
|
address: string;
|
|
32
32
|
}[];
|
|
33
|
-
export declare function getAssetFromContractAddress(network:
|
|
34
|
-
export declare function getContractAddressFromAsset(network:
|
|
35
|
-
export * from './offRampSend.js';
|
|
33
|
+
export declare function getAssetFromContractAddress(network: TNetwork, contractAddress: string): TOnRampAsset | undefined;
|
|
34
|
+
export declare function getContractAddressFromAsset(network: TNetwork, asset: TOnRampAsset): string | undefined;
|
|
36
35
|
export * from './getDeviceLogo.js';
|
|
37
36
|
export * from './getDeviceModelName.js';
|
|
38
37
|
export * from './getBrowserName.js';
|
|
39
38
|
export * from './formatBiometricHints.js';
|
|
40
39
|
export * from './getExternalWalletDisplayName.js';
|
|
40
|
+
export * from './getExternalWalletIcon.js';
|
|
41
|
+
export * from './safeStyled.js';
|
|
42
|
+
export * from './openMobileUrl.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
__spreadValues
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import {
|
|
6
|
-
OnRampAsset,
|
|
7
|
-
Network,
|
|
8
|
-
getOnRampNetworks,
|
|
9
|
-
getOnRampAssets,
|
|
10
|
-
toAssetInfoArray
|
|
11
|
-
} from "@getpara/web-sdk";
|
|
4
|
+
} from "../chunk-MMUBH76A.js";
|
|
5
|
+
import { getOnRampNetworks, getOnRampAssets, toAssetInfoArray } from "@getpara/core-sdk";
|
|
12
6
|
function getCurrencyCode({ assetInfo }, { network, asset, provider }) {
|
|
13
7
|
var _a, _b, _c;
|
|
14
8
|
return (_c = (_b = (_a = Object.values(assetInfo).reduce((acc, record) => __spreadValues(__spreadValues({}, acc), record), {})[network]) == null ? void 0 : _a[asset]) == null ? void 0 : _b[provider]) == null ? void 0 : _c[0];
|
|
@@ -44,8 +38,8 @@ function reverseCurrencyLookup(data, provider, code) {
|
|
|
44
38
|
return [row == null ? void 0 : row[1], row == null ? void 0 : row[2]];
|
|
45
39
|
}
|
|
46
40
|
const TestNetworks = [
|
|
47
|
-
{ main:
|
|
48
|
-
{ main:
|
|
41
|
+
{ main: "ETHEREUM", test: "SEPOLIA" },
|
|
42
|
+
{ main: "SOLANA", test: "SOLANA_DEVNET" }
|
|
49
43
|
];
|
|
50
44
|
function getNetworkTestEquivalent(network) {
|
|
51
45
|
var _a;
|
|
@@ -56,13 +50,13 @@ function getNetworkOrMainNetEquivalent(network, testMode) {
|
|
|
56
50
|
return testMode ? (_b = (_a = TestNetworks.find(({ test }) => test === network)) == null ? void 0 : _a.main) != null ? _b : network : network;
|
|
57
51
|
}
|
|
58
52
|
const NetworkChainIds = [
|
|
59
|
-
{ chainId: "11155111", network:
|
|
60
|
-
{ chainId: "1", network:
|
|
61
|
-
{ chainId: "137", network:
|
|
62
|
-
{ chainId: "42220", network:
|
|
63
|
-
{ chainId: "8453", network:
|
|
64
|
-
{ chainId: "42161", network:
|
|
65
|
-
{ chainId: "10", network:
|
|
53
|
+
{ chainId: "11155111", network: "SEPOLIA" },
|
|
54
|
+
{ chainId: "1", network: "ETHEREUM" },
|
|
55
|
+
{ chainId: "137", network: "POLYGON" },
|
|
56
|
+
{ chainId: "42220", network: "CELO" },
|
|
57
|
+
{ chainId: "8453", network: "BASE" },
|
|
58
|
+
{ chainId: "42161", network: "ARBITRUM" },
|
|
59
|
+
{ chainId: "10", network: "OPTIMISM" }
|
|
66
60
|
];
|
|
67
61
|
function getChainId(network) {
|
|
68
62
|
var _a, _b;
|
|
@@ -74,40 +68,42 @@ function getNetworkFromChainId(chainId) {
|
|
|
74
68
|
}
|
|
75
69
|
const ETH_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
76
70
|
const NetworkAssetAddresses = [
|
|
77
|
-
{ network:
|
|
78
|
-
{ network:
|
|
79
|
-
{ network:
|
|
80
|
-
{ network:
|
|
81
|
-
{ network:
|
|
82
|
-
{ network:
|
|
83
|
-
{ network:
|
|
84
|
-
{ network:
|
|
85
|
-
{ network:
|
|
86
|
-
{ network:
|
|
71
|
+
{ network: "ETHEREUM", asset: "USDC", address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" },
|
|
72
|
+
{ network: "POLYGON", asset: "USDC", address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359" },
|
|
73
|
+
{ network: "CELO", asset: "USDC", address: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C" },
|
|
74
|
+
{ network: "BASE", asset: "USDC", address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913" },
|
|
75
|
+
{ network: "ARBITRUM", asset: "USDC", address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831" },
|
|
76
|
+
{ network: "OPTIMISM", asset: "USDC", address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85" },
|
|
77
|
+
{ network: "SOLANA", asset: "USDC", address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" },
|
|
78
|
+
{ network: "SOLANA_DEVNET", asset: "USDC", address: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU" },
|
|
79
|
+
{ network: "SEPOLIA", asset: "USDC", address: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238" },
|
|
80
|
+
{ network: "SOLANA_DEVNET", asset: "TETHER", address: "EJwZgeZrdC8TXTQbQBoL6bfuAnFUUy1PVCMB4DYPzVaS" }
|
|
87
81
|
];
|
|
88
82
|
function getAssetFromContractAddress(network, contractAddress) {
|
|
89
83
|
var _a, _b;
|
|
90
84
|
if (contractAddress === ETH_CONTRACT_ADDRESS) {
|
|
91
|
-
return
|
|
85
|
+
return "USDC";
|
|
92
86
|
}
|
|
93
|
-
const checkNetworks = [network, (_a = getNetworkOrMainNetEquivalent(network)) != null ? _a : void 0].filter((n) => !!n).map((n) =>
|
|
87
|
+
const checkNetworks = [network, (_a = getNetworkOrMainNetEquivalent(network)) != null ? _a : void 0].filter((n) => !!n).map((n) => n);
|
|
94
88
|
return (_b = NetworkAssetAddresses.find(
|
|
95
89
|
(row) => checkNetworks.includes(row.network) && row.asset.toLowerCase() === contractAddress.toLowerCase()
|
|
96
90
|
)) == null ? void 0 : _b.asset;
|
|
97
91
|
}
|
|
98
92
|
function getContractAddressFromAsset(network, asset) {
|
|
99
93
|
var _a;
|
|
100
|
-
if (asset ===
|
|
94
|
+
if (asset === "USDC") {
|
|
101
95
|
return ETH_CONTRACT_ADDRESS;
|
|
102
96
|
}
|
|
103
97
|
return (_a = NetworkAssetAddresses.find((row) => row.network === network && row.asset === asset)) == null ? void 0 : _a.address;
|
|
104
98
|
}
|
|
105
|
-
export * from "./offRampSend.js";
|
|
106
99
|
export * from "./getDeviceLogo.js";
|
|
107
100
|
export * from "./getDeviceModelName.js";
|
|
108
101
|
export * from "./getBrowserName.js";
|
|
109
102
|
export * from "./formatBiometricHints.js";
|
|
110
103
|
export * from "./getExternalWalletDisplayName.js";
|
|
104
|
+
export * from "./getExternalWalletIcon.js";
|
|
105
|
+
export * from "./safeStyled.js";
|
|
106
|
+
export * from "./openMobileUrl.js";
|
|
111
107
|
export {
|
|
112
108
|
NetworkAssetAddresses,
|
|
113
109
|
NetworkChainIds,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const openMobileUrl: (url?: string) => void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import { isAndroid, isMobile, isTelegram } from "@getpara/web-sdk";
|
|
4
|
+
const openMobileUrl = (url) => {
|
|
5
|
+
if (typeof window === "undefined") {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
if (isMobile()) {
|
|
9
|
+
if (!url) return;
|
|
10
|
+
if (isTelegram()) {
|
|
11
|
+
let href = url;
|
|
12
|
+
if (isAndroid()) {
|
|
13
|
+
try {
|
|
14
|
+
const decoded = decodeURI(url);
|
|
15
|
+
href = decoded === url ? encodeURI(url) : url;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
href = encodeURI(url);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
window.open(href, "_blank", "noreferrer noopener");
|
|
21
|
+
} else if (url.startsWith("http")) {
|
|
22
|
+
const link = document.createElement("a");
|
|
23
|
+
link.href = url;
|
|
24
|
+
link.target = "_blank";
|
|
25
|
+
link.rel = "noreferrer noopener";
|
|
26
|
+
link.click();
|
|
27
|
+
} else {
|
|
28
|
+
window.location.href = url;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
openMobileUrl
|
|
34
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../chunk-MMUBH76A.js";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
const createStubComponent = () => {
|
|
5
|
+
const StubComponent = () => null;
|
|
6
|
+
StubComponent.attrs = () => createStubComponent();
|
|
7
|
+
StubComponent.withConfig = () => createStubComponent();
|
|
8
|
+
return StubComponent;
|
|
9
|
+
};
|
|
10
|
+
const createStubStyled = () => {
|
|
11
|
+
const styledStub = () => createStubComponent();
|
|
12
|
+
const handler = {
|
|
13
|
+
get: (_target, _prop) => {
|
|
14
|
+
return createStubComponent;
|
|
15
|
+
},
|
|
16
|
+
apply: () => {
|
|
17
|
+
return createStubComponent();
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return new Proxy(styledStub, handler);
|
|
21
|
+
};
|
|
22
|
+
const safeStyled = typeof window !== "undefined" ? styled : createStubStyled();
|
|
23
|
+
export {
|
|
24
|
+
safeStyled
|
|
25
|
+
};
|
package/package.json
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-common",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./dist/index.js"
|
|
9
|
-
},
|
|
10
|
-
"sideEffects": [
|
|
11
|
-
"*.css"
|
|
12
|
-
],
|
|
3
|
+
"version": "2.0.0-alpha.71",
|
|
13
4
|
"dependencies": {
|
|
14
|
-
"@getpara/react-components": "2.0.0-alpha.
|
|
15
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
5
|
+
"@getpara/react-components": "2.0.0-alpha.71",
|
|
6
|
+
"@getpara/web-sdk": "2.0.0-alpha.71",
|
|
16
7
|
"@moonpay/moonpay-react": "^1.8.3",
|
|
17
8
|
"@ramp-network/ramp-instant-sdk": "^4.0.5",
|
|
18
|
-
"
|
|
19
|
-
"@stripe/stripe-js": "^3.4.0",
|
|
20
|
-
"libphonenumber-js": "^1.11.1",
|
|
9
|
+
"libphonenumber-js": "^1.11.7",
|
|
21
10
|
"styled-components": "^6.1.8",
|
|
22
11
|
"ua-parser-js": "^2.0.2"
|
|
23
12
|
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
|
|
26
|
-
"typegen": "tsc --emitDeclarationOnly"
|
|
27
|
-
},
|
|
28
13
|
"devDependencies": {
|
|
29
14
|
"@types/react": "^18.0.31",
|
|
30
15
|
"@types/react-dom": "^18.2.7",
|
|
31
|
-
"typescript": "^5.
|
|
16
|
+
"typescript": "^5.8.3"
|
|
32
17
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"react-dom": "*"
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./dist/index.js"
|
|
36
20
|
},
|
|
37
21
|
"files": [
|
|
38
22
|
"dist",
|
|
39
23
|
"package.json",
|
|
40
24
|
"styles.css"
|
|
41
25
|
],
|
|
26
|
+
"main": "dist/index.js",
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"react": "*",
|
|
29
|
+
"react-dom": "*"
|
|
30
|
+
},
|
|
42
31
|
"resolutions": {
|
|
43
32
|
"styled-components": "^6"
|
|
44
33
|
},
|
|
45
|
-
"
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs",
|
|
36
|
+
"typegen": "tsc --emitDeclarationOnly"
|
|
37
|
+
},
|
|
38
|
+
"sideEffects": [
|
|
39
|
+
"*.css"
|
|
40
|
+
],
|
|
41
|
+
"type": "module",
|
|
42
|
+
"types": "dist/index.d.ts",
|
|
43
|
+
"gitHead": "30e5bad6a141f1b56959432f11aaf1536b84dece"
|
|
46
44
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Props } from '../types/index.js';
|
|
2
|
-
export declare const STRIPE_PUBLISHABLE_KEY = "pk_live_51MvquNGrzDeP5yP9EgVSMBPQbrbg0oHDjPIIXypePd0jzOFjbadyfO7wBKLHhUtbKIUiEUVC3YYcTJyAmJ8xA7JE00T2UDfYKz";
|
|
3
|
-
export declare const STRIPE_PUBLISHABLE_KEY_TEST = "pk_test_51MvquNGrzDeP5yP98WgPaAUgQ50I3OpfPhVfiLO47FBHepJnZRPO62IzZY2uxT5ovhSS10RwcTcnaVil1mcJOzIi00dHapODdS";
|
|
4
|
-
export declare const StripeEmbed: ({ para, isDark, isEmbedded, onRampPurchase, setOnRampPurchase }: Props) => import("react/jsx-runtime").JSX.Element;
|