-
Notifications
You must be signed in to change notification settings - Fork 40
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
Update TransactionOnNetwork to follow specs #555
Update TransactionOnNetwork to follow specs #555
Conversation
src/transactionOnNetwork.ts
Outdated
result.logs = TransactionLogs.fromHttpResponse(response.logs || {}); | ||
// result.raw = response; |
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.
Commented out?
src/transactionWatcher.ts
Outdated
throw new ErrIsCompletedFieldIsMissingOnTransaction(); | ||
} | ||
return transactionOnNetwork.isCompleted; | ||
return transactionOnNetwork.status.isExecuted(); |
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.
Is this correct (execution vs. completion)?
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.
Oh, yes, since it's the process status.
src/transactionOnNetwork.ts
Outdated
function: string = ""; | ||
data: Buffer = Buffer.from([]); | ||
version: number = 0; | ||
options: number = 0; | ||
signature: string = ""; |
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.
in specs the signature is of type bytes
.
miniblockHash: string = ""; | ||
blockHash: string = ""; |
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.
these are also of type bytes
in the specs.
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.
for the extra work to display this in js we will let them string because the hash is usually display
/** | ||
* Returns whether the transaction has been conpleted (not necessarily with success). | ||
*/ | ||
isCompleted(): boolean { | ||
return this.isSuccessful() || this.isFailed() || this.isInvalid(); | ||
} | ||
|
||
/** | ||
* Returns whether the transaction has been executed successfully. | ||
*/ | ||
isSuccessful(): boolean { | ||
return ( | ||
this.status == "executed" || | ||
this.status == "success" || | ||
this.status == "successful" | ||
); | ||
return this.status == "executed" || this.status == "success" || this.status == "successful"; |
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.
Maybe also add the boolean members as well?
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.
done
src/transactionOnNetwork.ts
Outdated
@@ -50,7 +50,7 @@ export class TransactionOnNetwork { | |||
data: Buffer = Buffer.from([]); | |||
version: number = 0; | |||
options: number = 0; | |||
signature: string = ""; | |||
signature?: Uint8Array; |
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.
Should not be optional and you can set the default value to an empty Uint8Array.
No description provided.