You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial report is from a user running the basic sdk example from the docs:
import { Database, helpers } from "@tableland/sdk"
import { Wallet } from "ethers"
import * as dotenv from "dotenv"
dotenv.config()
async function main() {
const privateKey: any = process.env.PRIVATE_KEY
const rpc: any = process.env.RPC_URL
const wallet = new Wallet(privateKey);
const provider: any = helpers.getDefaultProvider(rpc)
const signer: any = wallet.connect(provider);
interface Schema {
id: number;
name: string;
}
const db = new Database<Schema>({ signer: signer })
const prefix: string = "my_sdk_table";
const { meta: create } = await db
.prepare(`CREATE TABLE ${prefix} (id integer primary key, name text);`)
.run();
console.log(create.txn?.name)
}
main();
This results in: Error: RUN_ERROR: signer.getChainId is not a function
details
Ethers.js v6 was recently released https://docs.ethers.org/v6
With this release the signer interface no longer has the getChainId method. The chainId is potentially available elsewhere within the ethers v6 signer, but we might want to decide if there's a more robust way to get the chainId.
The v3 SDK had the requirement that a specific network had been connected to, which made this problem a little easier.
ideas for a solution
We could potentially try to sniff out what kind of interface the passed in signer supports. The downside I see here is that this could be cumbersome.
We could determine the chainId from the query. I think this makes sense, but I'd have to dive into implementation to be sure.
additional comments
This is blocked by hardhat supporting ethers v6. I'm gonna move this to cycle 3, but I don't know how long it will take for hardhat to introduce support
Hardhat has beta support for ethers v6, but some of the evm-tableland open zeppelin dependencies have peer dependencies that require ethers v5. So we will have to wait for something to change in OZ, as such I'm moving this out to cycle 6
This has turned into a pretty difficult update because of all of the dependency requirements. Moving this out another cycle.
context
A user reported this bug in Discord here https://discord.com/channels/592843512312102924/1077277654132215960
initial report
The initial report is from a user running the basic sdk example from the docs:
This results in:
Error: RUN_ERROR: signer.getChainId is not a function
details
Ethers.js v6 was recently released https://docs.ethers.org/v6
With this release the signer interface no longer has the
getChainId
method. The chainId is potentially available elsewhere within the ethers v6 signer, but we might want to decide if there's a more robust way to get the chainId.The v3 SDK had the requirement that a specific network had been connected to, which made this problem a little easier.
ideas for a solution
additional comments
From SyncLinear.com | TABJS-3
The text was updated successfully, but these errors were encountered: