cardano_wallet 0.1.0 → 0.1.1
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/README.md +15 -4
- data/dev +1 -0
- data/lib/cardano_wallet/base.rb +1 -1
- data/lib/cardano_wallet/misc.rb +2 -2
- data/lib/cardano_wallet/shelley.rb +34 -0
- data/lib/cardano_wallet/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bee737961a137776d1544ee46ea7e4866ef2dd78bb0a8de1808e34cd3b0f97b
|
4
|
+
data.tar.gz: cc36f525ddd0e0106ef22536797f7ee1ac3eba66ff6b587fe3074ad6c6ec16d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4a2a58cc93aa312ad88fda33ed5d34a83834bf38dbf4a4237ec0a923384341089fe942166bf7a93f4f58df22817255777f19237dfdabc5d94e5c44bf71a2c7
|
7
|
+
data.tar.gz: ab96b3386eaa674fdff19072f78e1d6016ef37d67f4904570a82ab453c771b89d1441e6fb03ec80b8d159300f43af7116fa7fe11e1bcf8845705d3755d32fd37
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
<a href="https://badge.fury.io/rb/cardano_wallet">
|
2
|
+
<img src="https://badge.fury.io/rb/cardano_wallet.svg" alt="Gem Version">
|
3
|
+
</a>
|
1
4
|
<a href="https://github.com/piotr-iohk/cardano-wallet-rb/releases">
|
2
5
|
<img src="https://img.shields.io/github/release/piotr-iohk/cardano-wallet-rb.svg" />
|
3
6
|
</a>
|
@@ -28,6 +31,12 @@ Or install it yourself as:
|
|
28
31
|
|
29
32
|
$ gem install cardano_wallet
|
30
33
|
|
34
|
+
## Documentation
|
35
|
+
|
36
|
+
For ruby doc see: https://rubydoc.info/gems/cardano_wallet.
|
37
|
+
|
38
|
+
For `cardano-wallet` REST Api see: https://input-output-hk.github.io/cardano-wallet/api/edge/.
|
39
|
+
|
31
40
|
## Usage
|
32
41
|
|
33
42
|
### Initialize
|
@@ -42,8 +51,10 @@ CW2 = CardanoWallet.new({port: 443,
|
|
42
51
|
protocol: "https",
|
43
52
|
cacert: "/root/ca.cert",
|
44
53
|
pem: "/root/client.pem"})
|
54
|
+
CW3 = CardanoWallet.new({url: "http://localhost:8090/v2"})
|
45
55
|
```
|
46
|
-
|
56
|
+
|
57
|
+
### Exercise
|
47
58
|
```ruby
|
48
59
|
CW = CardanoWallet.new
|
49
60
|
|
@@ -59,8 +70,8 @@ end
|
|
59
70
|
|
60
71
|
#Shelley
|
61
72
|
w = SHELLEY.wallets.create{name: "Wallet1",
|
62
|
-
|
63
|
-
|
73
|
+
mnemonic_sentence: %w[vintage poem topic machine hazard cement dune glimpse fix brief account badge mass silly business],
|
74
|
+
passphrase: "Secure Passphrase"}
|
64
75
|
|
65
76
|
SHELLEY.wallets.get(w['id'])
|
66
77
|
|
@@ -72,7 +83,7 @@ MISC.network.clock
|
|
72
83
|
PROXY.submit_external_transaction(File.new("/tmp/blob.bin").read)
|
73
84
|
```
|
74
85
|
|
75
|
-
Refer to documentation.
|
86
|
+
Refer to [documentation](https://rubydoc.info/gems/cardano_wallet) for more details.
|
76
87
|
|
77
88
|
## Development
|
78
89
|
|
data/dev
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
NETWORK=testnet WALLET=dev-master-byron NODE=master docker-compose $1
|
data/lib/cardano_wallet/base.rb
CHANGED
data/lib/cardano_wallet/misc.rb
CHANGED
@@ -38,8 +38,8 @@ module CardanoWallet
|
|
38
38
|
|
39
39
|
# Check network parameters
|
40
40
|
# @see https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/getNetworkParameters
|
41
|
-
def parameters
|
42
|
-
self.class.get("/network/parameters
|
41
|
+
def parameters
|
42
|
+
self.class.get("/network/parameters")
|
43
43
|
end
|
44
44
|
|
45
45
|
end
|
@@ -42,6 +42,12 @@ module CardanoWallet
|
|
42
42
|
StakePools.new @opt
|
43
43
|
end
|
44
44
|
|
45
|
+
# API for Migrations
|
46
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Migrations
|
47
|
+
def migrations
|
48
|
+
Migrations.new @opt
|
49
|
+
end
|
50
|
+
|
45
51
|
end
|
46
52
|
|
47
53
|
# API for Wallets
|
@@ -250,5 +256,33 @@ module CardanoWallet
|
|
250
256
|
self.class.get("/wallets/#{wid}/delegation-fees")
|
251
257
|
end
|
252
258
|
end
|
259
|
+
|
260
|
+
# Shelley migrations
|
261
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#tag/Migrations
|
262
|
+
class Migrations < Base
|
263
|
+
def initialize opt
|
264
|
+
super
|
265
|
+
end
|
266
|
+
|
267
|
+
# Calculate migration cost
|
268
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/getShelleyWalletMigrationInfo
|
269
|
+
def cost(wid)
|
270
|
+
self.class.get("/wallets/#{wid}/migrations")
|
271
|
+
end
|
272
|
+
|
273
|
+
# Migrate all funds from Shelley wallet.
|
274
|
+
# @see https://input-output-hk.github.io/cardano-wallet/api/#operation/migrateShelleyWallet
|
275
|
+
# @param wid [String] wallet id
|
276
|
+
# @param passphrase [String] wallet's passphrase
|
277
|
+
# @param [Array] array of addresses
|
278
|
+
def migrate(wid, passphrase, addresses)
|
279
|
+
self.class.post("/wallets/#{wid}/migrations",
|
280
|
+
:body => { :addresses => addresses,
|
281
|
+
:passphrase => passphrase
|
282
|
+
}.to_json,
|
283
|
+
:headers => { 'Content-Type' => 'application/json' } )
|
284
|
+
end
|
285
|
+
|
286
|
+
end
|
253
287
|
end
|
254
288
|
end
|
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.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Stachyra
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- bin/console
|
101
101
|
- bin/setup
|
102
102
|
- cardano_wallet.gemspec
|
103
|
+
- dev
|
103
104
|
- docker-compose.yml
|
104
105
|
- lib/cardano_wallet.rb
|
105
106
|
- lib/cardano_wallet/base.rb
|