UNPKG

1.02 kBTypeScriptView Raw
1import { TokenInfo } from './types';
2export declare type TokenInfoChangeKey = Exclude<keyof TokenInfo, 'address' | 'chainId'>;
3export declare type TokenInfoChanges = Array<TokenInfoChangeKey>;
4/**
5 * Differences between a base list and an updated list.
6 */
7export interface TokenListDiff {
8 /**
9 * Tokens from updated with chainId/address not present in base list
10 */
11 readonly added: TokenInfo[];
12 /**
13 * Tokens from base with chainId/address not present in the updated list
14 */
15 readonly removed: TokenInfo[];
16 /**
17 * The token info that changed
18 */
19 readonly changed: {
20 [chainId: number]: {
21 [address: string]: TokenInfoChanges;
22 };
23 };
24}
25/**
26 * Computes the diff of a token list where the first argument is the base and the second argument is the updated list.
27 * @param base base list
28 * @param update updated list
29 */
30export declare function diffTokenLists(base: TokenInfo[], update: TokenInfo[]): TokenListDiff;