cardano_wallet 0.1.2 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e29845cb4672d029153cec037844d2092a542c6513bfdd5a8d05288e85ad1f24
4
- data.tar.gz: 5584f5d87039805b91bac5e39842c08b1ace6b79d732f9feba3e138c2f4983e9
3
+ metadata.gz: 6e71c5cdb72ca953d4289d8d343e1e769c0cd0cb24f6bc51c8487fd189c7dff2
4
+ data.tar.gz: 4c4712df87921f80adf52b49db9cb8752f397b9fef31c3dd10fe895e18caa29b
5
5
  SHA512:
6
- metadata.gz: 7feb9ac4fbb80c4f27bf7c3a454b2b89e03bbb99916374484f37ce8fcb36ea0b088def659aea7a36ffe16a833565d12905583deec04eb9761417880d263b1749
7
- data.tar.gz: 701838da0b5377578b46b45a8051ca1661eb1f89a1829a272206ec9e6d01be23a2ae40f773992955e4a67b369a7387247a898a2daa1238809b6ba96aa482e89c
6
+ metadata.gz: 515592573f6cdff23f85e26b32430f2913192d04d841dd23f1e1b4c2b5a11c698861f6b5c2039052ce0f6327f82c7c523cf907feb67f8a1a5b3195c1fa27b73c
7
+ data.tar.gz: 3e8f0e8a30a9eda51a229c202d08adf6d91f7a67a58dbb933f1c50df83182e9b4eb448352ff9e4d5790913ecfe297f753831496807636c5ebac75cd8d065dc45
@@ -0,0 +1,34 @@
1
+ name: Nightly
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "0 23 * * *"
6
+
7
+ jobs:
8
+ test:
9
+
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up cardano-wallet
15
+ run: NODE_CONFIG_PATH=`pwd`/spec/shelley-testnet docker-compose -f docker-compose-shelley.yml up --detach
16
+ - name: Set up Ruby
17
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
18
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
19
+ # uses: ruby/setup-ruby@v1
20
+ uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
21
+ with:
22
+ ruby-version: 2.6
23
+ - name: Install dependencies
24
+ run: bundle install
25
+ - name: Wait until node is synced
26
+ run: bundle exec rake wait_until_node_synced
27
+ - name: Run all tests
28
+ run: bundle exec rspec
29
+ env:
30
+ CI: true
31
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32
+ NETWORK: testnet
33
+ WALLET: dev-master-shelley
34
+ NODE: master
@@ -31,11 +31,11 @@ jobs:
31
31
  ruby-version: 2.6
32
32
  - name: Install dependencies
33
33
  run: bundle install
34
- - name: Run tests
35
- run: bundle exec rake
34
+ - name: Run all tests except nighlty
35
+ run: bundle exec rspec . -t ~nightly
36
36
  env:
37
37
  CI: true
38
38
  CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
39
39
  NETWORK: testnet
40
40
  WALLET: dev-master-shelley
41
- NODE: 1.13.0
41
+ NODE: master
data/README.md CHANGED
@@ -11,6 +11,9 @@
11
11
  <a href="https://github.com/piotr-iohk/cardano-wallet-rb/actions?query=workflow%3ATests">
12
12
  <img src="https://github.com/piotr-iohk/cardano-wallet-rb/workflows/Tests/badge.svg" />
13
13
  </a>
14
+ <a href="https://github.com/piotr-iohk/cardano-wallet-rb/actions?query=workflow%3ANightly">
15
+ <img src="https://github.com/piotr-iohk/cardano-wallet-rb/workflows/Nightly/badge.svg" />
16
+ </a>
14
17
 
15
18
  # cardano-wallet-rb
16
19
 
data/Rakefile CHANGED
@@ -4,3 +4,13 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ require_relative "lib/cardano_wallet"
9
+ task :wait_until_node_synced do
10
+ desc "Wait for node to be synced"
11
+ network = CardanoWallet.new.misc.network
12
+ while network.information["sync_progress"]["status"] == "syncing" do
13
+ puts "Syncing... #{network.information["sync_progress"]["progress"]["quantity"]}%"
14
+ sleep 15
15
+ end
16
+ end
@@ -3,12 +3,11 @@ version: "3.5"
3
3
  services:
4
4
  cardano-node:
5
5
  image: inputoutput/cardano-node:${NODE}
6
- environment:
7
- NETWORK:
8
6
  volumes:
9
7
  - node-db:/data
10
8
  - node-ipc:/ipc
11
- - ${NODE_CONFIG_PATH}:/configuration
9
+ - ${NODE_CONFIG_PATH}:/config
10
+ command: run --socket-path /ipc/node.socket --config /config/shelley_testnet-config.json --topology /config/shelley_testnet-topology.json --database-path /data
12
11
  restart: on-failure
13
12
 
14
13
  cardano-wallet:
@@ -19,8 +18,7 @@ services:
19
18
  - ${NODE_CONFIG_PATH}:/config
20
19
  ports:
21
20
  - 8090:8090
22
- entrypoint: []
23
- command: cardano-wallet-shelley serve --testnet /config/ff-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0
21
+ command: serve --testnet /config/shelley_testnet-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0
24
22
  restart: on-failure
25
23
 
26
24
  volumes:
