@getpara/web-sdk 2.18.0 → 2.20.0

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.
@@ -29,11 +29,11 @@ export declare class WebUtils implements PlatformUtils {
29
29
  r: Buffer;
30
30
  s: Buffer;
31
31
  }>;
32
- ed25519Keygen(ctx: Ctx, userId: string, sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
32
+ ed25519Keygen(ctx: Ctx, userId: string, sessionCookie: string, emailProps?: BackupKitEmailProps, type?: TWalletType): Promise<{
33
33
  signer: string;
34
34
  walletId: string;
35
35
  }>;
36
- ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie: string): Promise<{
36
+ ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie: string, type?: TWalletType): Promise<{
37
37
  signer: string;
38
38
  walletId: string;
39
39
  }>;
package/dist/WebUtils.js CHANGED
@@ -45,11 +45,11 @@ class WebUtils {
45
45
  signHash(_address, _hash) {
46
46
  throw new Error("not implemented");
47
47
  }
48
- ed25519Keygen(ctx, userId, sessionCookie, emailProps) {
49
- return ed25519Keygen(ctx, userId, sessionCookie, emailProps);
48
+ ed25519Keygen(ctx, userId, sessionCookie, emailProps, type) {
49
+ return ed25519Keygen(ctx, userId, sessionCookie, emailProps, type);
50
50
  }
51
- ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
52
- return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie);
51
+ ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
52
+ return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type);
53
53
  }
54
54
  ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
55
55
  return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
@@ -14,12 +14,12 @@ export declare function refresh(ctx: Ctx, sessionCookie: string, userId: string,
14
14
  signer: string;
15
15
  protocolId: string;
16
16
  }>;
17
- export declare function ed25519Keygen(ctx: Ctx, userId: string, sessionCookie?: string, _emailProps?: BackupKitEmailProps): Promise<{
17
+ export declare function ed25519Keygen(ctx: Ctx, userId: string, sessionCookie?: string, _emailProps?: BackupKitEmailProps, type?: TWalletType): Promise<{
18
18
  signer: string;
19
19
  walletId: string;
20
20
  recoveryShare: string | null;
21
21
  }>;
22
- export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie?: string): Promise<{
22
+ export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie?: string, type?: TWalletType): Promise<{
23
23
  signer: string;
24
24
  walletId: string;
25
25
  recoveryShare: string | null;
@@ -165,7 +165,7 @@ function refresh(ctx, sessionCookie, userId, walletId, share, oldPartnerId, newP
165
165
  });
166
166
  }));
167
167
  }
168
- function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
168
+ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}, type) {
169
169
  return new Promise((resolve, reject) => __async(this, null, function* () {
170
170
  const workId = uuid.v4();
171
171
  let worker = null;
@@ -190,7 +190,7 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
190
190
  env: ctx.env,
191
191
  apiKey: ctx.apiKey,
192
192
  cosmosPrefix: ctx.cosmosPrefix,
193
- params: { userId },
193
+ params: { userId, type },
194
194
  functionType: "ED25519_KEYGEN",
195
195
  disableWorkers: ctx.disableWorkers,
196
196
  sessionCookie,
@@ -200,7 +200,7 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
200
200
  });
201
201
  }));
202
202
  }
203
- function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
203
+ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
204
204
  return new Promise((resolve, reject) => __async(this, null, function* () {
205
205
  const workId = uuid.v4();
206
206
  let worker = null;
@@ -226,7 +226,7 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCo
226
226
  workId
227
227
  );
228
228
  const email = void 0;
229
- const params = { pregenIdentifier, pregenIdentifierType, email };
229
+ const params = { pregenIdentifier, pregenIdentifierType, email, type };
230
230
  if (pregenIdentifierType === "EMAIL") {
231
231
  params.email = pregenIdentifier;
232
232
  }
@@ -1,9 +1,9 @@
1
1
  import { Ctx, TPregenIdentifierType, SignatureRes, TWalletType } from '@getpara/core-sdk';
2
- export declare function ed25519Keygen(ctx: Ctx, userId: string): Promise<{
2
+ export declare function ed25519Keygen(ctx: Ctx, userId: string, _sessionCookie?: string, _emailProps?: unknown, type?: TWalletType): Promise<{
3
3
  signer: string;
4
4
  walletId: string;
5
5
  }>;
6
- export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType): Promise<{
6
+ export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, _sessionCookie?: string, type?: TWalletType): Promise<{
7
7
  signer: string;
8
8
  walletId: string;
9
9
  }>;
@@ -39,11 +39,11 @@ function sendTransactionRequest(ctx, userId, walletId, protocolId, transaction,
39
39
  return data;
40
40
  });
41
41
  }
