0xtrails
Version:
SDK for Trails
17 lines (13 loc) • 499 B
text/typescript
import { createPublicClient, http } from "viem"
import { getChainInfo } from "./chains.js"
export async function getIsContract(address: `0x${string}`, chainId: number) {
const client = createPublicClient({
chain: getChainInfo(chainId)!,
transport: http(),
})
const code = await client.getCode({ address })
return code !== "0x"
}
export function getIsCustomCalldata(calldata: string | undefined): boolean {
return calldata !== undefined && calldata !== "" && calldata !== "0x"
}