cns 0.5.0 → 0.5.1
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 +4 -4
- data/Gemfile.lock +26 -25
- data/lib/cns/bigquery.rb +62 -1
- data/lib/cns/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 1bbdeb4f8ed224cedf745bd468a3715b9a6e3c1a36c3e5b1455007fa0a27869d
         | 
| 4 | 
            +
              data.tar.gz: fbdbb4951a8e991f0e2441fd0c9ff4a2e12b5c4d33021cfeb55a69d01cb27596
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2f001b52232d28c45fb4b148fece442bfc8cd4b8f2584861bbb47eac3cfc08da57aaf4bb455748e1224934f9f0f7a51acdb2688a9092cbe03138298a05fa75ff
         | 
| 7 | 
            +
              data.tar.gz: bddaf7047232a466aa8cb93593a1af4132cb6917a8703cc6f7c93d37a2d45cdf4fb37b2e162c302e11537c3e73df145feda172dc24d3f71e5a93049af81f6a75
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                cns (0.5. | 
| 4 | 
            +
                cns (0.5.1)
         | 
| 5 5 | 
             
                  curb
         | 
| 6 6 | 
             
                  faraday
         | 
| 7 7 | 
             
                  google-cloud-bigquery
         | 
| @@ -16,39 +16,38 @@ GEM | |
| 16 16 | 
             
                backport (1.2.0)
         | 
| 17 17 | 
             
                base64 (0.2.0)
         | 
| 18 18 | 
             
                benchmark (0.3.0)
         | 
| 19 | 
            -
                concurrent-ruby (1.2. | 
| 19 | 
            +
                concurrent-ruby (1.2.3)
         | 
| 20 20 | 
             
                curb (1.0.5)
         | 
| 21 21 | 
             
                declarative (0.0.20)
         | 
| 22 22 | 
             
                e2mmap (0.1.0)
         | 
| 23 | 
            -
                faraday (2. | 
| 24 | 
            -
                   | 
| 25 | 
            -
             | 
| 26 | 
            -
                   | 
| 27 | 
            -
                 | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                google-apis-core (0.11.2)
         | 
| 23 | 
            +
                faraday (2.9.0)
         | 
| 24 | 
            +
                  faraday-net_http (>= 2.0, < 3.2)
         | 
| 25 | 
            +
                faraday-net_http (3.1.0)
         | 
| 26 | 
            +
                  net-http
         | 
| 27 | 
            +
                google-apis-bigquery_v2 (0.65.0)
         | 
| 28 | 
            +
                  google-apis-core (>= 0.14.0, < 2.a)
         | 
| 29 | 
            +
                google-apis-core (0.14.0)
         | 
| 31 30 | 
             
                  addressable (~> 2.5, >= 2.5.1)
         | 
| 32 | 
            -
                  googleauth ( | 
| 31 | 
            +
                  googleauth (~> 1.9)
         | 
| 33 32 | 
             
                  httpclient (>= 2.8.1, < 3.a)
         | 
| 34 33 | 
             
                  mini_mime (~> 1.0)
         | 
| 35 34 | 
             
                  representable (~> 3.0)
         | 
| 36 35 | 
             
                  retriable (>= 2.0, < 4.a)
         | 
| 37 36 | 
             
                  rexml
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                google-cloud-bigquery (1.45.0)
         | 
| 37 | 
            +
                google-cloud-bigquery (1.48.1)
         | 
| 40 38 | 
             
                  concurrent-ruby (~> 1.0)
         | 
| 41 | 
            -
                  google-apis-bigquery_v2 (~> 0. | 
| 39 | 
            +
                  google-apis-bigquery_v2 (~> 0.62)
         | 
| 40 | 
            +
                  google-apis-core (~> 0.13)
         | 
| 42 41 | 
             
                  google-cloud-core (~> 1.6)
         | 
| 43 | 
            -
                  googleauth ( | 
| 42 | 
            +
                  googleauth (~> 1.9)
         | 
| 44 43 | 
             
                  mini_mime (~> 1.0)
         | 
| 45 44 | 
             
                google-cloud-core (1.6.1)
         | 
| 46 45 | 
             
                  google-cloud-env (>= 1.0, < 3.a)
         | 
| 47 46 | 
             
                  google-cloud-errors (~> 1.0)
         | 
| 48 | 
            -
                google-cloud-env (2.1. | 
| 47 | 
            +
                google-cloud-env (2.1.1)
         | 
| 49 48 | 
             
                  faraday (>= 1.0, < 3.a)
         | 
| 50 49 | 
             
                google-cloud-errors (1.3.1)
         | 
| 51 | 
            -
                googleauth (1. | 
| 50 | 
            +
                googleauth (1.11.0)
         | 
| 52 51 | 
             
                  faraday (>= 1.0, < 3.a)
         | 
| 53 52 | 
             
                  google-cloud-env (~> 2.1)
         | 
| 54 53 | 
             
                  jwt (>= 1.4, < 3.0)
         | 
| @@ -57,7 +56,8 @@ GEM | |
| 57 56 | 
             
                  signet (>= 0.16, < 2.a)
         | 
| 58 57 | 
             
                httpclient (2.8.3)
         | 
| 59 58 | 
             
                jaro_winkler (1.5.6)
         | 
| 60 | 
            -
                jwt (2. | 
| 59 | 
            +
                jwt (2.8.1)
         | 
| 60 | 
            +
                  base64
         | 
| 61 61 | 
             
                kramdown (2.4.0)
         | 
| 62 62 | 
             
                  rexml
         | 
| 63 63 | 
             
                kramdown-parser-gfm (1.1.0)
         | 
| @@ -65,7 +65,9 @@ GEM | |
| 65 65 | 
             
                kwalify (0.7.2)
         | 
| 66 66 | 
             
                mini_mime (1.1.5)
         | 
| 67 67 | 
             
                multi_json (1.15.0)
         | 
| 68 | 
            -
                 | 
| 68 | 
            +
                net-http (0.4.1)
         | 
| 69 | 
            +
                  uri
         | 
| 70 | 
            +
                nokogiri (1.16.2-x86_64-linux)
         | 
| 69 71 | 
             
                  racc (~> 1.4)
         | 
| 70 72 | 
             
                os (1.1.4)
         | 
| 71 73 | 
             
                parallel (1.24.0)
         | 
| @@ -81,7 +83,7 @@ GEM | |
| 81 83 | 
             
                  parser (>= 2.5.0.0, < 2.8, != 2.5.1.1)
         | 
| 82 84 | 
             
                  psych (~> 3.1)
         | 
| 83 85 | 
             
                  rainbow (>= 2.0, < 4.0)
         | 
| 84 | 
            -
                regexp_parser (2. | 
| 86 | 
            +
                regexp_parser (2.9.0)
         | 
| 85 87 | 
             
                representable (3.2.0)
         | 
| 86 88 | 
             
                  declarative (< 0.1.0)
         | 
| 87 89 | 
             
                  trailblazer-option (>= 0.1.1, < 0.2.0)
         | 
| @@ -107,8 +109,7 @@ GEM | |
| 107 109 | 
             
                  parser (~> 2.2)
         | 
| 108 110 | 
             
                  slop (~> 3.4, >= 3.4.7)
         | 
| 109 111 | 
             
                ruby-progressbar (1.13.0)
         | 
| 110 | 
            -
                 | 
| 111 | 
            -
                signet (0.18.0)
         | 
| 112 | 
            +
                signet (0.19.0)
         | 
| 112 113 | 
             
                  addressable (~> 2.8)
         | 
| 113 114 | 
             
                  faraday (>= 0.17.5, < 3.a)
         | 
| 114 115 | 
             
                  jwt (>= 1.5, < 3.0)
         | 
| @@ -128,13 +129,13 @@ GEM | |
| 128 129 | 
             
                  thor (~> 1.0)
         | 
| 129 130 | 
             
                  tilt (~> 2.0)
         | 
| 130 131 | 
             
                  yard (~> 0.9, >= 0.9.24)
         | 
| 131 | 
            -
                thor (1.3. | 
| 132 | 
            +
                thor (1.3.1)
         | 
| 132 133 | 
             
                tilt (2.3.0)
         | 
| 133 134 | 
             
                trailblazer-option (0.1.2)
         | 
| 134 135 | 
             
                uber (0.1.0)
         | 
| 135 136 | 
             
                unicode-display_width (1.8.0)
         | 
| 136 | 
            -
                 | 
| 137 | 
            -
                yard (0.9. | 
| 137 | 
            +
                uri (0.13.0)
         | 
| 138 | 
            +
                yard (0.9.36)
         | 
| 138 139 |  | 
| 139 140 | 
             
            PLATFORMS
         | 
| 140 141 | 
             
              x86_64-linux
         | 
    
        data/lib/cns/bigquery.rb
    CHANGED
    
    | @@ -70,7 +70,7 @@ module Cns | |
| 70 70 |  | 
| 71 71 | 
             
                # insere (caso existam) dados novos etherscan no bigquery (output to file)
         | 
| 72 72 | 
             
                def processa_ceth
         | 
| 73 | 
            -
                  File.open(FO, mode: 'a') { |out| out.puts(Time.now.strftime("TRANSACOES  %Y-%m-%d %H:%M ") +  | 
| 73 | 
            +
                  File.open(FO, mode: 'a') { |out| out.puts(Time.now.strftime("TRANSACOES  %Y-%m-%d %H:%M ") + processa_ethc) }
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| 76 76 | 
             
                private
         | 
| @@ -88,6 +88,19 @@ module Cns | |
| 88 88 | 
             
                  str
         | 
| 89 89 | 
             
                end
         | 
| 90 90 |  | 
| 91 | 
            +
                # insere transacoes blockchain novas nas tabelas etht (norml), ethi (internas), ethp (block), ethw (withdrawals), ethk (token)
         | 
| 92 | 
            +
                #
         | 
| 93 | 
            +
                # @return [String] linhas & tabelas afetadas
         | 
| 94 | 
            +
                def processa_ethc
         | 
| 95 | 
            +
                  str = "ETH"
         | 
| 96 | 
            +
                  str += format(" %<n>i etht", n: dml(ethtc_ins)) if apiesc.novtx.count > 0
         | 
| 97 | 
            +
                  str += format(" %<n>i ethi", n: dml(ethic_ins)) if apiesc.novix.count > 0
         | 
| 98 | 
            +
                  str += format(" %<n>i ethp", n: dml(ethpc_ins)) if apiesc.novpx.count > 0
         | 
| 99 | 
            +
                  str += format(" %<n>i ethw", n: dml(ethwc_ins)) if apiesc.novwx.count > 0
         | 
| 100 | 
            +
                  str += format(" %<n>i ethk", n: dml(ethkc_ins)) if apiesc.novkx.count > 0
         | 
| 101 | 
            +
                  str
         | 
| 102 | 
            +
                end
         | 
| 103 | 
            +
             | 
| 91 104 | 
             
                # insere transacoes exchange kraken novas nas tabelas ust (trades), usl (ledger)
         | 
| 92 105 | 
             
                #
         | 
| 93 106 | 
             
                # @return [String] linhas & tabelas afetadas
         | 
| @@ -185,6 +198,21 @@ module Cns | |
| 185 198 | 
             
                  )
         | 
| 186 199 | 
             
                end
         | 
| 187 200 |  | 
| 201 | 
            +
                # @return [Etherscan] API blockchain ETH
         | 
| 202 | 
            +
                def apiesc
         | 
| 203 | 
            +
                  @apies ||= Etherscan.new(
         | 
| 204 | 
            +
                    {
         | 
| 205 | 
            +
                      wb: sql("select * from #{BD}.walletEthc order by 2"),
         | 
| 206 | 
            +
                      nt: sql("select itx,iax from #{BD}.ethtxc"),
         | 
| 207 | 
            +
                      ni: sql("select itx,iax from #{BD}.ethixc"),
         | 
| 208 | 
            +
                      np: sql("select itx,iax from #{BD}.ethpxc"),
         | 
| 209 | 
            +
                      nw: sql("select itx,iax from #{BD}.ethwxc"),
         | 
| 210 | 
            +
                      nk: sql("select itx,iax from #{BD}.ethkxc")
         | 
| 211 | 
            +
                    },
         | 
| 212 | 
            +
                    ops
         | 
| 213 | 
            +
                  )
         | 
| 214 | 
            +
                end
         | 
| 215 | 
            +
             | 
| 188 216 | 
             
                # @return [Greymass] API blockchain EOS
         | 
| 189 217 | 
             
                def apigm
         | 
| 190 218 | 
             
                  @apigm ||= Greymass.new(
         | 
| @@ -286,6 +314,39 @@ module Cns | |
| 286 314 | 
             
                  ") VALUES#{apies.novkx.map { |obj| ethk_1val(obj) }.join(',')}"
         | 
| 287 315 | 
             
                end
         | 
| 288 316 |  | 
| 317 | 
            +
                # @return [String] comando insert SQL formatado etht (norml)
         | 
| 318 | 
            +
                def ethtc_ins
         | 
| 319 | 
            +
                  "insert #{BD}.etht(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,iax," \
         | 
| 320 | 
            +
                  'value,gas,gasprice,gasused,iserror,txreceipt_status,input,contractaddress,dias' \
         | 
| 321 | 
            +
                  ") VALUES#{apiesc.novtx.map { |obj| etht_1val(obj) }.join(',')}"
         | 
| 322 | 
            +
                end
         | 
| 323 | 
            +
             | 
| 324 | 
            +
                # @return [String] comando insert SQL formatado ethi (internas)
         | 
| 325 | 
            +
                def ethic_ins
         | 
| 326 | 
            +
                  "insert #{BD}.ethi(blocknumber,timestamp,txhash,axfrom,axto,iax," \
         | 
| 327 | 
            +
                  'value,contractaddress,input,type,gas,gasused,traceid,iserror,errcode' \
         | 
| 328 | 
            +
                  ") VALUES#{apiesc.novix.map { |obj| ethi_1val(obj) }.join(',')}"
         | 
| 329 | 
            +
                end
         | 
| 330 | 
            +
             | 
| 331 | 
            +
                # @return [String] comando insert SQL formatado ethp (block)
         | 
| 332 | 
            +
                def ethpc_ins
         | 
| 333 | 
            +
                  "insert #{BD}.ethp(blocknumber,timestamp,blockreward,iax" \
         | 
| 334 | 
            +
                  ") VALUES#{apiesc.novpx.map { |obj| ethp_1val(obj) }.join(',')}"
         | 
| 335 | 
            +
                end
         | 
| 336 | 
            +
             | 
| 337 | 
            +
                # @return [String] comando insert SQL formatado ethw (withdrawals)
         | 
| 338 | 
            +
                def ethwc_ins
         | 
| 339 | 
            +
                  "insert #{BD}.ethw(withdrawalindex,validatorindex,address,amount,blocknumber,timestamp" \
         | 
| 340 | 
            +
                  ") VALUES#{apiesc.novwx.map { |obj| ethw_1val(obj) }.join(',')}"
         | 
| 341 | 
            +
                end
         | 
| 342 | 
            +
             | 
| 343 | 
            +
                # @return [String] comando insert SQL formatado ethk (token)
         | 
| 344 | 
            +
                def ethkc_ins
         | 
| 345 | 
            +
                  "insert #{BD}.ethk(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,iax," \
         | 
| 346 | 
            +
                  'value,tokenname,tokensymbol,tokendecimal,gas,gasprice,gasused,input,contractaddress,dias' \
         | 
| 347 | 
            +
                  ") VALUES#{apiesc.novkx.map { |obj| ethk_1val(obj) }.join(',')}"
         | 
| 348 | 
            +
                end
         | 
| 349 | 
            +
             | 
| 289 350 | 
             
                # @return [String] comando insert SQL formatado eos
         | 
| 290 351 | 
             
                def eost_ins
         | 
| 291 352 | 
             
                  "insert #{BD}.eos(gseq,aseq,bnum,time,contract,action,acfrom,acto,iax,amount,moeda,memo,dias" \
         | 
    
        data/lib/cns/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cns
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.5. | 
| 4 | 
            +
              version: 0.5.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Hernâni Rodrigues Vaz
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-03-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |