cardano_wallet 0.2.4 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/nightly.yml +1 -6
- data/.github/workflows/tests.yml +1 -6
- data/.ruby-version +1 -0
- data/lib/cardano_wallet/misc.rb +20 -2
- data/lib/cardano_wallet/shelley.rb +26 -5
- data/lib/cardano_wallet/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9ad05abba294de18063a3e1e381ce3e06e95644f4209526eba555f9a2504dae
|
4
|
+
data.tar.gz: 24ee6eeb1fd928c07df71c9e2875fae4b150c6ac564ecfd1775001f1d712468b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a94ebe1b3dc75ed9da0c3a7da543e607c3228baa1f9f127f09cd8d3f50e37f54dca7c2c6e84176f8ae4f0c8e0933e5c38b6dc536efddc98b5a2b34e5db7c4adf
|
7
|
+
data.tar.gz: '042836808eb65faf1a67f5508dd7ea12fd4b82c61cd6e7d9da8f4cb728fd45e6d9bf96ef1ea1afeedba8fdb56d9e53ff16a49dd08987edf678bd64aeb657708c'
|
@@ -14,12 +14,7 @@ jobs:
|
|
14
14
|
- name: Set up cardano-wallet
|
15
15
|
run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
16
16
|
- name: Set up Ruby
|
17
|
-
|
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
|
17
|
+
uses: ruby/setup-ruby@v1
|
23
18
|
- name: Install dependencies
|
24
19
|
run: bundle install
|
25
20
|
- name: Wait until node is synced
|
data/.github/workflows/tests.yml
CHANGED
@@ -23,12 +23,7 @@ jobs:
|
|
23
23
|
- name: Set up cardano-wallet
|
24
24
|
run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
25
25
|
- name: Set up Ruby
|
26
|
-
|
27
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
28
|
-
# uses: ruby/setup-ruby@v1
|
29
|
-
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
30
|
-
with:
|
31
|
-
ruby-version: 2.6
|
26
|
+
uses: ruby/setup-ruby@v1
|
32
27
|
- name: Install dependencies
|
33
28
|
run: bundle install
|
34
29
|
- name: Run all tests except nighlty
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.7.1
|
data/lib/cardano_wallet/misc.rb
CHANGED
@@ -95,8 +95,7 @@ module CardanoWallet
|
|
95
95
|
|
96
96
|
self.class.post("/wallets/#{wid}/signatures/#{role}/#{index}",
|
97
97
|
:body => payload.to_json,
|
98
|
-
:headers => { 'Content-Type' => 'application/json'
|
99
|
-
'Accept' => 'application/octet-stream'} )
|
98
|
+
:headers => { 'Content-Type' => 'application/json' } )
|
100
99
|
end
|
101
100
|
|
102
101
|
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getWalletKey
|
@@ -109,6 +108,25 @@ module CardanoWallet
|
|
109
108
|
self.class.get("/addresses/#{address_id}")
|
110
109
|
end
|
111
110
|
|
111
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postAnyAddress
|
112
|
+
def post_address(payload)
|
113
|
+
CardanoWallet::Utils.verify_param_is_hash!(payload)
|
114
|
+
self.class.post("/addresses",
|
115
|
+
:body => payload.to_json,
|
116
|
+
:headers => { 'Content-Type' => 'application/json',
|
117
|
+
'Accept' => 'application/json'} )
|
118
|
+
end
|
119
|
+
|
120
|
+
# Current SMASH health
|
121
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getCurrentSmashHealth
|
122
|
+
#
|
123
|
+
# @example
|
124
|
+
# smash_health({url: "https://smash.cardano-mainnet.iohk.io/"})
|
125
|
+
def smash_health(q = {})
|
126
|
+
q.empty? ? query = '' : query = CardanoWallet::Utils.to_query(q)
|
127
|
+
self.class.get("/smash/health#{query}")
|
128
|
+
end
|
129
|
+
|
112
130
|
end
|
113
131
|
|
114
132
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Proxy
|
@@ -202,7 +202,7 @@ module CardanoWallet
|
|
202
202
|
# random(wid, {action: "join", pool: "poolid"})
|
203
203
|
# random(wid, {action: "quit"})
|
204
204
|
def random_deleg(wid, deleg_action)
|
205
|
-
|
205
|
+
Utils.verify_param_is_hash!(deleg_action)
|
206
206
|
self.class.post("/wallets/#{wid}/coin-selections/random",
|
207
207
|
:body => {:delegation_action => deleg_action}.to_json,
|
208
208
|
:headers => { 'Content-Type' => 'application/json' })
|
@@ -239,16 +239,18 @@ module CardanoWallet
|
|
239
239
|
# @param payments [Array of Hashes] addres, amount pair
|
240
240
|
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
241
241
|
# @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
|
242
|
+
# @param ttl [Int] transaction's time-to-live in seconds
|
242
243
|
#
|
243
244
|
# @example
|
244
|
-
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}], 'self', {"1": "abc"})
|
245
|
-
def create(wid, passphrase, payments, withdrawal = nil, metadata = nil)
|
245
|
+
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}], 'self', {"1": "abc"}, ttl = 10)
|
246
|
+
def create(wid, passphrase, payments, withdrawal = nil, metadata = nil, ttl = nil)
|
246
247
|
payments_formatted = Utils.format_payments(payments)
|
247
248
|
payload = { :payments => payments_formatted,
|
248
249
|
:passphrase => passphrase
|
249
250
|
}
|
250
251
|
payload[:withdrawal] = withdrawal if withdrawal
|
251
252
|
payload[:metadata] = metadata if metadata
|
253
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
252
254
|
|
253
255
|
self.class.post("/wallets/#{wid}/transactions",
|
254
256
|
:body => payload.to_json,
|
@@ -259,13 +261,14 @@ module CardanoWallet
|
|
259
261
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransactionFee
|
260
262
|
#
|
261
263
|
# @example
|
262
|
-
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}], {"1": "abc"})
|
263
|
-
def payment_fees(wid, payments, withdrawal = nil, metadata = nil)
|
264
|
+
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}], {"1": "abc"}, ttl = 10)
|
265
|
+
def payment_fees(wid, payments, withdrawal = nil, metadata = nil, ttl = nil)
|
264
266
|
payments_formatted = Utils.format_payments(payments)
|
265
267
|
payload = { :payments => payments_formatted }
|
266
268
|
|
267
269
|
payload[:withdrawal] = withdrawal if withdrawal
|
268
270
|
payload[:metadata] = metadata if metadata
|
271
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
269
272
|
|
270
273
|
self.class.post("/wallets/#{wid}/payment-fees",
|
271
274
|
:body => payload.to_json,
|
@@ -286,6 +289,24 @@ module CardanoWallet
|
|
286
289
|
super
|
287
290
|
end
|
288
291
|
|
292
|
+
# Stake pools maintenance actions
|
293
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postMaintenanceAction
|
294
|
+
#
|
295
|
+
# @example
|
296
|
+
# maintenance_action({ "maintenance_action": "gc_stake_pools" })
|
297
|
+
def trigger_maintenance_actions(action = {})
|
298
|
+
Utils.verify_param_is_hash!(action)
|
299
|
+
self.class.post("/stake-pools/maintenance-actions",
|
300
|
+
:body => action.to_json,
|
301
|
+
:headers => { 'Content-Type' => 'application/json' } )
|
302
|
+
end
|
303
|
+
|
304
|
+
# Metdata GC Status
|
305
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getMaintenanceActions
|
306
|
+
def view_maintenance_actions
|
307
|
+
self.class.get("/stake-pools/maintenance-actions")
|
308
|
+
end
|
309
|
+
|
289
310
|
# List all stake pools
|
290
311
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakePools
|
291
312
|
def list(stake = {})
|
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.2.
|
4
|
+
version: 0.2.9
|
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-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- ".gitignore"
|
108
108
|
- ".rakeTasks"
|
109
109
|
- ".rspec"
|
110
|
+
- ".ruby-version"
|
110
111
|
- CODE_OF_CONDUCT.md
|
111
112
|
- Gemfile
|
112
113
|
- LICENSE.txt
|
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.1.
|
151
|
+
rubygems_version: 3.1.4
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Ruby wrapper over cardano-wallet.
|