ethereum-attestation-service / eas-sdk

Ethereum Attestation Service - TypeScript/JavaScript SDK
MIT License
89 stars 45 forks source link

Getting sendTransaction is not a function Type errors on create actions (schema, attestations, timestamps) #110

Closed anushas-dev closed 1 month ago

anushas-dev commented 1 month ago

Hi Team, Getting the below error on EAS transactions calls -

TypeError: this.signer.sendTransaction is not a function at Transaction.wait (~/node_modules/@ethereum-attestation-service/eas-sdk/dist/transaction.js:18:38)

I'm using :

 Node.js v20.15.1
npm -v
10.7.0
npm view ethers
ethers@6.13.1 

Code used for timestamp creations to reproduce the issue -

import { EAS } from "@ethereum-attestation-service/eas-sdk";
import { ethers } from 'ethers';

const EASContractAddress = "0xC2679fBD37d54388Ce493F1DB75320D236e1815e"; 
const eas = new EAS(EASContractAddress);
const provider = ethers.getDefaultProvider(
    "https://ethereum-sepolia-rpc.publicnode.com",
);
eas.connect(provider);

const data1 = ethers.encodeBytes32String('record');
const data2 = ethers.encodeBytes32String('validator');

const transaction = await eas.multiTimestamp([data1, data2]);
await transaction.wait();
lbeder commented 1 month ago

It seems that your ethers.getDefaultProvider doesn't return a provider that can send transactions. Can you try initializing a new JsonRpcProvider instead?

anushas-dev commented 1 month ago

It seems that your ethers.getDefaultProvider doesn't return a provider that can send transactions. Can you try initializing a new JsonRpcProvider instead?

Yes, thank you for checking this.