@somnia-chain/markets-sdk / native / createNative
Function: createNative()
createNative(
client):SomniaNative
Defined in: packages/sdk/src/native/client.ts:213
Wrap any JSON-RPC client in the Somnia-native API.
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.
Parameters
client
Anything with an EIP-1193 request method.
Returns
The SomniaNative surface.