-
Notifications
You must be signed in to change notification settings - Fork 50
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
Allow multiple change outputs #1025
Conversation
0311bc5
to
409e956
Compare
e47f4df
to
d95bebe
Compare
minimalLovelaceAmount: additionalLovelaceAmount, | ||
} | ||
|
||
const outputsWithChange = change ? [...outputs, ...change] : outputs |
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.
empty array is truthy in JS, so I believe this actually always ends up in the left branch, or can the "change" be null? In that case I'd rather be more explicit and check for change != null
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 totally missed this, thanks, will fix 👍
// max token size about 70 bytes, max output size is 4000 => 4000 / 70 ~ 50 | ||
export const MAX_OUTPUT_TOKENS = 50 | ||
|
||
export const MIN_UTXO_VALUE = 1000000 |
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.
Isn't this rather ADA_ONLY_MIN_UTXO_VALUE ?
const totalOutput = outputs.reduce((acc, {coins}) => acc + coins, 0) + deposit | ||
const totalOutputTokens = aggregateTokenBundles(outputs.map(({tokenBundle}) => tokenBundle)) | ||
|
||
// total amount of lovelace that had to be added to token-containing outputs |
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.
perhaps a single bigger multiline comment at the beginning outlining the steps in human language here would help a lot in figuring out what's going on. The one-line comments scattered around the code help to some extent, but it's already too hard to get a bigger picture out of them - could you write such comment @PeterBenc ?
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.
LGTM, I'd just suggest adding a big comment outliningthe steps taken when computing the tx plan
Refactor tx planning - create adaOnly change output
4b566b7
to
1cae13c
Compare
Changes:
Gotcha: