mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 04:46:10 +01:00
b3963daaab
We're bumping from `^6` to `^8`. All imports are now named, and they have been updated. This is a breaking change, in that support for `eth_signTransaction` is added in `^8.0.0`. We do not support this method in our UI, so our middleware stack has been instrumented to reject. In addition, there are some non-breaking behavioral changes in this version that reviewers should be aware of, see the [7.0.0 release](https://github.com/MetaMask/eth-json-rpc-middleware/releases).
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { createScaffoldMiddleware, mergeMiddleware } from 'json-rpc-engine';
|
|
import { createWalletMiddleware } from 'eth-json-rpc-middleware';
|
|
import {
|
|
createPendingNonceMiddleware,
|
|
createPendingTxMiddleware,
|
|
} from './middleware/pending';
|
|
|
|
export default function createMetamaskMiddleware({
|
|
version,
|
|
getAccounts,
|
|
processTransaction,
|
|
processEthSignMessage,
|
|
processTypedMessage,
|
|
processTypedMessageV3,
|
|
processTypedMessageV4,
|
|
processPersonalMessage,
|
|
processDecryptMessage,
|
|
processEncryptionPublicKey,
|
|
getPendingNonce,
|
|
getPendingTransactionByHash,
|
|
}) {
|
|
const metamaskMiddleware = mergeMiddleware([
|
|
createScaffoldMiddleware({
|
|
eth_syncing: false,
|
|
web3_clientVersion: `MetaMask/v${version}`,
|
|
}),
|
|
createWalletMiddleware({
|
|
getAccounts,
|
|
processTransaction,
|
|
processEthSignMessage,
|
|
processTypedMessage,
|
|
processTypedMessageV3,
|
|
processTypedMessageV4,
|
|
processPersonalMessage,
|
|
processDecryptMessage,
|
|
processEncryptionPublicKey,
|
|
}),
|
|
createPendingNonceMiddleware({ getPendingNonce }),
|
|
createPendingTxMiddleware({ getPendingTransactionByHash }),
|
|
]);
|
|
return metamaskMiddleware;
|
|
}
|