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