@getpara/core-sdk 1.7.1 → 1.9.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 +2974 -0
- package/dist/cjs/PlatformUtils.js +15 -0
- package/dist/cjs/StorageUtils.js +15 -0
- package/dist/cjs/constants.js +75 -0
- package/dist/cjs/cryptography/utils.js +350 -0
- package/dist/cjs/errors.js +51 -0
- package/dist/cjs/external/mpcComputationClient.js +62 -0
- package/dist/cjs/external/userManagementClient.js +106 -0
- package/dist/cjs/index.js +75 -4008
- package/dist/cjs/shares/KeyContainer.js +89 -0
- package/dist/cjs/shares/recovery.js +127 -0
- package/dist/cjs/shares/shareDistribution.js +104 -0
- package/dist/cjs/transmission/transmissionUtils.js +93 -0
- package/dist/cjs/types/config.js +43 -0
- package/dist/cjs/types/events.js +40 -0
- package/dist/cjs/types/index.js +50 -0
- package/dist/cjs/types/onRamps.js +33 -0
- package/dist/cjs/types/params.js +15 -0
- package/dist/cjs/types/popup.js +35 -0
- package/dist/cjs/types/recovery.js +34 -0
- package/dist/cjs/types/theme.js +15 -0
- package/dist/cjs/types/wallet.js +31 -0
- package/dist/cjs/utils/events.js +45 -0
- package/dist/cjs/utils/formatting.js +120 -0
- package/dist/cjs/utils/index.js +31 -0
- package/dist/cjs/utils/listeners.js +80 -0
- package/dist/cjs/utils/onRamps.js +64 -0
- package/dist/cjs/utils/polling.js +58 -0
- package/dist/cjs/utils/url.js +103 -0
- package/dist/cjs/utils/wallet.js +130 -0
- package/dist/esm/ParaCore.js +2923 -0
- package/dist/esm/PlatformUtils.js +0 -0
- package/dist/esm/StorageUtils.js +0 -0
- package/dist/esm/chunk-UICEQADR.js +68 -0
- package/dist/esm/constants.js +37 -0
- package/dist/esm/cryptography/utils.js +282 -0
- package/dist/esm/errors.js +27 -0
- package/dist/esm/external/mpcComputationClient.js +30 -0
- package/dist/esm/external/userManagementClient.js +71 -0
- package/dist/esm/index.js +54 -3968
- package/dist/esm/shares/KeyContainer.js +57 -0
- package/dist/esm/shares/recovery.js +74 -0
- package/dist/esm/shares/shareDistribution.js +64 -0
- package/dist/esm/transmission/transmissionUtils.js +42 -0
- package/dist/esm/types/config.js +20 -0
- package/dist/esm/types/events.js +18 -0
- package/dist/esm/types/index.js +21 -0
- package/dist/esm/types/onRamps.js +11 -0
- package/dist/esm/types/params.js +0 -0
- package/dist/esm/types/popup.js +13 -0
- package/dist/esm/types/recovery.js +12 -0
- package/dist/esm/types/theme.js +0 -0
- package/dist/esm/types/wallet.js +9 -0
- package/dist/esm/utils/events.js +11 -0
- package/dist/esm/utils/formatting.js +80 -0
- package/dist/esm/utils/index.js +6 -0
- package/dist/esm/utils/listeners.js +47 -0
- package/dist/esm/utils/onRamps.js +40 -0
- package/dist/esm/utils/polling.js +18 -0
- package/dist/esm/utils/url.js +77 -0
- package/dist/esm/utils/wallet.js +87 -0
- package/dist/types/ParaCore.d.ts +3 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/params.d.ts +4 -0
- package/package.json +5 -5
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__spreadProps,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "../chunk-UICEQADR.js";
|
|
5
|
+
import { WalletScheme, WalletType } from "@getpara/user-management-client";
|
|
6
|
+
import { stringToPhoneNumber } from "./formatting.js";
|
|
7
|
+
const WalletSchemeTypeMap = {
|
|
8
|
+
[WalletScheme.DKLS]: {
|
|
9
|
+
[WalletType.EVM]: true,
|
|
10
|
+
[WalletType.COSMOS]: true
|
|
11
|
+
},
|
|
12
|
+
[WalletScheme.CGGMP]: {
|
|
13
|
+
[WalletType.EVM]: true,
|
|
14
|
+
[WalletType.COSMOS]: true
|
|
15
|
+
},
|
|
16
|
+
[WalletScheme.ED25519]: {
|
|
17
|
+
[WalletType.SOLANA]: true
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function isPregenIdentifierMatch(a, b, type) {
|
|
21
|
+
if (!a || !b) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
switch (type) {
|
|
25
|
+
case "EMAIL":
|
|
26
|
+
return a.toLowerCase() === b.toLowerCase();
|
|
27
|
+
case "PHONE":
|
|
28
|
+
return stringToPhoneNumber(a) === stringToPhoneNumber(b);
|
|
29
|
+
case "CUSTOM_ID":
|
|
30
|
+
return a === b;
|
|
31
|
+
default:
|
|
32
|
+
return a.replace(/^@/g, "").toLowerCase() === b.replace(/^@/g, "").toLowerCase();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function isWalletSupported(types, wallet) {
|
|
36
|
+
return types.some((walletType) => {
|
|
37
|
+
var _a;
|
|
38
|
+
return !!((_a = WalletSchemeTypeMap[wallet == null ? void 0 : wallet.scheme]) == null ? void 0 : _a[walletType]);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function getSchemes(types) {
|
|
42
|
+
return Object.keys(WalletSchemeTypeMap).filter((scheme) => {
|
|
43
|
+
if (scheme === WalletScheme.CGGMP) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return (Array.isArray(types) ? types : Object.keys(types)).some((type) => WalletSchemeTypeMap[scheme][type]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function getWalletTypes(schemes) {
|
|
50
|
+
return [
|
|
51
|
+
...new Set(
|
|
52
|
+
schemes.reduce((acc, scheme) => {
|
|
53
|
+
return [...acc, ...Object.keys(WalletSchemeTypeMap[scheme]).filter((type) => WalletSchemeTypeMap[scheme][type])];
|
|
54
|
+
}, [])
|
|
55
|
+
)
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
function getEquivalentTypes(types) {
|
|
59
|
+
return getWalletTypes(getSchemes((Array.isArray(types) ? types : [types]).map((t) => WalletType[t])));
|
|
60
|
+
}
|
|
61
|
+
function entityToWallet(w) {
|
|
62
|
+
return __spreadProps(__spreadValues({}, w), {
|
|
63
|
+
scheme: w.scheme,
|
|
64
|
+
type: w.type,
|
|
65
|
+
pregenIdentifierType: w.pregenIdentifierType
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function migrateWallet(obj) {
|
|
69
|
+
if (["USER", "PREGEN"].includes(obj.type)) {
|
|
70
|
+
obj.isPregen = obj.type === "PREGEN";
|
|
71
|
+
obj.type = obj.scheme === WalletScheme.ED25519 ? WalletType.SOLANA : WalletType.EVM;
|
|
72
|
+
}
|
|
73
|
+
if (!!obj.scheme && !obj.type) {
|
|
74
|
+
obj.type = obj.scheme === WalletScheme.ED25519 ? WalletType.SOLANA : WalletType.EVM;
|
|
75
|
+
}
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
WalletSchemeTypeMap,
|
|
80
|
+
entityToWallet,
|
|
81
|
+
getEquivalentTypes,
|
|
82
|
+
getSchemes,
|
|
83
|
+
getWalletTypes,
|
|
84
|
+
isPregenIdentifierMatch,
|
|
85
|
+
isWalletSupported,
|
|
86
|
+
migrateWallet
|
|
87
|
+
};
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Client, { AuthMethod, BackupKitEmailProps, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, WalletParams, OAuthMethod, OnRampPurchaseCreateParams, OnRampPurchase, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, ExternalWalletLoginRes, AccountMetadata } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus } from './types/index.js';
|
|
3
|
+
import { Ctx, Environment, Theme, FullSignatureRes, ExternalWalletInfo, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, SupportedWalletTypes, PortalUrlOptions, ConstructorOpts, RecoveryStatus, GetWalletBalanceParams } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
import { CountryCallingCode } from 'libphonenumber-js';
|
|
6
6
|
export declare abstract class ParaCore {
|
|
@@ -113,6 +113,7 @@ export declare abstract class ParaCore {
|
|
|
113
113
|
*/
|
|
114
114
|
portalTheme?: Theme;
|
|
115
115
|
private disableProviderModal?;
|
|
116
|
+
get isNoWalletConfig(): boolean;
|
|
116
117
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
117
118
|
get isWalletTypeEnabled(): Partial<Record<WalletType, boolean>>;
|
|
118
119
|
private platformUtils;
|
|
@@ -848,6 +849,7 @@ export declare abstract class ParaCore {
|
|
|
848
849
|
setUserShare(base64Wallets: string | null): Promise<void>;
|
|
849
850
|
private getTransactionReviewUrl;
|
|
850
851
|
private getOnRampTransactionUrl;
|
|
852
|
+
getWalletBalance: ({ walletId, rpcUrl }: GetWalletBalanceParams) => Promise<string | undefined>;
|
|
851
853
|
/**
|
|
852
854
|
* Signs a message using one of the current wallets.
|
|
853
855
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
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';
|
|
3
|
+
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, } from './types/index.js';
|
|
4
4
|
export * from './types/events.js';
|
|
5
5
|
export * from './types/config.js';
|
|
6
6
|
export { getPortalDomain, stringToPhoneNumber, entityToWallet } from './utils/index.js';
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
7
7
|
"typings": "dist/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@celo/utils": "^8.0.
|
|
10
|
+
"@celo/utils": "^8.0.2",
|
|
11
11
|
"@cosmjs/encoding": "^0.32.4",
|
|
12
|
-
"@
|
|
12
|
+
"@ethereumjs/util": "^9.1.0",
|
|
13
|
+
"@getpara/user-management-client": "1.9.0",
|
|
13
14
|
"@noble/hashes": "^1.5.0",
|
|
14
15
|
"base64url": "^3.0.1",
|
|
15
|
-
"ethereumjs-util": "7.1.5",
|
|
16
16
|
"libphonenumber-js": "1.11.2",
|
|
17
17
|
"node-forge": "^1.3.1",
|
|
18
18
|
"qs": "^6.12.0"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"require": "./dist/cjs/index.js"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "3d749844bf071e2c8de2769dd16e17c026951109"
|
|
44
44
|
}
|
package/dist/cjs/index.js.br
DELETED
|
Binary file
|
package/dist/cjs/index.js.gz
DELETED
|
Binary file
|
package/dist/esm/index.js.br
DELETED
|
Binary file
|
package/dist/esm/index.js.gz
DELETED
|
Binary file
|