@portal-hq/provider 4.1.6 → 4.1.7
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.
|
@@ -38,7 +38,7 @@ class Provider {
|
|
|
38
38
|
return this.keychain.getAddresses();
|
|
39
39
|
}
|
|
40
40
|
get address() {
|
|
41
|
-
return this.keychain.
|
|
41
|
+
return this.keychain.getAddresses().then((addrs) => addrs === null || addrs === void 0 ? void 0 : addrs.eip155);
|
|
42
42
|
}
|
|
43
43
|
constructor({
|
|
44
44
|
// Required
|
|
@@ -284,6 +284,19 @@ class EnclaveSigner {
|
|
|
284
284
|
* Checks for error format and extracts data
|
|
285
285
|
*/
|
|
286
286
|
processEnclaveResponse(response) {
|
|
287
|
+
// Handle case where API returns signature directly as a string
|
|
288
|
+
// This can happen if JSON parsing fails in HttpRequest.buildResponse()
|
|
289
|
+
if (typeof response === 'string') {
|
|
290
|
+
return response;
|
|
291
|
+
}
|
|
292
|
+
// Ensure response is an object before using 'in' operator
|
|
293
|
+
if (!response || typeof response !== 'object') {
|
|
294
|
+
throw new utils_1.PortalMpcError({
|
|
295
|
+
code: utils_1.PortalErrorCodes.BadRequest,
|
|
296
|
+
id: 'InvalidResponse',
|
|
297
|
+
message: `Invalid API response format: expected object, got ${typeof response}`,
|
|
298
|
+
});
|
|
299
|
+
}
|
|
287
300
|
// Check for API-level errors first
|
|
288
301
|
// API returns errors at top level: {id, message, code}
|
|
289
302
|
if ('id' in response && 'message' in response && 'code' in response) {
|
|
@@ -36,7 +36,7 @@ class Provider {
|
|
|
36
36
|
return this.keychain.getAddresses();
|
|
37
37
|
}
|
|
38
38
|
get address() {
|
|
39
|
-
return this.keychain.
|
|
39
|
+
return this.keychain.getAddresses().then((addrs) => addrs === null || addrs === void 0 ? void 0 : addrs.eip155);
|
|
40
40
|
}
|
|
41
41
|
constructor({
|
|
42
42
|
// Required
|
|
@@ -279,6 +279,19 @@ class EnclaveSigner {
|
|
|
279
279
|
* Checks for error format and extracts data
|
|
280
280
|
*/
|
|
281
281
|
processEnclaveResponse(response) {
|
|
282
|
+
// Handle case where API returns signature directly as a string
|
|
283
|
+
// This can happen if JSON parsing fails in HttpRequest.buildResponse()
|
|
284
|
+
if (typeof response === 'string') {
|
|
285
|
+
return response;
|
|
286
|
+
}
|
|
287
|
+
// Ensure response is an object before using 'in' operator
|
|
288
|
+
if (!response || typeof response !== 'object') {
|
|
289
|
+
throw new PortalMpcError({
|
|
290
|
+
code: PortalErrorCodes.BadRequest,
|
|
291
|
+
id: 'InvalidResponse',
|
|
292
|
+
message: `Invalid API response format: expected object, got ${typeof response}`,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
282
295
|
// Check for API-level errors first
|
|
283
296
|
// API returns errors at top level: {id, message, code}
|
|
284
297
|
if ('id' in response && 'message' in response && 'code' in response) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/provider",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/esm/index",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test": "jest"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@portal-hq/connect": "^4.1.
|
|
23
|
-
"@portal-hq/utils": "^4.1.
|
|
22
|
+
"@portal-hq/connect": "^4.1.7",
|
|
23
|
+
"@portal-hq/utils": "^4.1.7",
|
|
24
24
|
"@types/react-native-uuid": "^2.0.0",
|
|
25
25
|
"react-native-uuid": "^2.0.3"
|
|
26
26
|
},
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"ts-jest": "^29.0.3",
|
|
33
33
|
"typescript": "^4.8.4"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "d8be728d9b04f0c3e2577fd98b1e38282cc950ba"
|
|
36
36
|
}
|
package/src/providers/index.ts
CHANGED
package/src/signers/enclave.ts
CHANGED
|
@@ -324,6 +324,21 @@ class EnclaveSigner implements Signer {
|
|
|
324
324
|
* Checks for error format and extracts data
|
|
325
325
|
*/
|
|
326
326
|
private processEnclaveResponse(response: EnclaveSignResponse): string {
|
|
327
|
+
// Handle case where API returns signature directly as a string
|
|
328
|
+
// This can happen if JSON parsing fails in HttpRequest.buildResponse()
|
|
329
|
+
if (typeof response === 'string') {
|
|
330
|
+
return response
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Ensure response is an object before using 'in' operator
|
|
334
|
+
if (!response || typeof response !== 'object') {
|
|
335
|
+
throw new PortalMpcError({
|
|
336
|
+
code: PortalErrorCodes.BadRequest,
|
|
337
|
+
id: 'InvalidResponse',
|
|
338
|
+
message: `Invalid API response format: expected object, got ${typeof response}`,
|
|
339
|
+
})
|
|
340
|
+
}
|
|
341
|
+
|
|
327
342
|
// Check for API-level errors first
|
|
328
343
|
// API returns errors at top level: {id, message, code}
|
|
329
344
|
if ('id' in response && 'message' in response && 'code' in response) {
|