steem-ruby 0.9.5 → 0.9.6

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: 6ee068c00342f904efe37abe6e2cafa9332b1221cac3598071aefab473cfe996
4
- data.tar.gz: b84eb953f450d52ebabfb1417b2e46a0154aeb8a1066981dcee937480b761632
3
+ metadata.gz: 9a4b00567a00437972e6c98e6e1953a09a057b22eaa7b0bce6c8992aa820b7fd
4
+ data.tar.gz: 798eac69a5ccf2fb41cab5eff144a33d2dd0724fcfeafc43e6516f62ac1e4603
5
5
  SHA512:
6
- metadata.gz: 824809d5a78d22ac1d15c812537e4c6fa11e85e56920cee365c18c18efc932ba7b265f049462407dd3acae1f460e912f0f582d6f2b05f07ebae8075a8c25b02a
7
- data.tar.gz: b5fd1bb775ec114939ac338e9f4a83dee337af072b17d435475c420b84b272880bc5847ab3cb8b88f6f689e661fb2897ac729cc6d540ea8ac1fff1073bba69bc
6
+ metadata.gz: 14932994eeef92859d4252242f60d0fef75afbf3a70254a2ddf820c86aad8b55f4254d3161f50b84a3406805477422138fd1c61506255f8d19061b5d9619cf62
7
+ data.tar.gz: 9053d13c53cdf86a43973a17e147074db03b98b83d05ebb6e18e9db253716eedadfd0c48af2fa047220f539b4b0d6de7d54f5694d754b466141ecd36fae4508c
@@ -70,58 +70,6 @@ module Steem
70
70
  process(options.merge(ops: ops), &block)
71
71
  end
72
72
 
73
- # This operation is used to cast a vote on a post/comment using multiple votable assets.
74
- #
75
- # options = {
76
- # wif: wif,
77
- # params: {
78
- # voter: voter,
79
- # author: author,
80
- # permlink: permlink,
81
- # TODO
82
- # }
83
- # }
84
- #
85
- # Steem::Broadcast.vote2(options) do |result|
86
- # puts result
87
- # end
88
- #
89
- # @param options [Hash] options
90
- # @option options [String] :wif Posting wif
91
- # @option options [Hash] :params
92
- # * :voter (String)
93
- # * :author (String)
94
- # * :permlink (String)
95
- # * :rshares (Array)
96
- # @option options [Boolean] :pretend Just validate, do not broadcast.
97
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_vote
98
- def self.vote2(options, &block)
99
- required_fields = %i(voter author permlink rshares)
100
- params = options[:params]
101
- check_required_fields(params, *required_fields)
102
-
103
- ops = [[:vote2, params]]
104
-
105
- process(options.merge(ops: ops), &block)
106
- end
107
-
108
- # @param options [Hash] options
109
- # @option options [String] :wif Posting wif
110
- # @option options [Hash] :params
111
- # * :account (String)
112
- # * :reward_tokens (Array)
113
- # @option options [Boolean] :pretend Just validate, do not broadcast.
114
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_vote
115
- def self.claim_reward_balance2(options, &block)
116
- required_fields = %i(account reward_tokens)
117
- params = options[:params]
118
- check_required_fields(params, *required_fields)
119
-
120
- ops = [[:claim_reward_balance2, params]]
121
-
122
- process(options.merge(ops: ops), &block)
123
- end
124
-
125
73
  # Creates a post/comment. This method simplifies content creation by
126
74
  # combining `comment` and `comment_options` into one transaction.
127
75
  #
@@ -433,42 +381,6 @@ module Steem
433
381
  process(options.merge(ops: ops), &block)
434
382
  end
435
383
 
436
- # This operation creates a limit order and matches it against existing open
437
- # orders.
438
- #
439
- # @param options [Hash] options
440
- # @option options [String] :wif Active wif
441
- # @option options [Hash] :params
442
- # * :owner (String)
443
- # * :orderid (String)
444
- # * :amount_to_sell (String)
445
- # * :exchange_rate (Hash)
446
- # * :fill_or_kill (Boolean)
447
- # * :expiration (String)
448
- # @option options [Boolean] :pretend Just validate, do not broadcast.
449
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_limit_order_create2
450
- def self.limit_order_create2(options, &block)
451
- required_fields = %i(owner orderid amount_to_sell exchange_rate
452
- fill_or_kill)
453
- params = options[:params]
454
- check_required_fields(params, *required_fields)
455
-
456
- params[:amount_to_sell] = normalize_amount(options.merge amount: params[:amount_to_sell])
457
- params[:exchange_rate] = {
458
- base: normalize_amount(options.merge amount: params[:exchange_rate][:base]),
459
- quote: normalize_amount(options.merge amount: params[:exchange_rate][:quote])
460
- }
461
-
462
- if !!params[:expiration]
463
- params[:expiration] = Time.parse(params[:expiration].to_s)
464
- params[:expiration] = params[:expiration].strftime('%Y-%m-%dT%H:%M:%S')
465
- end
466
-
467
- ops = [[:limit_order_create2, params]]
468
-
469
- process(options.merge(ops: ops), &block)
470
- end
471
-
472
384
  # Cancels an order and returns the balance to owner.
