monero 0.0.0.8 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +13 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.txt +21 -0
- data/README.md +127 -100
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/monero.rb +37 -13
- data/lib/monero_rpc/client.rb +49 -0
- data/lib/monero_rpc/config.rb +13 -0
- data/lib/{rpc → monero_rpc}/payment.rb +1 -3
- data/lib/{rpc → monero_rpc}/transfer.rb +19 -24
- data/lib/monero_rpc/transfer_class.rb +30 -0
- data/lib/monero_rpc/version.rb +3 -0
- data/lib/monero_rpc/wallet.rb +157 -0
- data/monero.gemspec +3 -3
- data/spec/monero_spec.rb +109 -0
- data/spec/spec_helper.rb +20 -0
- metadata +29 -18
- data/lib/rpc/client.rb +0 -40
- data/lib/rpc/config.rb +0 -8
- data/lib/rpc/incoming_transfer.rb +0 -26
- data/lib/rpc/version.rb +0 -3
- data/lib/rpc/wallet.rb +0 -148
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9e8cc4121eff928d8b1c72f84f3af18dcc5d8cceab58fd8472fbb9a038c79a6
|
4
|
+
data.tar.gz: d70534fb325c85d99a7ad217209b04584aa6d2bfe31854a88dcbf0285f835d68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f1c396f5d309f9b132caec7b0eed269714041f5a373ab679a1b5b32cf1e7bf3d999646bb0a53a47cf3e5c1f334bc52255808c1d236bfd32dbc68b4f461264d6
|
7
|
+
data.tar.gz: 8ab32be640a75e40929f508e7e3ec4bd59b071a74f6d8ec5f2088417c1393f1c09f617771df9243c185d69b91480148d56ff384a224e5da47740a44b1e8c42df
|
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
monero (0.0.0.11)
|
5
|
+
money
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
concurrent-ruby (1.1.5)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
i18n (1.6.0)
|
13
|
+
concurrent-ruby (~> 1.0)
|
14
|
+
money (6.13.4)
|
15
|
+
i18n (>= 0.6.4, <= 2)
|
16
|
+
rake (12.3.1)
|
17
|
+
rspec (3.8.0)
|
18
|
+
rspec-core (~> 3.8.0)
|
19
|
+
rspec-expectations (~> 3.8.0)
|
20
|
+
rspec-mocks (~> 3.8.0)
|
21
|
+
rspec-core (3.8.0)
|
22
|
+
rspec-support (~> 3.8.0)
|
23
|
+
rspec-expectations (3.8.2)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.8.0)
|
26
|
+
rspec-mocks (3.8.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-support (3.8.0)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
bundler
|
36
|
+
monero!
|
37
|
+
rake
|
38
|
+
rspec (~> 3.0)
|
39
|
+
|
40
|
+
BUNDLED WITH
|
41
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Tim Kretschmer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,179 +1,206 @@
|
|
1
|
-
*Heavy development. Tested against 0.12.0 without issues. Please contribute. If you want to send Testnet transactions, please always send them back to https://dis.gratis*
|
2
|
-
|
3
1
|
# Monero Ruby Client
|
4
2
|
|
5
3
|
Ruby client to connect and use [Monero Wallet RPC](https://getmonero.org/resources/developer-guides/wallet-rpc.html).
|
6
4
|
|
5
|
+
*Tested against [0.14.1.2 Boron Butterfly](https://web.getmonero.org/downloads/) without issues. Please contribute. If you want to send testnet transactions, please always send them back to https://dis.gratis or any other faucet*
|
7
6
|
|
8
|
-
|
7
|
+
---
|
9
8
|
#### Disclaimer - before you start - *important notice!*
|
10
|
-
To try out please make sure that you run your **monerod** and your **monero-wallet-rpc** with the `--testnet` option. Always use the
|
9
|
+
To try out please make sure that you run your **monerod** and your **monero-wallet-rpc** with the `--stagenet` or `--testnet` option. Always use the stagenet or testnet to play around. Be careful with your wallet, you might lose coins if you try out on the real chain.
|
11
10
|
|
11
|
+
- Stagenet Faucet: https://community.xmr.to/faucet/stagenet/
|
12
12
|
- Testnet Faucet: https://dis.gratis/
|
13
13
|
- Testnet Blockexplorer: https://testnet.xmrchain.com
|
14
|
+
- in case the faucets are offline or empty just ask on reddit or in IRC #monero, #monero-dev or #monero-pools
|
14
15
|
---
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
17
|
## Installation
|
20
18
|
For easy installation add `gem 'monero'` to your Gemfile or run `gem install monero`
|
21
19
|
|
22
|
-
|
23
20
|
## Preparation
|
21
|
+
Start your daemon `./monerod --testnet` or `./monerod --stagenet`
|
24
22
|
|
25
|
-
Start your
|
23
|
+
Start your RPC Client `./monero-wallet-rpc --testnet --rpc-bind-port 28081 --rpc-bind-ip 127.0.0.1 --rpc-login username:password --log-level 4`
|
26
24
|
|
27
|
-
Start your RPC Client `./monero-wallet-rpc --testnet --rpc-bind-port 18081 --rpc-bind-ip 127.0.0.1 --rpc-login username:password --log-level 4`
|
28
25
|
|
29
26
|
- To open a wallet at start use `--wallet-file filename` and `--password pass`
|
30
27
|
- In case you need to access the client from another machine, you need to set `--confirm-external-bind`.
|
31
28
|
- To be able to create/open other wallets you need to specify `--wallet-file /path/to/wallets/on/your/machine`
|
32
|
-
- if you don't specify `--rpc-login` a file will be created that stores the login data (`cat monero-wallet-rpc.
|
29
|
+
- if you don't specify `--rpc-login` a file will be created that stores the login data (`cat monero-wallet-rpc.28081.login`)
|
30
|
+
|
31
|
+
You can also use
|
32
|
+
[monerod-rpc-docker](https://github.com/xaviablaza/monerod-rpc-docker) by
|
33
|
+
xaviablaza to run monerod and the RPC client.
|
33
34
|
|
34
35
|
## Getting started
|
35
36
|
|
36
37
|
### Configuration
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
You can predefine all variables via configuration. You don't need to do this.
|
39
|
+
```ruby
|
40
|
+
|
41
|
+
MoneroRPC.config.host = "127.0.0.1"
|
42
|
+
MoneroRPC.config.port = "18081"
|
43
|
+
MoneroRPC.config.username = "username"
|
44
|
+
MoneroRPC.config.password = "password"
|
45
|
+
MoneroRPC.config.debug = true
|
46
|
+
# If you call for transfers you already receive objects MoneroRPC::IncomingTransfer and MoneroRPC::OutgoingTransfer. However, you can use your own classes.
|
47
|
+
# MoneroRPC.config.in_transfer_clazz = "MyOwnClassForIncomingTransfers"
|
48
|
+
# MoneroRPC.config.out_transfer_clazz = "OutgoinMoneroTransfer"
|
49
|
+
```
|
43
50
|
|
44
51
|
### Usage
|
45
52
|
|
46
53
|
Monero Ruby Client is very easy to use. Full documentation of RPC Client: https://getmonero.org/resources/developer-guides/wallet-rpc.html#transfer
|
47
54
|
|
48
|
-
|
49
|
-
|
55
|
+
just crate a new instance
|
56
|
+
`$monero_rpc = MoneroRPC.new(host: "192.168.0.202", port: "28081", username: "username", password: "password")`
|
50
57
|
|
58
|
+
---
|
51
59
|
Get the current address
|
60
|
+
```ruby
|
61
|
+
$monero_rpc.address
|
62
|
+
=> "9wm6oNA5nP3LnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9HjTDpKXAE"
|
63
|
+
```
|
52
64
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
RPC::Wallet.create_address "family savings"
|
61
|
-
=> {"address"=>"BZFWM5MrhK64DD5TH1JVxR4JbuQpmRSFKi4SHQD2TrSrDFU8AK16YSjN7K8WSfjAfnZeJeskBtkgr73LbPZc4vMbQr3YvHj", "address_index"=>1}
|
62
|
-
|
63
|
-
___
|
65
|
+
---
|
66
|
+
Create a new subaddress with a label (label is optional)
|
67
|
+
```ruby
|
68
|
+
$monero_rpc.create_address "family savings"
|
69
|
+
=> {"address"=>"BZFWM5MrhK64DD5TH1JVxR4JbuQpmRSFKi4SHQD2TrSrDFU8AK16YSjN7K8WSfjAfnZeJeskBtkgr73LbPZc4vMbQr3YvHj", "address_index"=>1}
|
70
|
+
```
|
64
71
|
|
72
|
+
---
|
65
73
|
Create a new address for a payment (integrated address)
|
74
|
+
```ruby
|
75
|
+
$monero_rpc.make_integrated_address
|
76
|
+
=> {"integrated_address"=>"A7TmpAyaPeZLnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9HjfufSYUchQ8hH2R272H",
|
77
|
+
"payment_id"=>"9d985c985ce58a8e"}
|
78
|
+
```
|
66
79
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
Get a list of all Adresses of your wallet
|
73
|
-
|
74
|
-
RPC::Wallet.get_addresses
|
75
|
-
|
76
|
-
___
|
77
|
-
|
80
|
+
---
|
81
|
+
Get a list of all addresses of your wallet
|
82
|
+
```ruby
|
83
|
+
$monero_rpc.get_addresses
|
84
|
+
```
|
78
85
|
|
86
|
+
---
|
79
87
|
To get the balance of the current wallet (we use the gem 'money')
|
88
|
+
```ruby
|
89
|
+
$monero_rpc.balance
|
90
|
+
# returns an ::XMR object which is just a shortcut for ::Money(amount, :xmr)
|
91
|
+
=> <Money fractional:9980629640000 currency:XMR>
|
80
92
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
RPC::Wallet.balance.format
|
86
|
-
=> "9.980629640000 XMR"
|
93
|
+
$monero_rpc.balance.format
|
94
|
+
=> "9.980629640000 XMR"
|
95
|
+
```
|
87
96
|
|
88
97
|
To get the unlocked balance, which is currently available
|
89
|
-
|
90
|
-
|
91
|
-
|
98
|
+
```ruby
|
99
|
+
$monero_rpc.unlocked_balance
|
100
|
+
=> <Money fractional:10000 currency:XMR>
|
101
|
+
```
|
92
102
|
|
93
103
|
To get both combined
|
104
|
+
```ruby
|
105
|
+
$monero_rpc.getbalance
|
106
|
+
=> {"balance"=>9961213880000, "unlocked_balance"=>10000}
|
107
|
+
```
|
94
108
|
|
95
|
-
|
96
|
-
=> {"balance"=>9961213880000, "unlocked_balance"=>10000}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
___
|
109
|
+
---
|
101
110
|
To get the current block height
|
111
|
+
```ruby
|
112
|
+
$monero_rpc.getheight
|
113
|
+
=> 1008032
|
114
|
+
```
|
102
115
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
___
|
108
|
-
|
109
|
-
Send XMR to an address via `RPC::Transfer.create`. If successfull you will get the transaction details. If not succesfull you'll get returned nil.
|
116
|
+
---
|
117
|
+
Send XMR to an address via `$monero_rpc.create_transfer`. If successful you will get the transaction details. If not successful you'll get returned nil.
|
110
118
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
119
|
+
```ruby
|
120
|
+
amount= 20075 # in atomic units; 1000000000000 == 1.0 XMR
|
121
|
+
$monero_rpc.create_transfer("A7TmpAyaPeZLnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9HjfwGRvbCHYCZAaKSzDx", amount)
|
122
|
+
=> {"fee"=>19415760000,
|
123
|
+
"tx_blob"=>"020001020005bbcf0896e3.......
|
124
|
+
```
|
115
125
|
|
126
|
+
The return hash consists of:
|
127
|
+
```
|
128
|
+
{amount, fee, multisig_txset, tx_blog, tx_hash, tx_key, tx_metadata,
|
129
|
+
unsigned_txset}
|
130
|
+
```
|
116
131
|
|
117
132
|
To send payments you can also specify the following options:
|
118
133
|
|
119
|
-
|
120
|
-
|
134
|
+
```ruby
|
135
|
+
options = { fee: fee, mixin: 5, unlock_time: unlock_time, payment_id: "c7e7146b3335aa54", get_tx_key: true, priority: 0, do_not_relay: false, get_tx_hex: true}
|
136
|
+
```
|
121
137
|
|
138
|
+
Please note that `fee` is currently ignored by the chain.
|
122
139
|
|
123
140
|
To send payments to multiple recipients simply use an array of `[:recipient, :amount]`. For example:
|
124
141
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
RPC::Transfer.send_bulk(recipients, options)
|
132
|
-
|
133
|
-
___
|
142
|
+
```ruby
|
143
|
+
recipients = [
|
144
|
+
{address:"A7TmpAyaPeZLnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9HjfwGRvbCHYCZAaKSzDx" amount: 1599999},
|
145
|
+
{address:"A7TmpAyaPeZLnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9Hjftr1RgJ6RM4BMMPLUc" amount: 130000},
|
146
|
+
{address:"A7TmpAyaPeZLnugTKRSwGJhW4vnYv8RAVdRvYyvbistbHUnojyTHyHcYpbZvbTZHDsi4rF1EK5TiYgnCN6FWM9HjfrgPgAEasYGSVhUdwe" amount: 442130000}
|
147
|
+
]
|
134
148
|
|
149
|
+
$monero_rpc.send_bulk_transfer(recipients, options)
|
150
|
+
```
|
135
151
|
|
152
|
+
---
|
136
153
|
To get a list of transfers you call `get_transfers(args)`. Options are `in (true)`, `out (false)`, `pending (true)`, `failed (false)`, `pool (true)`, `filter_by_height (false)`, `min_height` and `max_height`
|
137
154
|
|
138
|
-
|
155
|
+
---
|
156
|
+
To get all incoming transfers use `get_all_incoming_transfers(args)`. Args can be `min_height` and `max_height` to filter accordingly. Result is a list of `MoneroRPC::IncomingTransfer` objects.
|
139
157
|
|
140
|
-
|
158
|
+
```ruby
|
159
|
+
incomes = $monero_rpc.get_all_incoming_transfers(min_height: 1087400)
|
160
|
+
=> [#<MoneroRPC::IncomingTransfer:0x000000036d3ca8 ...>, #<MoneroRPC::IncomingTransfer:0x000000036d38c0 ...>, #<MoneroRPC::IncomingTransfer:0x000000036d3258 ...>, #<MoneroRPC::IncomingTransfer:0x000000036d2c90 ...> ....
|
141
161
|
|
142
|
-
|
143
|
-
|
162
|
+
incomes.first.confirmed?
|
163
|
+
=> false
|
144
164
|
|
145
|
-
|
146
|
-
|
165
|
+
incomes.first.pending?
|
166
|
+
=> true
|
147
167
|
|
148
|
-
|
149
|
-
|
168
|
+
incomes.first.confirmations?
|
169
|
+
=> 0
|
150
170
|
|
151
|
-
|
152
|
-
|
171
|
+
incomes.first.address
|
172
|
+
=> "9vN5sHeH2a6AbRsB1dZ3APavL3YyFLguhh5pu2cAHb4CTY9GtnsEsBYTzwxzL6XH4Uby2Svju8sYvZN7mDMcd6MTKDvBgVR"
|
153
173
|
|
154
|
-
|
155
|
-
|
174
|
+
incomes.first.amount
|
175
|
+
=> 0.40123
|
176
|
+
```
|
156
177
|
|
157
|
-
|
158
|
-
=> 0.40123
|
178
|
+
You can use your own custom class by using the config `MoneroRPC.config.in_transfer_clazz = "MyCustomMoneroTransfer"`
|
159
179
|
|
160
|
-
|
180
|
+
The same works for outgoing transfers where we have "MoneroRPC::OutgoingTransfer"
|
161
181
|
|
162
|
-
|
182
|
+
$monero_rpc.get_all_outgoing_transfers
|
163
183
|
|
164
|
-
For a specific Transfer simply call `get_transfer_by_txid(tx_id)`
|
165
184
|
|
166
|
-
|
185
|
+
---
|
186
|
+
For a specific Transfer simply call `$monero_rpc.get_transfer_by_txid(tx_id)`
|
167
187
|
|
188
|
+
---
|
189
|
+
## Running tests
|
168
190
|
|
191
|
+
Configure the RPC singleton in
|
192
|
+
[spec_helper.rb](https://github.com/krtschmr/monero/blob/master/spec/spec_helper.rb)
|
169
193
|
|
170
194
|
## Donations
|
171
195
|
If this was useful you might consider a small donation:
|
172
196
|
|
173
|
-
|
197
|
+
krtschmr:
|
198
|
+
```
|
199
|
+
42gYBRdXZbDdpV8gn7ntZySQuY4kzF7upNw67cj1LkkxV3kgjqoBBU9fBPeh4mZMMb75WAkNisvKdehdiE3g7Awx3JSdd5Y
|
200
|
+
```
|
174
201
|
|
175
202
|
Even better would be your contribution to the code. Let's work together and make this gem a great place for all Monero fans! Don't just fork and do your own thing. My idea for this gem isn't the way we have to do. Feel free to bring yourself into this project. I'm willing to change everything from scratch if it will benefit the future.
|
176
203
|
|
177
|
-
|
178
|
-
|
179
|
-
MIT
|
204
|
+
## License
|
205
|
+
This gem is available as open source under the terms of the [MIT
|
206
|
+
License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "monero"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/monero.rb
CHANGED
@@ -1,26 +1,50 @@
|
|
1
1
|
require 'money'
|
2
|
-
require '
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
require '
|
7
|
-
require '
|
8
|
-
require '
|
2
|
+
require 'monero_rpc/config'
|
3
|
+
require 'monero_rpc/payment'
|
4
|
+
require 'monero_rpc/wallet'
|
5
|
+
require 'monero_rpc/version'
|
6
|
+
require 'monero_rpc/transfer'
|
7
|
+
require 'monero_rpc/transfer_class'
|
8
|
+
require 'monero_rpc/client'
|
9
9
|
|
10
|
-
module
|
10
|
+
module MoneroRPC
|
11
11
|
def self.config
|
12
|
-
@@config ||=
|
12
|
+
@@config ||= MoneroRPC::Config.instance
|
13
13
|
end
|
14
|
+
|
15
|
+
def self.new(args={})
|
16
|
+
host = args.fetch(:host, MoneroRPC.config.host) || raise("missing host")
|
17
|
+
port = args.fetch(:port, MoneroRPC.config.port) || raise("missing port")
|
18
|
+
username = args.fetch(:username, MoneroRPC.config.username) || raise("missing username")
|
19
|
+
password = args.fetch(:password, MoneroRPC.config.password) || raise("missing password")
|
20
|
+
debug = args.fetch(:debug, MoneroRPC.config.debug)
|
21
|
+
in_transfer_clazz = args.fetch(:in_transfer_clazz, MoneroRPC.config.in_transfer_clazz)
|
22
|
+
out_transfer_clazz = args.fetch(:out_transfer_clazz, MoneroRPC.config.out_transfer_clazz)
|
23
|
+
|
24
|
+
Client.new(host: host, port: port, username: username, password: password, debug: debug, in_transfer_clazz: in_transfer_clazz, out_transfer_clazz: out_transfer_clazz)
|
25
|
+
end
|
26
|
+
|
14
27
|
end
|
15
28
|
|
16
|
-
Money::Currency.register({
|
17
|
-
|
29
|
+
Money::Currency.register({
|
30
|
+
:priority => 1,
|
31
|
+
:iso_code => "xmr",
|
32
|
+
:iso_numeric => "846",
|
33
|
+
:name => "Monero",
|
34
|
+
:symbol => "XMR",
|
35
|
+
:subunit => "",
|
36
|
+
:subunit_to_unit => 1000000000000,
|
37
|
+
:decimal_mark => ".",
|
38
|
+
:thousands_separator => ""
|
39
|
+
})
|
18
40
|
|
19
41
|
unless Object.const_defined?('XMR')
|
20
|
-
|
21
42
|
class XMR
|
22
43
|
def self.new(amount); Money.new(amount, :xmr); end
|
23
44
|
def to_s; Money.new(amount, :xmr).format.to_s; end
|
24
45
|
end
|
25
|
-
|
26
46
|
end
|
47
|
+
|
48
|
+
I18n.enforce_available_locales = false
|
49
|
+
Money.locale_backend = :i18n
|
50
|
+
I18n.locale = :en
|