@uniswap/token-list-bridge-utils 0.1.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +674 -0
- package/README.md +17 -0
- package/dist/arb-token-lists/server/app.d.ts +1 -0
- package/dist/arb-token-lists/src/lib/getClargs.d.ts +8 -0
- package/dist/arb-token-lists/src/lib/graph.d.ts +2 -0
- package/dist/arb-token-lists/src/lib/instantiate_bridge.d.ts +15 -0
- package/dist/arb-token-lists/src/lib/token_list_gen.d.ts +23 -0
- package/dist/arb-token-lists/src/lib/types.d.ts +36 -0
- package/dist/arb-token-lists/src/lib/utils.d.ts +18 -0
- package/dist/arb-token-lists/src/main.d.ts +1 -0
- package/dist/constants/chainId.d.ts +10 -0
- package/dist/constants/tokens.d.ts +5 -0
- package/dist/fixtures/index.d.ts +24 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +8 -0
- package/dist/providers/ArbitrumMappingProvider.d.ts +11 -0
- package/dist/providers/MappingProvider.d.ts +4 -0
- package/dist/providers/OptimismMappingProvider.d.ts +10 -0
- package/dist/providers/PolygonMappingProvider.d.ts +9 -0
- package/dist/providers/index.d.ts +5 -0
- package/dist/token-list-bridge-utils.cjs.development.js +2217 -0
- package/dist/token-list-bridge-utils.cjs.development.js.map +1 -0
- package/dist/token-list-bridge-utils.cjs.production.min.js +2 -0
- package/dist/token-list-bridge-utils.cjs.production.min.js.map +1 -0
- package/dist/token-list-bridge-utils.esm.js +2201 -0
- package/dist/token-list-bridge-utils.esm.js.map +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/verify.d.ts +9 -0
- package/package.json +68 -0
- package/src/arb-token-lists/.env.sample +4 -0
- package/src/arb-token-lists/.eslintrc.js +43 -0
- package/src/arb-token-lists/.gitignore +4 -0
- package/src/arb-token-lists/package.json +40 -0
- package/src/arb-token-lists/readme.md +14 -0
- package/src/arb-token-lists/server/app.ts +21 -0
- package/src/arb-token-lists/src/Assets/coingecko_uris.json +5108 -0
- package/src/arb-token-lists/src/Assets/logo_uris.json +44 -0
- package/src/arb-token-lists/src/WarningList/warningTokens.json +290 -0
- package/src/arb-token-lists/src/lib/getClargs.ts +32 -0
- package/src/arb-token-lists/src/lib/graph.ts +116 -0
- package/src/arb-token-lists/src/lib/instantiate_bridge.ts +35 -0
- package/src/arb-token-lists/src/lib/token_list_gen.ts +334 -0
- package/src/arb-token-lists/src/lib/types.ts +44 -0
- package/src/arb-token-lists/src/lib/utils.ts +285 -0
- package/src/arb-token-lists/src/main.ts +54 -0
- package/src/arb-token-lists/tsconfig.json +20 -0
- package/src/arb-token-lists/update_all +6 -0
- package/src/arb-token-lists/yarn.lock +4273 -0
- package/src/constants/chainId.ts +13 -0
- package/src/constants/tokens.ts +31 -0
- package/src/fixtures/index.ts +104 -0
- package/src/index.test.ts +211 -0
- package/src/index.ts +92 -0
- package/src/providers/ArbitrumMappingProvider.ts +28 -0
- package/src/providers/MappingProvider.ts +5 -0
- package/src/providers/OptimismMappingProvider.ts +13 -0
- package/src/providers/PolygonMappingProvider.ts +127 -0
- package/src/providers/index.ts +17 -0
- package/src/utils.ts +21 -0
- package/src/verify.test.ts +19 -0
- package/src/verify.ts +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# DTS User Guide
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
DTS scaffolds your new library inside `/src`.
|
|
6
|
+
|
|
7
|
+
To run DTS, use:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm start # or yarn start
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
|
|
14
|
+
|
|
15
|
+
To do a one-off build, use `npm run build` or `yarn build`.
|
|
16
|
+
|
|
17
|
+
To run tests, use `npm test` or `yarn test`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { providers } from 'ethers';
|
|
2
|
+
import { MultiCaller, TokenBridger } from "arb-ts";
|
|
3
|
+
export declare const getNetworkConfig: () => Promise<{
|
|
4
|
+
l1: {
|
|
5
|
+
network: import("arb-ts").L1Network;
|
|
6
|
+
provider: providers.JsonRpcProvider;
|
|
7
|
+
multiCaller: MultiCaller;
|
|
8
|
+
};
|
|
9
|
+
l2: {
|
|
10
|
+
network: import("arb-ts").L2Network;
|
|
11
|
+
provider: providers.JsonRpcProvider;
|
|
12
|
+
multiCaller: MultiCaller;
|
|
13
|
+
};
|
|
14
|
+
tokenBridger: TokenBridger;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { ArbTokenList, EtherscanList } from './types';
|
|
3
|
+
export interface ArbificationOptions {
|
|
4
|
+
overwriteCurrentList: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface L2ToL1GatewayAddresses {
|
|
7
|
+
[contractAddress: string]: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const generateTokenList: (l1TokenList: TokenList, prevArbTokenList?: ArbTokenList | undefined, options?: {
|
|
10
|
+
/**
|
|
11
|
+
* Append all tokens from the original l1TokenList to the output list.
|
|
12
|
+
*/
|
|
13
|
+
includeAllL1Tokens?: boolean | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Append all unbridged tokens from original l1TokenList to the output list.
|
|
16
|
+
*/
|
|
17
|
+
includeUnbridgedL1Tokens?: boolean | undefined;
|
|
18
|
+
getAllTokensInNetwork?: boolean | undefined;
|
|
19
|
+
} | undefined) => Promise<ArbTokenList>;
|
|
20
|
+
export declare const arbifyL1List: (pathOrUrl: string) => Promise<void>;
|
|
21
|
+
export declare const updateArbifiedList: (pathOrUrl: string) => Promise<void>;
|
|
22
|
+
export declare const updateLogoURIs: (path: string) => Promise<void>;
|
|
23
|
+
export declare const arbListtoEtherscanList: (arbList: ArbTokenList) => EtherscanList;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TokenInfo, TokenList } from '@uniswap/token-lists';
|
|
2
|
+
export interface ArbTokenInfo extends Omit<TokenInfo, 'extensions'> {
|
|
3
|
+
extensions?: {
|
|
4
|
+
bridgeInfo: {
|
|
5
|
+
[destinationChainID: string]: {
|
|
6
|
+
tokenAddress: string;
|
|
7
|
+
originBridgeAddress: string;
|
|
8
|
+
destBridgeAddress: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface ArbTokenList extends Omit<TokenList, 'tokens'> {
|
|
14
|
+
tokens: ArbTokenInfo[];
|
|
15
|
+
}
|
|
16
|
+
export interface EtherscanToken {
|
|
17
|
+
l1Address: string | null;
|
|
18
|
+
l2Address: string;
|
|
19
|
+
l1GatewayAddress: string | null;
|
|
20
|
+
l2GatewayAddress: string | null;
|
|
21
|
+
}
|
|
22
|
+
export declare type EtherscanList = EtherscanToken[];
|
|
23
|
+
export interface GraphTokenResult {
|
|
24
|
+
l2Address: string | null;
|
|
25
|
+
joinTableEntry: [
|
|
26
|
+
{
|
|
27
|
+
gateway: {
|
|
28
|
+
gatewayAddr: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
l1TokenAddr: string;
|
|
33
|
+
}
|
|
34
|
+
export interface GraphTokensResult {
|
|
35
|
+
tokens: GraphTokenResult[];
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { MultiCaller } from 'arb-ts';
|
|
3
|
+
import { ArbTokenList } from './types';
|
|
4
|
+
export declare const listNameToFileName: (name: string) => string;
|
|
5
|
+
export declare const listNameToArbifiedListName: (name: string) => string;
|
|
6
|
+
export declare const getL2TokenAddressesFromL1: (l1TokenAddresses: string[], multiCaller: MultiCaller, l1GatewayRouterAddress: string) => Promise<(string | undefined)[]>;
|
|
7
|
+
export declare const getL2TokenAddressesFromL2: (l1TokenAddresses: string[], multiCaller: MultiCaller, l2GatewayRouterAddress: string) => Promise<(string | undefined)[]>;
|
|
8
|
+
export declare const getLogoUri: (l1TokenAddress: string) => Promise<string | undefined>;
|
|
9
|
+
export declare const getTokenListObjFromUrl: (url: string) => Promise<TokenList>;
|
|
10
|
+
export declare const getTokenListObjFromLocalPath: (path: string) => Promise<TokenList>;
|
|
11
|
+
export declare const tokenListIsValid: (tokenList: ArbTokenList | TokenList) => boolean;
|
|
12
|
+
export declare const validateTokenListWithErrorThrowing: (tokenList: ArbTokenList | TokenList) => boolean;
|
|
13
|
+
export declare const removeInvalidTokensFromList: (tokenList: ArbTokenList | TokenList) => ArbTokenList | TokenList;
|
|
14
|
+
export declare const getTokenListObj: (pathOrUrl: string) => Promise<TokenList>;
|
|
15
|
+
export declare const isArbTokenList: (obj: any) => void;
|
|
16
|
+
export declare const isTokenList: (obj: any) => void;
|
|
17
|
+
export declare const sanitizeString: (str: string) => string;
|
|
18
|
+
export declare const excludeList: string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TokenInfo, TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { ChainId } from '../constants/chainId';
|
|
3
|
+
export declare const Tokens: Partial<Record<ChainId, Record<string, TokenInfo>>>;
|
|
4
|
+
export declare const sampleL1TokenList: TokenList;
|
|
5
|
+
export declare const arbBridgeL2Address = "0x467194771dae2967aef3ecbedd3bf9a310c76c65";
|
|
6
|
+
export declare const arbBridgeL1Address = "0xd3b5b60020504bc3489d6949d545893982ba3011";
|
|
7
|
+
export declare const arbedSampleTokenList: {
|
|
8
|
+
name: string;
|
|
9
|
+
tokens: TokenInfo[];
|
|
10
|
+
timestamp: string;
|
|
11
|
+
version: import("@uniswap/token-lists").Version;
|
|
12
|
+
keywords?: string[] | undefined;
|
|
13
|
+
tags?: import("@uniswap/token-lists").Tags | undefined;
|
|
14
|
+
logoURI?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
export declare const polygonedSampleTokenList: {
|
|
17
|
+
name: string;
|
|
18
|
+
tokens: TokenInfo[];
|
|
19
|
+
timestamp: string;
|
|
20
|
+
version: import("@uniswap/token-lists").Version;
|
|
21
|
+
keywords?: string[] | undefined;
|
|
22
|
+
tags?: import("@uniswap/token-lists").Tags | undefined;
|
|
23
|
+
logoURI?: string | undefined;
|
|
24
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { ChainId } from './constants/chainId';
|
|
3
|
+
import { TokenListOrFetchableTokenList } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* Adds bridgeInfo to the given token list for Optimism, Polygon and Arbitrum.
|
|
6
|
+
* @param l1TokenListOrPathOrUrl
|
|
7
|
+
* @returns TokenList with l2 bridgeInfo filled
|
|
8
|
+
*/
|
|
9
|
+
export declare function chainify(l1TokenListOrPathOrUrl: TokenListOrFetchableTokenList): Promise<TokenList>;
|
|
10
|
+
/**
|
|
11
|
+
* Given a network and a TokenList, returns the TokenList with `extensions` filled.
|
|
12
|
+
* @param chainId chainId to operate on
|
|
13
|
+
* @param l1TokenListOrPathOrUrl either an L1 TokenList object or a path/url to a TokenList
|
|
14
|
+
* @returns L1 TokenList with `extensions` filled for the given network
|
|
15
|
+
*/
|
|
16
|
+
export declare function chainifyTokenList(chainId: ChainId, l1TokenListOrPathOrUrl: TokenListOrFetchableTokenList): Promise<TokenList>;
|
|
17
|
+
/** Merges two token lists, resolving conflicts to primary list. */
|
|
18
|
+
export declare function mergeTokenLists(primary: TokenList, secondary: TokenList): TokenList;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { MappingProvider } from './MappingProvider';
|
|
3
|
+
/**
|
|
4
|
+
* The Arbitrum team maintains an (unpublished) package to `arbify` an L1
|
|
5
|
+
* token list.
|
|
6
|
+
*
|
|
7
|
+
* The provider simply invokes this package which we host as a submodule.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ArbitrumMappingProvider implements MappingProvider {
|
|
10
|
+
provide(l1TokenList: TokenList): Promise<TokenList>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { MappingProvider } from './MappingProvider';
|
|
3
|
+
/**
|
|
4
|
+
* The Optimism L2 mapping is manually maintained by the Optimism team.
|
|
5
|
+
*
|
|
6
|
+
* This provider mostly no-ops, i.e. grabs the list and returns it.
|
|
7
|
+
*/
|
|
8
|
+
export declare class OptimismMappingProvider implements MappingProvider {
|
|
9
|
+
provide(l1TokenList: TokenList): Promise<TokenList>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TokenList } from '@uniswap/token-lists';
|
|
2
|
+
import { MappingProvider } from './MappingProvider';
|
|
3
|
+
/**
|
|
4
|
+
* The Polygon team manually maintains the mapping via user submissions at
|
|
5
|
+
* https://mapper.polygon.technology.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PolygonMappingProvider implements MappingProvider {
|
|
8
|
+
provide(l1TokenList: TokenList): Promise<TokenList>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChainId } from '../constants/chainId';
|
|
2
|
+
import { ArbitrumMappingProvider } from './ArbitrumMappingProvider';
|
|
3
|
+
import { OptimismMappingProvider } from './OptimismMappingProvider';
|
|
4
|
+
import { PolygonMappingProvider } from './PolygonMappingProvider';
|
|
5
|
+
export declare function getMappingProvider(chainId: ChainId): ArbitrumMappingProvider | OptimismMappingProvider | PolygonMappingProvider;
|