openassets-ruby 0.5.9 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6db9e2095845b0f41f8d2ce916eec8861e17e85
4
- data.tar.gz: af64f14eac87c2c661880de228559c2a01857b0b
3
+ metadata.gz: 6049263ed6d5a4b2352121798443348afcff0d32
4
+ data.tar.gz: dc1a6b813c3b7c1680ba6812b14b9a1132c2aada
5
5
  SHA512:
6
- metadata.gz: 2d842c800af1c6ec40bc9e89fdea57e7772c10971331d34b199318540ce65564bd6a547f5b050bcbb5d1c3928088a9e03a3f3db513a15e959e92dd0643e0c2d7
7
- data.tar.gz: 1cc45ea3ac9b069f7220f72c24e5c0d94fd06c81af439cf3bd4d0f921c4cbfbf81348f7086f613cbdf8f019533dbe7c9e5fd15324ab89dd2f31053f1744fdb29
6
+ metadata.gz: b40d7c76bdfd510d9de15c7889269c8aa0792056f700bc721e7f4dced496f7ca4a02ccbc752998b7b75c0d8410c7881b22b0b9e4fa659424116848e9a05867fb
7
+ data.tar.gz: 98057b6457902d560748f09476db474ba3c7c94aef422eac83fdc4a72576015abef9be942f980acd2762778cb4cf9ff419bb34fa8958efc6521fb1aa662c1834
data/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015 HAW International Inc.
3
+ Copyright (c) 2015-2017 HAW International Inc.
4
+ Copyright (c) 2015-2017 azuchi
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,60 +4,86 @@ The implementation of the [Open Assets Protocol](https://github.com/OpenAssets/o
4
4
  ## Install
5
5
 
6
6
  ```ruby
7
- gem install openassets-ruby
7
+ gem install openassets-ruby
8
8
  ```
9
9
 
10
10
  ## Configuration
11
11
 
12
12
  Initialize the connection information to the Bitcoin Core server.
13
13
 
14
- * **use mainnet**
14
+ * **use mainnet**
15
15
  ```ruby
16
16
  require 'openassets'
17
17
 
18
- api = OpenAssets::Api.new({:network => 'mainnet',
19
- :provider => 'bitcoind', :cache => 'cache.db',
20
- :dust_limit => 600, :default_fees => 10000, :min_confirmation => 1, :max_confirmation => 9999999,
21
- :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 8332, :host => 'localhost', :timeout => 60, :open_timeout => 60}})
18
+ api = OpenAssets::Api.new({
19
+ network: 'mainnet',
20
+ provider: 'bitcoind',
21
+ cache: 'cache.db',
22
+ dust_limit: 600,
23
+ default_fees: 10000,
24
+ min_confirmation: 1,
25
+ max_confirmation: 9999999,
26
+ rpc: {
27
+ user: 'xxx',
28
+ password: 'xxx',
29
+ schema: 'http',
30
+ port: 8332,
31
+ host: 'localhost',
32
+ timeout: 60,
33
+ open_timeout: 60 }
34
+ })
22
35
  ```
23
36
 
24
- * **use testnet**
25
- change :network and :port(depends on your server setting).
37
+ * **use testnet**
38
+ Change `network` and `port` depending on your server setting.
26
39
  ```ruby
27
40
  require 'openassets'
28
41
 
29
- api = OpenAssets::Api.new({:network => 'testnet',
30
- :provider => 'bitcoind', :cache => 'testnet.db',
31
- :dust_limit => 600, :default_fees => 10000, :min_confirmation => 1, :max_confirmation => 9999999,
32
- :rpc => {:user => 'xxx', :password => 'xxx', :schema => 'http', :port => 18332, :host => 'localhost', :timeout => 60, :open_timeout => 60}})
42
+ api = OpenAssets::Api.new({
43
+ network: 'testnet',
44
+ provider: 'bitcoind',
45
+ cache: 'testnet.db',
46
+ dust_limit: 600,
47
+ default_fees: 10000,
48
+ min_confirmation: 1,
49
+ max_confirmation: 9999999,
50
+ rpc: {
51
+ user: 'xxx',
52
+ password: 'xxx',
53
+ schema: 'http',
54
+ port: 18332,
55
+ host: 'localhost',
56
+ timeout: 60,
57
+ open_timeout: 60 }
58
+ })
33
59
  ```
34
60
 
35
61
  The configuration options are as follows:
36
62
 
37
- |option|describe|default|
63
+ |option|description|default|
38
64
  |---|---|---|
39
- |**network**|The using network. "mainnet" or "testnet" or "regtest" |mainnet|
40
- |**provider**|The RPC server. Specify possible now only "bitcoind".|bitcoind|
41
- |**cache**|The path to the database file. If you want to use in-memory database, specify ':memory:'. |cache.db|
42
- |**dust_limit**|The amount of Bitcoin, which is set to the each output of the Open Assets Protocol(issue or transfer).|600 (satoshi)|
43
- |**default_fees**|The default transaction fee in satoshi. If you want to use auto fee settings, specify ':auto'. (used by issue_asset and send_asset, send_bitcoin )|10000 (satoshi)|
65
+ |**network**|The using network. "mainnet" or "testnet" or "regtest" or "litecoin" or "litecoin_testnet" |mainnet|
66
+ |**provider**|The RPC server. "bitcoind" is the only option for now.|bitcoind|
67
+ |**cache**|The path to the database file. Specify ':memory: to use in-memory database.|cache.db|
68
+ |**dust_limit**|The amount of Bitcoin, which is set to the each output of the Open Assets Protocol (issue or transfer).|600 (satoshi)|
69
+ |**default_fees**|The default transaction fee in satoshi. Specify ':auto' to use auto fee settings. (used by issue_asset and send_asset, send_bitcoin )|10000 (satoshi)|
44
70
  |**min_confirmation**|The minimum number of confirmations the transaction containing an output that used to get UTXO.|1|
45
71
  |**max_confirmation**|The maximum number of confirmations the transaction containing an output that used to get UTXO.|9999999|
46
72
  |**rpc**|The access information to the RPC server of Bitcoin Core.|N/A|
47
73
 
48
74
  ## API
49
75
 
50
- Currently openassets-ruby support the following API.
76
+ Currently openassets-ruby support the following API.
51
77
 
52
- * **list_unspent**
78
+ * **list_unspent**
53
79
  Returns an array of unspent transaction outputs, argument with the asset ID and quantity of each output.
54
80
  ```ruby
55
81
  # get all unspent outputs in the wallet.
56
82
  api.list_unspent
57
-
83
+
58
84
  # specify th open asset address.
59
85
  api.list_unspent(['akTfC7D825Cse4NvFiLCy7vr3B6x2Mpq8t6'])
60
-
86
+
61
87
  > [
62
88
  {
63
89
  "txid": "1610a1f62597a3ea36e09e78354be22d2a958c1a38ed9e5d3f1c2811ee82dc37",
@@ -75,9 +101,9 @@ Returns an array of unspent transaction outputs, argument with the asset ID and
75
101
  "proof_of_authenticity": false
76
102
  },
77
103
  ...
78
- ```
104
+ ```
79
105
  Output items are as follows.
80
-
106
+
81
107
  |Item|description|
82
108
  |:---|:---|
83
109
  |txid|The TXID of the transaction containing the output.|
@@ -89,16 +115,16 @@ Returns an array of unspent transaction outputs, argument with the asset ID and
89
115
  |asset_id|The asset ID is a 160 bits hash, used to uniquely identify the asset stored on the output.|
90
116
  |account|The name of an account.|
91
117
  |asset_quantity|The asset quantity is an unsigned integer representing how many units of that asset are stored on the output.|
92
- |asset_amount| The asset amount is the value obtained by converting the asset quantity to the unit of divisibility that are defined in the Asset definition file. |
118
+ |asset_amount| The asset amount is the value obtained by converting the asset quantity to the unit of divisibility that are defined in the Asset definition file. |
93
119
  |asset_definition_url|The url of asset definition file.|
94
120
  |proof_of_authenticity|The result of [Proof of Authenticity](https://github.com/OpenAssets/open-assets-protocol/blob/master/asset-definition-protocol.mediawiki#Proof_of_Authenticity) that is checked consistent with the subject in the SSL certificate. If the result is true, issuer is verified. If the result is false, issuer is not verified. This verification is performed only if link_to_website that is defined in Asset Definition File is true.|
95
121
 
96
- * **get_balance**
122
+ * **get_balance**
97
123
  Returns the balance in both bitcoin and colored coin assets for all of the addresses available in your Bitcoin Core wallet.
98
124
  ```ruby
99
125
  # get all balance in the wallet.
100
126
  api.get_balance
101
-
127
+
102
128
  # specify the open asset address.
103
129
  api.get_balance('akTfC7D825Cse4NvFiLCy7vr3B6x2Mpq8t6')
104
130
  > [
@@ -124,9 +150,9 @@ Returns the balance in both bitcoin and colored coin assets for all of the addre
124
150
  ],
125
151
  "account": "openassets-ruby"
126
152
  },
