Skip to content

Commit

Permalink
fix: web3 provider gnosis safe detection
Browse files Browse the repository at this point in the history
  • Loading branch information
goums committed Jul 13, 2022
1 parent a38283d commit 852bfcd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/lib/GelatoOpsSDK.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-prototype-builtins */
import "ethers";

import { Signer } from "@ethersproject/abstract-signer";
Expand All @@ -8,7 +9,7 @@ import {
Forwarder,
Forwarder__factory,
} from "../contracts/types";
import { ContractTransaction, ethers, Overrides } from "ethers";
import { ContractTransaction, ethers, Overrides, providers } from "ethers";
import {
CreateTaskOptions,
CreateTaskOptionsWithDefaults,
Expand Down Expand Up @@ -198,8 +199,16 @@ export class GelatoOpsSDK {
}

public isGnosisSafeApp = (): boolean => {
// eslint-disable-next-line no-prototype-builtins
return Boolean(this._signer.provider?.hasOwnProperty("safe"));
let provider: providers.Provider | undefined;
if (this._signer.provider?.hasOwnProperty("provider")) {
// Use internal provider
provider = (
this._signer.provider as unknown as { provider: providers.Provider }
).provider;
} else {
provider = this._signer.provider;
}
return Boolean(provider?.hasOwnProperty("safe"));
};

private async _requestAndStoreSignature() {
Expand Down

0 comments on commit 852bfcd

Please sign in to comment.