473
385
  #
474
386
  # @param options [Hash] options
@@ -1328,166 +1240,6 @@ module Steem
1328
1240
  process(options.merge(ops: ops), &block)
1329
1241
  end
1330
1242
 
1331
- # @param options [Hash] options
1332
- # @option options [String] :wif Active wif
1333
- # @option options [Hash] :params
1334
- # * :control_account (String)
1335
- # * :symbol (Hash)
1336
- # * :smt_creation_fee (Hash)
1337
- # * :precision (Integer)
1338
- # * :extensions (Array)
1339
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1340
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1341
- def self.smt_create(options, &block)
1342
- required_fields = %i(control_account symbol smt_creation_fee precision)
1343
- params = options[:params]
1344
-
1345
- check_required_fields(params, *required_fields)
1346
-
1347
- params[:smt_creation_fee] = normalize_amount(options.merge amount: params[:smt_creation_fee])
1348
- params[:extensions] ||= []
1349
-
1350
- ops = [[:smt_create, params]]
1351
-
1352
- process(options.merge(ops: ops), &block)
1353
- end
1354
-
1355
- # @param options [Hash] options
1356
- # @option options [String] :wif Active wif
1357
- # @option options [Hash] :params
1358
- # * :control_account (String)
1359
- # * :symbol (Hash)
1360
- # * :contribution_begin_time (String)
1361
- # * :contribution_end_time (String)
1362
- # * :launch_time max_supply (String)
1363
- # * :steem_units_hard_cap (Integer)
1364
- # * :steem_units_soft_cap (Integer)
1365
- # * :steem_units_min (Integer)
1366
- # * initial_generation_policy (String)
1367
- # * :extensions (Array)
1368
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1369
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1370
- def self.smt_setup(options, &block)
1371
- required_fields = %i(control_account symbol contribution_begin_time contribution_end_time launch_time max_supply steem_units_hard_cap steem_units_soft_cap steem_units_min initial_generation_policy)
1372
- params = options[:params]
1373
-
1374
- check_required_fields(params, *required_fields)
1375
-
1376
- params[:extensions] ||= []
1377
-
1378
- ops = [[:smt_setup, params]]
1379
-
1380
- process(options.merge(ops: ops), &block)
1381
- end
1382
-
1383
- # @param options [Hash] options
1384
- # @option options [String] :wif Active wif
1385
- # @option options [Hash] :params
1386
- # * :control_account (String)
1387
- # * :symbol (Hash)
1388
- # * :setup_parameters (Array)
1389
- # * :extensions (Array)
1390
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1391
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1392
- def self.smt_set_setup_parameters(options, &block)
1393
- required_fields = %i(control_account symbol setup_parameters)
1394
- params = options[:params]
1395
-
1396
- check_required_fields(params, *required_fields)
1397
-
1398
- params[:extensions] ||= []
1399
-
1400
- ops = [[:smt_set_setup_parameters, params]]
1401
-
1402
- process(options.merge(ops: ops), &block)
1403
- end
1404
-
1405
- # @param options [Hash] options
1406
- # @option options [String] :wif Active wif
1407
- # @option options [Hash] :params
1408
- # * :control_account (String)
1409
- # * :symbol (Hash)
1410
- # * :runtime_parameters (Array)
1411
- # * :extensions (Array)
1412
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1413
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1414
- def self.smt_set_runtime_parameters(options, &block)
1415
- required_fields = %i(control_account symbol runtime_parameters)
1416
- params = options[:params]
1417
-
1418
- check_required_fields(params, *required_fields)
1419
-
1420
- params[:extensions] ||= []
1421
-
1422
- ops = [[:smt_set_runtime_parameters, params]]
1423
-
1424
- process(options.merge(ops: ops), &block)
1425
- end
1426
-
1427
- # @param options [Hash] options
1428
- # @option options [String] :wif Active wif
1429
- # @option options [Hash] :params
1430
- # * :control_account (String)
1431
- # * :symbol (Hash)
1432
- # * :extensions (Array)
1433
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1434
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1435
- def self.smt_setup_emissions(options, &block)
1436
- required_fields = %i(control_account symbol schedule_time emissions_unit interval_seconds interval_count lep_time rep_time lep_abs_amount rep_abs_amount lep_rel_amount_numerator rep_rel_amount_numerator rel_amount_denom_bits remove floor_emissions)
1437
- params = options[:params]
1438
-
1439
- check_required_fields(params, *required_fields)
1440
-
1441
- params[:extensions] ||= []
1442
-
1443
- ops = [[:smt_setup_emissions, params]]
1444
-
1445
- process(options.merge(ops: ops), &block)
1446
- end
1447
-
1448
- # @param options [Hash] options
1449
- # @option options [String] :wif Active wif
1450
- # @option options [Hash] :params
1451
- # * :control_account (String)
1452
- # * :symbol (Hash)
1453
- # * :extensions (Array)
1454
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1455
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1456
- def self.smt_contribute(options, &block)
1457
- required_fields = %i(contributor symbol contribution_id contribution)
1458
- params = options[:params]
1459
-
1460
- check_required_fields(params, *required_fields)
1461
-
1462
- params[:extensions] ||= []
1463
-
1464
- ops = [[:smt_contribute, params]]
1465
-
1466
- process(options.merge(ops: ops), &block)
1467
- end
1468
-
1469
- # @param options [Hash] options
1470
- # @option options [String] :wif Active wif
1471
- # @option options [Hash] :params
1472
- # * :from_account (String)
1473
- # * :to_pool (String)
1474
- # * :amount (Hash)
1475
- # * :extensions (Array)
1476
- # @option options [Boolean] :pretend Just validate, do not broadcast.
1477
- # @see https://developers.steem.io/apidefinitions/broadcast-ops#broadcast_ops_smt_create
1478
- def self.delegate_to_pool(options, &block)
1479
- required_fields = %i(from_account to_pool amount)
1480
- params = options[:params]
1481
-
1482
- check_required_fields(params, *required_fields)
1483
-
1484
- params[:extensions] ||= []
1485
-
1486
- ops = [[:delegate_to_pool, params]]
1487
-
1488
- process(options.merge(ops: ops), &block)
1489
- end
1490
-
1491
1243
  # @param options [Hash] options
