hypha-dao / hashed-wallet

Hashed Wallet
MIT License
3 stars 3 forks source link

Feature/get active recoveries #123

Closed n13 closed 2 years ago

n13 commented 2 years ago

🗃 Github Issue Or Explanation for this PR. (What is it supposed to do and Why is needed)

Implemented get active recoveries init recovery claim vouch

refactored send, removing more of the old polkawallet code

✅ Checklist

🕵️‍♂️ Notes for Code Reviewer

I added a new function to the JS code - the ability to specify a transformer, that takes the result and transforms it in JavaScript.

We need this here to access the polkadot JS "toHuman" and "toJSON" functions to format the result into a proper object we can use.

The 'activeRecoveries' query returns an object with a key - the key is the combination of the two keys, the rescuer and the lost account. The polkadot JS function "toHuman" splits this key into rescuer and lostAccount.

Our transformer unpacks the key, and adds lostAccount and rescuer as values. Trivial to do in JS.

We also convert the "value" to JSON so we get a proper json object, rather than a String with encoded JSON.

Note that this JavaScript runs in browser and so it doesn't have 'await' - it needs to run as a promise with .then(...)...

🙈 Screenshots

👯‍♀️ Paired with