rippler 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -1
- data/lib/rippler.rb +21 -0
- data/lib/rippler/account.rb +22 -4
- data/lib/rippler/contacts.rb +99 -3
- data/lib/rippler/line.rb +10 -0
- data/lib/rippler/version.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -34,7 +34,11 @@ Rippler also provides additional commands that print out human-readable output:
|
|
34
34
|
|
35
35
|
$ rippler history account:molecular
|
36
36
|
|
37
|
-
This one prints account history in a human-readable format.
|
37
|
+
This one prints any account history in a human-readable format.
|
38
|
+
|
39
|
+
$ rippler balances account:bitstamp
|
40
|
+
|
41
|
+
This one prints out all outstanding balances (debit/credit IOUs and XRP) for a specific account. For example, you can see who holds Bitstamp BTC and fiat IOUs, and how much.
|
38
42
|
|
39
43
|
$ rippler monitor streams:[ledger,transactions]
|
40
44
|
|
data/lib/rippler.rb
CHANGED
@@ -10,6 +10,7 @@ require 'rippler/money'
|
|
10
10
|
require 'rippler/account'
|
11
11
|
require 'rippler/ledger'
|
12
12
|
require 'rippler/transaction'
|
13
|
+
require 'rippler/line'
|
13
14
|
|
14
15
|
module Rippler
|
15
16
|
extend Rippler::Utils
|
@@ -108,6 +109,26 @@ module Rippler
|
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
112
|
+
# Retrieve non-trivial balances (IOUs and XRP) for a given Ripple account
|
113
|
+
def self.balances params
|
114
|
+
# Request IOU trust lines and balances
|
115
|
+
reply = request( {'command' => "account_lines",
|
116
|
+
'account' => DEFAULT_ACCT,
|
117
|
+
}.merge(params) )
|
118
|
+
lines = reply["result"]["lines"]
|
119
|
+
|
120
|
+
# Request account info (with XRP balance)
|
121
|
+
reply = request( {'command' => "account_info",
|
122
|
+
'account' => DEFAULT_ACCT,
|
123
|
+
}.merge(params) )
|
124
|
+
xrp_balance = Account(reply["result"]["account_data"]).balance
|
125
|
+
|
126
|
+
lines.map do |line|
|
127
|
+
line = Line.new(line)
|
128
|
+
line.to_s if line.balance.to_f.abs > 0.00001
|
129
|
+
end.compact.push("XRP balance: #{xrp_balance}")
|
130
|
+
end
|
131
|
+
|
111
132
|
# Retrieve account transactions history, print out nicely formatted transactions
|
112
133
|
def self.history params
|
113
134
|
reply = request( {'command' => "account_tx",
|
data/lib/rippler/account.rb
CHANGED
@@ -2,12 +2,30 @@ module Rippler
|
|
2
2
|
class Account
|
3
3
|
include Rippler::Utils
|
4
4
|
|
5
|
-
attr_accessor :address
|
5
|
+
attr_accessor :address, :balance, :flags
|
6
6
|
|
7
7
|
# String: "evoorhees" or "rpfxDFsjDNtzSBCALKuWoWMkpRp4vxvgrG"
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
# Hash:
|
9
|
+
# {"Account"=>"rUvpjNBcnt4DLKEVA2XyvJi1YGCfp2EPtk",
|
10
|
+
# "Balance"=>"199999990",
|
11
|
+
# "Flags"=>0,
|
12
|
+
# "LedgerEntryType"=>"AccountRoot",
|
13
|
+
# "OwnerCount"=>0,
|
14
|
+
# "PreviousTxnID"=>"14DBB4EBF6BE71439CE776446337A7E789EB4205D55F1731622DD225AF950BE2",
|
15
|
+
# "PreviousTxnLgrSeq"=>338219,
|
16
|
+
# "Sequence"=>2,
|
17
|
+
# "index"=>"71EE27781DE11E4D3E44052E1264C9F5E01F3F2BC0F5D9A890099914C5031C91"}
|
18
|
+
def initialize data
|
19
|
+
case data
|
20
|
+
when String
|
21
|
+
@address = Rippler::Contacts[data] || data
|
22
|
+
@name = Rippler::Addresses[@address]
|
23
|
+
when Hash
|
24
|
+
@address = data["Account"]
|
25
|
+
@name = Rippler::Addresses[@address]
|
26
|
+
@balance = Money(data["Balance"])
|
27
|
+
@flags = data["Flags"]
|
28
|
+
end
|
11
29
|
end
|
12
30
|
|
13
31
|
def name
|
data/lib/rippler/contacts.rb
CHANGED
@@ -4,12 +4,13 @@ module Rippler
|
|
4
4
|
OpenCoin rJR7gjNe3DpJ7kpB4CHBxjDKfwVMpTKPpj
|
5
5
|
OpenCoin.1 r3kmLJN5D28dHuH8vZNUZpMC43pEHpaocV
|
6
6
|
|
7
|
-
bitstamp rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B
|
8
|
-
bitstamp_hotwallet rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1
|
9
7
|
weex_btc rpvfJ4mR6QQAeogpXEKnuyGBx8mYCSnYZi
|
10
8
|
weex_aud rBcYpuDT1aXNo4jnqczWJTytKGdBGufsre
|
11
9
|
weex_cad r47RkFi1Ew3LvCNKT6ufw3ZCyj5AJiLHi9
|
12
10
|
weex_usd r9vbV3EHvXWjSkeQ6CAcYVPGeq7TuiXY2X
|
11
|
+
bitstamp rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B
|
12
|
+
bitstamp.hotwallet rrpNnNLKrartuEqfJGpqyDwPj1AFPg9vn1
|
13
|
+
bitstamp.NejcKodric rphasxS8Q5p5TLTpScQCBhh5HfJfPbM2M8
|
13
14
|
|
14
15
|
TTBit rGwUWgN5BEg3QGNY3RX2HfYowjUTZdid3E
|
15
16
|
BankOfZed ra88Lr8fyo9cUTuyjVFMTrvTSBU93erjyh
|
@@ -103,6 +104,14 @@ module Rippler
|
|
103
104
|
Jaques rLVMPwKBxungSYQgiN7HmTa9ndiXSbgzhV
|
104
105
|
Geraintjdotcom rNiS1vbeca2p7WxRwA1oS4WtnxXLB9MHsU
|
105
106
|
icey rDACCWyQyqfuvt9WxCWBZyqgBEMijLseZm
|
107
|
+
thatbluedude rLnCJbgbivWYavZXCdaJ7asHPP31RyXPdk
|
108
|
+
montana rUMub4tmRpNRfognEeTcwW5rEbXwrgZLwd
|
109
|
+
Cookie_Monster raww2VncvFyPvPCY8xnmb1AoqRxUWb6VdN
|
110
|
+
CarlosL rE9hpRfFFqWGxpGYA8bC6GkroRCr4mLLcq
|
111
|
+
greendave rPGpKXPSSxwvkpNXM5BtRRFWYjLP1ibH9D
|
112
|
+
Darkneo rfQdhMCnjWRP1fd1amNQwe49sMmXgR3uYq
|
113
|
+
veteranBtc rUvpjNBcnt4DLKEVA2XyvJi1YGCfp2EPtk
|
114
|
+
templeofshadows rJCCwPsVANVfEgQEB2bsEiaTF86cr9fdw4
|
106
115
|
|
107
116
|
molecular rpH3zuMch2GrrYX724xGWwbMGwiQ5RbSAU
|
108
117
|
Ente rNEtVs4kNeESF5HbWCDZMYcWwKZ5iKwUEr
|
@@ -145,6 +154,7 @@ module Rippler
|
|
145
154
|
Schleicher rGGxDC8VZ7zHmVKt6XK6sc7fUziNtvohWC
|
146
155
|
ripper234 rhQ7mQ1JJKygoxh7SoCaKNZB4GufdCRiH3
|
147
156
|
alexkravets rKQLJpoBagwGiE7LVcY8YfDfE6EUREJjeq
|
157
|
+
alexkravets.1 rnLkaEfjiiyLKkKwUrjYxWNuysB2z7ja2Z
|
148
158
|
comboy rLHMoLsuLhg1Q741bHNjv7jhMqr6karoG7
|
149
159
|
djbaniel rNnLFDCRrAtuESodmwamAasMBZqCmkqQH9
|
150
160
|
wyodude rwJBiKfYKRFX59GykztmGdedUvmV64LpaK
|
@@ -375,6 +385,56 @@ module Rippler
|
|
375
385
|
drawingthesun rBpSXnvCUkG6cAtk1KxaRKvM7wPcrJot5s
|
376
386
|
_bh rPtfQWdcdhuL9eNeNv5YfmekSX3K7vJHbG
|
377
387
|
mazi rhdAw3LiEfWWmSrbnZG3udsN7PoWKT56Qo
|
388
|
+
imanikin rEQLRKCwfHX6CJ9BnqBZmzwCVxMs3yNjGq
|
389
|
+
AmitabhS rUy6q3TxE4iuVWMpzycrQfD5uZok51g1cq
|
390
|
+
jed rHTxKLzRbniScyQFGMb3NodmxA848W8dKM
|
391
|
+
wiggi rnfP45Y8G24MaD3Atr2Gt1rYMJFRKbLrpu
|
392
|
+
brunozisterer rDrZuE8YjYnU7C1s4nm1u3VmNjEyxacVHU
|
393
|
+
walruscode rwmg65FXDmAZpBVBuhW6XRJTUuc33jwQgN
|
394
|
+
DannyM rnziParaNb8nsU4aruQdwYE3j5jUcqjzFm
|
395
|
+
magnebit rQrUJLNcjnaZJjqMjaiPHxGa7eipzyf7b
|
396
|
+
coinft rngJ9Co6MPZxJcyepRv2hMPV1HqaeGCdVU
|
397
|
+
w1R903.oushri rUNgGdWJDyyK4MeKzZdUvDZCBM528tXNb1
|
398
|
+
coderrr rfMPPvVmb3T3SMaVxsGYDHjbyac66aRN21
|
399
|
+
freeworm rnC6kokbPHcBAxcrVUjUmJdTAXVkyBWU4v
|
400
|
+
redmallorca r3eWvbX3UxtbqdQ6qFVeUnF7aMYBnea7zz
|
401
|
+
Face rJXpVEfEbiBkxFCLB1SdQCU7HQcpmVjU1U
|
402
|
+
osmosis r2oU84CFuT4MgmrDejBaoyHNvovpMSPiA
|
403
|
+
bpd rLCvFaWk9WkJCCyg9Byvwbe9gxn1pnMLWL
|
404
|
+
pof rhcZbS2CAVZ9jTE4WGujuztwJAgztGCLRH
|
405
|
+
theomar rK3mQg14stixU8yZzeKkvPXsi4btfX11BY
|
406
|
+
Carandiru rXJDPhk2tNumsqAnNkWQ79YpQeREaSriK
|
407
|
+
BitcoinForLiberty rUhRc8wx912YH617j8egv7nLcwNX5G8ry1
|
408
|
+
phantastisch rDmU6omZ7RWqcp1m5GNXY2BdRibFC5rGHF
|
409
|
+
bigbox rEFko7T56fAkp2az6pXxkpfqqbCSAjcosW
|
410
|
+
katp rG2bkX4MV5kMdNkKzzrgVEjeudAz2b3dgY
|
411
|
+
m0mchil rDNa6N2YsP9SGNoJdbNj1McViMDyxkdqsB
|
412
|
+
cabin rPUZ2yrr94nXbamcoaZ9U9ABMo8VMXxRwt
|
413
|
+
arrowdebreu rE2f4i2j8ooUBUKM6jZmwmkjLigwsy5yvP
|
414
|
+
prophecynine r9WcJzZE7SegMX2Eoczx6bjQ5kACGbA5BY
|
415
|
+
honolululu r4mxrHNPjCqRufGUhD28SAJ4DHD363m8ZJ
|
416
|
+
btcash rPHzZKcjGHss9MMmt6nQiARbKZBNpJesr4
|
417
|
+
kingmidas r4xF86D31qByMFKwg2WTpQ9aD7E15Gxqmy
|
418
|
+
vhaasteren rJ76yEA3MjG6foR7Np2gCxkSSe6cRy5fsH
|
419
|
+
OneMiner rPXh6UrSBuLzzqKksZchqM4nC67EhfNnAW
|
420
|
+
phasor rnFqZzWEi5mEaM7Sra1ZSbAJuYPFYi5Ung
|
421
|
+
nave rPkWfq4WTRey3vuRtXPwEwN9PBF3qEPWDt
|
422
|
+
SuperTramp rEaYSdRcqphHGGcpcnjyCefJKiDnevaZT4
|
423
|
+
4461462665 rnghnHTtDmdKBunkiYn3LH3jKg7bpQ4KmX
|
424
|
+
gwillen r3hQEumtyv77Zp1Brw8fWuaVVSK7etMVEe
|
425
|
+
conroe64 rKQ2Db6JmHF6PBoy7u9uBpn7geQDA4pQrM
|
426
|
+
GlobalBTC rwjL7pxE8MxgGRG2idm7pySBnowrQ7QL84
|
427
|
+
sputnik rp9rFPvgYSqKVC3Aibz8r8chHoHW5hfV3S
|
428
|
+
db rDALX7uHNUxPmfySY4ENdMiQ9uim12uBpg
|
429
|
+
bitcoins5411 rEVbH32GDhDrPPF6bZUXLeBc8sgsUpCsJY
|
430
|
+
CyanSlowly rBMJup7diEYhHgAXKZATGmVxzEEqYyWumZ
|
431
|
+
rube7x rsbzdffvgZo3HJFnxJCdF52zTDoFNE8KMf
|
432
|
+
fancy_pants rGrVrXUL11cfbB2A4XdVHeVtcEmHmTZQ23
|
433
|
+
OJsimpson rhBKQBvsyDnSnLgU5D1DcbNKq34To6G2Mr
|
434
|
+
overrisk99 rfMwkq3bxP3ZQcDzFHQspFZWvKQEaMvQL6
|
435
|
+
Nevermore123 rDYdoGbQLCch5xSfbZTYnh1ctjTFBNA65h
|
436
|
+
miguel rKSNsGJSQWy2pQcWc8tP5e4n8umCqyj5FY
|
437
|
+
ssbtoday rPuCSJKRBX5iU7gKo6RyxSBUpmSJ3VFmhz
|
378
438
|
|
379
439
|
X.FortKnox.1 rhWnKQ79moM7wkk2b9RpufDzhbHw7YLc6d
|
380
440
|
X.FortKnox.2 r9PbKbYisKN1DSwaZ7jp6ZsKmfk1yCFAAi
|
@@ -410,7 +470,43 @@ module Rippler
|
|
410
470
|
X.12 rwCYkXihZPm7dWuPCXoS3WXap7vbnZ8uzB
|
411
471
|
X.13 rwHpLXGBMxUUqenPBaPugBfoVtgQy19nRE
|
412
472
|
X.14 rpMwfz4c8FRxjqQhxLxbKzqkXdgkenFg8B
|
413
|
-
|
473
|
+
X.15 rEWDpTUVU9fZZtzrywAUE6D6UcFzu6hFdE
|
474
|
+
X.16 rUGNvasUuxLiPL5RXvfZXW8HjBtSHZgqgz
|
475
|
+
X.17 rPyuHFYDwYMGJ5xhMbzfYeikx7ARV3ExvF
|
476
|
+
X.18 r4MZrGMPEHfxGNQHR92BJo5hU9BiqMsTej
|
477
|
+
X.19 rnT9PFSfAnWyj2fd7D5TCoCyCYbK4n356A
|
478
|
+
X.20 rnW7DHtmZGJk4uhGTSU2BW3iPCPWb2xegg
|
479
|
+
X.21 rUrdFHbrEKWNQQ444zcTLrThjcnHCw2FPu
|
480
|
+
X.22 r49nVgaYSDuU7GEQh4mF1nyjsXSVRcUHsr
|
481
|
+
X.23 rf8kg7r5Fc8cCszGdD2jeUZt2FrgQd76BS
|
482
|
+
X.24 r9aRw8p1jHtR9XhDAE22TjtM7PdupNXhkx
|
483
|
+
X.25 rwdLV79WzXmFuzP2cBwTG6mtXcfSnCjtoF
|
484
|
+
X.26 r3ZXkbKVkCcwtSRbX5Rqz9VveyZDuXSs5G
|
485
|
+
X.27 rakv2tqjdLLuPu5g5j4F5JW21Q4LNLc6Vn
|
486
|
+
X.28 rnwRcxX4JpHnPjTJpaDH8YZzRPTphvsHbE
|
487
|
+
X.29 rKWFsTLRPrgC8KDC7fCqQRzDsvajgcM1Tp
|
488
|
+
X.30 r4mscDrVMQz2on2px31aV5e5ouHeRPn8oy
|
489
|
+
X.31 rHnxRmkRdL4NsAoxqN1xwKDuW49uosM3HL
|
490
|
+
X.32 r3o9bK8Re9XZpFwZC6jXGwKBuhoLss9Mhc
|
491
|
+
X.33 rKuuVUKA14roSPTuquQTo7nmWZN8EsfxpT
|
492
|
+
X.34 r9dshc2F8SqBdqXSmQHjsSoPN42PLB37ud
|
493
|
+
X.35 rnxnLRYWt6yiHC413MWwUeXJ4AZpQKShUg
|
494
|
+
X.36 rNJRm1VQZZuczrVHjgUSB9Y6kpMopLdADo
|
495
|
+
X.37 r3iLZXAAmuRQnt4hYQUcoXiSkrSAmHjcKW
|
496
|
+
X.38 raXgrRqLeDFRjFbXXJd3vQgjymoLkbzic5
|
497
|
+
X.39 r9VUjVRKEFyBNmFRKPCjHbjYUv8QvJ5xyu
|
498
|
+
X.40 rs5Kyt6CoYsYx5E6HVpcKGQjVa6trzrBa4
|
499
|
+
X.41 r9LVrQDxq9R4mSN2XezNDAXbAeUtRwBrvu
|
500
|
+
X.42 rMPNPj8nwiKsBNTRRMGtgRnAdXK17Wvuep
|
501
|
+
X.43 rh9uD31E8B3nWbPCGNVNkTE1QzA2486Yom
|
502
|
+
X.44 rHrck4S1n9kmyWyFPJHAegLKtRFNmwC2ic
|
503
|
+
X.45 rjcDqW25DCTpAUnKi9T8aiMe32vEy8JHt
|
504
|
+
X.46 rh5PSrnbYZ31ZVRWNgcEZDNhTmV61rshVK
|
505
|
+
X.47 rhBKQBvsyDnSnLgU5D1DcbNKq34To6G2Mr
|
506
|
+
X.48 r3RVftuvnhuWyTykK2R2XaD6vepwyfnCYs
|
507
|
+
X.49 rLDwkvrMVbbJ9WLaXpNaPM9k9AinJwNPSg
|
508
|
+
X.50 rhMb2LRHvyouHMF9WoWMJ29mdDTUgEdiA5
|
509
|
+
]] # X.*** signifies anonymous account that is active in Ripple
|
414
510
|
|
415
511
|
Addresses = Contacts.invert
|
416
512
|
end
|
data/lib/rippler/line.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
module Rippler
|
2
|
+
# Line is a relationship between 2 Ripple accounts. It may have limit and balance.
|
3
|
+
class Line < OpenStruct
|
4
|
+
include Rippler::Utils
|
5
|
+
|
6
|
+
def to_s
|
7
|
+
"Account: #{Account(account)} balance: #{balance}/#{currency}, limits: #{limit_peer}/#{limit}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/lib/rippler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rippler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faye-websocket
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- lib/rippler/account.rb
|
47
47
|
- lib/rippler/contacts.rb
|
48
48
|
- lib/rippler/ledger.rb
|
49
|
+
- lib/rippler/line.rb
|
49
50
|
- lib/rippler/money.rb
|
50
51
|
- lib/rippler/transaction.rb
|
51
52
|
- lib/rippler/utils.rb
|