Skip to content

Commit

Permalink
smoll fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BeroBurny committed Jun 4, 2024
1 parent baa6330 commit d15ce07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
12 changes: 8 additions & 4 deletions web/src/lib/components/ResponseSendModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,22 @@
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!
const receipt = await web3.eth.sendTransaction(quotaRecord.transaction);
console.warn(`TX receipt: `, receipt);
successful[index] = true;
} catch {
} catch (error) {
console.error(error);
submitting[index] = false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/formatters.ts
Original file line number Diff line number Diff line change
@@ -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);
}
9 changes: 5 additions & 4 deletions web/src/lib/hacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}));
})
);
}

0 comments on commit d15ce07

Please sign in to comment.