mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-23 02:10:12 +01:00
e223348fb3
This release only includes one breaking change, which is the renaming of the package to be under the `@metamask` scope. It includes improvements to the types that will unblock migrating our network clients to TypeScript.
43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { createScaffoldMiddleware, mergeMiddleware } from 'json-rpc-engine';
|
|
import { createWalletMiddleware } from '@metamask/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;
|
|
}
|