@exodus/web3-ethereum 2.5.0 → 2.7.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.
|
@@ -25,8 +25,18 @@ export function parseAndValidateTypedData(typedData, { chainId: activeChainId })
|
|
|
25
25
|
throw new InvalidInputError();
|
|
26
26
|
}
|
|
27
27
|
const allowedFieldsSet = new Set(parsedTypedData.types[parsedTypedData.primaryType].map(({ name }) => name));
|
|
28
|
+
// Handle cases where the message includes fields that doesn't belong to the primary type.
|
|
29
|
+
const isFieldExempted = (field) => {
|
|
30
|
+
// Handle OpenSea case. See: https://github.com/status-im/status-mobile/issues/13769
|
|
31
|
+
if (field === 'totalOriginalConsiderationItems' &&
|
|
32
|
+
parsedTypedData.primaryType === 'OrderComponents' &&
|
|
33
|
+
parsedTypedData.message['consideration']) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
return false;
|
|
37
|
+
};
|
|
28
38
|
for (const field in parsedTypedData.message) {
|
|
29
|
-
if (!allowedFieldsSet.has(field)) {
|
|
39
|
+
if (!allowedFieldsSet.has(field) && !isFieldExempted(field)) {
|
|
30
40
|
throw new InvalidInputError(`field '${field}' is not defined in the primary type definition`);
|
|
31
41
|
}
|
|
32
42
|
}
|
|
@@ -325,19 +325,22 @@ export function validateRequest(value) {
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
if ('gasPrice' in data && hasOwn(data, 'gasPrice')) {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
328
|
+
let passes2 = 0
|
|
329
|
+
const sub17 = (() => {
|
|
330
|
+
if (!(typeof data.gasPrice === 'string')) return false
|
|
331
|
+
if (!format4.test(data.gasPrice)) return false
|
|
332
|
+
return true
|
|
333
|
+
})()
|
|
334
|
+
if (sub17) passes2++
|
|
335
|
+
const sub18 = (() => {
|
|
336
|
+
if (!(data.gasPrice === null)) return false
|
|
337
|
+
return true
|
|
338
|
+
})()
|
|
339
|
+
if (sub18) passes2++
|
|
340
|
+
if (passes2 !== 1) {
|
|
338
341
|
validate.errors = [
|
|
339
342
|
{
|
|
340
|
-
keywordLocation: '#/properties/gasPrice/
|
|
343
|
+
keywordLocation: '#/properties/gasPrice/oneOf',
|
|
341
344
|
instanceLocation: '#/gasPrice',
|
|
342
345
|
},
|
|
343
346
|
]
|
|
@@ -388,19 +391,19 @@ export function validateRequest(value) {
|
|
|
388
391
|
'maxPriorityFeePerGas' in data &&
|
|
389
392
|
hasOwn(data, 'maxPriorityFeePerGas')
|
|
390
393
|
) {
|
|
391
|
-
let
|
|
392
|
-
const
|
|
394
|
+
let passes3 = 0
|
|
395
|
+
const sub19 = (() => {
|
|
393
396
|
if (!(typeof data.maxPriorityFeePerGas === 'string')) return false
|
|
394
397
|
if (!format1.test(data.maxPriorityFeePerGas)) return false
|
|
395
398
|
return true
|
|
396
399
|
})()
|
|
397
|
-
if (
|
|
398
|
-
const
|
|
400
|
+
if (sub19) passes3++
|
|
401
|
+
const sub20 = (() => {
|
|
399
402
|
if (!(data.maxPriorityFeePerGas === null)) return false
|
|
400
403
|
return true
|
|
401
404
|
})()
|
|
402
|
-
if (
|
|
403
|
-
if (
|
|
405
|
+
if (sub20) passes3++
|
|
406
|
+
if (passes3 !== 1) {
|
|
404
407
|
validate.errors = [
|
|
405
408
|
{
|
|
406
409
|
keywordLocation: '#/properties/maxPriorityFeePerGas/oneOf',
|
|
@@ -411,19 +414,19 @@ export function validateRequest(value) {
|
|
|
411
414
|
}
|
|
412
415
|
}
|
|
413
416
|
if ('maxFeePerGas' in data && hasOwn(data, 'maxFeePerGas')) {
|
|
414
|
-
let
|
|
415
|
-
const
|
|
417
|
+
let passes4 = 0
|
|
418
|
+
const sub21 = (() => {
|
|
416
419
|
if (!(typeof data.maxFeePerGas === 'string')) return false
|
|
417
420
|
if (!format1.test(data.maxFeePerGas)) return false
|
|
418
421
|
return true
|
|
419
422
|
})()
|
|
420
|
-
if (
|
|
421
|
-
const
|
|
423
|
+
if (sub21) passes4++
|
|
424
|
+
const sub22 = (() => {
|
|
422
425
|
if (!(data.maxFeePerGas === null)) return false
|
|
423
426
|
return true
|
|
424
427
|
})()
|
|
425
|
-
if (
|
|
426
|
-
if (
|
|
428
|
+
if (sub22) passes4++
|
|
429
|
+
if (passes4 !== 1) {
|
|
427
430
|
validate.errors = [
|
|
428
431
|
{
|
|
429
432
|
keywordLocation: '#/properties/maxFeePerGas/oneOf',
|
|
@@ -1031,14 +1034,14 @@ export function validateRequest(value) {
|
|
|
1031
1034
|
}
|
|
1032
1035
|
}
|
|
1033
1036
|
if ('image' in data && hasOwn(data, 'image')) {
|
|
1034
|
-
let
|
|
1035
|
-
const
|
|
1037
|
+
let passes5 = 0
|
|
1038
|
+
const sub23 = (() => {
|
|
1036
1039
|
if (!(typeof data.image === 'string')) return false
|
|
1037
1040
|
if (!format6.test(data.image)) return false
|
|
1038
1041
|
return true
|
|
1039
1042
|
})()
|
|
1040
|
-
if (
|
|
1041
|
-
const
|
|
1043
|
+
if (sub23) passes5++
|
|
1044
|
+
const sub24 = (() => {
|
|
1042
1045
|
const err38 = validate.errors
|
|
1043
1046
|
const res38 = ref16(data.image)
|
|
1044
1047
|
const suberr38 = ref16.errors
|
|
@@ -1046,8 +1049,8 @@ export function validateRequest(value) {
|
|
|
1046
1049
|
if (!res38) return false
|
|
1047
1050
|
return true
|
|
1048
1051
|
})()
|
|
1049
|
-
if (
|
|
1050
|
-
if (
|
|
1052
|
+
if (sub24) passes5++
|
|
1053
|
+
if (passes5 !== 1) {
|
|
1051
1054
|
validate.errors = [
|
|
1052
1055
|
{
|
|
1053
1056
|
keywordLocation: '#/properties/image/oneOf',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/web3-ethereum",
|
|
3
3
|
"description": "Apps connectivity library for EVM-compatible chains.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"module": "lib/index.js",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@exodus/currency": "^2.1.2",
|
|
35
35
|
"@exodus/ethereum-api": "^6.0.0",
|
|
36
|
-
"@exodus/web3-constants": "^1.
|
|
37
|
-
"@exodus/web3-ethereum-utils": "^1.
|
|
38
|
-
"@exodus/web3-provider": "^2.
|
|
39
|
-
"@exodus/web3-rpc-handlers": "^0.
|
|
36
|
+
"@exodus/web3-constants": "^1.20.0",
|
|
37
|
+
"@exodus/web3-ethereum-utils": "^1.10.0",
|
|
38
|
+
"@exodus/web3-provider": "^2.18.0",
|
|
39
|
+
"@exodus/web3-rpc-handlers": "^0.15.0",
|
|
40
40
|
"bn.js": "^5.2.0",
|
|
41
41
|
"eth-rpc-errors": "^4.0.3"
|
|
42
42
|
},
|
|
@@ -44,11 +44,12 @@
|
|
|
44
44
|
"@exodus/assets": "^8.0.72",
|
|
45
45
|
"@exodus/json-rpc": "^1.11.0",
|
|
46
46
|
"@exodus/schemasafe": "^1.0.0",
|
|
47
|
-
"@exodus/web3-types": "^1.
|
|
48
|
-
"@exodus/web3-validation": "^1.
|
|
47
|
+
"@exodus/web3-types": "^1.16.0",
|
|
48
|
+
"@exodus/web3-validation": "^1.34.0",
|
|
49
49
|
"@wallet-standard/base": "^1.0.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@exodus/assets": "^8.0.72"
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
|
+
"gitHead": "88c28467495b5524e3d0d0080e58ea9d5fbe7b11"
|
|
54
55
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to
|
|
7
|
-
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
8
|
-
|
|
9
|
-
## [Unreleased]
|
|
10
|
-
|
|
11
|
-
## [2.5.0] - 2023-06-07
|
|
12
|
-
|
|
13
|
-
### Changed
|
|
14
|
-
|
|
15
|
-
- Use a simplified `getNonce` dependency (doesn't require arguments)
|
|
16
|
-
|
|
17
|
-
## [2.4.1] - 2023-06-05
|
|
18
|
-
|
|
19
|
-
### Added
|
|
20
|
-
|
|
21
|
-
- chore(ethereum): build ethereum dependencies based on hydra modules (#502)
|
|
22
|
-
|
|
23
|
-
### Fixed
|
|
24
|
-
|
|
25
|
-
- fix(ethereum): harden typed data validation (#508)
|
|
26
|
-
- fix(ethereum): untangle balance weirdness (#506)
|
|
27
|
-
|
|
28
|
-
## [2.4.0] - 2023-05-29
|
|
29
|
-
|
|
30
|
-
### Fixed
|
|
31
|
-
|
|
32
|
-
- fix(ethereum): TS compilation errors (#498)
|
|
33
|
-
- fix: rename ethereum:provider to eip1193:provider (#499)
|
|
34
|
-
|
|
35
|
-
## [2.3.0] - 2023-05-18
|
|
36
|
-
|
|
37
|
-
### Fixed
|
|
38
|
-
|
|
39
|
-
- fix(web3): resolve error on approving token for swap (#485)
|
|
40
|
-
- fix: rename ethereum:provider to eip1193:provider (#499)
|
|
41
|
-
|
|
42
|
-
## [2.1.1] - 2023-05-11
|
|
43
|
-
|
|
44
|
-
### Fixed
|
|
45
|
-
|
|
46
|
-
- Validation for signing typed data.
|
|
47
|
-
|
|
48
|
-
### Changed
|
|
49
|
-
|
|
50
|
-
- Ensure mainnet (`0x1`) is always a first supported chain ID
|
|
51
|
-
|
|
52
|
-
## [2.0.0] - 2023-05-11
|
|
53
|
-
|
|
54
|
-
### Changed
|
|
55
|
-
|
|
56
|
-
- Breaking: accept `getAsset` dependency instead of `asset`.
|
|
57
|
-
- Breaking: make RPC validate parsed requests.
|
|
58
|
-
|
|
59
|
-
## [1.5.1] - 2023-04-06
|
|
60
|
-
|
|
61
|
-
### Fixed
|
|
62
|
-
|
|
63
|
-
- Convert methods in the provider to properties with arrow functions.
|
|
64
|
-
- Convert chain ID from `getDefaultChainId` to lower case
|
|
65
|
-
|
|
66
|
-
## [1.5.0] - 2023-04-05
|
|
67
|
-
|
|
68
|
-
### Changed
|
|
69
|
-
|
|
70
|
-
- Supply simulated changes to the approval function
|
|
71
|
-
|
|
72
|
-
## [1.4.6] - 2023-03-27
|
|
73
|
-
|
|
74
|
-
### Fixed
|
|
75
|
-
|
|
76
|
-
- `eth_getLogs` method validation (allow null in an array)
|
|
77
|
-
|
|
78
|
-
## [1.4.4] - 2023-03-26
|
|
79
|
-
|
|
80
|
-
### Fixed
|
|
81
|
-
|
|
82
|
-
- Don't change the Approve Transaction title if no token symbol found
|
|
83
|
-
- `eth_getLogs` method validation
|
|
84
|
-
|
|
85
|
-
## [1.4.2] - 2023-03-22
|
|
86
|
-
|
|
87
|
-
### Fixed
|
|
88
|
-
|
|
89
|
-
- Returning a possibly mutated object in `validateRequestWithPrefix`
|
|
90
|
-
|
|
91
|
-
## [1.4.1] - 2023-03-15
|
|
92
|
-
|
|
93
|
-
### Changed
|
|
94
|
-
|
|
95
|
-
- Properly check if `getDefaultChainId` is undefined in provider constructor
|
|
96
|
-
|
|
97
|
-
## [1.4.0] - 2023-03-01
|
|
98
|
-
|
|
99
|
-
### Changed
|
|
100
|
-
|
|
101
|
-
- Unpin `ethereum-api` package version
|
|
102
|
-
|
|
103
|
-
## [1.3.0] - 2023-02-28
|
|
104
|
-
|
|
105
|
-
### Changed
|
|
106
|
-
|
|
107
|
-
- Use arrow functions for compatibility with React bundler
|
|
108
|
-
|
|
109
|
-
## [1.2.0] - 2023-02-27
|
|
110
|
-
|
|
111
|
-
### Added
|
|
112
|
-
|
|
113
|
-
- Implement RPC functions
|
|
114
|
-
|
|
115
|
-
## [1.1.0] - 2023-02-22
|
|
116
|
-
|
|
117
|
-
### Changed
|
|
118
|
-
|
|
119
|
-
- Rework simulate transaction api
|
|
120
|
-
- Package structure
|
|
121
|
-
|
|
122
|
-
## [1.0.0] - 2023-02-20
|
|
123
|
-
|
|
124
|
-
Initial release.
|
|
125
|
-
|
|
126
|
-
[unreleased]:
|
|
127
|
-
https://github.com/ExodusMovement/exodus-web3/compare/db3e8cfd7d2f3cb908bb675cff1ca7981bbd1b09...master
|
|
128
|
-
[1.0.0]:
|
|
129
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/c220026347ce27cfc25bacc083d61b1aae5c876b)
|
|
130
|
-
[1.1.0]:
|
|
131
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/75254d697e3ffd2d95759e30425c30c7fb7fa654)
|
|
132
|
-
[1.2.0]:
|
|
133
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/39137384d78bfa3e008b92e47e106a7be1df071e)
|
|
134
|
-
[1.3.0]:
|
|
135
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/91de31ee30652f2f8acc66f6e1d909fd27174a36)
|
|
136
|
-
[1.4.0]:
|
|
137
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/bbba5c8aa7d663deec5f649250421777c855341a)
|
|
138
|
-
[1.4.1]:
|
|
139
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/cd3382acdb92fd0dafbb2f2f49b0cc9a648d6e2c)
|
|
140
|
-
[1.4.2]:
|
|
141
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/c414d2c359ecbd25fe1b4d244f6fb51f633a4284)
|
|
142
|
-
[1.4.4]:
|
|
143
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/e48f74f32e040de9e86ef77ea48058d5c0b36c86)
|
|
144
|
-
[1.4.6]:
|
|
145
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/4d9d6eed59fbe201c1e6f2abb4b50f1f336bc690)
|
|
146
|
-
[1.5.0]:
|
|
147
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/4a0c077d0175fe3c6a35e2f9a459f8cad214e8f6)
|
|
148
|
-
[1.5.1]:
|
|
149
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/0576160a36d260f5f63789ddd28c18c9d8885e7b)
|
|
150
|
-
[2.0.0]:
|
|
151
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/54f84cf089d1dffd5dafd443fc2aacb8dd0fc962)
|
|
152
|
-
[2.1.1]:
|
|
153
|
-
(https://github.com/ExodusMovement/exodus-web3/commit/db3e8cfd7d2f3cb908bb675cff1ca7981bbd1b09)
|