arkecosystem-crypto 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arkecosystem/crypto.rb +35 -42
- data/lib/arkecosystem/crypto/{identity → identities}/address.rb +10 -4
- data/lib/arkecosystem/crypto/identities/private_key.rb +18 -0
- data/lib/arkecosystem/crypto/identities/public_key.rb +18 -0
- data/lib/arkecosystem/crypto/{identity → identities}/wif.rb +4 -4
- data/lib/arkecosystem/crypto/networks/devnet.rb +1 -5
- data/lib/arkecosystem/crypto/networks/mainnet.rb +1 -5
- data/lib/arkecosystem/crypto/networks/testnet.rb +1 -5
- data/lib/arkecosystem/crypto/transactions/builder/base.rb +52 -0
- data/lib/arkecosystem/crypto/transactions/builder/delegate_registration.rb +34 -0
- data/lib/arkecosystem/crypto/transactions/builder/multi_signature_registration.rb +43 -0
- data/lib/arkecosystem/crypto/transactions/builder/second_signature_registration.rb +28 -0
- data/lib/arkecosystem/crypto/transactions/builder/transfer.rb +33 -0
- data/lib/arkecosystem/crypto/transactions/builder/vote.rb +29 -0
- data/lib/arkecosystem/crypto/transactions/deserializer.rb +98 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/base.rb +17 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/delegate_registration.rb +24 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/delegate_resignation.rb +14 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/ipfs.rb +20 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/multi_payment.rb +40 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/multi_signature_registration.rb +34 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/second_signature_registration.rb +20 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/timelock_transfer.rb +21 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/transfer.rb +21 -0
- data/lib/arkecosystem/crypto/transactions/deserializers/vote.rb +33 -0
- data/lib/arkecosystem/crypto/transactions/serializer.rb +86 -0
- data/lib/arkecosystem/crypto/transactions/serializers/base.rb +15 -0
- data/lib/arkecosystem/crypto/transactions/serializers/delegate_registration.rb +19 -0
- data/lib/arkecosystem/crypto/transactions/serializers/delegate_resignation.rb +14 -0
- data/lib/arkecosystem/crypto/transactions/serializers/ipfs.rb +19 -0
- data/lib/arkecosystem/crypto/transactions/serializers/multi_payment.rb +25 -0
- data/lib/arkecosystem/crypto/transactions/serializers/multi_signature_registration.rb +33 -0
- data/lib/arkecosystem/crypto/transactions/serializers/second_signature_registration.rb +16 -0
- data/lib/arkecosystem/crypto/transactions/serializers/timelock_transfer.rb +23 -0
- data/lib/arkecosystem/crypto/transactions/serializers/transfer.rb +22 -0
- data/lib/arkecosystem/crypto/transactions/serializers/vote.rb +25 -0
- data/lib/arkecosystem/crypto/transactions/transaction.rb +198 -0
- data/lib/arkecosystem/crypto/utils/message.rb +42 -0
- data/lib/arkecosystem/crypto/utils/slot.rb +23 -0
- data/lib/arkecosystem/crypto/version.rb +1 -1
- metadata +67 -39
- data/lib/arkecosystem/crypto/builder/delegate_registration.rb +0 -33
- data/lib/arkecosystem/crypto/builder/multi_signature_registration.rb +0 -45
- data/lib/arkecosystem/crypto/builder/second_signature_registration.rb +0 -27
- data/lib/arkecosystem/crypto/builder/transaction.rb +0 -109
- data/lib/arkecosystem/crypto/builder/transfer.rb +0 -32
- data/lib/arkecosystem/crypto/builder/vote.rb +0 -28
- data/lib/arkecosystem/crypto/crypto.rb +0 -144
- data/lib/arkecosystem/crypto/deserialiser.rb +0 -94
- data/lib/arkecosystem/crypto/deserialisers/base.rb +0 -15
- data/lib/arkecosystem/crypto/deserialisers/delegate_registration.rb +0 -22
- data/lib/arkecosystem/crypto/deserialisers/delegate_resignation.rb +0 -12
- data/lib/arkecosystem/crypto/deserialisers/ipfs.rb +0 -18
- data/lib/arkecosystem/crypto/deserialisers/multi_payment.rb +0 -38
- data/lib/arkecosystem/crypto/deserialisers/multi_signature_registration.rb +0 -32
- data/lib/arkecosystem/crypto/deserialisers/second_signature_registration.rb +0 -18
- data/lib/arkecosystem/crypto/deserialisers/timelock_transfer.rb +0 -19
- data/lib/arkecosystem/crypto/deserialisers/transfer.rb +0 -18
- data/lib/arkecosystem/crypto/deserialisers/vote.rb +0 -31
- data/lib/arkecosystem/crypto/identity/private_key.rb +0 -14
- data/lib/arkecosystem/crypto/identity/public_key.rb +0 -18
- data/lib/arkecosystem/crypto/message.rb +0 -42
- data/lib/arkecosystem/crypto/models/transaction.rb +0 -16
- data/lib/arkecosystem/crypto/serialiser.rb +0 -84
- data/lib/arkecosystem/crypto/serialisers/base.rb +0 -13
- data/lib/arkecosystem/crypto/serialisers/delegate_registration.rb +0 -17
- data/lib/arkecosystem/crypto/serialisers/delegate_resignation.rb +0 -12
- data/lib/arkecosystem/crypto/serialisers/ipfs.rb +0 -17
- data/lib/arkecosystem/crypto/serialisers/multi_payment.rb +0 -23
- data/lib/arkecosystem/crypto/serialisers/multi_signature_registration.rb +0 -31
- data/lib/arkecosystem/crypto/serialisers/second_signature_registration.rb +0 -14
- data/lib/arkecosystem/crypto/serialisers/timelock_transfer.rb +0 -21
- data/lib/arkecosystem/crypto/serialisers/transfer.rb +0 -20
- data/lib/arkecosystem/crypto/serialisers/vote.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd066f7d7ee4b19bfc41e6015e3ac4ad5d328177619cb1fca893eee07b3c77a2
|
4
|
+
data.tar.gz: f5adc3875d4ef53dadd8f5a661ce7bc3774b0096dfe95bbca01c3573974aab8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42c940cfe7fb6171c01fbc87637518df3bf649ae288293b28cd6778d963462aeb18322a13ccdc5fa6d4def7663a98d05a09f8acda42fcb7bb77cd0bba53b4995
|
7
|
+
data.tar.gz: 8760434dd8193b858f0f615001ed465fda9182475a3bc834ffc1ac0aab79803dccd4439117d8874a6feab431b79e33a6d0038599ea6a39a5b1d33f5c5bd43552
|
data/lib/arkecosystem/crypto.rb
CHANGED
@@ -1,49 +1,42 @@
|
|
1
|
-
require 'arkecosystem/crypto/crypto'
|
2
|
-
require 'arkecosystem/crypto/message'
|
3
|
-
|
4
|
-
require 'arkecosystem/crypto/builder/delegate_registration'
|
5
|
-
require 'arkecosystem/crypto/builder/multi_signature_registration'
|
6
|
-
require 'arkecosystem/crypto/builder/second_signature_registration'
|
7
|
-
require 'arkecosystem/crypto/builder/transfer'
|
8
|
-
require 'arkecosystem/crypto/builder/vote'
|
9
|
-
|
10
1
|
require 'arkecosystem/crypto/configuration/fee'
|
11
2
|
require 'arkecosystem/crypto/configuration/network'
|
12
|
-
|
13
3
|
require 'arkecosystem/crypto/enums/fees'
|
14
4
|
require 'arkecosystem/crypto/enums/types'
|
15
|
-
|
16
|
-
require 'arkecosystem/crypto/
|
17
|
-
require 'arkecosystem/crypto/
|
18
|
-
require 'arkecosystem/crypto/
|
19
|
-
require 'arkecosystem/crypto/identity/wif'
|
20
|
-
|
21
|
-
require 'arkecosystem/crypto/models/transaction'
|
22
|
-
|
5
|
+
require 'arkecosystem/crypto/identities/address'
|
6
|
+
require 'arkecosystem/crypto/identities/private_key'
|
7
|
+
require 'arkecosystem/crypto/identities/public_key'
|
8
|
+
require 'arkecosystem/crypto/identities/wif'
|
23
9
|
require 'arkecosystem/crypto/networks/devnet'
|
24
10
|
require 'arkecosystem/crypto/networks/mainnet'
|
25
11
|
require 'arkecosystem/crypto/networks/testnet'
|
26
|
-
|
27
|
-
require 'arkecosystem/crypto/
|
28
|
-
require 'arkecosystem/crypto/
|
29
|
-
require 'arkecosystem/crypto/
|
30
|
-
require 'arkecosystem/crypto/
|
31
|
-
require 'arkecosystem/crypto/
|
32
|
-
require 'arkecosystem/crypto/
|
33
|
-
require 'arkecosystem/crypto/
|
34
|
-
require 'arkecosystem/crypto/
|
35
|
-
require 'arkecosystem/crypto/
|
36
|
-
require 'arkecosystem/crypto/
|
37
|
-
require 'arkecosystem/crypto/
|
38
|
-
|
39
|
-
require 'arkecosystem/crypto/
|
40
|
-
require 'arkecosystem/crypto/
|
41
|
-
require 'arkecosystem/crypto/
|
42
|
-
require 'arkecosystem/crypto/
|
43
|
-
require 'arkecosystem/crypto/
|
44
|
-
require 'arkecosystem/crypto/
|
45
|
-
require 'arkecosystem/crypto/
|
46
|
-
require 'arkecosystem/crypto/
|
47
|
-
require 'arkecosystem/crypto/
|
48
|
-
require 'arkecosystem/crypto/
|
49
|
-
require 'arkecosystem/crypto/
|
12
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
13
|
+
require 'arkecosystem/crypto/transactions/builder/delegate_registration'
|
14
|
+
require 'arkecosystem/crypto/transactions/builder/multi_signature_registration'
|
15
|
+
require 'arkecosystem/crypto/transactions/builder/second_signature_registration'
|
16
|
+
require 'arkecosystem/crypto/transactions/builder/transfer'
|
17
|
+
require 'arkecosystem/crypto/transactions/builder/vote'
|
18
|
+
require 'arkecosystem/crypto/transactions/deserializer'
|
19
|
+
require 'arkecosystem/crypto/transactions/deserializers/base'
|
20
|
+
require 'arkecosystem/crypto/transactions/deserializers/delegate_registration'
|
21
|
+
require 'arkecosystem/crypto/transactions/deserializers/delegate_resignation'
|
22
|
+
require 'arkecosystem/crypto/transactions/deserializers/ipfs'
|
23
|
+
require 'arkecosystem/crypto/transactions/deserializers/multi_payment'
|
24
|
+
require 'arkecosystem/crypto/transactions/deserializers/multi_signature_registration'
|
25
|
+
require 'arkecosystem/crypto/transactions/deserializers/second_signature_registration'
|
26
|
+
require 'arkecosystem/crypto/transactions/deserializers/timelock_transfer'
|
27
|
+
require 'arkecosystem/crypto/transactions/deserializers/transfer'
|
28
|
+
require 'arkecosystem/crypto/transactions/deserializers/vote'
|
29
|
+
require 'arkecosystem/crypto/transactions/serializer'
|
30
|
+
require 'arkecosystem/crypto/transactions/serializers/base'
|
31
|
+
require 'arkecosystem/crypto/transactions/serializers/delegate_registration'
|
32
|
+
require 'arkecosystem/crypto/transactions/serializers/delegate_resignation'
|
33
|
+
require 'arkecosystem/crypto/transactions/serializers/ipfs'
|
34
|
+
require 'arkecosystem/crypto/transactions/serializers/multi_payment'
|
35
|
+
require 'arkecosystem/crypto/transactions/serializers/multi_signature_registration'
|
36
|
+
require 'arkecosystem/crypto/transactions/serializers/second_signature_registration'
|
37
|
+
require 'arkecosystem/crypto/transactions/serializers/timelock_transfer'
|
38
|
+
require 'arkecosystem/crypto/transactions/serializers/transfer'
|
39
|
+
require 'arkecosystem/crypto/transactions/serializers/vote'
|
40
|
+
require 'arkecosystem/crypto/transactions/transaction'
|
41
|
+
require 'arkecosystem/crypto/utils/message'
|
42
|
+
require 'arkecosystem/crypto/utils/slot'
|
@@ -3,11 +3,11 @@ require 'arkecosystem/crypto/configuration/network'
|
|
3
3
|
|
4
4
|
module ArkEcosystem
|
5
5
|
module Crypto
|
6
|
-
module
|
6
|
+
module Identities
|
7
7
|
# The identity utility for an address.
|
8
8
|
class Address
|
9
|
-
def self.
|
10
|
-
private_key = PrivateKey.
|
9
|
+
def self.from_passphrase(passphrase, network = nil)
|
10
|
+
private_key = PrivateKey.from_passphrase(passphrase)
|
11
11
|
|
12
12
|
from_private_key(private_key, network)
|
13
13
|
end
|
@@ -23,7 +23,13 @@ module ArkEcosystem
|
|
23
23
|
|
24
24
|
public_key = Digest::RMD160.digest(private_key.public_key)
|
25
25
|
|
26
|
-
|
26
|
+
version = if network.is_a? Integer
|
27
|
+
network
|
28
|
+
else
|
29
|
+
network.version
|
30
|
+
end
|
31
|
+
|
32
|
+
BTC::Base58.base58check_from_data([version].pack('c') + public_key)
|
27
33
|
end
|
28
34
|
|
29
35
|
def self.validate(address)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'btcruby'
|
2
|
+
|
3
|
+
module ArkEcosystem
|
4
|
+
module Crypto
|
5
|
+
module Identities
|
6
|
+
# The identity utility for a private key.
|
7
|
+
class PrivateKey
|
8
|
+
def self.from_passphrase(passphrase)
|
9
|
+
BTC::Key.new(private_key: Digest::SHA256.digest(passphrase))
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.from_hex(private_key)
|
13
|
+
BTC::Key.new(private_key: BTC.from_hex(private_key))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'btcruby'
|
2
|
+
|
3
|
+
module ArkEcosystem
|
4
|
+
module Crypto
|
5
|
+
module Identities
|
6
|
+
# The identity utility for a public key.
|
7
|
+
class PublicKey
|
8
|
+
def self.from_passphrase(passphrase)
|
9
|
+
PrivateKey.from_passphrase(passphrase).public_key
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.from_hex(public_key)
|
13
|
+
BTC::Key.new(public_key: BTC.from_hex(public_key))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -2,16 +2,16 @@ require 'btcruby'
|
|
2
2
|
|
3
3
|
module ArkEcosystem
|
4
4
|
module Crypto
|
5
|
-
module
|
5
|
+
module Identities
|
6
6
|
# The identity utility for a WIF.
|
7
7
|
class WIF
|
8
|
-
def self.
|
8
|
+
def self.from_passphrase(passphrase, network = nil)
|
9
9
|
network ||= ArkEcosystem::Crypto::Configuration::Network.get
|
10
10
|
|
11
|
-
|
11
|
+
passphrase = Digest::SHA256.digest(passphrase)
|
12
12
|
|
13
13
|
seed = [network.wif].pack('C*')
|
14
|
-
seed <<
|
14
|
+
seed << passphrase
|
15
15
|
seed << [0x01].pack('C*')
|
16
16
|
|
17
17
|
BTC::Base58.base58check_from_data(seed)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'time'
|
2
|
+
require 'arkecosystem/crypto/identities/private_key'
|
3
|
+
require 'arkecosystem/crypto/configuration/fee'
|
4
|
+
require 'arkecosystem/crypto/configuration/network'
|
5
|
+
require 'btcruby/base58'
|
6
|
+
require 'deep_hash_transform'
|
7
|
+
|
8
|
+
module ArkEcosystem
|
9
|
+
module Crypto
|
10
|
+
module Transactions
|
11
|
+
module Builder
|
12
|
+
# The base builder for transactions.
|
13
|
+
class Base
|
14
|
+
def initialize
|
15
|
+
@transaction = ArkEcosystem::Crypto::Transactions::Transaction.new()
|
16
|
+
@transaction.type = type
|
17
|
+
@transaction.fee = ArkEcosystem::Crypto::Configuration::Fee.get(@transaction.type)
|
18
|
+
@transaction.sender_public_key = nil
|
19
|
+
@transaction.recipient_id = nil
|
20
|
+
@transaction.amount = 0
|
21
|
+
@transaction.vendor_field = nil
|
22
|
+
@transaction.timestamp = ArkEcosystem::Crypto::Utils::Slot.get_time
|
23
|
+
@transaction.asset = {}
|
24
|
+
end
|
25
|
+
|
26
|
+
def sign(passphrase)
|
27
|
+
sign_and_create_id(passphrase)
|
28
|
+
end
|
29
|
+
|
30
|
+
def sign_and_create_id(passphrase)
|
31
|
+
@transaction.sign(passphrase)
|
32
|
+
@transaction.id = @transaction.get_id
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def second_sign(second_passphrase)
|
37
|
+
@transaction.second_sign(second_passphrase)
|
38
|
+
self
|
39
|
+
end
|
40
|
+
|
41
|
+
def verify
|
42
|
+
@transaction.verify
|
43
|
+
end
|
44
|
+
|
45
|
+
def second_verify(second_public_key)
|
46
|
+
@transaction.second_verify(second_public_key)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'arkecosystem/crypto/enums/fees'
|
2
|
+
require 'arkecosystem/crypto/enums/types'
|
3
|
+
require 'arkecosystem/crypto/identities/public_key'
|
4
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
5
|
+
|
6
|
+
module ArkEcosystem
|
7
|
+
module Crypto
|
8
|
+
module Transactions
|
9
|
+
module Builder
|
10
|
+
# The builder for delegate registration transactions.
|
11
|
+
class DelegateRegistration < Base
|
12
|
+
def set_username(username)
|
13
|
+
@username = username
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def sign(passphrase)
|
18
|
+
@transaction.asset = {
|
19
|
+
delegate: {
|
20
|
+
username: @username,
|
21
|
+
public_key: ArkEcosystem::Crypto::Identities::PublicKey.from_passphrase(passphrase)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
sign_and_create_id(passphrase)
|
25
|
+
end
|
26
|
+
|
27
|
+
def type
|
28
|
+
ArkEcosystem::Crypto::Enums::Types::DELEGATE_REGISTRATION
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'arkecosystem/crypto/enums/fees'
|
2
|
+
require 'arkecosystem/crypto/enums/types'
|
3
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
4
|
+
|
5
|
+
module ArkEcosystem
|
6
|
+
module Crypto
|
7
|
+
module Transactions
|
8
|
+
module Builder
|
9
|
+
# The builder for multi signature registration transactions.
|
10
|
+
class MultiSignatureRegistration < Base
|
11
|
+
def initialize
|
12
|
+
super
|
13
|
+
|
14
|
+
@transaction.asset = {
|
15
|
+
multisignature: {}
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def set_keysgroup(keysgroup)
|
20
|
+
@fee = (keysgroup.size + 1) * ArkEcosystem::Crypto::Configuration::Fee.get(@transaction.type)
|
21
|
+
|
22
|
+
@transaction.asset[:multisignature][:keysgroup] = keysgroup
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def set_lifetime(lifetime)
|
27
|
+
@transaction.asset[:multisignature][:lifetime] = lifetime
|
28
|
+
self
|
29
|
+
end
|
30
|
+
|
31
|
+
def set_min(min)
|
32
|
+
@transaction.asset[:multisignature][:min] = min
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
def type
|
37
|
+
ArkEcosystem::Crypto::Enums::Types::MULTI_SIGNATURE_REGISTRATION
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'arkecosystem/crypto/enums/fees'
|
2
|
+
require 'arkecosystem/crypto/enums/types'
|
3
|
+
require 'arkecosystem/crypto/identities/public_key'
|
4
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
5
|
+
|
6
|
+
module ArkEcosystem
|
7
|
+
module Crypto
|
8
|
+
module Transactions
|
9
|
+
module Builder
|
10
|
+
# The builder for second signature registration transactions.
|
11
|
+
class SecondSignatureRegistration < Base
|
12
|
+
def set_second_passphrase(second_passphrase)
|
13
|
+
@transaction.asset = {
|
14
|
+
signature: {
|
15
|
+
public_key: ArkEcosystem::Crypto::Identities::PublicKey.from_passphrase(second_passphrase)
|
16
|
+
}
|
17
|
+
}
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def type
|
22
|
+
ArkEcosystem::Crypto::Enums::Types::SECOND_SIGNATURE_REGISTRATION
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'arkecosystem/crypto/enums/fees'
|
2
|
+
require 'arkecosystem/crypto/enums/types'
|
3
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
4
|
+
|
5
|
+
module ArkEcosystem
|
6
|
+
module Crypto
|
7
|
+
module Transactions
|
8
|
+
module Builder
|
9
|
+
# The builder for transfer transactions.
|
10
|
+
class Transfer < Base
|
11
|
+
def set_recipient_id(recipient_id)
|
12
|
+
@transaction.recipient_id = recipient_id
|
13
|
+
self
|
14
|
+
end
|
15
|
+
|
16
|
+
def set_amount(amount)
|
17
|
+
@transaction.amount = amount
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_vendor_field(vendor_field)
|
22
|
+
@transaction.vendor_field = vendor_field
|
23
|
+
self
|
24
|
+
end
|
25
|
+
|
26
|
+
def type
|
27
|
+
ArkEcosystem::Crypto::Enums::Types::TRANSFER
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'arkecosystem/crypto/enums/fees'
|
2
|
+
require 'arkecosystem/crypto/enums/types'
|
3
|
+
require 'arkecosystem/crypto/identities/address'
|
4
|
+
require 'arkecosystem/crypto/transactions/builder/base'
|
5
|
+
|
6
|
+
module ArkEcosystem
|
7
|
+
module Crypto
|
8
|
+
module Transactions
|
9
|
+
module Builder
|
10
|
+
# The builder for vote transactions.
|
11
|
+
class Vote < Base
|
12
|
+
def set_votes(votes)
|
13
|
+
@transaction.asset[:votes] = votes
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
def sign(passphrase)
|
18
|
+
@transaction.recipient_id = ArkEcosystem::Crypto::Identities::Address.from_passphrase(passphrase)
|
19
|
+
sign_and_create_id(passphrase)
|
20
|
+
end
|
21
|
+
|
22
|
+
def type
|
23
|
+
ArkEcosystem::Crypto::Enums::Types::VOTE
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|