mixin_bot 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff1380a5f8ac4dfc43535c076c71d5cf56bb33c6397678b2fec9f8ee57363856
4
- data.tar.gz: 57f9a232369a358340bd2f631590436290aa53d86ca48a23083e1257a0a20792
3
+ metadata.gz: 8518e345e340ad9210d201ef9222ac8255e8d2410bef2de528a01972b23c2293
4
+ data.tar.gz: 542b6d177762c88e43897880febb1bf05b781901ec7306278a70e0ddbe9cb16b
5
5
  SHA512:
6
- metadata.gz: 7611839592fcc990af4de58b12760863d647b4d12dd411901313e5bf58f4b459e14ef4d39e4f020e663c1c2d243c7a97b62cb32c20892f299fe49d70f4985675
7
- data.tar.gz: a7fb7e2b860623e48d13b380ad7aa94346840ca04d809b36cdeb35d967462986a638e3e110eb31229eef39aacce7f263d6ec1e26cbfb67b516cf0ed69ee5b040
6
+ metadata.gz: 26728ebf17156617342ed7672a0efb54b243d9f0ecc7b724c72050a03260cf4df01b011de0dc4be3ec57a322e8eca2f411647ff842b0976470c76b6ab43a755c
7
+ data.tar.gz: 552a1ab0c82ea8ce605484c19dfacb866d3b7205f3631670752f17014f2e48cff441b3022a85fed5106f7c770344a84745caaba08032f75fe27ee8c6e86a5d69
@@ -160,12 +160,12 @@ module MixinBot
160
160
 
161
161
  raise 'access_token required!' if access_token.nil? && !senders.include?(client_id)
162
162
 
163
- amount = amount.to_f.floor(8)
163
+ amount = amount.to_d.round(8)
164
164
  input_amount = utxos.map(
165
165
  &lambda { |utxo|
166
- utxo['amount'].to_f
166
+ utxo['amount'].to_d
167
167
  }
168
- ).sum.floor(8)
168
+ ).sum
169
169
 
170
170
  if input_amount < amount
171
171
  raise format(
@@ -199,7 +199,7 @@ module MixinBot
199
199
  output1 = build_output(
200
200
  receivers: senders,
201
201
  index: 1,
202
- amount: (input_amount - amount).floor(8),
202
+ amount: input_amount - amount,
203
203
  threshold: senders_threshold,
204
204
  hint: hint
205
205
  )
@@ -223,7 +223,7 @@ module MixinBot
223
223
  def build_output(receivers:, index:, amount:, threshold:, hint: nil)
224
224
  _output = create_output receivers: receivers, index: index, hint: hint
225
225
  {
226
- amount: amount.to_f.floor(8).to_s,
226
+ amount: amount.to_d.round(8).to_s,
227
227
  script: build_threshold_script(threshold),
228
228
  mask: _output['mask'],
229
229
  keys: _output['keys']
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MixinBot
4
- VERSION = '0.7.3'
4
+ VERSION = '0.7.4'
5
5
  end
data/lib/mixin_bot.rb CHANGED
@@ -4,6 +4,8 @@
4
4
  require 'English'
5
5
  require 'active_support/core_ext/hash'
6
6
  require 'base64'
7
+ require 'bigdecimal'
8
+ require 'bigdecimal/util'
7
9
  require 'digest'
8
10
  require 'faye/websocket'
9
11
  require 'http'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixin_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - an-lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-03 00:00:00.000000000 Z
11
+ date: 2021-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport