UNPKG

@subwallet/invariant-vara-sdk

Version:

<div align="center"> <h1>⚡Invariant protocol⚡</h1> <p> <a href="https://invariant.app/math-spec-vara.pdf">MATH SPEC 📄</a> | <a href="https://discord.gg/VzS3C9wR">DISCORD 🌐</a> | </p> </div>

33 lines (32 loc) 896 B
import { assert } from 'chai'; import { isTokenX } from './utils'; export const objectEquals = (object, expectedObject, keys) => { for (const key in object) { if (!keys.includes(key)) { assert.deepEqual(object[key], expectedObject[key]); } } }; export const sortTokens = (tokenX, tokenY) => { return isTokenX(tokenX, tokenY) ? [tokenX, tokenY] : [tokenY, tokenX]; }; export const assertThrowsAsync = async (fn, word) => { try { await fn; } catch (e) { if (word) { const err = e.toString(); console.log(err); const regex = new RegExp(`${word}$`); if (!regex.test(err)) { console.log(err); throw new Error('Invalid Error message'); } } return; } throw new Error('Function did not throw error'); };