@portal-hq/utils 4.1.0-beta-3 → 4.1.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/lib/commonjs/events/index.js +1 -3
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/version/index.js +13 -0
- package/lib/commonjs/version/version.json +1 -0
- package/lib/esm/events/index.js +1 -3
- package/lib/esm/index.js +1 -0
- package/lib/esm/version/index.js +6 -0
- package/lib/esm/version/version.json +1 -0
- package/package.json +2 -2
- package/src/definitions/index.ts +11 -10
- package/src/events/index.ts +1 -3
- package/src/index.ts +2 -0
- package/src/version/index.ts +7 -0
- package/src/version/version.json +1 -0
- package/types.d.ts +1 -28
|
@@ -11,7 +11,6 @@ var Events;
|
|
|
11
11
|
Events["GetBackupShareMetadata"] = "Get Backup Share Metadata";
|
|
12
12
|
Events["GetBalances"] = "Get Balances";
|
|
13
13
|
Events["GetClient"] = "Get Client";
|
|
14
|
-
Events["GetClientCipherText"] = "Get Client Cipher Text";
|
|
15
14
|
Events["GetEnabledDapps"] = "Get Enabled Dapps";
|
|
16
15
|
Events["GetNFTs"] = "Get NFTs";
|
|
17
16
|
Events["GetNetworks"] = "Get Networks";
|
|
@@ -19,11 +18,10 @@ var Events;
|
|
|
19
18
|
Events["GetSigningShareMetadata"] = "Get Signing Share Metadata";
|
|
20
19
|
Events["GetSources"] = "Get Sources";
|
|
21
20
|
Events["GetTransactions"] = "Get Transactions";
|
|
22
|
-
Events["PrepareClientEject"] = "Prepare Client Eject";
|
|
23
21
|
Events["SimulateTransaction"] = "Simulate Transaction";
|
|
24
|
-
Events["StoreClientCipherText"] = "Store Client Cipher Text";
|
|
25
22
|
Events["StoredClientBackupShare"] = "Stored Client Backup Share";
|
|
26
23
|
Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
|
|
27
24
|
Events["StoredClientSigningShare"] = "Stored Client Signing Share";
|
|
25
|
+
Events["EjectClient"] = "Eject Client";
|
|
28
26
|
})(Events || (Events = {}));
|
|
29
27
|
exports.default = Events;
|
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.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;
|
|
6
|
+
exports.HttpRequester = exports.PortalRequests = exports.HttpRequest = exports.parseRequest = exports.numberToHexString = exports.getClientPlatformVersion = 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; } });
|
|
@@ -33,6 +33,8 @@ Object.defineProperty(exports, "ProviderRpcError", { enumerable: true, get: func
|
|
|
33
33
|
Object.defineProperty(exports, "RpcErrorCodes", { enumerable: true, get: function () { return errors_1.RpcErrorCodes; } });
|
|
34
34
|
var events_1 = require("./events");
|
|
35
35
|
Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return __importDefault(events_1).default; } });
|
|
36
|
+
var version_1 = require("./version");
|
|
37
|
+
Object.defineProperty(exports, "getClientPlatformVersion", { enumerable: true, get: function () { return version_1.getClientPlatformVersion; } });
|
|
36
38
|
var eth_requests_1 = require("./eth-requests");
|
|
37
39
|
Object.defineProperty(exports, "numberToHexString", { enumerable: true, get: function () { return eth_requests_1.numberToHexString; } });
|
|
38
40
|
Object.defineProperty(exports, "parseRequest", { enumerable: true, get: function () { return eth_requests_1.parseRequest; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getClientPlatformVersion = void 0;
|
|
7
|
+
const version_json_1 = __importDefault(require("./version.json"));
|
|
8
|
+
const getClientPlatformVersion = () => {
|
|
9
|
+
if (!(version_json_1.default === null || version_json_1.default === void 0 ? void 0 : version_json_1.default.version))
|
|
10
|
+
return '';
|
|
11
|
+
return version_json_1.default.version;
|
|
12
|
+
};
|
|
13
|
+
exports.getClientPlatformVersion = getClientPlatformVersion;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "version": "4.1.0" }
|
package/lib/esm/events/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var Events;
|
|
|
9
9
|
Events["GetBackupShareMetadata"] = "Get Backup Share Metadata";
|
|
10
10
|
Events["GetBalances"] = "Get Balances";
|
|
11
11
|
Events["GetClient"] = "Get Client";
|
|
12
|
-
Events["GetClientCipherText"] = "Get Client Cipher Text";
|
|
13
12
|
Events["GetEnabledDapps"] = "Get Enabled Dapps";
|
|
14
13
|
Events["GetNFTs"] = "Get NFTs";
|
|
15
14
|
Events["GetNetworks"] = "Get Networks";
|
|
@@ -17,11 +16,10 @@ var Events;
|
|
|
17
16
|
Events["GetSigningShareMetadata"] = "Get Signing Share Metadata";
|
|
18
17
|
Events["GetSources"] = "Get Sources";
|
|
19
18
|
Events["GetTransactions"] = "Get Transactions";
|
|
20
|
-
Events["PrepareClientEject"] = "Prepare Client Eject";
|
|
21
19
|
Events["SimulateTransaction"] = "Simulate Transaction";
|
|
22
|
-
Events["StoreClientCipherText"] = "Store Client Cipher Text";
|
|
23
20
|
Events["StoredClientBackupShare"] = "Stored Client Backup Share";
|
|
24
21
|
Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
|
|
25
22
|
Events["StoredClientSigningShare"] = "Stored Client Signing Share";
|
|
23
|
+
Events["EjectClient"] = "Eject Client";
|
|
26
24
|
})(Events || (Events = {}));
|
|
27
25
|
export default Events;
|
package/lib/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { convertLocalToCrypto, convertCryptoToLocal, convert } from './currency'
|
|
|
3
3
|
export { KeychainAdapter, MpcStatuses, Storage, } from './definitions';
|
|
4
4
|
export { CloudStorageReadError, HttpError, InvalidApiKeyError, InvalidChainIdError, InvalidGatewayConfigError, MissingOptionError, MpcSigningError, NoAddressError, PortalErrorCodes, PortalErrorCodeTypes, PortalMpcError, ProviderRpcError, RpcErrorCodes, } from './errors';
|
|
5
5
|
export { default as Events } from './events';
|
|
6
|
+
export { getClientPlatformVersion } from './version';
|
|
6
7
|
export { numberToHexString, parseRequest } from './eth-requests';
|
|
7
8
|
export { default as HttpRequest } from './http-request';
|
|
8
9
|
export { default as PortalRequests } from './PortalRequests';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "version": "4.1.0" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "4.1.0
|
|
3
|
+
"version": "4.1.0",
|
|
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": "d53139e2dae6d0ede12d647ae4d11f4915b896f1"
|
|
30
30
|
}
|
package/src/definitions/index.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import PortalConnect from '@portal-hq/connect'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BuildEip155TransactionResponse,
|
|
4
|
+
BuildSolanaTransactionResponse,
|
|
5
|
+
} from '@portal-hq/core/types'
|
|
3
6
|
|
|
4
7
|
import type {
|
|
5
8
|
AddressesByNamespace,
|
|
@@ -53,10 +56,15 @@ export interface IPortalApi {
|
|
|
53
56
|
apiUrl: string
|
|
54
57
|
requests: HttpRequester
|
|
55
58
|
|
|
59
|
+
buildTransaction(
|
|
60
|
+
to: string,
|
|
61
|
+
token: string,
|
|
62
|
+
amount: string,
|
|
63
|
+
chain?: string,
|
|
64
|
+
): Promise<BuildEip155TransactionResponse | BuildSolanaTransactionResponse>
|
|
56
65
|
getBackupSharesMetadata(chainId?: string): Promise<BackupSharePairMetadata[]>
|
|
57
66
|
getBalances(chainId?: string): Promise<Balance[]>
|
|
58
67
|
getClient(): Promise<ClientResponse>
|
|
59
|
-
getClientCipherText(backupSharePairId: string): Promise<string>
|
|
60
68
|
getEnabledDapps(): Promise<Dapp[]>
|
|
61
69
|
getNFTs(chainId?: string): Promise<NFT[]>
|
|
62
70
|
getNetworks(): Promise<Network[]>
|
|
@@ -76,18 +84,10 @@ export interface IPortalApi {
|
|
|
76
84
|
order?: GetTransactionsOrder,
|
|
77
85
|
): Promise<Transaction[]>
|
|
78
86
|
identify(traits?: Record<string, any>): Promise<{ success: boolean }>
|
|
79
|
-
prepareClientEject(
|
|
80
|
-
walletId: string,
|
|
81
|
-
backupMethod: BackupMethods,
|
|
82
|
-
): Promise<string>
|
|
83
87
|
simulateTransaction(
|
|
84
88
|
params: SimulateTransactionParam,
|
|
85
89
|
chainId?: string,
|
|
86
90
|
): Promise<SimulatedTransaction>
|
|
87
|
-
storeClientCipherText(
|
|
88
|
-
backupSharePairId: string,
|
|
89
|
-
cipherText: string,
|
|
90
|
-
): Promise<boolean>
|
|
91
91
|
storedClientSigningShares(signingSharePairIds: string[]): Promise<void>
|
|
92
92
|
storedClientBackupShares(backupSharePairIds: string[]): Promise<void>
|
|
93
93
|
storedClientBackupSharesKey(backupSharePairIds: string[]): Promise<void>
|
|
@@ -112,6 +112,7 @@ export interface IPortalApi {
|
|
|
112
112
|
| 'UNKNOWN',
|
|
113
113
|
): Promise<void>
|
|
114
114
|
storedClientSigningShares(signingSharePairIds: string[]): Promise<void>
|
|
115
|
+
ejectClient(): Promise<void>
|
|
115
116
|
track(
|
|
116
117
|
event: string,
|
|
117
118
|
properties?: Record<string, any>,
|
package/src/events/index.ts
CHANGED
|
@@ -9,7 +9,6 @@ enum Events {
|
|
|
9
9
|
GetBackupShareMetadata = 'Get Backup Share Metadata',
|
|
10
10
|
GetBalances = 'Get Balances',
|
|
11
11
|
GetClient = 'Get Client',
|
|
12
|
-
GetClientCipherText = 'Get Client Cipher Text',
|
|
13
12
|
GetEnabledDapps = 'Get Enabled Dapps',
|
|
14
13
|
GetNFTs = 'Get NFTs',
|
|
15
14
|
GetNetworks = 'Get Networks',
|
|
@@ -17,12 +16,11 @@ enum Events {
|
|
|
17
16
|
GetSigningShareMetadata = 'Get Signing Share Metadata',
|
|
18
17
|
GetSources = 'Get Sources',
|
|
19
18
|
GetTransactions = 'Get Transactions',
|
|
20
|
-
PrepareClientEject = 'Prepare Client Eject',
|
|
21
19
|
SimulateTransaction = 'Simulate Transaction',
|
|
22
|
-
StoreClientCipherText = 'Store Client Cipher Text',
|
|
23
20
|
StoredClientBackupShare = 'Stored Client Backup Share',
|
|
24
21
|
StoredClientBackupShareKey = 'Stored Client Backup Share Key',
|
|
25
22
|
StoredClientSigningShare = 'Stored Client Signing Share',
|
|
23
|
+
EjectClient = 'Eject Client',
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
export default Events
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "version": "4.1.0" }
|
package/types.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
|
|
8
8
|
import { MpcStatuses } from './src/definitions'
|
|
9
9
|
|
|
10
|
-
export type MpcMember = 'client' | 'server'
|
|
11
|
-
|
|
12
10
|
export type OutgoingRequestData = MessageData | SignableTransactionData
|
|
13
11
|
|
|
14
12
|
export type ProgressCallback = (status: MpcStatus) => void | Promise<void>
|
|
@@ -22,11 +20,6 @@ export type ValidHttpRequestMethods =
|
|
|
22
20
|
|
|
23
21
|
export type ValidRpcErrorCodes = 4001 | 4100 | 4200 | 4900 | 4901
|
|
24
22
|
|
|
25
|
-
export interface Bk {
|
|
26
|
-
X: string
|
|
27
|
-
Rank: number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
23
|
interface ClientResponse {
|
|
31
24
|
id: string
|
|
32
25
|
custodian: ClientResponseCustodian
|
|
@@ -52,7 +45,6 @@ interface ClientResponseCustodian {
|
|
|
52
45
|
|
|
53
46
|
interface ClientResponseEnvironment {
|
|
54
47
|
id: string
|
|
55
|
-
backupWithPortalEnabled?: boolean
|
|
56
48
|
name: string
|
|
57
49
|
}
|
|
58
50
|
|
|
@@ -184,23 +176,9 @@ export interface PortalKeychainMetadata {
|
|
|
184
176
|
}
|
|
185
177
|
|
|
186
178
|
export interface DkgData {
|
|
187
|
-
|
|
188
|
-
bks: { [key: MpcMember]: Bk }
|
|
189
|
-
p: string
|
|
190
|
-
partialPubkey: { [key: MpcMember]: Pubkey }
|
|
191
|
-
pederson: { [key: MpcMember]: PedersonParams }
|
|
192
|
-
pubkey: Pubkey
|
|
193
|
-
q: string
|
|
179
|
+
backupSharePairId?: string
|
|
194
180
|
share: string
|
|
195
181
|
signingSharePairId?: string
|
|
196
|
-
backupSharePairId?: string
|
|
197
|
-
ssid: string
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface PedersonParams {
|
|
201
|
-
n: string
|
|
202
|
-
s: string
|
|
203
|
-
t: string
|
|
204
182
|
}
|
|
205
183
|
|
|
206
184
|
export interface HttpErrorOptions {
|
|
@@ -250,11 +228,6 @@ export interface OutgoingRequest {
|
|
|
250
228
|
data: OutgoingRequestData
|
|
251
229
|
}
|
|
252
230
|
|
|
253
|
-
export interface Pubkey {
|
|
254
|
-
X: string
|
|
255
|
-
Y: string
|
|
256
|
-
}
|
|
257
|
-
|
|
258
231
|
export interface QuoteArgs {
|
|
259
232
|
affiliateAddress?: string
|
|
260
233
|
buyAmount?: number
|