@getpara/server-sdk 1.16.0 → 1.18.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.
@@ -144,20 +144,34 @@ function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
144
144
  }
145
145
  function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
146
146
  return __async(this, null, function* () {
147
- const { protocolId } = yield ctx.client.preSignMessage(userId, walletId, base64Bytes, import_core_sdk.WalletScheme.ED25519);
148
- try {
149
- const base64Sig = yield new Promise(
150
- (resolve, reject) => global.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
151
- if (err) {
152
- reject(err);
153
- }
154
- resolve(result);
155
- })
156
- );
157
- return { signature: base64Sig };
158
- } catch (e) {
159
- throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
160
- }
147
+ const protocolId = uuid.v4();
148
+ const preSignMessageRes = ctx.client.preSignMessage(
149
+ userId,
150
+ walletId,
151
+ base64Bytes,
152
+ import_core_sdk.WalletScheme.ED25519,
153
+ void 0,
154
+ protocolId
155
+ );
156
+ const signRes = function() {
157
+ return __async(this, null, function* () {
158
+ try {
159
+ const base64Sig = yield new Promise(
160
+ (resolve, reject) => global.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
161
+ if (err) {
162
+ reject(err);
163
+ }
164
+ resolve(result);
165
+ })
166
+ );
167
+ return { signature: base64Sig };
168
+ } catch (e) {
169
+ throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
170
+ }
171
+ });
172
+ }();
173
+ yield preSignMessageRes;
174
+ return yield signRes;
161
175
  });
162
176
  }
163
177
  function keygen(ctx, userId, type, secretKey) {
@@ -146,7 +146,7 @@ function executeMessage(ctx, message) {
146
146
  }
147
147
  });
148
148
  }
149
- function withRetry(operation, maxRetries = 2, timeoutMs = 8e3) {
149
+ function withRetry(operation, maxRetries = 2, timeoutMs = 1e4) {
150
150
  return __async(this, null, function* () {
151
151
  let retries = 0;
152
152
  while (true) {
@@ -73,20 +73,32 @@ async function ed25519PreKeygen(ctx, pregenIdentifier, pregenIdentifierType) {
73
73
  }
74
74
  }
75
75
  async function ed25519Sign(ctx, share, userId, walletId, base64Bytes) {
76
- const { protocolId } = await ctx.client.preSignMessage(userId, walletId, base64Bytes, WalletScheme.ED25519);
77
- try {
78
- const base64Sig = await new Promise(
79
- (resolve, reject) => global.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
80
- if (err) {
81
- reject(err);
82
- }
83
- resolve(result);
84
- })
85
- );
86
- return { signature: base64Sig };
87
- } catch (e) {
88
- throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
89
- }
76
+ const protocolId = uuid.v4();
77
+ const preSignMessageRes = ctx.client.preSignMessage(
78
+ userId,
79
+ walletId,
80
+ base64Bytes,
81
+ WalletScheme.ED25519,
82
+ void 0,
83
+ protocolId
84
+ );
85
+ const signRes = async function() {
86
+ try {
87
+ const base64Sig = await new Promise(
88
+ (resolve, reject) => global.ed25519Sign(share, protocolId, base64Bytes, (err, result) => {
89
+ if (err) {
90
+ reject(err);
91
+ }
92
+ resolve(result);
93
+ })
94
+ );
95
+ return { signature: base64Sig };
96
+ } catch (e) {
97
+ throw new Error(`error signing for account of type SOLANA with userId ${userId} and walletId ${walletId}`);
98
+ }
99
+ }();
100
+ await preSignMessageRes;
101
+ return await signRes;
90
102
  }
91
103
  async function keygen(ctx, userId, type, secretKey) {
92
104
  const { walletId, protocolId } = await ctx.client.createWallet(userId, {
@@ -118,7 +118,7 @@ function executeMessage(ctx, message) {
118
118
  }
119
119
  });
120
120
  }
121
- function withRetry(operation, maxRetries = 2, timeoutMs = 8e3) {
121
+ function withRetry(operation, maxRetries = 2, timeoutMs = 1e4) {
122
122
  return __async(this, null, function* () {
123
123
  let retries = 0;
124
124
  while (true) {
@@ -17,7 +17,7 @@ export declare function requestWasmWithRetries(ctx: Ctx, retries?: number): Prom
17
17
  * Executes an operation with retry capabilities
18
18
  * @param operation The function to execute
19
19
  * @param maxRetries Maximum number of retries (default: 2)
20
- * @param timeoutMs Timeout in milliseconds (default: 8000)
20
+ * @param timeoutMs Timeout in milliseconds (default: 10000)
21
21
  * @returns The result of the operation
22
22
  */
23
23
  export declare function withRetry<T>(operation: () => Promise<T>, maxRetries?: number, timeoutMs?: number): Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpara/server-sdk",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -9,8 +9,8 @@
9
9
  "wasm_exec.js"
10
10
  ],
11
11
  "dependencies": {
12
- "@getpara/core-sdk": "1.16.0",
13
- "@getpara/user-management-client": "1.16.0",
12
+ "@getpara/core-sdk": "1.18.0",
13
+ "@getpara/user-management-client": "1.18.0",
14
14
  "uuid": "^11.1.0",
15
15
  "ws": "^8.14.2"
16
16
  },
@@ -30,5 +30,5 @@
30
30
  "dist",
31
31
  "package.json"
32
32
  ],
33
- "gitHead": "27004dc519903d24ffafa0d8da16976dae9278a2"
33
+ "gitHead": "5928feb89e9fe821893477e4f892f6efa2ebffe2"
34
34
  }