-
Notifications
You must be signed in to change notification settings - Fork 3
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
refactor: isReturn
and total
methods
#106
Conversation
…a' into refactor/confirmed-signed-tx-data
} | ||
} | ||
|
||
return isReturn; |
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.
This change ensures that isReturn
will return true
only when all of the recipients are the same as sender.
|
||
return isReturn; | ||
} | ||
|
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.
The same as above but for the signed transactions.
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.
@shahin-hq I think here we could use the this.isReturn()
from the signed dto in the coins, or do you see any issues?
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.
I tried that before but couldn't because I couldn't find a way to access given wallet in coin class.
return [this.#wallet.address(), this.#wallet.publicKey()].includes(this.sender()); |
@@ -131,11 +148,25 @@ export class ExtendedSignedTransactionData { | |||
} | |||
|
|||
public total(): number { | |||
if (this.isReturn()) { | |||
return this.amount() - this.fee(); | |||
} |
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.
If a transaction is a returning the fee should be subtracted
} | ||
} | ||
} | ||
|
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.
Added total
calculation for multipayment signed transactions. The same as confirmed transaction:
if (this.isMultiPayment()) { |
Closes: https://app.clickup.com/t/86dv3g5de
For testing: ArdentHQ/arkvault#795