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.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/arkecosystem/crypto.rb +35 -42
  3. data/lib/arkecosystem/crypto/{identity → identities}/address.rb +10 -4
  4. data/lib/arkecosystem/crypto/identities/private_key.rb +18 -0
  5. data/lib/arkecosystem/crypto/identities/public_key.rb +18 -0
  6. data/lib/arkecosystem/crypto/{identity → identities}/wif.rb +4 -4
  7. data/lib/arkecosystem/crypto/networks/devnet.rb +1 -5
  8. data/lib/arkecosystem/crypto/networks/mainnet.rb +1 -5
  9. data/lib/arkecosystem/crypto/networks/testnet.rb +1 -5
  10. data/lib/arkecosystem/crypto/transactions/builder/base.rb +52 -0
  11. data/lib/arkecosystem/crypto/transactions/builder/delegate_registration.rb +34 -0
  12. data/lib/arkecosystem/crypto/transactions/builder/multi_signature_registration.rb +43 -0
  13. data/lib/arkecosystem/crypto/transactions/builder/second_signature_registration.rb +28 -0
  14. data/lib/arkecosystem/crypto/transactions/builder/transfer.rb +33 -0
  15. data/lib/arkecosystem/crypto/transactions/builder/vote.rb +29 -0
  16. data/lib/arkecosystem/crypto/transactions/deserializer.rb +98 -0
  17. data/lib/arkecosystem/crypto/transactions/deserializers/base.rb +17 -0
  18. data/lib/arkecosystem/crypto/transactions/deserializers/delegate_registration.rb +24 -0
  19. data/lib/arkecosystem/crypto/transactions/deserializers/delegate_resignation.rb +14 -0
  20. data/lib/arkecosystem/crypto/transactions/deserializers/ipfs.rb +20 -0
  21. data/lib/arkecosystem/crypto/transactions/deserializers/multi_payment.rb +40 -0
  22. data/lib/arkecosystem/crypto/transactions/deserializers/multi_signature_registration.rb +34 -0
  23. data/lib/arkecosystem/crypto/transactions/deserializers/second_signature_registration.rb +20 -0
  24. data/lib/arkecosystem/crypto/transactions/deserializers/timelock_transfer.rb +21 -0
  25. data/lib/arkecosystem/crypto/transactions/deserializers/transfer.rb +21 -0
  26. data/lib/arkecosystem/crypto/transactions/deserializers/vote.rb +33 -0
  27. data/lib/arkecosystem/crypto/transactions/serializer.rb +86 -0
  28. data/lib/arkecosystem/crypto/transactions/serializers/base.rb +15 -0
  29. data/lib/arkecosystem/crypto/transactions/serializers/delegate_registration.rb +19 -0
  30. data/lib/arkecosystem/crypto/transactions/serializers/delegate_resignation.rb +14 -0
  31. data/lib/arkecosystem/crypto/transactions/serializers/ipfs.rb +19 -0
  32. data/lib/arkecosystem/crypto/transactions/serializers/multi_payment.rb +25 -0
  33. data/lib/arkecosystem/crypto/transactions/serializers/multi_signature_registration.rb +33 -0
  34. data/lib/arkecosystem/crypto/transactions/serializers/second_signature_registration.rb +16 -0
  35. data/lib/arkecosystem/crypto/transactions/serializers/timelock_transfer.rb +23 -0
  36. data/lib/arkecosystem/crypto/transactions/serializers/transfer.rb +22 -0
  37. data/lib/arkecosystem/crypto/transactions/serializers/vote.rb +25 -0
  38. data/lib/arkecosystem/crypto/transactions/transaction.rb +198 -0
  39. data/lib/arkecosystem/crypto/utils/message.rb +42 -0
  40. data/lib/arkecosystem/crypto/utils/slot.rb +23 -0
  41. data/lib/arkecosystem/crypto/version.rb +1 -1
  42. metadata +67 -39
  43. data/lib/arkecosystem/crypto/builder/delegate_registration.rb +0 -33
  44. data/lib/arkecosystem/crypto/builder/multi_signature_registration.rb +0 -45
  45. data/lib/arkecosystem/crypto/builder/second_signature_registration.rb +0 -27
  46. data/lib/arkecosystem/crypto/builder/transaction.rb +0 -109
  47. data/lib/arkecosystem/crypto/builder/transfer.rb +0 -32
  48. data/lib/arkecosystem/crypto/builder/vote.rb +0 -28
  49. data/lib/arkecosystem/crypto/crypto.rb +0 -144
  50. data/lib/arkecosystem/crypto/deserialiser.rb +0 -94
  51. data/lib/arkecosystem/crypto/deserialisers/base.rb +0 -15
  52. data/lib/arkecosystem/crypto/deserialisers/delegate_registration.rb +0 -22
  53. data/lib/arkecosystem/crypto/deserialisers/delegate_resignation.rb +0 -12
  54. data/lib/arkecosystem/crypto/deserialisers/ipfs.rb +0 -18
  55. data/lib/arkecosystem/crypto/deserialisers/multi_payment.rb +0 -38
  56. data/lib/arkecosystem/crypto/deserialisers/multi_signature_registration.rb +0 -32
  57. data/lib/arkecosystem/crypto/deserialisers/second_signature_registration.rb +0 -18
  58. data/lib/arkecosystem/crypto/deserialisers/timelock_transfer.rb +0 -19
  59. data/lib/arkecosystem/crypto/deserialisers/transfer.rb +0 -18
  60. data/lib/arkecosystem/crypto/deserialisers/vote.rb +0 -31
  61. data/lib/arkecosystem/crypto/identity/private_key.rb +0 -14
  62. data/lib/arkecosystem/crypto/identity/public_key.rb +0 -18
  63. data/lib/arkecosystem/crypto/message.rb +0 -42
  64. data/lib/arkecosystem/crypto/models/transaction.rb +0 -16
  65. data/lib/arkecosystem/crypto/serialiser.rb +0 -84
  66. data/lib/arkecosystem/crypto/serialisers/base.rb +0 -13
  67. data/lib/arkecosystem/crypto/serialisers/delegate_registration.rb +0 -17
  68. data/lib/arkecosystem/crypto/serialisers/delegate_resignation.rb +0 -12
  69. data/lib/arkecosystem/crypto/serialisers/ipfs.rb +0 -17
  70. data/lib/arkecosystem/crypto/serialisers/multi_payment.rb +0 -23
  71. data/lib/arkecosystem/crypto/serialisers/multi_signature_registration.rb +0 -31
  72. data/lib/arkecosystem/crypto/serialisers/second_signature_registration.rb +0 -14
  73. data/lib/arkecosystem/crypto/serialisers/timelock_transfer.rb +0 -21
  74. data/lib/arkecosystem/crypto/serialisers/transfer.rb +0 -20
  75. data/lib/arkecosystem/crypto/serialisers/vote.rb +0 -23
