Hi @here I want to get the value column of my user wallets transactions. What I am doing right now to put a lookup(join) with two tables like EthNFTTransfer lookup join with transaction_hash and EthTransaction with hash In this table providing from_address and token_address. It gives me the response where the transaction_hash and hash are not matched.
here is the code :
async function nftTransfers(){
const userAddress = '0x0e5df4277388c9e156038db9f09c390ed2730f2e';
const query = new Moralis.Query("EthNFTTransfers");
const pipeline = [
{ match: { from_address: userAddress, token_address: '0x088a4855eb27f3d6f2eb91329f68ee9a1ab38683' } },
{ lookup: {
from: "EthTransactions",
let: { hashValue: "$hash" },
pipeline: [
{$match: {$expr: { $eq: ["$transaction_hash", "$$hashValue"]}
}},
{ $project: { gas: 1, value: 1, hash: 1. ,_id :0 }},
],
as: "TokenWithPrice"
}},
{ unwind : "$TokenWithPrice" },
{limit : 10}
];
const result = await query.aggregate(pipeline);
console.log(result)
} nftTransfers();
Here is the response:
[
{
block_timestamp: { __type: 'Date', iso: '2021-11-08T19:17:00.000Z' },
log_index: 14,
contract_type: 'ERC721',
transaction_type: 'Single',
transaction_hash: '0x8de1ef297431e2a5aed0e0b806686b07b12d2e187f7d967f66ac21a8fe6b944c',
transaction_index: 16,
token_address: '0x088a4855eb27f3d6f2eb91329f68ee9a1ab38683',
block_number: 9607845,
from_address: '0x0e5df4277388c9e156038db9f09c390ed2730f2e',
to_address: '0x4774deccf75ed6768a8ebb006ee0ec075c625f70',
token_id: '0',
amount: '1',
block_hash: '0xa5a2d4219ba2f4dde19f1206840b7895172b29049632ad4ba90a8568d00a96ca',
confirmed: true,
createdAt: '2022-01-28T14:41:18.301Z',
updatedAt: '2022-01-28T14:41:18.301Z',
TokenWithPrice: {
hash: '0xe974a29f8036671d1ceb4a372d9b151f7e1ddbeafb4a7e60c4bd0ff8ab783c21',
value: '0',
gas: 51498
},
objectId: 'yXGxC1BPZevslDdCMCqmDCky'
},
Like the returned response is not matched how can i achieve this one? Is there any mistake that I am making to my code or any thing that you suggest on this, Thanks