@pioneer-platform/pioneer-coins 8.1.78 → 8.1.80
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/address.d.ts +1 -1
- package/lib/address.js +15 -6
- package/lib/coins.d.ts +1 -0
- package/lib/coins.js +39 -2
- package/lib/paths.js +2 -2
- package/package.json +1 -1
package/lib/address.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const addressInfoForCoin: (symbol: string, isTestnet?: boolean, scriptType?: string) => any;
|
|
1
|
+
export declare const addressInfoForCoin: (symbol: string, isTestnet?: boolean, scriptType?: string, showDisplay?: boolean) => any;
|
package/lib/address.js
CHANGED
|
@@ -8,8 +8,17 @@ exports.addressInfoForCoin = void 0;
|
|
|
8
8
|
var log = require('@pioneer-platform/loggerdog')();
|
|
9
9
|
var paths_1 = require("./paths");
|
|
10
10
|
var coins_1 = require("./coins");
|
|
11
|
-
var addressInfoForCoin = function (symbol, isTestnet, scriptType) {
|
|
11
|
+
var addressInfoForCoin = function (symbol, isTestnet, scriptType, showDisplay) {
|
|
12
|
+
if (!isTestnet)
|
|
13
|
+
isTestnet = false;
|
|
14
|
+
if (!showDisplay)
|
|
15
|
+
showDisplay = false;
|
|
12
16
|
var paths = (0, paths_1.getPaths)(paths_1.blockchains);
|
|
17
|
+
//thorswap hack
|
|
18
|
+
if (symbol === "THOR")
|
|
19
|
+
symbol = "RUNE";
|
|
20
|
+
if (symbol === "GAIA")
|
|
21
|
+
symbol = "ATOM";
|
|
13
22
|
log.info('paths', paths);
|
|
14
23
|
symbol = symbol.toUpperCase();
|
|
15
24
|
var blockchainEntry = paths.find(function (entry) { return entry.symbol === symbol.toUpperCase(); });
|
|
@@ -18,14 +27,14 @@ var addressInfoForCoin = function (symbol, isTestnet, scriptType) {
|
|
|
18
27
|
}
|
|
19
28
|
//validate script type options
|
|
20
29
|
var addressInfo = {
|
|
21
|
-
|
|
30
|
+
address_n: blockchainEntry.addressNListMaster,
|
|
22
31
|
coin: coins_1.COIN_MAP_KEEPKEY_LONG[symbol.toUpperCase()],
|
|
23
|
-
|
|
32
|
+
script_type: blockchainEntry.script_type,
|
|
24
33
|
showDisplay: blockchainEntry.showDisplay
|
|
25
34
|
};
|
|
26
|
-
if (isTestnet && blockchainEntry.testnet) {
|
|
27
|
-
|
|
28
|
-
}
|
|
35
|
+
// if (isTestnet && blockchainEntry.testnet) {
|
|
36
|
+
// addressInfo.addressNList[1] += 1; // Incrementing the account index for testnet
|
|
37
|
+
// }
|
|
29
38
|
return addressInfo;
|
|
30
39
|
};
|
|
31
40
|
exports.addressInfoForCoin = addressInfoForCoin;
|
package/lib/coins.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const getRangoBlockchainName: (blockchain: string) => string | undefined;
|
|
2
|
+
export declare const getThorswapBlockchainName: (blockchain: string) => string | undefined;
|
|
2
3
|
export declare const getSwapProtocals: (asset: string, network: string) => string[] | undefined;
|
|
3
4
|
export declare const parseThorchainAssetString: (input: string) => {
|
|
4
5
|
asset: string;
|
package/lib/coins.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.xpubConvert = exports.getExplorerTxUrl = exports.needsMemoByNetwork = exports.getExplorerAddressUrl = exports.getExplorerUrl = exports.segwitCoins = exports.stakingCoins = exports.baseAmountToNative = exports.nativeToBaseAmount = exports.getPrecision = exports.CURRENCY_DECIMALS = exports.PoSchains = exports.COIN_ICONS_BY_SYMBOL = exports.supportedAssets = exports.supportedBlockchains = exports.getNativeAssetForBlockchain = exports.addressNListToBIP32 = exports.bip32ToAddressNList = exports.bip32Like = exports.GET_NETWORK_NAME = exports.SLIP_44_BY_LONG = exports.COIN_MAP_KEEPKEY_LONG = exports.COIN_MAP_LONG_XCHAIN = exports.COIN_MAP_LONG = exports.COIN_MAP = exports.UTXO_COINS = exports.HDWALLETS = exports.parseThorchainAssetString = exports.getSwapProtocals = exports.getRangoBlockchainName = void 0;
|
|
3
|
+
exports.xpubConvert = exports.getExplorerTxUrl = exports.needsMemoByNetwork = exports.getExplorerAddressUrl = exports.getExplorerUrl = exports.segwitCoins = exports.stakingCoins = exports.baseAmountToNative = exports.nativeToBaseAmount = exports.getPrecision = exports.CURRENCY_DECIMALS = exports.PoSchains = exports.COIN_ICONS_BY_SYMBOL = exports.supportedAssets = exports.supportedBlockchains = exports.getNativeAssetForBlockchain = exports.addressNListToBIP32 = exports.bip32ToAddressNList = exports.bip32Like = exports.GET_NETWORK_NAME = exports.SLIP_44_BY_LONG = exports.COIN_MAP_KEEPKEY_LONG = exports.COIN_MAP_LONG_XCHAIN = exports.COIN_MAP_LONG = exports.COIN_MAP = exports.UTXO_COINS = exports.HDWALLETS = exports.parseThorchainAssetString = exports.getSwapProtocals = exports.getThorswapBlockchainName = exports.getRangoBlockchainName = void 0;
|
|
4
4
|
var TAG = " | coin tools | ";
|
|
5
5
|
var log = require('@pioneer-platform/loggerdog')();
|
|
6
6
|
// const bitcoin = require("bitcoinjs-lib");
|
|
@@ -55,6 +55,41 @@ var getRangoBlockchainName = function (blockchain) {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
exports.getRangoBlockchainName = getRangoBlockchainName;
|
|
58
|
+
var getThorswapBlockchainName = function (blockchain) {
|
|
59
|
+
try {
|
|
60
|
+
var rangoName = void 0;
|
|
61
|
+
switch (blockchain) {
|
|
62
|
+
case "bitcoin":
|
|
63
|
+
rangoName = "BTC";
|
|
64
|
+
break;
|
|
65
|
+
case "bitcoincash":
|
|
66
|
+
rangoName = "BCH";
|
|
67
|
+
break;
|
|
68
|
+
case "avalanche":
|
|
69
|
+
rangoName = "AVAX_CCHAIN";
|
|
70
|
+
break;
|
|
71
|
+
case "ethereum":
|
|
72
|
+
rangoName = "ETH";
|
|
73
|
+
break;
|
|
74
|
+
case "cosmos":
|
|
75
|
+
rangoName = "COSMOS";
|
|
76
|
+
break;
|
|
77
|
+
case "thorchain":
|
|
78
|
+
rangoName = "THOR";
|
|
79
|
+
break;
|
|
80
|
+
case "osmosis":
|
|
81
|
+
rangoName = "OSMOSIS";
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
throw Error("Unknown rango name for blockchain" + blockchain);
|
|
85
|
+
}
|
|
86
|
+
return rangoName;
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
log.error(e);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.getThorswapBlockchainName = getThorswapBlockchainName;
|
|
58
93
|
/*
|
|
59
94
|
Swap protocals
|
|
60
95
|
|
|
@@ -198,7 +233,8 @@ exports.COIN_MAP_LONG_XCHAIN = {
|
|
|
198
233
|
};
|
|
199
234
|
exports.COIN_MAP_KEEPKEY_LONG = {
|
|
200
235
|
BTC: "Bitcoin",
|
|
201
|
-
ATOM: "
|
|
236
|
+
ATOM: "Cosmos",
|
|
237
|
+
GAIA: "Cosmos",
|
|
202
238
|
OSMO: "osmosis",
|
|
203
239
|
BTCT: "testnet",
|
|
204
240
|
BCH: "BitcoinCash",
|
|
@@ -207,6 +243,7 @@ exports.COIN_MAP_KEEPKEY_LONG = {
|
|
|
207
243
|
DGB: "DigiByte",
|
|
208
244
|
DOGE: "Dogecoin",
|
|
209
245
|
RUNE: "Thorchain",
|
|
246
|
+
THOR: "Thorchain",
|
|
210
247
|
ETH: "Ethereum",
|
|
211
248
|
ADA: "Cardano",
|
|
212
249
|
BNB: "Binance",
|
package/lib/paths.js
CHANGED
|
@@ -132,8 +132,8 @@ function getPaths(blockchains, isTestnet) {
|
|
|
132
132
|
var entry = {
|
|
133
133
|
note: " Default ATOM path ",
|
|
134
134
|
type: "address",
|
|
135
|
-
script_type: "
|
|
136
|
-
available_scripts_types: ['
|
|
135
|
+
script_type: "cosmos",
|
|
136
|
+
available_scripts_types: ['cosmos'],
|
|
137
137
|
addressNList: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
|
|
138
138
|
addressNListMaster: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
|
|
139
139
|
curve: 'secp256k1',
|