@somnia-chain/markets-sdk


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

Interface: PortfolioFundingEvent

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:86

External capital entering or leaving the wallet — a bridge delivery, a transfer from another wallet, a withdrawal.

Funding events refine the MWRR capital base ONLY. They never touch the equity curve, PnL, or volume: moving money into an account is not profit, and it is not a trade.

Venue fills are NOT funding. A trade's settlement transfer is an internal rearrangement the trade event already carries, so a caller sourcing funding from raw token transfers MUST exclude transfers whose counterparty is a venue contract (pool, router, settlement) or the same capital is counted twice.

These are caller-supplied because the SDK cannot derive them: the indexer has no wallet token-transfer entity, and the public Somnia RPC caps eth_getLogs at 1,000 blocks. Source them from app records, bridge history, or a private RPC scan, valued in USD at the event time.

Properties

kind

kind: "funding"

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:88

Event kind.


timestamp

timestamp: number

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:90

Event time (ms).


direction

direction: "in" | "out"

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:92

Whether capital entered or left the wallet.


valueUsd

valueUsd: number

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:94

Absolute value moved, human USD units (positive).


chainId?

optional chainId?: number

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:102

Numeric chain id the movement happened on. Set it, with transferId and counterpartyChainId, on a BRIDGE leg so a multi-chain exchange can pair the origin and destination legs of one transfer between its own chains and drop both — see netInternalTransfers. Optional; a plain deposit or withdrawal leaves all three unset.


transferId?

optional transferId?: string

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:108

The bridge transfer both legs belong to (the warp-route message id, or any id the app assigns to one transfer). Legs with the same id and opposite direction are one transfer.


counterpartyChainId?

optional counterpartyChainId?: number

Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:110

The chain the other leg of a bridge transfer lands on (out) or came from (in).