Finish up deploy

yann300-patch-36
David Disu 3 years ago committed by yann300
parent 95b0e4f248
commit 21c5a17ebe
  1. 5
      .eslintrc.json
  2. 2
      libs/remix-ui/publish-to-storage/src/lib/publish-to-storage.tsx
  3. 74
      libs/remix-ui/run-tab/src/lib/actions/index.ts
  4. 1
      libs/remix-ui/run-tab/src/lib/actions/payload.ts
  5. 30
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  6. 39
      libs/remix-ui/run-tab/src/lib/components/mainnet.tsx
  7. 8
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts
  8. 2
      libs/remix-ui/run-tab/src/lib/run-tab.tsx
  9. 50
      libs/remix-ui/run-tab/src/lib/types/index.ts
  10. 2
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  11. 6
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts
  12. 1
      libs/remix-ui/workspace/src/lib/contexts/index.ts
  13. 1
      libs/remix-ui/workspace/src/lib/providers/FileSystemProvider.tsx
  14. 1
      libs/remix-ui/workspace/src/lib/types/index.ts

@ -31,5 +31,8 @@
"extends": ["plugin:@nrwl/nx/javascript"], "extends": ["plugin:@nrwl/nx/javascript"],
"rules": {} "rules": {}
} }
] ],
"globals": {
"JSX": true
}
} }