1492
1244
  # @option options [Array<Array<Hash>] :ops Operations to process.
1493
1245
  # @option options [Boolean] :pretend Just validate, do not broadcast.
@@ -3,8 +3,8 @@ module Steem
3
3
  EXPIRE_IN_SECS = 600
4
4
  EXPIRE_IN_SECS_PROPOSAL = 24 * 60 * 60
5
5
 
6
- NETWORKS_STEEM_CHAIN_ID = 'abc93c9021bbd9a8dd21c438ee3c480a661ca1966b5e4e838326dcf42a3dac2d'
7
- NETWORKS_STEEM_ADDRESS_PREFIX = 'TST'
6
+ NETWORKS_STEEM_CHAIN_ID = '0000000000000000000000000000000000000000000000000000000000000000'
7
+ NETWORKS_STEEM_ADDRESS_PREFIX = 'STM'
8
8
  NETWORKS_STEEM_CORE_ASSET = ["0", 3, "@@000000021"] # STEEM
9
9
  NETWORKS_STEEM_DEBT_ASSET = ["0", 3, "@@000000013"] # SBD
10
10
  NETWORKS_STEEM_VEST_ASSET = ["0", 6, "@@000000037"] # VESTS
@@ -24,7 +24,7 @@ module Steem
24
24
  # NETWORKS_STEEM_DEFAULT_NODE = 'https://rpc.steemviz.com'
25
25
  # NETWORKS_STEEM_DEFAULT_NODE = 'https://steemd.steemgigs.org'
26
26
 
27
- NETWORKS_TEST_CHAIN_ID = 'abc93c9021bbd9a8dd21c438ee3c480a661ca1966b5e4e838326dcf42a3dac2d'
27
+ NETWORKS_TEST_CHAIN_ID = '46d82ab7d8db682eb1959aed0ada039a6d49afa1602491f93dde9cac3e8e6c32'
28
28
  NETWORKS_TEST_ADDRESS_PREFIX = 'TST'
29
29
  NETWORKS_TEST_CORE_ASSET = ["0", 3, "@@000000021"] # TESTS
30
30
  NETWORKS_TEST_DEBT_ASSET = ["0", 3, "@@000000013"] # TBD
@@ -1,5 +1,3 @@
1
- require 'pry'
2
-
3
1
  module Steem
4
2
  # {TransactionBuilder} can be used to create a transaction that the
5
3
  # {NetworkBroadcastApi} can broadcast to the rest of the platform. The main
@@ -37,7 +35,7 @@ module Steem
37
35
  alias force_serialize? force_serialize
38
36
 
39
37
  def initialize(options = {})
40
- @app_base = true#!!options[:app_base] # default false
38
+ @app_base = !!options[:app_base] # default false
41
39
  @database_api = options[:database_api]
42
40
  @block_api = options[:block_api]
43
41
 
