trustwallet / trust-wallet-ios

:iphone: Trust - Ethereum Wallet and Web3 DApp Browser for iOS
https://trustwallet.com
GNU General Public License v3.0
1.52k stars 718 forks source link

About TrustWeb3Provider instantiation #929

Closed zhuofanxu closed 5 years ago

zhuofanxu commented 5 years ago

I find over the project and can't find the part of TrustWeb3Provider instantiation for web3 instance . could you explain it ? thanks!

stevemulligan commented 5 years ago

If you are looking for where it sets the network to use, it's in Trust/Transactions/Storage/Session.swift line 32

And the web3 provider is set in JS inside Trust/Browser/Factory/WKWebViewConfiguration.swift line 23

Hope that helps.

zhuofanxu commented 5 years ago

thanks for reply! but i'm looking for is that var web3Provider = new Trust(config); var web3 = new Web3(web3Provider) like in chrome extension 'metamask'

hewigovens commented 5 years ago

check: https://github.com/TrustWallet/trust-web3-provider/blob/master/Example/TrustWeb3Provider/WKUserScriptConfig.swift