|
|
|
@ -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) |
|
|
|
|
} |
|
|
|
|