Defender Release 2020W48: xDai support, json-rpc endpoint, and better address input

Hey everyone! We have released another new version to Defender at defender.openzeppelin.com. This release includes xDai support across the board, a JSON RPC endpoint you can use from your Relayer scripts and Autotasks, and a much improved address input that leverages your address book contacts!

xDai support

One of the most requested features has been support for the xDai sidechain. xDai is a proof-of-stake chain that used the stablecoin DAI as native currency, which can be transferred from mainnet via a bridge. xDai block speeds are faster than mainnet, and its transaction fees are much lower, thus providing a much better end-user experience for dapp interactions.

Since this release, you will be able to manage contracts on xDai via Admin, as well as send transactions using xDai Relayers.

Under the hood, we are relying on the dai.poa.network endpoint for communicating with the network. We’ll be adding additional providers for redundancy over time.

JSON RPC endpoint

A common issue for many users of Autotask was relying on default network providers, which rely on shared provider keys and often got throttled after repeated use. The alternative so far was to manually register for a network provider and inject the token on each Autotask.

This new Defender release ships along with a new version of the defender-relay-client, which includes a new DefenderRelayProvider object that relies on Defender as a JSON RPC endpoint. If you are using ethers.js, you can now run the following:

const { DefenderRelaySigner, DefenderRelayProvider } = require('defender-relay-client/lib/ethers');
const { ethers } = require('ethers');
 
const credentials = { apiKey: API_KEY, apiSecret: API_SECRET };
const provider = new DefenderRelayProvider(credentials);
const signer = new DefenderRelaySigner(credentials, provider, { speed: 'fast' };

If you try the above in your Autotask and get an error of DefenderRelayProvider not being defined, please try deleting and recreating the Autotask, to ensure the latest version of the defender-relay-client is used.

Improved address input

Given how awkward address management can be, we have improved all address inputs across the application so they source information from your shared address book, and allow you to easily pick an address from it. This removes the need to be copy-pasting addresses around, or looking up what address corresponds to what:

defender-admin-address-dropdown

Coming up…

We are working on adding Sokol support in addition to xDai, to facilitate testing. Also, we are improving the Admin proposals interface by adding contextual information about (including direct queries) the contract you are interacting with, so you don’t have to switch between Defender and a block explorer when setting up a proposal. As for Relayer and Autotasks, we’ll be shipping soon the option to send transactions with a fixed gas price (as opposed to a speed) and a time-to-live, as well as the ability to invoke Autotasks via a webhook.

Stay tuned!

2 Likes