lib/cns/bigquery3.rb in cns-0.3.3 vs lib/cns/bigquery3.rb in cns-0.3.4

- old
+ new

@@ -27,10 +27,16 @@ def ethp_ins "insert #{BD}.ethp(blocknumber,timestamp,blockreward,iax" \ ") VALUES#{apies.novpx.map { |obj| ethp_1val(obj) }.join(',')}" end + # @return [String] comando insert SQL formatado ethw (withdrawals) + def ethw_ins + "insert #{BD}.ethw(withdrawalindex,validatorindex,address,amount,blocknumber,timestamp" \ + ") VALUES#{apies.novwx.map { |obj| ethw_1val(obj) }.join(',')}" + end + # @return [String] comando insert SQL formatado ethk (token) def ethk_ins "insert #{BD}.ethk(blocknumber,timestamp,txhash,nonce,blockhash,transactionindex,axfrom,axto,iax," \ 'value,tokenname,tokensymbol,tokendecimal,gas,gasprice,gasused,input,contractaddress,dias' \ ") VALUES#{apies.novkx.map { |obj| ethk_1val(obj) }.join(',')}" @@ -128,9 +134,21 @@ def ethp_1val(htx) "(#{Integer(htx[:blockNumber])}," \ "#{Integer(htx[:timeStamp])}," \ "cast('#{htx[:blockReward]}' as numeric)," \ "'#{htx[:iax]}')" + end + + # @example (see Apibc#block_es) + # @param [Hash] htx transacao withdrawals etherscan + # @return [String] valores formatados ethi (withdrawals parte1) + def ethw_1val(htx) + "(#{Integer(htx[:withdrawalIndex])}," \ + "#{Integer(htx[:validatorIndex])}," \ + "'#{htx[:address]}'," \ + "cast('#{htx[:amount]}' as numeric)," \ + "#{Integer(htx[:blockNumber])}," \ + "#{Integer(htx[:timestamp])})" end # @example (see Apibc#token_es) # @param [Hash] hkx token event etherscan # @return [String] valores formatados ethk (token parte1)