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

Contract creation #216

Merged
merged 6 commits into from
Mar 12, 2018
Merged

Contract creation #216

merged 6 commits into from
Mar 12, 2018

Conversation

kolya182
Copy link
Contributor

No description provided.

@@ -58,7 +58,7 @@ export interface ITransaction {
blockHash: string | null,
blockNumber: number,
from: string,
gas: string,
gas: number,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this changes return value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initial gas type was defined wrong. It does not return value, it used as an interface.

const from = String(transaction.from).toLowerCase();
const to = String(transaction.to).toLowerCase();
const to: string = transaction.to === null ? "" : String(transaction.to).toLowerCase();
const addresses: string[] = to ? [from, to] : [from];
Copy link
Contributor

Choose a reason for hiding this comment

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

if to == null, then contract should exist and you need to save contract address

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not at this point, later in the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

let's do it now, that's the whole point of this change

const from = String(transaction.from).toLowerCase();
const to = String(transaction.to).toLowerCase();
const to: string = transaction.to === null ? "" : String(transaction.to).toLowerCase();
const addresses: string[] = to ? [from, to] : [from];
Copy link
Contributor

Choose a reason for hiding this comment

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

can you do flatMap instead? [from, to].flatMap() - it will remove null

@kolya182 kolya182 merged commit b292890 into master Mar 12, 2018
@kolya182 kolya182 deleted the contract-creation branch March 12, 2018 18:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants