With Binance, Fee Assets are the type of currency you use to pay Binance; Base Asset is the type of currency offered; Quote Asset is the type of currency received

Binance has three accounting categories for assets: “Fee”, “Quote”, and “Base”. When I first looked at the table, I got fixated on “Buy” and “Sell” operations and looked at Base and Quote through those lenses. It’s an overcomplication though, because “buy” and “sell” are the same coin looked at from different angles. In both cases one item is given for another; an exchange is made. Regardless of Buy or Sell operation:

Jacek builds a REST API with three layers: db, handler, and route

In Learn Reitit Pro, Jacek Schae has a three-layered approach to building a REST API. The three layers: db, handler, and route. For the db, he uses next.jdbc with a Heroku-hosted PostgreSQL instance. For the routing layer he uses Reitit and Ring (which uses Java-built’s Jetty). The second layer is just Clojure functions–simple. The routing layer is Ring powered with Jetty assisted with Reitit. Ring’s just a Clojure wrapper for the Java Jetty web server, which accepts http requests and returns http responses.

Authorization: Bearer TOKEN

You can authorize http requests in four main ways: Two involve the Authentication header, two involve request parameters. You can use a 1) Basic or 2) Bearer Authentication header, or you can pass a token/un-pass combo to a 3) query paramater or 4) form parameter. The value of the Authorization header is a space-delimited tuple. As an http newbie, I wondered how to pass authorization tokens in. Do I pass another token in?

Bitcoin/Dogecoin use a UTXO model to see how much you have

Crypto is weird. With it, you really spend transactions labeled with coin values (UTXOs) and not coins themselves. The blockchain uses an Unspect Transaction Outputs model a.k.a. a UTXO model to calculate what a person’s able to spend. Assume a brand new network which genesises three transactions–1BTC, 0.5BTC, 2BTC–for 3 UTXOs. Someone else joins the network, and you decide to pay him 0.25BTC. Like pulling a $5 from your wallet, you pull one UTXOs and give it to the network, probably the 0.

Paper wallet fundamentals

A wallet is a container for pairs of strings. You can have 2, 4, 6… 2n strings in a valid wallet. The two strings of each pair are a public hash string and a private hash string. Why both and not just private hash strings? Without the public, the software it’ll eventually work with won’t know which address to unlock coins for (“key” is a bad metaphor; the public key is more like a lockbox, and the private key is more like a key).

Reitit course starts with a Hello World app template, not the Cheffy app template.

I handled three misconceptions with Jacek’s Reitit course: It’d use the Re-Frame cheffy files off the bat, showing a proper webpage on Heroku; that the Heroku server’d use the latest Leiningen; and that heroku create initialized the git repo. lein new app cheffy creates a hello world project from the “app” template. It doesn’t pull cheffy as a template. Leiningen defaults to 1.7 which does not use https when pulling from Clojars or Maven causing checksum errors when the servers 501 (https required).

Re-Frame interceptor errors prevent app state updates

One error in any interceptor prevents the second Re-Frame domino from falling. Either I wrote an error or clojure.spec changed since Jacek recorded his course, but my spec saw the db and threw an error. My spec function was in an interceptor, and this interceptor error prevented Re-Frame from updating the app-db, causing nothing to load in the app. Any error in any interceptor (including after interceptors) of an event handler will prevent app state updates and further effects.

When an event-fx dispatches to an event-db, pull the event-db's op to the original event-fx and change it to event-db

In Re-Frame, I removed effect events for db events. Pure db events represent low cognitive-overhead functional programming: db in, db out. Side effect fx events necessarily complicate the program, but per Jacek Schae’s instruction, I removed unnecessary cases: I.e. fx events that dispatched to db events. I changed these db-dispatching fx events to a db event and have it modify the db one more time in a db event instead of dispatching.

Delete .shadow-cljs/build and rebuild to clear caching errors

I fucked up then fixed Jacek’s Cheffy app in four ways: malindented (which causes rewrapping) for the db hashmap (putting key values outside the original map) page-nav (nesting content under it) messages (nesting them within an input container) duplicated a file to model it for another page, but I didn’t update the component name the modal name the file name typed keys instead of key for ^{:key id} malcached it somehow?

Dereference your damn atoms ha

I couldn’t add an image in my app. After many hours, I saw that I passed in an atom to a component without dereferencing it, which caused an image not to load. The values atom had the image. I looked in the from-group, the modal, and the button. I put print statements in the component and the subscription and event it used. The print statement in the subcription showed nil. The print in the :upsert-image event showed an atom with the image.