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