@exodus/ethereum-api 8.53.6 → 8.54.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/CHANGELOG.md +10 -0
- package/package.json +2 -2
- package/src/tx-type/index.js +29 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [8.54.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.53.6...@exodus/ethereum-api@8.54.0) (2025-10-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: enable contract deployment via evm asset api (#6742)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
6
16
|
## [8.53.6](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.53.5...@exodus/ethereum-api@8.53.6) (2025-10-23)
|
|
7
17
|
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.54.0",
|
|
4
4
|
"description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Ethereum and EVM-based blockchains",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"type": "git",
|
|
68
68
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "bcb81073e271d505ae3f11c60a6d5e1857f67a28"
|
|
71
71
|
}
|
package/src/tx-type/index.js
CHANGED
|
@@ -6,8 +6,9 @@ import assert from 'minimalistic-assert'
|
|
|
6
6
|
import { isContractAddressCached } from '../eth-like-util.js'
|
|
7
7
|
|
|
8
8
|
export const TX_TYPE_TRANSFER = 'transfer'
|
|
9
|
+
export const TX_TYPE_CREATE_CONTRACT = 'create-contract'
|
|
9
10
|
|
|
10
|
-
const VALID_TX_TYPES = new Set([TX_TYPE_TRANSFER])
|
|
11
|
+
const VALID_TX_TYPES = new Set([TX_TYPE_TRANSFER, TX_TYPE_CREATE_CONTRACT])
|
|
11
12
|
|
|
12
13
|
export const isValidTxType = (txType) => VALID_TX_TYPES.has(txType)
|
|
13
14
|
|
|
@@ -33,14 +34,21 @@ export const assertCriticalTxAttributes = (criticalTxAttributes) => {
|
|
|
33
34
|
const { amount, toAddress, txInput, txToAddress, txType, txValue } = criticalTxAttributes
|
|
34
35
|
|
|
35
36
|
assert(amount instanceof NumberUnit, 'expected NumberUnit amount')
|
|
36
|
-
assert(typeof toAddress === 'string', 'expected string toAddress')
|
|
37
37
|
assert(
|
|
38
38
|
typeof txInput === 'string' && txInput.startsWith('0x', 'expected hexadecimal string txInput')
|
|
39
39
|
)
|
|
40
|
-
assert(typeof txToAddress === 'string', 'expected string txToAddress')
|
|
41
40
|
assert(isValidTxType(txType), 'expected valid txType')
|
|
42
41
|
assert(txValue instanceof NumberUnit, 'expected NumberUnit txValue')
|
|
43
42
|
|
|
43
|
+
if (txType === TX_TYPE_CREATE_CONTRACT) {
|
|
44
|
+
assert(toAddress === null, 'expected null toAddress')
|
|
45
|
+
assert(txToAddress === null, 'expected null txToAddress')
|
|
46
|
+
assert(txInput !== '0x', 'expected non-empty txInput for contract creation')
|
|
47
|
+
} else {
|
|
48
|
+
assert(typeof toAddress === 'string', 'expected string toAddress')
|
|
49
|
+
assert(typeof txToAddress === 'string', 'expected string txToAddress')
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
return criticalTxAttributes
|
|
45
53
|
}
|
|
46
54
|
|
|
@@ -91,7 +99,8 @@ const createResolvedTxAttributes = async ({
|
|
|
91
99
|
txToAddress,
|
|
92
100
|
txValue,
|
|
93
101
|
txType,
|
|
94
|
-
isContractTxToAddress:
|
|
102
|
+
isContractTxToAddress:
|
|
103
|
+
Boolean(txToAddress) && (await isContractAddressCached({ asset, address: txToAddress })),
|
|
95
104
|
})
|
|
96
105
|
|
|
97
106
|
export const resolveTxFromAddress = async ({
|
|
@@ -147,6 +156,22 @@ export const resolveCriticalTxAttributes = ({
|
|
|
147
156
|
|
|
148
157
|
const amount = providedAmount ?? asset.currency.ZERO
|
|
149
158
|
assert(amount instanceof NumberUnit, 'expected providedAmount')
|
|
159
|
+
|
|
160
|
+
if (txType === TX_TYPE_CREATE_CONTRACT) {
|
|
161
|
+
assert(asset.name === asset.baseAsset.name, 'must use baseAsset for contract deployments')
|
|
162
|
+
assert(!providedToAddress, 'toAddress must be falsy when creating a contract')
|
|
163
|
+
assert(!providedTxToAddress, 'txToAddress must be falsy when creating a contract')
|
|
164
|
+
|
|
165
|
+
return assertCriticalTxAttributes({
|
|
166
|
+
amount,
|
|
167
|
+
toAddress: null,
|
|
168
|
+
txInput: providedTxInput,
|
|
169
|
+
txToAddress: null,
|
|
170
|
+
txType,
|
|
171
|
+
txValue: amount,
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
150
175
|
assert(txType === TX_TYPE_TRANSFER, 'expected TX_TYPE_TRANSFER')
|
|
151
176
|
|
|
152
177
|
// HACK: If a `toAddress` hasn't been defined, then we
|