@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.
Files changed (55) hide show
  1. package/dist/cjs/ParaCore.js +936 -974
  2. package/dist/cjs/constants.js +7 -1
  3. package/dist/cjs/index.js +15 -9
  4. package/dist/cjs/types/coreApi.js +74 -0
  5. package/dist/cjs/types/events.js +1 -0
  6. package/dist/cjs/types/index.js +4 -2
  7. package/dist/cjs/types/{params.js → methods.js} +2 -2
  8. package/dist/cjs/utils/autobind.js +41 -0
  9. package/dist/cjs/utils/formatting.js +0 -12
  10. package/dist/cjs/utils/index.js +10 -0
  11. package/dist/cjs/utils/json.js +37 -0
  12. package/dist/cjs/utils/listeners.js +2 -11
  13. package/dist/cjs/utils/phone.js +61 -0
  14. package/dist/cjs/utils/types.js +29 -0
  15. package/dist/cjs/utils/url.js +34 -2
  16. package/dist/cjs/utils/wallet.js +30 -17
  17. package/dist/esm/ParaCore.js +952 -979
  18. package/dist/esm/constants.js +5 -1
  19. package/dist/esm/index.js +12 -9
  20. package/dist/esm/types/coreApi.js +52 -0
  21. package/dist/esm/types/events.js +1 -0
  22. package/dist/esm/types/index.js +2 -1
  23. package/dist/esm/utils/autobind.js +19 -0
  24. package/dist/esm/utils/formatting.js +0 -10
  25. package/dist/esm/utils/index.js +5 -0
  26. package/dist/esm/utils/json.js +15 -0
  27. package/dist/esm/utils/listeners.js +2 -11
  28. package/dist/esm/utils/phone.js +28 -0
  29. package/dist/esm/utils/types.js +7 -0
  30. package/dist/esm/utils/url.js +15 -2
  31. package/dist/esm/utils/wallet.js +27 -16
  32. package/dist/types/ParaCore.d.ts +100 -391
  33. package/dist/types/PlatformUtils.d.ts +3 -3
  34. package/dist/types/constants.d.ts +2 -0
  35. package/dist/types/external/userManagementClient.d.ts +1 -1
  36. package/dist/types/index.d.ts +5 -3
  37. package/dist/types/types/config.d.ts +4 -24
  38. package/dist/types/types/coreApi.d.ts +475 -0
  39. package/dist/types/types/events.d.ts +4 -1
  40. package/dist/types/types/index.d.ts +2 -1
  41. package/dist/types/types/methods.d.ts +148 -0
  42. package/dist/types/types/onRamps.d.ts +3 -3
  43. package/dist/types/types/wallet.d.ts +4 -4
  44. package/dist/types/utils/autobind.d.ts +1 -0
  45. package/dist/types/utils/formatting.d.ts +2 -4
  46. package/dist/types/utils/index.d.ts +5 -0
  47. package/dist/types/utils/json.d.ts +1 -0
  48. package/dist/types/utils/onRamps.d.ts +3 -3
  49. package/dist/types/utils/phone.d.ts +7 -0
  50. package/dist/types/utils/types.d.ts +2 -0
  51. package/dist/types/utils/url.d.ts +2 -1
  52. package/dist/types/utils/wallet.d.ts +9 -7
  53. package/package.json +4 -3
  54. package/dist/types/types/params.d.ts +0 -73
  55. /package/dist/esm/types/{params.js → methods.js} +0 -0
@@ -1,12 +1,12 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
- import { BackupKitEmailProps, TPregenIdentifierType, WalletType, SDKType } from '@getpara/user-management-client';
3
+ import { BackupKitEmailProps, TPregenIdentifierType, TWalletType, SDKType } from '@getpara/user-management-client';
4
4
  import { Ctx, PopupType, SignatureRes } from './types/index.js';
5
5
  import { StorageUtils } from './StorageUtils.js';
