minter 0.2.0 → 0.3.0

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: 2fb9bd69dc66c7e056d03f510826cac63ebfdb73e9aa516458660c97fe17998b
4
- data.tar.gz: 77afdd7d8847d641930e16b50779aade041f5afa9634534b955cd68cf253bf89
3
+ metadata.gz: cca09f64ab8a3f6f9121c7781c5cc426115c528db338637fd0e4981f336a2626
4
+ data.tar.gz: db213270516e20bea78292e5bf357a9486ae662a0f965dfc4abbe04865a23dd6
5
5
  SHA512:
6
- metadata.gz: 3fc9c2d0bfa3c85758a931de46ce86afb67b7c0afb253e328ef5e275d9d76db6c5bd8dc97c1de2ce87631a639b5cc1ca7d092a5f5fbb52539ed0560217cd3ab4
7
- data.tar.gz: 37d5fc9507bc6aaf2776ba2fad4215aece8f6c367d80f2e7806032de367781696b3f8f510b16215be8758125b7160304c5bff03637b1ba00a5afad7ac27ef8f9
6
+ metadata.gz: d8e6e0d3532e0a3557b3f12dfc7a6275f49d25cff4b2574be7b0bf335c50c8e4e2fe676434ec0d63b68364ebd8dd7271b630c0eb7e83c14f832d96867b7651c0
7
+ data.tar.gz: 48bd8c44f72558d0e2784151fd1e1b6f0af04544d89d88b4dc7163877ac18c32902c53c2eb7deda527dbc4ceca1d534ad0d065a3dc090f6ede8f1b4410d61c20
@@ -20,6 +20,7 @@ module Minter
20
20
  attach_function :SignRedeemCheckTransaction, [:string], :string
21
21
  attach_function :SignEditCandidateTransaction, [:string], :string
22
22
  attach_function :SignMultiSendTransaction, [:string], :string
23
+ attach_function :SignCreateMultisiqAddressTransaction, [:string], :string
23
24
  end
24
25
  end
25
26
 
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Minter
4
+ class CreateMultisiqAddressTx < Transaction
5
+ SIGN_METHOD = :SignCreateMultisiqAddressTransaction
6
+ attr_accessor :addresses, :threshold, :nonce, :chain_id, :gas_coin, :gas_price
7
+
8
+ def initialize(threshold:, nonce:, chain_id:, gas_coin:, gas_price:)
9
+ @threshold = threshold
10
+ @nonce = nonce
11
+ @chain_id = chain_id
12
+ @gas_coin = gas_coin
13
+ @gas_price = gas_price
14
+ @addresses = []
15
+ end
16
+
17
+ def add_address(address:, weight:)
18
+ @addresses << { Address: address, Weight: weight }
19
+ end
20
+
21
+ def to_params
22
+ {
23
+ Threshold: threshold,
24
+ Nonce: nonce,
25
+ ChainId: chain_id,
26
+ GasCoin: gas_coin,
27
+ GasPrice: gas_price,
28
+ Addresses: addresses
29
+ }
30
+ end
31
+
32
+ def sign(private_key)
33
+ params = to_params
34
+ params[:PrivateKey] = private_key
35
+
36
+ result = JSON.parse(Minter::TransactionFfi.send(self.class::SIGN_METHOD, params.to_json))
37
+ if result["success"]
38
+ [SignedTx.new(result["tx_hash"]), result["multisiq_address"]]
39
+ else
40
+ raise TransactionError, result["error"]
41
+ end
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Minter
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Nikolaev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -167,6 +167,7 @@ files:
167
167
  - lib/minter/key.rb
168
168
  - lib/minter/transactions/buy_coin_tx.rb
169
169
  - lib/minter/transactions/create_coin_tx.rb
170
+ - lib/minter/transactions/create_multisiq_address_tx.rb
170
171
  - lib/minter/transactions/declare_candidacy_tx.rb
171
172
  - lib/minter/transactions/delegate_tx.rb
172
173
  - lib/minter/transactions/edit_candidate_tx.rb