Documentation Index
Fetch the complete documentation index at: https://docs.0xkey.io/llms.txt
Use this file to discover all available pages before exploring further.
Coming soon in Phase 1. Gas sponsorship, get_gas_usage, get_nonces, and production on-chain broadcast are not yet wired end-to-end. The code below describes the target SDK API; do not rely on it in production until the Roadmap marks these capabilities Supported.
SDK Overview
The SDK primarily abstracts three endpoints: eth_send_transaction, get_send_transaction_status, and get_gas_usage.
You can sign and broadcast transactions in two primary ways:
-
Using the React handler (
handleSendTransaction) from @0xkey-io/react-wallet-kit
This gives you:
- modals
- spinner + chain logo
- success screen
- explorer link
- built-in polling
-
Using low-level functions in
@0xkey-io/core
You manually call:
ethSendTransaction OR solSendTransaction → submit
pollTransactionStatus → wait for inclusion
-
Using server-side
@0xkey-io/sdk-server
This is the right choice for Node.js backends. It exposes the same methods via the server SDK client.
This page walks you through the React flow with full code examples. For using @0xkey-io/core directly, see the send transaction snippets and the Roadmap.
Using handleSendTransaction (React)
This handler wraps everything: intent creation, signing, 0xkey submission, polling, modal UX, and final success UI.
import { ZeroXKeyProvider, type ZeroXKeyProviderConfig } from "@0xkey-io/react-wallet-kit";
const zeroXKeyConfig: ZeroXKeyProviderConfig = {
organizationId: process.env.NEXT_PUBLIC_ORGANIZATION_ID!,
authProxyConfigId: process.env.NEXT_PUBLIC_AUTH_PROXY_CONFIG_ID!,
};
export default function App({ children }) {
return (
<ZeroXKeyProvider config={zeroXKeyConfig}>
{children}
</ZeroXKeyProvider>
);
}
Step 2 — Use handleSendTransaction inside your UI
const { handleSendTransaction, wallets } = useZeroXKey();
const walletAccount = wallets[0].accounts[0];
await handleSendTransaction({
transaction: {
from: walletAccount.address,
to: "0xRecipient",
value: "1000000000000000",
data: "0x",
caip2: "eip155:8453",
sponsor: true,
},
});
OR (Solana):
const { handleSendTransaction, wallets } = useZeroXKey();
const walletAccount = wallets
.flatMap((w) => w.accounts)
.find((a) => a.addressFormat === "ADDRESS_FORMAT_SOLANA");
if (!walletAccount) {
throw new Error("No Solana wallet account found");
}
await handleSendTransaction({
transaction: {
signWith: walletAccount.address, // Solana address
unsignedTransaction: "<base64-serialized-unsigned-solana-tx>",
caip2: "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", // devnet
sponsor: true,
// recentBlockhash: "<recent blockhash>", // optional
},
});
- Full React handler implementation here
This automatically:
- opens 0xkey modal
- shows chain logo
- polls until INCLUDED
- displays success page + explorer link
Checking Gas Usage
You can configure gas limits for both sub-orgs and all orgs. We recommend checking sub-org gas usage against the limit on the client side so your application can handle edge cases when approaching or exceeding the gas limit.
You may also want to monitor your all org gas usage regularly to see if you are approaching your gas limit.
const resp = await httpClient?.getGasUsage({})
if (resp?.usageUsd! > resp?.windowLimitUsd!) { // you can also configure this to be a threshold
console.error("Gas usage limit exceeded for sponsored transactions");
return
}
For additional references leveraging these endpoints, check out our Swapping Example and Sweeping Example
EVM paymaster example
You may also leverage our own example for setting up EVM paymaster leveraging the above endpoints. This example shows how to send an erc-20 token on EVM networks using 0xkey’s paymaster (gas sponsorship).
Please refer to with-paymaster to see how to setup and manage paymaster for your transaction operations.