lib/cns/etherscan1.rb in cns-0.2.2 vs lib/cns/etherscan1.rb in cns-0.2.3
- old
+ new
@@ -66,11 +66,11 @@
# @example (see Apibc#account_es)
# @param [Hash] abc account etherscan
# @return [Hash] dados etherscan - address, saldo & transacoes
def base_bc(abc)
- acc = abc[:account]
+ acc = abc[:account].downcase
{
ax: acc,
sl: (abc[:balance].to_d / 10**18).round(10),
tx: filtrar_tx(acc, api.norml_es(acc)),
kx: filtrar_tx(acc, api.token_es(acc))
@@ -97,10 +97,10 @@
# @param [Array<Hash>] ary lista transacoes/token events
# @return [Array<Hash>] lista transacoes/token events filtrada
def filtrar_tx(add, ary)
# elimina transferencia from: (lax) to: (add) - esta transferencia aparece em from: (add) to: (lax)
# elimina chaves irrelevantes (DL) & adiciona chave indice itx & adiciona identificador da carteira iax
- ary.delete_if { |odl| odl[:to] == add && lax.include?(odl[:from]) }
+ ary.delete_if { |odl| add.casecmp?(odl[:to]) && lax.include?(odl[:from].downcase) }
.map { |omp| omp.delete_if { |key, _| DL.include?(key) }.merge(itx: Integer(omp[:blockNumber]), iax: add) }
end
# @return [Array<Hash>] lista ordenada transacoes normais novas
def sortx