@getpara/core-sdk 2.0.0-alpha.53 → 2.0.0-alpha.54

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 (51) hide show
  1. package/dist/cjs/ParaCore.js +213 -60
  2. package/dist/cjs/constants.js +7 -1
  3. package/dist/cjs/index.js +2 -0
  4. package/dist/cjs/shares/enclave.js +266 -0
  5. package/dist/cjs/shares/shareDistribution.js +16 -1
  6. package/dist/cjs/types/assets.js +15 -0
  7. package/dist/cjs/types/events.js +2 -0
  8. package/dist/cjs/utils/formatting.js +41 -0
  9. package/dist/esm/ParaCore.js +214 -61
  10. package/dist/esm/{chunk-7B52C2XE.js → chunk-W5CT3TVS.js} +2 -0
  11. package/dist/esm/constants.js +6 -2
  12. package/dist/esm/cryptography/utils.js +1 -1
  13. package/dist/esm/errors.js +1 -1
  14. package/dist/esm/external/mpcComputationClient.js +1 -1
  15. package/dist/esm/external/userManagementClient.js +1 -1
  16. package/dist/esm/index.js +3 -2
  17. package/dist/esm/shares/KeyContainer.js +1 -1
  18. package/dist/esm/shares/enclave.js +226 -0
  19. package/dist/esm/shares/recovery.js +1 -1
  20. package/dist/esm/shares/shareDistribution.js +17 -2
  21. package/dist/esm/transmission/transmissionUtils.js +1 -1
  22. package/dist/esm/types/assets.js +0 -0
  23. package/dist/esm/types/auth.js +1 -1
  24. package/dist/esm/types/config.js +1 -1
  25. package/dist/esm/types/coreApi.js +1 -1
  26. package/dist/esm/types/events.js +3 -1
  27. package/dist/esm/types/popup.js +1 -1
  28. package/dist/esm/types/wallet.js +1 -1
  29. package/dist/esm/utils/autobind.js +1 -1
  30. package/dist/esm/utils/events.js +1 -1
  31. package/dist/esm/utils/formatting.js +41 -1
  32. package/dist/esm/utils/json.js +1 -1
  33. package/dist/esm/utils/listeners.js +1 -1
  34. package/dist/esm/utils/onRamps.js +1 -1
  35. package/dist/esm/utils/phone.js +1 -1
  36. package/dist/esm/utils/polling.js +1 -1
  37. package/dist/esm/utils/types.js +1 -1
  38. package/dist/esm/utils/url.js +1 -1
  39. package/dist/esm/utils/wallet.js +1 -1
  40. package/dist/types/ParaCore.d.ts +15 -2
  41. package/dist/types/constants.d.ts +2 -0
  42. package/dist/types/index.d.ts +3 -2
  43. package/dist/types/shares/enclave.d.ts +81 -0
  44. package/dist/types/shares/shareDistribution.d.ts +4 -2
  45. package/dist/types/types/assets.d.ts +14 -0
  46. package/dist/types/types/config.d.ts +2 -0
  47. package/dist/types/types/coreApi.d.ts +1 -0
  48. package/dist/types/types/events.d.ts +7 -2
  49. package/dist/types/types/methods.d.ts +15 -7
  50. package/dist/types/utils/formatting.d.ts +10 -1
  51. package/package.json +3 -3
@@ -0,0 +1,14 @@
1
+ import { TNetwork, TOnRampAsset } from '@getpara/user-management-client';
2
+ import { Wallet } from './wallet.js';
3
+ export type AssetTransferType = 'INBOUND' | 'OUTBOUND';
4
+ export type AssetTransfer = {
5
+ wallet: Omit<Wallet, 'signer'>;
6
+ type: AssetTransferType;
7
+ sourceAddress: string;
8
+ destinationAddress: string;
9
+ asset: TOnRampAsset;
10
+ network: TNetwork;
11
+ quantity: string;
12
+ chainId?: string;
13
+ contractAddress?: string;
14
+ };
@@ -1,5 +1,6 @@
1
1
  import { AxiosInstance } from 'axios';
