cardano_wallet 0.3.9 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ca7324e8297c5dc1450d6f80d152ef4e8c5f955a26b293a6fd25bdff5f573c9
4
- data.tar.gz: 55143e350cb6fe9a4c0fc6b6041901cf175a37d035a8625accca1f69b4728eb9
3
+ metadata.gz: db8533e403d0e47ad79f2a1f747ff748da7f23f5cfb7a2f8401f8ce5d7c17bfb
4
+ data.tar.gz: 7fd7466533875ca3414a28ae940eac4c0fee0543114e4b26713bdf1321689b7d
5
5
  SHA512:
6
- metadata.gz: 17823106144667576a2cd3a43a34020cd0ce6f9d9182f93836c82a6987d6e8ec4d74ccf7c5e0fc99566902a5a39ab096a339d575f59af3a5be4ee60472abc938
7
- data.tar.gz: e43e2cb40b72f39f477dfbb2aa3b364d326ee5222072ce78bfa28b4b219b44f26eca9e2433eae870bfe558e80b6a86ff1e883cdef0dffd62666ed29370f1540b
6
+ metadata.gz: d63b186f82b6f5abd16c0e336e6a137ea2607ce911641d5270af80f791e2c83e75e5213ec16af5a5b0ad867700fcc62fd752804320bc0d03fa005ebaaf8e6f5f
7
+ data.tar.gz: e18d2611da373ee8b7c2ad0702405a9d5cf51dc0badd0c744349fabbf2d4644f561d10fbb3a102a4e8a62ced3844ea74f2fbd580c992b836e0fa12fd44482fa6
data/.rubocop.yml CHANGED
@@ -22,3 +22,4 @@ Metrics/CyclomaticComplexity:
22
22
 
23
23
  Metrics/ParameterLists:
24
24
  Max: 10
25
+ MaxOptionalParameters: 10
@@ -210,6 +210,41 @@ module CardanoWallet
210
210
  # Byron transactions
211
211
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postByronTransactionFee
212
212
  class Transactions < Base
213
+ # Construct transaction
214
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructByronTransaction
215
+ # @param wid [String] source wallet id
216
+ # @param payments [Array of Hashes] full payments payload with assets
217
+ # @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
218
+ # @param mint [Array of Hashes] mint object
219
+ # @param validity_interval [Hash] validity_interval object
220
+ def construct(wid, payments = nil, metadata = nil, mint = nil, validity_interval = nil)
221
+ payload = {}
222
+ payload[:payments] = payments if payments
223
+ payload[:metadata] = metadata if metadata
224
+ payload[:mint] = mint if mint
225
+ payload[:validity_interval] = validity_interval if validity_interval
226
+
227
+ self.class.post("/byron-wallets/#{wid}/transactions-construct",
228
+ body: payload.to_json,
229
+ headers: { 'Content-Type' => 'application/json' })
230
+ end
231
+
232
+ # Sign transaction
233
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signByronTransaction
234
+ # @param wid [String] source wallet id
235
+ # @param passphrase [String] wallet's passphrase
236
+ # @param passphrase [String] CBOR transaction data
237
+ def sign(wid, passphrase, transaction)
238
+ payload = {
239
+ 'passphrase' => passphrase,
240
+ 'transaction' => transaction
241
+ }
242
+
243
+ self.class.post("/byron-wallets/#{wid}/transactions-sign",
244
+ body: payload.to_json,
245
+ headers: { 'Content-Type' => 'application/json' })
246
+ end
247
+
213
248
  # Get tx by id
214
249
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronTransaction
215
250
  def get(wid, tx_id)
@@ -49,8 +49,9 @@ module CardanoWallet
49
49
  end
50
50
 
51
51
  # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/postAccountKeyShared
52
- def create_acc_public_key(wid, index, pass, format)
53
- payload = { passphrase: pass, format: format }
52
+ def create_acc_public_key(wid, index, payload)
53
+ # payload = { passphrase: pass, format: format }
54
+ Utils.verify_param_is_hash!(payload)
54
55
  self.class.post("/shared-wallets/#{wid}/keys/#{index}",
55
56
  body: payload.to_json,
56
57
  headers: { 'Content-Type' => 'application/json' })
@@ -62,6 +62,21 @@ module CardanoWallet
62
62
  ##
