diff --git a/web/src/lib/components/ResponseSendModal.svelte b/web/src/lib/components/ResponseSendModal.svelte index dc8a073..f16f34e 100644 --- a/web/src/lib/components/ResponseSendModal.svelte +++ b/web/src/lib/components/ResponseSendModal.svelte @@ -70,10 +70,13 @@ if (BigInt(quotaRecord.amount) > BigInt(allowed)) { const approval = await erc20.methods .approve(quotaRecord.transaction.to, quotaRecord.amount) - .send(callOptions); + .send({ + ...callOptions, + from: ownerAddress + }); - console.warn(approval); - if (!approval) throw new Error('Not Approved!'); // To stop execution + console.log(approval); + if (!approval.status) throw new Error('Not Approved!'); // To stop execution } // FINAL STEP! @@ -81,7 +84,8 @@ console.warn(`TX receipt: `, receipt); successful[index] = true; - } catch { + } catch (error) { + console.error(error); submitting[index] = false; } } diff --git a/web/src/lib/formatters.ts b/web/src/lib/formatters.ts index edecb8e..6033df6 100644 --- a/web/src/lib/formatters.ts +++ b/web/src/lib/formatters.ts @@ -1,5 +1,5 @@ import { intlFormatDistance } from 'date-fns'; export function formatDuration(value: number): string { - return intlFormatDistance(value / 10000, 0); + return intlFormatDistance(value * 1000, 0); } diff --git a/web/src/lib/hacks.ts b/web/src/lib/hacks.ts index 7eea273..e105a48 100644 --- a/web/src/lib/hacks.ts +++ b/web/src/lib/hacks.ts @@ -94,9 +94,10 @@ export async function hacks_getQuota(value: Object) { if (value.whitelisted) url.searchParams.set('whitelistedSourceChains', value.whitelisted); if (value.threshold) url.searchParams.set('threshold', value.threshold); - return await fetch(url.toString()).then((r) => - r.json().then(json => { - if (r.ok) return json; + return await fetch(url.toString()).then((response) => + response.json().then((json) => { + if (response.ok) return json; throw new Error(JSON.stringify(json)); - })); + }) + ); }