@getpara/server-sdk 3.12.0 → 3.14.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.
@@ -86,8 +86,8 @@ class ServerUtils {
86
86
  preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey, sessionCookie) {
87
87
  return (0, import_keygen.preKeygen)(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, false, partnerId, sessionCookie);
88
88
  }
89
- signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
90
- return (0, import_signing.signMessage)(ctx, userId, walletId, share, message, sessionCookie, isDKLS);
89
+ signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, _cosmosSignDoc, canonicalTransaction) {
90
+ return (0, import_signing.signMessage)(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction);
91
91
  }
92
92
  signTransaction(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS) {
93
93
  return (0, import_signing.signTransaction)(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS);
@@ -104,8 +104,8 @@ class ServerUtils {
104
104
  ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
105
105
  return (0, import_keygen.ed25519PreKeygen)(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type);
106
106
  }
107
- ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
108
- return (0, import_signing.ed25519Sign)(ctx, userId, walletId, share, base64Bytes, sessionCookie);
107
+ ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
108
+ return (0, import_signing.ed25519Sign)(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction);
109
109
  }
110
110
  openPopup(_popupUrl) {
111
111
  return __async(this, null, function* () {
@@ -136,7 +136,7 @@ function sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCooki
136
136
  }));
137
137
  });
138
138
  }
