@@ -20,8 +20,8 @@ import {
2020import { Plugin } from '@remixproject/engine' ;
2121import { getContractData } from '@remix-project/core-plugin'
2222import type { TxResult } from '@remix-project/remix-lib' ;
23- import { BrowserProvider } from "ethers"
24- import { toNumber , ethers } from 'ethers'
23+ import { BrowserProvider , formatEther } from "ethers"
24+ import { toNumber } from 'ethers'
2525import { execution } from '@remix-project/remix-lib' ;
2626const { txFormat, txHelper : { makeFullTypeDefinition } } = execution ;
2727
@@ -104,6 +104,12 @@ export class DeployContractHandler extends BaseToolHandler {
104104 if ( ! data ) {
105105 return this . createErrorResult ( `Could not retrieve contract data for '${ args . contractName } '` ) ;
106106 }
107+ await plugin . call ( 'sidePanel' , 'showContent' , 'udapp' )
108+ plugin . emit ( 'setValueRequest' , args . value || '0' , 'wei' )
109+ if ( args . value && args . value !== '0' ) {
110+ plugin . call ( 'notification' , 'toast' , `Value of ${ formatEther ( args . value ) } ETH will be sent with the deployment` )
111+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ; // Wait a moment for the toast to be seen
112+ }
107113
108114 let txReturn
109115 try {
@@ -141,8 +147,7 @@ export class DeployContractHandler extends BaseToolHandler {
141147 logs : receipt . logs ,
142148 contractAddress : receipt . contractAddress ,
143149 success : receipt . status === 1 ? true : false
144- } ;
145- await plugin . call ( 'sidePanel' , 'showContent' , 'udapp' )
150+ }
146151 plugin . call ( 'udapp' , 'addInstance' , result . contractAddress , data . abi , args . contractName , data )
147152
148153 return this . createSuccessResult ( result ) ;
@@ -256,6 +261,13 @@ export class CallContractHandler extends BaseToolHandler {
256261 const isView = funcABI . stateMutability === 'view' || funcABI . stateMutability === 'pure' ;
257262 let txReturn
258263 try {
264+ await plugin . call ( 'sidePanel' , 'showContent' , 'udapp' )
265+ plugin . emit ( 'setValueRequest' , args . value || '0' , 'wei' )
266+ if ( args . value && args . value !== '0' ) {
267+ plugin . call ( 'notification' , 'toast' , `Value of ${ formatEther ( args . value ) } ETH will be sent with the deployment` )
268+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) ) ; // Wait a moment for the toast to be seen
269+ }
270+
259271 txReturn = await new Promise ( ( resolve , reject ) => {
260272 const params = funcABI . type !== 'fallback' ? ( args . args ? args . args . join ( ',' ) : '' ) : ''
261273 plugin . call ( 'blockchain' , 'runOrCallContractMethod' ,
0 commit comments