OVERVIEW

WHAT IS AN AGENT

In VynX, an agent is any autonomous system that submits intents. There are no wallet popups, no brand preferences, no onboarding fatigue. An intent is an instruction — swap X USDC for Y token — validated and signed (EIP-712) by the Relayer. The protocol handles routing, settlement, and guarantees.

SUBMITAUCTIONLOCKPAYSETTLE

The agent wallet submits two Base transactions per swap — approve() and lockIntent() — and pays their gas. The destination-chain payment is the Solver’s own transaction; its gas is internalized in the bid spread.

SETTLEMENT LIFECYCLE · HAPPY PATH
01
SUBMITAGENT

The agent submits an intent — token (USDC), amount, destination chain, and a 15-minute deadline. The SDK sends an all-zero placeholder signature; the relayer's EIP-712 signature is the authoritative one.

02
AUCTIONRELAYER

The relayer validates solver eligibility (SHF ≥ 1.20×), signs the intent, then opens a 200 ms sealed-bid auction. Highest OutputAmount wins; ties break on health factor.

03
LOCKAGENT → SETTLEMENT (BASE)

The SDK submits approve() and lockIntent() from the agent wallet — two Base transactions, agent-paid gas. lockIntent() escrows the USDC on VynxSettlement, verifying the relayer's EIP-712 signature against the live relayerKey.

UNKNOWN → LOCKED
04
PAYSOLVER → DESTINATION CHAIN

The winning solver delivers the output token on the destination chain. The relayer waits for finality, then signs a voucher over (intentId, solver, amount).

05
CLAIMSOLVER → SETTLEMENT (BASE)

claimFunds() verifies the voucher and releases the escrow to the solver. A 10 bps fee is deducted atomically.

LOCKED → REDEEMED

No fill by the deadline? Anyone can call refundIntent() to return the full amount to the agent — unilateral, no solver or governance approval required.

LOCKED → REFUNDED
QUICK START

THREE STEPS TO PRODUCTION

01
INSTALL
INSTALL
npm install @vynx/sdk viem
02
INITIALIZE
INITIALIZE
import { createWalletClient, createPublicClient, http } from 'viem'
import { base } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'
import { VynxCore } from '@vynx/sdk'

const account = privateKeyToAccount(process.env.AGENT_PK)

const walletClient = createWalletClient({
  account,
  chain: base,
  transport: http(process.env.BASE_RPC_URL),
})
const publicClient = createPublicClient({
  chain: base,
  transport: http(process.env.BASE_RPC_URL),
})

const vynx = new VynxCore({ walletClient, publicClient })
03
SUBMIT INTENT
SUBMIT INTENT
const receipt = await vynx.executeSwap({
  targetToken:   'DEGEN', // symbol or 0x address
  amountUSD:     100,     // min $50
  targetChainId: 8453,    // Base
})

// receipt.destTxHash · receipt.outputAmount · receipt.executionTimeMs

inputAmount minimum: 50 USDC (50_000_000). Intents below this threshold are rejected by the Relayer’s Asymmetric Asset Policy.

SDK REFERENCE

@VYNX/SDK

@vynx/sdk↗ npm
METHOD
DESCRIPTION
executeSwap()
Signs, submits, and settles an intent. Resolves with the on-chain receipt.
getSwapStatus()
Non-blocking status poll by tracking ref. Safe in polling loops.
destroy()
Aborts in-flight executeSwap() calls and stops their settlement pollers. Resolves once they settle.

The SDK submits approve() — exact allowance, never unlimited — and lockIntent() from the agent wallet. It does not hold capital, does not sign EIP-712 typed data, and does not query oracles.

EIP-712 PAYLOAD

INTENT STRUCTURE

Every intent is an EIP-712 typed data payload. The Relayer validates and signs the struct; lockIntent() verifies that signature on-chain. The Solver bids.

FIELD
TYPE
DESCRIPTION
intentId
bytes32
Unique identifier. Derived on submission.
agent
address
Intent originator. Your signing address.
token
address
Must be USDC on Base (0x833589...).
amount
uint256
In USDC base units (6 decimals). Min: 50e6.
solver
address
Winning Solver. Assigned by the Relayer.
nonce
uint256
Replay protection. Incremented per intent.
destinationChainId
uint256
8453 Base · 84532 Base Sepolia · 1/10/137/42161.
deadline
uint256
Unix timestamp. Default: now + 15 min.
INTENT LIFECYCLE

STATE MACHINE

INTENT STATE MACHINE
submitlockclaimdeadlinebreachPENDINGIN_AUCTIONLOCKEDSETTLEDEXPIREDSLASHED

SETTLED, EXPIRED, and SLASHED are terminal. On EXPIRED the agent is refunded in full; on SLASHED the breaching solver forfeits 10% and the agent is compensated.

STATUS
DESCRIPTION
PENDING
Intent submitted and accepted. In private mempool.
IN_AUCTION
Broadcast to Solvers. 200ms window open.
LOCKED
SDK executed lockIntent() from the agent wallet. Funds locked on Base.
SETTLED
claimFunds() confirmed. Output delivered to agent.
EXPIRED
Deadline (15 min) passed without fill. Refund automatic.
SLASHED
Solver breached Deadline. 10% slash. Agent compensated.

On EXPIRED: the agent receives a full unilateral refund. No Solver approval required. No governance vote. The refund is enforced by DEFAULT_DEADLINE in VynxSettlement.sol.

ERROR HANDLING

FAILURE MODES

RELAYER REJECTION

Intent rejected before auction if: inputToken ≠ USDC, inputAmount < 50 USDC, no eligible Solvers (SHF), or agent nonce reused.

Check payload. Retry with corrected parameters.

AUCTION NO-FILL

No Solver bid within 200ms window. Status → PENDING (requeued) or EXPIRED if deadline passed.

getSwapStatus() to confirm. Retry or wait for refund.

DEADLINE BREACH — AGENT PROTECTED

Solver won but failed to settle within 15 min. SlashAmount = InputAmount × 10%. 5% returned to agent. Protocol enforced. No action needed.

Monitor via getSwapStatus(). Compensation is automatic.

VynxSettlement.sol reverts and emits SuspiciousRelayerActivity if intentId is not found or Solver does not match on-chain record.

ERROR CODE REFERENCE

Every error thrown by executeSwap() and getSwapStatus() is a VynxError with a stable code. Match on the code, never the message. The class encodes whether capital is at risk.

1xxx · PRE-EXECUTIONNever at risk
VYNX_1001_INSUFFICIENT_FUNDS
Agent USDC balance is below amountUSD.
VYNX_1002_BELOW_MINIMUM
amountUSD is below the $50 protocol minimum.
VYNX_1003_UNKNOWN_TOKEN
targetToken is neither a known symbol nor a valid EVM address.
VYNX_1004_UNSUPPORTED_CHAIN
targetChainId not in 1 · 10 · 137 · 8453 · 42161.
VYNX_1005_QUOTE_UNAVAILABLE
Both 1inch and Odos failed to return a price quote.
2xxx · EXECUTION FAILEDNever at risk
VYNX_2001_NO_LIQUIDITY
No solver bid, or the winner missed the 10 s SLA. Transient — retry in 5–30 s.
VYNX_2002_SYSTEM_UNAVAILABLE
Relayer unreachable, returned a non-OK status, the approve transaction failed, or maxExecutionTimeMs elapsed — which aborts the settlement poller. Retry with backoff; check getSwapStatus() before re-submitting.
3xxx · CAPITAL RECOVEREDAuto-refunded
VYNX_3001_SWAP_TIMEOUT
Locked but the solver did not settle in 15 min. The SDK called refundIntent() and confirmed it on-chain.
9xxx · HUMAN INTERVENTIONAction required
VYNX_9001_REFUND_UNRECOVERABLE
Three refundIntent() attempts failed. Capital is locked — call refundIntent() manually after the deadline.
VYNX_9999_INTERNAL
Unexpected SDK error. Capital is not at risk. Open an issue with err.context.
FAQ

FREQUENTLY ASKED QUESTIONS