Is it possible to use cloud code to transfer ERC20 tokens

Hi guys,

Can you please tell me how I might call the Moralis.transfer() method using cloud code?
Are all the SDK methods available in cloud code?

// sending 0.5 tokens with 18 decimals
const options = {type: "erc20", 
                 amount: Moralis.Units.Token("0.5", "18"), 
                 receiver: "0x..",
                 contractAddress: "0x.."}
let result = await Moralis.transfer(options)

you can not use that method from a cloud function, mainly because you don’t have access to a wallet in a cloud function, you could still do a transfer in a cloud function, but you’ll have to write your own code and to hardcode a private key

1 Like