I’m trying to subscribe to transactions where a user is involved so I can create triggers on my platform, but when I try to sub, moralis is asking for my master key, which should be a secret.
This code is running in our front-end, and not as a cloud function, I was unable to return a subscription from a cloud function (and i think it isn’t possible)
const query = new (await getMoralis()).Query('EthTransactions')
await query.aggregate([
// only transactions to or from userAddress
{
match: {
$expr: {
$or: [
{ $eq: ['$from_address', address] },
{ $eq: ['$to_address', address] },
],
},
},
},
])
const subscription = await query.subscribe()
subscription.on('create', function(data) {
console.log(data)
})