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 b73a44e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 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));
}));
})
);
}
22 changes: 1 addition & 21 deletions web/src/lib/stores/wallet.ts
Original file line number Diff line number Diff line change
@@ -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<false | EIP6963ProviderDetail>();

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');
}

0 comments on commit b73a44e

Please sign in to comment.