glueby 0.4.0 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,18 @@
1
- namespace :glueby do
2
- namespace :fee_provider do
3
- desc 'Manage the UTXO pool in Glueby::FeeProvider. Creates outputs for paying fee if the outputs is less than configured pool size by :utxo_pool_size'
4
- task :manage_utxo_pool, [] => [:environment] do |_, _|
5
- Glueby::FeeProvider::Tasks.new.manage_utxo_pool
6
- end
7
-
8
- desc 'Show the status of the UTXO pool in Glueby::FeeProvider'
9
- task :status, [] => [:environment] do |_, _|
10
- Glueby::FeeProvider::Tasks.new.status
11
- end
12
- end
13
- end
1
+ namespace :glueby do
2
+ namespace :fee_provider do
3
+ desc 'Manage the UTXO pool in Glueby::FeeProvider. Creates outputs for paying fee if the outputs is less than configured pool size by :utxo_pool_size'
4
+ task :manage_utxo_pool, [] => [:environment] do |_, _|
5
+ Glueby::FeeProvider::Tasks.new.manage_utxo_pool
6
+ end
7
+
8
+ desc 'Show the status of the UTXO pool in Glueby::FeeProvider'
9
+ task :status, [] => [:environment] do |_, _|
10
+ Glueby::FeeProvider::Tasks.new.status
11
+ end
12
+
13
+ desc 'Show the address of the Glueby::FeeProvider'
14
+ task :address, [] => [:environment] do |_, _|
15
+ Glueby::FeeProvider::Tasks.new.address
16
+ end
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glueby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - azuchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tapyrus
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
33
+ version: 6.1.3
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 6.1.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 6.1.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 6.1.3
55
69
  description: A Ruby library of smart contracts that can be used on Tapyrus.
56
70
  email:
57
71
  - azuchi@chaintope.com
@@ -87,6 +101,7 @@ files:
87
101
  - lib/glueby.rb
88
102
  - lib/glueby/active_record.rb
89
103
  - lib/glueby/active_record/system_information.rb
104
+ - lib/glueby/block_syncer.rb
90
105
  - lib/glueby/configuration.rb
91
106
  - lib/glueby/contract.rb
92
107
  - lib/glueby/contract/active_record.rb
@@ -96,6 +111,7 @@ files:
96
111
  - lib/glueby/contract/fee_estimator.rb
97
112
  - lib/glueby/contract/payment.rb
98
113
  - lib/glueby/contract/timestamp.rb
114
+ - lib/glueby/contract/timestamp/syncer.rb
99
115
  - lib/glueby/contract/token.rb
100
116
  - lib/glueby/contract/tx_builder.rb
101
117
  - lib/glueby/fee_provider.rb
@@ -111,14 +127,15 @@ files:
111
127
  - lib/glueby/internal/wallet/active_record/utxo.rb
112
128
  - lib/glueby/internal/wallet/active_record/wallet.rb
113
129
  - lib/glueby/internal/wallet/active_record_wallet_adapter.rb
130
+ - lib/glueby/internal/wallet/active_record_wallet_adapter/syncer.rb
114
131
  - lib/glueby/internal/wallet/errors.rb
115
132
  - lib/glueby/internal/wallet/tapyrus_core_wallet_adapter.rb
133
+ - lib/glueby/railtie.rb
116
134
  - lib/glueby/version.rb
117
135
  - lib/glueby/wallet.rb
136
+ - lib/tasks/glueby/block_syncer.rake
118
137
  - lib/tasks/glueby/contract.rake
119
- - lib/tasks/glueby/contract/block_syncer.rake
120
138
  - lib/tasks/glueby/contract/timestamp.rake
121
- - lib/tasks/glueby/contract/wallet_adapter.rake
122
139
  - lib/tasks/glueby/fee_provider.rake
123
140
  homepage: https://github.com/chaintope/glueby
124
141
  licenses:
@@ -1,36 +0,0 @@
1
- module Glueby
2
- module Contract
3
- module Task
4
- module BlockSyncer
5
-
6
- def sync_block
7
- latest_block_num = Glueby::Internal::RPC.client.getblockcount
8
- synced_block = Glueby::AR::SystemInformation.synced_block_height
9
- (synced_block.int_value + 1..latest_block_num).each do |i|
10
- ::ActiveRecord::Base.transaction do
11
- block_hash = Glueby::Internal::RPC.client.getblockhash(i)
12
- import_block(block_hash)
13
- synced_block.update(info_value: i.to_s)
14
- puts "success in synchronization (block height=#{i.to_s})"
15
- end
16
- end
17
- end
18
-
19
- end
20
- end
21
- end
22
- end
23
-
24
- namespace :glueby do
25
- namespace :contract do
26
- namespace :block_syncer do
27
- include Glueby::Contract::Task::BlockSyncer
28
-
29
- desc 'sync block into database'
30
- task :start, [] => [:environment] do |_, _|
31
- Glueby::Contract::Task::BlockSyncer.sync_block
32
- end
33
-
34
- end
35
- end
36
- end
@@ -1,42 +0,0 @@
1
- module Glueby
2
- module Contract
3
- module Task
4
- module WalletAdapter
5
- def import_block(block_hash)
6
- block = Glueby::Internal::RPC.client.getblock(block_hash, 0)
7
- block = Tapyrus::Block.parse_from_payload(block.htb)
8
- block.transactions.each { |tx| import_tx(tx.txid) }
9
- end
10
-
11
- def import_tx(txid)
12
- tx = Glueby::Internal::RPC.client.getrawtransaction(txid)
13
- tx = Tapyrus::Tx.parse_from_payload(tx.htb)
14
- Glueby::Internal::Wallet::AR::Utxo.destroy_for_inputs(tx)
15
- Glueby::Internal::Wallet::AR::Utxo.create_or_update_for_outputs(tx)
16
- end
17
- end
18
- end
19
- end
20
- end
21
-
22
- namespace :glueby do
23
- namespace :contract do
24
- namespace :wallet_adapter do
25
- include Glueby::Contract::Task::WalletAdapter
26
-
27
- desc 'import block into database'
28
- task :import_block, [:block_hash] => [:environment] do |_, args|
29
- block_hash = args[:block_hash]
30
-
31
- ::ActiveRecord::Base.transaction { import_block(block_hash) }
32
- end
33
-
34
- desc 'import transaction into database'
35
- task :import_tx, [:txid] => [:environment] do |_, args|
36
- txid = args[:txid]
37
-
38
- ::ActiveRecord::Base.transaction { import_tx(txid) }
39
- end
40
- end
41
- end
42
- end