@getpara/core-sdk 1.0.2 → 1.1.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.
Files changed (65) hide show
  1. package/dist/cjs/ParaCore.js +125 -223
  2. package/dist/cjs/constants.js +20 -0
  3. package/dist/cjs/cryptography/utils.js +2 -2
  4. package/dist/cjs/external/userManagementClient.js +14 -14
  5. package/dist/cjs/index.js +28 -12
  6. package/dist/cjs/types/config.js +22 -0
  7. package/dist/cjs/types/index.js +11 -2
  8. package/dist/cjs/types/onRamps.js +10 -0
  9. package/dist/cjs/types/recovery.js +12 -0
  10. package/dist/cjs/types/wallet.js +9 -0
  11. package/dist/cjs/utils/events.js +9 -0
  12. package/dist/cjs/utils/{formattingUtils.js → formatting.js} +11 -1
  13. package/dist/cjs/utils/index.js +22 -0
  14. package/dist/cjs/utils/onRamps.js +36 -0
  15. package/dist/cjs/utils/url.js +74 -0
  16. package/dist/cjs/utils/wallet.js +74 -0
  17. package/dist/esm/ParaCore.js +74 -165
  18. package/dist/esm/constants.js +17 -0
  19. package/dist/esm/cryptography/utils.js +1 -1
  20. package/dist/esm/external/userManagementClient.js +1 -1
  21. package/dist/esm/index.js +12 -8
  22. package/dist/esm/types/config.js +19 -0
  23. package/dist/esm/types/index.js +6 -2
  24. package/dist/esm/types/onRamps.js +7 -0
  25. package/dist/esm/types/recovery.js +9 -0
  26. package/dist/esm/types/wallet.js +6 -0
  27. package/dist/esm/utils/events.js +5 -0
  28. package/dist/esm/utils/{formattingUtils.js → formatting.js} +8 -0
  29. package/dist/esm/utils/index.js +6 -0
  30. package/dist/esm/utils/onRamps.js +30 -0
  31. package/dist/esm/utils/url.js +66 -0
  32. package/dist/esm/utils/wallet.js +64 -0
  33. package/dist/types/ParaCore.d.ts +4 -167
  34. package/dist/types/PlatformUtils.d.ts +1 -3
  35. package/dist/types/constants.d.ts +17 -0
  36. package/dist/types/cryptography/utils.d.ts +1 -1
  37. package/dist/types/external/userManagementClient.d.ts +1 -1
  38. package/dist/types/index.d.ts +12 -10
  39. package/dist/types/shares/recovery.d.ts +1 -1
  40. package/dist/types/shares/shareDistribution.d.ts +1 -1
  41. package/dist/types/types/config.d.ts +162 -0
  42. package/dist/types/types/events.d.ts +10 -10
  43. package/dist/types/types/index.d.ts +6 -2
  44. package/dist/types/types/onRamps.d.ts +10 -0
  45. package/dist/types/types/recovery.d.ts +7 -0
  46. package/dist/types/types/wallet.d.ts +39 -0
  47. package/dist/types/utils/events.d.ts +2 -0
  48. package/dist/types/utils/{formattingUtils.d.ts → formatting.d.ts} +3 -1
  49. package/dist/types/utils/index.d.ts +6 -0
  50. package/dist/types/utils/onRamps.d.ts +12 -0
  51. package/dist/types/utils/url.d.ts +15 -0
  52. package/dist/types/utils/wallet.d.ts +10 -0
  53. package/package.json +3 -3
  54. package/dist/cjs/definitions.js +0 -153
  55. package/dist/cjs/types/walletTypes.js +0 -2
  56. package/dist/esm/definitions.js +0 -140
  57. package/dist/esm/types/walletTypes.js +0 -1
  58. package/dist/types/definitions.d.ts +0 -86
  59. package/dist/types/types/walletTypes.d.ts +0 -11
  60. /package/dist/cjs/types/{popupTypes.js → popup.js} +0 -0
  61. /package/dist/cjs/utils/{pollingUtils.js → polling.js} +0 -0
  62. /package/dist/esm/types/{popupTypes.js → popup.js} +0 -0
  63. /package/dist/esm/utils/{pollingUtils.js → polling.js} +0 -0
  64. /package/dist/types/types/{popupTypes.d.ts → popup.d.ts} +0 -0
  65. /package/dist/types/utils/{pollingUtils.d.ts → polling.d.ts} +0 -0
