golos_cloud 1.0.0alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +13 -0
- data/README.md +48 -0
- data/Rakefile +22 -0
- data/bin/golos_cloud +23 -0
- data/golos_cloud.gemspec +29 -0
- data/lib/golos_cloud/models/account.rb +84 -0
- data/lib/golos_cloud/models/block.rb +19 -0
- data/lib/golos_cloud/models/comment.rb +73 -0
- data/lib/golos_cloud/models/connection.rb +33 -0
- data/lib/golos_cloud/models/sql_base.rb +28 -0
- data/lib/golos_cloud/models/token.rb +27 -0
- data/lib/golos_cloud/models/transaction.rb +29 -0
- data/lib/golos_cloud/models/tx/account_create.rb +26 -0
- data/lib/golos_cloud/models/tx/account_recover.rb +20 -0
- data/lib/golos_cloud/models/tx/account_update.rb +22 -0
- data/lib/golos_cloud/models/tx/account_witness_proxy.rb +19 -0
- data/lib/golos_cloud/models/tx/account_witness_vote.rb +20 -0
- data/lib/golos_cloud/models/tx/claim_reward_balance.rb +21 -0
- data/lib/golos_cloud/models/tx/comment.rb +24 -0
- data/lib/golos_cloud/models/tx/comments_option.rb +23 -0
- data/lib/golos_cloud/models/tx/convert.rb +20 -0
- data/lib/golos_cloud/models/tx/custom/follow.rb +32 -0
- data/lib/golos_cloud/models/tx/custom/reblog.rb +22 -0
- data/lib/golos_cloud/models/tx/custom/witness.rb +11 -0
- data/lib/golos_cloud/models/tx/custom.rb +19 -0
- data/lib/golos_cloud/models/tx/delegate_vesting_share.rb +20 -0
- data/lib/golos_cloud/models/tx/delete_comment.rb +19 -0
- data/lib/golos_cloud/models/tx/escrow_approve.rb +23 -0
- data/lib/golos_cloud/models/tx/escrow_dispute.rb +22 -0
- data/lib/golos_cloud/models/tx/escrow_release.rb +25 -0
- data/lib/golos_cloud/models/tx/escrow_transfer.rb +28 -0
- data/lib/golos_cloud/models/tx/feed.rb +20 -0
- data/lib/golos_cloud/models/tx/limit_order.rb +26 -0
- data/lib/golos_cloud/models/tx/pow.rb +19 -0
- data/lib/golos_cloud/models/tx/transfer.rb +24 -0
- data/lib/golos_cloud/models/tx/vote.rb +21 -0
- data/lib/golos_cloud/models/tx/withdraw.rb +19 -0
- data/lib/golos_cloud/models/tx/withdraw_vesting_route.rb +21 -0
- data/lib/golos_cloud/models/tx/witness_update.rb +24 -0
- data/lib/golos_cloud/models/vo/author_reward.rb +22 -0
- data/lib/golos_cloud/models/vo/curation_reward.rb +21 -0
- data/lib/golos_cloud/models/vo/fill_convert_request.rb +21 -0
- data/lib/golos_cloud/models/vo/fill_order.rb +23 -0
- data/lib/golos_cloud/models/vo/fill_vesting_withdraw.rb +21 -0
- data/lib/golos_cloud/models/vo/interest.rb +19 -0
- data/lib/golos_cloud/models/vo/shutdown_witness.rb +18 -0
- data/lib/golos_cloud/version.rb +3 -0
- data/lib/golos_cloud.rb +50 -0
- data/lib/version.rb +3 -0
- data/steem_source_docs.md +12167 -0
- metadata +180 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6284e8f83f026642ec3a1b89050404a0fe457c70
|
4
|
+
data.tar.gz: b6d25cb678e58cd95f26c617382a927be7a76242
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea244bb9e371352af8ee864178e5f2a344a5b213cb49972d4bcdd3cb23721a86c26b35e0ac56245c85dbd4b8e2304ea6f3b4dea908981bbafe2311554b92eb7e
|
7
|
+
data.tar.gz: 90908b58e8eeb3ffe83aa85f065c439fffabcd9852de40586aeffb4e12174251ee185e62d6fd02acd652bab4910f4319ffe38a3a453515083912e37df0677fa6
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at andrewc@pobox.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
2
|
+
Version 2, December 2004
|
3
|
+
|
4
|
+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
5
|
+
|
6
|
+
Everyone is permitted to copy and distribute verbatim or modified
|
7
|
+
copies of this license document, and changing it is allowed as long
|
8
|
+
as the name is changed.
|
9
|
+
|
10
|
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
11
|
+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
12
|
+
|
13
|
+
0. You just DO WHAT THE FUCK YOU WANT TO.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# GolosCloud
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/golos_cloud.svg)](https://badge.fury.io/rb/golos_cloud)
|
4
|
+
|
5
|
+
### How To Use (Rails 4+)
|
6
|
+
- Add Gem to Gemfile
|
7
|
+
* `gem 'golos_cloud', '~> 1.0'`
|
8
|
+
- Bundle Install Gems
|
9
|
+
* `bundle install`
|
10
|
+
|
11
|
+
### How To Use (Standalone)
|
12
|
+
- `gem install golos_cloud`
|
13
|
+
- `irb`
|
14
|
+
- `require 'golos_cloud'`
|
15
|
+
- `GolosCloud::Comment.last`
|
16
|
+
|
17
|
+
### Models
|
18
|
+
- Account
|
19
|
+
- Block
|
20
|
+
- Comment
|
21
|
+
- Token
|
22
|
+
- Transaction
|
23
|
+
|
24
|
+
### Followers
|
25
|
+
|
26
|
+
How to query today's followers:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
followers = GolosCloud::Tx::Custom::Follow
|
30
|
+
followers.following(:ned).today.count
|
31
|
+
```
|
32
|
+
|
33
|
+
### Resteem
|
34
|
+
|
35
|
+
How to query today's "resteems":
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
reblogs = GolosCloud::Tx::Custom::Reblog
|
39
|
+
reblogs.author(:netuoso).today.count
|
40
|
+
```
|
41
|
+
|
42
|
+
### How To Contribute
|
43
|
+
- Fork this repo
|
44
|
+
- Branch off Master and make your changes
|
45
|
+
- Submit a PR to this repo's Master branch
|
46
|
+
|
47
|
+
### License
|
48
|
+
- [WTFPL](LICENSE.txt)
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :test
|
11
|
+
|
12
|
+
task :console do
|
13
|
+
exec "irb -r golos_cloud -I ./lib"
|
14
|
+
end
|
15
|
+
|
16
|
+
task :build do
|
17
|
+
exec 'gem build golos_cloud.gemspec'
|
18
|
+
end
|
19
|
+
|
20
|
+
task :push do
|
21
|
+
exec "gem push golos_cloud-#{GolosCloud::VERSION}.gem"
|
22
|
+
end
|
data/bin/golos_cloud
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'golos_cloud'
|
4
|
+
|
5
|
+
puts "#"*40
|
6
|
+
puts "#"*40
|
7
|
+
puts "Welcome to GolosCloud Version: #{GolosCloud::VERSION}"
|
8
|
+
puts "#"*40
|
9
|
+
puts "#"*40
|
10
|
+
puts ""
|
11
|
+
|
12
|
+
case ARGV[0]
|
13
|
+
when "rate"
|
14
|
+
puts "Current STEEM per MVESTS rate: #{GolosCloud::Connection.steem_per_mvests}"
|
15
|
+
else
|
16
|
+
STDOUT.puts <<~EOF
|
17
|
+
Please provide command name
|
18
|
+
|
19
|
+
Usage:
|
20
|
+
golos-cloud rate
|
21
|
+
golos-cloud help
|
22
|
+
EOF
|
23
|
+
end
|
data/golos_cloud.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'golos_cloud/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "golos_cloud"
|
8
|
+
spec.version = GolosCloud::VERSION
|
9
|
+
spec.authors = ["Anthony Martin"]
|
10
|
+
spec.email = ["golos_cloud@martin-studio.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Ruby/Rails wrapper for golos.cloud}
|
13
|
+
spec.description = %q{Rails compatible gem that provides full DB connection and models to golos.cloud}
|
14
|
+
spec.homepage = "https://github.com/inertia186/golos_cloud"
|
15
|
+
spec.license = "WTFPL"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "bin"
|
21
|
+
spec.executables = "golos_cloud"
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "nokogiri", ["~> 1.8"]
|
25
|
+
spec.add_runtime_dependency "rest-client", ["~> 2.0"]
|
26
|
+
spec.add_runtime_dependency "activerecord", [">= 4", "< 6"]
|
27
|
+
spec.add_runtime_dependency "tiny_tds", ["~> 1.3"]
|
28
|
+
spec.add_runtime_dependency "activerecord-sqlserver-adapter", [">= 4", "< 6"]
|
29
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
class Account < GolosCloud::SqlBase
|
3
|
+
|
4
|
+
self.table_name = :Accounts
|
5
|
+
|
6
|
+
scope :before, lambda { |before, field = 'created'| where("#{field} < ?", before) }
|
7
|
+
scope :after, lambda { |after, field = 'created'| where("#{field} > ?", after) }
|
8
|
+
scope :today, -> { after(1.day.ago) }
|
9
|
+
scope :yesterday, -> { before(1.day.ago).after(2.days.ago) }
|
10
|
+
|
11
|
+
def witness?
|
12
|
+
self.witness_votes != "[]"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Structure
|
19
|
+
#
|
20
|
+
# GolosCloud::Account(
|
21
|
+
# id: varchar,
|
22
|
+
# name: varchar,
|
23
|
+
# owner: varchar_max,
|
24
|
+
# active: varchar_max,
|
25
|
+
# posting: varchar_max,
|
26
|
+
# memo_key: varchar_max,
|
27
|
+
# json_metadata: text,
|
28
|
+
# proxy: varchar,
|
29
|
+
# last_owner_update: datetime,
|
30
|
+
# last_account_update: datetime,
|
31
|
+
# created: datetime,
|
32
|
+
# mined: boolean,
|
33
|
+
# owner_challenged: boolean,
|
34
|
+
# active_challenged: boolean,
|
35
|
+
# last_owner_proved: datetime,
|
36
|
+
# last_active_proved: datetime,
|
37
|
+
# recovery_account: varchar,
|
38
|
+
# last_account_recovery: datetime,
|
39
|
+
# reset_account: varchar,
|
40
|
+
# comment_count: integer,
|
41
|
+
# lifetime_vote_count: integer,
|
42
|
+
# post_count: integer,
|
43
|
+
# can_vote: boolean,
|
44
|
+
# voting_power: integer,
|
45
|
+
# last_vote_time: datetime,
|
46
|
+
# balance: varchar,
|
47
|
+
# savings_balance: varchar,
|
48
|
+
# sbd_balance: varchar,
|
49
|
+
# sbd_seconds: integer,
|
50
|
+
# sbd_seconds_last_update: datetime,
|
51
|
+
# sbd_last_interest_payment: datetime,
|
52
|
+
# savings_sbd_balance: varchar,
|
53
|
+
# savings_sbd_seconds: integer,
|
54
|
+
# savings_sbd_seconds_last_update: datetime,
|
55
|
+
# savings_sbd_last_interest_payment: datetime,
|
56
|
+
# savings_withdraw_requests: integer,
|
57
|
+
# vesting_shares: varchar,
|
58
|
+
# vesting_withdraw_rate: varchar,
|
59
|
+
# next_vesting_withdrawal: datetime,
|
60
|
+
# withdrawn: integer,
|
61
|
+
# to_withdraw: integer,
|
62
|
+
# withdraw_routes: integer,
|
63
|
+
# curation_rewards: integer,
|
64
|
+
# posting_rewards: integer,
|
65
|
+
# proxied_vsf_votes: varchar_max,
|
66
|
+
# witnesses_voted_for: integer,
|
67
|
+
# average_bandwidth: integer,
|
68
|
+
# lifetime_bandwidth: integer,
|
69
|
+
# last_bandwidth_update: datetime,
|
70
|
+
# average_market_bandwidth: integer,
|
71
|
+
# last_market_bandwidth_update: datetime,
|
72
|
+
# last_post: datetime,
|
73
|
+
# last_root_post: datetime,
|
74
|
+
# vesting_balance: varchar,
|
75
|
+
# reputation: integer,
|
76
|
+
# transfer_history: varchar_max,
|
77
|
+
# market_history: varchar_max,
|
78
|
+
# post_history: varchar_max,
|
79
|
+
# vote_history: varchar_max,
|
80
|
+
# other_history: varchar_max,
|
81
|
+
# witness_votes: varchar_max,
|
82
|
+
# dirty: boolean,
|
83
|
+
# TS: ss_timestamp
|
84
|
+
# )
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
class Block < GolosCloud::SqlBase
|
3
|
+
|
4
|
+
self.table_name = :Blocks
|
5
|
+
self.primary_key = :block_num
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# Structure
|
11
|
+
#
|
12
|
+
# GolosCloud::Block(
|
13
|
+
# block_num: integer,
|
14
|
+
# previous: varchar,
|
15
|
+
# timestamp: datetime,
|
16
|
+
# witness: varchar,
|
17
|
+
# witness_signature: varchar,
|
18
|
+
# transaction_merkle_root: varchar
|
19
|
+
# )
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
class Comment < GolosCloud::SqlBase
|
3
|
+
|
4
|
+
self.table_name = :Comments
|
5
|
+
|
6
|
+
scope :before, lambda { |before, field = 'created'| where("#{field} < ?", before) }
|
7
|
+
scope :after, lambda { |after, field = 'created'| where("#{field} > ?", after) }
|
8
|
+
scope :today, -> { after(1.day.ago) }
|
9
|
+
scope :yesterday, -> { before(1.day.ago).after(2.days.ago) }
|
10
|
+
|
11
|
+
def self.find_by_author(user)
|
12
|
+
self.where(author: user)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.find_by_parent(user)
|
16
|
+
self.where(parent_author: user)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# Strcture
|
23
|
+
#
|
24
|
+
# GolosCloud::Comment(
|
25
|
+
# ID: integer,
|
26
|
+
# author: varchar,
|
27
|
+
# permlink: varchar,
|
28
|
+
# category: varchar,
|
29
|
+
# parent_author: varchar,
|
30
|
+
# parent_permlink: varchar,
|
31
|
+
# title: text,
|
32
|
+
# body: text,
|
33
|
+
# json_metadata: text,
|
34
|
+
# last_update: datetime,
|
35
|
+
# created: datetime,
|
36
|
+
# active: datetime,
|
37
|
+
# last_payout: datetime,
|
38
|
+
# depth: integer,
|
39
|
+
# children: integer,
|
40
|
+
# net_rshares: integer,
|
41
|
+
# abs_rshares: integer,
|
42
|
+
# vote_rshares: integer,
|
43
|
+
# children_abs_rshares: integer,
|
44
|
+
# cashout_time: datetime,
|
45
|
+
# max_cashout_time: datetime,
|
46
|
+
# total_vote_weight: float,
|
47
|
+
# reward_weight: integer,
|
48
|
+
# total_payout_value: money,
|
49
|
+
# curator_payout_value: money,
|
50
|
+
# author_rewards: money,
|
51
|
+
# net_votes: integer,
|
52
|
+
# root_comment: varchar,
|
53
|
+
# mode: varchar,
|
54
|
+
# max_accepted_payout: money,
|
55
|
+
# percent_steem_dollars: integer,
|
56
|
+
# allow_replies: boolean,
|
57
|
+
# allow_votes: boolean,
|
58
|
+
# allow_curation_rewards: boolean,
|
59
|
+
# beneficiaries: varchar_max,
|
60
|
+
# url: varchar_max,
|
61
|
+
# root_title: text,
|
62
|
+
# pending_payout_value: money,
|
63
|
+
# total_pending_payout_value: money,
|
64
|
+
# active_votes: varchar_max,
|
65
|
+
# replies: varchar_max,
|
66
|
+
# author_reputation: integer,
|
67
|
+
# promoted: varchar,
|
68
|
+
# body_length: integer,
|
69
|
+
# reblogged_by: varchar_max,
|
70
|
+
# body_language: varchar,
|
71
|
+
# dirty: boolean,
|
72
|
+
# TS: ss_timestamp
|
73
|
+
# )
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
module GolosCloud
|
5
|
+
class Connection < GolosCloud::SqlBase
|
6
|
+
|
7
|
+
self.table_name = nil
|
8
|
+
|
9
|
+
def self.steem_per_mvests
|
10
|
+
begin
|
11
|
+
# SteemDollar.com (fastest)
|
12
|
+
steemdollar_response = RestClient::Request.execute(method: :get, url: "https://www.steemdollar.com/vests.php", timeout: 3, open_timeout: 3).body
|
13
|
+
Nokogiri::XML.parse(steemdollar_response).css('.text-intro')[2].text.match(/1\s*VESTS\s*=\s*(\d*\.\d*)/)[1]
|
14
|
+
|
15
|
+
# Steemd.com
|
16
|
+
# steemd_response = RestClient::Request.execute(method: :get, url: "https://steemd.com", timeout: 3, open_timeout: 3).body
|
17
|
+
# Nokogiri::XML.parse(steemd_response).css('.hash3').first.text.match(/^steem_per_mvests(\d*.\d*)/)[1]
|
18
|
+
rescue => e
|
19
|
+
Rails.logger.error("Error: #{e}")
|
20
|
+
Settings.steem_per_mvests
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.tables
|
25
|
+
self.connection.tables
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.columns(model_name)
|
29
|
+
"GolosCloud::#{model_name}".constantize.columns.map(&:name)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "active_record"
|
2
|
+
|
3
|
+
module GolosCloud
|
4
|
+
class SqlBase < ActiveRecord::Base
|
5
|
+
|
6
|
+
establish_connection({
|
7
|
+
adapter: "sqlserver",
|
8
|
+
host: "sql.golos.cloud",
|
9
|
+
username: "golos",
|
10
|
+
password: "golos",
|
11
|
+
timeout: 60
|
12
|
+
})
|
13
|
+
|
14
|
+
self.table_name = nil
|
15
|
+
self.inheritance_column = nil
|
16
|
+
self.abstract_class = true
|
17
|
+
|
18
|
+
scope :before, lambda { |before, field = 'timestamp'| where("#{field} < ?", before) }
|
19
|
+
scope :after, lambda { |after, field = 'timestamp'| where("#{field} > ?", after) }
|
20
|
+
scope :today, -> { after(1.day.ago) }
|
21
|
+
scope :yesterday, -> { before(1.day.ago).after(2.days.ago) }
|
22
|
+
|
23
|
+
def tx
|
24
|
+
GolosCloud::Transaction.find_by(tx_id: self.tx_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
class Token < GolosCloud::SqlBase
|
3
|
+
|
4
|
+
self.table_name = :Tokens
|
5
|
+
|
6
|
+
scope :before, lambda { |before, field = 'time'| where("#{field} < ?", before) }
|
7
|
+
scope :after, lambda { |after, field = 'time'| where("#{field} > ?", after) }
|
8
|
+
scope :today, -> { after(1.day.ago) }
|
9
|
+
scope :yesterday, -> { before(1.day.ago).after(2.days.ago) }
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Structure
|
15
|
+
#
|
16
|
+
# GolosCloud::Token(
|
17
|
+
# id: integer,
|
18
|
+
# hour: boolean,
|
19
|
+
# symbol: varchar,
|
20
|
+
# time: smalldatetime,
|
21
|
+
# open: real,
|
22
|
+
# close: real,
|
23
|
+
# high: real,
|
24
|
+
# low: real,
|
25
|
+
# volumefrom: real,
|
26
|
+
# volumeto: real
|
27
|
+
# )
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
class Transaction < GolosCloud::SqlBase
|
3
|
+
|
4
|
+
self.table_name = :Transactions
|
5
|
+
self.primary_key = :tx_id
|
6
|
+
|
7
|
+
scope :before, lambda { |before, field = 'expiration'| where("#{field} < ?", before) }
|
8
|
+
scope :after, lambda { |after, field = 'expiration'| where("#{field} > ?", after) }
|
9
|
+
scope :today, -> { after(1.day.ago) }
|
10
|
+
scope :yesterday, -> { before(1.day.ago).after(2.days.ago) }
|
11
|
+
|
12
|
+
def block
|
13
|
+
GolosCloud::Block.find(block_num)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Structure
|
20
|
+
#
|
21
|
+
# GolosCloud::Transaction(
|
22
|
+
# tx_id: integer,
|
23
|
+
# block_num: integer,
|
24
|
+
# transaction_num: integer,
|
25
|
+
# ref_block_num: integer,
|
26
|
+
# ref_block_prefix: integer,
|
27
|
+
# expiration: datetime,
|
28
|
+
# type: varchar
|
29
|
+
# )
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class AccountCreate < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxAccountCreates
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::AccountCreate(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# fee: money,
|
17
|
+
# delegation: money,
|
18
|
+
# creator: varchar,
|
19
|
+
# new_account_name: varchar,
|
20
|
+
# owner_key: varchar,
|
21
|
+
# active_key: varchar,
|
22
|
+
# posting_key: varchar,
|
23
|
+
# memo_key: varchar_max,
|
24
|
+
# json_metadata: varchar_max,
|
25
|
+
# timestamp: datetime
|
26
|
+
# )
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class AccountRecover < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxAccountRecovers
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::AccountRecover(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# recovery_account: varchar,
|
17
|
+
# account_to_recover: varchar,
|
18
|
+
# recovered: boolean,
|
19
|
+
# timestamp: datetime
|
20
|
+
# )
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class AccountUpdate < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxAccountUpdates
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::AccountUpdate(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# account: varchar,
|
17
|
+
# key_auth1: varchar,
|
18
|
+
# key_auth2: varchar,
|
19
|
+
# memo_key: varchar_max,
|
20
|
+
# json_metadata: varchar_max,
|
21
|
+
# timestamp: datetime
|
22
|
+
# )
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class AccountWitnessProxy < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxAccountWitnessProxies
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::AccountWitnessProxy(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# account: varchar,
|
17
|
+
# Proxy: varchar,
|
18
|
+
# timestamp: datetime
|
19
|
+
# )
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class AccountWitnessVote < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxAccountWitnessVotes
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::AccountWitnessVote(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# account: varchar,
|
17
|
+
# witness: varchar,
|
18
|
+
# approve: boolean,
|
19
|
+
# timestamp: datetime
|
20
|
+
# )
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GolosCloud
|
2
|
+
module Tx
|
3
|
+
class ClaimRewardBalance < GolosCloud::SqlBase
|
4
|
+
|
5
|
+
self.table_name = :TxClaimRewardBalances
|
6
|
+
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# Structure
|
12
|
+
#
|
13
|
+
# GolosCloud::Tx::ClaimRewardBalance(
|
14
|
+
# ID: integer,
|
15
|
+
# tx_id: integer,
|
16
|
+
# account: varchar,
|
17
|
+
# reward_steem: money,
|
18
|
+
# reward_sbd: money,
|
19
|
+
# reward_vests: money,
|
20
|
+
# timestamp: datetime
|
21
|
+
# )
|