cardano_wallet 0.2.2 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cardano_wallet/misc.rb +25 -0
- data/lib/cardano_wallet/shelley.rb +67 -4
- data/lib/cardano_wallet/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c115a916adbed97481aa950e6c15a6e8609117a68549112dcc18d60300e47657
|
4
|
+
data.tar.gz: e3cd4ce44ea58b62349bc29e14faf51dfe3b6f69a4135c3dcf6e5575c26bbbfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d2f7768e00ead4a2cf7b7b463dc3bdea8ac5794dc4a7ef3604dcd31c1663052c2493b382f100acaf9f5dcf1afb996c68da2e74f5720022d70126864a2d26e03
|
7
|
+
data.tar.gz: 0e353d9082d2f22cce803ab1f38de10a364dbbb936b6f720a93aaaa88584cf326b9d2d969b0fce495cd9cabefe8118be0e5aec5600ed4083d5748aa273153e48
|
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
|
@@ -165,6 +194,19 @@ module CardanoWallet
|
|
165
194
|
:body => {:payments => payments_formatted}.to_json,
|
166
195
|
:headers => { 'Content-Type' => 'application/json' })
|
167
196
|
end
|
197
|
+
|
198
|
+
# Coin selection -> Delegation action
|
199
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/selectCoins
|
200
|
+
#
|
201
|
+
# @example
|
202
|
+
# random(wid, {action: "join", pool: "poolid"})
|
203
|
+
# random(wid, {action: "quit"})
|
204
|
+
def random_deleg(wid, deleg_action)
|
205
|
+
Utils.verify_param_is_hash!(deleg_action)
|
206
|
+
self.class.post("/wallets/#{wid}/coin-selections/random",
|
207
|
+
:body => {:delegation_action => deleg_action}.to_json,
|
208
|
+
:headers => { 'Content-Type' => 'application/json' })
|
209
|
+
end
|
168
210
|
end
|
169
211
|
|
170
212
|
# API for Transactions
|
@@ -197,16 +239,18 @@ module CardanoWallet
|
|
197
239
|
# @param payments [Array of Hashes] addres, amount pair
|
198
240
|
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
199
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
|
200
243
|
#
|
201
244
|
# @example
|
202
|
-
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}], 'self', {"1": "abc"})
|
203
|
-
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)
|
204
247
|
payments_formatted = Utils.format_payments(payments)
|
205
248
|
payload = { :payments => payments_formatted,
|
206
249
|
:passphrase => passphrase
|
207
250
|
}
|
208
251
|
payload[:withdrawal] = withdrawal if withdrawal
|
209
252
|
payload[:metadata] = metadata if metadata
|
253
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
210
254
|
|
211
255
|
self.class.post("/wallets/#{wid}/transactions",
|
212
256
|
:body => payload.to_json,
|
@@ -217,13 +261,14 @@ module CardanoWallet
|
|
217
261
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransactionFee
|
218
262
|
#
|
219
263
|
# @example
|
220
|
-
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}], {"1": "abc"})
|
221
|
-
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)
|
222
266
|
payments_formatted = Utils.format_payments(payments)
|
223
267
|
payload = { :payments => payments_formatted }
|
224
268
|
|
225
269
|
payload[:withdrawal] = withdrawal if withdrawal
|
226
270
|
payload[:metadata] = metadata if metadata
|
271
|
+
payload[:time_to_live] = { quantity: ttl, unit: "second" } if ttl
|
227
272
|
|
228
273
|
self.class.post("/wallets/#{wid}/payment-fees",
|
229
274
|
:body => payload.to_json,
|
@@ -244,6 +289,24 @@ module CardanoWallet
|
|
244
289
|
super
|
245
290
|
end
|
246
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
|
+
|
247
310
|
# List all stake pools
|
248
311
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakePools
|
249
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.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-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.1.
|
150
|
+
rubygems_version: 3.1.4
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Ruby wrapper over cardano-wallet.
|