viem 2¶
Not executed for this release
chain.ts
import { defineChain, createPublicClient, createWalletClient, http, parseEther } from "viem";
import { privateKeyToAccount } from "viem/accounts";
export const pqwerai = defineChain({
id: 20778,
name: "PQWERAI Testnet",
nativeCurrency: { name: "tPQAI", symbol: "tPQAI", decimals: 18 },
rpcUrls: { default: { http: [process.env.PQWERAI_RPC ?? "http://127.0.0.1:8545"] } },
testnet: true,
});
const client = createPublicClient({ chain: pqwerai, transport: http() });
console.log(await client.getBlockNumber());
// PQWERAI finality comes from g4_status, not blockTag "finalized"
const status = await client.request({ method: "g4_status" as any, params: [] as any });
const wallet = createWalletClient({ chain: pqwerai, transport: http(), account: privateKeyToAccount(process.env.KEY as `0x${string}`) });
const hash = await wallet.sendTransaction({ to: "0x000000000000000000000000000000000000dEaD", value: parseEther("0.01") });
await client.waitForTransactionReceipt({ hash });
blockTag: "finalized" and "safe" work against the public RPC endpoints, which resolve both to the Smartnode
finalized checkpoint. Against your own PQWERAI Core node they return finalized block not found; use latest and
g4_status there.
Sources at 83ff5b69f0 (project repository, not public yet): testnet/release/network/network.json
Found a problem? Report a documentation issue · Build testnet-20778+83ff5b69f0