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