diff --git a/README.md b/README.md index c0e31ba..262d696 100644 --- a/README.md +++ b/README.md @@ -6,44 +6,53 @@ A Graphical User Interface (GUI) for ## Roadmap ### Stage 1 - - [x] Initial Project Setup - - [x] Implementation of `DashHd` & `DashPhrase` modules - - [x] To generate a new wallet - - [x] To restore an existing wallet via recovery phrase - - [ ] Add Usage Controls - - [ ] Request Funds - - [DashWallet.js#walletfindchangewalletfriendopts](https://github.com/dashhive/DashWallet.js#walletfindchangewalletfriendopts) - - [ ] Send Funds - - [DashWallet.js#walletfindfriendfriendopts](https://github.com/dashhive/DashWallet.js#walletfindfriendfriendopts) - - [ ] [Share Pairing Contact Info](https://github.com/dashhive/DashWallet.js#walletbefriendfrienddetails) - - [ ] Add a Contact - - [ ] Display List of Contacts - - [ ] Send - - [ ] Request - - [ ] Edit - - [ ] Remove - - [ ] Backup Wallet & Contacts - - [ ] Encrypt wallet data in local storage - - [x] Reocvery Phrase - - [ ] Contact Data +- [x] Initial Project Setup +- [x] Implementation of `DashHd` & `DashPhrase` modules + - [x] To generate a new wallet + - [x] To restore an existing wallet via recovery phrase +- [ ] Add Usage Controls + - [x] Share Pairing Contact Info + - Dash URI + - [DIP: aj-contact-scanback](https://github.com/dashhive/DIPs/blob/aj-contact-scanback/aj-contact-scanback.md#1-contact-exchange) + - ``` + dash://?xpub=xpub6FKUF6P1ULrfvSrhA9DKSS3MA3digsd27MSTMjBxCczsfYz7vcFLnbQwjP9CsAfEJsnD4UwtbU43iZaibv4vnzQNZmQAVcufN4r3pva8kTz + &sub=01H5KG2NGES5RVMA85YB3M6G0G + &nickname=Prime%208 + &profile=https://imgur.com/gallery/y6sSvCr.json + &picture=https://i.imgur.com/y6sSvCr.jpeg + &scope=sub,nickname,profile,xpub + &redirect_uri=https:// + ``` + - QR Code (uses the Dash URI from above) + - [x] Add a Contact + - [ ] Request Funds + - [ ] Send Funds +- [ ] Contacts + - [x] List + - [ ] Edit + - [ ] Remove +- [ ] Backup Wallet & Contacts +- [ ] Encrypt wallet data in local storage + - [x] Recovery Phrase + - [ ] Contact Data ### Stage 2 - [ ] Transactions view - - [ ] Table with filter/sort - - [ ] Select & Copy as CSV + - [ ] Table with filter/sort + - [ ] Select & Copy as CSV - [ ] Display Wallet balance in desired fiat currency - [ ] Settings - - [ ] Select Wallet (multiple accounts) - - [ ] Set Alias for selected wallet - - [ ] Preferred fiat Currency - - USD - - GBP - - EUR - - etc + - [ ] Select Wallet (multiple accounts) + - [ ] Set Alias for selected wallet + - [ ] Preferred fiat Currency + - USD + - GBP + - EUR + - etc - [ ] Contact/Payment Share Features - - [ ] SMS - - [ ] Email - - [ ] QR Image + - [ ] SMS + - [ ] Email + - [ ] QR Image - [ ] Set Fund Denomination for Send & Request payments ### Stage 3 @@ -51,13 +60,13 @@ A Graphical User Interface (GUI) for - [ ] View & manage addresses associated with Wallet - [ ] Add side-by-side view for contacts to display the XPubs that represent both you & the contact in the connection - [ ] Gift card integration - - [ ] DashDirect - - [ ] BitRefill + - [ ] DashDirect + - [ ] BitRefill ### Stage 4 - [ ] Savings account (Investing) Integration - - [ ] CrowdNode - - [ ] THORChain / Maya + - [ ] CrowdNode + - [ ] THORChain / Maya - [ ] Subscriptions - [ ] If possible, automate `befriend` process with blockchain messaging. diff --git a/src/main.js b/src/main.js index f5f5721..5c0389f 100644 --- a/src/main.js +++ b/src/main.js @@ -149,14 +149,18 @@ let contactsList = await setupContactsList( // shareAccount.id, shareAccount.xkeyId, { - request: { - accountIndex, - xprv: shareAccount.xprv, - xpub: shareAccount.xpub, - id: shareAccount.id, - xkeyId: shareAccount.xkeyId, - addressKeyId: shareAccount.addressKeyId, - address: shareAccount.address, + incoming: { + // ...(state.contact.incoming || {}), + [`${appState.selectedWallet}/${shareAccount.xkeyId}`]: { + accountIndex, + addressIndex: shareAccount.addressIndex, + xprv: shareAccount.xprv, + xpub: shareAccount.xpub, + id: shareAccount.id, + xkeyId: shareAccount.xkeyId, + addressKeyId: shareAccount.addressKeyId, + address: shareAccount.address, + }, }, } ) @@ -652,7 +656,9 @@ let sendOrRequest = setupDialog( name="to" placeholder="enter @alias or dash address" spellcheck="false" + list="contactAliases" /> + + + + ${ + (state.contacts || []).map(contact => { + return html`` + }) + } + ${inputAmount.renderAsHTML()} @@ -733,6 +747,74 @@ let sendOrRequest = setupDialog( return; } + if (String(fde.to).startsWith('@')) { + let cAlias = String(fde.to).substring(1) + let contact = state.contacts.find(c => c.alias === cAlias) + let inWallet = Object.values(contact?.incoming)?.[0] + let outWallet = Object.values(contact?.outgoing)?.[0] + + if (fde.intent === 'send') { + let { + xkeyId, + addressKeyId, + addressIndex, + address: addr, + } = await deriveWalletData( + outWallet?.xpub, + 0, + outWallet?.addressIndex + 1, + ) + + console.log( + `${fde.intent} TO CONTACT`, + contact, + { + xkeyId: outWallet?.xkeyId, + addressKeyId: outWallet?.addressKeyId, + addressIndex: outWallet?.addressIndex, + address: outWallet?.address, + }, + { + xkeyId, + addressKeyId, + addressIndex, + address: addr, + }, + ) + } + if (fde.intent === 'request') { + let { + xkeyId, + addressKeyId, + addressIndex, + address: addr, + } = await deriveWalletData( + inWallet?.xpub, + 0, + inWallet?.addressIndex + 1, + ) + + console.log( + `${fde.intent} TO CONTACT`, + contact, + { + xkeyId: inWallet?.xkeyId, + addressKeyId: inWallet?.addressKeyId, + addressIndex: inWallet?.addressIndex, + address: inWallet?.address, + }, + { + xkeyId, + addressKeyId, + addressIndex, + address: addr, + }, + ) + } + + return; + } + sendOrRequest.close(fde.intent) }, }, @@ -839,7 +921,10 @@ async function main() { event.preventDefault() event.stopPropagation() - sendOrRequest.render() + sendOrRequest.render({ + userInfo, + contacts: appState.contacts + }) sendOrRequest.showModal() // .catch(console.error) } @@ -1020,7 +1105,7 @@ async function main() { if (res) { appState.contacts = res - return contactsList.render({ + contactsList.render({ contacts: res?.sort(sortContactsByAlias), userInfo, }) diff --git a/src/rigs/add-contact.js b/src/rigs/add-contact.js index 82c9506..b20aa4c 100644 --- a/src/rigs/add-contact.js +++ b/src/rigs/add-contact.js @@ -280,12 +280,13 @@ export let addContactRig = (function (globals) { ...(state.contact.info || {}), ...info, }, - wallets: { - ...(state.contact.wallets || {}), + outgoing: { + ...(state.contact.outgoing || {}), [xkeyId]: { addressIndex, addressKeyId, address: address || addr, + xkeyId, xprv, xpub, }, @@ -362,11 +363,11 @@ export let addContactRig = (function (globals) { } }, handleRender: state => { - console.log( - '+contact app state & wallets', - appState, - state, - ) + // console.log( + // '+contact app state & wallets', + // appState, + // state, + // ) }, handleSubmit: state => async event => { event.preventDefault() diff --git a/src/rigs/edit-profile.js b/src/rigs/edit-profile.js index bd8aeaa..b477a58 100644 --- a/src/rigs/edit-profile.js +++ b/src/rigs/edit-profile.js @@ -103,10 +103,10 @@ export let editProfileRig = (function (globals) { fields: html``, events: { handleRender: state => { - console.log( - 'edit profile render', - state.userInfo, - ) + // console.log( + // 'edit profile render', + // state.userInfo, + // ) }, handleSubmit: state => async event => { event.preventDefault() diff --git a/src/styles/dialog.css b/src/styles/dialog.css index 9b709ce..cd09605 100644 --- a/src/styles/dialog.css +++ b/src/styles/dialog.css @@ -248,6 +248,10 @@ dialog.responsive fieldset section article { dialog.responsive button[type="submit"] { flex: 1 1 auto; } +dialog.responsive footer button[type="reset"], +dialog.responsive footer button[type="submit"] { + flex: 1 1 50%; +} /* dialog.responsive button[type="reset"] { position: absolute; top: 0; @@ -260,10 +264,6 @@ dialog.responsive button[type="submit"] { padding: 1rem; line-height: 1; } -dialog.responsive footer button[type="reset"], -dialog.responsive footer button[type="submit"] { - flex: 1 1 50%; -} dialog.responsive button[type="reset"]:focus { outline: 0; }