When in Status trigger personal_sign instead of eth_sign (#1285).

This commit is contained in:
Richard Moore 2021-02-08 14:46:04 -05:00
parent 796954f880
commit 73e94349de
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -12,6 +12,7 @@ import { JsonRpcProvider } from "./json-rpc-provider";
// Exported Types
export type ExternalProvider = {
isMetaMask?: boolean;
isStatus?: boolean;
host?: string;
path?: string;
sendAsync?: (request: { method: string, params?: Array<any> }, callback: (error: any, response: any) => void) => void
@ -29,7 +30,7 @@ function buildWeb3LegacyFetcher(provider: ExternalProvider, sendFunc: Web3Legacy
return function(method: string, params: Array<any>): Promise<any> {
// Metamask complains about eth_sign (and on some versions hangs)
if (method == "eth_sign" && provider.isMetaMask) {
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) {
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
method = "personal_sign";
params = [ params[1], params[0] ];
@ -64,7 +65,7 @@ function buildEip1193Fetcher(provider: ExternalProvider): JsonRpcFetchFunc {
if (params == null) { params = [ ]; }
// Metamask complains about eth_sign (and on some versions hangs)
if (method == "eth_sign" && provider.isMetaMask) {
if (method == "eth_sign" && (provider.isMetaMask || provider.isStatus)) {
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
method = "personal_sign";
params = [ params[1], params[0] ];