Skip to content
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

feat: Added support for memo #140

Merged
merged 6 commits into from
Apr 12, 2021
Merged

feat: Added support for memo #140

merged 6 commits into from
Apr 12, 2021

Conversation

AbhayAysola
Copy link
Contributor

Closes #88
Account Number: 8928526805de48e4bf2ed2a9b4b839e6b2603018ecdfbf4cffdb2065e01a3ed1

@AbhayAysola
Copy link
Contributor Author

@zinoadidi This should work as far as I know, but since I can't test it anywhere it might not work as expected.

@zinoadidi
Copy link
Contributor

will you update when you manage to test it;
also, tests should be updated as well to reflect possibility with memo
and docs
and I saw some places where 'empty string' was used instead of STRING type didn't pay much attention but could be something to check in code

@AbhayAysola
Copy link
Contributor Author

will you update when you manage to test it;
also, tests should be updated as well to reflect possibility with memo
and docs
and I saw some places where 'empty string' was used instead of STRING type didn't pay much attention but could be something to check in code

Sure, I will update docs and tests when I can confirm that it works.
The empty string is done on purpose since memo isn't mandatory.

@zinoadidi
Copy link
Contributor

zinoadidi commented Apr 11, 2021

ok cool;
Maybe something to check, I remember with TS it doesn't include the field if its not set
as I read in the discord chat, bucky says its possible to omit the field from request if user doesn't provide it.

Its just a theory, we can check it

@AbhayAysola
Copy link
Contributor Author

Yeah that shouldn't be an issue we can test it when the banks are up.

@tomijaga
Copy link
Contributor

tomijaga commented Apr 11, 2021

Hey @AbhayAysola there is already a PR on the account manager for the memo.
I think you can use this to implement the memo here since it was made by the core team

@tomijaga
Copy link
Contributor

Here's the PR thenewboston-blockchain/Account-Manager#615

@AbhayAysola
Copy link
Contributor Author

AbhayAysola commented Apr 11, 2021

Here's the PR thenewboston-developers/Account-Manager#615

Yep I used that

@tomijaga
Copy link
Contributor

tomijaga commented Apr 11, 2021

@AbhayAysola Okay so all that's left is:

  • check that the memo only has alphanumeric characters by using the
    same regex expression as in the PR: /^[a-zA-Z0-9_ ]*$/

  • Remove leading spaces using the .trim() method

  • And if memo is empty just remove it from the transaction object

Do all of these in the createTransaction() method in the PaymentHandler class

This is the last thing needed for the migration to the account manager. I could make the updates on your branch if you want

@AbhayAysola
Copy link
Contributor Author

@AbhayAysola Okay so all that's left is:

  • check that the memo only has alphanumeric characters by using the
    same regex expression as in the PR: /^[a-zA-Z0-9_ ]*$/
  • Remove leading spaces using the .trim() method
  • And if memo is empty just remove it from the transaction object

Do all of these in the createTransaction() method in the PaymentHandler class

This is the last thing needed for the migration to the account manager. I could make the updates on your branch if you want

I added those in

@tomijaga
Copy link
Contributor

@AbhayAysola Nice!
@zinoadidi We can merge this in now and create new tasks for test and docs

@AbhayAysola
Copy link
Contributor Author

I tested it and made some changes @zinoadidi @tomijaga

Should I update tests and docs in this PR or will it be in another task?

@zinoadidi
Copy link
Contributor

@AbhayAysola you can go ahead and update test and docs as well; mention me when its ready and we can have this feature released as well;

Good job!

@AbhayAysola
Copy link
Contributor Author

@zinoadidi I updated the docs but there wasn't anything to change in the tests since it is just an addition of a field.

@zinoadidi
Copy link
Contributor

zinoadidi commented Apr 12, 2021

@AbhayAysola seen.
I do think the field should be reflected in the tests and transaction that don't meet the requirements should be included in test / updated to work with and reject memo as well
Else it will be possible to remove the field unknowingly in future and the tests will not catch it

@AbhayAysola
Copy link
Contributor Author

@AbhayAysola seen.
I do think the field should be reflected in the tests and transaction that don't meet the requirements should be included in test / updated to work with and reject memo as well
Else it will be possible to remote the field unknowingly in future and the tests will not catch it

Hmm I guess you're right. I'll add that in

src/payment-handler.ts Outdated Show resolved Hide resolved
@zinoadidi zinoadidi changed the title Add memo feat: Added support for memo Apr 12, 2021
@zinoadidi zinoadidi merged commit ad5ed54 into thenewboston-blockchain:development Apr 12, 2021
@zinoadidi zinoadidi linked an issue Apr 12, 2021 that may be closed by this pull request
@zinoadidi
Copy link
Contributor

@AbhayAysola confirm your account number

@AbhayAysola
Copy link
Contributor Author

@AbhayAysola confirm your account number

8928526805de48e4bf2ed2a9b4b839e6b2603018ecdfbf4cffdb2065e01a3ed1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Implement support for Memo in transactions
3 participants