@@ -0,0 +1,23 @@
1
+ require 'time'
2
+ require 'arkecosystem/crypto/configuration/network'
3
+
4
+ module ArkEcosystem
5
+ module Crypto
6
+ module Utils
7
+ # The slot helper.
8
+ class Slot
9
+ def self.get_time
10
+ network = ArkEcosystem::Crypto::Configuration::Network.get
11
+
12
+ (Time.now.utc - Time.parse(network.epoch).to_time.to_i).to_i
13
+ end
14
+
15
+ def self.get_epoch
16
+ network = ArkEcosystem::Crypto::Configuration::Network.get
17
+
18
+ Time.parse(network.epoch).to_time.to_i
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -4,7 +4,7 @@ module ArkEcosystem
4
4
  MAJOR = 0
5
5
 
6
6
  # Current minor release.
7
- MINOR = 1
7
+ MINOR = 2
8
8
 
9
9
  # Current patch level.
10
10
  PATCH = 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arkecosystem-crypto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Faust
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-02 00:00:00.000000000 Z
11
+ date: 2018-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.4
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.4
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.16.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.16.1
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: btcruby
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +108,7 @@ dependencies:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
- description: A simple Ruby Cryptography Implementation for the ARK Blockchain.
111
+ description: A simple Ruby Cryptography Implementation for the Ark Blockchain.
84
112
  email:
