@avalabs/evm-module 0.0.23 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +1 -1
  3. package/dist/index.cjs +6 -6
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +5 -5
  6. package/dist/index.js.map +1 -1
  7. package/package.json +13 -8
  8. package/.turbo/turbo-build.log +0 -22
  9. package/.turbo/turbo-lint.log +0 -4
  10. package/.turbo/turbo-test.log +0 -119
  11. package/CHANGELOG.md +0 -174
  12. package/jest.config.js +0 -9
  13. package/src/constants.ts +0 -1
  14. package/src/contracts/openzeppelin/ERC1155.ts +0 -440
  15. package/src/contracts/openzeppelin/ERC20.ts +0 -330
  16. package/src/contracts/openzeppelin/ERC721.ts +0 -420
  17. package/src/contracts/openzeppelin/common.ts +0 -131
  18. package/src/contracts/openzeppelin/factories/ERC1155__factory.ts +0 -388
  19. package/src/contracts/openzeppelin/factories/ERC20__factory.ts +0 -353
  20. package/src/contracts/openzeppelin/factories/ERC721__factory.ts +0 -413
  21. package/src/contracts/openzeppelin/factories/index.ts +0 -6
  22. package/src/contracts/openzeppelin/index.ts +0 -10
  23. package/src/env.ts +0 -25
  24. package/src/handlers/eth-send-transaction/eth-send-transaction.test.ts +0 -572
  25. package/src/handlers/eth-send-transaction/eth-send-transaction.ts +0 -189
  26. package/src/handlers/eth-send-transaction/schema.test.ts +0 -240
  27. package/src/handlers/eth-send-transaction/schema.ts +0 -20
  28. package/src/handlers/eth-sign/eth-sign.test.ts +0 -359
  29. package/src/handlers/eth-sign/eth-sign.ts +0 -158
  30. package/src/handlers/eth-sign/schemas/eth-sign-typed-data.ts +0 -65
  31. package/src/handlers/eth-sign/schemas/eth-sign.ts +0 -9
  32. package/src/handlers/eth-sign/schemas/parse-request-params/fixture.ts +0 -47
  33. package/src/handlers/eth-sign/schemas/parse-request-params/parse-request-params.test.ts +0 -284
  34. package/src/handlers/eth-sign/schemas/parse-request-params/parse-request-params.ts +0 -94
  35. package/src/handlers/eth-sign/schemas/personal-sign.ts +0 -12
  36. package/src/handlers/eth-sign/schemas/shared.ts +0 -5
  37. package/src/handlers/eth-sign/utils/beautify-message/beautify-message.test.ts +0 -29
  38. package/src/handlers/eth-sign/utils/beautify-message/beautify-message.ts +0 -134
  39. package/src/handlers/eth-sign/utils/is-typed-data-valid.ts +0 -26
  40. package/src/handlers/eth-sign/utils/typeguards.ts +0 -10
  41. package/src/handlers/forward-to-rpc-node/forward-to-rpc-node.test.ts +0 -90
  42. package/src/handlers/forward-to-rpc-node/forward-to-rpc-node.ts +0 -23
  43. package/src/handlers/get-address/get-address.ts +0 -26
  44. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.test.ts +0 -77
  45. package/src/handlers/get-balances/evm-balance-service/get-erc20-balances.ts +0 -81
  46. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.test.ts +0 -96
  47. package/src/handlers/get-balances/evm-balance-service/get-native-token-balances.ts +0 -53
  48. package/src/handlers/get-balances/get-balances.test.ts +0 -248
  49. package/src/handlers/get-balances/get-balances.ts +0 -123
  50. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.test.ts +0 -71
  51. package/src/handlers/get-balances/glacier-balance-service/get-erc20-balances.ts +0 -106
  52. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.test.ts +0 -59
  53. package/src/handlers/get-balances/glacier-balance-service/get-native-token-balances.ts +0 -48
  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.test.ts +0 -53
  59. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-erc20.ts +0 -49
  60. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-normal.test.ts +0 -57
  61. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-normal.ts +0 -57
  62. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/get-transaction-from-etherscan.test.ts +0 -116
  63. package/src/handlers/get-transaction-history/converters/etherscan-transaction-converter/get-transaction-from-etherscan.ts +0 -73
  64. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/convert-transaction.ts +0 -47
  65. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-nft-metadata.ts +0 -35
  66. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-sender-info.ts +0 -38
  67. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-tokens.ts +0 -106
  68. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transaction-from-glacier.test.ts +0 -222
  69. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-transactions-from-glacier.ts +0 -62
  70. package/src/handlers/get-transaction-history/converters/evm-transaction-converter/get-tx-type.ts +0 -52
  71. package/src/handlers/get-transaction-history/get-transaction-history.test.ts +0 -57
  72. package/src/handlers/get-transaction-history/get-transaction-history.ts +0 -55
  73. package/src/handlers/get-transaction-history/utils/get-explorer-address-by-network.ts +0 -7
  74. package/src/handlers/get-transaction-history/utils/get-small-image-for-nft.ts +0 -16
  75. package/src/handlers/get-transaction-history/utils/ipfs-resolver-with-fallback.ts +0 -18
  76. package/src/handlers/get-transaction-history/utils/is-ethereum-chain-id.ts +0 -15
  77. package/src/handlers/get-transaction-history/utils/resolve.ts +0 -7
  78. package/src/index.ts +0 -3
  79. package/src/module.ts +0 -141
  80. package/src/services/glacier-service/glacier-service.ts +0 -238
  81. package/src/types.ts +0 -25
  82. package/src/utils/estimate-gas-limit.ts +0 -27
  83. package/src/utils/get-chain-id.ts +0 -12
  84. package/src/utils/get-nonce.ts +0 -11
  85. package/src/utils/get-provider.ts +0 -46
  86. package/src/utils/parse-erc20-transaction-type.ts +0 -35
  87. package/src/utils/process-transaction-simulation.test.ts +0 -105
  88. package/src/utils/process-transaction-simulation.ts +0 -293
  89. package/src/utils/scan-transaction.ts +0 -63
  90. package/tsconfig.jest.json +0 -7
  91. package/tsconfig.json +0 -14
  92. package/tsup.config.ts +0 -4
