Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't find func 'Web3.InfuraKovanWeb3()' #311

Closed
AlleniCode opened this issue Mar 19, 2021 · 3 comments
Closed

I can't find func 'Web3.InfuraKovanWeb3()' #311

AlleniCode opened this issue Mar 19, 2021 · 3 comments

Comments

@AlleniCode
Copy link

I can't find func 'Web3.InfuraKovanWeb3()', how to change to Kovan Testnet?

let web3 = Web3.InfuraMainnetWeb3()
let web3 = Web3.InfuraRopstenWeb3()
let web3 = Web3.InfuraRinkebyWeb3()
// let web3 = Web3.InfuraKovanWeb3()
@dangell7
Copy link

You can set the URL yourself by creating a provider. If the Kovan isn't hard coded in just set the url.

@alex78pro
Copy link
Contributor

extension Web3 {
/// Initialized Web3 instance bound to Infura's kovan provider.
public static func InfuraKovanWeb3(accessToken: String? = nil) -> web3 {
let infura = InfuraProvider(Networks.Kovan, accessToken: accessToken)!
return web3(provider: infura)
}
}

@AlleniCode
Copy link
Author

extension Web3 {
/// Initialized Web3 instance bound to Infura's kovan provider.
public static func InfuraKovanWeb3(accessToken: String? = nil) -> web3 {
let infura = InfuraProvider(Networks.Kovan, accessToken: accessToken)!
return web3(provider: infura)
}
}

👍 Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants