@avalabs/evm-module 0.0.22 → 0.1.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 (90) hide show
  1. package/LICENSE +9 -0
  2. package/dist/index.cjs +18 -20
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +2 -2
  5. package/dist/index.d.ts +2 -2
  6. package/dist/index.js +16 -17
  7. package/dist/index.js.map +1 -1
  8. package/package.json +14 -8
  9. package/.turbo/turbo-build.log +0 -22
  10. package/.turbo/turbo-lint.log +0 -4
  11. package/.turbo/turbo-test.log +0 -117
  12. package/CHANGELOG.md +0 -166
  13. package/jest.config.js +0 -9
  14. package/src/constants.ts +0 -1
  15. package/src/contracts/openzeppelin/ERC1155.ts +0 -440
  16. package/src/contracts/openzeppelin/ERC20.ts +0 -330
  17. package/src/contracts/openzeppelin/ERC721.ts +0 -420
  18. package/src/contracts/openzeppelin/common.ts +0 -131
  19. package/src/contracts/openzeppelin/factories/ERC1155__factory.ts +0 -388
  20. package/src/contracts/openzeppelin/factories/ERC20__factory.ts +0 -353
  21. package/src/contracts/openzeppelin/factories/ERC721__factory.ts +0 -413
  22. package/src/contracts/openzeppelin/factories/index.ts +0 -6
  23. package/src/contracts/openzeppelin/index.ts +0 -10
  24. package/src/env.ts +0 -25
  25. package/src/handlers/eth-send-transaction/eth-send-transaction.test.ts +0 -572
  26. package/src/handlers/eth-send-transaction/eth-send-transaction.ts +0 -189
  27. package/src/handlers/eth-send-transaction/schema.test.ts +0 -240
  28. package/src/handlers/eth-send-transaction/schema.ts +0 -20
  29. package/src/handlers/eth-sign/eth-sign.test.ts +0 -359
  30. package/src/handlers/eth-sign/eth-sign.ts +0 -158
  31. package/src/handlers/eth-sign/schemas/eth-sign-typed-data.ts +0 -65
  32. package/src/handlers/eth-sign/schemas/eth-sign.ts +0 -9
  33. package/src/handlers/eth-sign/schemas/parse-request-params/fixture.ts +0 -47
  34. package/src/handlers/eth-sign/schemas/parse-request-params/parse-request-params.test.ts +0 -284
  35. package/src/handlers/eth-sign/schemas/parse-request-params/parse-request-params.ts +0 -94
  36. package/src/handlers/eth-sign/schemas/personal-sign.ts +0 -12
  37. package/src/handlers/eth-sign/schemas/shared.ts +0 -5
  38. package/src/handlers/eth-sign/utils/beautify-message/beautify-message.test.ts +0 -29
  39. package/src/handlers/eth-sign/utils/beautify-message/beautify-message.ts +0 -134
  40. package/src/handlers/eth-sign/utils/is-typed-data-valid.ts +0 -26
  41. package/src/handlers/eth-sign/utils/typeguards.ts +0 -10
  42. package/src/handlers/forward-to-rpc-node/forward-to-rpc-node.test.ts +0 -90
  43. package/src/handlers/forward-to-rpc-node/forward-to-rpc-node.ts +0 -23
  44. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.test.ts +0 -78
  45. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.ts +0 -85
  46. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.test.ts +0 -97
  47. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.ts +0 -56
  48. package/src/handlers/get-balances/get-balances.test.ts +0 -249
  49. package/src/handlers/get-balances/get-balances.ts +0 -121
  50. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.test.ts +0 -72
  51. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.ts +0 -109
  52. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.test.ts +0 -60
  53. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.ts +0 -47
  54. package/src/handlers/get-network-fee/get-network-fee.test.ts +0 -43
  55. package/src/handlers/get-network-fee/get-network-fee.ts +0 -59
  56. package/src/handlers/get-tokens/get-tokens.test.ts +0 -100
  57. package/src/handlers/get-tokens/get-tokens.ts +0 -18
  58. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-erc20.ts +0 -51
  59. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-normal.ts +0 -58
  60. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/get-transaction-from-etherscan.test.ts +0 -116
  61. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/get-transaction-from-etherscan.ts +0 -73
  62. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/convert-transaction.ts +0 -47
  63. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-nft-metadata.ts +0 -35
  64. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-sender-info.ts +0 -38
  65. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-tokens.ts +0 -107
  66. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transaction-from-glacier.test.ts +0 -222
  67. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transactions-from-glacier.ts +0 -62
  68. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-tx-type.ts +0 -52
  69. package/src/handlers/get-transaction-history/get-transaction-history.test.ts +0 -57
  70. package/src/handlers/get-transaction-history/get-transaction-history.ts +0 -55
  71. package/src/handlers/get-transaction-history/utils/get-explorer-address-by-network.ts +0 -7
  72. package/src/handlers/get-transaction-history/utils/get-small-image-for-nft.ts +0 -16
  73. package/src/handlers/get-transaction-history/utils/ipfs-resolver-with-fallback.ts +0 -18
  74. package/src/handlers/get-transaction-history/utils/is-ethereum-chain-id.ts +0 -15
  75. package/src/handlers/get-transaction-history/utils/resolve.ts +0 -7
  76. package/src/index.ts +0 -3
  77. package/src/module.ts +0 -138
  78. package/src/services/glacier-service/glacier-service.ts +0 -238
  79. package/src/types.ts +0 -25
  80. package/src/utils/estimate-gas-limit.ts +0 -27
  81. package/src/utils/get-chain-id.ts +0 -12
  82. package/src/utils/get-nonce.ts +0 -11
  83. package/src/utils/get-provider.ts +0 -46
  84. package/src/utils/parse-erc20-transaction-type.ts +0 -35
  85. package/src/utils/process-transaction-simulation.test.ts +0 -105
  86. package/src/utils/process-transaction-simulation.ts +0 -293
  87. package/src/utils/scan-transaction.ts +0 -63
  88. package/tsconfig.jest.json +0 -7
  89. package/tsconfig.json +0 -14
  90. package/tsup.config.ts +0 -4
