@getpara/core-sdk 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +3378 -0
- package/dist/cjs/PlatformUtils.js +15 -0
- package/dist/cjs/StorageUtils.js +15 -0
- package/dist/cjs/constants.js +87 -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 +100 -3998
- package/dist/cjs/package.json +3 -0
- 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/auth.js +33 -0
- package/dist/cjs/types/config.js +43 -0
- package/dist/cjs/types/coreApi.js +89 -0
- package/dist/cjs/types/events.js +41 -0
- package/dist/cjs/types/index.js +54 -0
- package/dist/cjs/types/methods.js +15 -0
- package/dist/cjs/types/onRamps.js +33 -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/autobind.js +41 -0
- package/dist/cjs/utils/events.js +45 -0
- package/dist/cjs/utils/formatting.js +116 -0
- package/dist/cjs/utils/index.js +41 -0
- package/dist/cjs/utils/json.js +37 -0
- package/dist/cjs/utils/listeners.js +71 -0
- package/dist/cjs/utils/onRamps.js +92 -0
- package/dist/cjs/utils/phone.js +73 -0
- package/dist/cjs/utils/polling.js +58 -0
- package/dist/cjs/utils/types.js +29 -0
- package/dist/cjs/utils/url.js +135 -0
- package/dist/cjs/utils/wallet.js +159 -0
- package/dist/esm/ParaCore.js +3343 -0
- package/dist/esm/PlatformUtils.js +0 -0
- package/dist/esm/StorageUtils.js +0 -0
- package/dist/esm/chunk-7B52C2XE.js +70 -0
- package/dist/esm/constants.js +45 -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 +74 -3963
- package/dist/esm/package.json +4 -0
- 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/auth.js +11 -0
- package/dist/esm/types/config.js +20 -0
- package/dist/esm/types/coreApi.js +66 -0
- package/dist/esm/types/events.js +19 -0
- package/dist/esm/types/index.js +23 -0
- package/dist/esm/types/methods.js +0 -0
- package/dist/esm/types/onRamps.js +11 -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/autobind.js +19 -0
- package/dist/esm/utils/events.js +11 -0
- package/dist/esm/utils/formatting.js +76 -0
- package/dist/esm/utils/index.js +11 -0
- package/dist/esm/utils/json.js +15 -0
- package/dist/esm/utils/listeners.js +38 -0
- package/dist/esm/utils/onRamps.js +66 -0
- package/dist/esm/utils/phone.js +39 -0
- package/dist/esm/utils/polling.js +18 -0
- package/dist/esm/utils/types.js +7 -0
- package/dist/esm/utils/url.js +90 -0
- package/dist/esm/utils/wallet.js +103 -0
- package/dist/types/ParaCore.d.ts +178 -133
- package/dist/types/PlatformUtils.d.ts +4 -5
- package/dist/types/constants.d.ts +16 -13
- package/dist/types/index.d.ts +3 -3
- package/dist/types/shares/KeyContainer.d.ts +0 -2
- package/dist/types/types/auth.d.ts +16 -0
- package/dist/types/types/config.d.ts +12 -5
- package/dist/types/types/coreApi.d.ts +134 -40
- package/dist/types/types/events.d.ts +4 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/methods.d.ts +49 -9
- package/dist/types/types/onRamps.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +8 -3
- package/dist/types/utils/formatting.d.ts +5 -2
- package/dist/types/utils/onRamps.d.ts +12 -5
- package/dist/types/utils/phone.d.ts +4 -0
- package/dist/types/utils/wallet.d.ts +8 -7
- package/package.json +26 -26
- 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
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme,
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Theme, WalletFilters,
|
|
3
|
+
import { Ctx, Environment, Theme, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
export declare abstract class ParaCore implements CoreInterface {
|
|
6
6
|
#private;
|
|
7
7
|
static version?: string;
|
|
8
8
|
ctx: Ctx;
|
|
9
9
|
protected isNativePasskey: boolean;
|
|
10
|
+
protected isPartnerOptional?: boolean;
|
|
11
|
+
isReady: boolean;
|
|
10
12
|
get authInfo(): CoreAuthInfo | undefined;
|
|
11
13
|
get email(): AuthIdentifier<'email'> | undefined;
|
|
12
14
|
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
@@ -15,6 +17,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
15
17
|
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
16
18
|
get externalWalletConnectionType(): ExternalWalletConnectionType;
|
|
17
19
|
userId?: string;
|
|
20
|
+
accountLinkInProgress: AccountLinkInProgress | undefined;
|
|
18
21
|
private sessionCookie?;
|
|
19
22
|
private isAwaitingAccountCreation;
|
|
20
23
|
private isAwaitingLogin;
|
|
@@ -25,12 +28,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
25
28
|
get isFarcaster(): boolean;
|
|
26
29
|
get isTelegram(): boolean;
|
|
27
30
|
get isExternalWalletAuth(): boolean;
|
|
31
|
+
get isExternalWalletWithVerification(): boolean;
|
|
28
32
|
get partnerId(): string | undefined;
|
|
29
33
|
/**
|
|
30
34
|
* The IDs of the currently active wallets, for each supported wallet type. Any signer integrations will default to the first viable wallet ID in this dictionary.
|
|
31
35
|
*/
|
|
32
36
|
currentWalletIds: CurrentWalletIds;
|
|
33
|
-
get currentWalletIdsArray(): [string,
|
|
37
|
+
get currentWalletIdsArray(): [string, TWalletType][];
|
|
34
38
|
get currentWalletIdsUnique(): string[];
|
|
35
39
|
/**
|
|
36
40
|
* Wallets associated with the `ParaCore` instance. Retrieve a particular wallet using `para.wallets[walletId]`.
|
|
@@ -114,10 +118,17 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
114
118
|
* @deprecated configure theming through the developer portal
|
|
115
119
|
*/
|
|
116
120
|
portalTheme?: Theme;
|
|
121
|
+
/**
|
|
122
|
+
* Whether or not to treat external wallets as connections only, skipping all Para functionality.
|
|
123
|
+
*/
|
|
124
|
+
externalWalletConnectionOnly?: boolean;
|
|
117
125
|
private disableProviderModal?;
|
|
126
|
+
private fetchPregenWalletsOverride?;
|
|
127
|
+
get isNoWalletConfig(): boolean;
|
|
118
128
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
119
129
|
get cosmosPrefix(): string | undefined;
|
|
120
|
-
get
|
|
130
|
+
get supportedAccountLinks(): SupportedAccountLinks;
|
|
131
|
+
get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
|
|
121
132
|
private platformUtils;
|
|
122
133
|
private localStorageGetItem;
|
|
123
134
|
private localStorageSetItem;
|
|
@@ -131,7 +142,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
131
142
|
* Remove all local storage and prefixed session storage.
|
|
132
143
|
* @param {'local' | 'session' | 'secure' | 'all'} type - Type of storage to clear. Defaults to 'all'.
|
|
133
144
|
*/
|
|
134
|
-
clearStorage: (type?: CoreMethodParams<
|
|
145
|
+
clearStorage: (type?: CoreMethodParams<"clearStorage">) => CoreMethodResponse<"clearStorage">;
|
|
135
146
|
private convertBigInt;
|
|
136
147
|
private convertEncryptionKeyPair;
|
|
137
148
|
private isPortal;
|
|
@@ -147,12 +158,14 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
147
158
|
* @param {string} walletId the ID of the wallet address to display.
|
|
148
159
|
* @param {object} options additional options for formatting the address.
|
|
149
160
|
* @param {boolean} options.truncate whether to truncate the address.
|
|
150
|
-
* @param {
|
|
161
|
+
* @param {TWalletType} options.addressType the type of address to display.
|
|
151
162
|
* @returns the formatted address
|
|
152
163
|
*/
|
|
153
164
|
getDisplayAddress(walletId: string, options?: {
|
|
154
165
|
truncate?: boolean;
|
|
155
|
-
addressType?:
|
|
166
|
+
addressType?: TWalletType | undefined;
|
|
167
|
+
cosmosPrefix?: string;
|
|
168
|
+
targetLength?: number;
|
|
156
169
|
} | undefined): string;
|
|
157
170
|
/**
|
|
158
171
|
* Returns a unique hash for a wallet suitable for use as an identicon seed.
|
|
@@ -160,10 +173,11 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
160
173
|
* @param {boolean} options.addressType used to format the hash for another wallet type.
|
|
161
174
|
* @returns the identicon hash string
|
|
162
175
|
*/
|
|
163
|
-
getIdenticonHash(walletId: string, overrideType?:
|
|
176
|
+
getIdenticonHash(walletId: string, overrideType?: TWalletType): string | undefined;
|
|
164
177
|
getWallets(): Record<string, Wallet>;
|
|
165
178
|
getAddress(walletId?: string): string | undefined;
|
|
166
179
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
180
|
+
abstract isPasskeySupported(): Promise<boolean>;
|
|
167
181
|
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
168
182
|
/**
|
|
169
183
|
* Constructs a new `ParaCore` instance.
|
|
@@ -173,6 +187,8 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
173
187
|
* @returns - A new ParaCore instance.
|
|
174
188
|
*/
|
|
175
189
|
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
190
|
+
private trackError;
|
|
191
|
+
private wrapMethodsWithErrorTracking;
|
|
176
192
|
private initializeFromStorage;
|
|
177
193
|
private updateAuthInfoFromStorage;
|
|
178
194
|
private updateUserIdFromStorage;
|
|
@@ -190,13 +206,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
190
206
|
* Init only needs to be called for storage that is async.
|
|
191
207
|
*/
|
|
192
208
|
init(): Promise<void>;
|
|
209
|
+
protected abstract ready(): Promise<void>;
|
|
193
210
|
protected setAuth(auth: PrimaryAuth, { extras, userId }?: {
|
|
194
211
|
extras?: AuthExtras;
|
|
195
212
|
userId?: string;
|
|
196
213
|
}): Promise<typeof this.authInfo>;
|
|
197
214
|
protected assertUserId(): string;
|
|
198
215
|
protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
|
|
199
|
-
assertIsUser: any;
|
|
200
216
|
/**
|
|
201
217
|
* Sets the email associated with the `ParaCore` instance.
|
|
202
218
|
* @param email - Email to set.
|
|
@@ -212,7 +228,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
212
228
|
* @param phone - Phone number to set.
|
|
213
229
|
* @param countryCode - Country Code to set.
|
|
214
230
|
*/
|
|
215
|
-
|
|
231
|
+
setPhoneNumber(phone: `+${number}` | string, countryCode?: string): Promise<void>;
|
|
216
232
|
/**
|
|
217
233
|
* Sets the farcaster username associated with the `ParaCore` instance.
|
|
218
234
|
* @param farcasterUsername - Farcaster Username to set.
|
|
@@ -223,7 +239,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
223
239
|
* @param externalAddress - External wallet address to set.
|
|
224
240
|
* @param externalType - Type of external wallet to set.
|
|
225
241
|
*/
|
|
226
|
-
setExternalWallet(
|
|
242
|
+
setExternalWallet(externalWallet: ExternalWalletInfo[] | ExternalWalletInfo): Promise<void>;
|
|
227
243
|
/**
|
|
228
244
|
* Sets the user id associated with the `ParaCore` instance.
|
|
229
245
|
* @param userId - User id to set.
|
|
@@ -250,6 +266,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
250
266
|
* @returns - userId associated with the `ParaCore` instance.
|
|
251
267
|
*/
|
|
252
268
|
getUserId(): string | undefined;
|
|
269
|
+
getAuthInfo(): CoreAuthInfo | undefined;
|
|
253
270
|
/**
|
|
254
271
|
* Gets the email associated with the `ParaCore` instance.
|
|
255
272
|
* @returns - email associated with the `ParaCore` instance.
|
|
@@ -270,6 +287,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
270
287
|
sessionLookupId?: string;
|
|
271
288
|
newDeviceSessionLookupId?: string;
|
|
272
289
|
}): Promise<void>;
|
|
290
|
+
/**
|
|
291
|
+
* Fetches the most recent OAuth account metadata for the signed-in user.
|
|
292
|
+
* If applicable, this will include the user's most recent metadata from their Google, Apple, Facebook, X, Discord, Farcaster, or Telegram account, the last time they signed in to your app.
|
|
293
|
+
* @deprecated use `para.getLinkedAccounts({ withMetadata: true })` instead.
|
|
294
|
+
* @returns {Promise<AccountMetadata>} the user's account metadata.
|
|
295
|
+
*/
|
|
296
|
+
getAccountMetadata(): Promise<AccountMetadata>;
|
|
273
297
|
/**
|
|
274
298
|
* Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
|
|
275
299
|
* If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
|
|
@@ -286,14 +310,14 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
286
310
|
* @returns {string} the wallet ID originally passed, or the one found.
|
|
287
311
|
*/
|
|
288
312
|
findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
|
|
289
|
-
findWallet(idOrAddress?: string, overrideType?:
|
|
290
|
-
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal'>[];
|
|
313
|
+
findWallet(idOrAddress?: string, overrideType?: TWalletType, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
|
|
314
|
+
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'>[];
|
|
291
315
|
/**
|
|
292
316
|
* Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
|
|
293
317
|
* @param {string} type the wallet type to filter by.
|
|
294
318
|
* @returns {Wallet[]} an array of matching wallets.
|
|
295
319
|
*/
|
|
296
|
-
getWalletsByType(type:
|
|
320
|
+
getWalletsByType(type: CoreMethodParams<'getWalletsByType'>): CoreMethodResponse<'getWalletsByType'>;
|
|
297
321
|
private assertIsValidWalletId;
|
|
298
322
|
private assertIsValidWalletType;
|
|
299
323
|
private getMissingTypes;
|
|
@@ -318,10 +342,47 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
318
342
|
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
319
343
|
private populateWalletAddresses;
|
|
320
344
|
private populatePregenWalletAddresses;
|
|
345
|
+
/**
|
|
346
|
+
* Logs in or creates a new user using an external wallet address.
|
|
347
|
+
* @param {Object} opts the options object
|
|
348
|
+
* @param {string} opts.address the external wallet address to use for identification.
|
|
349
|
+
* @param {TWalletType} opts.type type of external wallet to use for identification.
|
|
350
|
+
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
351
|
+
*/
|
|
352
|
+
loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
|
|
353
|
+
verifyExternalWallet({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWallet'>): CoreMethodResponse<'verifyExternalWallet'>;
|
|
354
|
+
protected verifyExternalWalletLink(opts: InternalMethodParams<'verifyExternalWalletLink'>): InternalMethodResponse<'verifyExternalWalletLink'>;
|
|
355
|
+
protected verifyTelegramProcess(opts: CoreMethodParams<'verifyTelegram'> & {
|
|
356
|
+
isLinkAccount: false;
|
|
357
|
+
}): CoreMethodResponse<'verifyTelegram'>;
|
|
358
|
+
protected verifyTelegramProcess(opts: InternalMethodParams<'verifyTelegramLink'> & {
|
|
359
|
+
isLinkAccount: true;
|
|
360
|
+
}): InternalMethodResponse<'verifyTelegramLink'>;
|
|
361
|
+
verifyTelegram(opts: CoreMethodParams<'verifyTelegram'>): CoreMethodResponse<'verifyTelegram'>;
|
|
362
|
+
protected verifyTelegramLink(opts: InternalMethodParams<'verifyTelegramLink'>): InternalMethodResponse<'verifyTelegramLink'>;
|
|
363
|
+
/**
|
|
364
|
+
* Performs 2FA verification.
|
|
365
|
+
* @param {Object} opts the options object
|
|
366
|
+
* @param {string} opts.email the email to use for performing a 2FA verification.
|
|
367
|
+
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
368
|
+
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
369
|
+
*/
|
|
370
|
+
verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
|
|
371
|
+
/**
|
|
372
|
+
* Sets up two-factor authentication for the current user.
|
|
373
|
+
* @returns {string} uri - uri to use for setting up 2FA
|
|
374
|
+
* */
|
|
375
|
+
setup2fa(): CoreMethodResponse<'setup2fa'>;
|
|
376
|
+
/**
|
|
377
|
+
* Enables 2FA.
|
|
378
|
+
* @param {Object} opts the options object
|
|
379
|
+
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
380
|
+
*/
|
|
381
|
+
enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
|
|
321
382
|
/**
|
|
322
383
|
* Resend a verification email for the current user.
|
|
323
384
|
*/
|
|
324
|
-
resendVerificationCode(): CoreMethodResponse<'resendVerificationCode'>;
|
|
385
|
+
resendVerificationCode({ type: reason, }: CoreMethodParams<'resendVerificationCode'>): CoreMethodResponse<'resendVerificationCode'>;
|
|
325
386
|
/**
|
|
326
387
|
* Checks if the current session is active.
|
|
327
388
|
* @returns `true` if active, `false` otherwise
|
|
@@ -332,6 +393,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
332
393
|
* @returns `true` if active, `false` otherwise
|
|
333
394
|
**/
|
|
334
395
|
isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
|
|
396
|
+
get isGuestMode(): boolean;
|
|
335
397
|
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
336
398
|
/**
|
|
337
399
|
* Get hints associated with the users stored biometrics.
|
|
@@ -339,6 +401,45 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
339
401
|
* @returns Array containing useragents and AAGuids for stored biometrics
|
|
340
402
|
*/
|
|
341
403
|
protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
|
|
404
|
+
/**
|
|
405
|
+
* Waits for the session to be active.
|
|
406
|
+
**/
|
|
407
|
+
waitForSignup({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignup'>): CoreMethodResponse<'waitForSignup'>;
|
|
408
|
+
waitForWalletCreation({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreation'>): CoreMethodResponse<'waitForWalletCreation'>;
|
|
409
|
+
/**
|
|
410
|
+
* Initiates a Farcaster login attempt and returns the URL for the user to connect.
|
|
411
|
+
* You can create a QR code with this URI that works with Farcaster's mobile app.
|
|
412
|
+
* @return {string} the Farcaster connect URI
|
|
413
|
+
*/
|
|
414
|
+
getFarcasterConnectUri({ appScheme }?: {
|
|
415
|
+
appScheme?: string;
|
|
416
|
+
}): CoreMethodResponse<'getFarcasterConnectUri'>;
|
|
417
|
+
protected verifyFarcasterProcess(opts: CoreMethodParams<'verifyFarcaster'> & {
|
|
418
|
+
isLinkAccount: false;
|
|
419
|
+
}): CoreMethodResponse<'verifyFarcaster'>;
|
|
420
|
+
protected verifyFarcasterProcess(opts: InternalMethodParams<'verifyFarcasterLink'> & {
|
|
421
|
+
isLinkAccount: true;
|
|
422
|
+
}): InternalMethodResponse<'verifyFarcasterLink'>;
|
|
423
|
+
verifyFarcaster(opts: CoreMethodParams<'verifyFarcaster'>): CoreMethodResponse<'verifyFarcaster'>;
|
|
424
|
+
protected verifyFarcasterLink(opts: InternalMethodParams<'verifyFarcasterLink'>): InternalMethodResponse<'verifyFarcasterLink'>;
|
|
425
|
+
getOAuthUrl(opts: CoreMethodParams<'getOAuthUrl'>): CoreMethodResponse<'getOAuthUrl'>;
|
|
426
|
+
protected verifyOAuthProcess(_: InternalMethodParams<'verifyOAuthLink'> & {
|
|
427
|
+
isLinkAccount: true;
|
|
428
|
+
}): InternalMethodResponse<'verifyOAuthLink'>;
|
|
429
|
+
protected verifyOAuthProcess(_: CoreMethodParams<'verifyOAuth'> & {
|
|
430
|
+
isLinkAccount: false;
|
|
431
|
+
}): CoreMethodResponse<'verifyOAuth'>;
|
|
432
|
+
verifyOAuth(opts: CoreMethodParams<'verifyOAuth'>): CoreMethodResponse<'verifyOAuth'>;
|
|
433
|
+
protected verifyOAuthLink(opts: InternalMethodParams<'verifyOAuthLink'>): InternalMethodResponse<'verifyOAuthLink'>;
|
|
434
|
+
/**
|
|
435
|
+
* Waits for the session to be active and sets up the user.
|
|
436
|
+
*
|
|
437
|
+
* @param {Object} opts the options object
|
|
438
|
+
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
439
|
+
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
440
|
+
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
441
|
+
**/
|
|
442
|
+
waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
342
443
|
/**
|
|
343
444
|
* Updates the session with the user management server, possibly
|
|
344
445
|
* opening a popup to refresh the session.
|
|
@@ -400,7 +501,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
400
501
|
*
|
|
401
502
|
* @deprecated alias for `createWalletPerType`
|
|
402
503
|
**/
|
|
403
|
-
createWalletPerMissingType: ({ skipDistribute, types, }?: CoreMethodParams<
|
|
504
|
+
createWalletPerMissingType: ({ skipDistribute, types, }?: CoreMethodParams<"createWalletPerType">) => CoreMethodResponse<"createWalletPerType">;
|
|
404
505
|
/**
|
|
405
506
|
* Creates several new wallets with the desired types. If no types are provided, this method
|
|
406
507
|
* will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
|
|
@@ -409,7 +510,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
409
510
|
*
|
|
410
511
|
* @param {Object} [opts] the options object.
|
|
411
512
|
* @param {boolean} [opts.skipDistribute] if `true`, the wallets' recovery share will not be distributed.
|
|
412
|
-
* @param {
|
|
513
|
+
* @param {TWalletType[]} [opts.types] the types of wallets to create.
|
|
413
514
|
* @returns {Object} the wallets created, their ids, and the recovery secret.
|
|
414
515
|
**/
|
|
415
516
|
createWalletPerType({ skipDistribute, types, }?: CoreMethodParams<'createWalletPerType'>): CoreMethodResponse<'createWalletPerType'>;
|
|
@@ -429,11 +530,56 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
429
530
|
/**
|
|
430
531
|
* Creates a new wallet.
|
|
431
532
|
* @param {Object} opts the options object.
|
|
432
|
-
* @param {
|
|
533
|
+
* @param {TWalletType} opts.type the type of wallet to create.
|
|
433
534
|
* @param {boolean} opts.skipDistribute - if true, recovery share will not be distributed.
|
|
434
535
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
435
536
|
**/
|
|
436
537
|
createWallet({ type: _type, skipDistribute, }?: CoreMethodParams<'createWallet'>): CoreMethodResponse<'createWallet'>;
|
|
538
|
+
createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
|
|
539
|
+
/**
|
|
540
|
+
* Creates new pregenerated wallets for each desired type.
|
|
541
|
+
* If no types are provided, this method will create one for each of the non-optional types
|
|
542
|
+
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
543
|
+
* @param {Object} opts the options object.
|
|
544
|
+
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
545
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
546
|
+
* @param {TWalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
547
|
+
* @returns {Wallet[]} an array containing the created wallets.
|
|
548
|
+
**/
|
|
549
|
+
createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
|
|
550
|
+
/**
|
|
551
|
+
* Claims a pregenerated wallet.
|
|
552
|
+
* @param {Object} opts the options object.
|
|
553
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
554
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
555
|
+
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
556
|
+
**/
|
|
557
|
+
claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
|
|
558
|
+
/**
|
|
559
|
+
* Updates the identifier for a pregen wallet.
|
|
560
|
+
* @param {Object} opts the options object.
|
|
561
|
+
* @param {string} opts.walletId the pregen wallet ID
|
|
562
|
+
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
563
|
+
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
564
|
+
**/
|
|
565
|
+
updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
|
|
566
|
+
/**
|
|
567
|
+
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
568
|
+
* @param {Object} opts the options object.
|
|
569
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
570
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
571
|
+
* @returns {boolean} whether the pregen wallet exists
|
|
572
|
+
**/
|
|
573
|
+
hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
|
|
574
|
+
/**
|
|
575
|
+
* Get pregen wallets for the given identifier.
|
|
576
|
+
* @param {Object} opts the options object.
|
|
577
|
+
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
578
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
579
|
+
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
580
|
+
**/
|
|
581
|
+
getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
|
|
582
|
+
createGuestWallets(): CoreMethodResponse<'createGuestWallets'>;
|
|
437
583
|
private encodeWalletBase64;
|
|
438
584
|
/**
|
|
439
585
|
* Encodes the current wallets encoded in Base 64.
|
|
@@ -447,6 +593,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
447
593
|
setUserShare(base64Wallets: CoreMethodParams<'setUserShare'>): CoreMethodResponse<'setUserShare'>;
|
|
448
594
|
private getTransactionReviewUrl;
|
|
449
595
|
private getOnRampTransactionUrl;
|
|
596
|
+
getWalletBalance: ({ walletId, rpcUrl, }: CoreMethodParams<"getWalletBalance">) => CoreMethodResponse<"getWalletBalance">;
|
|
450
597
|
/**
|
|
451
598
|
* Signs a message using one of the current wallets.
|
|
452
599
|
*
|
|
@@ -485,34 +632,21 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
485
632
|
keepSessionAlive(): Promise<boolean>;
|
|
486
633
|
/**
|
|
487
634
|
* Serialize the current session for import by another Para instance.
|
|
635
|
+
* @param {boolean} excludeSigners - whether or not to exclude the signer from the exported wallets.
|
|
488
636
|
* @returns {string} the serialized session
|
|
489
637
|
*/
|
|
490
|
-
exportSession(): CoreMethodResponse<'exportSession'>;
|
|
638
|
+
exportSession({ excludeSigners }?: CoreMethodParams<'exportSession'>): CoreMethodResponse<'exportSession'>;
|
|
491
639
|
/**
|
|
492
640
|
* Imports a session serialized by another Para instance.
|
|
493
641
|
* @param {string} serializedInstanceBase64 the serialized session
|
|
494
642
|
*/
|
|
495
643
|
importSession(serializedInstanceBase64: CoreMethodParams<'importSession'>): CoreMethodResponse<'importSession'>;
|
|
496
|
-
/**
|
|
497
|
-
* @deprecated
|
|
498
|
-
*/
|
|
499
|
-
/**
|
|
500
|
-
* @deprecated
|
|
501
|
-
*/
|
|
502
|
-
/**
|
|
503
|
-
* @deprecated
|
|
504
|
-
*/
|
|
505
|
-
/**
|
|
506
|
-
* @deprecated
|
|
507
|
-
*/
|
|
508
|
-
/**
|
|
509
|
-
* @deprecated
|
|
510
|
-
*/
|
|
511
644
|
/**
|
|
512
645
|
* Retrieves a token to verify the current session.
|
|
513
646
|
* @returns {Promise<string>} the ID
|
|
514
647
|
**/
|
|
515
648
|
getVerificationToken(): CoreMethodResponse<'getVerificationToken'>;
|
|
649
|
+
issueJwt({ keyIndex }?: CoreMethodParams<'issueJwt'>): CoreMethodResponse<'issueJwt'>;
|
|
516
650
|
/**
|
|
517
651
|
* Logs the user out.
|
|
518
652
|
* @param {Object} opts the options object.
|
|
@@ -521,18 +655,17 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
521
655
|
logout({ clearPregenWallets }?: {
|
|
522
656
|
clearPregenWallets?: boolean;
|
|
523
657
|
}): Promise<void>;
|
|
524
|
-
|
|
525
|
-
protected getSupportedCreateAuthMethods(): Promise<Set<AuthMethod>>;
|
|
658
|
+
protected get toStringAdditions(): Record<string, unknown>;
|
|
526
659
|
/**
|
|
527
660
|
* Converts to a string, removing sensitive data when logging this class.
|
|
528
661
|
*
|
|
529
662
|
* Doesn't work for all types of logging.
|
|
530
663
|
**/
|
|
531
664
|
toString(): string;
|
|
532
|
-
|
|
665
|
+
protected devLog(...s: string[]): void;
|
|
533
666
|
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
534
667
|
credentialId: string;
|
|
535
|
-
url
|
|
668
|
+
url?: string;
|
|
536
669
|
}>;
|
|
537
670
|
/**
|
|
538
671
|
* Returns a Para Portal URL for logging in with a WebAuth passkey or a password.
|
|
@@ -543,101 +676,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
543
676
|
* @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
|
|
544
677
|
*/
|
|
545
678
|
protected getLoginUrl({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
|
|
546
|
-
protected getOAuthUrl({ method, deeplinkUrl }: OAuthUrlParams): Promise<string>;
|
|
547
679
|
signUpOrLogIn({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogIn'>): CoreMethodResponse<'signUpOrLogIn'>;
|
|
548
680
|
verifyNewAccount({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccount'>): CoreMethodResponse<'verifyNewAccount'>;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
*/
|
|
557
|
-
verifyTelegram({ telegramAuthResponse, ...urlOptions }: CoreMethodParams<'verifyTelegram'>): CoreMethodResponse<'verifyTelegram'>;
|
|
558
|
-
/**
|
|
559
|
-
* Waits for the session to be active and sets up the user.
|
|
560
|
-
*
|
|
561
|
-
* @param {Object} opts the options object
|
|
562
|
-
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
563
|
-
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
564
|
-
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
565
|
-
**/
|
|
566
|
-
waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
567
|
-
waitForSignup({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignup'>): CoreMethodResponse<'waitForSignup'>;
|
|
568
|
-
waitForWalletCreation({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreation'>): CoreMethodResponse<'waitForWalletCreation'>;
|
|
569
|
-
loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
|
|
570
|
-
verifyExternalWallet({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWallet'>): CoreMethodResponse<'verifyExternalWallet'>;
|
|
571
|
-
/**
|
|
572
|
-
* Performs 2FA verification.
|
|
573
|
-
* @param {Object} opts the options object
|
|
574
|
-
* @param {string} opts.email the email to use for performing a 2FA verification.
|
|
575
|
-
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
576
|
-
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
577
|
-
*/
|
|
578
|
-
verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
|
|
579
|
-
/**
|
|
580
|
-
* Sets up two-factor authentication for the current user.
|
|
581
|
-
* @returns {string} uri - uri to use for setting up 2FA
|
|
582
|
-
* */
|
|
583
|
-
setup2fa(): CoreMethodResponse<'setup2fa'>;
|
|
584
|
-
/**
|
|
585
|
-
* Enables 2FA.
|
|
586
|
-
* @param {Object} opts the options object
|
|
587
|
-
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
588
|
-
*/
|
|
589
|
-
enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
|
|
590
|
-
/**
|
|
591
|
-
* Creates a new pregenerated wallet.
|
|
592
|
-
*
|
|
593
|
-
* @param {Object} opts the options object.
|
|
594
|
-
* @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
|
|
595
|
-
* @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
|
|
596
|
-
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
597
|
-
* @returns {Wallet} the created wallet.
|
|
598
|
-
**/
|
|
599
|
-
createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
|
|
600
|
-
/**
|
|
601
|
-
* Creates new pregenerated wallets for each desired type.
|
|
602
|
-
* If no types are provided, this method will create one for each of the non-optional types
|
|
603
|
-
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
604
|
-
* @param {Object} opts the options object.
|
|
605
|
-
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
606
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
607
|
-
* @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
608
|
-
* @returns {Wallet[]} an array containing the created wallets.
|
|
609
|
-
**/
|
|
610
|
-
createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
|
|
611
|
-
/**
|
|
612
|
-
* Claims a pregenerated wallet.
|
|
613
|
-
* @param {Object} opts the options object.
|
|
614
|
-
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
615
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
616
|
-
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
617
|
-
**/
|
|
618
|
-
claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
|
|
619
|
-
/**
|
|
620
|
-
* Updates the identifier for a pregen wallet.
|
|
621
|
-
* @param {Object} opts the options object.
|
|
622
|
-
* @param {string} opts.walletId the pregen wallet ID
|
|
623
|
-
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
624
|
-
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
625
|
-
**/
|
|
626
|
-
updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
|
|
627
|
-
/**
|
|
628
|
-
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
629
|
-
* @param {Object} opts the options object.
|
|
630
|
-
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
631
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
632
|
-
* @returns {boolean} whether the pregen wallet exists
|
|
633
|
-
**/
|
|
634
|
-
hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
|
|
635
|
-
/**
|
|
636
|
-
* Get pregen wallets for the given identifier.
|
|
637
|
-
* @param {Object} opts the options object.
|
|
638
|
-
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
639
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
640
|
-
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
641
|
-
**/
|
|
642
|
-
getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
|
|
681
|
+
getLinkedAccounts({ withMetadata, }?: CoreMethodParams<'getLinkedAccounts'>): CoreMethodResponse<'getLinkedAccounts'>;
|
|
682
|
+
protected linkAccount(opts: InternalMethodParams<'linkAccount'>): InternalMethodResponse<'linkAccount'>;
|
|
683
|
+
protected unlinkAccount({ linkedAccountId, }: InternalMethodParams<'unlinkAccount'>): InternalMethodResponse<'unlinkAccount'>;
|
|
684
|
+
protected verifyLink({ accountLinkInProgress, ...opts }?: {
|
|
685
|
+
accountLinkInProgress?: AccountLinkInProgress;
|
|
686
|
+
} & Partial<Pick<VerifyLinkParams, 'verificationCode' | 'telegramAuthResponse'> & VerifyExternalWalletParams>): Promise<LinkedAccounts>;
|
|
687
|
+
protected verifyEmailOrPhoneLink({ verificationCode, }: InternalMethodParams<'verifyEmailOrPhoneLink'>): InternalMethodResponse<'verifyEmailOrPhoneLink'>;
|
|
643
688
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
|
|
1
|
+
import { BackupKitEmailProps, TPregenIdentifierType, TWalletType, SDKType } from '@getpara/user-management-client';
|
|
4
2
|
import { Ctx, PopupType, SignatureRes } from './types/index.js';
|
|
5
3
|
import { StorageUtils } from './StorageUtils.js';
|
|
6
4
|
export interface PlatformUtils {
|
|
5
|
+
sdkType: SDKType;
|
|
7
6
|
getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
|
|
8
|
-
keygen(ctx: Ctx, userId: string, type: Exclude<
|
|
7
|
+
keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
9
8
|
sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
10
9
|
signer: string;
|
|
11
10
|
walletId: string;
|
|
@@ -14,7 +13,7 @@ export interface PlatformUtils {
|
|
|
14
13
|
signer: string;
|
|
15
14
|
protocolId?: string;
|
|
16
15
|
}>;
|
|
17
|
-
preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<
|
|
16
|
+
preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
18
17
|
sessionCookie: string): Promise<{
|
|
19
18
|
signer: string;
|
|
20
19
|
walletId: string;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export declare const PARA_CORE_VERSION: string;
|
|
2
2
|
export declare const PREFIX = "@CAPSULE/";
|
|
3
|
-
export declare const LOCAL_STORAGE_AUTH_INFO
|
|
4
|
-
export declare const LOCAL_STORAGE_EMAIL
|
|
5
|
-
export declare const LOCAL_STORAGE_PHONE
|
|
6
|
-
export declare const LOCAL_STORAGE_COUNTRY_CODE
|
|
7
|
-
export declare const LOCAL_STORAGE_FARCASTER_USERNAME
|
|
8
|
-
export declare const LOCAL_STORAGE_TELEGRAM_USER_ID
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
3
|
+
export declare const LOCAL_STORAGE_AUTH_INFO = "@CAPSULE/authInfo";
|
|
4
|
+
export declare const LOCAL_STORAGE_EMAIL = "@CAPSULE/e-mail";
|
|
5
|
+
export declare const LOCAL_STORAGE_PHONE = "@CAPSULE/phone";
|
|
6
|
+
export declare const LOCAL_STORAGE_COUNTRY_CODE = "@CAPSULE/countryCode";
|
|
7
|
+
export declare const LOCAL_STORAGE_FARCASTER_USERNAME = "@CAPSULE/farcasterUsername";
|
|
8
|
+
export declare const LOCAL_STORAGE_TELEGRAM_USER_ID = "@CAPSULE/telegramUserId";
|
|
9
|
+
export declare const LOCAL_STORAGE_EXTERNAL_WALLET_USER_ID = "@CAPSULE/externalWalletUserId";
|
|
10
|
+
export declare const LOCAL_STORAGE_USER_ID = "@CAPSULE/userId";
|
|
11
|
+
export declare const LOCAL_STORAGE_ED25519_WALLETS = "@CAPSULE/ed25519Wallets";
|
|
12
|
+
export declare const LOCAL_STORAGE_WALLETS = "@CAPSULE/wallets";
|
|
13
|
+
export declare const LOCAL_STORAGE_EXTERNAL_WALLETS = "@CAPSULE/externalWallets";
|
|
14
|
+
export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS = "@CAPSULE/currentWalletIds";
|
|
15
|
+
export declare const LOCAL_STORAGE_SESSION_COOKIE = "@CAPSULE/sessionCookie";
|
|
16
|
+
export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
|
|
16
17
|
export declare const POLLING_INTERVAL_MS = 2000;
|
|
17
18
|
export declare const SHORT_POLLING_INTERVAL_MS = 1000;
|
|
18
19
|
export declare const POLLING_TIMEOUT_MS = 300000;
|
|
20
|
+
export declare const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
|
|
21
|
+
export declare const ACCOUNT_LINK_CONFLICT = "Account already linked";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
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, } from './types/index.js';
|
|
2
|
+
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, 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 TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, } from '@getpara/user-management-client';
|
|
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, type AccountLinkInProgress, AccountLinkError, type InternalInterface, } from './types/index.js';
|
|
4
4
|
export * from './types/coreApi.js';
|
|
5
5
|
export * from './types/events.js';
|
|
6
6
|
export * from './types/config.js';
|
|
@@ -19,7 +19,7 @@ export * from './utils/formatting.js';
|
|
|
19
19
|
export * from './utils/polling.js';
|
|
20
20
|
export * from './utils/phone.js';
|
|
21
21
|
export { isWalletSupported } from './utils/wallet.js';
|
|
22
|
-
export { getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
22
|
+
export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
23
23
|
export { getPortalBaseURL } from './utils/url.js';
|
|
24
24
|
export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
|
|
25
25
|
export declare const paraVersion: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ExternalWalletInfo, TLinkedAccountType } from '@getpara/user-management-client';
|
|
2
|
+
export type AccountLinkInProgress = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: TLinkedAccountType;
|
|
5
|
+
identifier?: string;
|
|
6
|
+
isComplete: boolean;
|
|
7
|
+
externalWallet?: ExternalWalletInfo & {
|
|
8
|
+
signatureVerificationMessage: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare enum AccountLinkError {
|
|
12
|
+
NotAuthenticated = "No user is currently authenticated",
|
|
13
|
+
Conflict = "Account already linked",
|
|
14
|
+
Canceled = "Account linking was canceled",
|
|
15
|
+
Unknown = "An unknown error occurred"
|
|
16
|
+
}
|