EXPERIMENTS

#032 Dubunum
    Dupdate
by Anupam, 02/08/23

I’m still pushing the rewrite this week (good code takes longer than I thought!). No download link, but lots of amazing progress to talk about.

Overview

My focus this week was pushing the rewrite of Dub as far as possible - with a focus on moving over to a new Web3Swift package in anticipation of supporting BIP 32/44.

This took a surprising amount of time! The state of Dub last week was primitive - early (re)implementation of our browser with much cleaner/safer code, error catching, & bug fixes. This gave me a great jumping off point - and a high standard - to continue pushing on this week.

While much of what was written last week was conceptually figured out ahead of time, this week was much more exploratory - implementing a WalletManager (a modular + swappable ‘black box’ to sign, swap wallets, and set chains - so we can reimplement with multi wallet support), NotificationManager, and more basic browser functionality.

While not completely done, I’ve made a significant amount of progress - and learned a lot of annoying quirks about our new Web3swift package. More details below.

Process

Some of the major accomplishments this week include:

A couple of these were easy (shoutout @Robert for making upload/download really easy - just some copy pasta 🍝); most of my time was spent figuring out the new Web3Swift package (which has literally zero documentation).

I spent about ~2 days going through the written tests & linked/forked packages to compile my own documentation. While this might seem simple, the package has changed a lot over the past few years and many of the functions have been replaced, rewritten, or deprecated entirely. Creating an up to date documentation with the current package was incredibly difficult (but I have one in our Notion database now!). I did find some cool codebases though!

After constructing my own web3 object, I was able to verify everything was set up correctly (some sketchy testing with the signing functions) until realizing that every wallet is locked to a chain (which makes implementing multi-chain support incredibly difficult). I’m currently talking to the web3swift team to see if there’s a way to implement this that fits our needs - if not, we might need to add BIP 32 support to the open source Argent package (which, while possible, is a significant undertaking).

Besides this, I spent most of my time implementing a series of WalletManager functions to link wallets to tabs, a notification manager for SwiftUI to track to show / hide wallet prompts, and dynamically generated javascript and web3 objects from enum’s based on the current chain. I also implemented a Wallet protocol (so we can have many different kinds of wallets all tracked by wallet manager).

Next Steps

As always, there’s still a lot to be done :)

The big pending next steps for this next sprint are:

As always, more to be done. Back next week with more ✌️