edge-currency-plugins 3.0.1 → 3.1.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/README.md +10 -0
- package/android/src/main/assets/edge-currency-plugins/edge-currency-plugins.js +35 -35
- package/lib/common/plugin/CurrencyTools.js +4 -4
- package/lib/common/plugin/types.js +154 -0
- package/lib/common/plugin/utils.js +2 -3
- package/lib/common/utxobased/db/Models/ProcessorTransaction.js +1 -0
- package/lib/common/utxobased/db/types.js +4 -0
- package/lib/common/utxobased/engine/UtxoEngine.js +14 -14
- package/lib/common/utxobased/engine/UtxoEngineState.js +2 -1
- package/lib/common/utxobased/engine/types.js +1 -0
- package/lib/common/utxobased/info/badcoin.js +0 -1
- package/lib/common/utxobased/info/bitcoin.js +0 -1
- package/lib/common/utxobased/info/bitcoincash.js +0 -1
- package/lib/common/utxobased/info/bitcoincashtestnet.js +0 -1
- package/lib/common/utxobased/info/bitcoingold.js +0 -1
- package/lib/common/utxobased/info/bitcoingoldtestnet.js +0 -1
- package/lib/common/utxobased/info/bitcoinsv.js +0 -1
- package/lib/common/utxobased/info/bitcointestnet.js +0 -1
- package/lib/common/utxobased/info/dash.js +0 -1
- package/lib/common/utxobased/info/digibyte.js +0 -1
- package/lib/common/utxobased/info/dogecoin.js +0 -1
- package/lib/common/utxobased/info/eboost.js +0 -1
- package/lib/common/utxobased/info/feathercoin.js +0 -1
- package/lib/common/utxobased/info/groestlcoin.js +0 -1
- package/lib/common/utxobased/info/litecoin.js +0 -1
- package/lib/common/utxobased/info/qtum.js +0 -1
- package/lib/common/utxobased/info/ravencoin.js +0 -1
- package/lib/common/utxobased/info/smartcash.js +0 -1
- package/lib/common/utxobased/info/ufo.js +0 -1
- package/lib/common/utxobased/info/vertcoin.js +0 -1
- package/lib/common/utxobased/info/zcoin.js +0 -1
- package/lib/common/utxobased/keymanager/cleaners.js +2 -2
- package/lib/common/utxobased/network/blockbookApi.js +8 -2
- package/lib/src/common/plugin/types.d.ts +141 -2
- package/lib/src/common/utxobased/db/types.d.ts +7 -3
- package/lib/src/common/utxobased/keymanager/utxopicker/types.d.ts +1 -1
- package/lib/src/common/utxobased/network/blockbookApi.d.ts +1 -1
- package/package.json +2 -2
|
@@ -34,17 +34,85 @@ export interface PluginInfo {
|
|
|
34
34
|
coinInfo: CoinInfo;
|
|
35
35
|
}
|
|
36
36
|
export interface EngineInfo {
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Supported wallet formats for address derivation.
|
|
39
|
+
*
|
|
40
|
+
* See https://github.com/EdgeApp/edge-core-js/blob/master/docs/key-formats.md#detailed-key-formats
|
|
41
|
+
**/
|
|
42
|
+
formats: CurrencyFormat[];
|
|
43
|
+
/**
|
|
44
|
+
* Optional list of currency pluginId strings of which this currency is a fork.
|
|
45
|
+
* These fork currencies are able to be split into this currency.
|
|
46
|
+
**/
|
|
38
47
|
forks?: string[];
|
|
39
48
|
uriPrefix?: string;
|
|
49
|
+
/**
|
|
50
|
+
* The gap limit defines the number of indexes to derive from the last used
|
|
51
|
+
* address. This is typically set to 10 for most currencies with the exception
|
|
52
|
+
* of Bitcoin which is set to 25 for historical reasons.
|
|
53
|
+
*/
|
|
40
54
|
gapLimit: number;
|
|
41
|
-
|
|
55
|
+
/**
|
|
56
|
+
* The number of milliseconds defining the frequency that the engine will
|
|
57
|
+
* fetch new fee rates.
|
|
58
|
+
*/
|
|
42
59
|
feeUpdateInterval: number;
|
|
60
|
+
/**
|
|
61
|
+
* Optional mempool.space URI for fetching fee info.
|
|
62
|
+
*
|
|
63
|
+
* See https://mempool.space/docs/api/rest#get-recommended-fees
|
|
64
|
+
*/
|
|
43
65
|
mempoolSpaceFeeInfoServer?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Default fee info used before fetching up-to-date fee info from Edge
|
|
68
|
+
* Info Servers.
|
|
69
|
+
*/
|
|
44
70
|
defaultFeeInfo: FeeInfo;
|
|
71
|
+
/**
|
|
72
|
+
* Optional script template functions for non-standard output script types.
|
|
73
|
+
* These are used to generate the output scriptPubkey for a transaction given
|
|
74
|
+
* pubkey as an argument.
|
|
75
|
+
*
|
|
76
|
+
* The derivation path includes a changeIndex using the 2 bytes of the hash
|
|
77
|
+
* of the script template function output given an empty pubkey value.
|
|
78
|
+
* The engine will search for funds on this derivation path using address
|
|
79
|
+
* indexes up to the gapLimit.
|
|
80
|
+
*
|
|
81
|
+
* This feature is mainly used for replay-protection script templates for
|
|
82
|
+
* Bitcoin Cash and Bitcoin SV replay protection. It it currently limited
|
|
83
|
+
* to supporting only `replayProtection` keyed entries.
|
|
84
|
+
*/
|
|
45
85
|
scriptTemplates?: ScriptTemplates;
|
|
86
|
+
/**
|
|
87
|
+
* Optional server configurations for the currency engine. Currently only supports
|
|
88
|
+
* NOWNode Blockbook servers configuration types for HTTP fallback.
|
|
89
|
+
*
|
|
90
|
+
* Use `blockbookServers` config in `EdgeCurrencyInfo['defaultSettings']` for
|
|
91
|
+
* the time being. This config controls the WebSocket URI for Blockbook
|
|
92
|
+
* connections over the WebSocket protocol.
|
|
93
|
+
*/
|
|
46
94
|
serverConfigs?: ServerConfig[];
|
|
95
|
+
/**
|
|
96
|
+
* An optional codec cleaner (asCodec) for serializing and deserializing an
|
|
97
|
+
* address over network interfaces. This can be used to resolve issues with
|
|
98
|
+
* network interfaces that expect addresses to be formatted differently than
|
|
99
|
+
* what is expected by the engine.
|
|
100
|
+
*
|
|
101
|
+
* For example, if a Blockbook server expects
|
|
102
|
+
* an address URI prefix (mycurrency:), then this cleaner codec can add the
|
|
103
|
+
* necessary translations.
|
|
104
|
+
*
|
|
105
|
+
* See https://cleaners.js.org/#/reference?id=ascodec cleaner codec
|
|
106
|
+
* documentation.
|
|
107
|
+
*/
|
|
47
108
|
asBlockbookAddress?: Cleaner<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Some currencies require an additional blockbook payload
|
|
111
|
+
* 'getTransactionSpecific' in order to provide all relevant transaction
|
|
112
|
+
* data. If this function is defined, it should merge the unknown `specialTx`
|
|
113
|
+
* data from the Blockbook endpoint with the `IProcessorTransaction` object
|
|
114
|
+
* which is stored to disk.
|
|
115
|
+
**/
|
|
48
116
|
txSpecificHandling?: (tx: IProcessorTransaction, specialTx: unknown) => IProcessorTransaction;
|
|
49
117
|
}
|
|
50
118
|
export interface ServerConfig {
|
|
@@ -54,21 +122,92 @@ export interface ServerConfig {
|
|
|
54
122
|
/**
|
|
55
123
|
* Coin Info
|
|
56
124
|
*/
|
|
125
|
+
/**
|
|
126
|
+
* This info is to be used to interface with the AltcoinJs library. It contains
|
|
127
|
+
* network and encoding parameters for the currency.
|
|
128
|
+
*/
|
|
57
129
|
export interface CoinInfo {
|
|
130
|
+
/**
|
|
131
|
+
* The official network name in lower case. This is a unique network name
|
|
132
|
+
* to identify the `CoinInfo`. It should not conflict with other currency
|
|
133
|
+
* plugins using the same UTXO plugin implementation.
|
|
134
|
+
*/
|
|
58
135
|
name: string;
|
|
136
|
+
/**
|
|
137
|
+
* Whether the currency uses segwit addresses (wrapped-segwit P2SH, P2WSH, etc).
|
|
138
|
+
*/
|
|
59
139
|
segwit: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The SLIP-0044 coin type number. This is used to derive the BIP32 path for
|
|
142
|
+
* addresses.
|
|
143
|
+
*/
|
|
60
144
|
coinType: number;
|
|
145
|
+
/**
|
|
146
|
+
* Optional sighash value to be passed to AltcoinJS as the sighashType field
|
|
147
|
+
* on inputs. This is primarily used by currencies that leverage it as
|
|
148
|
+
* build-in replay-protection mechanisms.
|
|
149
|
+
*/
|
|
61
150
|
sighash?: number;
|
|
151
|
+
/**
|
|
152
|
+
* A function to be passed to AltcoinJS `signInput` method. This is used to
|
|
153
|
+
* get the input hash for the signature algorithm before signing the input.
|
|
154
|
+
*
|
|
155
|
+
* This is used if the currency has a custom signature hash function that
|
|
156
|
+
* deviates from the default `bcrypto.hash256` function used for Bitcoin.
|
|
157
|
+
*/
|
|
62
158
|
sighashFunction?: (Hash: Buffer) => Buffer;
|
|
159
|
+
/**
|
|
160
|
+
* A function to be passed to AltcoinJS `getId` method. This is used to get
|
|
161
|
+
* the transaction hash (txid) for a transaction.
|
|
162
|
+
*
|
|
163
|
+
* This is used if the currency has a custom signature hash function that
|
|
164
|
+
* deviates from the default `bcrypto.hash256` function used for Bitcoin.
|
|
165
|
+
*/
|
|
63
166
|
txHashFunction?: (Hash: Buffer) => Buffer;
|
|
167
|
+
/**
|
|
168
|
+
* A optional custom decode function passed to AltcoinJS `PaymentCreator`
|
|
169
|
+
* function. This is used to decode the base58 address encoding.
|
|
170
|
+
*/
|
|
64
171
|
bs58DecodeFunc?: BaseConverter['decode'];
|
|
172
|
+
/**
|
|
173
|
+
* A optional custom encode function passed to AltcoinJS `PaymentCreator`
|
|
174
|
+
* function. This is used to encode the address to a base58 encoding.
|
|
175
|
+
*/
|
|
65
176
|
bs58EncodeFunc?: BaseConverter['encode'];
|
|
177
|
+
/**
|
|
178
|
+
* A optional custom WIF encoding function passed to AltcoinJS `toWIF` method.
|
|
179
|
+
* This is used to encode the private key into a WIF.
|
|
180
|
+
*/
|
|
66
181
|
wifEncodeFunc?: typeof wif.encode;
|
|
182
|
+
/**
|
|
183
|
+
* A optional custom extended public/private key encoding function.
|
|
184
|
+
* This is used when converting a public or private key to an xpub/xpriv.
|
|
185
|
+
*/
|
|
67
186
|
bip32FromBase58Func?: (xKey: string, network: BitcoinJSNetwork) => bip32.BIP32Interface;
|
|
187
|
+
/**
|
|
188
|
+
* A optional custom seed encoding function.
|
|
189
|
+
* This is used when converting a seed to root private key.
|
|
190
|
+
*/
|
|
68
191
|
bip32FromSeedFunc?: (seed: Buffer) => bip32.BIP32Interface;
|
|
192
|
+
/**
|
|
193
|
+
* A optional custom UTXO picker function for currencies that may require
|
|
194
|
+
* different UTXO selection algorithms.
|
|
195
|
+
*/
|
|
69
196
|
utxoPicker?: UtxoPicker;
|
|
197
|
+
/**
|
|
198
|
+
* This is all the currency specific prefixes for encoding and decoding
|
|
199
|
+
* of various data types.
|
|
200
|
+
*/
|
|
70
201
|
prefixes: CoinPrefixes;
|
|
71
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* This is all the currency specific prefixes for encoding and decoding
|
|
205
|
+
* of various data types.
|
|
206
|
+
*
|
|
207
|
+
* The first entry in the array is used for standard serialization.
|
|
208
|
+
* The second entry in the array is used for legacy serialization.
|
|
209
|
+
* All entries in the array are checked whether they can de-serialize the content
|
|
210
|
+
*/
|
|
72
211
|
export interface CoinPrefixes {
|
|
73
212
|
messagePrefix: string[];
|
|
74
213
|
wif: number[];
|
|
@@ -40,10 +40,14 @@ export interface IProcessorTransaction {
|
|
|
40
40
|
}
|
|
41
41
|
export interface ITransactionOutput {
|
|
42
42
|
amount: string;
|
|
43
|
-
scriptPubkey: string;
|
|
44
43
|
n: number;
|
|
44
|
+
scriptPubkey: string;
|
|
45
45
|
}
|
|
46
|
-
export interface ITransactionInput
|
|
47
|
-
|
|
46
|
+
export interface ITransactionInput {
|
|
47
|
+
amount: string;
|
|
48
|
+
n: number;
|
|
48
49
|
outputIndex: number;
|
|
50
|
+
scriptPubkey: string;
|
|
51
|
+
sequence: number;
|
|
52
|
+
txId: string;
|
|
49
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "edge-currency-plugins",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"base-x": "^4.0.0",
|
|
88
88
|
"chai": "^4.2.0",
|
|
89
89
|
"chai-as-promised": "^7.1.1",
|
|
90
|
-
"edge-core-js": "^2.
|
|
90
|
+
"edge-core-js": "^2.7.0",
|
|
91
91
|
"esbuild-loader": "^4.1.0",
|
|
92
92
|
"eslint": "^7.14.0",
|
|
93
93
|
"eslint-config-standard-kit": "0.15.1",
|