127
- ```
153
+ ```
128
154
  Output items are as follows.
129
-
155
+
130
156
  |Item|description|
131
157
  |:---|:---|
132
158
  |address| A P2PKH or P2SH address.|
@@ -135,12 +161,12 @@ Returns the balance in both bitcoin and colored coin assets for all of the addre
135
161
  |assets|The array of the assets.|
136
162
  |asset_id|The asset ID is a 160 bits hash, used to uniquely identify the asset stored on the output.|
137
163
  |asset_quantity|The asset quantity is an unsigned integer representing how many units of that asset are stored on the output.|
138
- |asset_amount| The asset amount is the value obtained by converting the asset quantity to the unit of divisibility that are defined in the Asset definition file. |
164
+ |asset_amount| The asset amount is the value obtained by converting the asset quantity to the unit of divisibility that are defined in the Asset definition file. |
139
165
  |asset_definition_url|The url of asset definition file.|
140
166
  |proof_of_authenticity|The result of [Proof of Authenticity](https://github.com/OpenAssets/open-assets-protocol/blob/master/asset-definition-protocol.mediawiki#Proof_of_Authenticity) that is checked consistent with the subject in the SSL certificate. If the result is true, issuer is verified. If the result is false, issuer is not verified. This verification is performed only if link_to_website that is defined in Asset Definition File is true.|
141
167
  |account|The name of an account.|
142
-
143
- * **issue_asset**
168
+
169
+ * **issue_asset**
144
170
  Creates a transaction for issuing an asset.
145
171
  ```ruby
146
172
  # issue asset
@@ -149,11 +175,11 @@ Creates a transaction for issuing an asset.
149
175
  # example
150
176
  address = 'akEJwzkzEFau4t2wjbXoMs7MwtZkB8xixmH'
151
177
  api.issue_asset(address, 150, 'u=https://goo.gl/bmVEuw', address, nil, 'broadcast')
152
- ```
153
- If specified ``output_qty``, the issue output is divided by the number of output_qty.
178
+ ```
179
+ If specified ``output_qty``, the issue output is divided by the number of output_qty.
154
180
  Ex, amount = 125 and output_qty = 2, the marker output asset quantity is [62, 63] and issue TxOut is two.
155
181
 
156
- * **send_asset**
182
+ * **send_asset**
157
183
  Creates a transaction for sending an asset from the open asset address to another.
158
184
  ```ruby
159
185
  # send asset
@@ -163,12 +189,12 @@ Creates a transaction for sending an asset from the open asset address to anothe
163
189
  from = 'akXDPMMHHBrUrd1fM756M1GSB8viVAwMyBk'
164
190
  to = 'akTfC7D825Cse4NvFiLCy7vr3B6x2Mpq8t6'
165
191
  api.send_asset(from, 'AWo3R89p5REmoSyMWB8AeUmud8456bRxZL', 100, to, 10000, 'broadcast')
166
- ```
167
- If specified ``output_qty``, the send output is divided by the number of output_qty.
192
+ ```
193
+ If specified ``output_qty``, the send output is divided by the number of output_qty.
168
194
  Ex, asset holding amount = 200, and send amount = 125 and output_qty = 2, the marker output asset quantity is [62, 63, 75] and send TxOut is three. The last of the asset quantity is change asset output.
169
-
170
- * **send_bitcoin**
171
- Creates a transaction for sending bitcoins from an address to another.
195
+
196
+ * **send_bitcoin**
197
+ Creates a transaction for sending bitcoins from an address to another.
172
198
  This transaction inputs use only uncolored outputs.
173
199
  ```ruby
174
200
  # send bitcoin
@@ -178,11 +204,11 @@ This transaction inputs use only uncolored outputs.
178
204
  from = '14M4kbAtn71P1nnNYuhBDFTNYxa19t1XP6'
179
205
  to = '1MFW7BTwiNbAkmVz4SzAMQXboKYKGSzkq2'
180
206
  api.send_bitcoin(from, 60000, to)
181
- ```
182
- If specified ``output_qty``, the send output is divided by the number of output_qty.
207
+ ```
208
+ If specified ``output_qty``, the send output is divided by the number of output_qty.
183
209
  Ex, amount = 60000 and output_qty = 2, send TxOut is two (each value is 30000, 30000) and change TxOut one.
184
210
 
185
- * **get_outputs_from_txid**
211
+ * **get_outputs_from_txid**
186
212
  Get tx outputs. (use for debug)
187
213
  ```ruby
188
214
  # api.get_outputs_from_txid(<txid>, <use_cache default value is false.>)
@@ -202,10 +228,10 @@ Get tx outputs. (use for debug)
202
228
  "txid": "3fba8bfb157ae29c293d5bd65c178fec169a87f880e2e62537fcce26612a6aa3",
203
229
  "vout": 1
204
230
  },..
