UNPKG

@noves/noves-sdk

Version:
91 lines (79 loc) 3.32 kB
/** * 1.5.0 Release Test — Core Pricing APIs (regression) * * Validates that all Pricing ecosystems still work: * - EVM, SVM, UTXO, Move, Cosmos * - getChains(), getPrice(), getPriceFromPool() */ import { Pricing, PriceType } from '../dist/index'; import { section, pass, fail, runTest, skip } from './helpers'; const API_KEY = process.env.NOVES_API_KEY!; export async function testCorePricing() { section('CORE: Pricing APIs (Regression)'); // ===== EVM Pricing ===== await runTest('Pricing.EVM.getChains()', async () => { const pricing = Pricing.evm(API_KEY); const chains = await pricing.getChains(); if (!chains) throw new Error('EVM Pricing getChains() empty'); pass('Pricing.EVM.getChains()', 'OK'); }); await runTest('Pricing.EVM.getPrice(eth, WETH)', async () => { const pricing = Pricing.evm(API_KEY); const price = await pricing.getPrice( 'eth', '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' // WETH ); if (!price) throw new Error('EVM getPrice returned null'); pass('Pricing.EVM.getPrice()', `Price data received: ${JSON.stringify(price).substring(0, 100)}`); }); // ===== SVM Pricing ===== await runTest('Pricing.SVM.getChains()', async () => { const pricing = Pricing.svm(API_KEY); const chains = await pricing.getChains(); if (!chains) throw new Error('SVM Pricing getChains() empty'); pass('Pricing.SVM.getChains()', 'OK'); }); await runTest('Pricing.SVM.getPrice(solana, SOL)', async () => { const pricing = Pricing.svm(API_KEY); const price = await pricing.getPrice( 'solana', 'So11111111111111111111111111111111111111112' // Wrapped SOL ); if (!price) throw new Error('SVM getPrice returned null'); pass('Pricing.SVM.getPrice()', `Price data: ${JSON.stringify(price).substring(0, 100)}`); }); // ===== UTXO Pricing ===== await runTest('Pricing.UTXO.getChains()', async () => { const pricing = Pricing.utxo(API_KEY); const chains = await pricing.getChains(); if (!chains) throw new Error('UTXO Pricing getChains() empty'); pass('Pricing.UTXO.getChains()', 'OK'); }); await runTest('Pricing.UTXO.getPrice(btc)', async () => { const pricing = Pricing.utxo(API_KEY); const price = await pricing.getPrice('btc', 'btc'); if (!price) throw new Error('UTXO getPrice returned null'); pass('Pricing.UTXO.getPrice()', `Price data: ${JSON.stringify(price).substring(0, 100)}`); }); // ===== Move Pricing ===== await runTest('Pricing.Move.getChains()', async () => { const pricing = Pricing.move(API_KEY); const chains = await pricing.getChains(); if (!chains) throw new Error('Move Pricing getChains() empty'); pass('Pricing.Move.getChains()', `OK`); }); // ===== Cosmos Pricing ===== await runTest('Pricing.Cosmos.getChains()', async () => { const pricing = Pricing.cosmos(API_KEY); const chains = await pricing.getChains(); if (!chains) throw new Error('Cosmos Pricing getChains() empty'); pass('Pricing.Cosmos.getChains()', 'OK'); }); // ===== PriceType export ===== await runTest('PriceType: export check', async () => { if (PriceType === undefined) { throw new Error('PriceType not exported'); } pass('PriceType: export', `PriceType enum is exported`); }); }