-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEP-6 wallet support #444
NEP-6 wallet support #444
Conversation
Per this issue: I upgraded electron-builder and now the build works. |
app/containers/Settings/Settings.jsx
Outdated
storage.set('keys', data) | ||
setKeys(data) | ||
storage.get('userWallet', (error, data) => { | ||
data.accounts.map((account, index) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do some error handling here?
if (error) { ... } else { delete wallet account }
Also can we use something like:
const keys = reject(data.accounts, { key });
Also, why do we need to check the label when deleting? isn't a key is unique?
@@ -29,31 +35,183 @@ describe('generateWallet module tests', () => { | |||
|
|||
describe('newWallet tests', () => { | |||
const payload = account | |||
const expectedAction = Object.assign({}, { payload }, { type: NEW_WALLET }) | |||
const expectedAction = Object.assign({}, { payload }, { type: NEW_WALLET_ACCOUNT }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an Object.assign here?
Can it be -
const expectedAction = { payload, type: NEW_WALLET_ACCOUNT }
app/modules/generateWallet.js
Outdated
} | ||
} | ||
|
||
export const createEmptyWallet = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this -
export const createEmptyWallet = ({
...DEFAULT_WALLET,
scrypt: DEFAULT_SCRYPT
})
app/modules/generateWallet.js
Outdated
export const walletHasKey = (wallet, key) => { | ||
let foundKey = false | ||
|
||
each(wallet.accounts, (account) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use .some - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
wallet.accounts.some((account) => account.key === key)
What current issue(s) from Trello/Github does this address?
#421
What problem does this PR solve?
All projects should follow the NEP-6 wallet standard so they can share wallets
How did you solve this problem?
Some notes:
I leave the keys.json storage file behind, just in case.
When we upgrade the wallets we only have labels and encrypted keys. This means that we can’t fill in the address fields until they log into the accounts.
I first tried to use neon-js which was pretty cool but it throws an exception if you try to export an Account without an address. It wasn’t too much work to do it all custom in the end.
Try to use naming inline with the NEP-6 standard (wallets contain accounts, in settings you add accounts not keys)
How did you make sure your solution works?
Automated + manual tests
QA Tests worth doing (any others?)
Are there any special changes in the code that we should be aware of?
No.
Is there anything else we should know?
Having wallet accounts without public addresses could pose a challenge if other programs the user is importing into don't support that. There's not really anything we can do though.