minter 0.1.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +80 -8
- data/lib/ffi/{go → sign}/compile.rb +6 -4
- data/lib/ffi/sign/go.mod +5 -0
- data/lib/ffi/sign/go.sum +185 -0
- data/lib/ffi/sign/sign-darwin-10.6-amd64.dylib +0 -0
- data/lib/ffi/{wallet.h → sign/sign-darwin-10.6-amd64.h} +3 -11
- data/lib/ffi/sign/sign-linux-amd64.h +78 -0
- data/lib/ffi/sign/sign-linux-amd64.so +0 -0
- data/lib/ffi/sign/sign.go +84 -0
- data/lib/ffi/sign/sign_ffi.rb +12 -0
- data/lib/ffi/tx_hash/compile.rb +16 -0
- data/lib/ffi/tx_hash/go.mod +5 -0
- data/lib/ffi/tx_hash/go.sum +185 -0
- data/lib/ffi/{transaction-darwin-10.6-amd64.dylib → tx_hash/tx-hash-darwin-10.6-amd64.dylib} +0 -0
- data/lib/ffi/{transaction-linux-amd64.h → tx_hash/tx-hash-darwin-10.6-amd64.h} +15 -15
- data/lib/ffi/tx_hash/tx-hash-linux-amd64.h +104 -0
- data/lib/ffi/{transaction-linux-amd64.so → tx_hash/tx-hash-linux-amd64.so} +0 -0
- data/lib/ffi/tx_hash/tx_hash.go +616 -0
- data/lib/ffi/tx_hash/tx_hash_ffi.rb +25 -0
- data/lib/ffi/wallet/compile.rb +16 -0
- data/lib/ffi/wallet/go.mod +5 -0
- data/lib/ffi/wallet/go.sum +185 -0
- data/lib/ffi/{wallet-darwin-10.6-amd64.dylib → wallet/wallet-darwin-10.6-amd64.dylib} +0 -0
- data/lib/ffi/{wallet-darwin-10.6-amd64.h → wallet/wallet-darwin-10.6-amd64.h} +0 -0
- data/lib/ffi/{wallet-linux-amd64.h → wallet/wallet-linux-amd64.h} +0 -0
- data/lib/ffi/{wallet-linux-amd64.so → wallet/wallet-linux-amd64.so} +0 -0
- data/lib/ffi/wallet/wallet.go +49 -0
- data/lib/ffi/{wallet_ffi.rb → wallet/wallet_ffi.rb} +1 -1
- data/lib/minter.rb +4 -2
- data/lib/minter/transactions/buy_coin_tx.rb +1 -8
- data/lib/minter/transactions/create_coin_tx.rb +1 -8
- data/lib/minter/transactions/create_multisig_address_tx.rb +38 -0
- data/lib/minter/transactions/declare_candidacy_tx.rb +1 -8
- data/lib/minter/transactions/delegate_tx.rb +1 -8
- data/lib/minter/transactions/edit_candidate_tx.rb +1 -8
- data/lib/minter/transactions/multi_send_tx.rb +29 -0
- data/lib/minter/transactions/redeem_check_tx.rb +1 -8
- data/lib/minter/transactions/sell_all_coin_tx.rb +1 -8
- data/lib/minter/transactions/sell_coin_tx.rb +1 -8
- data/lib/minter/transactions/send_coin_tx.rb +1 -8
- data/lib/minter/transactions/set_candidate_off_tx.rb +1 -8
- data/lib/minter/transactions/set_candidate_on_tx.rb +1 -8
- data/lib/minter/transactions/signed_tx.rb +3 -3
- data/lib/minter/transactions/transaction.rb +41 -0
- data/lib/minter/transactions/unbond_tx.rb +1 -8
- data/lib/minter/version.rb +1 -1
- data/lib/minter/wallet.rb +3 -2
- metadata +81 -27
- data/lib/ffi/transaction-darwin-10.6-amd64.h +0 -104
- data/lib/ffi/transaction_ffi.rb +0 -94
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ffi"
|
4
|
+
module Minter
|
5
|
+
module TxHashFfi
|
6
|
+
extend FFI::Library
|
7
|
+
filename = RUBY_PLATFORM.match("darwin") ? "/tx-hash-darwin-10.6-amd64.dylib" : "/tx-hash-linux-amd64.so"
|
8
|
+
ffi_lib File.join(File.dirname(__FILE__), filename)
|
9
|
+
attach_function :BuyCoinTx, [:string], :string
|
10
|
+
attach_function :CreateCoinTx, [:string], :string
|
11
|
+
attach_function :CreateMultisigAddressTx, [:string], :string
|
12
|
+
attach_function :GetMultisigAddress, [:string], :string
|
13
|
+
attach_function :DeclareCandidacyTx, [:string], :string
|
14
|
+
attach_function :DelegateTx, [:string], :string
|
15
|
+
attach_function :EditCandidateTx, [:string], :string
|
16
|
+
attach_function :MultiSendTx, [:string], :string
|
17
|
+
attach_function :RedeemCheckTx, [:string], :string
|
18
|
+
attach_function :SellAllCoinTx, [:string], :string
|
19
|
+
attach_function :SellCoinTx, [:string], :string
|
20
|
+
attach_function :SendCoinTx, [:string], :string
|
21
|
+
attach_function :SetCandidateOffTx, [:string], :string
|
22
|
+
attach_function :SetCandidateOnTx, [:string], :string
|
23
|
+
attach_function :UnbondTx, [:string], :string
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
out_path = "./wallet"
|
4
|
+
arg_string = ""
|
5
|
+
{
|
6
|
+
out: out_path,
|
7
|
+
targets: ["linux/amd64", "darwin/amd64"],
|
8
|
+
buildmode: "c-shared"
|
9
|
+
}.each_pair do |name, args|
|
10
|
+
arg_string += "-#{name}"
|
11
|
+
arg_string += "=#{[args].flatten.join(',')}" unless args.nil?
|
12
|
+
arg_string += " "
|
13
|
+
end
|
14
|
+
|
15
|
+
puts "xgo #{arg_string.strip} ./"
|
16
|
+
system("xgo #{arg_string.strip} ./")
|
@@ -0,0 +1,185 @@
|
|
1
|
+
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
|
2
|
+
github.com/Azure/azure-pipeline-go v0.2.2/go.mod h1:4rQ/NZncSvGqNkkOsNpOU1tgoNuIlp9AfUH5G1tvCHc=
|
3
|
+
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
|
4
|
+
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
|
5
|
+
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
|
6
|
+
github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
|
7
|
+
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
|
8
|
+
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
|
9
|
+
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
10
|
+
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
|
11
|
+
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
|
12
|
+
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
13
|
+
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
|
14
|
+
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
15
|
+
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e h1:ahyvB3q25YnZWly5Gq1ekg6jcmWaGj/vG/MhF4aisoc=
|
16
|
+
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:kGUqhHd//musdITWjFvNTHn90WG9bMLBEPQZ17Cmlpw=
|
17
|
+
github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec h1:1Qb69mGp/UtRPn422BH4/Y4Q3SLUrD9KHuDkm8iodFc=
|
18
|
+
github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec/go.mod h1:CD8UlnlLDiqb36L110uqiP2iSflVjx9g/3U9hCI4q2U=
|
19
|
+
github.com/MinterTeam/minter-go-sdk v1.0.8 h1:DLGldS4zOQKWAqXtgZqo7q1pkAuHNyDAF+4bQrXG3GY=
|
20
|
+
github.com/MinterTeam/minter-go-sdk v1.0.8/go.mod h1:IVoupdNnGyzfdprQ32x2ZI9MaA6XpXDirH16H6GqBTY=
|
21
|
+
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
22
|
+
github.com/OneOfOne/xxhash v1.2.5/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
|
23
|
+
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
24
|
+
github.com/VictoriaMetrics/fastcache v1.5.3/go.mod h1:+jv9Ckb+za/P1ZRg/sulP5Ni1v49daAVERr0H3CuscE=
|
25
|
+
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
26
|
+
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
27
|
+
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
28
|
+
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
|
29
|
+
github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ=
|
30
|
+
github.com/aws/aws-sdk-go v1.25.48/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
31
|
+
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
32
|
+
github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6/go.mod h1:Dmm/EzmjnCiweXmzRIAiUWCInVmPgjkzgv5k4tVyXiQ=
|
33
|
+
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 h1:A/EVblehb75cUgXA5njHPn0kLAsykn6mJGz7rnmW5W0=
|
34
|
+
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
|
35
|
+
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
36
|
+
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
37
|
+
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
38
|
+
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
39
|
+
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
40
|
+
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
41
|
+
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
42
|
+
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
43
|
+
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
44
|
+
github.com/cespare/xxhash/v2 v2.0.1-0.20190104013014-3767db7a7e18/go.mod h1:HD5P3vAIAh+Y2GAxg0PrPN1P8WkepXGpjbUPDHJqqKM=
|
45
|
+
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
46
|
+
github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9/go.mod h1:1MxXX1Ux4x6mqPmjkUgTP1CdXIBXKX7T+Jk9Gxrmx+U=
|
47
|
+
github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e h1:0XBUw73chJ1VYSsfvcPvVT7auykAJce9FpRr10L6Qhw=
|
48
|
+
github.com/cmars/basen v0.0.0-20150613233007-fe3947df716e/go.mod h1:P13beTBKr5Q18lJe1rIoLUqjM+CB1zYrRg44ZqGuQSA=
|
49
|
+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
50
|
+
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
51
|
+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
52
|
+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
53
|
+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
54
|
+
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
55
|
+
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
56
|
+
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
57
|
+
github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
58
|
+
github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
59
|
+
github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs=
|
60
|
+
github.com/ethereum/go-ethereum v1.9.10 h1:jooX7tWcscpC7ytufk73t9JMCeJQ7aJF2YmZJQEuvFo=
|
61
|
+
github.com/ethereum/go-ethereum v1.9.10/go.mod h1:lXHkVo/MTvsEXfYsmNzelZ8R1e0DTvdk/wMZJIRpaRw=
|
62
|
+
github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
63
|
+
github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0=
|
64
|
+
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
65
|
+
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
|
66
|
+
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
67
|
+
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
68
|
+
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
69
|
+
github.com/go-resty/resty/v2 v2.0.0 h1:9Nq/U+V4xsoDnDa/iTrABDWUCuk3Ne92XFHPe6dKWUc=
|
70
|
+
github.com/go-resty/resty/v2 v2.0.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
|
71
|
+
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
72
|
+
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
73
|
+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
74
|
+
github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
75
|
+
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
76
|
+
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
77
|
+
github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
78
|
+
github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc=
|
79
|
+
github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
80
|
+
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
81
|
+
github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3/go.mod h1:MZ2ZmwcBpvOoJ22IJsc7va19ZwoheaBk43rKg12SKag=
|
82
|
+
github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY=
|
83
|
+
github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc=
|
84
|
+
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
85
|
+
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
|
86
|
+
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
87
|
+
github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
88
|
+
github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
89
|
+
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
90
|
+
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
91
|
+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
92
|
+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
93
|
+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
94
|
+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
95
|
+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
96
|
+
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
97
|
+
github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
98
|
+
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
|
99
|
+
github.com/mattn/go-ieproxy v0.0.0-20190702010315-6dee0af9227d/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
|
100
|
+
github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
101
|
+
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
102
|
+
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
103
|
+
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
104
|
+
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
|
105
|
+
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
|
106
|
+
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
107
|
+
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
108
|
+
github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
109
|
+
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
110
|
+
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
111
|
+
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
112
|
+
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
113
|
+
github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
114
|
+
github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
115
|
+
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
116
|
+
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
117
|
+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
118
|
+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
119
|
+
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
120
|
+
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
121
|
+
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
122
|
+
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
123
|
+
github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
124
|
+
github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho=
|
125
|
+
github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY=
|
126
|
+
github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
|
127
|
+
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
|
128
|
+
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
129
|
+
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
130
|
+
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
131
|
+
github.com/spaolacci/murmur3 v1.0.1-0.20190317074736-539464a789e9/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
132
|
+
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
|
133
|
+
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570/go.mod h1:8OR4w3TdeIHIh1g6EMY5p0gVNOovcWC+1vpc7naMuAw=
|
134
|
+
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
135
|
+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
136
|
+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
137
|
+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
138
|
+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
139
|
+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
140
|
+
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
|
141
|
+
github.com/tyler-smith/go-bip32 v0.0.0-20170922074101-2c9cfd177564 h1:NXXyQVeRVLK8Xu27/hkkjwVOZLk5v4ZBEvvMtqMqznM=
|
142
|
+
github.com/tyler-smith/go-bip32 v0.0.0-20170922074101-2c9cfd177564/go.mod h1:0/YuQQF676+d4CMNclTqGUam1EDwz0B8o03K9pQqA3c=
|
143
|
+
github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
144
|
+
github.com/tyler-smith/go-bip39 v1.0.2 h1:+t3w+KwLXO6154GNJY+qUtIxLTmFjfUmpguQT1OlOT8=
|
145
|
+
github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs=
|
146
|
+
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
147
|
+
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208/go.mod h1:IotVbo4F+mw0EzQ08zFqg7pK3FebNXpaMsRy2RT+Ees=
|
148
|
+
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
149
|
+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
150
|
+
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 h1:0hQKqeLdqlt5iIwVOBErRisrHJAN57yOiPRQItI20fU=
|
151
|
+
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
152
|
+
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
153
|
+
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
154
|
+
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
155
|
+
golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2 h1:4dVFTC832rPn4pomLSz1vA+are2+dU19w1H8OngV7nc=
|
156
|
+
golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
157
|
+
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
158
|
+
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
159
|
+
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
160
|
+
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
161
|
+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
162
|
+
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
163
|
+
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
164
|
+
golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8 h1:41hwlulw1prEMBxLQSlMSux1zxJf07B3WPsdjJlKZxE=
|
165
|
+
golang.org/x/sys v0.0.0-20190912141932-bc967efca4b8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
166
|
+
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
167
|
+
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
168
|
+
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
169
|
+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
170
|
+
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
171
|
+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
172
|
+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
173
|
+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
174
|
+
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
175
|
+
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c=
|
176
|
+
gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns=
|
177
|
+
gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
|
178
|
+
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
179
|
+
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
|
180
|
+
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
181
|
+
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
182
|
+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
183
|
+
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
|
184
|
+
launchpad.net/gocheck v0.0.0-20140225173054-000000000087 h1:Izowp2XBH6Ya6rv+hqbceQyw/gSGoXfH/UPoTGduL54=
|
185
|
+
launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM=
|
Binary file
|
File without changes
|
File without changes
|
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"C"
|
5
|
+
"github.com/MinterTeam/minter-go-sdk/wallet"
|
6
|
+
)
|
7
|
+
|
8
|
+
//export NewMnemonic
|
9
|
+
func NewMnemonic() *C.char {
|
10
|
+
mnemonic, _ := wallet.NewMnemonic()
|
11
|
+
return C.CString(mnemonic)
|
12
|
+
}
|
13
|
+
|
14
|
+
//export PrivateKeyFromMnemonic
|
15
|
+
func PrivateKeyFromMnemonic(mnemonic *C.char) *C.char {
|
16
|
+
seed, _ := wallet.Seed(C.GoString(mnemonic))
|
17
|
+
prKey, _ := wallet.PrivateKeyBySeed(seed)
|
18
|
+
return C.CString(prKey)
|
19
|
+
}
|
20
|
+
|
21
|
+
//export PublicKeyFromPrivateKey
|
22
|
+
func PublicKeyFromPrivateKey(prKey *C.char) *C.char {
|
23
|
+
pubKey, _ := wallet.PublicKeyByPrivateKey(C.GoString(prKey))
|
24
|
+
return C.CString(pubKey)
|
25
|
+
}
|
26
|
+
|
27
|
+
//export AddressFromMnemonic
|
28
|
+
func AddressFromMnemonic(mnemonic *C.char) *C.char {
|
29
|
+
seed, _ := wallet.Seed(C.GoString(mnemonic))
|
30
|
+
prKey, _ := wallet.PrivateKeyBySeed(seed)
|
31
|
+
pubKey, _ := wallet.PublicKeyByPrivateKey(prKey)
|
32
|
+
address, _ := wallet.AddressByPublicKey(pubKey)
|
33
|
+
return C.CString(address)
|
34
|
+
}
|
35
|
+
|
36
|
+
//export AddressFromPrivateKey
|
37
|
+
func AddressFromPrivateKey(prKey *C.char) *C.char {
|
38
|
+
pubKey, _ := wallet.PublicKeyByPrivateKey(C.GoString(prKey))
|
39
|
+
address, _ := wallet.AddressByPublicKey(pubKey)
|
40
|
+
return C.CString(address)
|
41
|
+
}
|
42
|
+
|
43
|
+
//export AddressFromPublicKey
|
44
|
+
func AddressFromPublicKey(mnemonic *C.char) *C.char {
|
45
|
+
address, _ := wallet.AddressByPublicKey(C.GoString(mnemonic))
|
46
|
+
return C.CString(address)
|
47
|
+
}
|
48
|
+
|
49
|
+
func main() {}
|
@@ -4,7 +4,7 @@ require "ffi"
|
|
4
4
|
module Minter
|
5
5
|
module WalletFfi
|
6
6
|
extend FFI::Library
|
7
|
-
filename = RUBY_PLATFORM.match(
|
7
|
+
filename = RUBY_PLATFORM.match("darwin") ? "/wallet-darwin-10.6-amd64.dylib" : "/wallet-linux-amd64.so"
|
8
8
|
ffi_lib File.join(File.dirname(__FILE__), filename)
|
9
9
|
attach_function :NewMnemonic, [], :string
|
10
10
|
attach_function :PrivateKeyFromMnemonic, [:string], :string
|
data/lib/minter.rb
CHANGED
@@ -6,8 +6,10 @@ 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/
|
9
|
+
require "ffi/wallet/wallet_ffi.rb"
|
10
|
+
require "ffi/tx_hash/tx_hash_ffi.rb"
|
11
|
+
require "ffi/sign/sign_ffi.rb"
|
12
|
+
require "minter/transactions/transaction.rb"
|
11
13
|
Dir[File.dirname(__FILE__) + "/minter/transactions/*.rb"].each { |file| require_relative file }
|
12
14
|
|
13
15
|
module Minter
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class BuyCoinTx
|
4
|
+
class BuyCoinTx < Transaction
|
5
5
|
attr_accessor :coin_to_buy, :value_to_buy, :coin_to_sell, :maximum_value_to_sell, :nonce, :chain_id, :gas_coin, :gas_price
|
6
6
|
|
7
7
|
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 +15,6 @@ module Minter
|
|
15
15
|
@gas_price = gas_price
|
16
16
|
end
|
17
17
|
|
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
18
|
def to_params
|
26
19
|
{ CoinToBuy: coin_to_buy,
|
27
20
|
ValueToBuy: value_to_buy,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class CreateCoinTx
|
4
|
+
class CreateCoinTx < Transaction
|
5
5
|
attr_accessor :name, :symbol, :initial_amount, :max_supply, :initial_reserve, :reserve_ratio, :nonce, :chain_id, :gas_coin, :gas_price
|
6
6
|
|
7
7
|
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 +17,6 @@ module Minter
|
|
17
17
|
@gas_price = gas_price
|
18
18
|
end
|
19
19
|
|
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
20
|
def to_params
|
28
21
|
{ Name: name,
|
29
22
|
Symbol: symbol,
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Minter
|
4
|
+
class CreateMultisigAddressTx < Transaction
|
5
|
+
attr_accessor :addresses, :threshold, :nonce, :chain_id, :gas_coin, :gas_price
|
6
|
+
|
7
|
+
def initialize(threshold:, nonce:, chain_id:, gas_coin:, gas_price:)
|
8
|
+
@threshold = threshold
|
9
|
+
@nonce = nonce
|
10
|
+
@chain_id = chain_id
|
11
|
+
@gas_coin = gas_coin
|
12
|
+
@gas_price = gas_price
|
13
|
+
@addresses = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_address(address:, weight:)
|
17
|
+
@addresses << { Address: address, Weight: weight }
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_params
|
21
|
+
{
|
22
|
+
Threshold: threshold,
|
23
|
+
Nonce: nonce,
|
24
|
+
ChainId: chain_id,
|
25
|
+
GasCoin: gas_coin,
|
26
|
+
GasPrice: gas_price,
|
27
|
+
Addresses: addresses
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def multisig_address
|
32
|
+
result = JSON.parse(Minter::TxHashFfi.GetMultisigAddress(to_params.to_json))
|
33
|
+
raise TransactionError, result["error"] unless result["success"] == "true"
|
34
|
+
|
35
|
+
result["multisig_address"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class DeclareCandidacyTx
|
4
|
+
class DeclareCandidacyTx < Transaction
|
5
5
|
attr_accessor :address, :pubkey, :commission, :coin, :stake, :nonce, :chain_id, :gas_coin, :gas_price
|
6
6
|
|
7
7
|
def initialize(address:, pubkey:, commission:, coin:, stake:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -16,13 +16,6 @@ module Minter
|
|
16
16
|
@gas_price = gas_price
|
17
17
|
end
|
18
18
|
|
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
19
|
def to_params
|
27
20
|
{ Address: address,
|
28
21
|
PubKey: pubkey,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Minter
|
4
|
-
class DelegateTx
|
4
|
+
class DelegateTx < Transaction
|
5
5
|
attr_accessor :pubkey, :coin, :value, :nonce, :chain_id, :gas_coin, :gas_price
|
6
6
|
|
7
7
|
def initialize(pubkey:, coin:, value:, nonce:, chain_id:, gas_coin:, gas_price:) # rubocop:disable Metrics/ParameterLists
|
@@ -14,13 +14,6 @@ module Minter
|
|
14
14
|
@gas_price = gas_price
|
15
15
|
end
|
16
16
|
|
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
17
|
def to_params
|
25
18
|
{ PubKey: pubkey,
|
26
19
|
Coin: coin,
|