edge-currency-plugins 1.0.0-rc.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/LICENSE +21 -0
- package/README.md +3 -0
- package/lib/bch.js +15 -0
- package/lib/bsv.js +15 -0
- package/lib/btc.js +15 -0
- package/lib/common/constants.js +11 -0
- package/lib/common/fees/calcMinerFeePerByte.js +62 -0
- package/lib/common/fees/makeFees.js +182 -0
- package/lib/common/fees/processInfoServerFees.js +30 -0
- package/lib/common/fees/processMempoolSpaceFees.js +38 -0
- package/lib/common/plugin/makeCurrencyPlugin.js +66 -0
- package/lib/common/plugin/makeCurrencyTools.js +211 -0
- package/lib/common/plugin/makeEngineEmitter.js +102 -0
- package/lib/common/plugin/makeMetadata.js +99 -0
- package/lib/common/plugin/pluginState.js +253 -0
- package/lib/common/plugin/serverScores.js +328 -0
- package/lib/common/plugin/types.js +173 -0
- package/lib/common/plugin/utils.js +18 -0
- package/lib/common/utxobased/db/Models/ProcessorTransaction.js +122 -0
- package/lib/common/utxobased/db/Models/baselet.js +81 -0
- package/lib/common/utxobased/db/makeBaselets.js +123 -0
- package/lib/common/utxobased/db/makeMutex.js +17 -0
- package/lib/common/utxobased/db/makeProcessor.js +554 -0
- package/lib/common/utxobased/db/types.js +67 -0
- package/lib/common/utxobased/engine/await-lock.js +65 -0
- package/lib/common/utxobased/engine/constants.js +7 -0
- package/lib/common/utxobased/engine/makeServerStates.js +394 -0
- package/lib/common/utxobased/engine/makeUtxoEngine.js +690 -0
- package/lib/common/utxobased/engine/makeUtxoEngineState.js +1443 -0
- package/lib/common/utxobased/engine/makeUtxoWalletTools.js +216 -0
- package/lib/common/utxobased/engine/paymentRequest.js +102 -0
- package/lib/common/utxobased/engine/types.js +21 -0
- package/lib/common/utxobased/engine/util/defaultValidateConfirmations.js +19 -0
- package/lib/common/utxobased/engine/util/getOwnUtxosFromTx.js +54 -0
- package/lib/common/utxobased/engine/utils.js +239 -0
- package/lib/common/utxobased/info/all.js +67 -0
- package/lib/common/utxobased/info/badcoin.js +73 -0
- package/lib/common/utxobased/info/bitcoin.js +91 -0
- package/lib/common/utxobased/info/bitcoincash.js +93 -0
- package/lib/common/utxobased/info/bitcoincashtestnet.js +72 -0
- package/lib/common/utxobased/info/bitcoingold.js +85 -0
- package/lib/common/utxobased/info/bitcoingoldtestnet.js +71 -0
- package/lib/common/utxobased/info/bitcoinsv.js +76 -0
- package/lib/common/utxobased/info/bitcointestnet.js +81 -0
- package/lib/common/utxobased/info/dash.js +76 -0
- package/lib/common/utxobased/info/digibyte.js +76 -0
- package/lib/common/utxobased/info/dogecoin.js +76 -0
- package/lib/common/utxobased/info/eboost.js +70 -0
- package/lib/common/utxobased/info/feathercoin.js +76 -0
- package/lib/common/utxobased/info/groestlcoin.js +88 -0
- package/lib/common/utxobased/info/litecoin.js +82 -0
- package/lib/common/utxobased/info/qtum.js +67 -0
- package/lib/common/utxobased/info/ravencoin.js +70 -0
- package/lib/common/utxobased/info/scriptTemplates/bitcoincashScriptTemplates.js +56 -0
- package/lib/common/utxobased/info/scriptTemplates/types.js +14 -0
- package/lib/common/utxobased/info/smartcash.js +78 -0
- package/lib/common/utxobased/info/ufo.js +75 -0
- package/lib/common/utxobased/info/utxoPickers/dogeUtxoPicker.js +34 -0
- package/lib/common/utxobased/info/vertcoin.js +82 -0
- package/lib/common/utxobased/info/zcoin.js +72 -0
- package/lib/common/utxobased/keymanager/base.js +60 -0
- package/lib/common/utxobased/keymanager/bip69.js +31 -0
- package/lib/common/utxobased/keymanager/bitcoincashUtils/base32.js +88 -0
- package/lib/common/utxobased/keymanager/bitcoincashUtils/bn.js +210 -0
- package/lib/common/utxobased/keymanager/bitcoincashUtils/cashAddress.js +282 -0
- package/lib/common/utxobased/keymanager/cleaners.js +198 -0
- package/lib/common/utxobased/keymanager/coinmapper.js +12 -0
- package/lib/common/utxobased/keymanager/declarations/base58grscheck.d.js +1 -0
- package/lib/common/utxobased/keymanager/declarations/blake-hash.d.js +1 -0
- package/lib/common/utxobased/keymanager/declarations/bn.d.js +1 -0
- package/lib/common/utxobased/keymanager/declarations/bs58smartcheck.d.js +1 -0
- package/lib/common/utxobased/keymanager/declarations/wif-smart.d.js +1 -0
- package/lib/common/utxobased/keymanager/declarations/wifgrs.d.js +1 -0
- package/lib/common/utxobased/keymanager/keymanager.js +1214 -0
- package/lib/common/utxobased/keymanager/utxopicker/accumulative.js +52 -0
- package/lib/common/utxobased/keymanager/utxopicker/forceUseUtxo.js +59 -0
- package/lib/common/utxobased/keymanager/utxopicker/subtractFee.js +17 -0
- package/lib/common/utxobased/keymanager/utxopicker/types.js +42 -0
- package/lib/common/utxobased/keymanager/utxopicker/utils.js +159 -0
- package/lib/common/utxobased/keymanager/utxopicker.js +17 -0
- package/lib/common/utxobased/network/BlockBook.js +200 -0
- package/lib/common/utxobased/network/BlockBookAPI.js +335 -0
- package/lib/common/utxobased/network/Deferred.js +29 -0
- package/lib/common/utxobased/network/MakeSocketEmitter.js +35 -0
- package/lib/common/utxobased/network/Socket.js +362 -0
- package/lib/common/utxobased/network/nodejsWS.js +59 -0
- package/lib/common/utxobased/network/socketQueue.js +60 -0
- package/lib/common/utxobased/network/types.js +19 -0
- package/lib/common/utxobased/network/windowWS.js +54 -0
- package/lib/firo.js +15 -0
- package/lib/ftc.js +15 -0
- package/lib/index.js +19 -0
- package/lib/ltc.js +15 -0
- package/lib/src/bch.d.ts +3 -0
- package/lib/src/bsv.d.ts +3 -0
- package/lib/src/btc.d.ts +3 -0
- package/lib/src/common/constants.d.ts +9 -0
- package/lib/src/common/fees/calcMinerFeePerByte.d.ts +13 -0
- package/lib/src/common/fees/makeFees.d.ts +20 -0
- package/lib/src/common/fees/processInfoServerFees.d.ts +7 -0
- package/lib/src/common/fees/processMempoolSpaceFees.d.ts +13 -0
- package/lib/src/common/plugin/makeCurrencyPlugin.d.ts +3 -0
- package/lib/src/common/plugin/makeCurrencyTools.d.ts +8 -0
- package/lib/src/common/plugin/makeEngineEmitter.d.ts +23 -0
- package/lib/src/common/plugin/makeMetadata.d.ts +14 -0
- package/lib/src/common/plugin/pluginState.d.ts +34 -0
- package/lib/src/common/plugin/serverScores.d.ts +61 -0
- package/lib/src/common/plugin/types.d.ts +135 -0
- package/lib/src/common/plugin/utils.d.ts +6 -0
- package/lib/src/common/utxobased/db/Models/ProcessorTransaction.d.ts +16 -0
- package/lib/src/common/utxobased/db/Models/baselet.d.ts +28 -0
- package/lib/src/common/utxobased/db/makeBaselets.d.ts +33 -0
- package/lib/src/common/utxobased/db/makeMutex.d.ts +3 -0
- package/lib/src/common/utxobased/db/makeProcessor.d.ts +42 -0
- package/lib/src/common/utxobased/db/types.d.ts +47 -0
- package/lib/src/common/utxobased/engine/await-lock.d.ts +29 -0
- package/lib/src/common/utxobased/engine/constants.d.ts +4 -0
- package/lib/src/common/utxobased/engine/makeServerStates.d.ts +37 -0
- package/lib/src/common/utxobased/engine/makeUtxoEngine.d.ts +3 -0
- package/lib/src/common/utxobased/engine/makeUtxoEngineState.d.ts +108 -0
- package/lib/src/common/utxobased/engine/makeUtxoWalletTools.d.ts +52 -0
- package/lib/src/common/utxobased/engine/paymentRequest.d.ts +18 -0
- package/lib/src/common/utxobased/engine/types.d.ts +19 -0
- package/lib/src/common/utxobased/engine/util/defaultValidateConfirmations.d.ts +3 -0
- package/lib/src/common/utxobased/engine/util/getOwnUtxosFromTx.d.ts +4 -0
- package/lib/src/common/utxobased/engine/utils.d.ts +43 -0
- package/lib/src/common/utxobased/info/all.d.ts +22 -0
- package/lib/src/common/utxobased/info/badcoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoincash.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoincashtestnet.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoingold.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoingoldtestnet.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcoinsv.d.ts +3 -0
- package/lib/src/common/utxobased/info/bitcointestnet.d.ts +6 -0
- package/lib/src/common/utxobased/info/dash.d.ts +3 -0
- package/lib/src/common/utxobased/info/digibyte.d.ts +3 -0
- package/lib/src/common/utxobased/info/dogecoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/eboost.d.ts +3 -0
- package/lib/src/common/utxobased/info/feathercoin.d.ts +6 -0
- package/lib/src/common/utxobased/info/groestlcoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/litecoin.d.ts +6 -0
- package/lib/src/common/utxobased/info/qtum.d.ts +3 -0
- package/lib/src/common/utxobased/info/ravencoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/scriptTemplates/bitcoincashScriptTemplates.d.ts +2 -0
- package/lib/src/common/utxobased/info/scriptTemplates/types.d.ts +9 -0
- package/lib/src/common/utxobased/info/smartcash.d.ts +3 -0
- package/lib/src/common/utxobased/info/ufo.d.ts +3 -0
- package/lib/src/common/utxobased/info/utxoPickers/dogeUtxoPicker.d.ts +2 -0
- package/lib/src/common/utxobased/info/vertcoin.d.ts +3 -0
- package/lib/src/common/utxobased/info/zcoin.d.ts +6 -0
- package/lib/src/common/utxobased/keymanager/base.d.ts +9 -0
- package/lib/src/common/utxobased/keymanager/bip69.d.ts +19 -0
- package/lib/src/common/utxobased/keymanager/bitcoincashUtils/base32.d.ts +19 -0
- package/lib/src/common/utxobased/keymanager/bitcoincashUtils/bn.d.ts +2 -0
- package/lib/src/common/utxobased/keymanager/bitcoincashUtils/cashAddress.d.ts +12 -0
- package/lib/src/common/utxobased/keymanager/cleaners.d.ts +55 -0
- package/lib/src/common/utxobased/keymanager/coinmapper.d.ts +2 -0
- package/lib/src/common/utxobased/keymanager/keymanager.d.ts +198 -0
- package/lib/src/common/utxobased/keymanager/utxopicker/accumulative.d.ts +2 -0
- package/lib/src/common/utxobased/keymanager/utxopicker/forceUseUtxo.d.ts +2 -0
- package/lib/src/common/utxobased/keymanager/utxopicker/subtractFee.d.ts +2 -0
- package/lib/src/common/utxobased/keymanager/utxopicker/types.d.ts +36 -0
- package/lib/src/common/utxobased/keymanager/utxopicker/utils.d.ts +15 -0
- package/lib/src/common/utxobased/keymanager/utxopicker.d.ts +8 -0
- package/lib/src/common/utxobased/network/BlockBook.d.ts +33 -0
- package/lib/src/common/utxobased/network/BlockBookAPI.d.ts +163 -0
- package/lib/src/common/utxobased/network/Deferred.d.ts +8 -0
- package/lib/src/common/utxobased/network/MakeSocketEmitter.d.ts +13 -0
- package/lib/src/common/utxobased/network/Socket.d.ts +41 -0
- package/lib/src/common/utxobased/network/nodejsWS.d.ts +2 -0
- package/lib/src/common/utxobased/network/socketQueue.d.ts +8 -0
- package/lib/src/common/utxobased/network/types.d.ts +17 -0
- package/lib/src/common/utxobased/network/windowWS.d.ts +2 -0
- package/lib/src/firo.d.ts +3 -0
- package/lib/src/ftc.d.ts +3 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/ltc.d.ts +3 -0
- package/lib/src/tbch.d.ts +3 -0
- package/lib/src/tbtc.d.ts +3 -0
- package/lib/src/tbtg.d.ts +3 -0
- package/lib/src/types.d.ts +6 -0
- package/lib/src/util/delay.d.ts +1 -0
- package/lib/src/util/filterUndefined.d.ts +1 -0
- package/lib/src/util/indexAtProtected.d.ts +5 -0
- package/lib/src/util/typeUtil.d.ts +8 -0
- package/lib/src/util/undefinedIfEmptyString.d.ts +1 -0
- package/lib/src/util/unixTime.d.ts +1 -0
- package/lib/tbch.js +15 -0
- package/lib/tbtc.js +15 -0
- package/lib/tbtg.js +15 -0
- package/lib/test/common/fees/calcMinerFeePerByte.spec.d.ts +1 -0
- package/lib/test/common/fees/fees.spec.d.ts +1 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/common.d.ts +29 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoin.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoincash.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/bitcoinsv.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/digibyte.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/feathercoin.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/groestlcoin.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/litecoin.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/smartcash.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/currencies/zcoin.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.fixtures/index.d.ts +2 -0
- package/lib/test/common/plugin/currencyPlugin.spec.d.ts +1 -0
- package/lib/test/common/plugin/makeMetadata.spec.d.ts +1 -0
- package/lib/test/common/plugin/serverScores.spec.d.ts +1 -0
- package/lib/test/common/utxobased/addressFormat/addressFormatIndex/addressFormat.spec.d.ts +1 -0
- package/lib/test/common/utxobased/db/Processor.spec.d.ts +1 -0
- package/lib/test/common/utxobased/engine/PaymentRequest.spec.d.ts +1 -0
- package/lib/test/common/utxobased/engine/UtxoWalletTools.spec.d.ts +1 -0
- package/lib/test/common/utxobased/engine/engine.fixtures/bitcoinTestnet/tests.d.ts +70 -0
- package/lib/test/common/utxobased/engine/engine.fixtures/index.d.ts +65 -0
- package/lib/test/common/utxobased/engine/engine.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/altcointestfixtures.d.ts +54 -0
- package/lib/test/common/utxobased/keymanager/coins/bitcoincashtransactiontest.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/bitcointransactiontest.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/cashaddr.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/checkdatasig.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/groestlcointransactiontest.spec.d.ts +1 -0
- package/lib/test/common/utxobased/keymanager/coins/keymanagertest.spec.d.ts +1 -0
- package/lib/test/common/utxobased/network/BlockBook.spec.d.ts +1 -0
- package/lib/test/util/objectKeys.d.ts +8 -0
- package/lib/test/util/testLog.d.ts +3 -0
- package/lib/test/utils.d.ts +10 -0
- package/lib/types.js +7 -0
- package/lib/util/delay.js +4 -0
- package/lib/util/filterUndefined.js +4 -0
- package/lib/util/indexAtProtected.js +9 -0
- package/lib/util/typeUtil.js +9 -0
- package/lib/util/undefinedIfEmptyString.js +2 -0
- package/lib/util/unixTime.js +2 -0
- package/package.json +101 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { EdgeFreshAddress, EdgeIo, EdgeLog, EdgeTransaction } from 'edge-core-js/types';
|
|
2
|
+
import { EngineEmitter } from '../../plugin/makeEngineEmitter';
|
|
3
|
+
import { ChangePath, CurrencyFormat, EngineConfig, PluginInfo } from '../../plugin/types';
|
|
4
|
+
import { Processor } from '../db/makeProcessor';
|
|
5
|
+
import { IAddress, IProcessorTransaction, IUTXO } from '../db/types';
|
|
6
|
+
import { NumbWalletInfo } from '../keymanager/cleaners';
|
|
7
|
+
import { WsTask } from '../network/Socket';
|
|
8
|
+
import AwaitLock from './await-lock';
|
|
9
|
+
import { ServerStates } from './makeServerStates';
|
|
10
|
+
import { UTXOPluginWalletTools } from './makeUtxoWalletTools';
|
|
11
|
+
export interface UtxoEngineState {
|
|
12
|
+
processedPercent: number;
|
|
13
|
+
start: () => Promise<void>;
|
|
14
|
+
stop: () => Promise<void>;
|
|
15
|
+
deriveScriptAddress: (script: string) => Promise<EdgeFreshAddress>;
|
|
16
|
+
getFreshAddress: (branch?: number) => Promise<EdgeFreshAddress>;
|
|
17
|
+
addGapLimitAddresses: (addresses: string[]) => Promise<void>;
|
|
18
|
+
broadcastTx: (transaction: EdgeTransaction) => Promise<string>;
|
|
19
|
+
refillServers: () => void;
|
|
20
|
+
getServerList: () => string[];
|
|
21
|
+
setServerList: (serverList: string[]) => void;
|
|
22
|
+
loadWifs: (wifs: string[]) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface UtxoEngineStateConfig extends EngineConfig {
|
|
25
|
+
walletTools: UTXOPluginWalletTools;
|
|
26
|
+
walletInfo: NumbWalletInfo;
|
|
27
|
+
processor: Processor;
|
|
28
|
+
}
|
|
29
|
+
export declare function makeUtxoEngineState(config: UtxoEngineStateConfig): UtxoEngineState;
|
|
30
|
+
interface CommonArgs {
|
|
31
|
+
pluginInfo: PluginInfo;
|
|
32
|
+
walletInfo: NumbWalletInfo;
|
|
33
|
+
walletTools: UTXOPluginWalletTools;
|
|
34
|
+
processor: Processor;
|
|
35
|
+
emitter: EngineEmitter;
|
|
36
|
+
taskCache: TaskCache;
|
|
37
|
+
updateProgressRatio: () => void;
|
|
38
|
+
io: EdgeIo;
|
|
39
|
+
log: EdgeLog;
|
|
40
|
+
serverStates: ServerStates;
|
|
41
|
+
walletFormats: CurrencyFormat[];
|
|
42
|
+
lock: AwaitLock;
|
|
43
|
+
}
|
|
44
|
+
interface TaskCache {
|
|
45
|
+
addressWatching: boolean;
|
|
46
|
+
blockWatching: boolean;
|
|
47
|
+
addressSubscribeCache: AddressSubscribeCache;
|
|
48
|
+
addressUtxoCache: AddressUtxoCache;
|
|
49
|
+
rawUtxoCache: RawUtxoCache;
|
|
50
|
+
processorUtxoCache: ProcessorUtxoCache;
|
|
51
|
+
addressTransactionCache: AddressTransactionCache;
|
|
52
|
+
updateTransactionCache: UpdateTransactionCache;
|
|
53
|
+
}
|
|
54
|
+
interface UpdateTransactionCache {
|
|
55
|
+
[key: string]: {
|
|
56
|
+
processing: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
interface AddressSubscribeCache {
|
|
60
|
+
[key: string]: {
|
|
61
|
+
processing: boolean;
|
|
62
|
+
path: ChangePath;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
interface AddressUtxoCache {
|
|
66
|
+
[key: string]: {
|
|
67
|
+
processing: boolean;
|
|
68
|
+
path: ChangePath;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface ProcessorUtxoCache {
|
|
72
|
+
[key: string]: {
|
|
73
|
+
processing: boolean;
|
|
74
|
+
full: boolean;
|
|
75
|
+
utxos: Set<IUTXO>;
|
|
76
|
+
path: ChangePath;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface RawUtxoCache {
|
|
80
|
+
[key: string]: {
|
|
81
|
+
processing: boolean;
|
|
82
|
+
path: ChangePath;
|
|
83
|
+
address: IAddress;
|
|
84
|
+
requiredCount: number;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
interface AddressTransactionCache {
|
|
88
|
+
[key: string]: {
|
|
89
|
+
processing: boolean;
|
|
90
|
+
path: ChangePath;
|
|
91
|
+
page: number;
|
|
92
|
+
blockHeight: number;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
interface TransactionChangedArgs {
|
|
96
|
+
tx: IProcessorTransaction;
|
|
97
|
+
emitter: EngineEmitter;
|
|
98
|
+
walletBlockHeight: number;
|
|
99
|
+
walletTools: UTXOPluginWalletTools;
|
|
100
|
+
pluginInfo: PluginInfo;
|
|
101
|
+
processor: Processor;
|
|
102
|
+
}
|
|
103
|
+
export declare const transactionChanged: (args: TransactionChangedArgs) => Promise<void>;
|
|
104
|
+
interface NextTaskArgs extends CommonArgs {
|
|
105
|
+
uri: string;
|
|
106
|
+
}
|
|
107
|
+
export declare const pickNextTask: (args: NextTaskArgs) => Promise<WsTask<any> | undefined | boolean>;
|
|
108
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AddressPath, CurrencyFormat } from '../../plugin/types';
|
|
2
|
+
import { ScriptTemplate } from '../info/scriptTemplates/types';
|
|
3
|
+
import { PublicKey } from '../keymanager/cleaners';
|
|
4
|
+
import { CurrencyFormatKeys } from './utils';
|
|
5
|
+
export interface WalletToolsConfig {
|
|
6
|
+
publicKey: PublicKey;
|
|
7
|
+
coin: string;
|
|
8
|
+
}
|
|
9
|
+
export interface UTXOPluginWalletTools {
|
|
10
|
+
getPubkey: (args: AddressPath) => string;
|
|
11
|
+
getScriptPubkey: (args: AddressPath) => ScriptPubkeyReturn;
|
|
12
|
+
getScriptPubkeyFromWif: (wif: string, format: CurrencyFormat) => ScriptPubkeyReturn;
|
|
13
|
+
getAddress: (args: AddressPath) => AddressReturn;
|
|
14
|
+
addressToScriptPubkey: (address: string) => string;
|
|
15
|
+
scriptPubkeyToAddress: (args: ScriptPubkeyToAddressArgs) => AddressReturn;
|
|
16
|
+
getPrivateKey: (args: GetPrivateKeyArgs) => string;
|
|
17
|
+
getPrivateKeyFromWif: (wif: string) => string;
|
|
18
|
+
getScriptAddress: (args: GetScriptAddressArgs) => GetScriptAddressReturn;
|
|
19
|
+
signMessageBase64: (args: SignMessageArgs) => string;
|
|
20
|
+
}
|
|
21
|
+
interface ScriptPubkeyReturn {
|
|
22
|
+
scriptPubkey: string;
|
|
23
|
+
redeemScript?: string;
|
|
24
|
+
}
|
|
25
|
+
interface ScriptPubkeyToAddressArgs {
|
|
26
|
+
scriptPubkey: string;
|
|
27
|
+
format: CurrencyFormat;
|
|
28
|
+
}
|
|
29
|
+
interface GetPrivateKeyArgs {
|
|
30
|
+
path: AddressPath;
|
|
31
|
+
xprivKeys: CurrencyFormatKeys;
|
|
32
|
+
}
|
|
33
|
+
interface GetScriptAddressArgs {
|
|
34
|
+
path: AddressPath;
|
|
35
|
+
scriptTemplate: ScriptTemplate;
|
|
36
|
+
}
|
|
37
|
+
interface AddressReturn {
|
|
38
|
+
address: string;
|
|
39
|
+
legacyAddress: string;
|
|
40
|
+
}
|
|
41
|
+
interface GetScriptAddressReturn {
|
|
42
|
+
address: string;
|
|
43
|
+
scriptPubkey: string;
|
|
44
|
+
redeemScript: string;
|
|
45
|
+
}
|
|
46
|
+
interface SignMessageArgs {
|
|
47
|
+
path: AddressPath;
|
|
48
|
+
message: string;
|
|
49
|
+
xprivKeys: CurrencyFormatKeys;
|
|
50
|
+
}
|
|
51
|
+
export declare function makeUtxoWalletTools(config: WalletToolsConfig): UTXOPluginWalletTools;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EdgeFetchFunction, EdgePaymentProtocolInfo, EdgeSpendTarget } from 'edge-core-js/types';
|
|
2
|
+
interface BitPayOutput {
|
|
3
|
+
amount: number;
|
|
4
|
+
address: string;
|
|
5
|
+
}
|
|
6
|
+
interface getSpendTargetsReturn {
|
|
7
|
+
nativeAmount: number;
|
|
8
|
+
spendTargets: EdgeSpendTarget[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getSpendTargets(outputs: BitPayOutput[]): getSpendTargetsReturn;
|
|
11
|
+
export declare function getPaymentDetails(paymentProtocolURL: string, currencyCode: string, fetch: EdgeFetchFunction): Promise<EdgePaymentProtocolInfo>;
|
|
12
|
+
interface CreatePaymentReturn {
|
|
13
|
+
currency: string;
|
|
14
|
+
transactions: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function createPayment(tx: string, currencyCode: string): CreatePaymentReturn;
|
|
17
|
+
export declare function sendPayment(fetch: EdgeFetchFunction, paymentUrl: string, payment: unknown): Promise<any>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { EdgeSpendInfo } from 'edge-core-js/types';
|
|
2
|
+
import { Input, Output } from '../keymanager/utxopicker/types';
|
|
3
|
+
export declare const asUtxoUserSettings: import("cleaners").ObjectCleaner<{
|
|
4
|
+
blockbookServers: string[];
|
|
5
|
+
enableCustomServers: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare type UtxoUserSettings = ReturnType<typeof asUtxoUserSettings>;
|
|
8
|
+
export interface UtxoTxOtherParams {
|
|
9
|
+
txJson?: {
|
|
10
|
+
hex?: string;
|
|
11
|
+
};
|
|
12
|
+
psbt?: {
|
|
13
|
+
base64: string;
|
|
14
|
+
inputs: Input[];
|
|
15
|
+
outputs: Output[];
|
|
16
|
+
};
|
|
17
|
+
edgeSpendInfo?: EdgeSpendInfo;
|
|
18
|
+
ourScriptPubkeys: string[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EdgeTransaction } from 'edge-core-js';
|
|
2
|
+
import { IProcessorTransaction } from '../../db/types';
|
|
3
|
+
export declare const defaultValidateConfirmations: (tx: IProcessorTransaction, blockHeight: number, requiredConfirmations?: number) => EdgeTransaction['confirmations'];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EngineInfo } from '../../../plugin/types';
|
|
2
|
+
import { Processor } from '../../db/makeProcessor';
|
|
3
|
+
import { IProcessorTransaction, IUTXO } from '../../db/types';
|
|
4
|
+
export declare const getOwnUtxosFromTx: (engineInfo: EngineInfo, processor: Processor, tx: IProcessorTransaction) => Promise<IUTXO[]>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Disklet } from 'disklet';
|
|
2
|
+
import { EdgeParsedUri } from 'edge-core-js/types';
|
|
3
|
+
import { CurrencyFormat } from '../../plugin/types';
|
|
4
|
+
import { IUTXO } from '../db/types';
|
|
5
|
+
import { ScriptTemplates } from '../info/scriptTemplates/types';
|
|
6
|
+
import { PrivateKey } from '../keymanager/cleaners';
|
|
7
|
+
import { AddressTypeEnum, BIP43PurposeTypeEnum, ScriptTypeEnum } from '../keymanager/keymanager';
|
|
8
|
+
export declare const getCurrencyFormatFromPurposeType: (purpose: BIP43PurposeTypeEnum) => CurrencyFormat;
|
|
9
|
+
export declare const getAddressTypeFromKeys: (privateKey: PrivateKey) => AddressTypeEnum;
|
|
10
|
+
export declare const getAddressTypeFromPurposeType: (purpose: BIP43PurposeTypeEnum) => AddressTypeEnum;
|
|
11
|
+
export declare const getScriptTypeFromPurposeType: (purpose: BIP43PurposeTypeEnum, redeemScript?: string | undefined, scriptTemplates?: ScriptTemplates | undefined) => ScriptTypeEnum;
|
|
12
|
+
export declare const validScriptPubkeyFromAddress: (args: {
|
|
13
|
+
address: string;
|
|
14
|
+
coin: string;
|
|
15
|
+
}) => string;
|
|
16
|
+
export declare const getFormatSupportedBranches: (format: CurrencyFormat) => number[];
|
|
17
|
+
export declare const currencyFormatToPurposeType: (format: CurrencyFormat) => BIP43PurposeTypeEnum;
|
|
18
|
+
export declare type CurrencyFormatKeys = {
|
|
19
|
+
[format in CurrencyFormat]?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const fetchOrDeriveXprivFromKeys: (args: {
|
|
22
|
+
privateKey: PrivateKey;
|
|
23
|
+
walletLocalEncryptedDisklet: Disklet;
|
|
24
|
+
coin: string;
|
|
25
|
+
}) => Promise<CurrencyFormatKeys>;
|
|
26
|
+
export declare const deriveXprivFromKeys: (args: {
|
|
27
|
+
privateKey: PrivateKey;
|
|
28
|
+
coin: string;
|
|
29
|
+
}) => CurrencyFormatKeys;
|
|
30
|
+
export declare const deriveXpubsFromKeys: (args: {
|
|
31
|
+
privateKey: PrivateKey;
|
|
32
|
+
coin: string;
|
|
33
|
+
}) => CurrencyFormatKeys;
|
|
34
|
+
export declare const deriveXpub: (args: {
|
|
35
|
+
privateKey: PrivateKey;
|
|
36
|
+
coin: string;
|
|
37
|
+
type: BIP43PurposeTypeEnum;
|
|
38
|
+
}) => string;
|
|
39
|
+
export declare const parsePathname: (args: {
|
|
40
|
+
pathname: string;
|
|
41
|
+
coin: string;
|
|
42
|
+
}) => EdgeParsedUri;
|
|
43
|
+
export declare const sumUtxos: (utxos: IUTXO[]) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { info as badcoin } from './badcoin';
|
|
2
|
+
export { info as bitcoin } from './bitcoin';
|
|
3
|
+
export { info as bitcoincash } from './bitcoincash';
|
|
4
|
+
export { info as bitcoincashtestnet } from './bitcoincashtestnet';
|
|
5
|
+
export { info as bitcoingold } from './bitcoingold';
|
|
6
|
+
export { info as bitcoingoldtestnet } from './bitcoingoldtestnet';
|
|
7
|
+
export { info as bitcoinsv } from './bitcoinsv';
|
|
8
|
+
export { info as bitcointestnet } from './bitcointestnet';
|
|
9
|
+
export { info as dash } from './dash';
|
|
10
|
+
export { info as digibyte } from './digibyte';
|
|
11
|
+
export { info as dogecoin } from './dogecoin';
|
|
12
|
+
export { info as eboost } from './eboost';
|
|
13
|
+
export { info as feathercoin } from './feathercoin';
|
|
14
|
+
export { info as groestlcoin } from './groestlcoin';
|
|
15
|
+
export { info as litecoin } from './litecoin';
|
|
16
|
+
export { info as qtum } from './qtum';
|
|
17
|
+
export { info as ravencoin } from './ravencoin';
|
|
18
|
+
export { info as smartcash } from './smartcash';
|
|
19
|
+
export { info as ufo } from './ufo';
|
|
20
|
+
export { info as vertcoin } from './vertcoin';
|
|
21
|
+
export { info as zcoin } from './zcoin';
|
|
22
|
+
export declare const all: import("../../plugin/types").PluginInfo[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EdgeCurrencyInfo } from 'edge-core-js/types';
|
|
2
|
+
import { CoinInfo, EngineInfo, PluginInfo } from '../../plugin/types';
|
|
3
|
+
export declare const currencyInfo: EdgeCurrencyInfo;
|
|
4
|
+
export declare const engineInfo: EngineInfo;
|
|
5
|
+
export declare const coinInfo: CoinInfo;
|
|
6
|
+
export declare const info: PluginInfo;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EdgeCurrencyInfo } from 'edge-core-js/types';
|
|
2
|
+
import { CoinInfo, EngineInfo, PluginInfo } from '../../plugin/types';
|
|
3
|
+
export declare const currencyInfo: EdgeCurrencyInfo;
|
|
4
|
+
export declare const engineInfo: EngineInfo;
|
|
5
|
+
export declare const coinInfo: CoinInfo;
|
|
6
|
+
export declare const info: PluginInfo;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EdgeCurrencyInfo } from 'edge-core-js/types';
|
|
2
|
+
import { CoinInfo, EngineInfo, PluginInfo } from '../../plugin/types';
|
|
3
|
+
export declare const currencyInfo: EdgeCurrencyInfo;
|
|
4
|
+
export declare const engineInfo: EngineInfo;
|
|
5
|
+
export declare const coinInfo: CoinInfo;
|
|
6
|
+
export declare const info: PluginInfo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ScriptTemplates {
|
|
2
|
+
[key: string]: ScriptTemplate;
|
|
3
|
+
}
|
|
4
|
+
export declare type ScriptTemplate = (pubkey: string, optionalArgs?: OptionalScriptTemplateArgs) => string;
|
|
5
|
+
export interface OptionalScriptTemplateArgs {
|
|
6
|
+
cdsSig?: string;
|
|
7
|
+
cdsMsg?: string;
|
|
8
|
+
cdsPubKey?: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EdgeCurrencyInfo } from 'edge-core-js/types';
|
|
2
|
+
import { CoinInfo, EngineInfo, PluginInfo } from '../../plugin/types';
|
|
3
|
+
export declare const currencyInfo: EdgeCurrencyInfo;
|
|
4
|
+
export declare const engineInfo: EngineInfo;
|
|
5
|
+
export declare const coinInfo: CoinInfo;
|
|
6
|
+
export declare const info: PluginInfo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
interface Base58BaseReturn {
|
|
4
|
+
encode: (payload: Buffer) => string;
|
|
5
|
+
decode: (stringPayload: string | undefined) => Buffer;
|
|
6
|
+
decodeUnsafe: (stringPayload: string) => Buffer | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function base58Base(checksumFn: (buffer: Buffer) => Buffer): Base58BaseReturn;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki
|
|
3
|
+
*/
|
|
4
|
+
import { Input, Output } from './utxopicker';
|
|
5
|
+
/***
|
|
6
|
+
* Previous transaction hashes (in reversed byte-order) are to be sorted in ascending order, lexicographically.
|
|
7
|
+
* In the event of two matching transaction hashes,
|
|
8
|
+
* the respective previous output indices will be compared by their integer value, in ascending order.
|
|
9
|
+
* If the previous output indices match, the inputs are considered equal.
|
|
10
|
+
*/
|
|
11
|
+
export declare const sortInputs: (inputs: Input[]) => Input[];
|
|
12
|
+
/***
|
|
13
|
+
* Transaction output amounts (as 64-bit unsigned integers) are to be sorted in ascending order.
|
|
14
|
+
* In the event of two matching output amounts,
|
|
15
|
+
* the respective output scriptPubKeys (as a byte-array) will be compared lexicographically, in ascending order.
|
|
16
|
+
* If the scriptPubKeys match, the outputs are considered equal.
|
|
17
|
+
* If the previous output indices match, the inputs are considered equal.
|
|
18
|
+
*/
|
|
19
|
+
export declare const sortOutputs: (outputs: Output[]) => Output[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* https://github.com/bitcoincashjs/cashaddr
|
|
3
|
+
* Copyright (c) 2018 Matias Alejo Garcia
|
|
4
|
+
* Copyright (c) 2017 Emilio Almansi
|
|
5
|
+
* Distributed under the MIT software license, see the accompanying
|
|
6
|
+
* file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
|
7
|
+
*/
|
|
8
|
+
/***
|
|
9
|
+
* Encodes the given array of 5-bit integers as a base32-encoded string.
|
|
10
|
+
*
|
|
11
|
+
* @param {Array} data Array of integers between 0 and 31 inclusive.
|
|
12
|
+
*/
|
|
13
|
+
export declare function encode(data: number[]): string;
|
|
14
|
+
/***
|
|
15
|
+
* Decodes the given base32-encoded string into an array of 5-bit integers.
|
|
16
|
+
*
|
|
17
|
+
* @param {string} base32
|
|
18
|
+
*/
|
|
19
|
+
export declare function decode(base32: string): number[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Buffer } from 'buffer';
|
|
3
|
+
export declare enum CashaddrTypeEnum {
|
|
4
|
+
pubkeyhash = "pubkeyhash",
|
|
5
|
+
scripthash = "scripthash"
|
|
6
|
+
}
|
|
7
|
+
export interface BitcoinCashScriptHash {
|
|
8
|
+
scriptHash: Buffer;
|
|
9
|
+
type: CashaddrTypeEnum;
|
|
10
|
+
}
|
|
11
|
+
export declare const hashToCashAddress: (scriptHash: string, type: CashaddrTypeEnum, cashAddrPrefix: string, includePrefix?: boolean) => string;
|
|
12
|
+
export declare const cashAddressToHash: (address: string, cashAddrPrefixes: string[]) => BitcoinCashScriptHash;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Cleaner } from 'cleaners';
|
|
2
|
+
import { CurrencyFormat, PluginInfo } from '../../plugin/types';
|
|
3
|
+
/**
|
|
4
|
+
* A cleaner for the private key format following the key-formats specification.
|
|
5
|
+
*
|
|
6
|
+
* (spec: https://github.com/EdgeApp/edge-core-js/blob/master/docs/key-formats.md)
|
|
7
|
+
*/
|
|
8
|
+
export interface PrivateKey {
|
|
9
|
+
coinType: number;
|
|
10
|
+
format: CurrencyFormat;
|
|
11
|
+
imported?: boolean;
|
|
12
|
+
seed: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function asPrivateKey(coinName: string, coinType?: number): Cleaner<PrivateKey>;
|
|
15
|
+
/**
|
|
16
|
+
* A cleaner for the public key format following the key-formats specification.
|
|
17
|
+
*
|
|
18
|
+
* (spec: https://github.com/EdgeApp/edge-core-js/blob/master/docs/key-formats.md)
|
|
19
|
+
*/
|
|
20
|
+
export interface PublicKey {
|
|
21
|
+
publicKeys: {
|
|
22
|
+
[format in CurrencyFormat]?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const asPublicKey: Cleaner<PublicKey>;
|
|
26
|
+
/**
|
|
27
|
+
* This utility returns a wallet's supported formats as specified in the
|
|
28
|
+
* key-formats specification.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getSupportedFormats: (format: CurrencyFormat) => CurrencyFormat[];
|
|
31
|
+
/**
|
|
32
|
+
* A cleaner that desensitizes the walletInfo object, excluding sensitive
|
|
33
|
+
* keys (seed/mnemonic, sync key, data key, etc). By using this object type
|
|
34
|
+
* internally within the plugin, we can minimize risk of leaking sensitive data.
|
|
35
|
+
*
|
|
36
|
+
* It also includes internal derived data (publicKey, format, walletFormats, etc).
|
|
37
|
+
* This derived data is to be used internally within the plugin and saved to disk (publicKey).
|
|
38
|
+
*
|
|
39
|
+
* The `walletFormats` field is a list of formats from which to derive
|
|
40
|
+
* extended-keys for the wallet.
|
|
41
|
+
*
|
|
42
|
+
* The `primaryFormat` field is the default format from which to derive
|
|
43
|
+
* addresses from.
|
|
44
|
+
*/
|
|
45
|
+
export interface NumbWalletInfo {
|
|
46
|
+
id: string;
|
|
47
|
+
type: string;
|
|
48
|
+
keys: {
|
|
49
|
+
imported?: boolean;
|
|
50
|
+
primaryFormat: CurrencyFormat;
|
|
51
|
+
publicKey: PublicKey;
|
|
52
|
+
walletFormats: CurrencyFormat[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export declare const asNumbWalletInfo: (pluginInfo: PluginInfo) => Cleaner<NumbWalletInfo>;
|