2
2
  import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType, Theme } from '@getpara/user-management-client';
3
+ import { EnclaveClient } from '../shares/enclave.js';
3
4
  export declare enum Environment {
4
5
  DEV = "DEV",
5
6
  SANDBOX = "SANDBOX",
@@ -12,6 +13,7 @@ export interface Ctx {
12
13
  env: Environment;
13
14
  apiKey: string;
14
15
  client: Client;
16
+ enclaveClient?: EnclaveClient;
15
17
  disableWorkers?: boolean;
16
18
  offloadMPCComputationURL?: string;
17
19
  mpcComputationClient?: AxiosInstance;
@@ -118,6 +118,7 @@ export type CoreMethods = Record<CoreMethodName, {
118
118
  getOAuthUrl: {
119
119
  params: OAuthUrlParams & {
120
120
  sessionLookupId?: string;
121
+ encryptionKey?: string;
121
122
  };
122
123
  response: string;
123
124
  };
@@ -1,7 +1,8 @@
1
- import { CurrentWalletIds } from '@getpara/user-management-client';
1
+ import { CurrentWalletIds, OnRampPurchase } from '@getpara/user-management-client';
2
2
  import { FullSignatureRes } from './wallet.js';
3
3
  import { Wallet } from './wallet.js';
4
4
  import { CoreMethodResponse } from './coreApi.js';
5
+ import { AssetTransfer } from './assets.js';
5
6
  export declare enum ParaEvent {
6
7
  LOGIN_EVENT = "paraLogin",
7
8
  ACCOUNT_CREATION_EVENT = "paraAccountCreation",
@@ -13,7 +14,9 @@ export declare enum ParaEvent {
13
14
  WALLETS_CHANGE_EVENT = "paraWalletsChange",
14
15
  WALLET_CREATED = "paraWalletCreated",
15
16
  PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed",
16
- GUEST_WALLETS_CREATED = "paraGuestWalletsCreated"
17
+ GUEST_WALLETS_CREATED = "paraGuestWalletsCreated",
18
+ ASSET_TRANSFERRED = "paraAssetTransferred",
19
+ ONRAMP_TRANSACTION_COMPLETE = "paraOnRampTransactionComplete"
17
20
  }
18
21
  export type BaseEvent<T> = {
19
22
  data: T;
@@ -48,3 +51,5 @@ export type PregenWalletClaimedResponse = {
48
51
  };
49
52
  export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
50
53
  export type GuestWalletsCreatedEvent = CustomEventInit<BaseEvent<CoreMethodResponse<'createGuestWallets'>>>;
54
+ export type AssetTransferredEvent = CustomEventInit<BaseEvent<AssetTransfer>>;
55
+ export type OnRampTransactionCompleteResponse = CustomEventInit<BaseEvent<OnRampPurchase>>;
@@ -1,4 +1,4 @@
1
- import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, RecoveryStatus, Theme, TOAuthMethod, TWalletType, TelegramAuthResponse } from '@getpara/user-management-client';
1
+ import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, RecoveryStatus, Theme, TOAuthMethod, TWalletType, TelegramAuthResponse, VerifyThirdPartyAuth, ServerAuthStateDone } from '@getpara/user-management-client';
2
2
  import { Wallet } from './wallet.js';
3
3
  type Device = {
4
4
  sessionId: string;
@@ -12,7 +12,7 @@ export type VerifyExternalWalletV1 = {
12
12
  cosmosPublicKeyHex?: string;
13
13
  cosmosSigner?: string;
14
14
  };
15
- export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN';
15
+ export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster';
16
16
  export type PortalUrlOptions = {
17
17
  params?: Record<string, string | undefined | null>;
18
18
  isForNewDevice?: boolean;
@@ -23,6 +23,9 @@ export type PortalUrlOptions = {
23
23
  pathId?: string;
24
24
  shorten?: boolean;
25
25
  isEmbedded?: boolean;
26
+ oAuthMethod?: OAuthUrlParams['method'];
27
+ appScheme?: string;
28
+ encryptionKey?: string;
26
29
  };
27
30
  export type WithAuthMethod = {
28
31
  /**
@@ -74,12 +77,14 @@ export type FarcasterParams = PollParams & {
74
77
  * You will need to display the URI as a QR code.
75
78
  */
76
79
  onConnectUri?: (uri: string) => void;
80
+ serverAuthState?: VerifyThirdPartyAuth;
77
81
  };
78
82
  export type TelegramParams = {
79
83
  /**
80
84
  * The response received from the Telegram login bot.
81
85
  */
82
- telegramAuthResponse: TelegramAuthResponse;
86
+ telegramAuthResponse?: TelegramAuthResponse;
87
+ serverAuthState?: VerifyThirdPartyAuth;
83
88
  };
84
89
  export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
85
90
  sessionId?: string;
@@ -121,7 +126,9 @@ export type OAuthParams = OAuthUrlParams & PollParams & {
121
126
  onOAuthPopup?: (popup: Window) => void;
122
127
  };
123
128
  export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
124
- export type AuthStateVerify = ServerAuthStateVerify;
129
+ export type AuthStateVerify = ServerAuthStateVerify & {
130
+ loginUrl?: string;
131
+ };
125
132
  export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
126
133
  /**
127
134
  * A Para Portal URL for logging in via a WebAuth passkey. For best compatibility, you should open this URL in a new window or tab.
@@ -166,10 +173,11 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
166
173
  */
167
174
  pinId?: string;
168
175
  };
176
+ export type AuthStateDone = ServerAuthStateDone;
169
177
  export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
170
- export type AuthStateSignupOrLogin = AuthStateSignup | AuthStateLogin;
171
- export type OAuthResponse = AuthStateSignupOrLogin;
172
- export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup;
178
+ export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
179
+ export type OAuthResponse = AuthStateSignupOrLoginOrDone;
180
+ export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup | AuthStateDone;
173
181
  export type Verify2faParams = {
174
182
  auth: VerifiedAuth;
175
183
  verificationCode: string;
@@ -1,4 +1,4 @@
1
- import { TWalletType } from '@getpara/user-management-client';
1
+ import { AssetValue, TWalletType } from '@getpara/user-management-client';
2
2
  export type Hex = `0x${string}`;
3
3
  export interface Signature {
4
4
  r: Hex;
@@ -17,3 +17,12 @@ export declare function truncateAddress(str: string, addressType: TWalletType, {
17
17
  prefix?: string;
18
18
  targetLength?: number;
19
19
  }): string;
20
+ export declare function formatCurrency(value?: AssetValue, { fallback }?: {
21
+ fallback?: string;
22
+ }): string;
23
+ export declare function formatAssetQuantity({ quantity, symbol, decimals, fallback, }: {
24
+ quantity?: number;
25
+ symbol?: string;
26
+ decimals?: number;
27
+ fallback?: string;
28
+ }): string;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getpara/core-sdk",
3
- "version": "2.0.0-alpha.53",
3
+ "version": "2.0.0-alpha.54",
4
4
  "dependencies": {
5
5
  "@celo/utils": "^8.0.2",
6
6
  "@cosmjs/encoding": "^0.32.4",
7
7
  "@ethereumjs/util": "^9.1.0",
8
- "@getpara/user-management-client": "2.0.0-alpha.53",
8
+ "@getpara/user-management-client": "2.0.0-alpha.54",
9
9
  "@noble/hashes": "^1.5.0",
10
10
  "base64url": "^3.0.1",
11
11
  "libphonenumber-js": "^1.11.7",
@@ -27,7 +27,7 @@
27
27
  "dist",
28
28
  "package.json"
29
29
  ],
30
- "gitHead": "ad18fa268a41b0e4c080fa8349553fb546983513",
30
+ "gitHead": "680049700f7b36b7ef407cab0fbfadad8c069d74",
31
31
  "main": "dist/cjs/index.js",
32
32
  "module": "dist/esm/index.js",
33
33
  "scripts": {