Skip to content

Commit

Permalink
When in Status trigger personal_#stead of eth_sign (#1285).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Feb 8, 2021
1 parent 796954f commit 73e9434
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/providers/src.ts/web3-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] ];
Expand Down Expand Up @@ -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] ];
Expand Down

0 comments on commit 73e9434

Please # to comment.