Skip to main content
Version: 1.16.1

Function: getSourceTokenFromExtraData()

getSourceTokenFromExtraData(extraData: string | undefined, family: ChainFamily): string | undefined

Defined in: utils.ts:327

Reads the source token a multi-token pool sends in its destPoolData/extraData (abi.encode(uint256 decimals, bytes sourceToken, bytes additionalPoolData)). Single-token pools send no source token: their 0- or 32-byte payloads give undefined, as do other pools' payloads.

Parameters​

ParameterTypeDescription
extraDatastring | undefinedThe transfer's extraData/destPoolData.
familyChainFamilyThe source chain's family, to decode the source token address.

Returns​

string | undefined

The source token address, or undefined when the pool data does not carry one.