Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m35s
CI/CD Pipeline / Security Scanning (push) Successful in 2m58s
CI/CD Pipeline / Lint and Format (push) Failing after 40s
CI/CD Pipeline / Terraform Validation (push) Failing after 24s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 25s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 56s
Validation / validate-genesis (push) Successful in 32s
Validation / validate-terraform (push) Failing after 30s
Validation / validate-kubernetes (push) Failing after 10s
Validation / validate-smart-contracts (push) Failing after 10s
Validation / validate-security (push) Failing after 1m23s
Validation / validate-documentation (push) Failing after 17s
Verify Deployment / Verify Deployment (push) Failing after 55s
Normalize /report/token-list to checksummed addresses, version objects, and extensions bag; add pinned static ethereum-mainnet list endpoint. Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
import {
|
|
buildUniswapTokenList,
|
|
checksumTokenAddress,
|
|
normalizeTokenListVersion,
|
|
toUniswapTokenListToken,
|
|
} from './uniswap-token-list';
|
|
|
|
describe('uniswap-token-list utils', () => {
|
|
it('normalizes string versions into major/minor/patch objects', () => {
|
|
expect(normalizeTokenListVersion('1.2.3')).toEqual({ major: 1, minor: 2, patch: 3 });
|
|
expect(normalizeTokenListVersion({ major: 4, minor: 5, patch: 6 })).toEqual({
|
|
major: 4,
|
|
minor: 5,
|
|
patch: 6,
|
|
});
|
|
});
|
|
|
|
it('moves non-schema token fields into extensions and checksums addresses', () => {
|
|
const token = toUniswapTokenListToken(
|
|
{
|
|
chainId: 1,
|
|
address: '0x2de5f116bfce3d0f922d9c8351e0c5fc24b9284a',
|
|
symbol: 'cWUSDC',
|
|
name: 'USD Coin (Compliant Wrapped ISO-4217 M1)',
|
|
decimals: 6,
|
|
logoURI: 'https://d-bis.org/tokens/cwusdc.svg',
|
|
type: 'w',
|
|
registryFamily: 'iso4217',
|
|
originalLogoURI: 'https://example.com/logo.svg',
|
|
},
|
|
{ displayNames: { cWUSDC: 'Wrapped cUSDC' } }
|
|
);
|
|
|
|
expect(token).toMatchObject({
|
|
chainId: 1,
|
|
address: '0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a',
|
|
symbol: 'cWUSDC',
|
|
name: 'Wrapped cUSDC',
|
|
decimals: 6,
|
|
logoURI: 'https://d-bis.org/tokens/cwusdc.svg',
|
|
extensions: {
|
|
type: 'w',
|
|
registryFamily: 'iso4217',
|
|
originalLogoURI: 'https://example.com/logo.svg',
|
|
},
|
|
});
|
|
expect(token).not.toHaveProperty('type');
|
|
expect(token).not.toHaveProperty('registryFamily');
|
|
expect(checksumTokenAddress('0x2de5f116bfce3d0f922d9c8351e0c5fc24b9284a')).toBe(
|
|
'0x2de5F116bFcE3d0f922d9C8351e0c5Fc24b9284a'
|
|
);
|
|
});
|
|
|
|
it('builds a schema-compliant list envelope', () => {
|
|
const list = buildUniswapTokenList({
|
|
name: 'DBIS Ethereum Mainnet GRU',
|
|
version: '1.1.0',
|
|
timestamp: '2026-06-06T00:00:00.000Z',
|
|
logoURI: 'https://d-bis.org/tokens/cwusdc.svg',
|
|
tokens: [
|
|
{
|
|
chainId: 1,
|
|
address: '0x2de5f116bfce3d0f922d9c8351e0c5fc24b9284a',
|
|
symbol: 'cWUSDC',
|
|
name: 'Wrapped cUSDC',
|
|
decimals: 6,
|
|
logoURI: 'https://d-bis.org/tokens/cwusdc.svg',
|
|
},
|
|
],
|
|
});
|
|
|
|
expect(list.version).toEqual({ major: 1, minor: 1, patch: 0 });
|
|
expect(Array.isArray(list.tokens)).toBe(true);
|
|
expect((list.tokens as unknown[]).length).toBe(1);
|
|
});
|
|
});
|