Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Add data field option to type 0 transaction creator - Closes#606 #632

Conversation

ishantiw
Copy link
Contributor

Description

There was no flag to take data field for 0 type transaction when creating one. Now it has been added as an option using -d flag.

const processInputs = (amount, address) => ({ passphrase, secondPassphrase }) =>
const dataFlag = {
char: 'd',
description: `Specifies the data for the transaction type 0. Takes a string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think description can be improved.
Message of UTF-8 string to attach, which has a maximum length of 64 bytes
@mitsujutsu what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I checked on Lisk Documentation and its the same so modified it

@@ -121,6 +121,11 @@ ARGUMENTS
ADDRESS Address of the recipient.

OPTIONS
-d, --data=data
Specifies the data for the transaction type 0. Takes a string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be changed based on the flag description

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

'transaction:create:transfer',
defaultAmount,
defaultAddress,
'--data=XXXXXX',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer realistic string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

);
});
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should add a case for invalid data too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we discussed, we don't need it

const processInputs = (amount, address) => ({ passphrase, secondPassphrase }) =>
const dataFlag = {
char: 'd',
description: `Message of UTF-8 string to attach, which has a maximum length of 64 bytes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this sentence doesn't make much sense...
@mitsujutsu can help with the better english i think

Copy link
Contributor Author

@ishantiw ishantiw Oct 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I thought you wanted to use this sentence only 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Optional UTF8 encoded data (maximum of 64 bytes) to include in the transaction asset."

Copy link
Contributor

@mitsuaki-u mitsuaki-u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo

const processInputs = (amount, address) => ({ passphrase, secondPassphrase }) =>
const dataFlag = {
char: 'd',
description: `Message of UTF-8 string to attach, which has a maximum length of 64 bytes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Optional UTF8 encoded data (maximum of 64 bytes) to include in the transaction asset."

@@ -81,7 +81,35 @@ describe('transaction:create:transfer', () => {
describe('transaction:create:transfer amount address', () => {
setupTest()
.command(['transaction:create:transfer', defaultAmount, defaultAddress])
.it('should create an tranfer transaction', () => {
.it('should create a tranfer transaction', () => {
expect(transactionUtilStub.validateAddress).to.be.calledWithExactly(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"tranfer" --> "transfer"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, good catch, these were old test and these wrong articles caught my eye but I missed out this one 😅

defaultAddress,
'--data=Testing lisk transaction data.',
])
.it('should create a tranfer transaction', () => {
expect(transactionUtilStub.validateAddress).to.be.calledWithExactly(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -109,7 +137,7 @@ describe('transaction:create:transfer', () => {
defaultAddress,
'--no-signature',
])
.it('should create an tranfer transaction without signature', () => {
.it('should create a tranfer transaction without signature', () => {
expect(transactionUtilStub.validateAddress).to.be.calledWithExactly(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -131,7 +159,7 @@ describe('transaction:create:transfer', () => {
defaultAddress,
'--passphrase=pass:123',
])
.it('should create an tranfer transaction', () => {
.it('should create a tranfer transaction', () => {
expect(transactionUtilStub.validateAddress).to.be.calledWithExactly(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@@ -160,7 +188,7 @@ describe('transaction:create:transfer', () => {
'--passphrase=pass:123',
'--second-passphrase=pass:456',
])
.it('should create an tranfer transaction', () => {
.it('should create a tranfer transaction', () => {
expect(transactionUtilStub.validateAddress).to.be.calledWithExactly(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@ishantiw
Copy link
Contributor Author

@shuse2 @mitsujutsu I've made changes corresponding to your review. Please review again.

Copy link
Contributor

@shuse2 shuse2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think typos are not fixed yet =0
tranfer => transfer

@shuse2
Copy link
Contributor

shuse2 commented Oct 23, 2018

Closing since it's already merged

@shuse2 shuse2 closed this Oct 23, 2018
@shuse2 shuse2 deleted the 606-add-data-field-option-to-type-0-transaction-creator branch October 23, 2018 08:03
shuse2 added a commit that referenced this pull request Nov 1, 2018
…-0-transaction-creator

Add data field option to type 0 transaction creator - Closes#606
@shuse2 shuse2 removed this from the Version 2.1.0 milestone Nov 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants