Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

setReferral

Set a referrer/referee mapping for fee sharing.

Links the referee to a chain of up to five upstream referrers; each fill the referee pays goes through the per-level commission split described in protocol book: perps/6-referral §5. Constraints: a user cannot refer themselves, the referrer must already have opted in via setFeeShareRatio, and the relationship is immutable once stored.

Signature

function setReferral(
  client: Client<Signer>,
  parameters: {
    sender: Address
    referrer: number
    referee: number
  },
): Promise<{ hash: Uint8Array } & TxData>

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
 
await client.setReferral({ sender, referrer: 42, referee: 99 })

Parameters

senderAddress. The submitting account.

referrernumber. Referrer's user index.

refereenumber. Referee's user index.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

See also