Real-time events/callbacks?

I am thinking about building a really simple web app to demonstrate the testnet – something really simple like sending transactions between known accounts

To give the demo some sizzle, and to demonstrate the unique speed / fast finality of algorand, what I would like to do is visually indicate when the transaction has been confirmed

Ideally there would be a way to register some kind of callback with the node, which would then ping the JS client when the tx was confirmed

Any thoughts on how best to accomplish doing this? A simple start would be to just poll the node from the JS client and look for the published transaction, but that seems less elegant

It is also possible that I am just thinking about this the wrong way entirely, so happy to be educated if that’s the case

Thanks!
Nick

1 Like

Nick,

I like this idea. We are working on a JS SDK. This should be available soon. You could build on top of the REST API, but you may want to hold for just a bit and let us get the JS SDK out. I am not certain it will have callbacks though.

Jason

This is not something we’re going to provide in the REST API itself. You will need to poll the node. There will be no callbacks in our API.

1 Like

Jason,

Do you have a rough estimate for the availability of the JS SDK? I also have an interest in developing some basic web Apps.

We are hoping to put something out in the next couple of weeks on a couple of APIs.

1 Like

Very excited about that!

Webhooks are very useful in a node and wallet, this should be straightforward to implement

@David would you mind going into a little more detail as to why this design decision was made? Are there any specific tradeoffs?

These things can be implemented on top of the REST APIs. We want to ensure we provide the necessary primitives to build on top of. Higher-level abstractions and convenience features can be added by the community if we don’t get to them.

2 Likes

Ah, great. That was my assumption. Once we open, the API basically turns into an OPI or “Open Protocol Interface.” :sunglasses:

Thank you for your answer.

1 Like

Hi @ChaseHunter

So what is the best solution to watch custom wallet address?

Should I do request each second to the public api with the address, do I have to setup the node, and do 1 second requests to that or has been something invented in last 2 years regarding webhooks or callbacks?

We have the new indexer which you could use but you still have to call it. You can set it up to be queried every block by using statusAfterBlock. That should prevent having to poll every second, which would be a waste. Another option is to use a tool like: Algorand Developer Portal

1 Like

No nothing and they will just lead down a rabbit hole of links with no proper answer, code examples or anything.

If there are no callbacks, then this whole thing is worthless. Where are the callbacks. We need a payment workflow, at this point it is nothing but guess work.

All I find in the subject is link to more links, and the only information that amounts up to anything is a paid service partnered with Algorand.

So seriously, what’s the answer. I still can’t find one.

Well I have implemented approx 6 months ago the frontend payment gateway.

You can create your own callback, or payment button and when user pays, than the user is redirected to the callback address with txid.

Its fully open source and free to copy/use… https://github.com/scholtz/wallet/blob/master/src/pages/PaymentGateway.vue

You do not pay any middleman fees, and user can pay directly to the eshop owner… Eshop owner can accept the payments even with usdc/usdt and can set his own matching order in the tx note field so that he can manually match the payment later for example.

Example of the link: Algo Wallet

In the address is base64-url encoded the parameters and return urls…

This is actually awesome, but I am getting a 405 Error upon successful transaction. Is there something I can do to fix it?

I literally tried everything I could think, I even turned off cloudflare for this specific part nothing is working. I tried to get it to load the page and it won’t get pass the 405 Error.

I am working with static html.

The link,

https://www.a-wallet.net/gateway/YWxnb3JhbmQ6Ly9LRTVBMjNER1pVS1hNQzNaUkJPMlgzRFAzSE9ENkY1RUxWNEtYUzNPUlRYMjdHTlJSN1BSUkhaUlBVPyZhbW91bnQ9NTAwMDAwMDAwMDAmYXNzZXQ9NDQ1MzYyNDIx/eyJzdWNjZXNzIjoiaHR0cHM6Ly9tYWdtLnJlZC9sb3R0by85ZGUwZjRkVWlydGg1NjQ3IiwiY2FuY2VsIjoiaHR0cHM6Ly9tYWdtLnJlZC9sb3R0by9mYWlsZWQifQ==

Error 405 usually means method not allowed… Are you redirecting user to this endpoint, or are you trying to make post request to it?

When i click on your link i get message Pay 5 MAGM to the algorand address KE5A23DGZUKXMC3ZRBO2X3DP3HOD6F5ELV4KXS3ORTX27GNRR7PRRHZRPU…

Or if you are refferenig to post payment redirect, i believe it is using get method… simple redirect back to your web with tx id in the parameters.

Can you pls share the link of the 405 error page?

Yes, the successful transaction and I tried over 12 different pages always get the same result.

I don’t know why I tried to figure it out for about 6 hours, and I don’t think it’s anything I am doing.

Sure it is the success page Thanks for purchasing a MAGMA🌋LOTTO ticket!| MAGMA

And the failed page works flawless, Sorry your transaction has failed or has been cancelled! - MAGMA🌋LOTTO | MAGMA