pub fn create_swap_note<R: FeltRng>(
sender: AccountId,
offered_asset: Asset,
requested_asset: Asset,
note_type: NoteType,
aux: Felt,
rng: &mut R,
) -> Result<(Note, NoteDetails), NoteError>
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.