Development Update Nov 18th ‘22
Accounts, Assets
Last week we introduced ourselves in our first article (make sure you check it out, if you haven’t already) and today we’re back with an update of what we’ve been up to since then. So let’s get to it.
The codebase of the Linx Wallet is split into several features, eg. accounts, tokens, transfers, etc. Next I’m going to go through the ones that we’ve worked on this week.
Accounts
Linx is a HD Wallet (click here if you want to read more about HD Wallets), in short this means all accounts are generated from a single root key / passphrase. At the moment we only support a single account, but we can easily change that if needed. It’s also worth mentioning from the start that Linx passphrases/accounts are not compatible with Chainweaver or X-Wallet, but rest assured we will provide tutorials for anyone that wants to transfer their assets from other wallets to Linx.
The accounts feature is essentially completed at this point, we went through the 2 main flows of creating a new account and importing an existing account, both are working well.
Assets
The next feature I want to talk about is what we call “assets”. By assets we mean KDA and any other tokens available on the Kadena blockchain that you can own. The main goal of this feature is to allow the user to see the balance and price of each token and use the feature in things like transfers or swaps.
A big difference between Kadena and other blockchains is that there are 20 chains (likely more in the future) instead of just one like most other networks have. At the moment this translates into at least 20 calls to Chainweb API to fetch the balance of your tokens from each chain.
This can get ugly pretty quickly when you imagine 20 chains, 20 tokens and a 1000 users at the same time online, which theoretically would lead to 400.000 network requests to fetch balance for each token. We have optimised this thus far, so this situation would lead to just 20.000 network requests, but overall a proper indexing solution is much needed for Kadena, it would make the life of DApp developers much easier.
For fellow builders out there, here’s a Pact snippet to fetch all tokens from a Kadena chain (make sure to only use this on a local endpoint):
(filter (!= "null")(map (lambda (x) (if (contains "implements fungible-v2" (at 'code (describe-module x))) x "null")) (list-modules)))
In terms of progress, we’re still ironing out a few things on the “Customize” screen where you can toggle the visibility of any token and also writing a few more tests but for the most part this feature is also covered.
What’s Next
The plan for next week is to finish what we’ve got left on “assets” and move on to “transfers” and “networks”. We’ve got some work done on both already so we’re excited to see those features coming together.
Don’t forget to follow us on Twitter and Medium.
Stay safe and keep building!