epm 0.3.14 → 0.3.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf17803b86f7df75b3bf30b52b66f510ad5e557f
4
- data.tar.gz: 232c2be0557e75d4fece75cc9c21405cfebc67b7
3
+ metadata.gz: 658f199c04cc037f671f8cda22d5c5ad557eb7ea
4
+ data.tar.gz: 6014e7668e96680c13b8b815397c22ba5facd4d5
5
5
  SHA512:
6
- metadata.gz: d213279d55c6644497b8e474d5e16512271ff86a314fa931472c0e7896959ccdd5ac250117e04a5c9db7ea82c90f16245629a445b8b8fa905c34c36f2fce8c1e
7
- data.tar.gz: a237a74163ce7093dbc8f0776a87c25818923bb9161fcf0e289ae8e4a7144f83c4ea2f9134bda2b6383ad7383a77b5ada1785380371f3014c6297228994119e6
6
+ metadata.gz: 1a47a28b0eb75c1443d78bb91272a722602b0e3fd9c65320cdcda0ec982f51813ea3fb77026bfe98f47224c3a041443db02591c3efa5919d1e347abd17bc0b3a
7
+ data.tar.gz: 90631f58b50b9a00ff1933741d4d9b35f470eb968baf9a177f61b5af05b8eab7987261a66060d5c898a6f4a062c113b51dcc76feacc671b6f3128b10c7bc1755
data/README.md CHANGED
@@ -24,15 +24,21 @@ This is a Ruby gem and will require that you have Ruby on your system (unless an
24
24
 
25
25
  Once you have ensured that you have Ruby on your system, `gem install epm`.
26
26
 
27
+ Note, if you install the gem with `sudo gem install epm` then your user will not have access to the settings file when you run `epm setup`, so instead of running `epm setup` you will want do something along the lines of:
28
+
29
+ ```
30
+ curl -o ~/.epm/epm-rpc.json https://raw.githubusercontent.com/project-douglas/epm/master/settings/epm-rpc.json
31
+ ```
32
+
27
33
  ## Important - Configure your Client
28
34
 
29
35
  **The first thing to do** when you have installed the EPM package is to configure the server. The epm config file is placed by default in `~/.epm/epm-rpc.json`. To install the default settings run:
30
36
 
31
37
  ```bash
32
- $ rake setup
38
+ $ epm setup
33
39
  ```
34
40
 
35
- After running the rake command (rake is ruby's make), then you can edit the config file in whatever editor you use. Set your preferred settings to however you like them. After that you can use the Create and Transact commands freely.
41
+ After running the epm setup command, then you can edit the config file in whatever editor you use. Set your preferred settings to however you like them. After that you can use the Create and Transact commands freely.
36
42
 
37
43
  ## Install Compilers
38
44
 
data/Rakefile CHANGED
@@ -1,12 +1,6 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- desc "Sets up EPM so users can configure"
5
- task :setup do
6
- require './lib/epm'
7
- EPM::Settings.check
8
- end
9
-
10
4
  desc "Update Sublime Package"
11
5
  task :sublime do
12
6
  Dir.chdir(File.dirname(__FILE__))
data/bin/epm CHANGED
@@ -119,3 +119,11 @@ command :restart do |c|
119
119
  print "Server has been restarted.\n"
120
120
  end
121
121
  end
122
+
123
+ command :setup do |c|
124
+ c.syntax = 'epm setup'
125
+ c.description = 'Setup your EPM instance.'
126
+ c.action do
127
+ EPM::Settings.check
128
+ end
129
+ end
@@ -17,7 +17,7 @@ module EPM
17
17
  'xEndowment' => '',
18
18
  'bCode' => @contract,
19
19
  'xGas' => '100000',
20
- 'xGasPrice' => '100000000000000'
20
+ 'xGasPrice' => ( @settings['gas-price'] || '100000000000000' )
21
21
  }
22
22
  post_body = { 'method' => 'create', 'params' => params, 'id' => 'epm-rpc', "jsonrpc" => "2.0" }.to_json
23
23
  elsif @settings['preferred-client'] == ('go' || 'ethereal')
@@ -25,7 +25,7 @@ module EPM
25
25
  'body' => @contract,
26
26
  'value' => '',
27
27
  'gas' => '100000',
28
- 'gasprice' => '100000000000000'
28
+ 'gasprice' => ( @settings['gas-price'] || '100000000000000' )
29
29
  }
