Skip to content

Commit 06536f0

Browse files
authored
feat: add NoteScript getter to Note model (0xMiden#1135)
1 parent e34d162 commit 06536f0

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
* [BREAKING] Made authenticator optional for `ClientBuilder` and `Client::new`. The authenticator parameter is now optional, allowing clients to be created without authentication capabilities ([#1056](https://github.com/0xMiden/miden-client/pull/1056)).
1111
* [BREAKING] Updated `applyStateSync` to receive a single object and then write the changes in a single transaction ([#1050](https://github.com/0xMiden/miden-client/pull/1050)).
1212
* [BREAKING] Refactored `OnNoteReceived` callback to return enum with update action ([#1051](https://github.com/0xMiden/miden-client/pull/1051)).
13+
* [BREAKING] Changed `OnNoteReceived` from closure to trait object (#1080)
14+
* `NoteScript` now has a `toString` method that prints its own MAST source [(#1082)](https://github.com/0xMiden/miden-client/pull/1082).
15+
* Added a `NoteScript` getter for the Web Client `Note` model ([#1135](https://github.com/0xMiden/miden-client/pull/1135/)).
1316
* [BREAKING] Changed `OnNoteReceived` from closure to trait object ([#1080](https://github.com/0xMiden/miden-client/pull/1080)).
14-
* `NoteScript` now has a `toString` method that prints its own MAST source ([#1082](https://github.com/0xMiden/miden-client/pull/1082)).
1517

1618
### Features
1719

crates/web-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@demox-labs/miden-sdk",
3-
"version": "0.11.0-next.10",
3+
"version": "0.11.0-next.11",
44
"description": "Miden Wasm SDK",
55
"collaborators": [
66
"Miden",

crates/web-client/src/models/note.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use wasm_bindgen::prelude::*;
99

1010
use super::{
1111
account_id::AccountId, felt::Felt, note_assets::NoteAssets, note_id::NoteId,
12-
note_metadata::NoteMetadata, note_recipient::NoteRecipient, note_type::NoteType, word::Word,
12+
note_metadata::NoteMetadata, note_recipient::NoteRecipient, note_script::NoteScript,
13+
note_type::NoteType, word::Word,
1314
};
1415

1516
#[wasm_bindgen]
@@ -43,6 +44,10 @@ impl Note {
4344
self.0.assets().clone().into()
4445
}
4546

47+
pub fn script(&self) -> NoteScript {
48+
self.0.script().clone().into()
49+
}
50+
4651
#[wasm_bindgen(js_name = "createP2IDNote")]
4752
pub fn create_p2id_note(
4853
sender: &AccountId,

docs/src/web-client/api/classes/Note.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@
8282

8383
***
8484

85+
### script()
86+
87+
> **script**(): [`NoteScript`](NoteScript.md)
88+
89+
#### Returns
90+
91+
[`NoteScript`](NoteScript.md)
92+
93+
***
94+
8595
### createP2IDENote()
8696

8797
> `static` **createP2IDENote**(`sender`, `target`, `assets`, `note_type`, `serial_num`, `recall_height`, `aux`): `Note`

0 commit comments

Comments
 (0)