Skip to content

Commit

Permalink
Fix Defender Unhandled Promise Rejection (#15)
Browse files Browse the repository at this point in the history
* Don't wait for confirmations as Defender signer is failing

* Changed Defender Actions to use ethers v6
  • Loading branch information
naddison36 authored Sep 10, 2024
1 parent de6d201 commit 83a0e4c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 7 additions & 6 deletions src/js/actions/autoClaimWithdraw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const {
DefenderRelaySigner,
DefenderRelayProvider,
} = require("defender-relay-client/lib/ethers");
const { Defender } = require("@openzeppelin/defender-sdk");
const { ethers } = require("ethers");

const { autoClaimWithdraw } = require("../tasks/liquidity");
Expand All @@ -13,8 +10,12 @@ const vaultAbi = require("../../abis/vault.json");
// Entrypoint for the Autotask
const handler = async (event) => {
// Initialize defender relayer provider and signer
const provider = new DefenderRelayProvider(event);
const signer = new DefenderRelaySigner(event, provider, { speed: "fastest" });
const client = new Defender(event);
const provider = client.relaySigner.getProvider({ ethersVersion: "v6" });
const signer = await client.relaySigner.getSigner(provider, {
speed: "fastest",
ethersVersion: "v6",
});

console.log(
`DEBUG env var in handler before being set: "${process.env.DEBUG}"`
Expand Down
13 changes: 7 additions & 6 deletions src/js/actions/autoRequestWithdraw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const {
DefenderRelaySigner,
DefenderRelayProvider,
} = require("defender-relay-client/lib/ethers");
const { Defender } = require("@openzeppelin/defender-sdk");
const { ethers } = require("ethers");

const { autoRequestWithdraw } = require("../tasks/liquidity");
Expand All @@ -12,8 +9,12 @@ const oethARMAbi = require("../../abis/OethARM.json");
// Entrypoint for the Autotask
const handler = async (event) => {
// Initialize defender relayer provider and signer
const provider = new DefenderRelayProvider(event);
const signer = new DefenderRelaySigner(event, provider, { speed: "fastest" });
const client = new Defender(event);
const provider = client.relaySigner.getProvider({ ethersVersion: "v6" });
const signer = await client.relaySigner.getSigner(provider, {
speed: "fastest",
ethersVersion: "v6",
});

console.log(
`DEBUG env var in handler before being set: "${process.env.DEBUG}"`
Expand Down

0 comments on commit 83a0e4c

Please sign in to comment.