keoken 0.2.8 → 0.3.0

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.
data/spec/keoken_spec.rb CHANGED
@@ -210,8 +210,8 @@ describe Keoken do
210
210
  expect(raw).to end_with('6a0400004b50100000000100000123000000000007a12000000000')
211
211
  end
212
212
  end
213
-
214
- describe 'creates token with Trezor' do
213
+
214
+ describe 'Trezor' do
215
215
  it 'creates token' do
216
216
  mock_requests
217
217
  allow(ENV).to receive(:[]).with('KEOKEN_NODE').and_return('PRODUCTION')
@@ -246,6 +246,85 @@ describe Keoken do
246
246
  )
247
247
  )
248
248
  end
249
+
250
+ it 'sends token' do
251
+ mock_requests
252
+ allow(ENV).to receive(:[]).with('KEOKEN_NODE').and_return('PRODUCTION')
253
+ token = Keoken::Token.new(id: 86)
254
+ token.send_amount(456_342)
255
+ script = token.hex
256
+ @transaction_token = Keoken::Backend::Trezor::Transaction.new
257
+ expect(
258
+ @transaction_token.build_for_send_amount(
259
+ '17wrMVCa9EJUVVEC3c5CZZanjT1NtWU2mX',
260
+ '32tM1kKxnTzcJugmGsavg5MnsJiNZfUUzQ',
261
+ [44, 145, 0, 0, 0],
262
+ script,
263
+ ['ypub6WrVGzkKFeNTTppAVe2KkY3yiohKNvFDZm7qAFKBAu8ozm2DYRmwoXwpQUAaEbLkCJmdGaYBLxBUbJcfeLZcwXEtF9neUCDXuWtVyFDApi6',
264
+ 'ypub6WtFU3UPzgvu1AJzw9Quw6TgNp7FM5ro2AZwcwmkgP4HvdurTiGRSDYKV4YaofGny96xFykeNxJGgt8SiNwhFnBbdmwyiiLVRxoKWTeQnuB']
265
+ )
266
+ ).to(
267
+ eq(
268
+ inputs:
269
+ [
270
+ {
271
+ address_n: [44, 145, 0, 0, 0],
272
+ amount: '8985999',
273
+ multisig: {
274
+ m: 2,
275
+ pubkeys:
276
+ [
277
+ {
278
+ address_n: [44, 145, 0, 0, 0],
279
+ node:
280
+ {
281
+ chain_code: '7bd6545bf255444ba4cf93b893e56deacf59e0b8e065d44673e9afff4e3655c6',
282
+ child_num: 0,
283
+ depth: 0,
284
+ fingerprint: 0,
285
+ public_key: '03db551b0f0962d4cbbf15b6d81dd7dc0e82868867182ec15b1e5e28b90fac97c4'
286
+ }
287
+ },
288
+ {
289
+ address_n: [44, 145, 0, 0, 0],
290
+ node:
291
+ {
292
+ chain_code: '4199329ed001a33fb58fd75bac23c80c0d38cedc009bac8f89c89df91c35bc8e',
293
+ child_num: 0,
294
+ depth: 0,
295
+ fingerprint: 0,
296
+ public_key: '02408f31733a184b6d0dd52a0800bf1a6b02102b9bfcc9c158b508365869c8c73d'
297
+ }
298
+ }
299
+ ],
300
+ signatures: ['', '', '']
301
+ },
302
+ prev_hash: '448a9356f6317eeaa9581f9a39d41431ac74aa2b73438c01e1d522543d14e8da',
303
+ prev_index: 1,
304
+ script_type: 'SPENDMULTISIG'
305
+ }
306
+ ],
307
+ outputs:
308
+ [
309
+ {
310
+ address: 'bitcoincash:qpxrq63y6kz2wphm2nfsh6z23yvjmz7avcc5wsgruw',
311
+ amount: '8756231',
312
+ script_type: 'PAYTOADDRESS'
313
+ },
314
+ {
315
+ address: 'bitcoincash:pqx3eghuvc7kmc4qkwg0qwfjqyedh3wg8qkwanr9pd',
316
+ amount: '114884',
317
+ script_type: 'PAYTOADDRESS'
318
+ },
319
+ {
320
+ amount: '0',
321
+ op_return_data: '6a0400004b50100000000100000086000000000006f696',
322
+ script_type: 'PAYTOOPRETURN'
323
+ }
324
+ ]
325
+ )
326
+ )
327
+ end
249
328
  end
250
329
  end
251
330
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitex
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.18
27
+ - !ruby/object:Gem::Dependency
28
+ name: money-tree
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -138,6 +152,11 @@ files:
138
152
  - doc/Keoken/Bitprim.html
139
153
  - doc/Keoken/Bitprim/Transaction.html
140
154
  - doc/Keoken/DataNotParsed.html
155
+ - doc/Keoken/Error.html
156
+ - doc/Keoken/Error/DataNotParsed.html
157
+ - doc/Keoken/Error/IdNotFound.html
158
+ - doc/Keoken/Error/NameNotFound.html
159
+ - doc/Keoken/Error/OutputNotFound.html
141
160
  - doc/Keoken/IdNotFound.html
142
161
  - doc/Keoken/NameNotFound.html
143
162
  - doc/Keoken/OutputNotFound.html