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 +4 -4
- data/.rubocop.yml +1 -0
- data/lib/cardano_wallet/byron.rb +35 -0
- data/lib/cardano_wallet/shared.rb +3 -2
- data/lib/cardano_wallet/shelley.rb +69 -2
- 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: db8533e403d0e47ad79f2a1f747ff748da7f23f5cfb7a2f8401f8ce5d7c17bfb
|
4
|
+
data.tar.gz: 7fd7466533875ca3414a28ae940eac4c0fee0543114e4b26713bdf1321689b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d63b186f82b6f5abd16c0e336e6a137ea2607ce911641d5270af80f791e2c83e75e5213ec16af5a5b0ad867700fcc62fd752804320bc0d03fa005ebaaf8e6f5f
|
7
|
+
data.tar.gz: e18d2611da373ee8b7c2ad0702405a9d5cf51dc0badd0c744349fabbf2d4644f561d10fbb3a102a4e8a62ced3844ea74f2fbd580c992b836e0fa12fd44482fa6
|
data/.rubocop.yml
CHANGED
data/lib/cardano_wallet/byron.rb
CHANGED
@@ -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,
|
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,
|
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)
|
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.
|
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-
|
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.
|
167
|
+
rubygems_version: 3.2.22
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Ruby wrapper over cardano-wallet.
|