Getting started
1
Prerequisites
- Node.js v20.18+ with npm
- A NEAR mainnet account
2
Clone the Example Solver Repository
The AMM Solver example uses a simple constant-product AMM formula to price quotes
3
Configure your environment
Create your environment file from the provided example:Open
env/.env.local and fill your NEAR account credentials, the token pair you want to market-make, and your desired fee margin.Example .env file
Example .env file
4
Get a Partner JWT
The Message Bus WebSocket endpoint (The example solver automatically uses this token for WebSocket authentication — no code changes required.
wss://solver-relay-v2.chaindefuser.com/ws) requires authentication. To get your credentials:- Sign up at partners.near-intents.org
- Request access through the partner portal
- Complete KYC/KYB verification as part of the application process
env/.env.local:5
Deposit liquidity
Your solver can only fill swaps if it has token balances inside the Verifier contract (Replace
intents.near).You need to do two things: register your solver’s public key on the contract, and deposit tokens.1
Register your public key
YOUR_PUBLIC_KEY with the public key that corresponds to the private key in your .env.local file, and SOLVER_ACCOUNT_ID with your actual NEAR account ID.2
Deposit tokens
- near.com - a web interface for swapping and depositing tokens
usdt.tether-token.near and wrap.near deposited into the contract.6
Start the solver
Since the environment file is named On startup, the solver connects to the Message Bus WebSocket, subscribes to quote events, and begins polling the Verifier contract for current token balances every 15 seconds. Log output confirms the connection and initial reserves.
.env.local, set NODE_ENV=local so the app picks it up:7
Verify it is working
Check the health endpoint to confirm the solver is running:In the logs, look for:
- Connection confirmed - successful WebSocket connection to the Message Bus
- Quote requests - incoming swap requests being evaluated
- Quote responses - signed quotes being sent back for pairs your solver supports