-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: verificationBuilder with custom provider (#141)
Co-authored-by: Raymond Yeh <ray@geek.sg> BREAKING CHANGE: Change in API for verify and verification builder. Native cloudflare removed in favor for custom providers.
- Loading branch information
1 parent
fcbe8f9
commit 1de27f3
Showing
19 changed files
with
288 additions
and
398 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,7 +1,11 @@ | ||
import * as ethers from "ethers"; | ||
import { providers } from "ethers"; | ||
import { VerificationBuilderOptions, VerificationBuilderOptionsWithNetwork } from "../types/core"; | ||
import { INFURA_API_KEY } from "../config"; | ||
|
||
export const getProvider = (options: { network: string }): ethers.providers.Provider => | ||
process.env.ETHEREUM_PROVIDER === "cloudflare" | ||
? new ethers.providers.CloudflareProvider() | ||
: new ethers.providers.InfuraProvider(options.network, INFURA_API_KEY); | ||
export const getDefaultProvider = (options: VerificationBuilderOptionsWithNetwork): providers.Provider => { | ||
return new providers.InfuraProvider(options.network, INFURA_API_KEY); | ||
}; | ||
|
||
export const getProvider = (options: VerificationBuilderOptions): providers.Provider => { | ||
return "provider" in options ? options.provider : getDefaultProvider(options); | ||
}; |
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.