package/package.json CHANGED
@@ -1,24 +1,29 @@
1
1
  {
2
2
  "name": "@avalabs/evm-module",
3
- "version": "0.0.23",
3
+ "version": "0.1.1",
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.23",
10
- "@avalabs/coingecko-sdk": "v2.8.0-alpha.195",
11
- "@avalabs/utils-sdk": "2.8.0-alpha.195",
12
- "@avalabs/etherscan-sdk": "v2.8.0-alpha.195",
13
- "@avalabs/glacier-sdk": "v2.8.0-alpha.195",
14
- "@avalabs/wallets-sdk": "v2.8.0-alpha.195",
14
+ "@avalabs/vm-module-types": "0.1.1",
15
+ "@avalabs/core-coingecko-sdk": "3.0.0",
16
+ "@avalabs/core-utils-sdk": "3.0.0",
17
+ "@avalabs/core-etherscan-sdk": "3.0.0",
18
+ "@avalabs/glacier-sdk": "3.0.0",
19
+ "@avalabs/core-wallets-sdk": "3.0.0",
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
25
  "@zodios/core": "10.9.6",
21
- "@avalabs/types": "2.8.0-alpha.193"
26
+ "@avalabs/types": "3.0.0"
22
27
  },
23
28
  "devDependencies": {
24
29
  "typechain": "8.3.1",
@@ -1,22 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.23 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 50.18 KB
15
- CJS dist/index.cjs.map 165.04 KB
16
- CJS ⚡️ Build success in 4556ms
17
- ESM dist/index.js 48.29 KB
18
- ESM dist/index.js.map 165.04 KB
19
- ESM ⚡️ Build success in 4560ms
20
- DTS ⚡️ Build success in 29581ms
21
- DTS dist/index.d.cts 2.33 KB
22
- DTS dist/index.d.ts 2.33 KB
@@ -1,4 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.23 lint /home/runner/work/vm-modules/vm-modules/packages/evm-module
3
- > eslint "src/**/*.ts"
4
-
@@ -1,119 +0,0 @@
1
-
2
- > @avalabs/evm-module@0.0.23 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 (34.428 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-transaction-history/converters/etherscan-transaction-converter/convert-transaction-normal.test.ts
111
- PASS src/handlers/get-transaction-history/converters/etherscan-transaction-converter/convert-transaction-erc20.test.ts
112
- PASS src/handlers/get-network-fee/get-network-fee.test.ts
113
- PASS src/handlers/eth-sign/utils/beautify-message/beautify-message.test.ts
114
-
115
- Test Suites: 19 passed, 19 total
116
- Tests: 84 passed, 84 total
117
- Snapshots: 0 total
118
- Time: 45.29 s
119
- Ran all test suites.
package/CHANGELOG.md DELETED
@@ -1,174 +0,0 @@
1
- # @avalabs/evm-module
2
-
3
- ## 0.0.23
4
-
5
- ### Patch Changes
6
-
7
- - fbdefd2: Replace BN with bigint
8
- - Updated dependencies [fbdefd2]
9
- - @avalabs/vm-module-types@0.0.23
10
-
11
- ## 0.0.22
12
-
13
- ### Patch Changes
14
-
15
- - a841a90: handle all eth\_\* methods
16
- - @avalabs/vm-module-types@0.0.22
17
-
18
- ## 0.0.21
19
-
20
- ### Patch Changes
21
-
22
- - @avalabs/vm-module-types@0.0.21
23
-
24
- ## 0.0.20
25
-
26
- ### Patch Changes
27
-
28
- - Updated dependencies [9bfa82d]
29
- - @avalabs/vm-module-types@0.0.20
30
-
31
- ## 0.0.19
32
-
33
- ### Patch Changes
34
-
35
- - 5af458b: Add getBalances to avalanche-module
36
- - Updated dependencies [5af458b]
37
- - @avalabs/vm-module-types@0.0.19
38
-
39
- ## 0.0.18
40
-
41
- ### Patch Changes
42
-
43
- - af310d3: handle blockaid schema error
44
- - @avalabs/vm-module-types@0.0.18
45
-
46
- ## 0.0.17
47
-
48
- ### Patch Changes
49
-
50
- - 3590edf: Transaction parsing, validation and simulation for EVM
51
- - Updated dependencies [3590edf]
52
- - @avalabs/vm-module-types@0.0.17
53
-
54
- ## 0.0.16
55
-
56
- ### Patch Changes
57
-
58
- - f39ff3a: Fixe internal dependencies
59
- - bc48457: add support for all eth_sign methods
60
- - Updated dependencies [bc48457]
61
- - @avalabs/vm-module-types@0.0.16
62
-
63
- ## 0.0.15
64
-
65
- ### Patch Changes
66
-
67
- - f536d58: add module functions to evm-module
68
- - Updated dependencies [f536d58]
69
- - @avalabs/vm-module-types@0.0.15
70
- - @internal/utils@0.0.3
71
-
72
- ## 0.0.14
73
-
74
- ### Patch Changes
75
-
76
- - 0593258: add getBalances to evm-module
77
- - Updated dependencies [0593258]
78
- - @avalabs/vm-module-types@0.0.14
79
- - @internal/utils@0.0.2
80
-
81
- ## 0.0.13
82
-
83
- ### Patch Changes
84
-
85
- - d9fa0f5: added getNetworkFee to avalanche module
86
- - Updated dependencies [af68c81]
87
- - Updated dependencies [d9fa0f5]
88
- - @avalabs/vm-module-types@0.0.13
89
-
90
- ## 0.0.12
91
-
92
- ### Patch Changes
93
-
94
- - d0c2cc9: make module interface more consistent
95
- - 3d8a9a5: test auto sign commit
96
- - 7bc6c6e: add eth_sendTransaction handler
97
- - Updated dependencies [cd97708]
98
- - Updated dependencies [d0c2cc9]
99
- - Updated dependencies [7bc6c6e]
100
- - @avalabs/vm-module-types@0.0.12
101
-
102
- ## 0.0.11
103
-
104
- ### Patch Changes
105
-
106
- - e62b48a: update getTransactionHistory:getTxType logic
107
- - @avalabs/vm-module-types@0.0.11
108
-
109
- ## 0.0.10
110
-
111
- ### Patch Changes
112
-
113
- - 60f36fa: add getTokens function
114
- - Updated dependencies [60f36fa]
115
- - @avalabs/vm-module-types@0.0.10
116
-
117
- ## 0.0.9
118
-
119
- ### Patch Changes
120
-
121
- - 6ffa356: add module functions to evm-module
122
- - Updated dependencies [6ffa356]
123
- - @avalabs/vm-module-types@0.0.9
124
-
125
- ## 0.0.8
126
-
127
- ### Patch Changes
128
-
129
- - Updated dependencies [d1d080f]
130
- - @avalabs/vm-module-types@0.0.8
131
-
132
- ## 0.0.7
133
-
134
- ### Patch Changes
135
-
136
- - bb98621: Move types to @avalabs/vm-module-types
137
- - Updated dependencies [bb98621]
138
- - @avalabs/vm-module-types@0.0.7
139
-
140
- ## 0.0.6
141
-
142
- ### Patch Changes
143
-
144
- - 1122704: test release
145
- - Updated dependencies [1122704]
146
- - @avalabs/vm-module-types@0.0.6
147
-
148
- ## 0.0.5
149
-
150
- ### Patch Changes
151
-
152
- - 0b0c52e: Move types to @avalabs/vm-module-types
153
- - Updated dependencies [0b0c52e]
154
- - @avalabs/vm-module-types@0.0.3
155
-
156
- ## 0.0.4
157
-
158
- ### Patch Changes
159
-
160
- - 4b7d5e9: Move types from packages-internal/types to packages/types
161
- - Updated dependencies [4b7d5e9]
162
- - @avalabs/vm-module-types@0.0.2
163
-
164
- ## 0.0.3
165
-
166
- ### Patch Changes
167
-
168
- - 5d5e2e2: Add GetNetworkFee and GetTransactionHistory to evm module
169
-
170
- ## 0.0.2
171
-
172
- ### Patch Changes
173
-
174
- - 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;