mobius-client 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mobius/client/blockchain/add_cosigner.rb +32 -15
- data/lib/mobius/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 37f31bfca5afe7e6d46ff5d0f8b9991a6e145d0871bb4af521922858b1e9c902
|
4
|
+
data.tar.gz: 1deea8ff27c033a34b78700bf209fb1ec49bf94f66c461e64325ac6d243b74ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49fca8065b821688c16d91d62793b178ec201082f348306d69717f00e5e169b1ce8ba67a8c877442332937206a2daf8caa4c8645feb6532dc842ca606470ba46
|
7
|
+
data.tar.gz: d321ee0e241b23b661a8a2bdab59390d66344ee8343a66edb7cb7685867629b6d54c9fe756b7c25d63ab69f5fa038c192dd82e71e4f498498a1cae64b19a5dce
|
@@ -3,20 +3,23 @@ class Mobius::Client::Blockchain::AddCosigner
|
|
3
3
|
extend Dry::Initializer
|
4
4
|
extend ConstructorShortcut[:call]
|
5
5
|
|
6
|
-
# @!method initialize(keypair, cosigner,
|
6
|
+
# @!method initialize(keypair, cosigner, cosigner_weight:, master_weight:)
|
7
7
|
# @param keypair [Stellar::Keypair] Account keypair
|
8
8
|
# @param cosigner_keypair [Stellar::Keypair] Cosigner account keypair
|
9
|
-
# @param
|
9
|
+
# @param cosigner_weight [Integer] Cosigner weight, default: 1
|
10
|
+
# @param master_weight [Integer] Master key weight, default: 10
|
10
11
|
# @!scope instance
|
11
12
|
param :keypair
|
12
13
|
param :cosigner_keypair
|
13
|
-
param :
|
14
|
+
param :cosigner_weight, default: -> { 1 } # TODO: should be an option too
|
15
|
+
option :master_weight, default: -> { 10 }
|
14
16
|
|
15
|
-
# @!method call(keypair, cosigner,
|
17
|
+
# @!method call(keypair, cosigner, cosigner_weight:, master_weight:)
|
16
18
|
# Executes an operation.
|
17
19
|
# @param keypair [Stellar::Keypair] Account keypair
|
18
20
|
# @param cosigner_keypair [Stellar::Keypair] Cosigner account keypair
|
19
|
-
# @param
|
21
|
+
# @param cosigner_weight[Integer] Cosigner weight, default: 1
|
22
|
+
# @param master_weight [Integer] Master key weight, default: 10
|
20
23
|
# @!scope class
|
21
24
|
|
22
25
|
# Executes an operation
|
@@ -30,22 +33,36 @@ class Mobius::Client::Blockchain::AddCosigner
|
|
30
33
|
|
31
34
|
private
|
32
35
|
|
33
|
-
# TODO: weight must be params
|
34
36
|
def tx
|
35
|
-
Stellar::Transaction.
|
37
|
+
Stellar::Transaction.for_account(
|
36
38
|
account: keypair,
|
37
|
-
sequence: account.next_sequence_value
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
sequence: account.next_sequence_value
|
40
|
+
).tap do |txn|
|
41
|
+
txn.operations << add_cosigner_op
|
42
|
+
txn.operations << set_thresholds_op
|
43
|
+
txn.fee *= txn.operations.size
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def add_cosigner_op
|
48
|
+
Stellar::Operation.set_options(
|
49
|
+
signer: cosigner,
|
50
|
+
master_weight: master_weight
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_thresholds_op
|
55
|
+
Stellar::Operation.set_options(
|
56
|
+
high_threshold: master_weight,
|
57
|
+
med_threshold: cosigner_weight,
|
58
|
+
low_threshold: cosigner_weight
|
43
59
|
)
|
44
60
|
end
|
45
61
|
|
46
|
-
def
|
62
|
+
def cosigner
|
47
63
|
Stellar::Signer.new(
|
48
|
-
key: Stellar::SignerKey.new(:signer_key_type_ed25519, cosigner_keypair.raw_public_key),
|
64
|
+
key: Stellar::SignerKey.new(:signer_key_type_ed25519, cosigner_keypair.raw_public_key),
|
65
|
+
weight: cosigner_weight
|
49
66
|
)
|
50
67
|
end
|
51
68
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mobius-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -392,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
392
392
|
version: '0'
|
393
393
|
requirements: []
|
394
394
|
rubyforge_project:
|
395
|
-
rubygems_version: 2.6
|
395
|
+
rubygems_version: 2.7.6
|
396
396
|
signing_key:
|
397
397
|
specification_version: 4
|
398
398
|
summary: Mobius Ruby Client
|