minter 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +28 -4
- data/lib/ffi/transaction/compile.rb +14 -0
- data/lib/ffi/{transaction_ffi.rb → transaction/transaction_ffi.rb} +1 -2
- data/lib/ffi/{go → wallet}/compile.rb +2 -2
- data/lib/ffi/{wallet_ffi.rb → wallet/wallet_ffi.rb} +0 -0
- data/lib/minter/transactions/buy_coin_tx.rb +2 -8
- data/lib/minter/transactions/create_coin_tx.rb +2 -8
- data/lib/minter/transactions/declare_candidacy_tx.rb +3 -8
- data/lib/minter/transactions/delegate_tx.rb +2 -8
- data/lib/minter/transactions/edit_candidate_tx.rb +2 -8
- data/lib/minter/transactions/multi_send_tx.rb +30 -0
- data/lib/minter/transactions/redeem_check_tx.rb +2 -8
- data/lib/minter/transactions/sell_all_coin_tx.rb +2 -8
- data/lib/minter/transactions/sell_coin_tx.rb +2 -8
- data/lib/minter/transactions/send_coin_tx.rb +3 -8
- data/lib/minter/transactions/set_candidate_off_tx.rb +2 -8
- data/lib/minter/transactions/set_candidate_on_tx.rb +2 -8
- data/lib/minter/transactions/transaction.rb +17 -0
- data/lib/minter/transactions/unbond_tx.rb +2 -8
- data/lib/minter/version.rb +1 -1
- data/lib/minter/wallet.rb +3 -2
- data/lib/minter.rb +3 -2
- metadata +8 -14
- data/lib/ffi/transaction-darwin-10.6-amd64.dylib +0 -0
- data/lib/ffi/transaction-darwin-10.6-amd64.h +0 -104
- data/lib/ffi/transaction-linux-amd64.h +0 -104
- data/lib/ffi/transaction-linux-amd64.so +0 -0
- data/lib/ffi/wallet-darwin-10.6-amd64.dylib +0 -0
- data/lib/ffi/wallet-darwin-10.6-amd64.h +0 -86
- data/lib/ffi/wallet-linux-amd64.h +0 -86
- data/lib/ffi/wallet-linux-amd64.so +0 -0
- data/lib/ffi/wallet.h +0 -86
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fb9bd69dc66c7e056d03f510826cac63ebfdb73e9aa516458660c97fe17998b
|
4
|
+
data.tar.gz: 77afdd7d8847d641930e16b50779aade041f5afa9634534b955cd68cf253bf89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fc9c2d0bfa3c85758a931de46ce86afb67b7c0afb253e328ef5e275d9d76db6c5bd8dc97c1de2ce87631a639b5cc1ca7d092a5f5fbb52539ed0560217cd3ab4
|
7
|
+
data.tar.gz: 37d5fc9507bc6aaf2776ba2fad4215aece8f6c367d80f2e7806032de367781696b3f8f510b16215be8758125b7160304c5bff03637b1ba00a5afad7ac27ef8f9
|
data/README.md
CHANGED
@@ -828,16 +828,30 @@ Transaction for creating multisignature address.
|
|
828
828
|
|
829
829
|
Transaction for sending coins to multiple addresses.
|
830
830
|
|
831
|
-
##### Example
|
832
|
-
|
833
831
|
```ruby
|
834
|
-
|
832
|
+
transaction = Minter::MultiSendTx.new(
|
833
|
+
nonce: 1,
|
834
|
+
chain_id: 2,
|
835
|
+
gas_coin: "MNT",
|
836
|
+
gas_price: 1
|
837
|
+
)
|
838
|
+
|
839
|
+
transaction.add_item(
|
840
|
+
symbol: "MNT",
|
841
|
+
address_to: "Mxfe60014a6e9ac91618f5d1cab3fd58cded61ee99",
|
842
|
+
value: 100_000_000_000_000_000
|
843
|
+
)
|
844
|
+
|
845
|
+
transaction.add_item(
|
846
|
+
symbol: "MNT",
|
847
|
+
address_to: "Mxddab6281766ad86497741ff91b6b48fe85012e3c",
|
848
|
+
value: 200_000_000_000_000_000
|
849
|
+
)
|
835
850
|
```
|
836
851
|
### Get fee of transaction
|
837
852
|
```ruby
|
838
853
|
# IN PROGRESS
|
839
854
|
```
|
840
|
-
|
841
855
|
### Decode Transaction
|
842
856
|
|
843
857
|
```ruby
|
@@ -895,6 +909,16 @@ wallet = Minter::Wallet.new
|
|
895
909
|
# "Mp961589ae817659c6bb323587faa9a92a91b5e8481dd3b73ad0dc680464dac5adbc2d498064598bc36e158436fb1861245ef909a1776e5cb50221db718c82a483">
|
896
910
|
```
|
897
911
|
|
912
|
+
#### Build wallet from mnemonic
|
913
|
+
```ruby
|
914
|
+
mnemonic = "hurt orient quarter item can into zebra west either ship team pattern"
|
915
|
+
wallet = Minter::Wallet.new(mnemonic)
|
916
|
+
=> #<Minter::Wallet:0x00007fb7019cdaf0
|
917
|
+
@address="Mx3f865a277ef9e901280d0e607294be9a654860ea",
|
918
|
+
@mnemonic="hurt orient quarter item can into zebra west either ship team pattern",
|
919
|
+
@private_key="0ce363580a20351d995dbafc8942f61c0094f38d0d4f837d1f0c37a9f3c3c7ca",
|
920
|
+
@public_key="Mp7084eec27577ffd4151b54bf7d8ed500a514629fea4e5992bb94a704011d89225be0543fd0a27069b7855c0d260aa21011380843d03d18aabc2bb1e4d4c80e15">
|
921
|
+
```
|
898
922
|
|
899
923
|
### Minter Key
|
900
924
|
#### Generate mnemonic.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
out_path = './transaction'
|
2
|
+
arg_string = ""
|
3
|
+
{
|
4
|
+
out: out_path,
|
5
|
+
targets: ['linux/amd64', 'darwin/amd64'],
|
6
|
+
buildmode: 'c-shared',
|
7
|
+
}.each_pair do |name, args|
|
8
|
+
arg_string += "-#{name}"
|
9
|
+
arg_string += "=#{[args].flatten.join(',')}" unless args.nil?
|
10
|
+
arg_string += " "
|
11
|
+
end
|
12
|
+
|
13
|
+
puts "xgo #{arg_string.strip} ./"
|
14
|
+
system("xgo #{arg_string.strip} ./")
|
@@ -7,7 +7,6 @@ module Minter
|
|
7
7
|
filename = RUBY_PLATFORM.match('darwin') ? "/transaction-darwin-10.6-amd64.dylib" : "/transaction-linux-amd64.so"
|
8
8
|
ffi_lib File.join(File.dirname(__FILE__), filename)
|
9
9
|
attach_function :SignTransaction, [:string], :string
|
10
|
-
attach_function :TransactionHash, [:string], :string
|
11
10
|
attach_function :DecodeTransaction, [:string], :string
|
12
11
|
attach_function :SignCreateCoinTransaction, [:string], :string
|
13
12
|
attach_function :SignSellCoinTransaction, [:string], :string
|
@@ -20,7 +19,7 @@ module Minter
|
|
20
19
|
attach_function :SignSetCandidateOnTransaction, [:string], :string
|
21
20
|
attach_function :SignRedeemCheckTransaction, [:string], :string
|
22
21
|
attach_function :SignEditCandidateTransaction, [:string], :string
|
23
|
-
|
22
|
+
attach_function :SignMultiSendTransaction, [:string], :string
|
24
23
|
end
|
25
24
|
end
|
26
25
|
|
File without changes
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class BuyCoinTx
|
4
|
+
class BuyCoinTx < Transaction
|
5
|
+
SIGN_METHOD = :SignBuyCoinTransaction
|
5
6
|
attr_accessor :coin_to_buy, :value_to_buy, :coin_to_sell, :maximum_value_to_sell, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(coin_to_buy:, value_to_buy:, coin_to_sell:, maximum_value_to_sell:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -15,13 +16,6 @@ module Minter
|
|
15
16
|
@gas_price = gas_price
|
16
17
|
end
|
17
18
|
|
18
|
-
def sign(private_key)
|
19
|
-
params = to_params
|
20
|
-
params[:PrivateKey] = private_key
|
21
|
-
tx_hash = Minter::TransactionFfi.SignBuyCoinTransaction(params.to_json)
|
22
|
-
SignedTx.new(tx_hash)
|
23
|
-
end
|
24
|
-
|
25
19
|
def to_params
|
26
20
|
{ CoinToBuy: coin_to_buy,
|
27
21
|
ValueToBuy: value_to_buy,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class CreateCoinTx
|
4
|
+
class CreateCoinTx < Transaction
|
5
|
+
SIGN_METHOD = :SignCreateCoinTransaction
|
5
6
|
attr_accessor :name, :symbol, :initial_amount, :max_supply, :initial_reserve, :reserve_ratio, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(name:, symbol:, initial_amount:, max_supply:, initial_reserve:, reserve_ratio:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -17,13 +18,6 @@ module Minter
|
|
17
18
|
@gas_price = gas_price
|
18
19
|
end
|
19
20
|
|
20
|
-
def sign(private_key)
|
21
|
-
params = to_params
|
22
|
-
params[:PrivateKey] = private_key
|
23
|
-
tx_hash = Minter::TransactionFfi.SignCreateCoinTransaction(params.to_json)
|
24
|
-
SignedTx.new(tx_hash)
|
25
|
-
end
|
26
|
-
|
27
21
|
def to_params
|
28
22
|
{ Name: name,
|
29
23
|
Symbol: symbol,
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class DeclareCandidacyTx
|
4
|
+
class DeclareCandidacyTx < Transaction
|
5
|
+
SIGN_METHOD = :SignDeclareCandidacyTransaction
|
6
|
+
|
5
7
|
attr_accessor :address, :pubkey, :commission, :coin, :stake, :nonce, :chain_id, :gas_coin, :gas_price
|
6
8
|
|
7
9
|
def initialize(address:, pubkey:, commission:, coin:, stake:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -16,13 +18,6 @@ module Minter
|
|
16
18
|
@gas_price = gas_price
|
17
19
|
end
|
18
20
|
|
19
|
-
def sign(private_key)
|
20
|
-
params = to_params
|
21
|
-
params[:PrivateKey] = private_key
|
22
|
-
tx_hash = Minter::TransactionFfi.SignDeclareCandidacyTransaction(params.to_json)
|
23
|
-
SignedTx.new(tx_hash)
|
24
|
-
end
|
25
|
-
|
26
21
|
def to_params
|
27
22
|
{ Address: address,
|
28
23
|
PubKey: pubkey,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class DelegateTx
|
4
|
+
class DelegateTx < Transaction
|
5
|
+
SIGN_METHOD = :SignDelegateTransaction
|
5
6
|
attr_accessor :pubkey, :coin, :value, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(pubkey:, coin:, value:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +15,6 @@ module Minter
|
|
14
15
|
@gas_price = gas_price
|
15
16
|
end
|
16
17
|
|
17
|
-
def sign(private_key)
|
18
|
-
params = to_params
|
19
|
-
params[:PrivateKey] = private_key
|
20
|
-
tx_hash = Minter::TransactionFfi.SignDelegateTransaction(params.to_json)
|
21
|
-
SignedTx.new(tx_hash)
|
22
|
-
end
|
23
|
-
|
24
18
|
def to_params
|
25
19
|
{ PubKey: pubkey,
|
26
20
|
Coin: coin,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class EditCandidateTx
|
4
|
+
class EditCandidateTx < Transaction
|
5
|
+
SIGN_METHOD = :SignEditCandidateTransaction
|
5
6
|
attr_accessor :pubkey, :reward_address, :owner_address, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(pubkey:, reward_address:, owner_address:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +15,6 @@ module Minter
|
|
14
15
|
@gas_price = gas_price
|
15
16
|
end
|
16
17
|
|
17
|
-
def sign(private_key)
|
18
|
-
params = to_params
|
19
|
-
params[:PrivateKey] = private_key
|
20
|
-
tx_hash = Minter::TransactionFfi.SignEditCandidateTransaction(params.to_json)
|
21
|
-
SignedTx.new(tx_hash)
|
22
|
-
end
|
23
|
-
|
24
18
|
def to_params
|
25
19
|
{ PubKey: pubkey,
|
26
20
|
RewardAddress: reward_address,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Minter
|
4
|
+
class MultiSendTx < Transaction
|
5
|
+
SIGN_METHOD = :SignMultiSendTransaction
|
6
|
+
attr_accessor :items, :coin, :nonce, :chain_id, :gas_coin, :gas_price
|
7
|
+
|
8
|
+
def initialize(nonce:, chain_id:, gas_coin:, gas_price:)
|
9
|
+
@nonce = nonce
|
10
|
+
@chain_id = chain_id
|
11
|
+
@gas_coin = gas_coin
|
12
|
+
@gas_price = gas_price
|
13
|
+
@items = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_item(symbol:, value:, address_to:)
|
17
|
+
@items << { Symbol: symbol, Value: value, AddressTo: address_to }
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_params
|
21
|
+
{
|
22
|
+
Nonce: nonce,
|
23
|
+
ChainId: chain_id,
|
24
|
+
GasCoin: gas_coin,
|
25
|
+
GasPrice: gas_price,
|
26
|
+
Items: items
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class RedeemCheckTx
|
4
|
+
class RedeemCheckTx < Transaction
|
5
|
+
SIGN_METHOD = :SignRedeemCheckTransaction
|
5
6
|
attr_accessor :check, :proof, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(check:, proof:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -13,13 +14,6 @@ module Minter
|
|
13
14
|
@gas_price = gas_price
|
14
15
|
end
|
15
16
|
|
16
|
-
def sign(private_key)
|
17
|
-
params = to_params
|
18
|
-
params[:PrivateKey] = private_key
|
19
|
-
tx_hash = Minter::TransactionFfi.SignRedeemCheckTransaction(params.to_json)
|
20
|
-
SignedTx.new(tx_hash)
|
21
|
-
end
|
22
|
-
|
23
17
|
def to_params
|
24
18
|
{ Check: check,
|
25
19
|
Proof: proof,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class SellAllCoinTx
|
4
|
+
class SellAllCoinTx < Transaction
|
5
|
+
SIGN_METHOD = :SignSellAllCoinTransaction
|
5
6
|
attr_accessor :coin_to_sell, :coin_to_buy, :minimum_value_to_buy, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(coin_to_sell:, coin_to_buy:, minimum_value_to_buy:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +15,6 @@ module Minter
|
|
14
15
|
@gas_price = gas_price
|
15
16
|
end
|
16
17
|
|
17
|
-
def sign(private_key)
|
18
|
-
params = to_params
|
19
|
-
params[:PrivateKey] = private_key
|
20
|
-
tx_hash = Minter::TransactionFfi.SignSellAllCoinTransaction(params.to_json)
|
21
|
-
SignedTx.new(tx_hash)
|
22
|
-
end
|
23
|
-
|
24
18
|
def to_params
|
25
19
|
{ CoinToSell: coin_to_sell,
|
26
20
|
CoinToBuy: coin_to_buy,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class SellCoinTx
|
4
|
+
class SellCoinTx < Transaction
|
5
|
+
SIGN_METHOD = :SignSellCoinTransaction
|
5
6
|
attr_accessor :coin_to_sell, :value_to_sell, :coin_to_buy, :minimum_value_to_buy, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(coin_to_sell:, value_to_sell:, coin_to_buy:, minimum_value_to_buy:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -15,13 +16,6 @@ module Minter
|
|
15
16
|
@gas_price = gas_price
|
16
17
|
end
|
17
18
|
|
18
|
-
def sign(private_key)
|
19
|
-
params = to_params
|
20
|
-
params[:PrivateKey] = private_key
|
21
|
-
tx_hash = Minter::TransactionFfi.SignSellCoinTransaction(params.to_json)
|
22
|
-
SignedTx.new(tx_hash)
|
23
|
-
end
|
24
|
-
|
25
19
|
def to_params
|
26
20
|
{ CoinToSell: coin_to_sell,
|
27
21
|
ValueToSell: value_to_sell,
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class SendCoinTx
|
4
|
+
class SendCoinTx < Transaction
|
5
|
+
SIGN_METHOD = :SignTransaction
|
6
|
+
|
5
7
|
attr_accessor :type, :address_to, :value, :coin, :nonce, :chain_id, :gas_coin, :gas_price
|
6
8
|
|
7
9
|
def initialize(address_to:, value:, coin:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +16,6 @@ module Minter
|
|
14
16
|
@gas_price = gas_price
|
15
17
|
end
|
16
18
|
|
17
|
-
def sign(private_key)
|
18
|
-
params = to_params
|
19
|
-
params[:PrivateKey] = private_key
|
20
|
-
tx_hash = Minter::TransactionFfi.SignTransaction(params.to_json)
|
21
|
-
SignedTx.new(tx_hash)
|
22
|
-
end
|
23
|
-
|
24
19
|
def to_params
|
25
20
|
{ AddressTo: address_to,
|
26
21
|
Value: value,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class SetCandidateOffTx
|
4
|
+
class SetCandidateOffTx < Transaction
|
5
|
+
SIGN_METHOD = :SignSetCandidateOffTransaction
|
5
6
|
attr_accessor :pubkey, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(pubkey:, nonce:, chain_id:, gas_coin:, gas_price:)
|
@@ -12,13 +13,6 @@ module Minter
|
|
12
13
|
@gas_price = gas_price
|
13
14
|
end
|
14
15
|
|
15
|
-
def sign(private_key)
|
16
|
-
params = to_params
|
17
|
-
params[:PrivateKey] = private_key
|
18
|
-
tx_hash = Minter::TransactionFfi.SignSetCandidateOffTransaction(params.to_json)
|
19
|
-
SignedTx.new(tx_hash)
|
20
|
-
end
|
21
|
-
|
22
16
|
def to_params
|
23
17
|
{ PubKey: pubkey,
|
24
18
|
Nonce: nonce,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class SetCandidateOnTx
|
4
|
+
class SetCandidateOnTx < Transaction
|
5
|
+
SIGN_METHOD = :SignSetCandidateOnTransaction
|
5
6
|
attr_accessor :pubkey, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(pubkey:, nonce:, chain_id:, gas_coin:, gas_price:)
|
@@ -12,13 +13,6 @@ module Minter
|
|
12
13
|
@gas_price = gas_price
|
13
14
|
end
|
14
15
|
|
15
|
-
def sign(private_key)
|
16
|
-
params = to_params
|
17
|
-
params[:PrivateKey] = private_key
|
18
|
-
tx_hash = Minter::TransactionFfi.SignSetCandidateOnTransaction(params.to_json)
|
19
|
-
SignedTx.new(tx_hash)
|
20
|
-
end
|
21
|
-
|
22
16
|
def to_params
|
23
17
|
{ PubKey: pubkey,
|
24
18
|
Nonce: nonce,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Minter
|
2
|
+
class TransactionError < StandardError; end
|
3
|
+
|
4
|
+
class Transaction
|
5
|
+
def sign(private_key)
|
6
|
+
params = to_params
|
7
|
+
params[:PrivateKey] = private_key
|
8
|
+
|
9
|
+
result = JSON.parse(Minter::TransactionFfi.send(self.class::SIGN_METHOD, params.to_json))
|
10
|
+
if result["success"]
|
11
|
+
SignedTx.new(result["tx_hash"])
|
12
|
+
else
|
13
|
+
raise TransactionError.new(result["error"])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class UnbondTx
|
4
|
+
class UnbondTx < Transaction
|
5
|
+
SIGN_METHOD = :SignUnbondTransaction
|
5
6
|
attr_accessor :pubkey, :coin, :value, :nonce, :chain_id, :gas_coin, :gas_price
|
6
7
|
|
7
8
|
def initialize(pubkey:, coin:, value:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +15,6 @@ module Minter
|
|
14
15
|
@gas_price = gas_price
|
15
16
|
end
|
16
17
|
|
17
|
-
def sign(private_key)
|
18
|
-
params = to_params
|
19
|
-
params[:PrivateKey] = private_key
|
20
|
-
tx_hash = Minter::TransactionFfi.SignUnbondTransaction(params.to_json)
|
21
|
-
SignedTx.new(tx_hash)
|
22
|
-
end
|
23
|
-
|
24
18
|
def to_params
|
25
19
|
{ PubKey: pubkey,
|
26
20
|
Coin: coin,
|
data/lib/minter/version.rb
CHANGED
data/lib/minter/wallet.rb
CHANGED
@@ -3,8 +3,9 @@
|
|
3
3
|
module Minter
|
4
4
|
class Wallet
|
5
5
|
attr_reader :seed, :private_key, :public_key, :mnemonic, :address
|
6
|
-
def initialize(
|
7
|
-
@mnemonic =
|
6
|
+
def initialize(mnemonic = nil)
|
7
|
+
@mnemonic = mnemonic
|
8
|
+
@mnemonic ||= Minter::WalletFfi.NewMnemonic
|
8
9
|
@private_key = Minter::WalletFfi.PrivateKeyFromMnemonic(@mnemonic)
|
9
10
|
@public_key = Minter::WalletFfi.PublicKeyFromPrivateKey(@private_key)
|
10
11
|
@address = Minter::WalletFfi.AddressFromMnemonic(@mnemonic)
|
data/lib/minter.rb
CHANGED
@@ -6,8 +6,9 @@ require "minter/api/client"
|
|
6
6
|
require "minter/version"
|
7
7
|
require "minter/wallet.rb"
|
8
8
|
require "minter/key.rb"
|
9
|
-
require "ffi/wallet_ffi.rb"
|
10
|
-
require "ffi/transaction_ffi.rb"
|
9
|
+
require "ffi/wallet/wallet_ffi.rb"
|
10
|
+
require "ffi/transaction/transaction_ffi.rb"
|
11
|
+
require "minter/transactions/transaction.rb"
|
11
12
|
Dir[File.dirname(__FILE__) + "/minter/transactions/*.rb"].each { |file| require_relative file }
|
12
13
|
|
13
14
|
module Minter
|
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -141,18 +141,10 @@ files:
|
|
141
141
|
- README.md
|
142
142
|
- bin/console
|
143
143
|
- bin/setup
|
144
|
-
- lib/ffi/
|
145
|
-
- lib/ffi/transaction
|
146
|
-
- lib/ffi/
|
147
|
-
- lib/ffi/
|
148
|
-
- lib/ffi/transaction-linux-amd64.so
|
149
|
-
- lib/ffi/transaction_ffi.rb
|
150
|
-
- lib/ffi/wallet-darwin-10.6-amd64.dylib
|
151
|
-
- lib/ffi/wallet-darwin-10.6-amd64.h
|
152
|
-
- lib/ffi/wallet-linux-amd64.h
|
153
|
-
- lib/ffi/wallet-linux-amd64.so
|
154
|
-
- lib/ffi/wallet.h
|
155
|
-
- lib/ffi/wallet_ffi.rb
|
144
|
+
- lib/ffi/transaction/compile.rb
|
145
|
+
- lib/ffi/transaction/transaction_ffi.rb
|
146
|
+
- lib/ffi/wallet/compile.rb
|
147
|
+
- lib/ffi/wallet/wallet_ffi.rb
|
156
148
|
- lib/minter.rb
|
157
149
|
- lib/minter/api/client.rb
|
158
150
|
- lib/minter/api/connection.rb
|
@@ -178,6 +170,7 @@ files:
|
|
178
170
|
- lib/minter/transactions/declare_candidacy_tx.rb
|
179
171
|
- lib/minter/transactions/delegate_tx.rb
|
180
172
|
- lib/minter/transactions/edit_candidate_tx.rb
|
173
|
+
- lib/minter/transactions/multi_send_tx.rb
|
181
174
|
- lib/minter/transactions/redeem_check_tx.rb
|
182
175
|
- lib/minter/transactions/sell_all_coin_tx.rb
|
183
176
|
- lib/minter/transactions/sell_coin_tx.rb
|
@@ -185,6 +178,7 @@ files:
|
|
185
178
|
- lib/minter/transactions/set_candidate_off_tx.rb
|
186
179
|
- lib/minter/transactions/set_candidate_on_tx.rb
|
187
180
|
- lib/minter/transactions/signed_tx.rb
|
181
|
+
- lib/minter/transactions/transaction.rb
|
188
182
|
- lib/minter/transactions/unbond_tx.rb
|
189
183
|
- lib/minter/version.rb
|
190
184
|
- lib/minter/wallet.rb
|
Binary file
|
@@ -1,104 +0,0 @@
|
|
1
|
-
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
|
-
|
3
|
-
/* package mod */
|
4
|
-
|
5
|
-
|
6
|
-
#line 1 "cgo-builtin-export-prolog"
|
7
|
-
|
8
|
-
#include <stddef.h> /* for ptrdiff_t below */
|
9
|
-
|
10
|
-
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
11
|
-
#define GO_CGO_EXPORT_PROLOGUE_H
|
12
|
-
|
13
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
14
|
-
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
18
|
-
|
19
|
-
/* Start of preamble from import "C" comments. */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
/* End of preamble from import "C" comments. */
|
25
|
-
|
26
|
-
|
27
|
-
/* Start of boilerplate cgo prologue. */
|
28
|
-
#line 1 "cgo-gcc-export-header-prolog"
|
29
|
-
|
30
|
-
#ifndef GO_CGO_PROLOGUE_H
|
31
|
-
#define GO_CGO_PROLOGUE_H
|
32
|
-
|
33
|
-
typedef signed char GoInt8;
|
34
|
-
typedef unsigned char GoUint8;
|
35
|
-
typedef short GoInt16;
|
36
|
-
typedef unsigned short GoUint16;
|
37
|
-
typedef int GoInt32;
|
38
|
-
typedef unsigned int GoUint32;
|
39
|
-
typedef long long GoInt64;
|
40
|
-
typedef unsigned long long GoUint64;
|
41
|
-
typedef GoInt64 GoInt;
|
42
|
-
typedef GoUint64 GoUint;
|
43
|
-
typedef __SIZE_TYPE__ GoUintptr;
|
44
|
-
typedef float GoFloat32;
|
45
|
-
typedef double GoFloat64;
|
46
|
-
typedef float _Complex GoComplex64;
|
47
|
-
typedef double _Complex GoComplex128;
|
48
|
-
|
49
|
-
/*
|
50
|
-
static assertion to make sure the file is being used on architecture
|
51
|
-
at least with matching size of GoInt.
|
52
|
-
*/
|
53
|
-
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
54
|
-
|
55
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
56
|
-
typedef _GoString_ GoString;
|
57
|
-
#endif
|
58
|
-
typedef void *GoMap;
|
59
|
-
typedef void *GoChan;
|
60
|
-
typedef struct { void *t; void *v; } GoInterface;
|
61
|
-
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
62
|
-
|
63
|
-
#endif
|
64
|
-
|
65
|
-
/* End of boilerplate cgo prologue. */
|
66
|
-
|
67
|
-
#ifdef __cplusplus
|
68
|
-
extern "C" {
|
69
|
-
#endif
|
70
|
-
|
71
|
-
|
72
|
-
extern char* SignTransaction(char* p0);
|
73
|
-
|
74
|
-
extern char* TransactionHash(char* p0);
|
75
|
-
|
76
|
-
extern char* DecodeTransaction(char* p0);
|
77
|
-
|
78
|
-
extern char* SignCreateCoinTransaction(char* p0);
|
79
|
-
|
80
|
-
extern char* SignSellCoinTransaction(char* p0);
|
81
|
-
|
82
|
-
extern char* SignBuyCoinTransaction(char* p0);
|
83
|
-
|
84
|
-
extern char* SignSellAllCoinTransaction(char* p0);
|
85
|
-
|
86
|
-
extern char* SignDeclareCandidacyTransaction(char* p0);
|
87
|
-
|
88
|
-
extern char* SignDelegateTransaction(char* p0);
|
89
|
-
|
90
|
-
extern char* SignUnbondTransaction(char* p0);
|
91
|
-
|
92
|
-
extern char* SignSetCandidateOffTransaction(char* p0);
|
93
|
-
|
94
|
-
extern char* SignSetCandidateOnTransaction(char* p0);
|
95
|
-
|
96
|
-
extern char* SignRedeemCheckTransaction(char* p0);
|
97
|
-
|
98
|
-
extern char* SignEditCandidateTransaction(char* p0);
|
99
|
-
|
100
|
-
extern char* SignMultiSendTransaction(char* p0);
|
101
|
-
|
102
|
-
#ifdef __cplusplus
|
103
|
-
}
|
104
|
-
#endif
|
@@ -1,104 +0,0 @@
|
|
1
|
-
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
|
-
|
3
|
-
/* package mod */
|
4
|
-
|
5
|
-
|
6
|
-
#line 1 "cgo-builtin-export-prolog"
|
7
|
-
|
8
|
-
#include <stddef.h> /* for ptrdiff_t below */
|
9
|
-
|
10
|
-
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
11
|
-
#define GO_CGO_EXPORT_PROLOGUE_H
|
12
|
-
|
13
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
14
|
-
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
18
|
-
|
19
|
-
/* Start of preamble from import "C" comments. */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
/* End of preamble from import "C" comments. */
|
25
|
-
|
26
|
-
|
27
|
-
/* Start of boilerplate cgo prologue. */
|
28
|
-
#line 1 "cgo-gcc-export-header-prolog"
|
29
|
-
|
30
|
-
#ifndef GO_CGO_PROLOGUE_H
|
31
|
-
#define GO_CGO_PROLOGUE_H
|
32
|
-
|
33
|
-
typedef signed char GoInt8;
|
34
|
-
typedef unsigned char GoUint8;
|
35
|
-
typedef short GoInt16;
|
36
|
-
typedef unsigned short GoUint16;
|
37
|
-
typedef int GoInt32;
|
38
|
-
typedef unsigned int GoUint32;
|
39
|
-
typedef long long GoInt64;
|
40
|
-
typedef unsigned long long GoUint64;
|
41
|
-
typedef GoInt64 GoInt;
|
42
|
-
typedef GoUint64 GoUint;
|
43
|
-
typedef __SIZE_TYPE__ GoUintptr;
|
44
|
-
typedef float GoFloat32;
|
45
|
-
typedef double GoFloat64;
|
46
|
-
typedef float _Complex GoComplex64;
|
47
|
-
typedef double _Complex GoComplex128;
|
48
|
-
|
49
|
-
/*
|
50
|
-
static assertion to make sure the file is being used on architecture
|
51
|
-
at least with matching size of GoInt.
|
52
|
-
*/
|
53
|
-
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
54
|
-
|
55
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
56
|
-
typedef _GoString_ GoString;
|
57
|
-
#endif
|
58
|
-
typedef void *GoMap;
|
59
|
-
typedef void *GoChan;
|
60
|
-
typedef struct { void *t; void *v; } GoInterface;
|
61
|
-
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
62
|
-
|
63
|
-
#endif
|
64
|
-
|
65
|
-
/* End of boilerplate cgo prologue. */
|
66
|
-
|
67
|
-
#ifdef __cplusplus
|
68
|
-
extern "C" {
|
69
|
-
#endif
|
70
|
-
|
71
|
-
|
72
|
-
extern char* SignTransaction(char* p0);
|
73
|
-
|
74
|
-
extern char* TransactionHash(char* p0);
|
75
|
-
|
76
|
-
extern char* DecodeTransaction(char* p0);
|
77
|
-
|
78
|
-
extern char* SignCreateCoinTransaction(char* p0);
|
79
|
-
|
80
|
-
extern char* SignSellCoinTransaction(char* p0);
|
81
|
-
|
82
|
-
extern char* SignBuyCoinTransaction(char* p0);
|
83
|
-
|
84
|
-
extern char* SignSellAllCoinTransaction(char* p0);
|
85
|
-
|
86
|
-
extern char* SignDeclareCandidacyTransaction(char* p0);
|
87
|
-
|
88
|
-
extern char* SignDelegateTransaction(char* p0);
|
89
|
-
|
90
|
-
extern char* SignUnbondTransaction(char* p0);
|
91
|
-
|
92
|
-
extern char* SignSetCandidateOffTransaction(char* p0);
|
93
|
-
|
94
|
-
extern char* SignSetCandidateOnTransaction(char* p0);
|
95
|
-
|
96
|
-
extern char* SignRedeemCheckTransaction(char* p0);
|
97
|
-
|
98
|
-
extern char* SignEditCandidateTransaction(char* p0);
|
99
|
-
|
100
|
-
extern char* SignMultiSendTransaction(char* p0);
|
101
|
-
|
102
|
-
#ifdef __cplusplus
|
103
|
-
}
|
104
|
-
#endif
|
Binary file
|
Binary file
|
@@ -1,86 +0,0 @@
|
|
1
|
-
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
|
-
|
3
|
-
/* package mod */
|
4
|
-
|
5
|
-
|
6
|
-
#line 1 "cgo-builtin-export-prolog"
|
7
|
-
|
8
|
-
#include <stddef.h> /* for ptrdiff_t below */
|
9
|
-
|
10
|
-
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
11
|
-
#define GO_CGO_EXPORT_PROLOGUE_H
|
12
|
-
|
13
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
14
|
-
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
18
|
-
|
19
|
-
/* Start of preamble from import "C" comments. */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
/* End of preamble from import "C" comments. */
|
25
|
-
|
26
|
-
|
27
|
-
/* Start of boilerplate cgo prologue. */
|
28
|
-
#line 1 "cgo-gcc-export-header-prolog"
|
29
|
-
|
30
|
-
#ifndef GO_CGO_PROLOGUE_H
|
31
|
-
#define GO_CGO_PROLOGUE_H
|
32
|
-
|
33
|
-
typedef signed char GoInt8;
|
34
|
-
typedef unsigned char GoUint8;
|
35
|
-
typedef short GoInt16;
|
36
|
-
typedef unsigned short GoUint16;
|
37
|
-
typedef int GoInt32;
|
38
|
-
typedef unsigned int GoUint32;
|
39
|
-
typedef long long GoInt64;
|
40
|
-
typedef unsigned long long GoUint64;
|
41
|
-
typedef GoInt64 GoInt;
|
42
|
-
typedef GoUint64 GoUint;
|
43
|
-
typedef __SIZE_TYPE__ GoUintptr;
|
44
|
-
typedef float GoFloat32;
|
45
|
-
typedef double GoFloat64;
|
46
|
-
typedef float _Complex GoComplex64;
|
47
|
-
typedef double _Complex GoComplex128;
|
48
|
-
|
49
|
-
/*
|
50
|
-
static assertion to make sure the file is being used on architecture
|
51
|
-
at least with matching size of GoInt.
|
52
|
-
*/
|
53
|
-
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
54
|
-
|
55
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
56
|
-
typedef _GoString_ GoString;
|
57
|
-
#endif
|
58
|
-
typedef void *GoMap;
|
59
|
-
typedef void *GoChan;
|
60
|
-
typedef struct { void *t; void *v; } GoInterface;
|
61
|
-
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
62
|
-
|
63
|
-
#endif
|
64
|
-
|
65
|
-
/* End of boilerplate cgo prologue. */
|
66
|
-
|
67
|
-
#ifdef __cplusplus
|
68
|
-
extern "C" {
|
69
|
-
#endif
|
70
|
-
|
71
|
-
|
72
|
-
extern char* NewMnemonic();
|
73
|
-
|
74
|
-
extern char* PrivateKeyFromMnemonic(char* p0);
|
75
|
-
|
76
|
-
extern char* PublicKeyFromPrivateKey(char* p0);
|
77
|
-
|
78
|
-
extern char* AddressFromMnemonic(char* p0);
|
79
|
-
|
80
|
-
extern char* AddressFromPrivateKey(char* p0);
|
81
|
-
|
82
|
-
extern char* AddressFromPublicKey(char* p0);
|
83
|
-
|
84
|
-
#ifdef __cplusplus
|
85
|
-
}
|
86
|
-
#endif
|
@@ -1,86 +0,0 @@
|
|
1
|
-
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
|
-
|
3
|
-
/* package mod */
|
4
|
-
|
5
|
-
|
6
|
-
#line 1 "cgo-builtin-export-prolog"
|
7
|
-
|
8
|
-
#include <stddef.h> /* for ptrdiff_t below */
|
9
|
-
|
10
|
-
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
11
|
-
#define GO_CGO_EXPORT_PROLOGUE_H
|
12
|
-
|
13
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
14
|
-
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
18
|
-
|
19
|
-
/* Start of preamble from import "C" comments. */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
/* End of preamble from import "C" comments. */
|
25
|
-
|
26
|
-
|
27
|
-
/* Start of boilerplate cgo prologue. */
|
28
|
-
#line 1 "cgo-gcc-export-header-prolog"
|
29
|
-
|
30
|
-
#ifndef GO_CGO_PROLOGUE_H
|
31
|
-
#define GO_CGO_PROLOGUE_H
|
32
|
-
|
33
|
-
typedef signed char GoInt8;
|
34
|
-
typedef unsigned char GoUint8;
|
35
|
-
typedef short GoInt16;
|
36
|
-
typedef unsigned short GoUint16;
|
37
|
-
typedef int GoInt32;
|
38
|
-
typedef unsigned int GoUint32;
|
39
|
-
typedef long long GoInt64;
|
40
|
-
typedef unsigned long long GoUint64;
|
41
|
-
typedef GoInt64 GoInt;
|
42
|
-
typedef GoUint64 GoUint;
|
43
|
-
typedef __SIZE_TYPE__ GoUintptr;
|
44
|
-
typedef float GoFloat32;
|
45
|
-
typedef double GoFloat64;
|
46
|
-
typedef float _Complex GoComplex64;
|
47
|
-
typedef double _Complex GoComplex128;
|
48
|
-
|
49
|
-
/*
|
50
|
-
static assertion to make sure the file is being used on architecture
|
51
|
-
at least with matching size of GoInt.
|
52
|
-
*/
|
53
|
-
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
54
|
-
|
55
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
56
|
-
typedef _GoString_ GoString;
|
57
|
-
#endif
|
58
|
-
typedef void *GoMap;
|
59
|
-
typedef void *GoChan;
|
60
|
-
typedef struct { void *t; void *v; } GoInterface;
|
61
|
-
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
62
|
-
|
63
|
-
#endif
|
64
|
-
|
65
|
-
/* End of boilerplate cgo prologue. */
|
66
|
-
|
67
|
-
#ifdef __cplusplus
|
68
|
-
extern "C" {
|
69
|
-
#endif
|
70
|
-
|
71
|
-
|
72
|
-
extern char* NewMnemonic();
|
73
|
-
|
74
|
-
extern char* PrivateKeyFromMnemonic(char* p0);
|
75
|
-
|
76
|
-
extern char* PublicKeyFromPrivateKey(char* p0);
|
77
|
-
|
78
|
-
extern char* AddressFromMnemonic(char* p0);
|
79
|
-
|
80
|
-
extern char* AddressFromPrivateKey(char* p0);
|
81
|
-
|
82
|
-
extern char* AddressFromPublicKey(char* p0);
|
83
|
-
|
84
|
-
#ifdef __cplusplus
|
85
|
-
}
|
86
|
-
#endif
|
Binary file
|
data/lib/ffi/wallet.h
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
/* Code generated by cmd/cgo; DO NOT EDIT. */
|
2
|
-
|
3
|
-
/* package command-line-arguments */
|
4
|
-
|
5
|
-
|
6
|
-
#line 1 "cgo-builtin-export-prolog"
|
7
|
-
|
8
|
-
#include <stddef.h> /* for ptrdiff_t below */
|
9
|
-
|
10
|
-
#ifndef GO_CGO_EXPORT_PROLOGUE_H
|
11
|
-
#define GO_CGO_EXPORT_PROLOGUE_H
|
12
|
-
|
13
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
14
|
-
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#endif
|
18
|
-
|
19
|
-
/* Start of preamble from import "C" comments. */
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
/* End of preamble from import "C" comments. */
|
25
|
-
|
26
|
-
|
27
|
-
/* Start of boilerplate cgo prologue. */
|
28
|
-
#line 1 "cgo-gcc-export-header-prolog"
|
29
|
-
|
30
|
-
#ifndef GO_CGO_PROLOGUE_H
|
31
|
-
#define GO_CGO_PROLOGUE_H
|
32
|
-
|
33
|
-
typedef signed char GoInt8;
|
34
|
-
typedef unsigned char GoUint8;
|
35
|
-
typedef short GoInt16;
|
36
|
-
typedef unsigned short GoUint16;
|
37
|
-
typedef int GoInt32;
|
38
|
-
typedef unsigned int GoUint32;
|
39
|
-
typedef long long GoInt64;
|
40
|
-
typedef unsigned long long GoUint64;
|
41
|
-
typedef GoInt64 GoInt;
|
42
|
-
typedef GoUint64 GoUint;
|
43
|
-
typedef __SIZE_TYPE__ GoUintptr;
|
44
|
-
typedef float GoFloat32;
|
45
|
-
typedef double GoFloat64;
|
46
|
-
typedef float _Complex GoComplex64;
|
47
|
-
typedef double _Complex GoComplex128;
|
48
|
-
|
49
|
-
/*
|
50
|
-
static assertion to make sure the file is being used on architecture
|
51
|
-
at least with matching size of GoInt.
|
52
|
-
*/
|
53
|
-
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];
|
54
|
-
|
55
|
-
#ifndef GO_CGO_GOSTRING_TYPEDEF
|
56
|
-
typedef _GoString_ GoString;
|
57
|
-
#endif
|
58
|
-
typedef void *GoMap;
|
59
|
-
typedef void *GoChan;
|
60
|
-
typedef struct { void *t; void *v; } GoInterface;
|
61
|
-
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;
|
62
|
-
|
63
|
-
#endif
|
64
|
-
|
65
|
-
/* End of boilerplate cgo prologue. */
|
66
|
-
|
67
|
-
#ifdef __cplusplus
|
68
|
-
extern "C" {
|
69
|
-
#endif
|
70
|
-
|
71
|
-
|
72
|
-
extern char* NewMnemonic();
|
73
|
-
|
74
|
-
extern char* PrivateKeyFromMnemonic(char* p0);
|
75
|
-
|
76
|
-
extern char* PublicKeyFromPrivateKey(char* p0);
|
77
|
-
|
78
|
-
extern char* AddressFromMnemonic(char* p0);
|
79
|
-
|
80
|
-
extern char* AddressFromPrivateKey(char* p0);
|
81
|
-
|
82
|
-
extern char* AddressFromPublicKey(char* p0);
|
83
|
-
|
84
|
-
#ifdef __cplusplus
|
85
|
-
}
|
86
|
-
#endif
|