update meteor demo

This commit is contained in:
Iuri Matias 2015-07-09 22:51:51 -04:00
parent 89f731d61f
commit 93ba02aa25
17 changed files with 197 additions and 2 deletions

View File

@ -1,5 +1,5 @@
type: "grunt" #other options: meteor, manual
#contracts: ["app/contracts/**"]
#output: "generated/tmp/abi.js"
#contracts: ["app/contracts/**/*.sol"]
#output: "src/embark.js"
#blockchainConfig: "config/blockchain.yml"
#contractsConfig: "config/contracts.yml"

View File

@ -0,0 +1,8 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.
notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2

1
demo_meteor/.meteor/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
local

7
demo_meteor/.meteor/.id Normal file
View File

@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics
v2fbp61wvu7nd11xgkdz

View File

@ -0,0 +1,10 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-platform
autopublish
insecure
ethereum:web3

View File

@ -0,0 +1,2 @@
server
browser

View File

@ -0,0 +1 @@
METEOR@1.1.0.2

View File

@ -0,0 +1,49 @@
autopublish@1.0.3
autoupdate@1.2.1
base64@1.0.3
binary-heap@1.0.3
blaze@2.1.2
blaze-tools@1.0.3
boilerplate-generator@1.0.3
callback-hook@1.0.3
check@1.0.5
ddp@1.1.0
deps@1.0.7
ejson@1.0.6
ethereum:web3@0.8.1
fastclick@1.0.3
geojson-utils@1.0.3
html-tools@1.0.4
htmljs@1.0.4
http@1.1.0
id-map@1.0.3
insecure@1.0.3
jquery@1.11.3_2
json@1.0.3
launch-screen@1.0.2
livedata@1.0.13
logging@1.0.7
meteor@1.1.6
meteor-platform@1.2.2
minifiers@1.1.5
minimongo@1.0.8
mobile-status-bar@1.0.3
mongo@1.1.0
observe-sequence@1.0.6
ordered-dict@1.0.3
random@1.0.3
reactive-dict@1.1.0
reactive-var@1.0.5
reload@1.1.3
retry@1.0.3
routepolicy@1.0.5
session@1.1.0
spacebars@1.0.6
spacebars-compiler@1.0.6
templating@1.1.1
tracker@1.0.7
ui@1.0.6
underscore@1.0.3
url@1.0.4
webapp@1.2.0
webapp-hashing@1.0.3

View File

@ -0,0 +1 @@
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8101'));web3.eth.defaultAccount = web3.eth.accounts[0];SimpleStorageAbi = [{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"type":"constructor"}];SimpleStorageContract = web3.eth.contract(SimpleStorageAbi);SimpleStorage = SimpleStorageContract.at('0x823802b31f5856bcf5a8a99f791934f9593afbf8');

View File

@ -0,0 +1 @@
/* CSS declarations go here */

View File

@ -0,0 +1,29 @@
<head>
<title>Embark - SimpleStorage Demo</title>
</head>
<body>
<h3>Embark - SimpleStorage Demo</h3>
{{> set_value}}
{{> current_value}}
<div class="logs">
</div>
</body>
<template name="current_value">
<div>
<button class="get">Get Value</button>
<br>value is <span class="value">{{value}}</span>
</div>
</template>
<template name="set_value">
<div>
<input type="text" class="text" value="10">
<button class="set">Set Value</button>
</div>
</template>

View File

@ -0,0 +1,35 @@
if (Meteor.isClient) {
Session.setDefault('value', 0);
var addToLog = function(txt) {
$(".logs").append("<br>" + txt);
}
Template.current_value.helpers({
value: function () {
return Session.get('value');
}
});
Template.current_value.events({
'click button': function () {
var value = SimpleStorage.get().toNumber();
Session.set('value', value);
addToLog("SimpleStorage.get()");
}
});
Template.set_value.events({
'click button': function () {
var value = parseInt($("input.text").val(), 10);
SimpleStorage.set(value);
addToLog("SimpleStorage.set("+value+")");
}
});
}
if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
}

View File

@ -0,0 +1,23 @@
development:
rpc_host: localhost
rpc_port: 8101
rpc_whitelist: "*"
minerthreads: 1
datadir: /tmp/embark
mine_when_needed: true
gas_limit: 500000
gas_price: 10000000000000
console: false
account:
init: true
password: config/password
staging:
rpc_host: localhost
rpc_port: 8101
rpc_whitelist: "*"
datadir: default
network_id: 0
console: true
account:
init: false
address:

View File

@ -0,0 +1,8 @@
development:
SimpleStorage:
args:
- 100
staging:
SimpleStorage:
args:
- 100

View File

@ -0,0 +1 @@
dev_password

View File

@ -0,0 +1,14 @@
contract SimpleStorage {
uint public storedData;
function SimpleStorage(uint initialValue) {
storedData = initialValue;
}
function set(uint x) {
storedData = x;
}
function get() constant returns (uint retVal) {
return storedData;
}
}

5
demo_meteor/embark.yml Normal file
View File

@ -0,0 +1,5 @@
type: "meteor"
contracts: ["contracts/**/*.sol"]
output: "client/embark.js"
blockchainConfig: "config/blockchain.yml"
contractsConfig: "config/contracts.yml"