edge-currency-plugins 3.10.0 → 3.12.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.
- package/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +45 -44
- package/lib/common/plugin/CurrencyTools.js +10 -0
- package/lib/common/utxobased/engine/UtxoEngine.js +17 -4
- package/lib/common/utxobased/engine/UtxoWalletTools.js +15 -2
- package/lib/common/utxobased/engine/types.js +7 -1
- package/lib/common/utxobased/info/bitcoingold.js +1 -1
- package/lib/common/utxobased/info/bitcoingoldtestnet.js +1 -1
- package/lib/common/utxobased/info/dash.js +2 -1
- package/lib/common/utxobased/info/digibyte.js +1 -1
- package/lib/common/utxobased/info/dogecoin.js +1 -1
- package/lib/common/utxobased/info/ecash.js +1 -1
- package/lib/common/utxobased/info/feathercoin.js +1 -1
- package/lib/common/utxobased/info/litecoin.js +1 -1
- package/lib/common/utxobased/info/pivx.js +2 -1
- package/lib/common/utxobased/info/qtum.js +1 -1
- package/lib/common/utxobased/info/ravencoin.js +1 -1
- package/lib/common/utxobased/info/smartcash.js +1 -1
- package/lib/common/utxobased/info/ufo.js +1 -1
- package/lib/common/utxobased/info/vertcoin.js +1 -0
- package/lib/common/utxobased/info/zcoin.js +1 -1
- package/lib/common/utxobased/keymanager/keymanager.js +56 -2
- package/lib/common/utxobased/keymanager/types.js +28 -1
- package/lib/src/common/utxobased/engine/UtxoWalletTools.d.ts +2 -0
- package/lib/src/common/utxobased/engine/types.d.ts +1 -0
- package/lib/src/common/utxobased/keymanager/keymanager.d.ts +3 -2
- package/lib/src/common/utxobased/keymanager/types.d.ts +19 -0
- package/lib/test/common/utxobased/keymanager/coins/altcointestfixtures.d.ts +5 -0
- package/lib/test/common/utxobased/keymanager/messagePrefix.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -107,6 +107,16 @@ var _utils3 = require('./utils');
|
|
|
107
107
|
},
|
|
108
108
|
|
|
109
109
|
async parseUri(uri) {
|
|
110
|
+
// CashStamps and similar paper-wallet tools prefix a WIF private key with
|
|
111
|
+
// a "<code>-wif:" protohandler (e.g. "bch-wif:<WIF>"). Strip it so the
|
|
112
|
+
// bare WIF is handled by the private-key detection in parsePathname. The
|
|
113
|
+
// prefix is derived from the wallet's own currency code, so it can only
|
|
114
|
+
// ever match this coin.
|
|
115
|
+
const wifPrefix = `${currencyInfo.currencyCode.toLowerCase()}-wif:`
|
|
116
|
+
if (uri.toLowerCase().startsWith(wifPrefix)) {
|
|
117
|
+
uri = uri.slice(wifPrefix.length)
|
|
118
|
+
}
|
|
119
|
+
|
|
110
120
|
const isGateway = uri
|
|
111
121
|
.toLocaleLowerCase()
|
|
112
122
|
.startsWith(`${coinInfo.name}://`)
|
|
@@ -45,6 +45,9 @@ var _cleaners3 = require('../keymanager/cleaners');
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
var _keymanager = require('../keymanager/keymanager');
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
48
51
|
var _types5 = require('../keymanager/types');
|
|
49
52
|
var _utils = require('../keymanager/utxopicker/utils');
|
|
50
53
|
var _paymentRequest = require('./paymentRequest');
|
|
@@ -797,11 +800,20 @@ var _UtxoWalletTools = require('./UtxoWalletTools');
|
|
|
797
800
|
opts
|
|
798
801
|
) {
|
|
799
802
|
const otherParams = _types7.asUtxoSignMessageOtherParams.call(void 0, opts.otherParams)
|
|
800
|
-
const { publicAddress } = otherParams
|
|
801
|
-
|
|
803
|
+
const { publicAddress, signatureFormat } = otherParams
|
|
804
|
+
// An address the wallet cannot sign for reaches us two ways: it parses
|
|
805
|
+
// but is not ours, or it is not an address of this chain at all and
|
|
806
|
+
// `addressToScriptPubkey` throws. Both are the same thing to a caller,
|
|
807
|
+
// so give them one named error rather than assorted parser prose.
|
|
808
|
+
let scriptPubkey
|
|
809
|
+
try {
|
|
810
|
+
scriptPubkey = walletTools.addressToScriptPubkey(publicAddress)
|
|
811
|
+
} catch (e2) {
|
|
812
|
+
throw new (0, _types5.AddressNotOwnedError)()
|
|
813
|
+
}
|
|
802
814
|
const addressData = await dataLayer.fetchAddress(scriptPubkey)
|
|
803
815
|
if (_optionalChain([addressData, 'optionalAccess', _13 => _13.path]) == null) {
|
|
804
|
-
throw new
|
|
816
|
+
throw new (0, _types5.AddressNotOwnedError)()
|
|
805
817
|
}
|
|
806
818
|
const privateKey = asMaybeCurrencyPrivateKey(privateKeys)
|
|
807
819
|
|
|
@@ -818,7 +830,8 @@ var _UtxoWalletTools = require('./UtxoWalletTools');
|
|
|
818
830
|
const signature = await walletTools.signMessageBase64({
|
|
819
831
|
path: _optionalChain([addressData, 'optionalAccess', _14 => _14.path]),
|
|
820
832
|
message,
|
|
821
|
-
xprivKeys
|
|
833
|
+
xprivKeys,
|
|
834
|
+
signatureFormat
|
|
822
835
|
})
|
|
823
836
|
return signature
|
|
824
837
|
},
|
|
@@ -25,6 +25,7 @@ var _keymanager = require('../keymanager/keymanager');
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
|
|
28
29
|
var _utils = require('./utils');
|
|
29
30
|
|
|
30
31
|
|
|
@@ -92,6 +93,7 @@ var _utils = require('./utils');
|
|
|
92
93
|
|
|
93
94
|
|
|
94
95
|
|
|
96
|
+
|
|
95
97
|
|
|
96
98
|
|
|
97
99
|
function makeUtxoWalletTools(
|
|
@@ -236,12 +238,23 @@ var _utils = require('./utils');
|
|
|
236
238
|
return { address, scriptPubkey, redeemScript }
|
|
237
239
|
},
|
|
238
240
|
|
|
239
|
-
signMessageBase64({
|
|
241
|
+
signMessageBase64({
|
|
242
|
+
path,
|
|
243
|
+
message,
|
|
244
|
+
xprivKeys,
|
|
245
|
+
signatureFormat
|
|
246
|
+
}) {
|
|
240
247
|
const privKey = fns.getPrivateKey({
|
|
241
248
|
path,
|
|
242
249
|
xprivKeys
|
|
243
250
|
})
|
|
244
|
-
return _keymanager.signMessageBase64.call(void 0,
|
|
251
|
+
return _keymanager.signMessageBase64.call(void 0,
|
|
252
|
+
message,
|
|
253
|
+
privKey,
|
|
254
|
+
path.format,
|
|
255
|
+
coin,
|
|
256
|
+
signatureFormat
|
|
257
|
+
)
|
|
245
258
|
}
|
|
246
259
|
}
|
|
247
260
|
|
|
@@ -11,6 +11,7 @@ var _cleaners = require('cleaners');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _types3 = require('../../plugin/types');
|
|
14
|
+
var _types5 = require('../keymanager/types');
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
|
|
@@ -42,7 +43,12 @@ var _types3 = require('../../plugin/types');
|
|
|
42
43
|
|
|
43
44
|
|
|
44
45
|
const asUtxoSignMessageOtherParams = _cleaners.asObject.call(void 0, {
|
|
45
|
-
publicAddress: _cleaners.asString
|
|
46
|
+
publicAddress: _cleaners.asString,
|
|
47
|
+
// Defaults to the legacy Electrum encoding so existing callers keep the
|
|
48
|
+
// format they already produce. BIP-137 is opt-in, since emitting a BIP-137
|
|
49
|
+
// header to a verifier expecting the legacy one is just as broken as the
|
|
50
|
+
// reverse.
|
|
51
|
+
signatureFormat: _cleaners.asMaybe.call(void 0, _types5.asUtxoSignatureFormat, 'electrum')
|
|
46
52
|
}); exports.asUtxoSignMessageOtherParams = asUtxoSignMessageOtherParams
|
|
47
53
|
|
|
48
54
|
const asOutputSort = _cleaners.asValue.call(void 0, 'bip69', 'targets')
|
|
@@ -99,7 +99,8 @@ const engineInfo = {
|
|
|
99
99
|
segwit: false,
|
|
100
100
|
coinType: 5,
|
|
101
101
|
prefixes: {
|
|
102
|
-
|
|
102
|
+
// Dash kept its pre-rebrand DarkCoin magic; not a typo.
|
|
103
|
+
messagePrefix: ['\x19DarkCoin Signed Message:\n'],
|
|
103
104
|
wif: [0xcc],
|
|
104
105
|
legacyXPriv: [0x02fe52f8],
|
|
105
106
|
legacyXPub: [0x02fe52cc],
|
|
@@ -81,7 +81,7 @@ const engineInfo = {
|
|
|
81
81
|
coinType: 3,
|
|
82
82
|
utxoPicker: _dogeUtxoPicker.makeDogeUtxoPicker.call(void 0, ),
|
|
83
83
|
prefixes: {
|
|
84
|
-
messagePrefix: ['\
|
|
84
|
+
messagePrefix: ['\x19Dogecoin Signed Message:\n'],
|
|
85
85
|
wif: [0x9e],
|
|
86
86
|
legacyXPriv: [0x02fac398],
|
|
87
87
|
legacyXPub: [0x02facafd],
|
|
@@ -63,7 +63,7 @@ var _commonInfo = require('./commonInfo');
|
|
|
63
63
|
segwit: true,
|
|
64
64
|
coinType: 8,
|
|
65
65
|
prefixes: {
|
|
66
|
-
messagePrefix: ['\
|
|
66
|
+
messagePrefix: ['\x1cFeathercoin Signed Message:\n'],
|
|
67
67
|
wif: [0x8e],
|
|
68
68
|
legacyXPriv: [0x0488daee],
|
|
69
69
|
legacyXPub: [0x0488bc26],
|
|
@@ -83,7 +83,7 @@ var _commonInfo = require('./commonInfo');
|
|
|
83
83
|
segwit: true,
|
|
84
84
|
coinType: 2,
|
|
85
85
|
prefixes: {
|
|
86
|
-
messagePrefix: ['\
|
|
86
|
+
messagePrefix: ['\x19Litecoin Signed Message:\n'],
|
|
87
87
|
wif: [0xb0],
|
|
88
88
|
legacyXPriv: [0x0488ade4],
|
|
89
89
|
legacyXPub: [0x0488b21e],
|
|
@@ -79,7 +79,8 @@ const engineInfo = {
|
|
|
79
79
|
/*
|
|
80
80
|
[Prefix reference](https://github.com/PIVX-Project/PIVX/blob/b89a9fc04e9e31bb3fd009df0506c957a00ad536/src/chainparams.cpp#L329)
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
// PIVX inherited DarkNet from its Dash fork ancestry; not a typo.
|
|
83
|
+
messagePrefix: ['\x18DarkNet Signed Message:\n'],
|
|
83
84
|
wif: [0xd4],
|
|
84
85
|
legacyXPriv: [0x0221312b],
|
|
85
86
|
legacyXPub: [0x022d2533],
|
|
@@ -71,7 +71,7 @@ const engineInfo = {
|
|
|
71
71
|
bs58EncodeFunc: base58smart.encode,
|
|
72
72
|
wifEncodeFunc: wifsmart.encode,
|
|
73
73
|
prefixes: {
|
|
74
|
-
messagePrefix: ['\
|
|
74
|
+
messagePrefix: ['\x1aSmartCash Signed Message:\n'],
|
|
75
75
|
wif: [0xbf],
|
|
76
76
|
legacyXPriv: [0x0488ade4],
|
|
77
77
|
legacyXPub: [0x0488b21e],
|
|
@@ -78,7 +78,7 @@ var _commonInfo = require('./commonInfo');
|
|
|
78
78
|
segwit: false,
|
|
79
79
|
coinType: 136,
|
|
80
80
|
prefixes: {
|
|
81
|
-
messagePrefix: ['\
|
|
81
|
+
messagePrefix: ['\x16Zcoin Signed Message:\n'],
|
|
82
82
|
wif: [0xd2],
|
|
83
83
|
legacyXPriv: [0x0488ade4],
|
|
84
84
|
legacyXPub: [0x0488b21e],
|
|
@@ -21,6 +21,12 @@ var _undefinedIfEmptyString = require('../../../util/undefinedIfEmptyString');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
24
30
|
var _bip69 = require('./bip69');
|
|
25
31
|
|
|
26
32
|
|
|
@@ -938,14 +944,62 @@ const wifToPrivateKeyEncodingInternal = (
|
|
|
938
944
|
}).publicKey.toString('hex')
|
|
939
945
|
} exports.privateKeyEncodingToPubkey = privateKeyEncodingToPubkey;
|
|
940
946
|
|
|
941
|
-
|
|
947
|
+
/**
|
|
948
|
+
* The `segwitType` to hand `bitcoinjs-message`, or `undefined` to leave the
|
|
949
|
+
* header byte in the legacy Electrum range. Only the BIP137 encoding cares
|
|
950
|
+
* about the derivation purpose, so only it resolves one.
|
|
951
|
+
*/
|
|
952
|
+
function getBip137SegwitType(
|
|
953
|
+
signatureFormat,
|
|
954
|
+
format
|
|
955
|
+
) {
|
|
956
|
+
if (signatureFormat !== 'bip137') return undefined
|
|
957
|
+
const purposeType = bip43PurposeNumberToTypeEnum(
|
|
958
|
+
parseInt(format.replace('bip', ''))
|
|
959
|
+
)
|
|
960
|
+
switch (purposeType) {
|
|
961
|
+
case BIP43PurposeTypeEnum.Segwit:
|
|
962
|
+
return 'p2wpkh'
|
|
963
|
+
case BIP43PurposeTypeEnum.WrappedSegwit:
|
|
964
|
+
return 'p2sh(p2wpkh)'
|
|
965
|
+
default:
|
|
966
|
+
return undefined
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
function signMessageBase64(
|
|
971
|
+
message,
|
|
972
|
+
privateKey,
|
|
973
|
+
format,
|
|
974
|
+
coin,
|
|
975
|
+
signatureFormat = 'electrum'
|
|
976
|
+
) {
|
|
942
977
|
const ECPair = getECPair()
|
|
943
978
|
const keyPair = ECPair.fromPrivateKey(Buffer.from(privateKey, 'hex'))
|
|
944
979
|
if (keyPair.privateKey == null) {
|
|
945
980
|
throw new Error('Address could not sign message')
|
|
946
981
|
}
|
|
982
|
+
// BIP137 encodes the address type in the signature's header byte. Native
|
|
983
|
+
// SegWit (bip84 / P2WPKH) and nested SegWit (bip49 / P2SH-P2WPKH) each have
|
|
984
|
+
// their own header range; verifiers such as Bringin reject a SegWit address
|
|
985
|
+
// whose message was signed with a legacy (bip44) header byte. The derivation
|
|
986
|
+
// path is what tells us the script type, so no caller has to infer it from
|
|
987
|
+
// the address string. Callers opt in, since emitting a BIP137 header to a
|
|
988
|
+
// verifier that expects the legacy Electrum encoding is just as broken.
|
|
989
|
+
// The purpose lookup stays inside the BIP137 branch on purpose:
|
|
990
|
+
// `bip43PurposeNumberToTypeEnum` throws on a purpose it does not map, so
|
|
991
|
+
// computing it unconditionally would let a future `CurrencyFormat` (bip86
|
|
992
|
+
// Taproot being the obvious candidate) break the default Electrum path,
|
|
993
|
+
// which never needs it.
|
|
994
|
+
const segwitType = getBip137SegwitType(signatureFormat, format)
|
|
995
|
+
// Magic-hash the message with the coin's own prefix (e.g. "Litecoin Signed
|
|
996
|
+
// Message:\n") so the signature verifies against that coin's addresses.
|
|
997
|
+
// Every UTXO coin routes through here, not just Bitcoin.
|
|
998
|
+
const messagePrefix = _coinmapper.getCoinFromString.call(void 0, coin).prefixes.messagePrefix[0]
|
|
947
999
|
return _bitcoinjsmessage2.default
|
|
948
|
-
.sign(message, keyPair.privateKey, keyPair.compressed
|
|
1000
|
+
.sign(message, keyPair.privateKey, keyPair.compressed, messagePrefix, {
|
|
1001
|
+
segwitType
|
|
1002
|
+
})
|
|
949
1003
|
.toString('base64')
|
|
950
1004
|
} exports.signMessageBase64 = signMessageBase64;
|
|
951
1005
|
|
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _cleaners = require('cleaners');
|
|
2
2
|
var _types = require('edge-core-js/types');
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* How to encode the header byte of a signed message.
|
|
6
|
+
* - `electrum`: the legacy format, whose header carries only the recovery id
|
|
7
|
+
* and key compression. Every verifier understands it, but it says nothing
|
|
8
|
+
* about the script type.
|
|
9
|
+
* - `bip137`: additionally encodes the signing address' script type, which
|
|
10
|
+
* verifiers such as Bringin require for SegWit addresses.
|
|
11
|
+
*/
|
|
12
|
+
const asUtxoSignatureFormat = _cleaners.asValue.call(void 0, 'electrum', 'bip137'); exports.asUtxoSignatureFormat = asUtxoSignatureFormat
|
|
13
|
+
|
|
14
|
+
|
|
4
15
|
|
|
5
16
|
|
|
6
17
|
|
|
@@ -27,6 +38,22 @@ function asMaybeError(name) {
|
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
40
|
|
|
41
|
+
/**
|
|
42
|
+
* The wallet cannot sign for the requested address: either it does not derive
|
|
43
|
+
* it, or the string is not an address of this chain at all. Callers get a
|
|
44
|
+
* stable `name` to branch on instead of matching against the message prose.
|
|
45
|
+
*/
|
|
46
|
+
class AddressNotOwnedError extends Error {
|
|
47
|
+
constructor() {
|
|
48
|
+
super('Wallet does not own the address to sign with')
|
|
49
|
+
this.name = 'AddressNotOwnedError'
|
|
50
|
+
}
|
|
51
|
+
} exports.AddressNotOwnedError = AddressNotOwnedError;
|
|
52
|
+
|
|
53
|
+
const asMaybeAddressNotOwnedError = asMaybeError(
|
|
54
|
+
'AddressNotOwnedError'
|
|
55
|
+
); exports.asMaybeAddressNotOwnedError = asMaybeAddressNotOwnedError
|
|
56
|
+
|
|
30
57
|
const asMaybeInsufficientFundsErrorPlus = asMaybeError(
|
|
31
58
|
// Share the same name because this error type is a subtype of
|
|
32
59
|
// InsufficientFundsError and therefore backwards compatible
|
|
@@ -2,6 +2,7 @@ import { AddressPath, ChangePath, CurrencyFormat, PluginInfo } from '../../plugi
|
|
|
2
2
|
import { ScriptTemplate } from '../info/scriptTemplates/types';
|
|
3
3
|
import { PublicKey } from '../keymanager/cleaners';
|
|
4
4
|
import { PrivateKeyEncoding } from '../keymanager/keymanager';
|
|
5
|
+
import { UtxoSignatureFormat } from '../keymanager/types';
|
|
5
6
|
import { CurrencyFormatKeys } from './utils';
|
|
6
7
|
export interface WalletToolsConfig {
|
|
7
8
|
pluginInfo: PluginInfo;
|
|
@@ -48,6 +49,7 @@ interface SignMessageArgs {
|
|
|
48
49
|
path: AddressPath;
|
|
49
50
|
message: string;
|
|
50
51
|
xprivKeys: CurrencyFormatKeys;
|
|
52
|
+
signatureFormat: UtxoSignatureFormat;
|
|
51
53
|
}
|
|
52
54
|
export declare function makeUtxoWalletTools(config: WalletToolsConfig): UtxoWalletTools;
|
|
53
55
|
export {};
|
|
@@ -23,6 +23,7 @@ export interface UtxoTxOtherParams {
|
|
|
23
23
|
export declare type UtxoSignMessageOtherParams = ReturnType<typeof asUtxoSignMessageOtherParams>;
|
|
24
24
|
export declare const asUtxoSignMessageOtherParams: import("cleaners").ObjectCleaner<{
|
|
25
25
|
publicAddress: string;
|
|
26
|
+
signatureFormat: "electrum" | "bip137";
|
|
26
27
|
}>;
|
|
27
28
|
export declare type UtxoSpendInfoOtherParams = ReturnType<typeof asUtxoSpendInfoOtherParams>;
|
|
28
29
|
export declare const asUtxoSpendInfoOtherParams: import("cleaners").ObjectCleaner<{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EdgeLog, EdgeMemo } from 'edge-core-js/types';
|
|
2
|
-
import { ChangePath, FeeInfo } from '../../plugin/types';
|
|
2
|
+
import { ChangePath, CurrencyFormat, FeeInfo } from '../../plugin/types';
|
|
3
3
|
import { UtxoData } from '../db/types';
|
|
4
4
|
import { ScriptTemplate, ScriptTemplates } from '../info/scriptTemplates/types';
|
|
5
|
+
import { UtxoSignatureFormat } from './types';
|
|
5
6
|
import * as utxopicker from './utxopicker';
|
|
6
7
|
export declare enum BIP43PurposeTypeEnum {
|
|
7
8
|
Airbitz = "airbitz",
|
|
@@ -202,7 +203,7 @@ export declare const xprivToPrivateKey: (args: XPrivToPrivateKeyArgs) => string;
|
|
|
202
203
|
export declare function privateKeyToWIF(args: PrivateKeyToWIFArgs): string;
|
|
203
204
|
export declare const wifToPrivateKeyEncoding: (args: WIFToPrivateKeyEncodingArgs) => PrivateKeyEncoding;
|
|
204
205
|
export declare function privateKeyEncodingToPubkey(privateKeyEncoding: PrivateKeyEncoding): string;
|
|
205
|
-
export declare function signMessageBase64(message: string, privateKey: string): string;
|
|
206
|
+
export declare function signMessageBase64(message: string, privateKey: string, format: CurrencyFormat, coin: string, signatureFormat?: UtxoSignatureFormat): string;
|
|
206
207
|
export declare function makeTx(args: MakeTxArgs): MakeTxReturn;
|
|
207
208
|
export declare function signTx(args: SignTxArgs): Promise<SignTxReturn>;
|
|
208
209
|
export {};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Cleaner } from 'cleaners';
|
|
2
2
|
import { EdgeTokenId, InsufficientFundsError } from 'edge-core-js/types';
|
|
3
|
+
/**
|
|
4
|
+
* How to encode the header byte of a signed message.
|
|
5
|
+
* - `electrum`: the legacy format, whose header carries only the recovery id
|
|
6
|
+
* and key compression. Every verifier understands it, but it says nothing
|
|
7
|
+
* about the script type.
|
|
8
|
+
* - `bip137`: additionally encodes the signing address' script type, which
|
|
9
|
+
* verifiers such as Bringin require for SegWit addresses.
|
|
10
|
+
*/
|
|
11
|
+
export declare const asUtxoSignatureFormat: Cleaner<"electrum" | "bip137">;
|
|
12
|
+
export declare type UtxoSignatureFormat = ReturnType<typeof asUtxoSignatureFormat>;
|
|
3
13
|
interface InsufficientFundsErrorOptsPlus {
|
|
4
14
|
tokenId: EdgeTokenId;
|
|
5
15
|
networkFee?: string;
|
|
@@ -9,5 +19,14 @@ export declare class InsufficientFundsErrorPlus extends InsufficientFundsError {
|
|
|
9
19
|
networkFeeShortage?: string;
|
|
10
20
|
constructor(opts: InsufficientFundsErrorOptsPlus);
|
|
11
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* The wallet cannot sign for the requested address: either it does not derive
|
|
24
|
+
* it, or the string is not an address of this chain at all. Callers get a
|
|
25
|
+
* stable `name` to branch on instead of matching against the message prose.
|
|
26
|
+
*/
|
|
27
|
+
export declare class AddressNotOwnedError extends Error {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
|
30
|
+
export declare const asMaybeAddressNotOwnedError: Cleaner<AddressNotOwnedError | undefined>;
|
|
12
31
|
export declare const asMaybeInsufficientFundsErrorPlus: Cleaner<InsufficientFundsErrorPlus | undefined>;
|
|
13
32
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { CurrencyFormat } from '../../../../../src/common/plugin/types';
|
|
1
2
|
import { AddressTypeEnum, BIP43PurposeTypeEnum, ScriptTypeEnum } from '../../../../../src/common/utxobased/keymanager/keymanager';
|
|
3
|
+
import { UtxoSignatureFormat } from '../../../../../src/common/utxobased/keymanager/types';
|
|
2
4
|
interface SeedToXPrivTests {
|
|
3
5
|
xpriv: string;
|
|
4
6
|
type: BIP43PurposeTypeEnum;
|
|
@@ -34,6 +36,9 @@ interface XPubToPubkeyTests {
|
|
|
34
36
|
interface SignMessageTests {
|
|
35
37
|
wif: string;
|
|
36
38
|
message: string;
|
|
39
|
+
format: CurrencyFormat;
|
|
40
|
+
/** Omitted to exercise the default, which must stay `electrum`. */
|
|
41
|
+
signatureFormat?: UtxoSignatureFormat;
|
|
37
42
|
signature: string;
|
|
38
43
|
}
|
|
39
44
|
interface Coin {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-plugins",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.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",
|