@getpara/core-sdk 2.0.0-dev.0 → 2.0.0-dev.2
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 +102 -4080
- 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 +78 -4049
- 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 +140 -367
- package/dist/types/PlatformUtils.d.ts +4 -5
- package/dist/types/constants.d.ts +17 -13
- package/dist/types/index.d.ts +5 -4
- 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 +531 -0
- package/dist/types/types/events.d.ts +4 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/methods.d.ts +145 -42
- package/dist/types/types/onRamps.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +8 -4
- package/dist/types/utils/formatting.d.ts +5 -2
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/onRamps.d.ts +12 -5
- package/dist/types/utils/phone.d.ts +6 -2
- package/dist/types/utils/types.d.ts +2 -0
- package/dist/types/utils/url.d.ts +2 -1
- package/dist/types/utils/wallet.d.ts +9 -7
- package/package.json +27 -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,11 +1,14 @@
|
|
|
1
|
-
import { AuthMethod,
|
|
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,
|
|
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
|
-
export declare abstract class ParaCore {
|
|
5
|
+
export declare abstract class ParaCore implements CoreInterface {
|
|
6
6
|
#private;
|
|
7
7
|
static version?: string;
|
|
8
8
|
ctx: Ctx;
|
|
9
|
+
protected isNativePasskey: boolean;
|
|
10
|
+
protected isPartnerOptional?: boolean;
|
|
11
|
+
isReady: boolean;
|
|
9
12
|
get authInfo(): CoreAuthInfo | undefined;
|
|
10
13
|
get email(): AuthIdentifier<'email'> | undefined;
|
|
11
14
|
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
@@ -14,6 +17,7 @@ export declare abstract class ParaCore {
|
|
|
14
17
|
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
15
18
|
get externalWalletConnectionType(): ExternalWalletConnectionType;
|
|
16
19
|
userId?: string;
|
|
20
|
+
accountLinkInProgress: AccountLinkInProgress | undefined;
|
|
17
21
|
private sessionCookie?;
|
|
18
22
|
private isAwaitingAccountCreation;
|
|
19
23
|
private isAwaitingLogin;
|
|
@@ -24,12 +28,13 @@ export declare abstract class ParaCore {
|
|
|
24
28
|
get isFarcaster(): boolean;
|
|
25
29
|
get isTelegram(): boolean;
|
|
26
30
|
get isExternalWalletAuth(): boolean;
|
|
31
|
+
get isExternalWalletWithVerification(): boolean;
|
|
27
32
|
get partnerId(): string | undefined;
|
|
28
33
|
/**
|
|
29
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.
|
|
30
35
|
*/
|
|
31
36
|
currentWalletIds: CurrentWalletIds;
|
|
32
|
-
get currentWalletIdsArray(): [string,
|
|
37
|
+
get currentWalletIdsArray(): [string, TWalletType][];
|
|
33
38
|
get currentWalletIdsUnique(): string[];
|
|
34
39
|
/**
|
|
35
40
|
* Wallets associated with the `ParaCore` instance. Retrieve a particular wallet using `para.wallets[walletId]`.
|
|
@@ -113,10 +118,17 @@ export declare abstract class ParaCore {
|
|
|
113
118
|
* @deprecated configure theming through the developer portal
|
|
114
119
|
*/
|
|
115
120
|
portalTheme?: Theme;
|
|
121
|
+
/**
|
|
122
|
+
* Whether or not to treat external wallets as connections only, skipping all Para functionality.
|
|
123
|
+
*/
|
|
124
|
+
externalWalletConnectionOnly?: boolean;
|
|
116
125
|
private disableProviderModal?;
|
|
126
|
+
private fetchPregenWalletsOverride?;
|
|
127
|
+
get isNoWalletConfig(): boolean;
|
|
117
128
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
118
129
|
get cosmosPrefix(): string | undefined;
|
|
119
|
-
get
|
|
130
|
+
get supportedAccountLinks(): SupportedAccountLinks;
|
|
131
|
+
get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
|
|
120
132
|
private platformUtils;
|
|
121
133
|
private localStorageGetItem;
|
|
122
134
|
private localStorageSetItem;
|
|
@@ -130,7 +142,7 @@ export declare abstract class ParaCore {
|
|
|
130
142
|
* Remove all local storage and prefixed session storage.
|
|
131
143
|
* @param {'local' | 'session' | 'secure' | 'all'} type - Type of storage to clear. Defaults to 'all'.
|
|
132
144
|
*/
|
|
133
|
-
clearStorage: (type?:
|
|
145
|
+
clearStorage: (type?: CoreMethodParams<"clearStorage">) => CoreMethodResponse<"clearStorage">;
|
|
134
146
|
private convertBigInt;
|
|
135
147
|
private convertEncryptionKeyPair;
|
|
136
148
|
private isPortal;
|
|
@@ -146,12 +158,14 @@ export declare abstract class ParaCore {
|
|
|
146
158
|
* @param {string} walletId the ID of the wallet address to display.
|
|
147
159
|
* @param {object} options additional options for formatting the address.
|
|
148
160
|
* @param {boolean} options.truncate whether to truncate the address.
|
|
149
|
-
* @param {
|
|
161
|
+
* @param {TWalletType} options.addressType the type of address to display.
|
|
150
162
|
* @returns the formatted address
|
|
151
163
|
*/
|
|
152
164
|
getDisplayAddress(walletId: string, options?: {
|
|
153
165
|
truncate?: boolean;
|
|
154
|
-
addressType?:
|
|
166
|
+
addressType?: TWalletType | undefined;
|
|
167
|
+
cosmosPrefix?: string;
|
|
168
|
+
targetLength?: number;
|
|
155
169
|
} | undefined): string;
|
|
156
170
|
/**
|
|
157
171
|
* Returns a unique hash for a wallet suitable for use as an identicon seed.
|
|
@@ -159,11 +173,12 @@ export declare abstract class ParaCore {
|
|
|
159
173
|
* @param {boolean} options.addressType used to format the hash for another wallet type.
|
|
160
174
|
* @returns the identicon hash string
|
|
161
175
|
*/
|
|
162
|
-
getIdenticonHash(walletId: string, overrideType?:
|
|
176
|
+
getIdenticonHash(walletId: string, overrideType?: TWalletType): string | undefined;
|
|
163
177
|
getWallets(): Record<string, Wallet>;
|
|
164
178
|
getAddress(walletId?: string): string | undefined;
|
|
165
179
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
166
|
-
|
|
180
|
+
abstract isPasskeySupported(): Promise<boolean>;
|
|
181
|
+
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
167
182
|
/**
|
|
168
183
|
* Constructs a new `ParaCore` instance.
|
|
169
184
|
* @param env - `Environment` to use.
|
|
@@ -172,6 +187,8 @@ export declare abstract class ParaCore {
|
|
|
172
187
|
* @returns - A new ParaCore instance.
|
|
173
188
|
*/
|
|
174
189
|
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
190
|
+
private trackError;
|
|
191
|
+
private wrapMethodsWithErrorTracking;
|
|
175
192
|
private initializeFromStorage;
|
|
176
193
|
private updateAuthInfoFromStorage;
|
|
177
194
|
private updateUserIdFromStorage;
|
|
@@ -189,10 +206,13 @@ export declare abstract class ParaCore {
|
|
|
189
206
|
* Init only needs to be called for storage that is async.
|
|
190
207
|
*/
|
|
191
208
|
init(): Promise<void>;
|
|
209
|
+
protected abstract ready(): Promise<void>;
|
|
192
210
|
protected setAuth(auth: PrimaryAuth, { extras, userId }?: {
|
|
193
211
|
extras?: AuthExtras;
|
|
194
212
|
userId?: string;
|
|
195
213
|
}): Promise<typeof this.authInfo>;
|
|
214
|
+
protected assertUserId(): string;
|
|
215
|
+
protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
|
|
196
216
|
/**
|
|
197
217
|
* Sets the email associated with the `ParaCore` instance.
|
|
198
218
|
* @param email - Email to set.
|
|
@@ -219,7 +239,7 @@ export declare abstract class ParaCore {
|
|
|
219
239
|
* @param externalAddress - External wallet address to set.
|
|
220
240
|
* @param externalType - Type of external wallet to set.
|
|
221
241
|
*/
|
|
222
|
-
setExternalWallet(
|
|
242
|
+
setExternalWallet(externalWallet: ExternalWalletInfo[] | ExternalWalletInfo): Promise<void>;
|
|
223
243
|
/**
|
|
224
244
|
* Sets the user id associated with the `ParaCore` instance.
|
|
225
245
|
* @param userId - User id to set.
|
|
@@ -246,6 +266,7 @@ export declare abstract class ParaCore {
|
|
|
246
266
|
* @returns - userId associated with the `ParaCore` instance.
|
|
247
267
|
*/
|
|
248
268
|
getUserId(): string | undefined;
|
|
269
|
+
getAuthInfo(): CoreAuthInfo | undefined;
|
|
249
270
|
/**
|
|
250
271
|
* Gets the email associated with the `ParaCore` instance.
|
|
251
272
|
* @returns - email associated with the `ParaCore` instance.
|
|
@@ -266,6 +287,13 @@ export declare abstract class ParaCore {
|
|
|
266
287
|
sessionLookupId?: string;
|
|
267
288
|
newDeviceSessionLookupId?: string;
|
|
268
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>;
|
|
269
297
|
/**
|
|
270
298
|
* Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
|
|
271
299
|
* If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
|
|
@@ -282,14 +310,14 @@ export declare abstract class ParaCore {
|
|
|
282
310
|
* @returns {string} the wallet ID originally passed, or the one found.
|
|
283
311
|
*/
|
|
284
312
|
findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
|
|
285
|
-
findWallet(idOrAddress?: string, overrideType?:
|
|
286
|
-
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'>[];
|
|
287
315
|
/**
|
|
288
316
|
* Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
|
|
289
317
|
* @param {string} type the wallet type to filter by.
|
|
290
318
|
* @returns {Wallet[]} an array of matching wallets.
|
|
291
319
|
*/
|
|
292
|
-
getWalletsByType(type:
|
|
320
|
+
getWalletsByType(type: CoreMethodParams<'getWalletsByType'>): CoreMethodResponse<'getWalletsByType'>;
|
|
293
321
|
private assertIsValidWalletId;
|
|
294
322
|
private assertIsValidWalletType;
|
|
295
323
|
private getMissingTypes;
|
|
@@ -301,28 +329,6 @@ export declare abstract class ParaCore {
|
|
|
301
329
|
* @returns - portal URL
|
|
302
330
|
*/
|
|
303
331
|
protected getPortalURL(): Promise<string>;
|
|
304
|
-
private getWebAuthURLForCreate;
|
|
305
|
-
private getPasswordURLForCreate;
|
|
306
|
-
private getShortUrl;
|
|
307
|
-
shortenLoginLink(link: string): Promise<string>;
|
|
308
|
-
/**
|
|
309
|
-
* Generates a URL for registering a new WebAuth passkey.
|
|
310
|
-
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
311
|
-
* @returns - the URL for creating a new passkey
|
|
312
|
-
*/
|
|
313
|
-
getWebAuthURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
314
|
-
/**
|
|
315
|
-
* Generates a URL for registering a new user password.
|
|
316
|
-
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
317
|
-
* @returns - the URL for creating a new password
|
|
318
|
-
*/
|
|
319
|
-
getPasswordURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
320
|
-
/**
|
|
321
|
-
* Generates a URL for registering a new WebAuth passkey for a phone number.
|
|
322
|
-
* @param {Omit<GetWebAuthUrlForLoginParams, 'authType'>} opts the options object
|
|
323
|
-
* @returns - web auth url
|
|
324
|
-
*/
|
|
325
|
-
getWebAuthURLForLoginForPhone(opts: Omit<GetWebAuthUrlForLoginParams, 'authType'>): Promise<string>;
|
|
326
332
|
/**
|
|
327
333
|
* Gets the private key for the given wallet.
|
|
328
334
|
* @param {string } [walletId] id of the wallet to get the private key for. Will default to the first wallet if not provided.
|
|
@@ -333,73 +339,27 @@ export declare abstract class ParaCore {
|
|
|
333
339
|
* Fetches the wallets associated with the user.
|
|
334
340
|
* @returns {WalletEntity[]} wallets that were fetched.
|
|
335
341
|
*/
|
|
336
|
-
fetchWallets():
|
|
342
|
+
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
337
343
|
private populateWalletAddresses;
|
|
338
344
|
private populatePregenWalletAddresses;
|
|
339
|
-
/**
|
|
340
|
-
* Checks if a user exists for an email address.
|
|
341
|
-
* @param {Object} opts the options object
|
|
342
|
-
* @param {string} opts.email the email to check.
|
|
343
|
-
* @returns true if user exists, false otherwise.
|
|
344
|
-
*/
|
|
345
|
-
checkIfUserExists({ email }: {
|
|
346
|
-
email: string;
|
|
347
|
-
}): Promise<boolean>;
|
|
348
|
-
/**
|
|
349
|
-
* Checks if a user exists for a phone number.
|
|
350
|
-
* @param {Object} opts the options object
|
|
351
|
-
* @param {string} opts.phone - phone number to check.
|
|
352
|
-
* @param {string} opts.countryCode - the country code.
|
|
353
|
-
* @returns true if user exists, false otherwise.
|
|
354
|
-
*/
|
|
355
|
-
checkIfUserExistsByPhone(auth: Auth<'phone'>): Promise<boolean>;
|
|
356
|
-
/**
|
|
357
|
-
* Creates a new user.
|
|
358
|
-
* @param {Object} opts the options object
|
|
359
|
-
* @param {string} opts.email the email to use.
|
|
360
|
-
*/
|
|
361
|
-
createUser({ email }: Auth<'email'>): Promise<void>;
|
|
362
|
-
/**
|
|
363
|
-
* Creates a new user with a phone number.
|
|
364
|
-
* @param {Object} opts the options object
|
|
365
|
-
* @param {string} opts.phone - the phone number to use for creating the user.
|
|
366
|
-
* @param {string} opts.countryCode - the country code to use for creating the user.
|
|
367
|
-
*/
|
|
368
|
-
createUserByPhone(auth: Auth<'phone'>): Promise<void>;
|
|
369
345
|
/**
|
|
370
346
|
* Logs in or creates a new user using an external wallet address.
|
|
371
347
|
* @param {Object} opts the options object
|
|
372
348
|
* @param {string} opts.address the external wallet address to use for identification.
|
|
373
|
-
* @param {
|
|
349
|
+
* @param {TWalletType} opts.type type of external wallet to use for identification.
|
|
374
350
|
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
375
351
|
*/
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* Passes the phone code obtained from the user for verification.
|
|
389
|
-
* @param {Object} opts the options object
|
|
390
|
-
* @param {string} verificationCode the six-digit code to check
|
|
391
|
-
* @returns {string} the web auth url for creating a new credential
|
|
392
|
-
*/
|
|
393
|
-
verifyPhone({ verificationCode }: {
|
|
394
|
-
verificationCode: string;
|
|
395
|
-
}): Promise<string>;
|
|
396
|
-
/**
|
|
397
|
-
* Validates the response received from an attempted Telegram login for authenticity, then
|
|
398
|
-
* creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
|
|
399
|
-
* @param authResponse - the response JSON object received from the Telegram widget.
|
|
400
|
-
* @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
|
|
401
|
-
*/
|
|
402
|
-
verifyTelegram(authObject: TelegramAuthResponse): Promise<VerifyTelegramRes>;
|
|
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'>;
|
|
403
363
|
/**
|
|
404
364
|
* Performs 2FA verification.
|
|
405
365
|
* @param {Object} opts the options object
|
|
@@ -407,181 +367,70 @@ export declare abstract class ParaCore {
|
|
|
407
367
|
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
408
368
|
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
409
369
|
*/
|
|
410
|
-
|
|
411
|
-
email: string;
|
|
412
|
-
verificationCode: string;
|
|
413
|
-
}): Promise<{
|
|
414
|
-
initiatedAt?: Date;
|
|
415
|
-
status?: RecoveryStatus;
|
|
416
|
-
userId: string;
|
|
417
|
-
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
418
|
-
}>;
|
|
419
|
-
/**
|
|
420
|
-
* Performs 2FA verification.
|
|
421
|
-
* @param {Object} opts the options object
|
|
422
|
-
* @param {string} opts.phone the phone number
|
|
423
|
-
* @param {string} opts.countryCode - the country code
|
|
424
|
-
* @param {string} opts.verificationCode - verification code to received via 2FA.
|
|
425
|
-
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
426
|
-
*/
|
|
427
|
-
verify2FAForPhone({ phone, verificationCode, }: Auth<'phone'> & {
|
|
428
|
-
verificationCode: string;
|
|
429
|
-
}): Promise<{
|
|
430
|
-
initiatedAt?: Date;
|
|
431
|
-
status?: RecoveryStatus;
|
|
432
|
-
userId: string;
|
|
433
|
-
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
434
|
-
}>;
|
|
370
|
+
verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
|
|
435
371
|
/**
|
|
436
372
|
* Sets up two-factor authentication for the current user.
|
|
437
373
|
* @returns {string} uri - uri to use for setting up 2FA
|
|
438
374
|
* */
|
|
439
|
-
|
|
440
|
-
uri?: string;
|
|
441
|
-
}>;
|
|
375
|
+
setup2fa(): CoreMethodResponse<'setup2fa'>;
|
|
442
376
|
/**
|
|
443
377
|
* Enables 2FA.
|
|
444
378
|
* @param {Object} opts the options object
|
|
445
379
|
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
446
380
|
*/
|
|
447
|
-
|
|
448
|
-
verificationCode: string;
|
|
449
|
-
}): Promise<void>;
|
|
450
|
-
/**
|
|
451
|
-
* Determines if 2FA has been set up.
|
|
452
|
-
* @returns {Object} `{ isSetup: boolean }` - true if 2FA is setup, false otherwise
|
|
453
|
-
*/
|
|
454
|
-
check2FAStatus(): Promise<{
|
|
455
|
-
isSetup: boolean;
|
|
456
|
-
}>;
|
|
381
|
+
enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
|
|
457
382
|
/**
|
|
458
383
|
* Resend a verification email for the current user.
|
|
459
384
|
*/
|
|
460
|
-
resendVerificationCode():
|
|
461
|
-
/**
|
|
462
|
-
* Resend a verification SMS for the current user.
|
|
463
|
-
*/
|
|
464
|
-
resendVerificationCodeByPhone(): Promise<void>;
|
|
465
|
-
/**
|
|
466
|
-
* Returns a URL for setting up a new WebAuth passkey.
|
|
467
|
-
* @param {Object} opts the options object
|
|
468
|
-
* @param {string} opts.authType - the auth type to use
|
|
469
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
470
|
-
* @returns {string} the URL
|
|
471
|
-
*/
|
|
472
|
-
getSetUpBiometricsURL({ authType, isForNewDevice, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice'>): Promise<string>;
|
|
473
|
-
/**
|
|
474
|
-
* Returns a URL for setting up a new WebAuth passkey for a phone number.
|
|
475
|
-
* @param {Object} opts the options object
|
|
476
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
477
|
-
* @returns {string} the URL
|
|
478
|
-
*/
|
|
479
|
-
getSetUpBiometricsURLForPhone({ isForNewDevice, }?: Pick<PortalUrlOptions, 'isForNewDevice'>): Promise<string>;
|
|
480
|
-
/**
|
|
481
|
-
* Returns a URL for setting up a new password.
|
|
482
|
-
* @param {Object} opts the options object
|
|
483
|
-
* @param {string} opts.authType - the auth type to use
|
|
484
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
485
|
-
* @param {Theme} [opts.theme] the portal theme to use in place of the partner's default
|
|
486
|
-
* @returns {string} the URL
|
|
487
|
-
*/
|
|
488
|
-
getSetupPasswordURL({ authType, isForNewDevice, theme, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice' | 'theme'>): Promise<string>;
|
|
385
|
+
resendVerificationCode({ type: reason, }: CoreMethodParams<'resendVerificationCode'>): CoreMethodResponse<'resendVerificationCode'>;
|
|
489
386
|
/**
|
|
490
387
|
* Checks if the current session is active.
|
|
491
388
|
* @returns `true` if active, `false` otherwise
|
|
492
389
|
*/
|
|
493
|
-
isSessionActive():
|
|
390
|
+
isSessionActive(): CoreMethodResponse<'isSessionActive'>;
|
|
494
391
|
/**
|
|
495
392
|
* Checks if a session is active and a wallet exists.
|
|
496
393
|
* @returns `true` if active, `false` otherwise
|
|
497
394
|
**/
|
|
498
|
-
isFullyLoggedIn():
|
|
395
|
+
isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
|
|
396
|
+
get isGuestMode(): boolean;
|
|
499
397
|
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
500
398
|
/**
|
|
501
399
|
* Get hints associated with the users stored biometrics.
|
|
400
|
+
* @deprecated
|
|
502
401
|
* @returns Array containing useragents and AAGuids for stored biometrics
|
|
503
402
|
*/
|
|
504
403
|
protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
|
|
505
|
-
/**
|
|
506
|
-
* Initiates a login.
|
|
507
|
-
* @param {Object} opts the options object
|
|
508
|
-
* @param {String} opts.email - the email to login with
|
|
509
|
-
* @param {boolean} opts.useShortURL - whether to shorten the link
|
|
510
|
-
* @returns - the WebAuth URL for logging in
|
|
511
|
-
**/
|
|
512
|
-
initiateUserLogin({ useShortUrl, ...auth }: PrimaryAuth & {
|
|
513
|
-
useShortUrl?: boolean;
|
|
514
|
-
}): Promise<string>;
|
|
515
|
-
/**
|
|
516
|
-
* Initiates a login.
|
|
517
|
-
* @param email - the email to login with
|
|
518
|
-
* @returns - a set of supported auth methods for the user
|
|
519
|
-
**/
|
|
520
|
-
initiateUserLoginV2(auth: PrimaryAuth): Promise<Set<AuthMethod>>;
|
|
521
|
-
/**
|
|
522
|
-
* Initiates a login.
|
|
523
|
-
* @param opts the options object
|
|
524
|
-
* @param opts.phone the phone number
|
|
525
|
-
* @param opts.countryCode the country code
|
|
526
|
-
* @param opts.useShortURL - whether to shorten the link
|
|
527
|
-
* @returns - the WebAuth URL for logging in
|
|
528
|
-
**/
|
|
529
|
-
initiateUserLoginForPhone({ useShortUrl, ...auth }: Auth<'phone'> & {
|
|
530
|
-
useShortUrl?: boolean;
|
|
531
|
-
}): Promise<string>;
|
|
532
404
|
/**
|
|
533
405
|
* Waits for the session to be active.
|
|
534
406
|
**/
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
popupWindow?: Window;
|
|
540
|
-
}): Promise<AccountSetupResponse>;
|
|
541
|
-
/**
|
|
542
|
-
* Initiates a Farcaster login attempt and return the URI for the user to connect.
|
|
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.
|
|
543
411
|
* You can create a QR code with this URI that works with Farcaster's mobile app.
|
|
544
412
|
* @return {string} the Farcaster connect URI
|
|
545
413
|
*/
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
getOAuthURL({ method, deeplinkUrl }: {
|
|
567
|
-
method: OAuthMethod;
|
|
568
|
-
deeplinkUrl?: string;
|
|
569
|
-
}): Promise<string>;
|
|
570
|
-
/**
|
|
571
|
-
* Awaits the response from a user's attempt to log in with OAuth.
|
|
572
|
-
* If successful, this returns the user's email address and indicates whether the user already exists.
|
|
573
|
-
*
|
|
574
|
-
* @param {Object} opts the options object.
|
|
575
|
-
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
576
|
-
* @return {Object} `{ email?: string; isError?: boolean; userExists: boolean; }` the result data
|
|
577
|
-
*/
|
|
578
|
-
waitForOAuth({ popupWindow }?: {
|
|
579
|
-
popupWindow?: Window | null;
|
|
580
|
-
}): Promise<{
|
|
581
|
-
email?: string;
|
|
582
|
-
isError?: boolean;
|
|
583
|
-
userExists: boolean;
|
|
584
|
-
}>;
|
|
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'>;
|
|
585
434
|
/**
|
|
586
435
|
* Waits for the session to be active and sets up the user.
|
|
587
436
|
*
|
|
@@ -590,10 +439,7 @@ export declare abstract class ParaCore {
|
|
|
590
439
|
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
591
440
|
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
592
441
|
**/
|
|
593
|
-
|
|
594
|
-
popupWindow?: Window | null;
|
|
595
|
-
skipSessionRefresh?: boolean;
|
|
596
|
-
}): Promise<LoginResponse>;
|
|
442
|
+
waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
597
443
|
/**
|
|
598
444
|
* Updates the session with the user management server, possibly
|
|
599
445
|
* opening a popup to refresh the session.
|
|
@@ -602,9 +448,7 @@ export declare abstract class ParaCore {
|
|
|
602
448
|
* @param {boolean} [shouldOpenPopup] - if `true`, the running device will open a popup to reauthenticate the user.
|
|
603
449
|
* @returns a URL for the user to reauthenticate.
|
|
604
450
|
**/
|
|
605
|
-
refreshSession({ shouldOpenPopup }?:
|
|
606
|
-
shouldOpenPopup?: boolean;
|
|
607
|
-
}): Promise<string>;
|
|
451
|
+
refreshSession({ shouldOpenPopup, }?: CoreMethodParams<'refreshSession'>): CoreMethodResponse<'refreshSession'>;
|
|
608
452
|
/**
|
|
609
453
|
* Call this method after login to ensure that the user ID is set
|
|
610
454
|
* internally.
|
|
@@ -625,7 +469,7 @@ export declare abstract class ParaCore {
|
|
|
625
469
|
* @param {any[]} opts.temporaryShares optional temporary shares to use for decryption.
|
|
626
470
|
* @param {boolean} [opts.skipSessionRefresh] - whether or not to skip refreshing the session.
|
|
627
471
|
**/
|
|
628
|
-
setupAfterLogin({ temporaryShares, skipSessionRefresh, }?: {
|
|
472
|
+
protected setupAfterLogin({ temporaryShares, skipSessionRefresh, }?: {
|
|
629
473
|
temporaryShares?: any[];
|
|
630
474
|
skipSessionRefresh?: boolean;
|
|
631
475
|
}): Promise<void>;
|
|
@@ -638,12 +482,7 @@ export declare abstract class ParaCore {
|
|
|
638
482
|
* @param {boolean} opts.forceRefreshRecovery whether or not to force recovery secret regeneration. Used when regenerating recovery shares.
|
|
639
483
|
* @returns {string} the recovery share.
|
|
640
484
|
**/
|
|
641
|
-
distributeNewWalletShare({ walletId, userShare, skipBiometricShareCreation, forceRefresh, }:
|
|
642
|
-
walletId: string;
|
|
643
|
-
userShare?: string;
|
|
644
|
-
skipBiometricShareCreation?: boolean;
|
|
645
|
-
forceRefresh?: boolean;
|
|
646
|
-
}): Promise<string>;
|
|
485
|
+
distributeNewWalletShare({ walletId, userShare, skipBiometricShareCreation, forceRefresh, }: CoreMethodParams<'distributeNewWalletShare'>): CoreMethodResponse<'distributeNewWalletShare'>;
|
|
647
486
|
private waitForWalletAddress;
|
|
648
487
|
/**
|
|
649
488
|
* Waits for a pregen wallet address to be created.
|
|
@@ -662,14 +501,7 @@ export declare abstract class ParaCore {
|
|
|
662
501
|
*
|
|
663
502
|
* @deprecated alias for `createWalletPerType`
|
|
664
503
|
**/
|
|
665
|
-
createWalletPerMissingType: ({ skipDistribute, types, }?:
|
|
666
|
-
skipDistribute?: boolean;
|
|
667
|
-
types?: WalletType[];
|
|
668
|
-
}) => Promise<{
|
|
669
|
-
wallets: Wallet[];
|
|
670
|
-
walletIds: CurrentWalletIds;
|
|
671
|
-
recoverySecret?: string;
|
|
672
|
-
}>;
|
|
504
|
+
createWalletPerMissingType: ({ skipDistribute, types, }?: CoreMethodParams<"createWalletPerType">) => CoreMethodResponse<"createWalletPerType">;
|
|
673
505
|
/**
|
|
674
506
|
* Creates several new wallets with the desired types. If no types are provided, this method
|
|
675
507
|
* will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
|
|
@@ -678,17 +510,10 @@ export declare abstract class ParaCore {
|
|
|
678
510
|
*
|
|
679
511
|
* @param {Object} [opts] the options object.
|
|
680
512
|
* @param {boolean} [opts.skipDistribute] if `true`, the wallets' recovery share will not be distributed.
|
|
681
|
-
* @param {
|
|
513
|
+
* @param {TWalletType[]} [opts.types] the types of wallets to create.
|
|
682
514
|
* @returns {Object} the wallets created, their ids, and the recovery secret.
|
|
683
515
|
**/
|
|
684
|
-
createWalletPerType({ skipDistribute, types, }?:
|
|
685
|
-
skipDistribute?: boolean;
|
|
686
|
-
types?: WalletType[];
|
|
687
|
-
}): Promise<{
|
|
688
|
-
wallets: Wallet[];
|
|
689
|
-
walletIds: CurrentWalletIds;
|
|
690
|
-
recoverySecret?: string;
|
|
691
|
-
}>;
|
|
516
|
+
createWalletPerType({ skipDistribute, types, }?: CoreMethodParams<'createWalletPerType'>): CoreMethodResponse<'createWalletPerType'>;
|
|
692
517
|
/**
|
|
693
518
|
* Refresh the current user share for a wallet.
|
|
694
519
|
*
|
|
@@ -701,44 +526,16 @@ export declare abstract class ParaCore {
|
|
|
701
526
|
* @param {boolean} [opts.redistributeBackupEncryptedShares] whether or not to redistribute backup encrypted shares.
|
|
702
527
|
* @returns {Object} the new user share and recovery secret.
|
|
703
528
|
**/
|
|
704
|
-
refreshShare({ walletId, share, oldPartnerId, newPartnerId, keyShareProtocolId, redistributeBackupEncryptedShares, }:
|
|
705
|
-
walletId: string;
|
|
706
|
-
share: string;
|
|
707
|
-
oldPartnerId?: string;
|
|
708
|
-
newPartnerId?: string;
|
|
709
|
-
keyShareProtocolId?: string;
|
|
710
|
-
redistributeBackupEncryptedShares?: boolean;
|
|
711
|
-
emailProps?: BackupKitEmailProps;
|
|
712
|
-
}): Promise<{
|
|
713
|
-
signer: string;
|
|
714
|
-
recoverySecret?: string;
|
|
715
|
-
protocolId: string;
|
|
716
|
-
}>;
|
|
529
|
+
refreshShare({ walletId, share, oldPartnerId, newPartnerId, keyShareProtocolId, redistributeBackupEncryptedShares, }: CoreMethodParams<'refreshShare'>): CoreMethodResponse<'refreshShare'>;
|
|
717
530
|
/**
|
|
718
531
|
* Creates a new wallet.
|
|
719
532
|
* @param {Object} opts the options object.
|
|
720
|
-
* @param {
|
|
533
|
+
* @param {TWalletType} opts.type the type of wallet to create.
|
|
721
534
|
* @param {boolean} opts.skipDistribute - if true, recovery share will not be distributed.
|
|
722
535
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
723
536
|
**/
|
|
724
|
-
createWallet({ type: _type, skipDistribute, }?:
|
|
725
|
-
|
|
726
|
-
skipDistribute?: boolean;
|
|
727
|
-
}): Promise<[Wallet, string | null]>;
|
|
728
|
-
/**
|
|
729
|
-
* Creates a new pregenerated wallet.
|
|
730
|
-
*
|
|
731
|
-
* @param {Object} opts the options object.
|
|
732
|
-
* @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
|
|
733
|
-
* @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
|
|
734
|
-
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
735
|
-
* @returns {Wallet} the created wallet.
|
|
736
|
-
**/
|
|
737
|
-
createPregenWallet(opts: {
|
|
738
|
-
type: WalletType;
|
|
739
|
-
pregenIdentifier: string;
|
|
740
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
741
|
-
}): Promise<Wallet>;
|
|
537
|
+
createWallet({ type: _type, skipDistribute, }?: CoreMethodParams<'createWallet'>): CoreMethodResponse<'createWallet'>;
|
|
538
|
+
createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
|
|
742
539
|
/**
|
|
743
540
|
* Creates new pregenerated wallets for each desired type.
|
|
744
541
|
* If no types are provided, this method will create one for each of the non-optional types
|
|
@@ -746,26 +543,18 @@ export declare abstract class ParaCore {
|
|
|
746
543
|
* @param {Object} opts the options object.
|
|
747
544
|
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
748
545
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
749
|
-
* @param {
|
|
546
|
+
* @param {TWalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
750
547
|
* @returns {Wallet[]} an array containing the created wallets.
|
|
751
548
|
**/
|
|
752
|
-
createPregenWalletPerType({ types,
|
|
753
|
-
pregenIdentifier: string;
|
|
754
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
755
|
-
types?: WalletType[];
|
|
756
|
-
}): Promise<Wallet[]>;
|
|
549
|
+
createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
|
|
757
550
|
/**
|
|
758
551
|
* Claims a pregenerated wallet.
|
|
759
|
-
*
|
|
760
552
|
* @param {Object} opts the options object.
|
|
761
553
|
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
762
554
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
763
555
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
764
556
|
**/
|
|
765
|
-
claimPregenWallets({
|
|
766
|
-
pregenIdentifier?: string;
|
|
767
|
-
pregenIdentifierType?: TPregenIdentifierType;
|
|
768
|
-
}): Promise<string | undefined>;
|
|
557
|
+
claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
|
|
769
558
|
/**
|
|
770
559
|
* Updates the identifier for a pregen wallet.
|
|
771
560
|
* @param {Object} opts the options object.
|
|
@@ -773,11 +562,7 @@ export declare abstract class ParaCore {
|
|
|
773
562
|
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
774
563
|
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
775
564
|
**/
|
|
776
|
-
updatePregenWalletIdentifier({ walletId,
|
|
777
|
-
walletId: string;
|
|
778
|
-
newPregenIdentifier: string;
|
|
779
|
-
newPregenIdentifierType: TPregenIdentifierType;
|
|
780
|
-
}): Promise<void>;
|
|
565
|
+
updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
|
|
781
566
|
/**
|
|
782
567
|
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
783
568
|
* @param {Object} opts the options object.
|
|
@@ -785,10 +570,7 @@ export declare abstract class ParaCore {
|
|
|
785
570
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
786
571
|
* @returns {boolean} whether the pregen wallet exists
|
|
787
572
|
**/
|
|
788
|
-
hasPregenWallet({
|
|
789
|
-
pregenIdentifier: string;
|
|
790
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
791
|
-
}): Promise<boolean>;
|
|
573
|
+
hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
|
|
792
574
|
/**
|
|
793
575
|
* Get pregen wallets for the given identifier.
|
|
794
576
|
* @param {Object} opts the options object.
|
|
@@ -796,23 +578,22 @@ export declare abstract class ParaCore {
|
|
|
796
578
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
797
579
|
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
798
580
|
**/
|
|
799
|
-
getPregenWallets({
|
|
800
|
-
|
|
801
|
-
pregenIdentifierType?: TPregenIdentifierType;
|
|
802
|
-
}): Promise<WalletEntity[]>;
|
|
581
|
+
getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
|
|
582
|
+
createGuestWallets(): CoreMethodResponse<'createGuestWallets'>;
|
|
803
583
|
private encodeWalletBase64;
|
|
804
584
|
/**
|
|
805
585
|
* Encodes the current wallets encoded in Base 64.
|
|
806
586
|
* @returns {string} the encoded wallet string
|
|
807
587
|
**/
|
|
808
|
-
getUserShare():
|
|
588
|
+
getUserShare(): CoreMethodResponse<'getUserShare'>;
|
|
809
589
|
/**
|
|
810
590
|
* Sets the current wallets from a Base 64 string.
|
|
811
591
|
* @param {string} base64Wallet the encoded wallet string
|
|
812
592
|
**/
|
|
813
|
-
setUserShare(base64Wallets:
|
|
593
|
+
setUserShare(base64Wallets: CoreMethodParams<'setUserShare'>): CoreMethodResponse<'setUserShare'>;
|
|
814
594
|
private getTransactionReviewUrl;
|
|
815
595
|
private getOnRampTransactionUrl;
|
|
596
|
+
getWalletBalance: ({ walletId, rpcUrl, }: CoreMethodParams<"getWalletBalance">) => CoreMethodResponse<"getWalletBalance">;
|
|
816
597
|
/**
|
|
817
598
|
* Signs a message using one of the current wallets.
|
|
818
599
|
*
|
|
@@ -824,12 +605,7 @@ export declare abstract class ParaCore {
|
|
|
824
605
|
* @param {number} [opts.timeout] optional timeout in milliseconds. If not present, defaults to 30 seconds.
|
|
825
606
|
* @param {string} [opts.cosmosSignDocBase64] the Cosmos `SignDoc` in base64, if applicable
|
|
826
607
|
**/
|
|
827
|
-
signMessage({ walletId, messageBase64, timeoutMs, cosmosSignDocBase64, }:
|
|
828
|
-
walletId: string;
|
|
829
|
-
messageBase64: string;
|
|
830
|
-
timeoutMs?: number;
|
|
831
|
-
cosmosSignDocBase64?: string;
|
|
832
|
-
}): Promise<FullSignatureRes>;
|
|
608
|
+
signMessage({ walletId, messageBase64, timeoutMs, cosmosSignDocBase64, isCanceled, onCancel, onPoll, }: CoreMethodParams<'signMessage'>): CoreMethodResponse<'signMessage'>;
|
|
833
609
|
private signMessageInner;
|
|
834
610
|
/**
|
|
835
611
|
* Signs a transaction.
|
|
@@ -839,24 +615,7 @@ export declare abstract class ParaCore {
|
|
|
839
615
|
* @param {string} [opts.chainId] the EVM chain id of the chain the transaction is being sent on, if applicable
|
|
840
616
|
* @param {number} [opts.timeoutMs] the amount of time to wait for the user to sign the transaction, in milliseconds
|
|
841
617
|
**/
|
|
842
|
-
signTransaction({ walletId, rlpEncodedTxBase64, chainId, timeoutMs, }:
|
|
843
|
-
walletId: string;
|
|
844
|
-
rlpEncodedTxBase64: string;
|
|
845
|
-
chainId: string;
|
|
846
|
-
timeoutMs?: number;
|
|
847
|
-
}): Promise<FullSignatureRes>;
|
|
848
|
-
/**
|
|
849
|
-
* @deprecated
|
|
850
|
-
* Sends a transaction.
|
|
851
|
-
* @param walletId - id of the wallet to send the transaction from.
|
|
852
|
-
* @param rlpEncodedTxBase64 - rlp encoded tx as base64 string
|
|
853
|
-
* @param chainId - chain id of the chain the transaction is being sent on.
|
|
854
|
-
**/
|
|
855
|
-
sendTransaction({ walletId, rlpEncodedTxBase64, chainId, }: {
|
|
856
|
-
walletId: string;
|
|
857
|
-
rlpEncodedTxBase64: string;
|
|
858
|
-
chainId: string;
|
|
859
|
-
}): Promise<FullSignatureRes>;
|
|
618
|
+
signTransaction({ walletId, rlpEncodedTxBase64, chainId, timeoutMs, isCanceled, onCancel, onPoll, }: CoreMethodParams<'signTransaction'>): CoreMethodResponse<'signTransaction'>;
|
|
860
619
|
protected isProviderModalDisabled(): boolean;
|
|
861
620
|
/**
|
|
862
621
|
* Starts a on-ramp or off-ramp transaction and returns the Para Portal link for the user to finalize and complete it.
|
|
@@ -866,37 +625,28 @@ export declare abstract class ParaCore {
|
|
|
866
625
|
* @param {string} opts.walletId the wallet ID to use for the transaction, where funds will be sent or withdrawn.
|
|
867
626
|
* @param {string} opts.externalWalletAddress the external wallet address to send funds to or withdraw funds from, if using an external wallet.
|
|
868
627
|
**/
|
|
869
|
-
initiateOnRampTransaction(options:
|
|
870
|
-
params: OnRampPurchaseCreateParams;
|
|
871
|
-
shouldOpenPopup?: boolean;
|
|
872
|
-
}): Promise<{
|
|
873
|
-
onRampPurchase: OnRampPurchase;
|
|
874
|
-
portalUrl: string;
|
|
875
|
-
}>;
|
|
628
|
+
initiateOnRampTransaction(options: CoreMethodParams<'initiateOnRampTransaction'>): CoreMethodResponse<'initiateOnRampTransaction'>;
|
|
876
629
|
/**
|
|
877
630
|
* Returns `true` if session was successfully kept alive, `false` otherwise.
|
|
878
631
|
**/
|
|
879
632
|
keepSessionAlive(): Promise<boolean>;
|
|
880
633
|
/**
|
|
881
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.
|
|
882
636
|
* @returns {string} the serialized session
|
|
883
637
|
*/
|
|
884
|
-
exportSession():
|
|
638
|
+
exportSession({ excludeSigners }?: CoreMethodParams<'exportSession'>): CoreMethodResponse<'exportSession'>;
|
|
885
639
|
/**
|
|
886
640
|
* Imports a session serialized by another Para instance.
|
|
887
641
|
* @param {string} serializedInstanceBase64 the serialized session
|
|
888
642
|
*/
|
|
889
|
-
importSession(serializedInstanceBase64:
|
|
890
|
-
protected exitAccountCreation(): void;
|
|
891
|
-
protected exitLogin(): void;
|
|
892
|
-
protected exitFarcaster(): void;
|
|
893
|
-
protected exitOAuth(): void;
|
|
894
|
-
protected exitLoops(): void;
|
|
643
|
+
importSession(serializedInstanceBase64: CoreMethodParams<'importSession'>): CoreMethodResponse<'importSession'>;
|
|
895
644
|
/**
|
|
896
645
|
* Retrieves a token to verify the current session.
|
|
897
646
|
* @returns {Promise<string>} the ID
|
|
898
647
|
**/
|
|
899
|
-
getVerificationToken():
|
|
648
|
+
getVerificationToken(): CoreMethodResponse<'getVerificationToken'>;
|
|
649
|
+
issueJwt({ keyIndex }?: CoreMethodParams<'issueJwt'>): CoreMethodResponse<'issueJwt'>;
|
|
900
650
|
/**
|
|
901
651
|
* Logs the user out.
|
|
902
652
|
* @param {Object} opts the options object.
|
|
@@ -905,11 +655,34 @@ export declare abstract class ParaCore {
|
|
|
905
655
|
logout({ clearPregenWallets }?: {
|
|
906
656
|
clearPregenWallets?: boolean;
|
|
907
657
|
}): Promise<void>;
|
|
908
|
-
protected
|
|
658
|
+
protected get toStringAdditions(): Record<string, unknown>;
|
|
909
659
|
/**
|
|
910
660
|
* Converts to a string, removing sensitive data when logging this class.
|
|
911
661
|
*
|
|
912
662
|
* Doesn't work for all types of logging.
|
|
913
663
|
**/
|
|
914
664
|
toString(): string;
|
|
665
|
+
protected devLog(...s: string[]): void;
|
|
666
|
+
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
667
|
+
credentialId: string;
|
|
668
|
+
url?: string;
|
|
669
|
+
}>;
|
|
670
|
+
/**
|
|
671
|
+
* Returns a Para Portal URL for logging in with a WebAuth passkey or a password.
|
|
672
|
+
* @param {Object} opts the options object
|
|
673
|
+
* @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
|
|
674
|
+
* @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
|
|
675
|
+
* @param {Theme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
|
|
676
|
+
* @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
|
|
677
|
+
*/
|
|
678
|
+
protected getLoginUrl({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
|
|
679
|
+
signUpOrLogIn({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogIn'>): CoreMethodResponse<'signUpOrLogIn'>;
|
|
680
|
+
verifyNewAccount({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccount'>): CoreMethodResponse<'verifyNewAccount'>;
|
|
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'>;
|
|
915
688
|
}
|