openassets-ruby 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -7
- data/lib/openassets.rb +1 -0
- data/lib/openassets/provider/bitcoin_core_provider.rb +6 -5
- data/lib/openassets/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70daead9de133f379e6162517a1b105acf4b43f1
|
4
|
+
data.tar.gz: d0ba9164705acde3f5f902ae33e8dae5bf7f2599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c60706a248230f365bdf5852d648843ad596daf5c66eb30f80e6ccb073259b9b192897041bd518e5e8f1dcfcca1318aedc068da1b3d466dd26dc8248ec70af8
|
7
|
+
data.tar.gz: 72f689fdd523bfb4421cf8e6ce90e3f8180e9344e4162fe6a2ca7e56efe1c8026085a6acb6fe5d557a2d4f77568099868df9aba8b3c90c0172fd4dc12ccaa563
|
data/README.md
CHANGED
@@ -170,7 +170,13 @@ Returns the balance in both bitcoin and colored coin assets for all of the addre
|
|
170
170
|
Creates a transaction for issuing an asset.
|
171
171
|
```ruby
|
172
172
|
# issue asset
|
173
|
-
# api.issue_asset(<issuer open asset address>,
|
173
|
+
# api.issue_asset(<issuer open asset address>,
|
174
|
+
# <issuing asset quantity>,
|
175
|
+
# <metadata>,
|
176
|
+
# <to open asset address>,
|
177
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
178
|
+
# <mode=('broadcast', 'signed', 'unsigned')>,
|
179
|
+
# <output_qty default value is 1.>)
|
174
180
|
|
175
181
|
# example
|
176
182
|
address = 'akEJwzkzEFau4t2wjbXoMs7MwtZkB8xixmH'
|
@@ -183,7 +189,13 @@ Ex, amount = 125 and output_qty = 2, the marker output asset quantity is [62, 63
|
|
183
189
|
Creates a transaction for sending an asset from the open asset address to another.
|
184
190
|
```ruby
|
185
191
|
# send asset
|
186
|
-
# api.send_asset(<from open asset address>,
|
192
|
+
# api.send_asset(<from open asset address>,
|
193
|
+
# <asset ID>,
|
194
|
+
# <asset quantity>,
|
195
|
+
# <to open asset address>,
|
196
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
197
|
+
# <mode=('broadcast', 'signed', 'unsigned')>,
|
198
|
+
# <output_qty default value is 1.>)
|
187
199
|
|
188
200
|
# example
|
189
201
|
from = 'akXDPMMHHBrUrd1fM756M1GSB8viVAwMyBk'
|
@@ -198,7 +210,12 @@ Creates a transaction for sending bitcoins from an address to another.
|
|
198
210
|
This transaction inputs use only uncolored outputs.
|
199
211
|
```ruby
|
200
212
|
# send bitcoin
|
201
|
-
# api.send_bitcoin(<from btc address>,
|
213
|
+
# api.send_bitcoin(<from btc address>,
|
214
|
+
# <amount (satoshi)>,
|
215
|
+
# <to btc address>,
|
216
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
217
|
+
# <mode=('broadcast', 'signed', 'unsigned')>,
|
218
|
+
# <output_qty default value is 1.>)
|
202
219
|
|
203
220
|
# example
|
204
221
|
from = '14M4kbAtn71P1nnNYuhBDFTNYxa19t1XP6'
|
@@ -235,7 +252,11 @@ Creates a transaction for sending **multiple** asset from the open asset address
|
|
235
252
|
`<from open asset address>` is used to send bitcoins **if** needed, and receive bitcoin change **if** any.
|
236
253
|
```ruby
|
237
254
|
# send assets
|
238
|
-
# api.send_assets(<from open asset address>,
|
255
|
+
# api.send_assets(<from open asset address>,
|
256
|
+
# <The array of send Asset information(see OpenAssets::SendAssetParam).>,
|
257
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
258
|
+
# <mode=('broadcast', 'signed', 'unsigned')>,
|
259
|
+
# <output_qty default value is 1.>)
|
239
260
|
|
240
261
|
# example
|
241
262
|
from = api.address_to_oa_address('mrxpeizRrF8ymNx5FrvcGGZVecZjtUFVP3')
|
@@ -263,7 +284,11 @@ Creates a transaction for sending **multiple** bitcoins from an address to other
|
|
263
284
|
This transaction inputs use only uncolored outputs.
|
264
285
|
```ruby
|
265
286
|
# send bitcoins
|
266
|
-
# api.send_bitcoins(<from btc address>,
|
287
|
+
# api.send_bitcoins(<from btc address>,
|
288
|
+
# <The array of send bitcoin information(see OpenAssets::SendBitcoinParam).>,
|
289
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
290
|
+
# <mode=('broadcast', 'signed', 'unsigned')>,
|
291
|
+
# <output_qty default value is 1.>)
|
267
292
|
|
268
293
|
# example
|
269
294
|
from = 'mrxpeizRrF8ymNx5FrvcGGZVecZjtUFVP3'
|
@@ -281,12 +306,15 @@ Creates a transaction for burn asset.
|
|
281
306
|
This API is to burn the asset by spending the all UTXO of specified asset as Bitcoin.
|
282
307
|
```ruby
|
283
308
|
# burn_asset
|
284
|
-
# api.burn_asset(<from open asset address>,
|
309
|
+
# api.burn_asset(<from open asset address>,
|
310
|
+
# <asset ID>,
|
311
|
+
# <fees (The fess in satoshis for the transaction. use 10000 satoshi if specified nil)>,
|
312
|
+
# <mode=('broadcast', 'signed', 'unsigned')>
|
285
313
|
|
286
314
|
# example
|
287
315
|
oa_address = 'bX2vhttomKj2fdd7SJV2nv8U4zDjusE5Y4B'
|
288
316
|
asset_id = 'oGu4VXx2TU97d9LmPP8PMCkHckkcPqC5RY'
|
289
|
-
tx = api.burn_asset(oa_address, asset_id
|
317
|
+
tx = api.burn_asset(oa_address, asset_id)
|
290
318
|
```
|
291
319
|
**Note:** Burned asset will not be able to again get.
|
292
320
|
|
data/lib/openassets.rb
CHANGED
@@ -7,20 +7,20 @@ module OpenAssets
|
|
7
7
|
class BitcoinCoreProvider < BlockChainProviderBase
|
8
8
|
|
9
9
|
RPC_API = [
|
10
|
-
:addmultisigaddress, :addnode, :backupwallet, :createmultisig, :createrawtransaction, :decoderawtransaction,
|
11
|
-
:decodescript, :dumpprivkey, :dumpwallet, :encryptwallet, :estimatefee, :estimatepriority, :generate,
|
10
|
+
:addmultisigaddress, :addnode, :backupwallet, :bumpfee, :createmultisig, :createrawtransaction, :decoderawtransaction,
|
11
|
+
:decodescript, :dumpprivkey, :dumpwallet, :encryptwallet, :estimatefee, :estimatepriority, :generate, :generatetoaddress,
|
12
12
|
:getaccountaddress, :getaccount, :getaddednodeinfo, :getaddressesbyaccount, :getbalance, :getbestblockhash,
|
13
13
|
:getblock, :getblockchaininfo, :getblockcount, :getblockhash, :getblockheader, :getchaintips, :getconnectioncount, :getdifficulty,
|
14
14
|
:getmempoolancestors, :getmempooldescendants, :getmempoolentry, :clearbanned, :disconnectnode,
|
15
15
|
:getgenerate, :gethashespersec, :getinfo, :getmempoolinfo, :getmininginfo, :getnettotals, :getnetworkhashps,
|
16
16
|
:getnetworkinfo, :getnewaddress, :getpeerinfo, :getrawchangeaddress, :getrawmempool, :getrawtransaction,
|
17
|
-
:getreceivedbyaccount, :getreceivedbyaddress, :gettransaction, :gettxout, :gettxoutproof, :gettxoutsetinfo,
|
18
|
-
:getunconfirmedbalance, :getwalletinfo, :getwork, :help, :importaddress, :importprivkey, :importwallet, :importpubkey,
|
17
|
+
:getreceivedbyaccount, :getreceivedbyaddress, :gettransaction, :gettxout, :gettxoutproof, :gettxoutsetinfo, :preciousblock, :pruneblockchain,
|
18
|
+
:getunconfirmedbalance, :getwalletinfo, :importmulti, :getwork, :help, :importaddress, :importprivkey, :importwallet, :importpubkey,
|
19
19
|
:keypoolrefill, :listaccounts, :listaddressgroupings, :listlockunspent, :listreceivedbyaccount, :listreceivedbyaddress,
|
20
20
|
:listsinceblock, :listtransactions, :listunspent, :lockunspent, :move, :ping, :prioritisetransaction, :sendfrom,
|
21
21
|
:sendmany, :sendrawtransaction, :sendtoaddress, :setaccount, :setgenerate, :settxfee, :signmessage, :signrawtransaction,
|
22
22
|
:stop, :submitblock, :validateaddress, :verifychain, :verifymessage, :verifytxoutproof, :walletlock, :walletpassphrase,
|
23
|
-
:walletpassphrasechange, :listbanned, :setban, :fundrawtransaction, :estimatesmartfee, :estimatesmartpriority,
|
23
|
+
:walletpassphrasechange, :listbanned, :setban, :setnetworkactive, :fundrawtransaction, :estimatesmartfee, :estimatesmartpriority,
|
24
24
|
:signmessagewithprivkey, :abandontransaction, :addwitnessaddress, :importprunedfunds, :importpubkey, :removeprunedfunds
|
25
25
|
]
|
26
26
|
|
@@ -114,6 +114,7 @@ module OpenAssets
|
|
114
114
|
:id => 'jsonrpc'
|
115
115
|
}
|
116
116
|
post(server_url, @config[:timeout], @config[:open_timeout], data.to_json, content_type: :json) do |respdata, request, result|
|
117
|
+
raise ApiError, result.message unless result.kind_of?(Net::HTTPSuccess)
|
117
118
|
response = JSON.parse(respdata.gsub(/\\u([\da-fA-F]{4})/) { [$1].pack('H*').unpack('n*').pack('U*').encode('ISO-8859-1').force_encoding('UTF-8') })
|
118
119
|
raise ApiError, response['error'] if response['error']
|
119
120
|
response['result']
|
data/lib/openassets/version.rb
CHANGED
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.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- azuchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bitcoin-ruby
|
@@ -245,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
version: '0'
|
246
246
|
requirements: []
|
247
247
|
rubyforge_project:
|
248
|
-
rubygems_version: 2.
|
248
|
+
rubygems_version: 2.6.11
|
249
249
|
signing_key:
|
250
250
|
specification_version: 4
|
251
251
|
summary: The implementation of the Open Assets Protocol for Ruby.
|