@getpara/core-sdk 1.7.1 → 2.0.0-alpha.3

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.
@@ -1,5 +1,4 @@
1
- import { PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
2
- import { EmbeddedWalletType, ExternalWalletType } from './params.js';
1
+ import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
3
2
  export interface Wallet {
4
3
  createdAt?: string;
5
4
  id: string;
@@ -20,8 +19,6 @@ export interface Wallet {
20
19
  lastUsedPartner?: PartnerEntity;
21
20
  lastUsedPartnerId?: string;
22
21
  isExternal?: boolean;
23
- ensName?: string | null;
24
- ensAvatar?: string | null;
25
22
  isExternalWithParaAuth?: boolean;
26
23
  }
27
24
  /** @deprecated */
@@ -40,3 +37,4 @@ export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
40
37
  }
41
38
  export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
42
39
  export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
40
+ export type ExternalWalletConnectionType = 'NONE' | 'CONNECTION_ONLY' | 'AUTHENTICATED';
@@ -0,0 +1 @@
1
+ export declare function autoBind(instance: any): void;
@@ -14,5 +14,3 @@ export declare function getCosmosAddress(publicKey: string, prefix: string): str
14
14
  export declare function truncateAddress(str: string, addressType: WalletTypeProp, { prefix }?: {
15
15
  prefix?: string;
16
16
  }): string;
17
- export declare function stringToPhoneNumber(str: string): string;
18
- export declare function normalizePhoneNumber(countryCode: string, number: string): string | undefined;
@@ -1,6 +1,11 @@
1
+ export * from './autobind.js';
1
2
  export * from './events.js';
2
3
  export * from './formatting.js';
4
+ export * from './json.js';
5
+ export * from './listeners.js';
3
6
  export * from './onRamps.js';
7
+ export * from './phone.js';
4
8
  export * from './polling.js';
9
+ export * from './types.js';
5
10
  export * from './url.js';
6
11
  export * from './wallet.js';
@@ -0,0 +1 @@
1
+ export declare function jsonParse<T = any>(data: string | null | undefined, validate?: (res: any) => res is T): T | undefined;
@@ -0,0 +1,7 @@
1
+ export declare function formatPhoneNumber(phone: string, countryCode?: string | undefined, opts?: {
2
+ forDisplay: undefined | false;
3
+ }): `+${number}` | null;
4
+ export declare function formatPhoneNumber(phone: string, countryCode: string | undefined, opts: {
5
+ forDisplay: true;
6
+ }): string | null;
7
+ export declare function displayPhoneNumber(phone: string, countryCode?: string): string;
@@ -0,0 +1,2 @@
1
+ import { ServerAuthState } from '@getpara/user-management-client';
2
+ export declare function isServerAuthState(obj: ServerAuthState | Record<string, never>): obj is ServerAuthState;
@@ -1,4 +1,4 @@
1
- import { Environment } from '../types/index.js';
1
+ import { Ctx, Environment } from '../types/index.js';
2
2
  export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
3
3
  export declare function getPortalBaseURL({ env, isE2E }: {
4
4
  env: Environment;
@@ -13,3 +13,4 @@ export declare function constructUrl({ base, path, params, }: {
13
13
  path: string;
14
14
  params?: Record<string, string | undefined | null>;
15
15
  }): string;
16
+ export declare function shortenUrl(ctx: Ctx, url: string): Promise<string>;
@@ -1,5 +1,5 @@
1
- import { TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
2
- import { SupportedWalletTypes, Wallet, WalletTypeProp } from '../types/index.js';
1
+ import { CurrentWalletIds, SupportedWalletTypes, TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
2
+ import { Wallet, WalletTypeProp } from '../types/index.js';
3
3
  export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
4
4
  export declare function isPregenIdentifierMatch(a: string | null | undefined, b: string | null | undefined, type: TPregenIdentifierType): boolean;
5
5
  export declare function isWalletSupported(types: WalletType[], wallet: Omit<Wallet, 'signer'>): boolean;
@@ -8,3 +8,5 @@ export declare function getWalletTypes(schemes: WalletScheme[]): WalletType[];
8
8
  export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeProp): WalletType[];
9
9
  export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
10
10
  export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
11
+ export declare function supportedWalletTypesEq(a: SupportedWalletTypes, b: SupportedWalletTypes): boolean;
12
+ export declare function mergeCurrentWalletIds(original: CurrentWalletIds, additional: CurrentWalletIds): CurrentWalletIds;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "1.7.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@celo/utils": "^8.0.0",
11
11
  "@cosmjs/encoding": "^0.32.4",
12
- "@getpara/user-management-client": "1.7.1",
12
+ "@getpara/user-management-client": "2.0.0-alpha.3",
13
13
  "@noble/hashes": "^1.5.0",
14
14
  "base64url": "^3.0.1",
15
15
  "ethereumjs-util": "7.1.5",
@@ -27,6 +27,7 @@
27
27
  "test": "vitest run --coverage"
28
28
  },
29
29
  "devDependencies": {
30
+ "@faker-js/faker": "^9.5.1",
30
31
  "typescript": "5.1.6"
31
32
  },
32
33
  "files": [
@@ -40,5 +41,5 @@
40
41
  "require": "./dist/cjs/index.js"
41
42
  }
42
43
  },
43
- "gitHead": "767395af96d4a724946a092de760e9137a73369a"
44
+ "gitHead": "77a1e04b06258842ca9c81e3db2a2b0092517659"
44
45
  }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,4 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": false
4
- }
@@ -1,66 +0,0 @@
1
- import { AuthType, WalletType } from '@getpara/user-management-client';
2
- import { Theme } from './theme.js';
3
- export type EmbeddedWalletType = Exclude<WalletType, never>;
4
- export type ExternalWalletType = Exclude<WalletType, never>;
5
- export type ExternalWalletInfo = {
6
- address: string;
7
- type: ExternalWalletType;
8
- provider?: string;
9
- addressBech32?: string;
10
- ensName?: string | null;
11
- ensAvatar?: string | null;
12
- withFullParaAuth?: boolean;
13
- };
14
- export type VerifyExternalWallet = {
15
- signedMessage: string;
16
- cosmosPublicKeyHex?: string;
17
- cosmosSigner?: string;
18
- };
19
- export type PortalUrlOptions = {
20
- params?: Record<string, string | undefined | null>;
21
- authType?: AuthType;
22
- isForNewDevice?: boolean;
23
- loginEncryptionPublicKey?: string;
24
- newDeviceSessionId?: string;
25
- newDeviceEncryptionKey?: string;
26
- partnerId?: string;
27
- sessionId?: string;
28
- theme?: Theme;
29
- pathId?: string;
30
- displayName?: string;
31
- pfpUrl?: string;
32
- };
33
- export type GetWebAuthUrlForLoginParams = {
34
- /**
35
- * The session ID for the URL.
36
- */
37
- sessionId: string;
38
- /**
39
- * Either 'email' | 'phone' | 'farcaster' | 'telegram'
40
- */
41
- authType?: AuthType;
42
- /**
43
- * The public key to use for encrypting the login encryption key.
44
- */
45
- loginEncryptionPublicKey: string;
46
- /**
47
- * The partner ID for the URL.
48
- */
49
- partnerId?: string;
50
- /**
51
- * The session ID for the new device being registered.
52
- */
53
- newDeviceSessionId?: string;
54
- /**
55
- * The public key for the new device being registered.
56
- */
57
- newDeviceEncryptionKey?: string;
58
- /**
59
- * The Telegram or Farcaster display name for the user.
60
- */
61
- displayName?: string;
62
- /**
63
- * The Telegram or Farcaster URL for the user's profile picture.
64
- */
65
- pfpUrl?: string;
66
- };