LayerHopDocsLaunch app (opens in a new tab)

Referral links

Share a LayerHop link with ?r=<your wallet>, record who referred each swap with the referrer quote parameter, and read a wallet's referred orders and volume from GET /v1/referrals/{address}.

A LayerHop referral link is any LayerHop link with ?r=<wallet address> added, for example https://app.layerhop.com/?r=0x2222…. The referrer is the sharer's own wallet, so there is nothing to register. Swaps made by people who arrive through the link are recorded as referred by that wallet, and anyone can read the totals from GET /v1/referrals/{address}.

Note

Referral rewards aren't switched on yet. Referrals are recorded (attribution only); they never change the fee or the price a user gets. rewardBps is 0 and estimatedRewardsUsd stays 0 until a reward rate is set.

  1. Someone opens a LayerHop page with ?r=<wallet> (an EVM 0x address or a Solana address).
  2. The web app stores that wallet in the browser for 30 days. The first valid link wins; later links don't replace it until it expires. Invalid values are ignored.
  3. While it is stored, every quote the swap app requests carries referrer=<wallet>. The partner widget never sends one: its swaps belong to the partner that embedded it.
  4. The order built from that quote (POST /v1/orders) records the referrer.

Your own swaps don't count: a referrer equal to the quote's sender is ignored.

Get your link in the app under Referrals (connect a wallet; with both an EVM and a Solana wallet connected you get one link per wallet), or build it yourself:

Text
https://app.layerhop.com/?r=0x2222222222222222222222222222222222222222

How do I attribute a referral through the API?#

Pass referrer on GET /v1/quote (or in the POST /v1/quote body). It is optional and never an error: an invalid value or a referrer equal to sender is ignored, and the quote is the same with or without it.

Terminal
curl "https://api.layerhop.com/v1/quote?srcChain=base&srcToken=USDC&amount=100000000&dstChain=solana&dstToken=SOL&sender=0x1111111111111111111111111111111111111111&recipient=9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM&referrer=0x2222222222222222222222222222222222222222"

With the TypeScript SDK:

TypeScript
const q = await layerhop.quote({ ...params, referrer: "0x2222222222222222222222222222222222222222" });

EVM referrers are stored lowercased. The referrer is attached to each quoteId in the response, and recorded when you build the order with POST /v1/orders.

Tip

referrer is not the same as integrator. integrator selects a registered partner fee; referrer only records which wallet sent the user, and adds no fee.

How do I read a wallet's referral stats?#

GET /v1/referrals/{address} is public and read-only (no key; the usual per-IP rate limit applies):

Terminal
curl https://api.layerhop.com/v1/referrals/0x2222222222222222222222222222222222222222
JSON
{
  "address": "0x2222222222222222222222222222222222222222",
  "referredOrders": 12,
  "filledOrders": 9,
  "referredVolumeUsd": 4210.55,
  "rewardBps": 0,
  "estimatedRewardsUsd": 0
}
Field Meaning
referredOrders Live orders built with this referrer (test-mode orders are excluded)
filledOrders The filled ones
referredVolumeUsd Filled volume in USD, at the current price of each source token (not the price at fill time). Tokens without a price count as $0. Rounded to cents
rewardBps The referral reward rate, in bps of filled volume. 0 = rewards off
estimatedRewardsUsd referredVolumeUsd × rewardBps / 10000; 0 while rewardBps is 0. An estimate, not a balance

The answer may be cached for up to 30 seconds. An address that is not an EVM or Solana wallet returns INVALID_PARAMS. A self-hosted API without a database answers zeros.

Last updated