Skip to content

Commit 217f2af

Browse files
committed
Restructure files
1 parent 2c5d015 commit 217f2af

8 files changed

+49
-10
lines changed

contracts.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
contracts = {}
2+
3+
tmp.contracts = [
4+
'amIOnTheFork',
5+
'replaySafeSplit'
6+
]
7+
8+
tmp.contracts
9+
.forEach(function(contract) {
10+
loadScript('./contracts/' + contract + '.js')
11+
});

helpers.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
helpers = {}
2+
3+
tmp.helpers = [
4+
'filterByProperty',
5+
'capitalize',
6+
'ls',
7+
'converters',
8+
'newAccount',
9+
]
10+
11+
tmp.helpers
12+
.forEach(function(helper) {
13+
loadScript('./helpers/' + helper + '.js')
14+
});

helpers/capitalize.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
helpers.capitalize = function(string) {
2+
firstCharacter = string[0].toUpperCase();
3+
return(firstCharacter + string.slice(1, string.length))
4+
}

converters.js helpers/converters.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
meta.etherToWei = function(value) {
1+
helpers.etherToWei = function(value) {
22
return(
33
web3.toWei(value, "ether")
44
);
55
}
66

7-
meta.weiToEther = function(value) {
7+
helpers.weiToEther = function(value) {
88
return(
99
web3.fromWei(value, "ether")
1010
);

helpers/filterByProperty.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
helpers.filterByProperty = function(propertyName) {
2+
return(
3+
function(propertyValue) {
4+
return(
5+
this
6+
.filter(function(wallet) {
7+
return(
8+
(new RegExp(propertyValue, 'i')).test(wallet[propertyName])
9+
);
10+
})
11+
);
12+
}
13+
);
14+
}

ls.js helpers/ls.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
meta.ls = function(file) {
1+
helpers.ls = function(file) {
22
return loadScript(meta.scriptLocation + file + ".js");
33
}

newAccount.js helpers/newAccount.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
meta.newAccount = function(owner, label, type) {
1+
helpers.newAccount = function(owner, label, type) {
22
address = personal.newAccount();
33
account = {
44
address: address,

meta.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ if(meta.OS == 'linux') {
2121
meta.scriptDirectory = meta.home + "Ethereum/scripts/"
2222

2323
files = [
24-
'balances',
25-
'ls',
26-
'newAccount',
24+
'helpers',
25+
'contracts',
2726
'wallets',
28-
'converters',
29-
'contracts/amIOnTheFork',
30-
'contracts/replaySafeSplit'
3127
]
3228

3329
files.forEach(function(file) {

0 commit comments

Comments
 (0)