Function: sourceToDestTokenAddresses()
sourceToDestTokenAddresses<
S>(source:Chain,destChainSelector:bigint,onRamp:string,sourceTokenAmount:S):Promise<S& {destTokenAddress:string;sourcePoolAddress:string;sourceTokenAddress:string; }>
Defined in: requests.ts:458
Map source token to its pool address and destination token address.
Resolves token routing by querying the TokenAdminRegistry and TokenPool to find the corresponding destination chain token.
Type Parameters
| Type Parameter |
|---|
S extends { token: string; } |
Parameters
| Parameter | Type | Description |
|---|---|---|
source | Chain | Source chain instance |
destChainSelector | bigint | Destination chain selector |
onRamp | string | OnRamp contract address |
sourceTokenAmount | S | Token amount object containing token and amount |
Returns
Promise<S & { destTokenAddress: string; sourcePoolAddress: string; sourceTokenAddress: string; }>
Extended token amount with sourcePoolAddress, sourceTokenAddress, and destTokenAddress
Throws
CCIPTokenNotInRegistryError if token is not registered in TokenAdminRegistry
Example
TypeScript
import { sourceToDestTokenAddresses, EVMChain } from '@chainlink/ccip-sdk'
const source = await EVMChain.fromUrl('https://rpc.sepolia.org')
const tokenAmount = await sourceToDestTokenAddresses(
source,
destChainSelector,
'0xOnRamp...',
{ token: '0xLINK...', amount: 1000000000000000000n }
)
console.log(`Pool: ${tokenAmount.sourcePoolAddress}`)
console.log(`Dest token: ${tokenAmount.destTokenAddress}`)