hive-keychain-commons 1.8.0 → 1.8.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/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './swaps/swap-api.interface';
|
|
|
11
11
|
export * from './swaps/swap.interface';
|
|
12
12
|
export * from './utils/assets.utils';
|
|
13
13
|
export * from './utils/crypto.utils';
|
|
14
|
+
export * from './utils/exchanges.utils';
|
|
14
15
|
export * from './utils/export-transactions.utils';
|
|
15
16
|
export * from './utils/format.utils';
|
|
16
17
|
export * from './utils/history-filters.utils';
|
package/lib/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __exportStar(require("./swaps/swap-api.interface"), exports);
|
|
|
28
28
|
__exportStar(require("./swaps/swap.interface"), exports);
|
|
29
29
|
__exportStar(require("./utils/assets.utils"), exports);
|
|
30
30
|
__exportStar(require("./utils/crypto.utils"), exports);
|
|
31
|
+
__exportStar(require("./utils/exchanges.utils"), exports);
|
|
31
32
|
__exportStar(require("./utils/export-transactions.utils"), exports);
|
|
32
33
|
__exportStar(require("./utils/format.utils"), exports);
|
|
33
34
|
__exportStar(require("./utils/history-filters.utils"), exports);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExchangesUtils = void 0;
|
|
4
|
+
const getExchanges = () => {
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
name: 'Binance',
|
|
8
|
+
image: 'binance',
|
|
9
|
+
link: 'https://www.binance.com/en/trade/HIVE_BTC',
|
|
10
|
+
username: 'bdhivesteem',
|
|
11
|
+
acceptedCoins: ['HIVE'],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'Upbit',
|
|
15
|
+
image: 'upbit',
|
|
16
|
+
link: 'https://id.upbit.com/exchange?code=CRIX.UPBIT.BTC-HIVE',
|
|
17
|
+
username: 'user.dunamu',
|
|
18
|
+
acceptedCoins: ['HIVE', 'HBD'],
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Gateio',
|
|
22
|
+
image: 'gateio',
|
|
23
|
+
link: 'https://www.gate.io/trade/HIVE_USDT',
|
|
24
|
+
username: 'gateiodeposit',
|
|
25
|
+
acceptedCoins: ['HIVE'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Huobi',
|
|
29
|
+
image: 'huobi',
|
|
30
|
+
link: 'https://www.huobi.com/en-us/exchange/hive_usdt/',
|
|
31
|
+
username: 'huobi-pro',
|
|
32
|
+
acceptedCoins: ['HIVE'],
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Mexc',
|
|
36
|
+
image: 'mexc',
|
|
37
|
+
link: 'https://www.mexc.com/exchange/HIVE_USDT',
|
|
38
|
+
username: 'mxchive',
|
|
39
|
+
acceptedCoins: ['HIVE'],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
};
|
|
43
|
+
exports.ExchangesUtils = {
|
|
44
|
+
getExchanges,
|
|
45
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Exchange } from '../interfaces/exchange';
|
|
2
1
|
export declare enum TransferWarning {
|
|
3
2
|
PRIVATE_KEY_IN_MEMO = "private_key_in_memo",
|
|
4
3
|
PHISHING = "phishing",
|
|
5
4
|
EXCHANGE_DEPOSIT = "exchange_deposit",
|
|
6
5
|
EXCHANGE_MEMO = "exchange_memo",
|
|
7
|
-
EXCHANGE_RECURRENT = "exchange_recurrent"
|
|
6
|
+
EXCHANGE_RECURRENT = "exchange_recurrent",
|
|
7
|
+
EXCHANGE_VSC = "EXCHANGE_VSC"
|
|
8
8
|
}
|
|
9
9
|
export declare const TransferUtils: {
|
|
10
|
-
getTransferWarning: (account: string,
|
|
10
|
+
getTransferWarning: (account: string, currency: string, memo: any, phisingAccounts: any, isRecurrent?: boolean, isOnVsc?: boolean) => TransferWarning | undefined;
|
|
11
11
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransferUtils = exports.TransferWarning = void 0;
|
|
4
4
|
const crypto_utils_1 = require("./crypto.utils");
|
|
5
|
+
const exchanges_utils_1 = require("./exchanges.utils");
|
|
5
6
|
const keys_utils_1 = require("./keys.utils");
|
|
6
7
|
var TransferWarning;
|
|
7
8
|
(function (TransferWarning) {
|
|
@@ -10,6 +11,7 @@ var TransferWarning;
|
|
|
10
11
|
TransferWarning["EXCHANGE_DEPOSIT"] = "exchange_deposit";
|
|
11
12
|
TransferWarning["EXCHANGE_MEMO"] = "exchange_memo";
|
|
12
13
|
TransferWarning["EXCHANGE_RECURRENT"] = "exchange_recurrent";
|
|
14
|
+
TransferWarning["EXCHANGE_VSC"] = "EXCHANGE_VSC";
|
|
13
15
|
})(TransferWarning = exports.TransferWarning || (exports.TransferWarning = {}));
|
|
14
16
|
const getPrivateKeysMemoValidationWarning = (memo) => {
|
|
15
17
|
const memoTemp = memo.startsWith('#')
|
|
@@ -30,8 +32,8 @@ const getPrivateKeysMemoValidationWarning = (memo) => {
|
|
|
30
32
|
}
|
|
31
33
|
return false;
|
|
32
34
|
};
|
|
33
|
-
const getTransferWarning = (account,
|
|
34
|
-
const exchangeWarning = getExchangeValidationWarning(account,
|
|
35
|
+
const getTransferWarning = (account, currency, memo, phisingAccounts, isRecurrent, isOnVsc) => {
|
|
36
|
+
const exchangeWarning = getExchangeValidationWarning(account, currency, memo.length > 0, isRecurrent, isOnVsc);
|
|
35
37
|
if (exchangeWarning)
|
|
36
38
|
return exchangeWarning;
|
|
37
39
|
const privateKeyInMemoWarning = getPrivateKeysMemoValidationWarning(memo);
|
|
@@ -44,10 +46,12 @@ const getTransferWarning = (account, exchanges, currency, memo, phisingAccounts,
|
|
|
44
46
|
}
|
|
45
47
|
return;
|
|
46
48
|
};
|
|
47
|
-
const getExchangeValidationWarning = (account,
|
|
48
|
-
const exchange =
|
|
49
|
+
const getExchangeValidationWarning = (account, currency, hasMemo, isRecurrent, isOnVsc) => {
|
|
50
|
+
const exchange = exchanges_utils_1.ExchangesUtils.getExchanges().find((exch) => exch.username === account);
|
|
49
51
|
if (!exchange)
|
|
50
52
|
return;
|
|
53
|
+
if (exchange && isOnVsc)
|
|
54
|
+
return TransferWarning.EXCHANGE_VSC;
|
|
51
55
|
if (!exchange.acceptedCoins.includes(currency)) {
|
|
52
56
|
// return chrome.i18n.getMessage('popup_warning_exchange_deposit', [currency]);
|
|
53
57
|
return TransferWarning.EXCHANGE_DEPOSIT;
|