pull/5370/head
filip mertens 2 years ago committed by Aniket
parent f595099546
commit 77bf879243
  1. 7
      apps/etherscan/src/app/RemixPlugin.tsx
  2. 16
      apps/etherscan/src/app/utils/utilities.ts

@ -23,9 +23,10 @@ export class RemixClient extends PluginClient {
const etherscanApi = getEtherScanApi(network)
const receiptStatus = await getReceiptStatus(receiptGuid, apiKey, etherscanApi)
return {
status: receiptStatus,
message: receiptStatus,
succeed: true
status: receiptStatus.status,
message: receiptStatus.message,
result: receiptStatus.result,
succeed: receiptStatus.status === '0' ? false : true
}
} catch (e: any){
return {

@ -2,6 +2,12 @@ import { PluginClient } from "@remixproject/plugin"
import axios from 'axios'
type RemixClient = PluginClient
export type receiptStatus = {
result: string
message: string
status: string
}
export const getEtherScanApi = (network: string) => {
return network === "main"
? `https://api.etherscan.io/api`
@ -20,12 +26,16 @@ export const getReceiptStatus = async (
receiptGuid: string,
apiKey: string,
etherscanApi: string
) => {
): Promise<receiptStatus> => {
const params = `guid=${receiptGuid}&module=contract&action=checkverifystatus&apiKey=${apiKey}`
try {
const response = await axios.get(`${etherscanApi}?${params}`)
const { result } = response.data
return result
const { result, message, status } = response.data
return {
result,
message,
status,
}
} catch (error) {
console.error(error)
}

Loading…
Cancel
Save