this.currentFork=this.defaultFork// in the case of injected and web3, we default to the last fork.
if(context==='injected'){
if(context==='injected'){
if(injectedProvider===undefined){
if(injectedProvider===undefined){
infoCb('No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page).')
infoCb('No injected Web3 provider found. Make sure your provider (e.g. MetaMask) is active and running (when recently activated you may have to reload the page).')
...
@@ -146,7 +143,7 @@ export class ExecutionContext {
...
@@ -146,7 +143,7 @@ export class ExecutionContext {
this.askPermission()
this.askPermission()
this.executionContext=context
this.executionContext=context
web3.setProvider(injectedProvider)
web3.setProvider(injectedProvider)
this._updateBlockGasLimit()
this._updateChainContext()
this.event.trigger('contextChanged',['injected'])
this.event.trigger('contextChanged',['injected'])
returncb()
returncb()
}
}
...
@@ -173,12 +170,19 @@ export class ExecutionContext {
...
@@ -173,12 +170,19 @@ export class ExecutionContext {
this.listenOnLastBlockId=null
this.listenOnLastBlockId=null
}
}
_updateBlockGasLimit(){
_updateChainContext(){
if(this.getProvider()!=='vm'){
if(this.getProvider()!=='vm'){
web3.eth.getBlock('latest',(err,block)=>{
web3.eth.getBlock('latest',async(err,block)=>{
if(!err){
if(!err){
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
// we can't use the blockGasLimit cause the next blocks could have a lower limit : https://github.com/ethereum/remix/issues/506
if(content&&content!==''){// module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
if(content&&content!==''){// module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
exportconstgenerateContractMetadataText='Generate contract metadata. Generate a JSON file in the contract folder. Allows to specify library addresses the contract depends on. If nothing is specified, Remix deploys libraries automatically.'
exportconsttextSecondary='text-secondary'
exportconsttextDark='text-dark'
exportconstwarnText='Be sure the endpoint is opened before enabling it. \nThis mode allows a user to provide a passphrase in the Remix interface without having to unlock the account. Although this is very convenient, you should completely trust the backend you are connected to (Geth, Parity, ...). Remix never persists any passphrase'.split('\n').map(s=>s.trim()).join(' ')
exportconstgitAccessTokenText='Manage the access token used to publish to Gist and retrieve Github contents.'
exportconstgitAccessTokenText2='Go to github token page (link below) to create a new token and save it in Remix. Make sure this token has only \'create gist\' permission.'
exportconstethereunVMText='Always use Ethereum VM at load'
exportconstwordWrapText='Word wrap in editor'
exportconstenablePersonalModeText=' Enable Personal Mode for web3 provider. Transaction sent over Web3 will use the web3.personal API.\n'
exportconstmatomoAnalytics='Enable Matomo Analytics. We do not collect personally identifiable information (PII). The info is used to improve the site’s UX & UI. See more about '
<ahref="https://medium.com/p/66ef69e14931/"target="_blank"> Analytics in Remix IDE</a><span>&</span><atarget="_blank"href="https://matomo.org/free-software">Matomo</a>