Skip to content

Commit 5f3f5a4

Browse files
committed
/common folder initial attempt
1 parent 1fc2fca commit 5f3f5a4

File tree

4 files changed

+262
-275
lines changed

4 files changed

+262
-275
lines changed
Lines changed: 40 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,45 @@
11
'use strict';
22

3-
var Constants = {};
4-
5-
Constants.SCRIPT_TYPES = {
6-
P2SH: 'P2SH',
7-
P2PKH: 'P2PKH',
8-
};
9-
10-
// not used, since Credentials 2.0
11-
Constants.DERIVATION_STRATEGIES = {
12-
BIP44: 'BIP44',
13-
BIP45: 'BIP45',
14-
BIP48: 'BIP48',
15-
};
16-
17-
Constants.PATHS = {
18-
REQUEST_KEY: "m/1'/0",
19-
// TXPROPOSAL_KEY: "m/1'/1",
20-
REQUEST_KEY_AUTH: "m/2", // relative to BASE
21-
};
22-
23-
Constants.BIP45_SHARED_INDEX = 0x80000000 - 1;
24-
25-
Constants.UNITS = {
26-
btc: {
27-
toSatoshis: 100000000,
28-
full: {
29-
maxDecimals: 8,
30-
minDecimals: 8,
31-
},
32-
short: {
33-
maxDecimals: 6,
34-
minDecimals: 2,
35-
}
3+
module.exports = {
4+
SCRIPT_TYPES: {
5+
P2SH: 'P2SH',
6+
P2PKH: 'P2PKH',
367
},
37-
bit: {
38-
toSatoshis: 100,
39-
full: {
40-
maxDecimals: 2,
41-
minDecimals: 2,
8+
// not used, since Credentials 2.0
9+
DERIVATION_STRATEGIES: {
10+
BIP44: 'BIP44',
11+
BIP45: 'BIP45',
12+
BIP48: 'BIP48',
13+
},
14+
PATHS: {
15+
REQUEST_KEY: "m/1'/0",
16+
// TXPROPOSAL_KEY: "m/1'/1",
17+
REQUEST_KEY_AUTH: "m/2", // relative to BASE
18+
},
19+
BIP45_SHARED_INDEX: 0x80000000 - 1,
20+
UNITS: {
21+
btc: {
22+
toSatoshis: 100000000,
23+
full: {
24+
maxDecimals: 8,
25+
minDecimals: 8,
26+
},
27+
short: {
28+
maxDecimals: 6,
29+
minDecimals: 2,
30+
}
31+
},
32+
bit: {
33+
toSatoshis: 100,
34+
full: {
35+
maxDecimals: 2,
36+
minDecimals: 2,
37+
},
38+
short: {
39+
maxDecimals: 0,
40+
minDecimals: 0,
41+
}
4242
},
43-
short: {
44-
maxDecimals: 0,
45-
minDecimals: 0,
46-
}
4743
},
48-
};
49-
50-
Constants.COINS = [ 'btc', 'bch'];
51-
52-
module.exports = Constants;
44+
COINS: ['btc', 'bch']
45+
}
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
'use strict';
22

3-
var Defaults = {};
4-
5-
Defaults.DEFAULT_FEE_PER_KB = 10000;
6-
Defaults.MIN_FEE_PER_KB = 0;
7-
Defaults.MAX_FEE_PER_KB = 1000000;
8-
Defaults.MAX_TX_FEE = 1 * 1e8;
9-
10-
module.exports = Defaults;
3+
module.exports = {
4+
DEFAULT_FEE_PER_KB: 10000,
5+
MIN_FEE_PER_KB: 0,
6+
MAX_FEE_PER_KB: 1000000,
7+
MAX_TX_FEE: 1 * 1e8
8+
};
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
var Common = {};
2-
3-
Common.Constants = require('./constants');
4-
Common.Defaults = require('./defaults');
5-
Common.Utils = require('./utils');
6-
7-
module.exports = Common;
1+
module.exports = {
2+
Constants: require('./constants'),
3+
Defaults: require('./defaults'),
4+
Utils: require('./utils')
5+
};

0 commit comments

Comments
 (0)