mixin_bot 0.7.3 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mixin_bot/api/multisig.rb +6 -6
- data/lib/mixin_bot/api/transaction.rb +4 -4
- data/lib/mixin_bot/api/transfer.rb +2 -2
- data/lib/mixin_bot/utils.rb +5 -5
- data/lib/mixin_bot/version.rb +1 -1
- data/lib/mixin_bot.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6b6a8ef2f385b184baa4c0228bfb9a97867cff65aa625618ce08a7ff0570237
|
4
|
+
data.tar.gz: 4d4f11a16d0bf135c56768f5658ac20e80db652474a9a5b55cb3700f41092196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1af0e4eb4050880c4ad2593045cc911a3cd078649f4a1cd90d7a820fec799cb9d758a70160af6b94b40ae9c04592c2a2ffa00159535d9b8954095a161ad1329
|
7
|
+
data.tar.gz: 571922c76b219488eb406836cb2d293365d16abe71f4a2fb7039d69ee53b52b71578b2f604264dd0f604d13dcebb53a40db06addef52dfff34cd21941088ae94
|
@@ -100,7 +100,7 @@ module MixinBot
|
|
100
100
|
path = '/payments'
|
101
101
|
payload = {
|
102
102
|
asset_id: kwargs[:asset_id],
|
103
|
-
amount: kwargs[:amount].
|
103
|
+
amount: format('%.8f', kwargs[:amount].to_d.to_r),
|
104
104
|
trace_id: kwargs[:trace_id] || SecureRandom.uuid,
|
105
105
|
memo: kwargs[:memo],
|
106
106
|
opponent_multisig: {
|
@@ -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.
|
163
|
+
amount = amount.to_d.round(8)
|
164
164
|
input_amount = utxos.map(
|
165
165
|
&lambda { |utxo|
|
166
|
-
utxo['amount'].
|
166
|
+
utxo['amount'].to_d
|
167
167
|
}
|
168
|
-
).sum
|
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:
|
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.
|
226
|
+
amount: format('%.8f', amount.to_d.to_r),
|
227
227
|
script: build_threshold_script(threshold),
|
228
228
|
mask: _output['mask'],
|
229
229
|
keys: _output['keys']
|
@@ -10,7 +10,7 @@ module MixinBot
|
|
10
10
|
asset_id = options[:asset_id]
|
11
11
|
receivers = options[:receivers]
|
12
12
|
threshold = options[:threshold]
|
13
|
-
amount = options[:amount].
|
13
|
+
amount = options[:amount].to_d
|
14
14
|
memo = options[:memo]
|
15
15
|
trace_id = options[:trace_id] || SecureRandom.uuid
|
16
16
|
encrypted_pin = options[:encrypted_pin] || encrypt_pin(pin)
|
@@ -23,7 +23,7 @@ module MixinBot
|
|
23
23
|
threshold: threshold
|
24
24
|
},
|
25
25
|
pin: encrypted_pin,
|
26
|
-
amount: format('%.8f', amount),
|
26
|
+
amount: format('%.8f', amount.to_r),
|
27
27
|
trace_id: trace_id,
|
28
28
|
memo: memo
|
29
29
|
}
|
@@ -40,7 +40,7 @@ module MixinBot
|
|
40
40
|
|
41
41
|
asset_id = options[:asset_id]
|
42
42
|
opponent_key = options[:opponent_key]
|
43
|
-
amount = options[:amount].
|
43
|
+
amount = options[:amount].to_d
|
44
44
|
memo = options[:memo]
|
45
45
|
trace_id = options[:trace_id] || SecureRandom.uuid
|
46
46
|
encrypted_pin = options[:encrypted_pin] || encrypt_pin(pin)
|
@@ -50,7 +50,7 @@ module MixinBot
|
|
50
50
|
asset_id: asset_id,
|
51
51
|
opponent_key: opponent_key,
|
52
52
|
pin: encrypted_pin,
|
53
|
-
amount: format('%.8f', amount),
|
53
|
+
amount: format('%.8f', amount.to_r),
|
54
54
|
trace_id: trace_id,
|
55
55
|
memo: memo
|
56
56
|
}
|
@@ -9,7 +9,7 @@ module MixinBot
|
|
9
9
|
|
10
10
|
asset_id = options[:asset_id]
|
11
11
|
opponent_id = options[:opponent_id]
|
12
|
-
amount = options[:amount].
|
12
|
+
amount = options[:amount].to_d
|
13
13
|
memo = options[:memo]
|
14
14
|
trace_id = options[:trace_id] || SecureRandom.uuid
|
15
15
|
encrypted_pin = options[:encrypted_pin] || encrypt_pin(pin)
|
@@ -19,7 +19,7 @@ module MixinBot
|
|
19
19
|
asset_id: asset_id,
|
20
20
|
opponent_id: opponent_id,
|
21
21
|
pin: encrypted_pin,
|
22
|
-
amount: format('%.8f', amount),
|
22
|
+
amount: format('%.8f', amount.to_r),
|
23
23
|
trace_id: trace_id,
|
24
24
|
memo: memo
|
25
25
|
}
|
data/lib/mixin_bot/utils.rb
CHANGED
@@ -160,9 +160,9 @@ module MixinBot
|
|
160
160
|
tx
|
161
161
|
end
|
162
162
|
|
163
|
-
def nft_memo_hash(collection, token_id,
|
163
|
+
def nft_memo_hash(collection, token_id, hash)
|
164
164
|
collection = NULL_UUID if collection.empty?
|
165
|
-
|
165
|
+
raise 'hash must be 256-bit string' unless hash.is_a?(String) && hash.size == 64
|
166
166
|
|
167
167
|
memo = {
|
168
168
|
prefix: NFT_MEMO_PREFIX,
|
@@ -172,7 +172,7 @@ module MixinBot
|
|
172
172
|
class: NFT_MEMO_DEFAULT_CLASS,
|
173
173
|
collection: collection,
|
174
174
|
token: token_id,
|
175
|
-
extra:
|
175
|
+
extra: hash
|
176
176
|
}
|
177
177
|
|
178
178
|
mark = [0]
|
@@ -186,8 +186,8 @@ module MixinBot
|
|
186
186
|
memo
|
187
187
|
end
|
188
188
|
|
189
|
-
def nft_memo(collection, token_id,
|
190
|
-
encode_nft_memo nft_memo_hash(collection, token_id,
|
189
|
+
def nft_memo(collection, token_id, hash)
|
190
|
+
encode_nft_memo nft_memo_hash(collection, token_id, hash)
|
191
191
|
end
|
192
192
|
|
193
193
|
def encode_nft_memo(memo)
|
data/lib/mixin_bot/version.rb
CHANGED
data/lib/mixin_bot.rb
CHANGED
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.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- an-lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|