@@ -0,0 +1,6 @@
1
+ export * from './events.js';
2
+ export * from './formatting.js';
3
+ export * from './onRamps.js';
4
+ export * from './polling.js';
5
+ export * from './url.js';
6
+ export * from './wallet.js';
@@ -0,0 +1,30 @@
1
+ export function toAssetInfoArray(data) {
2
+ const result = [];
3
+ Object.keys(data).forEach(walletType => {
4
+ const networks = data[walletType];
5
+ Object.keys(networks).forEach(network => {
6
+ const assets = networks[network];
7
+ Object.keys(assets).forEach(asset => {
8
+ const providerInfo = assets[asset];
9
+ result.push([walletType, network, asset, providerInfo]);
10
+ });
11
+ });
12
+ });
13
+ return result;
14
+ }
15
+ export function getOnRampNetworks(data, { walletType, allowed } = {}) {
16
+ return [
17
+ ...new Set(toAssetInfoArray(data)
18
+ .filter(([type, network]) => (!walletType || type === walletType) && (!allowed || allowed.includes(network)))
19
+ .map(([_, network]) => network)),
20
+ ];
21
+ }
22
+ export function getOnRampAssets(data, { walletType, network, allowed, } = {}) {
23
+ return [
24
+ ...new Set(toAssetInfoArray(data)
25
+ .filter(([t, n, a]) => (!walletType || t === walletType) &&
26
+ (!network || n === network) &&
27
+ (!Array.isArray(allowed) || allowed.includes(a)))
28
+ .map(([, , asset]) => asset)),
29
+ ];
30
+ }
@@ -0,0 +1,66 @@
1
+ import { Environment } from '../types/index.js';
2
+ export function getPortalDomain(env, isE2E) {
3
+ if (isE2E) {
4
+ return `localhost`;
5
+ }
6
+ switch (env) {
7
+ case Environment.DEV:
8
+ return 'localhost';
9
+ case Environment.SANDBOX:
10
+ return 'app.sandbox.usecapsule.com';
11
+ case Environment.BETA:
12
+ return 'app.beta.usecapsule.com';
13
+ case Environment.PROD:
14
+ return 'app.usecapsule.com';
15
+ default:
16
+ throw new Error(`env: ${env} not supported`);
17
+ }
18
+ }
19
+ export function getPortalBaseURL({ env, isE2E }, useLocalIp, isForWasm) {
20
+ if (isE2E) {
21
+ if (isForWasm) {
22
+ return `https://app.sandbox.usecapsule.com`;
23
+ }
24
+ return `http://localhost:3003`;
25
+ }
26
+ const domain = getPortalDomain(env);
27
+ if (env === Environment.DEV) {
28
+ if (useLocalIp) {
29
+ return `http://127.0.0.1:3003`;
30
+ }
31
+ return `http://${domain}:3003`;
32
+ }
33
+ return `https://${domain}`;
34
+ }
35
+ export function getParaConnectDomain(env) {
36
+ switch (env) {
37
+ case Environment.DEV:
38
+ return 'localhost';
39
+ case Environment.SANDBOX:
40
+ return 'connect.sandbox.getpara.com';
41
+ case Environment.BETA:
42
+ return 'connect.beta.getpara.com';
43
+ case Environment.PROD:
44
+ return 'connect.getpara.com';
45
+ default:
46
+ throw new Error(`env: ${env} not supported`);
47
+ }
48
+ }
49
+ export function getParaConnectBaseUrl({ env }, useLocalIp) {
50
+ const domain = getParaConnectDomain(env);
51
+ if (env === Environment.DEV) {
52
+ if (useLocalIp) {
53
+ return `http://127.0.0.1:3008`;
54
+ }
55
+ return `http://${domain}:3008`;
56
+ }
57
+ return `https://${domain}`;
58
+ }
59
+ export function constructUrl({ base, path, params = {}, }) {
60
+ const url = new URL(path, base);
61
+ Object.entries(params).forEach(([key, value]) => {
62
+ if (!!value && value !== 'undefined' && value !== 'null')
63
+ url.searchParams.set(key, value.toString());
64
+ });
65
+ return url.toString();
66
+ }
@@ -0,0 +1,64 @@
1
+ import { WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import { stringToPhoneNumber } from './formatting.js';
3
+ export const WalletSchemeTypeMap = {
4
+ [WalletScheme.DKLS]: {
5
+ [WalletType.EVM]: true,
6
+ [WalletType.COSMOS]: true,
7
+ },
8
+ [WalletScheme.CGGMP]: {
9
+ [WalletType.EVM]: true,
10
+ [WalletType.COSMOS]: true,
11
+ },
12
+ [WalletScheme.ED25519]: {
13
+ [WalletType.SOLANA]: true,
14
+ },
15
+ };
16
+ export function isPregenIdentifierMatch(a, b, type) {
17
+ if (!a || !b) {
18
+ return false;
19
+ }
20
+ switch (type) {
21
+ case 'EMAIL':
22
+ return a.toLowerCase() === b.toLowerCase();
23
+ case 'PHONE':
24
+ return stringToPhoneNumber(a) === stringToPhoneNumber(b);
25
+ case 'CUSTOM_ID':
26
+ return a === b;
27
+ default:
28
+ return a.replace(/^@/g, '').toLowerCase() === b.replace(/^@/g, '').toLowerCase();
29
+ }
30
+ }
31
+ export function isWalletSupported(types, wallet) {
32
+ return types.some((walletType) => !!WalletSchemeTypeMap[wallet.scheme][walletType]);
33
+ }
34
+ export function getSchemes(types) {
35
+ return Object.keys(WalletSchemeTypeMap).filter(scheme => {
36
+ if (scheme === WalletScheme.CGGMP) {
37
+ return false;
38
+ }
39
+ return (Array.isArray(types) ? types : Object.keys(types)).some(type => WalletSchemeTypeMap[scheme][type]);
40
+ });
41
+ }
42
+ export function getWalletTypes(schemes) {
43
+ return [
44
+ ...new Set(schemes.reduce((acc, scheme) => {
45
+ return [...acc, ...Object.keys(WalletSchemeTypeMap[scheme]).filter(type => WalletSchemeTypeMap[scheme][type])];
46
+ }, [])),
47
+ ];
48
+ }
49
+ export function getEquivalentTypes(types) {
50
+ return getWalletTypes(getSchemes((Array.isArray(types) ? types : [types]).map(t => WalletType[t])));
51
+ }
52
+ export function entityToWallet(w) {
53
+ return Object.assign(Object.assign({}, w), { scheme: w.scheme, type: w.type, pregenIdentifierType: w.pregenIdentifierType });
54
+ }
55
+ export function migrateWallet(obj) {
56
+ if (['USER', 'PREGEN'].includes(obj.type)) {
57
+ obj.isPregen = obj.type === 'PREGEN';
58
+ obj.type = obj.scheme === WalletScheme.ED25519 ? WalletType.SOLANA : WalletType.EVM;
59
+ }
60
+ if (!!obj.scheme && !obj.type) {
61
+ obj.type = obj.scheme === WalletScheme.ED25519 ? WalletType.SOLANA : WalletType.EVM;
62
+ }
63
+ return obj;
64
+ }
@@ -1,170 +1,8 @@
1
- import Client, { AuthMethod, AuthType, BackupKitEmailProps, CurrentWalletIds, EmailTheme, PartnerEntity, WalletEntity, WalletType, WalletScheme, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth } from '@getpara/user-management-client';
1
+ import Client, { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth } from '@getpara/user-management-client';
2
2
  import type { pki as pkiType } from 'node-forge';
3
- import { Ctx, Environment, WalletFilters, WalletTypeProp } from './definitions.js';
4
- import { Theme, FullSignatureRes, EmbeddedWalletType, ExternalWalletType, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResp, LoginResp } from './types/index.js';
3
+ import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus } from './types/index.js';
5
4
  import { PlatformUtils } from './PlatformUtils.js';
