├── .commitlintrc.json
├── .editorconfig
├── .eslintignore
├── .eslintrc
├── .github
├── actions
│ └── pnpm-install
│ │ └── action.yaml
└── workflows
│ ├── publish.yaml
│ └── semantic-pr.yml
├── .gitignore
├── .husky
├── commit-msg
├── pre-commit
└── pre-push
├── .npmrc
├── .prettierrc
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── jest.config.js
├── package.json
├── pnpm-lock.yaml
├── scripts
└── prepublishOnly.js
├── src
├── api.ts
├── assets
│ └── icons
│ │ ├── bridges
│ │ ├── across.svg
│ │ ├── allbridge.svg
│ │ ├── arbitrum.svg
│ │ ├── avalanche.svg
│ │ ├── cbridge.svg
│ │ ├── celerim.svg
│ │ ├── chainflip.svg
│ │ ├── circle.svg
│ │ ├── debridge.svg
│ │ ├── glacis.svg
│ │ ├── gnosis.svg
│ │ ├── hop.svg
│ │ ├── lifi.svg
│ │ ├── mayan.svg
│ │ ├── omni.svg
│ │ ├── optimism.svg
│ │ ├── polygon.svg
│ │ ├── relay.svg
│ │ ├── squid.svg
│ │ ├── stargate.svg
│ │ ├── symbiosis.svg
│ │ └── thorswap.svg
│ │ ├── chains
│ │ ├── abstract.svg
│ │ ├── apechain.svg
│ │ ├── arbitrum.svg
│ │ ├── aurora.svg
│ │ ├── avalanche.svg
│ │ ├── base.svg
│ │ ├── bera.svg
│ │ ├── berachain.svg
│ │ ├── bitcoin.svg
│ │ ├── bitcoincash.svg
│ │ ├── blast.svg
│ │ ├── bob.svg
│ │ ├── boba.svg
│ │ ├── bsc.svg
│ │ ├── celo.svg
│ │ ├── corn.svg
│ │ ├── cronos.svg
│ │ ├── dogecoin.svg
│ │ ├── ethereum.svg
│ │ ├── etherlink.svg
│ │ ├── evmos.svg
│ │ ├── fantom.svg
│ │ ├── flare.svg
│ │ ├── fraxtal.svg
│ │ ├── fuse.svg
│ │ ├── fusion.svg
│ │ ├── gnosis.svg
│ │ ├── gravity.svg
│ │ ├── harmony.svg
│ │ ├── hyperevm.svg
│ │ ├── hyperliquid.svg
│ │ ├── imx.svg
│ │ ├── ink.svg
│ │ ├── kaia.svg
│ │ ├── katana.svg
│ │ ├── lens.svg
│ │ ├── linea.svg
│ │ ├── lisk.svg
│ │ ├── litecoin.svg
│ │ ├── mantle.svg
│ │ ├── metis.svg
│ │ ├── mode.svg
│ │ ├── moonbeam.svg
│ │ ├── moonriver.svg
│ │ ├── opbnb.svg
│ │ ├── optimism.svg
│ │ ├── polygon.svg
│ │ ├── rootstock.svg
│ │ ├── scroll.svg
│ │ ├── sei.svg
│ │ ├── solana.svg
│ │ ├── soneium.svg
│ │ ├── sonic.svg
│ │ ├── sui.svg
│ │ ├── superposition.svg
│ │ ├── swell.svg
│ │ ├── taiko.svg
│ │ ├── unichain.svg
│ │ ├── velas.svg
│ │ ├── viction.svg
│ │ ├── world.svg
│ │ ├── xdc.svg
│ │ ├── xlayer.svg
│ │ ├── zkevm.svg
│ │ └── zksync.svg
│ │ ├── exchanges
│ │ ├── aftermath.svg
│ │ ├── bebop.svg
│ │ ├── cowswap.svg
│ │ ├── dodo.svg
│ │ ├── enso.svg
│ │ ├── jupiter.svg
│ │ ├── kyberswap.svg
│ │ ├── lifidexaggregator.svg
│ │ ├── odos.svg
│ │ ├── okx.svg
│ │ ├── oneinch.svg
│ │ ├── openocean.svg
│ │ ├── stellaswap.svg
│ │ ├── superswap.svg
│ │ ├── sushi.svg
│ │ ├── velora.svg
│ │ └── zerox.svg
│ │ ├── protocols
│ │ ├── feeCollection.svg
│ │ ├── superfluid.svg
│ │ └── wrapper.svg
│ │ └── tokens
│ │ ├── USDL.svg
│ │ ├── USDT0.svg
│ │ ├── bera.svg
│ │ ├── honey.svg
│ │ ├── vlx.png
│ │ └── wbera.svg
├── bridges.ts
├── chains
│ ├── Chain.ts
│ ├── EVMChain.ts
│ ├── MVMChain.ts
│ ├── SolanaChain.ts
│ ├── UTXOChain.ts
│ ├── base.ts
│ └── index.ts
├── errors.ts
├── exchanges.ts
├── index.ts
├── step.ts
└── tokens
│ ├── base.ts
│ ├── index.ts
│ └── token.ts
├── tsconfig.base.json
├── tsconfig.build.json
├── tsconfig.json
└── tsconfig.node.json
/.commitlintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["@commitlint/config-conventional"]
3 | }
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.php]
12 | indent_style = tab
13 | indent_size = 4
14 |
15 | [*.py]
16 | charset = utf-8
17 | indent_style = space
18 | indent_size = 4
19 | end_of_line = lf
20 | insert_final_newline = true
21 | trim_trailing_whitespace = true
22 |
23 | [Makefile]
24 | indent_style = tab
25 | indent_size = 4
26 |
27 | [*.sln]
28 | indent_style = tab
29 |
30 | [*.{md,mdx}]
31 | trim_trailing_whitespace = false
32 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | *.config.js
2 | *.config.ts
3 | *.test.js
4 | *.test.ts
5 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "@typescript-eslint/parser",
3 | "extends": [
4 | "plugin:@typescript-eslint/recommended",
5 | "prettier"
6 | ],
7 | "parserOptions": {
8 | "sourceType": "module"
9 | },
10 | "rules": {
11 | "prettier/prettier": "error",
12 | "max-len": "off",
13 | "@typescript-eslint/consistent-type-imports": "warn",
14 | "@typescript-eslint/no-unused-vars": "warn",
15 | "@typescript-eslint/no-explicit-any": "warn",
16 | "curly": 2
17 | },
18 | "plugins": [
19 | "@typescript-eslint",
20 | "prettier"
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/.github/actions/pnpm-install/action.yaml:
--------------------------------------------------------------------------------
1 | name: 'PNPM install'
2 | description: 'Run pnpm install with node_modules and cache enabled'
3 |
4 | runs:
5 | using: 'composite'
6 | steps:
7 | - name: Set up pnpm
8 | uses: pnpm/action-setup@v4
9 | - name: Set up Node.js
10 | uses: actions/setup-node@v4
11 | with:
12 | node-version: lts/*
13 | registry-url: 'https://registry.npmjs.org'
14 | cache: 'pnpm' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies
15 | - name: Install dependencies
16 | env:
17 | HUSKY: '0' # By default do not run HUSKY install
18 | shell: bash
19 | run: pnpm install --frozen-lockfile
20 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yaml:
--------------------------------------------------------------------------------
1 | name: Release & Publish
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
7 | - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
8 | - 'v[0-9]+.[0-9]+.[0-9]+'
9 | workflow_dispatch:
10 |
11 | jobs:
12 | release:
13 | permissions:
14 | contents: write
15 | runs-on: ubuntu-latest
16 | steps:
17 | - name: Checkout code
18 | uses: actions/checkout@v4
19 | - name: Create GitHub Release
20 | uses: softprops/action-gh-release@v2
21 | env:
22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 | with:
24 | generate_release_notes: true
25 | name: ${{ github.ref_name }}
26 | draft: false
27 | prerelease: false
28 |
29 | publish:
30 | permissions:
31 | contents: write
32 | id-token: write
33 | runs-on: ubuntu-latest
34 | steps:
35 | - uses: actions/checkout@v4
36 | - name: Install dependencies
37 | uses: ./.github/actions/pnpm-install
38 | - name: Build
39 | run: pnpm build
40 | - name: Publish to npm
41 | run: |
42 | pnpm publish --no-git-checks --access public \
43 | ${{ contains(github.ref_name, 'alpha') && '--tag alpha' || contains(github.ref_name, 'beta') && '--tag beta' || '' }}
44 | env:
45 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46 | NPM_CONFIG_PROVENANCE: true
47 |
--------------------------------------------------------------------------------
/.github/workflows/semantic-pr.yml:
--------------------------------------------------------------------------------
1 | name: "Semantic PR Title"
2 |
3 | on:
4 | pull_request_target:
5 | types:
6 | - opened
7 | - edited
8 | - synchronize
9 | - reopened
10 |
11 | jobs:
12 | main:
13 | name: Validate PR title
14 | runs-on: ubuntu-latest
15 | permissions:
16 | pull-requests: read
17 | steps:
18 | - uses: amannn/action-semantic-pull-request@v5
19 | env:
20 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # build
2 | _cjs
3 | _esm
4 | _types
5 |
6 | # idea
7 | .idea/
8 |
9 | # Logs
10 | logs
11 | *.log
12 | npm-debug.log*
13 | yarn-debug.log*
14 | yarn-error.log*
15 | lerna-debug.log*
16 |
17 | # Diagnostic reports (https://nodejs.org/api/report.html)
18 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
19 |
20 | # Runtime data
21 | pids
22 | *.pid
23 | *.seed
24 | *.pid.lock
25 |
26 | # Directory for instrumented libs generated by jscoverage/JSCover
27 | lib-cov
28 |
29 | # Coverage directory used by tools like istanbul
30 | coverage
31 | *.lcov
32 |
33 | # nyc test coverage
34 | .nyc_output
35 |
36 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
37 | .grunt
38 |
39 | # Bower dependency directory (https://bower.io/)
40 | bower_components
41 |
42 | # node-waf configuration
43 | .lock-wscript
44 |
45 | # Compiled binary addons (https://nodejs.org/api/addons.html)
46 | build/Release
47 |
48 | # Dependency directories
49 | node_modules/
50 | jspm_packages/
51 |
52 | # Snowpack dependency directory (https://snowpack.dev/)
53 | web_modules/
54 |
55 | # TypeScript cache
56 | *.tsbuildinfo
57 |
58 | # Optional npm cache directory
59 | .npm
60 |
61 | # Optional eslint cache
62 | .eslintcache
63 |
64 | # Microbundle cache
65 | .rpt2_cache/
66 | .rts2_cache_cjs/
67 | .rts2_cache_es/
68 | .rts2_cache_umd/
69 |
70 | # Optional REPL history
71 | .node_repl_history
72 |
73 | # Output of 'npm pack'
74 | *.tgz
75 |
76 | # Yarn Integrity file
77 | .yarn-integrity
78 |
79 | # dotenv environment variables file
80 | .env
81 | .env.test
82 |
83 | # parcel-bundler cache (https://parceljs.org/)
84 | .cache
85 | .parcel-cache
86 |
87 | # Next.js build output
88 | .next
89 | out
90 |
91 | # Nuxt.js build / generate output
92 | .nuxt
93 | dist
94 |
95 | # Gatsby files
96 | .cache/
97 | # Comment in the public line in if your project uses Gatsby and not Next.js
98 | # https://nextjs.org/blog/next-9-1#public-directory-support
99 | # public
100 |
101 | # vuepress build output
102 | .vuepress/dist
103 |
104 | # Serverless directories
105 | .serverless/
106 |
107 | # FuseBox cache
108 | .fusebox/
109 |
110 | # DynamoDB Local files
111 | .dynamodb/
112 |
113 | # TernJS port file
114 | .tern-port
115 |
116 | # Stores VSCode versions used for testing VSCode extensions
117 | .vscode-test
118 |
119 | # yarn v2
120 | .yarn
121 | .pnp.*
122 |
123 | # ignore lock files of other package managers
124 | yarn.lock
125 | package-lock.json
126 |
127 | .DS_Store
128 |
--------------------------------------------------------------------------------
/.husky/commit-msg:
--------------------------------------------------------------------------------
1 | pnpm commitlint --edit $1
2 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | npm run pre-commit
2 |
--------------------------------------------------------------------------------
/.husky/pre-push:
--------------------------------------------------------------------------------
1 | npm run pre-push
2 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | auto-install-peers=false
2 | enable-pre-post-scripts=true
3 | provenance=true
4 | strict-peer-dependencies=false
5 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "semi": false,
3 | "singleQuote": true,
4 | "trailingComma": "es5",
5 | "arrowParens": "always"
6 | }
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | [](/LICENSE.md)
4 | [](https://www.npmjs.com/package/@lifi/types)
5 | [](https://www.npmjs.com/package/@lifi/types)
6 | [](https://twitter.com/lifiprotocol)
7 |
8 |
9 |
10 | # LI.FI - Types
11 |
12 | Types for the LI.FI stack.
13 |
14 | ## Summary
15 |
16 | This package contains all common types for the [LI.FI SDK](https://github.com/lifinance/sdk).
17 | Learn more about LI.FI on (https://li.fi).
18 |
19 | Check out the [Changelog](./CHANGELOG.md) to see what changed in the last releases.
20 |
21 | ## Installation
22 |
23 | ```bash
24 | pnpm add @lifi/types
25 | ```
26 |
27 | or
28 |
29 | ```bash
30 | npm install --save @lifi/types
31 | ```
32 |
33 | ## Release
34 |
35 | The package uses `standard-version` to generate a changelog based on semantic commit history. The `standard-version` package also handles version numbering.
36 |
37 | Once main is up to date with the changes to be released execute the following command on the main branch to invoke `standard-version`:
38 |
39 | ```bash
40 | pnpm release
41 | ```
42 |
43 | Then to release:
44 |
45 | ```bash
46 | git push --follow-tags origin main
47 | ```
48 |
49 | This will push a newly created git tag to the remote repository, which will trigger a github action which will publish the new version to npm
50 |
--------------------------------------------------------------------------------
/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | roots: ['/test'],
3 | testMatch: [
4 | '**/__tests__/**/*.+(ts|tsx|js)',
5 | '**/?(*.)+(spec|test).+(ts|tsx|js)',
6 | ],
7 | transform: {
8 | '^.+\\.(ts|tsx)$': ['ts-jest', { tsconfig: 'tsconfig.json' }],
9 | },
10 | }
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@lifi/types",
3 | "version": "17.18.0",
4 | "description": "Types for the LI.FI stack",
5 | "keywords": [
6 | "sdk",
7 | "ethereum",
8 | "dapp",
9 | "bridge",
10 | "swap",
11 | "web3",
12 | "lifi",
13 | "ethers",
14 | "cross-chain",
15 | "defi",
16 | "web3-react",
17 | "cross-chain-applications",
18 | "cross-chain-bridge",
19 | "bridge-aggregation",
20 | "multi-chain",
21 | "metamask"
22 | ],
23 | "homepage": "https://github.com/lifinance/types",
24 | "bugs": {
25 | "url": "https://github.com/lifinance/types"
26 | },
27 | "repository": {
28 | "type": "git",
29 | "url": "git+ssh://git@github.com/lifinance/types.git"
30 | },
31 | "license": "Apache-2.0",
32 | "author": "LI.FI ",
33 | "type": "module",
34 | "exports": {
35 | ".": {
36 | "types": "./src/_types/index.d.ts",
37 | "import": "./src/_esm/index.js",
38 | "default": "./src/_cjs/index.js"
39 | },
40 | "./package.json": "./package.json"
41 | },
42 | "main": "./src/_cjs/index.js",
43 | "module": "./src/_esm/index.js",
44 | "types": "./src/_types/index.d.ts",
45 | "typings": "./src/_types/index.d.ts",
46 | "sideEffects": false,
47 | "files": [
48 | "src",
49 | "!src/assets",
50 | "!src/**/*.tsbuildinfo"
51 | ],
52 | "scripts": {
53 | "build": "pnpm clean && pnpm build:cjs && pnpm build:esm && pnpm build:types",
54 | "build:cjs": "tsc --project ./tsconfig.build.json --module commonjs --outDir ./src/_cjs --removeComments --verbatimModuleSyntax false && printf '{\"type\":\"commonjs\"}' > ./src/_cjs/package.json",
55 | "build:esm": "tsc --project ./tsconfig.build.json --module es2015 --outDir ./src/_esm && printf '{\"type\": \"module\",\"sideEffects\":false}' > ./src/_esm/package.json",
56 | "build:types": "tsc --project ./tsconfig.build.json --module esnext --declarationDir ./src/_types --emitDeclarationOnly --declaration --declarationMap",
57 | "clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo src/tsconfig.build.tsbuildinfo src/_esm src/_cjs src/_types",
58 | "lint:fix": "eslint --ext .tsx --ext .ts ./src --fix",
59 | "package": "npm run build && npm pack",
60 | "postinstall": "husky",
61 | "postpack": "pinst --enable",
62 | "pre-commit": "lint-staged",
63 | "pre-push": "pnpm build",
64 | "prepublishOnly": "pnpm node scripts/prepublishOnly.js",
65 | "prepack": "pinst --disable",
66 | "prettier:fix": "prettier --write ./src/.",
67 | "release": "standard-version -a",
68 | "release:alpha": "standard-version -a --prerelease alpha --skip.changelog",
69 | "release:beta": "standard-version -a --prerelease beta --skip.changelog",
70 | "typecheck": "tsc --noEmit"
71 | },
72 | "lint-staged": {
73 | "src/**/*.{ts,tsx}": [
74 | "pnpm run lint:fix",
75 | "pnpm run prettier:fix"
76 | ]
77 | },
78 | "dependencies": {
79 | "viem": "^2.24.3"
80 | },
81 | "devDependencies": {
82 | "@commitlint/cli": "^19.8.0",
83 | "@commitlint/config-conventional": "^19.8.0",
84 | "@types/fs-extra": "^11.0.4",
85 | "@typescript-eslint/eslint-plugin": "^7.18.0",
86 | "@typescript-eslint/parser": "^7.18.0",
87 | "eslint": "^8.57.1",
88 | "eslint-config-prettier": "^9.1.0",
89 | "eslint-plugin-prettier": "^5.2.5",
90 | "fs-extra": "^11.2.0",
91 | "husky": "^9.1.7",
92 | "lint-staged": "^15.5.0",
93 | "pinst": "^3.0.0",
94 | "prettier": "^3.5.3",
95 | "standard-version": "^9.5.0",
96 | "typescript": "^5.8.2"
97 | },
98 | "packageManager": "pnpm@10.7.0+sha512.6b865ad4b62a1d9842b61d674a393903b871d9244954f652b8842c2b553c72176b278f64c463e52d40fff8aba385c235c8c9ecf5cc7de4fd78b8bb6d49633ab6",
99 | "publishConfig": {
100 | "access": "public"
101 | },
102 | "standard-version": {
103 | "scripts": {
104 | "postbump": "git add ."
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/scripts/prepublishOnly.js:
--------------------------------------------------------------------------------
1 | import pkg from 'fs-extra'
2 | import path from 'path'
3 | import { fileURLToPath } from 'url'
4 |
5 | const { outputFileSync, readJsonSync, writeJsonSync } = pkg
6 | const __filename = fileURLToPath(import.meta.url)
7 | const __dirname = path.dirname(__filename)
8 |
9 | generatePackageJson()
10 |
11 | // Generates a package.json to be published to NPM with only the necessary fields.
12 | function generatePackageJson() {
13 | const packageJsonPath = path.join(__dirname, '../package.json')
14 | const tmpPackageJson = readJsonSync(packageJsonPath)
15 |
16 | writeJsonSync(`${packageJsonPath}.tmp`, tmpPackageJson, { spaces: 2 })
17 |
18 | const {
19 | name,
20 | description,
21 | dependencies,
22 | peerDependencies,
23 | peerDependenciesMeta,
24 | version,
25 | files,
26 | exports: exports_,
27 | // NOTE: We explicitly don't want to publish the type field. We create a separate package.json for `src/cjs` and `src/esm` that has the type field.
28 | // type,
29 | main,
30 | module,
31 | types,
32 | typings,
33 | typesVersions,
34 | sideEffects,
35 | license,
36 | repository,
37 | authors,
38 | keywords,
39 | } = tmpPackageJson
40 |
41 | // Generate proxy packages for each export.
42 | const files_ = [...files]
43 | for (const [key, value] of Object.entries(exports_)) {
44 | if (typeof value === 'string') {
45 | continue
46 | }
47 | if (key === '.') {
48 | continue
49 | }
50 | if (!value.default || !value.import) {
51 | throw new Error('`default` and `import` are required.')
52 | }
53 |
54 | outputFileSync(
55 | `${key}/package.json`,
56 | `{
57 | ${Object.entries(value)
58 | .map(([k, v]) => {
59 | const key = (() => {
60 | if (k === 'import') {
61 | return 'module'
62 | }
63 | if (k === 'default') {
64 | return 'main'
65 | }
66 | if (k === 'types') {
67 | return 'types'
68 | }
69 | throw new Error('Invalid key')
70 | })()
71 | return `"${key}": "${v.replace('./', '../')}"`
72 | })
73 | .join(',\n ')}
74 | }`
75 | )
76 | files_.push(key.replace('./', ''))
77 | }
78 |
79 | writeJsonSync(
80 | packageJsonPath,
81 | {
82 | name,
83 | description,
84 | dependencies,
85 | peerDependencies,
86 | peerDependenciesMeta,
87 | version,
88 | files: files_,
89 | exports: exports_,
90 | // type,
91 | main,
92 | module,
93 | types,
94 | typings,
95 | typesVersions,
96 | sideEffects,
97 | license,
98 | repository,
99 | authors,
100 | keywords,
101 | },
102 | { spaces: 2 }
103 | )
104 | }
105 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/across.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/allbridge.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/arbitrum.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/avalanche.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/cbridge.svg:
--------------------------------------------------------------------------------
1 |
20 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/celerim.svg:
--------------------------------------------------------------------------------
1 |
20 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/chainflip.svg:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/circle.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/debridge.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/glacis.svg:
--------------------------------------------------------------------------------
1 |
33 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/gnosis.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/hop.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/lifi.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/mayan.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/omni.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/optimism.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/polygon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/relay.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/squid.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/stargate.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/symbiosis.svg:
--------------------------------------------------------------------------------
1 |
17 |
--------------------------------------------------------------------------------
/src/assets/icons/bridges/thorswap.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/abstract.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/apechain.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/arbitrum.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/aurora.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/avalanche.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/base.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/bera.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/berachain.svg:
--------------------------------------------------------------------------------
1 |
12 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/bitcoin.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/bitcoincash.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/blast.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/bob.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/boba.svg:
--------------------------------------------------------------------------------
1 |
60 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/bsc.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/celo.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/corn.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/cronos.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/ethereum.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/etherlink.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/evmos.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/fantom.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/flare.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/fraxtal.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/fuse.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/fusion.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/gnosis.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/gravity.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/harmony.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/hyperevm.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/hyperliquid.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/imx.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/ink.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/kaia.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/katana.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/lens.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/linea.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/lisk.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/litecoin.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/mantle.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/metis.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/mode.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/moonbeam.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/moonriver.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/opbnb.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/optimism.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/polygon.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/rootstock.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/scroll.svg:
--------------------------------------------------------------------------------
1 |
9 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/sei.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/solana.svg:
--------------------------------------------------------------------------------
1 |
15 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/soneium.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/sonic.svg:
--------------------------------------------------------------------------------
1 |
14 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/sui.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/superposition.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/swell.svg:
--------------------------------------------------------------------------------
1 |
11 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/taiko.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/unichain.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/velas.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/viction.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/world.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/xdc.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/xlayer.svg:
--------------------------------------------------------------------------------
1 |
39 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/zkevm.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/chains/zksync.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/bebop.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/cowswap.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/dodo.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/enso.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/jupiter.svg:
--------------------------------------------------------------------------------
1 |
36 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/kyberswap.svg:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/lifidexaggregator.svg:
--------------------------------------------------------------------------------
1 |
35 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/odos.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/okx.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/oneinch.svg:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/openocean.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/stellaswap.svg:
--------------------------------------------------------------------------------
1 |
31 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/superswap.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/sushi.svg:
--------------------------------------------------------------------------------
1 |
23 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/velora.svg:
--------------------------------------------------------------------------------
1 |
13 |
--------------------------------------------------------------------------------
/src/assets/icons/exchanges/zerox.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/protocols/feeCollection.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/protocols/superfluid.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/protocols/wrapper.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/tokens/USDL.svg:
--------------------------------------------------------------------------------
1 |
31 |
--------------------------------------------------------------------------------
/src/assets/icons/tokens/USDT0.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/tokens/bera.svg:
--------------------------------------------------------------------------------
1 |
7 |
--------------------------------------------------------------------------------
/src/assets/icons/tokens/honey.svg:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/assets/icons/tokens/vlx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lifinance/types/c09878b33bfd38ac3f24a4624bb261f6b01d754d/src/assets/icons/tokens/vlx.png
--------------------------------------------------------------------------------
/src/assets/icons/tokens/wbera.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/src/bridges.ts:
--------------------------------------------------------------------------------
1 | import type { BaseToken } from './tokens/token.js'
2 |
3 | export interface Bridge {
4 | key: string
5 | name: string
6 | logoURI: string
7 | bridgeUrl?: string
8 | discordUrl?: string
9 | supportUrl?: string
10 | docsUrl?: string
11 | explorerUrl?: string
12 | analyticsUrl?: string
13 | }
14 |
15 | /**
16 | * Should not be accessed via the types package anymore
17 | * @deprecated
18 | */
19 | export interface BridgeDefinition {
20 | tool: string
21 | fromChainId: number
22 | fromToken: BaseToken
23 | toChainId: number
24 | toToken: BaseToken
25 | maximumTransfer: string
26 | minimumTransfer: string
27 | swapFeeRate: string
28 | swapFeeMinimum: string
29 | swapFeeMaximum: string
30 | }
31 |
--------------------------------------------------------------------------------
/src/chains/Chain.ts:
--------------------------------------------------------------------------------
1 | import type { CoinKey } from '../tokens/base.js'
2 | import type { ChainKey } from './base.js'
3 |
4 | export enum ChainType {
5 | EVM = 'EVM',
6 | // Solana virtual machine
7 | SVM = 'SVM',
8 | // Move virtual machine
9 | MVM = 'MVM',
10 | // Unspent transaction output (e.g. Bitcoin)
11 | UTXO = 'UTXO',
12 | }
13 |
14 | export interface _Chain {
15 | key: ChainKey
16 | chainType: ChainType
17 | name: string
18 | coin: CoinKey
19 | id: number
20 | mainnet: boolean
21 | logoURI?: string
22 | // faucetUrls is DEPRECATED - will be removed in the next breaking release
23 | faucetUrls?: string[]
24 | }
25 |
--------------------------------------------------------------------------------
/src/chains/EVMChain.ts:
--------------------------------------------------------------------------------
1 | import type { _Chain } from './Chain.js'
2 |
3 | export interface EVMChain extends _Chain {
4 | /**
5 | * @deprecated tokenlistUrl is deprecated and will be removed in the next breaking release
6 | */
7 | tokenlistUrl?: string
8 | metamask: AddEthereumChainParameter
9 | multicallAddress?: string
10 | relayerSupported?: boolean
11 | }
12 |
13 | export interface AddEthereumChainParameter {
14 | chainId: string
15 | blockExplorerUrls: string[]
16 | chainName: string
17 | nativeCurrency: {
18 | name: string
19 | symbol: string
20 | decimals: number
21 | }
22 | rpcUrls: string[]
23 | }
24 |
25 | // This type alias is required to avoid breaking
26 | // changes with the new non EVM support types release
27 | // This will be removed in the future in favour of _Chain
28 | export type Chain = EVMChain
29 |
--------------------------------------------------------------------------------
/src/chains/MVMChain.ts:
--------------------------------------------------------------------------------
1 | import type { _Chain } from './Chain.js'
2 | import type { AddEthereumChainParameter } from './EVMChain.js'
3 |
4 | export interface MVMChain extends _Chain {
5 | metamask: AddEthereumChainParameter
6 | }
7 |
--------------------------------------------------------------------------------
/src/chains/SolanaChain.ts:
--------------------------------------------------------------------------------
1 | import type { _Chain } from './Chain.js'
2 | import type { AddEthereumChainParameter } from './EVMChain.js'
3 |
4 | export interface SolanaChain extends _Chain {
5 | tokenlistUrl?: string
6 | metamask: AddEthereumChainParameter
7 | multicallAddress?: string
8 | }
9 |
--------------------------------------------------------------------------------
/src/chains/UTXOChain.ts:
--------------------------------------------------------------------------------
1 | import type { _Chain } from './Chain.js'
2 | import type { AddEthereumChainParameter } from './EVMChain.js'
3 |
4 | export interface UTXOChain extends _Chain {
5 | metamask: AddEthereumChainParameter
6 | }
7 |
--------------------------------------------------------------------------------
/src/chains/base.ts:
--------------------------------------------------------------------------------
1 | export enum ChainKey {
2 | // EVM
3 | ETH = 'eth',
4 | POL = 'pol',
5 | BSC = 'bsc',
6 | DAI = 'dai',
7 | FTM = 'ftm',
8 | AVA = 'ava',
9 | ARB = 'arb',
10 | OPT = 'opt',
11 | ONE = 'one',
12 | FSN = 'fsn',
13 | MOR = 'mor',
14 | CEL = 'cel',
15 | FUS = 'fus',
16 | TLO = 'tlo',
17 | CRO = 'cro',
18 | BOB = 'bob',
19 | RSK = 'rsk',
20 | VEL = 'vel',
21 | MOO = 'moo',
22 | MAM = 'mam',
23 | AUR = 'aur',
24 | EVM = 'evm',
25 | ARN = 'arn',
26 | ERA = 'era',
27 | PZE = 'pze',
28 | LNA = 'lna',
29 | BAS = 'bas',
30 | SCL = 'scl',
31 | MOD = 'mod',
32 | MNT = 'mnt',
33 | BLS = 'bls',
34 | SEI = 'sei',
35 | FRA = 'fra',
36 | TAI = 'tai',
37 | GRA = 'gra',
38 | IMX = 'imx',
39 | KAI = 'kai',
40 | XLY = 'xly',
41 | OPB = 'opb',
42 | WCC = 'wcc',
43 | LSK = 'lsk',
44 | ABS = 'abs',
45 | BER = 'ber',
46 | SON = 'son',
47 | UNI = 'uni',
48 | APE = 'ape',
49 | SOE = 'soe',
50 | INK = 'ink',
51 | LNS = 'lns',
52 | SWL = 'swl',
53 | CRN = 'crn',
54 | ETL = 'etl',
55 | SUP = 'sup',
56 | HYP = 'hyp',
57 | XDC = 'xdc',
58 | BOC = 'boc', // BOB was already taken by Boba
59 | VIC = 'vic',
60 | FLR = 'flr',
61 | KAT = 'kat',
62 |
63 | // None-EVM
64 | SOL = 'sol',
65 | TER = 'ter',
66 | OAS = 'oas',
67 |
68 | // MVM
69 | SUI = 'sui',
70 |
71 | // UTXO
72 | BTC = 'btc',
73 | BCH = 'bch',
74 | LTC = 'ltc',
75 | DGE = 'dge',
76 | }
77 |
78 | export enum ChainId {
79 | ETH = 1,
80 | POL = 137,
81 | BSC = 56,
82 | DAI = 100,
83 | FTM = 250,
84 | AVA = 43114,
85 | ARB = 42161,
86 | OPT = 10,
87 | ONE = 1666600000,
88 | FSN = 32659,
89 | MOR = 1285,
90 | CEL = 42220,
91 | FUS = 122,
92 | TLO = 40,
93 | CRO = 25,
94 | BOB = 288,
95 | RSK = 30,
96 | VEL = 106,
97 | MOO = 1284,
98 | MAM = 1088,
99 | AUR = 1313161554,
100 | EVM = 9001,
101 | ARN = 42170,
102 | ERA = 324,
103 | PZE = 1101,
104 | LNA = 59144,
105 | BAS = 8453,
106 | SCL = 534352,
107 | MOD = 34443,
108 | MNT = 5000,
109 | BLS = 81457,
110 | SEI = 1329,
111 | FRA = 252,
112 | TAI = 167000,
113 | GRA = 1625,
114 | IMX = 13371,
115 | KAI = 8217,
116 | XLY = 196,
117 | OPB = 204,
118 | WCC = 480,
119 | LSK = 1135,
120 | ABS = 2741,
121 | BER = 80094,
122 | SON = 146,
123 | UNI = 130,
124 | APE = 33139,
125 | SOE = 1868,
126 | INK = 57073,
127 | LNS = 232,
128 | SWL = 1923,
129 | CRN = 21000000,
130 | ETL = 42793,
131 | SUP = 55244,
132 | HYP = 999,
133 | XDC = 50,
134 | BOC = 60808, // BOB was already taken by Boba
135 | VIC = 88,
136 | FLR = 14,
137 | KAT = 747474,
138 |
139 | // None-EVM (IDs are made up by the LI.FI team)
140 | SOL = 1151111081099710,
141 | TER = 1161011141099710,
142 | OAS = 111971151099710,
143 |
144 | // MVM (IDs are made up by the LI.FI team)
145 | SUI = 9270000000000000, // First 16 non-letter hex digits of SUI genesis blob
146 |
147 | // UTXO (IDs are made up by the LI.FI team)
148 | BTC = 20000000000001,
149 | BCH = 20000000000002,
150 | LTC = 20000000000003,
151 | DGE = 20000000000004,
152 | }
153 |
--------------------------------------------------------------------------------
/src/chains/index.ts:
--------------------------------------------------------------------------------
1 | export * from './base.js'
2 | export * from './Chain.js'
3 | export * from './EVMChain.js'
4 | export * from './MVMChain.js'
5 | export * from './SolanaChain.js'
6 | export * from './UTXOChain.js'
7 |
--------------------------------------------------------------------------------
/src/errors.ts:
--------------------------------------------------------------------------------
1 | // Error codes emitted by the LI.FI API
2 | export enum ErrorCode {
3 | DefaultError = 1000,
4 | FailedToBuildTransactionError = 1001,
5 | NoQuoteError = 1002,
6 | NotFoundError = 1003,
7 | NotProcessableError = 1004,
8 | RateLimitError = 1005,
9 | ServerError = 1006,
10 | SlippageError = 1007,
11 | ThirdPartyError = 1008,
12 | TimeoutError = 1009,
13 | UnauthorizedError = 1010,
14 | ValidationError = 1011,
15 | RpcFailure = 1012,
16 | MalformedSchema = 1013,
17 | }
18 |
--------------------------------------------------------------------------------
/src/exchanges.ts:
--------------------------------------------------------------------------------
1 | import type { StaticToken } from './tokens/token.js'
2 |
3 | export interface ExchangeAggregator {
4 | key: string
5 | name: string
6 | logoURI: string
7 | webUrl: string
8 | }
9 |
10 | export interface Exchange {
11 | key: string
12 | name: string
13 | chainId: number
14 | logoURI: string
15 | webUrl: string
16 | graph?: string
17 | tokenlistUrl: string
18 | routerAddress: string
19 | factoryAddress: string
20 | initCodeHash: string
21 | baseTokens: readonly StaticToken[]
22 | }
23 |
24 | export interface ExchangeDefinition {
25 | tool: string
26 | chains: number[]
27 | }
28 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './api.js'
2 | export * from './bridges.js'
3 | export * from './chains/index.js'
4 | export * from './errors.js'
5 | export * from './exchanges.js'
6 | export * from './step.js'
7 | export * from './tokens/index.js'
8 |
--------------------------------------------------------------------------------
/src/step.ts:
--------------------------------------------------------------------------------
1 | import type { TypedData, TransactionRequest } from './api.js'
2 | import type { Token } from './tokens/index.js'
3 |
4 | export interface FeeCost {
5 | name: string
6 | description: string
7 | percentage: string
8 | token: Token
9 | amount: string
10 | amountUSD: string
11 | included: boolean
12 | }
13 |
14 | export interface GasCost {
15 | type: 'SUM' | 'APPROVE' | 'SEND' | 'FEE'
16 | price: string // suggested current standard price for chain
17 | estimate: string // estimate how much gas will be needed
18 | limit: string // suggested gas limit (estimate +25%)
19 | amount: string // estimate * price = amount of tokens that will be needed
20 | amountUSD: string // usd value of token amount
21 | token: Token // the used gas token
22 | }
23 |
24 | // ACTION
25 | export interface Action {
26 | fromChainId: number
27 | fromAmount: string
28 | fromToken: Token
29 | fromAddress?: string
30 |
31 | toChainId: number
32 | toToken: Token
33 | toAddress?: string
34 |
35 | slippage?: number
36 | }
37 |
38 | // ESTIMATE
39 | export interface Estimate {
40 | tool: string
41 | fromAmount: string
42 | fromAmountUSD?: string
43 | toAmount: string
44 | toAmountMin: string
45 | toAmountUSD?: string
46 | approvalAddress: string
47 | feeCosts?: FeeCost[]
48 | // This is a list to account for approval gas costs and transaction gas costs. However, approval gas costs are not used at the moment
49 | gasCosts?: GasCost[]
50 | // estimated duration in seconds
51 | executionDuration: number
52 | }
53 |
54 | // STEP
55 | export const _StepType = [
56 | 'lifi',
57 | 'swap',
58 | 'cross',
59 | 'protocol',
60 | 'custom',
61 | ] as const
62 | export type StepType = (typeof _StepType)[number]
63 | export type StepTool = string
64 | export type StepToolDetails = {
65 | key: string
66 | name: string
67 | logoURI: string
68 | }
69 |
70 | type StepInformationBase = {
71 | tool: string
72 | type: string
73 | action: Action
74 | estimate: Estimate
75 | }
76 |
77 | export type StepInformation = StepInformationBase & {
78 | createdAt: Date
79 | gasLimit: string
80 | stepId: string
81 | transactionId: string
82 | intermediateActions: StepInformationBase[]
83 | integrator?: string
84 | relatedLifiSteps?: string[]
85 | }
86 |
87 | export interface StepBase {
88 | id: string
89 | type: StepType
90 | tool: StepTool
91 | toolDetails: StepToolDetails
92 | integrator?: string
93 | referrer?: string
94 | action: Action
95 | estimate?: Estimate
96 | transactionRequest?: TransactionRequest
97 | /**
98 | * EIP-712 Typed Data
99 | * @link https://eips.ethereum.org/EIPS/eip-712
100 | */
101 | typedData?: TypedData[]
102 | }
103 |
104 | export interface DestinationCallInfo {
105 | toContractAddress: string
106 | toContractCallData: string
107 | toFallbackAddress: string
108 | callDataGasLimit: string
109 | }
110 |
111 | export type CallAction = Action & DestinationCallInfo
112 |
113 | export interface SwapStep extends StepBase {
114 | type: 'swap'
115 | action: Action
116 | estimate: Estimate
117 | }
118 |
119 | export interface CrossStep extends StepBase {
120 | type: 'cross'
121 | action: Action
122 | estimate: Estimate
123 | }
124 |
125 | export interface ProtocolStep extends StepBase {
126 | type: 'protocol'
127 | action: Action
128 | estimate: Estimate
129 | }
130 |
131 | export interface CustomStep extends StepBase {
132 | type: 'custom'
133 | action: CallAction
134 | estimate: Estimate
135 | }
136 |
137 | export type Step = SwapStep | CrossStep | CustomStep | ProtocolStep
138 |
139 | export interface LiFiStep extends Omit {
140 | type: 'lifi'
141 | includedSteps: Step[]
142 | }
143 |
144 | export function isSwapStep(step: Step): step is SwapStep {
145 | return step.type === 'swap'
146 | }
147 |
148 | export function isCrossStep(step: Step): step is CrossStep {
149 | return step.type === 'cross'
150 | }
151 |
152 | export function isProtocolStep(step: Step): step is ProtocolStep {
153 | return step.type === 'protocol'
154 | }
155 |
156 | export function isCustomStep(step: Step): step is CustomStep {
157 | return step.type === 'custom'
158 | }
159 |
--------------------------------------------------------------------------------
/src/tokens/base.ts:
--------------------------------------------------------------------------------
1 | export enum CoinKey {
2 | ETH = 'ETH',
3 | MATIC = 'MATIC',
4 | POL = 'POL',
5 | BNB = 'BNB',
6 | DAI = 'DAI',
7 | FTM = 'FTM',
8 | AVAX = 'AVAX',
9 | ONE = 'ONE',
10 | FSN = 'FSN',
11 | MOVR = 'MOVR',
12 | CELO = 'CELO',
13 | FUSE = 'FUSE',
14 | TLOS = 'TLOS',
15 | CRO = 'CRO',
16 | RBTC = 'RBTC',
17 | VLX = 'VLX',
18 | GLMR = 'GLMR',
19 | METIS = 'METIS',
20 | EVM = 'EVM',
21 | MNT = 'MNT',
22 | SEI = 'SEI',
23 | G = 'G',
24 | IMX = 'IMX',
25 | KLAY = 'KLAY',
26 | OKB = 'OKB',
27 | WLD = 'WLD', // World Coin Token
28 | LSK = 'LSK', // Lisk Token
29 | BERA = 'BERA', // Berachain Token
30 | S = 'S', // Sonic Token
31 | APE = 'APE', // ApeCoin
32 | GHO = 'GHO', // Lens
33 | WGHO = 'WGHO', // Lens
34 | XTZ = 'XTZ', // Etherlink Native
35 | HYPE = 'HYPE', // HyperEVM native
36 | XDC = 'XDC', // XDC native
37 | VIC = 'VIC', // Viction native
38 | FLR = 'FLR', // Flare native
39 |
40 | // Solana
41 | SOL = 'SOL',
42 | WSOL = 'wSOL',
43 |
44 | // MVM
45 | SUI = 'SUI',
46 |
47 | // UTXO
48 | BTC = 'BTC',
49 | BCH = 'BCH',
50 | LTC = 'LTC',
51 | DOGE = 'DOGE',
52 |
53 | // Stable coins
54 | USDT = 'USDT',
55 | USDC = 'USDC',
56 | BUSD = 'BUSD',
57 | USDCe = 'USDCe',
58 | USDB = 'USDB', // Blast native stablecoin
59 | FRAX = 'FRAX', // Fraxtal stablecoin
60 | AXLUSDC = 'axlUSDC', // Axelar Wrapped USDC
61 | FDUSD = 'FDUSD', // First Digital USD
62 | HONEY = 'HONEY', // Stablecoin on Berachain
63 | BYUSD = 'BYUSD', // Stablecoin on Berachain
64 | APEUSD = 'APEUSD', // Stablecoin on ApeChain
65 | FEUSD = 'FEUSD', // Stablecoin on HyperEVM
66 |
67 | // Other tokens
68 | WBTC = 'WBTC',
69 | WETH = 'WETH',
70 | SUSHI = 'SUSHI',
71 | DODO = 'DODO',
72 | MCB = 'MCB',
73 | CELR = 'CELR',
74 | IF = 'IF',
75 | RUNE = 'RUNE',
76 | WMNT = 'WMNT', // Wrapped MNT Token
77 | frxETH = 'frxETH',
78 | wfrxETH = 'wfrxETH', // Wrapped frxETH Token
79 | WSEI = 'WSEI', // Wrapped SEI Token
80 | WG = 'WG', // Wrapped G Token on Gravity chain
81 | WIMX = 'WIMX', // Wrapped IMX Token
82 | WPOL = 'WPOL', // Wrapped POL Token
83 | WKLAY = 'WKLAY', // Wrapped KLAY Token
84 | WOKB = 'WOKB', // Wrapped OKB Token
85 | WBNB = 'WBNB', // Wrapped BNB Token
86 | WCRO = 'WCRO', // Wrapped CRO Token
87 | WBERA = 'WBERA', // Wrapped BERA Token
88 | wS = 'wS', // Wrapped Sonic Token
89 | WAPE = 'WAPE', // Wrapped ApeCoin
90 | WXTZ = 'WXTZ', // Etherlink Wrapped Native
91 | WHYPE = 'WHYPE', // HyperEVM Wrapped Native
92 | WXDC = 'WXDC', // XDC Wrapped Native
93 | WVIC = 'WVIC', // Viction Wrapped Native
94 | WFLR = 'WFLR', // Flare Wrapped Native
95 | }
96 |
--------------------------------------------------------------------------------
/src/tokens/index.ts:
--------------------------------------------------------------------------------
1 | export * from './base.js'
2 | export * from './token.js'
3 |
--------------------------------------------------------------------------------
/src/tokens/token.ts:
--------------------------------------------------------------------------------
1 | import type { ChainId } from '../chains/base.js'
2 | import type { CoinKey } from './base.js'
3 |
4 | export interface BaseToken {
5 | chainId: ChainId
6 | address: string
7 | }
8 |
9 | export interface StaticToken extends BaseToken {
10 | symbol: string
11 | decimals: number
12 | name: string
13 | coinKey?: CoinKey
14 | logoURI?: string
15 | }
16 |
17 | export interface Token extends StaticToken {
18 | priceUSD: string
19 | }
20 |
21 | export interface TokenAmount extends Token {
22 | amount?: bigint
23 | blockNumber?: bigint
24 | }
25 |
26 | export interface Coin {
27 | key: CoinKey
28 | name: string
29 | logoURI: string
30 | verified: boolean
31 | chains: {
32 | [ChainId: string]: StaticToken
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tsconfig.base.json:
--------------------------------------------------------------------------------
1 | {
2 | // This tsconfig file contains the shared config for the build (tsconfig.build.json) and type checking (tsconfig.json) config.
3 | "include": [],
4 | "compilerOptions": {
5 | // Incremental builds
6 | // NOTE: Enabling incremental builds speeds up `tsc`. Keep in mind though that it does not reliably bust the cache when the `tsconfig.json` file changes.
7 | "incremental": true,
8 |
9 | // Type checking
10 | "strict": true,
11 | "useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
12 | "noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
13 | "noImplicitReturns": true, // Not enabled by default in `strict` mode.
14 | "useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
15 | "noImplicitOverride": true, // Not enabled by default in `strict` mode.
16 | "noUnusedLocals": true, // Not enabled by default in `strict` mode.
17 | "noUnusedParameters": true, // Not enabled by default in `strict` mode.
18 | // TODO: The following options are also not enabled by default in `strict` mode and would be nice to have but would require some adjustments to the codebase.
19 | // "exactOptionalPropertyTypes": true,
20 | // "noUncheckedIndexedAccess": true,
21 |
22 | // JavaScript support
23 | "allowJs": false,
24 | "checkJs": false,
25 |
26 | // Interop constraints
27 | "esModuleInterop": false,
28 | "allowSyntheticDefaultImports": false,
29 | "forceConsistentCasingInFileNames": true,
30 | "verbatimModuleSyntax": true,
31 | // Language and environment
32 | "moduleResolution": "NodeNext",
33 | "module": "NodeNext",
34 | "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
35 | "lib": [
36 | "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
37 | "DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
38 | ],
39 |
40 | // Skip type checking for node modules
41 | "skipLibCheck": true
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/tsconfig.build.json:
--------------------------------------------------------------------------------
1 | {
2 | // This file is used to compile the for cjs and esm (see package.json build scripts). It should exclude all test files.
3 | "extends": "./tsconfig.base.json",
4 | "include": ["src"],
5 | "exclude": [
6 | "src/assets"
7 | ],
8 | "compilerOptions": {
9 | "moduleResolution": "node",
10 | "sourceMap": true,
11 | "rootDir": "./src"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | // This configuration is used for local development and type checking.
3 | "extends": "./tsconfig.base.json",
4 | "include": ["src"],
5 | "exclude": [],
6 | "references": [{ "path": "./tsconfig.node.json" }],
7 | "compilerOptions": {
8 | "baseUrl": "."
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | // This configuration is used for local development and type checking of configuration and script files that are not part of the build.
3 | "compilerOptions": {
4 | "strict": true,
5 | "composite": true,
6 | "module": "ESNext",
7 | "moduleResolution": "Node",
8 | "allowSyntheticDefaultImports": true
9 | }
10 | }
11 |
--------------------------------------------------------------------------------