6
6
  export interface PlatformUtils {
7
7
  sdkType: SDKType;
8
8
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
9
- keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
9
+ keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
10
10
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
11
11
  signer: string;
12
12
  walletId: string;
@@ -15,7 +15,7 @@ export interface PlatformUtils {
15
15
  signer: string;
16
16
  protocolId?: string;
17
17
  }>;
18
- preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
18
+ preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
19
19
  sessionCookie: string): Promise<{
20
20
  signer: string;
21
21
  walletId: string;
@@ -1,5 +1,6 @@
1
1
  export declare const PARA_CORE_VERSION: string;
2
2
  export declare const PREFIX = "@CAPSULE/";
3
+ export declare const LOCAL_STORAGE_AUTH_INFO: string;
3
4
  export declare const LOCAL_STORAGE_EMAIL: string;
4
5
  export declare const LOCAL_STORAGE_PHONE: string;
5
6
  export declare const LOCAL_STORAGE_COUNTRY_CODE: string;
@@ -15,4 +16,5 @@ export declare const LOCAL_STORAGE_SESSION_COOKIE: string;
15
16
  export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR: string;
16
17
  export declare const POLLING_INTERVAL_MS = 2000;
17
18
  export declare const SHORT_POLLING_INTERVAL_MS = 1000;
19
+ export declare const POLLING_TIMEOUT_MS = 300000;
18
20
  export declare const EXTERNAL_WALLET_CONNECTION_ONLY_USER_ID = "EXTERNAL_WALLET_CONNECTION_ONLY";
@@ -6,7 +6,7 @@ export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: bo
6
6
  export declare function initClient({ env, version, apiKey, partnerId, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, }: {
7
7
  env: Environment;
8
8
  version?: string;
9
- apiKey?: string;
9
+ apiKey: string;
10
10
  partnerId?: string;
11
11
  useFetchAdapter?: boolean;
12
12
  retrieveSessionCookie?: () => string;
@@ -1,9 +1,10 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
- export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, type CreateGuestWalletsParams, } from './types/index.js';
2
+ export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TWalletType, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, type TOAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, } from '@getpara/user-management-client';
3
+ export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, type GetWalletBalanceParams, } from './types/index.js';
4
+ export * from './types/coreApi.js';
4
5
  export * from './types/events.js';
5
6
  export * from './types/config.js';
6
- export { getPortalDomain, stringToPhoneNumber, entityToWallet } from './utils/index.js';
7
+ export { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
7
8
  export { PREFIX as STORAGE_PREFIX } from './constants.js';
8
9
  export { distributeNewShare } from './shares/shareDistribution.js';
9
10
  export { KeyContainer } from './shares/KeyContainer.js';
@@ -16,6 +17,7 @@ export * from './external/userManagementClient.js';
16
17
  export * from './errors.js';
17
18
  export * from './utils/formatting.js';
18
19
  export * from './utils/polling.js';
20
+ export * from './utils/phone.js';
19
21
  export { isWalletSupported } from './utils/wallet.js';
20
22
  export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
21
23
  export { getPortalBaseURL } from './utils/url.js';
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, TWalletScheme, TWalletType } from '@getpara/user-management-client';
3
3
  import { Theme } from './theme.js';