85
113
  - brian@ark.io
86
114
  executables: []
@@ -88,48 +116,48 @@ extensions: []
88
116
  extra_rdoc_files: []
89
117
  files:
90
118
  - lib/arkecosystem/crypto.rb
91
- - lib/arkecosystem/crypto/builder/delegate_registration.rb
92
- - lib/arkecosystem/crypto/builder/multi_signature_registration.rb
93
- - lib/arkecosystem/crypto/builder/second_signature_registration.rb
94
- - lib/arkecosystem/crypto/builder/transaction.rb
95
- - lib/arkecosystem/crypto/builder/transfer.rb
96
- - lib/arkecosystem/crypto/builder/vote.rb
97
119
  - lib/arkecosystem/crypto/configuration/fee.rb
98
120
  - lib/arkecosystem/crypto/configuration/network.rb
99
- - lib/arkecosystem/crypto/crypto.rb
100
- - lib/arkecosystem/crypto/deserialiser.rb
101
- - lib/arkecosystem/crypto/deserialisers/base.rb
102
- - lib/arkecosystem/crypto/deserialisers/delegate_registration.rb
103
- - lib/arkecosystem/crypto/deserialisers/delegate_resignation.rb
104
- - lib/arkecosystem/crypto/deserialisers/ipfs.rb
105
- - lib/arkecosystem/crypto/deserialisers/multi_payment.rb
106
- - lib/arkecosystem/crypto/deserialisers/multi_signature_registration.rb
107
- - lib/arkecosystem/crypto/deserialisers/second_signature_registration.rb
108
- - lib/arkecosystem/crypto/deserialisers/timelock_transfer.rb
109
- - lib/arkecosystem/crypto/deserialisers/transfer.rb
110
- - lib/arkecosystem/crypto/deserialisers/vote.rb
111
121
  - lib/arkecosystem/crypto/enums/fees.rb
112
122
  - lib/arkecosystem/crypto/enums/types.rb
113
- - lib/arkecosystem/crypto/identity/address.rb
114
- - lib/arkecosystem/crypto/identity/private_key.rb
115
- - lib/arkecosystem/crypto/identity/public_key.rb
116
- - lib/arkecosystem/crypto/identity/wif.rb
117
- - lib/arkecosystem/crypto/message.rb
118
- - lib/arkecosystem/crypto/models/transaction.rb
123
+ - lib/arkecosystem/crypto/identities/address.rb
124
+ - lib/arkecosystem/crypto/identities/private_key.rb
125
+ - lib/arkecosystem/crypto/identities/public_key.rb
126
+ - lib/arkecosystem/crypto/identities/wif.rb
119
127
  - lib/arkecosystem/crypto/networks/devnet.rb
120
128
  - lib/arkecosystem/crypto/networks/mainnet.rb
121
129
  - lib/arkecosystem/crypto/networks/testnet.rb
