mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-02 06:07:06 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import mergeMiddleware from 'json-rpc-engine/src/mergeMiddleware'
|
|
import createScaffoldMiddleware from 'json-rpc-engine/src/createScaffoldMiddleware'
|
|
import createWalletSubprovider from 'eth-json-rpc-middleware/wallet'
|
|
import { createPendingNonceMiddleware, createPendingTxMiddleware } from './middleware/pending'
|
|
|
|
export default createMetamaskMiddleware
|
|
|
|
function createMetamaskMiddleware ({
|
|
version,
|
|
getAccounts,
|
|
processTransaction,
|
|
processEthSignMessage,
|
|
processTypedMessage,
|
|
processTypedMessageV3,
|
|
processTypedMessageV4,
|
|
processPersonalMessage,
|
|
getPendingNonce,
|
|
getPendingTransactionByHash,
|
|
}) {
|
|
const metamaskMiddleware = mergeMiddleware([
|
|
createScaffoldMiddleware({
|
|
// staticSubprovider
|
|
eth_syncing: false,
|
|
web3_clientVersion: `MetaMask/v${version}`,
|
|
}),
|
|
createWalletSubprovider({
|
|
getAccounts,
|
|
processTransaction,
|
|
processEthSignMessage,
|
|
processTypedMessage,
|
|
processTypedMessageV3,
|
|
processTypedMessageV4,
|
|
processPersonalMessage,
|
|
}),
|
|
createPendingNonceMiddleware({ getPendingNonce }),
|
|
createPendingTxMiddleware({ getPendingTransactionByHash }),
|
|
])
|
|
return metamaskMiddleware
|
|
}
|