@getpara/web-sdk 1.12.0 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ParaWeb.js CHANGED
@@ -1,10 +1,17 @@
1
1
  "use client";
2
2
  import "./chunk-M66XENHI.js";
3
- import ParaCore from "@getpara/core-sdk";
3
+ import * as Sentry from "@sentry/browser";
4
+ import ParaCore, { Environment } from "@getpara/core-sdk";
4
5
  import { WebUtils } from "./WebUtils.js";
5
6
  class Para extends ParaCore {
6
7
  constructor(env, apiKey, opts) {
7
8
  super(env, apiKey, opts);
9
+ if (env !== Environment.PROD && env !== Environment.DEV) {
10
+ Sentry.init({
11
+ environment: env.toLowerCase(),
12
+ dsn: "https://38f27d4836da617ab9e95cf66b9611d9@o4504568036720640.ingest.us.sentry.io/4508850812944384"
13
+ });
14
+ }
8
15
  }
9
16
  getPlatformUtils() {
10
17
  return new WebUtils();
@@ -2,12 +2,12 @@
2
2
  import { Ctx, PlatformUtils, SignatureRes, PopupType } from '@getpara/core-sdk';
3
3
  import { LocalStorage } from './LocalStorage.js';
4
4
  import { SessionStorage } from './SessionStorage.js';
5
- import { BackupKitEmailProps, WalletType, SDKType } from '@getpara/user-management-client';
5
+ import { BackupKitEmailProps, TWalletType, SDKType } from '@getpara/user-management-client';
6
6
  import { TPregenIdentifierType } from '@getpara/core-sdk';
7
7
  export declare class WebUtils implements PlatformUtils {
8
8
  sdkType: SDKType;
9
9
  getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
10
- 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
10
+ 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
11
11
  sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
12
12
  signer: string;
13
13
  walletId: string;
@@ -15,7 +15,7 @@ export declare class WebUtils implements PlatformUtils {
15
15
  refresh(ctx: Ctx, sessionCookie: string, userId: string, walletId: string, share: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string): Promise<{
16
16
  signer: string;
17
17
  }>;
18
- preKeygen(ctx: Ctx, partnerId: string | undefined, 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 | undefined, 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,11 +1,11 @@
1
1
  import { Ctx, TPregenIdentifierType } from '@getpara/core-sdk';
2
- import { BackupKitEmailProps, WalletType } from '@getpara/user-management-client';
3
- export declare function keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, skipDistribute?: boolean, sessionCookie?: string, emailProps?: BackupKitEmailProps): Promise<{
2
+ import { BackupKitEmailProps, TWalletType } from '@getpara/user-management-client';
3
+ export declare function keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, skipDistribute?: boolean, sessionCookie?: string, emailProps?: BackupKitEmailProps): Promise<{
4
4
  signer: string;
5
5
  walletId: string;
6
6
  recoveryShare: string | null;
7
7
  }>;
8
- export declare function preKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, _skipDistribute: boolean, partnerId: string, sessionCookie?: string): Promise<{
8
+ export declare function preKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null, _skipDistribute: boolean, partnerId: string, sessionCookie?: string): Promise<{
9
9
  signer: string;
10
10
  walletId: string;
11
11
  recoveryShare: string | null;
@@ -1,4 +1,4 @@
1
- import { Ctx, TPregenIdentifierType, SignatureRes, WalletType } from '@getpara/core-sdk';
1
+ import { Ctx, TPregenIdentifierType, SignatureRes, TWalletType } from '@getpara/core-sdk';
2
2
  export declare function ed25519Keygen(ctx: Ctx, userId: string): Promise<{
3
3
  signer: string;
4
4
  walletId: string;
@@ -10,11 +10,11 @@ export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pre
10
10
  export declare function ed25519Sign(ctx: Ctx, share: string, userId: string, walletId: string, base64Bytes: string): Promise<{
11
11
  signature: string;
12
12
  }>;
13
- export declare function keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null): Promise<{
13
+ export declare function keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null): Promise<{
14
14
  signer: string;
15
15
  walletId: string;
16
16
  }>;
17
- export declare function preKeygen(ctx: Ctx, _partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null): Promise<{
17
+ export declare function preKeygen(ctx: Ctx, _partnerId: string | undefined, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null): Promise<{
18
18
  signer: string;
19
19
  walletId: string;
20
20
  }>;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  __async
4
4
  } from "../chunk-M66XENHI.js";
5
- import { getBaseMPCNetworkUrl, WalletScheme, WalletType } from "@getpara/core-sdk";
5
+ import { getBaseMPCNetworkUrl } from "@getpara/core-sdk";
6
6
  const configCGGMPBase = (serverUrl, walletId, id) => `{"ServerUrl":"${serverUrl}", "WalletId": "${walletId}", "Id":"${id}", "Ids":["USER","CAPSULE"], "Threshold":1}`;
7
7
  const configDKLSBase = (walletId, id, disableWebSockets) => `{"walletId": "${walletId}", "id":"${id}", "otherId":"CAPSULE", "isReceiver": false, "disableWebSockets": ${disableWebSockets}}`;
8
8
  function keygenRequest(ctx, userId, walletId, protocolId) {
@@ -41,8 +41,8 @@ function sendTransactionRequest(ctx, userId, walletId, protocolId, transaction,
41
41
  function ed25519Keygen(ctx, userId) {
42
42
  return __async(this, null, function* () {
43
43
  const { walletId, protocolId } = yield ctx.client.createWallet(userId, {
44
- scheme: WalletScheme.ED25519,
45
- type: WalletType.SOLANA
44
+ scheme: "ED25519",
45
+ type: "SOLANA"
46
46
  });
47
47
  const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
48
48
  try {
@@ -65,8 +65,8 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
65
65
  const { walletId, protocolId } = yield ctx.client.createPregenWallet({
66
66
  pregenIdentifier,
67
67
  pregenIdentifierType,
68
- scheme: WalletScheme.ED25519,
69
- type: WalletType.SOLANA
68
+ scheme: "ED25519",
69
+ type: "SOLANA"
70
70
  });
71
71
  const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
72
72
  try {
@@ -86,7 +86,7 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
86
86
  }
87
87
  function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
88
88
  return __async(this, null, function* () {
89
- const { protocolId } = yield ctx.client.preSignMessage(userId, walletId, base64Bytes, WalletScheme.ED25519);
89
+ const { protocolId } = yield ctx.client.preSignMessage(userId, walletId, base64Bytes, "ED25519");
90
90
  try {
91
91
  const base64Sig = yield new Promise(
92
92
  (resolve, reject) => globalThis.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
@@ -106,9 +106,9 @@ function keygen(ctx, userId, type, secretKey) {
106
106
  return __async(this, null, function* () {
107
107
  const { walletId, protocolId } = yield ctx.client.createWallet(userId, {
108
108
  useTwoSigners: true,
109
- scheme: ctx.useDKLS ? WalletScheme.DKLS : WalletScheme.CGGMP,
109
+ scheme: ctx.useDKLS ? "DKLS" : "CGGMP",
110
110
  type,
111
- cosmosPrefix: type === WalletType.COSMOS ? ctx.cosmosPrefix : void 0
111
+ cosmosPrefix: type === "COSMOS" ? ctx.cosmosPrefix : void 0
112
112
  });
113
113
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
114
114
  return {
@@ -149,7 +149,7 @@ function preKeygen(ctx, _partnerId, pregenIdentifier, pregenIdentifierType, type
149
149
  pregenIdentifier,
150
150
  pregenIdentifierType,
151
151
  type,
152
- cosmosPrefix: type === WalletType.COSMOS ? ctx.cosmosPrefix : void 0
152
+ cosmosPrefix: type === "COSMOS" ? ctx.cosmosPrefix : void 0
153
153
  });
154
154
  const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
155
155
  const signerConfigUser = configDKLSBase(walletId, "USER", ctx.disableWebSockets);
@@ -21,13 +21,7 @@ var __async = (__this, __arguments, generator) => {
21
21
  };
22
22
  import "../wasm/wasm_exec.js";
23
23
  import * as walletUtils from "./walletUtils.js";
24
- import {
25
- getPortalBaseURL,
26
- initClient,
27
- mpcComputationClient,
28
- paraVersion,
29
- WalletType
30
- } from "@getpara/core-sdk";
24
+ import { getPortalBaseURL, initClient, mpcComputationClient, paraVersion } from "@getpara/core-sdk";
31
25
  function loadWasm(ctx, wasmOverride) {
32
26
  return __async(this, null, function* () {
33
27
  if (typeof self === "undefined") {
@@ -51,7 +45,7 @@ function executeMessage(ctx, message) {
51
45
  const { functionType, params, returnObject } = message;
52
46
  switch (functionType) {
53
47
  case "KEYGEN": {
54
- const { userId, secretKey, type = WalletType.EVM } = params;
48
+ const { userId, secretKey, type = "EVM" } = params;
55
49
  const keygenRes = yield walletUtils.keygen(ctx, userId, type, secretKey);
56
50
  return keygenRes;
57
51
  }
@@ -81,7 +75,7 @@ function executeMessage(ctx, message) {
81
75
  return returnObject ? { protocolId, signer } : signer;
82
76
  }
83
77
  case "PREKEYGEN": {
84
- const { email, partnerId, secretKey, type = WalletType.EVM } = params;
78
+ const { email, partnerId, secretKey, type = "EVM" } = params;
85
79
  let { pregenIdentifier, pregenIdentifierType } = params;
86
80
  if (email !== "null" && email !== "undefined" && email !== "" && email != null) {
87
81
  pregenIdentifier = email;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/web-sdk",
3
- "version": "1.12.0",
3
+ "version": "2.0.0-alpha.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,8 +8,9 @@
8
8
  "wasm_exec.js"
9
9
  ],
10
10
  "dependencies": {
11
- "@getpara/core-sdk": "1.12.0",
12
- "@getpara/user-management-client": "1.12.0",
11
+ "@getpara/core-sdk": "2.0.0-alpha.5",
12
+ "@getpara/user-management-client": "2.0.0-alpha.5",
13
+ "@sentry/browser": "^9.1.0",
13
14
  "base64url": "3.0.1",
14
15
  "buffer": "6.0.3",
15
16
  "cbor-web": "8.1.0",
@@ -35,5 +36,5 @@
35
36
  "dist",
36
37
  "package.json"
37
38
  ],
38
- "gitHead": "748afcf08c9d307a2d3eaf0716f73132f3eb8529"
39
+ "gitHead": "3ecfca088f24489f2e8fa5493d0f4459b08880e1"
39
40
  }