122
- - lib/arkecosystem/crypto/serialiser.rb
123
- - lib/arkecosystem/crypto/serialisers/base.rb
124
- - lib/arkecosystem/crypto/serialisers/delegate_registration.rb
125
- - lib/arkecosystem/crypto/serialisers/delegate_resignation.rb
126
- - lib/arkecosystem/crypto/serialisers/ipfs.rb
127
- - lib/arkecosystem/crypto/serialisers/multi_payment.rb
128
- - lib/arkecosystem/crypto/serialisers/multi_signature_registration.rb
129
- - lib/arkecosystem/crypto/serialisers/second_signature_registration.rb
130
- - lib/arkecosystem/crypto/serialisers/timelock_transfer.rb
131
- - lib/arkecosystem/crypto/serialisers/transfer.rb
132
- - lib/arkecosystem/crypto/serialisers/vote.rb
130
+ - lib/arkecosystem/crypto/transactions/builder/base.rb
131
+ - lib/arkecosystem/crypto/transactions/builder/delegate_registration.rb
132
+ - lib/arkecosystem/crypto/transactions/builder/multi_signature_registration.rb
133
+ - lib/arkecosystem/crypto/transactions/builder/second_signature_registration.rb
134
+ - lib/arkecosystem/crypto/transactions/builder/transfer.rb
135
+ - lib/arkecosystem/crypto/transactions/builder/vote.rb
136
+ - lib/arkecosystem/crypto/transactions/deserializer.rb
137
+ - lib/arkecosystem/crypto/transactions/deserializers/base.rb
138
+ - lib/arkecosystem/crypto/transactions/deserializers/delegate_registration.rb
139
+ - lib/arkecosystem/crypto/transactions/deserializers/delegate_resignation.rb
140
+ - lib/arkecosystem/crypto/transactions/deserializers/ipfs.rb
141
+ - lib/arkecosystem/crypto/transactions/deserializers/multi_payment.rb
142
+ - lib/arkecosystem/crypto/transactions/deserializers/multi_signature_registration.rb
143
+ - lib/arkecosystem/crypto/transactions/deserializers/second_signature_registration.rb
144
+ - lib/arkecosystem/crypto/transactions/deserializers/timelock_transfer.rb
145
+ - lib/arkecosystem/crypto/transactions/deserializers/transfer.rb
146
+ - lib/arkecosystem/crypto/transactions/deserializers/vote.rb
147
+ - lib/arkecosystem/crypto/transactions/serializer.rb
148
+ - lib/arkecosystem/crypto/transactions/serializers/base.rb
149
+ - lib/arkecosystem/crypto/transactions/serializers/delegate_registration.rb
150
+ - lib/arkecosystem/crypto/transactions/serializers/delegate_resignation.rb
151
+ - lib/arkecosystem/crypto/transactions/serializers/ipfs.rb
152
+ - lib/arkecosystem/crypto/transactions/serializers/multi_payment.rb
153
+ - lib/arkecosystem/crypto/transactions/serializers/multi_signature_registration.rb
154
+ - lib/arkecosystem/crypto/transactions/serializers/second_signature_registration.rb
155
+ - lib/arkecosystem/crypto/transactions/serializers/timelock_transfer.rb
156
+ - lib/arkecosystem/crypto/transactions/serializers/transfer.rb
157
+ - lib/arkecosystem/crypto/transactions/serializers/vote.rb
158
+ - lib/arkecosystem/crypto/transactions/transaction.rb
159
+ - lib/arkecosystem/crypto/utils/message.rb
160
+ - lib/arkecosystem/crypto/utils/slot.rb
133
161
  - lib/arkecosystem/crypto/version.rb
134
162
  homepage: https://github.com/ArkEcosystem/ruby-crypto
135
163
  licenses:
@@ -155,5 +183,5 @@ rubyforge_project:
155
183
  rubygems_version: 2.7.6
156
184
  signing_key:
157
185
  specification_version: 4
158
- summary: A simple Ruby Cryptography Implementation for the ARK Blockchain.
186
+ summary: A simple Ruby Cryptography Implementation for the Ark Blockchain.
159
187
  test_files: []
