Skip to content

Commit

Permalink
fix: splitChange not considering mints
Browse files Browse the repository at this point in the history
  • Loading branch information
joacohoyos committed Jan 10, 2024
1 parent 4faabf3 commit 821526c
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 336 deletions.
2 changes: 1 addition & 1 deletion dist/esm/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
"name": "@jpg-store/lucid-cardano",
"version": "0.11.1",
"version": "0.11.2",
"license": "MIT",
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
"repository": "https://github.com/jpg-store/lucid",
Expand Down
10 changes: 9 additions & 1 deletion dist/esm/src/lucid/tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,17 @@ export class Tx {
async splitChange() {
const { coinsPerUtxoByte } = await this.lucid.protocolParameters;
const { changeNativeAssetChunkSize, changeMinUtxo } = this.configuration;
const change = this.txBuilder
const positiveMintAssets = this.txBuilder.mint()?.as_positive_multiasset();
const mintValue = positiveMintAssets && C.Value.new_from_assets(positiveMintAssets);
const negativeMintAssets = this.txBuilder.mint()?.as_negative_multiasset();
const burnValue = negativeMintAssets && C.Value.new_from_assets(negativeMintAssets);
let change = this.txBuilder
.get_explicit_input()
.checked_sub(this.txBuilder.get_explicit_output());
if (mintValue)
change = change.checked_add(mintValue);
if (burnValue)
change = change.checked_sub(burnValue);
let changeAda = change.coin();
let changeAssets = valueToAssets(change);
const changeAssetsArray = Object.keys(changeAssets)
Expand Down
138 changes: 9 additions & 129 deletions dist/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"main": "./esm/mod.js",
"types": "./dist/types/mod.d.ts",
"name": "@jpg-store/lucid-cardano",
"version": "0.11.1",
"version": "0.11.2",
"license": "MIT",
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
"repository": "https://github.com/jpg-store/lucid",
Expand Down
2 changes: 1 addition & 1 deletion dist/src/package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
"name": "@jpg-store/lucid-cardano",
"version": "0.11.1",
"version": "0.11.2",
"license": "MIT",
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
"repository": "https://github.com/jpg-store/lucid",
Expand Down
Loading

0 comments on commit 821526c

Please sign in to comment.