-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add walletconnect provider #114
Add walletconnect provider #114
Conversation
Hey @devceline @Cali93 Are there any docs on how I can test this? :) |
Hi - yes of course. As mentioned in the description I personally tested it by modifying the preliminary setup for that is:
After that, you should see a notification in https://app.web3inbox.com in your subscription. If you do not get one, double check that the notification type in the If you have any questions please feel free to reach out. |
Hi @devceline thanks for the reply, i have seen the WC cloud projects but that needs verification. Is there some way to test with out touching https://your.domain/.well-known/ or snapshot.org directly |
@ChaituVR you can deploy a testing domain to host the .well-known for a new testing WalletConnect Cloud project, e.g. snapshot-wc-notify-test.vercel.app. It doesn't have to be tied to the snapshot.org domain until you move to prod. |
Hey guys, how can i see my test app here https://app.web3inbox.com/notifications/new-app ? |
Hey! We'll send you a full video on this tomorrow. However, for now You can follow the following instructions to see your app there. On Then clicking the "Notifications" tab And toggle "Display all" Then navigate back to |
Hi @devceline I could get my app on this list. here is my app https://cloud.walletconnect.com/app/project?uuid=1b17f525-1b76-40d7-86e4-66821b538885 should i have to publish it? |
@ChaituVR you don't need to publish your app to test it, just enable Notify API in Cloud and also toggle the switch in app.web3inbox.com from Celine's post above. |
I did that @chris13524 but sadly i don't see it. I see other test ones but not mine. Maybe i miss some step ,😥 |
Or is there some other way i can test this ? maybe i can build a small front end like here https://docs.walletconnect.com/api/notify/usage |
Just checked your project, looks like Notify is disabled, can you go ahead and tick that toggle for Notify API? |
@ChaituVR I don't think Ngrok will work for hosting the did.json because Ngrok requires the user to press a button in order to view the site (which a JS fetch will not be able to do). So you will probably need to host the did.json on another platform such as Cloudflare Pages or Vercel. Key is hitting that switch and getting a green toast, and it doesn't look like that was setup yet. |
I get this as response when i try to trigger test endpoint
|
whatever way i try, I always get this error 😢 Anyway, what are the next steps to proceed? |
Well - can you tell me what address you're putting in line 32 of Next steps would be choosing whether or not you'd want to maintain a list of subscribers on your database or go with the discord provider approach and just depend on external data. In this case, external data is notify servers' list of subscribers. Once we have that squared away I can update the PR to match, but if you can't test this maybe we should arrange a meeting to actually tackle the issue. |
I tried passing multiple addresses, for example
@bonustrack Could you help me with this plz? |
@ChaituVR the address needs to be a CAIP-10 account ID. Try prefixing the address with |
Hi @chris13524 thank you! Is there some issue with Also tried in incognito |
@ChaituVR this looks like a temporary network error, and we don't commonly see this. Could you perhaps try again? |
} catch (e) { | ||
capture('[WalletConnect] failed to fetch subscribers'); | ||
return []; | ||
} |
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.
Why are we catching and suppressing this error? If we can't get subscribers then the functions that call this should fail as well, not proceed with an empty list.
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.
the other providers like discord and xmtp don't throw and just end up being a noop so I did the same here
const notifyUrl = `${WALLETCONNECT_NOTIFY_SERVER_URL}/${WALLETCONNECT_PROJECT_ID}/notify`; | ||
|
||
const body = { | ||
accounts, |
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.
accounts
has a max length of 500, so we need to call /notify
in a loop.
Also has a rate limit of 2 per second so you may need to add some artificial timing e.g. with date math and await new Promise(resolve => setTimeout(resolve, time))
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'll refactor to fix this
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.
Can you run the lint:fix
command too?
src/providers/walletconnectNotify.ts
Outdated
|
||
// Cross Reference subscribers from Snapshot to the ones in Notify | ||
export async function getSubscriberFromDb(space: string) { | ||
const subs: string[] = await getSubscribers(space); |
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.
You don't need to run this query, you should instead use the "subscribers" variable from the send
function
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.
Awesome - updating to use subscribers
.
case 'proposal/end': | ||
return `A proposal has closed for ${space.name}`; |
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 talked to team about this, better we should be jusing just 'proposal/start' instead of created/end
// That should be defined in the wc-notify-config.json | ||
function getNotificationType(event) { | ||
if (event.includes('proposal/')) { | ||
return 'ed2fd071-65e1-440d-95c5-7d58884eae43'; |
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 think this one is for new app
return 'ed2fd071-65e1-440d-95c5-7d58884eae43'; | |
return 'f3c55113-06fb-47c7-87da-28ee21b9114a'; |
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.
Yes - please feel free to adjust the notification types per your cloud configuration
const url = new URL(proposal.link); | ||
url.searchParams.append('app', 'walletconnect'); |
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.
This is resulting in https://snapshot.org/?app=walletconnect#/thanku.eth/proposal/0x8c2a67398c9912f7c2ba15a68caf94388ea98a88074079103d48e3eae83e2ea7
I think it is better to add string at the end of URL
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.
Maybe this is fine
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.
What's the purpose of ?app=walletconnect
@devceline ?
Reason for new URL
was to properly parse and construct the string to properly use query params. If we appended at end of the URL it also wouldn't be a valid query param as it would actually be part of the fragment. What would the string at the end of the URL be used for?
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.
What would the string at the end of the URL be used for?
It is used by snapshot to know that someone voted from web3inbox, changed it to web3inbox
in the other PR, hope it is fine
} | ||
|
||
// Transform proposal event into notification format. | ||
async function formatMessage(event, proposal) { |
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.
async function formatMessage(event, proposal) { | |
function formatMessage(event, proposal) { |
Closed in favor of #162 |
Changes
walletconnectProvider
/api/test
endpoint - it is kept in there for testing convenience, will be reverted once everything is confirmed to work@types/node
to prevent build error