@@ -1,33 +0,0 @@
1
- require 'arkecosystem/crypto/crypto'
2
- require 'arkecosystem/crypto/enums/fees'
3
- require 'arkecosystem/crypto/enums/types'
4
- require 'arkecosystem/crypto/identity/public_key'
5
- require 'arkecosystem/crypto/builder/transaction'
6
-
7
- module ArkEcosystem
8
- module Crypto
9
- module Builder
10
- # The builder for delegate registration transactions.
11
- class DelegateRegistration < Transaction
12
- def set_username(username)
13
- @username = username
14
- self
15
- end
16
-
17
- def sign(secret)
18
- @asset = {
19
- delegate: {
20
- username: @username,
21
- public_key: ArkEcosystem::Crypto::Identity::PublicKey.from_secret_as_hex(secret)
22
- }
23
- }
24
- sign_and_create_id(secret)
25
- end
26
-
27
- def type
28
- ArkEcosystem::Crypto::Enums::Types::DELEGATE_REGISTRATION
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,45 +0,0 @@
1
- require 'arkecosystem/crypto/crypto'
2
- require 'arkecosystem/crypto/enums/fees'
3
- require 'arkecosystem/crypto/enums/types'
4
- require 'arkecosystem/crypto/builder/transaction'
5
-
6
- module ArkEcosystem
7
- module Crypto
8
- module Builder
9
- # The builder for multi signature registration transactions.
10
- class MultiSignatureRegistration < Transaction
11
- def initialize
12
- super
13
-
14
- @asset = {
15
- multisignature: {}
16
- }
17
- end
18
-
19
- def set_keysgroup(keysgroup)
20
- @asset[:multisignature][:keysgroup] = keysgroup
21
- self
22
- end
23
-
24
- def set_lifetime(lifetime)
25
- @asset[:multisignature][:lifetime] = lifetime
26
- self
27
- end
28
-
29
- def set_min(min)
30
- @asset[:multisignature][:min] = min
31
- self
32
- end
33
-
34
- def sign(secret)
35
- @fee = (@asset[:multisignature][:keysgroup].size + 1) * ArkEcosystem::Crypto::Configuration::Fee.get(@type)
36
- sign_and_create_id(secret)
37
- end
38
-
39
- def type
40
- ArkEcosystem::Crypto::Enums::Types::MULTI_SIGNATURE_REGISTRATION
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,27 +0,0 @@
1
- require 'arkecosystem/crypto/crypto'
2
- require 'arkecosystem/crypto/enums/fees'
3
- require 'arkecosystem/crypto/enums/types'
4
- require 'arkecosystem/crypto/identity/public_key'
5
- require 'arkecosystem/crypto/builder/transaction'
6
-
7
- module ArkEcosystem
8
- module Crypto
9
- module Builder
10
- # The builder for second signature registration transactions.
11
- class SecondSignatureRegistration < Transaction
12
- def set_second_secret(second_secret)
13
- @asset = {
14
- signature: {
15
- public_key: ArkEcosystem::Crypto::Identity::PublicKey.from_secret_as_hex(second_secret)
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
@@ -1,109 +0,0 @@
1
- require 'time'
2
- require 'arkecosystem/crypto/crypto'
3
- require 'arkecosystem/crypto/identity/private_key'
4
- require 'arkecosystem/crypto/configuration/fee'
5
- require 'arkecosystem/crypto/configuration/network'
6
- require 'btcruby/base58'
7
- require 'deep_hash_transform'
8
-
9
- module ArkEcosystem
10
- module Crypto
11
- module Builder
12
- # The base builder for transactions.
13
- class Transaction
14
- attr_accessor :amount, :asset, :fee, :id, :recipient_id, :sender_public_key, :sign_signature, :signature, :timestamp, :type, :vendor_field
15
-
16
- def initialize
17
- @type = type
18
- @fee = ArkEcosystem::Crypto::Configuration::Fee.get(@type)
19
- @sender_public_key = nil
20
- @recipient_id = nil
21
- @amount = 0
22
- @vendor_field = nil
23
- @timestamp = seconds_after_epoch
24
- @asset = {}
25
- end
26
-
27
- def sign(secret)
28
- sign_and_create_id(secret)
29
- end
30
-
31
- def sign_and_create_id(secret)
32
- private_key = ArkEcosystem::Crypto::Identity::PrivateKey.from_secret(secret)
33
- @sender_public_key = private_key.public_key.unpack('H*').first
34
-
35
- transaction_bytes = ArkEcosystem::Crypto::Crypto.get_bytes(to_hash)
36
- @signature = private_key.ecdsa_signature(Digest::SHA256.digest(transaction_bytes)).unpack('H*').first
37
-
38
- transaction_bytes = ArkEcosystem::Crypto::Crypto.get_bytes(to_hash, false, false)
39
- @id = Digest::SHA256.digest(transaction_bytes).unpack('H*').first
40
- self
41
- end
42
-
43
- def second_sign(second_secret)
44
- second_key = ArkEcosystem::Crypto::Identity::PrivateKey.from_secret(second_secret)
45
-
46
- bytes = ArkEcosystem::Crypto::Crypto.get_bytes(to_hash, false)
47
-
48
- @sign_signature = second_key.ecdsa_signature(Digest::SHA256.digest(bytes)).unpack('H*').first
49
- self
50
- end
51
-
52
- def verify
53
- ArkEcosystem::Crypto::Crypto.verify(self)
54
- end
55
-
56
- def second_verify(second_public_key_hex)
57
- ArkEcosystem::Crypto::Crypto.second_verify(self, second_public_key_hex)
58
- end
59
-
60
- def to_params
61
- {
62
- type: type,
63
- amount: amount,
64
- fee: fee,
65
- vendorField: vendor_field,
66
- timestamp: timestamp,
67
- recipientId: recipient_id,
68
- senderPublicKey: sender_public_key,
69
- signature: signature,
70
- id: id
71
- }.tap do |h|
72
- h[:asset] = asset.deep_transform_keys { |key| snake_case_to_camel_case(key) } if asset.any?
73
- h[:signSignature] = sign_signature if sign_signature
74
- end
75
- end
76
-
77
- def to_hash
78
- {
79
- amount: amount,
80
- asset: asset,
81
- fee: fee,
82
- id: id,
83
- recipient_id: recipient_id,
84
- sender_public_key: sender_public_key,
85
- sign_signature: sign_signature,
86
- signature: signature,
87
- timestamp: timestamp,
88
- type: type,
89
- vendor_field: vendor_field
90
- }
91
- end
92
-
93
- private
94
-
95
- def seconds_after_epoch
96
- network = ArkEcosystem::Crypto::Configuration::Network.get
97
-
98
- (Time.now.utc - Time.parse(network.epoch).to_time.to_i).to_i
99
- end
100
-
101
- def snake_case_to_camel_case(string)
102
- string.to_s.split('_').enum_for(:each_with_index).collect do |s, index|
103
- index.zero? ? s : s.capitalize
104
- end.join
105
- end
106
- end
107
- end
108
- end
109
- end
@@ -1,32 +0,0 @@
1
- require 'arkecosystem/crypto/crypto'
2
- require 'arkecosystem/crypto/enums/fees'
3
- require 'arkecosystem/crypto/enums/types'
4
- require 'arkecosystem/crypto/builder/transaction'
5
-
6
- module ArkEcosystem
7
- module Crypto
8
- module Builder
9
- # The builder for transfer transactions.
10
- class Transfer < Transaction
11
- def set_recipient_id(recipient_id)
12
- @recipient_id = recipient_id
13
- self
14
- end
15
-
16
- def set_amount(amount)
17
- @amount = amount
18
- self
19
- end
20
-
21
- def set_vendor_field(vendor_field)
22
- @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
@@ -1,28 +0,0 @@
1
- require 'arkecosystem/crypto/crypto'
2
- require 'arkecosystem/crypto/enums/fees'
3
- require 'arkecosystem/crypto/enums/types'
4
- require 'arkecosystem/crypto/identity/address'
5
- require 'arkecosystem/crypto/builder/transaction'
6
-
7
- module ArkEcosystem
8
- module Crypto
9
- module Builder
10
- # The builder for vote transactions.
11
- class Vote < Transaction
12
- def set_votes(votes)
13
- @asset[:votes] = votes
14
- self
15
- end
16
-
17
- def sign(secret)
18
- @recipient_id = ArkEcosystem::Crypto::Identity::Address.from_secret(secret)
19
- sign_and_create_id(secret)
20
- end
21
-
22
- def type
23
- ArkEcosystem::Crypto::Enums::Types::VOTE
24
- end
25
- end
26
- end
27
- end
28
- end