205
- ```
206
-
207
- * **send_assets**
208
- Creates a transaction for sending **multiple** asset from the open asset address(es) to another.
231
+ ```
232
+
233
+ * **send_assets**
234
+ Creates a transaction for sending **multiple** asset from the open asset address(es) to another.
209
235
  `<from open asset address>` is used to send bitcoins **if** needed, and receive bitcoin change **if** any.
210
236
  ```ruby
211
237
  # send assets
@@ -218,7 +244,7 @@ Creates a transaction for sending **multiple** asset from the open asset address
218
244
  params << OpenAssets::SendAssetParam.new('oGu4VXx2TU97d9LmPP8PMCkHckkcPqC5RY', 50, to)
219
245
  params << OpenAssets::SendAssetParam.new('oUygwarZqNGrjDvcZUpZdvEc7es6dcs1vs', 4, to)
220
246
  tx = api.send_assets(from, params)
221
-
247
+
222
248
  # send assets from multiple addresses.
223
249
  change_address = 'mwxeANpckdbdgZCpUMTceQhbbhLPJiqpfD'
224
250
  from = [
@@ -232,9 +258,9 @@ Creates a transaction for sending **multiple** asset from the open asset address
232
258
  tx = api.send_assets(change_address, params)
233
259
  ```
234
260
 
