Skip to content

Commit aefca91

Browse files
committed
Added demo Dappleths to store
1 parent 36eb7c0 commit aefca91

30 files changed

+9799
-0
lines changed

Ropsten/0/index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<style>
2+
/*
3+
Dappleth UI could use ionic 1.x css
4+
components
5+
https://ionicframework.com/docs/v1/components/
6+
icons
7+
http://ionicons.com/
8+
Use <style> to add your custom additional css
9+
*/
10+
</style>
11+
<dappleth-header>
12+
<!-- Header Page
13+
An empty header will include a default header.
14+
15+
Attributes:
16+
- styleclass
17+
Use styleclass to set a custom class to header
18+
i.e.: <dappleth-header styleclass="bar bar-header bar-positive">
19+
to set a blue (positive) bar
20+
(see https://ionicframework.com/docs/v1/components/ for more...)
21+
22+
Footer tags can be removed, mind to add some button to close Dappleth
23+
i.e.: <button class="button button-clear" on-touch="close()">
24+
<i class="icon ion-ios-arrow-back dark"></i>
25+
</button>
26+
-->
27+
</dappleth-header>
28+
<dappleth-content>
29+
<!-- Content Page
30+
Write your Page using all the components of Ionic 1.x
31+
visit https://ionicframework.com/docs/v1/components/ for more
32+
i.e.: <div class="list">
33+
<a class="item item-icon-left" ng-click="getMails()">
34+
<i class="icon ion-email"></i>
35+
Check mail
36+
</a>
37+
</div>
38+
39+
You can otherwise write your own html and css in this content page
40+
-->
41+
42+
<div class="card item-avatar-left">
43+
<h3>Hello World <i class="icon ion-ios-world"></i></h3>
44+
</div>
45+
</dappleth-content>
46+
<dappleth-footer>
47+
<!-- Footer Page
48+
An empty footer will include a default header.
49+
50+
Attributes:
51+
- styleclass
52+
Use styleclass to set a custom class to header
53+
i.e.: <dappleth-header styleclass="bar bar-header bar-positive">
54+
to set a blue (positive) bar
55+
(see https://ionicframework.com/docs/v1/components/ for more...)
56+
57+
Footer tags can be removed.
58+
-->
59+
</dappleth-footer>

Ropsten/0/index.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
var dappleth = (function(){
2+
//global variables
3+
var Dapp;
4+
var dappContract;
5+
6+
//init internal methods
7+
var _init = function(core) {
8+
//use menmonic $scope variable for core functions and scope
9+
$scope = core.scope;
10+
//use mnemonic $service variable for core API
11+
$service = core.service;
12+
//use mnemonic Dapp variable for current Dappleth
13+
Dapp = $scope.Dapp.activeApp;
14+
//install contract on global variable dappContract (could be an array of contracts)
15+
dappContract = web3.eth.contract(Dapp.Contracts[0].ABI).at(Dapp.Contracts[0].Address);
16+
//extend angular core scope with the scope of this Dapps
17+
angular.extend($scope, context);
18+
}
19+
20+
//exit internal method
21+
var _exit = function(){
22+
//called externally on closing Dappleth
23+
//write here function to clean enviroment befor leave
24+
console.log('bye bye');
25+
};
26+
27+
//container for function binded on UI
28+
var context = {
29+
//generic function called on refresh
30+
dappRefresh: function(value){
31+
//...
32+
$scope.$broadcast('scroll.refreshComplete');
33+
},
34+
//sample API call to get your balance from UI
35+
myBalance: function(){
36+
return $service.balance()
37+
},
38+
//exit and return to wallet
39+
close: function(){
40+
$service.exit();
41+
},
42+
//basic void sample function
43+
getMail: function(){
44+
console.log('getMail called!');
45+
}
46+
};
47+
48+
//don't edit: start and end functions called externally
49+
return {
50+
run: _init,
51+
exit: _exit
52+
};
53+
})();
54+

Ropsten/0/logo.png

276 KB
Loading

Ropsten/1/logomini.png

13.2 KB
Loading

Ropsten/2/index.html

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<style>
2+
body {
3+
cursor: url('https://ionicframework.com/img/finger.png'), auto;
4+
}
5+
.slider {
6+
height: 100%;
7+
}
8+
.slider-slide {
9+
padding-top: 50px;
10+
color: #000;
11+
background-color: #fff;
12+
text-align: center;
13+
14+
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
15+
font-weight: 200;
16+
}
17+
18+
#logo {
19+
margin: 30px 0px;
20+
}
21+
22+
#list {
23+
width: 170px;
24+
margin: 30px auto;
25+
font-size: 20px;
26+
}
27+
#list ol {
28+
margin-top: 30px;
29+
}
30+
#list ol li {
31+
text-align: left;
32+
list-style: decimal;
33+
margin: 10px 0px;
34+
}
35+
36+
.button.ng-hide{
37+
display:none;
38+
}
39+
</style>
40+
<dappleth-header></dappleth-header>
41+
<dappleth-content>
42+
<div class="button-bar padding" ng-show="slideIndex == 4">
43+
<button class="button button-small {{Dapp.read ? 'button' : 'button-outline'}} button-dark" ng-click="isRead(true)">
44+
Read</button>
45+
<button class="button button-small {{Dapp.read ? 'button-outline' : 'button'}} button-dark" ng-click="isRead(false)">
46+
Write</button>
47+
</div>
48+
<ion-slide-box show-pager="false" on-slide-changed="slideChanged(index)">
49+
<ion-slide>
50+
<h3>Are you ready to give a face to your smart contract?</h3>
51+
<div id="logo">
52+
<img ng-src="http://www.inzhoop.com/dappleths/dapp_1/logo.png" height="150px">
53+
</div>
54+
<div id="list">
55+
<h5>Just 3 steps, come on!</h5>
56+
</div>
57+
</ion-slide>
58+
<ion-slide>
59+
<h3>Smart Face</h3>
60+
61+
<div id="list">
62+
<h5>Step 1/3</h5>
63+
<ol>
64+
<li><b>Paste Address</b></li>
65+
<li>Paste ABI</li>
66+
<li>Play</li>
67+
</ol>
68+
</div>
69+
<div class="list">
70+
<label class="item item-input item-floating-label">
71+
<span class="input-label">Contract Address</span>
72+
<input type="text" placeholder="Type or paste address" ng-model="Dapp.activeApp.Address">
73+
</label>
74+
</div>
75+
</ion-slide>
76+
<ion-slide>
77+
<h3>Smart Face</h3>
78+
79+
<div id="list">
80+
<h5>Step 2/3</h5>
81+
<ol>
82+
<li>Paste Address</li>
83+
<li><b>Paste ABI</b></li>
84+
<li>Play</li>
85+
</ol>
86+
</div>
87+
<div class="list">
88+
<label class="item item-input item-floating-label">
89+
<span class="input-label">Contract ABI</span>
90+
<textarea placeholder="Paste ABI" rows="8" cols="10" ng-model="Dapp.activeApp.ABI">
91+
</textarea>
92+
</label>
93+
</div>
94+
</ion-slide>
95+
<ion-slide>
96+
<h3>Smart Face</h3>
97+
98+
<div id="list">
99+
<h5>Step 3/3</h5>
100+
<ol>
101+
<li>Paste Address</li>
102+
<li>Paste ABI</li>
103+
<li><b>Play</b></li>
104+
</ol>
105+
</div>
106+
<button class="button button-positive button-block" ng-click="install()"> Install </button>
107+
</ion-slide>
108+
<ion-slide>
109+
<div class="list text-left">
110+
111+
<a class="item item-icon-left" ng-repeat="f in Dapp.functions | filter:{type:'function', constant: Dapp.read}" ng-click="funCall(f.name)">
112+
<i class="icon ion-code-working"></i>
113+
{{f.name}}
114+
<span class="item-note">{{f.type}}</span>
115+
<!--span class="badge badge-assertive">0</span-->
116+
</a>
117+
118+
</div>
119+
120+
</ion-slide>
121+
</ion-slide-box>
122+
123+
124+
</dappleth-content>
125+
<dappleth-footer>
126+
<div class="bar bar-footer bar-assertive">
127+
<a class="button icon-left ion-chevron-left button-clear button-light" ng-click="previous()" ng-show="slideIndex > 0"> Previous</a>
128+
<a class="button icon-right ion-chevron-right button-clear button-light" ng-click="next()" ng-show="slideIndex < 3">Next </a>
129+
</div>
130+
</dappleth-footer>

