Skip to main content
@toxicflow-labs/ts-sdk/relay authenticates a secondary trading EOA with Relay and submits already signed trading-wallet or AccountCore payloads. It does not create wallet-intent signatures for you; use Trading-wallet signing first. All testnet examples use Monad chain ID 10143 and the Relay testnet URL https://relay.testnet.kuru.io.

Authenticate

authenticate() requests Relay’s one-time challenge, signs its exact UTF-8 message with personal_sign, exchanges it for a JWT, validates the wallet binding, and retains the token on the client.
Use createWalletClientRelaySigner(walletClient, tradingWalletAddress) for an injected or embedded wallet. The SDK does not authenticate, refresh tokens, re-sign payloads, or retry state-changing submissions implicitly.

Sign and submit

After the signed intent is ready, submission is one Relay REST request and no chain RPC. The client assigns a UUIDv7 request ID unless you provide one.
BROADCAST means Relay’s RPC accepted the sponsored transaction. It does not prove the target action executed successfully. Wait for the transaction receipt and verify the expected event or state change.

SDK method mapping

Relay trigger creation (createReplaceTrigger and createBatchTrigger) is disabled. The SDK provides the corresponding signing interfaces for contract integrations.

Runnable examples

The SDK repository has one runnable source file per Relay method. Each signs its payload first, authenticates the trading EOA, then sends the matching Relay request: Set the current account and market inputs explicitly before running an example. The testnet deployment addresses and chain ID 10143 are listed in Testnet Deployments.

Errors and retries

KuruRelayError.kind distinguishes input, authentication, HTTP, transport, timeout, cancellation, Relay rejection, and malformed-response failures. A Relay rejection includes safe response metadata such as retryable, retryAfterMs, and candidateTxHash. Do not blindly retry a state-changing request. Reconcile the prior request ID and any candidate transaction hash, then use a fresh signature or consciously reuse the same request ID only when the Relay API’s idempotency behavior is understood.