@lifi/types 9.0.0-alpha.8 → 9.0.0

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.
Files changed (66) hide show
  1. package/dist/api.d.ts +35 -59
  2. package/dist/apiErrors.d.ts +9 -0
  3. package/dist/base.d.ts +231 -0
  4. package/dist/{chains/base.js → base.js} +65 -0
  5. package/dist/bridges.d.ts +21 -15
  6. package/dist/bridges.js +167 -1
  7. package/dist/chains/Chain.d.ts +2 -3
  8. package/dist/chains/Chain.js +2 -1
  9. package/dist/chains/EVMChain.d.ts +1 -0
  10. package/dist/chains/EVMChain.js +4 -1
  11. package/dist/chains/chain.utils.d.ts +4 -0
  12. package/dist/chains/chain.utils.js +21 -0
  13. package/dist/chains/index.d.ts +2 -1
  14. package/dist/chains/index.js +2 -1
  15. package/dist/chains/supported.chains.d.ts +5 -0
  16. package/dist/chains/supported.chains.js +1208 -0
  17. package/dist/cjs/api.d.ts +35 -59
  18. package/dist/cjs/apiErrors.d.ts +9 -0
  19. package/dist/cjs/base.d.ts +231 -0
  20. package/dist/cjs/{chains/base.js → base.js} +68 -3
  21. package/dist/cjs/bridges.d.ts +21 -15
  22. package/dist/cjs/bridges.js +168 -0
  23. package/dist/cjs/chains/Chain.d.ts +2 -3
  24. package/dist/cjs/chains/Chain.js +3 -2
  25. package/dist/cjs/chains/EVMChain.d.ts +1 -0
  26. package/dist/cjs/chains/EVMChain.js +6 -0
  27. package/dist/cjs/chains/chain.utils.d.ts +4 -0
  28. package/dist/cjs/chains/chain.utils.js +26 -0
  29. package/dist/cjs/chains/index.d.ts +2 -1
  30. package/dist/cjs/chains/index.js +2 -1
  31. package/dist/cjs/chains/supported.chains.d.ts +5 -0
  32. package/dist/cjs/chains/supported.chains.js +1211 -0
  33. package/dist/cjs/coins.d.ts +9 -0
  34. package/dist/cjs/coins.js +1892 -0
  35. package/dist/cjs/exchanges.d.ts +32 -6
  36. package/dist/cjs/exchanges.js +1102 -0
  37. package/dist/cjs/index.d.ts +6 -3
  38. package/dist/cjs/index.js +6 -3
  39. package/dist/cjs/multicall.d.ts +3 -0
  40. package/dist/cjs/multicall.js +80 -0
  41. package/dist/cjs/step.d.ts +8 -10
  42. package/dist/coins.d.ts +9 -0
  43. package/dist/coins.js +1885 -0
  44. package/dist/exchanges.d.ts +32 -6
  45. package/dist/exchanges.js +1100 -1
  46. package/dist/index.d.ts +6 -3
  47. package/dist/index.js +6 -3
  48. package/dist/multicall.d.ts +3 -0
  49. package/dist/multicall.js +77 -0
  50. package/dist/step.d.ts +8 -10
  51. package/package.json +32 -22
  52. package/CHANGELOG.md +0 -1291
  53. package/dist/chains/base.d.ts +0 -122
  54. package/dist/cjs/chains/base.d.ts +0 -122
  55. package/dist/cjs/tokens/base.d.ts +0 -58
  56. package/dist/cjs/tokens/base.js +0 -66
  57. package/dist/cjs/tokens/index.d.ts +0 -2
  58. package/dist/cjs/tokens/index.js +0 -18
  59. package/dist/cjs/tokens/token.d.ts +0 -29
  60. package/dist/tokens/base.d.ts +0 -58
  61. package/dist/tokens/base.js +0 -63
  62. package/dist/tokens/index.d.ts +0 -2
  63. package/dist/tokens/index.js +0 -2
  64. package/dist/tokens/token.d.ts +0 -29
  65. /package/dist/{tokens/token.js → apiErrors.js} +0 -0
  66. /package/dist/cjs/{tokens/token.js → apiErrors.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- export * from './api';
1
+ export * from './base';
2
2
  export * from './bridges';
3
3
  export * from './chains';
4
+ export * from './coins';
4
5
  export * from './exchanges';
5
- export * from './quests';
6
6
  export * from './step';
7
- export * from './tokens';
7
+ export * from './api';
8
+ export * from './apiErrors';
9
+ export * from './multicall';
10
+ export * from './quests';
package/dist/index.js CHANGED
@@ -1,7 +1,10 @@
1
- export * from './api';
1
+ export * from './base';
2
2
  export * from './bridges';
3
3
  export * from './chains';
4
+ export * from './coins';
4
5
  export * from './exchanges';
5
- export * from './quests';
6
6
  export * from './step';
7
- export * from './tokens';
7
+ export * from './api';
8
+ export * from './apiErrors';
9
+ export * from './multicall';
10
+ export * from './quests';
@@ -0,0 +1,3 @@
1
+ export declare const multicallAddresses: {
2
+ [ChainId: number]: string;
3
+ };
@@ -0,0 +1,77 @@
1
+ import { ChainId } from '.';
2
+ // based on:
3
+ // new nice tool to search for addresses: https://www.multicall3.com/deployments
4
+ // - https://github.com/mds1/multicall#deployments
5
+ // - https://github.com/sushiswap/sushiswap-sdk/blob/canary/src/constants/addresses.ts#L323
6
+ // - https://github.com/joshstevens19/ethereum-multicall#multicall-contracts
7
+ // '0xcA11bde05977b3631167028862bE2a173976CA11' is a Multicall3 contract
8
+ // export const multicallAddresses: Record<ChainId, string> = {
9
+ export const multicallAddresses = {
10
+ // Mainnet
11
+ [ChainId.ETH]: '0xcA11bde05977b3631167028862bE2a173976CA11',
12
+ [ChainId.POL]: '0xcA11bde05977b3631167028862bE2a173976CA11',
13
+ [ChainId.BSC]: '0xcA11bde05977b3631167028862bE2a173976CA11',
14
+ [ChainId.DAI]: '0xcA11bde05977b3631167028862bE2a173976CA11',
15
+ [ChainId.OKT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
16
+ [ChainId.FTM]: '0xcA11bde05977b3631167028862bE2a173976CA11',
17
+ [ChainId.AVA]: '0xcA11bde05977b3631167028862bE2a173976CA11',
18
+ [ChainId.ARB]: '0xcA11bde05977b3631167028862bE2a173976CA11',
19
+ [ChainId.HEC]: '0xcA11bde05977b3631167028862bE2a173976CA11',
20
+ [ChainId.OPT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
21
+ [ChainId.ONE]: '0xcA11bde05977b3631167028862bE2a173976CA11',
22
+ [ChainId.FSN]: '0x0769fd68dFb93167989C6f7254cd0D766Fb2841F',
23
+ [ChainId.MOR]: '0xcA11bde05977b3631167028862bE2a173976CA11',
24
+ [ChainId.CEL]: '0xcA11bde05977b3631167028862bE2a173976CA11',
25
+ [ChainId.FUS]: '0xcA11bde05977b3631167028862bE2a173976CA11',
26
+ [ChainId.CRO]: '0xcA11bde05977b3631167028862bE2a173976CA11',
27
+ [ChainId.BOB]: '0xcA11bde05977b3631167028862bE2a173976CA11',
28
+ [ChainId.MOO]: '0xcA11bde05977b3631167028862bE2a173976CA11',
29
+ [ChainId.MAM]: '0xcA11bde05977b3631167028862bE2a173976CA11',
30
+ [ChainId.AUR]: '0xcA11bde05977b3631167028862bE2a173976CA11',
31
+ [ChainId.EVM]: '0xcA11bde05977b3631167028862bE2a173976CA11',
32
+ [ChainId.MET]: '0xcA11bde05977b3631167028862bE2a173976CA11',
33
+ [ChainId.RSK]: '0xcA11bde05977b3631167028862bE2a173976CA11',
34
+ [ChainId.VEL]: '0x6ede559F2Bd951777470595761672091CCD21Ac6',
35
+ [ChainId.PZE]: '0xcA11bde05977b3631167028862bE2a173976CA11',
36
+ [ChainId.ERA]: '0xF9cda624FBC7e059355ce98a31693d299FACd963',
37
+ [ChainId.LNA]: '0xcA11bde05977b3631167028862bE2a173976CA11',
38
+ [ChainId.ARN]: '0xcA11bde05977b3631167028862bE2a173976CA11',
39
+ [ChainId.BAS]: '0xcA11bde05977b3631167028862bE2a173976CA11',
40
+ // TODO
41
+ // [ChainId.EXP]: '', // TODO
42
+ // [ChainId.TCH]: '', // TODO
43
+ // [ChainId.UBQ]: '', // TODO
44
+ // [ChainId.DIO]: '', // TODO
45
+ // [ChainId.TLO]: '', // TODO
46
+ // [ChainId.SHI]: '', // TODO
47
+ // [ChainId.GL1]: '', // TODO
48
+ // [ChainId.TBW]: '', // TODO
49
+ // [ChainId.PALM]: '0x0769fd68dFb93167989C6f7254cd0D766Fb2841F',
50
+ // [ChainId.TELOS]: '0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3',
51
+ // Testnet
52
+ [ChainId.GOR]: '0xcA11bde05977b3631167028862bE2a173976CA11',
53
+ [ChainId.MUM]: '0xcA11bde05977b3631167028862bE2a173976CA11',
54
+ [ChainId.BSCT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
55
+ [ChainId.ONET]: '0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3',
56
+ [ChainId.AVAT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
57
+ [ChainId.OPTG]: '0xcA11bde05977b3631167028862bE2a173976CA11',
58
+ [ChainId.EVMT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
59
+ [ChainId.MORT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
60
+ [ChainId.FTMT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
61
+ [ChainId.RSKT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
62
+ [ChainId.ARBG]: '0xcA11bde05977b3631167028862bE2a173976CA11',
63
+ [ChainId.LNAT]: '0xcA11bde05977b3631167028862bE2a173976CA11',
64
+ // TODO
65
+ // [ChainId.METT]: '', // TODO
66
+ // [ChainId.DIOT]: '', // TODO
67
+ // [ChainId.HECT]: '', // TODO
68
+ // [ChainId.FUST]: '', // TODO
69
+ // [ChainId.TLOT]: '', // TODO
70
+ // none EVM
71
+ // [ChainId.SOL]: '', // NOT NEEDED
72
+ // [ChainId.TER]: '', // NOT NEEDED
73
+ // [ChainId.OAS]: '', // NOT NEEDED
74
+ // [ChainId.SOLT]: '', // NOT NEEDED
75
+ // [ChainId.TERT]: '', // NOT NEEDED
76
+ // [ChainId.OAST]: '', // NOT NEEDED
77
+ };
package/dist/step.d.ts CHANGED
@@ -1,12 +1,15 @@
1
- import { Substatus, TransactionRequest } from '.';
2
- import { Token } from './tokens/token';
1
+ import { providers } from 'ethers';
2
+ import { Substatus } from '.';
3
+ import { Token } from './base';
4
+ import { Bridge } from './bridges';
5
+ import { Exchange, ExchangeAggregator } from './exchanges';
3
6
  export interface FeeCost {
4
7
  name: string;
5
8
  description: string;
6
9
  percentage: string;
7
10
  token: Token;
8
11
  amount: string;
9
- amountUSD?: string;
12
+ amountUSD: string;
10
13
  included: boolean;
11
14
  }
12
15
  export interface GasCost {
@@ -76,22 +79,17 @@ export declare const emptyExecution: Execution;
76
79
  export declare const _StepType: readonly ["lifi", "swap", "cross", "protocol", "custom"];
77
80
  export type StepType = (typeof _StepType)[number];
78
81
  export type StepTool = string;
79
- export type StepToolDetails = {
80
- key: string;
81
- name: string;
82
- logoURI: string;
83
- };
84
82
  export interface StepBase {
85
83
  id: string;
86
84
  type: StepType;
87
85
  tool: StepTool;
88
- toolDetails: StepToolDetails;
86
+ toolDetails: Pick<ExchangeAggregator | Exchange | Bridge, 'key' | 'name' | 'logoURI'>;
89
87
  integrator?: string;
90
88
  referrer?: string;
91
89
  action: Action;
92
90
  estimate?: Estimate;
93
91
  execution?: Execution;
94
- transactionRequest?: TransactionRequest;
92
+ transactionRequest?: providers.TransactionRequest;
95
93
  }
96
94
  export interface DestinationCallInfo {
97
95
  toContractAddress: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/types",
3
- "version": "9.0.0-alpha.8",
3
+ "version": "9.0.0",
4
4
  "description": "Types for the LI.FI stack",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",
@@ -10,23 +10,23 @@
10
10
  "import": "./dist/index.js"
11
11
  },
12
12
  "scripts": {
13
- "addscope": "node tools/packagejson name @lifi/types",
13
+ "watch": "tsc -w -p ./tsconfig.json",
14
14
  "build": "node tools/cleanup types && tsc -p ./tsconfig.json && tsc -p ./tsconfig.cjs.json",
15
15
  "clean": "node tools/cleanup",
16
- "lint:fix": "eslint --ext .tsx --ext .ts ./src --fix",
17
16
  "package": "npm run build && npm pack",
18
- "postpublish": "npm run use:gitReadme && pinst --enable",
17
+ "test": "jest --no-cache --runInBand",
18
+ "test:cov": "jest --coverage --no-cache --runInBand",
19
+ "addscope": "node tools/packagejson name @lifi/types",
19
20
  "pre-commit": "lint-staged",
20
- "pre-push": "yarn build",
21
- "prepare": "husky install",
22
- "prepublishOnly": "run-s build use:npmReadme && pinst --enable",
21
+ "pre-push": "yarn build && yarn test",
22
+ "lint:fix": "eslint --ext .tsx --ext .ts ./src --fix",
23
23
  "prettier:fix": "prettier --write ./src/.",
24
- "release": "standard-version -a",
25
- "release:alpha": "standard-version -a --prerelease alpha --skip.changelog",
26
- "release:beta": "standard-version -a --prerelease beta --skip.changelog",
27
- "use:gitReadme": "mv 'README.md' 'npm.README.md' && mv 'git.README.md' 'README.md'",
28
24
  "use:npmReadme": "mv 'README.md' 'git.README.md' && mv 'npm.README.md' 'README.md'",
29
- "watch": "tsc -w -p ./tsconfig.json"
25
+ "use:gitReadme": "mv 'README.md' 'npm.README.md' && mv 'git.README.md' 'README.md'",
26
+ "prepublishOnly": "run-s build use:npmReadme && pinst --enable",
27
+ "postpublish": "npm run use:gitReadme && pinst --enable",
28
+ "prepare": "husky install",
29
+ "release": "standard-version --release-as major"
30
30
  },
31
31
  "lint-staged": {
32
32
  "src/**/*.{ts,tsx}": [
@@ -68,21 +68,31 @@
68
68
  "bugs": {
69
69
  "url": "https://github.com/lifinance/types"
70
70
  },
71
+ "dependencies": {
72
+ "ethers": "^5.7.2"
73
+ },
71
74
  "devDependencies": {
72
- "@commitlint/cli": "^17.7.1",
73
- "@commitlint/config-conventional": "^17.7.0",
74
- "@typescript-eslint/eslint-plugin": "^6.3.0",
75
- "@typescript-eslint/parser": "^6.3.0",
76
- "eslint": "^8.47.0",
77
- "eslint-config-prettier": "^9.0.0",
78
- "eslint-plugin-prettier": "^5.0.0",
75
+ "@commitlint/cli": "^17.5.1",
76
+ "@commitlint/config-conventional": "^17.4.4",
77
+ "@types/jest": "^29.5.0",
78
+ "@typescript-eslint/eslint-plugin": "^5.58.0",
79
+ "@typescript-eslint/parser": "^5.58.0",
80
+ "axios": "^1.4.0",
81
+ "eslint": "^8.38.0",
82
+ "eslint-config-prettier": "^8.8.0",
83
+ "eslint-plugin-prettier": "^4.2.1",
79
84
  "husky": "^8.0.3",
80
- "lint-staged": "^14.0.0",
85
+ "jest": "^29.5.0",
86
+ "lint-staged": "^13.2.1",
81
87
  "npm-run-all": "^4.1.5",
82
88
  "pinst": "^3.0.0",
83
- "prettier": "^3.0.1",
89
+ "prettier": "^2.8.7",
84
90
  "standard-version": "^9.5.0",
85
- "typescript": "^5.1.6"
91
+ "ts-jest": "^29.1.0",
92
+ "typescript": "^5.0.4"
93
+ },
94
+ "directories": {
95
+ "test": "test"
86
96
  },
87
97
  "packageManager": "yarn@3.5.0"
88
98
  }