Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initSwap(app) {
super._initSwap(app)
this.app = app
this.decoder = new InputDataDecoder(this.abi)
this.contract = new this.app.env.web3.eth.Contract(this.abi, this.address)
}
export async function queryTransactionHistory(address: string) {
try {
const decoder = new abiDecoder([...ERC20, ...WETH])
const provider = getEtherscanProvider()
let txs = await provider.getHistory(address)
let parsedTxs = []
txs = txs.slice(Math.max(txs.length - 50, 0))
txs.forEach(tx => {
if (tx.data === '0x') {
parsedTxs.push({ type: 'Ether Transferred', status: 'CONFIRMED', hash: tx.hash, time: tx.timestamp * 1000 })
} else {
let decoded = decoder.decodeData(tx.data)
switch(decoded.name) {
case 'approve':
let value = decoded.inputs[1].toString()
_initSwap(app) {
super._initSwap(app)
this.app = app
this.decoder = new InputDataDecoder(this.abi)
this.contract = new this.app.env.web3.eth.Contract(this.abi, this.address)
this.ERC20 = new this.app.env.web3.eth.Contract(this.tokenAbi, this.tokenAddress)
}