@@ -51,8 +49,8 @@ module Steem
51
49
 
52
50
  @wif = [options[:wif]].flatten
53
51
  @signed = false
54
- @testnet = true#!!options[:testnet]
55
- @force_serialize = true#!!options[:force_serialize]
52
+ @testnet = !!options[:testnet]
53
+ @force_serialize = !!options[:force_serialize]
56
54
 
57
55
  if !!(trx = options[:trx])
58
56
  trx = case trx
@@ -64,7 +62,7 @@ module Steem
64
62
  end
65
63
 
66
64
  @trx ||= Transaction.new
67
- @chain = options[:chain] || :test
65
+ @chain = options[:chain] || :steem
68
66
  @error_pipe = options[:error_pipe] || STDERR
69
67
  @chain_id = options[:chain_id]
70
68
  @chain_id ||= case @chain
@@ -73,9 +71,9 @@ module Steem
73
71
  else; raise UnsupportedChainError, "Unsupported chain: #{@chain}"
74
72
  end
75
73
 
76
- # if testnet? && @chain_id == NETWORKS_STEEM_CHAIN_ID
77
- # raise UnsupportedChainError, "Unsupported testnet chain id: #{@chain_id}"
78
- # end
74
+ if testnet? && @chain_id == NETWORKS_STEEM_CHAIN_ID
75
+ raise UnsupportedChainError, "Unsupported testnet chain id: #{@chain_id}"
76
+ end
79
77
  end
80
78
 
81
79
  def inspect
@@ -217,7 +215,7 @@ module Steem
217
215
  catch :serialize do; begin
218
216
  transaction_hex.tap do |result|
219
217
  hex = if app_base?
220
- result
218
+ result.hex
221
219
  else
222
220
  result
223
221
  end
@@ -238,7 +236,7 @@ module Steem
238
236
  raise SerializationMismatchError unless @trx == derrived_trx
239
237
  end
240
238
 
241
- hex = hex.to_s[0..-4] # drop empty signature array
239
+ hex = hex[0..-4] # drop empty signature array
242
240
  @trx.id = Digest::SHA256.hexdigest(unhexlify(hex))[0..39]
243
241
 
244
242
  hex = @chain_id + hex
@@ -27,7 +27,7 @@ module Steem
27
27
  when '@@000000013' then 'SBD'
28
28
  when '@@000000021' then 'STEEM'
29
29
  when '@@000000037' then 'VESTS'
30
- # else; raise TypeError, "Asset #{@nai} unknown."
30
+ else; raise TypeError, "Asset #{@nai} unknown."
31
31
  end
32
32
 
33
33
  @amount = "%.#{@precision}f" % (@amount.to_f / 10 ** @precision)
@@ -40,7 +40,7 @@ module Steem
40
40
  when '@@000000013' then 'SBD'
41
41
  when '@@000000021' then 'STEEM'
42
42
  when '@@000000037' then 'VESTS'
43
- # else; raise TypeError, "Asset #{@nai} unknown."
43
+ else; raise TypeError, "Asset #{@nai} unknown."
44
44
  end
45
45
 
46
46
  @amount = "%.#{@precision}f" % (@amount.to_f / 10 ** @precision)
@@ -57,7 +57,7 @@ module Steem
57
57
  when 'SBD' then 3
58
58
  when 'TESTS' then 3
59
59
  when 'TBD' then 3
60
- # else; raise TypeError, "Asset #{@asset} unknown."
60
+ else; raise TypeError, "Asset #{@asset} unknown."
61
61
  end
62
62
  end
63
63
  end
@@ -81,7 +81,7 @@ module Steem
81
81
 
82
82
  def to_h
83
83
  case @asset
84
- when 'STEEM', 'TESTS' then {
84
+ when 'STEEM' then {
85
85
  amount: (@amount.to_f * 1000).to_i.to_s,
86
86
  precision: 3,
87
87
  nai: '@@000000021'
@@ -91,17 +91,11 @@ module Steem
91
91
  precision: 6,
92
92
  nai: '@@000000037'
93
93
  }
94
- when 'SBD', 'TBD' then {
94
+ when 'SBD' then {
95
95
  amount: (@amount.to_f * 1000).to_i.to_s,
96
96
  precision: 3,
97
97
  nai: '@@000000013'
98
98
  }
99
- else
100
- {
101
- amount: (@amount.to_f * (10 ** @precision)).to_i.to_s,
102
- precision: @precision,
103
- nai: @nai
104
- }
105
99
  end
106
100
  end
107
101
 
data/lib/steem/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Steem
2
- VERSION = '0.9.5'
2
+ VERSION = '0.9.6'
3
3
  AGENT_ID = "steem-ruby/#{VERSION}"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steem-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-06 00:00:00.000000000 Z
11
+ date: 2021-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler