0.0.9-alpha • Published 2 years ago

valo-log-finder v0.0.9-alpha

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

valo-log-finder

Valo standard ruleset for well known log patterns

Example codes

import {
  createActionRuleSet,
  createAmountRuleSet
  createLogMatcherForActions,
  createLogMatcherForAmounts,
  getTxCanonicalMsgs,
  getTxAmounts
} from "valo-log-finder"

const tx = {
  "height": ...,
  "txhash": ...,
  "raw_log": ...,
  "logs": ...,
  "gas_wanted": ...,
  "gas_used": ...,
  "tx": ...,
  "timestamp": ...,
}
const address = "nova1..." //TODO: Fix

// getTxCanonicalMsgs
const actionRuleset = createActionRuleSet()
const actionLogMatcher = createLogMatcherForActions(actionRuleset)
const actionMatchedMsg = getTxCanonicalMsgs(tx, actionLogMatcher)

console.log(actionMatchedMsg)


// getTxAmountInfo
const amountRuleset = createAmountRuleSet()
const amountLogMatcher = createLogMatcherForAmounts(amountRuleset)
const amountMatchedMsg = getTxAmounts(tx, amountLogMatcher, address)

console.log(amountMatchedMsg)