Skip to content
This repository was archived by the owner on Aug 24, 2021. It is now read-only.

Commit 864911d

Browse files
Merge pull request #331 from gnosis/develop
Develop
2 parents 1a389e8 + 2e8285f commit 864911d

10 files changed

Lines changed: 374 additions & 15 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Ethereum Multisignature Wallet
55

66
The purpose of multisig wallets is to increase security by requiring multiple parties to agree on transactions before execution. Transactions can be executed only when confirmed by a predefined number of owners. A web user interface can be found [here](/dapp).
77

8+
**NOTE:** Not compatible with current NodeJS LTS. Recommended NodeJS version is v6.17.1 (last LTS for v6).
9+
810
Features
911
-------------
1012

@@ -30,8 +32,20 @@ Being used by
3032
Install
3133
-------------
3234
```
35+
# For Ubuntu/Debian you need to install libusb development headers
36+
apt install -y libusb-1.0-0-dev
37+
3338
git clone https://github.com/gnosis/MultiSigWallet.git
3439
cd MultiSigWallet
40+
41+
# Latest NodeJS (v12.13.0) does NOT appear to work correctly.
42+
# You should use NVM and install Node v6.17.1 for best results: https://github.com/nvm-sh/nvm
43+
# Tested by @Privex on 2019-Nov-06 with v6.17.1 with success
44+
nvm install v6.17.1
45+
46+
# node-gyp is required for 'npm install' to work correctly
47+
npm install node-gyp
48+
3549
npm install
3650
```
3751

