pub fn create_swap_note<R>(
sender: AccountId,
offered_asset: Asset,
requested_asset: Asset,
swap_note_type: NoteType,
swap_note_aux: BaseElement,
payback_note_type: NoteType,
payback_note_aux: BaseElement,
rng: &mut R,
) -> Result<(Note, NoteDetails), NoteError>where
R: FeltRng,
Expand description
Generates a SWAP note - swap of assets between two accounts - and returns the note as well as NoteDetails for the payback note.
This script enables a swap of 2 assets between the sender
account and any other account that
is willing to consume the note. The consumer will receive the offered_asset
and will create a
new P2ID note with sender
as target, containing the requested_asset
.
ยงErrors
Returns an error if deserialization or compilation of the SWAP
script fails.