Skip to content

Commit

Permalink
Merge pull request #6 from piotr-iohk/stake_pool_again
Browse files Browse the repository at this point in the history
Stake pool again
  • Loading branch information
piotr-iohk authored Jun 18, 2020
2 parents 85ac9c7 + 4a05daf commit 8f6e9da
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/cardano_wallet/shelley.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,9 @@ def initialize opt

# List all stake pools
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakePools
def list(wid)
self.class.get("/wallets/#{wid}/stake-pools")
def list(stake = {})
stake.empty? ? query = '' : query = Utils.to_query(stake)
self.class.get("/stake-pools#{query}")
end

# Join stake pool
Expand Down
2 changes: 1 addition & 1 deletion lib/cardano_wallet/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CardanoWallet
VERSION = "0.1.2"
VERSION = "0.1.3"
end
8 changes: 5 additions & 3 deletions spec/shelley_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,12 @@
teardown
end

it "Can list stake pools" do
id = create_shelley_wallet
it "Can list stake pools only when stake is provided" do
pools = SHELLEY.stake_pools
expect(pools.list(id).code).to eq 200
expect(pools.list({stake: 1000}).code).to eq 200

expect(pools.list.code).to eq 400
expect(pools.list).to include "query_param_missing"
end

it "I could join Stake Pool - if I knew it's id" do
Expand Down

0 comments on commit 8f6e9da

Please sign in to comment.