Ropsten/2/index.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
var dappleth = (function(){
2+
var dappContract;
3+
var Dapp;
4+
var ABI;
5+
6+
var _init = function(core) {
7+
$scope = core.scope;
8+
$service = core.service;
9+
10+
Dapp = $scope.Dapp.activeApp;
11+
Dapp.Address = "0xf8374f01dd4960a6ea6192f36f451e111cabf3b3";
12+
Dapp.ABI = '[{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"greet","outputs":[{"name":"","type":"string"}],"type":"function"},{"inputs":[{"name":"_greeting","type":"string"}],"type":"constructor"}]';
13+
14+
15+
_start();
16+
}
17+
18+
var _exit = function(){
19+
//
20+
}
21+
22+
var _start = function() {
23+
$scope.slideIndex=0;
24+
$scope.Dapp.read = true;
25+
26+
$scope.dappRefresh = function(value){
27+
$D.scope.$broadcast('scroll.refreshComplete');
28+
}
29+
30+
$scope.isRead = function(value){
31+
$scope.Dapp.read = value;
32+
}
33+
34+
$scope.next = function() {
35+
$service.nextSlide();
36+
};
37+
38+
$scope.previous = function() {
39+
$service.prevSlide();
40+
$scope.start= false;
41+
};
42+
43+
$scope.startApp = function() {
44+
$scope.start= true;
45+
};
46+
47+
$scope.slideChanged = function(index) {
48+
$scope.slideIndex = index;
49+
};
50+
51+
$scope.install = function() {
52+
$scope.Dapp.functions = JSON.parse(Dapp.ABI);
53+
dappContract = web3.eth.contract($scope.Dapp.functions).at(Dapp.Address);
54+
$service.nextSlide();
55+
};
56+
57+
$scope.funCall = function(f) {
58+
if($scope.Dapp.read){
59+
var res = dappContract[f].apply();
60+
$service.popupAlert("Call " + f, res);
61+
}
62+
};
63+
}
64+
65+
return {
66+
run: _init,
67+
exit: _exit
68+
};
69+
70+
})();
71+

Ropsten/2/logo.png

101 KB
Loading

0 commit comments

Comments
 (0)