mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-27 04:46:10 +01:00
76a2a9bb8b
* @metamask/eslint-config@5.0.0 * Update eslintrc and prettierrc * yarn lint:fix
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
import { createScaffoldMiddleware, mergeMiddleware } from 'json-rpc-engine';
|
|
import createWalletSubprovider from 'eth-json-rpc-middleware/wallet';
|
|
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({
|
|
// staticSubprovider
|
|
eth_syncing: false,
|
|
web3_clientVersion: `MetaMask/v${version}`,
|
|
}),
|
|
createWalletSubprovider({
|
|
getAccounts,
|
|
processTransaction,
|
|
processEthSignMessage,
|
|
processTypedMessage,
|
|
processTypedMessageV3,
|
|
processTypedMessageV4,
|
|
processPersonalMessage,
|
|
processDecryptMessage,
|
|
processEncryptionPublicKey,
|
|
}),
|
|
createPendingNonceMiddleware({ getPendingNonce }),
|
|
createPendingTxMiddleware({ getPendingTransactionByHash }),
|
|
]);
|
|
return metamaskMiddleware;
|
|
}
|