Can't deploy to Defender Testnet with relayer

I might be misunderstanding how deployment works but I have been trying to deploy my smart contract to Defender Testnet by following this guide I have the correct API Keys but in my deploy script, I am trying to use a relayer to support meta transactions. Whenever I do deploy, it goes on the sepolia testnet but I can't see it on the Defender testnet.

Also for my code, I can't seem to add a wait function after deploying my smart contract as it always gives me this error

C:\Users\Jexarx\React\Final Year Project\backend\node_modules\ethers\src.ts\providers\provider.ts:1585
                if ((await receipt.confirmations()) >= confirms) {
TypeError: receipt.confirmations is not a function
    at DefenderRelayProvider.txListener (C:\Users\Jexarx\React\Final Year Project\backend\node_modules\ethers\src.ts\providers\provider.ts:1585:36)
    at Timeout._onTimeout (C:\Users\Jexarx\React\Final Year Project\backend\node_modules\@ethersproject\providers\src.ts\base-provider.ts:2137:32)
    at listOnTimeout (node:internal/timers:569:17)
    at processTimers (node:internal/timers:512:7)


When I run my code without the wait, it reaches the end and I can see it as a pending transaction on sepolia testnet and my relayer. Can I interact with the smart contract now that its on the sepolia testnet and I don't need it on Defender testnet?

:computer: Environment

I'm using Defender, Relayer and a Testnet

The code

const {
} = require('@openzeppelin/defender-relay-client/lib/ethers');
const { ethers } = require('hardhat');
const { writeFileSync } = require('fs');

// tutorial from
async function main() {
  const credentials = { apiKey: process.env.RELAYER_KEY, apiSecret: process.env.RELAYER_SECRET };
  const initialSupply = 10000000;

  const provider = new DefenderRelayProvider(credentials);
  const relaySigner = new DefenderRelaySigner(credentials, provider, { speed: 'fast'});

  const traceCreditFactory = await ethers.getContractFactory("TraceCredit", { signer: relaySigner});
  // const traceCredit = await ethers.deployContract("TraceCredit", [initialSupply], { signer: relaySigner });
  // await traceCredit.waitForDeployment();
  // const traceCreditAddress = await traceCredit.getAddress();

  const traceCredit = await traceCreditFactory.deploy(initialSupply);
  const traceCreditAddress = await traceCredit.getAddress();

  const nodeManagerFactory = await ethers.getContractFactory("NodeManager", { signer: relaySigner });
  // const nodeManager = await nodeManagerFactory.deploy(traceCreditAddress, TRUSTED_FORWARDER);
  // const nodeManagerAddress = await nodeManager.getAddress();

  const nodeManager = await nodeManagerFactory.deploy(traceCreditAddress, TRUSTED_FORWARDER)
  const nodeManagerAddress = await nodeManager.getAddress();

  // check if thing is deployed first 
  writeFileSync('deploy.json', JSON.stringify({
    nodeManager: nodeManagerAddress,
  }, null, 2));

  console.log('Contract deployed');

main().catch((error) => {
  process.exitCode = 1;

My hardhat config

import 'dotenv/config';
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomicfoundation/hardhat-ethers";
import "@openzeppelin/hardhat-upgrades";


const config: HardhatUserConfig = {
  solidity: {
    compilers: [
        version: "0.8.19",
        version: "0.8.20",
        settings: {},
  defender: {
    apiKey: process.env.TEST_ENV_API_KEY,
    apiSecret: process.env.TEST_ENV_API_SECRET_KEY
  networks: {
    sepolia: {
      url: "",
      chainId: 11155111

export default config;

The command I use
npx hardhat run --network sepolia scripts/deploy.js

Again, if I am misunderstanding something and I have already deployed it successfully on the sepolia testnet and can interact with my smart contract now, please let me know.

1 Like

Hi the error you're seeing TypeError: receipt.confirmations is not a function is a known ethers compatibility issue and will be fixed very soon.

I'm not sure what you mean by Defender testnet, but so long as the contract is deployed successfully to sepolia you can interact with it via Defender, ethers, web3js, etc