diff --git a/static/scripts/rewards/web3/erc20-permit.ts b/static/scripts/rewards/web3/erc20-permit.ts index f6e058c9..74ef8e9b 100644 --- a/static/scripts/rewards/web3/erc20-permit.ts +++ b/static/scripts/rewards/web3/erc20-permit.ts @@ -91,7 +91,7 @@ export async function transferFromPermit(permit2Contract: Contract, reward: Perm buttonController.showMakeClaim(); } else { const { errorname, message } = decodeError(permit2Contract, e); - console.error(`Error in permitTransferFrom: ${errorname} [ ${message} ]`); + console.error(`Error in permitTransferFrom: ${errorname} ${message}`); errorToast(e, e.reason); } } diff --git a/static/scripts/rewards/web3/erc721-permit.ts b/static/scripts/rewards/web3/erc721-permit.ts index ba115e06..a689d255 100644 --- a/static/scripts/rewards/web3/erc721-permit.ts +++ b/static/scripts/rewards/web3/erc721-permit.ts @@ -73,7 +73,7 @@ export function claimErc721PermitHandler(reward: ERC721Permit) { buttonController.showMakeClaim(); } else { const { errorname, message } = decodeError(nftContract, e); - console.error(`Error claiming NFT: ${errorname} [ ${message} ]`); + console.error(`Error claiming NFT: ${errorname} ${message}`); errorToast(e, e.reason); } } else if (typeof error === "string") { diff --git a/static/scripts/rewards/web3/error-decoder.ts b/static/scripts/rewards/web3/error-decoder.ts index 2508c77e..e0119f4c 100644 --- a/static/scripts/rewards/web3/error-decoder.ts +++ b/static/scripts/rewards/web3/error-decoder.ts @@ -8,13 +8,15 @@ export function decodeError(contract: Contract, err: MetaMaskError) { const res = iface.decodeErrorResult(selecter, errordata); const errorfragments = iface.getError(selecter); - let message; + let message = ""; if (errorfragments.inputs.length > 0) { + message += "[ "; message = errorfragments.inputs .map((input, index) => { return `${input.name}: ${res[index].toString()}`; }) .join(", "); + message += " ]"; } return {