get proxy contract receipt status

pull/5370/head
Aniket-Engg 2 years ago committed by Aniket
parent 7a39d93d79
commit 632f7e19e3
  1. 19
      apps/etherscan/src/app/utils/utilities.ts
  2. 11
      apps/etherscan/src/app/utils/verify.ts

@ -48,3 +48,22 @@ export const getReceiptStatus = async (
console.error(error)
}
}
export const getProxyContractReceiptStatus = async (
receiptGuid: string,
apiKey: string,
etherscanApi: string
): Promise<receiptStatus> => {
const params = `guid=${receiptGuid}&module=contract&action=checkproxyverification&apiKey=${apiKey}`
try {
const response = await axios.get(`${etherscanApi}?${params}`)
const { result, message, status } = response.data
return {
result,
message,
status,
}
} catch (error) {
console.error(error)
}
}

@ -1,4 +1,4 @@
import { getNetworkName, getEtherScanApi, getReceiptStatus } from "../utils"
import { getNetworkName, getEtherScanApi, getReceiptStatus, getProxyContractReceiptStatus } from "../utils"
import { CompilationResult } from "@remixproject/plugin-api"
import { CompilerAbstract } from '@remix-project/remix-solidity'
import axios from 'axios'
@ -114,7 +114,14 @@ export const verify = async (
if (message === "OK" && status === "1") {
resetAfter10Seconds(client, setResults)
const receiptStatus = await getReceiptStatus(
let receiptStatus
if (isProxyContract) {
receiptStatus = await getProxyContractReceiptStatus(
result,
apiKeyParam,
etherscanApi
)
} else receiptStatus = await getReceiptStatus(
result,
apiKeyParam,
etherscanApi

Loading…
Cancel
Save