| name | description |
|---|---|
signet-ts-sdk |
TypeScript SDK for Signet blockchain operations — order creation/signing, bundle building, event parsing, passage bridging, and chain configuration |
TypeScript SDK for creating, signing, and submitting Signet orders. Compatible with the Rust signet-types crate for cross-implementation interoperability.
Build and sign EIP-712 orders using the UnsignedOrder builder. Orders use Permit2 for gasless token approvals.
import { UnsignedOrder, orderHash, MAINNET } from "@signet-sh/sdk";
const signedOrder = await UnsignedOrder.new()
.withInput(tokenAddress, amount)
.withOutput(outputToken, outputAmount, recipient, chainId)
.withDeadline(deadline)
.withChain({
chainId: MAINNET.rollupChainId,
orderContract: MAINNET.rollupOrders,
})
.sign(walletClient);
const hash = orderHash(signedOrder);Construct atomic transaction bundles for block builders. Bundles support rollup transactions, host chain transactions, and timing constraints.
import { SignetEthBundleBuilder, createTxCacheClient } from "@signet-sh/sdk";
const bundle = SignetEthBundleBuilder.new()
.withTx(signedTx)
.withBlockNumber(12345678n)
.build();
const txCache = createTxCacheClient("https://tx.signet.sh");
await txCache.submitBundle(bundle);Simulate bundles before submission:
import { SignetCallBundleBuilder, serializeCallBundle } from "@signet-sh/sdk";
const callBundle = SignetCallBundleBuilder.new()
.withTx(signedTx)
.withBlockNumber(12345679n)
.withStateBlockNumber("latest")
.build();
const serialized = serializeCallBundle(callBundle);Parse RollupOrders contract events with full type safety using viem's parseEventLogs and the SDK's typed event interfaces (v0.4.0+).
import { parseEventLogs } from "viem";
import {
rollupOrdersAbi,
type OrderEvent,
type FilledEvent,
type SweepEvent,
} from "@signet-sh/sdk";
const events = parseEventLogs({ abi: rollupOrdersAbi, logs });
for (const event of events) {
switch (event.eventName) {
case "Order": {
const { deadline, inputs, outputs } = event.args as OrderEvent;
break;
}
case "Filled": {
const { outputs } = event.args as FilledEvent;
break;
}
case "Sweep": {
const { recipient, token, amount } = event.args as SweepEvent;
break;
}
}
}Bridge native ETH and ERC20 tokens between host chain and Signet rollup using the Passage contract.
import { passageAbi, MAINNET } from "@signet-sh/sdk";
// Bridge native ETH
await walletClient.writeContract({
address: MAINNET.hostPassage,
abi: passageAbi,
functionName: "enter",
args: [recipientAddress],
value: 1000000000000000000n,
});
// Bridge ERC20 tokens
await walletClient.writeContract({
address: MAINNET.hostPassage,
abi: passageAbi,
functionName: "enterToken",
args: [MAINNET.rollupChainId, recipientAddress, tokenAddress, amount],
});SignedOrder— A signed order ready for submissionSignedFill— A signed fill for filling ordersSignetEthBundle— Bundle forsignet_sendBundleSignetCallBundle— Bundle forsignet_callBundle(simulation)SignetCallBundleResponse— Response fromsignet_callBundlePermit2Batch— Permit2 batch transfer dataPermitBatchTransferFrom— Permit2 batch transfer from structureOutput— Order output specification (token, amount, recipient, chainId)Input— Order input specification (token, amount)TokenPermissions— Token permission for Permit2ChainConfig— Chain configuration for order signingUnsignedOrderParams— Parameters for building unsigned ordersSerializedSignedOrder— JSON-serializable signed orderSerializedSignetEthBundle— JSON-serializable eth bundleSerializedSignetCallBundle— JSON-serializable call bundleSerializedSignetCallBundleResponse— JSON-serializable call bundle responseCallBundleTransactionResult— Result of a simulated bundle transactionSerializedCallBundleTransactionResult— JSON-serializable transaction resultAggregateFills— Aggregate fill dataAggregateOrders— Aggregate order dataBlockNumberOrTag— Block number or tag ("latest","pending", etc.)SignetSystemConstants— Chain configuration interfaceEip712SigningParams— EIP-712 signing parametersFeasibilityResult— Result of order feasibility checkFeasibilityIssue— Individual feasibility issueFeasibilityIssueType— Type of feasibility issueFlow— Entry mechanism:"passage"or"orders"TokenSymbol— Supported token symbolsTokenMeta— Token metadata (symbol, decimals, addresses)TxCacheClient— Tx-cache client interfaceAddress,Hex,B256,Bytes— Ethereum primitive types (re-exported from viem)
Typed interfaces for parsing RollupOrders contract events with parseEventLogs:
OrderEvent— Parsed args from anOrderevent:{ deadline, inputs, outputs }FilledEvent— Parsed args from aFilledevent:{ outputs }SweepEvent— Parsed args from aSweepevent:{ recipient, token, amount }
Order hashing & signing:
orderHash(order)— Compute the order hashorderHashPreImage(order)— Get the pre-image used for hashingcomputeOrderHash(order)— Compute order hash (alternate)normalizeSignature(sig)— Normalize ECDSA signature S-valueeip712Components(order)— Get EIP-712 domain and typeseip712SigningHash(order)— Compute EIP-712 signing hashpermit2Domain(chainId)— Get Permit2 EIP-712 domainpermit2DomainSeparator(chainId)— Compute Permit2 domain separatorpermitBatchWitnessStructHash(data)— Compute batch witness struct hashrandomNonce()— Generate a random Permit2 noncenonceFromSeed(seed)— Derive a nonce from a seed
Validation:
validateOrder(order)— Validate an order's structurevalidateFill(fill)— Validate a fill's structurecheckOrderFeasibility(order, params)— Check if an order is feasible on-chainhasPermit2Approval(client, params)— Check Permit2 approval statusisNonceUsed(client, params)— Check if a Permit2 nonce is used
Encoding:
encodeInitiatePermit2(order)— Encode order for Permit2 initiationencodeFillPermit2(fill)— Encode fill for Permit2 execution
Serialization:
serializeOrder(order)— Serialize a signed order for JSONdeserializeOrder(data)— Deserialize a signed order from JSONserializeEthBundle(bundle)— Serialize eth bundle for JSON-RPCdeserializeEthBundle(data)— Deserialize eth bundle from JSONserializeCallBundle(bundle)— Serialize call bundle for JSON-RPCdeserializeCallBundle(data)— Deserialize call bundle from JSONdeserializeCallBundleResponse(data)— Deserialize call bundle responsedeserializeTransactionResult(data)— Deserialize transaction result
Permit2:
ensurePermit2Approval(walletClient, publicClient, params)— Smart Permit2 approval with USDT handling
Tokens:
getTokenAddress(symbol, chainId, config)— Get token contract addressgetTokenDecimals(symbol, config?)— Get token decimals with chain-specific overridesresolveTokenSymbol(address, chainId, config)— Resolve address to token symbolgetAvailableTokens(chainId, config)— Get available tokens for a chainmapTokenCrossChain(symbol, fromChainId, toChainId, config)— Map token across chainsneedsWethWrap(symbol, direction, flow)— Check if ETH needs wrapping for operation
Client:
createTxCacheClient(baseUrl)— Create a tx-cache client for submitting orders and bundles
Constants helpers:
getOrdersContract(constants, chainId)— Get the orders contract for a chain
UnsignedOrder— Builder for creating and signing orders. Methods:new(),withInput(),withOutput(),withDeadline(),withChain(),sign()UnsignedFill— Builder for creating and signing fillsSignetEthBundleBuilder— Builder for eth bundles. Methods:new(),withTx(),withTxs(),withHostTx(),withBlockNumber(),withMinTimestamp(),withMaxTimestamp(),build()SignetCallBundleBuilder— Builder for call bundles (simulation). Methods:new(),withTx(),withBlockNumber(),withStateBlockNumber(),build()
PERMIT2_ADDRESS— Canonical Permit2 contract addressPERMIT2_NAME— Permit2 EIP-712 domain nameMAINNET— Mainnet chain configuration (host chain 1, rollup chain 519)PARMIGIANA— Parmigiana testnet configuration (host chain 3151908, rollup chain 88888)OUTPUT_WITNESS_TYPE_STRING— EIP-712 output witness type stringPERMIT_BATCH_WITNESS_TRANSFER_FROM_TYPES— Permit2 batch witness transfer typesTOKENS— Token registry with addresses and metadatasignetRollup— Viem chain definition for Signet rollupparmigianaRollup— Viem chain definition for Parmigiana rollupparmigianaHost— Viem chain definition for Parmigiana host
rollupOrdersAbi— Rollup orders contract ABI (Order, Filled, Sweep events)hostOrdersAbi— Host orders contract ABIpassageAbi— Passage bridge contract ABI (Enter, EnterToken events)rollupPassageAbi— Rollup passage contract ABIpermit2Abi— Permit2 contract ABIwethAbi— WETH contract ABI (deposit, withdraw)zenithAbi— Zenith contract ABItransactorAbi— Transactor contract ABIbundleHelperAbi— Bundle helper contract ABI
The SDK supports subpath imports for smaller bundle sizes:
import { MAINNET, PARMIGIANA } from "@signet-sh/sdk/constants";
import { UnsignedOrder } from "@signet-sh/sdk/signing";
import type { SignedOrder } from "@signet-sh/sdk/types";
import { rollupOrdersAbi, passageAbi, wethAbi } from "@signet-sh/sdk/abi";
import { getTokenAddress, getTokenDecimals } from "@signet-sh/sdk/tokens";
import { createTxCacheClient } from "@signet-sh/sdk/client";
import { ensurePermit2Approval } from "@signet-sh/sdk/permit2";| Field | Value |
|---|---|
hostChainId |
1n (Ethereum) |
rollupChainId |
519n |
hostPassage |
0x02a64d6e2c30d2B07ddBD177b24D9D0f6439CcbD |
rollupOrders |
0x000000000000007369676e65742d6f7264657273 |
hostOrders |
0x96f44ddc3Bc8892371305531F1a6d8ca2331fE6C |
txCacheUrl |
https://transactions.signet.sh |
| Field | Value |
|---|---|
hostChainId |
3151908n |
rollupChainId |
88888n |
hostPassage |
0x28524D2a753925Ef000C3f0F811cDf452C6256aF |
rollupOrders |
0x000000000000007369676E65742D6f7264657273 |
hostOrders |
0x96f44ddc3Bc8892371305531F1a6d8ca2331fE6C |
txCacheUrl |
https://transactions.parmigiana.signet.sh |
tokenDecimals |
{ WUSD: 18 } (testnet override) |
- Approve token to Permit2 (one-time per token)
- Build order with
UnsignedOrderbuilder - Sign with wallet (off-chain EIP-712 via Permit2)
- Submit to tx-cache with
createTxCacheClient
import { ensurePermit2Approval } from "@signet-sh/sdk";
const { approved, txHash } = await ensurePermit2Approval(
walletClient,
publicClient,
{
token: tokenAddress,
owner: account.address,
amount: 1000000n,
}
);import { getTokenAddress, getTokenDecimals, MAINNET } from "@signet-sh/sdk";
const weth = getTokenAddress("WETH", MAINNET.hostChainId, MAINNET);
const decimals = getTokenDecimals("WETH", MAINNET);import { needsWethWrap } from "@signet-sh/sdk";
// Check if ETH needs wrapping for an Orders flow (Permit2 requires WETH)
const wrap = needsWethWrap("ETH", "input", "orders"); // true
const noWrap = needsWethWrap("ETH", "input", "passage"); // false — Passage accepts native ETHimport { checkOrderFeasibility } from "@signet-sh/sdk";
const result = await checkOrderFeasibility(order, {
publicClient,
config: MAINNET,
});
if (result.issues.length > 0) {
console.log("Issues:", result.issues);
}