Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Stable Enterprise SDK

@stablechain/enterprise is a server-side TypeScript client for Stable's enterprise transaction rails. It signs and relays two kinds of privileged transactions: gas-waived transactions, where you sponsor a user's gas, and guaranteed-blockspace transactions, which land in a reserved Enterprise lane. You can enable either rail, or both, on one client.

import { createStableEnterprise, stable } from "@stablechain/enterprise";
import { privateKeyToAccount } from "viem/accounts";
 
const enterprise = createStableEnterprise({
  chain: stable,
  gasWaiver: { account: privateKeyToAccount("0xYOUR_WAIVER_KEY") },
});
 
const { txHash } = await enterprise.gasWaiver.send(user, { to: token, data });
txHash: 0x8f3a...2d41

The call returns H_inner, the hash of the user's transaction, not the wrapper transaction that carried it.

What the SDK does

The SDK exposes three features, one per module. Each is optional and independently configured, and each carries its own signing account so you can use separate keys.

  • Relay with gas waiver (gasWaiver): build, sign, and relay a gas-waived transaction. A whitelisted waiver account wraps a user's zero-gas transaction so the user transacts without holding any USDT0. See Gas waiver.
  • Guaranteed blockspace (guaranteedBlock): relay a transaction through the Enterprise RPC gateway so it lands in reserved Enterprise-lane blockspace. Unlike gas waiver, the signer pays its own gas. See Guaranteed blockspace.
  • Guaranteed relay transactions (guaranteedWaiver): both combined. A gas-waived transaction routed through guaranteed blockspace, so the user needs no balance and the transaction still lands in the Enterprise lane.

Every feature offers the same four methods: send and sendBatch for the custodial path where the SDK signs, and relay and relayBatch for the non-custodial path where the user signs elsewhere and hands you only the signed hex.

The SDK is published on npm as @stablechain/enterprise, currently at version 1.0.0, and requires viem >= 2.0.0 as a peer dependency.

Access

The Enterprise SDK is available on Stable Mainnet and Stable Testnet. Pass stable for mainnet or stableTestnet for testnet as the client's chain; both are re-exported by the package.

Both rails are gated. Gas waiver requires a governance-registered waiver key, and guaranteed blockspace requires an Enterprise RPC gateway API key. To integrate, contact Stable to get access. Stable provisions the waiver key and the gateway endpoint you need.

Server-side only

The waiver key is a whitelisted, governance-registered account: anyone holding it can sponsor gas under your policy. The Enterprise RPC gateway URL embeds your API key. Treat both as secrets. To keep the waiver key out of process, back it with a custody signer such as AWS KMS. See Signing keys and custody.

When to use it

Reach for the Enterprise SDK when you operate a backend and want to sponsor users' gas or guarantee inclusion for your own traffic. For everyday transfers, bridges, swaps, and vault yield from either a backend or a browser, use the general-purpose Stable SDK instead.

Start here

Next recommended

  • Install from npm: View the package on npmjs.com and check the latest version.
  • Gas waiver protocol: Transaction formats, marker routing, and governance controls.
  • Stable SDK: The general-purpose client for transfers, bridging, swaps, and yield.
  • Connect to Stable: Chain IDs, RPC endpoints, and explorers for mainnet and testnet.