dapp/Gruntfile.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
const DAPP_PORT = process.env.DAPP_PORT || 8282;
2+
const DAPP_HOST = process.env.DAPP_HOST || "0.0.0.0";
3+
const DAPP_CERT = process.env.DAPP_CERT || "localhost.crt";
4+
const DAPP_KEY = process.env.DAPP_KEY || "localhost.key";
5+
16
module.exports = function(grunt) {
27

38
// Project configuration.
@@ -13,13 +18,13 @@ module.exports = function(grunt) {
1318
// the server port
1419
// can also be written as a function, e.g.
1520
// port: function() { return 8282; }
16-
port: 8282,
21+
port: DAPP_PORT,
1722

1823
// the host ip address
1924
// If specified to, for example, "127.0.0.1" the server will
2025
// only be available on that ip.
2126
// Specify "0.0.0.0" to be available everywhere
22-
host: "0.0.0.0",
27+
host: DAPP_HOST,
2328

2429
// cache: <sec>,
2530
showDir : true,
@@ -37,13 +42,13 @@ module.exports = function(grunt) {
3742
// the server port
3843
// can also be written as a function, e.g.
3944
// port: function() { return 8282; }
40-
port: 8282,
45+
port: DAPP_PORT,
4146

4247
// the host ip address
4348
// If specified to, for example, "127.0.0.1" the server will
4449
// only be available on that ip.
4550
// Specify "0.0.0.0" to be available everywhere
46-
host: "0.0.0.0",
51+
host: DAPP_HOST,
4752

4853
// cache: <sec>,
4954
showDir : true,
@@ -66,8 +71,8 @@ module.exports = function(grunt) {
6671
/// Use 'https: true' for default module SSL configuration
6772
/// (default state is disabled)
6873
https: {
69-
cert: "localhost.crt",
70-
key : "localhost.key"
74+
cert: DAPP_CERT,
75+
key: DAPP_KEY
7176
},
7277
//
7378
// // Tell grunt task to open the browser

dapp/Readme.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,26 @@ A web user interface for the [MultiSigWallet](https://github.com/gnosis/MultiSig
55

66
Requirements
77
-------------
8-
* Node v5+
8+
* Node v5+ (Confirmed working on v6.17.1 - will not work on current LTS v12.13.0)
99
* [Grunt-cli](http://gruntjs.com/getting-started#installing-the-cli)
1010

1111
Install
1212
-------------
1313
```
14+
# For Ubuntu/Debian you need to install libusb development headers
15+
apt install -y libusb-1.0-0-dev
16+
17+
# Latest NodeJS (v12.13.0) does NOT appear to work correctly.
18+
# You should use NVM and install Node v6.17.1 for best results: https://github.com/nvm-sh/nvm
19+
# Tested by @Privex on 2019-Nov-06 with v6.17.1 with success
20+
nvm install v6.17.1
21+
22+
git clone https://github.com/gnosis/MultiSigWallet.git
23+
cd MultiSigWallet/dapp
24+
25+
# node-gyp is required for 'npm install' to work correctly
26+
npm install node-gyp
27+
1428
npm install -g grunt-cli
1529
npm install
1630
grunt
@@ -35,4 +49,4 @@ Desktop version
3549

3650
```
3751
npm run build-libs-electron
38-
```
52+
```

dapp/css/app.css

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,67 @@ input[name="editable-select"]:disabled {
179179
::selection {
180180
background: #b3c3ce;
181181
}
182+
183+
.safe-migration-btn {
184+
background: #1ba5c2;
185+
color: #ffffff;
186+
border: none;
187+
padding: 10px 15px 10px 15px;
188+
margin-top: 15px;
189+
font-size: 18px;
190+
}
191+
192+
/*.safe-migration-ul li:before {
193+
background: #2c4c61;
194+
}*/
195+
196+
.safe-migration-ul {
197+
list-style: none;
198+
margin-top: 20px;
199+
}
200+
201+
.safe-migration-ul li::before {
202+
content: counter(li);
203+
color: #9baeba;
204+
background: #2c4c61;
205+
display: inline-block;
206+
margin-left: -40px;
207+
border-radius: 50%;
208+
width: 28px;
209+
padding-left: 10px;
210+
height: 28px;
211+
padding-top: 3px;
212+
margin-right: 9px;
213+
}
214+
215+
.safe-migration-ul li {
216+
counter-increment: li;
217+
margin-bottom: 10px;
218+
}
219+
220+
.safe-features {
221+
height: 180px;
222+
}
223+
224+
/* .safe-features ul {
225+
list-style: none;
226+
} */
227+
228+
/* .safe-features li::before {
229+
content: "\2022";
230+
color: #1ba5c2;
231+
font-weight: bold;
232+
display: inline-block;
233+
width: 1em;
234+
margin-left: -1em;
235+
} */
236+
237+
.safe-features .left {
238+
float: left;
239+
max-width: 420px;
240+
}
241+
242+
.safe-features .right {
243+
float: right;
244+
max-width: 420px;
245+
}

dapp/src/bundles/css/bundle.css

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,69 @@ input[name="editable-select"]:disabled {
181181
background: #b3c3ce;
182182
}
183183

184+
.safe-migration-btn {
185+
background: #1ba5c2;
186+
color: #ffffff;
187+
border: none;
188+
padding: 10px 15px 10px 15px;
189+
margin-top: 15px;
190+
font-size: 18px;
191+
}
192+
193+
/*.safe-migration-ul li:before {
194+
background: #2c4c61;
195+
}*/
196+
197+
.safe-migration-ul {
198+
list-style: none;
199+
margin-top: 20px;
200+
}
201+
202+
.safe-migration-ul li::before {
203+
content: counter(li);
204+
color: #9baeba;
205+
background: #2c4c61;
206+
display: inline-block;
207+
margin-left: -40px;
208+
border-radius: 50%;
209+
width: 28px;
210+
padding-left: 10px;
211+
height: 28px;
212+
padding-top: 3px;
213+
margin-right: 9px;
214+
}
215+
216+
.safe-migration-ul li {
217+
counter-increment: li;
218+
margin-bottom: 10px;
219+
}
220+
221+
.safe-features {
222+
height: 180px;
223+
}
224+
225+
/* .safe-features ul {
226+
list-style: none;
227+
} */
228+
229+
/* .safe-features li::before {
230+
content: "\2022";
231+
color: #1ba5c2;
232+
font-weight: bold;
233+
display: inline-block;
234+
width: 1em;
235+
margin-left: -1em;
236+
} */
237+
238+
.safe-features .left {
239+
float: left;
240+
max-width: 420px;
241+
}
242+
243+
.safe-features .right {
244+
float: right;
245+
max-width: 420px;
246+
}
184247
/*!
185248
* Bootstrap v3.3.7 (http://getbootstrap.com)
186249
* Copyright 2011-2016 Twitter, Inc.

dapp/src/controllers/walletDetailCtrl.js

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,71 @@
5656
// Get address book from localStorage
5757
$scope.addressBook = JSON.parse(localStorage.getItem('addressBook') || '{}');
5858

59+
$scope.showSafeMigrationModal = function () {
60+
$uibModal.open({
61+
templateUrl: 'partials/modals/safeMigration.html',
62+
size: 'lg',
63+
resolve: {
64+
wallet: walletCopy
65+
},
66+
controller: function ($scope, $uibModalInstance, Wallet, wallet) {
67+
68+
$scope.data = {
69+
hideMigrationModal: walletCopy.safeMigrated
70+
};
71+
72+
// Get number of confirmations
73+
Wallet
74+
.getRequired(
75+
wallet.address,
76+
function (e, confirmations) {
77+
$scope.data.threshold = confirmations.toNumber();
78+
}
79+
).call();
80+
81+
// Get owners
82+
Wallet.getOwners(wallet.address, function (e, owners) {
83+
if (e) {
84+
Utils.dangerAlert(e);
85+
return;
86+
}
87+
88+
$scope.data.owners = owners.map(function (address) { return Web3Service.toChecksumAddress(address); });
89+
}).call();
90+
91+
$scope.create = function () {
92+
93+
var ownersAddresses = $scope.data.owners; // Object.keys(wallet.owners);
94+
var ownersNames = [];
95+
96+
for (var address of ownersAddresses) {
97+
ownersNames.push(wallet.owners[address].name);
98+
}
99+
100+
var url = 'https://gnosis-safe.io/open';
101+
url += '?name=' + wallet.name;
102+
url += '&threshold=' + $scope.data.threshold;
103+
url += '&owneraddresses=' + ownersAddresses.join(',');
104+
url += '&ownernames=' + ownersNames.join(',');
105+
106+
window.open(url);
107+
$scope.dismiss();
108+
};
109+
110+
$scope.dismiss = function () {
111+
if ($scope.data.hideMigrationModal == true) {
112+
// Don't show this modal again
113+
wallet.safeMigrated = true;
114+
} else {
115+
wallet.safeMigrated = false;
116+
}
117+
Wallet.updateWallet(wallet);
118+
$uibModalInstance.dismiss();
119+
};
120+
}
121+
});
122+
};
123+
59124
$scope.updateParams = function () {
60125

61126
var batch = Web3Service.web3.createBatch();
@@ -80,8 +145,8 @@
80145
// Check if the owners are in the wallet.owners object
81146
var walletOwnerskeys = $scope.wallet.owners ? Object.keys($scope.wallet.owners) : [];
82147

83-
if (!$scope.wallet.owners) {
84-
$scope.wallet.owners = {};
148+
if (!$scope.wallet.owners) {
149+
$scope.wallet.owners = {};
85150
$scope.owners.forEach(function (item, index) {
86151
$scope.wallet.owners[item] = {
87152
'name': 'Owner ' + (index + 1),
@@ -90,7 +155,7 @@
90155
if (index == $scope.owners.length-1) { // last item
91156
Wallet.updateWallet($scope.wallet);
92157
}
93-
});
158+
});
94159
} else {
95160
for (var x = 0; x < $scope.owners.length; x++) {
96161
// If owner not in list
@@ -113,6 +178,11 @@
113178
)
114179
);
115180

181+
// Handle migration modal
182+
if (!walletCopy.safeMigrated) {
183+
$scope.showSafeMigrationModal();
184+
}
185+
116186
// Get ETH Balance
117187
batch.add(
118188
Wallet.getBalance(
@@ -415,15 +485,15 @@
415485
/*$scope.getOwners = function () {
416486
var batch = Web3Service.web3.createBatch();
417487
$scope.owners = [];
418-
488+
419489
function assignOwner (e, owner) {
420490
if (owner) {
421491
$scope.$apply(function () {
422492
$scope.owners.push(owner);
423493
});
424494
}
425495
}
426-
496+
427497
for(var i=0; i<$scope.ownersNum; i++){
428498
// Get owners
429499
batch.add(

0 commit comments

Comments
 (0)