Skip to content

Commit 821526c

Browse files
committed
fix: splitChange not considering mints
1 parent 4faabf3 commit 821526c

File tree

9 files changed

+252
-336
lines changed

9 files changed

+252
-336
lines changed

dist/esm/package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
"name": "@jpg-store/lucid-cardano",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"license": "MIT",
55
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
66
"repository": "https://github.com/jpg-store/lucid",

dist/esm/src/lucid/tx.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,17 @@ export class Tx {
418418
async splitChange() {
419419
const { coinsPerUtxoByte } = await this.lucid.protocolParameters;
420420
const { changeNativeAssetChunkSize, changeMinUtxo } = this.configuration;
421-
const change = this.txBuilder
421+
const positiveMintAssets = this.txBuilder.mint()?.as_positive_multiasset();
422+
const mintValue = positiveMintAssets && C.Value.new_from_assets(positiveMintAssets);
423+
const negativeMintAssets = this.txBuilder.mint()?.as_negative_multiasset();
424+
const burnValue = negativeMintAssets && C.Value.new_from_assets(negativeMintAssets);
425+
let change = this.txBuilder
422426
.get_explicit_input()
423427
.checked_sub(this.txBuilder.get_explicit_output());
428+
if (mintValue)
429+
change = change.checked_add(mintValue);
430+
if (burnValue)
431+
change = change.checked_sub(burnValue);
424432
let changeAda = change.coin();
425433
let changeAssets = valueToAssets(change);
426434
const changeAssetsArray = Object.keys(changeAssets)

dist/package-lock.json

+9-129
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "./esm/mod.js",
44
"types": "./dist/types/mod.d.ts",
55
"name": "@jpg-store/lucid-cardano",
6-
"version": "0.11.1",
6+
"version": "0.11.2",
77
"license": "MIT",
88
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
99
"repository": "https://github.com/jpg-store/lucid",

dist/src/package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default {
22
"name": "@jpg-store/lucid-cardano",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"license": "MIT",
55
"description": "This is a fork of the original Lucid repo compiled into CommonJS. For more information check https://github.com/spacebudz/lucid",
66
"repository": "https://github.com/jpg-store/lucid",

0 commit comments

Comments
 (0)