mixin_bot 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 984fd110f61498e0cff51f5df350484ff8c31e87ea09c26ebcda93151609cd36
4
- data.tar.gz: ed4c91a108b486d3213e88474c95564776210b6d628cefa0632bea41b10c863f
3
+ metadata.gz: 3ab14eb3fd1f2187aa59672bb2b1ec7706e0e9a4baa099f3002753d516d405f2
4
+ data.tar.gz: 1888a0bb071ffc1f0d0c691a5ae4405a9e4ffe9a0c7800c45553a523ced9170e
5
5
  SHA512:
6
- metadata.gz: f0da3b8af07a5c58670d3dc47777ef4160d2c38e2addf02a6ed9338587fed71f5e04f8203cf83984e54811275d7077eb95c4379125c14dc935920a5b4f129688
7
- data.tar.gz: 84661d4ed53646870c000edee35e85a0108c06414aab660dcf736fb2d18082a5cfe90885ed38f47b0970d9e99e75953bc8227cdd1ad8fcbc994a271edbbbfe98
6
+ metadata.gz: 9b08fc17724391cf02e75b8126dcfe1ef43800510df13be4f51d9c8dfe5ba7113b2a3ce696e258a1a13312fee274dc36ddf61d9d40271387f308fff31f9398e0
7
+ data.tar.gz: 024e157e76f9bd96d92d265562dc2d1add40b2c7c6539e180a735125eb021d8f89c1eaa8c90ac01b684af1f47810d9aa83fe0c67c79252ad7e1b1d366a1f5f05
@@ -101,7 +101,7 @@ module MixinBot
101
101
  # receivers_threshold: 1,
102
102
  # state: 'unspent'
103
103
  # }
104
- COLLECTIBLE_TRANSACTION_ARGUMENTS = %i[collectible nfo receivers threshold].freeze
104
+ COLLECTIBLE_TRANSACTION_ARGUMENTS = %i[collectible nfo receivers receivers_threshold].freeze
105
105
  def build_collectible_transaction(**kwargs)
106
106
  raise ArgumentError, "#{COLLECTIBLE_TRANSACTION_ARGUMENTS.join(', ')} are needed for build collectible transaction" unless COLLECTIBLE_TRANSACTION_ARGUMENTS.all? { |param| kwargs.keys.include? param }
107
107
 
@@ -112,8 +112,9 @@ module MixinBot
112
112
  build_raw_transaction(
113
113
  utxos: [collectible],
114
114
  senders: collectible['receivers'],
115
+ senders_threshold: collectible['receivers_threshold'],
115
116
  receivers: kwargs['receivers'],
116
- threshold: kwargs['threshold'],
117
+ receivers_threshold: kwargs['receivers_threshold'],
117
118
  extra: kwargs["nfo"],
118
119
  amount: 1,
119
120
  asset_mixin_id: NFT_ASSET_MIXIN_ID
@@ -123,6 +123,7 @@ module MixinBot
123
123
  end
124
124
 
125
125
  def unique_uuid(user_id, opponent_id = nil)
126
+ opponent_id ||= client_id
126
127
  MixinBot::Utils.unique_uuid user_id, opponent_id
127
128
  end
128
129
  alias unique_conversation_id unique_uuid
@@ -146,22 +146,22 @@ module MixinBot
146
146
  # kwargs:
147
147
  # {
148
148
  # senders: [ uuid ],
149
+ # senders_threshold: integer,
149
150
  # receivers: [ uuid ],
150
- # threshold: integer,
151
+ # receivers_threshold: integer,
151
152
  # asset_id: uuid,
152
153
  # amount: string / float,
153
154
  # memo: string,
154
155
  # }
155
- RAW_TRANSACTION_ARGUMENTS = %i[utxos senders receivers amount threshold].freeze
156
+ RAW_TRANSACTION_ARGUMENTS = %i[utxos senders senders_threshold receivers receivers_threshold amount].freeze
156
157
  def build_raw_transaction(**kwargs)
157
158
  raise ArgumentError, "#{RAW_TRANSACTION_ARGUMENTS.join(', ')} are needed for build raw transaction" unless RAW_TRANSACTION_ARGUMENTS.all? { |param| kwargs.keys.include? param }
158
159
 
159
160
  senders = kwargs[:senders]
160
- threshold = kwargs[:threshold]
161
+ senders_threshold = kwargs[:senders_threshold]
161
162
  receivers = kwargs[:receivers]
162
163
  receivers_threshold = kwargs[:receivers_threshold]
163
164
  amount = kwargs[:amount]
164
- threshold = kwargs[:threshold]
165
165
  asset_id = kwargs[:asset_id]
166
166
  asset_mixin_id = kwargs[:asset_mixin_id]
167
167
  utxos = kwargs[:utxos]
@@ -213,7 +213,7 @@ module MixinBot
213
213
  receivers: senders,
214
214
  index: 1,
215
215
  amount: (input_amount - amount),
216
- threshold: threshold,
216
+ threshold: senders_threshold,
217
217
  hint: hint
218
218
  )
219
219
  outputs.push output1
@@ -17,11 +17,10 @@ module MixinBot
17
17
  NFT_MASK = 0x00
18
18
  NULL_UUID = '00000000-0000-0000-0000-000000000000'
19
19
 
20
- def unique_uuid(user_id, opponent_id = nil)
21
- opponent_id ||= client_id
20
+ def unique_uuid(uuid_1, uuid_2)
22
21
  md5 = Digest::MD5.new
23
- md5 << [user_id, opponent_id].min
24
- md5 << [user_id, opponent_id].max
22
+ md5 << [uuid_1, uuid_2].min
23
+ md5 << [uuid_1, uuid_2].max
25
24
  digest = md5.digest
26
25
  digest6 = (digest[6].ord & 0x0f | 0x30).chr
27
26
  digest8 = (digest[8].ord & 0x3f | 0x80).chr
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MixinBot
4
- VERSION = '0.6.4'
4
+ VERSION = '0.6.5'
5
5
  end
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.6.4
4
+ version: 0.6.5
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-10-29 00:00:00.000000000 Z
11
+ date: 2021-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport