Skip to content

Commit 62b7265

Browse files
authored
fix: mask HTTP 400 errors in ContractDetails (#1802)
Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
1 parent 8cc101a commit 62b7265

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/utils/ERCUtils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,19 @@ export class ERCUtils {
101101
// Private
102102
//
103103

104+
private static privateAxios = axios.create()
105+
104106
private static async call(targetAddress: string, abi: string, values: unknown[]): Promise<unknown[] | null> {
105107
let result: unknown[] | null
106108
const itf = new ethers.Interface([abi])
107109
const functionData = itf.encodeFunctionData(abi, values)
108-
const url = "api/v1/contracts/call"
110+
const url = axios.defaults.baseURL + "api/v1/contracts/call"
109111
const body: ContractCallRequest = {
110112
data: functionData,
111113
to: targetAddress,
112114
}
113115
try {
114-
const response = await axios.post<ContractCallResponse>(url, body)
116+
const response = await ERCUtils.privateAxios.post<ContractCallResponse>(url, body)
115117
result = itf.decodeFunctionResult(abi, response.data.result)
116118
} catch (error) {
117119
if (axios.isAxiosError(error) && error.status === 400) {

0 commit comments

Comments
 (0)