Skip to content

Commit 216ca56

Browse files
committed
Add insert_ada
1 parent 1d53e4c commit 216ca56

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

plutus-ledger-api/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Changelog](https://keepachangelog.com/en/1.1.0).
99

1010
### Added
1111

12+
- Add `insert_ada_mut` to `Value`
1213
- Add `insert_token_mut` to `Value`
1314

1415
## v3.0.4

plutus-ledger-api/src/v1/value.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,14 @@ impl Value {
262262
self.get_token_amount(&CurrencySymbol::Ada, &TokenName::ada())
263263
}
264264

265+
/// Insert ada into a value by inserting or replacing old value
266+
pub fn insert_ada_mut(&mut self, amount: BigInt) {
267+
self.0.insert(
268+
CurrencySymbol::Ada,
269+
BTreeMap::from([(TokenName::ada(), amount)]),
270+
);
271+
}
272+
265273
/// Create a new value by inserting a new token or replacing the existing quantity.
266274
pub fn insert_token(
267275
&self,

0 commit comments

Comments
 (0)