@getpara/server-sdk 3.18.0 → 3.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.
- package/dist/cjs/ServerUtils.js +4 -4
- package/dist/cjs/wallet/signing.js +30 -4
- package/dist/cjs/workers/walletUtils.js +39 -14
- package/dist/cjs/workers/worker.js +6 -4
- package/dist/esm/ServerUtils.js +4 -4
- package/dist/esm/wallet/signing.js +18 -4
- package/dist/esm/workers/walletUtils.js +25 -14
- package/dist/esm/workers/worker.js +6 -4
- package/dist/types/ServerUtils.d.ts +2 -2
- package/dist/types/wallet/signing.d.ts +2 -2
- package/dist/types/workers/walletUtils.d.ts +2 -2
- package/package.json +5 -5
package/dist/cjs/ServerUtils.js
CHANGED
|
@@ -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, _cosmosSignDoc, canonicalTransaction) {
|
|
90
|
-
return (0, import_signing.signMessage)(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction);
|
|
89
|
+
signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, _cosmosSignDoc, canonicalTransaction, approvalCaseId) {
|
|
90
|
+
return (0, import_signing.signMessage)(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction, approvalCaseId);
|
|
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, canonicalTransaction) {
|
|
108
|
-
return (0, import_signing.ed25519Sign)(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction);
|
|
107
|
+
ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId) {
|
|
108
|
+
return (0, import_signing.ed25519Sign)(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId);
|
|
109
109
|
}
|
|
110
110
|
openPopup(_popupUrl) {
|
|
111
111
|
return __async(this, null, function* () {
|
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __export = (target, all) => {
|
|
8
22
|
for (var name in all)
|
|
9
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -136,7 +150,7 @@ function sendTransaction(ctx, userId, walletId, share, tx, chainId, sessionCooki
|
|
|
136
150
|
}));
|
|
137
151
|
});
|
|
138
152
|
}
|
|
139
|
-
function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction) {
|
|
153
|
+
function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction, approvalCaseId) {
|
|
140
154
|
return __async(this, null, function* () {
|
|
141
155
|
return new Promise((resolve, reject) => __async(null, null, function* () {
|
|
142
156
|
const workId = uuid.v4();
|
|
@@ -160,7 +174,13 @@ function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKL
|
|
|
160
174
|
worker.postMessage({
|
|
161
175
|
env: ctx.env,
|
|
162
176
|
apiKey: ctx.apiKey,
|
|
163
|
-
params: {
|
|
177
|
+
params: __spreadValues({
|
|
178
|
+
share,
|
|
179
|
+
walletId,
|
|
180
|
+
userId,
|
|
181
|
+
message,
|
|
182
|
+
canonicalTransaction
|
|
183
|
+
}, approvalCaseId ? { approvalCaseId } : {}),
|
|
164
184
|
functionType: "SIGN_MESSAGE",
|
|
165
185
|
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
166
186
|
disableWorkers: ctx.disableWorkers,
|
|
@@ -176,7 +196,7 @@ function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKL
|
|
|
176
196
|
}));
|
|
177
197
|
});
|
|
178
198
|
}
|
|
179
|
-
function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
|
|
199
|
+
function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId) {
|
|
180
200
|
return __async(this, null, function* () {
|
|
181
201
|
return new Promise((resolve, reject) => __async(null, null, function* () {
|
|
182
202
|
const workId = uuid.v4();
|
|
@@ -200,7 +220,13 @@ function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, c
|
|
|
200
220
|
worker.postMessage({
|
|
201
221
|
env: ctx.env,
|
|
202
222
|
apiKey: ctx.apiKey,
|
|
203
|
-
params: {
|
|
223
|
+
params: __spreadValues({
|
|
224
|
+
share,
|
|
225
|
+
walletId,
|
|
226
|
+
userId,
|
|
227
|
+
base64Bytes,
|
|
228
|
+
canonicalTransaction
|
|
229
|
+
}, approvalCaseId ? { approvalCaseId } : {}),
|
|
204
230
|
functionType: "ED25519_SIGN",
|
|
205
231
|
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
206
232
|
disableWorkers: ctx.disableWorkers,
|
|
@@ -2,8 +2,22 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
7
21
|
var __export = (target, all) => {
|
|
8
22
|
for (var name in all)
|
|
9
23
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -159,11 +173,21 @@ function withMPCNetworkHost(ctx, share) {
|
|
|
159
173
|
return share;
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
|
-
function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction) {
|
|
176
|
+
function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction, approvalCaseId) {
|
|
163
177
|
return __async(this, null, function* () {
|
|
164
178
|
const protocolId = uuid.v4();
|
|
165
179
|
const hostedShare = withMPCNetworkHost(ctx, share);
|
|
166
|
-
const preSignMessageRes = ctx.client.preSignMessage(
|
|
180
|
+
const preSignMessageRes = approvalCaseId ? ctx.client.preSignMessage(
|
|
181
|
+
userId,
|
|
182
|
+
walletId,
|
|
183
|
+
base64Bytes,
|
|
184
|
+
"ED25519",
|
|
185
|
+
void 0,
|
|
186
|
+
protocolId,
|
|
187
|
+
void 0,
|
|
188
|
+
canonicalTransaction,
|
|
189
|
+
approvalCaseId
|
|
190
|
+
) : ctx.client.preSignMessage(
|
|
167
191
|
userId,
|
|
168
192
|
walletId,
|
|
169
193
|
base64Bytes,
|
|
@@ -194,9 +218,9 @@ function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransac
|
|
|
194
218
|
})();
|
|
195
219
|
signRes.catch(() => {
|
|
196
220
|
});
|
|
197
|
-
const { pendingTransactionId } = yield preSignMessageRes;
|
|
221
|
+
const { pendingTransactionId, approvalCaseId: pendingApprovalCaseId } = yield preSignMessageRes;
|
|
198
222
|
if (pendingTransactionId) {
|
|
199
|
-
return { pendingTransactionId };
|
|
223
|
+
return __spreadValues({ pendingTransactionId }, pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {});
|
|
200
224
|
}
|
|
201
225
|
return yield signRes;
|
|
202
226
|
});
|
|
@@ -286,10 +310,10 @@ function preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType, type,
|
|
|
286
310
|
}
|
|
287
311
|
});
|
|
288
312
|
}
|
|
289
|
-
function signMessage(ctx, share, walletId, userId, message, canonicalTransaction) {
|
|
313
|
+
function signMessage(ctx, share, walletId, userId, message, canonicalTransaction, approvalCaseId) {
|
|
290
314
|
return __async(this, null, function* () {
|
|
291
315
|
const protocolId = uuid.v4();
|
|
292
|
-
const preSignMessageRes = ctx.client.preSignMessage(
|
|
316
|
+
const preSignMessageRes = approvalCaseId ? ctx.client.preSignMessage(
|
|
293
317
|
userId,
|
|
294
318
|
walletId,
|
|
295
319
|
message,
|
|
@@ -297,8 +321,9 @@ function signMessage(ctx, share, walletId, userId, message, canonicalTransaction
|
|
|
297
321
|
null,
|
|
298
322
|
protocolId,
|
|
299
323
|
true,
|
|
300
|
-
canonicalTransaction
|
|
301
|
-
|
|
324
|
+
canonicalTransaction,
|
|
325
|
+
approvalCaseId
|
|
326
|
+
) : ctx.client.preSignMessage(userId, walletId, message, null, null, protocolId, true, canonicalTransaction);
|
|
302
327
|
if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
|
|
303
328
|
return signMessageRequest(ctx, userId, walletId, protocolId, message, share);
|
|
304
329
|
}
|
|
@@ -322,9 +347,9 @@ function signMessage(ctx, share, walletId, userId, message, canonicalTransaction
|
|
|
322
347
|
})();
|
|
323
348
|
signMessageRes.catch(() => {
|
|
324
349
|
});
|
|
325
|
-
const { pendingTransactionId } = yield preSignMessageRes;
|
|
350
|
+
const { pendingTransactionId, approvalCaseId: pendingApprovalCaseId } = yield preSignMessageRes;
|
|
326
351
|
if (pendingTransactionId) {
|
|
327
|
-
return { pendingTransactionId };
|
|
352
|
+
return __spreadValues({ pendingTransactionId }, pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {});
|
|
328
353
|
}
|
|
329
354
|
return yield signMessageRes;
|
|
330
355
|
});
|
|
@@ -364,10 +389,10 @@ function signTransaction(ctx, share, walletId, userId, tx, chainId) {
|
|
|
364
389
|
signTxRes.catch(() => {
|
|
365
390
|
});
|
|
366
391
|
const {
|
|
367
|
-
data: { pendingTransactionId }
|
|
392
|
+
data: { pendingTransactionId, approvalCaseId: pendingApprovalCaseId }
|
|
368
393
|
} = yield signTransactionRes;
|
|
369
394
|
if (pendingTransactionId) {
|
|
370
|
-
return { pendingTransactionId };
|
|
395
|
+
return __spreadValues({ pendingTransactionId }, pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {});
|
|
371
396
|
}
|
|
372
397
|
return yield signTxRes;
|
|
373
398
|
});
|
|
@@ -409,10 +434,10 @@ function sendTransaction(ctx, share, walletId, userId, tx, chainId) {
|
|
|
409
434
|
sendTxRes.catch(() => {
|
|
410
435
|
});
|
|
411
436
|
const {
|
|
412
|
-
data: { pendingTransactionId }
|
|
437
|
+
data: { pendingTransactionId, approvalCaseId: pendingApprovalCaseId }
|
|
413
438
|
} = yield sendTransactionRes;
|
|
414
439
|
if (pendingTransactionId) {
|
|
415
|
-
return { pendingTransactionId };
|
|
440
|
+
return __spreadValues({ pendingTransactionId }, pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {});
|
|
416
441
|
}
|
|
417
442
|
return yield sendTxRes;
|
|
418
443
|
});
|
|
@@ -137,8 +137,10 @@ 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, canonicalTransaction } = params;
|
|
141
|
-
return withRetry(
|
|
140
|
+
const { share, walletId, userId, message: message2, canonicalTransaction, approvalCaseId } = params;
|
|
141
|
+
return withRetry(
|
|
142
|
+
() => walletUtils.signMessage(ctx, share, walletId, userId, message2, canonicalTransaction, approvalCaseId)
|
|
143
|
+
);
|
|
142
144
|
}
|
|
143
145
|
case "REFRESH": {
|
|
144
146
|
const { share, walletId, userId } = params;
|
|
@@ -170,8 +172,8 @@ function executeMessage(ctx, message) {
|
|
|
170
172
|
return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
|
|
171
173
|
}
|
|
172
174
|
case "ED25519_SIGN": {
|
|
173
|
-
const { share, walletId, userId, base64Bytes, canonicalTransaction } = params;
|
|
174
|
-
return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction);
|
|
175
|
+
const { share, walletId, userId, base64Bytes, canonicalTransaction, approvalCaseId } = params;
|
|
176
|
+
return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction, approvalCaseId);
|
|
175
177
|
}
|
|
176
178
|
case "ED25519_PREKEYGEN": {
|
|
177
179
|
const { email } = params;
|
package/dist/esm/ServerUtils.js
CHANGED
|
@@ -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, _cosmosSignDoc, canonicalTransaction) {
|
|
39
|
-
return signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction);
|
|
38
|
+
signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, _cosmosSignDoc, canonicalTransaction, approvalCaseId) {
|
|
39
|
+
return signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction, approvalCaseId);
|
|
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, canonicalTransaction) {
|
|
57
|
-
return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction);
|
|
56
|
+
ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId) {
|
|
57
|
+
return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId);
|
|
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, canonicalTransaction) {
|
|
81
|
+
async function signMessage(ctx, userId, walletId, share, message, sessionCookie, isDKLS, canonicalTransaction, approvalCaseId) {
|
|
82
82
|
return new Promise(async (resolve, reject) => {
|
|
83
83
|
const workId = uuid.v4();
|
|
84
84
|
try {
|
|
@@ -101,7 +101,14 @@ 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: {
|
|
104
|
+
params: {
|
|
105
|
+
share,
|
|
106
|
+
walletId,
|
|
107
|
+
userId,
|
|
108
|
+
message,
|
|
109
|
+
canonicalTransaction,
|
|
110
|
+
...approvalCaseId ? { approvalCaseId } : {}
|
|
111
|
+
},
|
|
105
112
|
functionType: "SIGN_MESSAGE",
|
|
106
113
|
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
107
114
|
disableWorkers: ctx.disableWorkers,
|
|
@@ -116,7 +123,7 @@ async function signMessage(ctx, userId, walletId, share, message, sessionCookie,
|
|
|
116
123
|
}
|
|
117
124
|
});
|
|
118
125
|
}
|
|
119
|
-
async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction) {
|
|
126
|
+
async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie, canonicalTransaction, approvalCaseId) {
|
|
120
127
|
return new Promise(async (resolve, reject) => {
|
|
121
128
|
const workId = uuid.v4();
|
|
122
129
|
try {
|
|
@@ -139,7 +146,14 @@ async function ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCoo
|
|
|
139
146
|
worker.postMessage({
|
|
140
147
|
env: ctx.env,
|
|
141
148
|
apiKey: ctx.apiKey,
|
|
142
|
-
params: {
|
|
149
|
+
params: {
|
|
150
|
+
share,
|
|
151
|
+
walletId,
|
|
152
|
+
userId,
|
|
153
|
+
base64Bytes,
|
|
154
|
+
canonicalTransaction,
|
|
155
|
+
...approvalCaseId ? { approvalCaseId } : {}
|
|
156
|
+
},
|
|
143
157
|
functionType: "ED25519_SIGN",
|
|
144
158
|
offloadMPCComputationURL: ctx.offloadMPCComputationURL,
|
|
145
159
|
disableWorkers: ctx.disableWorkers,
|
|
@@ -90,10 +90,20 @@ function withMPCNetworkHost(ctx, share) {
|
|
|
90
90
|
return share;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
async function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction) {
|
|
93
|
+
async function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction, approvalCaseId) {
|
|
94
94
|
const protocolId = uuid.v4();
|
|
95
95
|
const hostedShare = withMPCNetworkHost(ctx, share);
|
|
96
|
-
const preSignMessageRes = ctx.client.preSignMessage(
|
|
96
|
+
const preSignMessageRes = approvalCaseId ? ctx.client.preSignMessage(
|
|
97
|
+
userId,
|
|
98
|
+
walletId,
|
|
99
|
+
base64Bytes,
|
|
100
|
+
"ED25519",
|
|
101
|
+
void 0,
|
|
102
|
+
protocolId,
|
|
103
|
+
void 0,
|
|
104
|
+
canonicalTransaction,
|
|
105
|
+
approvalCaseId
|
|
106
|
+
) : ctx.client.preSignMessage(
|
|
97
107
|
userId,
|
|
98
108
|
walletId,
|
|
99
109
|
base64Bytes,
|
|
@@ -122,9 +132,9 @@ async function ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalT
|
|
|
122
132
|
})();
|
|
123
133
|
signRes.catch(() => {
|
|
124
134
|
});
|
|
125
|
-
const { pendingTransactionId } = await preSignMessageRes;
|
|
135
|
+
const { pendingTransactionId, approvalCaseId: pendingApprovalCaseId } = await preSignMessageRes;
|
|
126
136
|
if (pendingTransactionId) {
|
|
127
|
-
return { pendingTransactionId };
|
|
137
|
+
return { pendingTransactionId, ...pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {} };
|
|
128
138
|
}
|
|
129
139
|
return await signRes;
|
|
130
140
|
}
|
|
@@ -209,9 +219,9 @@ async function preKeygen(ctx, partnerId, pregenIdentifier, pregenIdentifierType,
|
|
|
209
219
|
throw wrapMpcError(`error creating account of type ${type} with walletId ${walletId}`, mpcErr, { walletId, protocolId });
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
|
-
async function signMessage(ctx, share, walletId, userId, message, canonicalTransaction) {
|
|
222
|
+
async function signMessage(ctx, share, walletId, userId, message, canonicalTransaction, approvalCaseId) {
|
|
213
223
|
const protocolId = uuid.v4();
|
|
214
|
-
const preSignMessageRes = ctx.client.preSignMessage(
|
|
224
|
+
const preSignMessageRes = approvalCaseId ? ctx.client.preSignMessage(
|
|
215
225
|
userId,
|
|
216
226
|
walletId,
|
|
217
227
|
message,
|
|
@@ -219,8 +229,9 @@ async function signMessage(ctx, share, walletId, userId, message, canonicalTrans
|
|
|
219
229
|
null,
|
|
220
230
|
protocolId,
|
|
221
231
|
true,
|
|
222
|
-
canonicalTransaction
|
|
223
|
-
|
|
232
|
+
canonicalTransaction,
|
|
233
|
+
approvalCaseId
|
|
234
|
+
) : ctx.client.preSignMessage(userId, walletId, message, null, null, protocolId, true, canonicalTransaction);
|
|
224
235
|
if (ctx.offloadMPCComputationURL && !ctx.useDKLS) {
|
|
225
236
|
return signMessageRequest(ctx, userId, walletId, protocolId, message, share);
|
|
226
237
|
}
|
|
@@ -242,9 +253,9 @@ async function signMessage(ctx, share, walletId, userId, message, canonicalTrans
|
|
|
242
253
|
})();
|
|
243
254
|
signMessageRes.catch(() => {
|
|
244
255
|
});
|
|
245
|
-
const { pendingTransactionId } = await preSignMessageRes;
|
|
256
|
+
const { pendingTransactionId, approvalCaseId: pendingApprovalCaseId } = await preSignMessageRes;
|
|
246
257
|
if (pendingTransactionId) {
|
|
247
|
-
return { pendingTransactionId };
|
|
258
|
+
return { pendingTransactionId, ...pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {} };
|
|
248
259
|
}
|
|
249
260
|
return await signMessageRes;
|
|
250
261
|
}
|
|
@@ -280,10 +291,10 @@ async function signTransaction(ctx, share, walletId, userId, tx, chainId) {
|
|
|
280
291
|
signTxRes.catch(() => {
|
|
281
292
|
});
|
|
282
293
|
const {
|
|
283
|
-
data: { pendingTransactionId }
|
|
294
|
+
data: { pendingTransactionId, approvalCaseId: pendingApprovalCaseId }
|
|
284
295
|
} = await signTransactionRes;
|
|
285
296
|
if (pendingTransactionId) {
|
|
286
|
-
return { pendingTransactionId };
|
|
297
|
+
return { pendingTransactionId, ...pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {} };
|
|
287
298
|
}
|
|
288
299
|
return await signTxRes;
|
|
289
300
|
}
|
|
@@ -321,10 +332,10 @@ async function sendTransaction(ctx, share, walletId, userId, tx, chainId) {
|
|
|
321
332
|
sendTxRes.catch(() => {
|
|
322
333
|
});
|
|
323
334
|
const {
|
|
324
|
-
data: { pendingTransactionId }
|
|
335
|
+
data: { pendingTransactionId, approvalCaseId: pendingApprovalCaseId }
|
|
325
336
|
} = await sendTransactionRes;
|
|
326
337
|
if (pendingTransactionId) {
|
|
327
|
-
return { pendingTransactionId };
|
|
338
|
+
return { pendingTransactionId, ...pendingApprovalCaseId ? { approvalCaseId: pendingApprovalCaseId } : {} };
|
|
328
339
|
}
|
|
329
340
|
return await sendTxRes;
|
|
330
341
|
}
|
|
@@ -111,8 +111,10 @@ 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, canonicalTransaction } = params;
|
|
115
|
-
return withRetry(
|
|
114
|
+
const { share, walletId, userId, message: message2, canonicalTransaction, approvalCaseId } = params;
|
|
115
|
+
return withRetry(
|
|
116
|
+
() => walletUtils.signMessage(ctx, share, walletId, userId, message2, canonicalTransaction, approvalCaseId)
|
|
117
|
+
);
|
|
116
118
|
}
|
|
117
119
|
case "REFRESH": {
|
|
118
120
|
const { share, walletId, userId } = params;
|
|
@@ -144,8 +146,8 @@ function executeMessage(ctx, message) {
|
|
|
144
146
|
return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
|
|
145
147
|
}
|
|
146
148
|
case "ED25519_SIGN": {
|
|
147
|
-
const { share, walletId, userId, base64Bytes, canonicalTransaction } = params;
|
|
148
|
-
return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction);
|
|
149
|
+
const { share, walletId, userId, base64Bytes, canonicalTransaction, approvalCaseId } = params;
|
|
150
|
+
return walletUtils.ed25519Sign(ctx, share, userId, walletId, base64Bytes, canonicalTransaction, approvalCaseId);
|
|
149
151
|
}
|
|
150
152
|
case "ED25519_PREKEYGEN": {
|
|
151
153
|
const { email } = params;
|
|
@@ -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, _cosmosSignDoc?: string, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
|
|
27
|
+
signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie: string, isDKLS?: boolean, _cosmosSignDoc?: string, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): 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, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
|
|
43
|
+
ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie: string, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): Promise<SignatureRes>;
|
|
44
44
|
localStorage: ServerLocalStorage;
|
|
45
45
|
sessionStorage: ServerSessionStorage;
|
|
46
46
|
secureStorage: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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, 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>;
|
|
4
|
+
export declare function signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie?: string, isDKLS?: boolean, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): Promise<SignatureRes>;
|
|
5
|
+
export declare function ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie?: string, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): Promise<SignatureRes>;
|
|
@@ -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, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
|
|
10
|
+
export declare function ed25519Sign(ctx: Ctx, share: string, userId: string, walletId: string, base64Bytes: string, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): 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, canonicalTransaction?: CanonicalTransactionContext): Promise<SignatureRes>;
|
|
19
|
+
export declare function signMessage(ctx: Ctx, share: string, walletId: string, userId: string, message: string, canonicalTransaction?: CanonicalTransactionContext, approvalCaseId?: string): 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.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/core-sdk": "3.
|
|
6
|
-
"@getpara/user-management-client": "3.
|
|
7
|
-
"@getpara/viem-v2-integration": "3.
|
|
5
|
+
"@getpara/core-sdk": "3.20.0",
|
|
6
|
+
"@getpara/user-management-client": "3.20.0",
|
|
7
|
+
"@getpara/viem-v2-integration": "3.20.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": "
|
|
19
|
+
"gitHead": "0a7224c678bc2b172bd41cce75637a8783869a93",
|
|
20
20
|
"main": "dist/cjs/index.js",
|
|
21
21
|
"module": "dist/esm/index.js",
|
|
22
22
|
"scripts": {
|