Hi,
Iām checking this NFT smart contract (Iām checking another one but letās use this one in my example)
Fat Ape Club: https://etherscan.io/token/0xf3114dd5c5b50a573e66596563d15a630ed359b4
Iād like to filter only the transactions where a specific Method was called, in particular the Mint one.
E.g. of the address above, click on āLastā to see the oldest transactions, you will notice that the method called in the first 105 transactions is called Gift.
Browse 3-4 pages until you see the first Mint, see:
Iād like to make a list of a given NFT smart contract and fetch only the transactions where a particular method was called, which in my case is āMintā. See example of such a transaction here:
https://etherscan.io/tx/0xe618e473d4452f083adde2ee7d0f07e30f360b3f250b3b63ada5f78aca031505
In Moralis I do a simple call:
const options = { chain: "eth", address: "0xf3114dd5c5b50a573e66596563d15a630ed359b4", order: "asc", from_block: 13522802 }
const transactions = await Moralis.Web3API.account.getTransactions(options)
if (transactions.result) {
for (const trx of transactions.result) {
console.log(trx)
}
console.log(transactions.result.length)
}
Example of trx printed to console:
{
hash: '0x67c9841dc8136e974cde1147736289499e79d9a12ff23d70ff917cde8604c741',
nonce: '11',
transaction_index: '137',
from_address: '0x54523e45e76ffe5e6ef2a5a7eb03912a5a43f4f1',
to_address: '0xf3114dd5c5b50a573e66596563d15a630ed359b4',
value: '100000000000000000',
gas: '283645',
gas_price: '120441470503',
input: '0xa0712d680000000000000000000000000000000000000000000000000000000000000001',
receipt_cumulative_gas_used: '9459270',
receipt_gas_used: '189097',
receipt_contract_address: null,
receipt_root: null,
receipt_status: '1',
block_timestamp: '2021-10-31T20:29:12.000Z',
block_number: '13526915',
block_hash: '0x28297295346bfa646085505a20fcb65f66c02e2439a5f6554b4ae554b976fd49',
addresses: {
from_to: [
'0x54523e45e76ffe5e6ef2a5a7eb03912a5a43f4f1',
'0xf3114dd5c5b50a573e66596563d15a630ed359b4'
]
}
}
Then I loop the transactions and print them to console, only to see that they contain really basic information, not even the method calledā¦
2 questions:
- how to fetch additional info in the transaction, such in this case the method called? Do I need to fetch it 1 by 1 for each transaction already in the response?
- do you think this use case deserves to be added to the moralis API? (of course I think it does, I canāt imagine to make 10k+ requests to the moralis server only to understand what kind of transaction each transaction isā¦ this should be info returned in the listā¦ can you make this happen?)