@portal-hq/utils 3.0.6 → 4.0.1
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/lib/commonjs/PortalRequests/index.js +87 -0
- package/lib/commonjs/definitions/index.js +24 -4
- package/lib/commonjs/http-request/index.js +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/requesters/http.js +15 -0
- package/lib/esm/PortalRequests/index.js +85 -0
- package/lib/esm/definitions/index.js +24 -4
- package/lib/esm/http-request/index.js +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/requesters/http.js +15 -0
- package/package.json +2 -2
- package/src/PortalRequests/index.ts +125 -0
- package/src/definitions/index.ts +75 -26
- package/src/http-request/index.ts +1 -1
- package/src/index.ts +2 -0
- package/src/requesters/http.ts +20 -0
- package/types.d.ts +130 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const index_1 = require("../index");
|
|
13
|
+
class PortalRequests {
|
|
14
|
+
buildHeaders(headers = {}) {
|
|
15
|
+
return Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
16
|
+
}
|
|
17
|
+
delete(baseUrl, path, options) {
|
|
18
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const requestOptions = {
|
|
20
|
+
method: 'DELETE',
|
|
21
|
+
url: `${baseUrl}${path}`,
|
|
22
|
+
};
|
|
23
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
24
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
25
|
+
const response = (yield request.send());
|
|
26
|
+
return response;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
get(baseUrl, path, options) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const requestOptions = {
|
|
32
|
+
method: 'GET',
|
|
33
|
+
url: `${baseUrl}${path}`,
|
|
34
|
+
};
|
|
35
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
36
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
37
|
+
const response = (yield request.send());
|
|
38
|
+
return response;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
post(baseUrl, path, options) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const requestOptions = {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
url: `${baseUrl}${path}`,
|
|
46
|
+
};
|
|
47
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
48
|
+
if (options && options.body) {
|
|
49
|
+
requestOptions.body = options.body;
|
|
50
|
+
}
|
|
51
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
52
|
+
const response = (yield request.send());
|
|
53
|
+
return response;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
put(baseUrl, path, options) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const requestOptions = {
|
|
59
|
+
method: 'PUT',
|
|
60
|
+
url: `${baseUrl}${path}`,
|
|
61
|
+
};
|
|
62
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
63
|
+
if (options && options.body) {
|
|
64
|
+
requestOptions.body = options.body;
|
|
65
|
+
}
|
|
66
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
67
|
+
const response = (yield request.send());
|
|
68
|
+
return response;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
patch(baseUrl, path, options) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
method: 'PATCH',
|
|
75
|
+
url: `${baseUrl}${path}`,
|
|
76
|
+
};
|
|
77
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
78
|
+
if (options && options.body) {
|
|
79
|
+
requestOptions.body = options.body;
|
|
80
|
+
}
|
|
81
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
82
|
+
const response = (yield request.send());
|
|
83
|
+
return response;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.default = PortalRequests;
|
|
@@ -2,27 +2,47 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PasswordStorage = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = void 0;
|
|
4
4
|
class KeychainAdapter {
|
|
5
|
+
loadMetadata() {
|
|
6
|
+
throw new Error('[Portal] KeychainAdapter method loadMetadata cannot be called directly. Please extend KeychainAdapter.');
|
|
7
|
+
}
|
|
5
8
|
deleteAddress() {
|
|
6
9
|
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
7
10
|
}
|
|
11
|
+
deleteShares() {
|
|
12
|
+
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
13
|
+
}
|
|
8
14
|
deleteDkgResult() {
|
|
9
15
|
throw new Error('[Portal] KeychainAdapter method deleteDkgResult cannot be called directly. Please extend KeychainAdapter.');
|
|
10
16
|
}
|
|
11
17
|
getAddress(isSim) {
|
|
12
18
|
throw new Error(`[Portal] KeychainAdapter method getAddress(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
13
19
|
}
|
|
14
|
-
getDkgResult(isSim
|
|
20
|
+
getDkgResult(isSim) {
|
|
21
|
+
throw new Error(`[Portal] KeychainAdapter method getDkgResult(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
22
|
+
}
|
|
23
|
+
getShares(_progress = () => {
|
|
15
24
|
// Noop
|
|
16
25
|
}) {
|
|
17
|
-
throw new Error(
|
|
26
|
+
throw new Error('[Portal] KeychainAdapter method getShares cannot be called directly. Please extend KeychainAdapter.');
|
|
27
|
+
}
|
|
28
|
+
getSigningShare(curve, _progress = () => {
|
|
29
|
+
// Noop
|
|
30
|
+
}) {
|
|
31
|
+
throw new Error(`[Portal] KeychainAdapter method getSigningShare(${curve}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
32
|
+
}
|
|
33
|
+
getAddresses() {
|
|
34
|
+
throw new Error('[Portal] KeychainAdapter method getAddresses cannot be called directly. Please extend KeychainAdapter.');
|
|
35
|
+
}
|
|
36
|
+
getEip155Address() {
|
|
37
|
+
throw new Error('[Portal] KeychainAdapter method getEip155Address cannot be called directly. Please extend KeychainAdapter.');
|
|
18
38
|
}
|
|
19
39
|
storeAddress(address, isSim) {
|
|
20
40
|
throw new Error(`[Portal] KeychainAdapter method storeAddress(${address}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
21
41
|
}
|
|
22
|
-
|
|
42
|
+
storeShares(result, _progress = () => {
|
|
23
43
|
// Noop
|
|
24
44
|
}) {
|
|
25
|
-
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}
|
|
45
|
+
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
26
46
|
}
|
|
27
47
|
validateOperations() {
|
|
28
48
|
throw new Error(`[Portal] KeychainAdapter method validateOperations() cannot be called directly. Please extend KeychainAdapter.`);
|
|
@@ -15,7 +15,7 @@ class HttpRequest {
|
|
|
15
15
|
// Sets headers on the request
|
|
16
16
|
this.prepareRequest();
|
|
17
17
|
// Sends the request with a formatted request body
|
|
18
|
-
if (['POST', 'PUT'].includes(this.method)) {
|
|
18
|
+
if (['POST', 'PUT', 'PATCH'].includes(this.method)) {
|
|
19
19
|
const body = this.prepareBody();
|
|
20
20
|
this.request.send(body);
|
|
21
21
|
}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.HttpRequester = exports.HttpRequest = exports.parseRequest = exports.numberToHexString = exports.Events = exports.RpcErrorCodes = exports.ProviderRpcError = exports.PortalMpcError = exports.PortalErrorCodeTypes = exports.PortalErrorCodes = exports.NoAddressError = exports.MpcSigningError = exports.MissingOptionError = exports.InvalidGatewayConfigError = exports.InvalidChainIdError = exports.InvalidApiKeyError = exports.HttpError = exports.CloudStorageReadError = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = exports.convert = exports.convertCryptoToLocal = exports.convertLocalToCrypto = exports.getChainNameForId = exports.getChainIdForName = exports.chainNameToId = exports.chainIdToName = void 0;
|
|
6
|
+
exports.HttpRequester = exports.PortalRequests = exports.HttpRequest = exports.parseRequest = exports.numberToHexString = exports.Events = exports.RpcErrorCodes = exports.ProviderRpcError = exports.PortalMpcError = exports.PortalErrorCodeTypes = exports.PortalErrorCodes = exports.NoAddressError = exports.MpcSigningError = exports.MissingOptionError = exports.InvalidGatewayConfigError = exports.InvalidChainIdError = exports.InvalidApiKeyError = exports.HttpError = exports.CloudStorageReadError = exports.Storage = exports.MpcStatuses = exports.KeychainAdapter = exports.convert = exports.convertCryptoToLocal = exports.convertLocalToCrypto = exports.getChainNameForId = exports.getChainIdForName = exports.chainNameToId = exports.chainIdToName = void 0;
|
|
7
7
|
var chains_1 = require("./chains");
|
|
8
8
|
Object.defineProperty(exports, "chainIdToName", { enumerable: true, get: function () { return chains_1.chainIdToName; } });
|
|
9
9
|
Object.defineProperty(exports, "chainNameToId", { enumerable: true, get: function () { return chains_1.chainNameToId; } });
|
|
@@ -38,5 +38,7 @@ Object.defineProperty(exports, "numberToHexString", { enumerable: true, get: fun
|
|
|
38
38
|
Object.defineProperty(exports, "parseRequest", { enumerable: true, get: function () { return eth_requests_1.parseRequest; } });
|
|
39
39
|
var http_request_1 = require("./http-request");
|
|
40
40
|
Object.defineProperty(exports, "HttpRequest", { enumerable: true, get: function () { return __importDefault(http_request_1).default; } });
|
|
41
|
+
var PortalRequests_1 = require("./PortalRequests");
|
|
42
|
+
Object.defineProperty(exports, "PortalRequests", { enumerable: true, get: function () { return __importDefault(PortalRequests_1).default; } });
|
|
41
43
|
var requesters_1 = require("./requesters");
|
|
42
44
|
Object.defineProperty(exports, "HttpRequester", { enumerable: true, get: function () { return requesters_1.HttpRequester; } });
|
|
@@ -71,5 +71,20 @@ class HttpRequester {
|
|
|
71
71
|
return response;
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
+
patch(path, options) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const requestOptions = {
|
|
77
|
+
method: 'PATCH',
|
|
78
|
+
url: `${this.baseUrl}${path}`,
|
|
79
|
+
};
|
|
80
|
+
requestOptions.headers = this.buildHeaders((options === null || options === void 0 ? void 0 : options.headers) ? options.headers : {});
|
|
81
|
+
if (options && options.body) {
|
|
82
|
+
requestOptions.body = options.body;
|
|
83
|
+
}
|
|
84
|
+
const request = new index_1.HttpRequest(requestOptions);
|
|
85
|
+
const response = (yield request.send());
|
|
86
|
+
return response;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
74
89
|
}
|
|
75
90
|
exports.default = HttpRequester;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { HttpRequest } from '../index';
|
|
11
|
+
class PortalRequests {
|
|
12
|
+
buildHeaders(headers = {}) {
|
|
13
|
+
return Object.assign({ 'Content-Type': 'application/json' }, headers);
|
|
14
|
+
}
|
|
15
|
+
delete(baseUrl, path, options) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const requestOptions = {
|
|
18
|
+
method: 'DELETE',
|
|
19
|
+
url: `${baseUrl}${path}`,
|
|
20
|
+
};
|
|
21
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
22
|
+
const request = new HttpRequest(requestOptions);
|
|
23
|
+
const response = (yield request.send());
|
|
24
|
+
return response;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
get(baseUrl, path, options) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const requestOptions = {
|
|
30
|
+
method: 'GET',
|
|
31
|
+
url: `${baseUrl}${path}`,
|
|
32
|
+
};
|
|
33
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
34
|
+
const request = new HttpRequest(requestOptions);
|
|
35
|
+
const response = (yield request.send());
|
|
36
|
+
return response;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
post(baseUrl, path, options) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const requestOptions = {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
url: `${baseUrl}${path}`,
|
|
44
|
+
};
|
|
45
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
46
|
+
if (options && options.body) {
|
|
47
|
+
requestOptions.body = options.body;
|
|
48
|
+
}
|
|
49
|
+
const request = new HttpRequest(requestOptions);
|
|
50
|
+
const response = (yield request.send());
|
|
51
|
+
return response;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
put(baseUrl, path, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
method: 'PUT',
|
|
58
|
+
url: `${baseUrl}${path}`,
|
|
59
|
+
};
|
|
60
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
61
|
+
if (options && options.body) {
|
|
62
|
+
requestOptions.body = options.body;
|
|
63
|
+
}
|
|
64
|
+
const request = new HttpRequest(requestOptions);
|
|
65
|
+
const response = (yield request.send());
|
|
66
|
+
return response;
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
patch(baseUrl, path, options) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const requestOptions = {
|
|
72
|
+
method: 'PATCH',
|
|
73
|
+
url: `${baseUrl}${path}`,
|
|
74
|
+
};
|
|
75
|
+
requestOptions.headers = this.buildHeaders(options && options.headers ? options.headers : {});
|
|
76
|
+
if (options && options.body) {
|
|
77
|
+
requestOptions.body = options.body;
|
|
78
|
+
}
|
|
79
|
+
const request = new HttpRequest(requestOptions);
|
|
80
|
+
const response = (yield request.send());
|
|
81
|
+
return response;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export default PortalRequests;
|
|
@@ -1,25 +1,45 @@
|
|
|
1
1
|
export class KeychainAdapter {
|
|
2
|
+
loadMetadata() {
|
|
3
|
+
throw new Error('[Portal] KeychainAdapter method loadMetadata cannot be called directly. Please extend KeychainAdapter.');
|
|
4
|
+
}
|
|
2
5
|
deleteAddress() {
|
|
3
6
|
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
4
7
|
}
|
|
8
|
+
deleteShares() {
|
|
9
|
+
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
10
|
+
}
|
|
5
11
|
deleteDkgResult() {
|
|
6
12
|
throw new Error('[Portal] KeychainAdapter method deleteDkgResult cannot be called directly. Please extend KeychainAdapter.');
|
|
7
13
|
}
|
|
8
14
|
getAddress(isSim) {
|
|
9
15
|
throw new Error(`[Portal] KeychainAdapter method getAddress(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
10
16
|
}
|
|
11
|
-
getDkgResult(isSim
|
|
17
|
+
getDkgResult(isSim) {
|
|
18
|
+
throw new Error(`[Portal] KeychainAdapter method getDkgResult(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
19
|
+
}
|
|
20
|
+
getShares(_progress = () => {
|
|
12
21
|
// Noop
|
|
13
22
|
}) {
|
|
14
|
-
throw new Error(
|
|
23
|
+
throw new Error('[Portal] KeychainAdapter method getShares cannot be called directly. Please extend KeychainAdapter.');
|
|
24
|
+
}
|
|
25
|
+
getSigningShare(curve, _progress = () => {
|
|
26
|
+
// Noop
|
|
27
|
+
}) {
|
|
28
|
+
throw new Error(`[Portal] KeychainAdapter method getSigningShare(${curve}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
29
|
+
}
|
|
30
|
+
getAddresses() {
|
|
31
|
+
throw new Error('[Portal] KeychainAdapter method getAddresses cannot be called directly. Please extend KeychainAdapter.');
|
|
32
|
+
}
|
|
33
|
+
getEip155Address() {
|
|
34
|
+
throw new Error('[Portal] KeychainAdapter method getEip155Address cannot be called directly. Please extend KeychainAdapter.');
|
|
15
35
|
}
|
|
16
36
|
storeAddress(address, isSim) {
|
|
17
37
|
throw new Error(`[Portal] KeychainAdapter method storeAddress(${address}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
18
38
|
}
|
|
19
|
-
|
|
39
|
+
storeShares(result, _progress = () => {
|
|
20
40
|
// Noop
|
|
21
41
|
}) {
|
|
22
|
-
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}
|
|
42
|
+
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
23
43
|
}
|
|
24
44
|
validateOperations() {
|
|
25
45
|
throw new Error(`[Portal] KeychainAdapter method validateOperations() cannot be called directly. Please extend KeychainAdapter.`);
|
|
@@ -13,7 +13,7 @@ class HttpRequest {
|
|
|
13
13
|
// Sets headers on the request
|
|
14
14
|
this.prepareRequest();
|
|
15
15
|
// Sends the request with a formatted request body
|
|
16
|
-
if (['POST', 'PUT'].includes(this.method)) {
|
|
16
|
+
if (['POST', 'PUT', 'PATCH'].includes(this.method)) {
|
|
17
17
|
const body = this.prepareBody();
|
|
18
18
|
this.request.send(body);
|
|
19
19
|
}
|
package/lib/esm/index.js
CHANGED
|
@@ -5,4 +5,5 @@ export { CloudStorageReadError, HttpError, InvalidApiKeyError, InvalidChainIdErr
|
|
|
5
5
|
export { default as Events } from './events';
|
|
6
6
|
export { numberToHexString, parseRequest } from './eth-requests';
|
|
7
7
|
export { default as HttpRequest } from './http-request';
|
|
8
|
+
export { default as PortalRequests } from './PortalRequests';
|
|
8
9
|
export { HttpRequester } from './requesters';
|
|
@@ -69,5 +69,20 @@ class HttpRequester {
|
|
|
69
69
|
return response;
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
patch(path, options) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const requestOptions = {
|
|
75
|
+
method: 'PATCH',
|
|
76
|
+
url: `${this.baseUrl}${path}`,
|
|
77
|
+
};
|
|
78
|
+
requestOptions.headers = this.buildHeaders((options === null || options === void 0 ? void 0 : options.headers) ? options.headers : {});
|
|
79
|
+
if (options && options.body) {
|
|
80
|
+
requestOptions.body = options.body;
|
|
81
|
+
}
|
|
82
|
+
const request = new HttpRequest(requestOptions);
|
|
83
|
+
const response = (yield request.send());
|
|
84
|
+
return response;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
72
87
|
}
|
|
73
88
|
export default HttpRequester;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"main": "lib/commonjs/index",
|
|
5
5
|
"module": "lib/esm/index",
|
|
6
6
|
"source": "src/index",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"ts-jest": "^29.0.3",
|
|
27
27
|
"typescript": "^4.8.4"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "48f26514785d9e7cdacfec332f0f6f71092f40b7"
|
|
30
30
|
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type HttpOptions, type HttpRequestOptions } from '../../types'
|
|
2
|
+
import { HttpRequest } from '../index'
|
|
3
|
+
|
|
4
|
+
class PortalRequests {
|
|
5
|
+
public buildHeaders(headers: Record<string, any> = {}): Record<string, any> {
|
|
6
|
+
return {
|
|
7
|
+
'Content-Type': 'application/json',
|
|
8
|
+
...headers,
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public async delete<T>(
|
|
13
|
+
baseUrl: string,
|
|
14
|
+
path: string,
|
|
15
|
+
options?: HttpOptions,
|
|
16
|
+
): Promise<T> {
|
|
17
|
+
const requestOptions = {
|
|
18
|
+
method: 'DELETE',
|
|
19
|
+
url: `${baseUrl}${path}`,
|
|
20
|
+
} as HttpRequestOptions
|
|
21
|
+
|
|
22
|
+
requestOptions.headers = this.buildHeaders(
|
|
23
|
+
options && options.headers ? options.headers : {},
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const request = new HttpRequest(requestOptions)
|
|
27
|
+
const response = (await request.send()) as T
|
|
28
|
+
|
|
29
|
+
return response
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async get<T>(
|
|
33
|
+
baseUrl: string,
|
|
34
|
+
path: string,
|
|
35
|
+
options?: HttpOptions,
|
|
36
|
+
): Promise<T> {
|
|
37
|
+
const requestOptions = {
|
|
38
|
+
method: 'GET',
|
|
39
|
+
url: `${baseUrl}${path}`,
|
|
40
|
+
} as HttpRequestOptions
|
|
41
|
+
|
|
42
|
+
requestOptions.headers = this.buildHeaders(
|
|
43
|
+
options && options.headers ? options.headers : {},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const request = new HttpRequest(requestOptions)
|
|
47
|
+
const response = (await request.send()) as T
|
|
48
|
+
|
|
49
|
+
return response
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public async post<T>(
|
|
53
|
+
baseUrl: string,
|
|
54
|
+
path: string,
|
|
55
|
+
options?: HttpOptions,
|
|
56
|
+
): Promise<T> {
|
|
57
|
+
const requestOptions = {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
url: `${baseUrl}${path}`,
|
|
60
|
+
} as HttpRequestOptions
|
|
61
|
+
|
|
62
|
+
requestOptions.headers = this.buildHeaders(
|
|
63
|
+
options && options.headers ? options.headers : {},
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
if (options && options.body) {
|
|
67
|
+
requestOptions.body = options.body
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const request = new HttpRequest(requestOptions)
|
|
71
|
+
const response = (await request.send()) as T
|
|
72
|
+
|
|
73
|
+
return response
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public async put<T>(
|
|
77
|
+
baseUrl: string,
|
|
78
|
+
path: string,
|
|
79
|
+
options: HttpOptions,
|
|
80
|
+
): Promise<T> {
|
|
81
|
+
const requestOptions = {
|
|
82
|
+
method: 'PUT',
|
|
83
|
+
url: `${baseUrl}${path}`,
|
|
84
|
+
} as HttpRequestOptions
|
|
85
|
+
|
|
86
|
+
requestOptions.headers = this.buildHeaders(
|
|
87
|
+
options && options.headers ? options.headers : {},
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
if (options && options.body) {
|
|
91
|
+
requestOptions.body = options.body
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const request = new HttpRequest(requestOptions)
|
|
95
|
+
const response = (await request.send()) as T
|
|
96
|
+
|
|
97
|
+
return response
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public async patch<T>(
|
|
101
|
+
baseUrl: string,
|
|
102
|
+
path: string,
|
|
103
|
+
options: HttpOptions,
|
|
104
|
+
): Promise<T> {
|
|
105
|
+
const requestOptions = {
|
|
106
|
+
method: 'PATCH',
|
|
107
|
+
url: `${baseUrl}${path}`,
|
|
108
|
+
} as HttpRequestOptions
|
|
109
|
+
|
|
110
|
+
requestOptions.headers = this.buildHeaders(
|
|
111
|
+
options && options.headers ? options.headers : {},
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
if (options && options.body) {
|
|
115
|
+
requestOptions.body = options.body
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const request = new HttpRequest(requestOptions)
|
|
119
|
+
const response = (await request.send()) as T
|
|
120
|
+
|
|
121
|
+
return response
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export default PortalRequests
|
package/src/definitions/index.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import PortalConnect from '@portal-hq/connect'
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
|
+
AddressesByNamespace,
|
|
4
5
|
BackupSharePairMetadata,
|
|
5
6
|
Balance,
|
|
6
|
-
|
|
7
|
+
ClientResponse,
|
|
7
8
|
Dapp,
|
|
8
|
-
|
|
9
|
+
GenerateResponse,
|
|
9
10
|
GetTransactionsOrder,
|
|
10
11
|
NFT,
|
|
11
12
|
Network,
|
|
13
|
+
PortalKeychainMetadata,
|
|
12
14
|
ProgressCallback,
|
|
13
15
|
QuoteArgs,
|
|
14
16
|
QuoteResponse,
|
|
17
|
+
Shares,
|
|
15
18
|
SigningSharePairMetadata,
|
|
16
19
|
SimulateTransactionParam,
|
|
17
20
|
SimulatedTransaction,
|
|
18
21
|
Transaction,
|
|
19
22
|
} from '../../types'
|
|
23
|
+
import PortalRequests from '../PortalRequests'
|
|
20
24
|
import { HttpRequester } from '../requesters'
|
|
21
25
|
|
|
22
26
|
export type EventHandler = (data: any) => void
|
|
@@ -48,25 +52,35 @@ export interface IPortalApi {
|
|
|
48
52
|
apiUrl: string
|
|
49
53
|
requests: HttpRequester
|
|
50
54
|
|
|
51
|
-
|
|
52
|
-
getBalances(): Promise<Balance[]>
|
|
53
|
-
getClient(): Promise<
|
|
55
|
+
getBackupSharesMetadata(chainId?: string): Promise<BackupSharePairMetadata[]>
|
|
56
|
+
getBalances(chainId?: string): Promise<Balance[]>
|
|
57
|
+
getClient(): Promise<ClientResponse>
|
|
54
58
|
getEnabledDapps(): Promise<Dapp[]>
|
|
55
|
-
getNFTs(): Promise<NFT[]>
|
|
59
|
+
getNFTs(chainId?: string): Promise<NFT[]>
|
|
56
60
|
getNetworks(): Promise<Network[]>
|
|
57
|
-
getQuote(
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
getQuote(
|
|
62
|
+
apiKey: string,
|
|
63
|
+
args: QuoteArgs,
|
|
64
|
+
chainId?: string,
|
|
65
|
+
): Promise<QuoteResponse>
|
|
66
|
+
getSigningSharesMetadata(
|
|
67
|
+
chainId?: string,
|
|
68
|
+
): Promise<SigningSharePairMetadata[]>
|
|
69
|
+
getSources(apiKey: string, chainId?: string): Promise<Record<string, string>>
|
|
60
70
|
getTransactions(
|
|
71
|
+
chainId?: string,
|
|
61
72
|
limit?: number,
|
|
62
73
|
offset?: number,
|
|
63
74
|
order?: GetTransactionsOrder,
|
|
64
|
-
chainId?: number,
|
|
65
75
|
): Promise<Transaction[]>
|
|
66
76
|
identify(traits?: Record<string, any>): Promise<{ success: boolean }>
|
|
67
77
|
simulateTransaction(
|
|
68
78
|
params: SimulateTransactionParam,
|
|
79
|
+
chainId?: string,
|
|
69
80
|
): Promise<SimulatedTransaction>
|
|
81
|
+
storedClientSigningShares(signingSharePairIds: string[]): Promise<void>
|
|
82
|
+
storedClientBackupShares(backupSharePairIds: string[]): Promise<void>
|
|
83
|
+
storedClientBackupSharesKey(backupSharePairIds: string[]): Promise<void>
|
|
70
84
|
storedClientBackupShare(
|
|
71
85
|
success: boolean,
|
|
72
86
|
backupMethod:
|
|
@@ -87,7 +101,7 @@ export interface IPortalApi {
|
|
|
87
101
|
| 'PASSWORD'
|
|
88
102
|
| 'UNKNOWN',
|
|
89
103
|
): Promise<void>
|
|
90
|
-
|
|
104
|
+
storedClientSigningShares(signingSharePairIds: string[]): Promise<void>
|
|
91
105
|
track(
|
|
92
106
|
event: string,
|
|
93
107
|
properties?: Record<string, any>,
|
|
@@ -109,30 +123,42 @@ export interface IPortalConnect {
|
|
|
109
123
|
export interface IPortalProvider {
|
|
110
124
|
apiKey: string
|
|
111
125
|
autoApprove: boolean
|
|
112
|
-
chainId
|
|
126
|
+
chainId?: string
|
|
113
127
|
log: Console
|
|
114
|
-
gateway:
|
|
115
|
-
|
|
128
|
+
gateway: PortalRequests
|
|
116
129
|
address: Promise<string | undefined>
|
|
117
|
-
|
|
130
|
+
addresses: Promise<AddressesByNamespace | undefined>
|
|
118
131
|
|
|
119
132
|
emit(event: string, data: any): IPortalProvider
|
|
120
|
-
getGatewayUrl(): string
|
|
133
|
+
getGatewayUrl(chainId: string): string
|
|
121
134
|
on(event: string, callback: EventHandler): IPortalProvider
|
|
122
135
|
once(event: string, callback: EventHandler): IPortalProvider
|
|
123
136
|
removeEventListener(event: string, listenerToRemove?: EventHandler): void
|
|
124
137
|
request(args: RequestArguments): Promise<any>
|
|
125
|
-
setChainId(
|
|
138
|
+
setChainId(
|
|
139
|
+
chainId: string | number,
|
|
140
|
+
connect?: PortalConnect | undefined,
|
|
141
|
+
): Promise<IPortalProvider>
|
|
126
142
|
}
|
|
127
143
|
|
|
128
144
|
export abstract class KeychainAdapter {
|
|
129
145
|
public api?: IPortalApi
|
|
130
|
-
|
|
146
|
+
public metadata?: PortalKeychainMetadata
|
|
147
|
+
loadMetadata(): Promise<void> {
|
|
148
|
+
throw new Error(
|
|
149
|
+
'[Portal] KeychainAdapter method loadMetadata cannot be called directly. Please extend KeychainAdapter.',
|
|
150
|
+
)
|
|
151
|
+
}
|
|
131
152
|
deleteAddress(): Promise<boolean> {
|
|
132
153
|
throw new Error(
|
|
133
154
|
'[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.',
|
|
134
155
|
)
|
|
135
156
|
}
|
|
157
|
+
deleteShares(): Promise<boolean> {
|
|
158
|
+
throw new Error(
|
|
159
|
+
'[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.',
|
|
160
|
+
)
|
|
161
|
+
}
|
|
136
162
|
deleteDkgResult(): Promise<boolean> {
|
|
137
163
|
throw new Error(
|
|
138
164
|
'[Portal] KeychainAdapter method deleteDkgResult cannot be called directly. Please extend KeychainAdapter.',
|
|
@@ -143,14 +169,38 @@ export abstract class KeychainAdapter {
|
|
|
143
169
|
`[Portal] KeychainAdapter method getAddress(${isSim}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
144
170
|
)
|
|
145
171
|
}
|
|
146
|
-
getDkgResult(
|
|
147
|
-
|
|
172
|
+
getDkgResult(isSim?: boolean): Promise<string> {
|
|
173
|
+
throw new Error(
|
|
174
|
+
`[Portal] KeychainAdapter method getDkgResult(${isSim}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
getShares(
|
|
148
178
|
_progress: ProgressCallback = () => {
|
|
149
179
|
// Noop
|
|
150
180
|
},
|
|
151
|
-
): Promise<
|
|
181
|
+
): Promise<Shares> {
|
|
152
182
|
throw new Error(
|
|
153
|
-
|
|
183
|
+
'[Portal] KeychainAdapter method getShares cannot be called directly. Please extend KeychainAdapter.',
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
getSigningShare(
|
|
187
|
+
curve: string,
|
|
188
|
+
_progress: ProgressCallback = () => {
|
|
189
|
+
// Noop
|
|
190
|
+
},
|
|
191
|
+
): Promise<GenerateResponse> {
|
|
192
|
+
throw new Error(
|
|
193
|
+
`[Portal] KeychainAdapter method getSigningShare(${curve}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
getAddresses(): Promise<AddressesByNamespace> {
|
|
197
|
+
throw new Error(
|
|
198
|
+
'[Portal] KeychainAdapter method getAddresses cannot be called directly. Please extend KeychainAdapter.',
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
getEip155Address(): Promise<string> {
|
|
202
|
+
throw new Error(
|
|
203
|
+
'[Portal] KeychainAdapter method getEip155Address cannot be called directly. Please extend KeychainAdapter.',
|
|
154
204
|
)
|
|
155
205
|
}
|
|
156
206
|
storeAddress(address: string, isSim?: boolean): Promise<void> {
|
|
@@ -158,15 +208,14 @@ export abstract class KeychainAdapter {
|
|
|
158
208
|
`[Portal] KeychainAdapter method storeAddress(${address}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
159
209
|
)
|
|
160
210
|
}
|
|
161
|
-
|
|
162
|
-
result:
|
|
163
|
-
isSim?: boolean,
|
|
211
|
+
storeShares(
|
|
212
|
+
result: Shares,
|
|
164
213
|
_progress: ProgressCallback = () => {
|
|
165
214
|
// Noop
|
|
166
215
|
},
|
|
167
216
|
): Promise<void> {
|
|
168
217
|
throw new Error(
|
|
169
|
-
`[Portal] KeychainAdapter method storeDkgResult(${result}
|
|
218
|
+
`[Portal] KeychainAdapter method storeDkgResult(${result}) cannot be called directly. Please extend KeychainAdapter.`,
|
|
170
219
|
)
|
|
171
220
|
}
|
|
172
221
|
validateOperations(): Promise<boolean> {
|
|
@@ -27,7 +27,7 @@ class HttpRequest {
|
|
|
27
27
|
this.prepareRequest()
|
|
28
28
|
|
|
29
29
|
// Sends the request with a formatted request body
|
|
30
|
-
if (['POST', 'PUT'].includes(this.method)) {
|
|
30
|
+
if (['POST', 'PUT', 'PATCH'].includes(this.method)) {
|
|
31
31
|
const body = this.prepareBody()
|
|
32
32
|
this.request.send(body)
|
|
33
33
|
} else {
|
package/src/index.ts
CHANGED
|
@@ -40,6 +40,7 @@ export { numberToHexString, parseRequest } from './eth-requests'
|
|
|
40
40
|
|
|
41
41
|
export { default as HttpRequest } from './http-request'
|
|
42
42
|
|
|
43
|
+
export { default as PortalRequests } from './PortalRequests'
|
|
43
44
|
export { HttpRequester } from './requesters'
|
|
44
45
|
|
|
45
46
|
export {
|
|
@@ -65,4 +66,5 @@ export {
|
|
|
65
66
|
type SigningRequestArguments,
|
|
66
67
|
type SigningResponse,
|
|
67
68
|
type Transaction,
|
|
69
|
+
type Shares,
|
|
68
70
|
} from '../types'
|
package/src/requesters/http.ts
CHANGED
|
@@ -90,6 +90,26 @@ class HttpRequester {
|
|
|
90
90
|
|
|
91
91
|
return response
|
|
92
92
|
}
|
|
93
|
+
|
|
94
|
+
public async patch<T>(path: string, options: HttpOptions): Promise<T> {
|
|
95
|
+
const requestOptions = {
|
|
96
|
+
method: 'PATCH',
|
|
97
|
+
url: `${this.baseUrl}${path}`,
|
|
98
|
+
} as HttpRequestOptions
|
|
99
|
+
|
|
100
|
+
requestOptions.headers = this.buildHeaders(
|
|
101
|
+
options?.headers ? options.headers : {},
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
if (options && options.body) {
|
|
105
|
+
requestOptions.body = options.body
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const request = new HttpRequest(requestOptions)
|
|
109
|
+
const response = (await request.send()) as T
|
|
110
|
+
|
|
111
|
+
return response
|
|
112
|
+
}
|
|
93
113
|
}
|
|
94
114
|
|
|
95
115
|
export default HttpRequester
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BackupMethods,
|
|
3
|
+
PortalCurve,
|
|
4
|
+
PortalNamespace,
|
|
5
|
+
PortalSharePairStatus,
|
|
6
|
+
} from '@portal-hq/core'
|
|
2
7
|
|
|
3
8
|
import { MpcStatuses } from './src/definitions'
|
|
4
9
|
|
|
@@ -8,7 +13,12 @@ export type OutgoingRequestData = MessageData | SignableTransactionData
|
|
|
8
13
|
|
|
9
14
|
export type ProgressCallback = (status: MpcStatus) => void | Promise<void>
|
|
10
15
|
|
|
11
|
-
export type ValidHttpRequestMethods =
|
|
16
|
+
export type ValidHttpRequestMethods =
|
|
17
|
+
| 'DELETE'
|
|
18
|
+
| 'GET'
|
|
19
|
+
| 'POST'
|
|
20
|
+
| 'PUT'
|
|
21
|
+
| 'PATCH'
|
|
12
22
|
|
|
13
23
|
export type ValidRpcErrorCodes = 4001 | 4100 | 4200 | 4900 | 4901
|
|
14
24
|
|
|
@@ -17,6 +27,63 @@ export interface Bk {
|
|
|
17
27
|
Rank: number
|
|
18
28
|
}
|
|
19
29
|
|
|
30
|
+
interface ClientResponse {
|
|
31
|
+
id: string
|
|
32
|
+
custodian: ClientResponseCustodian
|
|
33
|
+
createdAt: string
|
|
34
|
+
environment?: ClientResponseEnvironment
|
|
35
|
+
ejectedAt?: string
|
|
36
|
+
isAccountAbstracted: boolean
|
|
37
|
+
metadata: ClientResponseMetadata
|
|
38
|
+
wallets: ClientResponseWallet[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface ClientResponseBackupSharePair {
|
|
42
|
+
backupMethod: BackupMethods
|
|
43
|
+
createdAt: string
|
|
44
|
+
id: string
|
|
45
|
+
status: PortalSharePairStatus
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ClientResponseCustodian {
|
|
49
|
+
id: string
|
|
50
|
+
name: string
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface ClientResponseEnvironment {
|
|
54
|
+
id: string
|
|
55
|
+
name: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface ClientResponseMetadata {
|
|
59
|
+
namespaces: ClientResponseMetadataNamespaces
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface ClientResponseMetadataNamespaces {
|
|
63
|
+
eip155?: ClientResponseNamespaceMetadataItem
|
|
64
|
+
solana?: ClientResponseNamespaceMetadataItem
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface ClientResponseNamespaceMetadataItem {
|
|
68
|
+
address: string
|
|
69
|
+
curve: PortalCurve
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface ClientResponseSharePair {
|
|
73
|
+
id: string
|
|
74
|
+
createdAt: string
|
|
75
|
+
status: PortalSharePairStatus
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ClientResponseWallet {
|
|
79
|
+
id: string
|
|
80
|
+
createdAt: string
|
|
81
|
+
backupSharePairs: ClientResponseBackupSharePair[]
|
|
82
|
+
curve: PortalCurve
|
|
83
|
+
publicKey: string
|
|
84
|
+
signingSharePairs: ClientResponseSharePair[]
|
|
85
|
+
}
|
|
86
|
+
|
|
20
87
|
export interface ClientWithCustodianData {
|
|
21
88
|
id: string
|
|
22
89
|
address: string
|
|
@@ -58,6 +125,63 @@ export interface DappImage {
|
|
|
58
125
|
data: string
|
|
59
126
|
}
|
|
60
127
|
|
|
128
|
+
export interface GenerateResponse {
|
|
129
|
+
id: string
|
|
130
|
+
share: DkgData
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface Shares {
|
|
134
|
+
ed25519?: GenerateResponse
|
|
135
|
+
secp256k1: GenerateResponse
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface AddressesByNamespace {
|
|
139
|
+
eip155: string
|
|
140
|
+
solana?: string
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface WalletsByCurve {
|
|
144
|
+
[key in PortalCurve]: PortalKeychainClientMetadataWallet
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface PortalKeychainClientMetadata {
|
|
148
|
+
id: string
|
|
149
|
+
addresses?: AddressesByNamespace
|
|
150
|
+
custodian: ClientResponseCustodian
|
|
151
|
+
wallets?: WalletsByCurve
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface PortalKeychainClientMetadataWallet {
|
|
155
|
+
id: string
|
|
156
|
+
curve: PortalCurve
|
|
157
|
+
publicKey: string
|
|
158
|
+
backupShares: PortalKeychainClientMetadataWalletBackupShare[]
|
|
159
|
+
signingShares: PortalKeychainClientMetadataWalletShare[]
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface PortalKeychainClientMetadataWalletBackupShare {
|
|
163
|
+
backupMethod: BackupMethods
|
|
164
|
+
createdAt: string
|
|
165
|
+
id: string
|
|
166
|
+
status: PortalSharePairStatus
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface PortalKeychainClientMetadataWalletShare {
|
|
170
|
+
createdAt: string
|
|
171
|
+
id: string
|
|
172
|
+
status: PortalSharePairStatus
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type PortalKeychainClientShares = GenerateResponse
|
|
176
|
+
|
|
177
|
+
export interface CurveByNamespace {
|
|
178
|
+
[namespace: string]: PortalCurve
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface PortalKeychainMetadata {
|
|
182
|
+
namespaces: CurveByNamespace
|
|
183
|
+
}
|
|
184
|
+
|
|
61
185
|
export interface DkgData {
|
|
62
186
|
allY: { [key: MpcMember]: Pubkey }
|
|
63
187
|
bks: { [key: MpcMember]: Bk }
|
|
@@ -68,6 +192,7 @@ export interface DkgData {
|
|
|
68
192
|
q: string
|
|
69
193
|
share: string
|
|
70
194
|
signingSharePairId?: string
|
|
195
|
+
backupSharePairId?: string
|
|
71
196
|
ssid: string
|
|
72
197
|
}
|
|
73
198
|
|
|
@@ -175,9 +300,11 @@ export interface SignableTransactionData {
|
|
|
175
300
|
}
|
|
176
301
|
|
|
177
302
|
export interface SigningRequestArguments {
|
|
178
|
-
readonly chainId
|
|
303
|
+
readonly chainId: string
|
|
304
|
+
readonly curve: PortalCurve
|
|
179
305
|
readonly method: string
|
|
180
306
|
readonly params?: unknown[] | SigningRequestParams
|
|
307
|
+
readonly isRaw?: boolean
|
|
181
308
|
}
|
|
182
309
|
|
|
183
310
|
export interface SigningResponse {
|