import * as Chain from './Chain.js' import * as Route from './Route.js' import * as Token from './Token.js' const base = Chain.from({ id: 'eip155:8453', name: 'Base', slug: 'base' }) const ethereum = Chain.from({ id: 'eip155:1', name: 'Ethereum', slug: 'ethereum' }) const tempo = Chain.from({ id: 'eip155:4217', name: 'Tempo', slug: 'tempo' }) const usdc = Token.from({ chains: { [base.id]: { address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6, standard: 'ERC-20', }, [ethereum.id]: { address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', decimals: 6, standard: 'ERC-20', }, }, currency: 'USD', name: 'USD Coin', slug: 'usdc', symbol: 'USDC', }) const usdce = Token.from({ chains: { [tempo.id]: { address: '0x20c000000000000000000000b9537d11c60e8b50', decimals: 6, standard: 'TIP-20', }, }, currency: 'USD', name: 'Bridged USDC (Stargate)', slug: 'usdce', symbol: 'USDC.e', }) describe('from', () => { test('expands source tokens into destination routes', () => { expect( Route.from({ destination: tempo({ tokens: [usdce] }), sources: [ethereum({ tokens: [usdc] }), base({ tokens: [usdc] })], }), ).toEqual([ { destination: expect.objectContaining({ address: '0x20c000000000000000000000b9537d11c60e8b50', }), source: expect.objectContaining({ address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', }), }, { destination: expect.objectContaining({ address: '0x20c000000000000000000000b9537d11c60e8b50', }), source: expect.objectContaining({ address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', }), }, ]) }) })