ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.9k stars 1.83k forks source link

Cannot get use getTransaction in CodeSandbox #4062

Open hzhu opened 1 year ago

hzhu commented 1 year ago

Ethers Version

6.2.3

Search Terms

provider, v6, getTransaction

Describe the Problem

The usage of the provider.getTransaction throws an error in this minimal CodeSandbox demo:

The "listener" argument must be of type Function. Received type object

and then repeatedly logs:

JsonRpcProvider failed to startup; retry in 1s 

Code Snippet

import { JsonRpcProvider } from "ethers";

async function example() {
  const provider = new JsonRpcProvider("https://eth.llamarpc.com");
  await provider.getTransaction(
    "0x8c9bae9a6eae090e515615f9581212449bb5901e540a6228e0fe1a8436d34460"
  );
}

example();

Contract ABI

No response

Errors

The "listener" argument must be of type Function. Received type object

Environment

Other (please specify)

Environment (Other)

CodeSandbox

zemse commented 1 year ago

This issue is reproducible in the sandbox with the following code as well.

import { FetchRequest } from "ethers";

async function example() {
  const f = new FetchRequest("https://google.com");
  await f.send();
}

example();

Might be somewhere around: https://github.com/ethers-io/ethers.js/blob/c785c1e5153d5a85a78f90f177577f2c8df15529/src.ts/utils/fetch.ts#L127.