cardano_wallet 0.2.3 → 0.2.8
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 +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 +25 -0
- data/lib/cardano_wallet/shelley.rb +55 -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: b83fd4fa4d1a41132d0afb2563a30fe64ff86b69356b45266fe0d044cfe4d0fc
|
4
|
+
data.tar.gz: 5191ea71cb925c5f6241facb477c65fba766d84cf0977716dcd0ad0d05926564
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3671b155b8d5d9ac44df4ed1be0370d266a2b034ae26e15385f3634306c648ba1bacdbe7bda7a4f4fdb93193ed1fe3e4a7cd999cef0b672f8cf049cf4d5e9bf3
|
7
|
+
data.tar.gz: 3ed411e07eb090749898e5a0080fde5e039e2de7c386248d8accdfd12526110fd68e7795b07be7be424f5497446d7ed08d3d3262c5f1eff975e0dfd8c54ca850
|
@@ -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
@@ -30,6 +30,7 @@ module CardanoWallet
|
|
30
30
|
def settings
|
31
31
|
Settings.new @opt
|
32
32
|
end
|
33
|
+
|
33
34
|
end
|
34
35
|
|
35
36
|
# API for Network
|
@@ -87,11 +88,35 @@ module CardanoWallet
|
|
87
88
|
super
|
88
89
|
end
|
89
90
|
|
91
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/signMetadata
|
92
|
+
def sign_metadata(wid, role, index, pass, metadata)
|
93
|
+
payload = { passphrase: pass }
|
94
|
+
payload[:metadata] = metadata if metadata
|
95
|
+
|
96
|
+
self.class.post("/wallets/#{wid}/signatures/#{role}/#{index}",
|
97
|
+
:body => payload.to_json,
|
98
|
+
:headers => { 'Content-Type' => 'application/json' } )
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getWalletKey
|
102
|
+
def get_public_key(wid, role, index)
|
103
|
+
self.class.get("/wallets/#{wid}/keys/#{role}/#{index}")
|
104
|
+
end
|
105
|
+
|
90
106
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/inspectAddress
|
91
107
|
def addresses(address_id)
|
92
108
|
self.class.get("/addresses/#{address_id}")
|
93
109
|
end
|
94
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
|
+
|
95
120
|
end
|
96
121
|
|
97
122
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Proxy
|
@@ -48,6 +48,35 @@ module CardanoWallet
|
|
48
48
|
Migrations.new @opt
|
49
49
|
end
|
50
50
|
|
51
|
+
# API for Keys
|
52
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Keys
|
53
|
+
def keys
|
54
|
+
Keys.new @opt
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
class Keys < Base
|
60
|
+
def initialize opt
|
61
|
+
super
|
62
|
+
end
|
63
|
+
|
64
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/signMetadata
|
65
|
+
def sign_metadata(wid, role, index, pass, metadata)
|
66
|
+
payload = { passphrase: pass }
|
67
|
+
payload[:metadata] = metadata if metadata
|
68
|
+
|
69
|
+
self.class.post("/wallets/#{wid}/signatures/#{role}/#{index}",
|
70
|
+
:body => payload.to_json,
|
71
|
+
:headers => { 'Content-Type' => 'application/json',
|
72
|
+
'Accept' => 'application/octet-stream'} )
|
73
|
+
end
|
74
|
+
|
75
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getWalletKey
|
76
|
+
def get_public_key(wid, role, index)
|
77
|
+
self.class.get("/wallets/#{wid}/keys/#{role}/#{index}")
|
78
|
+
end
|
79
|
+
|
51
80
|
end
|
52
81
|
|
53
82
|
# API for Wallets
|
@@ -173,7 +202,7 @@ module CardanoWallet
|
|
173
202
|
# random(wid, {action: "join", pool: "poolid"})
|
174
203
|
# random(wid, {action: "quit"})
|
175
204
|
def random_deleg(wid, deleg_action)
|
176
|
-
|
205
|
+
Utils.verify_param_is_hash!(deleg_action)
|
177
206
|
self.class.post("/wallets/#{wid}/coin-selections/random",
|
178
207
|
:body => {:delegation_action => deleg_action}.to_json,
|
179
208
|
:headers => { 'Content-Type' => 'application/json' })
|
@@ -210,16 +239,18 @@ module CardanoWallet
|
|
210
239
|
# @param payments [Array of Hashes] addres, amount pair
|
211
240
|
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
212
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
|
213
243
|
#
|
214
244
|
# @example
|
215
|
-
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}], 'self', {"1": "abc"})
|
216
|
-
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)
|
217
247
|
payments_formatted = Utils.format_payments(payments)
|
218
248
|
payload = { :payments => payments_formatted,
|
219
249
|
:passphrase => passphrase
|
220
250
|
}
|
221
251
|
payload[:withdrawal] = withdrawal if withdrawal
|
222
252
|
payload[:metadata] = metadata if metadata
|
253
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
223
254
|
|
224
255
|
self.class.post("/wallets/#{wid}/transactions",
|
225
256
|
:body => payload.to_json,
|
@@ -230,13 +261,14 @@ module CardanoWallet
|
|
230
261
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransactionFee
|
231
262
|
#
|
232
263
|
# @example
|
233
|
-
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}], {"1": "abc"})
|
234
|
-
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)
|
235
266
|
payments_formatted = Utils.format_payments(payments)
|
236
267
|
payload = { :payments => payments_formatted }
|
237
268
|
|
238
269
|
payload[:withdrawal] = withdrawal if withdrawal
|
239
270
|
payload[:metadata] = metadata if metadata
|
271
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
240
272
|
|
241
273
|
self.class.post("/wallets/#{wid}/payment-fees",
|
242
274
|
:body => payload.to_json,
|
@@ -257,6 +289,24 @@ module CardanoWallet
|
|
257
289
|
super
|
258
290
|
end
|
259
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
|
+
|
260
310
|
# List all stake pools
|
261
311
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakePools
|
262
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.8
|
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-11-18 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.
|