@somnia-chain/markets-sdk / index / netInternalTransfers
Function: netInternalTransfers()
netInternalTransfers(
events,chainIds):PortfolioFundingEvent[]
Defined in: packages/sdk/src/unified/portfolioAnalytics.ts:137
Remove the bridge legs that move capital between an exchange's OWN chains from a funding list. A transfer from one configured chain to another leaves the account's capital where it was, so counting its origin leg as a withdrawal and its destination leg as a deposit distorts the capital base on both sides.
Details
- Two legs with the same
transferId, oppositedirection, and bothchainIds inchainIdsare one internal transfer: both are dropped. - An
outleg whosecounterpartyChainIdis inchainIdsbut whoseinleg is absent (still in flight, or outside the window) is dropped alone: the capital is in transit and stays in the base. - An
inleg whosecounterpartyChainIdis inchainIdsbut whoseoutleg is absent is dropped for the same reason — the capital was already in the base on the origin chain. - Every other event, including a leg to or from a chain outside
chainIds, is an external movement and passes through unchanged.
Pure: returns a new array, in the input order.
Parameters
events
readonly PortfolioFundingEvent[]
chainIds
readonly number[]