@fluent-wallet/wallet_send-transaction 3.0.14 → 3.0.19
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/index.js +43 -1
- package/package.json +7 -7
package/index.js
CHANGED
|
@@ -9,6 +9,39 @@ import {ETH_TX_TYPES} from '@fluent-wallet/consts'
|
|
|
9
9
|
|
|
10
10
|
export const NAME = 'wallet_sendTransaction'
|
|
11
11
|
|
|
12
|
+
const EIP7702_AUTHORIZATION_DB_FIELDS = [
|
|
13
|
+
'chainId',
|
|
14
|
+
'address',
|
|
15
|
+
'nonce',
|
|
16
|
+
'yParity',
|
|
17
|
+
'r',
|
|
18
|
+
's',
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
function formatEip7702AuthorizationForDb(authorization) {
|
|
22
|
+
return {
|
|
23
|
+
eip7702Authorization: EIP7702_AUTHORIZATION_DB_FIELDS.reduce(
|
|
24
|
+
(formattedAuthorization, key) => {
|
|
25
|
+
if (authorization[key] !== undefined)
|
|
26
|
+
formattedAuthorization[key] = authorization[key]
|
|
27
|
+
return formattedAuthorization
|
|
28
|
+
},
|
|
29
|
+
{},
|
|
30
|
+
),
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function formatTxPayloadForDb(txMeta) {
|
|
35
|
+
if (!txMeta.authorizationList) return txMeta
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
...txMeta,
|
|
39
|
+
authorizationList: txMeta.authorizationList.map(
|
|
40
|
+
formatEip7702AuthorizationForDb,
|
|
41
|
+
),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
12
45
|
export const schemas = {
|
|
13
46
|
input: [or, cfxSchema.input, ethSchema.input],
|
|
14
47
|
}
|
|
@@ -67,6 +100,14 @@ export const main = async ({
|
|
|
67
100
|
|
|
68
101
|
if (_inpage) {
|
|
69
102
|
if (params.authReqId) throw InvalidParams('Invalid tx data')
|
|
103
|
+
if (
|
|
104
|
+
params[0].authorizationList ||
|
|
105
|
+
params[0].type === ETH_TX_TYPES.EIP7702
|
|
106
|
+
) {
|
|
107
|
+
throw InvalidParams(
|
|
108
|
+
'Dapp-initiated EIP-7702 transactions are not supported yet',
|
|
109
|
+
)
|
|
110
|
+
}
|
|
70
111
|
if (params[0].gasLimit) {
|
|
71
112
|
if (!params[0].gas) params[0].gas = params[0].gasLimit
|
|
72
113
|
delete params[0].gasLimit
|
|
@@ -180,6 +221,7 @@ export const main = async ({
|
|
|
180
221
|
throw Server(`Server error while signning tx`)
|
|
181
222
|
}
|
|
182
223
|
const {raw: rawtx, txMeta} = signed
|
|
224
|
+
const txPayload = formatTxPayloadForDb(txMeta)
|
|
183
225
|
const txhash = getTxHashFromRawTx(rawtx)
|
|
184
226
|
const duptx = getAddrTxByHash({addressId: addr, txhash})
|
|
185
227
|
|
|
@@ -194,7 +236,7 @@ export const main = async ({
|
|
|
194
236
|
const txExtra = {ok: false}
|
|
195
237
|
if (_popup && _sendAction) txExtra.sendAction = _sendAction
|
|
196
238
|
const dbtxs = [
|
|
197
|
-
{eid: 'newTxPayload', txPayload
|
|
239
|
+
{eid: 'newTxPayload', txPayload},
|
|
198
240
|
{eid: 'newTxExtra', txExtra},
|
|
199
241
|
{
|
|
200
242
|
eid: 'newTxId',
|
package/package.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"packageManager": "yarn@3.1.0",
|
|
6
|
-
"version": "3.0.
|
|
6
|
+
"version": "3.0.19",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@ethersproject/bignumber": "5.6.2",
|
|
9
|
-
"@fluent-wallet/cfx_send-transaction": "1.0.
|
|
10
|
-
"@fluent-wallet/consts": "0.0.
|
|
11
|
-
"@fluent-wallet/eth_send-transaction": "2.0.
|
|
12
|
-
"@fluent-wallet/json-rpc-error": "1.1.
|
|
13
|
-
"@fluent-wallet/signature": "0.0.
|
|
14
|
-
"@fluent-wallet/spec": "1.0.
|
|
9
|
+
"@fluent-wallet/cfx_send-transaction": "1.0.20",
|
|
10
|
+
"@fluent-wallet/consts": "0.0.29",
|
|
11
|
+
"@fluent-wallet/eth_send-transaction": "2.0.17",
|
|
12
|
+
"@fluent-wallet/json-rpc-error": "1.1.4",
|
|
13
|
+
"@fluent-wallet/signature": "0.0.25",
|
|
14
|
+
"@fluent-wallet/spec": "1.0.17"
|
|
15
15
|
}
|
|
16
16
|
}
|