peatio-infura 0.1.61

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 49a13895781f3483ce91a62eb4851312155d99f1a7b0b60c3e79a050b8e4c694
4
+ data.tar.gz: ff3b246cb2e88af846e8475f811386841e724b8eafb03663cdb5b3451628f5e4
5
+ SHA512:
6
+ metadata.gz: 976524be9401b885146b6ea1950d0a7780d78b0b5b420b73fd378560830dd79c8df2453b0162a47c96187b745ae9812b7c05ee1b96535413a401e32624969f60
7
+ data.tar.gz: 0fd51724f87ce8495d95574db4f5032f88d94167695332aaf56af90f4257a9f8c2b25c279942573380470af3a4edecb1aac83f6d108378f9e6fc160e8090771a
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build peatio-infura-0.1.3.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install peatio-infura-0.1.3.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install peatio-infura-0.1.3.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.3 and build and push peatio-infura-0.1.3.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in peatio-infura.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,154 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ peatio-infura (0.1.61)
5
+ activesupport (~> 5.2.3)
6
+ better-faraday (~> 1.0.5)
7
+ faraday (~> 0.15.4)
8
+ memoist (~> 0.16.0)
9
+ net-http-persistent (~> 3.0.1)
10
+ peatio (>= 0.6.3)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ activemodel (5.2.4.3)
16
+ activesupport (= 5.2.4.3)
17
+ activesupport (5.2.4.3)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
20
+ minitest (~> 5.1)
21
+ tzinfo (~> 1.1)
22
+ addressable (2.7.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ amq-protocol (2.3.1)
25
+ amqp (1.8.0)
26
+ amq-protocol (>= 2.2.0)
27
+ eventmachine
28
+ better-faraday (1.0.8)
29
+ activesupport (>= 4.0, < 6.0)
30
+ faraday (~> 0.12)
31
+ bunny (2.15.0)
32
+ amq-protocol (~> 2.3, >= 2.3.1)
33
+ byebug (11.0.1)
34
+ clamp (1.3.1)
35
+ coderay (1.1.2)
36
+ concurrent-ruby (1.1.6)
37
+ connection_pool (2.2.3)
38
+ cookiejar (0.3.3)
39
+ crack (0.4.3)
40
+ safe_yaml (~> 1.0.0)
41
+ daemons (1.3.1)
42
+ diff-lcs (1.3)
43
+ em-http-request (1.1.6)
44
+ addressable (>= 2.3.4)
45
+ cookiejar (!= 0.3.1)
46
+ em-socksify (>= 0.3)
47
+ eventmachine (>= 1.0.3)
48
+ http_parser.rb (>= 0.6.0)
49
+ em-socksify (0.3.2)
50
+ eventmachine (>= 1.0.0.beta.4)
51
+ em-synchrony (1.0.6)
52
+ eventmachine (>= 1.0.0.beta.1)
53
+ em-websocket (0.5.1)
54
+ eventmachine (>= 0.12.9)
55
+ http_parser.rb (~> 0.6.0)
56
+ eventmachine (1.2.7)
57
+ faraday (0.15.4)
58
+ multipart-post (>= 1.2, < 3)
59
+ faraday_middleware (0.13.1)
60
+ faraday (>= 0.7.4, < 1.0)
61
+ faye (1.3.0)
62
+ cookiejar (>= 0.3.0)
63
+ em-http-request (>= 0.3.0)
64
+ eventmachine (>= 0.12.0)
65
+ faye-websocket (>= 0.9.1)
66
+ multi_json (>= 1.0.0)
67
+ rack (>= 1.0.0)
68
+ websocket-driver (>= 0.5.1)
69
+ faye-websocket (0.10.9)
70
+ eventmachine (>= 0.12.0)
71
+ websocket-driver (>= 0.5.1)
72
+ hashdiff (1.0.0)
73
+ http_parser.rb (0.6.0)
74
+ i18n (1.8.3)
75
+ concurrent-ruby (~> 1.0)
76
+ jwt (2.2.1)
77
+ memoist (0.16.2)
78
+ metaclass (0.0.4)
79
+ method_source (0.9.2)
80
+ minitest (5.14.1)
81
+ mocha (1.9.0)
82
+ metaclass (~> 0.0.1)
83
+ multi_json (1.14.1)
84
+ multipart-post (2.1.1)
85
+ mysql2 (0.5.3)
86
+ net-http-persistent (3.0.1)
87
+ connection_pool (~> 2.2)
88
+ peatio (2.6.1)
89
+ activemodel (> 5.2, <= 6.0.0)
90
+ amqp
91
+ bunny
92
+ clamp
93
+ em-synchrony (~> 1.0)
94
+ em-websocket
95
+ eventmachine
96
+ faraday_middleware (~> 0.13.1)
97
+ faye (~> 1.2)
98
+ jwt
99
+ mysql2
100
+ prometheus-client
101
+ thin
102
+ prometheus-client (2.1.0)
103
+ pry (0.12.2)
104
+ coderay (~> 1.1.0)
105
+ method_source (~> 0.9.0)
106
+ pry-byebug (3.7.0)
107
+ byebug (~> 11.0)
108
+ pry (~> 0.10)
109
+ public_suffix (4.0.1)
110
+ rack (2.2.3)
111
+ rake (13.0.1)
112
+ rspec (3.9.0)
113
+ rspec-core (~> 3.9.0)
114
+ rspec-expectations (~> 3.9.0)
115
+ rspec-mocks (~> 3.9.0)
116
+ rspec-core (3.9.0)
117
+ rspec-support (~> 3.9.0)
118
+ rspec-expectations (3.9.0)
119
+ diff-lcs (>= 1.2.0, < 2.0)
120
+ rspec-support (~> 3.9.0)
121
+ rspec-mocks (3.9.0)
122
+ diff-lcs (>= 1.2.0, < 2.0)
123
+ rspec-support (~> 3.9.0)
124
+ rspec-support (3.9.0)
125
+ safe_yaml (1.0.5)
126
+ thin (1.7.2)
127
+ daemons (~> 1.0, >= 1.0.9)
128
+ eventmachine (~> 1.0, >= 1.0.4)
129
+ rack (>= 1, < 3)
130
+ thread_safe (0.3.6)
131
+ tzinfo (1.2.7)
132
+ thread_safe (~> 0.1)
133
+ webmock (3.7.6)
134
+ addressable (>= 2.3.6)
135
+ crack (>= 0.3.2)
136
+ hashdiff (>= 0.4.0, < 2.0.0)
137
+ websocket-driver (0.7.2)
138
+ websocket-extensions (>= 0.1.0)
139
+ websocket-extensions (0.1.5)
140
+
141
+ PLATFORMS
142
+ ruby
143
+
144
+ DEPENDENCIES
145
+ bundler (~> 1.16)
146
+ mocha (~> 1.8)
147
+ peatio-infura!
148
+ pry-byebug
149
+ rake (~> 13.0)
150
+ rspec (~> 3.0)
151
+ webmock (~> 3.5)
152
+
153
+ BUNDLED WITH
154
+ 1.17.3
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "peatio/infura"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ - key: eth-mainnet
2
+ name: Ethereum Mainnet
3
+ client: infura # API client name.
4
+ server: https://rinkeby.infura.io/v3/INFURA_KEY # Public Ethereum node endpoint. IMPORTANT: full syncmode.
5
+ height: 7500000 # Initial block number from which sync will be started.
6
+ min_confirmations: 6 # Minimal confirmations needed for withdraw and deposit confirmation.
7
+ explorer:
8
+ address: https://etherscan.io/address/#{address}
9
+ transaction: https://etherscan.io/tx/#{txid}
10
+ status: active
@@ -0,0 +1,20 @@
1
+ - id: eth
2
+ name: Ethereum
3
+ blockchain_key: eth-mainnet
4
+ symbol: 'Ξ'
5
+ type: coin
6
+ precision: 8
7
+ base_factor: 1_000_000_000_000_000_000
8
+ enabled: true
9
+ # Deposits with less amount are skipped during blockchain synchronization.
10
+ # We advise to set value 10 times bigger than the network fee to prevent losses.
11
+ min_deposit_amount: 0.00021
12
+ min_collection_amount: 0.00021
13
+ withdraw_limit_24h: 2.0
14
+ withdraw_limit_72h: 5.0
15
+ deposit_fee: 0
16
+ withdraw_fee: 0
17
+ position: 5
18
+ options:
19
+ gas_limit: 21_000
20
+ gas_price: 1_000_000_000
@@ -0,0 +1,47 @@
1
+ - name: Ethereum Deposit Wallet
2
+ blockchain_key: eth-mainnet
3
+ currency_id: eth
4
+ # Address where deposits will be collected to.
5
+ address: '0xd1bfc7daabbd6aa40a7a1a87464cc93882fa24cb' # IMPORTANT: Always wrap this value in quotes!
6
+ kind: deposit # Wallet kind (deposit, hot, warm, cold or fee).
7
+ nsig: 1 # Number of signatures required for performing withdraw.
8
+ max_balance: 0.0
9
+ status: active
10
+ gateway: infurad # Gateway client name.
11
+ settings:
12
+ #
13
+ # infurad gateway client settings.
14
+ uri: https://rinkeby.infura.io/v3/INFURA_KEY
15
+ sign_uri: http://infura:8545
16
+
17
+ - name: Ethereum Hot Wallet
18
+ blockchain_key: eth-mainnet
19
+ currency_id: eth
20
+ # Address where deposits will be collected to.
21
+ address: '0xd1bfc7daabbd6aa40a7a1a87464cc93882fa2401' # IMPORTANT: Always wrap this value in quotes!
22
+ kind: hot # Wallet kind (deposit, hot, warm, cold or fee).
23
+ nsig: 1 # Number of signatures required for performing withdraw.
24
+ max_balance: 5.0
25
+ status: active
26
+ gateway: infurad # Gateway client name.
27
+ settings:
28
+ #
29
+ # infurad gateway client settings.
30
+ uri: https://rinkeby.infura.io/v3/INFURA_KEY
31
+ sign_uri: http://infura:8545
32
+
33
+ - name: Ethereum Warm Wallet
34
+ blockchain_key: eth-mainnet
35
+ currency_id: eth
36
+ # Address where deposits will be collected to.
37
+ address: '0xd1bfc7daabbd6aa40a7a1a87464cc93882fa24545' # IMPORTANT: Always wrap this value in quotes!
38
+ kind: warm # Wallet kind (deposit, hot, warm, cold or fee).
39
+ nsig: 1 # Number of signatures required for performing withdraw.
40
+ max_balance: 50.0
41
+ status: active
42
+ gateway: infurad # Gateway client name.
43
+ settings:
44
+ #
45
+ # infurad gateway client settings.
46
+ uri: https://rinkeby.infura.io/v3/INFURA_KEY
47
+ sign_uri: http://infura:8545
@@ -0,0 +1,29 @@
1
+ # Integration.
2
+
3
+ For Peatio Infura plugin integration you need to do the following steps:
4
+
5
+ ## Image Build.
6
+
7
+ 1. Add peatio-infura gem into your Gemfile.plugin
8
+ ```ruby
9
+ gem 'peatio-infura', '~> 0.1.5'
10
+ ```
11
+
12
+ 2. Run `bundle install` for updating Gemfile.lock
13
+
14
+ 3. Build custom Peatio [docker image with Infura plugin](https://github.com/rubykube/peatio/blob/master/docs/plugins.md#build)
15
+
16
+ 4. Push your image using `docker push`
17
+
18
+ 5. Update your deployment to use image with peatio-infura gem
19
+
20
+ ## Peatio Configuration.
21
+
22
+ 1. Create Infura Blockchain [config example](../config/blockchains.yml).
23
+ * No additional steps are needed
24
+
25
+ 2. Create Infura Currency [config example](../config/currencies.yml).
26
+ * No additional steps are needed
27
+
28
+ 3. Create Infura Wallets [config example](../config/wallets.yml)(deposit and hot wallets are required).
29
+ * No additional steps are needed
data/docs/json-rpc.md ADDED
@@ -0,0 +1,29 @@
1
+ # JSON RPC
2
+
3
+ The next list of JSON RPC calls where used for plugin development.
4
+ For response examples see spec/resources:
5
+
6
+ * getbalance
7
+
8
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
9
+ * getblock
10
+
11
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblock", "params": ["5a471d4fd13d8bc3351e4d3a618fa55993326014b925346d8e9272e271e97c4e", 2] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
12
+ * getblockcount
13
+
14
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
15
+ * getblockhash
16
+
17
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockhash", "params": [40500] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332 `
18
+ * getnewaddress
19
+
20
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332 `
21
+ * listaddressgroupings
22
+
23
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "listaddressgroupings", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
24
+ * sendtoaddress
25
+
26
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendtoaddress", "params": ["QRnrwkUBQ2E4ZJ3bj8jvn4Nwx4nJ2U7wXF", 0.11] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
27
+ * methodnotfound
28
+
29
+ `curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "methodnotfound", "params": [] }' -H 'content-type: text/plain;' http://user:password@127.0.0.1:19332`
data/docs/testnet.md ADDED
@@ -0,0 +1,5 @@
1
+ # Getting Infura in testnet.
2
+
3
+ You could use one of the next faucet:
4
+
5
+ * [rinkeby]()
@@ -0,0 +1,17 @@
1
+ require "active_support/core_ext/object/blank"
2
+ require "active_support/core_ext/enumerable"
3
+ require "peatio"
4
+
5
+ module Peatio
6
+ module Infura
7
+ require "bigdecimal"
8
+ require "bigdecimal/util"
9
+ require "peatio/infura/blockchain"
10
+ require "peatio/infura/client"
11
+ require "peatio/infura/wallet"
12
+
13
+ require "peatio/infura/hooks"
14
+
15
+ require "peatio/infura/version"
16
+ end
17
+ end
@@ -0,0 +1,221 @@
1
+
2
+ module Peatio
3
+ module Infura
4
+ class Blockchain < Peatio::Blockchain::Abstract
5
+
6
+ UndefinedCurrencyError = Class.new(StandardError)
7
+
8
+ TOKEN_EVENT_IDENTIFIER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
9
+ SUCCESS = '0x1'
10
+ FAILED = '0x0'
11
+
12
+ DEFAULT_FEATURES = { case_sensitive: false, cash_addr_format: false }.freeze
13
+
14
+ def initialize(custom_features = {})
15
+ @features = DEFAULT_FEATURES.merge(custom_features).slice(*SUPPORTED_FEATURES)
16
+ @settings = {}
17
+ end
18
+
19
+ def configure(settings = {})
20
+ # Clean client state during configure.
21
+ @client = nil
22
+ @erc20 = []; @eth = []
23
+
24
+ @settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
25
+ @settings[:currencies]&.each do |c|
26
+ if c.dig(:options, :erc20_contract_address).present?
27
+ @erc20 << c
28
+ else
29
+ @eth << c
30
+ end
31
+ end
32
+ end
33
+
34
+ def fetch_block!(block_number)
35
+ block_json = client.json_rpc(:eth_getBlockByNumber, ["0x#{block_number.to_s(16)}", true])
36
+
37
+ if block_json.blank? || block_json['transactions'].blank?
38
+ return Peatio::Block.new(block_number, [])
39
+ end
40
+ block_json.fetch('transactions').each_with_object([]) do |tx, block_arr|
41
+ if tx.fetch('input').hex <= 0
42
+ next if invalid_eth_transaction?(tx)
43
+ else
44
+ next if @erc20.find { |c| c.dig(:options, :erc20_contract_address) == normalize_address(tx.fetch('to')) }.blank?
45
+ tx = client.json_rpc(:eth_getTransactionReceipt, [normalize_txid(tx.fetch('hash'))])
46
+ next if tx.nil? || tx.fetch('to').blank?
47
+ end
48
+
49
+ txs = build_transactions(tx).map do |ntx|
50
+ Peatio::Transaction.new(ntx)
51
+ end
52
+
53
+ block_arr.append(*txs)
54
+ end.yield_self { |block_arr| Peatio::Block.new(block_number, block_arr) }
55
+ rescue Infura::Client::Error => e
56
+ raise Peatio::Blockchain::ClientError, e
57
+ end
58
+
59
+ def latest_block_number
60
+ client.json_rpc(:eth_blockNumber).to_i(16)
61
+ rescue Infura::Client::Error => e
62
+ raise Peatio::Blockchain::ClientError, e
63
+ end
64
+
65
+ def load_balance_of_address!(address, currency_id)
66
+ currency = settings[:currencies].find { |c| c[:id] == currency_id.to_s }
67
+ raise UndefinedCurrencyError unless currency
68
+
69
+ if currency.dig(:options, :erc20_contract_address).present?
70
+ load_erc20_balance(address, currency)
71
+ else
72
+ client.json_rpc(:eth_getBalance, [normalize_address(address), 'latest'])
73
+ .hex
74
+ .to_d
75
+ .yield_self { |amount| convert_from_base_unit(amount, currency) }
76
+ end
77
+ rescue Infura::Client::Error => e
78
+ raise Peatio::Blockchain::ClientError, e
79
+ end
80
+
81
+ def fetch_transaction(transaction)
82
+ currency = settings[:currencies].find { |c| c.fetch(:id) == transaction.currency_id }
83
+ return if currency.blank?
84
+ txn_receipt = client.json_rpc(:eth_getTransactionReceipt, [transaction.hash])
85
+ if currency.in?(@eth)
86
+ txn_json = client.json_rpc(:eth_getTransactionByHash, [transaction.hash])
87
+ attributes = {
88
+ amount: convert_from_base_unit(txn_json.fetch('value').hex, currency),
89
+ to_address: normalize_address(txn_json['to']),
90
+ status: transaction_status(txn_receipt)
91
+ }
92
+ else
93
+ txn_json = txn_receipt.fetch('logs').find { |log| log['logIndex'].to_i(16) == transaction.txout }
94
+ attributes = {
95
+ amount: convert_from_base_unit(txn_json.fetch('data').hex, currency),
96
+ to_address: normalize_address('0x' + txn_json.fetch('topics').last[-40..-1]),
97
+ status: transaction_status(txn_receipt)
98
+ }
99
+ end
100
+ transaction.assign_attributes(attributes)
101
+ transaction
102
+ end
103
+
104
+ private
105
+
106
+ def load_erc20_balance(address, currency)
107
+ data = abi_encode('balanceOf(address)', normalize_address(address))
108
+ client.json_rpc(:eth_call, [{ to: contract_address(currency), data: data }, 'latest'])
109
+ .hex
110
+ .to_d
111
+ .yield_self { |amount| convert_from_base_unit(amount, currency) }
112
+ end
113
+
114
+ def client
115
+ @client ||= Infura::Client.new(settings_fetch(:server))
116
+ end
117
+
118
+ def settings_fetch(key)
119
+ @settings.fetch(key) { raise Peatio::Blockchain::MissingSettingError, key.to_s }
120
+ end
121
+
122
+ def normalize_txid(txid)
123
+ txid.try(:downcase)
124
+ end
125
+
126
+ def normalize_address(address)
127
+ address.try(:downcase)
128
+ end
129
+
130
+ def build_transactions(tx_hash)
131
+ if tx_hash.has_key?('logs')
132
+ build_erc20_transactions(tx_hash)
133
+ else
134
+ build_eth_transactions(tx_hash)
135
+ end
136
+ end
137
+
138
+ def build_eth_transactions(block_txn)
139
+ @eth.map do |currency|
140
+ { hash: normalize_txid(block_txn.fetch('hash')),
141
+ amount: convert_from_base_unit(block_txn.fetch('value').hex, currency),
142
+ to_address: normalize_address(block_txn['to']),
143
+ txout: block_txn.fetch('transactionIndex').to_i(16),
144
+ block_number: block_txn.fetch('blockNumber').to_i(16),
145
+ currency_id: currency.fetch(:id),
146
+ status: transaction_status(block_txn) }
147
+ end
148
+ end
149
+
150
+ def build_erc20_transactions(txn_receipt)
151
+ # Build invalid transaction for failed withdrawals
152
+ if transaction_status(txn_receipt) == 'fail' && txn_receipt.fetch('logs').blank?
153
+ return build_invalid_erc20_transaction(txn_receipt)
154
+ end
155
+
156
+ txn_receipt.fetch('logs').each_with_object([]) do |log, formatted_txs|
157
+
158
+ next if log.fetch('topics').blank? || log.fetch('topics')[0] != TOKEN_EVENT_IDENTIFIER
159
+
160
+ # Skip if ERC20 contract address doesn't match.
161
+ currencies = @erc20.select { |c| c.dig(:options, :erc20_contract_address) == log.fetch('address') }
162
+ next if currencies.blank?
163
+
164
+ destination_address = normalize_address('0x' + log.fetch('topics').last[-40..-1])
165
+
166
+ currencies.each do |currency|
167
+ formatted_txs << { hash: normalize_txid(txn_receipt.fetch('transactionHash')),
168
+ amount: convert_from_base_unit(log.fetch('data').hex, currency),
169
+ to_address: destination_address,
170
+ txout: log['logIndex'].to_i(16),
171
+ block_number: txn_receipt.fetch('blockNumber').to_i(16),
172
+ currency_id: currency.fetch(:id),
173
+ status: transaction_status(txn_receipt) }
174
+ end
175
+ end
176
+ end
177
+
178
+ def build_invalid_erc20_transaction(txn_receipt)
179
+ currencies = @erc20.select { |c| c.dig(:options, :erc20_contract_address) == txn_receipt.fetch('to') }
180
+ return if currencies.blank?
181
+
182
+ currencies.each_with_object([]) do |currency, invalid_txs|
183
+ invalid_txs << { hash: normalize_txid(txn_receipt.fetch('transactionHash')),
184
+ block_number: txn_receipt.fetch('blockNumber').to_i(16),
185
+ currency_id: currency.fetch(:id),
186
+ status: transaction_status(txn_receipt) }
187
+ end
188
+ end
189
+
190
+ def transaction_status(block_txn)
191
+ if block_txn.dig('status') == SUCCESS
192
+ 'success'
193
+ elsif block_txn.dig('status') == FAILED
194
+ 'failed'
195
+ else
196
+ 'pending'
197
+ end
198
+ end
199
+
200
+ def invalid_eth_transaction?(block_txn)
201
+ block_txn.fetch('to').blank? \
202
+ || block_txn.fetch('value').hex.to_d <= 0 && block_txn.fetch('input').hex <= 0
203
+ end
204
+
205
+ def contract_address(currency)
206
+ normalize_address(currency.dig(:options, :erc20_contract_address))
207
+ end
208
+
209
+ def abi_encode(method, *args)
210
+ '0x' + args.each_with_object(Digest::SHA3.hexdigest(method, 256)[0...8]) do |arg, data|
211
+ data.concat(arg.gsub(/\A0x/, '').rjust(64, '0'))
212
+ end
213
+ end
214
+
215
+ def convert_from_base_unit(value, currency)
216
+ value.to_d / currency.fetch(:base_factor).to_d
217
+ end
218
+ end
219
+ end
220
+
221
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'memoist'
4
+ require 'faraday'
5
+ require 'better-faraday'
6
+
7
+ module Peatio
8
+ module Infura
9
+ class Client
10
+ Error = Class.new(StandardError)
11
+
12
+ class ConnectionError < Error; end
13
+
14
+ class ResponseError < Error
15
+ def initialize(code, msg)
16
+ super "#{msg} (#{code})"
17
+ end
18
+ end
19
+
20
+ extend Memoist
21
+
22
+ def initialize(endpoint, idle_timeout: 5)
23
+ @json_rpc_endpoint = URI.parse(endpoint)
24
+ @json_rpc_call_id = 0
25
+ @idle_timeout = idle_timeout
26
+ end
27
+
28
+ def json_rpc(method, params = [])
29
+ response = connection.post \
30
+ current_conn.url_prefix,
31
+ { jsonrpc: '2.0', id: rpc_call_id, method: method, params: params }.to_json,
32
+ {'Accept' => 'application/json',
33
+ 'Content-Type' => 'application/json'}
34
+ response.assert_success!
35
+ response = JSON.parse(response.body)
36
+ response['error'].tap { |error| raise ResponseError.new(error['code'], error['message']) if error }
37
+ response.fetch('result')
38
+ rescue Faraday::Error => e
39
+ raise ConnectionError, e
40
+ rescue StandardError => e
41
+ raise Error, e
42
+ end
43
+
44
+ private
45
+
46
+ def rpc_call_id
47
+ @json_rpc_call_id += 1
48
+ end
49
+
50
+ def connection
51
+ @connection ||= Faraday.new(@json_rpc_endpoint) do |f|
52
+ f.adapter :net_http_persistent, pool_size: 5, idle_timeout: @idle_timeout
53
+ end.tap do |connection|
54
+ unless @json_rpc_endpoint.user.blank?
55
+ connection.basic_auth(@json_rpc_endpoint.user, @json_rpc_endpoint.password)
56
+ end
57
+ end
58
+ end
59
+
60
+ end
61
+ end
62
+
63
+ end
64
+
@@ -0,0 +1,42 @@
1
+ module Peatio
2
+ module Infura
3
+ module Hooks
4
+ BLOCKCHAIN_VERSION_REQUIREMENT = "~> 1.0.0"
5
+ WALLET_VERSION_REQUIREMENT = "~> 1.0.0"
6
+
7
+ class << self
8
+ def check_compatibility
9
+ unless Gem::Requirement.new(BLOCKCHAIN_VERSION_REQUIREMENT)
10
+ .satisfied_by?(Gem::Version.new(Peatio::Blockchain::VERSION))
11
+ [
12
+ "Infura blockchain version requiremnt was not suttisfied by Peatio::Blockchain.",
13
+ "Infura blockchain requires #{BLOCKCHAIN_VERSION_REQUIREMENT}.",
14
+ "Peatio::Blockchain version is #{Peatio::Blockchain::VERSION}"
15
+ ].join('\n').tap { |s| Kernel.abort s }
16
+ end
17
+
18
+ unless Gem::Requirement.new(WALLET_VERSION_REQUIREMENT)
19
+ .satisfied_by?(Gem::Version.new(Peatio::Wallet::VERSION))
20
+ [
21
+ "Infura wallet version requiremnt was not suttisfied by Peatio::Wallet.",
22
+ "Infura wallet requires #{WALLET_VERSION_REQUIREMENT}.",
23
+ "Peatio::Wallet version is #{Peatio::Wallet::VERSION}"
24
+ ].join('\n').tap { |s| Kernel.abort s }
25
+ end
26
+ end
27
+
28
+ def register
29
+ Peatio::Blockchain.registry[:infura] = Infura::Blockchain
30
+ Peatio::Wallet.registry[:infurad] = Infura::Wallet
31
+ end
32
+ end
33
+
34
+ if defined?(Rails::Railtie)
35
+ require "peatio/infura/railtie"
36
+ else
37
+ check_compatibility
38
+ register
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,13 @@
1
+ module Peatio
2
+ module Infura
3
+ class Railtie < Rails::Railtie
4
+ config.before_initialize do
5
+ Hooks.check_compatibility
6
+ end
7
+
8
+ config.after_initialize do
9
+ Hooks.register
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Peatio
2
+ module Infura
3
+ VERSION = '0.1.61'
4
+ end
5
+ end
@@ -0,0 +1,183 @@
1
+ module Peatio
2
+ module Infura
3
+ class Wallet < Peatio::Wallet::Abstract
4
+
5
+ DEFAULT_ETH_FEE = { gas_limit: 21_000, gas_price: 1_000_000_000 }.freeze
6
+
7
+ DEFAULT_ERC20_FEE = { gas_limit: 90_000, gas_price: 1_000_000_000 }.freeze
8
+
9
+ def initialize(settings = {})
10
+ @settings = settings
11
+ end
12
+
13
+ def configure(settings = {})
14
+ # Clean client state during configure.
15
+ @client = nil
16
+
17
+ @settings.merge!(settings.slice(*SUPPORTED_SETTINGS))
18
+
19
+ @wallet = @settings.fetch(:wallet) do
20
+ raise Peatio::Wallet::MissingSettingError, :wallet
21
+ end.slice(:uri, :address, :secret)
22
+
23
+ @currency = @settings.fetch(:currency) do
24
+ raise Peatio::Wallet::MissingSettingError, :currency
25
+ end.slice(:id, :base_factor, :options)
26
+ end
27
+
28
+ def create_address!(options = {})
29
+ secret = options.fetch(:secret) { PasswordGenerator.generate(64) }
30
+ secret.yield_self do |password|
31
+ { address: normalize_address(client.json_rpc(:personal_newAccount, [password])),
32
+ secret: password }
33
+ end
34
+ rescue Infura::Client::Error => e
35
+ raise Peatio::Wallet::ClientError, e
36
+ end
37
+
38
+ def create_transaction!(transaction, options = {})
39
+ if @currency.dig(:options, :erc20_contract_address).present?
40
+ create_erc20_transaction!(transaction)
41
+ else
42
+ create_eth_transaction!(transaction, options)
43
+ end
44
+ rescue Infura::Client::Error => e
45
+ raise Peatio::Wallet::ClientError, e
46
+ end
47
+
48
+ def prepare_deposit_collection!(transaction, deposit_spread, deposit_currency)
49
+ # TODO: Add spec for this behaviour.
50
+ # Don't prepare for deposit_collection in case of eth deposit.
51
+ return [] if deposit_currency.dig(:options, :erc20_contract_address).blank?
52
+
53
+ options = DEFAULT_ERC20_FEE.merge(deposit_currency.fetch(:options).slice(:gas_limit, :gas_price))
54
+
55
+ # We collect fees depending on the number of spread deposit size
56
+ # Example: if deposit spreads on three wallets need to collect eth fee for 3 transactions
57
+ fees = convert_from_base_unit(options.fetch(:gas_limit).to_i * options.fetch(:gas_price).to_i)
58
+ transaction.amount = fees * deposit_spread.size
59
+
60
+ [create_eth_transaction!(transaction)]
61
+ rescue Infura::Client::Error => e
62
+ raise Peatio::Wallet::ClientError, e
63
+ end
64
+
65
+ def load_balance!
66
+ if @currency.dig(:options, :erc20_contract_address).present?
67
+ load_erc20_balance(@wallet.fetch(:address))
68
+ else
69
+ client.json_rpc(:eth_getBalance, [normalize_address(@wallet.fetch(:address)), 'latest'])
70
+ .hex
71
+ .to_d
72
+ .yield_self { |amount| convert_from_base_unit(amount) }
73
+ end
74
+ rescue Infura::Client::Error => e
75
+ raise Peatio::Wallet::ClientError, e
76
+ end
77
+
78
+ private
79
+
80
+ def load_erc20_balance(address)
81
+ data = abi_encode('balanceOf(address)', normalize_address(address))
82
+ client.json_rpc(:eth_call, [{ to: contract_address, data: data }, 'latest'])
83
+ .hex
84
+ .to_d
85
+ .yield_self { |amount| convert_from_base_unit(amount) }
86
+ end
87
+
88
+ def create_eth_transaction!(transaction, options = {})
89
+ currency_options = @currency.fetch(:options).slice(:gas_limit, :gas_price)
90
+ options.merge!(DEFAULT_ETH_FEE, currency_options)
91
+
92
+ amount = convert_to_base_unit(transaction.amount)
93
+
94
+ # Subtract fees from initial deposit amount in case of deposit collection
95
+ amount -= options.fetch(:gas_limit).to_i * options.fetch(:gas_price).to_i if options.dig(:subtract_fee)
96
+
97
+ txid = client.json_rpc(:personal_sendTransaction,
98
+ [{
99
+ from: normalize_address(@wallet.fetch(:address)),
100
+ to: normalize_address(transaction.to_address),
101
+ value: '0x' + amount.to_s(16),
102
+ gas: '0x' + options.fetch(:gas_limit).to_i.to_s(16),
103
+ gasPrice: '0x' + options.fetch(:gas_price).to_i.to_s(16)
104
+ }.compact, @wallet.fetch(:secret)])
105
+
106
+ unless valid_txid?(normalize_txid(txid))
107
+ raise Infura::WalletClient::Error, \
108
+ "Withdrawal from #{@wallet.fetch(:address)} to #{transaction.to_address} failed."
109
+ end
110
+ transaction.amount = convert_from_base_unit(amount)
111
+ transaction.hash = normalize_txid(txid)
112
+ transaction
113
+ end
114
+
115
+ def create_erc20_transaction!(transaction, options = {})
116
+ currency_options = @currency.fetch(:options).slice(:gas_limit, :gas_price, :erc20_contract_address)
117
+ options.merge!(DEFAULT_ERC20_FEE, currency_options)
118
+
119
+ amount = convert_to_base_unit(transaction.amount)
120
+ data = abi_encode('transfer(address,uint256)',
121
+ normalize_address(transaction.to_address),
122
+ '0x' + amount.to_s(16))
123
+
124
+ txid = client.json_rpc(:personal_sendTransaction,
125
+ [{
126
+ from: normalize_address(@wallet.fetch(:address)),
127
+ to: options.fetch(:erc20_contract_address),
128
+ data: data,
129
+ gas: '0x' + options.fetch(:gas_limit).to_i.to_s(16),
130
+ gasPrice: '0x' + options.fetch(:gas_price).to_i.to_s(16)
131
+ }.compact, @wallet.fetch(:secret)])
132
+
133
+ unless valid_txid?(normalize_txid(txid))
134
+ raise Infura::WalletClient::Error, \
135
+ "Withdrawal from #{@wallet.fetch(:address)} to #{transaction.to_address} failed."
136
+ end
137
+ transaction.hash = normalize_txid(txid)
138
+ transaction
139
+ end
140
+
141
+ def normalize_address(address)
142
+ address.downcase
143
+ end
144
+
145
+ def normalize_txid(txid)
146
+ txid.downcase
147
+ end
148
+
149
+ def contract_address
150
+ normalize_address(@currency.dig(:options, :erc20_contract_address))
151
+ end
152
+
153
+ def valid_txid?(txid)
154
+ txid.to_s.match?(/\A0x[A-F0-9]{64}\z/i)
155
+ end
156
+
157
+ def abi_encode(method, *args)
158
+ '0x' + args.each_with_object(Digest::SHA3.hexdigest(method, 256)[0...8]) do |arg, data|
159
+ data.concat(arg.gsub(/\A0x/, '').rjust(64, '0'))
160
+ end
161
+ end
162
+
163
+ def convert_from_base_unit(value)
164
+ value.to_d / @currency.fetch(:base_factor)
165
+ end
166
+
167
+ def convert_to_base_unit(value)
168
+ x = value.to_d * @currency.fetch(:base_factor)
169
+ unless (x % 1).zero?
170
+ raise Peatio::WalletClient::Error,
171
+ "Failed to convert value to base (smallest) unit because it exceeds the maximum precision: " \
172
+ "#{value.to_d} - #{x.to_d} must be equal to zero."
173
+ end
174
+ x.to_i
175
+ end
176
+
177
+ def client
178
+ uri = @wallet.fetch(:uri) { raise Peatio::Wallet::MissingSettingError, :uri }
179
+ @client ||= Client.new(uri, idle_timeout: 1)
180
+ end
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "peatio/infura/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "peatio-infura"
8
+ spec.version = Peatio::Infura::VERSION
9
+ spec.authors = ["Iman mousavi"]
10
+ spec.email = ["irwebuniq@gmail.com"]
11
+
12
+ spec.summary = %q{Gem for extending Peatio plugable system with Infura implementation.}
13
+ spec.description = %q{Infura Peatio gem which implements Peatio::Blockchain::Abstract & Peatio::Wallet::Abstract.}
14
+ spec.homepage = "https://github.com/irmaster/Peatio-Infura"
15
+ spec.license = "MIT"
16
+
17
+ # Specify which files should be added to the gem when it is released.
18
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
19
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
20
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
+ end
22
+ spec.bindir = "exe"
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ["lib"]
25
+
26
+ spec.add_dependency "activesupport", "~> 5.2.3"
27
+ spec.add_dependency "better-faraday", "~> 1.0.5"
28
+ spec.add_dependency "faraday", "~> 0.15.4"
29
+ spec.add_dependency "memoist", "~> 0.16.0"
30
+ spec.add_dependency "peatio", ">= 0.6.3"
31
+ spec.add_dependency 'net-http-persistent', '~> 3.0.1'
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "mocha", "~> 1.8"
35
+ spec.add_development_dependency "pry-byebug"
36
+ spec.add_development_dependency "rake", "~> 13.0"
37
+ spec.add_development_dependency "rspec", "~> 3.0"
38
+ spec.add_development_dependency "webmock", "~> 3.5"
39
+ end
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: peatio-infura
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.61
5
+ platform: ruby
6
+ authors:
7
+ - Iman mousavi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 5.2.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 5.2.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: better-faraday
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.5
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.5
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.15.4
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.15.4
55
+ - !ruby/object:Gem::Dependency
56
+ name: memoist
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.16.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.16.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: peatio
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.3
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: net-http-persistent
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.0.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.0.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mocha
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.8'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.8'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-byebug
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '13.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '13.0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rspec
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: '3.0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: '3.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: webmock
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '3.5'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '3.5'
181
+ description: Infura Peatio gem which implements Peatio::Blockchain::Abstract & Peatio::Wallet::Abstract.
182
+ email:
183
+ - irwebuniq@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - ".gitignore"
189
+ - ".rakeTasks"
190
+ - Gemfile
191
+ - Gemfile.lock
192
+ - Rakefile
193
+ - bin/console
194
+ - bin/setup
195
+ - config/blockchains.yml
196
+ - config/currencies.yml
197
+ - config/wallets.yml
198
+ - docs/integration.md
199
+ - docs/json-rpc.md
200
+ - docs/testnet.md
201
+ - lib/peatio/infura.rb
202
+ - lib/peatio/infura/blockchain.rb
203
+ - lib/peatio/infura/client.rb
204
+ - lib/peatio/infura/hooks.rb
205
+ - lib/peatio/infura/railtie.rb
206
+ - lib/peatio/infura/version.rb
207
+ - lib/peatio/infura/wallet.rb
208
+ - peatio-infura.gemspec
209
+ homepage: https://github.com/irmaster/Peatio-Infura
210
+ licenses:
211
+ - MIT
212
+ metadata: {}
213
+ post_install_message:
214
+ rdoc_options: []
215
+ require_paths:
216
+ - lib
217
+ required_ruby_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - ">="
225
+ - !ruby/object:Gem::Version
226
+ version: '0'
227
+ requirements: []
228
+ rubygems_version: 3.0.8
229
+ signing_key:
230
+ specification_version: 4
231
+ summary: Gem for extending Peatio plugable system with Infura implementation.
232
+ test_files: []