@getpara/core-sdk 2.0.0-alpha.17 → 2.0.0-alpha.19
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 +10 -2
- package/dist/cjs/constants.js +1 -1
- package/dist/esm/ParaCore.js +12 -3
- package/dist/esm/constants.js +1 -1
- package/dist/types/ParaCore.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/config.d.ts +9 -1
- package/dist/types/types/methods.d.ts +1 -0
- package/package.json +3 -3
package/dist/cjs/ParaCore.js
CHANGED
|
@@ -326,6 +326,7 @@ const _ParaCore = class _ParaCore {
|
|
|
326
326
|
this.portalTheme = opts.portalTheme;
|
|
327
327
|
this.platformUtils = this.getPlatformUtils();
|
|
328
328
|
this.disableProviderModal = this.platformUtils.disableProviderModal;
|
|
329
|
+
this.fetchPregenWalletsOverride = opts.fetchPregenWalletsOverride;
|
|
329
330
|
if (opts.useStorageOverrides) {
|
|
330
331
|
this.localStorageGetItem = opts.localStorageGetItemOverride;
|
|
331
332
|
this.localStorageSetItem = opts.localStorageSetItemOverride;
|
|
@@ -1655,7 +1656,6 @@ const _ParaCore = class _ParaCore {
|
|
|
1655
1656
|
}
|
|
1656
1657
|
onPoll == null ? void 0 : onPoll();
|
|
1657
1658
|
} catch (err) {
|
|
1658
|
-
console.error(err);
|
|
1659
1659
|
onPoll == null ? void 0 : onPoll();
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
@@ -2787,6 +2787,13 @@ const _ParaCore = class _ParaCore {
|
|
|
2787
2787
|
return __async(this, null, function* () {
|
|
2788
2788
|
var _p = _o, { auth } = _p, urlOptions = __objRest(_p, ["auth"]);
|
|
2789
2789
|
const serverAuthState = yield this.ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), this.getVerificationEmailProps()));
|
|
2790
|
+
const authInfo = serverAuthState.auth;
|
|
2791
|
+
if (this.fetchPregenWalletsOverride && (0, import_user_management_client.isPregenAuth)(authInfo)) {
|
|
2792
|
+
const { userShare } = yield this.fetchPregenWalletsOverride({ pregenId: authInfo });
|
|
2793
|
+
if (userShare) {
|
|
2794
|
+
yield this.setUserShare(userShare);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2790
2797
|
return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
|
|
2791
2798
|
});
|
|
2792
2799
|
}
|
|
@@ -3019,7 +3026,8 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
3019
3026
|
passwordUrl: yield this.constructPortalUrl("loginPassword", {
|
|
3020
3027
|
sessionId: sessionLookupId,
|
|
3021
3028
|
shorten,
|
|
3022
|
-
portalTheme
|
|
3029
|
+
portalTheme,
|
|
3030
|
+
params: { isEmbedded: `${!loginState.isWalletSelectionNeeded}` }
|
|
3023
3031
|
})
|
|
3024
3032
|
} : {});
|
|
3025
3033
|
});
|
package/dist/cjs/constants.js
CHANGED
|
@@ -39,7 +39,7 @@ __export(constants_exports, {
|
|
|
39
39
|
SHORT_POLLING_INTERVAL_MS: () => SHORT_POLLING_INTERVAL_MS
|
|
40
40
|
});
|
|
41
41
|
module.exports = __toCommonJS(constants_exports);
|
|
42
|
-
const PARA_CORE_VERSION = "2.0.0-alpha.
|
|
42
|
+
const PARA_CORE_VERSION = "2.0.0-alpha.19";
|
|
43
43
|
const PREFIX = "@CAPSULE/";
|
|
44
44
|
const LOCAL_STORAGE_AUTH_INFO = `${PREFIX}authInfo`;
|
|
45
45
|
const LOCAL_STORAGE_EMAIL = `${PREFIX}e-mail`;
|
package/dist/esm/ParaCore.js
CHANGED
|
@@ -33,7 +33,8 @@ import {
|
|
|
33
33
|
toPregenTypeAndId,
|
|
34
34
|
toPregenIds,
|
|
35
35
|
isExternalWallet,
|
|
36
|
-
WALLET_TYPES
|
|
36
|
+
WALLET_TYPES,
|
|
37
|
+
isPregenAuth
|
|
37
38
|
} from "@getpara/user-management-client";
|
|
38
39
|
import forge from "node-forge";
|
|
39
40
|
const { pki, jsbn } = forge;
|
|
@@ -289,6 +290,7 @@ const _ParaCore = class _ParaCore {
|
|
|
289
290
|
this.portalTheme = opts.portalTheme;
|
|
290
291
|
this.platformUtils = this.getPlatformUtils();
|
|
291
292
|
this.disableProviderModal = this.platformUtils.disableProviderModal;
|
|
293
|
+
this.fetchPregenWalletsOverride = opts.fetchPregenWalletsOverride;
|
|
292
294
|
if (opts.useStorageOverrides) {
|
|
293
295
|
this.localStorageGetItem = opts.localStorageGetItemOverride;
|
|
294
296
|
this.localStorageSetItem = opts.localStorageSetItemOverride;
|
|
@@ -1618,7 +1620,6 @@ const _ParaCore = class _ParaCore {
|
|
|
1618
1620
|
}
|
|
1619
1621
|
onPoll == null ? void 0 : onPoll();
|
|
1620
1622
|
} catch (err) {
|
|
1621
|
-
console.error(err);
|
|
1622
1623
|
onPoll == null ? void 0 : onPoll();
|
|
1623
1624
|
}
|
|
1624
1625
|
}
|
|
@@ -2750,6 +2751,13 @@ const _ParaCore = class _ParaCore {
|
|
|
2750
2751
|
return __async(this, null, function* () {
|
|
2751
2752
|
var _p = _o, { auth } = _p, urlOptions = __objRest(_p, ["auth"]);
|
|
2752
2753
|
const serverAuthState = yield this.ctx.client.signUpOrLogIn(__spreadValues(__spreadValues({}, auth), this.getVerificationEmailProps()));
|
|
2754
|
+
const authInfo = serverAuthState.auth;
|
|
2755
|
+
if (this.fetchPregenWalletsOverride && isPregenAuth(authInfo)) {
|
|
2756
|
+
const { userShare } = yield this.fetchPregenWalletsOverride({ pregenId: authInfo });
|
|
2757
|
+
if (userShare) {
|
|
2758
|
+
yield this.setUserShare(userShare);
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2753
2761
|
return __privateMethod(this, _ParaCore_instances, prepareAuthState_fn).call(this, serverAuthState, urlOptions);
|
|
2754
2762
|
});
|
|
2755
2763
|
}
|
|
@@ -2982,7 +2990,8 @@ prepareLoginState_fn = function(_0, _1) {
|
|
|
2982
2990
|
passwordUrl: yield this.constructPortalUrl("loginPassword", {
|
|
2983
2991
|
sessionId: sessionLookupId,
|
|
2984
2992
|
shorten,
|
|
2985
|
-
portalTheme
|
|
2993
|
+
portalTheme,
|
|
2994
|
+
params: { isEmbedded: `${!loginState.isWalletSelectionNeeded}` }
|
|
2986
2995
|
})
|
|
2987
2996
|
} : {});
|
|
2988
2997
|
});
|
package/dist/esm/constants.js
CHANGED
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -120,6 +120,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
120
120
|
*/
|
|
121
121
|
externalWalletConnectionOnly?: boolean;
|
|
122
122
|
private disableProviderModal?;
|
|
123
|
+
private fetchPregenWalletsOverride?;
|
|
123
124
|
get isNoWalletConfig(): boolean;
|
|
124
125
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
125
126
|
get cosmosPrefix(): string | undefined;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
|
-
export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
|
|
2
|
+
export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type PregenAuth, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
|
|
3
3
|
export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, 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/coreApi.js';
|
|
5
5
|
export * from './types/events.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, TWalletScheme, TWalletType } from '@getpara/user-management-client';
|
|
2
|
+
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
|
|
3
3
|
import { Theme } from './theme.js';
|
|
4
4
|
export declare enum Environment {
|
|
5
5
|
DEV = "DEV",
|
|
@@ -140,4 +140,12 @@ export interface ConstructorOpts {
|
|
|
140
140
|
* Partner ID set in the Para Portal to track analytics for legacy SDK versions. This variable is unused outside of the Para Portal.
|
|
141
141
|
*/
|
|
142
142
|
portalPartnerId?: string;
|
|
143
|
+
/**
|
|
144
|
+
* An optional function that fetches the pregenerated wallets for a given identifier so a user can claim them on account creation.
|
|
145
|
+
*/
|
|
146
|
+
fetchPregenWalletsOverride?: (opts: {
|
|
147
|
+
pregenId: PregenAuth;
|
|
148
|
+
}) => Promise<{
|
|
149
|
+
userShare?: string;
|
|
150
|
+
}>;
|
|
143
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.19",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
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": "2.0.0-alpha.
|
|
13
|
+
"@getpara/user-management-client": "2.0.0-alpha.19",
|
|
14
14
|
"@noble/hashes": "^1.5.0",
|
|
15
15
|
"base64url": "^3.0.1",
|
|
16
16
|
"libphonenumber-js": "1.11.2",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"require": "./dist/cjs/index.js"
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "80d2c5d7e1203fb12378aa29bfd4d7003c7d7075"
|
|
45
45
|
}
|