edge-currency-plugins 2.0.4 → 2.2.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.
Files changed (46) hide show
  1. package/lib/common/plugin/makeCurrencyTools.js +0 -5
  2. package/lib/common/plugin/types.js +3 -2
  3. package/lib/common/upgradeMemos.js +47 -0
  4. package/lib/common/utxobased/db/Models/ProcessorTransaction.js +7 -4
  5. package/lib/common/utxobased/engine/makeUtxoEngine.js +18 -18
  6. package/lib/common/utxobased/engine/utils.js +0 -13
  7. package/lib/common/utxobased/info/badcoin.js +6 -2
  8. package/lib/common/utxobased/info/bitcoin.js +6 -2
  9. package/lib/common/utxobased/info/bitcoincash.js +8 -4
  10. package/lib/common/utxobased/info/bitcoincashtestnet.js +8 -4
  11. package/lib/common/utxobased/info/bitcoingold.js +6 -2
  12. package/lib/common/utxobased/info/bitcoingoldtestnet.js +6 -2
  13. package/lib/common/utxobased/info/bitcoinsv.js +9 -5
  14. package/lib/common/utxobased/info/bitcointestnet.js +6 -2
  15. package/lib/common/utxobased/info/commonInfo.js +16 -0
  16. package/lib/common/utxobased/info/dash.js +7 -2
  17. package/lib/common/utxobased/info/digibyte.js +6 -2
  18. package/lib/common/utxobased/info/dogecoin.js +6 -2
  19. package/lib/common/utxobased/info/eboost.js +6 -2
  20. package/lib/common/utxobased/info/feathercoin.js +6 -2
  21. package/lib/common/utxobased/info/groestlcoin.js +6 -2
  22. package/lib/common/utxobased/info/litecoin.js +6 -2
  23. package/lib/common/utxobased/info/qtum.js +6 -2
  24. package/lib/common/utxobased/info/ravencoin.js +6 -2
  25. package/lib/common/utxobased/info/smartcash.js +6 -2
  26. package/lib/common/utxobased/info/ufo.js +6 -2
  27. package/lib/common/utxobased/info/vertcoin.js +6 -2
  28. package/lib/common/utxobased/info/zcoin.js +6 -2
  29. package/lib/common/utxobased/keymanager/bitcoincashUtils/base32.js +1 -2
  30. package/lib/common/utxobased/keymanager/bitcoincashUtils/cashAddress.js +1 -4
  31. package/lib/common/utxobased/keymanager/declarations/bs58smartcheck.d.js +4 -0
  32. package/lib/common/utxobased/keymanager/declarations/wif-smart.d.js +24 -0
  33. package/lib/common/utxobased/keymanager/keymanager.js +129 -84
  34. package/lib/common/utxobased/keymanager/utxopicker/utils.js +1 -3
  35. package/lib/common/validateMemos.js +107 -0
  36. package/lib/src/common/plugin/types.d.ts +6 -4
  37. package/lib/src/common/upgradeMemos.d.ts +6 -0
  38. package/lib/src/common/utxobased/engine/utils.d.ts +1 -2
  39. package/lib/src/common/utxobased/info/commonInfo.d.ts +2 -0
  40. package/lib/src/common/utxobased/keymanager/keymanager.d.ts +5 -11
  41. package/lib/src/common/validateMemos.d.ts +6 -0
  42. package/lib/src/util/cleaners.d.ts +6 -0
  43. package/lib/util/cleaners.js +18 -0
  44. package/package.json +12 -4
  45. package/lib/common/utxobased/keymanager/declarations/base58grscheck.d.js +0 -1
  46. package/lib/common/utxobased/keymanager/declarations/wifgrs.d.js +0 -1
@@ -1,4 +1,4 @@
1
- import { EdgeLog } from 'edge-core-js/types';
1
+ import { EdgeLog, EdgeMemo } from 'edge-core-js/types';
2
2
  import { ChangePath } from '../../plugin/types';
3
3
  import { IUTXO } from '../db/types';
4
4
  import { ScriptTemplate, ScriptTemplates } from '../info/scriptTemplates/types';
@@ -14,7 +14,8 @@ export declare enum AddressTypeEnum {
14
14
  p2pkh = "p2pkh",
15
15
  p2sh = "p2sh",
16
16
  p2wpkh = "p2wpkh",
17
- p2wsh = "p2wsh"
17
+ p2wsh = "p2wsh",
18
+ p2tr = "p2tr"
18
19
  }