235
- * **send_bitcoins**
236
- Creates a transaction for sending **multiple** bitcoins from an address to others.
237
- This transaction inputs use only uncolored outputs.
261
+ * **send_bitcoins**
262
+ Creates a transaction for sending **multiple** bitcoins from an address to others.
263
+ This transaction inputs use only uncolored outputs.
238
264
  ```ruby
239
265
  # send bitcoins
240
266
  # api.send_bitcoins(<from btc address>, <The array of send bitcoin information(see OpenAssets::SendBitcoinParam).>, <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>, <mode=('broadcast', 'signed', 'unsigned')>, <output_qty default value is 1.>)
@@ -250,9 +276,9 @@ This transaction inputs use only uncolored outputs.
250
276
  ```
251
277
 
252
278
 
253
- * **burn_asset**
254
- Creates a transaction for burn asset.
255
- This API is to burn the asset by spending the all UTXO of specified asset as Bitcoin.
279
+ * **burn_asset**
280
+ Creates a transaction for burn asset.
281
+ This API is to burn the asset by spending the all UTXO of specified asset as Bitcoin.
256
282
  ```ruby
257
283
  # burn_asset
258
284
  # api.burn_asset(<from open asset address>, <asset ID>,, <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>, <mode=('broadcast', 'signed', 'unsigned')>, <output_qty default value is 1.>)
@@ -266,15 +292,15 @@ This API is to burn the asset by spending the all UTXO of specified asset as Bit
266
292
 
267
293
  ## Command line interface
268
294
 
269
- Openassets-ruby comes with a `openassets` command line interface that allows easy interaction with OpenAssets.
295
+ Openassets-ruby comes with a `openassets` command line interface that allows easy interaction with OpenAssets.
270
296
 
271
297
  ### Usage
272
298
 
273
299
  openassets [options] [command]
274
-
275
- Options:
300
+
301
+ Options:
276
302
  -c path to config JSON which is passed to OpenAssets::Api.new - see Configuration for details
277
- -e load conifg from ENV variables (look at the exe/openassets file for details)
303
+ -e load conifg from ENV variables (look at the exe/openassets file for details)
278
304
 
279
305
  commands:
280
306
  * console runs an IRB console and gives you an initialized Api instance to interact with OpenAssets
@@ -284,24 +310,4 @@ Openassets-ruby comes with a `openassets` command line interface that allows eas
284
310
 
285
311
  ## License
286
312
 
287
- The MIT License (MIT)
288
-
289
- Copyright (c) 2015 HAW International Inc.
290
-
291
- Permission is hereby granted, free of charge, to any person obtaining a copy
292
- of this software and associated documentation files (the "Software"), to deal
293
- in the Software without restriction, including without limitation the rights
294
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
295
- copies of the Software, and to permit persons to whom the Software is
296
- furnished to do so, subject to the following conditions:
297
-
298
- The above copyright notice and this permission notice shall be included in all
299
- copies or substantial portions of the Software.
300
-
301
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
302
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
303
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
304
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
305
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
306
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
307
- SOFTWARE.
313
+ openassets-ruby is licensed under the [MIT License](LICENSE).
@@ -362,6 +362,10 @@ module OpenAssets
362
362
  Bitcoin.network = :testnet3
363
363
  when 'regtest'
364
364
  Bitcoin.network = :regtest
365
+ when 'litecoin'
366
+ Bitcoin.network = :litecoin
367
+ when 'litecoin_testnet'
368
+ Bitcoin.network = :litecoin_testnet
365
369
  else
366
370
  Bitcoin.network = :bitcoin
367
371
  end
@@ -1,3 +1,3 @@
1
1
  module OpenAssets
2
- VERSION = '0.5.9'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openassets-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.9
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2017-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bitcoin-ruby
@@ -180,7 +180,6 @@ files:
180
180
  - CODE_OF_CONDUCT.md
181
181
  - Gemfile
182
182
  - LICENSE
183
- - LICENSE.txt
184
183
  - README.md
185
184
  - Rakefile
186
185
  - bin/console
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2015 azuchi
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.