keoken 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardoc/checksums +11 -11
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +4 -1
- data/doc/Bitcoin/Script.html +1 -1
- data/doc/Keoken/Backend/Base.html +67 -1
- data/doc/Keoken/Backend/BitcoinRuby/Transaction.html +2 -2
- data/doc/Keoken/Backend/BitcoinRuby.html +1 -1
- data/doc/Keoken/Backend/Trezor/Transaction.html +59 -27
- data/doc/Keoken/Backend/Trezor.html +1 -1
- data/doc/Keoken/Backend.html +1 -1
- data/doc/Keoken/Bitprim/Transaction.html +1 -1
- data/doc/Keoken/Bitprim.html +1 -1
- data/doc/Keoken/Error/DataNotParsed.html +202 -0
- data/doc/Keoken/Error/IdNotFound.html +202 -0
- data/doc/Keoken/Error/NameNotFound.html +202 -0
- data/doc/Keoken/Error/OutputNotFound.html +202 -0
- data/doc/Keoken/Error.html +117 -0
- data/doc/Keoken/Parser.html +1 -1
- data/doc/Keoken/Token.html +7 -7
- data/doc/Keoken.html +4 -4
- data/doc/_index.html +26 -11
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +1 -1
- data/doc/index.html +1 -1
- data/doc/method_list.html +18 -10
- data/doc/top-level-namespace.html +1 -1
- data/keoken.gemspec +1 -0
- data/lib/keoken/backend/trezor/transaction.rb +54 -24
- data/lib/keoken/version.rb +1 -1
- data/spec/keoken_spec.rb +81 -2
- metadata +20 -1
@@ -0,0 +1,117 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: Keoken::Error
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.18
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Keoken::Error";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (E)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Error</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: Keoken::Error
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/keoken/errors/id_not_found.rb<span class="defines">,<br />
|
82
|
+
lib/keoken/errors/name_not_found.rb,<br /> lib/keoken/errors/data_not_parsed.rb,<br /> lib/keoken/errors/output_not_found.rb</span>
|
83
|
+
</dd>
|
84
|
+
</dl>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<h2>Defined Under Namespace</h2>
|
89
|
+
<p class="children">
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Error/DataNotParsed.html" title="Keoken::Error::DataNotParsed (class)">DataNotParsed</a></span>, <span class='object_link'><a href="Error/IdNotFound.html" title="Keoken::Error::IdNotFound (class)">IdNotFound</a></span>, <span class='object_link'><a href="Error/NameNotFound.html" title="Keoken::Error::NameNotFound (class)">NameNotFound</a></span>, <span class='object_link'><a href="Error/OutputNotFound.html" title="Keoken::Error::OutputNotFound (class)">OutputNotFound</a></span>
|
95
|
+
|
96
|
+
|
97
|
+
</p>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div id="footer">
|
110
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
111
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
112
|
+
0.9.18 (ruby-2.3.3).
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</body>
|
117
|
+
</html>
|
data/doc/Keoken/Parser.html
CHANGED
@@ -469,7 +469,7 @@
|
|
469
469
|
</div>
|
470
470
|
|
471
471
|
<div id="footer">
|
472
|
-
Generated on
|
472
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
473
473
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
474
474
|
0.9.18 (ruby-2.3.3).
|
475
475
|
</div>
|
data/doc/Keoken/Token.html
CHANGED
@@ -582,7 +582,7 @@
|
|
582
582
|
<li>
|
583
583
|
|
584
584
|
|
585
|
-
<span class='type'>(<tt><span class='object_link'><a href="NameNotFound.html" title="Keoken::NameNotFound (class)">Keoken::NameNotFound</a></span></tt>)</span>
|
585
|
+
<span class='type'>(<tt><span class='object_link'><a href="Error/NameNotFound.html" title="Keoken::Error::NameNotFound (class)">Keoken::Error::NameNotFound</a></span></tt>)</span>
|
586
586
|
|
587
587
|
|
588
588
|
|
@@ -612,7 +612,7 @@
|
|
612
612
|
<pre class="code"><span class="info file"># File 'lib/keoken/token.rb', line 26</span>
|
613
613
|
|
614
614
|
<span class='kw'>def</span> <span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span>
|
615
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NameNotFound.html" title="Keoken::NameNotFound (class)">NameNotFound</a></span></span> <span class='kw'>unless</span> <span class='ivar'>@name</span>
|
615
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Error.html" title="Keoken::Error (module)">Error</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Error/NameNotFound.html" title="Keoken::Error::NameNotFound (class)">NameNotFound</a></span></span> <span class='kw'>unless</span> <span class='ivar'>@name</span>
|
616
616
|
<span class='ivar'>@data_script</span> <span class='op'>=</span>
|
617
617
|
<span class='lbracket'>[</span>
|
618
618
|
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#VERSION_NODE-constant" title="Keoken::VERSION_NODE (constant)">VERSION_NODE</a></span></span><span class='comma'>,</span>
|
@@ -749,7 +749,7 @@
|
|
749
749
|
<li>
|
750
750
|
|
751
751
|
|
752
|
-
<span class='type'>(<tt><span class='object_link'><a href="IdNotFound.html" title="Keoken::IdNotFound (class)">Keoken::IdNotFound</a></span></tt>)</span>
|
752
|
+
<span class='type'>(<tt><span class='object_link'><a href="Error/IdNotFound.html" title="Keoken::Error::IdNotFound (class)">Keoken::Error::IdNotFound</a></span></tt>)</span>
|
753
753
|
|
754
754
|
|
755
755
|
|
@@ -780,13 +780,13 @@
|
|
780
780
|
<pre class="code"><span class="info file"># File 'lib/keoken/token.rb', line 44</span>
|
781
781
|
|
782
782
|
<span class='kw'>def</span> <span class='id identifier rubyid_send_amount'>send_amount</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span>
|
783
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="IdNotFound.html" title="Keoken::IdNotFound (class)">IdNotFound</a></span></span> <span class='kw'>unless</span> <span class='ivar'>@id</span>
|
784
|
-
<span class='id identifier rubyid_asset_length'>asset_length</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#ASSET_ID_SIZE-constant" title="Keoken::ASSET_ID_SIZE (constant)">ASSET_ID_SIZE</a></span></span> <span class='op'>-</span> <span class='ivar'>@id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
783
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Error.html" title="Keoken::Error (module)">Error</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Error/IdNotFound.html" title="Keoken::Error::IdNotFound (class)">IdNotFound</a></span></span> <span class='kw'>unless</span> <span class='ivar'>@id</span>
|
784
|
+
<span class='id identifier rubyid_asset_length'>asset_length</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#ASSET_ID_SIZE-constant" title="Keoken::ASSET_ID_SIZE (constant)">ASSET_ID_SIZE</a></span></span> <span class='op'>-</span> <span class='ivar'>@id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span>
|
785
785
|
<span class='ivar'>@data_script</span> <span class='op'>=</span>
|
786
786
|
<span class='lbracket'>[</span>
|
787
787
|
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#VERSION_NODE-constant" title="Keoken::VERSION_NODE (constant)">VERSION_NODE</a></span></span><span class='comma'>,</span>
|
788
788
|
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#TYPE_SEND_TOKEN-constant" title="Keoken::TYPE_SEND_TOKEN (constant)">TYPE_SEND_TOKEN</a></span></span><span class='comma'>,</span>
|
789
|
-
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#PREFIX_BYTE_ASSET_ID-constant" title="Keoken::PREFIX_BYTE_ASSET_ID (constant)">PREFIX_BYTE_ASSET_ID</a></span></span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_asset_length'>asset_length</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='ivar'>@id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span>
|
789
|
+
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#PREFIX_BYTE_ASSET_ID-constant" title="Keoken::PREFIX_BYTE_ASSET_ID (constant)">PREFIX_BYTE_ASSET_ID</a></span></span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='lparen'>(</span><span class='id identifier rubyid_asset_length'>asset_length</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='ivar'>@id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='comma'>,</span>
|
790
790
|
<span class='const'><span class='object_link'><a href="../Keoken.html" title="Keoken (module)">Keoken</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Keoken.html#PREFIX_BYTE_AMOUNT-constant" title="Keoken::PREFIX_BYTE_AMOUNT (constant)">PREFIX_BYTE_AMOUNT</a></span></span><span class='lbracket'>[</span><span class='int'>0</span><span class='op'>..</span><span class='id identifier rubyid_prefix_length'>prefix_length</span><span class='lparen'>(</span><span class='id identifier rubyid_amount'>amount</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='id identifier rubyid_amount'>amount</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lparen'>(</span><span class='int'>16</span><span class='rparen'>)</span>
|
791
791
|
<span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
|
792
792
|
<span class='kw'>self</span>
|
@@ -903,7 +903,7 @@ return [String] JSON serialization of token object.
|
|
903
903
|
</div>
|
904
904
|
|
905
905
|
<div id="footer">
|
906
|
-
Generated on
|
906
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
907
907
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
908
908
|
0.9.18 (ruby-2.3.3).
|
909
909
|
</div>
|
data/doc/Keoken.html
CHANGED
@@ -89,11 +89,11 @@
|
|
89
89
|
<p class="children">
|
90
90
|
|
91
91
|
|
92
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span>, <span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span>
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span>, <span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span>, <span class='object_link'><a href="Keoken/Error.html" title="Keoken::Error (module)">Error</a></span>
|
93
93
|
|
94
94
|
|
95
95
|
|
96
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Keoken/
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Keoken/Parser.html" title="Keoken::Parser (class)">Parser</a></span>, <span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span>
|
97
97
|
|
98
98
|
|
99
99
|
</p>
|
@@ -154,7 +154,7 @@
|
|
154
154
|
<dt id="VERSION-constant" class="">VERSION =
|
155
155
|
|
156
156
|
</dt>
|
157
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.2.
|
157
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.2.8</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
158
158
|
|
159
159
|
</dl>
|
160
160
|
|
@@ -170,7 +170,7 @@
|
|
170
170
|
</div>
|
171
171
|
|
172
172
|
<div id="footer">
|
173
|
-
Generated on
|
173
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
174
174
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
175
175
|
0.9.18 (ruby-2.3.3).
|
176
176
|
</div>
|
data/doc/_index.html
CHANGED
@@ -117,7 +117,22 @@
|
|
117
117
|
<ul>
|
118
118
|
|
119
119
|
<li>
|
120
|
-
<span class='object_link'><a href="Keoken/DataNotParsed.html" title="Keoken::DataNotParsed (class)">DataNotParsed</a></span>
|
120
|
+
<span class='object_link'><a href="Keoken/Error/DataNotParsed.html" title="Keoken::Error::DataNotParsed (class)">DataNotParsed</a></span>
|
121
|
+
|
122
|
+
<small>(Keoken::Error)</small>
|
123
|
+
|
124
|
+
</li>
|
125
|
+
|
126
|
+
</ul>
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
|
130
|
+
<ul id="alpha_E" class="alpha">
|
131
|
+
<li class="letter">E</li>
|
132
|
+
<ul>
|
133
|
+
|
134
|
+
<li>
|
135
|
+
<span class='object_link'><a href="Keoken/Error.html" title="Keoken::Error (module)">Error</a></span>
|
121
136
|
|
122
137
|
<small>(Keoken)</small>
|
123
138
|
|
@@ -132,9 +147,9 @@
|
|
132
147
|
<ul>
|
133
148
|
|
134
149
|
<li>
|
135
|
-
<span class='object_link'><a href="Keoken/IdNotFound.html" title="Keoken::IdNotFound (class)">IdNotFound</a></span>
|
150
|
+
<span class='object_link'><a href="Keoken/Error/IdNotFound.html" title="Keoken::Error::IdNotFound (class)">IdNotFound</a></span>
|
136
151
|
|
137
|
-
<small>(Keoken)</small>
|
152
|
+
<small>(Keoken::Error)</small>
|
138
153
|
|
139
154
|
</li>
|
140
155
|
|
@@ -160,9 +175,9 @@
|
|
160
175
|
<ul>
|
161
176
|
|
162
177
|
<li>
|
163
|
-
<span class='object_link'><a href="Keoken/NameNotFound.html" title="Keoken::NameNotFound (class)">NameNotFound</a></span>
|
178
|
+
<span class='object_link'><a href="Keoken/Error/NameNotFound.html" title="Keoken::Error::NameNotFound (class)">NameNotFound</a></span>
|
164
179
|
|
165
|
-
<small>(Keoken)</small>
|
180
|
+
<small>(Keoken::Error)</small>
|
166
181
|
|
167
182
|
</li>
|
168
183
|
|
@@ -175,9 +190,9 @@
|
|
175
190
|
<ul>
|
176
191
|
|
177
192
|
<li>
|
178
|
-
<span class='object_link'><a href="Keoken/OutputNotFound.html" title="Keoken::OutputNotFound (class)">OutputNotFound</a></span>
|
193
|
+
<span class='object_link'><a href="Keoken/Error/OutputNotFound.html" title="Keoken::Error::OutputNotFound (class)">OutputNotFound</a></span>
|
179
194
|
|
180
|
-
<small>(Keoken)</small>
|
195
|
+
<small>(Keoken::Error)</small>
|
181
196
|
|
182
197
|
</li>
|
183
198
|
|
@@ -185,6 +200,9 @@
|
|
185
200
|
</ul>
|
186
201
|
|
187
202
|
|
203
|
+
</td><td valign='top' width="33%">
|
204
|
+
|
205
|
+
|
188
206
|
<ul id="alpha_P" class="alpha">
|
189
207
|
<li class="letter">P</li>
|
190
208
|
<ul>
|
@@ -200,9 +218,6 @@
|
|
200
218
|
</ul>
|
201
219
|
|
202
220
|
|
203
|
-
</td><td valign='top' width="33%">
|
204
|
-
|
205
|
-
|
206
221
|
<ul id="alpha_S" class="alpha">
|
207
222
|
<li class="letter">S</li>
|
208
223
|
<ul>
|
@@ -269,7 +284,7 @@
|
|
269
284
|
</div>
|
270
285
|
|
271
286
|
<div id="footer">
|
272
|
-
Generated on
|
287
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
273
288
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
274
289
|
0.9.18 (ruby-2.3.3).
|
275
290
|
</div>
|
data/doc/class_list.html
CHANGED
@@ -43,7 +43,7 @@
|
|
43
43
|
|
44
44
|
<ul id="full_list" class="class">
|
45
45
|
<li id="object_" class="odd"><div class="item" style="padding-left:30px"><span class='object_link'><a href="top-level-namespace.html" title="Top Level Namespace (root)">Top Level Namespace</a></span></div></li>
|
46
|
-
<li id='object_Bitcoin::Script' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Bitcoin/Script.html" title="Bitcoin::Script (class)">Bitcoin::Script</a></span> < Object<small class='search_info'>Bitcoin</small></div></li><li id='object_Keoken' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Keoken::Backend' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span><small class='search_info'>Keoken</small></div><ul><li id='object_Keoken::Backend::Base' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Backend/Base.html" title="Keoken::Backend::Base (class)">Base</a></span> < Object<small class='search_info'>Keoken::Backend</small></div></li><li id='object_Keoken::Backend::BitcoinRuby' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span><small class='search_info'>Keoken::Backend</small></div><ul><li id='object_Keoken::Backend::BitcoinRuby::Transaction' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span> < Base<small class='search_info'>Keoken::Backend::BitcoinRuby</small></div></li></ul></li><li id='object_Keoken::Backend::Trezor' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend/Trezor.html" title="Keoken::Backend::Trezor (module)">Trezor</a></span><small class='search_info'>Keoken::Backend</small></div><ul><li id='object_Keoken::Backend::Trezor::Transaction' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Keoken/Backend/Trezor/Transaction.html" title="Keoken::Backend::Trezor::Transaction (class)">Transaction</a></span> < Base<small class='search_info'>Keoken::Backend::Trezor</small></div></li></ul></li></ul></li><li id='object_Keoken::Bitprim' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span><small class='search_info'>Keoken</small></div><ul><li id='object_Keoken::Bitprim::Transaction' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span> < Object<small class='search_info'>Keoken::Bitprim</small></div></li></ul></li><li id='object_Keoken::
|
46
|
+
<li id='object_Bitcoin::Script' class='even'><div class='item' style='padding-left:30px'><span class='object_link'><a href="Bitcoin/Script.html" title="Bitcoin::Script (class)">Bitcoin::Script</a></span> < Object<small class='search_info'>Bitcoin</small></div></li><li id='object_Keoken' class='odd'><div class='item' style='padding-left:30px'><a class='toggle'></a> <span class='object_link'><a href="Keoken.html" title="Keoken (module)">Keoken</a></span><small class='search_info'>Top Level Namespace</small></div><ul><li id='object_Keoken::Backend' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend.html" title="Keoken::Backend (module)">Backend</a></span><small class='search_info'>Keoken</small></div><ul><li id='object_Keoken::Backend::Base' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Backend/Base.html" title="Keoken::Backend::Base (class)">Base</a></span> < Object<small class='search_info'>Keoken::Backend</small></div></li><li id='object_Keoken::Backend::BitcoinRuby' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend/BitcoinRuby.html" title="Keoken::Backend::BitcoinRuby (module)">BitcoinRuby</a></span><small class='search_info'>Keoken::Backend</small></div><ul><li id='object_Keoken::Backend::BitcoinRuby::Transaction' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Keoken/Backend/BitcoinRuby/Transaction.html" title="Keoken::Backend::BitcoinRuby::Transaction (class)">Transaction</a></span> < Base<small class='search_info'>Keoken::Backend::BitcoinRuby</small></div></li></ul></li><li id='object_Keoken::Backend::Trezor' class='collapsed'><div class='item' style='padding-left:60px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Backend/Trezor.html" title="Keoken::Backend::Trezor (module)">Trezor</a></span><small class='search_info'>Keoken::Backend</small></div><ul><li id='object_Keoken::Backend::Trezor::Transaction' class='collapsed'><div class='item' style='padding-left:75px'><span class='object_link'><a href="Keoken/Backend/Trezor/Transaction.html" title="Keoken::Backend::Trezor::Transaction (class)">Transaction</a></span> < Base<small class='search_info'>Keoken::Backend::Trezor</small></div></li></ul></li></ul></li><li id='object_Keoken::Bitprim' class='collapsed odd'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Bitprim.html" title="Keoken::Bitprim (module)">Bitprim</a></span><small class='search_info'>Keoken</small></div><ul><li id='object_Keoken::Bitprim::Transaction' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Bitprim/Transaction.html" title="Keoken::Bitprim::Transaction (class)">Transaction</a></span> < Object<small class='search_info'>Keoken::Bitprim</small></div></li></ul></li><li id='object_Keoken::Error' class='collapsed even'><div class='item' style='padding-left:45px'><a class='toggle'></a> <span class='object_link'><a href="Keoken/Error.html" title="Keoken::Error (module)">Error</a></span><small class='search_info'>Keoken</small></div><ul><li id='object_Keoken::Error::DataNotParsed' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Error/DataNotParsed.html" title="Keoken::Error::DataNotParsed (class)">DataNotParsed</a></span> < StandardError<small class='search_info'>Keoken::Error</small></div></li><li id='object_Keoken::Error::IdNotFound' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Error/IdNotFound.html" title="Keoken::Error::IdNotFound (class)">IdNotFound</a></span> < StandardError<small class='search_info'>Keoken::Error</small></div></li><li id='object_Keoken::Error::NameNotFound' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Error/NameNotFound.html" title="Keoken::Error::NameNotFound (class)">NameNotFound</a></span> < StandardError<small class='search_info'>Keoken::Error</small></div></li><li id='object_Keoken::Error::OutputNotFound' class='collapsed'><div class='item' style='padding-left:60px'><span class='object_link'><a href="Keoken/Error/OutputNotFound.html" title="Keoken::Error::OutputNotFound (class)">OutputNotFound</a></span> < StandardError<small class='search_info'>Keoken::Error</small></div></li></ul></li><li id='object_Keoken::Parser' class='collapsed odd'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Keoken/Parser.html" title="Keoken::Parser (class)">Parser</a></span> < Object<small class='search_info'>Keoken</small></div></li><li id='object_Keoken::Token' class='collapsed even'><div class='item' style='padding-left:45px'><span class='object_link'><a href="Keoken/Token.html" title="Keoken::Token (class)">Token</a></span> < Parser<small class='search_info'>Keoken</small></div></li></ul></li>
|
47
47
|
|
48
48
|
</ul>
|
49
49
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -126,7 +126,7 @@ the change address, the address who owns the recipient token and the script.</p>
|
|
126
126
|
</div></div>
|
127
127
|
|
128
128
|
<div id="footer">
|
129
|
-
Generated on
|
129
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
130
130
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
131
131
|
0.9.18 (ruby-2.3.3).
|
132
132
|
</div>
|
data/doc/index.html
CHANGED
@@ -126,7 +126,7 @@ the change address, the address who owns the recipient token and the script.</p>
|
|
126
126
|
</div></div>
|
127
127
|
|
128
128
|
<div id="footer">
|
129
|
-
Generated on
|
129
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
130
130
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
131
131
|
0.9.18 (ruby-2.3.3).
|
132
132
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -190,32 +190,32 @@
|
|
190
190
|
|
191
191
|
<li class="odd ">
|
192
192
|
<div class="item">
|
193
|
-
<span class='object_link'><a href="Keoken/IdNotFound.html#initialize-instance_method" title="Keoken::IdNotFound#initialize (method)">#initialize</a></span>
|
194
|
-
<small>Keoken::IdNotFound</small>
|
193
|
+
<span class='object_link'><a href="Keoken/Error/IdNotFound.html#initialize-instance_method" title="Keoken::Error::IdNotFound#initialize (method)">#initialize</a></span>
|
194
|
+
<small>Keoken::Error::IdNotFound</small>
|
195
195
|
</div>
|
196
196
|
</li>
|
197
197
|
|
198
198
|
|
199
199
|
<li class="even ">
|
200
200
|
<div class="item">
|
201
|
-
<span class='object_link'><a href="Keoken/NameNotFound.html#initialize-instance_method" title="Keoken::NameNotFound#initialize (method)">#initialize</a></span>
|
202
|
-
<small>Keoken::NameNotFound</small>
|
201
|
+
<span class='object_link'><a href="Keoken/Error/NameNotFound.html#initialize-instance_method" title="Keoken::Error::NameNotFound#initialize (method)">#initialize</a></span>
|
202
|
+
<small>Keoken::Error::NameNotFound</small>
|
203
203
|
</div>
|
204
204
|
</li>
|
205
205
|
|
206
206
|
|
207
207
|
<li class="odd ">
|
208
208
|
<div class="item">
|
209
|
-
<span class='object_link'><a href="Keoken/DataNotParsed.html#initialize-instance_method" title="Keoken::DataNotParsed#initialize (method)">#initialize</a></span>
|
210
|
-
<small>Keoken::DataNotParsed</small>
|
209
|
+
<span class='object_link'><a href="Keoken/Error/DataNotParsed.html#initialize-instance_method" title="Keoken::Error::DataNotParsed#initialize (method)">#initialize</a></span>
|
210
|
+
<small>Keoken::Error::DataNotParsed</small>
|
211
211
|
</div>
|
212
212
|
</li>
|
213
213
|
|
214
214
|
|
215
215
|
<li class="even ">
|
216
216
|
<div class="item">
|
217
|
-
<span class='object_link'><a href="Keoken/OutputNotFound.html#initialize-instance_method" title="Keoken::OutputNotFound#initialize (method)">#initialize</a></span>
|
218
|
-
<small>Keoken::OutputNotFound</small>
|
217
|
+
<span class='object_link'><a href="Keoken/Error/OutputNotFound.html#initialize-instance_method" title="Keoken::Error::OutputNotFound#initialize (method)">#initialize</a></span>
|
218
|
+
<small>Keoken::Error::OutputNotFound</small>
|
219
219
|
</div>
|
220
220
|
</li>
|
221
221
|
|
@@ -309,6 +309,14 @@
|
|
309
309
|
|
310
310
|
|
311
311
|
<li class="even ">
|
312
|
+
<div class="item">
|
313
|
+
<span class='object_link'><a href="Keoken/Backend/Base.html#total_inputs_amount-instance_method" title="Keoken::Backend::Base#total_inputs_amount (method)">#total_inputs_amount</a></span>
|
314
|
+
<small>Keoken::Backend::Base</small>
|
315
|
+
</div>
|
316
|
+
</li>
|
317
|
+
|
318
|
+
|
319
|
+
<li class="odd ">
|
312
320
|
<div class="item">
|
313
321
|
<span class='object_link'><a href="Keoken/Parser.html#transaction_type-instance_method" title="Keoken::Parser#transaction_type (method)">#transaction_type</a></span>
|
314
322
|
<small>Keoken::Parser</small>
|
@@ -316,7 +324,7 @@
|
|
316
324
|
</li>
|
317
325
|
|
318
326
|
|
319
|
-
<li class="
|
327
|
+
<li class="even ">
|
320
328
|
<div class="item">
|
321
329
|
<span class='object_link'><a href="Keoken/Bitprim/Transaction.html#tx-instance_method" title="Keoken::Bitprim::Transaction#tx (method)">#tx</a></span>
|
322
330
|
<small>Keoken::Bitprim::Transaction</small>
|
@@ -324,7 +332,7 @@
|
|
324
332
|
</li>
|
325
333
|
|
326
334
|
|
327
|
-
<li class="
|
335
|
+
<li class="odd ">
|
328
336
|
<div class="item">
|
329
337
|
<span class='object_link'><a href="Keoken/Bitprim/Transaction.html#utxos-instance_method" title="Keoken::Bitprim::Transaction#utxos (method)">#utxos</a></span>
|
330
338
|
<small>Keoken::Bitprim::Transaction</small>
|
@@ -100,7 +100,7 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
103
|
+
Generated on Fri Feb 8 14:51:35 2019 by
|
104
104
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
105
|
0.9.18 (ruby-2.3.3).
|
106
106
|
</div>
|
data/keoken.gemspec
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'money-tree'
|
2
|
+
|
1
3
|
module Keoken
|
2
4
|
module Backend
|
3
5
|
module Trezor
|
@@ -9,14 +11,15 @@ module Keoken
|
|
9
11
|
# @param address [String] Address that will contain the token.
|
10
12
|
# @param path [Array] Address derivation path.
|
11
13
|
# @param script [String] The token script.
|
14
|
+
# @param xpubs [Array] The xpubs corresponding to the multisig address.
|
12
15
|
#
|
13
16
|
# @return [Keoken::Backend::Trezor::Transaction] A serialized object ready for Trezor signing.
|
14
17
|
#
|
15
|
-
def build_for_creation(address, path, script)
|
18
|
+
def build_for_creation(address, path, script, xpubs = [])
|
16
19
|
build_inputs(address)
|
17
20
|
total, fee = build_fee(:create)
|
18
21
|
output_amount = total - fee.to_i
|
19
|
-
create(@inputs, path, address, output_amount, script)
|
22
|
+
create(@inputs, path, address, output_amount, script, xpubs)
|
20
23
|
end
|
21
24
|
|
22
25
|
# Create the transaction to broadcast in order to send amount between tokens.
|
@@ -25,30 +28,23 @@ module Keoken
|
|
25
28
|
# @param address_dest [String] Address to receive the tokens.
|
26
29
|
# @param path [Array] Address derivation path.
|
27
30
|
# @param script [String] The token script.
|
31
|
+
# @param xpubs [Array] The xpubs corresponding to the multisig address.
|
28
32
|
#
|
29
33
|
# @return [Keoken::Backend::Trezor::Transaction] A serialized object ready for Trezor signing.
|
30
34
|
#
|
31
|
-
def build_for_send_amount(address, address_dest, path, script)
|
35
|
+
def build_for_send_amount(address, address_dest, path, script, xpubs = [])
|
32
36
|
build_inputs(address)
|
33
37
|
total, fee = build_fee(:send)
|
34
38
|
output_amount = total - (fee.to_i * 2)
|
35
39
|
output_amount_to_addr2 = fee.to_i
|
36
|
-
send(@inputs, path, output_amount, address, output_amount_to_addr2, address_dest, script)
|
40
|
+
send(@inputs, path, output_amount, address, output_amount_to_addr2, address_dest, script, xpubs)
|
37
41
|
end
|
38
42
|
|
39
43
|
private
|
40
44
|
|
41
|
-
def create(inputs, path, address, output_amount, script)
|
45
|
+
def create(inputs, path, address, output_amount, script, xpubs)
|
42
46
|
{
|
43
|
-
inputs:
|
44
|
-
inputs.map do |input|
|
45
|
-
{
|
46
|
-
address_n: path,
|
47
|
-
prev_index: input[:position],
|
48
|
-
prev_hash: input[:tx_id],
|
49
|
-
amount: input[:input_amount].to_s
|
50
|
-
}
|
51
|
-
end,
|
47
|
+
inputs: build_trezor_inputs(inputs, path, address, xpubs),
|
52
48
|
outputs: [
|
53
49
|
{
|
54
50
|
address: Cashaddress.from_legacy(address),
|
@@ -64,17 +60,9 @@ module Keoken
|
|
64
60
|
}
|
65
61
|
end
|
66
62
|
|
67
|
-
def send(inputs, path, output_amount, address, output_amount_to_addr2, addr2, script)
|
63
|
+
def send(inputs, path, output_amount, address, output_amount_to_addr2, addr2, script, xpubs)
|
68
64
|
{
|
69
|
-
inputs:
|
70
|
-
inputs.map do |input|
|
71
|
-
{
|
72
|
-
address_n: path,
|
73
|
-
prev_index: input[:position],
|
74
|
-
prev_hash: input[:tx_id],
|
75
|
-
amount: input[:input_amount].to_s
|
76
|
-
}
|
77
|
-
end,
|
65
|
+
inputs: build_trezor_inputs(inputs, path, address, xpubs),
|
78
66
|
outputs: [
|
79
67
|
{
|
80
68
|
address: Cashaddress.from_legacy(address),
|
@@ -94,6 +82,48 @@ module Keoken
|
|
94
82
|
]
|
95
83
|
}
|
96
84
|
end
|
85
|
+
|
86
|
+
def build_trezor_inputs(inputs, path, address, xpubs)
|
87
|
+
inputs.map do |input|
|
88
|
+
hash =
|
89
|
+
{
|
90
|
+
address_n: path,
|
91
|
+
prev_index: input[:position],
|
92
|
+
prev_hash: input[:tx_id],
|
93
|
+
amount: input[:input_amount].to_s
|
94
|
+
}
|
95
|
+
hash.merge(build_multisig(address, path, xpubs))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def build_multisig(address, path, xpubs)
|
100
|
+
if xpubs.empty?
|
101
|
+
{}
|
102
|
+
else
|
103
|
+
{
|
104
|
+
script_type: 'SPENDMULTISIG',
|
105
|
+
multisig:
|
106
|
+
{
|
107
|
+
signatures: ['', '', ''],
|
108
|
+
m: 2,
|
109
|
+
pubkeys: xpubs.map do |xpub|
|
110
|
+
node = MoneyTree::Node.from_bip32(xpub)
|
111
|
+
{
|
112
|
+
address_n: path,
|
113
|
+
node:
|
114
|
+
{
|
115
|
+
chain_code: node.chain_code.to_s(16),
|
116
|
+
depth: 0,
|
117
|
+
child_num: 0,
|
118
|
+
fingerprint: 0,
|
119
|
+
public_key: node.public_key.key
|
120
|
+
}
|
121
|
+
}
|
122
|
+
end
|
123
|
+
}
|
124
|
+
}
|
125
|
+
end
|
126
|
+
end
|
97
127
|
end
|
98
128
|
end
|
99
129
|
end
|
data/lib/keoken/version.rb
CHANGED