63
63
  # Base class for Shelley Assets API
64
64
  class Assets < Base
65
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/mintBurnAssets
66
+ def mint(wid, mint_burn, pass, metadata = nil, ttl = nil)
67
+ payload = {
68
+ mint_burn: mint_burn,
69
+ passphrase: pass
70
+ }
71
+
72
+ payload[:metadata] = metadata if metadata
73
+ payload[:time_to_live] = { quantity: ttl, unit: 'second' } if ttl
74
+
75
+ self.class.post("/wallets/#{wid}/assets",
76
+ body: payload.to_json,
77
+ headers: { 'Content-Type' => 'application/json' })
78
+ end
79
+
65
80
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listAssets
66
81
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAsset
67
82
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAssetDefault
@@ -93,8 +108,9 @@ module CardanoWallet
93
108
  end
94
109
 
95
110
  # @see https://input-output-hk.github.io/cardano-wallet/api/#operation/postAccountKey
96
- def create_acc_public_key(wid, index, pass, format)
97
- payload = { passphrase: pass, format: format }
111
+ def create_acc_public_key(wid, index, payload)
112
+ # payload = { passphrase: pass, format: format, purpose: purpose }
113
+ Utils.verify_param_is_hash!(payload)
98
114
  self.class.post("/wallets/#{wid}/keys/#{index}",
99
115
  body: payload.to_json,
100
116
  headers: { 'Content-Type' => 'application/json' })
@@ -242,6 +258,51 @@ module CardanoWallet
242
258
  # API for Transactions
243
259
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Transactions
244
260
  class Transactions < Base
261
+ # Construct transaction
262
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructTransaction
263
+ # @param wid [String] source wallet id
264
+ # @param payments [Array of Hashes] full payments payload with assets
265
+ # @param withdrawal [String or Array] 'self' or mnemonic sentence
266
+ # @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
267
+ # @param mint [Array of Hashes] mint object
268
+ # @param delegations [Array of Hashes] delegations object
269
+ # @param validity_interval [Hash] validity_interval object
270
+ def construct(wid,
271
+ payments = nil,
272
+ withdrawal = nil,
273
+ metadata = nil,
274
+ delegations = nil,
275
+ mint = nil,
276
+ validity_interval = nil)
277
+ payload = {}
278
+ payload[:payments] = payments if payments
279
+ payload[:withdrawal] = withdrawal if withdrawal
280
+ payload[:metadata] = metadata if metadata
281
+ payload[:mint] = mint if mint
282
+ payload[:delegations] = delegations if delegations
283
+ payload[:validity_interval] = validity_interval if validity_interval
284
+
285
+ self.class.post("/wallets/#{wid}/transactions-construct",
286
+ body: payload.to_json,
287
+ headers: { 'Content-Type' => 'application/json' })
288
+ end
289
+
290
+ # Sign transaction
291
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signTransaction
292
+ # @param wid [String] source wallet id
293
+ # @param passphrase [String] wallet's passphrase
294
+ # @param passphrase [String] CBOR transaction data
295
+ def sign(wid, passphrase, transaction)
296
+ payload = {
297
+ 'passphrase' => passphrase,
298
+ 'transaction' => transaction
299
+ }
300
+
301
+ self.class.post("/wallets/#{wid}/transactions-sign",
302
+ body: payload.to_json,
303
+ headers: { 'Content-Type' => 'application/json' })
304
+ end
305
+
245
306
  # Get tx by id
246
307
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getTransaction
247
308
  def get(wid, tx_id)
@@ -354,6 +415,12 @@ module CardanoWallet
354
415
  self.class.get("/stake-pools#{query}")
355
416
  end
356
417
 
418
+ # List all stake keys
419
+ # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listStakeKeys
420
+ def list_stake_keys(wid)
421
+ self.class.get("/wallets/#{wid}/stake-keys")
422
+ end
423
+
357
424
  # Join stake pool
358
425
  # @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/joinStakePool
359
426
  def join(sp_id, wid, passphrase)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CardanoWallet
4
- VERSION = '0.3.9'
4
+ VERSION = '0.3.14'
5
5
  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.3.9
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Stachyra
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-31 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.2.15
167
+ rubygems_version: 3.2.22
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Ruby wrapper over cardano-wallet.