show file path

pull/4538/head
aniket-engg 9 months ago committed by Aniket
parent 07f27097da
commit 947cc035f6
  1. 4
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  2. 4
      apps/remix-ide/src/app/udapp/run-tab.js
  3. 2
      libs/remix-ui/run-tab/src/lib/actions/actions.ts
  4. 4
      libs/remix-ui/run-tab/src/lib/actions/events.ts
  5. 2
      libs/remix-ui/run-tab/src/lib/components/instanceContainerUI.tsx
  6. 17
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
  7. 6
      libs/remix-ui/run-tab/src/lib/types/index.ts

@ -74,9 +74,7 @@
"udapp.NoSavedInstanceText": "Currently you have no saved contracts to interact with.",
"udapp.tooltipTextUnsave": "Delete from saved list",
"udapp.savedOn": "Saved On",
"udapp.filePath": "File Path",
"udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx",
"udapp.transactionsRecorded": "Transactions recorded",

@ -84,8 +84,8 @@ export class RunTab extends ViewPlugin {
this.emit('addInstanceReducer', address, abi, name)
}
addSavedInstance(address, abi, name, savedOn) {
this.emit('addSavedInstanceReducer', address, abi, name, savedOn)
addSavedInstance(address, abi, name, savedOn, filePath) {
this.emit('addSavedInstanceReducer', address, abi, name, savedOn, filePath)
}
createVMAccount(newAccount) {

@ -70,7 +70,7 @@ export const addInstance = (dispatch: React.Dispatch<any>, instance: { contractD
dispatch(addNewInstance(instance))
}
export const addSavedInstance = (dispatch: React.Dispatch<any>, instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any>, savedOn?: number }) => {
export const addSavedInstance = (dispatch: React.Dispatch<any>, instance: { contractData?: ContractData, address: string, name: string, abi?: any, decodedResponse?: Record<number, any>, savedOn?: number, filePath?: string }) => {
instance.decodedResponse = {}
dispatch(addNewSavedInstance(instance))
}

@ -83,8 +83,8 @@ export const setupEvents = (plugin: RunTab, dispatch: React.Dispatch<any>) => {
addInstance(dispatch, { abi, address, name })
})
plugin.on('udapp', 'addSavedInstanceReducer', (address, abi, name, savedOn) => {
addSavedInstance(dispatch, { abi, address, name, savedOn })
plugin.on('udapp', 'addSavedInstanceReducer', (address, abi, name, savedOn, filePath) => {
addSavedInstance(dispatch, { abi, address, name, savedOn, filePath})
})
plugin.on('filePanel', 'setWorkspace', () => {

@ -20,7 +20,7 @@ export function InstanceContainerUI(props: InstanceContainerProps) {
if (savedContracts[env.current] && savedContracts[env.current][network.id]) {
const instances = savedContracts[env.current][network.id]
for (const inst of instances)
if (inst) await props.plugin.call('udapp', 'addSavedInstance', inst.address, inst.contractData.abi, inst.name, inst.savedOn)
if (inst) await props.plugin.call('udapp', 'addSavedInstance', inst.address, inst.contractData.abi, inst.name, inst.savedOn, inst.filePath)
}
}
}

@ -59,6 +59,7 @@ export function UniversalDappUI(props: UdappProps) {
}, [props.instance.balance])
useEffect(() => {
console.log('props--->', props.instance)
const getEnv = async () => {
env.current = await props.plugin.call('blockchain', 'getProvider')
}
@ -134,6 +135,8 @@ export function UniversalDappUI(props: UdappProps) {
const saveContract = async() => {
const env = await props.plugin.call('blockchain', 'getProvider')
const workspace = await props.plugin.call('filePanel', 'getCurrentWorkspace')
console.log('workspace--->', workspace)
const {network} = await props.plugin.call('blockchain', 'getCurrentNetworkStatus')
const savedContracts = localStorage.getItem('savedContracts')
let objToSave
@ -151,10 +154,11 @@ export function UniversalDappUI(props: UdappProps) {
}
}
props.instance.savedOn = Date.now()
props.instance.filePath = `${workspace.name}/${props.instance.contractData.contract.file}`
objToSave[env][network.id].push(props.instance)
localStorage.setItem('savedContracts', JSON.stringify(objToSave))
// Add contract to saved contracts list on UI
await props.plugin.call('udapp', 'addSavedInstance', props.instance.address, props.instance.contractData.abi, props.instance.name, props.instance.savedOn)
await props.plugin.call('udapp', 'addSavedInstance', props.instance.address, props.instance.contractData.abi, props.instance.name, props.instance.savedOn, props.instance.filePath)
// Remove contract from deployed contracts list on UI
props.removeInstance(props.index, false)
}
@ -294,13 +298,20 @@ export function UniversalDappUI(props: UdappProps) {
<div className="udapp_contractActionsContainer">
<div className="d-flex" data-id="instanceContractBal">
<label>
<FormattedMessage id="udapp.balance" />: {instanceBalance} ETH
<b><FormattedMessage id="udapp.balance" />:</b> {instanceBalance} ETH
</label>
</div>
{ props.isSavedContract && props.instance.savedOn ? (
<div className="d-flex" data-id="instanceContractSavedOn">
<label>
<FormattedMessage id="udapp.savedOn" />: {(new Date(props.instance.savedOn)).toUTCString()}
<b><FormattedMessage id="udapp.savedOn" />:</b> {(new Date(props.instance.savedOn)).toUTCString()}
</label>
</div>
) : null }
{ props.isSavedContract && props.instance.filePath ? (
<div className="d-flex" data-id="instanceContractFilePath">
<label>
<b><FormattedMessage id="udapp.filePath" />:</b> {props.instance.filePath}
</label>
</div>
) : null }

@ -315,7 +315,8 @@ export interface InstanceContainerProps {
name: string,
decodedResponse?: Record<number, any>,
abi?: any,
savedOn?: number
savedOn?: number,
filePath?: string
}[],
error: string
},
@ -422,7 +423,8 @@ export interface UdappProps {
name: string,
decodedResponse?: Record<number, any>,
abi?: any,
savedOn?: number
savedOn?: number,
filePath?: string
},
context: 'memory' | 'blockchain',
isSavedContract?: boolean

Loading…
Cancel
Save