@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / PerpMainFunding

Interface: PerpMainFunding

Defined in: packages/sdk/src/perp/linkedWallet.ts:85

The outstanding claim against a child, and who it is owed to.

What a main funds can be BORROWED, NEVER WITHDRAWN: withdraw pays the child at most balance - principal, so a compromised child key can trade the money and lose it but cannot take it out.

Properties

principal

principal: bigint

Defined in: packages/sdk/src/perp/linkedWallet.ts:95

Principal a main has funded and not yet recovered, in collateral units. Zero means nothing is outstanding.

It is NOT a segregated bucket. The child's own money and its main's are one fungible balance, and the claim is clamped to min(principal, balance) at flat moments — so the child's own contribution is the JUNIOR tranche and a loss eats it first. A child that genuinely lost the money does not owe it forever.


payer

payer: `0x${string}`

Defined in: packages/sdk/src/perp/linkedWallet.ts:104

The payer recorded AT FUNDING TIME, or zero when nothing is outstanding.

Snapshotted deliberately: both routes home settle against this address, so an unlink or re-link between the pull and the repayment cannot misroute the money to whoever happens to be linked later. When this disagrees with the LIVE resolution (PerpFundingPayer), THIS is who gets repaid.


withdrawableFromPrincipal

readonly withdrawableFromPrincipal: 0n

Defined in: packages/sdk/src/perp/linkedWallet.ts:111

How much of principal the child could withdraw: always zero while a claim stands, and present as a field only so a caller does not have to re-derive the rule from prose. Included because "why can I not withdraw my balance" is the commonest question this surface has to answer.