Environment
I'm using Defender SDK to create an action.
Details
When my action get triggered it should get some data from chain (all of this works) and than send a transaction (call a contract method) with ethers, but it crash with error 'network does not support ENS'. Actually I'm creating this action with a relayer on arbitrum-sepolia testnet, but i tried with another contract on arbitrum testnet and i don't get this error.
How can i test my action in testnet?
(I'm using typescript and local testing for developing)
Code to reproduce
export async function handler(event: any, context: any) {
const provider = new DefenderRelayProvider(event);
const signer = new DefenderRelaySigner(event, provider, (await provider.getSigner()).address, { speed: 'fast' });
// const signer = await provider.getSigner();
const registryABI: Interface = JSON.parse(fs.readFileSync(`${__dirname}/Registry.json`, 'utf-8'));
const IEpochControlsABI: Interface = JSON.parse(fs.readFileSync(`${__dirname}/IEpochControls.json`, 'utf-8'));
const ERC20ABI: Interface = JSON.parse(fs.readFileSync(`${__dirname}/ERC20.json`, 'utf-8'));
const actionNotificationChannel = process.env.NOTIFICATION_CHANNEL_ALIAS;
// const { notificationClient } = context;
const registry = new ethers.Contract(process.env.REGISTRY_ADDRESS, registryABI, signer);
const unrolledDVPs = await registry.getUnrolledDVPs();
console.log(unrolledDVPs);
const startTimestamp = Date.now();
console.log(unrolledDVPs[0]);
for (let dvpAddress of unrolledDVPs[0]) {
let dvp = new ethers.Contract(dvpAddress, IEpochControlsABI, signer);
let baseTokenAddress = await dvp.baseToken();
let sideTokenAddress = await dvp.sideToken();
let baseToken = new ethers.Contract(baseTokenAddress, ERC20ABI, signer);
let baseTokenSymbol = await baseToken.symbol();
console.log(baseTokenSymbol);
let sideToken = new ethers.Contract(sideTokenAddress, ERC20ABI, signer);
let sideTokenSymbol = await sideToken.symbol();
console.log(sideTokenSymbol);
// THIS IS THE FUNCTION THAT CRASH
dvp.rollEpoch()
.then(() => {
// sendNotification(...);
})
.catch(error => {
throw error;
});
}
}
async function sendNotification(notificationClient: any, channelAlias: string, subject: string, message: string) {
try {
notificationClient.send({
channelAlias: channelAlias,
subject: subject,
message: message,
});
} catch (error) {
console.error('Failed to send notification', error);
}
}
// To run locally (this code will not be executed in actions)
if (require.main === module) {
dotenv.config();
const { RELAYER_API_KEY: apiKey, RELAYER_API_SECRET: apiSecret, NETWORK: network } = process.env;
exports
.handler({ apiKey, apiSecret, network })
.then(() => process.exit(0))
.catch((error: any) => {
console.error(error);
process.exit(1);
});
}