cardano_wallet 0.3.11 → 0.3.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +3 -3
- data/.rubocop.yml +1 -0
- data/Rakefile +1 -0
- data/lib/cardano_wallet/byron.rb +35 -0
- data/lib/cardano_wallet/shelley.rb +73 -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: 8fa0c383ca96ba2ca8b2293d2754578a41aabc2db26617ca51f0519d662b0820
|
4
|
+
data.tar.gz: 36a2ca1a5a76837978ae826e7d285ac53ab24eccf13678489d9f5383e0695592
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92abce3f9b08f24e9be3138236eb346ab2c992b61b8c4182bc4dbeae02fa572708de671b56d3dbef1ac1bb589bf4ee878369967da05e8c6d8b020de125668a0f
|
7
|
+
data.tar.gz: 9fc6f2d60b340f6cb9161a34d33b2b4b97c49cac0a4ba670c8b5d69dc2e901abed986acdda5f1d5de6e459755b47c2bf61a17161b744271311b9f9d8c530478a
|
data/.github/workflows/tests.yml
CHANGED
@@ -33,7 +33,7 @@ jobs:
|
|
33
33
|
echo "Node: $NODE"
|
34
34
|
NODE_CONFIG_PATH=`pwd`/configs docker-compose up --detach
|
35
35
|
docker run --rm inputoutput/cardano-wallet:$WALLET version
|
36
|
-
docker run --rm inputoutput/cardano-node:$NODE version
|
36
|
+
docker run --rm inputoutput/cardano-node:$NODE cli version
|
37
37
|
ls ~/node-db-nightly-docker
|
38
38
|
|
39
39
|
- name: Run all tests except nighlty
|
@@ -45,5 +45,5 @@ jobs:
|
|
45
45
|
CI: true
|
46
46
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
47
47
|
NETWORK: testnet
|
48
|
-
WALLET: dev-master
|
49
|
-
NODE: 1.
|
48
|
+
WALLET: dev-master
|
49
|
+
NODE: alonzo-purple-1.0.1
|
data/.rubocop.yml
CHANGED
data/Rakefile
CHANGED
@@ -31,6 +31,7 @@ task :get_latest_configs, [:env] do |_, args|
|
|
31
31
|
mk_dir(path)
|
32
32
|
wget("#{base_url}/#{env}-config.json", "#{path}/#{env}-config.json")
|
33
33
|
wget("#{base_url}/#{env}-byron-genesis.json", "#{path}/#{env}-byron-genesis.json")
|
34
|
+
wget("#{base_url}/#{env}-alonzo-genesis.json", "#{path}/#{env}-alonzo-genesis.json")
|
34
35
|
wget("#{base_url}/#{env}-shelley-genesis.json", "#{path}/#{env}-shelley-genesis.json")
|
35
36
|
wget("#{base_url}/#{env}-topology.json", "#{path}/#{env}-topology.json")
|
36
37
|
end
|
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)
|
@@ -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
|
@@ -88,8 +103,9 @@ module CardanoWallet
|
|
88
103
|
end
|
89
104
|
|
90
105
|
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getWalletKey
|
91
|
-
def get_public_key(wid, role, index)
|
92
|
-
|
106
|
+
def get_public_key(wid, role, index, query = {})
|
107
|
+
query_formatted = query.empty? ? '' : Utils.to_query(query)
|
108
|
+
self.class.get("/wallets/#{wid}/keys/#{role}/#{index}#{query_formatted}")
|
93
109
|
end
|
94
110
|
|
95
111
|
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/postAccountKey
|
@@ -243,6 +259,61 @@ module CardanoWallet
|
|
243
259
|
# API for Transactions
|
244
260
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Transactions
|
245
261
|
class Transactions < Base
|
262
|
+
# Balance transaction
|
263
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction
|
264
|
+
# @param wid [String] source wallet id
|
265
|
+
# @param payload [Hash] payload object
|
266
|
+
def balance(wid, payload)
|
267
|
+
self.class.post("/wallets/#{wid}/transactions-balance",
|
268
|
+
body: payload.to_json,
|
269
|
+
headers: { 'Content-Type' => 'application/json' })
|
270
|
+
end
|
271
|
+
|
272
|
+
# Construct transaction
|
273
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructTransaction
|
274
|
+
# @param wid [String] source wallet id
|
275
|
+
# @param payments [Array of Hashes] full payments payload with assets
|
276
|
+
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
277
|
+
# @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
|
278
|
+
# @param mint [Array of Hashes] mint object
|
279
|
+
# @param delegations [Array of Hashes] delegations object
|
280
|
+
# @param validity_interval [Hash] validity_interval object
|
281
|
+
def construct(wid,
|
282
|
+
payments = nil,
|
283
|
+
withdrawal = nil,
|
284
|
+
metadata = nil,
|
285
|
+
delegations = nil,
|
286
|
+
mint = nil,
|
287
|
+
validity_interval = nil)
|
288
|
+
payload = {}
|
289
|
+
payload[:payments] = payments if payments
|
290
|
+
payload[:withdrawal] = withdrawal if withdrawal
|
291
|
+
payload[:metadata] = metadata if metadata
|
292
|
+
payload[:mint] = mint if mint
|
293
|
+
payload[:delegations] = delegations if delegations
|
294
|
+
payload[:validity_interval] = validity_interval if validity_interval
|
295
|
+
|
296
|
+
self.class.post("/wallets/#{wid}/transactions-construct",
|
297
|
+
body: payload.to_json,
|
298
|
+
headers: { 'Content-Type' => 'application/json' })
|
299
|
+
end
|
300
|
+
|
301
|
+
# Sign transaction
|
302
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signTransaction
|
303
|
+
# @param wid [String] source wallet id
|
304
|
+
# @param passphrase [String] wallet's passphrase
|
305
|
+
# @param passphrase [String] CBOR transaction data
|
306
|
+
def sign(wid, passphrase, transaction)
|
307
|
+
payload = {
|
308
|
+
'passphrase' => passphrase,
|
309
|
+
'transaction' => transaction
|
310
|
+
}
|
311
|
+
|
312
|
+
self.class.post("/wallets/#{wid}/transactions-sign",
|
313
|
+
body: payload.to_json,
|
314
|
+
headers: { 'Content-Type' => 'application/json' })
|
315
|
+
end
|
316
|
+
|
246
317
|
# Get tx by id
|
247
318
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getTransaction
|
248
319
|
def get(wid, tx_id)
|
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.16
|
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-10-15 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.
|