UNPKG

@premia/pair-lists

Version:

📚 The Token Pair Lists specification

49 lines (48 loc) • 1.77 kB
import { PairInfo, TokenInfo } from './types'; export declare type TokenInfoChangeKey = Exclude<keyof TokenInfo, 'address' | 'chainId' | 'priceOracleAddress'>; export declare type TokenInfoChanges = Array<TokenInfoChangeKey>; export declare type PairInfoChangeKey = Exclude<keyof PairInfo, 'base' | 'quote' | 'priceOracleAddress'>; export declare type PairInfoChanges = Array<PairInfoChangeKey>; /** * Differences between a base list and an updated list. */ export interface PairListDiff { /** * Tokens from updated with chainId/address/oracle not present in base list */ readonly addedTokens: TokenInfo[]; /** * Tokens from base with chainId/address/oracle not present in the updated list */ readonly removedTokens: TokenInfo[]; /** * Pairs from updated with chainId/address/oracle not present in base list */ readonly addedPairs: PairInfo[]; /** * Pairs from base with chainId/address/oracle not present in the updated list */ readonly removedPairs: PairInfo[]; /** * The token info that changed */ readonly changedTokens: { [chainId: number]: { [address: string]: TokenInfoChanges; }; }; /** * The pair info that changed */ readonly changedPairs: { [chainId: number]: { [address: string]: PairInfoChanges; }; }; } /** * Computes the diff of a token list where the first argument is the base and the second argument is the updated list. * @param base base list * @param update updated list */ export declare function diffPairLists(basePairs: PairInfo[], updatePairs: PairInfo[], baseTokens: TokenInfo[], updateTokens: TokenInfo[]): PairListDiff;