@ledgerhq/coin-evm 0.2.0-next.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.
- package/.eslintrc.js +57 -0
- package/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +18 -0
- package/jest.config.js +6 -0
- package/package.json +102 -0
- package/src/__tests__/adapters.unit.test.ts +527 -0
- package/src/__tests__/broadcast.unit.test.ts +181 -0
- package/src/__tests__/buildOptimisticOperation.unit.test.ts +182 -0
- package/src/__tests__/createTransaction.unit.test.ts +52 -0
- package/src/__tests__/deviceTransactionConfig.unit.test.ts +245 -0
- package/src/__tests__/estimateMaxSpendable.unit.test.ts +123 -0
- package/src/__tests__/getTransactionStatus.unit.test.ts +355 -0
- package/src/__tests__/hw-getAddress.unit.test.ts +24 -0
- package/src/__tests__/logic.unit.test.ts +406 -0
- package/src/__tests__/preload.unit.test.ts +139 -0
- package/src/__tests__/prepareTransaction.unit.test.ts +394 -0
- package/src/__tests__/rpc.unit.test.ts +532 -0
- package/src/__tests__/signOperation.unit.test.ts +157 -0
- package/src/__tests__/synchronization.unit.test.ts +832 -0
- package/src/__tests__/transaction.unit.test.ts +196 -0
- package/src/abis/erc20.abi.json +230 -0
- package/src/abis/optimismGasPriceOracle.abi.json +252 -0
- package/src/adapters.ts +148 -0
- package/src/api/etherscan.ts +124 -0
- package/src/api/rpc.common.ts +354 -0
- package/src/api/rpc.native.ts +5 -0
- package/src/api/rpc.ts +2 -0
- package/src/bridge/js.ts +77 -0
- package/src/bridge.integration.test.ts +93 -0
- package/src/broadcast.ts +40 -0
- package/src/buildOptimisticOperation.ts +113 -0
- package/src/cli-transaction.ts +11 -0
- package/src/createTransaction.ts +25 -0
- package/src/datasets/ethereum.scanAccounts.1.ts +48 -0
- package/src/datasets/ethereum1.ts +20 -0
- package/src/datasets/ethereum2.ts +20 -0
- package/src/datasets/ethereum_classic.ts +68 -0
- package/src/deviceTransactionConfig.ts +64 -0
- package/src/errors.ts +5 -0
- package/src/estimateMaxSpendable.ts +19 -0
- package/src/getTransactionStatus.ts +186 -0
- package/src/hw-getAddress.ts +24 -0
- package/src/logic.ts +149 -0
- package/src/preload.ts +54 -0
- package/src/prepareTransaction.ts +176 -0
- package/src/signOperation.ts +127 -0
- package/src/specs.ts +344 -0
- package/src/speculos-deviceActions.ts +83 -0
- package/src/synchronization.ts +317 -0
- package/src/testUtils.ts +153 -0
- package/src/transaction.ts +193 -0
- package/src/types.ts +132 -0
- package/tsconfig.json +12 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: "@typescript-eslint/parser",
|
|
3
|
+
env: {
|
|
4
|
+
browser: true,
|
|
5
|
+
es6: true,
|
|
6
|
+
node: true,
|
|
7
|
+
jest: true,
|
|
8
|
+
},
|
|
9
|
+
extends: [
|
|
10
|
+
"eslint:recommended",
|
|
11
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
12
|
+
"plugin:@typescript-eslint/recommended",
|
|
13
|
+
"prettier",
|
|
14
|
+
],
|
|
15
|
+
globals: {
|
|
16
|
+
Atomics: "readonly",
|
|
17
|
+
SharedArrayBuffer: "readonly",
|
|
18
|
+
},
|
|
19
|
+
plugins: ["@typescript-eslint", "prettier"],
|
|
20
|
+
rules: {
|
|
21
|
+
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
22
|
+
"linebreak-style": ["error", "unix"],
|
|
23
|
+
semi: ["error", "always"],
|
|
24
|
+
"no-unused-vars": "off",
|
|
25
|
+
"import/prefer-default-export": 0,
|
|
26
|
+
"no-plusplus": 0,
|
|
27
|
+
"no-underscore-dangle": 0,
|
|
28
|
+
"prefer-template": 0,
|
|
29
|
+
"no-await-in-loop": 0,
|
|
30
|
+
"no-restricted-syntax": 0,
|
|
31
|
+
"consistent-return": 0,
|
|
32
|
+
"no-lonely-if": 0,
|
|
33
|
+
"no-use-before-define": 0,
|
|
34
|
+
"no-nested-ternary": 0,
|
|
35
|
+
"import/no-cycle": 0,
|
|
36
|
+
"no-multi-assign": 0,
|
|
37
|
+
"guard-for-in": 0,
|
|
38
|
+
"no-continue": 0,
|
|
39
|
+
"lines-between-class-members": 0,
|
|
40
|
+
"prefer-destructuring": 0,
|
|
41
|
+
"prettier/prettier": "error",
|
|
42
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
43
|
+
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
44
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
45
|
+
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
|
|
46
|
+
"@typescript-eslint/no-explicit-any": 0,
|
|
47
|
+
"@typescript-eslint/ban-types": [
|
|
48
|
+
"error",
|
|
49
|
+
{
|
|
50
|
+
extendDefaults: true,
|
|
51
|
+
types: {
|
|
52
|
+
"{}": false,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
};
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @ledgerhq/coin-evm
|
|
2
|
+
|
|
3
|
+
## 0.2.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3536](https://github.com/LedgerHQ/ledger-live/pull/3536) [`a380bfc53a`](https://github.com/LedgerHQ/ledger-live/commit/a380bfc53a25bf196031337cd7ab8bc459731e16) Thanks [@chabroA](https://github.com/chabroA)! - Move evm familly logic in own package
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`5cce6e3593`](https://github.com/LedgerHQ/ledger-live/commit/5cce6e359309110df53e16ef989c5b8b94492dfd), [`b30ead9d22`](https://github.com/LedgerHQ/ledger-live/commit/b30ead9d22a4bce5f8ee27febf0190fccd2ca25b), [`7439b63325`](https://github.com/LedgerHQ/ledger-live/commit/7439b63325a9b0181a3af4310ba787f00faa80c9), [`ce675302c7`](https://github.com/LedgerHQ/ledger-live/commit/ce675302c78311571e1087cfa35ee67580263796), [`43cdd2624c`](https://github.com/LedgerHQ/ledger-live/commit/43cdd2624cd2965ddb6e346e9a77a3cc12476500)]:
|
|
12
|
+
- @ledgerhq/cryptoassets@9.7.0-next.0
|
|
13
|
+
- @ledgerhq/live-network@1.1.0-next.0
|
|
14
|
+
- @ledgerhq/types-live@6.35.0-next.0
|
|
15
|
+
- @ledgerhq/coin-framework@0.3.5-next.0
|
|
16
|
+
- @ledgerhq/domain-service@1.1.3-next.0
|
|
17
|
+
- @ledgerhq/hw-app-eth@6.33.5-next.0
|
|
18
|
+
- @ledgerhq/live-portfolio@0.0.7-next.0
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ledgerhq/coin-evm",
|
|
3
|
+
"version": "0.2.0-next.0",
|
|
4
|
+
"description": "Ledger EVM Coin integration",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Ledger",
|
|
7
|
+
"LedgerWallet",
|
|
8
|
+
"evm",
|
|
9
|
+
"Ethereum",
|
|
10
|
+
"Hardware Wallet"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/LedgerHQ/ledger-live/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/coin-evm",
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"typesVersions": {
|
|
24
|
+
"*": {
|
|
25
|
+
"lib/*": [
|
|
26
|
+
"lib/*"
|
|
27
|
+
],
|
|
28
|
+
"lib-es/*": [
|
|
29
|
+
"lib-es/*"
|
|
30
|
+
],
|
|
31
|
+
"*": [
|
|
32
|
+
"lib/*"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"exports": {
|
|
37
|
+
"./lib/*": "./lib/*.js",
|
|
38
|
+
"./lib-es/*": "./lib-es/*.js",
|
|
39
|
+
"./*": {
|
|
40
|
+
"require": "./lib/*.js",
|
|
41
|
+
"default": "./lib-es/*.js"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
"license": "Apache-2.0",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@ethersproject/shims": "^5.7.0",
|
|
48
|
+
"@ledgerhq/live-app-sdk": "^0.8.1",
|
|
49
|
+
"@polkadot/types": "9.8.1",
|
|
50
|
+
"@polkadot/types-known": "9.8.1",
|
|
51
|
+
"@polkadot/util": "10.3.1",
|
|
52
|
+
"@polkadot/util-crypto": "10.3.1",
|
|
53
|
+
"axios": "0.26.1",
|
|
54
|
+
"bignumber.js": "^9.1.0",
|
|
55
|
+
"eip55": "^2.1.0",
|
|
56
|
+
"ethers": "^5.6.9",
|
|
57
|
+
"expect": "^27.4.6",
|
|
58
|
+
"invariant": "^2.2.2",
|
|
59
|
+
"lodash": "^4.17.21",
|
|
60
|
+
"react-native-get-random-values": "^1.8.0",
|
|
61
|
+
"rxjs": "^6.6.7",
|
|
62
|
+
"@ledgerhq/coin-framework": "^0.3.5-next.0",
|
|
63
|
+
"@ledgerhq/cryptoassets": "^9.7.0-next.0",
|
|
64
|
+
"@ledgerhq/devices": "^8.0.3",
|
|
65
|
+
"@ledgerhq/domain-service": "^1.1.3-next.0",
|
|
66
|
+
"@ledgerhq/errors": "^6.12.6",
|
|
67
|
+
"@ledgerhq/hw-app-eth": "^6.33.5-next.0",
|
|
68
|
+
"@ledgerhq/live-env": "^0.3.0",
|
|
69
|
+
"@ledgerhq/live-network": "^1.1.0-next.0",
|
|
70
|
+
"@ledgerhq/live-portfolio": "^0.0.7-next.0",
|
|
71
|
+
"@ledgerhq/live-promise": "^0.0.1",
|
|
72
|
+
"@ledgerhq/logs": "^6.10.1",
|
|
73
|
+
"@ledgerhq/types-cryptoassets": "^7.2.0",
|
|
74
|
+
"@ledgerhq/types-live": "^6.35.0-next.0"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/invariant": "^2.2.2",
|
|
78
|
+
"@types/jest": "^29.2.4",
|
|
79
|
+
"@types/lodash": "^4.14.191",
|
|
80
|
+
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
81
|
+
"@typescript-eslint/parser": "^5.46.1",
|
|
82
|
+
"eslint": "^7.32.0",
|
|
83
|
+
"eslint-config-prettier": "^8.3.0",
|
|
84
|
+
"eslint-config-typescript": "^3.0.0",
|
|
85
|
+
"eslint-formatter-pretty": "^3.0.1",
|
|
86
|
+
"eslint-plugin-prettier": "^3.4.0",
|
|
87
|
+
"eslint-plugin-typescript": "^0.14.0",
|
|
88
|
+
"jest": "^28.1.1",
|
|
89
|
+
"prettier": "^2.8.1",
|
|
90
|
+
"ts-jest": "^28.0.5"
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"clean": "rimraf lib lib-es",
|
|
94
|
+
"build": "tsc && tsc -m ES6 --outDir lib-es",
|
|
95
|
+
"prewatch": "pnpm build",
|
|
96
|
+
"watch": "tsc --watch",
|
|
97
|
+
"doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
|
|
98
|
+
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx",
|
|
99
|
+
"lint:fix": "pnpm lint --fix",
|
|
100
|
+
"test": "jest"
|
|
101
|
+
}
|
|
102
|
+
}
|