Skip to content

Commit

Permalink
Merge pull request ubiquity#290 from ubq-testing/development
Browse files Browse the repository at this point in the history
optimistic view claim rendering
  • Loading branch information
ubiquity-os[bot] authored Sep 11, 2024
2 parents 2413abc + cba5b51 commit 3850fef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"URLSAFE",
"WXDAI",
"XDAI",
"xmark"
"xmark",
"outfile"
],
"dictionaries": ["typescript", "node", "software-terms", "html"],
"import": ["@cspell/dict-typescript/cspell-ext.json", "@cspell/dict-node/cspell-ext.json", "@cspell/dict-software-terms"],
Expand Down
16 changes: 8 additions & 8 deletions static/scripts/rewards/web3/erc20-permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,9 @@ async function transferFromPermit(permit2Contract: Contract, app: AppState) {
async function waitForTransaction(tx: TransactionResponse) {
try {
const receipt = await tx.wait();
viewClaimButton.onclick = () => {
window.open(`https://blockscan.com/tx/${receipt.transactionHash}`, "_blank");
};

toaster.create("success", `Claim Complete.`);
buttonController.showViewClaim();
buttonController.hideLoader();
buttonController.hideMakeClaim();
console.log(receipt.transactionHash);
toaster.create("success", `Claim Complete.`);

return receipt;
} catch (error: unknown) {
Expand Down Expand Up @@ -140,9 +134,15 @@ export function claimErc20PermitHandlerWrapper(app: AppState) {
const permit2Contract = new ethers.Contract(permit2Address, permit2Abi, signer);
if (!permit2Contract) return;

const tx = await transferFromPermit(permit2Contract, app);
const tx: TransactionResponse = await transferFromPermit(permit2Contract, app);
if (!tx) return;

viewClaimButton.onclick = () => window.open(`https://blockscan.com/tx/${tx.hash}`, "_blank");

buttonController.showViewClaim();
buttonController.hideLoader();
buttonController.hideMakeClaim();

const receipt = await waitForTransaction(tx);
if (!receipt) return;

Expand Down

0 comments on commit 3850fef

Please sign in to comment.