@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.
- package/dist/cjs/ParaCore.js +125 -223
- package/dist/cjs/constants.js +20 -0
- package/dist/cjs/cryptography/utils.js +2 -2
- package/dist/cjs/external/userManagementClient.js +14 -14
- package/dist/cjs/index.js +28 -12
- package/dist/cjs/types/config.js +22 -0
- package/dist/cjs/types/index.js +11 -2
- package/dist/cjs/types/onRamps.js +10 -0
- package/dist/cjs/types/recovery.js +12 -0
- package/dist/cjs/types/wallet.js +9 -0
- package/dist/cjs/utils/events.js +9 -0
- package/dist/cjs/utils/{formattingUtils.js → formatting.js} +11 -1
- package/dist/cjs/utils/index.js +22 -0
- package/dist/cjs/utils/onRamps.js +36 -0
- package/dist/cjs/utils/url.js +74 -0
- package/dist/cjs/utils/wallet.js +74 -0
- package/dist/esm/ParaCore.js +74 -165
- package/dist/esm/constants.js +17 -0
- package/dist/esm/cryptography/utils.js +1 -1
- package/dist/esm/external/userManagementClient.js +1 -1
- package/dist/esm/index.js +12 -8
- package/dist/esm/types/config.js +19 -0
- package/dist/esm/types/index.js +6 -2
- package/dist/esm/types/onRamps.js +7 -0
- package/dist/esm/types/recovery.js +9 -0
- package/dist/esm/types/wallet.js +6 -0
- package/dist/esm/utils/events.js +5 -0
- package/dist/esm/utils/{formattingUtils.js → formatting.js} +8 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/onRamps.js +30 -0
- package/dist/esm/utils/url.js +66 -0
- package/dist/esm/utils/wallet.js +64 -0
- package/dist/types/ParaCore.d.ts +4 -167
- package/dist/types/PlatformUtils.d.ts +1 -3
- package/dist/types/constants.d.ts +17 -0
- package/dist/types/cryptography/utils.d.ts +1 -1
- package/dist/types/external/userManagementClient.d.ts +1 -1
- package/dist/types/index.d.ts +12 -10
- package/dist/types/shares/recovery.d.ts +1 -1
- package/dist/types/shares/shareDistribution.d.ts +1 -1
- package/dist/types/types/config.d.ts +162 -0
- package/dist/types/types/events.d.ts +10 -10
- package/dist/types/types/index.d.ts +6 -2
- package/dist/types/types/onRamps.d.ts +10 -0
- package/dist/types/types/recovery.d.ts +7 -0
- package/dist/types/types/wallet.d.ts +39 -0
- package/dist/types/utils/events.d.ts +2 -0
- package/dist/types/utils/{formattingUtils.d.ts → formatting.d.ts} +3 -1
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/onRamps.d.ts +12 -0
- package/dist/types/utils/url.d.ts +15 -0
- package/dist/types/utils/wallet.d.ts +10 -0
- package/package.json +3 -3
- package/dist/cjs/definitions.js +0 -153
- package/dist/cjs/types/walletTypes.js +0 -2
- package/dist/esm/definitions.js +0 -140
- package/dist/esm/types/walletTypes.js +0 -1
- package/dist/types/definitions.d.ts +0 -86
- package/dist/types/types/walletTypes.d.ts +0 -11
- /package/dist/cjs/types/{popupTypes.js → popup.js} +0 -0
- /package/dist/cjs/utils/{pollingUtils.js → polling.js} +0 -0
- /package/dist/esm/types/{popupTypes.js → popup.js} +0 -0
- /package/dist/esm/utils/{pollingUtils.js → polling.js} +0 -0
- /package/dist/types/types/{popupTypes.d.ts → popup.d.ts} +0 -0
- /package/dist/types/utils/{pollingUtils.d.ts → polling.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CurrentWalletIds } from '@getpara/user-management-client';
|
|
2
|
-
import { FullSignatureRes } from './
|
|
3
|
-
import { Wallet } from '
|
|
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
|
|
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<
|
|
26
|
+
export type LoginEvent = CustomEventInit<BaseEvent<LoginResponse>>;
|
|
27
27
|
export type AccountCreationEvent = CustomEventInit<BaseEvent<boolean>>;
|
|
28
|
-
export type
|
|
28
|
+
export type AccountSetupResponse = {
|
|
29
29
|
walletIds: CurrentWalletIds;
|
|
30
30
|
recoverySecret?: string;
|
|
31
31
|
};
|
|
32
|
-
export type AccountSetupEvent = CustomEventInit<BaseEvent<
|
|
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
|
|
38
|
+
export type WalletCreatedResponse = {
|
|
39
39
|
wallet: Omit<Wallet, 'signer'>;
|
|
40
40
|
recoverySecret?: string;
|
|
41
41
|
};
|
|
42
|
-
export type WalletCreatedEvent = CustomEventInit<BaseEvent<
|
|
43
|
-
export type
|
|
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<
|
|
47
|
+
export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export * from './
|
|
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 './
|
|
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,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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletTypeProp } from '../
|
|
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,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
|
|
3
|
+
"version": "1.1.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
|
|
12
|
+
"@getpara/user-management-client": "1.1.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": "
|
|
43
|
+
"gitHead": "a9e81f5c4560664441b3a18b3f8fe05c5db927ec"
|
|
44
44
|
}
|
package/dist/cjs/definitions.js
DELETED
|
@@ -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;
|
package/dist/esm/definitions.js
DELETED
|
@@ -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 {};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import Client, { Network, OnRampAsset, OnRampProvider, OnRampPurchase, OnRampPurchaseStatus, OnRampPurchaseType, WalletScheme, WalletType } from '@getpara/user-management-client';
|
|
2
|
-
import { AxiosInstance } from 'axios';
|
|
3
|
-
export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, type OnRampPurchase };
|
|
4
|
-
export declare const is2FAEnabled = false;
|
|
5
|
-
export declare enum Environment {
|
|
6
|
-
DEV = "DEV",
|
|
7
|
-
SANDBOX = "SANDBOX",
|
|
8
|
-
BETA = "BETA",
|
|
9
|
-
PROD = "PROD",
|
|
10
|
-
DEVELOPMENT = "BETA",
|
|
11
|
-
PRODUCTION = "PROD"
|
|
12
|
-
}
|
|
13
|
-
export interface Ctx {
|
|
14
|
-
env: Environment;
|
|
15
|
-
apiKey?: string;
|
|
16
|
-
client: Client;
|
|
17
|
-
disableWorkers?: boolean;
|
|
18
|
-
offloadMPCComputationURL?: string;
|
|
19
|
-
mpcComputationClient?: AxiosInstance;
|
|
20
|
-
useLocalFiles?: boolean;
|
|
21
|
-
useDKLS?: boolean;
|
|
22
|
-
disableWebSockets: boolean;
|
|
23
|
-
wasmOverride?: ArrayBuffer;
|
|
24
|
-
cosmosPrefix?: string;
|
|
25
|
-
isE2E?: boolean;
|
|
26
|
-
}
|
|
27
|
-
export type deprecated__NetworkProp = keyof typeof Network | Network;
|
|
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__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
|
|
36
|
-
export type deprecated__RampConfig = {
|
|
37
|
-
id: deprecated__OnRampProviderProp;
|
|
38
|
-
hostApiKey: string;
|
|
39
|
-
};
|
|
40
|
-
export type deprecated__StripeConfig = {
|
|
41
|
-
id: deprecated__OnRampProviderProp;
|
|
42
|
-
};
|
|
43
|
-
export type deprecated__OnRampAssetProp = keyof typeof OnRampAsset | OnRampAsset;
|
|
44
|
-
export type deprecated__OnRampConfigProvider = deprecated__RampConfig | deprecated__StripeConfig;
|
|
45
|
-
export declare enum EnabledFlow {
|
|
46
|
-
BUY = "BUY",
|
|
47
|
-
RECEIVE = "RECEIVE",
|
|
48
|
-
WITHDRAW = "WITHDRAW"
|
|
49
|
-
}
|
|
50
|
-
export type deprecated__EnabledFlowProp = keyof typeof EnabledFlow | EnabledFlow;
|
|
51
|
-
export type deprecated__OnRampConfig = {
|
|
52
|
-
testMode?: boolean;
|
|
53
|
-
asset: deprecated__OnRampAssetProp;
|
|
54
|
-
network: deprecated__NetworkProp;
|
|
55
|
-
enabledFlows?: deprecated__EnabledFlowProp[];
|
|
56
|
-
providers: deprecated__OnRampConfigProvider[];
|
|
57
|
-
};
|
|
58
|
-
export declare enum OnRampMethod {
|
|
59
|
-
ACH = "ACH",
|
|
60
|
-
DEBIT = "Debit",
|
|
61
|
-
CREDIT = "Credit",
|
|
62
|
-
APPLE_PAY = "Apple Pay"
|
|
63
|
-
}
|
|
64
|
-
export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
|
|
65
|
-
export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
|
|
66
|
-
export declare function getPortalBaseURL({ env, isE2E }: {
|
|
67
|
-
env: Environment;
|
|
68
|
-
isE2E?: boolean;
|
|
69
|
-
}, useLocalIp?: boolean, isForWasm?: boolean): string;
|
|
70
|
-
export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.beta.getpara.com" | "connect.getpara.com";
|
|
71
|
-
export declare function getParaConnectBaseUrl({ env }: {
|
|
72
|
-
env: Environment;
|
|
73
|
-
}, useLocalIp?: boolean): string;
|
|
74
|
-
export type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
|
|
75
|
-
export type OnRampAssetInfo = Record<WalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
|
|
76
|
-
export type OnRampAssetInfoRow = [WalletType, Network, OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>];
|
|
77
|
-
export declare function toAssetInfoArray(data: OnRampAssetInfo): OnRampAssetInfoRow[];
|
|
78
|
-
export declare function getOnRampNetworks(data: OnRampAssetInfo, { walletType, allowed }?: {
|
|
79
|
-
walletType?: WalletType;
|
|
80
|
-
allowed?: Network[];
|
|
81
|
-
}): Network[];
|
|
82
|
-
export declare function getOnRampAssets(data: OnRampAssetInfo, { walletType, network, allowed, }?: {
|
|
83
|
-
walletType?: WalletType;
|
|
84
|
-
network?: Network;
|
|
85
|
-
allowed?: OnRampAsset[];
|
|
86
|
-
}): OnRampAsset[];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface SuccessfulSignatureRes {
|
|
2
|
-
signature: string;
|
|
3
|
-
}
|
|
4
|
-
export interface DeniedSignatureRes {
|
|
5
|
-
pendingTransactionId: string;
|
|
6
|
-
}
|
|
7
|
-
export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
|
|
8
|
-
transactionReviewUrl: string;
|
|
9
|
-
}
|
|
10
|
-
export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
|
|
11
|
-
export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|