File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ module Peatio #:nodoc:
1818 # txout: 1,
1919 # to_address: '0x9af4f143cd5ecfba0fcdd863c5ef52d5ccb4f3e5',
2020 # amount: 0.01,
21+ # fee: 0.0004,
2122 # block_number: 7732274,
2223 # currency_id: 'eth',
2324 # status: 'success'
@@ -67,6 +68,10 @@ class Transaction
6768 # return [Decimal] amount of the transaction
6869 attr_accessor :amount
6970
71+ # @!attribute [rw] fee
72+ # return [Decimal] fee of the transaction
73+ attr_accessor :fee
74+
7075 # @!attribute [rw] block_number
7176 # return [Integer] transaction block number
7277 attr_accessor :block_number
@@ -98,6 +103,9 @@ class Transaction
98103 validates :amount ,
99104 numericality : { greater_than_or_equal_to : 0 }
100105
106+ validates :fee ,
107+ numericality : { greater_than_or_equal_to : 0 } , allow_blank : true
108+
101109 validates :status , inclusion : { in : STATUSES }
102110
103111 def initialize ( attributes = { } )
Original file line number Diff line number Diff line change 11module Peatio
2- VERSION = "2.6.3 "
2+ VERSION = "2.6.4 "
33end
Original file line number Diff line number Diff line change 88 from_addresses : [ 'from_address' ] ,
99 to_address : 'to_address' ,
1010 amount : 10 ,
11+ fee : 0.005 ,
1112 block_number : 1042 ,
1213 currency_id : 'btc' ,
1314 status : 'pending' }
7576 expect ( Peatio ::Transaction . new ( transaction_attrs ) . valid? ) . to be_falsey
7677 end
7778
79+ it 'validates fee to be number' do
80+ transaction_attrs [ :fee ] = 'abc'
81+ expect ( Peatio ::Transaction . new ( transaction_attrs ) . valid? ) . to be_falsey
82+ end
83+
7884 it 'validates block_number to be number' do
7985 transaction_attrs [ :block_number ] = 'abc'
8086 expect ( Peatio ::Transaction . new ( transaction_attrs ) . valid? ) . to be_falsey
100106 txout : 2 ,
101107 to_address : 'to_address' ,
102108 amount : 10 ,
109+ fee : 0.08 ,
103110 block_number : 1042 ,
104111 currency_id : 'btc' ,
105112 status : 'pending' }
122129 txout : 2 ,
123130 to_address : 'to_address' ,
124131 amount : 10 ,
132+ fee : 0.08 ,
125133 block_number : 1042 ,
126134 currency_id : 'btc' ,
127135 status : 'pending' }
You can’t perform that action at this time.
0 commit comments