Trigger Cloud Function

Hi Everyone,
I want to achieve an automatic trigger inside the Cloud function whenever Moralis.transfer(options) is called. I want to pass some custom values with options. And get the result from the transfer function call inside the Cloud trigger automatically. Can this be done? Because I am creating another table data after the transfer function, so to be on the secure side want to perform execution just after the transfer is successful inside the serverside automatically.

1 Like

Hey @mauriya

You can for example make trigger afterSave for tables xTransactions.

Hi @Yomoo,
I am getting
Error: {“message”:“Moralis.Web3API.native.getTransaction is not a function”,“code”:141}

Moralis.Cloud.afterSave("BscTransactions", async(request) => {
  const logger = Moralis.Cloud.getLogger();
  const hash = request.object.get('hash');
  const options = {  chain: "bsc testnet",  transaction_hash: hash};
  const transaction = await Moralis.Web3API.native.getTransaction(options);
  logger.info(transaction);
})

What I am trying to do is get the value of the transaction.

@mauriya, until we will make that getTransaction available in Moralis SDK, you can use a HTTP request like in this post: Is it possible to get contents of block using a transaction hash?

Thank you @cryptokid It certainly helps.