edge-currency-plugins 3.8.0 → 3.8.1
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/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +21 -21
- package/lib/common/plugin/CurrencyTools.js +10 -1
- package/lib/common/plugin/types.js +8 -0
- package/lib/common/utxobased/engine/UtxoWalletTools.js +2 -1
- package/lib/common/utxobased/info/bitcoincash.js +1 -1
- package/lib/common/utxobased/info/ecash.js +6 -4
- package/lib/common/utxobased/keymanager/keymanager.js +9 -4
- package/lib/src/common/plugin/types.d.ts +7 -0
- package/lib/src/common/utxobased/keymanager/keymanager.d.ts +1 -0
- package/lib/test/common/plugin/CurrencyPlugin.fixtures/currencies/ecash.d.ts +2 -0
- package/package.json +1 -1
|
@@ -169,11 +169,20 @@ var _utils3 = require('./utils');
|
|
|
169
169
|
obj,
|
|
170
170
|
_customTokens
|
|
171
171
|
) {
|
|
172
|
-
|
|
172
|
+
let publicAddress = obj.publicAddress
|
|
173
173
|
if (publicAddress === '') {
|
|
174
174
|
throw new Error('InvalidPublicAddressError')
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
// Remove any cashaddr prefixes from the public address if they exist.
|
|
178
|
+
if (
|
|
179
|
+
_optionalChain([coinInfo, 'access', _7 => _7.prefixes, 'access', _8 => _8.cashaddr, 'optionalAccess', _9 => _9.some, 'call', _10 => _10(prefix =>
|
|
180
|
+
publicAddress.startsWith(`${prefix}:`)
|
|
181
|
+
)]) === true
|
|
182
|
+
) {
|
|
183
|
+
publicAddress = publicAddress.split(':')[1]
|
|
184
|
+
}
|
|
185
|
+
|
|
177
186
|
// TODO: validate network address
|
|
178
187
|
|
|
179
188
|
const query = []
|
|
@@ -190,7 +190,8 @@ var _utils = require('./utils');
|
|
|
190
190
|
return _keymanager.scriptPubkeyToAddress.call(void 0, {
|
|
191
191
|
scriptPubkey: args.scriptPubkey,
|
|
192
192
|
addressType,
|
|
193
|
-
coin
|
|
193
|
+
coin,
|
|
194
|
+
includeCashaddrPrefix: pluginInfo.coinInfo.includeCashaddrPrefix
|
|
194
195
|
})
|
|
195
196
|
},
|
|
196
197
|
|
|
@@ -62,7 +62,7 @@ const engineInfo = {
|
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
formats: ['bip44', 'bip32'],
|
|
65
|
-
forks: [], // 'bitcoinsv' is currently disabled, so not included in the forks
|
|
65
|
+
forks: ['ecash'], // 'bitcoinsv' is currently disabled, so not included in the forks
|
|
66
66
|
gapLimit: 10,
|
|
67
67
|
feeUpdateInterval: 60000,
|
|
68
68
|
defaultFeeInfo: {
|
|
@@ -21,8 +21,8 @@ const currencyInfo = {
|
|
|
21
21
|
|
|
22
22
|
// Explorers:
|
|
23
23
|
blockExplorer: 'https://blockchair.com/ecash/block/%s',
|
|
24
|
-
addressExplorer: 'https://
|
|
25
|
-
transactionExplorer: 'https://
|
|
24
|
+
addressExplorer: 'https://blockchair.com/ecash/address/%s',
|
|
25
|
+
transactionExplorer: 'https://blockchair.com/ecash/tx/%s',
|
|
26
26
|
|
|
27
27
|
denominations: [
|
|
28
28
|
{ name: 'XEC', multiplier: '100', symbol: 'e' },
|
|
@@ -65,9 +65,10 @@ const engineInfo = {
|
|
|
65
65
|
},
|
|
66
66
|
asBlockbookAddress: _cleaners.asCodec.call(void 0,
|
|
67
67
|
raw => {
|
|
68
|
-
|
|
68
|
+
const address = _cleaners.asString.call(void 0, raw)
|
|
69
|
+
return address.startsWith('ecash:') ? address.split(':')[1] : address
|
|
69
70
|
},
|
|
70
|
-
address => `ecash:${address}`
|
|
71
|
+
address => (address.startsWith('ecash:') ? address : `ecash:${address}`)
|
|
71
72
|
)
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -76,6 +77,7 @@ const engineInfo = {
|
|
|
76
77
|
segwit: false,
|
|
77
78
|
sighash: _altcoinjs.Psbt.BCH_SIGHASH_ALL,
|
|
78
79
|
coinType: 899,
|
|
80
|
+
includeCashaddrPrefix: true,
|
|
79
81
|
|
|
80
82
|
prefixes: {
|
|
81
83
|
messagePrefix: ['\x18Bitcoin Signed Message::\n'],
|
|
@@ -271,6 +271,7 @@ var VerifyAddressEnum; (function (VerifyAddressEnum) {
|
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
274
|
+
|
|
274
275
|
|
|
275
276
|
|
|
276
277
|
function bip43PurposeNumberToTypeEnum(
|
|
@@ -612,7 +613,8 @@ const addressToScriptPubkeyInternal = (
|
|
|
612
613
|
coin: args.coin
|
|
613
614
|
}),
|
|
614
615
|
_cashAddress.CashaddrTypeEnum.pubkeyhash,
|
|
615
|
-
standardPrefixes.cashaddr
|
|
616
|
+
standardPrefixes.cashaddr,
|
|
617
|
+
args.includeCashaddrPrefix
|
|
616
618
|
)
|
|
617
619
|
}
|
|
618
620
|
if (legacyPrefixes.cashaddr != null) {
|
|
@@ -623,7 +625,8 @@ const addressToScriptPubkeyInternal = (
|
|
|
623
625
|
coin: args.coin
|
|
624
626
|
}),
|
|
625
627
|
_cashAddress.CashaddrTypeEnum.pubkeyhash,
|
|
626
|
-
legacyPrefixes.cashaddr
|
|
628
|
+
legacyPrefixes.cashaddr,
|
|
629
|
+
args.includeCashaddrPrefix
|
|
627
630
|
)
|
|
628
631
|
}
|
|
629
632
|
payment = _altcoinjs.payments.p2pkh
|
|
@@ -637,7 +640,8 @@ const addressToScriptPubkeyInternal = (
|
|
|
637
640
|
coin: args.coin
|
|
638
641
|
}),
|
|
639
642
|
_cashAddress.CashaddrTypeEnum.scripthash,
|
|
640
|
-
standardPrefixes.cashaddr
|
|
643
|
+
standardPrefixes.cashaddr,
|
|
644
|
+
args.includeCashaddrPrefix
|
|
641
645
|
)
|
|
642
646
|
}
|
|
643
647
|
if (legacyPrefixes.cashaddr != null) {
|
|
@@ -648,7 +652,8 @@ const addressToScriptPubkeyInternal = (
|
|
|
648
652
|
coin: args.coin
|
|
649
653
|
}),
|
|
650
654
|
_cashAddress.CashaddrTypeEnum.scripthash,
|
|
651
|
-
legacyPrefixes.cashaddr
|
|
655
|
+
legacyPrefixes.cashaddr,
|
|
656
|
+
args.includeCashaddrPrefix
|
|
652
657
|
)
|
|
653
658
|
}
|
|
654
659
|
payment = _altcoinjs.payments.p2sh
|
|
@@ -142,6 +142,13 @@ export interface CoinInfo {
|
|
|
142
142
|
* addresses.
|
|
143
143
|
*/
|
|
144
144
|
coinType: number;
|
|
145
|
+
/**
|
|
146
|
+
* Whether the currency should include its cashaddr prefix in the formatted
|
|
147
|
+
* addresses.
|
|
148
|
+
*
|
|
149
|
+
* Defaults to `false`.
|
|
150
|
+
*/
|
|
151
|
+
includeCashaddrPrefix?: boolean;
|
|
145
152
|
/**
|
|
146
153
|
* Optional sighash value to be passed to AltcoinJS as the sighashType field
|
|
147
154
|
* on inputs. This is primarily used by currencies that leverage it as
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-plugins",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.1",
|
|
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",
|