-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Show transaction hashes for claimed permits #173
Feature: Show transaction hashes for claimed permits #173
Conversation
I think you'll need to pull from development because the app doesn't run. Did you test this? Also I fixed the continuous deploys within the time that you opened this pull request. If you push again it should deploy here and we will know definitively if its an environment issue etc.
|
done. |
@barebind This PR is ready for review, right? |
yes, I'm looking for adding database functions on my local supabase instance but getting a weird error. in any case there won't be any change on code side as it handles errors already. so yes, pr ready for review. |
I've tried on development branch too but still have this issue. it's not about this PR I would say. @pavlovcik |
Got it, it's -declare const extraRpcs: Record<string, string[]>; // @DEV: passed in at build time check build/esbuild-build.ts
+declare const allNetworkUrls: Record<string, string[]>; // @DEV: passed in at build time check build/esbuild-build.ts
export enum NetworkIds {
Mainnet = 1,
Goerli = 5,
Gnosis = 100,
}
-console.trace({ extraRpcs });
+console.trace({ allNetworkUrls }); Should I fix it on this PR? |
It should be fixed on most of the other branches why don't you investigate based on the other recently closed pulls and see what commit they are based on. It seems unusual to me that the problem persists if you rebased (or even merged) from a later commit when it was fixed. |
added the fix PR #181 for the issue. @pavlovcik |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that error is coming from db function. the transaction column is not null so it doesn't allow to update it as we discussed before. but the thing you are supposed to see a toaster saying that the permit is already claimed. let me check it. can you post the permit url? |
Why can we update only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works fine
Maybe I misunderstood the context but I'm referring these conversations/quotes below.
|
The rationale is that it seemed simple to implement and good for 99% of cases. Given that column level security is an advanced feature according to their docs:
I figured it makes the most sense to do it the simple way, and then possibly get around to implementing column level security as a lower priority task in the future. |
I meant if there is way to rewrite non null fields in supabase, because it seems strange that you can write (using supabase's public anon key) to null fields but can't override non empty |
I agree with the idea that this task focuses solving more like a
sort of problems. it is more about the UX rather than security. I think security concern should be another issue to discuss. on the other hand though, I totally agree with @rndquu's comment in long term. simply checking |
Where is the notification? |
|
This task is to show the transaction hash of the prior claim. Besides, what you're showing me already has been implemented and is live on pay.ubq.fi |
@@ -74,6 +81,13 @@ export function claimErc20PermitHandler(permit: Erc20Permit, provider: JsonRpcPr | |||
} | |||
|
|||
export async function checkPermitClaimable(permit: Erc20Permit, signer: ethers.providers.JsonRpcSigner | null, provider: JsonRpcProvider) { | |||
const permitHash = await doesPermitHaveTxHash(permit); | |||
if (permitHash !== null) { | |||
const explorerLink = `<a href="${getExplorerLinkForTx(permit.networkId, permitHash)}" target=_blank >${shortenTxHash(permitHash)}</a>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I understand, its only if it exists in the database. Perhaps we can do an end-to-end test somehow? How did you test locally? We can just do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1- generate claim through script
2- write it to db manually (as null transaction column)
3- and test the rest :)
I assume that (I have to somehow) permits are written to db correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose for another task we should replace the claim button with the transaction hash if it has already been claimed or validated.
We can substitute the claim button with one that has this icon, and upon mouse over it can say "View Claim"
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M212.309-140.001q-30.308 0-51.308-21t-21-51.308v-535.382q0-30.308 21-51.308t51.308-21h252.305V-760H212.309q-4.616 0-8.463 3.846-3.846 3.847-3.846 8.463v535.382q0 4.616 3.846 8.463 3.847 3.846 8.463 3.846h535.382q4.616 0 8.463-3.846 3.846-3.847 3.846-8.463v-252.305h59.999v252.305q0 30.308-21 51.308t-51.308 21H212.309Zm176.46-206.615-42.153-42.153L717.847-760H560v-59.999h259.999V-560H760v-157.847L388.769-346.616Z"/></svg>
There are two different checks, first one is db check for not-null-transaction-column if there is a hash then show the explorer link
and the second one that you are seeing as a toaster message is claimed nonce check. the order is as it is, first check db and then nonce. |
I'm testing now. Writing some notes. Some unrelated issue:
toFull.innerHTML = `<div>${receiverAddress}</div>`; |
Doesn't look like it works because I just tested on this. |
I've tested this PR locally, not on CF deployments + the tx hash must exist in the DB in order for the notification with tx hash to be displayed |
I think this feature should also include writing the data to the database. Even if my permit amount was of |
it actually writes the transaction hash to the database after the transaction is sent and confirmed. I think your test case is an already claimed permit which has a null transaction column in the database. which shouldn't happen normally |
No I generated a new permit and claimed it. You can check the chain for a timestamp. |
This PR does write tx hash to the |
do you generate new permit manually? if the permit is on db with null hash(not claimed) it updates the permits.transaction with the sent transaction's hash. it doesn't write the permit data to the database. |
I have the real private key in my .env so I generate real permits when I run yarn start. When is it written to the database? It's a bit difficult for me to see in the code when I'm mobile. |
this pr is only updating already existing permit with the transaction hash. I was assuming permit is inserted to database when/where it's generated. |
normally the permits are generated(and inserted to db) by ubiquibot so when I'm testing I inserted the generated permit(yarn start) to db manually. |
Yes, it's expected to work this way:
So in order to see a tx url in the |
@barebind any updates? |
seems like you changed this one to draft 2 days ago, any specific reason? anything that you were waiting from me? in any case I think that we definitely cannot merge both branches as basically they are doing the same thing in different ways. if you don't have any feedback I think it's better to close this one. |
This didn't work in my end-to-end test. |
I'm closing this PR as it is basically same feature (and same issues) with different UI/UX with #173 |
Resolves #138