-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows users to optionally define gnosis safe settings in `hardhat.config.ts`. If specified, then a gnosis signer will be used. If not defined, a normal ethers signer will be used. Signed-off-by: Ryan Goulding <[email protected]>
- Loading branch information
1 parent
f0392c5
commit 4215019
Showing
8 changed files
with
579 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
import pMemoize from 'p-memoize' | ||
import type { OmniSignerFactory } from '@layerzerolabs/devtools' | ||
import { OmniSignerEVM } from '@layerzerolabs/devtools-evm' | ||
import { GnosisOmniSignerEVM, OmniSignerEVM } from '@layerzerolabs/devtools-evm' | ||
import { createProviderFactory } from '@/provider' | ||
import { createGetHreByEid } from '@/runtime' | ||
|
||
export const createSignerFactory = ( | ||
addressOrIndex?: string | number, | ||
providerFactory = createProviderFactory() | ||
): OmniSignerFactory<OmniSignerEVM> => { | ||
providerFactory = createProviderFactory(), | ||
networkEnvironmentFactory = createGetHreByEid() | ||
): OmniSignerFactory => { | ||
return pMemoize(async (eid) => { | ||
const provider = await providerFactory(eid) | ||
const signer = provider.getSigner(addressOrIndex) | ||
|
||
return new OmniSignerEVM(eid, signer) | ||
const env = await networkEnvironmentFactory(eid) | ||
const safeConfig = env.network.config.safeConfig | ||
return safeConfig | ||
? new GnosisOmniSignerEVM(eid, signer, safeConfig.safeUrl, safeConfig) | ||
: new OmniSignerEVM(eid, signer) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.