42
- function ed25519Keygen(ctx, userId) {
42
+ function ed25519Keygen(ctx, userId, _sessionCookie, _emailProps, type = "SOLANA") {
43
43
  return __async(this, null, function* () {
44
44
  const { walletId, protocolId } = yield ctx.client.createWallet(userId, {
45
45
  scheme: "ED25519",
46
- type: "SOLANA"
46
+ type
47
47
  });
48
48
  const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
49
49
  try {
@@ -57,17 +57,17 @@ function ed25519Keygen(ctx, userId) {
57
57
  );
58
58
  return { signer: newSigner, walletId };
59
59
  } catch (e) {
60
- throw new Error(`error creating account of type SOLANA with userId ${userId} and walletId ${walletId}`);
60
+ throw new Error(`error creating ED25519 account with userId ${userId} and walletId ${walletId}`);
61
61
  }
62
62
  });
63
63
  }
64
- function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
64
+ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, _sessionCookie, type = "SOLANA") {
65
65
  return __async(this, null, function* () {
66
66
  const { walletId, protocolId } = yield ctx.client.createPregenWallet({
67
67
  pregenIdentifier,
68
68
  pregenIdentifierType,
69
69
  scheme: "ED25519",
70
- type: "SOLANA"
70
+ type
71
71
  });
72
72
  const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
73
73
  try {
@@ -81,7 +81,7 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
81
81
  );
82
82
  return { signer: newSigner, walletId };
83
83
  } catch (e) {
84
- throw new Error(`error creating account of type SOLANA with walletId ${walletId}`);
84
+ throw new Error(`error creating ED25519 account with walletId ${walletId}`);
85
85
  }
86
86
  });
87
87
  }
@@ -111,8 +111,8 @@ function executeMessage(ctx, message) {
111
111
  return { privateKey };
112
112
  }
113
113
  case "ED25519_KEYGEN": {
114
- const { userId } = params;
115
- return walletUtils.ed25519Keygen(ctx, userId);
114
+ const { userId, type } = params;
115
+ return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
116
116
  }
117
117
  case "ED25519_SIGN": {
118
118
  const { share, walletId, userId, base64Bytes } = params;
@@ -125,7 +125,7 @@ function executeMessage(ctx, message) {
125
125
  pregenIdentifier = email;
126
126
  pregenIdentifierType = "EMAIL";
127
127
  }
128
- return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType);
128
+ return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, void 0, params.type);
129
129
  }
130
130
  default: {
131
131
  throw new Error(`functionType: ${functionType} not supported`);
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@getpara/web-sdk",
3
- "version": "2.18.0",
3
+ "version": "2.20.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "2.18.0",
6
- "@getpara/user-management-client": "2.18.0",
5
+ "@getpara/core-sdk": "2.20.0",
6
+ "@getpara/user-management-client": "2.20.0",
7
7
  "base64url": "^3.0.1",
8
8
  "buffer": "6.0.3",
9
9
  "cbor-web": "^9.0.2",
@@ -29,7 +29,7 @@
29
29
  "dist",
30
30
  "package.json"
31
31
  ],
32
- "gitHead": "4481f6f4e108e682d14c74d4433696141c47fc58",
32
+ "gitHead": "a8443bcc4018864f5e582f238ade1bb3b4e121f4",
33
33
  "main": "dist/index.js",
34
34
  "scripts": {
35
35
  "build": "rm -rf dist && yarn typegen && node ./scripts/build.mjs && yarn post-build",