139
- function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
139
+ function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction) {
140
140
  return __async(this, null, function* () {
141
141
  return new Promise((resolve, reject) => __async(null, null, function* () {
142
142
  const workId = uuid.v4();
@@ -160,7 +160,7 @@ function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKL
160
160
  worker.postMessage({
161
161
  env: ctx.env,
162
162
  apiKey: ctx.apiKey,
163
- params: { share, walletId, userId, message },
163
+ params: { share, walletId, userId, message, canonicalTransaction },
164
164
  functionType: "SIGN_MESSAGE",
165
165
  offloadMPCComputationURL: ctx.offloadMPCComputationURL,
166
166
  disableWorkers: ctx.disableWorkers,
@@ -176,7 +176,7 @@ function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKL
176
176
  }));
177
177
  });
178
178
  }
179
- function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
179
+ function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
180
180
  return __async(this, null, function* () {
181
181
  return new Promise((resolve, reject) => __async(null, null, function* () {
182
182
  const workId = uuid.v4();
@@ -200,7 +200,7 @@ function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
200
200
  worker.postMessage({
201
201
  env: ctx.env,
202
202
  apiKey: ctx.apiKey,
203
- params: { share, walletId, userId, base64Bytes },
203
+ params: { share, walletId, userId, base64Bytes, canonicalTransaction },
204
204
  functionType: "ED25519_SIGN",
205
205
  offloadMPCComputationURL: ctx.offloadMPCComputationURL,
206
206
  disableWorkers: ctx.disableWorkers,
@@ -159,11 +159,20 @@ function withMPCNetworkHost(ctx, share) {
159
159
  return share;
160
160
  }
161
161
  }
162
- function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
162
+ function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction) {
163
163
  return __async(this, null, function* () {
164
164
  const protocolId = uuid.v4();
165
165
  const hostedShare = withMPCNetworkHost(ctx, share);
166
- const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, base64Bytes, "ED25519", void 0, protocolId);
166
+ const preSignMessageRes = ctx.client.preSignMessage(
167
+ userId,
168
+ walletId,
169
+ base64Bytes,
170
+ "ED25519",
171
+ void 0,
172
+ protocolId,
173
+ void 0,
174
+ canonicalTransaction
175
+ );
167
176
  const signRes = (function() {
168
177
  return __async(this, null, function* () {
169
178
  try {
@@ -277,10 +286,19 @@ function preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type,
277
286
  }
278
287
  });
279
288
  }
280
- function signMessage(ctx, share, walletId, userId, message) {
289
+ function signMessage(ctx, share, walletId, userId, message, canonicalTransaction) {
281
290
  return __async(this, null, function* () {
282
291
  const protocolId = uuid.v4();
283
- const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, message, null, null, protocolId, true);
292
+ const preSignMessageRes = ctx.client.preSignMessage(
293
+ userId,
294
+ walletId,
295
+ message,
296
+ null,
297
+ null,
298
+ protocolId,
299
+ true,
300
+ canonicalTransaction
301
+ );
284
302
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
285
303
  return signMessageRequest(ctx, userId, walletId, protocolId, message, share);
286
304
  }
@@ -137,8 +137,8 @@ function executeMessage(ctx, message) {
137
137
  return withRetry(() => walletUtils.sendTransaction(ctx, share, walletId, userId, tx, chainId));
138
138
  }
139
139
  case "SIGN_MESSAGE": {
140
- const { share, walletId, userId, message: message2 } = params;
141
- return withRetry(() => walletUtils.signMessage(ctx, share, walletId, userId, message2));
140
+ const { share, walletId, userId, message: message2, canonicalTransaction } = params;
141
+ return withRetry(() => walletUtils.signMessage(ctx, share, walletId, userId, message2, canonicalTransaction));
142
142
  }
143
143
  case "REFRESH": {
144
144
  const { share, walletId, userId } = params;
@@ -170,8 +170,8 @@ function executeMessage(ctx, message) {
170
170
  return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
171
171
  }
172
172
  case "ED25519_SIGN": {
173
- const { share, walletId, userId, base64Bytes } = params;
174
- return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes);
173
+ const { share, walletId, userId, base64Bytes, canonicalTransaction } = params;
174
+ return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction);
175
175
  }
176
176
  case "ED25519_PREKEYGEN": {
177
177
  const { email } = params;
@@ -35,8 +35,8 @@ class ServerUtils {
35
35
  preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type, secretKey, sessionCookie) {
36
36
  return preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey, false, partnerId, sessionCookie);
37
37
  }
38
- signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
39
- return signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS);
38
+ signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, _cosmosSignDoc, canonicalTransaction) {
39
+ return signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction);
40
40
  }
41
41
  signTransaction(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS) {
42
42
  return signTransaction(ctx, userId, walletId, share, message, chainId, sessionCookie, isDKLS);
@@ -53,8 +53,8 @@ class ServerUtils {
53
53
  ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
54
54
  return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type);
55
55
  }
56
- ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
57
- return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
56
+ ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
57
+ return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction);
58
58
  }
59
59
  async openPopup(_popupUrl) {
60
60
  throw new Error("OpenPopup is not implemented in the ServerUtils class.");
@@ -78,7 +78,7 @@ async function sendTransaction(ctx, userId, walletId, share, tx, chainId, sessio
78
78
  }
79
79
  });
80
80
  }
81
- async function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS) {
81
+ async function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction) {
82
82
  return new Promise(async (resolve, reject) => {
83
83
  const workId = uuid.v4();
84
84
  try {
@@ -101,7 +101,7 @@ async function signMessage(ctx, userId, walletId, share, message, sessionCookie,
101
101
  worker.postMessage({
102
102
  env: ctx.env,
103
103
  apiKey: ctx.apiKey,
104
- params: { share, walletId, userId, message },
104
+ params: { share, walletId, userId, message, canonicalTransaction },
105
105
  functionType: "SIGN_MESSAGE",
106
106
  offloadMPCComputationURL: ctx.offloadMPCComputationURL,
107
107
  disableWorkers: ctx.disableWorkers,
@@ -116,7 +116,7 @@ async function signMessage(ctx, userId, walletId, share, message, sessionCookie,
116
116
  }
117
117
  });
118
118
  }
119
- async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
119
+ async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
120
120
  return new Promise(async (resolve, reject) => {
121
121
  const workId = uuid.v4();
122
122
  try {
@@ -139,7 +139,7 @@ async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCoo
139
139
  worker.postMessage({
140
140
  env: ctx.env,
141
141
  apiKey: ctx.apiKey,
142
- params: { share, walletId, userId, base64Bytes },
142
+ params: { share, walletId, userId, base64Bytes, canonicalTransaction },
143
143
  functionType: "ED25519_SIGN",
144
144
  offloadMPCComputationURL: ctx.offloadMPCComputationURL,
145
145
  disableWorkers: ctx.disableWorkers,
@@ -1,5 +1,7 @@
1
1
  import "../chunk-GM7WFPGG.js";
2
- import { getBaseMPCNetworkUrl } from "@getpara/core-sdk";
2
+ import {
3
+ getBaseMPCNetworkUrl
4
+ } from "@getpara/core-sdk";
3
5
  import * as uuid from "uuid";
4
6
  import { wrapMpcError } from "./mpcWorkerError.js";
5
7
  const configCGGMPBase = (serverUrl, walletId, id) => `{"ServerUrl":"${serverUrl}", "WalletId": "${walletId}", "Id":"${id}", "Ids":["USER","CAPSULE"], "Threshold":1}`;
@@ -88,10 +90,19 @@ function withMPCNetworkHost(ctx, share) {
88
90
  return share;
89
91
  }
90
92
  }
91
- async function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
93
+ async function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction) {
92
94
  const protocolId = uuid.v4();
93
95
  const hostedShare = withMPCNetworkHost(ctx, share);
94
- const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, base64Bytes, "ED25519", void 0, protocolId);
96
+ const preSignMessageRes = ctx.client.preSignMessage(
97
+ userId,
98
+ walletId,
99
+ base64Bytes,
100
+ "ED25519",
101
+ void 0,
102
+ protocolId,
103
+ void 0,
104
+ canonicalTransaction
105
+ );
95
106
  const signRes = (async function() {
96
107
  try {
97
108
  const base64Sig = await new Promise(
@@ -198,9 +209,18 @@ async function preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType,
198
209
  throw wrapMpcError(`error creating account of type ${type} with walletId ${walletId}`, mpcErr, { walletId, protocolId });
199
210
  }
200
211
  }
201
- async function signMessage(ctx, share, walletId, userId, message) {
212
+ async function signMessage(ctx, share, walletId, userId, message, canonicalTransaction) {
202
213
  const protocolId = uuid.v4();
203
- const preSignMessageRes = ctx.client.preSignMessage(userId, walletId, message, null, null, protocolId, true);
214
+ const preSignMessageRes = ctx.client.preSignMessage(
215
+ userId,
216
+ walletId,
217
+ message,
218
+ null,
219
+ null,
220
+ protocolId,
221
+ true,
222
+ canonicalTransaction
223
+ );
204
224
  if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
205
225
  return signMessageRequest(ctx, userId, walletId, protocolId, message, share);
206
226
  }
@@ -111,8 +111,8 @@ function executeMessage(ctx, message) {
111
111
  return withRetry(() => walletUtils.sendTransaction(ctx, share, walletId, userId, tx, chainId));
112
112
  }
113
113
  case "SIGN_MESSAGE": {
114
- const { share, walletId, userId, message: message2 } = params;
115
- return withRetry(() => walletUtils.signMessage(ctx, share, walletId, userId, message2));
114
+ const { share, walletId, userId, message: message2, canonicalTransaction } = params;
115
+ return withRetry(() => walletUtils.signMessage(ctx, share, walletId, userId, message2, canonicalTransaction));
116
116
  }
117
117
  case "REFRESH": {
118
118
  const { share, walletId, userId } = params;
@@ -144,8 +144,8 @@ function executeMessage(ctx, message) {
144
144
  return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
145
145
  }
146
146
  case "ED25519_SIGN": {
147
- const { share, walletId, userId, base64Bytes } = params;
148
- return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes);
147
+ const { share, walletId, userId, base64Bytes, canonicalTransaction } = params;
148
+ return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction);
149
149
  }
150
150
  case "ED25519_PREKEYGEN": {
151
151
  const { email } = params;
@@ -1,6 +1,6 @@
1
1
  import http from 'node:http';
2
2
  import https from 'node:https';
3
- import type { Ctx, SignatureRes, PlatformUtils, TPregenIdentifierType, TWalletType } from '@getpara/core-sdk';
3
+ import type { Ctx, SignatureRes, PlatformUtils, TPregenIdentifierType, TWalletType, CanonicalTransactionContext } from '@getpara/core-sdk';
4
4
  import { BackupKitEmailProps, SDKType } from '@getpara/user-management-client';
5
5
  import { ServerLocalStorage } from './ServerLocalStorage.js';
6
6
  import { ServerSessionStorage } from './ServerSessionStorage.js';
@@ -24,7 +24,7 @@ export declare class ServerUtils implements PlatformUtils {
24
24
  signer: string;
25
25
  walletId: string;
26
26
  }>;
27
- signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
27
+ signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie: string, isDKLS?: boolean, _cosmosSignDoc?: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
28
28
  signTransaction(ctx: Ctx, userId: string, walletId: string, share: string, message: string, chainId: string, sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
29
29
  sendTransaction(ctx: Ctx, userId: string, walletId: string, share: string, tx: string, chainId: string, sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
30
30
  signHash(_address: string, _hash: string): Promise<{
@@ -40,7 +40,7 @@ export declare class ServerUtils implements PlatformUtils {
40
40
  signer: string;
41
41
  walletId: string;
42
42
  }>;
43
- ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie: string): Promise<SignatureRes>;
43
+ ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
44
44
  localStorage: ServerLocalStorage;
45
45
  sessionStorage: ServerSessionStorage;
46
46
  secureStorage: any;
@@ -1,5 +1,5 @@
1
- import type { Ctx, SignatureRes } from '@getpara/core-sdk';
1
+ import type { CanonicalTransactionContext, Ctx, SignatureRes } from '@getpara/core-sdk';
2
2
  export declare function signTransaction(ctx: Ctx, userId: string, walletId: string, share: string, tx: string, chainId: string, sessionCookie?: string, isDKLS?: boolean): Promise<SignatureRes>;
3
3
  export declare function sendTransaction(ctx: Ctx, userId: string, walletId: string, share: string, tx: string, chainId: string, sessionCookie?: string, isDKLS?: boolean): Promise<SignatureRes>;
4
- export declare function signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie?: string, isDKLS?: boolean): Promise<SignatureRes>;
5
- export declare function ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie?: string): Promise<SignatureRes>;
4
+ export declare function signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie?: string, isDKLS?: boolean, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
5
+ export declare function ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie?: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
@@ -1,4 +1,4 @@
1
- import { Ctx, TPregenIdentifierType, SignatureRes, TWalletType } from '@getpara/core-sdk';
1
+ import { Ctx, TPregenIdentifierType, SignatureRes, TWalletType, type CanonicalTransactionContext } from '@getpara/core-sdk';
2
2
  export declare function ed25519Keygen(ctx: Ctx, userId: string, _sessionCookie?: string, _emailProps?: unknown, type?: TWalletType): Promise<{
3
3
  signer: string;
4
4
  walletId: string;
@@ -7,7 +7,7 @@ export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pre
7
7
  signer: string;
8
8
  walletId: string;
9
9
  }>;
10
- export declare function ed25519Sign(ctx: Ctx, share: string, userId: string, walletId: string, base64Bytes: string): Promise<SignatureRes>;
10
+ export declare function ed25519Sign(ctx: Ctx, share: string, userId: string, walletId: string, base64Bytes: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
11
11
  export declare function keygen(ctx: Ctx, userId: string, type: Exclude<TWalletType, 'SOLANA'>, secretKey: string | null): Promise<{
12
12
  signer: string;
13
13
  walletId: string;
@@ -16,7 +16,7 @@ export declare function preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier:
16
16
  signer: string;
17
17
  walletId: string;
18
18
  }>;
19
- export declare function signMessage(ctx: Ctx, share: string, walletId: string, userId: string, message: string): Promise<SignatureRes>;
19
+ export declare function signMessage(ctx: Ctx, share: string, walletId: string, userId: string, message: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
20
20
  export declare function signTransaction(ctx: Ctx, share: string, walletId: string, userId: string, tx: string, chainId: string): Promise<SignatureRes>;
21
21
  export declare function sendTransaction(ctx: Ctx, share: string, walletId: string, userId: string, tx: string, chainId: string): Promise<SignatureRes>;
22
22
  export declare function refresh(ctx: Ctx, share: string, walletId: string, userId: string): Promise<string>;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@getpara/server-sdk",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "dependencies": {
5
- "@getpara/core-sdk": "3.12.0",
6
- "@getpara/user-management-client": "3.12.0",
7
- "@getpara/viem-v2-integration": "3.12.0",
5
+ "@getpara/core-sdk": "3.14.0",
6
+ "@getpara/user-management-client": "3.14.0",
7
+ "@getpara/viem-v2-integration": "3.14.0",
8
8
  "uuid": "^11.1.1",
9
9
  "ws": "^8.21.0"
10
10
  },
@@ -16,7 +16,7 @@
16
16
  "dist",
17
17
  "package.json"
18
18
  ],
19
- "gitHead": "d35527b231d0ba1c19fadab258ab2c61888ce392",
19
+ "gitHead": "2b83e73b639ad1733d1c03a5e628a92c87b399c1",
20
20
  "main": "dist/cjs/index.js",
21
21
  "module": "dist/esm/index.js",
22
22
  "scripts": {