cronos_chain_scanner 0.1.4 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52ca3f4634f77d69344ce1c5d25903d1b2836374935bc77a71ba7585af86dba6
4
- data.tar.gz: 4d9f22b0c2fdb360b82aaa115734e3fa70349f2376cacc00bdf074c55af1b991
3
+ metadata.gz: 259fbd12cf721da39b67b2ac2def57de96051878a9ce966475b17c9a3c7ea512
4
+ data.tar.gz: a623bdea524320e6644fd6e99f848b7afbf30cbe9c458f8e4d428d93e05fb90d
5
5
  SHA512:
6
- metadata.gz: 4c497250023771f2959580ad97f8956b92924cf6e668cff637206207ac62d8e3d49db5bf024ee5126be68edcb1f1afe206c514bc4cda949f34974d81230ee0ce
7
- data.tar.gz: e7ef49920c33ae5ea4f1b7a65da3afd4e7d1c872e4079f358c443849cce899f39847682e8bc322e979c2f6fbcfb9b192c5558bebdb564e6f7de4ded02c37adc6
6
+ metadata.gz: e6ee95d22f8cd54379ae9e1be003138c945d2d1d45fe230d572c321f412d8e967b459df35e86b027c4ca865e2e3c33171a4dc00f4621001389aa44ff47f5d258
7
+ data.tar.gz: 88b7ee88b4512af9f5f2ede0c6279f7555fa7c1262e7071d608f60b003444cf954a6fe811d6a742e3bfa2bb3e968f4ebac4ddd578cd28e3e9ee51da028f1a643
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cronos_chain_scanner (0.1.4)
4
+ cronos_chain_scanner (0.1.7)
5
5
  faraday (~> 2.0)
6
6
  oj (~> 3.0)
7
7
 
data/README.md CHANGED
@@ -27,11 +27,20 @@ CronosChainScanner.net = 'testnet3' or CronosChainScanner.net = 'main' (default)
27
27
  ```ruby
28
28
  CronosChainScanner::Blocks.eth_block_number
29
29
 
30
+ CronosChainScanner::Contracts.listcontracts
31
+
30
32
  CronosChainScanner::Accounts.eth_get_balance(@address)
33
+ CronosChainScanner::Accounts.balance(@address)
31
34
  CronosChainScanner::Accounts.txlist(@address, starttimestamp)
32
35
  CronosChainScanner::Accounts.tokenbalance(@contractaddress, @address)
33
36
 
34
37
  CronosChainScanner::Transactions.gettxinfo(@txhash)
38
+ CronosChainScanner::Transactions.gettxreceiptstatus(@txhash)
39
+ CronosChainScanner::Transactions.getstatus(@txhash)
40
+
41
+ CronosChainScanner::Tokens.getToken(@contractaddress)
42
+
43
+ CronosChainScanner::Contracts.listcontracts
35
44
  ```
36
45
 
37
46
  ## Development
@@ -11,6 +11,12 @@ module CronosChainScanner
11
11
  Request.get hash
12
12
  end
13
13
 
14
+ def balance(address)
15
+ hash = DEFAULT_HASH.merge(action: 'balance', address: address)
16
+
17
+ Request.get hash
18
+ end
19
+
14
20
  def txlist(address, starttimestamp = nil, sort = 'desc')
15
21
  hash = DEFAULT_HASH.merge(action: 'txlist', address: address, starttimestamp: starttimestamp, sort: sort)
16
22
 
@@ -10,6 +10,12 @@ module CronosChainScanner
10
10
 
11
11
  Request.get hash
12
12
  end
13
+
14
+ def getblockreward(blockno)
15
+ hash = DEFAULT_HASH.merge(action: 'getblockreward', blockno: blockno)
16
+
17
+ Request.get hash
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CronosChainScanner
4
+ class Contracts
5
+ class << self
6
+ DEFAULT_HASH = { module: 'contract' }.freeze
7
+
8
+ def listcontracts
9
+ hash = DEFAULT_HASH.merge(action: 'listcontracts')
10
+
11
+ Request.get hash
12
+ end
13
+ end
14
+ end
15
+ end
@@ -31,7 +31,6 @@ module CronosChainScanner
31
31
  end
32
32
 
33
33
  def params(hash)
34
- puts URI.encode_www_form(hash)
35
34
  '?' + URI.encode_www_form(hash)
36
35
  end
37
36
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CronosChainScanner
4
+ class Tokens
5
+ class << self
6
+ DEFAULT_HASH = { module: 'token' }.freeze
7
+
8
+ def getToken(contractaddress)
9
+ hash = DEFAULT_HASH.merge(action: 'getToken', contractaddress: contractaddress)
10
+
11
+ Request.get hash
12
+ end
13
+ end
14
+ end
15
+ end
@@ -17,6 +17,12 @@ module CronosChainScanner
17
17
 
18
18
  Request.get hash
19
19
  end
20
+
21
+ def getstatus(txhash)
22
+ hash = DEFAULT_HASH.merge(action: 'getstatus', txhash: txhash)
23
+
24
+ Request.get hash
25
+ end
20
26
  end
21
27
  end
22
28
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CronosChainScanner
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.7"
5
5
  end
6
6
 
@@ -5,6 +5,8 @@ require_relative "cronos_chain_scanner/request"
5
5
  require_relative "cronos_chain_scanner/accounts"
6
6
  require_relative "cronos_chain_scanner/transactions"
7
7
  require_relative "cronos_chain_scanner/blocks"
8
+ require_relative "cronos_chain_scanner/contracts"
9
+ require_relative "cronos_chain_scanner/tokens"
8
10
 
9
11
  module CronosChainScanner
10
12
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cronos_chain_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - menghuanwd
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-03 00:00:00.000000000 Z
11
+ date: 2022-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -97,7 +97,9 @@ files:
97
97
  - lib/cronos_chain_scanner.rb
98
98
  - lib/cronos_chain_scanner/accounts.rb
99
99
  - lib/cronos_chain_scanner/blocks.rb
100
+ - lib/cronos_chain_scanner/contracts.rb
100
101
  - lib/cronos_chain_scanner/request.rb
102
+ - lib/cronos_chain_scanner/tokens.rb
101
103
  - lib/cronos_chain_scanner/transactions.rb
102
104
  - lib/cronos_chain_scanner/version.rb
103
105
  homepage: https://github.com/menghuanwd/cronos_chain_scanner