4
4
  export declare enum Environment {
5
5
  DEV = "DEV",
@@ -11,7 +11,7 @@ export declare enum Environment {
11
11
  }
12
12
  export interface Ctx {
13
13
  env: Environment;
14
- apiKey?: string;
14
+ apiKey: string;
15
15
  client: Client;
16
16
  disableWorkers?: boolean;
17
17
  offloadMPCComputationURL?: string;
@@ -25,11 +25,9 @@ export interface Ctx {
25
25
  }
26
26
  export type deprecated__NetworkProp = keyof typeof Network | Network;
27
27
  export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
28
- export type WalletTypeProp = keyof typeof WalletType | WalletType;
29
- export type WalletSchemeProp = keyof typeof WalletScheme | WalletScheme;
30
28
  export type WalletFilters = {
31
- type?: WalletTypeProp[];
32
- scheme?: WalletSchemeProp[];
29
+ type?: TWalletType[];
30
+ scheme?: TWalletScheme[];
33
31
  forbidPregen?: boolean;
34
32
  };
35
33
  export type deprecated__RampConfig = {
@@ -57,17 +55,6 @@ export type deprecated__OnRampConfig = {
57
55
  export type SupportedWalletTypeConfig = {
58
56
  optional?: boolean;
59
57
  };
60
- export type deprecated__SupportedWalletTypesOpt = {
61
- [WalletType.EVM]?: boolean | SupportedWalletTypeConfig;
62
- [WalletType.SOLANA]?: boolean | SupportedWalletTypeConfig;
63
- [WalletType.COSMOS]?: boolean | (SupportedWalletTypeConfig & {
64
- prefix?: string;
65
- });
66
- };
67
- export type SupportedWalletTypes = {
68
- type: WalletType;
69
- optional?: boolean;
70
- }[];
71
58
  export interface ConstructorOpts {
72
59
  externalWalletConnectionOnly?: boolean;
73
60
  useStorageOverrides?: boolean;
@@ -145,13 +132,6 @@ export interface ConstructorOpts {
145
132
  * @deprecated configure this through the developer portal
146
133
  */
147
134
  homepageUrl?: string;
148
- /**
149
- * Which type of wallet your application supports, in the form `{ [WalletType]: true }`. Currently allowed values for `WalletType` are `'EVM'`, `'SOLANA'`, or `'COSMOS'`.
150
- *
151
- * To specify which prefix to use for new Cosmos wallets, pass `{ COSMOS: { prefix: 'your-prefix' } }`. Defaults to `'cosmos'`.
152
- * @deprecated Configure your app's supported wallet types in the Para Developer Portal.
153
- */
154
- supportedWalletTypes?: deprecated__SupportedWalletTypesOpt;
155
135
  /**
156
136
  * If `true`, the SDK will use the device's temporary session storage instead of saving user and wallet data to local storage.
157
137
  */
@@ -0,0 +1,475 @@
1
+ import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, TelegramAuthResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType } from '@getpara/user-management-client';
2
+ import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse } from './methods.js';
3
+ import { ParaCore } from '../ParaCore.js';
4
+ import { FullSignatureRes, Wallet } from './wallet.js';
5
+ export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance"];
6
+ export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
7
+ export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
8
+ params: infer P;
9
+ } ? P : never;
10
+ export type CoreMethodResponse<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
11
+ response: infer R;
12
+ } ? CoreMethods[method] extends {
13
+ sync: true;
14
+ } ? R : Promise<R> : void;
15
+ export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
16
+ export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? (_?: ParaCore) => CoreMethodResponse<method> : (_?: ParaCore, __?: CoreMethodParams<method>) => CoreMethodResponse<method>;
17
+ export type CoreMethods = Record<CoreMethodName, {
18
+ params?: unknown;
19
+ response?: unknown;
20
+ sync?: true;
21
+ }> & {
22
+ getAuthInfo: {
23
+ params: void;
24
+ response: CoreAuthInfo | undefined;
25
+ sync: true;
26
+ };
27
+ signUpOrLogIn: {
28
+ params: WithCustomTheme & WithUseShortUrls & {
29
+ /**
30
+ * The user's email address or phone number, in the form `{ email: '...' } | { phone: '+1...' }`}
31
+ */
32
+ auth: VerifiedAuth;
33
+ };
34
+ response: AuthStateVerify | AuthStateLogin;
35
+ };
36
+ verifyNewAccount: {
37
+ params: WithCustomTheme & WithUseShortUrls & {
38
+ /**
39
+ * The verification code entered by the user.
40
+ */
41
+ verificationCode: string;
42
+ };
43
+ response: AuthStateSignup;
44
+ };
45
+ waitForLogin: {
46
+ params: PollParams & {
47
+ /**
48
+ * Whether to skip the session refresh
49
+ */
50
+ skipSessionRefresh?: boolean;
51
+ /**
52
+ * A function returning a boolean, indicating whether the login process should be cancelled.
53
+ */
54
+ isCanceled?: () => boolean;
55
+ };
56
+ response: {
57
+ /**
58
+ * Whether the signed-in user still needs to create one or more wallets for this application.
59
+ */
60
+ needsWallet?: boolean;
61
+ /**
62
+ * The partner ID for the current application.
63
+ */
64
+ partnerId?: string;
65
+ };
66
+ };
67
+ waitForSignup: {
68
+ params: PollParams & {
69
+ /**
70
+ * A function returning a boolean, indicating whether the signup process should be cancelled.
71
+ */
72
+ isCanceled?: () => boolean;
73
+ };
74
+ response: true;
75
+ };
76
+ waitForWalletCreation: {
77
+ params: PollParams & {
78
+ /**
79
+ * A function returning a boolean, indicating whether wallet creation should be cancelled.
80
+ */
81
+ isCanceled?: () => boolean;
82
+ };
83
+ response: {
84
+ /**
85
+ * The IDs of the newly created wallets.
86
+ */
87
+ walletIds: CurrentWalletIds;
88
+ /**
89
+ * The recovery secret for the new wallets, if available.
90
+ */
91
+ recoverySecret?: string;
92
+ };
93
+ };
94
+ getOAuthUrl: {
95
+ params: OAuthUrlParams & {
96
+ sessionLookupId?: string;
97
+ };
98
+ response: string;
99
+ };
100
+ verifyOAuth: {
101
+ params: AuthStateBaseParams & OAuthUrlParams & PollParams & {
102
+ /**
103
+ * A function returning a boolean, indicating whether the OAuth process should be cancelled.
104
+ */
105
+ isCanceled?: () => boolean;
106
+ /**
107
+ * A callback function that will be invoked with the OAuth URL when it is available.
108
+ * For example, you can use this to open the URL in a new window or tab.
109
+ */
110
+ onOAuthUrl?: (url: string) => void;
111
+ };
112
+ response: OAuthResponse;
113
+ };
114
+ getFarcasterConnectUri: {
115
+ params: void;
116
+ response: string;
117
+ };
118
+ verifyFarcaster: {
119
+ params: AuthStateBaseParams & PollParams & {
120
+ /**
121
+ * A function returning a boolean, indicating whether the Farcaster login process should be cancelled.
122
+ */
123
+ isCanceled?: () => boolean;
124
+ /**
125
+ * A callback function that will be invoked with the Farcaster Connect URI when it is available.
126
+ * You will need to display the URI as a QR code.
127
+ */
128
+ onConnectUri?: (uri: string) => void;
129
+ };
130
+ response: OAuthResponse;
131
+ };
132
+ verifyTelegram: {
133
+ params: AuthStateBaseParams & {
134
+ /**
135
+ * The response received from the Telegram login bot.
136
+ */
137
+ telegramAuthResponse: TelegramAuthResponse;
138
+ };
139
+ response: OAuthResponse;
140
+ };
141
+ loginExternalWallet: {
142
+ params: AuthStateBaseParams & {
143
+ /**
144
+ * The external wallet information to use for login.
145
+ */
146
+ externalWallet: ExternalWalletInfo;
147
+ };
148
+ response: AuthStateVerifyOrLogin;
149
+ };
150
+ verifyExternalWallet: {
151
+ params: AuthStateBaseParams & VerifyExternalWalletParams;
152
+ response: AuthStateSignup;
153
+ };
154
+ resendVerificationCode: {
155
+ params: void;
156
+ response: void;
157
+ };
158
+ logout: {
159
+ params: {
160
+ /**
161
+ * Whether to remove all pregen wallets from storage.
162
+ */
163
+ clearPregenWallets?: boolean;
164
+ };
165
+ response: void;
166
+ };
167
+ clearStorage: {
168
+ params: StorageType | undefined;
169
+ response: void;
170
+ };
171
+ isSessionActive: {
172
+ params: void;
173
+ response: boolean;
174
+ };
175
+ isFullyLoggedIn: {
176
+ params: void;
177
+ response: boolean;
178
+ };
179
+ refreshSession: {
180
+ params: {
181
+ shouldOpenPopup?: boolean;
182
+ };
183
+ response: string;
184
+ };
185
+ keepSessionAlive: {
186
+ params: void;
187
+ response: boolean;
188
+ };
189
+ exportSession: {
190
+ params: {
191
+ /**
192
+ * Whether to exclude the wallet signers from the exported session.
193
+ */
194
+ excludeSigners?: boolean;
195
+ };
196
+ response: string;
197
+ sync: true;
198
+ };
199
+ importSession: {
200
+ params: string;
201
+ response: void;
202
+ };
203
+ getVerificationToken: {
204
+ params: void;
205
+ response: string;
206
+ };
207
+ setup2fa: {
208
+ params: void;
209
+ response: Setup2faResponse;
210
+ };
211
+ enable2fa: {
212
+ params: {
213
+ /**
214
+ * The two-factor authentication code entered by the user.
215
+ */
216
+ verificationCode: string;
217
+ };
218
+ response: void;
219
+ };
220
+ verify2fa: {
221
+ params: {
222
+ /**
223
+ * The email or phone number for the user to verify, in the form `{ email: '...' } | { phone: '+1...' }`
224
+ */
225
+ auth: VerifiedAuth;
226
+ /**
227
+ * The two-factor authentication code entered by the user.
228
+ */
229
+ verificationCode: string;
230
+ };
231
+ response: Verify2faResponse;
232
+ };
233
+ getWallets: {
234
+ params: void;
235
+ response: Record<string, Wallet>;
236
+ sync: true;
237
+ };
238
+ getWalletsByType: {
239
+ params: TWalletType;
240
+ response: Wallet[];
241
+ sync: true;
242
+ };
243
+ fetchWallets: {
244
+ params: void;
245
+ response: WalletEntity[];
246
+ };
247
+ createWallet: {
248
+ params: {
249
+ type?: Uppercase<TWalletType>;
250
+ skipDistribute?: boolean;
251
+ };
252
+ response: [Wallet, string | undefined];
253
+ };
254
+ createWalletPerType: {
255
+ params: {
256
+ /**
257
+ * Array of the wallet types to create
258
+ */
259
+ types?: Uppercase<TWalletType>[];
260
+ /**
261
+ * If `true`, skip distributing the new wallets shares.
262
+ */
263
+ skipDistribute?: boolean;
264
+ };
265
+ response: {
266
+ /**
267
+ * Array of the created wallets
268
+ */
269
+ wallets: Wallet[];
270
+ /**
271
+ * The `CurrentWalletIds` value for the new wallets
272
+ */
273
+ walletIds: CurrentWalletIds;
274
+ /**
275
+ * The recovery secret for the new wallets, if available.
276
+ */
277
+ recoverySecret?: string;
278
+ };
279
+ };
280
+ getPregenWallets: {
281
+ params: {
282
+ /**
283
+ * The pregen ID for the wallets to fetch. If not provided, all available wallets will be retrieved.
284
+ */
285
+ pregenId?: PregenAuth;
286
+ };
287
+ response: WalletEntity[];
288
+ };
289
+ updatePregenWalletIdentifier: {
290
+ params: {
291
+ /**
292
+ * The ID of the pregen wallet to update.
293
+ */
294
+ walletId: string;
295
+ /**
296
+ * The new identifer for the wallet.
297
+ */
298
+ newPregenId: PregenAuth;
299
+ };
300
+ response: void;
301
+ };
302
+ hasPregenWallet: {
303
+ params: {
304
+ /**
305
+ * The pregen ID for the wallet to check.
306
+ */
307
+ pregenId: PregenAuth;
308
+ };
309
+ response: boolean;
310
+ };
311
+ createPregenWallet: {
312
+ params: {
313
+ /**
314
+ * The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
315
+ */
316
+ type: TWalletType;
317
+ /**
318
+ * The pregen identifier for the wallet, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
319
+ */
320
+ pregenId: PregenAuth;
321
+ };
322
+ response: Wallet;
323
+ };
324
+ createPregenWalletPerType: {
325
+ params: {
326
+ /**
327
+ * The wallet types to create. If not provided, defaults to your application's `supportedWalletTypes` setting.
328
+ */
329
+ types?: TWalletType[];
330
+ /**
331
+ * The pregen identifier for the wallets, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
332
+ */
333
+ pregenId: PregenAuth;
334
+ };
335
+ response: Wallet[];
336
+ };
337
+ claimPregenWallets: {
338
+ params: {
339
+ /**
340
+ * The pregen identifier for the wallet to claim. If not provided, will attempt to claim all wallets in storage.
341
+ */
342
+ pregenId?: PregenAuth;
343
+ };
344
+ response: string | undefined;
345
+ };
346
+ createGuestWallets: {
347
+ params: void;
348
+ response: Wallet[];
349
+ };
350
+ distributeNewWalletShare: {
351
+ params: {
352
+ /**
353
+ * The ID of the wallet whose share to distribute.
354
+ */
355
+ walletId: string;
356
+ /**
357
+ * The user share string.
358
+ */
359
+ userShare?: string;
360
+ /**
361
+ * If `true`, skip biometric share creation.
362
+ */
363
+ skipBiometricShareCreation?: boolean;
364
+ /**
365
+ * If `true`, force a session refresh.
366
+ */
367
+ forceRefresh?: boolean;
368
+ };
369
+ response: string;
370
+ };
371
+ getUserShare: {
372
+ params: void;
373
+ response: string | null;
374
+ sync: true;
375
+ };
376
+ setUserShare: {
377
+ params: string | null;
378
+ response: void;
379
+ };
380
+ refreshShare: {
381
+ params: {
382
+ walletId: string;
383
+ share: string;
384
+ oldPartnerId?: string;
385
+ newPartnerId?: string;
386
+ keyShareProtocolId?: string;
387
+ redistributeBackupEncryptedShares?: boolean;
388
+ emailProps?: BackupKitEmailProps;
389
+ };
390
+ response: {
391
+ protocolId: string;
392
+ recoverySecret?: string;
393
+ signer: string;
394
+ };
395
+ };
396
+ signMessage: {
397
+ params: PollParams & {
398
+ /**
399
+ * The ID of the wallet to use for signing.
400
+ */
401
+ walletId: string;
402
+ /**
403
+ * The message to sign as a base64-encoded string.
404
+ */
405
+ messageBase64: string;
406
+ /**
407
+ * The duration in milliseconds to wait before the signing operation times out.
408
+ */
409
+ timeoutMs?: number;
410
+ /**
411
+ * For Cosmos transactions, the `SignDoc` as a base64-encoded string.
412
+ */
413
+ cosmosSignDocBase64?: string;
414
+ /**
415
+ * A callback that returns a boolean, indicating whether the signing operation should be cancelled.
416
+ */
417
+ isCanceled?: () => boolean;
418
+ };
419
+ response: FullSignatureRes;
420
+ };
421
+ signTransaction: {
422
+ params: PollParams & {
423
+ /**
424
+ * The ID of the wallet to use for signing.
425
+ */
426
+ walletId: string;
427
+ /**
428
+ * The transaction to sign as a base64-encoded string.
429
+ */
430
+ rlpEncodedTxBase64: string;
431
+ /**
432
+ * For EVM transactions, the chain ID.
433
+ */
434
+ chainId: string;
435
+ /**
436
+ * The duration in milliseconds to wait before the signing operation times out.
437
+ */
438
+ timeoutMs?: number;
439
+ /**
440
+ * A callback that returns a boolean, indicating whether the signing operation should be cancelled.
441
+ */
442
+ isCanceled?: () => boolean;
443
+ };
444
+ response: FullSignatureRes;
445
+ };
446
+ initiateOnRampTransaction: {
447
+ params: WalletParams & {
448
+ /**
449
+ * The on-ramp transaction options.
450
+ */
451
+ params: OnRampPurchaseCreateParams;
452
+ /**
453
+ * Whether to open a popup window for the user to complete the transaction.
454
+ */
455
+ shouldOpenPopup?: boolean;
456
+ };
457
+ response: {
458
+ /**
459
+ * The newly created on-ramp transaction.
460
+ */
461
+ onRampPurchase: OnRampPurchase;
462
+ /**
463
+ * A Para Portal URL for the user to complete the transaction.
464
+ */
465
+ portalUrl: string;
466
+ };
467
+ };
468
+ getWalletBalance: {
469
+ params: GetWalletBalanceParams;
470
+ response: GetWalletBalanceResponse;
471
+ };
472
+ };
473
+ export type CoreInterface = {
474
+ [key in keyof CoreMethods]: CoreMethod<key>;
475
+ };
@@ -1,6 +1,7 @@
1
1
  import { CurrentWalletIds } from '@getpara/user-management-client';
2
2
  import { FullSignatureRes } from './wallet.js';
3
3
  import { Wallet } from './wallet.js';
4
+ import { CoreMethodResponse } from './coreApi.js';
4
5
  export declare enum ParaEvent {
5
6
  LOGIN_EVENT = "paraLogin",
6
7
  ACCOUNT_CREATION_EVENT = "paraAccountCreation",
@@ -11,7 +12,8 @@ export declare enum ParaEvent {
11
12
  EXTERNAL_WALLET_CHANGE_EVENT = "paraExternalWalletChange",
12
13
  WALLETS_CHANGE_EVENT = "paraWalletsChange",
13
14
  WALLET_CREATED = "paraWalletCreated",
14
- PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed"
15
+ PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed",
16
+ GUEST_WALLETS_CREATED = "paraGuestWalletsCreated"
15
17
  }
16
18
  export type BaseEvent<T> = {
17
19
  data: T;
@@ -45,3 +47,4 @@ export type PregenWalletClaimedResponse = {
45
47
  recoverySecret?: string;
46
48
  };
47
49
  export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
50
+ export type GuestWalletsCreatedEvent = CustomEventInit<BaseEvent<CoreMethodResponse<'createGuestWallets'>>>;
@@ -1,6 +1,7 @@
1
1
  export * from './config.js';
2
+ export * from './coreApi.js';
2
3
  export * from './wallet.js';
3
- export * from './params.js';
4
+ export * from './methods.js';
4
5
  export * from './theme.js';
5
6
  export * from './onRamps.js';
6
7
  export * from './popup.js';