6
5
  import { CountryCallingCode } from 'libphonenumber-js';
7
- export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
8
- export type SupportedWalletTypeConfig = {
9
- optional?: boolean;
10
- };
11
- export type deprecated__SupportedWalletTypesOpt = {
12
- [WalletType.EVM]?: boolean | SupportedWalletTypeConfig;
13
- [WalletType.SOLANA]?: boolean | SupportedWalletTypeConfig;
14
- [WalletType.COSMOS]?: boolean | (SupportedWalletTypeConfig & {
15
- prefix?: string;
16
- });
17
- };
18
- export type SupportedWalletTypes = {
19
- type: WalletType;
20
- optional?: boolean;
21
- }[];
22
- export declare enum RecoveryStatus {
23
- INITIATED = "INITIATED",
24
- READY = "READY",
25
- EXPIRED = "EXPIRED",
26
- FINISHED = "FINISHED",
27
- CANCELLED = "CANCELLED"
28
- }
29
- /** @deprecated */
30
- export declare enum PregenIdentifierType {
31
- EMAIL = "EMAIL",
32
- PHONE = "PHONE"
33
- }
34
- export interface Wallet {
35
- createdAt?: string;
36
- id: string;
37
- name?: string;
38
- signer: string;
39
- address?: string;
40
- addressSecondary?: string;
41
- publicKey?: string;
42
- scheme?: WalletScheme;
43
- type?: EmbeddedWalletType | ExternalWalletType;
44
- isPregen?: boolean;
45
- pregenIdentifier?: string;
46
- pregenIdentifierType?: TPregenIdentifierType;
47
- userId?: string;
48
- partnerId?: string;
49
- partner?: PartnerEntity;
50
- lastUsedAt?: string;
51
- lastUsedPartner?: PartnerEntity;
52
- lastUsedPartnerId?: string;
53
- isExternal?: boolean;
54
- }
55
- export interface ConstructorOpts {
56
- useStorageOverrides?: boolean;
57
- disableWorkers?: boolean;
58
- offloadMPCComputationURL?: string;
59
- useLocalFiles?: boolean;
60
- localStorageGetItemOverride?: (key: string) => Promise<string | null>;
61
- localStorageSetItemOverride?: (key: string, value: string) => Promise<void>;
62
- sessionStorageGetItemOverride?: (key: string) => Promise<string | null>;
63
- sessionStorageSetItemOverride?: (key: string, value: string) => Promise<void>;
64
- sessionStorageRemoveItemOverride?: (key: string) => Promise<void>;
65
- clearStorageOverride?: () => Promise<void>;
66
- /**
67
- * Hex color to use in the portal for the background color.
68
- * @deprecated use portalTheme instead
69
- */
70
- portalBackgroundColor?: string;
71
- /**
72
- * Hex color to use in the portal for the primary button.
73
- * @deprecated use portalTheme instead
74
- */
75
- portalPrimaryButtonColor?: string;
76
- /**
77
- * Hex text color to use in the portal.
78
- * @deprecated use portalTheme instead
79
- */
80
- portalTextColor?: string;
81
- /**
82
- * Hex color to use in the portal for the primary button text.
83
- * @deprecated use portalTheme instead
84
- */
85
- portalPrimaryButtonTextColor?: string;
86
- /**
87
- * Theme to use for the portal
88
- * @deprecated configure theming through the developer portal
89
- */
90
- portalTheme?: Theme;
91
- useDKLSForCreation?: boolean;
92
- disableWebSockets?: boolean;
93
- wasmOverride?: ArrayBuffer;
94
- /**
95
- * Base theme for the emails sent from this Para instance.
96
- * @default - dark
97
- * @deprecated configure theming through the developer portal
98
- */
99
- emailTheme?: EmailTheme;
100
- /**
101
- * Hex color to use as the primary color in the emails.
102
- * @default - #FE452B
103
- * @deprecated configure theming through the developer portal
104
- */
105
- emailPrimaryColor?: string;
106
- /**
107
- * Linkedin URL to link to in the emails. Should be a secure URL string starting with https://www.linkedin.com/company/.
108
- * @deprecated configure this through the developer portal
109
- */
110
- linkedinUrl?: string;
111
- /**
112
- * Github URL to link to in the emails. Should be a secure URL string starting with https://github.com/.
113
- * @deprecated configure this through the developer portal
114
- */
115
- githubUrl?: string;
116
- /**
117
- * X (Twitter) URL to link to in the emails. Should be a secure URL string starting with https://twitter.com/.
118
- * @deprecated configure this through the developer portal
119
- */
120
- xUrl?: string;
121
- /**
122
- * Support URL to link to in the emails. This can be a secure https URL or a mailto: string. Will default to using the stored application URL is nothing is provided here.
123
- * @deprecated homepageUrl will be used for this, configure it through the developer portal
124
- */
125
- supportUrl?: string;
126
- /**
127
- * URL for your home landing page. Should be a secure URL string starting with https://.
128
- * @deprecated configure this through the developer portal
129
- */
130
- homepageUrl?: string;
131
- /**
132
- * Which type of wallet your application supports, in the form `{ [WalletType]: true }`. Currently allowed values for `WalletType` are `'EVM'`, `'SOLANA'`, or `'COSMOS'`.
133
- *
134
- * To specify which prefix to use for new Cosmos wallets, pass `{ COSMOS: { prefix: 'your-prefix' } }`. Defaults to `'cosmos'`.
135
- * @deprecated Configure your app's supported wallet types in the Para Developer Portal.
136
- */
137
- supportedWalletTypes?: deprecated__SupportedWalletTypesOpt;
138
- /**
139
- * If `true`, the SDK will use the device's temporary session storage instead of saving user and wallet data to local storage.
140
- */
141
- useSessionStorage?: boolean;
142
- /**
143
- * Partner ID set in the Para Portal to track analytics for legacy SDK versions. This variable is unused outside of the Para Portal.
144
- */
145
- portalPartnerId?: string;
146
- }
147
- type PortalUrlOptions = {
148
- params?: Record<string, string | undefined | null>;
149
- authType?: AuthType;
150
- isForNewDevice?: boolean;
151
- loginEncryptionPublicKey?: string;
152
- newDeviceSessionId?: string;
153
- newDeviceEncryptionKey?: string;
154
- partnerId?: string;
155
- sessionId?: string;
156
- theme?: Theme;
157
- pathId?: string;
158
- displayName?: string;
159
- pfpUrl?: string;
160
- };
161
- export declare const PREFIX = "@CAPSULE/";
162
- export declare function stringToPhoneNumber(str: string): string;
163
- export declare function normalizePhoneNumber(countryCode: string, number: string): string | undefined;
164
- export declare function isWalletSupported(types: WalletType[], wallet: Omit<Wallet, 'signer'>): boolean;
165
- export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
166
- export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
167
- export declare function isCosmosRequired(supportedWalletTypes: SupportedWalletTypes): boolean;
168
6
  export declare abstract class ParaCore {
169
7
  #private;
170
8
  static version?: string;
@@ -705,7 +543,7 @@ export declare abstract class ParaCore {
705
543
  * Waits for the session to be active.
706
544
  **/
707
545
  waitForAccountCreation(): Promise<boolean>;
708
- waitForPasskeyAndCreateWallet(): Promise<AccountSetupResp>;
546
+ waitForPasskeyAndCreateWallet(): Promise<AccountSetupResponse>;
709
547
  /**
710
548
  * Initiates a Farcaster login attempt and return the URI for the user to connect.
711
549
  * You can create a QR code with this URI that works with Farcaster's mobile app.
@@ -758,7 +596,7 @@ export declare abstract class ParaCore {
758
596
  waitForLoginAndSetup({ popupWindow, skipSessionRefresh, }?: {
759
597
  popupWindow?: Window;
760
598
  skipSessionRefresh?: boolean;
761
- }): Promise<LoginResp>;
599
+ }): Promise<LoginResponse>;
762
600
  /**
763
601
  * Updates the session with the user management server, possibly
764
602
  * opening a popup to refresh the session.
@@ -1079,4 +917,3 @@ export declare abstract class ParaCore {
1079
917
  **/
1080
918
  toString(): string;
1081
919
  }
1082
- export {};
@@ -1,9 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
3
- import { Ctx } from './definitions.js';
4
- import { SignatureRes } from './types/walletTypes.js';
3
+ import { Ctx, PopupType, SignatureRes } from './types/index.js';
5
4
  import { StorageUtils } from './StorageUtils.js';
6
- import { PopupType } from './types/popupTypes.js';
7
5
  export interface PlatformUtils {
8
6
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
9
7
  keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
@@ -0,0 +1,17 @@
1
+ export declare const PARA_CORE_VERSION: string;
2
+ export declare const PREFIX = "@CAPSULE/";
3
+ export declare const LOCAL_STORAGE_EMAIL: string;
4
+ export declare const LOCAL_STORAGE_PHONE: string;
5
+ export declare const LOCAL_STORAGE_COUNTRY_CODE: string;
6
+ export declare const LOCAL_STORAGE_FARCASTER_USERNAME: string;
7
+ export declare const LOCAL_STORAGE_TELEGRAM_USER_ID: string;
8
+ export declare const LOCAL_STORAGE_USER_ID: string;
9
+ export declare const LOCAL_STORAGE_ED25519_WALLETS: string;
10
+ export declare const LOCAL_STORAGE_WALLETS: string;
11
+ export declare const LOCAL_STORAGE_EXTERNAL_WALLETS: string;
12
+ export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS: string;
13
+ export declare const LOCAL_STORAGE_CURRENT_EXTERNAL_WALLET_ADDRESSES: string;
14
+ export declare const LOCAL_STORAGE_SESSION_COOKIE: string;
15
+ export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
16
+ export declare const POLLING_INTERVAL_MS = 2000;
17
+ export declare const SHORT_POLLING_INTERVAL_MS = 1000;
@@ -1,5 +1,5 @@
1
1
  import forge from 'node-forge';
2
- import { Ctx } from '../definitions.js';
2
+ import { Ctx } from '../types/index.js';
3
3
  interface EncryptedShare {
4
4
  walletId: string;
5
5
  walletScheme: string;
@@ -1,5 +1,5 @@
1
1
  import Client from '@getpara/user-management-client';
2
- import { Environment } from '../definitions.js';
2
+ import { Environment } from '../types/index.js';
3
3
  export declare function getBaseOAuthUrl(env: Environment): string;
4
4
  export declare function getBaseUrl(env: Environment): string;
5
5
  export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: boolean): string;
@@ -1,22 +1,24 @@
1
- import { ParaCore, PREFIX as STORAGE_PREFIX, PregenIdentifierType, isWalletSupported } from './ParaCore.js';
2
- export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, WalletType, WalletScheme, OnRampPurchaseType, type OnRampConfig, type OnRampAllowedAssets, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
- export * from './definitions.js';
4
- export type { Ctx } from './definitions.js';
5
- export * from './types/index.js';
1
+ import { ParaCore } from './ParaCore.js';
2
+ export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
+ export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
4
+ export * from './types/events.js';
5
+ export * from './types/config.js';
6
+ export { getPortalDomain, stringToPhoneNumber, entityToWallet } from './utils/index.js';
7
+ export { PREFIX as STORAGE_PREFIX } from './constants.js';
6
8
  export { distributeNewShare } from './shares/shareDistribution.js';
7
9
  export { KeyContainer } from './shares/KeyContainer.js';
8
- export { RecoveryStatus, stringToPhoneNumber, entityToWallet } from './ParaCore.js';
9
- export type { Wallet, ConstructorOpts, SupportedWalletTypes } from './ParaCore.js';
10
10
  export type { PlatformUtils } from './PlatformUtils.js';
11
11
  export type { StorageUtils } from './StorageUtils.js';
12
12
  export { getBaseUrl, initClient } from './external/userManagementClient.js';
13
13
  export * as mpcComputationClient from './external/mpcComputationClient.js';
14
14
  export { decryptWithKeyPair, decryptWithPrivateKey, getAsymmetricKeyPair, getPublicKeyHex, encryptWithDerivedPublicKey, encodePrivateKeyToPemHex, getDerivedPrivateKeyAndDecrypt, getPublicKeyFromSignature, getSHA256HashHex, encryptPrivateKey, decryptPrivateKey, decryptPrivateKeyAndDecryptShare, hashPasswordWithSalt, encryptPrivateKeyWithPassword, decryptPrivateKeyWithPassword, publicKeyFromHex, } from './cryptography/utils.js';
15
15
  export * from './external/userManagementClient.js';
16
- export * from './utils/pollingUtils.js';
17
16
  export * from './errors.js';
18
- export * from './utils/formattingUtils.js';
17
+ export * from './utils/formatting.js';
18
+ export * from './utils/polling.js';
19
+ export { isWalletSupported } from './utils/wallet.js';
20
+ export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
21
+ export { getPortalBaseURL } from './utils/url.js';
19
22
  export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
20
- export { STORAGE_PREFIX, PregenIdentifierType, isWalletSupported };
21
23
  export declare const paraVersion: string;
22
24
  export default ParaCore;
@@ -1,5 +1,5 @@
1
1
  import { BackupKitEmailProps, EncryptedKeyShare } from '@getpara/user-management-client';
2
- import { Ctx } from '../definitions.js';
2
+ import { Ctx } from '../types/index.js';
3
3
  export declare function sendRecoveryForShare({ ctx, userId, walletId, otherEncryptedShares, userSigner, ignoreRedistributingBackupEncryptedShare, emailProps, forceRefresh, }: {
4
4
  ctx: Ctx;
5
5
  userId: string;
@@ -1,5 +1,5 @@
1
1
  import { BackupKitEmailProps } from '@getpara/user-management-client';
2
- import { Ctx } from '../definitions.js';
2
+ import { Ctx } from '../types/index.js';
3
3
  export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, }: {
4
4
  ctx: Ctx;
5
5
  userId: string;
@@ -0,0 +1,162 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, WalletScheme, WalletType } from '@getpara/user-management-client';
3
+ import { Theme } from './theme.js';
4
+ export declare enum Environment {
5
+ DEV = "DEV",
6
+ SANDBOX = "SANDBOX",
7
+ BETA = "BETA",
8
+ PROD = "PROD",
9
+ DEVELOPMENT = "BETA",
10
+ PRODUCTION = "PROD"
11
+ }
12
+ export interface Ctx {
13
+ env: Environment;
14
+ apiKey?: string;
15
+ client: Client;
16
+ disableWorkers?: boolean;
17
+ offloadMPCComputationURL?: string;
18
+ mpcComputationClient?: AxiosInstance;
19
+ useLocalFiles?: boolean;
20
+ useDKLS?: boolean;
21
+ disableWebSockets: boolean;
22
+ wasmOverride?: ArrayBuffer;
23
+ cosmosPrefix?: string;
24
+ isE2E?: boolean;
25
+ }
26
+ export type deprecated__NetworkProp = keyof typeof Network | Network;
27
+ export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
28
+ export type WalletTypeProp = keyof typeof WalletType | WalletType;
29
+ export type WalletSchemeProp = keyof typeof WalletScheme | WalletScheme;
30
+ export type WalletFilters = {
31
+ type?: WalletTypeProp[];
32
+ scheme?: WalletSchemeProp[];
33
+ forbidPregen?: boolean;
34
+ };
35
+ export type deprecated__RampConfig = {
36
+ id: deprecated__OnRampProviderProp;
37
+ hostApiKey: string;
38
+ };
39
+ export type deprecated__StripeConfig = {
40
+ id: deprecated__OnRampProviderProp;
41
+ };
42
+ export type deprecated__OnRampAssetProp = keyof typeof OnRampAsset | OnRampAsset;
43
+ export type deprecated__OnRampConfigProvider = deprecated__RampConfig | deprecated__StripeConfig;
44
+ export declare enum EnabledFlow {
45
+ BUY = "BUY",
46
+ RECEIVE = "RECEIVE",
47
+ WITHDRAW = "WITHDRAW"
48
+ }
49
+ export type deprecated__EnabledFlowProp = keyof typeof EnabledFlow | EnabledFlow;
50
+ export type deprecated__OnRampConfig = {
51
+ testMode?: boolean;
52
+ asset: deprecated__OnRampAssetProp;
53
+ network: deprecated__NetworkProp;
54
+ enabledFlows?: deprecated__EnabledFlowProp[];
55
+ providers: deprecated__OnRampConfigProvider[];
56
+ };
57
+ export type SupportedWalletTypeConfig = {
58
+ optional?: boolean;
59
+ };
60
+ export type deprecated__SupportedWalletTypesOpt = {
61
+ [WalletType.EVM]?: boolean | SupportedWalletTypeConfig;
62
+ [WalletType.SOLANA]?: boolean | SupportedWalletTypeConfig;
63
+ [WalletType.COSMOS]?: boolean | (SupportedWalletTypeConfig & {
64
+ prefix?: string;
65
+ });
66
+ };
67
+ export type SupportedWalletTypes = {
68
+ type: WalletType;
69
+ optional?: boolean;
70
+ }[];
71
+ export interface ConstructorOpts {
72
+ useStorageOverrides?: boolean;
73
+ disableWorkers?: boolean;
74
+ offloadMPCComputationURL?: string;
75
+ useLocalFiles?: boolean;
76
+ localStorageGetItemOverride?: (key: string) => Promise<string | null>;
77
+ localStorageSetItemOverride?: (key: string, value: string) => Promise<void>;
78
+ sessionStorageGetItemOverride?: (key: string) => Promise<string | null>;
79
+ sessionStorageSetItemOverride?: (key: string, value: string) => Promise<void>;
80
+ sessionStorageRemoveItemOverride?: (key: string) => Promise<void>;
81
+ clearStorageOverride?: () => Promise<void>;
82
+ /**
83
+ * Hex color to use in the portal for the background color.
84
+ * @deprecated use portalTheme instead
85
+ */
86
+ portalBackgroundColor?: string;
87
+ /**
88
+ * Hex color to use in the portal for the primary button.
89
+ * @deprecated use portalTheme instead
90
+ */
91
+ portalPrimaryButtonColor?: string;
92
+ /**
93
+ * Hex text color to use in the portal.
94
+ * @deprecated use portalTheme instead
95
+ */
96
+ portalTextColor?: string;
97
+ /**
98
+ * Hex color to use in the portal for the primary button text.
99
+ * @deprecated use portalTheme instead
100
+ */
101
+ portalPrimaryButtonTextColor?: string;
102
+ /**
103
+ * Theme to use for the portal
104
+ * @deprecated configure theming through the developer portal
105
+ */
106
+ portalTheme?: Theme;
107
+ useDKLSForCreation?: boolean;
108
+ disableWebSockets?: boolean;
109
+ wasmOverride?: ArrayBuffer;
110
+ /**
111
+ * Base theme for the emails sent from this Para instance.
112
+ * @default - dark
113
+ * @deprecated configure theming through the developer portal
114
+ */
115
+ emailTheme?: EmailTheme;
116
+ /**
117
+ * Hex color to use as the primary color in the emails.
118
+ * @default - #FE452B
119
+ * @deprecated configure theming through the developer portal
120
+ */
121
+ emailPrimaryColor?: string;
122
+ /**
123
+ * Linkedin URL to link to in the emails. Should be a secure URL string starting with https://www.linkedin.com/company/.
124
+ * @deprecated configure this through the developer portal
125
+ */
126
+ linkedinUrl?: string;
127
+ /**
128
+ * Github URL to link to in the emails. Should be a secure URL string starting with https://github.com/.
129
+ * @deprecated configure this through the developer portal
130
+ */
131
+ githubUrl?: string;
132
+ /**
133
+ * X (Twitter) URL to link to in the emails. Should be a secure URL string starting with https://twitter.com/.
134
+ * @deprecated configure this through the developer portal
135
+ */
136
+ xUrl?: string;
137
+ /**
138
+ * Support URL to link to in the emails. This can be a secure https URL or a mailto: string. Will default to using the stored application URL is nothing is provided here.
139
+ * @deprecated homepageUrl will be used for this, configure it through the developer portal
140
+ */
141
+ supportUrl?: string;
142
+ /**
143
+ * URL for your home landing page. Should be a secure URL string starting with https://.
144
+ * @deprecated configure this through the developer portal
145
+ */
146
+ homepageUrl?: string;
147
+ /**
148
+ * Which type of wallet your application supports, in the form `{ [WalletType]: true }`. Currently allowed values for `WalletType` are `'EVM'`, `'SOLANA'`, or `'COSMOS'`.
149
+ *
150
+ * To specify which prefix to use for new Cosmos wallets, pass `{ COSMOS: { prefix: 'your-prefix' } }`. Defaults to `'cosmos'`.
151
+ * @deprecated Configure your app's supported wallet types in the Para Developer Portal.
152
+ */
153
+ supportedWalletTypes?: deprecated__SupportedWalletTypesOpt;
154
+ /**
155
+ * If `true`, the SDK will use the device's temporary session storage instead of saving user and wallet data to local storage.
156
+ */
157
+ useSessionStorage?: boolean;
158
+ /**
159
+ * Partner ID set in the Para Portal to track analytics for legacy SDK versions. This variable is unused outside of the Para Portal.
160
+ */
161
+ portalPartnerId?: string;
162
+ }