Skip to content

Commit

Permalink
Use query instead of body for Etherscan API (#954)
Browse files Browse the repository at this point in the history
Co-authored-by: mikkel-pearl <[email protected]>
Co-authored-by: Eric Lau <[email protected]>
  • Loading branch information
3 people authored Jan 9, 2024
1 parent c9f518d commit 7b4698a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/plugin-hardhat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- Support proxy verification on Snowtrace. ([#954](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/954))

## 3.0.1 (2023-12-20)

- Update dependency on undici. ([#948](https://github.com/OpenZeppelin/openzeppelin-upgrades/pull/948))
Expand Down
6 changes: 2 additions & 4 deletions packages/plugin-hardhat/src/utils/etherscan-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import { Etherscan } from '@nomicfoundation/hardhat-verify/etherscan';
* @returns The Etherscan API response
*/
export async function callEtherscanApi(etherscan: Etherscan, params: any): Promise<EtherscanResponseBody> {
const parameters = new URLSearchParams({ ...params, apikey: etherscan.apiKey });

const parameters = { ...params, apikey: etherscan.apiKey };
const response = await request(etherscan.apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: parameters.toString(),
query: parameters,
});

if (!(response.statusCode >= 200 && response.statusCode <= 299)) {
Expand Down

0 comments on commit 7b4698a

Please sign in to comment.