cronos_scanner 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +22 -0
- data/README.md +47 -0
- data/Rakefile +4 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/cronos_scanner/accounts.rb +15 -0
- data/lib/cronos_scanner/blocks.rb +10 -0
- data/lib/cronos_scanner/contracts.rb +10 -0
- data/lib/cronos_scanner/request.rb +38 -0
- data/lib/cronos_scanner/tokens.rb +11 -0
- data/lib/cronos_scanner/transactions.rb +12 -0
- data/lib/cronos_scanner/version.rb +5 -0
- data/lib/cronos_scanner.rb +34 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e65284478669f31adb4b51daf64fa01e29e36051b69316efc942bcd78387f498
|
4
|
+
data.tar.gz: 8abc3c59927a4be97db73271fd7bd4d41e25e452bbc36ff23da70f60d826ae9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6028603643f1636663d13133e835a435661ae1a1fe8f3281493ce42e4d9d9c49465121106d1aa02ace84857b45c3b55ed0ea7318211db89a990c4f6a1f0e2bbc
|
7
|
+
data.tar.gz: 75c82b12e3787fdcbe970786cbb3574d451ba84e288b49d8b0ee888d47bddc29186284e30c59cdac21b4e9fb81a7347640937ff73c13fce3bffcc3de5fee3650
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cronos_scanner (0.2.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.15.0)
|
10
|
+
rake (13.0.6)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
x86_64-darwin-20
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
bundler (~> 2.0)
|
17
|
+
cronos_scanner!
|
18
|
+
minitest (~> 5.0)
|
19
|
+
rake (~> 13.0)
|
20
|
+
|
21
|
+
BUNDLED WITH
|
22
|
+
2.2.19
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# CronosScanner
|
2
|
+
|
3
|
+
Cronos Chain Scanner
|
4
|
+
|
5
|
+
```
|
6
|
+
TestNet API: https://api-testnet.cronoscan.com/
|
7
|
+
MainNet API: https://api.cronoscan.com/
|
8
|
+
```
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'cronos_scanner'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
$ bundle install
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
|
24
|
+
$ gem install cronos_scanner
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
# set your net first
|
30
|
+
|
31
|
+
CronosScanner.net = 'testnet' or CronosScanner.net = 'main' (default)
|
32
|
+
CronosScanner.apikey = 'apikey'
|
33
|
+
```
|
34
|
+
|
35
|
+
```test
|
36
|
+
ruby test/*
|
37
|
+
```
|
38
|
+
|
39
|
+
## Development
|
40
|
+
|
41
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
42
|
+
|
43
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gu-dave/cronos_scanner.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "cronos_scanner"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CronosScanner
|
4
|
+
class Accounts
|
5
|
+
class << self
|
6
|
+
DEFAULT_HASH = { module: 'account' }.freeze
|
7
|
+
|
8
|
+
def txlistinternal(address)
|
9
|
+
hash = DEFAULT_HASH.merge(action: 'txlistinternal', address: address)
|
10
|
+
|
11
|
+
Request.get hash
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'oj'
|
2
|
+
require 'faraday'
|
3
|
+
|
4
|
+
module CronosScanner
|
5
|
+
class Request
|
6
|
+
class << self
|
7
|
+
def get(hash)
|
8
|
+
res = connect.get do |req|
|
9
|
+
req.url params(hash)
|
10
|
+
req.headers['Content-Type'] = 'application/json'
|
11
|
+
end.body
|
12
|
+
|
13
|
+
Oj.load(res)
|
14
|
+
end
|
15
|
+
|
16
|
+
def post(hash)
|
17
|
+
res = connect.post do |req, params|
|
18
|
+
req.url params(hash)
|
19
|
+
req.headers['Content-Type'] = 'application/json'
|
20
|
+
req.params params
|
21
|
+
end.body
|
22
|
+
|
23
|
+
Oj.load(res)
|
24
|
+
end
|
25
|
+
|
26
|
+
def connect
|
27
|
+
Faraday.new(url: CronosScanner.domain) do |faraday|
|
28
|
+
faraday.request :json
|
29
|
+
faraday.adapter Faraday.default_adapter
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def params(hash)
|
34
|
+
'?' + URI.encode_www_form(hash) + "&apikey=#{CronosScanner.apikey}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "cronos_scanner/version"
|
4
|
+
require_relative "cronos_scanner/request"
|
5
|
+
require_relative "cronos_scanner/accounts"
|
6
|
+
require_relative "cronos_scanner/transactions"
|
7
|
+
require_relative "cronos_scanner/blocks"
|
8
|
+
require_relative "cronos_scanner/contracts"
|
9
|
+
require_relative "cronos_scanner/tokens"
|
10
|
+
|
11
|
+
module CronosScanner
|
12
|
+
class Error < StandardError; end
|
13
|
+
# Your code goes here...
|
14
|
+
|
15
|
+
class << self
|
16
|
+
# attr_reader :net
|
17
|
+
attr_writer :net, :apikey
|
18
|
+
|
19
|
+
def domain
|
20
|
+
case @net
|
21
|
+
when 'main'
|
22
|
+
'https://api.cronoscan.com/api'
|
23
|
+
when 'testnet'
|
24
|
+
'https://api-testnet.cronoscan.com/api'
|
25
|
+
else
|
26
|
+
raise 'error net, only testnet and main'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def apikey
|
31
|
+
@apikey
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cronos_scanner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- dave
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-05-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: An unofficial simple gem For Cronos Chain Explorer API
|
56
|
+
email:
|
57
|
+
- dave.gu@crypto.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- Gemfile
|
63
|
+
- Gemfile.lock
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- bin/console
|
67
|
+
- bin/setup
|
68
|
+
- lib/cronos_scanner.rb
|
69
|
+
- lib/cronos_scanner/accounts.rb
|
70
|
+
- lib/cronos_scanner/blocks.rb
|
71
|
+
- lib/cronos_scanner/contracts.rb
|
72
|
+
- lib/cronos_scanner/request.rb
|
73
|
+
- lib/cronos_scanner/tokens.rb
|
74
|
+
- lib/cronos_scanner/transactions.rb
|
75
|
+
- lib/cronos_scanner/version.rb
|
76
|
+
homepage: https://github.com/gu-dave/cronos_scanner
|
77
|
+
licenses: []
|
78
|
+
metadata:
|
79
|
+
allowed_push_host: https://rubygems.org
|
80
|
+
homepage_uri: https://github.com/gu-dave/cronos_scanner
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.0
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubygems_version: 3.0.3
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: A Ruby Gem For Cronos Chain
|
100
|
+
test_files: []
|