Skip to content
This repository was archived by the owner on Apr 23, 2026. It is now read-only.
This repository was archived by the owner on Apr 23, 2026. It is now read-only.

Blocked Testnet interactions with envNetwork #3

Description

@on1force

I was really wondering why my verification didn't went through.. getting stuck for 2 days to eventually found out that you hardcoded the network from env... why? there's network params in the paymentRequirements dude..

    // Select provider based on NETWORK env var
    const envNetwork = process.env.NETWORK || 'testnet'; // ???
    const chainId = envNetwork === 'mainnet' ? 56 : 97;
    const selectedProvider = envNetwork === 'mainnet' ? provider : testnetProvider;


    // Get token info dynamically
    const tokenInfo = await getTokenInfo(paymentPayload.token, selectedProvider);


    // Create relayer contract instance
    const relayer = new Contract(
      B402_RELAYER_ADDRESS,
      B402_ABI,
      selectedProvider
    );


    // Verify signature locally (EIP-712)
    const domain = {
      name: "B402",
      version: "1",
      chainId: chainId,
      verifyingContract: paymentRequirements.relayerContract,
    };


    const types = {
      TransferWithAuthorization: [
        { name: "from", type: "address" },
        { name: "to", type: "address" },
        { name: "value", type: "uint256" },
        { name: "validAfter", type: "uint256" },
        { name: "validBefore", type: "uint256" },
        { name: "nonce", type: "bytes32" },
      ],
    };


    const recovered = ethers.verifyTypedData(domain, types, authorization, signature);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions