ruby-client 1.0.5 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{client.rb → nimiq.rb} +0 -0
- metadata +2 -101
- data/.gitignore +0 -59
- data/.travis.yml +0 -6
- data/Gemfile +0 -6
- data/Gemfile.lock +0 -92
- data/LICENSE +0 -177
- data/README.md +0 -49
- data/Rakefile +0 -14
- data/bin/console +0 -6
- data/bin/setup +0 -6
- data/doc/Api.html +0 -1592
- data/doc/ClientRPC.html +0 -99
- data/doc/ClientRPC/Connect.html +0 -106
- data/doc/ClientRPC/Connect/Error.html +0 -106
- data/doc/Gemfile.html +0 -101
- data/doc/Gemfile_lock.html +0 -193
- data/doc/LICENSE.html +0 -177
- data/doc/LICENSE_txt.html +0 -105
- data/doc/Nimiq.html +0 -99
- data/doc/Nimiq/Client.html +0 -248
- data/doc/Nimiq/Error.html +0 -108
- data/doc/Nimiq/Exceptions.html +0 -163
- data/doc/Object.html +0 -125
- data/doc/README_md.html +0 -162
- data/doc/Rakefile.html +0 -108
- data/doc/Ruby.html +0 -99
- data/doc/Ruby/ClientTest.html +0 -106
- data/doc/bin/setup.html +0 -99
- data/doc/classes/Api.html +0 -1506
- data/doc/classes/ClientRPC.html +0 -120
- data/doc/classes/ClientRPC/Connect.html +0 -120
- data/doc/classes/ClientRPC/Connect/Error.html +0 -111
- data/doc/classes/Nimiq.html +0 -145
- data/doc/classes/Nimiq/Client.html +0 -237
- data/doc/classes/Nimiq/Error.html +0 -113
- data/doc/classes/Nimiq/Exceptions.html +0 -152
- data/doc/classes/index.html +0 -80
- data/doc/created.rid +0 -13
- data/doc/css/application.css +0 -64
- data/doc/css/bootstrap.min.css +0 -868
- data/doc/css/coderay.css +0 -141
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -668
- data/doc/files/index.html +0 -82
- data/doc/files/lib/api_rb.html +0 -112
- data/doc/files/lib/client_rb.html +0 -118
- data/doc/files/lib/nimiq/version_rb.html +0 -105
- data/doc/files/lib/rpcclient_rb.html +0 -119
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/img/glyphicons-halflings-white.png +0 -0
- data/doc/img/glyphicons-halflings.png +0 -0
- data/doc/index.html +0 -110
- data/doc/js/application.js +0 -50
- data/doc/js/bootstrap.min.js +0 -7
- data/doc/js/darkfish.js +0 -84
- data/doc/js/index.js +0 -1
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -105
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -110
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -229
- data/doc/js/searcher.js.gz +0 -0
- data/doc/method/index.html +0 -122
- data/doc/table_of_contents.html +0 -318
- data/lib/api.rb +0 -317
- data/lib/nimiq/version.rb +0 -3
- data/lib/rpcclient.rb +0 -108
- data/ruby-client.gemspec +0 -29
data/README.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Nimiq Ruby RPC Client
|
2
|
-
|
3
|
-
> Ruby implementation of the Nimiq RPC client specs.
|
4
|
-
|
5
|
-
## Info
|
6
|
-
|
7
|
-
Nimiq Ruby RPC client. It will allow you to interact with the Nimiq Blockchain, to collect data, sync with the network etc.. This library covers all the current [Nimiq JSON-RPC specification](https://github.com/nimiq/core-js/wiki/JSON-RPC-API#remotejs-client).
|
8
|
-
|
9
|
-
# What is Nimiq?
|
10
|
-
|
11
|
-
Inspired by the Bitcoin, Nimiq is a blockchain / cryptocurrency that runs in your browser seamlessly.
|
12
|
-
|
13
|
-
Fast, easy and fun to use, for more information visit the [Nimiq website](https://www.nimiq.com/).
|
14
|
-
|
15
|
-
### Usage
|
16
|
-
|
17
|
-
Example to use this ruby client:
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
options = {
|
21
|
-
host: "http://127.0.0.1",
|
22
|
-
port: "8000",
|
23
|
-
# user: "user",
|
24
|
-
# pass: "pass",
|
25
|
-
# uri: "http://USER:PASS@IP:PORT",
|
26
|
-
}
|
27
|
-
nimiq = Nimiq::Client.new(options)
|
28
|
-
consensus = nimiq.consensus()
|
29
|
-
get_balance = nimiq.get_balance("NQ27 B9ED 98G5 3VH7 FY8D BFP0 XNF4 BD8L TN4B")
|
30
|
-
|
31
|
-
puts "Consensus #{consensus}"
|
32
|
-
puts "My account balance #{get_balance}"
|
33
|
-
```
|
34
|
-
|
35
|
-
## Development
|
36
|
-
|
37
|
-
This section is for developments. If you only want to use this client go to the [Usage](#Usage) section. After cloning the repo, run `bundle` to install the required dependencies. For testing it requires a running Nimiq RPC node, to connect to. You can then run tests by typing `rspec --format documentation`.
|
38
|
-
|
39
|
-
For a private node connection that require a username/password, don't forget to set these in the configuration spec file.
|
40
|
-
|
41
|
-
## Contributions
|
42
|
-
|
43
|
-
This implementation was originally contributed by [jxdv](https://github.com/jxdv/).
|
44
|
-
|
45
|
-
Bug reports and pull requests are welcome.
|
46
|
-
|
47
|
-
## License
|
48
|
-
|
49
|
-
[Apache 2.0](LICENSE)
|
data/Rakefile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new do |t|
|
5
|
-
t.pattern = "spec/*_spec.rb"
|
6
|
-
end
|
7
|
-
|
8
|
-
# Rake::TestTask.new(:test) do |t|
|
9
|
-
# t.libs << "test"
|
10
|
-
# t.libs << "lib"
|
11
|
-
# t.test_files = FileList["test/**/*_test.rb"]
|
12
|
-
# end
|
13
|
-
|
14
|
-
# task :default => :test
|
data/bin/console
DELETED
data/bin/setup
DELETED
data/doc/Api.html
DELETED
@@ -1,1592 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>module Api - RDoc Documentation</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "./";
|
11
|
-
var index_rel_prefix = "./";
|
12
|
-
</script>
|
13
|
-
|
14
|
-
<script src="./js/navigation.js" defer></script>
|
15
|
-
<script src="./js/search.js" defer></script>
|
16
|
-
<script src="./js/search_index.js" defer></script>
|
17
|
-
<script src="./js/searcher.js" defer></script>
|
18
|
-
<script src="./js/darkfish.js" defer></script>
|
19
|
-
|
20
|
-
<link href="./css/fonts.css" rel="stylesheet">
|
21
|
-
<link href="./css/rdoc.css" rel="stylesheet">
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
<body id="top" role="document" class="module">
|
27
|
-
<nav role="navigation">
|
28
|
-
<div id="project-navigation">
|
29
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
-
<h2>
|
31
|
-
<a href="./index.html" rel="home">Home</a>
|
32
|
-
</h2>
|
33
|
-
|
34
|
-
<div id="table-of-contents-navigation">
|
35
|
-
<a href="./table_of_contents.html#pages">Pages</a>
|
36
|
-
<a href="./table_of_contents.html#classes">Classes</a>
|
37
|
-
<a href="./table_of_contents.html#methods">Methods</a>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
-
<form action="#" method="get" accept-charset="utf-8">
|
43
|
-
<div id="search-field-wrapper">
|
44
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
-
aria-autocomplete="list" aria-controls="search-results"
|
46
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<ul id="search-results" aria-label="Search Results"
|
51
|
-
aria-busy="false" aria-expanded="false"
|
52
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
-
</form>
|
54
|
-
</div>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
<div id="class-metadata">
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
<!-- Method Quickref -->
|
66
|
-
<div id="method-list-section" class="nav-section">
|
67
|
-
<h3>Methods</h3>
|
68
|
-
|
69
|
-
<ul class="link-list" role="directory">
|
70
|
-
|
71
|
-
<li ><a href="#method-i-accounts">#accounts</a>
|
72
|
-
|
73
|
-
<li ><a href="#method-i-block_number">#block_number</a>
|
74
|
-
|
75
|
-
<li ><a href="#method-i-consensus">#consensus</a>
|
76
|
-
|
77
|
-
<li ><a href="#method-i-constant">#constant</a>
|
78
|
-
|
79
|
-
<li ><a href="#method-i-create_account">#create_account</a>
|
80
|
-
|
81
|
-
<li ><a href="#method-i-create_raw_transaction">#create_raw_transaction</a>
|
82
|
-
|
83
|
-
<li ><a href="#method-i-get_account">#get_account</a>
|
84
|
-
|
85
|
-
<li ><a href="#method-i-get_balance">#get_balance</a>
|
86
|
-
|
87
|
-
<li ><a href="#method-i-get_block_by_hash">#get_block_by_hash</a>
|
88
|
-
|
89
|
-
<li ><a href="#method-i-get_block_by_number">#get_block_by_number</a>
|
90
|
-
|
91
|
-
<li ><a href="#method-i-get_block_template">#get_block_template</a>
|
92
|
-
|
93
|
-
<li ><a href="#method-i-get_block_transaction_count_by_hash">#get_block_transaction_count_by_hash</a>
|
94
|
-
|
95
|
-
<li ><a href="#method-i-get_block_transaction_count_by_number">#get_block_transaction_count_by_number</a>
|
96
|
-
|
97
|
-
<li ><a href="#method-i-get_transaction_by_block_hash_and_index">#get_transaction_by_block_hash_and_index</a>
|
98
|
-
|
99
|
-
<li ><a href="#method-i-get_transaction_by_block_number_and_index">#get_transaction_by_block_number_and_index</a>
|
100
|
-
|
101
|
-
<li ><a href="#method-i-get_transaction_by_hash">#get_transaction_by_hash</a>
|
102
|
-
|
103
|
-
<li ><a href="#method-i-get_transaction_receipt">#get_transaction_receipt</a>
|
104
|
-
|
105
|
-
<li ><a href="#method-i-get_transactions_by_address">#get_transactions_by_address</a>
|
106
|
-
|
107
|
-
<li ><a href="#method-i-get_work">#get_work</a>
|
108
|
-
|
109
|
-
<li ><a href="#method-i-hashrate">#hashrate</a>
|
110
|
-
|
111
|
-
<li ><a href="#method-i-log">#log</a>
|
112
|
-
|
113
|
-
<li ><a href="#method-i-mempool">#mempool</a>
|
114
|
-
|
115
|
-
<li ><a href="#method-i-mempool_content">#mempool_content</a>
|
116
|
-
|
117
|
-
<li ><a href="#method-i-min_fee_per_byte">#min_fee_per_byte</a>
|
118
|
-
|
119
|
-
<li ><a href="#method-i-miner_address">#miner_address</a>
|
120
|
-
|
121
|
-
<li ><a href="#method-i-miner_threads">#miner_threads</a>
|
122
|
-
|
123
|
-
<li ><a href="#method-i-mining">#mining</a>
|
124
|
-
|
125
|
-
<li ><a href="#method-i-peer_count">#peer_count</a>
|
126
|
-
|
127
|
-
<li ><a href="#method-i-peer_list">#peer_list</a>
|
128
|
-
|
129
|
-
<li ><a href="#method-i-peer_state">#peer_state</a>
|
130
|
-
|
131
|
-
<li ><a href="#method-i-pool">#pool</a>
|
132
|
-
|
133
|
-
<li ><a href="#method-i-pool_confirmed_balance">#pool_confirmed_balance</a>
|
134
|
-
|
135
|
-
<li ><a href="#method-i-pool_connection_state">#pool_connection_state</a>
|
136
|
-
|
137
|
-
<li ><a href="#method-i-send_raw_transaction">#send_raw_transaction</a>
|
138
|
-
|
139
|
-
<li ><a href="#method-i-send_transaction">#send_transaction</a>
|
140
|
-
|
141
|
-
<li ><a href="#method-i-submit_block">#submit_block</a>
|
142
|
-
|
143
|
-
<li ><a href="#method-i-syncing">#syncing</a>
|
144
|
-
|
145
|
-
</ul>
|
146
|
-
</div>
|
147
|
-
|
148
|
-
</div>
|
149
|
-
</nav>
|
150
|
-
|
151
|
-
<main role="main" aria-labelledby="module-Api">
|
152
|
-
<h1 id="module-Api" class="module">
|
153
|
-
module Api
|
154
|
-
</h1>
|
155
|
-
|
156
|
-
<section class="description">
|
157
|
-
|
158
|
-
<p>Copyright 2020 <a href="Nimiq.html"><code>Nimiq</code></a> community.</p>
|
159
|
-
|
160
|
-
<p>Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at</p>
|
161
|
-
|
162
|
-
<pre class="ruby"><span class="ruby-identifier">http</span><span class="ruby-value">:/</span><span class="ruby-operator">/</span><span class="ruby-identifier">www</span>.<span class="ruby-identifier">apache</span>.<span class="ruby-identifier">org</span><span class="ruby-operator">/</span><span class="ruby-identifier">licenses</span><span class="ruby-operator">/</span><span class="ruby-constant">LICENSE</span><span class="ruby-value">-2.0</span>
|
163
|
-
</pre>
|
164
|
-
|
165
|
-
<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>
|
166
|
-
|
167
|
-
</section>
|
168
|
-
|
169
|
-
|
170
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
<section class="attribute-method-details" class="method-section">
|
179
|
-
<header>
|
180
|
-
<h3>Attributes</h3>
|
181
|
-
</header>
|
182
|
-
|
183
|
-
|
184
|
-
<div id="attribute-i-rpc" class="method-detail">
|
185
|
-
<div class="method-heading attribute-method-heading">
|
186
|
-
<span class="method-name">rpc</span><span
|
187
|
-
class="attribute-access-type">[RW]</span>
|
188
|
-
</div>
|
189
|
-
|
190
|
-
<div class="method-description">
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
</div>
|
195
|
-
</div>
|
196
|
-
|
197
|
-
</section>
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
202
|
-
<header>
|
203
|
-
<h3>Public Instance Methods</h3>
|
204
|
-
</header>
|
205
|
-
|
206
|
-
|
207
|
-
<div id="method-i-accounts" class="method-detail ">
|
208
|
-
|
209
|
-
<div class="method-heading">
|
210
|
-
<span class="method-name">accounts</span><span
|
211
|
-
class="method-args">()</span>
|
212
|
-
|
213
|
-
<span class="method-click-advice">click to toggle source</span>
|
214
|
-
|
215
|
-
</div>
|
216
|
-
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
|
220
|
-
<p>accounts - Returns a list of addresses owned by client.</p>
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
<div class="method-source-code" id="accounts-source">
|
226
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 21</span>
|
227
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">accounts</span>
|
228
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"accounts"</span>)
|
229
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
230
|
-
<span class="ruby-keyword">end</span></pre>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
</div>
|
239
|
-
|
240
|
-
|
241
|
-
<div id="method-i-block_number" class="method-detail ">
|
242
|
-
|
243
|
-
<div class="method-heading">
|
244
|
-
<span class="method-name">block_number</span><span
|
245
|
-
class="method-args">()</span>
|
246
|
-
|
247
|
-
<span class="method-click-advice">click to toggle source</span>
|
248
|
-
|
249
|
-
</div>
|
250
|
-
|
251
|
-
|
252
|
-
<div class="method-description">
|
253
|
-
|
254
|
-
<p><a href="Api.html#method-i-block_number"><code>block_number</code></a> - Returns the height of most recent block.</p>
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
<div class="method-source-code" id="block_number-source">
|
260
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 27</span>
|
261
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">block_number</span>
|
262
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"blockNumber"</span>)
|
263
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
264
|
-
<span class="ruby-keyword">end</span></pre>
|
265
|
-
</div>
|
266
|
-
|
267
|
-
</div>
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
</div>
|
273
|
-
|
274
|
-
|
275
|
-
<div id="method-i-consensus" class="method-detail ">
|
276
|
-
|
277
|
-
<div class="method-heading">
|
278
|
-
<span class="method-name">consensus</span><span
|
279
|
-
class="method-args">()</span>
|
280
|
-
|
281
|
-
<span class="method-click-advice">click to toggle source</span>
|
282
|
-
|
283
|
-
</div>
|
284
|
-
|
285
|
-
|
286
|
-
<div class="method-description">
|
287
|
-
|
288
|
-
<p>consensus - Returns information on the current consensus state.</p>
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
<div class="method-source-code" id="consensus-source">
|
294
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 33</span>
|
295
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">consensus</span>
|
296
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"consensus"</span>)
|
297
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
298
|
-
<span class="ruby-keyword">end</span></pre>
|
299
|
-
</div>
|
300
|
-
|
301
|
-
</div>
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
<div id="method-i-constant" class="method-detail ">
|
310
|
-
|
311
|
-
<div class="method-heading">
|
312
|
-
<span class="method-name">constant</span><span
|
313
|
-
class="method-args">(name, value = nil)</span>
|
314
|
-
|
315
|
-
<span class="method-click-advice">click to toggle source</span>
|
316
|
-
|
317
|
-
</div>
|
318
|
-
|
319
|
-
|
320
|
-
<div class="method-description">
|
321
|
-
|
322
|
-
<p>constant - Returns or overrides a constant value. When no parameter is given, it returns the value of the constant. When giving a value as parameter, it sets the constant to the given value. To reset the constant to the default value, the parameter “reset” should be used.</p>
|
323
|
-
<ul><li>
|
324
|
-
<p>@param [String] name - The class and name of the constant. (format should be Class.CONSTANT)</p>
|
325
|
-
</li><li>
|
326
|
-
<p>@param [Integer] value - The new value of the constant or “reset”. (optional)</p>
|
327
|
-
</li></ul>
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
<div class="method-source-code" id="constant-source">
|
333
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 44</span>
|
334
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">constant</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span> = <span class="ruby-keyword">nil</span>)
|
335
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">value</span>
|
336
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"constant"</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>)
|
337
|
-
<span class="ruby-keyword">else</span>
|
338
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"constant"</span>, <span class="ruby-identifier">name</span>)
|
339
|
-
<span class="ruby-keyword">end</span>
|
340
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
341
|
-
<span class="ruby-keyword">end</span></pre>
|
342
|
-
</div>
|
343
|
-
|
344
|
-
</div>
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
</div>
|
350
|
-
|
351
|
-
|
352
|
-
<div id="method-i-create_account" class="method-detail ">
|
353
|
-
|
354
|
-
<div class="method-heading">
|
355
|
-
<span class="method-name">create_account</span><span
|
356
|
-
class="method-args">()</span>
|
357
|
-
|
358
|
-
<span class="method-click-advice">click to toggle source</span>
|
359
|
-
|
360
|
-
</div>
|
361
|
-
|
362
|
-
|
363
|
-
<div class="method-description">
|
364
|
-
|
365
|
-
<p><a href="Api.html#method-i-create_account"><code>create_account</code></a> - Creates a new account and stores its private key in the client store.</p>
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
<div class="method-source-code" id="create_account-source">
|
371
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 54</span>
|
372
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create_account</span>
|
373
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"createAccount"</span>)
|
374
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
375
|
-
<span class="ruby-keyword">end</span></pre>
|
376
|
-
</div>
|
377
|
-
|
378
|
-
</div>
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
</div>
|
384
|
-
|
385
|
-
|
386
|
-
<div id="method-i-create_raw_transaction" class="method-detail ">
|
387
|
-
|
388
|
-
<div class="method-heading">
|
389
|
-
<span class="method-name">create_raw_transaction</span><span
|
390
|
-
class="method-args">(transaction)</span>
|
391
|
-
|
392
|
-
<span class="method-click-advice">click to toggle source</span>
|
393
|
-
|
394
|
-
</div>
|
395
|
-
|
396
|
-
|
397
|
-
<div class="method-description">
|
398
|
-
|
399
|
-
<p><a href="Api.html#method-i-create_raw_transaction"><code>create_raw_transaction</code></a> - Creates and signs a transaction without sending it. The transaction can then be send via `send_raw_transaction` without accidentally replaying it.</p>
|
400
|
-
<ul><li>
|
401
|
-
<p>@param [TransactionObject] transaction - The transaction object.</p>
|
402
|
-
</li></ul>
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
<div class="method-source-code" id="create_raw_transaction-source">
|
408
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 62</span>
|
409
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">create_raw_transaction</span>(<span class="ruby-identifier">transaction</span>)
|
410
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"createRawTransaction"</span>, <span class="ruby-identifier">transaction</span>)
|
411
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
412
|
-
<span class="ruby-keyword">end</span></pre>
|
413
|
-
</div>
|
414
|
-
|
415
|
-
</div>
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
</div>
|
421
|
-
|
422
|
-
|
423
|
-
<div id="method-i-get_account" class="method-detail ">
|
424
|
-
|
425
|
-
<div class="method-heading">
|
426
|
-
<span class="method-name">get_account</span><span
|
427
|
-
class="method-args">(address)</span>
|
428
|
-
|
429
|
-
<span class="method-click-advice">click to toggle source</span>
|
430
|
-
|
431
|
-
</div>
|
432
|
-
|
433
|
-
|
434
|
-
<div class="method-description">
|
435
|
-
|
436
|
-
<p><a href="Api.html#method-i-get_account"><code>get_account</code></a> - Returns details for the account of given address.</p>
|
437
|
-
<ul><li>
|
438
|
-
<p>@param [String] address - Address to get account details.</p>
|
439
|
-
</li></ul>
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
<div class="method-source-code" id="get_account-source">
|
445
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 77</span>
|
446
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_account</span>(<span class="ruby-identifier">address</span>)
|
447
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getAccount"</span>, <span class="ruby-identifier">address</span>)
|
448
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
449
|
-
<span class="ruby-keyword">end</span></pre>
|
450
|
-
</div>
|
451
|
-
|
452
|
-
</div>
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
</div>
|
458
|
-
|
459
|
-
|
460
|
-
<div id="method-i-get_balance" class="method-detail ">
|
461
|
-
|
462
|
-
<div class="method-heading">
|
463
|
-
<span class="method-name">get_balance</span><span
|
464
|
-
class="method-args">(address)</span>
|
465
|
-
|
466
|
-
<span class="method-click-advice">click to toggle source</span>
|
467
|
-
|
468
|
-
</div>
|
469
|
-
|
470
|
-
|
471
|
-
<div class="method-description">
|
472
|
-
|
473
|
-
<p><a href="Api.html#method-i-get_balance"><code>get_balance</code></a> - Returns the balance of the account of given address.</p>
|
474
|
-
<ul><li>
|
475
|
-
<p>@param [String] address - Address to check for balance.</p>
|
476
|
-
</li></ul>
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
<div class="method-source-code" id="get_balance-source">
|
482
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 84</span>
|
483
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_balance</span>(<span class="ruby-identifier">address</span>)
|
484
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBalance"</span>, <span class="ruby-identifier">address</span>)
|
485
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
486
|
-
<span class="ruby-keyword">end</span></pre>
|
487
|
-
</div>
|
488
|
-
|
489
|
-
</div>
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
</div>
|
495
|
-
|
496
|
-
|
497
|
-
<div id="method-i-get_block_by_hash" class="method-detail ">
|
498
|
-
|
499
|
-
<div class="method-heading">
|
500
|
-
<span class="method-name">get_block_by_hash</span><span
|
501
|
-
class="method-args">(block_hash, full_transactions = nil)</span>
|
502
|
-
|
503
|
-
<span class="method-click-advice">click to toggle source</span>
|
504
|
-
|
505
|
-
</div>
|
506
|
-
|
507
|
-
|
508
|
-
<div class="method-description">
|
509
|
-
|
510
|
-
<p><a href="Api.html#method-i-get_block_by_hash"><code>get_block_by_hash</code></a> - Returns information about a block by hash.</p>
|
511
|
-
<ul><li>
|
512
|
-
<p>@param [String] block_hash - Hash of the block to gather information on.</p>
|
513
|
-
</li><li>
|
514
|
-
<p>@param [Boolean] full_transactions (optional) - If true it returns the full transaction objects, if false only the hashes of the transactions. (default false)</p>
|
515
|
-
</li></ul>
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
<div class="method-source-code" id="get_block_by_hash-source">
|
521
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 92</span>
|
522
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_block_by_hash</span>(<span class="ruby-identifier">block_hash</span>, <span class="ruby-identifier">full_transactions</span> = <span class="ruby-keyword">nil</span>)
|
523
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">full_transactions</span>
|
524
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockByHash"</span>, <span class="ruby-identifier">block_hash</span>, <span class="ruby-identifier">full_transactions</span>)
|
525
|
-
<span class="ruby-keyword">else</span>
|
526
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockByHash"</span>, <span class="ruby-identifier">block_hash</span>)
|
527
|
-
<span class="ruby-keyword">end</span>
|
528
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
529
|
-
<span class="ruby-keyword">end</span></pre>
|
530
|
-
</div>
|
531
|
-
|
532
|
-
</div>
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
</div>
|
538
|
-
|
539
|
-
|
540
|
-
<div id="method-i-get_block_by_number" class="method-detail ">
|
541
|
-
|
542
|
-
<div class="method-heading">
|
543
|
-
<span class="method-name">get_block_by_number</span><span
|
544
|
-
class="method-args">(block_number, full_transactions = nil)</span>
|
545
|
-
|
546
|
-
<span class="method-click-advice">click to toggle source</span>
|
547
|
-
|
548
|
-
</div>
|
549
|
-
|
550
|
-
|
551
|
-
<div class="method-description">
|
552
|
-
|
553
|
-
<p><a href="Api.html#method-i-get_block_by_number"><code>get_block_by_number</code></a> - Returns information about a block by block number.</p>
|
554
|
-
<ul><li>
|
555
|
-
<p>@param [Integer] <a href="Api.html#method-i-block_number"><code>block_number</code></a> - The height of the block to gather information on.</p>
|
556
|
-
</li><li>
|
557
|
-
<p>@param [Boolean] full_transactions (optional) - If true it returns the full transaction objects, if false only the hashes of the transactions. (default false)</p>
|
558
|
-
</li></ul>
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
<div class="method-source-code" id="get_block_by_number-source">
|
564
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 104</span>
|
565
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_block_by_number</span>(<span class="ruby-identifier">block_number</span>, <span class="ruby-identifier">full_transactions</span> = <span class="ruby-keyword">nil</span>)
|
566
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">full_transactions</span>
|
567
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockByNumber"</span>, <span class="ruby-identifier">block_number</span>, <span class="ruby-identifier">full_transactions</span>)
|
568
|
-
<span class="ruby-keyword">else</span>
|
569
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockByNumber"</span>, <span class="ruby-identifier">block_number</span>)
|
570
|
-
<span class="ruby-keyword">end</span>
|
571
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
572
|
-
<span class="ruby-keyword">end</span></pre>
|
573
|
-
</div>
|
574
|
-
|
575
|
-
</div>
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
</div>
|
581
|
-
|
582
|
-
|
583
|
-
<div id="method-i-get_block_template" class="method-detail ">
|
584
|
-
|
585
|
-
<div class="method-heading">
|
586
|
-
<span class="method-name">get_block_template</span><span
|
587
|
-
class="method-args">(address = nil, dada_field = nil)</span>
|
588
|
-
|
589
|
-
<span class="method-click-advice">click to toggle source</span>
|
590
|
-
|
591
|
-
</div>
|
592
|
-
|
593
|
-
|
594
|
-
<div class="method-description">
|
595
|
-
|
596
|
-
<p><a href="Api.html#method-i-get_block_template"><code>get_block_template</code></a> - Returns a template to build the next block for mining. This will consider pool instructions when connected to a pool.</p>
|
597
|
-
<ul><li>
|
598
|
-
<p>@param [String] address (optional) - Address to use as a miner for this block. This overrides the address provided during startup or from the pool.</p>
|
599
|
-
</li><li>
|
600
|
-
<p>@param [String] dada_field (optional) - Hex-encoded value for the extra data field. This overrides the address provided during startup or from the pool.</p>
|
601
|
-
</li></ul>
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
<div class="method-source-code" id="get_block_template-source">
|
607
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 117</span>
|
608
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_block_template</span>(<span class="ruby-identifier">address</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">dada_field</span> = <span class="ruby-keyword">nil</span>)
|
609
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockTemplate"</span>)
|
610
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
611
|
-
<span class="ruby-keyword">end</span></pre>
|
612
|
-
</div>
|
613
|
-
|
614
|
-
</div>
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
</div>
|
620
|
-
|
621
|
-
|
622
|
-
<div id="method-i-get_block_transaction_count_by_hash" class="method-detail ">
|
623
|
-
|
624
|
-
<div class="method-heading">
|
625
|
-
<span class="method-name">get_block_transaction_count_by_hash</span><span
|
626
|
-
class="method-args">(block_hash)</span>
|
627
|
-
|
628
|
-
<span class="method-click-advice">click to toggle source</span>
|
629
|
-
|
630
|
-
</div>
|
631
|
-
|
632
|
-
|
633
|
-
<div class="method-description">
|
634
|
-
|
635
|
-
<p><a href="Api.html#method-i-get_block_transaction_count_by_hash"><code>get_block_transaction_count_by_hash</code></a> - Returns the number of transactions in a block from a block matching the given block hash.</p>
|
636
|
-
<ul><li>
|
637
|
-
<p>@param [String] block_hash - Hash of the block.</p>
|
638
|
-
</li></ul>
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
<div class="method-source-code" id="get_block_transaction_count_by_hash-source">
|
644
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 124</span>
|
645
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_block_transaction_count_by_hash</span>(<span class="ruby-identifier">block_hash</span>)
|
646
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockTransactionCountByHash"</span>, <span class="ruby-identifier">block_hash</span>)
|
647
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
648
|
-
<span class="ruby-keyword">end</span></pre>
|
649
|
-
</div>
|
650
|
-
|
651
|
-
</div>
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
</div>
|
657
|
-
|
658
|
-
|
659
|
-
<div id="method-i-get_block_transaction_count_by_number" class="method-detail ">
|
660
|
-
|
661
|
-
<div class="method-heading">
|
662
|
-
<span class="method-name">get_block_transaction_count_by_number</span><span
|
663
|
-
class="method-args">(block_number)</span>
|
664
|
-
|
665
|
-
<span class="method-click-advice">click to toggle source</span>
|
666
|
-
|
667
|
-
</div>
|
668
|
-
|
669
|
-
|
670
|
-
<div class="method-description">
|
671
|
-
|
672
|
-
<p><a href="Api.html#method-i-get_block_transaction_count_by_number"><code>get_block_transaction_count_by_number</code></a> - Returns the number of transactions in a block matching the given block number.</p>
|
673
|
-
<ul><li>
|
674
|
-
<p>@param [Integer] <a href="Api.html#method-i-block_number"><code>block_number</code></a> - Height of the block.</p>
|
675
|
-
</li></ul>
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
<div class="method-source-code" id="get_block_transaction_count_by_number-source">
|
681
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 131</span>
|
682
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_block_transaction_count_by_number</span>(<span class="ruby-identifier">block_number</span>)
|
683
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getBlockTransactionCountByNumber"</span>, <span class="ruby-identifier">block_number</span>)
|
684
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
685
|
-
<span class="ruby-keyword">end</span></pre>
|
686
|
-
</div>
|
687
|
-
|
688
|
-
</div>
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
</div>
|
694
|
-
|
695
|
-
|
696
|
-
<div id="method-i-get_transaction_by_block_hash_and_index" class="method-detail ">
|
697
|
-
|
698
|
-
<div class="method-heading">
|
699
|
-
<span class="method-name">get_transaction_by_block_hash_and_index</span><span
|
700
|
-
class="method-args">(block_hash, transaction_index)</span>
|
701
|
-
|
702
|
-
<span class="method-click-advice">click to toggle source</span>
|
703
|
-
|
704
|
-
</div>
|
705
|
-
|
706
|
-
|
707
|
-
<div class="method-description">
|
708
|
-
|
709
|
-
<p><a href="Api.html#method-i-get_transaction_by_block_hash_and_index"><code>get_transaction_by_block_hash_and_index</code></a> - Returns information about a transaction by block hash and transaction index position.</p>
|
710
|
-
<ul><li>
|
711
|
-
<p>@param [Integer] block_hash - Hash of the block containing the transaction.</p>
|
712
|
-
</li><li>
|
713
|
-
<p>@param [Integer] transaction_index - Index of the transaction in the block.</p>
|
714
|
-
</li></ul>
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
<div class="method-source-code" id="get_transaction_by_block_hash_and_index-source">
|
720
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 139</span>
|
721
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_transaction_by_block_hash_and_index</span>(<span class="ruby-identifier">block_hash</span>, <span class="ruby-identifier">transaction_index</span>)
|
722
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionByBlockHashAndIndex"</span>, <span class="ruby-identifier">block_hash</span>, <span class="ruby-identifier">transaction_index</span>)
|
723
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
724
|
-
<span class="ruby-keyword">end</span></pre>
|
725
|
-
</div>
|
726
|
-
|
727
|
-
</div>
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
</div>
|
733
|
-
|
734
|
-
|
735
|
-
<div id="method-i-get_transaction_by_block_number_and_index" class="method-detail ">
|
736
|
-
|
737
|
-
<div class="method-heading">
|
738
|
-
<span class="method-name">get_transaction_by_block_number_and_index</span><span
|
739
|
-
class="method-args">(block_height, transaction_index)</span>
|
740
|
-
|
741
|
-
<span class="method-click-advice">click to toggle source</span>
|
742
|
-
|
743
|
-
</div>
|
744
|
-
|
745
|
-
|
746
|
-
<div class="method-description">
|
747
|
-
|
748
|
-
<p><a href="Api.html#method-i-get_transaction_by_block_number_and_index"><code>get_transaction_by_block_number_and_index</code></a> - Returns information about a transaction by block number and transaction index position.</p>
|
749
|
-
<ul><li>
|
750
|
-
<p>@param [Integer] block_height - Height of the block containing the transaction.</p>
|
751
|
-
</li><li>
|
752
|
-
<p>@param [Integer] transaction_index - Index of the transaction in the block.</p>
|
753
|
-
</li></ul>
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
<div class="method-source-code" id="get_transaction_by_block_number_and_index-source">
|
759
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 147</span>
|
760
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_transaction_by_block_number_and_index</span>(<span class="ruby-identifier">block_height</span>, <span class="ruby-identifier">transaction_index</span>)
|
761
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionByBlockNumberAndIndex"</span>, <span class="ruby-identifier">block_height</span>, <span class="ruby-identifier">transaction_index</span>)
|
762
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
763
|
-
<span class="ruby-keyword">end</span></pre>
|
764
|
-
</div>
|
765
|
-
|
766
|
-
</div>
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
</div>
|
772
|
-
|
773
|
-
|
774
|
-
<div id="method-i-get_transaction_by_hash" class="method-detail ">
|
775
|
-
|
776
|
-
<div class="method-heading">
|
777
|
-
<span class="method-name">get_transaction_by_hash</span><span
|
778
|
-
class="method-args">(transaction_hash)</span>
|
779
|
-
|
780
|
-
<span class="method-click-advice">click to toggle source</span>
|
781
|
-
|
782
|
-
</div>
|
783
|
-
|
784
|
-
|
785
|
-
<div class="method-description">
|
786
|
-
|
787
|
-
<p><a href="Api.html#method-i-get_transaction_by_hash"><code>get_transaction_by_hash</code></a> - Returns the information about a transaction requested by transaction hash.</p>
|
788
|
-
<ul><li>
|
789
|
-
<p>@param [String] transaction_hash - Hash of a transaction.</p>
|
790
|
-
</li></ul>
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
<div class="method-source-code" id="get_transaction_by_hash-source">
|
796
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 154</span>
|
797
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_transaction_by_hash</span>(<span class="ruby-identifier">transaction_hash</span>)
|
798
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionByHash"</span>, <span class="ruby-identifier">transaction_hash</span>)
|
799
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
800
|
-
<span class="ruby-keyword">end</span></pre>
|
801
|
-
</div>
|
802
|
-
|
803
|
-
</div>
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
</div>
|
809
|
-
|
810
|
-
|
811
|
-
<div id="method-i-get_transaction_receipt" class="method-detail ">
|
812
|
-
|
813
|
-
<div class="method-heading">
|
814
|
-
<span class="method-name">get_transaction_receipt</span><span
|
815
|
-
class="method-args">(transaction_hash)</span>
|
816
|
-
|
817
|
-
<span class="method-click-advice">click to toggle source</span>
|
818
|
-
|
819
|
-
</div>
|
820
|
-
|
821
|
-
|
822
|
-
<div class="method-description">
|
823
|
-
|
824
|
-
<p><a href="Api.html#method-i-get_transaction_receipt"><code>get_transaction_receipt</code></a> - Returns the receipt of a transaction by transaction hash. Note That the receipt is not available for pending transactions.</p>
|
825
|
-
<ul><li>
|
826
|
-
<p>@param [String] transaction_hash - Hash of a transaction.</p>
|
827
|
-
</li></ul>
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
<div class="method-source-code" id="get_transaction_receipt-source">
|
833
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 162</span>
|
834
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_transaction_receipt</span>(<span class="ruby-identifier">transaction_hash</span>)
|
835
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionReceipt"</span>, <span class="ruby-identifier">transaction_hash</span>)
|
836
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
837
|
-
<span class="ruby-keyword">end</span></pre>
|
838
|
-
</div>
|
839
|
-
|
840
|
-
</div>
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
</div>
|
846
|
-
|
847
|
-
|
848
|
-
<div id="method-i-get_transactions_by_address" class="method-detail ">
|
849
|
-
|
850
|
-
<div class="method-heading">
|
851
|
-
<span class="method-name">get_transactions_by_address</span><span
|
852
|
-
class="method-args">(address, transactions_number = nil)</span>
|
853
|
-
|
854
|
-
<span class="method-click-advice">click to toggle source</span>
|
855
|
-
|
856
|
-
</div>
|
857
|
-
|
858
|
-
|
859
|
-
<div class="method-description">
|
860
|
-
|
861
|
-
<p><a href="Api.html#method-i-get_transactions_by_address"><code>get_transactions_by_address</code></a> - Returns the latest transactions successfully performed by or for an address.</p>
|
862
|
-
<ul><li>
|
863
|
-
<p>@param [String] address - Address of which transactions should be gathered.</p>
|
864
|
-
</li><li>
|
865
|
-
<p>@param [Integer] transactions_number (optional) - Number of transactions that shall be returned. (default 1000)</p>
|
866
|
-
</li></ul>
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
<div class="method-source-code" id="get_transactions_by_address-source">
|
872
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 170</span>
|
873
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_transactions_by_address</span>(<span class="ruby-identifier">address</span>, <span class="ruby-identifier">transactions_number</span> = <span class="ruby-keyword">nil</span>)
|
874
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">transactions_number</span>
|
875
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionsByAddress"</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">transactions_number</span>)
|
876
|
-
<span class="ruby-keyword">else</span>
|
877
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getTransactionsByAddress"</span>, <span class="ruby-identifier">address</span>)
|
878
|
-
<span class="ruby-keyword">end</span>
|
879
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
880
|
-
<span class="ruby-keyword">end</span></pre>
|
881
|
-
</div>
|
882
|
-
|
883
|
-
</div>
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
</div>
|
889
|
-
|
890
|
-
|
891
|
-
<div id="method-i-get_work" class="method-detail ">
|
892
|
-
|
893
|
-
<div class="method-heading">
|
894
|
-
<span class="method-name">get_work</span><span
|
895
|
-
class="method-args">(address = nil, dada_field = nil)</span>
|
896
|
-
|
897
|
-
<span class="method-click-advice">click to toggle source</span>
|
898
|
-
|
899
|
-
</div>
|
900
|
-
|
901
|
-
|
902
|
-
<div class="method-description">
|
903
|
-
|
904
|
-
<p><a href="Api.html#method-i-get_work"><code>get_work</code></a> - Returns instructions to mine the next block. This will consider pool instructions when connected to a pool.</p>
|
905
|
-
<ul><li>
|
906
|
-
<p>@param [String] address (optional) - Address to use as a miner for this block. This overrides the address provided during startup or from the pool.</p>
|
907
|
-
</li><li>
|
908
|
-
<p>@param [String] dada_field (optional) - Hex-encoded value for the extra data field. This overrides the address provided during startup or from the pool.</p>
|
909
|
-
</li></ul>
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
<div class="method-source-code" id="get_work-source">
|
915
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 182</span>
|
916
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">get_work</span>(<span class="ruby-identifier">address</span> = <span class="ruby-keyword">nil</span>, <span class="ruby-identifier">dada_field</span> = <span class="ruby-keyword">nil</span>)
|
917
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"getWork"</span>, <span class="ruby-identifier">address</span>, <span class="ruby-identifier">dada_field</span>)
|
918
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
919
|
-
<span class="ruby-keyword">end</span></pre>
|
920
|
-
</div>
|
921
|
-
|
922
|
-
</div>
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
</div>
|
928
|
-
|
929
|
-
|
930
|
-
<div id="method-i-hashrate" class="method-detail ">
|
931
|
-
|
932
|
-
<div class="method-heading">
|
933
|
-
<span class="method-name">hashrate</span><span
|
934
|
-
class="method-args">()</span>
|
935
|
-
|
936
|
-
<span class="method-click-advice">click to toggle source</span>
|
937
|
-
|
938
|
-
</div>
|
939
|
-
|
940
|
-
|
941
|
-
<div class="method-description">
|
942
|
-
|
943
|
-
<p>hashrate - Returns the number of hashes per second that the node is mining with.</p>
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
<div class="method-source-code" id="hashrate-source">
|
949
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 188</span>
|
950
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">hashrate</span>
|
951
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"hashrate"</span>)
|
952
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
953
|
-
<span class="ruby-keyword">end</span></pre>
|
954
|
-
</div>
|
955
|
-
|
956
|
-
</div>
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
</div>
|
962
|
-
|
963
|
-
|
964
|
-
<div id="method-i-log" class="method-detail ">
|
965
|
-
|
966
|
-
<div class="method-heading">
|
967
|
-
<span class="method-name">log</span><span
|
968
|
-
class="method-args">(tag, log_level)</span>
|
969
|
-
|
970
|
-
<span class="method-click-advice">click to toggle source</span>
|
971
|
-
|
972
|
-
</div>
|
973
|
-
|
974
|
-
|
975
|
-
<div class="method-description">
|
976
|
-
|
977
|
-
<p>log - Sets the log level of the node.</p>
|
978
|
-
<ul><li>
|
979
|
-
<p>@param [String] tag - If the tag is '*' the log level will be set globally, otherwise the log level is applied only on this tag.</p>
|
980
|
-
</li><li>
|
981
|
-
<p>@param [String] log_level - Log levels valid options: `trace`, `verbose`, `debug`, `info`, `warn`, `error`, `assert`.</p>
|
982
|
-
</li></ul>
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
<div class="method-source-code" id="log-source">
|
988
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 196</span>
|
989
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">log</span>(<span class="ruby-identifier">tag</span>, <span class="ruby-identifier">log_level</span>)
|
990
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"log"</span>, <span class="ruby-identifier">tag</span>, <span class="ruby-identifier">log_level</span>)
|
991
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
992
|
-
<span class="ruby-keyword">end</span></pre>
|
993
|
-
</div>
|
994
|
-
|
995
|
-
</div>
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
</div>
|
1001
|
-
|
1002
|
-
|
1003
|
-
<div id="method-i-mempool" class="method-detail ">
|
1004
|
-
|
1005
|
-
<div class="method-heading">
|
1006
|
-
<span class="method-name">mempool</span><span
|
1007
|
-
class="method-args">()</span>
|
1008
|
-
|
1009
|
-
<span class="method-click-advice">click to toggle source</span>
|
1010
|
-
|
1011
|
-
</div>
|
1012
|
-
|
1013
|
-
|
1014
|
-
<div class="method-description">
|
1015
|
-
|
1016
|
-
<p>mempool - Returns information on the current mempool situation. This will provide an overview of the number of transactions sorted into buckets based on their fee per byte (in smallest unit).</p>
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
<div class="method-source-code" id="mempool-source">
|
1022
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 202</span>
|
1023
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mempool</span>
|
1024
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"mempool"</span>)
|
1025
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1026
|
-
<span class="ruby-keyword">end</span></pre>
|
1027
|
-
</div>
|
1028
|
-
|
1029
|
-
</div>
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
</div>
|
1035
|
-
|
1036
|
-
|
1037
|
-
<div id="method-i-mempool_content" class="method-detail ">
|
1038
|
-
|
1039
|
-
<div class="method-heading">
|
1040
|
-
<span class="method-name">mempool_content</span><span
|
1041
|
-
class="method-args">()</span>
|
1042
|
-
|
1043
|
-
<span class="method-click-advice">click to toggle source</span>
|
1044
|
-
|
1045
|
-
</div>
|
1046
|
-
|
1047
|
-
|
1048
|
-
<div class="method-description">
|
1049
|
-
|
1050
|
-
<p><a href="Api.html#method-i-mempool_content"><code>mempool_content</code></a> - Returns transactions that are currently in the mempool.</p>
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
<div class="method-source-code" id="mempool_content-source">
|
1056
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 208</span>
|
1057
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mempool_content</span>
|
1058
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"mempoolContent"</span>)
|
1059
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1060
|
-
<span class="ruby-keyword">end</span></pre>
|
1061
|
-
</div>
|
1062
|
-
|
1063
|
-
</div>
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
</div>
|
1069
|
-
|
1070
|
-
|
1071
|
-
<div id="method-i-min_fee_per_byte" class="method-detail ">
|
1072
|
-
|
1073
|
-
<div class="method-heading">
|
1074
|
-
<span class="method-name">min_fee_per_byte</span><span
|
1075
|
-
class="method-args">(set_min_fee = nil)</span>
|
1076
|
-
|
1077
|
-
<span class="method-click-advice">click to toggle source</span>
|
1078
|
-
|
1079
|
-
</div>
|
1080
|
-
|
1081
|
-
|
1082
|
-
<div class="method-description">
|
1083
|
-
|
1084
|
-
<p><a href="Api.html#method-i-min_fee_per_byte"><code>min_fee_per_byte</code></a> - Returns or sets the minimum fee per byte.</p>
|
1085
|
-
<ul><li>
|
1086
|
-
<p>@param [Integer] set_min_fee (optional) - The new minimum fee per byte.</p>
|
1087
|
-
</li></ul>
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
<div class="method-source-code" id="min_fee_per_byte-source">
|
1093
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 232</span>
|
1094
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">min_fee_per_byte</span>(<span class="ruby-identifier">set_min_fee</span> = <span class="ruby-keyword">nil</span>)
|
1095
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">set_min_fee</span>
|
1096
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"minFeePerByte"</span>, <span class="ruby-identifier">set_min_fee</span>)
|
1097
|
-
<span class="ruby-keyword">else</span>
|
1098
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"minFeePerByte"</span>)
|
1099
|
-
<span class="ruby-keyword">end</span>
|
1100
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1101
|
-
<span class="ruby-keyword">end</span></pre>
|
1102
|
-
</div>
|
1103
|
-
|
1104
|
-
</div>
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
</div>
|
1110
|
-
|
1111
|
-
|
1112
|
-
<div id="method-i-miner_address" class="method-detail ">
|
1113
|
-
|
1114
|
-
<div class="method-heading">
|
1115
|
-
<span class="method-name">miner_address</span><span
|
1116
|
-
class="method-args">()</span>
|
1117
|
-
|
1118
|
-
<span class="method-click-advice">click to toggle source</span>
|
1119
|
-
|
1120
|
-
</div>
|
1121
|
-
|
1122
|
-
|
1123
|
-
<div class="method-description">
|
1124
|
-
|
1125
|
-
<p><a href="Api.html#method-i-miner_address"><code>miner_address</code></a> - Returns the miner address.</p>
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
<div class="method-source-code" id="miner_address-source">
|
1131
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 214</span>
|
1132
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">miner_address</span>
|
1133
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"minerAddress"</span>)
|
1134
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1135
|
-
<span class="ruby-keyword">end</span></pre>
|
1136
|
-
</div>
|
1137
|
-
|
1138
|
-
</div>
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
</div>
|
1144
|
-
|
1145
|
-
|
1146
|
-
<div id="method-i-miner_threads" class="method-detail ">
|
1147
|
-
|
1148
|
-
<div class="method-heading">
|
1149
|
-
<span class="method-name">miner_threads</span><span
|
1150
|
-
class="method-args">(set_threads = nil)</span>
|
1151
|
-
|
1152
|
-
<span class="method-click-advice">click to toggle source</span>
|
1153
|
-
|
1154
|
-
</div>
|
1155
|
-
|
1156
|
-
|
1157
|
-
<div class="method-description">
|
1158
|
-
|
1159
|
-
<p><a href="Api.html#method-i-miner_threads"><code>miner_threads</code></a> - Returns or sets the number of CPU threads for the miner.</p>
|
1160
|
-
<ul><li>
|
1161
|
-
<p>@param [Integer] set_threads (optional) - The number of threads to allocate for mining.</p>
|
1162
|
-
</li></ul>
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
<div class="method-source-code" id="miner_threads-source">
|
1168
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 221</span>
|
1169
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">miner_threads</span>(<span class="ruby-identifier">set_threads</span> = <span class="ruby-keyword">nil</span>)
|
1170
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">set_threads</span>
|
1171
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"minerThreads"</span>, <span class="ruby-identifier">set_threads</span>)
|
1172
|
-
<span class="ruby-keyword">else</span>
|
1173
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"minerThreads"</span>)
|
1174
|
-
<span class="ruby-keyword">end</span>
|
1175
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1176
|
-
<span class="ruby-keyword">end</span></pre>
|
1177
|
-
</div>
|
1178
|
-
|
1179
|
-
</div>
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
</div>
|
1185
|
-
|
1186
|
-
|
1187
|
-
<div id="method-i-mining" class="method-detail ">
|
1188
|
-
|
1189
|
-
<div class="method-heading">
|
1190
|
-
<span class="method-name">mining</span><span
|
1191
|
-
class="method-args">()</span>
|
1192
|
-
|
1193
|
-
<span class="method-click-advice">click to toggle source</span>
|
1194
|
-
|
1195
|
-
</div>
|
1196
|
-
|
1197
|
-
|
1198
|
-
<div class="method-description">
|
1199
|
-
|
1200
|
-
<p>mining - Returns `true` if client is actively mining new blocks.</p>
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
<div class="method-source-code" id="mining-source">
|
1206
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 242</span>
|
1207
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">mining</span>
|
1208
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"mining"</span>)
|
1209
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1210
|
-
<span class="ruby-keyword">end</span></pre>
|
1211
|
-
</div>
|
1212
|
-
|
1213
|
-
</div>
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
</div>
|
1219
|
-
|
1220
|
-
|
1221
|
-
<div id="method-i-peer_count" class="method-detail ">
|
1222
|
-
|
1223
|
-
<div class="method-heading">
|
1224
|
-
<span class="method-name">peer_count</span><span
|
1225
|
-
class="method-args">()</span>
|
1226
|
-
|
1227
|
-
<span class="method-click-advice">click to toggle source</span>
|
1228
|
-
|
1229
|
-
</div>
|
1230
|
-
|
1231
|
-
|
1232
|
-
<div class="method-description">
|
1233
|
-
|
1234
|
-
<p><a href="Api.html#method-i-peer_count"><code>peer_count</code></a> - Returns number of peers currently connected to the client.</p>
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
<div class="method-source-code" id="peer_count-source">
|
1240
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 248</span>
|
1241
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">peer_count</span>
|
1242
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"peerCount"</span>)
|
1243
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1244
|
-
<span class="ruby-keyword">end</span></pre>
|
1245
|
-
</div>
|
1246
|
-
|
1247
|
-
</div>
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
</div>
|
1253
|
-
|
1254
|
-
|
1255
|
-
<div id="method-i-peer_list" class="method-detail ">
|
1256
|
-
|
1257
|
-
<div class="method-heading">
|
1258
|
-
<span class="method-name">peer_list</span><span
|
1259
|
-
class="method-args">()</span>
|
1260
|
-
|
1261
|
-
<span class="method-click-advice">click to toggle source</span>
|
1262
|
-
|
1263
|
-
</div>
|
1264
|
-
|
1265
|
-
|
1266
|
-
<div class="method-description">
|
1267
|
-
|
1268
|
-
<p><a href="Api.html#method-i-peer_list"><code>peer_list</code></a> - Returns list of peers known to the client.</p>
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
<div class="method-source-code" id="peer_list-source">
|
1274
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 254</span>
|
1275
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">peer_list</span>
|
1276
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"peerList"</span>)
|
1277
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1278
|
-
<span class="ruby-keyword">end</span></pre>
|
1279
|
-
</div>
|
1280
|
-
|
1281
|
-
</div>
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
</div>
|
1287
|
-
|
1288
|
-
|
1289
|
-
<div id="method-i-peer_state" class="method-detail ">
|
1290
|
-
|
1291
|
-
<div class="method-heading">
|
1292
|
-
<span class="method-name">peer_state</span><span
|
1293
|
-
class="method-args">(peer_address)</span>
|
1294
|
-
|
1295
|
-
<span class="method-click-advice">click to toggle source</span>
|
1296
|
-
|
1297
|
-
</div>
|
1298
|
-
|
1299
|
-
|
1300
|
-
<div class="method-description">
|
1301
|
-
|
1302
|
-
<p><a href="Api.html#method-i-peer_state"><code>peer_state</code></a> - Returns the state of the peer.</p>
|
1303
|
-
<ul><li>
|
1304
|
-
<p>@param [String] peer_address - The address of the peer.</p>
|
1305
|
-
</li></ul>
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
<div class="method-source-code" id="peer_state-source">
|
1311
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 261</span>
|
1312
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">peer_state</span>(<span class="ruby-identifier">peer_address</span>)
|
1313
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"peerState"</span>, <span class="ruby-identifier">peer_address</span>)
|
1314
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1315
|
-
<span class="ruby-keyword">end</span></pre>
|
1316
|
-
</div>
|
1317
|
-
|
1318
|
-
</div>
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
</div>
|
1324
|
-
|
1325
|
-
|
1326
|
-
<div id="method-i-pool" class="method-detail ">
|
1327
|
-
|
1328
|
-
<div class="method-heading">
|
1329
|
-
<span class="method-name">pool</span><span
|
1330
|
-
class="method-args">(pool_address = nil)</span>
|
1331
|
-
|
1332
|
-
<span class="method-click-advice">click to toggle source</span>
|
1333
|
-
|
1334
|
-
</div>
|
1335
|
-
|
1336
|
-
|
1337
|
-
<div class="method-description">
|
1338
|
-
|
1339
|
-
<p>pool - Returns or sets the mining pool. When no parameter is given, it returns the current mining pool. When a value is given as parameter, it sets the mining pool to that value.</p>
|
1340
|
-
<ul><li>
|
1341
|
-
<p>@param [String/Boolean] pool_address (optional) - The mining pool connection string (url:port) or boolean to enable/disable pool mining.</p>
|
1342
|
-
</li></ul>
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
<div class="method-source-code" id="pool-source">
|
1348
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 269</span>
|
1349
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pool</span>(<span class="ruby-identifier">pool_address</span> = <span class="ruby-keyword">nil</span>)
|
1350
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">pool_address</span>
|
1351
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"pool"</span>, <span class="ruby-identifier">pool_address</span>)
|
1352
|
-
<span class="ruby-keyword">else</span>
|
1353
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"pool"</span>)
|
1354
|
-
<span class="ruby-keyword">end</span>
|
1355
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1356
|
-
<span class="ruby-keyword">end</span></pre>
|
1357
|
-
</div>
|
1358
|
-
|
1359
|
-
</div>
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
</div>
|
1365
|
-
|
1366
|
-
|
1367
|
-
<div id="method-i-pool_confirmed_balance" class="method-detail ">
|
1368
|
-
|
1369
|
-
<div class="method-heading">
|
1370
|
-
<span class="method-name">pool_confirmed_balance</span><span
|
1371
|
-
class="method-args">()</span>
|
1372
|
-
|
1373
|
-
<span class="method-click-advice">click to toggle source</span>
|
1374
|
-
|
1375
|
-
</div>
|
1376
|
-
|
1377
|
-
|
1378
|
-
<div class="method-description">
|
1379
|
-
|
1380
|
-
<p><a href="Api.html#method-i-pool_confirmed_balance"><code>pool_confirmed_balance</code></a> - Returns the confirmed mining pool balance.</p>
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
<div class="method-source-code" id="pool_confirmed_balance-source">
|
1386
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 279</span>
|
1387
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pool_confirmed_balance</span>
|
1388
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"poolConfirmedBalance"</span>)
|
1389
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1390
|
-
<span class="ruby-keyword">end</span></pre>
|
1391
|
-
</div>
|
1392
|
-
|
1393
|
-
</div>
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
</div>
|
1399
|
-
|
1400
|
-
|
1401
|
-
<div id="method-i-pool_connection_state" class="method-detail ">
|
1402
|
-
|
1403
|
-
<div class="method-heading">
|
1404
|
-
<span class="method-name">pool_connection_state</span><span
|
1405
|
-
class="method-args">()</span>
|
1406
|
-
|
1407
|
-
<span class="method-click-advice">click to toggle source</span>
|
1408
|
-
|
1409
|
-
</div>
|
1410
|
-
|
1411
|
-
|
1412
|
-
<div class="method-description">
|
1413
|
-
|
1414
|
-
<p><a href="Api.html#method-i-pool_connection_state"><code>pool_connection_state</code></a> - Returns the connection state to mining pool.</p>
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
<div class="method-source-code" id="pool_connection_state-source">
|
1420
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 285</span>
|
1421
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">pool_connection_state</span>
|
1422
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"poolConnectionState"</span>)
|
1423
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1424
|
-
<span class="ruby-keyword">end</span></pre>
|
1425
|
-
</div>
|
1426
|
-
|
1427
|
-
</div>
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
</div>
|
1433
|
-
|
1434
|
-
|
1435
|
-
<div id="method-i-send_raw_transaction" class="method-detail ">
|
1436
|
-
|
1437
|
-
<div class="method-heading">
|
1438
|
-
<span class="method-name">send_raw_transaction</span><span
|
1439
|
-
class="method-args">(signed_transaction)</span>
|
1440
|
-
|
1441
|
-
<span class="method-click-advice">click to toggle source</span>
|
1442
|
-
|
1443
|
-
</div>
|
1444
|
-
|
1445
|
-
|
1446
|
-
<div class="method-description">
|
1447
|
-
|
1448
|
-
<p><a href="Api.html#method-i-send_raw_transaction"><code>send_raw_transaction</code></a> - Sends a signed message call transaction or a contract creation, if the data field contains code.</p>
|
1449
|
-
<ul><li>
|
1450
|
-
<p>@param [String] signed_transaction - The hex encoded signed transaction.</p>
|
1451
|
-
</li></ul>
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
<div class="method-source-code" id="send_raw_transaction-source">
|
1457
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 292</span>
|
1458
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">send_raw_transaction</span>(<span class="ruby-identifier">signed_transaction</span>)
|
1459
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"sendRawTransaction"</span>, <span class="ruby-identifier">signed_transaction</span>)
|
1460
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1461
|
-
<span class="ruby-keyword">end</span></pre>
|
1462
|
-
</div>
|
1463
|
-
|
1464
|
-
</div>
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
</div>
|
1470
|
-
|
1471
|
-
|
1472
|
-
<div id="method-i-send_transaction" class="method-detail ">
|
1473
|
-
|
1474
|
-
<div class="method-heading">
|
1475
|
-
<span class="method-name">send_transaction</span><span
|
1476
|
-
class="method-args">(transaction)</span>
|
1477
|
-
|
1478
|
-
<span class="method-click-advice">click to toggle source</span>
|
1479
|
-
|
1480
|
-
</div>
|
1481
|
-
|
1482
|
-
|
1483
|
-
<div class="method-description">
|
1484
|
-
|
1485
|
-
<p><a href="Api.html#method-i-send_transaction"><code>send_transaction</code></a> - Creates new message call transaction or a contract creation, if the data field contains code.</p>
|
1486
|
-
<ul><li>
|
1487
|
-
<p>@param [TransactionObject] transaction - The transaction object.</p>
|
1488
|
-
</li></ul>
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
<div class="method-source-code" id="send_transaction-source">
|
1494
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 299</span>
|
1495
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">send_transaction</span>(<span class="ruby-identifier">transaction</span>)
|
1496
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"sendTransaction"</span>, <span class="ruby-identifier">transaction</span>)
|
1497
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1498
|
-
<span class="ruby-keyword">end</span></pre>
|
1499
|
-
</div>
|
1500
|
-
|
1501
|
-
</div>
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
</div>
|
1507
|
-
|
1508
|
-
|
1509
|
-
<div id="method-i-submit_block" class="method-detail ">
|
1510
|
-
|
1511
|
-
<div class="method-heading">
|
1512
|
-
<span class="method-name">submit_block</span><span
|
1513
|
-
class="method-args">(block)</span>
|
1514
|
-
|
1515
|
-
<span class="method-click-advice">click to toggle source</span>
|
1516
|
-
|
1517
|
-
</div>
|
1518
|
-
|
1519
|
-
|
1520
|
-
<div class="method-description">
|
1521
|
-
|
1522
|
-
<p><a href="Api.html#method-i-submit_block"><code>submit_block</code></a> - Submits a block to the node. When the block is valid, the node will forward it to other nodes in the network. When submitting work from getWork, remember to include the suffix.</p>
|
1523
|
-
<ul><li>
|
1524
|
-
<p>@param [String] block - Hex-encoded full block (including header, interlink and body).</p>
|
1525
|
-
</li></ul>
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
<div class="method-source-code" id="submit_block-source">
|
1531
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 307</span>
|
1532
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">submit_block</span>(<span class="ruby-identifier">block</span>)
|
1533
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"submitBlock"</span>, <span class="ruby-identifier">block</span>)
|
1534
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1535
|
-
<span class="ruby-keyword">end</span></pre>
|
1536
|
-
</div>
|
1537
|
-
|
1538
|
-
</div>
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
</div>
|
1544
|
-
|
1545
|
-
|
1546
|
-
<div id="method-i-syncing" class="method-detail ">
|
1547
|
-
|
1548
|
-
<div class="method-heading">
|
1549
|
-
<span class="method-name">syncing</span><span
|
1550
|
-
class="method-args">()</span>
|
1551
|
-
|
1552
|
-
<span class="method-click-advice">click to toggle source</span>
|
1553
|
-
|
1554
|
-
</div>
|
1555
|
-
|
1556
|
-
|
1557
|
-
<div class="method-description">
|
1558
|
-
|
1559
|
-
<p>syncing - Returns an object with data about the sync status or `false`.</p>
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
<div class="method-source-code" id="syncing-source">
|
1565
|
-
<pre><span class="ruby-comment"># File lib/api.rb, line 313</span>
|
1566
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">syncing</span>
|
1567
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@rpc</span>.<span class="ruby-identifier">request</span>(<span class="ruby-string">"syncing"</span>)
|
1568
|
-
<span class="ruby-keyword">return</span> <span class="ruby-identifier">result</span>
|
1569
|
-
<span class="ruby-keyword">end</span></pre>
|
1570
|
-
</div>
|
1571
|
-
|
1572
|
-
</div>
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
</div>
|
1578
|
-
|
1579
|
-
|
1580
|
-
</section>
|
1581
|
-
|
1582
|
-
</section>
|
1583
|
-
|
1584
|
-
</main>
|
1585
|
-
|
1586
|
-
|
1587
|
-
<footer id="validator-badges" role="contentinfo">
|
1588
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
1589
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
1590
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1591
|
-
</footer>
|
1592
|
-
|