I am running some code with my autotask, triggered by a function call from my sentinel, i am passing some extra data in the metadata from my autotask function. and would like to display them in my notification.
Environment
Using Autotask to run a simple code that is triggered by sentinnel.
Details
After returning the metadata from my autotask, i am unable to access it with matchReasons.0.metadata
, doing that results in [failed to resolve {{ matchReasons.0.metadata }}]
Code to reproduce
const { DefenderRelaySigner, DefenderRelayProvider } = require('defender-relay-client/lib/ethers');
const ethers = require('ethers');
exports.handler = async function(event) {
const provider = new DefenderRelayProvider(event);
const signer = new DefenderRelaySigner(event, provider, { speed: 'fast' });
const matches = [];
// Use provider and signer for querying or sending txs from ethers, for example...
const ADDRESS = ""
const ABI = [
"function sayversion() pure external returns (string memory)",
"function balanceOf(address account) external view returns (uint256)",
]
const contract = new ethers.Contract(ADDRESS, ABI, signer);
console.log(await contract.sayversion());
const requestEvents = event.request.body
const events = requestEvents.events;
const balance = await contract.balanceOf(ADDRESS)
for(const evt of events) {
matches.push({
hash: evt.hash,
metadata: {
"id": "1",
"timestamp": new Date().getTime(),
"contract Balance": balance,
"nested": { "example": { "here": true } }
}
});
}
return { matches };
}
And in the custom notifications setting, doing something like this
{{ matchReasons.0.metadata }}
which results in
[failed to resolve {{ matchReasons.0.metadata }}]