import * as Chain from './Chain.js' import * as Token from './Token.js' const base = Chain.from({ id: 'eip155:8453', name: 'Base', slug: 'base' }) describe('from', () => { test('creates a token with chain-specific metadata', () => { const token = Token.from({ chains: { [base.id]: { address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6, standard: 'ERC-20', }, }, currency: 'USD', name: 'USD Coin', slug: 'usdc', symbol: 'USDC', }) const resolved = base({ tokens: [token] }).tokens[0] expect(resolved).toMatchObject({ address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', decimals: 6, standard: 'ERC-20', symbol: 'USDC', }) expect(resolved?.chain.id).toBe('eip155:8453') }) }) describe('resolve', () => { test('rejects a token that is unavailable on the chain', () => { const token = Token.from({ chains: {}, currency: 'USD', name: 'USD Coin', slug: 'usdc', symbol: 'USDC', }) expect(() => base({ tokens: [token] })).toThrowErrorMatchingInlineSnapshot( `[Funding.Token.MissingChainError]`, ) }) })