19
20
  export declare enum ScriptTypeEnum {
20
21
  p2wpkh = "p2wpkh",
@@ -23,6 +24,7 @@ export declare enum ScriptTypeEnum {
23
24
  p2pk = "p2pk",
24
25
  p2pkh = "p2pkh",
25
26
  p2sh = "p2sh",
27
+ p2tr = "p2tr",
26
28
  replayProtection = "replayprotection",
27
29
  replayProtectionP2SH = "replayprotectionp2sh"
28
30
  }
@@ -132,6 +134,7 @@ export interface MakeTxArgs {
132
134
  forceUseUtxo: IUTXO[];
133
135
  utxos: IUTXO[];
134
136
  targets: MakeTxTarget[];
137
+ memos: EdgeMemo[];
135
138
  feeRate: number;
136
139
  setRBF: boolean;
137
140
  coin: string;
@@ -144,7 +147,6 @@ export interface MakeTxArgs {
144
147
  export interface MakeTxTarget {
145
148
  address?: string;
146
149
  value?: number;
147
- memo?: string | null;
148
150
  }
149
151
  interface MakeTxReturn extends Required<utxopicker.UtxoPickerResult> {
150
152
  hex: string;
@@ -159,14 +161,6 @@ interface SignTxReturn {
159
161
  id: string;
160
162
  hex: string;
161
163
  }
162
- export interface BitcoinJSNetwork {
163
- wif: number;
164
- bip32: Bip32;
165
- messagePrefix: string;
166
- bech32: string;
167
- pubKeyHash: number;
168
- scriptHash: number;
169
- }
170
164
  export interface Bip32 {
171
165
  public: number;
172
166
  private: number;
@@ -0,0 +1,6 @@
1
+ import { EdgeCurrencyInfo, EdgeSpendInfo } from 'edge-core-js/types';
2
+ /**
3
+ * Validates the memos on an spend request.
4
+ * Throws an error if any of the memos are wrong.
5
+ */
6
+ export declare function validateMemos(spendInfo: EdgeSpendInfo, currencyInfo: EdgeCurrencyInfo): void;
@@ -0,0 +1,6 @@
1
+ import { Cleaner } from 'cleaners';
2
+ /**
3
+ * A string of hex-encoded binary data.
4
+ */
5
+ export declare const asBase16: Cleaner<Uint8Array>;
6
+ export declare function asIntegerString(raw: unknown): string;
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _cleaners = require('cleaners');
2
+ var _rfc4648 = require('rfc4648');
3
+
4
+ /**
5
+ * A string of hex-encoded binary data.
6
+ */
7
+ const asBase16 = _cleaners.asCodec.call(void 0,
8
+ raw => _rfc4648.base16.parse(_cleaners.asString.call(void 0, raw)),
9
+ clean => _rfc4648.base16.stringify(clean).toLowerCase()
10
+ ); exports.asBase16 = asBase16
11
+
12
+ function asIntegerString(raw) {
13
+ const clean = _cleaners.asString.call(void 0, raw)
14
+ if (!/^\d+$/.test(clean)) {
15
+ throw new Error('Expected an integer string')
16
+ }
17
+ return clean
18
+ } exports.asIntegerString = asIntegerString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edge-currency-plugins",
3
- "version": "2.0.4",
3
+ "version": "2.2.0",
4
4
  "description": "Edge currency plugins to fetch and process wallet accounts, balances and transactions.",
5
5
  "repository": "https://github.com/EdgeApp/edge-currency-plugins",
6
6
  "license": "MIT",
@@ -33,7 +33,8 @@
33
33
  "*.{js,ts,json}": "eslint"
34
34
  },
35
35
  "dependencies": {
36
- "altcoin-js": "https://github.com/EdgeApp/altcoin-js.git#master",
36
+ "@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
37
+ "altcoin-js": "^1.0.0",
37
38
  "async-mutex": "^0.2.6",
38
39
  "baselet": "^0.2.4",
39
40
  "biggystring": "^4.0.0",
@@ -48,6 +49,7 @@
48
49
  "bs58smartcheck": "^2.0.4",
49
50
  "cleaners": "^0.3.12",
50
51
  "disklet": "^0.4.5",
52
+ "ecpair": "https://github.com/EdgeApp/ecpair.git#b193eb8ea2ec0c93b528f4b0223a605407ff43e4",
51
53
  "edge-sync-client": "^0.2.7",
52
54
  "memlet": "^0.1.7",
53
55
  "uri-js": "^4.4.0",
@@ -57,8 +59,10 @@
57
59
  "ws": "^7.4.6"
58
60
  },
59
61
  "devDependencies": {
62
+ "@types/base-x": "^3.0.6",
60
63
  "@types/bn.js": "^5.1.0",
61
64
  "@types/bs58": "^4.0.1",
65
+ "@types/bs58grscheck": "^2.1.0",
62
66
  "@types/chai": "^4.2.9",
63
67
  "@types/chai-as-promised": "^7.1.3",
64
68
  "@types/jsonfile": "^6.0.1",
@@ -67,12 +71,15 @@
67
71
  "@types/node-fetch": "2.x",
68
72
  "@types/request": "^2.48.7",
69
73
  "@types/url-parse": "^1.4.3",
74
+ "@types/wif": "^2.0.2",
75
+ "@types/wifgrs": "^2.0.0",
70
76
  "@types/ws": "^7.2.6",
71
77
  "@typescript-eslint/eslint-plugin": "^4.8.2",
72
78
  "@typescript-eslint/parser": "^4.8.2",
79
+ "base-x": "^4.0.0",
73
80
  "chai": "^4.2.0",
74
81
  "chai-as-promised": "^7.1.1",
75
- "edge-core-js": "^0.19.48",
82
+ "edge-core-js": "^1.6.0",
76
83
  "eslint": "^7.14.0",
77
84
  "eslint-config-standard-kit": "0.15.1",
78
85
  "eslint-plugin-import": "^2.22.1",
@@ -97,6 +104,7 @@
97
104
  "request": "^2.88.2",
98
105
  "rimraf": "^3.0.2",
99
106
  "sucrase": "^3.12.1",
100
- "typescript": "^4.1.2"
107
+ "typescript": "^4.1.2",
108
+ "wif": "^2.0.6"
101
109
  }
102
110
  }
@@ -1 +0,0 @@
1
- "use strict";