@@ -22,6 +22,12 @@ module CardanoWallet
22
22
  Addresses.new @opt
23
23
  end
24
24
 
25
+ # API for CoinSelections
26
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Coin-Selections
27
+ def coin_selections
28
+ CoinSelections.new @opt
29
+ end
30
+
25
31
  # Get API for Byron transactions
26
32
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronTransactionFee
27
33
  def transactions
@@ -152,6 +158,36 @@ module CardanoWallet
152
158
  self.class.put("/byron-wallets/#{wid}/addresses/#{addr_id}")
153
159
  end
154
160
 
161
+ # Import addresses to Byron wallet.
162
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/importAddresses
163
+ # @param wid [String] wallet id
164
+ # @param addresses [Array] array of addresses
165
+ def bulk_import(wid, addresses)
166
+ self.class.put("/byron-wallets/#{wid}/addresses",
167
+ :body => { :addresses => addresses
168
+ }.to_json,
169
+ :headers => { 'Content-Type' => 'application/json' } )
170
+ end
171
+ end
172
+
173
+ # API for CoinSelections
174
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Coin-Selections
175
+ class CoinSelections < Base
176
+ def initialize opt
177
+ super
178
+ end
179
+
180
+ # Show random coin selection for particular payment
181
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/byronSelectCoins
182
+ #
183
+ # @example
184
+ # random(wid, {address1: 123, address2: 456})
185
+ def random(wid, payments)
186
+ payments_formatted = Utils.format_payments(payments)
187
+ self.class.post("/byron-wallets/#{wid}/coin-selections/random",
188
+ :body => {:payments => payments_formatted}.to_json,
189
+ :headers => { 'Content-Type' => 'application/json' })
190
+ end
155
191
  end
156
192
 
157
193
  # Byron transactions
@@ -161,6 +197,12 @@ module CardanoWallet
161
197
  super
162
198
  end
163
199
 
200
+ # Get tx by id
201
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronTransaction
202
+ def get(wid, tx_id)
203
+ self.class.get("/byron-wallets/#{wid}/transactions/#{tx_id}")
204
+ end
205
+
164
206
  # List all Byron wallet's transactions.
165
207
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronTransactions
166
208
  #
@@ -174,6 +174,12 @@ module CardanoWallet
174
174
  super
175
175
  end
176
176
 
177
+ # Get tx by id
178
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getTransaction
179
+ def get(wid, tx_id)
180
+ self.class.get("/wallets/#{wid}/transactions/#{tx_id}")
181
+ end
182
+
177
183
  # List all wallet's transactions
178
184
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listTransactions
179
185
  #
@@ -189,17 +195,18 @@ module CardanoWallet
189
195
  # @param wid [String] source wallet id
190
196
  # @param passphrase [String] source wallet's passphrase
191
197
  # @param payments [Hash] addres, amount pair
198
+ # @param q [Hash] query param (currently only withdrawRewards = true | false)
192
199
  #
193
200
  # @example
194
- # create(wid, passphrase, {addr1: 1000000})
195
- def create(wid, passphrase, payments)
201
+ # create(wid, passphrase, {addr1: 1000000}, q)
202
+ def create(wid, passphrase, payments, q = {})
196
203
  payments_formatted = Utils.format_payments(payments)
197
- self.class.post("/wallets/#{wid}/transactions",
204
+ q.empty? ? query = '' : query = Utils.to_query(q)
205
+ self.class.post("/wallets/#{wid}/transactions#{query}",
198
206
  :body => { :payments => payments_formatted,
199
207
  :passphrase => passphrase
200
208
  }.to_json,
201
209
  :headers => { 'Content-Type' => 'application/json' } )
202
-
203
210
  end
204
211
 
205
212
  # Estimate fees for transaction
@@ -207,9 +214,10 @@ module CardanoWallet
207
214
  #
208
215
  # @example
209
216
  # payment_fees(wid, {addr1: 1000000})
210
- def payment_fees(wid, payments)
217
+ def payment_fees(wid, payments, q = {})
211
218
  payments_formatted = Utils.format_payments(payments)
212
- self.class.post("/wallets/#{wid}/payment-fees",
219
+ q.empty? ? query = '' : query = Utils.to_query(q)
220
+ self.class.post("/wallets/#{wid}/payment-fees#{query}",
213
221
  :body => { :payments => payments_formatted }.to_json,
214
222
  :headers => { 'Content-Type' => 'application/json' } )
215
223
  end
@@ -230,8 +238,9 @@ module CardanoWallet
230
238
 
231
239
  # List all stake pools
232
240
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakePools
233
- def list(wid)
234
- self.class.get("/wallets/#{wid}/stake-pools")
241
+ def list(stake = {})
242
+ stake.empty? ? query = '' : query = Utils.to_query(stake)
243
+ self.class.get("/stake-pools#{query}")
235
244
  end
236
245
 
237
246
  # Join stake pool
@@ -1,3 +1,3 @@
1
1
  module CardanoWallet
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardano_wallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-14 00:00:00.000000000 Z
11
+ date: 2020-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - ".github/workflows/gem-push.yml"
105
+ - ".github/workflows/nightly.yml"
105
106
  - ".github/workflows/tests.yml"
106
107
  - ".gitignore"
107
108
  - ".rakeTasks"