diff --git a/packages/web3-eth-contract/src/contract.ts b/packages/web3-eth-contract/src/contract.ts index a34c4d75ddf..fed27a46c69 100644 --- a/packages/web3-eth-contract/src/contract.ts +++ b/packages/web3-eth-contract/src/contract.ts @@ -765,11 +765,15 @@ export class Contract options ?? {}, ); const logs = await getLogs(this, { fromBlock, toBlock, topics, address }, returnFormat); + // eslint-disable-next-line + console.log(logs) const decodedLogs = logs.map(log => typeof log === 'string' ? log : decodeEventABI(abi, log as LogsInput, this._jsonInterface, returnFormat), ); + // eslint-disable-next-line + console.log(decodedLogs) const filter = options?.filter ?? {}; const filterKeys = Object.keys(filter); diff --git a/packages/web3-eth/src/utils/decoding.ts b/packages/web3-eth/src/utils/decoding.ts index ca2dd9e3941..659a2040d6c 100644 --- a/packages/web3-eth/src/utils/decoding.ts +++ b/packages/web3-eth/src/utils/decoding.ts @@ -42,6 +42,8 @@ export const decodeEventABI = ( const result = format(logSchema, data, returnFormat); // eslint-disable-next-line console.log(result) + // eslint-disable-next-line + console.log(event) // if allEvents get the right event if ([ALL_EVENTS, 'allEvents'].includes(modifiedEvent.name)) { const matchedEvent = jsonInterface.find(j => j.signature === data.topics[0]); diff --git a/packages/web3-eth/test/unit/decoding.test.ts b/packages/web3-eth/test/unit/decoding.test.ts index 94627d84575..01b7449c511 100644 --- a/packages/web3-eth/test/unit/decoding.test.ts +++ b/packages/web3-eth/test/unit/decoding.test.ts @@ -34,5 +34,67 @@ describe('decoding functions', () => { }, ); }); + // describe.only('decodeEventABI test', () => { + // const inputs :LogsInput = { + + // address: '0x96944673f4314c7c6dfb719ecf86d68cce9dc393', + + // topics: [ + + // '0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31', + + // '0x000000000000000000000000af853ff16d40f011a9b153a664ac5cea2f3f1a93', + + // '0x0000000000000000000000006855e2abfb524687cb19e3cf2f33b25bf38223cc' + + // ], + + // data: '0x0000000000000000000000000000000000000000000000000000000000000000', + + // blockNumber: "229", + + // transactionHash: '0x1e53f2432335b7ae65b9b194ffc04531dbd82a400000ce11be59dd6116a110af', + + // transactionIndex: "0", + + // blockHash: '0xc543b8156a1fcbc2f7e3049903ef4f19785bf81b3ca299a4f5a10a660d93499b', + + // logIndex: "0" + + // }; + // const event = { + // anonymous: false, + // inputs: [ + // { + // indexed: true, + // internalType: 'address', + // name: 'from', + // type: 'address' + // }, + // { + // indexed: true, + // internalType: 'address', + // name: 'to', + // type: 'address' + // }, + // { + // indexed: true, + // internalType: 'uint256', + // name: 'tokenId', + // type: 'uint256' + // } + // ], + // name: 'Transfer', + // type: 'event', + // signature: '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef' + // }; + + // console.log(decodeEventABI(event, inputs, [ + // { signature: event.signature } as unknown as AbiEventFragment & { + // signature: string; + // }, + // ]) + // ) + // }); }); });