From 0172ea56362c3f13232390f85ad1e9d69edb4a32 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 2 Nov 2022 12:46:21 +0100 Subject: [PATCH] add e2e etherscan api --- apps/remix-ide-e2e/src/tests/etherscan_api.ts | 43 ++++++++++++++++++- libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx | 1 + 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/tests/etherscan_api.ts b/apps/remix-ide-e2e/src/tests/etherscan_api.ts index 7089d5b563..530212a2d3 100644 --- a/apps/remix-ide-e2e/src/tests/etherscan_api.ts +++ b/apps/remix-ide-e2e/src/tests/etherscan_api.ts @@ -46,7 +46,16 @@ module.exports = { .click('[data-id="verify-contract"]') .waitForElementVisible('[data-id="verify-result"]') .waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified') - } + }, + + 'Should call the etherscan plugin api #group1': function (browser: NightwatchBrowser) { + browser + .frameParent() + .clickLaunchIcon('filePanel') + .addFile('receiptStatusScript.ts', { content: receiptStatusScript }) + .click('*[data-id="play-editor"]') // run the script + .waitForElementContainsText('*[data-id="terminalJournal"]', 'Pass - Verified', 60000) + } } const verifiedContract = ` @@ -105,3 +114,35 @@ contract Owner { return owner; } }` + +const receiptStatusScript = ` + const receiptStatus = async () => { + try { + const apikey = '2HKUX5ZVASZIKWJM8MIQVCRUVZ6JAWT531' + const ret = await remix.call('etherscan' as any, 'receiptStatus', 'n1qtqfn8jggwqv9uvni5zzectnztqbxqqvizznvl4vg1pndb9v', apikey) + console.log(ret) + } catch (e) { + console.log(e.message) + } + } + receiptStatus() +` + +const verifyScript = ` + const verify = async () => { + try { + const apikey = '2HKUX5ZVASZIKWJM8MIQVCRUVZ6JAWT531' + const contractAddress = '0x900d15ce8fc2115c4a870107e5ea855e4243900e' + const contractArguments = '' // hex value without 0x + const contractName = 'Owner' + const contractFile = 'contracts/2_Owner.sol' + const compilationResultParam = await remix.call('compilerArtefacts' as any, 'getCompilerAbstract', contractFile) + console.log('verifying..') + const ret = await remix.call('etherscan' as any, 'verify', apikey, contractAddress, contractArguments, contractName, compilationResultParam) + console.log(ret) + } catch (e) { + console.log(e.message) + } + } + verify() +` diff --git a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx index 88228e6cb4..9102ffda48 100644 --- a/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx +++ b/libs/remix-ui/tabs/src/lib/remix-ui-tabs.tsx @@ -146,6 +146,7 @@ export const TabsUI = (props: TabsUIProps) => {