diff --git a/apps/etherscan/src/app/RemixPlugin.tsx b/apps/etherscan/src/app/RemixPlugin.tsx index 8167850b9c..979f2c967d 100644 --- a/apps/etherscan/src/app/RemixPlugin.tsx +++ b/apps/etherscan/src/app/RemixPlugin.tsx @@ -1,6 +1,6 @@ import { PluginClient } from '@remixproject/plugin'; import { verify, EtherScanReturn } from './utils/verify'; -import { getReceiptStatus, getEtherScanApi, getNetworkName } from './utils'; +import { getReceiptStatus, getEtherScanApi, getNetworkName, getProxyContractReceiptStatus } from './utils'; export class RemixClient extends PluginClient { @@ -14,14 +14,17 @@ export class RemixClient extends PluginClient { return result } - async receiptStatus (receiptGuid: string, apiKey: string) { + async receiptStatus (receiptGuid: string, apiKey: string, isProxyContract: boolean) { try { const { network, networkId } = await getNetworkName(this) if (network === "vm") { throw new Error("Cannot check the receipt status in the selected network") } const etherscanApi = getEtherScanApi(networkId) - const receiptStatus = await getReceiptStatus(receiptGuid, apiKey, etherscanApi) + let receiptStatus + + if (isProxyContract) receiptStatus = await getProxyContractReceiptStatus(receiptGuid, apiKey, etherscanApi) + else receiptStatus = await getReceiptStatus(receiptGuid, apiKey, etherscanApi) return { message: receiptStatus.result, succeed: receiptStatus.status === '0' ? false : true diff --git a/apps/etherscan/src/app/utils/scripts.ts b/apps/etherscan/src/app/utils/scripts.ts index 81eb2cfd9f..0d204d8d55 100644 --- a/apps/etherscan/src/app/utils/scripts.ts +++ b/apps/etherscan/src/app/utils/scripts.ts @@ -21,9 +21,10 @@ export const receiptGuidScript = ` /** * @param {string} apikey - etherscan api key * @param {string} guid - receipt id + * @param {boolean} isProxyContract - true, if contract is a proxy contract (optional) * @returns {{ status, message, succeed }} receiptStatus */ -export const receiptStatus = async (apikey: string, guid: string) => { - return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey) +export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => { + return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey, isProxyContract) } ` \ No newline at end of file diff --git a/libs/remix-ui/workspace/src/lib/scripts/etherscan/receiptGuidScript.ts b/libs/remix-ui/workspace/src/lib/scripts/etherscan/receiptGuidScript.ts index ec0787ead6..5d8dca8063 100644 --- a/libs/remix-ui/workspace/src/lib/scripts/etherscan/receiptGuidScript.ts +++ b/libs/remix-ui/workspace/src/lib/scripts/etherscan/receiptGuidScript.ts @@ -1,8 +1,9 @@ /** * @param {string} apikey - etherscan api key * @param {string} guid - receipt id + * @param {boolean} isProxyContract - true, if contract is a proxy contract (optional) * @returns {{ status, message, succeed }} receiptStatus */ -export const receiptStatus = async (apikey: string, guid: string) => { - return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey) +export const receiptStatus = async (apikey: string, guid: string, isProxyContract?: boolean) => { + return await remix.call('etherscan' as any, 'receiptStatus', guid, apikey, isProxyContract) } \ No newline at end of file