@pioneer-platform/pioneer-coins 9.2.1 → 9.2.3

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/coins.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export declare const getRangoBlockchainName: (blockchain: string) => string | undefined;
2
- export declare const getThorswapBlockchainName: (blockchain: string) => string | undefined;
3
2
  export declare const getSwapProtocals: (asset: string, network: string) => string[] | undefined;
4
3
  export declare const parseThorchainAssetString: (input: string) => {
5
4
  asset: string;
@@ -36,6 +35,7 @@ export declare const COIN_MAP: {
36
35
  binance: string;
37
36
  thorchain: string;
38
37
  eos: string;
38
+ ripple: string;
39
39
  fio: string;
40
40
  };
41
41
  export declare const COIN_MAP_LONG: {
@@ -61,6 +61,7 @@ export declare const COIN_MAP_LONG: {
61
61
  MATIC: string;
62
62
  BNB: string;
63
63
  EOS: string;
64
+ XRP: string;
64
65
  FIO: string;
65
66
  };
66
67
  export declare const COIN_MAP_LONG_XCHAIN: {
package/lib/coins.js CHANGED
@@ -1,17 +1,16 @@
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.THORCHAIN_NETWORKS = exports.HDWALLETS = exports.parseThorchainAssetString = exports.getSwapProtocals = exports.getThorswapBlockchainName = 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.THORCHAIN_NETWORKS = exports.HDWALLETS = exports.parseThorchainAssetString = exports.getSwapProtocals = 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");
7
7
  // const ethUtils = require('ethereumjs-util');
8
- var ripemd160 = require("crypto-js/ripemd160");
9
- var CryptoJS = require("crypto-js");
10
- var sha256 = require("crypto-js/sha256");
11
- var bech32 = require("bech32");
8
+ // const ripemd160 = require("crypto-js/ripemd160")
9
+ // const CryptoJS = require("crypto-js")
10
+ // const sha256 = require("crypto-js/sha256")
11
+ // const bech32 = require(`bech32`)
12
12
  //import BigNumber from 'bignumber.js'
13
13
  var b58 = require('bs58check');
14
- var getPaths = require('./paths').getPaths;
15
14
  /*
16
15
  Rango Blockchain naming conventions
17
16
  bitcoin -> BTC
@@ -55,41 +54,6 @@ var getRangoBlockchainName = function (blockchain) {
55
54
  }
56
55
  };
57
56
  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;
93
57
  /*
94
58
  Swap protocals
95
59
 
@@ -249,6 +213,7 @@ exports.COIN_MAP = {
249
213
  binance: "BNB",
250
214
  thorchain: "RUNE",
251
215
  eos: "EOS",
216
+ ripple: "XRP",
252
217
  fio: "FIO",
253
218
  };
254
219
  exports.COIN_MAP_LONG = {
@@ -274,6 +239,7 @@ exports.COIN_MAP_LONG = {
274
239
  MATIC: "polygon",
275
240
  BNB: "binance",
276
241
  EOS: "eos",
242
+ XRP: "ripple",
277
243
  FIO: "fio",
278
244
  };
279
245
  exports.COIN_MAP_LONG_XCHAIN = {
@@ -794,18 +760,6 @@ function getExplorerTxUrl(network, txid, testnet) {
794
760
  }
795
761
  }
796
762
  exports.getExplorerTxUrl = getExplorerTxUrl;
797
- function bech32ify(address, prefix) {
798
- var words = bech32.toWords(address);
799
- return bech32.encode(prefix, words);
800
- }
801
- // NOTE: this only works with a compressed public key (33 bytes)
802
- function createBech32Address(publicKey, prefix) {
803
- var message = CryptoJS.enc.Hex.parse(publicKey.toString("hex"));
804
- var hash = ripemd160(sha256(message)).toString();
805
- var address = Buffer.from(hash, "hex");
806
- var cosmosAddress = bech32ify(address, prefix);
807
- return cosmosAddress;
808
- }
809
763
  // All known xpub formats
810
764
  var prefixes = new Map([
811
765
  ['xpub', '0488b21e'],
@@ -837,215 +791,3 @@ function xpubConvert(xpub, target) {
837
791
  return b58.encode(data);
838
792
  }
839
793
  exports.xpubConvert = xpubConvert;
840
- // export async function normalize_pubkeys(format:string,pubkeys:any,pathsIn:any, isTestnet?:boolean) {
841
- // let tag = TAG + " | normalize_pubkeys | "
842
- // try {
843
- // log.debug(tag,"input: ",{format,pubkeys,pathsIn,isTestnet})
844
- // if(!isTestnet) isTestnet = false
845
- //
846
- // if(pathsIn.length !== pubkeys.length){
847
- // log.error(tag,"pubkeys: ",pubkeys.length)
848
- // log.error(tag,"pathsIn: ",pathsIn.length)
849
- // throw Error("102: invalid input, paths dont match!")
850
- // }
851
- //
852
- // let output:any = []
853
- // if(format === 'keepkey'){
854
- // for(let i = 0; i < pubkeys.length; i++){
855
- // let pubkey:any = pathsIn[i]
856
- // log.debug(tag,"pubkey: ",pubkey)
857
- // let normalized:any = {}
858
- // normalized.path = addressNListToBIP32(pathsIn[i].addressNList)
859
- // normalized.pathMaster = addressNListToBIP32(pathsIn[i].addressNListMaster)
860
- //
861
- // log.debug(tag,"pubkey: ",pubkey)
862
- // normalized.source = format
863
- // if(pubkey.type === 'xpub'){
864
- // normalized.type = 'xpub'
865
- // normalized.xpub = true
866
- // normalized.pubkey = pubkeys[i].xpub
867
- // pubkey.pubkey = pubkeys[i].xpub
868
- // }
869
- // if(pubkey.type === 'zpub'){
870
- // normalized.type = 'zpub'
871
- // normalized.zpub = true
872
- // //convert to zpub
873
- // let zpub = await xpubConvert(pubkeys[i].xpub,'zpub')
874
- // normalized.pubkey = zpub
875
- // pubkey.pubkey = zpub
876
- // }
877
- // //TODO get this from supported coins? DRY
878
- // if(pubkey.symbol === 'ETH' || pubkey.symbol === 'RUNE' || pubkey.symbol === 'BNB' || pubkey.symbol === 'ATOM' || pubkey.symbol === 'OSMO'){
879
- // pubkey.pubkey = pubkeys[i].xpub
880
- // }
881
- // normalized.note = pubkey.note
882
- // normalized.symbol = pubkey.symbol
883
- // normalized.blockchain = COIN_MAP_LONG[pubkey.symbol]
884
- // normalized.network = COIN_MAP_LONG[pubkey.symbol]
885
- // //normalized.path = addressNListToBIP32(pubkey.addressNList)
886
- //
887
- // //get master address
888
- // let address = await get_address_from_xpub(pubkey.pubkey,pubkey.script_type,pubkey.symbol,0,0,false)
889
- // if(!address){
890
- // log.error("Failed to get address for pubkey: ",pubkey)
891
- // throw Error("address master required for valid pubkey")
892
- // }
893
- // normalized.script_type = pubkey.script_type //TODO select script type?
894
- // if(pubkey.symbol === 'ETH' || pubkey.symbol === 'RUNE' || pubkey.symbol === 'BNB' || pubkey.symbol === 'ATOM' || pubkey.symbol === 'OSMO'){
895
- // normalized.type = "address"
896
- // normalized.pubkey = address
897
- // }
898
- // if(isTestnet && pubkey.symbol === 'BTC'){
899
- // //tpub
900
- // normalized.tpub = await xpubConvert(pubkey.xpub,'tpub')
901
- // }
902
- // normalized.master = address
903
- // normalized.address = address
904
- //
905
- // output.push(normalized)
906
- // }
907
- //
908
- // } else {
909
- // throw Error(" unknown format! ")
910
- // }
911
- //
912
- // return output
913
- // } catch (e) {
914
- // log.error(tag, "e: ", e)
915
- // throw e
916
- // }
917
- // }
918
- // export async function get_address_from_xpub(xpub:string,scriptType:string,coin:string,account:number,index:number,isChange:boolean, isTestnet?:boolean) {
919
- // let tag = TAG + " | get_address_from_xpub | "
920
- // try {
921
- // let output
922
- // log.debug(tag,"Input: ",{xpub,scriptType,coin,account,index,isChange,isTestnet})
923
- // //if xpub get next unused
924
- // if(!xpub) throw Error("xpub required! coin:"+coin)
925
- // console.log("CHECKPOINT")
926
- // //TODO is clone?
927
- // //get pubkey at path
928
- // let publicKey
929
- // if(coin !== 'BTC'){
930
- // publicKey = bitcoin.bip32.fromBase58(xpub).derive(account).derive(index).publicKey
931
- // }
932
- //
933
- // let response:any
934
- // switch(coin) {
935
- // case 'BTC':
936
- // //TODO more types
937
- // console.log("CHECKPOINT1")
938
- // if(scriptType === 'bech32' || scriptType === 'p2wpkh'){
939
- // if(xpub[0] !== 'z') throw Error("103: not a Zpub")
940
- // let account0 = new BIP84.fromZPub(xpub)
941
- // output = account0.getAddress(0)
942
- // } else if(scriptType === 'legacy' || 'p2pkh'){
943
- // publicKey = bitcoin.bip32.fromBase58(xpub).derive(account).derive(index).publicKey
944
- // publicKey = publicKey.toString(`hex`)
945
- // const { address } = bitcoin.payments.p2pkh({
946
- // pubkey: Buffer.from(publicKey,'hex'),
947
- // network: NETWORKS[coin.toLowerCase()]
948
- // });
949
- // output = address
950
- // }
951
- // console.log("CHECKPOINT2 : ",output)
952
- // break;
953
- // case 'BCH':
954
- // publicKey = publicKey.toString(`hex`)
955
- // response = bitcoin.payments.p2pkh({
956
- // pubkey: Buffer.from(publicKey,'hex'),
957
- // network: NETWORKS[coin.toLowerCase()]
958
- // })
959
- // output = response.address
960
- // break;
961
- // case 'DOGE':
962
- // publicKey = publicKey.toString(`hex`)
963
- // response = bitcoin.payments.p2pkh({
964
- // pubkey: Buffer.from(publicKey,'hex'),
965
- // network: NETWORKS[coin.toLowerCase()]
966
- // })
967
- // output = response.address
968
- // break;
969
- // case 'DASH':
970
- // publicKey = publicKey.toString(`hex`)
971
- // response = bitcoin.payments.p2pkh({
972
- // pubkey: Buffer.from(publicKey,'hex'),
973
- // network: NETWORKS[coin.toLowerCase()]
974
- // })
975
- // output = response.address
976
- // break;
977
- // case 'LTC':
978
- // publicKey = publicKey.toString(`hex`)
979
- // response = bitcoin.payments.p2pkh({
980
- // pubkey: Buffer.from(publicKey,'hex'),
981
- // network: NETWORKS[coin.toLowerCase()]
982
- // })
983
- // output = response.address
984
- // break;
985
- // case 'ETH':
986
- // output = ethUtils.bufferToHex(ethUtils.pubToAddress(publicKey,true))
987
- // break;
988
- // case 'RUNE':
989
- // if(!isTestnet){
990
- // output = createBech32Address(publicKey,'thor')
991
- // } else {
992
- // output = createBech32Address(publicKey,'tthor')
993
- // }
994
- // break;
995
- // case 'ATOM':
996
- // output = createBech32Address(publicKey,'cosmos')
997
- // break;
998
- // case 'OSMO':
999
- // console.log("publicKey: ",publicKey.toString('hex'))
1000
- // let pubkeyOsmo = bitcoin.bip32.fromBase58(xpub).publicKey
1001
- // output = createBech32Address(pubkeyOsmo,'osmo')
1002
- // break;
1003
- // case 'BNB':
1004
- // log.debug("pubkey: ",publicKey)
1005
- // if(!isTestnet){
1006
- // output = createBech32Address(publicKey,'bnb')
1007
- // } else {
1008
- // output = createBech32Address(publicKey,'tbnb')
1009
- // }
1010
- // break;
1011
- // // case 'FIO':
1012
- // // log.debug(tag,"pubkey: ",publicKey)
1013
- // //
1014
- // // try{
1015
- // // //get accounts for pubkey
1016
- // // let account = networks['FIO'].getAccountsFromPubkey(publicKey)
1017
- // // log.debug(tag,"account: ",account)
1018
- // // }catch(e){
1019
- // // //no accounts
1020
- // // //return pubkey
1021
- // // output = {unregistered:true,pubkey:publicKey}
1022
- // // }
1023
- // //
1024
- // // break;
1025
- // // case 'EOS':
1026
- // // log.debug(tag,"pubkey: ",publicKey)
1027
- // //
1028
- // // try{
1029
- // // //get accounts for pubkey
1030
- // // let account = networks['EOS'].getAccountsFromPubkey(publicKey)
1031
- // // log.debug(tag,"account: ",account)
1032
- // // }catch(e){
1033
- // // //no accounts
1034
- // // //return pubkey
1035
- // // output = {unregistered:true,pubkey:publicKey}
1036
- // // }
1037
- // //
1038
- // // break;
1039
- // default:
1040
- // throw Error("coin not yet implemented ! coin: "+coin)
1041
- // // code block
1042
- // }
1043
- //
1044
- // log.debug(tag,"output: ",output)
1045
- //
1046
- //
1047
- // return output
1048
- // } catch (e) {
1049
- // log.error(tag, "e: ", e)
1050
- // }
1051
- // }
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "./paths";
2
2
  export * from "./coins";
3
- export * from "./pubkey";
4
3
  export * from "./address";
package/lib/index.js CHANGED
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./paths"), exports);
18
18
  __exportStar(require("./coins"), exports);
19
- __exportStar(require("./pubkey"), exports);
20
19
  __exportStar(require("./address"), exports);
package/lib/paths.js CHANGED
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPaths = exports.blockchains = void 0;
4
4
  var log = require('@pioneer-platform/loggerdog')();
5
5
  exports.blockchains = [
6
- 'eip155:42161',
7
- 'eip155:43114',
8
- 'eip155:56',
6
+ // 'eip155:42161',
7
+ // 'eip155:43114',
8
+ // 'eip155:56',
9
9
  'binance:bnb-beacon-chain',
10
10
  'bip122:000000000000000000651ef99cb9fcbe',
11
11
  'bip122:000000000019d6689c085ae165831e93',
12
- 'eip155:8453',
12
+ // 'eip155:8453',
13
13
  'cosmos:cosmoshub-4',
14
14
  'bip122:dash-hash',
15
15
  'bip122:digibytes-hash',
@@ -19,9 +19,9 @@ exports.blockchains = [
19
19
  'eip155:1',
20
20
  'bip122:12a765e31ffd4059bada1e25190f6e98',
21
21
  'cosmos:maya-mainnet-v1',
22
- 'eip155:10',
22
+ // 'eip155:10',
23
23
  'cosmos:osmosis-1',
24
- 'eip155:137',
24
+ // 'eip155:137',
25
25
  'ripple:unknown',
26
26
  'cosmos:thorchain-mainnet-v1',
27
27
  'bip122:0000000000196a45'
@@ -39,7 +39,7 @@ function getPaths(blockchains, isTestnet) {
39
39
  symbol: 'BTC',
40
40
  symbolSwapKit: 'BTC',
41
41
  network: 'bip122:000000000019d6689c085ae165831e93',
42
- script_type: "p2wpkh",
42
+ script_type: "p2wpkh", //bech32
43
43
  available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'],
44
44
  type: "zpub",
45
45
  addressNList: [0x80000000 + 84, 0x80000000 + 1, 0x80000000 + 0],
@@ -72,7 +72,7 @@ function getPaths(blockchains, isTestnet) {
72
72
  symbol: 'BTC',
73
73
  symbolSwapKit: 'BTC',
74
74
  network: 'bip122:000000000019d6689c085ae165831e93',
75
- script_type: "p2wpkh",
75
+ script_type: "p2wpkh", //bech32
76
76
  available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'],
77
77
  type: "zpub",
78
78
  addressNList: [0x80000000 + 84, 0x80000000 + 0, 0x80000000 + 0],
@@ -94,32 +94,31 @@ function getPaths(blockchains, isTestnet) {
94
94
  addressNList: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0],
95
95
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0],
96
96
  curve: 'secp256k1',
97
- showDisplay: false,
97
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
98
98
  blockchain: 'ethereum'
99
99
  };
100
100
  if (isTestnet)
101
101
  entry.testnet = true;
102
102
  output.push(entry);
103
103
  }
104
- if (blockchains.indexOf('eip155:43114') >= 0) {
105
- var entry = {
106
- note: " AVAX primary (default)",
107
- symbol: 'AVAX',
108
- symbolSwapKit: 'AVAX',
109
- network: 'eip155:43114',
110
- script_type: "avalanche",
111
- available_scripts_types: ['avalanche'],
112
- type: "address",
113
- addressNList: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0],
114
- addressNListMaster: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0],
115
- curve: 'secp256k1',
116
- showDisplay: false,
117
- blockchain: 'avalanche'
118
- };
119
- if (isTestnet)
120
- entry.testnet = true;
121
- output.push(entry);
122
- }
104
+ // if(blockchains.indexOf('eip155:43114') >= 0){
105
+ // let entry:any = {
106
+ // note:" AVAX primary (default)",
107
+ // symbol: 'AVAX',
108
+ // symbolSwapKit: 'AVAX',
109
+ // network: 'eip155:43114',
110
+ // script_type:"avalanche",
111
+ // available_scripts_types:['avalanche'],
112
+ // type:"address",
113
+ // addressNList: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0],
114
+ // addressNListMaster: [0x80000000 + 44, 0x80000000 + 60, 0x80000000 + 0, 0, 0],
115
+ // curve: 'secp256k1',
116
+ // showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
117
+ // blockchain: 'avalanche'
118
+ // }
119
+ // if(isTestnet) entry.testnet = true
120
+ // output.push(entry)
121
+ // }
123
122
  if (blockchains.indexOf('cosmos:thorchain-mainnet-v1') >= 0) {
124
123
  var entry = {
125
124
  note: " Default RUNE path ",
@@ -128,7 +127,7 @@ function getPaths(blockchains, isTestnet) {
128
127
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 931, 0x80000000 + 0, 0, 0],
129
128
  curve: 'secp256k1',
130
129
  script_type: "thorchain",
131
- showDisplay: false,
130
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
132
131
  blockchain: 'thorchain',
133
132
  symbol: 'RUNE',
134
133
  symbolSwapKit: 'RUNE',
@@ -147,7 +146,7 @@ function getPaths(blockchains, isTestnet) {
147
146
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 931, 0x80000000 + 0, 0, 0],
148
147
  curve: 'secp256k1',
149
148
  script_type: "secret",
150
- showDisplay: false,
149
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
151
150
  blockchain: 'secret',
152
151
  symbol: 'SCRT',
153
152
  symbolSwapKit: 'SCRT',
@@ -167,7 +166,7 @@ function getPaths(blockchains, isTestnet) {
167
166
  addressNList: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
168
167
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
169
168
  curve: 'secp256k1',
170
- showDisplay: false,
169
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
171
170
  blockchain: 'cosmos',
172
171
  symbol: 'ATOM',
173
172
  symbolSwapKit: 'GAIA',
@@ -187,7 +186,7 @@ function getPaths(blockchains, isTestnet) {
187
186
  addressNList: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
188
187
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 118, 0x80000000 + 0, 0, 0],
189
188
  curve: 'secp256k1',
190
- showDisplay: false,
189
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
191
190
  blockchain: 'osmosis',
192
191
  symbol: 'OSMO',
193
192
  symbolSwapKit: 'OSMO',
@@ -207,7 +206,7 @@ function getPaths(blockchains, isTestnet) {
207
206
  addressNList: [0x80000000 + 44, 0x80000000 + 714, 0x80000000 + 0, 0, 0],
208
207
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 714, 0x80000000 + 0, 0, 0],
209
208
  curve: 'secp256k1',
210
- showDisplay: false,
209
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
211
210
  blockchain: 'binance',
212
211
  symbol: 'BNB',
213
212
  symbolSwapKit: 'BNB',
@@ -227,7 +226,7 @@ function getPaths(blockchains, isTestnet) {
227
226
  addressNList: [0x80000000 + 44, 0x80000000 + 145, 0x80000000 + 0],
228
227
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 145, 0x80000000 + 0, 0, 0],
229
228
  curve: 'secp256k1',
230
- showDisplay: false,
229
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
231
230
  blockchain: 'bitcoincash',
232
231
  symbol: 'BCH',
233
232
  symbolSwapKit: 'BCH',
@@ -247,7 +246,7 @@ function getPaths(blockchains, isTestnet) {
247
246
  addressNList: [0x80000000 + 44, 0x80000000 + 2, 0x80000000 + 0],
248
247
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 2, 0x80000000 + 0, 0, 0],
249
248
  curve: 'secp256k1',
250
- showDisplay: false,
249
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
251
250
  blockchain: 'litecoin',
252
251
  symbol: 'LTC',
253
252
  symbolSwapKit: 'LTC',
@@ -264,7 +263,7 @@ function getPaths(blockchains, isTestnet) {
264
263
  symbol: 'LTC',
265
264
  symbolSwapKit: 'LTC',
266
265
  network: 'bip122:12a765e31ffd4059bada1e25190f6e98',
267
- script_type: "p2wpkh",
266
+ script_type: "p2wpkh", //bech32
268
267
  available_scripts_types: ['p2pkh', 'p2sh', 'p2wpkh', 'p2sh-p2wpkh'],
269
268
  type: "zpub",
270
269
  addressNList: [0x80000000 + 84, 0x80000000 + 2, 0x80000000 + 0],
@@ -283,7 +282,7 @@ function getPaths(blockchains, isTestnet) {
283
282
  addressNList: [0x80000000 + 44, 0x80000000 + 3, 0x80000000 + 0],
284
283
  addressNListMaster: [0x80000000 + 44, 0x80000000 + 3, 0x80000000 + 0, 0, 0],
285
284
  curve: 'secp256k1',
286
- showDisplay: false,
285
+ showDisplay: false, // Not supported by TrezorConnect or Ledger, but KeepKey should do it
287
286
  blockchain: 'dogecoin',
288
287
  symbol: 'DOGE',
289
288
  symbolSwapKit: 'DOGE',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-coins",
3
- "version": "9.2.1",
3
+ "version": "9.2.3",
4
4
  "main": "./lib/index.js",
5
5
  "types": "./lib/main.d.ts",
6
6
  "_moduleAliases": {
@@ -15,20 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@pioneer-platform/loggerdog": "^8.3.1",
18
- "bech32": "^1.1.4",
19
- "bignumber.js": "^9.0.1",
20
- "bitcoin-regex": "^2.0.0",
21
- "bitcoincash-regex": "^1.1.8",
22
- "bs58check": "^3.0.1",
23
- "crypto-js": "^4.0.0",
24
- "dash-regex": "^1.0.10",
25
- "dogecoin-regex": "^1.0.9",
26
- "ethereum-regex": "^1.1.12",
27
- "ethereum-tx-decoder": "^3.0.0",
28
- "litecoin-regex": "^1.0.8",
29
- "monero-regex": "^1.0.8",
30
- "neo-regex": "^1.0.7",
31
- "ripple-regex": "^1.1.8"
18
+ "bignumber.js": "^9.0.1"
32
19
  },
33
20
  "devDependencies": {
34
21
  "@types/express": "^4.17.6",
@@ -36,5 +23,5 @@
36
23
  "nodemon": "^2.0.3",
37
24
  "typescript": "^5.0.2"
38
25
  },
39
- "gitHead": "bb1ba4da55a6b00c29e335c6680a591cf319ce6b"
26
+ "gitHead": "236e08840f2788576131840f6ed62e63dbe148ce"
40
27
  }
package/lib/pubkey.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function classifyPubkey(address: string): "BTC" | "ETH" | "BCH" | "LTC" | "DOGE" | "DASH" | "XRP" | "XMR" | "NEO" | "Cryptocurrency could not be detected";
package/lib/pubkey.js DELETED
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.classifyPubkey = void 0;
4
- /*
5
- classifyPubkey
6
- */
7
- var bitcoinRegex = require('bitcoin-regex');
8
- var ethereumRegex = require('ethereum-regex');
9
- var litecoinRegex = require('litecoin-regex');
10
- var dogecoinRegex = require('dogecoin-regex');
11
- var bitcoincashRegex = require('bitcoincash-regex');
12
- var dashRegex = require('dash-regex');
13
- var moneroRegex = require('monero-regex');
14
- var rippleRegex = require('ripple-regex');
15
- var neoRegex = require('neo-regex');
16
- function classifyPubkey(address) {
17
- if (bitcoinRegex({ exact: true }).test(address))
18
- return 'BTC';
19
- else if (ethereumRegex({ exact: true }).test(address))
20
- return 'ETH';
21
- else if (litecoinRegex({ exact: true }).test(address))
22
- return 'LTC';
23
- else if (dogecoinRegex({ exact: true }).test(address))
24
- return 'DOGE';
25
- else if (dashRegex({ exact: true }).test(address))
26
- return 'DASH';
27
- else if (moneroRegex({ exact: true }).test(address))
28
- return 'XMR';
29
- else if (rippleRegex({ exact: true }).test(address))
30
- return 'XRP';
31
- else if (bitcoincashRegex.format('cashaddr', { exact: true }).test(address))
32
- return 'BCH';
33
- else if (neoRegex({ exact: true }).test(address))
34
- return 'NEO';
35
- //Hacky, hard coded
36
- switch (address[0]) {
37
- //Dash multi-sig p2sh
38
- case "S":
39
- return 'DASH';
40
- break;
41
- //Doge multi-sig p2sh
42
- case "A":
43
- return 'DOGE';
44
- break;
45
- //Doge multi-sig p2sh
46
- case "9":
47
- return 'DOGE';
48
- break;
49
- }
50
- return 'Cryptocurrency could not be detected';
51
- }
52
- exports.classifyPubkey = classifyPubkey;