@ -79,7 +79,7 @@ export const PublishToStorage = (props: RemixUiPublishToStorageProps) => {
resetStorage() resetStorage()
} }
const modal = async (title: string, message: string | JSX.Element) => { // eslint-disable-line no-undef const modal = async (title: string, message: string | JSX.Element) => {
await setState(prevState => { await setState(prevState => {
return { return {
...prevState, ...prevState,

@ -7,7 +7,7 @@ import { addProvider, displayNotification, displayPopUp, fetchAccountsListFailed
import { RunTab } from '../types/run-tab' import { RunTab } from '../types/run-tab'
import { CompilerAbstract } from '@remix-project/remix-solidity' import { CompilerAbstract } from '@remix-project/remix-solidity'
import * as remixLib from '@remix-project/remix-lib' import * as remixLib from '@remix-project/remix-lib'
import { ContractData } from '../types' import { ContractData, Network, Tx } from '../types'
declare global { declare global {
interface Window { interface Window {
_paq: any _paq: any
@ -228,7 +228,6 @@ const removeExternalProvider = (name) => {
dispatch(removeProvider(name)) dispatch(removeProvider(name))
} }
// eslint-disable-next-line no-undef
export const setExecutionContext = (executionContext: { context: string, fork: string }, displayContent: JSX.Element) => { export const setExecutionContext = (executionContext: { context: string, fork: string }, displayContent: JSX.Element) => {
plugin.blockchain.changeExecutionContext(executionContext, () => { plugin.blockchain.changeExecutionContext(executionContext, () => {
dispatch(displayNotification('External node request', displayContent, 'OK', 'Cancel', () => { dispatch(displayNotification('External node request', displayContent, 'OK', 'Cancel', () => {
@ -250,7 +249,6 @@ export const clearPopUp = async () => {
dispatch(hidePopUp()) dispatch(hidePopUp())
} }
// eslint-disable-next-line no-undef
export const createNewBlockchainAccount = async (cbMessage: JSX.Element) => { export const createNewBlockchainAccount = async (cbMessage: JSX.Element) => {
plugin.blockchain.newAccount( plugin.blockchain.newAccount(
'', '',
@ -283,7 +281,6 @@ export const setMatchPassphrasePrompt = (passphrase: string) => {
dispatch(setMatchPassphrase(passphrase)) dispatch(setMatchPassphrase(passphrase))
} }
// eslint-disable-next-line no-undef
export const signMessageWithAddress = (account: string, message: string, modalContent: (hash: string, data: string) => JSX.Element, passphrase?: string) => { export const signMessageWithAddress = (account: string, message: string, modalContent: (hash: string, data: string) => JSX.Element, passphrase?: string) => {
plugin.blockchain.signMessage(message, account, passphrase, (err, msgHash, signedData) => { plugin.blockchain.signMessage(message, account, passphrase, (err, msgHash, signedData) => {
if (err) { if (err) {
@ -382,27 +379,32 @@ const getCompilerContracts = () => {
return plugin.compilersArtefacts.__last.getData().contracts return plugin.compilersArtefacts.__last.getData().contracts
} }
// eslint-disable-next-line no-undef
const terminalLogger = (view: JSX.Element) => { const terminalLogger = (view: JSX.Element) => {
plugin.call('terminal', 'logHtml', view) plugin.call('terminal', 'logHtml', view)
} }
const getConfirmationCb = () => { const getConfirmationCb = (confirmDialogContent: (
tx: Tx, network:
Network, amount: string,
gasEstimation: string,
gasFees: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void,
determineGasPrice: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void
) => JSX.Element) => {
// this code is the same as in recorder.js. TODO need to be refactored out // this code is the same as in recorder.js. TODO need to be refactored out
const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => { const confirmationCb = (network, tx, gasEstimation, continueTxExecution, cancelCb) => {
if (network.name !== 'Main') { if (network.name !== 'Main') {
return continueTxExecution(null) return continueTxExecution(null)
} }
const amount = plugin.blockchain.fromWei(tx.value, true, 'ether') const amount = plugin.blockchain.fromWei(tx.value, true, 'ether')
const content = confirmDialog(tx, network, amount, gasEstimation, plugin.blockchain.determineGasFees(tx), plugin.blockchain.determineGasPrice.bind(plugin.blockchain)) const content = confirmDialogContent(tx, network, amount, gasEstimation, plugin.blockchain.determineGasFees(tx), plugin.blockchain.determineGasPrice.bind(plugin.blockchain))
dispatch(displayNotification('Confirm transaction', content, 'Confirm', 'Cancel', () => { dispatch(displayNotification('Confirm transaction', content, 'Confirm', 'Cancel', () => {
plugin.blockchain.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', content.querySelector('input#confirmsetting').checked) plugin.blockchain.config.setUnpersistedProperty('doNotShowTransactionConfirmationAgain', plugin.REACT_API.confirmSettings)
// TODO: check if this is check is still valid given the refactor // TODO: check if this is check is still valid given the refactor
if (!content.gasPriceStatus) { if (!plugin.REACT_API.gasPriceStatus) {
cancelCb('Given transaction fee is not correct') cancelCb('Given transaction fee is not correct')
} else { } else {
continueTxExecution(content.txFee) continueTxExecution({ maxFee: plugin.REACT_API.maxFee, maxPriorityFee: plugin.REACT_API.maxPriorityFee, baseFeePerGas: plugin.REACT_API.baseFeePerGas, gasPrice: plugin.REACT_API.gasPrice })
} }
}, () => { }, () => {
return cancelCb('Transaction canceled by user.') return cancelCb('Transaction canceled by user.')
@ -412,8 +414,22 @@ const getConfirmationCb = () => {
return confirmationCb return confirmationCb
} }
// eslint-disable-next-line no-undef export const createInstance = async (
export const createInstance = async (selectedContract: ContractData, gasEstimationPrompt: (msg: string) => JSX.Element, passphrasePrompt: (msg: string) => JSX.Element, logBuilder: (msg: string) => JSX.Element, publishToStorage: (storage: 'ipfs' | 'swarm', contract: ContractData) => void) => { selectedContract: ContractData,
gasEstimationPrompt: (msg: string) => JSX.Element,
passphrasePrompt: (msg: string) => JSX.Element,
logBuilder: (msg: string) => JSX.Element,
publishToStorage: (storage: 'ipfs' | 'swarm',
contract: ContractData) => void,
mainnetPrompt: (
tx: Tx, network:
Network, amount: string,
gasEstimation: string,
gasFees: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void,
determineGasPrice: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void
) => JSX.Element,
isOverSizePrompt: () => JSX.Element,
args) => {
const continueCb = (error, continueTxExecution, cancelCb) => { const continueCb = (error, continueTxExecution, cancelCb) => {
if (error) { if (error) {
const msg = typeof error !== 'string' ? error.message : error const msg = typeof error !== 'string' ? error.message : error
@ -468,33 +484,27 @@ export const createInstance = async (selectedContract: ContractData, gasEstimati
const compilerContracts = getCompilerContracts() const compilerContracts = getCompilerContracts()
const confirmationCb = getConfirmationCb(mainnetPrompt) const confirmationCb = getConfirmationCb(mainnetPrompt)
// if (selectedContract.isOverSizeLimit()) { if (selectedContract.isOverSizeLimit()) {
// return modalDialog('Contract code size over limit', yo`<div>Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails. <br> return dispatch(displayNotification('Contract code size over limit', isOverSizePrompt(), 'Force Send', 'Cancel', () => {
// More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank">eip-170</a> deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb)
// </div>`, }, () => {
// { const log = logBuilder(`creation of ${selectedContract.name} canceled by user.`)
// label: 'Force Send',
// fn: () => { return terminalLogger(log)
// this.deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb) }))
// } }
// }, { deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb)
// label: 'Cancel',
// fn: () => {
// this.logCallback(`creation of ${selectedContract.name} canceled by user.`)
// }
// })
// }
// this.deployContract(selectedContract, args, contractMetadata, compilerContracts, { continueCb, promptCb, statusCb, finalCb }, confirmationCb)
} }
const deployContract = (selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) => { const deployContract = (selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) => {
_paq.push(['trackEvent', 'udapp', 'DeployContractTo', this.networkName + '_' + this.networkId]) _paq.push(['trackEvent', 'udapp', 'DeployContractTo', plugin.REACT_API.networkName])
const { statusCb } = callbacks const { statusCb } = callbacks
if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) { if (!contractMetadata || (contractMetadata && contractMetadata.autoDeployLib)) {
return this.blockchain.deployContractAndLibraries(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) return plugin.blockchain.deployContractAndLibraries(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb)
} }
if (Object.keys(selectedContract.bytecodeLinkReferences).length) statusCb(`linking ${JSON.stringify(selectedContract.bytecodeLinkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`) if (Object.keys(selectedContract.bytecodeLinkReferences).length) statusCb(`linking ${JSON.stringify(selectedContract.bytecodeLinkReferences, null, '\t')} using ${JSON.stringify(contractMetadata.linkReferences, null, '\t')}`)
this.blockchain.deployContractWithLibrary(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb) plugin.blockchain.deployContractWithLibrary(selectedContract, args, contractMetadata, compilerContracts, callbacks, confirmationCb)
} }
export const setCheckIpfs = (value: boolean) => { export const setCheckIpfs = (value: boolean) => {

@ -1,4 +1,3 @@
/* eslint-disable no-undef */
export const fetchAccountsListRequest = () => { export const fetchAccountsListRequest = () => {
return { return {
type: 'FETCH_ACCOUNTS_LIST_REQUEST', type: 'FETCH_ACCOUNTS_LIST_REQUEST',

@ -1,9 +1,10 @@
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { ContractData, ContractDropdownProps } from '../types' import { ContractData, ContractDropdownProps, Network, Tx } from '../types'
import * as ethJSUtil from 'ethereumjs-util' import * as ethJSUtil from 'ethereumjs-util'
import { ContractGUI } from './contractGUI' import { ContractGUI } from './contractGUI'
import { PassphrasePrompt } from './passphrase' import { PassphrasePrompt } from './passphrase'
import { MainnetPrompt } from './mainnet'
export function ContractDropdownUI (props: ContractDropdownProps) { export function ContractDropdownUI (props: ContractDropdownProps) {
const [networkName, setNetworkName] = useState<string>('') const [networkName, setNetworkName] = useState<string>('')
@ -121,7 +122,7 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
if (selectedContract.bytecodeObject.length === 0) { if (selectedContract.bytecodeObject.length === 0) {
return props.modal('Alert', 'This contract may be abstract, not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.', 'OK', () => {}) return props.modal('Alert', 'This contract may be abstract, not implement an abstract parent\'s methods completely or not invoke an inherited contract\'s constructor correctly.', 'OK', () => {})
} }
props.createInstance(loadedContractData, gasEstimationPrompt, passphrasePrompt, logBuilder, props.publishToStorage) props.createInstance(loadedContractData, gasEstimationPrompt, passphrasePrompt, logBuilder, props.publishToStorage, mainnetPrompt, isOverSizePrompt, args)
} }
// listenToContextChange () { // listenToContextChange () {
@ -346,8 +347,31 @@ export function ContractDropdownUI (props: ContractDropdownProps) {
return <PassphrasePrompt message={message} setPassphrase={props.setPassphrase} defaultValue={props.passphrase} /> return <PassphrasePrompt message={message} setPassphrase={props.setPassphrase} defaultValue={props.passphrase} />
} }
const mainnetPrompt = () => { const mainnetPrompt = (tx: Tx, network: Network, amount: string, gasEstimation: string, gasFees: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void, determineGasPrice: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void) => {
return <MainnetPrompt
init={determineGasPrice}
network={network}
tx={tx}
amount={amount}
gasEstimation={gasEstimation}
setNewGasPrice={gasFees}
updateBaseFeePerGas={props.updateBaseFeePerGas}
updateConfirmSettings={props.updateConfirmSettings}
updateGasPrice={props.updateGasPrice}
updateGasPriceStatus={props.updateGasPriceStatus}
updateMaxFee={props.updateMaxFee}
updateMaxPriorityFee={props.updateMaxPriorityFee}
setTxFeeContent={props.updateTxFeeContent}
txFeeContent={props.txFeeContent}
/>
}
const isOverSizePrompt = () => {
return (
<div>Contract creation initialization returns data with length of more than 24576 bytes. The deployment will likely fails. <br />
More info: <a href="https://github.com/ethereum/EIPs/blob/master/EIPS/eip-170.md" target="_blank">eip-170</a>
</div>
)
} }
return ( return (

@ -2,34 +2,9 @@
import React, { useEffect } from 'react' import React, { useEffect } from 'react'
import { CopyToClipboard } from '@remix-ui/clipboard' import { CopyToClipboard } from '@remix-ui/clipboard'
import Web3 from 'web3' import Web3 from 'web3'
import { MainnetProps } from '../types'
interface MainnetProps { export function MainnetPrompt (props: MainnetProps) {
network: {
name: string,
lastBlock: {
baseFeePerGas: string
}
},
tx: {
from: string,
to: string,
data: string,
gas: string
},
amount: string,
gasEstimation: string,
setNewGasPrice: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void,
updateGasPriceStatus: (status: boolean) => void,
updateConfirmSettings: (confirmation: boolean) => void,
updateMaxFee: (fee: string) => void,
updateBaseFeePerGas: (fee: string) => void,
init: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void,
setTxFeeContent: (content: string) => void,
updateGasPrice: (price: string) => void,
txFeeContent: string
}
export function PassphrasePrompt (props: MainnetProps) {
useEffect(() => { useEffect(() => {
props.init((txFeeText, gasPriceValue, gasPriceStatus) => { props.init((txFeeText, gasPriceValue, gasPriceStatus) => {
if (txFeeText) props.setTxFeeContent(txFeeText) if (txFeeText) props.setTxFeeContent(txFeeText)
@ -75,6 +50,10 @@ export function PassphrasePrompt (props: MainnetProps) {
}) })
} }
const onMaxPriorityFeeChange = (value: string) => {
props.updateMaxPriorityFee(value)
}
return ( return (
<div> <div>
<div className="text-dark">You are about to create a transaction on {props.network.name} Network. Confirm the details to send the info to your provider. <div className="text-dark">You are about to create a transaction on {props.network.name} Network. Confirm the details to send the info to your provider.
@ -113,14 +92,14 @@ export function PassphrasePrompt (props: MainnetProps) {
<div className="align-items-center my-1" title="Represents the part of the tx fee that goes to the miner."> <div className="align-items-center my-1" title="Represents the part of the tx fee that goes to the miner.">
<div className='d-flex'> <div className='d-flex'>
<span className="text-dark mr-2 text-nowrap">Max Priority fee:</span> <span className="text-dark mr-2 text-nowrap">Max Priority fee:</span>
<input className="form-control mr-1 text-right" style={{ height: '1.2rem', width: '6rem' }} value="1" id='maxpriorityfee' /> <input className="form-control mr-1 text-right" style={{ height: '1.2rem', width: '6rem' }} value="1" id='maxpriorityfee' onInput={(e: any) => onMaxPriorityFeeChange(e.target.value)} />
<span title="visit https://ethgasstation.info for current gas price info.">Gwei</span> <span title="visit https://ethgasstation.info for current gas price info.">Gwei</span>
</div> </div>
</div> </div>
<div className="align-items-center my-1" title="Represents the maximum amount of fee that you will pay for this transaction. The minimun needs to be set to base fee."> <div className="align-items-center my-1" title="Represents the maximum amount of fee that you will pay for this transaction. The minimun needs to be set to base fee.">
<div className='d-flex'> <div className='d-flex'>
<span className="text-dark mr-2 text-nowrap">Max fee (Not less than base fee {Web3.utils.fromWei(Web3.utils.toBN(parseInt(props.network.lastBlock.baseFeePerGas, 16)), 'Gwei')} Gwei):</span> <span className="text-dark mr-2 text-nowrap">Max fee (Not less than base fee {Web3.utils.fromWei(Web3.utils.toBN(parseInt(props.network.lastBlock.baseFeePerGas, 16)), 'Gwei')} Gwei):</span>
<input className="form-control mr-1 text-right" style={{ height: '1.2rem', width: '6rem' }} id='maxfee' onInput={(e) => onMaxFeeChange(e.target.value)} /> <input className="form-control mr-1 text-right" style={{ height: '1.2rem', width: '6rem' }} id='maxfee' onInput={(e: any) => onMaxFeeChange(e.target.value)} />
<span>Gwei</span> <span>Gwei</span>
<span className="text-dark ml-2"></span> <span className="text-dark ml-2"></span>
</div> </div>
@ -128,7 +107,7 @@ export function PassphrasePrompt (props: MainnetProps) {
</div> </div>
: <div className="d-flex align-items-center my-1"> : <div className="d-flex align-items-center my-1">
<span className="text-dark mr-2 text-nowrap">Gas price:</span> <span className="text-dark mr-2 text-nowrap">Gas price:</span>
<input className="form-control mr-1 text-right" style={{ width: '40px', height: '28px' }} id='gasprice' onInput={(e) => onGasPriceChange(e.target.value)} /> <input className="form-control mr-1 text-right" style={{ width: '40px', height: '28px' }} id='gasprice' onInput={(e: any) => onGasPriceChange(e.target.value)} />
<span>Gwei (visit <a target='_blank' href='https://ethgasstation.info'>ethgasstation.info</a> for current gas price info.)</span> <span>Gwei (visit <a target='_blank' href='https://ethgasstation.info'>ethgasstation.info</a> for current gas price info.)</span>
</div> </div>
} }

@ -60,7 +60,8 @@ export interface RunTabState {
maxFee: string, maxFee: string,
maxPriorityFee: string, maxPriorityFee: string,
baseFeePerGas: string, baseFeePerGas: string,
txFeeContent: string txFeeContent: string,
gasPrice: string
} }
export const runTabInitialState: RunTabState = { export const runTabInitialState: RunTabState = {
@ -134,9 +135,10 @@ export const runTabInitialState: RunTabState = {
gasPriceStatus: false, gasPriceStatus: false,
confirmSettings: false, confirmSettings: false,
maxFee: '', maxFee: '',
maxPriorityFee: '', maxPriorityFee: '1',
baseFeePerGas: '', baseFeePerGas: '',
txFeeContent: '' txFeeContent: '',
gasPrice: ''
} }
export const runTabReducer = (state: RunTabState = runTabInitialState, action: Action) => { export const runTabReducer = (state: RunTabState = runTabInitialState, action: Action) => {

@ -102,7 +102,6 @@ export function RunTabUI (props: RunTabProps) {
} }
}, [runTab.popup]) }, [runTab.popup])
// eslint-disable-next-line no-undef
const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => {
setModals(modals => { setModals(modals => {
modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn }) modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn })
@ -187,6 +186,7 @@ export function RunTabUI (props: RunTabProps) {
updateMaxFee={updateMaxFee} updateMaxFee={updateMaxFee}
updateMaxPriorityFee={updateMaxPriorityFee} updateMaxPriorityFee={updateMaxPriorityFee}
updateTxFeeContent={updateTxFeeContent} updateTxFeeContent={updateTxFeeContent}
txFeeContent={runTab.txFeeContent}
/> />
<RecorderUI /> <RecorderUI />
<InstanceContainerUI /> <InstanceContainerUI />

@ -1,4 +1,3 @@
/* eslint-disable no-undef */
import { RunTab } from './run-tab' import { RunTab } from './run-tab'
export interface RunTabProps { export interface RunTabProps {
plugin: RunTab plugin: RunTab
@ -116,6 +115,20 @@ export interface ContractData {
metadata: any metadata: any
} }
export interface Tx {
from: string,
to: string,
data: string,
gas: string
}
export interface Network {
name: string,
lastBlock: {
baseFeePerGas: string
}
}
export interface ContractDropdownProps { export interface ContractDropdownProps {
exEnvironment: string, exEnvironment: string,
contracts: { contracts: {
@ -134,7 +147,21 @@ export interface ContractDropdownProps {
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
passphrase: string, passphrase: string,
setPassphrase: (passphrase: string) => void, setPassphrase: (passphrase: string) => void,
createInstance: (selectedContract: ContractData, gasEstimationPrompt: (msg: string) => JSX.Element, passphrasePrompt: (msg: string) => JSX.Element, logBuilder: (msg: string) => JSX.Element, publishToStorage: (storage: 'ipfs' | 'swarm', contract: ContractData) => void) => void, createInstance: (selectedContract: ContractData,
gasEstimationPrompt: (msg: string) => JSX.Element,
passphrasePrompt: (msg: string) => JSX.Element,
logBuilder: (msg: string) => JSX.Element,
publishToStorage: (storage: 'ipfs' | 'swarm',
contract: ContractData) => void,
mainnetPrompt: (
tx: Tx, network:
Network, amount: string,
gasEstimation: string,
gasFees: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void,
determineGasPrice: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void
) => JSX.Element,
isOverSizePrompt: () => JSX.Element,
args) => void,
ipfsCheckedState: boolean, ipfsCheckedState: boolean,
setIpfsCheckedState: (value: boolean) => void, setIpfsCheckedState: (value: boolean) => void,
publishToStorage: (storage: 'ipfs' | 'swarm', contract: ContractData) => void, publishToStorage: (storage: 'ipfs' | 'swarm', contract: ContractData) => void,
@ -144,7 +171,8 @@ export interface ContractDropdownProps {
updateMaxFee: (fee: string) => void, updateMaxFee: (fee: string) => void,
updateMaxPriorityFee: (fee: string) => void, updateMaxPriorityFee: (fee: string) => void,
updateGasPrice: (price: string) => void, updateGasPrice: (price: string) => void,
updateTxFeeContent: (content: string) => void updateTxFeeContent: (content: string) => void,
txFeeContent: string
} }
export interface RecorderProps { export interface RecorderProps {
@ -181,3 +209,19 @@ export interface ContractGUIProps {
evmBC: any, evmBC: any,
lookupOnly: boolean lookupOnly: boolean
} }
export interface MainnetProps {
network: Network,
tx: Tx,
amount: string,
gasEstimation: string,
setNewGasPrice: (maxFee: string, cb: (txFeeText: string, priceStatus: boolean) => void) => void,
updateGasPriceStatus: (status: boolean) => void,
updateConfirmSettings: (confirmation: boolean) => void,
updateMaxFee: (fee: string) => void,
updateBaseFeePerGas: (fee: string) => void,
init: (cb: (txFeeText: string, gasPriceValue: string, gasPriceStatus: boolean) => void) => void,
setTxFeeContent: (content: string) => void,
updateGasPrice: (price: string) => void,
updateMaxPriorityFee: (fee: string) => void
txFeeContent: string
}

@ -81,7 +81,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
setCurrentVersion(value) setCurrentVersion(value)
api.setCompilerParameters({ version: value }) api.setCompilerParameters({ version: value })
} }
// eslint-disable-next-line no-undef
const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => {
await setState(prevState => { await setState(prevState => {
return { return {

@ -10,8 +10,8 @@ export interface CompilerContainerProps {
api: ICompilerApi, api: ICompilerApi,
compileTabLogic: CompileTabLogic, compileTabLogic: CompileTabLogic,
isHardhatProject: boolean, isHardhatProject: boolean,
tooltip: (message: string | JSX.Element) => void, // eslint-disable-line no-undef tooltip: (message: string | JSX.Element) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, // eslint-disable-line no-undef modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
compiledFileName: string, compiledFileName: string,
updateCurrentVersion: any, updateCurrentVersion: any,
configurationSettings: ConfigurationSettings configurationSettings: ConfigurationSettings
@ -21,6 +21,6 @@ export interface ContractSelectionProps {
contractMap: { contractMap: {
file: string file: string
} | Record<string, any>, } | Record<string, any>,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, // eslint-disable-line no-undef modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
contractsDetails: Record<string, any> contractsDetails: Record<string, any>
} }

@ -4,7 +4,6 @@ import { BrowserState } from '../reducers/workspace'
export const FileSystemContext = createContext<{ export const FileSystemContext = createContext<{
fs: BrowserState, fs: BrowserState,
// eslint-disable-next-line no-undef
modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void, modal:(title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
dispatchInitWorkspace:() => Promise<void>, dispatchInitWorkspace:() => Promise<void>,
dispatchFetchDirectory:(path: string) => Promise<void>, dispatchFetchDirectory:(path: string) => Promise<void>,

@ -170,7 +170,6 @@ export const FileSystemProvider = (props: WorkspaceProps) => {
}) })
} }
// eslint-disable-next-line no-undef
const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => { const modal = (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => {
setModals(modals => { setModals(modals => {
modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn }) modals.push({ message, title, okLabel, okFn, cancelLabel, cancelFn })

@ -41,7 +41,6 @@ export interface WorkspaceState {
export interface Modal { export interface Modal {
hide?: boolean hide?: boolean
title: string title: string
// eslint-disable-next-line no-undef
message: string | JSX.Element message: string | JSX.Element
okLabel: string okLabel: string
okFn: () => void okFn: () => void

Loading…
Cancel
Save