edge-currency-plugins 3.6.1 → 3.7.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.
@@ -450,9 +450,8 @@ var _utils3 = require('./utils');
450
450
  },
451
451
 
452
452
  async broadcastTx(transaction) {
453
- const txId = await serverStates.broadcastTx(transaction)
454
-
455
- return txId
453
+ await serverStates.broadcastTx(transaction)
454
+ return transaction.txid
456
455
  },
457
456
  refillServers() {
458
457
  serverStates.refillServers()
@@ -14,6 +14,7 @@ var _eboost = require('./eboost'); _createNamedExportFrom(_eboost, 'eboost', 'in
14
14
  var _feathercoin = require('./feathercoin'); _createNamedExportFrom(_feathercoin, 'feathercoin', 'info');
15
15
  var _groestlcoin = require('./groestlcoin'); _createNamedExportFrom(_groestlcoin, 'groestlcoin', 'info');
16
16
  var _litecoin = require('./litecoin'); _createNamedExportFrom(_litecoin, 'litecoin', 'info');
17
+ var _pivx = require('./pivx'); _createNamedExportFrom(_pivx, 'pivx', 'info');
17
18
  var _qtum = require('./qtum'); _createNamedExportFrom(_qtum, 'qtum', 'info');
18
19
  var _ravencoin = require('./ravencoin'); _createNamedExportFrom(_ravencoin, 'ravencoin', 'info');
19
20
  var _smartcash = require('./smartcash'); _createNamedExportFrom(_smartcash, 'smartcash', 'info');
@@ -42,6 +43,7 @@ var _zcoin = require('./zcoin'); _createNamedExportFrom(_zcoin, 'zcoin', 'info')
42
43
 
43
44
 
44
45
 
46
+
45
47
 
46
48
 
47
49
  const all = [
@@ -61,6 +63,7 @@ var _zcoin = require('./zcoin'); _createNamedExportFrom(_zcoin, 'zcoin', 'info')
61
63
  _feathercoin.info,
62
64
  _groestlcoin.info,
63
65
  _litecoin.info,
66
+ _pivx.info,
64
67
  _qtum.info,
65
68
  _ravencoin.info,
66
69
  _smartcash.info,
@@ -0,0 +1,97 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+ var _maximumFeeRateCalculator = require('../../plugin/util/maximumFeeRateCalculator');
5
+
6
+
7
+
8
+
9
+ var _commonInfo = require('./commonInfo');
10
+
11
+ const currencyInfo = {
12
+ assetDisplayName: 'PIVX',
13
+ chainDisplayName: 'PIVX',
14
+ currencyCode: 'PIVX',
15
+ customFeeTemplate: _commonInfo.utxoCustomFeeTemplate,
16
+ memoOptions: _commonInfo.utxoMemoOptions,
17
+ pluginId: 'pivx',
18
+ walletType: 'wallet:pivx',
19
+
20
+ // Explorers:
21
+ addressExplorer: 'https://zkbitcoin.com/address/%s',
22
+ blockExplorer: 'https://zkbitcoin.com/block/%s',
23
+ transactionExplorer: 'https://zkbitcoin.com/tx/%s',
24
+
25
+ denominations: [
26
+ {
27
+ name: 'PIVX',
28
+ multiplier: '100000000',
29
+ symbol: 'Ᵽ'
30
+ }
31
+ ],
32
+
33
+ // Deprecated:
34
+ ..._commonInfo.legacyMemoInfo,
35
+ defaultSettings: {
36
+ customFeeSettings: ['satPerByte'],
37
+ blockbookServers: [
38
+ /* 'wss://pivx-eusa1.edge.app', */ 'wss://zkbitcoin.com'
39
+ ],
40
+ enableCustomServers: false
41
+ },
42
+ displayName: 'PIVX',
43
+ metaTokens: []
44
+ }
45
+
46
+ const engineInfo = {
47
+ serverConfigs: [
48
+ {
49
+ type: 'blockbook-nownode',
50
+ uris: ['https://btc-wusa1.edge.app']
51
+ },
52
+ {
53
+ type: 'blockbook-nownode',
54
+ uris: ['https://pivxbook.nownodes.io']
55
+ }
56
+ ],
57
+ formats: ['bip44', 'bip32'],
58
+ gapLimit: 10,
59
+ feeUpdateInterval: 60000,
60
+ defaultFeeInfo: {
61
+ lowFeeFudgeFactor: undefined,
62
+ standardFeeLowFudgeFactor: undefined,
63
+ standardFeeHighFudgeFactor: undefined,
64
+ highFeeFudgeFactor: undefined,
65
+
66
+ highFee: '200',
67
+ lowFee: '50',
68
+ standardFeeLow: '100',
69
+ standardFeeHigh: '150',
70
+ standardFeeLowAmount: '10000000',
71
+ standardFeeHighAmount: '100000000',
72
+ maximumFeeRate: _maximumFeeRateCalculator.maximumFeeRateCalculator.call(void 0, currencyInfo, 0.6)
73
+ }
74
+ }
75
+
76
+ const coinInfo = {
77
+ name: 'pivx',
78
+ segwit: false,
79
+ coinType: 119,
80
+ prefixes: {
81
+ /*
82
+ [Prefix reference](https://github.com/PIVX-Project/PIVX/blob/b89a9fc04e9e31bb3fd009df0506c957a00ad536/src/chainparams.cpp#L329)
83
+ */
84
+ messagePrefix: ['PIVX Signed Message:\n'],
85
+ wif: [0xd4],
86
+ legacyXPriv: [0x0221312b],
87
+ legacyXPub: [0x022d2533],
88
+ pubkeyHash: [0x1e],
89
+ scriptHash: [0x0d]
90
+ }
91
+ }; exports.coinInfo = coinInfo
92
+
93
+ const info = {
94
+ currencyInfo,
95
+ engineInfo,
96
+ coinInfo: exports.coinInfo
97
+ }; exports.info = info
@@ -32,19 +32,18 @@ var _types9 = require('./types');
32
32
  var _utxopicker = require('./utxopicker'); var utxopicker = _interopRequireWildcard(_utxopicker);
33
33
  var _utils = require('./utxopicker/utils'); var pickerUtils = _interopRequireWildcard(_utils);
34
34
 
35
- let ECPair
35
+ let ECPairCache
36
+ const getECPair = () => {
37
+ if (ECPairCache != null) return ECPairCache
36
38
 
37
- Promise.resolve().then(() => require('@bitcoin-js/tiny-secp256k1-asmjs'))
38
- .then(tinysecp => {
39
- _altcoinjs.initEccLib.call(void 0, tinysecp)
40
- ECPair = _ecpair.ECPairFactory.call(void 0, tinysecp)
41
- })
42
- .catch(error => {
43
- console.error(error)
44
- })
45
- .finally(() => {
46
- console.log('loaded ECPair!')
47
- })
39
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
40
+ const secp256k1 = require('@bitcoinerlab/secp256k1')
41
+ _altcoinjs.initEccLib.call(void 0, secp256k1)
42
+ ECPairCache = _ecpair.ECPairFactory.call(void 0, secp256k1)
43
+ console.log(`loaded ECPair!`)
44
+
45
+ return ECPairCache
46
+ }
48
47
 
49
48
  // in bitcoin these are bip44, bip49, bip84 xpub prefixes
50
49
  // other coins contain different formats which still need to be gathered.
@@ -885,6 +884,7 @@ const xprivToPrivateKeyInternal = (
885
884
  prefixIndex: 0
886
885
  })
887
886
  const coinClass = _coinmapper.getCoinFromString.call(void 0, args.coin)
887
+ const ECPair = getECPair()
888
888
  return ECPair.fromPrivateKey(Buffer.from(args.privateKey, 'hex'), {
889
889
  network
890
890
  }).toWIF(coinClass.wifEncodeFunc)
@@ -900,6 +900,7 @@ const wifToPrivateKeyEncodingInternal = (
900
900
  forWIF: true,
901
901
  prefixIndex
902
902
  })
903
+ const ECPair = getECPair()
903
904
  const ecPair = ECPair.fromWIF(args.wifKey, network, coin.bs58DecodeFunc)
904
905
  if (ecPair.privateKey == null) return
905
906
  return {
@@ -925,12 +926,14 @@ const wifToPrivateKeyEncodingInternal = (
925
926
  privateKeyEncoding
926
927
  ) {
927
928
  const { hex, compressed } = privateKeyEncoding
929
+ const ECPair = getECPair()
928
930
  return ECPair.fromPrivateKey(Buffer.from(hex, 'hex'), {
929
931
  compressed
930
932
  }).publicKey.toString('hex')
931
933
  } exports.privateKeyEncodingToPubkey = privateKeyEncodingToPubkey;
932
934
 
933
935
  function signMessageBase64(message, privateKey) {
936
+ const ECPair = getECPair()
934
937
  const keyPair = ECPair.fromPrivateKey(Buffer.from(privateKey, 'hex'))
935
938
  if (keyPair.privateKey == null) {
936
939
  throw new Error('Address could not sign message')
@@ -1119,6 +1122,7 @@ const wifToPrivateKeyEncodingInternal = (
1119
1122
  maximumFeeRate != null ? { maximumFeeRate: parseInt(maximumFeeRate) } : {}
1120
1123
  const psbt = _altcoinjs.Psbt.fromBase64(args.psbtBase64, opts)
1121
1124
  const coin = _coinmapper.getCoinFromString.call(void 0, args.coin)
1125
+ const ECPair = getECPair()
1122
1126
 
1123
1127
  const validator = (
1124
1128
  pubkey,
@@ -92,7 +92,7 @@ var _cleaners = require('cleaners');
92
92
  addresses: _cleaners.asOptional.call(void 0, _cleaners.asArray.call(void 0, _cleaners.asString), () => []),
93
93
  // `isAddress` is a boolean flag that indicates whether the input is an address.
94
94
  // And therefore has `addresses` field. If `isAddress` is false, then the input is likely a coinbase input.
95
- isAddress: _cleaners.asBoolean,
95
+ isAddress: _cleaners.asOptional.call(void 0, _cleaners.asBoolean),
96
96
  // This is the index of the input. Not to be confused with the index of the previous output (vout).
97
97
  n: _cleaners.asNumber,
98
98
  // Empirically observed omitted sequence is possible for when sequence is zero.
@@ -14,6 +14,7 @@ export { info as eboost } from './eboost';
14
14
  export { info as feathercoin } from './feathercoin';
15
15
  export { info as groestlcoin } from './groestlcoin';
16
16
  export { info as litecoin } from './litecoin';
17
+ export { info as pivx } from './pivx';
17
18
  export { info as qtum } from './qtum';
18
19
  export { info as ravencoin } from './ravencoin';
19
20
  export { info as smartcash } from './smartcash';
@@ -0,0 +1,3 @@
1
+ import { CoinInfo, PluginInfo } from '../../plugin/types';
2
+ export declare const coinInfo: CoinInfo;
3
+ export declare const info: PluginInfo;
@@ -28,7 +28,7 @@ export interface BlockbookTransaction {
28
28
  fees: string;
29
29
  vin: Array<{
30
30
  addresses: string[];
31
- isAddress: boolean;
31
+ isAddress?: boolean;
32
32
  n: number;
33
33
  sequence: number;
34
34
  txid?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "3.6.1",
3
+ "version": "3.7.0",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "homepage": "https://edge.app/",
6
6
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",
@@ -29,7 +29,7 @@
29
29
  "lib": "sucrase -q -t typescript,imports -d ./lib ./src",
30
30
  "lint": "eslint .",
31
31
  "precommit": "lint-staged && npm-run-all types test",
32
- "prepare": "husky install && npm-run-all clean lib types webpack",
32
+ "prepare": "husky install && patch-package && npm-run-all clean lib types webpack",
33
33
  "start": "webpack serve",
34
34
  "test": "mocha",
35
35
  "types": "tsc",
@@ -40,7 +40,7 @@
40
40
  "*.{js,ts,json}": "eslint"
41
41
  },
42
42
  "dependencies": {
43
- "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
43
+ "@bitcoinerlab/secp256k1": "^1.2.0",
44
44
  "altcoin-js": "^1.0.0",
45
45
  "async-mutex": "^0.2.6",
46
46
  "baselet": "^0.3.0",
@@ -109,6 +109,7 @@
109
109
  "npm-run-all": "^4.1.5",
110
110
  "nyc": "^15.1.0",
111
111
  "parcel": "^1.12.4",
112
+ "patch-package": "^8.0.0",
112
113
  "prettier": "^2.2.0",
113
114
  "request": "^2.88.2",
114
115
  "rimraf": "^3.0.2",