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

- old
+ new

@@ -40,10 +40,15 @@ # @return [Array<Hash>] lista transacoes block novas def novpx @novpx ||= bcd.map { |obc| obc[:px].select { |obj| idp.include?(obj[:itx]) } }.flatten end + # @return [Array<Hash>] lista transacoes withdrawals novas + def novwx + @novwx ||= bcd.map { |obc| obc[:wx].select { |obj| idw.include?(obj[:itx]) } }.flatten + end + # @return [Array<Hash>] lista transacoes token novas def novkx @novkx ||= bcd.map { |obc| obc[:kx].select { |obj| idk.include?(obj[:itx]) } }.flatten end @@ -78,10 +83,16 @@ def idp @idp ||= bcd.map { |obc| obc[:px].map { |obj| obj[:itx] } }.flatten - (ops[:t] ? [] : bqd[:np].map { |obq| obq[:itx] }) end + # @return [Array<Integer>] lista indices transacoes withdrawals novas + def idw + @idw ||= bcd.map { |obc| obc[:wx].map { |obj| obj[:itx] } }.flatten - + (ops[:t] ? [] : bqd[:nw].map { |obq| obq[:itx] }) + end + # @return [Array<Integer>] lista indices transacoes token novas def idk @idk ||= bcd.map { |obc| obc[:kx].map { |obj| obj[:itx] } }.flatten - (ops[:t] ? [] : bqd[:nk].map { |obq| obq[:itx] }) end @@ -95,10 +106,11 @@ ax: acc, sl: (abc[:balance].to_d / 10**18), tx: filtrar_tx(acc, api.norml_es(acc)), ix: filtrar_tx(acc, api.inter_es(acc)), px: filtrar_px(acc, api.block_es(acc)), + wx: filtrar_px(acc, api.withw_es(acc)), kx: filtrar_tx(acc, api.token_es(acc)) } end # @param [Hash] wbq wallet bigquery @@ -110,15 +122,17 @@ ax: xbq = wbq[:ax], bs: wbq[:sl], bt: bqd[:nt].select { |ont| ont[:iax] == xbq }, bi: bqd[:ni].select { |oni| oni[:iax] == xbq }, bp: bqd[:np].select { |onp| onp[:iax] == xbq }, + bw: bqd[:nw].select { |onw| onw[:iax] == xbq }, bk: bqd[:nk].select { |onk| onk[:iax] == xbq }, es: hbc[:sl], et: hbc[:tx], ei: hbc[:ix], ep: hbc[:px], + ew: hbc[:wx], ek: hbc[:kx] } end # @param add (see Apibc#norml_es) @@ -150,9 +164,14 @@ end # @return [Array<Hash>] lista ordenada transacoes block novas def sorpx novpx.sort { |ant, prx| ant[:itx] <=> prx[:itx] } + end + + # @return [Array<Hash>] lista ordenada transacoes withdrawals novas + def sorwx + novwx.sort { |ant, prx| ant[:itx] <=> prx[:itx] } end # @return [Array<Hash>] lista ordenada transacoes token novas def sorkx novkx.sort { |ant, prx| ant[:itx] <=> prx[:itx] }