@getpara/server-sdk 2.19.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.
- package/dist/cjs/ServerUtils.js +4 -4
- package/dist/cjs/wallet/keygen.js +4 -4
- package/dist/cjs/workers/walletUtils.js +6 -6
- package/dist/cjs/workers/worker.js +3 -3
- package/dist/esm/ServerUtils.js +4 -4
- package/dist/esm/wallet/keygen.js +4 -4
- package/dist/esm/workers/walletUtils.js +6 -6
- package/dist/esm/workers/worker.js +3 -3
- package/dist/types/ServerUtils.d.ts +2 -2
- package/dist/types/wallet/keygen.d.ts +2 -2
- package/dist/types/workers/walletUtils.d.ts +2 -2
- package/package.json +5 -5
package/dist/cjs/ServerUtils.js
CHANGED
|
@@ -78,11 +78,11 @@ class ServerUtils {
|
|
|
78
78
|
signHash(_address, _hash) {
|
|
79
79
|
throw new Error("SignHash is not implemented in the ServerUtils class.");
|
|
80
80
|
}
|
|
81
|
-
ed25519Keygen(ctx, userId, sessionCookie, emailProps) {
|
|
82
|
-
return (0, import_keygen.ed25519Keygen)(ctx, userId, sessionCookie, emailProps);
|
|
81
|
+
ed25519Keygen(ctx, userId, sessionCookie, emailProps, type) {
|
|
82
|
+
return (0, import_keygen.ed25519Keygen)(ctx, userId, sessionCookie, emailProps, type);
|
|
83
83
|
}
|
|
84
|
-
ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
85
|
-
return (0, import_keygen.ed25519PreKeygen)(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie);
|
|
84
|
+
ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
|
|
85
|
+
return (0, import_keygen.ed25519PreKeygen)(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type);
|
|
86
86
|
}
|
|
87
87
|
ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
|
|
88
88
|
return (0, import_signing.ed25519Sign)(ctx, userId, walletId, share, base64Bytes, sessionCookie);
|
|
@@ -200,7 +200,7 @@ function preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey,
|
|
|
200
200
|
}
|
|
201
201
|
}));
|
|
202
202
|
}
|
|
203
|
-
function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
203
|
+
function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}, type) {
|
|
204
204
|
return new Promise((resolve, reject) => __async(this, null, function* () {
|
|
205
205
|
const workId = uuid.v4();
|
|
206
206
|
try {
|
|
@@ -235,7 +235,7 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
|
235
235
|
env: ctx.env,
|
|
236
236
|
apiKey: ctx.apiKey,
|
|
237
237
|
cosmosPrefix: ctx.cosmosPrefix,
|
|
238
|
-
params: { userId },
|
|
238
|
+
params: { userId, type },
|
|
239
239
|
functionType: "ED25519_KEYGEN",
|
|
240
240
|
disableWorkers: ctx.disableWorkers,
|
|
241
241
|
sessionCookie,
|
|
@@ -248,12 +248,12 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
|
248
248
|
}
|
|
249
249
|
}));
|
|
250
250
|
}
|
|
251
|
-
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
251
|
+
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
|
|
252
252
|
return new Promise((resolve, reject) => __async(this, null, function* () {
|
|
253
253
|
const workId = uuid.v4();
|
|
254
254
|
try {
|
|
255
255
|
const email = void 0;
|
|
256
|
-
const params = { pregenIdentifier, pregenIdentifierType, email };
|
|
256
|
+
const params = { pregenIdentifier, pregenIdentifierType, email, type };
|
|
257
257
|
if (pregenIdentifierType === "EMAIL") {
|
|
258
258
|
params.email = pregenIdentifier;
|
|
259
259
|
}
|
|
@@ -96,11 +96,11 @@ function sendTransactionRequest(ctx, userId, walletId, protocolId, transaction,
|
|
|
96
96
|
return data;
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
function ed25519Keygen(ctx, userId) {
|
|
99
|
+
function ed25519Keygen(ctx, userId, _sessionCookie, _emailProps, type = "SOLANA") {
|
|
100
100
|
return __async(this, null, function* () {
|
|
101
101
|
const { walletId, protocolId } = yield ctx.client.createWallet(userId, {
|
|
102
102
|
scheme: "ED25519",
|
|
103
|
-
type
|
|
103
|
+
type
|
|
104
104
|
});
|
|
105
105
|
const serverUrl = (0, import_core_sdk.getBaseMPCNetworkUrl)(ctx.env, !ctx.disableWebSockets);
|
|
106
106
|
try {
|
|
@@ -114,17 +114,17 @@ function ed25519Keygen(ctx, userId) {
|
|
|
114
114
|
);
|
|
115
115
|
return { signer: newSigner, walletId };
|
|
116
116
|
} catch (e) {
|
|
117
|
-
throw new Error(`error creating account
|
|
117
|
+
throw new Error(`error creating ED25519 account with userId ${userId} and walletId ${walletId}`);
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
-
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
|
|
121
|
+
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, _sessionCookie, type = "SOLANA") {
|
|
122
122
|
return __async(this, null, function* () {
|
|
123
123
|
const { walletId, protocolId } = yield ctx.client.createPregenWallet({
|
|
124
124
|
pregenIdentifier,
|
|
125
125
|
pregenIdentifierType,
|
|
126
126
|
scheme: "ED25519",
|
|
127
|
-
type
|
|
127
|
+
type
|
|
128
128
|
});
|
|
129
129
|
const serverUrl = (0, import_core_sdk.getBaseMPCNetworkUrl)(ctx.env, !ctx.disableWebSockets);
|
|
130
130
|
try {
|
|
@@ -138,7 +138,7 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
|
|
|
138
138
|
);
|
|
139
139
|
return { signer: newSigner, walletId };
|
|
140
140
|
} catch (e) {
|
|
141
|
-
throw new Error(`error creating account
|
|
141
|
+
throw new Error(`error creating ED25519 account with walletId ${walletId}`);
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
}
|
|
@@ -127,8 +127,8 @@ function executeMessage(ctx, message) {
|
|
|
127
127
|
return { privateKey };
|
|
128
128
|
}
|
|
129
129
|
case "ED25519_KEYGEN": {
|
|
130
|
-
const { userId } = params;
|
|
131
|
-
return walletUtils.ed25519Keygen(ctx, userId);
|
|
130
|
+
const { userId, type } = params;
|
|
131
|
+
return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
|
|
132
132
|
}
|
|
133
133
|
case "ED25519_SIGN": {
|
|
134
134
|
const { share, walletId, userId, base64Bytes } = params;
|
|
@@ -141,7 +141,7 @@ function executeMessage(ctx, message) {
|
|
|
141
141
|
pregenIdentifier = email;
|
|
142
142
|
pregenIdentifierType = "EMAIL";
|
|
143
143
|
}
|
|
144
|
-
return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType);
|
|
144
|
+
return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, void 0, params.type);
|
|
145
145
|
}
|
|
146
146
|
default: {
|
|
147
147
|
throw new Error(`functionType: ${functionType} not supported`);
|
package/dist/esm/ServerUtils.js
CHANGED
|
@@ -37,11 +37,11 @@ class ServerUtils {
|
|
|
37
37
|
signHash(_address, _hash) {
|
|
38
38
|
throw new Error("SignHash is not implemented in the ServerUtils class.");
|
|
39
39
|
}
|
|
40
|
-
ed25519Keygen(ctx, userId, sessionCookie, emailProps) {
|
|
41
|
-
return ed25519Keygen(ctx, userId, sessionCookie, emailProps);
|
|
40
|
+
ed25519Keygen(ctx, userId, sessionCookie, emailProps, type) {
|
|
41
|
+
return ed25519Keygen(ctx, userId, sessionCookie, emailProps, type);
|
|
42
42
|
}
|
|
43
|
-
ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
44
|
-
return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie);
|
|
43
|
+
ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
|
|
44
|
+
return ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type);
|
|
45
45
|
}
|
|
46
46
|
ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie) {
|
|
47
47
|
return ed25519Sign(ctx, userId, walletId, share, base64Bytes, sessionCookie);
|
|
@@ -119,7 +119,7 @@ function preKeygen(ctx, pregenIdentifier, pregenIdentifierType, type, secretKey,
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
122
|
+
function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}, type) {
|
|
123
123
|
return new Promise(async (resolve, reject) => {
|
|
124
124
|
const workId = uuid.v4();
|
|
125
125
|
try {
|
|
@@ -152,7 +152,7 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
|
152
152
|
env: ctx.env,
|
|
153
153
|
apiKey: ctx.apiKey,
|
|
154
154
|
cosmosPrefix: ctx.cosmosPrefix,
|
|
155
|
-
params: { userId },
|
|
155
|
+
params: { userId, type },
|
|
156
156
|
functionType: "ED25519_KEYGEN",
|
|
157
157
|
disableWorkers: ctx.disableWorkers,
|
|
158
158
|
sessionCookie,
|
|
@@ -165,12 +165,12 @@ function ed25519Keygen(ctx, userId, sessionCookie, _emailProps = {}) {
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie) {
|
|
168
|
+
function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, sessionCookie, type) {
|
|
169
169
|
return new Promise(async (resolve, reject) => {
|
|
170
170
|
const workId = uuid.v4();
|
|
171
171
|
try {
|
|
172
172
|
const email = void 0;
|
|
173
|
-
const params = { pregenIdentifier, pregenIdentifierType, email };
|
|
173
|
+
const params = { pregenIdentifier, pregenIdentifierType, email, type };
|
|
174
174
|
if (pregenIdentifierType === "EMAIL") {
|
|
175
175
|
params.email = pregenIdentifier;
|
|
176
176
|
}
|
|
@@ -30,10 +30,10 @@ async function sendTransactionRequest(ctx, userId, walletId, protocolId, transac
|
|
|
30
30
|
});
|
|
31
31
|
return data;
|
|
32
32
|
}
|
|
33
|
-
async function ed25519Keygen(ctx, userId) {
|
|
33
|
+
async function ed25519Keygen(ctx, userId, _sessionCookie, _emailProps, type = "SOLANA") {
|
|
34
34
|
const { walletId, protocolId } = await ctx.client.createWallet(userId, {
|
|
35
35
|
scheme: "ED25519",
|
|
36
|
-
type
|
|
36
|
+
type
|
|
37
37
|
});
|
|
38
38
|
const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
|
|
39
39
|
try {
|
|
@@ -47,15 +47,15 @@ async function ed25519Keygen(ctx, userId) {
|
|
|
47
47
|
);
|
|
48
48
|
return { signer: newSigner, walletId };
|
|
49
49
|
} catch {
|
|
50
|
-
throw new Error(`error creating account
|
|
50
|
+
throw new Error(`error creating ED25519 account with userId ${userId} and walletId ${walletId}`);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
async function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
|
|
53
|
+
async function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, _sessionCookie, type = "SOLANA") {
|
|
54
54
|
const { walletId, protocolId } = await ctx.client.createPregenWallet({
|
|
55
55
|
pregenIdentifier,
|
|
56
56
|
pregenIdentifierType,
|
|
57
57
|
scheme: "ED25519",
|
|
58
|
-
type
|
|
58
|
+
type
|
|
59
59
|
});
|
|
60
60
|
const serverUrl = getBaseMPCNetworkUrl(ctx.env, !ctx.disableWebSockets);
|
|
61
61
|
try {
|
|
@@ -69,7 +69,7 @@ async function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
|
|
|
69
69
|
);
|
|
70
70
|
return { signer: newSigner, walletId };
|
|
71
71
|
} catch {
|
|
72
|
-
throw new Error(`error creating account
|
|
72
|
+
throw new Error(`error creating ED25519 account with walletId ${walletId}`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
async function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
|
|
@@ -99,8 +99,8 @@ function executeMessage(ctx, message) {
|
|
|
99
99
|
return { privateKey };
|
|
100
100
|
}
|
|
101
101
|
case "ED25519_KEYGEN": {
|
|
102
|
-
const { userId } = params;
|
|
103
|
-
return walletUtils.ed25519Keygen(ctx, userId);
|
|
102
|
+
const { userId, type } = params;
|
|
103
|
+
return walletUtils.ed25519Keygen(ctx, userId, void 0, void 0, type);
|
|
104
104
|
}
|
|
105
105
|
case "ED25519_SIGN": {
|
|
106
106
|
const { share, walletId, userId, base64Bytes } = params;
|
|
@@ -113,7 +113,7 @@ function executeMessage(ctx, message) {
|
|
|
113
113
|
pregenIdentifier = email;
|
|
114
114
|
pregenIdentifierType = "EMAIL";
|
|
115
115
|
}
|
|
116
|
-
return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType);
|
|
116
|
+
return walletUtils.ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType, void 0, params.type);
|
|
117
117
|
}
|
|
118
118
|
default: {
|
|
119
119
|
throw new Error(`functionType: ${functionType} not supported`);
|
|
@@ -25,11 +25,11 @@ export declare class ServerUtils implements PlatformUtils {
|
|
|
25
25
|
r: Buffer;
|
|
26
26
|
s: Buffer;
|
|
27
27
|
}>;
|
|
28
|
-
ed25519Keygen(ctx: Ctx, userId: string, sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
28
|
+
ed25519Keygen(ctx: Ctx, userId: string, sessionCookie: string, emailProps?: BackupKitEmailProps, type?: TWalletType): Promise<{
|
|
29
29
|
signer: string;
|
|
30
30
|
walletId: string;
|
|
31
31
|
}>;
|
|
32
|
-
ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie: string): Promise<{
|
|
32
|
+
ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie: string, type?: TWalletType): Promise<{
|
|
33
33
|
signer: string;
|
|
34
34
|
walletId: string;
|
|
35
35
|
}>;
|
|
@@ -12,12 +12,12 @@ export declare function preKeygen(ctx: Ctx, pregenIdentifier: string, pregenIden
|
|
|
12
12
|
walletId: string;
|
|
13
13
|
recoveryShare: string | null;
|
|
14
14
|
}>;
|
|
15
|
-
export declare function ed25519Keygen(ctx: Ctx, userId: string, sessionCookie?: string, _emailProps?: BackupKitEmailProps): Promise<{
|
|
15
|
+
export declare function ed25519Keygen(ctx: Ctx, userId: string, sessionCookie?: string, _emailProps?: BackupKitEmailProps, type?: TWalletType): Promise<{
|
|
16
16
|
signer: string;
|
|
17
17
|
walletId: string;
|
|
18
18
|
recoveryShare: string | null;
|
|
19
19
|
}>;
|
|
20
|
-
export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie?: string): Promise<{
|
|
20
|
+
export declare function ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie?: string, type?: TWalletType): Promise<{
|
|
21
21
|
signer: string;
|
|
22
22
|
walletId: string;
|
|
23
23
|
recoveryShare: string | null;
|
|
@@ -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
|
}>;
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/server-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@getpara/core-sdk": "2.
|
|
6
|
-
"@getpara/user-management-client": "2.
|
|
7
|
-
"@getpara/viem-v2-integration": "2.
|
|
5
|
+
"@getpara/core-sdk": "2.20.0",
|
|
6
|
+
"@getpara/user-management-client": "2.20.0",
|
|
7
|
+
"@getpara/viem-v2-integration": "2.20.0",
|
|
8
8
|
"uuid": "^11.1.0",
|
|
9
9
|
"ws": "^8.14.2"
|
|
10
10
|
},
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dist",
|
|
17
17
|
"package.json"
|
|
18
18
|
],
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "a8443bcc4018864f5e582f238ade1bb3b4e121f4",
|
|
20
20
|
"main": "dist/cjs/index.js",
|
|
21
21
|
"module": "dist/esm/index.js",
|
|
22
22
|
"scripts": {
|