-
Notifications
You must be signed in to change notification settings - Fork 4
feat: websocket wallet auth #87
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* feat: basic service working * feat: handle timelock * refactor: removed useless extra parameters on updateWalletTablesWithTx * refactor: replaced getTxLockedInputs to getLockedUtxoFromInputs * refactor: removed useless extra parameters on updateAddressTablesWithTx * refactor: idented sql queries to improve legibility * refactor: indent sql queries on tests/utils * fix: removed locked from txinput * style: formatted sql in db and tests/utils * refactor: renamed info table to metadata * refactor: using 1 and 0 instead of TRUE and FALSE * docs: added missing docstring for updateBalances * refactor: addToWalletBalanceTable and addToAddressTable to use types Co-authored-by: André Abadesso <[email protected]>
* feat: handle authorities * fix: update without WHERE on updateTimeLocks * feat: handle authorities * fix: typos preventing tests from running * fix: broken test after rebasing * style: passing eslint * chore: added missing tables and columns to database.md * refactor: using TOKEN_AUTHORITY_MASK from lib and using isAuthority from utils * refactor: using lib constants for mint and melt * docs: limited name and symbol sizes on database design * chore: ignoring .env * chore: removed now pointless eslint ignore comment * chore: removed wrong info on comment * fix: wrong insert signature * refactor: using new signature for addToAddressTable * chore: reading port from env * docs: added a comment to explain authority refresh in updateWalletTablesWithTx * docs: added acomment explaining how unlocked_authorities work * refactor: using toUnsignedInteger instead of Math.abs(toInteger) * docs: added comment to explain IEEE_754 on toNegative * refactor: addToTokenTable to use types * fix: invalid token symbol breaking tests * feat: avoiding multiplication on useless cases Signed-off-by: André Abadesso <[email protected]> * docs: updated DATABASE.md to resolve TODO Co-authored-by: André Abadesso <[email protected]>
* chore: added missing tables and columns to database.md * docs: limited name and symbol sizes on database design * refactor: moved common methods to a commons.ts file
* chore: added missing tables and columns to database.md * docs: limited name and symbol sizes on database design * feat: tx proposal * feat: send the transaction using hathor-wallet-lib and test * feat: input signatures should be deseriaalized from base64 in txProposalSend * feat: added custom storage to hathorLib * feat: handling failure using wallet-lib pushTx api * fix: invalid enum type in tx_proposal_status * feat: added multiple tests for txProposalSend * feat: added api response type * chore: fix eslint to pass ci build * chore: updated output length TODOs to issue #8 * feat: validating output addresses and using valid addresses (with mock) on tests * fix: added missing token table to database.md * chore: cleanup * feat: added DELETE tx_proposal api * feat: validating txsend params using Joi * feat: validating tx weight and querying it from the full-node * feat: querying constants from full-node and storing it on database to prevent the lambda from querying the full node on every request * fix: closing mysql connection after success on send * feat: not deleting already sent transactions on destroy * feat: validating txProposalCreate params with joi * feat: getting server from env, fallbacking to wallet default * fix: wrong wallet fn and invokation name * fix: timestamp should be validated as number instead of date * chore: added truncate script to cleanup tables * chore: removed useless blank line breaking ci * chore: rebased with dev and fixed broken tests * chore: merged packages with dev * refactor: INVALID_SELECTION_ALGO -> INVALID_SELECTION_ALGORITHM * fix: production MAX_GAP example env file should be 20 * chore: updated todo with PR link * refactor: wrong if format * chore: solved TODO with outputs limit from lib * refactor: using Number.isInteger to check if inputs and outputs value and timelock is a number * refactor: formatted query in db.ts * refactor: removed unused getAddresses method * docs: updated docstring for txProposalDestroy * feat: validating nonce to be an integer * chore: removed truncate.sql * docs: typo on txProposalCreate * docs: added docstring explaining why we should shuffle the array * chore: added missing tables to DATABASE.md * feat: checking if utxos sent by the user are already used * feat: returning full errors array instead of only the first * refactor: expecting an array of objects on inputs and outputs instead of array of arrays (#29) * feat: joi validating inputs as object array * refactor: expecting array of objects on inputs and outputs instead of array of arrays * feat: handling invalid values for outputs on txProposalCreate * docs: added comment explaining validation parameters * refactor: status codes and error wrapper (#27) * refactor: wrapped error messages in a common method and refactored status codes to not use 200 on errors * fix: removed unused error messages and status codes for it * feat: added params validation to missing routes (#30) * feat: validating wallet, balances, addresses and txhistory params with joi * fix: removed unnecessary required attribute to Joi validation on some apis * docs: added a comment suggesting a future improvement on wallet balances * feat: making sure version_data table has only one row and added tests to it * docs: added missing header on commons file * chore: removed .env.* from git
* feat: add addressPath in the tx-proposal return * tests: add tests for new db method * chore: remove duplicated table in DATABASES file and add open files to gitignore * docs: improve docstring of new method
* feat: returning token list on txProposalCreate * fix: returning only output tokens
* feat: returning token list on txProposalCreate * fix: returning only output tokens
#47) * feat: getAddresses method from the lib now expects changeDerivation as parameter * feat: derive xpub to change path before using it to getAddresses * chore: improve comments and fix lint errors * chore: bump hathor wallet lib version
…t select the inputs (#56)
) * feat: add validation for wallet start to check first wallet address * feat: using new deriveChild method from lib * feat: validate first address is now optional and depends on the env * feat: if CONFIRM_FIRST_ADDRESS is true, firstAddress is required in payload * feat: setting firstAddress validation in the joi schema * refactor: improving code cleaness
…62) * fix: added a 'blacklist' of transactions including the genesis txs * docs: improved comment to explain that genesis txs and pre-mined coins should already be in the database * chore: added initial script to add the genesis block and its utxo
* feature: real time client notifications * refactor: typing and organization * tests: redis functions refactor: redis connection management and organization * chores: managing connections * chore: add websocket to README * refactor: responding to review requests, cleaning code * refactor: changes to calls, cleanup and use sqs * refactor: cleanup * fix: send sqs * refactor: use .promise() when calling aws-sdk in async context * chore: cleanup * chore: add todo for join wallet auth
* feat: added spent_by on utxo table * feat: added method to get block by height * feat: added method to add transaction to database on every new tx received * feat: setting spent_by instead of removing the utxos * feat: added an api to return the latest block on the wallet-service * tests: using spent_by on removeUtxos tests * feat: added the latest block api to serverless.yml * feat: using the new removeUtxos signature on addNewTx * feat: added method to search for the latest valid block on our database * feat: handle reorg algorithm * feat: added methods to unspend and delete utxos * chore: typed fullnode api as any * feat: methods to handle reorg and detect the latest valid block (this should be rebased) * chore: passing tslint (this should be rebased) * chore: added reorg and detect latest valid block to serverless.yml * fix: replaced confirmed_at_height with height on transaction * feat: handling balance re-calculation after the re-org * feat: ignoring tx if we already have it on our database (updating its height) * feat: filtering spent 'utxos' from queries * chore: db.ts passing eslint * refactor: renamed Utxo to DbTxOutput * refactor: renamed utxo table to tx_outputs as it will now save every tx_output * refactor: removed maybeUpdateLatestHeight as it is no longer needed because of the blocks database * refactor: utxo to txOutput on database table name * tests: passing tests * chore: passing es and tslint * feat: changed utxo to tx_output on DATABASE * chore: removed debug logs * docs: added docstrings to db.ts methods * refactor: setting 'dirty' to true instead of deleting tx_outputs * refactor: setting dirty = true on address_tx_history and wallet_tx_history instead of deleting * tests: added test for checkBlockForVoided * tests: added tests for fetchAddressBalance and fetchAddressTxHistorySum * fix: balance recalculation was counting transaction count wrong * fix: summing locked transactions on address_balances * fix: was setting dirty to FALSE * tests: increase coverage on db.ts * chore: npm audit fix * docs: added missing docstring to handleReorg * feat: improved logging on reorg method * docs: added missing docstring to src/fullnode * refactor: renamed addTx to addOrUpdateTx and added a updateTx method * docs: added docstring to methods in txProcessor * docs: added comment explaining that a tx_output might point to a block * refactor: using (tx_id, index) on unspend utxos * fix: reorg algorithm were not considering the txs that the dirty txs were spending * refactor: removed useless comment * refactor: rename removeUtxos to updateTxOutputSpentBy * style: added null as possible response resolve on getBlockByHeight * docs: fixed typo * refactor: renamed checkBlockForVoided to isTxVoided * refactor: setting transactions as voided and renamed deleteTx to markTxAsVoided * refactor: using voided instead of dirty and improved method names * refactor: de-duping txOutputs ids * fix: prevent findTransactionsById from searching an empty list of txs * refactor: using instead of * refactor: moved the reorg method responsible for balance recalc. to another method * fix: returning an error status code on reorg fail * refactor: using the transactions table to handle blocks (#76) * refactor: using transactions table with version instead of a dedicated blocks table * refactor: not adding to blocks table on onNewTx * refactor: removed blocks table from DATABASE.md * feat: added hash index on transaction.version * docs: added comment explaining height on transaction table * refactor: BLOCK_VERSION is now a constant and re-used on methods * docs: replaced utxo for tx_output on txProcessor * chore: solve conflicts on rebase with dev
* fix: returning correct status code on txprocessor error * refactor: catching only addNewTx errors
…ing serverless.yml (#78) * chore: creating a sqs queue and required iam role for wsTxNotifyNew * chore: removed AWS_REGION from serverless.yml * chore: added missing stage to sqs queue
* feature: api auth
* feat: handleVoided on commons * feat: added handleVoidedTx to txProcessor * fix: added missing import * tests: fixed broken tests * feat: logging affected addresses on handle voided * docs: fixed wrong docstring on handlevoided * tests: improved tests to include a transaction that is voided because of the inputs
5866ae2
to
783f624
Compare
fix: treat exceptions from jsonwebtoken
fix: generate policy for all public paths
783f624
to
40b8201
Compare
* chore: changes to serverless.yml needed while deploying and testing the Lambdas * chore: change memorySzize for onNewTxRequest * refactor: some adjustments in serverless config * Add explanatory comments * Add timeout in authTokenApi
luislhl
reviewed
Jul 15, 2021
luislhl
reviewed
Jul 15, 2021
luislhl
reviewed
Jul 15, 2021
luislhl
reviewed
Jul 15, 2021
luislhl
reviewed
Jul 15, 2021
luislhl
reviewed
Jul 15, 2021
* feat: create new API to return addresses to use of a wallet * chore: fix typo * refactor: renaming addressesToUse to newAddresses and added addressPath on its return * feat: add wallet ID authorizer proxy handler on the new API and fix docs return * refactor: change api docs to a json file and fix linter errors * tests: add addressPath to newAddresses API test * feat: get wallet gap limit and limit the new addresses to this value * fix: typo on var name * tests: fix tests for new authorization proxy
* feat: models and migrations * fix: metadata key lenght * feat: seeders for mainnet and testnet * feat: .sequelizerc for dynamic configs * chore: remove metadata table * feat: models and migrations * ci: add pr-validation pipeline * Add docker-compose to facilitate running a local mysql server * ci: add missing env vars * ci: use mainnet as network, since the tests expect that * ci: fix env vars * chore: decreased threshold for jest tests * chore: updated jest * tests: increased timeout for handle reorg test * Add redis in docker-compose.yml Co-authored-by: André Carneiro <[email protected]> Co-authored-by: André Abadesso <[email protected]>
luislhl
previously approved these changes
Jul 16, 2021
* chore: added indexes for tx_output and transaction tables * feat: added indexes to transaction and tx_output models
andreabadesso
requested changes
Jul 19, 2021
…-wallet-service into feat/real-time-auth
andreabadesso
approved these changes
Jul 20, 2021
We discovered some problems that need to be resolved
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The design is available in HathorNetwork/hathor-wallet-service#84