cardano_wallet 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/nightly.yml +48 -3
- data/.github/workflows/tests.yml +25 -11
- data/cardano_wallet.gemspec +1 -1
- data/dev +1 -1
- data/docker-compose-shelley.yml +1 -2
- data/lib/cardano_wallet/byron.rb +36 -2
- data/lib/cardano_wallet/shelley.rb +46 -3
- data/lib/cardano_wallet/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0de7182a62723fefbe32712a08ac13765fe4507ac90969d3b752aff67fb05af
|
4
|
+
data.tar.gz: e6346e28024ce715b14ab9964634f4dc5bf80f7d63526bae0a6c4bc4d2bce22f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2e7311a7a4ef549aae1f9fb571f1ccc7e84800b9ffe10b80f08b23586a3e2cadd73aefb3215ad1bef28e5f8f09198323fafb01a4d0f3053770dd27d087f1281
|
7
|
+
data.tar.gz: 3e4df4399289e3772061e4e8e68cae38a58308cbfb837b940af4736e36b1052884791cc641811a3b987307f75075e8df306bd0778683e83acf1479edd760a381
|
@@ -3,6 +3,16 @@ name: Nightly
|
|
3
3
|
on:
|
4
4
|
schedule:
|
5
5
|
- cron: "0 23 * * *"
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
nodeTag:
|
9
|
+
description: 'Node tag (docker)'
|
10
|
+
required: true
|
11
|
+
default: '1.24.2'
|
12
|
+
walletTag:
|
13
|
+
description: 'Wallet tag (docker)'
|
14
|
+
required: true
|
15
|
+
default: 'dev-master-shelley'
|
6
16
|
|
7
17
|
jobs:
|
8
18
|
test:
|
@@ -11,19 +21,54 @@ jobs:
|
|
11
21
|
|
12
22
|
steps:
|
13
23
|
- uses: actions/checkout@v2
|
14
|
-
|
15
|
-
|
24
|
+
|
25
|
+
- name: Cache node db
|
26
|
+
id: cache
|
27
|
+
uses: actions/cache@v2
|
28
|
+
with:
|
29
|
+
path: ~/node-db-nightly-docker
|
30
|
+
key: ${{ runner.os }}-node-db-nightly-docker-tests-${{ hashFiles('**/protocolMagicId') }}
|
31
|
+
|
32
|
+
- name: Set up cardano-wallet and cardano-node MANUAL
|
33
|
+
if: ${{ github.event.inputs.walletTag != '' && github.event.inputs.nodeTag != ''}}
|
34
|
+
env:
|
35
|
+
WALLET: ${{ github.event.inputs.walletTag }}
|
36
|
+
NODE: ${{ github.event.inputs.nodeTag }}
|
37
|
+
run: |
|
38
|
+
echo "Wallet: $WALLET"
|
39
|
+
echo "Node: $NODE"
|
40
|
+
NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
41
|
+
docker run --rm inputoutput/cardano-wallet:$WALLET version
|
42
|
+
docker run --rm inputoutput/cardano-node:$NODE version
|
43
|
+
ls ~/node-db-nightly-docker
|
44
|
+
|
45
|
+
- name: Set up cardano-wallet and cardano-node NIGHTLY
|
46
|
+
if: ${{ github.event.inputs.walletTag == '' && github.event.inputs.nodeTag == ''}}
|
47
|
+
run: |
|
48
|
+
echo "Wallet: $WALLET"
|
49
|
+
echo "Node: $NODE"
|
50
|
+
NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
51
|
+
docker run --rm inputoutput/cardano-wallet:$WALLET version
|
52
|
+
docker run --rm inputoutput/cardano-node:$NODE version
|
53
|
+
ls ~/node-db-nightly-docker
|
54
|
+
|
16
55
|
- name: Set up Ruby
|
17
56
|
uses: ruby/setup-ruby@v1
|
57
|
+
|
18
58
|
- name: Install dependencies
|
19
59
|
run: bundle install
|
60
|
+
|
20
61
|
- name: Wait until node is synced
|
21
62
|
run: bundle exec rake wait_until_node_synced
|
63
|
+
|
22
64
|
- name: Run all tests
|
23
65
|
run: bundle exec rspec .
|
66
|
+
|
67
|
+
- name: Stop docker-compose
|
68
|
+
run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml down
|
24
69
|
env:
|
25
70
|
CI: true
|
26
71
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
27
72
|
NETWORK: testnet
|
28
73
|
WALLET: dev-master-shelley
|
29
|
-
NODE: 1.
|
74
|
+
NODE: 1.25.1
|
data/.github/workflows/tests.yml
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
2
|
-
# They are provided by a third-party and are governed by
|
3
|
-
# separate terms of service, privacy policy, and support
|
4
|
-
# documentation.
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
-
|
8
1
|
name: Tests
|
9
2
|
|
10
3
|
on:
|
@@ -12,6 +5,7 @@ on:
|
|
12
5
|
branches: [ master ]
|
13
6
|
pull_request:
|
14
7
|
branches: [ master ]
|
8
|
+
workflow_dispatch:
|
15
9
|
|
16
10
|
jobs:
|
17
11
|
test:
|
@@ -20,17 +14,37 @@ jobs:
|
|
20
14
|
|
21
15
|
steps:
|
22
16
|
- uses: actions/checkout@v2
|
23
|
-
|
24
|
-
|
17
|
+
|
18
|
+
- name: Cache node db
|
19
|
+
id: cache
|
20
|
+
uses: actions/cache@v2
|
21
|
+
with:
|
22
|
+
path: ~/node-db-nightly-docker
|
23
|
+
key: ${{ runner.os }}-node-db-tests-docker-${{ hashFiles('**/protocolMagicId') }}
|
24
|
+
|
25
|
+
- name: Set up cardano-wallet and cardano-node
|
26
|
+
run: |
|
27
|
+
echo "Wallet: $WALLET"
|
28
|
+
echo "Node: $NODE"
|
29
|
+
NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml up --detach
|
30
|
+
docker run --rm inputoutput/cardano-wallet:$WALLET version
|
31
|
+
docker run --rm inputoutput/cardano-node:$NODE version
|
32
|
+
ls ~/node-db-nightly-docker
|
33
|
+
|
25
34
|
- name: Set up Ruby
|
26
35
|
uses: ruby/setup-ruby@v1
|
36
|
+
|
27
37
|
- name: Install dependencies
|
28
38
|
run: bundle install
|
39
|
+
|
29
40
|
- name: Run all tests except nighlty
|
30
|
-
run:
|
41
|
+
run: rspec . -t ~nightly
|
42
|
+
|
43
|
+
- name: Stop docker-compose
|
44
|
+
run: NODE_CONFIG_PATH=`pwd`/spec/testnet docker-compose -f docker-compose-shelley.yml down
|
31
45
|
env:
|
32
46
|
CI: true
|
33
47
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
34
48
|
NETWORK: testnet
|
35
49
|
WALLET: dev-master-shelley
|
36
|
-
NODE: 1.
|
50
|
+
NODE: 1.25.1
|
data/cardano_wallet.gemspec
CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'rake', '~> 12.3'
|
33
33
|
spec.add_development_dependency 'rspec', '~> 3.7'
|
34
34
|
spec.add_development_dependency 'bip_mnemonic', '~> 0.0.4'
|
35
|
-
spec.add_development_dependency 'codecov', '
|
35
|
+
spec.add_development_dependency 'codecov', '0.2.8'
|
36
36
|
spec.add_development_dependency 'simplecov'
|
37
37
|
|
38
38
|
end
|
data/dev
CHANGED
data/docker-compose-shelley.yml
CHANGED
@@ -4,7 +4,7 @@ services:
|
|
4
4
|
cardano-node:
|
5
5
|
image: inputoutput/cardano-node:${NODE}
|
6
6
|
volumes:
|
7
|
-
- node-db:/data
|
7
|
+
- ~/node-db-nightly-docker:/data
|
8
8
|
- node-ipc:/ipc
|
9
9
|
- ${NODE_CONFIG_PATH}:/config
|
10
10
|
command: run --socket-path /ipc/node.socket --config /config/${NETWORK}-config.json --topology /config/${NETWORK}-topology.json --database-path /data
|
@@ -22,6 +22,5 @@ services:
|
|
22
22
|
restart: on-failure
|
23
23
|
|
24
24
|
volumes:
|
25
|
-
node-db:
|
26
25
|
wallet-shelley-db:
|
27
26
|
node-ipc:
|
data/lib/cardano_wallet/byron.rb
CHANGED
@@ -39,6 +39,29 @@ module CardanoWallet
|
|
39
39
|
def migrations
|
40
40
|
Migrations.new @opt
|
41
41
|
end
|
42
|
+
|
43
|
+
# API for Assets
|
44
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Byron-Assets
|
45
|
+
def assets
|
46
|
+
Assets.new @opt
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class Assets < Base
|
51
|
+
def initialize opt
|
52
|
+
super
|
53
|
+
end
|
54
|
+
|
55
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listByronAssets
|
56
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronAsset
|
57
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getByronAssetDefault
|
58
|
+
def get(wid, policy_id = nil, asset_name = nil)
|
59
|
+
ep = "/byron-wallets/#{wid}/assets"
|
60
|
+
ep += "/#{policy_id}" if policy_id
|
61
|
+
ep += "/#{asset_name}" if asset_name
|
62
|
+
self.class.get(ep)
|
63
|
+
end
|
64
|
+
|
42
65
|
end
|
43
66
|
|
44
67
|
# Byron wallets
|
@@ -221,8 +244,14 @@ module CardanoWallet
|
|
221
244
|
#
|
222
245
|
# @example
|
223
246
|
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}])
|
247
|
+
# create(wid, passphrase, [{ "address": "addr1..", "amount": { "quantity": 42000000, "unit": "lovelace" }, "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ])
|
248
|
+
|
224
249
|
def create(wid, passphrase, payments)
|
225
|
-
|
250
|
+
if payments.any?{|p| p.has_key?("address".to_sym) || p.has_key?("address")}
|
251
|
+
payments_formatted = payments
|
252
|
+
else
|
253
|
+
payments_formatted = Utils.format_payments(payments)
|
254
|
+
end
|
226
255
|
self.class.post("/byron-wallets/#{wid}/transactions",
|
227
256
|
:body => { :payments => payments_formatted,
|
228
257
|
:passphrase => passphrase
|
@@ -235,8 +264,13 @@ module CardanoWallet
|
|
235
264
|
#
|
236
265
|
# @example
|
237
266
|
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}])
|
267
|
+
# payment_fees(wid, [{ "address": "addr1..", "amount": { "quantity": 42000000, "unit": "lovelace" }, "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ])
|
238
268
|
def payment_fees(wid, payments)
|
239
|
-
|
269
|
+
if payments.any?{|p| p.has_key?("address".to_sym) || p.has_key?("address")}
|
270
|
+
payments_formatted = payments
|
271
|
+
else
|
272
|
+
payments_formatted = Utils.format_payments(payments)
|
273
|
+
end
|
240
274
|
self.class.post("/byron-wallets/#{wid}/payment-fees",
|
241
275
|
:body => { :payments => payments_formatted }.to_json,
|
242
276
|
:headers => { 'Content-Type' => 'application/json' } )
|
@@ -54,6 +54,29 @@ module CardanoWallet
|
|
54
54
|
Keys.new @opt
|
55
55
|
end
|
56
56
|
|
57
|
+
# API for Assets
|
58
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#tag/Assets
|
59
|
+
def assets
|
60
|
+
Assets.new @opt
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
class Assets < Base
|
66
|
+
def initialize opt
|
67
|
+
super
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/listAssets
|
71
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAsset
|
72
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getAssetDefault
|
73
|
+
def get(wid, policy_id = nil, asset_name = nil)
|
74
|
+
ep = "/wallets/#{wid}/assets"
|
75
|
+
ep += "/#{policy_id}" if policy_id
|
76
|
+
ep += "/#{asset_name}" if asset_name
|
77
|
+
self.class.get(ep)
|
78
|
+
end
|
79
|
+
|
57
80
|
end
|
58
81
|
|
59
82
|
class Keys < Base
|
@@ -77,6 +100,15 @@ module CardanoWallet
|
|
77
100
|
self.class.get("/wallets/#{wid}/keys/#{role}/#{index}")
|
78
101
|
end
|
79
102
|
|
103
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/postAccountKey
|
104
|
+
def create_acc_public_key(wid, index, pass, extended)
|
105
|
+
payload = { passphrase: pass, extended: extended }
|
106
|
+
self.class.post("/wallets/#{wid}/keys/#{index}",
|
107
|
+
:body => payload.to_json,
|
108
|
+
:headers => { 'Content-Type' => 'application/json' }
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
80
112
|
end
|
81
113
|
|
82
114
|
# API for Wallets
|
@@ -236,15 +268,20 @@ module CardanoWallet
|
|
236
268
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction
|
237
269
|
# @param wid [String] source wallet id
|
238
270
|
# @param passphrase [String] source wallet's passphrase
|
239
|
-
# @param payments [Array of Hashes]
|
271
|
+
# @param payments [Array of Hashes] address / amount list or full payments payload with assets
|
240
272
|
# @param withdrawal [String or Array] 'self' or mnemonic sentence
|
241
273
|
# @param metadata [Hash] special metadata JSON subset format (cf: https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/postTransaction)
|
242
274
|
# @param ttl [Int] transaction's time-to-live in seconds
|
243
275
|
#
|
244
276
|
# @example
|
245
277
|
# create(wid, passphrase, [{addr1: 1000000}, {addr2: 1000000}], 'self', {"1": "abc"}, ttl = 10)
|
278
|
+
# create(wid, passphrase, [{ "address": "addr1..", "amount": { "quantity": 42000000, "unit": "lovelace" }, "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ], 'self', {"1": "abc"}, ttl = 10)
|
246
279
|
def create(wid, passphrase, payments, withdrawal = nil, metadata = nil, ttl = nil)
|
247
|
-
|
280
|
+
if payments.any?{|p| p.has_key?("address".to_sym) || p.has_key?("address")}
|
281
|
+
payments_formatted = payments
|
282
|
+
else
|
283
|
+
payments_formatted = Utils.format_payments(payments)
|
284
|
+
end
|
248
285
|
payload = { :payments => payments_formatted,
|
249
286
|
:passphrase => passphrase
|
250
287
|
}
|
@@ -262,8 +299,14 @@ module CardanoWallet
|
|
262
299
|
#
|
263
300
|
# @example
|
264
301
|
# payment_fees(wid, [{addr1: 1000000}, {addr2: 1000000}], {"1": "abc"}, ttl = 10)
|
302
|
+
# payment_fees(wid, [{ "address": "addr1..", "amount": { "quantity": 42000000, "unit": "lovelace" }, "assets": [{"policy_id": "pid", "asset_name": "name", "quantity": 0 } ] } ], {"1": "abc"}, ttl = 10)
|
265
303
|
def payment_fees(wid, payments, withdrawal = nil, metadata = nil, ttl = nil)
|
266
|
-
|
304
|
+
if payments.any?{|p| p.has_key?("address".to_sym) || p.has_key?("address")}
|
305
|
+
payments_formatted = payments
|
306
|
+
else
|
307
|
+
payments_formatted = Utils.format_payments(payments)
|
308
|
+
end
|
309
|
+
|
267
310
|
payload = { :payments => payments_formatted }
|
268
311
|
|
269
312
|
payload[:withdrawal] = withdrawal if withdrawal
|
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Stachyra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: codecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.2.8
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.2.8
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.2.3
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: Ruby wrapper over cardano-wallet.
|