mixin_bot 0.3.5 → 0.3.6

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: 8282148099d4fa3128ae77f40fbefbd5712edeacebbd10fc286055b463427f40
4
- data.tar.gz: d8e8b3511fb866dd76004534d2629f6edb362d82177d8a717a5f7a797c532b8e
3
+ metadata.gz: bec70596fc9cd40814bcdfd8693573173472db142523131f44c28057f7eae2dd
4
+ data.tar.gz: 52ddbfa9ab68e4340b39c8299383dadf82e14b4ce8dee3c1fd785b5843ac6672
5
5
  SHA512:
6
- metadata.gz: ac472ad54cc28559dec43283aa12691984fb5dd4f1d4dc5c2356b72716cfedd754d209b4b37f7ca4986408e7155523a2a41caeeec140c9ab6dcd00704e7b0d2e
7
- data.tar.gz: 414a6e52690819775032c7abd45d2cc4e885bc0d12a195ba87e4d5bd945ebac1eb8ffad7b458d3f3faf7cbfba5cccc157b5c5f6cab1517685dc28e15041389fe
6
+ metadata.gz: bdf202a7fad3fd4e6101288a0fd821b45f9945047ef03e01177dd72942f7c94af225be54e12ff6a7f1fc092d9939e0defcd8e5d6eba2c7b8b683d510ef486ab5
7
+ data.tar.gz: 2058403228454b3b1f4764a7a4ea4756e463648650ee9bfabd12073fe88465eb3d7b478a3583cd4e73f829ef60605e8952aff56a706922b19beb00554d2cfbd6
@@ -119,19 +119,19 @@ module MixinBot
119
119
 
120
120
  # pay to the multisig address
121
121
  # used for create multisig payment code_id
122
- def create_multisig_payment(params)
122
+ def create_multisig_payment(**kwargs)
123
123
  path = '/payments'
124
124
  payload = {
125
- asset_id: params[:asset_id],
126
- amount: params[:amount].to_s,
127
- trace_id: params[:trace_id] || SecureRandom.uuid,
128
- memo: params[:memo],
125
+ asset_id: kwargs[:asset_id],
126
+ amount: kwargs[:amount].to_s,
127
+ trace_id: kwargs[:trace_id] || SecureRandom.uuid,
128
+ memo: kwargs[:memo],
129
129
  opponent_multisig: {
130
- receivers: params[:receivers],
131
- threshold: params[:threshold]
130
+ receivers: kwargs[:receivers],
131
+ threshold: kwargs[:threshold]
132
132
  }
133
133
  }
134
- access_token = params[:access_token]
134
+ access_token = kwargs[:access_token]
135
135
  access_token ||= access_token('POST', path, payload.to_json)
136
136
  authorization = format('Bearer %<access_token>s', access_token: access_token)
137
137
  client.post(path, headers: { 'Authorization': authorization }, json: payload)
@@ -166,37 +166,37 @@ module MixinBot
166
166
  end
167
167
 
168
168
  # filter utxo by members, asset_id and threshold
169
- def filter_utxos(params)
170
- utxos = all_multisigs(access_token: params[:access_token])
169
+ def filter_utxos(**kwargs)
170
+ utxos = all_multisigs(access_token: kwargs[:access_token])
171
171
 
172
- unless params[:members].nil?
172
+ unless kwargs[:members].nil?
173
173
  utxos = utxos.filter(
174
174
  &lambda { |utxo|
175
- utxo['members'].sort == params[:members].sort
175
+ utxo['members'].sort == kwargs[:members].sort
176
176
  }
177
177
  )
178
178
  end
179
179
 
180
- unless params[:asset_id].nil?
180
+ unless kwargs[:asset_id].nil?
181
181
  utxos = utxos.filter(
182
182
  &lambda { |utxo|
183
- utxo['asset_id'] == params[:asset_id]
183
+ utxo['asset_id'] == kwargs[:asset_id]
184
184
  }
185
185
  )
186
186
  end
187
187
 
188
- unless params[:threshold].nil?
188
+ unless kwargs[:threshold].nil?
189
189
  utxos = utxos.filter(
190
190
  &lambda { |utxo|
191
- utxo['threshold'] == params[:threshold]
191
+ utxo['threshold'] == kwargs[:threshold]
192
192
  }
193
193
  )
194
194
  end
195
195
 
196
- unless params[:state].nil?
196
+ unless kwargs[:state].nil?
197
197
  utxos = utxos.filter(
198
198
  &lambda { |utxo|
199
- utxo['state'] == params[:state]
199
+ utxo['state'] == kwargs[:state]
200
200
  }
201
201
  )
202
202
  end
@@ -204,7 +204,7 @@ module MixinBot
204
204
  utxos
205
205
  end
206
206
 
207
- # params:
207
+ # kwargs:
208
208
  # {
209
209
  # senders: [ uuid ],
210
210
  # receivers: [ uuid ],
@@ -214,16 +214,16 @@ module MixinBot
214
214
  # amount: string / float,
215
215
  # memo: string,
216
216
  # }
217
- def build_raw_transaction(params)
218
- senders = params[:senders]
219
- receivers = params[:receivers]
220
- asset_id = params[:asset_id]
221
- asset_mixin_id = params[:asset_mixin_id]
222
- amount = params[:amount]
223
- memo = params[:memo]
224
- threshold = params[:threshold]
225
- access_token = params[:access_token]
226
- utxos = params[:utxos]
217
+ def build_raw_transaction(kwargs)
218
+ senders = kwargs[:senders]
219
+ receivers = kwargs[:receivers]
220
+ asset_id = kwargs[:asset_id]
221
+ asset_mixin_id = kwargs[:asset_mixin_id]
222
+ amount = kwargs[:amount]
223
+ memo = kwargs[:memo]
224
+ threshold = kwargs[:threshold]
225
+ access_token = kwargs[:access_token]
226
+ utxos = kwargs[:utxos]
227
227
 
228
228
  raise 'access_token required!' if access_token.nil? && !senders.include?(client_id)
229
229
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MixinBot
4
- VERSION = '0.3.5'
4
+ VERSION = '0.3.6'
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.3.5
4
+ version: 0.3.6
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-01-05 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print