cardano_wallet 0.3.22 → 0.3.25
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/Rakefile +6 -6
- data/docker-compose.yml +2 -2
- data/lib/cardano_wallet/misc.rb +13 -0
- data/lib/cardano_wallet/shared.rb +44 -1
- data/lib/cardano_wallet/shelley.rb +7 -3
- data/lib/cardano_wallet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a89888b8835a0dd36002a87747de771d664596fd414acb093dcf66d01b9d67
|
4
|
+
data.tar.gz: c1f776e1399798f21c65fa9b774085ad4eb52b8155216d6cbbac429dff6761ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f28a7f65d8b655a6992627309bd9bf41b1bfbbdf25c4e500058e36202b58b9f02c5142a984ec1d8f4efec38fff0b0fd365bd342d54481df8959e21b493942921
|
7
|
+
data.tar.gz: 86128a38a67f2396c18df3018539ddd1d363a18e8a60b9a87098085da28b77b17437b373f89cd66a896869ff37be6352e52f6331d63c6dea52b0c7f621bfc1d2
|
data/.github/workflows/tests.yml
CHANGED
@@ -25,7 +25,7 @@ jobs:
|
|
25
25
|
run: rubocop
|
26
26
|
|
27
27
|
- name: Get recent configs
|
28
|
-
run: bundle exec rake get_latest_configs[
|
28
|
+
run: bundle exec rake get_latest_configs[$NETWORK]
|
29
29
|
|
30
30
|
- name: Set up cardano-wallet and cardano-node
|
31
31
|
run: |
|
@@ -44,6 +44,6 @@ jobs:
|
|
44
44
|
env:
|
45
45
|
CI: true
|
46
46
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
47
|
-
NETWORK:
|
47
|
+
NETWORK: preview
|
48
48
|
WALLET: dev-master
|
49
|
-
NODE: 1.35.
|
49
|
+
NODE: 1.35.3
|
data/Rakefile
CHANGED
@@ -23,13 +23,13 @@ end
|
|
23
23
|
task :get_latest_configs, [:env] do |_, args|
|
24
24
|
puts "\n >> Get latest configs for '#{args[:env]}'"
|
25
25
|
|
26
|
-
base_url = 'https://
|
26
|
+
base_url = 'https://book.world.dev.cardano.org/environments'
|
27
27
|
env = args[:env]
|
28
28
|
path = File.join(Dir.pwd, 'configs')
|
29
29
|
mk_dir(path)
|
30
|
-
wget("#{base_url}/#{env}
|
31
|
-
wget("#{base_url}/#{env}
|
32
|
-
wget("#{base_url}/#{env}
|
33
|
-
wget("#{base_url}/#{env}
|
34
|
-
wget("#{base_url}/#{env}
|
30
|
+
wget("#{base_url}/#{env}/config.json", "#{path}/config.json")
|
31
|
+
wget("#{base_url}/#{env}/byron-genesis.json", "#{path}/byron-genesis.json")
|
32
|
+
wget("#{base_url}/#{env}/alonzo-genesis.json", "#{path}/alonzo-genesis.json")
|
33
|
+
wget("#{base_url}/#{env}/shelley-genesis.json", "#{path}/shelley-genesis.json")
|
34
|
+
wget("#{base_url}/#{env}/topology.json", "#{path}/topology.json")
|
35
35
|
end
|
data/docker-compose.yml
CHANGED
@@ -7,7 +7,7 @@ services:
|
|
7
7
|
- ~/node-db-nightly-docker:/data
|
8
8
|
- node-ipc:/ipc
|
9
9
|
- ${NODE_CONFIG_PATH}:/config
|
10
|
-
command: run --socket-path /ipc/node.socket --config /config
|
10
|
+
command: run --socket-path /ipc/node.socket --config /config/config.json --topology /config/topology.json --database-path /data
|
11
11
|
restart: on-failure
|
12
12
|
|
13
13
|
cardano-wallet:
|
@@ -18,7 +18,7 @@ services:
|
|
18
18
|
- ${NODE_CONFIG_PATH}:/config
|
19
19
|
ports:
|
20
20
|
- 8090:8090
|
21
|
-
command: serve --testnet /config
|
21
|
+
command: serve --testnet /config/byron-genesis.json --node-socket /ipc/node.socket --database /wallet-db --listen-address 0.0.0.0
|
22
22
|
restart: on-failure
|
23
23
|
|
24
24
|
volumes:
|
data/lib/cardano_wallet/misc.rb
CHANGED
@@ -31,6 +31,19 @@ module CardanoWallet
|
|
31
31
|
def settings
|
32
32
|
Settings.new @opt
|
33
33
|
end
|
34
|
+
|
35
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Node
|
36
|
+
def node
|
37
|
+
Node.new @opt
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Node
|
42
|
+
class Node < Base
|
43
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Node/paths/~1blocks~1latest~1header/get
|
44
|
+
def block_header
|
45
|
+
self.class.get('/blocks/latest/header')
|
46
|
+
end
|
34
47
|
end
|
35
48
|
|
36
49
|
# API for Network
|
@@ -45,13 +45,15 @@ module CardanoWallet
|
|
45
45
|
# @param mint [Array of Hashes] mint object
|
46
46
|
# @param delegations [Array of Hashes] delegations object
|
47
47
|
# @param validity_interval [Hash] validity_interval object
|
48
|
+
# @param encoding [String] output encoding ("base16" or "base64")
|
48
49
|
def construct(wid,
|
49
50
|
payments = nil,
|
50
51
|
withdrawal = nil,
|
51
52
|
metadata = nil,
|
52
53
|
delegations = nil,
|
53
54
|
mint = nil,
|
54
|
-
validity_interval = nil
|
55
|
+
validity_interval = nil,
|
56
|
+
encoding = nil)
|
55
57
|
payload = {}
|
56
58
|
payload[:payments] = payments if payments
|
57
59
|
payload[:withdrawal] = withdrawal if withdrawal
|
@@ -59,11 +61,52 @@ module CardanoWallet
|
|
59
61
|
payload[:mint_burn] = mint if mint
|
60
62
|
payload[:delegations] = delegations if delegations
|
61
63
|
payload[:validity_interval] = validity_interval if validity_interval
|
64
|
+
payload[:encoding] = encoding if encoding
|
62
65
|
|
63
66
|
self.class.post("/shared-wallets/#{wid}/transactions-construct",
|
64
67
|
body: payload.to_json,
|
65
68
|
headers: { 'Content-Type' => 'application/json' })
|
66
69
|
end
|
70
|
+
|
71
|
+
# Decode transaction
|
72
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/decodeSharedTransaction
|
73
|
+
# @param wid [String] source wallet id
|
74
|
+
# @param transaction [String] CBOR base64|base16 encoded transaction
|
75
|
+
def decode(wid, transaction)
|
76
|
+
payload = {}
|
77
|
+
payload[:transaction] = transaction
|
78
|
+
self.class.post("/shared-wallets/#{wid}/transactions-decode",
|
79
|
+
body: payload.to_json,
|
80
|
+
headers: { 'Content-Type' => 'application/json' })
|
81
|
+
end
|
82
|
+
|
83
|
+
# Sign transaction
|
84
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/signSharedTransaction
|
85
|
+
# @param wid [String] source wallet id
|
86
|
+
# @param passphrase [String] wallet's passphrase
|
87
|
+
# @param transaction [String] CBOR transaction data
|
88
|
+
# @param encoding [String] output encoding ("base16" or "base64")
|
89
|
+
def sign(wid, passphrase, transaction, encoding = nil)
|
90
|
+
payload = {
|
91
|
+
'passphrase' => passphrase,
|
92
|
+
'transaction' => transaction
|
93
|
+
}
|
94
|
+
payload[:encoding] = encoding if encoding
|
95
|
+
self.class.post("/wallets/#{wid}/transactions-sign",
|
96
|
+
body: payload.to_json,
|
97
|
+
headers: { 'Content-Type' => 'application/json' })
|
98
|
+
end
|
99
|
+
|
100
|
+
# Submit transaction
|
101
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/submitSharedTransaction
|
102
|
+
# @param wid [String] source wallet id
|
103
|
+
# @param transaction [String] CBOR transaction data
|
104
|
+
def submit(wid, transaction)
|
105
|
+
payload = { 'transaction' => transaction }
|
106
|
+
self.class.post("/wallets/#{wid}/transactions-submit",
|
107
|
+
body: payload.to_json,
|
108
|
+
headers: { 'Content-Type' => 'application/json' })
|
109
|
+
end
|
67
110
|
end
|
68
111
|
|
69
112
|
# API for Addresses
|
@@ -313,13 +313,15 @@ module CardanoWallet
|
|
313
313
|
# @param mint [Array of Hashes] mint object
|
314
314
|
# @param delegations [Array of Hashes] delegations object
|
315
315
|
# @param validity_interval [Hash] validity_interval object
|
316
|
+
# @param encoding [String] output encoding ("base16" or "base64")
|
316
317
|
def construct(wid,
|
317
318
|
payments = nil,
|
318
319
|
withdrawal = nil,
|
319
320
|
metadata = nil,
|
320
321
|
delegations = nil,
|
321
322
|
mint = nil,
|
322
|
-
validity_interval = nil
|
323
|
+
validity_interval = nil,
|
324
|
+
encoding = nil)
|
323
325
|
payload = {}
|
324
326
|
payload[:payments] = payments if payments
|
325
327
|
payload[:withdrawal] = withdrawal if withdrawal
|
@@ -327,6 +329,7 @@ module CardanoWallet
|
|
327
329
|
payload[:mint_burn] = mint if mint
|
328
330
|
payload[:delegations] = delegations if delegations
|
329
331
|
payload[:validity_interval] = validity_interval if validity_interval
|
332
|
+
payload[:encoding] = encoding if encoding
|
330
333
|
|
331
334
|
self.class.post("/wallets/#{wid}/transactions-construct",
|
332
335
|
body: payload.to_json,
|
@@ -338,12 +341,13 @@ module CardanoWallet
|
|
338
341
|
# @param wid [String] source wallet id
|
339
342
|
# @param passphrase [String] wallet's passphrase
|
340
343
|
# @param transaction [String] CBOR transaction data
|
341
|
-
|
344
|
+
# @param encoding [String] output encoding ("base16" or "base64")
|
345
|
+
def sign(wid, passphrase, transaction, encoding = nil)
|
342
346
|
payload = {
|
343
347
|
'passphrase' => passphrase,
|
344
348
|
'transaction' => transaction
|
345
349
|
}
|
346
|
-
|
350
|
+
payload[:encoding] = encoding if encoding
|
347
351
|
self.class.post("/wallets/#{wid}/transactions-sign",
|
348
352
|
body: payload.to_json,
|
349
353
|
headers: { 'Content-Type' => 'application/json' })
|
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.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Stachyra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|