Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

verify does not support custom networks like Polygon Amoy (unsupported network error) #311

@ranggakc

Description

@ranggakc

Summary

When trying to verify a document on the Polygon Amoy network using @govtechsg/oa-verify, the following error occurs:
Error: unsupported network (argument="network", value=null, code=INVALID_ARGUMENT, version=providers/5.8.0)

Steps to Reproduce

I'm using the following code:

const { utils, verificationBuilder, openAttestationVerifiers } = require('@govtechsg/oa-verify');

const providerParams = {
  network: "amoy",
  providerType: "infura",
  apiKey: process.env.INFURA_PROJECT_ID,
  url: `https://polygon-amoy.infura.io/v3/${process.env.INFURA_PROJECT_ID}`
};

const provider = utils.generateProvider(providerParams);

const verify = verificationBuilder(openAttestationVerifiers, { provider });
const fragments = await verify(document);

Expected Behavior

I expected oa-verify to allow verification using the custom RPC endpoint (e.g., Polygon Amoy) provided via the url parameter.

Actual Behavior

The following error is thrown:
Error: unsupported network (argument="network", value=null, code=INVALID_ARGUMENT)

It seems that generateProvider() still attempts to resolve the network when providerType is set to 'infura', even if url is provided — which causes ethers.js to reject the request when the network is not known.

Suggested Fix

Add support for custom RPC networks by respecting providerType: 'custom' and ignoring network entirely.

Alternatively, allow passing a fully-initialized ethers.providers.JsonRpcProvider into the verification context directly.

Environment

  • @govtechsg/oa-verify version: 9.4.0
  • ethers version: 6.12.0
  • Network: Polygon Amoy
  • Node.js: v22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions