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)); - })); + }) + ); } diff --git a/web/src/lib/stores/wallet.ts b/web/src/lib/stores/wallet.ts index 7448bfe..8e5f9f9 100644 --- a/web/src/lib/stores/wallet.ts +++ b/web/src/lib/stores/wallet.ts @@ -1,27 +1,7 @@ import { readable, writable } from 'svelte/store'; -import { announceProvider, createStore, type EIP6963ProviderDetail } from 'mipd'; -import { dev } from '$app/environment'; +import { createStore, type EIP6963ProviderDetail } from 'mipd'; export const selectedProvider = writable(); const store = createStore(); export const providers = readable(store.getProviders(), store.subscribe); - -// want to use impersonator, hack to add it on the provider list -try { - if (dev && typeof window !== 'undefined') { - setTimeout(() => { - announceProvider({ - info: { - icon: 'https://pa1.aminoapps.com/8618/9035ab93575fa9b12d8f3d6bf5cad45abf10d18fr1-720-450_hq.gif', - name: 'Non-EIP6963Provider', - rdns: 'window.ethereum', - uuid: '00000000-0000-0000-0000-000000000000' - }, - provider: window.ethereum - }); - }, 1000); - } -} catch { - console.log('skip announceProvider'); -}