30
30
  post_body = { 'method' => 'EthereumApi.Create', 'params' => params, 'id' => 'epm-rpc', 'jsonrpc' => '2.0'}.to_json
31
31
  end
@@ -38,6 +38,9 @@ module EPM
38
38
  log cmd.shift
39
39
  when 'set:'
40
40
  set_var cmd.shift
41
+ when 'endow:'
42
+ endow cmd.shift
43
+ sleep 1
41
44
  end
42
45
  end
43
46
  end
@@ -88,6 +91,16 @@ module EPM
88
91
  EPM::Transact.new(recipient, data, @settings).transact
89
92
  end
90
93
 
94
+ def endow command
95
+ recipient = command.shift
96
+ until ! recipient[/(\{\{.*?\}\})/]
97
+ recipient.gsub!($1, @brain[$1])
98
+ end
99
+ endowment = command.shift
100
+ p "Sending #{recipient} an endowment of: #{endowment}."
101
+ EPM::Transact.new(recipient, data, @settings).transact endowment
102
+ end
103
+
91
104
  def query command
92
105
  contract = command.shift
93
106
  address = command.shift
@@ -9,23 +9,23 @@ module EPM
9
9
  @data = EPM::HexData.construct_data data
10
10
  end
11
11
 
12
- def transact
12
+ def transact value=''
13
13
  if @settings['preferred-client'] == 'cpp'
14
14
  params = {
15
15
  'sec' => @settings["address-private-key"],
16
- 'xValue' => '',
16
+ 'xValue' => value,
17
17
  'aDest' => @recipient,
18
18
  'bData' => @data,
19
19
  'xGas' => '100000',
20
- 'xGasPrice' => '100000000000000'
20
+ 'xGasPrice' => ( @settings['gas-price'] || '100000000000000' )
21
21
  }
22
22
  post_body = { 'method' => 'transact', 'params' => params, 'id' => 'epm-rpc', "jsonrpc" => "2.0" }.to_json
23
23
  elsif @settings['preferred-client'] == ('go' || 'ethereal')
24
24
  params = {
25
25
  'recipient' => @recipient,
26
- 'value' => '',
26
+ 'value' => value,
27
27
  'gas' => '100000',
28
- 'gasprice' => '100000000000000',
28
+ 'gasprice' => ( @settings['gas-price'] || '100000000000000' ),
29
29
  'body' => @data,
30
30
  }
31
31
  post_body = { 'method' => 'EthereumApi.Transact', 'params' => params, 'id' => 'epm-rpc', "jsonrpc" => "2.0" }.to_json
@@ -81,6 +81,19 @@ module EPM
81
81
  FileUtils.mkdir(File.dirname settings_file)
82
82
  end
83
83
  FileUtils.cp settings_example, settings_file
84
+ settings = File.read settings_file
85
+ print "Before we begin, I need to ask you two personal questions:\n"
86
+ print "What is your primary account which I should be using to send transactions?\n\n"
87
+ account = STDIN.gets.chomp
88
+ print "Thanks. #{account} is what I will use.\n"
89
+ print "Thanks. Now what is the private key for that account which I should be using?\n\n"
90
+ secret = STDIN.gets.chomp
91
+ print "Thanks. #{secret} is what I will use.\n"
92
+ account = "0x#{account}" if account[0..1] != '0x'
93
+ secret = "0x#{secret}" if secret[0..1] != '0x'
94
+ settings.gsub!("0xact", account)
95
+ settings.gsub!("0xsec", secret)
96
+ File.open(settings_file, 'w'){|f| f.write(settings)}
84
97
  end
85
98
 
86
99
  def install_log_file
@@ -1 +1 @@
1
- VERSION ||= "0.3.14"
1
+ VERSION ||= "0.3.15"
@@ -12,6 +12,7 @@
12
12
  "directory": "~/.ethereum", // in cpp world Aleth defaults to this so change to a different directory to run eth headless in
13
13
  "eth-listen-port": "30303", // see the comment above
14
14
  "name": "name", // this is the client name
15
+ "gas-price": "100000000000000",
15
16
  "address-public-key": "0xact",
16
17
  "address-private-key": "0xsec"
17
18
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Casey Kuhlman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander