@getpara/core-sdk 1.0.2 → 1.2.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 +140 -224
  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 +89 -166
  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 +12 -168
  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,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
+ }
@@ -1,6 +1,6 @@
1
1
  import { CurrentWalletIds } from '@getpara/user-management-client';
2
- import { FullSignatureRes } from './walletTypes.js';
3
- import { Wallet } from '../ParaCore.js';
2
+ import { FullSignatureRes } from './wallet.js';
3
+ import { Wallet } from './wallet.js';
4
4
  export declare enum ParaEvent {
5
5
  LOGIN_EVENT = "paraLogin",
6
6
  ACCOUNT_CREATION_EVENT = "paraAccountCreation",
@@ -17,31 +17,31 @@ export type BaseEvent<T> = {
17
17
  data: T;
18
18
  error?: Error;
19
19
  };
20
- export type LoginResp = {
20
+ export type LoginResponse = {
21
21
  isComplete: boolean;
22
22
  isError?: boolean;
23
23
  needsWallet?: boolean;
24
24
  partnerId?: string;
25
25
  };
26
- export type LoginEvent = CustomEventInit<BaseEvent<LoginResp>>;
26
+ export type LoginEvent = CustomEventInit<BaseEvent<LoginResponse>>;
27
27
  export type AccountCreationEvent = CustomEventInit<BaseEvent<boolean>>;
28
- export type AccountSetupResp = {
28
+ export type AccountSetupResponse = {
29
29
  walletIds: CurrentWalletIds;
30
30
  recoverySecret?: string;
31
31
  };
32
- export type AccountSetupEvent = CustomEventInit<BaseEvent<AccountSetupResp>>;
32
+ export type AccountSetupEvent = CustomEventInit<BaseEvent<AccountSetupResponse>>;
33
33
  export type LogoutEvent = CustomEventInit<BaseEvent<null>>;
34
34
  export type SignMessageEvent = CustomEventInit<BaseEvent<FullSignatureRes>>;
35
35
  export type SignTransactionEvent = CustomEventInit<BaseEvent<FullSignatureRes>>;
36
36
  export type ExternalWalletChangeEvent = CustomEventInit<BaseEvent<null>>;
37
37
  export type WalletsChangeEvent = CustomEventInit<BaseEvent<null>>;
38
- export type WalletCreatedResp = {
38
+ export type WalletCreatedResponse = {
39
39
  wallet: Omit<Wallet, 'signer'>;
40
40
  recoverySecret?: string;
41
41
  };
42
- export type WalletCreatedEvent = CustomEventInit<BaseEvent<WalletCreatedResp>>;
43
- export type PregenWalletClaimedResp = {
42
+ export type WalletCreatedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
43
+ export type PregenWalletClaimedResponse = {
44
44
  wallet: Omit<Wallet, 'signer'>;
45
45
  recoverySecret?: string;
46
46
  };
47
- export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResp>>;
47
+ export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
@@ -1,5 +1,9 @@
1
- export * from './walletTypes.js';
1
+ export * from './config.js';
2
+ export * from './wallet.js';
2
3
  export * from './params.js';
3
4
  export * from './theme.js';
4
- export * from './popupTypes.js';
5
+ export * from './onRamps.js';
6
+ export * from './popup.js';
7
+ export * from './recovery.js';
5
8
  export * from './events.js';
9
+ export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, type OnRampPurchase, } from '@getpara/user-management-client';
@@ -0,0 +1,10 @@
1
+ import { Network, OnRampAsset, OnRampProvider, OnRampPurchaseType, WalletType } from '@getpara/user-management-client';
2
+ export type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
3
+ export type OnRampAssetInfo = Record<WalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
4
+ export type OnRampAssetInfoRow = [WalletType, Network, OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>];
5
+ export declare enum OnRampMethod {
6
+ ACH = "ACH",
7
+ DEBIT = "Debit",
8
+ CREDIT = "Credit",
9
+ APPLE_PAY = "Apple Pay"
10
+ }
@@ -0,0 +1,7 @@
1
+ export declare enum RecoveryStatus {
2
+ INITIATED = "INITIATED",
3
+ READY = "READY",
4
+ EXPIRED = "EXPIRED",
5
+ FINISHED = "FINISHED",
6
+ CANCELLED = "CANCELLED"
7
+ }
@@ -0,0 +1,39 @@
1
+ import { PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
2
+ import { EmbeddedWalletType, ExternalWalletType } from './params.js';
3
+ export interface Wallet {
4
+ createdAt?: string;
5
+ id: string;
6
+ name?: string;
7
+ signer: string;
8
+ address?: string;
9
+ addressSecondary?: string;
10
+ publicKey?: string;
11
+ scheme?: WalletScheme;
12
+ type?: EmbeddedWalletType | ExternalWalletType;
13
+ isPregen?: boolean;
14
+ pregenIdentifier?: string;
15
+ pregenIdentifierType?: TPregenIdentifierType;
16
+ userId?: string;
17
+ partnerId?: string;
18
+ partner?: PartnerEntity;
19
+ lastUsedAt?: string;
20
+ lastUsedPartner?: PartnerEntity;
21
+ lastUsedPartnerId?: string;
22
+ isExternal?: boolean;
23
+ }
24
+ /** @deprecated */
25
+ export declare enum PregenIdentifierType {
26
+ EMAIL = "EMAIL",
27
+ PHONE = "PHONE"
28
+ }
29
+ export interface SuccessfulSignatureRes {
30
+ signature: string;
31
+ }
32
+ export interface DeniedSignatureRes {
33
+ pendingTransactionId: string;
34
+ }
35
+ export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
36
+ transactionReviewUrl: string;
37
+ }
38
+ export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
39
+ export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
@@ -0,0 +1,2 @@
1
+ import { ParaEvent } from '../types/index.js';
2
+ export declare function dispatchEvent<T>(type: ParaEvent, data: T, error?: string): void;
@@ -1,4 +1,4 @@
1
- import { WalletTypeProp } from '../definitions.js';
1
+ import { WalletTypeProp } from '../types/index.js';
2
2
  export type Hex = `0x${string}`;
3
3
  export interface Signature {
4
4
  r: Hex;
@@ -14,3 +14,5 @@ export declare function getCosmosAddress(publicKey: string, prefix: string): str
14
14
  export declare function truncateAddress(str: string, addressType: WalletTypeProp, { prefix }?: {
15
15
  prefix?: string;
16
16
  }): string;
17
+ export declare function stringToPhoneNumber(str: string): string;
18
+ export declare function normalizePhoneNumber(countryCode: string, number: string): string | undefined;
@@ -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,12 @@
1
+ import { Network, OnRampAsset, WalletType } from '@getpara/user-management-client';
2
+ import { OnRampAssetInfoRow, OnRampAssetInfo } from '../types/index.js';
3
+ export declare function toAssetInfoArray(data: OnRampAssetInfo): OnRampAssetInfoRow[];
4
+ export declare function getOnRampNetworks(data: OnRampAssetInfo, { walletType, allowed }?: {
5
+ walletType?: WalletType;
6
+ allowed?: Network[];
7
+ }): Network[];
8
+ export declare function getOnRampAssets(data: OnRampAssetInfo, { walletType, network, allowed, }?: {
9
+ walletType?: WalletType;
10
+ network?: Network;
11
+ allowed?: OnRampAsset[];
12
+ }): OnRampAsset[];
@@ -0,0 +1,15 @@
1
+ import { Environment } from '../types/index.js';
2
+ export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
3
+ export declare function getPortalBaseURL({ env, isE2E }: {
4
+ env: Environment;
5
+ isE2E?: boolean;
6
+ }, useLocalIp?: boolean, isForWasm?: boolean): string;
7
+ export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.beta.getpara.com" | "connect.getpara.com";
8
+ export declare function getParaConnectBaseUrl({ env }: {
9
+ env: Environment;
10
+ }, useLocalIp?: boolean): string;
11
+ export declare function constructUrl({ base, path, params, }: {
12
+ base: string;
13
+ path: string;
14
+ params?: Record<string, string | undefined | null>;
15
+ }): string;
@@ -0,0 +1,10 @@
1
+ import { TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import { SupportedWalletTypes, Wallet, WalletTypeProp } from '../types/index.js';
3
+ export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
4
+ export declare function isPregenIdentifierMatch(a: string | null | undefined, b: string | null | undefined, type: TPregenIdentifierType): boolean;
5
+ export declare function isWalletSupported(types: WalletType[], wallet: Omit<Wallet, 'signer'>): boolean;
6
+ export declare function getSchemes(types: WalletTypeProp[] | SupportedWalletTypes): WalletScheme[];
7
+ export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
8
+ export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
9
+ export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
10
+ export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@celo/utils": "^8.0.0",
11
11
  "@cosmjs/encoding": "^0.32.4",
12
- "@getpara/user-management-client": "1.0.2",
12
+ "@getpara/user-management-client": "1.2.0",
13
13
  "@noble/hashes": "^1.5.0",
14
14
  "base64url": "^3.0.1",
15
15
  "buffer": "6.0.3",
@@ -40,5 +40,5 @@
40
40
  "types": "./dist/types/index.d.ts"
41
41
  }
42
42
  },
43
- "gitHead": "b52cb28fc10a5fda8c49747e98b512d680b5ded0"
43
+ "gitHead": "a9162c59be1456292d46c56787c1d5bf313bf24b"
44
44
  }
@@ -1,153 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOnRampAssets = exports.getOnRampNetworks = exports.toAssetInfoArray = exports.getParaConnectBaseUrl = exports.getParaConnectDomain = exports.getPortalBaseURL = exports.getPortalDomain = exports.WalletSchemeTypeMap = exports.OnRampMethod = exports.EnabledFlow = exports.Environment = exports.is2FAEnabled = exports.OnRampPurchaseStatus = exports.OnRampProvider = exports.OnRampAsset = exports.Network = void 0;
4
- const buffer_1 = require("buffer");
5
- if (typeof global !== 'undefined') {
6
- global.Buffer = global.Buffer || buffer_1.Buffer;
7
- }
8
- else if (typeof window !== 'undefined') {
9
- window.Buffer = window.Buffer || buffer_1.Buffer;
10
- window.global = window.global || window;
11
- }
12
- else {
13
- self.Buffer = self.Buffer || buffer_1.Buffer;
14
- self.global = self.global || self;
15
- }
16
- const user_management_client_1 = require("@getpara/user-management-client");
17
- Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return user_management_client_1.Network; } });
18
- Object.defineProperty(exports, "OnRampAsset", { enumerable: true, get: function () { return user_management_client_1.OnRampAsset; } });
19
- Object.defineProperty(exports, "OnRampProvider", { enumerable: true, get: function () { return user_management_client_1.OnRampProvider; } });
20
- Object.defineProperty(exports, "OnRampPurchaseStatus", { enumerable: true, get: function () { return user_management_client_1.OnRampPurchaseStatus; } });
21
- exports.is2FAEnabled = false;
22
- var Environment;
23
- (function (Environment) {
24
- // Internal Environments
25
- Environment["DEV"] = "DEV";
26
- Environment["SANDBOX"] = "SANDBOX";
27
- Environment["BETA"] = "BETA";
28
- Environment["PROD"] = "PROD";
29
- // Customer-Facing Environments
30
- // NOTE: these resolve to the corresponding internal environments for convenience
31
- Environment["DEVELOPMENT"] = "BETA";
32
- Environment["PRODUCTION"] = "PROD";
33
- })(Environment || (exports.Environment = Environment = {}));
34
- var EnabledFlow;
35
- (function (EnabledFlow) {
36
- EnabledFlow["BUY"] = "BUY";
37
- EnabledFlow["RECEIVE"] = "RECEIVE";
38
- EnabledFlow["WITHDRAW"] = "WITHDRAW";
39
- })(EnabledFlow || (exports.EnabledFlow = EnabledFlow = {}));
40
- var OnRampMethod;
41
- (function (OnRampMethod) {
42
- OnRampMethod["ACH"] = "ACH";
43
- OnRampMethod["DEBIT"] = "Debit";
44
- OnRampMethod["CREDIT"] = "Credit";
45
- OnRampMethod["APPLE_PAY"] = "Apple Pay";
46
- })(OnRampMethod || (exports.OnRampMethod = OnRampMethod = {}));
47
- exports.WalletSchemeTypeMap = {
48
- [user_management_client_1.WalletScheme.DKLS]: {
49
- [user_management_client_1.WalletType.EVM]: true,
50
- [user_management_client_1.WalletType.COSMOS]: true,
51
- },
52
- [user_management_client_1.WalletScheme.CGGMP]: {
53
- [user_management_client_1.WalletType.EVM]: true,
54
- [user_management_client_1.WalletType.COSMOS]: true,
55
- },
56
- [user_management_client_1.WalletScheme.ED25519]: {
57
- [user_management_client_1.WalletType.SOLANA]: true,
58
- },
59
- };
60
- function getPortalDomain(env, isE2E) {
61
- if (isE2E) {
62
- return `localhost`;
63
- }
64
- switch (env) {
65
- case Environment.DEV:
66
- return 'localhost';
67
- case Environment.SANDBOX:
68
- return 'app.sandbox.usecapsule.com';
69
- case Environment.BETA:
70
- return 'app.beta.usecapsule.com';
71
- case Environment.PROD:
72
- return 'app.usecapsule.com';
73
- default:
74
- throw new Error(`env: ${env} not supported`);
75
- }
76
- }
77
- exports.getPortalDomain = getPortalDomain;
78
- function getPortalBaseURL({ env, isE2E }, useLocalIp, isForWasm) {
79
- if (isE2E) {
80
- if (isForWasm) {
81
- return `https://app.sandbox.usecapsule.com`;
82
- }
83
- return `http://localhost:3003`;
84
- }
85
- const domain = getPortalDomain(env);
86
- if (env === Environment.DEV) {
87
- if (useLocalIp) {
88
- return `http://127.0.0.1:3003`;
89
- }
90
- return `http://${domain}:3003`;
91
- }
92
- return `https://${domain}`;
93
- }
94
- exports.getPortalBaseURL = getPortalBaseURL;
95
- function getParaConnectDomain(env) {
96
- switch (env) {
97
- case Environment.DEV:
98
- return 'localhost';
99
- case Environment.SANDBOX:
100
- return 'connect.sandbox.getpara.com';
101
- case Environment.BETA:
102
- return 'connect.beta.getpara.com';
103
- case Environment.PROD:
104
- return 'connect.getpara.com';
105
- default:
106
- throw new Error(`env: ${env} not supported`);
107
- }
108
- }
109
- exports.getParaConnectDomain = getParaConnectDomain;
110
- function getParaConnectBaseUrl({ env }, useLocalIp) {
111
- const domain = getParaConnectDomain(env);
112
- if (env === Environment.DEV) {
113
- if (useLocalIp) {
114
- return `http://127.0.0.1:3008`;
115
- }
116
- return `http://${domain}:3008`;
117
- }
118
- return `https://${domain}`;
119
- }
120
- exports.getParaConnectBaseUrl = getParaConnectBaseUrl;
121
- function toAssetInfoArray(data) {
122
- const result = [];
123
- Object.keys(data).forEach(walletType => {
124
- const networks = data[walletType];
125
- Object.keys(networks).forEach(network => {
126
- const assets = networks[network];
127
- Object.keys(assets).forEach(asset => {
128
- const providerInfo = assets[asset];
129
- result.push([walletType, network, asset, providerInfo]);
130
- });
131
- });
132
- });
133
- return result;
134
- }
135
- exports.toAssetInfoArray = toAssetInfoArray;
136
- function getOnRampNetworks(data, { walletType, allowed } = {}) {
137
- return [
138
- ...new Set(toAssetInfoArray(data)
139
- .filter(([type, network]) => (!walletType || type === walletType) && (!allowed || allowed.includes(network)))
140
- .map(([_, network]) => network)),
141
- ];
142
- }
143
- exports.getOnRampNetworks = getOnRampNetworks;
144
- function getOnRampAssets(data, { walletType, network, allowed, } = {}) {
145
- return [
146
- ...new Set(toAssetInfoArray(data)
147
- .filter(([t, n, a]) => (!walletType || t === walletType) &&
148
- (!network || n === network) &&
149
- (!Array.isArray(allowed) || allowed.includes(a)))
150
- .map(([, , asset]) => asset)),
151
- ];
152
- }
153
- exports.getOnRampAssets = getOnRampAssets;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,140 +0,0 @@
1
- import { Buffer as NodeBuffer } from 'buffer';
2
- if (typeof global !== 'undefined') {
3
- global.Buffer = global.Buffer || NodeBuffer;
4
- }
5
- else if (typeof window !== 'undefined') {
6
- window.Buffer = window.Buffer || NodeBuffer;
7
- window.global = window.global || window;
8
- }
9
- else {
10
- self.Buffer = self.Buffer || NodeBuffer;
11
- self.global = self.global || self;
12
- }
13
- import { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, WalletScheme, WalletType, } from '@getpara/user-management-client';
14
- export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus };
15
- export const is2FAEnabled = false;
16
- export var Environment;
17
- (function (Environment) {
18
- // Internal Environments
19
- Environment["DEV"] = "DEV";
20
- Environment["SANDBOX"] = "SANDBOX";
21
- Environment["BETA"] = "BETA";
22
- Environment["PROD"] = "PROD";
23
- // Customer-Facing Environments
24
- // NOTE: these resolve to the corresponding internal environments for convenience
25
- Environment["DEVELOPMENT"] = "BETA";
26
- Environment["PRODUCTION"] = "PROD";
27
- })(Environment || (Environment = {}));
28
- export var EnabledFlow;
29
- (function (EnabledFlow) {
30
- EnabledFlow["BUY"] = "BUY";
31
- EnabledFlow["RECEIVE"] = "RECEIVE";
32
- EnabledFlow["WITHDRAW"] = "WITHDRAW";
33
- })(EnabledFlow || (EnabledFlow = {}));
34
- export var OnRampMethod;
35
- (function (OnRampMethod) {
36
- OnRampMethod["ACH"] = "ACH";
37
- OnRampMethod["DEBIT"] = "Debit";
38
- OnRampMethod["CREDIT"] = "Credit";
39
- OnRampMethod["APPLE_PAY"] = "Apple Pay";
40
- })(OnRampMethod || (OnRampMethod = {}));
41
- export const WalletSchemeTypeMap = {
42
- [WalletScheme.DKLS]: {
43
- [WalletType.EVM]: true,
44
- [WalletType.COSMOS]: true,
45
- },
46
- [WalletScheme.CGGMP]: {
47
- [WalletType.EVM]: true,
48
- [WalletType.COSMOS]: true,
49
- },
50
- [WalletScheme.ED25519]: {
51
- [WalletType.SOLANA]: true,
52
- },
53
- };
54
- export function getPortalDomain(env, isE2E) {
55
- if (isE2E) {
56
- return `localhost`;
57
- }
58
- switch (env) {
59
- case Environment.DEV:
60
- return 'localhost';
61
- case Environment.SANDBOX:
62
- return 'app.sandbox.usecapsule.com';
63
- case Environment.BETA:
64
- return 'app.beta.usecapsule.com';
65
- case Environment.PROD:
66
- return 'app.usecapsule.com';
67
- default:
68
- throw new Error(`env: ${env} not supported`);
69
- }
70
- }
71
- export function getPortalBaseURL({ env, isE2E }, useLocalIp, isForWasm) {
72
- if (isE2E) {
73
- if (isForWasm) {
74
- return `https://app.sandbox.usecapsule.com`;
75
- }
76
- return `http://localhost:3003`;
77
- }
78
- const domain = getPortalDomain(env);
79
- if (env === Environment.DEV) {
80
- if (useLocalIp) {
81
- return `http://127.0.0.1:3003`;
82
- }
83
- return `http://${domain}:3003`;
84
- }
85
- return `https://${domain}`;
86
- }
87
- export function getParaConnectDomain(env) {
88
- switch (env) {
89
- case Environment.DEV:
90
- return 'localhost';
91
- case Environment.SANDBOX:
92
- return 'connect.sandbox.getpara.com';
93
- case Environment.BETA:
94
- return 'connect.beta.getpara.com';
95
- case Environment.PROD:
96
- return 'connect.getpara.com';
97
- default:
98
- throw new Error(`env: ${env} not supported`);
99
- }
100
- }
101
- export function getParaConnectBaseUrl({ env }, useLocalIp) {
102
- const domain = getParaConnectDomain(env);
103
- if (env === Environment.DEV) {
104
- if (useLocalIp) {
105
- return `http://127.0.0.1:3008`;
106
- }
107
- return `http://${domain}:3008`;
108
- }
109
- return `https://${domain}`;
110
- }
111
- export function toAssetInfoArray(data) {
112
- const result = [];
113
- Object.keys(data).forEach(walletType => {
114
- const networks = data[walletType];
115
- Object.keys(networks).forEach(network => {
116
- const assets = networks[network];
117
- Object.keys(assets).forEach(asset => {
118
- const providerInfo = assets[asset];
119
- result.push([walletType, network, asset, providerInfo]);
120
- });
121
- });
122
- });
123
- return result;
124
- }
125
- export function getOnRampNetworks(data, { walletType, allowed } = {}) {
126
- return [
127
- ...new Set(toAssetInfoArray(data)
128
- .filter(([type, network]) => (!walletType || type === walletType) && (!allowed || allowed.includes(network)))
129
- .map(([_, network]) => network)),
130
- ];
131
- }
132
- export function getOnRampAssets(data, { walletType, network, allowed, } = {}) {
133
- return [
134
- ...new Set(toAssetInfoArray(data)
135
- .filter(([t, n, a]) => (!walletType || t === walletType) &&
136
- (!network || n === network) &&
137
- (!Array.isArray(allowed) || allowed.includes(a)))
138
- .map(([, , asset]) => asset)),
139
- ];
140
- }
@@ -1 +0,0 @@
1
- export {};