NeapDocs
Launch app
Docs · Contracts and addresses

Reference

Contracts and addresses

Testnet addresses, units, contract methods and the public API.

Addresses (NEAR testnet)

WhatValue
Neap contractneap-perps.testnet
Collateral (test USDC)usdc.fakes.testnet
APIhttps://neap-backend.onrender.com
WebSocketwss://neap-backend.onrender.com/ws
Market 0NEAR-PERP · major
Market 1TIDE-PERP · long-tail · Ref pool 2962 on ref-finance-101.testnet

The live list of markets is at GET /markets. Mainnet addresses will be published here at launch.

Units

QuantityEncoding
USDC amountsInteger atoms, 6 decimals. 1 USDC = 1000000.
Pricesprice_e6: USD times 10^6. $5.10 = 5100000.
Position sizesize_q: units times 10^6. One token is 1000000.
Large integersSent and returned as strings in JSON.

User methods

Calls that move value require 1 yoctoNEAR attached, which forces a full-access key signature.

MethodPurpose
register()Create your Neap balance. Pays storage.
ft_transfer_call on USDCDeposit USDC. With a CreateMarket message, create a market.
open_account(market)Create your margin account in a market. Pays storage.
deposit(market, amount)Neap balance to margin.
withdraw_margin(market, amount)Margin to Neap balance.
withdraw(amount)Neap balance to your NEAR wallet.
request_order(market, side, size_q, limit_price, expiry_blocks, reduce_only)Place a two-step order.
cancel_order(order_id)Cancel a pending order.
place_conditional(...) · cancel_conditional(id)Take-profit, stop-loss and limit orders.
convert_pnl(market)Turn matured profit into withdrawable USDC.
lp_deposit(market, amount) · lp_redeem(market, shares)Add or remove pool liquidity.
claim_fees(market, payee)Lister or protocol claims accrued fees.

Permissionless keeper methods

MethodPurpose
refresh_price(market)Read the NEAR pool price.
activate_market(market)Move a Proposed market to Active once checks pass.
crank(market)Advance the price staircase and funding.
execute_order(order_id)Fill a pending order.
execute_conditional(id)Trigger a TP, SL or limit order.
liquidate(market, account)Liquidate an account below maintenance margin. Pays the caller.

Views

MethodReturns
get_market(market)Mode, price, open interest, pool value, insurance, funding rate.
get_account(market, account)Margin, profit and loss, position size.
get_wallet(account)Idle Neap balance.
quote(market, side, size_q)Execution price, spread in bps and fee for a hypothetical order.
get_order(id) · get_conditional(id)One order.
get_lp_shares(market, account)Pool shares held.
get_fee_ledger(market, payee)Accrued, unclaimed fees.
get_custody()Total user balances and total vault balances held by the contract.
near contract call-function as-read-only neap-perps.testnet get_market \
  json-args '{"market": 0}' network-config testnet now

API

The API is read-only market data, served from the indexer. Pagination is ?limit=50&offset=0, maximum 500.

EndpointReturns
GET /health · /configService status, network and contract.
GET /markets · /markets/:idLive market state with 24 hour stats.
GET /markets/:id/candles?interval=60Price candles, oldest first.
GET /markets/:id/fills · /orders · /conditionals · /liquidationsMarket history.
GET /markets/:id/quote?side=Long&size_q=…The contract's quote.
GET /account/:ownerBalances and positions for one account.
GET /account/:owner/fills · /orders · /conditionals · /liquidationsAccount history.
WS /wsA snapshot on connect, then market state every few seconds and every contract event.

Events follow NEP-297 with standard: "neap": order_requested, fill, liquidation, price_observed, market_created, market_activated, market_mode_changed and others.