package/package.json CHANGED
@@ -1,23 +1,29 @@
1
1
  {
2
2
  "name": "@avalabs/evm-module",
3
- "version": "0.0.22",
3
+ "version": "0.1.0",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "module",
8
+ "files": [
9
+ "dist",
10
+ "manifest.json"
11
+ ],
12
+ "license": "Limited Ecosystem License",
8
13
  "dependencies": {
9
- "@avalabs/vm-module-types": "0.0.22",
10
- "@avalabs/coingecko-sdk": "v2.8.0-alpha.193",
11
- "@avalabs/utils-sdk": "2.8.0-alpha.193",
12
- "@avalabs/etherscan-sdk": "v2.8.0-alpha.193",
13
- "@avalabs/glacier-sdk": "v2.8.0-alpha.193",
14
- "@avalabs/wallets-sdk": "v2.8.0-alpha.193",
14
+ "@avalabs/vm-module-types": "0.1.0",
15
+ "@avalabs/coingecko-sdk": "v2.8.0-alpha.195",
16
+ "@avalabs/utils-sdk": "2.8.0-alpha.195",
17
+ "@avalabs/etherscan-sdk": "v2.8.0-alpha.195",
18
+ "@avalabs/glacier-sdk": "v2.8.0-alpha.195",
19
+ "@avalabs/wallets-sdk": "v2.8.0-alpha.195",
15
20
  "@blockaid/client": "0.11.0",
16
21
  "bn.js": "5.2.1",
17
22
  "lodash.startcase": "4.4.0",
18
23
  "@metamask/rpc-errors": "6.3.0",
19
24
  "zod": "3.23.8",
20
- "@zodios/core": "10.9.6"
25
+ "@zodios/core": "10.9.6",
26
+ "@avalabs/types": "2.8.0-alpha.193"
21
27
  },
22
28
  "devDependencies": {
23
29
  "typechain": "8.3.1",
@@ -1,22 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.22 build /home/runner/work/vm-modules/vm-modules/packages/evm-module
3
- > tsup
4
-
5
- CLI Building entry: ./src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v7.2.0
8
- CLI Using tsup config: /home/runner/work/vm-modules/vm-modules/packages/evm-module/tsup.config.ts
9
- CLI Target: es2021
10
- CLI Cleaning output folder
11
- CJS Build start
12
- ESM Build start
13
- DTS Build start
14
- CJS dist/index.cjs 49.87 KB
15
- CJS dist/index.cjs.map 163.68 KB
16
- CJS ⚡️ Build success in 4908ms
17
- ESM dist/index.js 48.02 KB
18
- ESM dist/index.js.map 163.68 KB
19
- ESM ⚡️ Build success in 4913ms
20
- DTS ⚡️ Build success in 31697ms
21
- DTS dist/index.d.cts 2.23 KB
22
- DTS dist/index.d.ts 2.23 KB
@@ -1,4 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.22 lint /home/runner/work/vm-modules/vm-modules/packages/evm-module
3
- > eslint "src/**/*.ts"
4
-
@@ -1,117 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.22 test /home/runner/work/vm-modules/vm-modules/packages/evm-module
3
- > jest
4
-
5
- PASS src/handlers/eth-send-transaction/eth-send-transaction.test.ts (35.828 s)
6
- ● Console
7
-
8
- console.error
9
- invalid params Error: Invalid params
10
- at Object.<anonymous> (/home/runner/work/vm-modules/vm-modules/packages/evm-module/src/handlers/eth-send-transaction/eth-send-transaction.test.ts:146:14)
11
- at Promise.then.completed (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/utils.js:298:28)
12
- at new Promise (<anonymous>)
13
- at callAsyncCircusFn (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/utils.js:231:10)
14
- at _callCircusTest (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/run.js:316:40)
15
- at _runTest (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/run.js:252:3)
16
- at _runTestsForDescribeBlock (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/run.js:126:9)
17
- at _runTestsForDescribeBlock (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/run.js:121:9)
18
- at run (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/run.js:71:3)
19
- at runAndTransformResultsToJestFormat (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
20
- at jestAdapter (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-circus@29.7.0/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
21
- at runTestInternal (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-runner@29.7.0/node_modules/jest-runner/build/runTest.js:367:16)
22
- at runTest (/home/runner/work/vm-modules/vm-modules/node_modules/.pnpm/jest-runner@29.7.0/node_modules/jest-runner/build/runTest.js:444:34)
23
-
24
-   35 |
25
-  36 | if (!result.success) {
26
- > 37 | console.error('invalid params', result.error);
27
-  | ^
28
-  38 | return {
29
-  39 | error: rpcErrors.invalidParams('Transaction params are invalid'),
30
-  40 | };
31
-
32
- at ethSendTransaction (src/handlers/eth-send-transaction/eth-send-transaction.ts:37:13)
33
- at Object.<anonymous> (src/handlers/eth-send-transaction/eth-send-transaction.test.ts:149:46)
34
-
35
- PASS src/handlers/eth-sign/eth-sign.test.ts
36
- ● Console
37
-
38
- console.error
39
- invalid params Invalid params
40
-
41
-   31 |
42
-  32 | if (!result.success) {
43
- > 33 | console.error('invalid params', result.error);
44
-  | ^
45
-  34 |
46
-  35 | return {
47
-  36 | success: false,
48
-
49
- at ethSign (src/handlers/eth-sign/eth-sign.ts:33:13)
50
- at Object.<anonymous> (src/handlers/eth-sign/eth-sign.test.ts:94:33)
51
-
52
- console.error
53
- processJsonRpcSimulation error { message: 'schema validation error' }
54
-
55
-   265 | }
56
-  266 | } catch (error) {
57
- > 267 | console.error('processJsonRpcSimulation error', error);
58
-  | ^
59
-  268 | alert = transactionAlerts[AlertType.WARNING];
60
-  269 | }
61
-  270 |
62
-
63
- at processJsonRpcSimulation (src/utils/process-transaction-simulation.ts:267:13)
64
- at ethSign (src/handlers/eth-sign/eth-sign.ts:119:7)
65
- at Object.<anonymous> (src/handlers/eth-sign/eth-sign.test.ts:242:20)
66
-
67
- console.error
68
- processJsonRpcSimulation error { message: 'schema validation error' }
69
-
70
-   265 | }
71
-  266 | } catch (error) {
72
- > 267 | console.error('processJsonRpcSimulation error', error);
73
-  | ^
74
-  268 | alert = transactionAlerts[AlertType.WARNING];
75
-  269 | }
76
-  270 |
77
-
78
- at processJsonRpcSimulation (src/utils/process-transaction-simulation.ts:267:13)
79
- at ethSign (src/handlers/eth-sign/eth-sign.ts:119:7)
80
- at Object.<anonymous> (src/handlers/eth-sign/eth-sign.test.ts:271:20)
81
-
82
- console.error
83
- processJsonRpcSimulation error { message: 'schema validation error' }
84
-
85
-   265 | }
86
-  266 | } catch (error) {
87
- > 267 | console.error('processJsonRpcSimulation error', error);
88
-  | ^
89
-  268 | alert = transactionAlerts[AlertType.WARNING];
90
-  269 | }
91
-  270 |
92
-
93
- at processJsonRpcSimulation (src/utils/process-transaction-simulation.ts:267:13)
94
- at ethSign (src/handlers/eth-sign/eth-sign.ts:119:7)
95
- at Object.<anonymous> (src/handlers/eth-sign/eth-sign.test.ts:288:20)
96
-
97
- PASS src/handlers/eth-sign/schemas/parse-request-params/parse-request-params.test.ts
98
- PASS src/handlers/get-balances/get-balances.test.ts
99
- PASS src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transaction-from-glacier.test.ts
100
- PASS src/handlers/eth-send-transaction/schema.test.ts
101
- PASS src/handlers/get-transaction-history/converters/etherscan-transaction-converter/get-transaction-from-etherscan.test.ts
102
- PASS src/handlers/get-tokens/get-tokens.test.ts
103
- PASS src/utils/process-transaction-simulation.test.ts
104
- PASS src/handlers/get-balances/evm-balance-service/get-native-token-balances.test.ts
105
- PASS src/handlers/forward-to-rpc-node/forward-to-rpc-node.test.ts
106
- PASS src/handlers/get-balances/glacier-balance-service/get-erc20-balances.test.ts
107
- PASS src/handlers/get-balances/evm-balance-service/get-erc20-balances.test.ts
108
- PASS src/handlers/get-transaction-history/get-transaction-history.test.ts
109
- PASS src/handlers/get-balances/glacier-balance-service/get-native-token-balances.test.ts
110
- PASS src/handlers/get-network-fee/get-network-fee.test.ts
111
- PASS src/handlers/eth-sign/utils/beautify-message/beautify-message.test.ts
112
-
113
- Test Suites: 17 passed, 17 total
114
- Tests: 82 passed, 82 total
115
- Snapshots: 0 total
116
- Time: 46.703 s
117
- Ran all test suites.
package/CHANGELOG.md DELETED
@@ -1,166 +0,0 @@
1
- # @avalabs/evm-module
2
-
3
- ## 0.0.22
4
-
5
- ### Patch Changes
6
-
7
- - a841a90: handle all eth\_\* methods
8
- - @avalabs/vm-module-types@0.0.22
9
-
10
- ## 0.0.21
11
-
12
- ### Patch Changes
13
-
14
- - @avalabs/vm-module-types@0.0.21
15
-
16
- ## 0.0.20
17
-
18
- ### Patch Changes
19
-
20
- - Updated dependencies [9bfa82d]
21
- - @avalabs/vm-module-types@0.0.20
22
-
23
- ## 0.0.19
24
-
25
- ### Patch Changes
26
-
27
- - 5af458b: Add getBalances to avalanche-module
28
- - Updated dependencies [5af458b]
29
- - @avalabs/vm-module-types@0.0.19
30
-
31
- ## 0.0.18
32
-
33
- ### Patch Changes
34
-
35
- - af310d3: handle blockaid schema error
36
- - @avalabs/vm-module-types@0.0.18
37
-
38
- ## 0.0.17
39
-
40
- ### Patch Changes
41
-
42
- - 3590edf: Transaction parsing, validation and simulation for EVM
43
- - Updated dependencies [3590edf]
44
- - @avalabs/vm-module-types@0.0.17
45
-
46
- ## 0.0.16
47
-
48
- ### Patch Changes
49
-
50
- - f39ff3a: Fixe internal dependencies
51
- - bc48457: add support for all eth_sign methods
52
- - Updated dependencies [bc48457]
53
- - @avalabs/vm-module-types@0.0.16
54
-
55
- ## 0.0.15
56
-
57
- ### Patch Changes
58
-
59
- - f536d58: add module functions to evm-module
60
- - Updated dependencies [f536d58]
61
- - @avalabs/vm-module-types@0.0.15
62
- - @internal/utils@0.0.3
63
-
64
- ## 0.0.14
65
-
66
- ### Patch Changes
67
-
68
- - 0593258: add getBalances to evm-module
69
- - Updated dependencies [0593258]
70
- - @avalabs/vm-module-types@0.0.14
71
- - @internal/utils@0.0.2
72
-
73
- ## 0.0.13
74
-
75
- ### Patch Changes
76
-
77
- - d9fa0f5: added getNetworkFee to avalanche module
78
- - Updated dependencies [af68c81]
79
- - Updated dependencies [d9fa0f5]
80
- - @avalabs/vm-module-types@0.0.13
81
-
82
- ## 0.0.12
83
-
84
- ### Patch Changes
85
-
86
- - d0c2cc9: make module interface more consistent
87
- - 3d8a9a5: test auto sign commit
88
- - 7bc6c6e: add eth_sendTransaction handler
89
- - Updated dependencies [cd97708]
90
- - Updated dependencies [d0c2cc9]
91
- - Updated dependencies [7bc6c6e]
92
- - @avalabs/vm-module-types@0.0.12
93
-
94
- ## 0.0.11
95
-
96
- ### Patch Changes
97
-
98
- - e62b48a: update getTransactionHistory:getTxType logic
99
- - @avalabs/vm-module-types@0.0.11
100
-
101
- ## 0.0.10
102
-
103
- ### Patch Changes
104
-
105
- - 60f36fa: add getTokens function
106
- - Updated dependencies [60f36fa]
107
- - @avalabs/vm-module-types@0.0.10
108
-
109
- ## 0.0.9
110
-
111
- ### Patch Changes
112
-
113
- - 6ffa356: add module functions to evm-module
114
- - Updated dependencies [6ffa356]
115
- - @avalabs/vm-module-types@0.0.9
116
-
117
- ## 0.0.8
118
-
119
- ### Patch Changes
120
-
121
- - Updated dependencies [d1d080f]
122
- - @avalabs/vm-module-types@0.0.8
123
-
124
- ## 0.0.7
125
-
126
- ### Patch Changes
127
-
128
- - bb98621: Move types to @avalabs/vm-module-types
129
- - Updated dependencies [bb98621]
130
- - @avalabs/vm-module-types@0.0.7
131
-
132
- ## 0.0.6
133
-
134
- ### Patch Changes
135
-
136
- - 1122704: test release
137
- - Updated dependencies [1122704]
138
- - @avalabs/vm-module-types@0.0.6
139
-
140
- ## 0.0.5
141
-
142
- ### Patch Changes
143
-
144
- - 0b0c52e: Move types to @avalabs/vm-module-types
145
- - Updated dependencies [0b0c52e]
146
- - @avalabs/vm-module-types@0.0.3
147
-
148
- ## 0.0.4
149
-
150
- ### Patch Changes
151
-
152
- - 4b7d5e9: Move types from packages-internal/types to packages/types
153
- - Updated dependencies [4b7d5e9]
154
- - @avalabs/vm-module-types@0.0.2
155
-
156
- ## 0.0.3
157
-
158
- ### Patch Changes
159
-
160
- - 5d5e2e2: Add GetNetworkFee and GetTransactionHistory to evm module
161
-
162
- ## 0.0.2
163
-
164
- ### Patch Changes
165
-
166
- - 0992961: move types to devDependencies
package/jest.config.js DELETED
@@ -1,9 +0,0 @@
1
- /** @type {import('ts-jest').JestConfigWithTsJest} */
2
- export default {
3
- clearMocks: true,
4
- preset: 'ts-jest',
5
- testEnvironment: 'node',
6
- transform: {
7
- '.ts': ['ts-jest', { tsconfig: './tsconfig.jest.json' }],
8
- },
9
- };
package/src/constants.ts DELETED
@@ -1 +0,0 @@
1
- export const DEFAULT_DECIMALS = 18;