@portal-hq/utils 4.1.1 → 4.1.2
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/currency/index.js +3 -3
- package/lib/commonjs/definitions/index.js +1 -1
- package/lib/commonjs/errors/portal-error.js +1 -1
- package/lib/commonjs/errors/provider-rpc-error.js +1 -1
- package/lib/commonjs/events/index.js +1 -0
- package/lib/commonjs/version/version.json +1 -1
- package/lib/esm/currency/index.js +3 -3
- package/lib/esm/events/index.js +1 -0
- package/lib/esm/version/version.json +1 -1
- package/package.json +2 -2
- package/src/definitions/index.ts +3 -0
- package/src/events/index.ts +1 -0
- package/src/version/version.json +1 -1
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.convertLocalToCrypto = exports.convertCryptoToLocal = exports.convert = void 0;
|
|
13
13
|
const countries_1 = require("./countries");
|
|
14
|
-
const convert = (
|
|
14
|
+
const convert = (value, from = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
const country = countries_1.countryCodes[countryCode || 'US'];
|
|
16
16
|
if (!country) {
|
|
17
17
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
@@ -27,7 +27,7 @@ const convert = (value_1, ...args_1) => __awaiter(void 0, [value_1, ...args_1],
|
|
|
27
27
|
return convertedValue;
|
|
28
28
|
});
|
|
29
29
|
exports.convert = convert;
|
|
30
|
-
const convertCryptoToLocal = (
|
|
30
|
+
const convertCryptoToLocal = (value, from = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
31
|
const country = countries_1.countryCodes[countryCode || 'US'];
|
|
32
32
|
if (!country) {
|
|
33
33
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
@@ -43,7 +43,7 @@ const convertCryptoToLocal = (value_1, ...args_1) => __awaiter(void 0, [value_1,
|
|
|
43
43
|
return convertedValue;
|
|
44
44
|
});
|
|
45
45
|
exports.convertCryptoToLocal = convertCryptoToLocal;
|
|
46
|
-
const convertLocalToCrypto = (
|
|
46
|
+
const convertLocalToCrypto = (value, to = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
47
|
const country = countries_1.countryCodes[countryCode || 'US'];
|
|
48
48
|
if (!country) {
|
|
49
49
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
@@ -60,7 +60,7 @@ var MpcStatuses;
|
|
|
60
60
|
MpcStatuses["RecoveringBackupShare"] = "Recovering backup share";
|
|
61
61
|
MpcStatuses["RecoveringSigningShare"] = "Recovering signing share";
|
|
62
62
|
MpcStatuses["StoringShare"] = "Storing share";
|
|
63
|
-
})(MpcStatuses
|
|
63
|
+
})(MpcStatuses = exports.MpcStatuses || (exports.MpcStatuses = {}));
|
|
64
64
|
class Storage {
|
|
65
65
|
delete() {
|
|
66
66
|
throw new Error('[Portal] Storage method delete cannot be called directly. Please extend Storage.');
|
|
@@ -62,7 +62,7 @@ var PortalErrorCodes;
|
|
|
62
62
|
PortalErrorCodes[PortalErrorCodes["FailedToDecodeCipherHexString"] = 405] = "FailedToDecodeCipherHexString";
|
|
63
63
|
PortalErrorCodes[PortalErrorCodes["FailedToGetNonceSize"] = 406] = "FailedToGetNonceSize";
|
|
64
64
|
PortalErrorCodes[PortalErrorCodes["FailedToDecryptCipher"] = 407] = "FailedToDecryptCipher";
|
|
65
|
-
})(PortalErrorCodes
|
|
65
|
+
})(PortalErrorCodes = exports.PortalErrorCodes || (exports.PortalErrorCodes = {}));
|
|
66
66
|
exports.PortalErrorCodeTypes = {
|
|
67
67
|
MpcErrors: Array.from({ length: 100 }, (_, i) => i + 100),
|
|
68
68
|
NetworkErrors: Array.from({ length: 100 }, (_, i) => i + 200),
|
|
@@ -8,7 +8,7 @@ var RpcErrorCodes;
|
|
|
8
8
|
RpcErrorCodes[RpcErrorCodes["UnsupportedMethod"] = 4200] = "UnsupportedMethod";
|
|
9
9
|
RpcErrorCodes[RpcErrorCodes["Disconnected"] = 4900] = "Disconnected";
|
|
10
10
|
RpcErrorCodes[RpcErrorCodes["ChainDisconnected"] = 4901] = "ChainDisconnected";
|
|
11
|
-
})(RpcErrorCodes
|
|
11
|
+
})(RpcErrorCodes = exports.RpcErrorCodes || (exports.RpcErrorCodes = {}));
|
|
12
12
|
const providerErrors = {
|
|
13
13
|
4001: {
|
|
14
14
|
name: 'User Rejected Request',
|
|
@@ -26,5 +26,6 @@ var Events;
|
|
|
26
26
|
Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
|
|
27
27
|
Events["StoredClientSigningShare"] = "Stored Client Signing Share";
|
|
28
28
|
Events["EjectClient"] = "Eject Client";
|
|
29
|
+
Events["FundClient"] = "Fund Client";
|
|
29
30
|
})(Events || (Events = {}));
|
|
30
31
|
exports.default = Events;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.1.
|
|
1
|
+
{ "version": "4.1.2" }
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { countryCodes, currencyCodes } from './countries';
|
|
11
|
-
export const convert = (
|
|
11
|
+
export const convert = (value, from = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
12
|
const country = countryCodes[countryCode || 'US'];
|
|
13
13
|
if (!country) {
|
|
14
14
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
@@ -23,7 +23,7 @@ export const convert = (value_1, ...args_1) => __awaiter(void 0, [value_1, ...ar
|
|
|
23
23
|
const convertedValue = Math.round((value / (1 / data[to]) + Number.EPSILON) * 10000) / 10000;
|
|
24
24
|
return convertedValue;
|
|
25
25
|
});
|
|
26
|
-
export const convertCryptoToLocal = (
|
|
26
|
+
export const convertCryptoToLocal = (value, from = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
27
|
const country = countryCodes[countryCode || 'US'];
|
|
28
28
|
if (!country) {
|
|
29
29
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
@@ -38,7 +38,7 @@ export const convertCryptoToLocal = (value_1, ...args_1) => __awaiter(void 0, [v
|
|
|
38
38
|
const convertedValue = Math.round(value * data[to] * 10000) / 10000;
|
|
39
39
|
return convertedValue;
|
|
40
40
|
});
|
|
41
|
-
export const convertLocalToCrypto = (
|
|
41
|
+
export const convertLocalToCrypto = (value, to = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
42
|
const country = countryCodes[countryCode || 'US'];
|
|
43
43
|
if (!country) {
|
|
44
44
|
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
package/lib/esm/events/index.js
CHANGED
|
@@ -24,5 +24,6 @@ var Events;
|
|
|
24
24
|
Events["StoredClientBackupShareKey"] = "Stored Client Backup Share Key";
|
|
25
25
|
Events["StoredClientSigningShare"] = "Stored Client Signing Share";
|
|
26
26
|
Events["EjectClient"] = "Eject Client";
|
|
27
|
+
Events["FundClient"] = "Fund Client";
|
|
27
28
|
})(Events || (Events = {}));
|
|
28
29
|
export default Events;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.1.
|
|
1
|
+
{ "version": "4.1.2" }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@portal-hq/utils",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.2",
|
|
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": "4504ed5bdfde36df2b9c1acab9916ad412ba6fd9"
|
|
30
30
|
}
|
package/src/definitions/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ import PortalConnect from '@portal-hq/connect'
|
|
|
2
2
|
import {
|
|
3
3
|
BuildEip155TransactionResponse,
|
|
4
4
|
BuildSolanaTransactionResponse,
|
|
5
|
+
FundParams,
|
|
6
|
+
FundResponse,
|
|
5
7
|
} from '@portal-hq/core/types'
|
|
6
8
|
|
|
7
9
|
import type {
|
|
@@ -62,6 +64,7 @@ export interface IPortalApi {
|
|
|
62
64
|
amount: string,
|
|
63
65
|
chain?: string,
|
|
64
66
|
): Promise<BuildEip155TransactionResponse | BuildSolanaTransactionResponse>
|
|
67
|
+
fund(chainId: string, params: FundParams): Promise<FundResponse>
|
|
65
68
|
getBackupSharesMetadata(chainId?: string): Promise<BackupSharePairMetadata[]>
|
|
66
69
|
getBalances(chainId?: string): Promise<Balance[]>
|
|
67
70
|
getClient(): Promise<ClientResponse>
|
package/src/events/index.ts
CHANGED
package/src/version/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "4.1.
|
|
1
|
+
{ "version": "4.1.2" }
|