Skip to content

Commit

Permalink
Merge pull request #363 from Emurgo/ruslan/tx-builder-total-input
Browse files Browse the repository at this point in the history
[10.0.2] Making `tx_builder.get_total_input()` function public
  • Loading branch information
vsubhuman authored Feb 8, 2022
2 parents 6e87b17 + 95f04b8 commit f5563ff
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 5 deletions.
1 change: 1 addition & 0 deletions build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
. test.sh && npm run rust:build-nodejs
2 changes: 1 addition & 1 deletion 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cardano-serialization-lib",
"version": "10.0.1",
"version": "10.0.2",
"description": "(De)serialization functions for the Cardano blockchain along with related utility functions",
"scripts": {
"rust:build-nodejs": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=nodejs; wasm-pack pack) && npm run js:flowgen",
Expand Down
16 changes: 16 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if [ $1 = "prod" ];
then RELEASE_TYPE="prod"
elif [ $1 = "beta" ];
then RELEASE_TYPE="beta"
else
echo "First parameter is expected 'prod' or 'beta'"
return 1
fi

echo "Preparing ${RELEASE_TYPE} release"

. build-and-test.sh \
&& npm run js:publish-nodejs:${RELEASE_TYPE} \
&& npm run js:publish-browser:${RELEASE_TYPE} \
&& npm run js:publish-asm:${RELEASE_TYPE} \
&& (cd rust; cargo publish --allow-dirty)
4 changes: 3 additions & 1 deletion rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardano-serialization-lib"
version = "10.0.1"
version = "10.0.2"
edition = "2018"
authors = ["EMURGO"]
license = "MIT"
Expand Down
6 changes: 6 additions & 0 deletions rust/pkg/cardano_serialization_lib.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -5299,6 +5299,12 @@ declare export class TransactionBuilder {
*/
get_implicit_input(): Value;

/**
* Return explicit input plus implicit input plus mint minus burn
* @returns {Value}
*/
get_total_input(): Value;

/**
* does not include fee
* @returns {Value}
Expand Down
3 changes: 2 additions & 1 deletion rust/src/tx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,8 @@ impl TransactionBuilder {
}).unwrap_or((Value::zero(), Value::zero()))
}

fn get_total_input(&self) -> Result<Value, JsError> {
/// Return explicit input plus implicit input plus mint minus burn
pub fn get_total_input(&self) -> Result<Value, JsError> {
let (mint_value, burn_value) = self.get_mint_as_values();
self.get_explicit_input()?
.checked_add(&self.get_implicit_input()?)?
Expand Down
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nvm i && npm i && npm run rust:test

0 comments on commit f5563ff

Please sign in to comment.