@somnia-chain/markets-sdk


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

Type Alias: PerpFundingPayer

PerpFundingPayer = { funded: true; payer: Address; } | { funded: false; reason: "dormant" | "unlinked" | "isMain"; }

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

Whether a child's next position-increasing order would draw on a main's wallet, and whose.

A discriminated union rather than a bare address, because zero from quoteFundingPayer collapses three genuinely different situations that a UI must not render identically: the rail is dormant, this wallet is unlinked, or this wallet IS a main. Narrow on funded first.

Union Members

Type Literal

{ funded: true; payer: Address; }

funded

funded: true

A main would be debited for whatever this account's own wallet cannot cover.

payer

payer: Address

The main whose wallet would be debited. This is the live resolution, not the snapshot a past pull recorded — see PerpMainFunding.payer for that, and note the two can differ after an unlink and re-link.


Type Literal

{ funded: false; reason: "dormant" | "unlinked" | "isMain"; }

funded

funded: false

No main would be debited. reason says which of the three cases applies; only unlinked is something the user can change by linking.

reason

reason: "dormant" | "unlinked" | "isMain"

  • dormant — the bank holds no registry address, so the feature is off for everyone on this deployment. Linking would not help.
  • unlinked — the rail is armed but this wallet has no main.
  • isMain — this wallet resolves to itself. Mains fund children, not the reverse; funding flows main->child only.