@somnia-chain/markets-sdk / native / createNative
Function: createNative()
createNative(
client):SomniaNative
Defined in: packages/sdk/src/native/client.ts:223
Wrap any JSON-RPC client in the Somnia-native API.
Details
client: Anything with an EIP-1193requestmethod.- Returns: The SomniaNative surface.
Example (Reading a native block)
ts
import { createPublicClient, http } from "viem";
import { somniaShannon } from "@somnia-chain/markets-sdk/chains";
import { createNative } from "@somnia-chain/markets-sdk/native";
const client = createPublicClient({ chain: somniaShannon, transport: http() });
const native = createNative(client);
const block = await native.getBlock("latest");
console.log(block?.consensusBlock.proposerAddress, block?.executionBlock.executionGasUsed);
Works with the markets client too — createNative(exchange.client.publicClient) —
and with a plain injected provider, since all it needs is .request.