nectarnectarNectar Labs home
Reading sessionTestnet

Agents

Give an agent stock-backed credit. It reads limits, opens a protected loan with one call and pays for data with the proceeds. The Feed server never holds a key. Testnet, mock collateral.

One run, start to finish

example

Example, not a call made on testnet: the tool's code run against recorded view answers. On testnet the numbers come from the contract at call time. 1 NVDAx, $10.00.

{
  "account_id": "agent1.nectar.testnet",
  "collateral": "NVDAx",
  "units": "1000000",
  "borrow_usd": "10"
}
{
  "receiver_id": "nvdax-mock.nectar.testnet",
  "method": "ft_transfer_call",
  "args": {
    "receiver_id": "nectar-core-v2.nectar.testnet",
    "amount": "1000000",
    "msg": "{\"LockCollateralAndBorrow\":{\"collateral\":\"NVDAx\",\"borrow_usd_e6\":\"10000000\",\"pre_liq_ltv_bps\":8000}}"
  },
  "deposit": "1",
  "gas": "200000000000000"
}
fees:   premium $0.00, origination $0.03, total $0.03
net:    $9.97
health: now   value $90.78, LTV 11.02%, flagged no
  -5%   value $86.24, LTV 11.6%, flagged no
  -10%  value $81.70, LTV 12.24%, flagged no
  -20%  value $72.62, LTV 13.77%, flagged no

The agent signs call from agent1.nectar.testnet. The contract decides; the preview is advice.

Pay for data with the loan

testnet

The Feed's CSV export is priced at 0.01 mock USDC on near:testnet. An agent that borrowed above pays the challenge from its own key.

  1. 1 · 402GET /api/feed/export.csv answers 402 with a PAYMENT-REQUIRED header: scheme exact, network near:testnet, amount 10000 (0.01 mock USDC), asset usdc-mock.nectar.testnet.
  2. 2 · pay 0.01 mock USDCThe agent signs a NEP-366 delegate action for the USDC transfer. Our facilitator relays it; the relayer can only relay what the payer signed.
  3. 3 · 200The server fetches the CSV first, settles the payment, then answers 200 with the file and a PAYMENT-RESPONSE header naming the transaction. A Feed outage never charges the payer.