Blockchain, libraries and websockets using a custom component

I thought I'd share a custom component I recently made and share some of the things I learned along the way (that part is in the code comments)

I wanted to start and see how far I could push custom components. I had already tested using socket.io.min.js to open a ws connection and stream video files so I wanted to see just how much a single custom component could handle. Since I'm already in the cryptocurrency space I knew Ripple (XRP) had a library to connect to their blockchain via a websocket, so this felt like a nice time to test a few things.

  • are 3rd party libraries allowed to establish a ws connection?
  • how complex can classes get and how how much is restricted and is it worth extra file size
  • the evil call stack, gotta find out how much I can use before I have to track down that annoying error
  • I had suggested function pointers as a solution for somebody but I hadn't yet tried it in Retool, so toss that in.

My comments can be long winded, but it helps me remember whatever I learn when I write it out. I also usually write out my thought process... especially in test/proof projects where there are or could be better ways of doing things. the code is originally from Ripple, but I had to make changes for Retool. most of those changes can probly be done in a better, or idk more efficient way (or at least w cleaner code lol)

I think the 1 thing I found that I 100% didn't expect at all was that class members seem to default to private and can't be changed. unless I'm just missing something obvious, which wouldn't surprise me as JS always likes to question my reality, I couldn't even get static or const to work like:

class stuff{
static nope = "I'm an error";
const doubleNope = "I was actually confused at this point and questioned life decisions lol"
.... more stuff
}

XRPLedger.json (56.4 KB)

it uses the official testnet, so no worries about the wallet stuff you can generate as many new ones as you want.

i guess if someone is interested I also have a custom component I'm working on that connects to a browser extension wallet (Tronlink, Tron blockchain this time) to interact with smart contracts via a injected library from the extension. it surprisingly is able to get events made from the extension also, I actually didn't expect that.

1 Like