cardano_wallet 0.3.10 → 0.3.15
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/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/shared.rb +3 -2
- 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: ae5c2835562e35f7ce7c3263d240631e94dc78046c665b8ef40f41c5495cf3f2
|
4
|
+
data.tar.gz: 29764e5fec66212d2902cab2a21f64c8bab4b7f0259bd4f38105f532b41840ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3873fbd889e7c2482f5a423f22d62723bcc94c26aa54d33e25c8f96c17e6ee072e8eb07705ccd111ec42b431502002fd725cc53905cb7b16ce570f631089305
|
7
|
+
data.tar.gz: 7eaf74bc9bd2e6b105f2a3fa72b61d670c08d06ccb981a26cc8ac9fe685d26a0fe0899335d38ff7e570f02c05e02dc409f1368eaa5912f47083dda5a825bf7b4
|
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)
|
@@ -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,61 @@ 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
|
+
# Balance transaction
|
262
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction
|
263
|
+
# @param wid [String] source wallet id
|
264
|
+
# @param payload [Hash] payload object
|
265
|
+
def balance(wid, payload)
|
266
|
+
self.class.post("/wallets/#{wid}/transactions-balance",
|
267
|
+
body: payload.to_json,
|
268
|
+
headers: { 'Content-Type' => 'application/json' })
|
269
|
+
end
|
270
|
+
|
271
|
+
# Construct transaction
|
272
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/constructTransaction
|
273
|
+
# @param wid [String] source wallet id
|
274
|
+
# @param payments [Array of Hashes] full payments payload with assets
|
275
|
+
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
276
|
+
# @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
|
277
|
+
# @param mint [Array of Hashes] mint object
|
278
|
+
# @param delegations [Array of Hashes] delegations object
|
279
|
+
# @param validity_interval [Hash] validity_interval object
|
280
|
+
def construct(wid,
|
281
|
+
payments = nil,
|
282
|
+
withdrawal = nil,
|
283
|
+
metadata = nil,
|
284
|
+
delegations = nil,
|
285
|
+
mint = nil,
|
286
|
+
validity_interval = nil)
|
287
|
+
payload = {}
|
288
|
+
payload[:payments] = payments if payments
|
289
|
+
payload[:withdrawal] = withdrawal if withdrawal
|
290
|
+
payload[:metadata] = metadata if metadata
|
291
|
+
payload[:mint] = mint if mint
|
292
|
+
payload[:delegations] = delegations if delegations
|
293
|
+
payload[:validity_interval] = validity_interval if validity_interval
|
294
|
+
|
295
|
+
self.class.post("/wallets/#{wid}/transactions-construct",
|
296
|
+
body: payload.to_json,
|
297
|
+
headers: { 'Content-Type' => 'application/json' })
|
298
|
+
end
|
299
|
+
|
300
|
+
# Sign transaction
|
301
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signTransaction
|
302
|
+
# @param wid [String] source wallet id
|
303
|
+
# @param passphrase [String] wallet's passphrase
|
304
|
+
# @param passphrase [String] CBOR transaction data
|
305
|
+
def sign(wid, passphrase, transaction)
|
306
|
+
payload = {
|
307
|
+
'passphrase' => passphrase,
|
308
|
+
'transaction' => transaction
|
309
|
+
}
|
310
|
+
|
311
|
+
self.class.post("/wallets/#{wid}/transactions-sign",
|
312
|
+
body: payload.to_json,
|
313
|
+
headers: { 'Content-Type' => 'application/json' })
|
314
|
+
end
|
315
|
+
|
245
316
|
# Get tx by id
|
246
317
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getTransaction
|
247
318
|
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.15
|
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-09-20 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.
|