1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Transfer an option — move the option singleton to a new owner.
//!
//! [`transfer`] spends the option singleton through the current owner's p2 layer and recreates
//! it at `new_owner_puzzle_hash` (hinted, so the new owner's wallet discovers it). Only the
//! option ticket moves; the locked underlying and its terms are untouched. The returned
//! [`OptionSpend`] carries the transferred option as its `created` handle so the caller can
//! immediately track — and later exercise or claw back — the option in its new-owner state.
use Bytes32;
use SpendContext;
use Conditions;
use crate;
use crate;
/// Build the unsigned coin spend that TRANSFERS `created`'s option singleton to
/// `new_owner_puzzle_hash`, authorized by its current `owner`.
///
/// Spends the option singleton through `owner`'s p2 layer and recreates it (same launcher id,
/// same underlying, same amount) at `new_owner_puzzle_hash` with a hint so the recipient's
/// wallet discovers it. The locked underlying coin and the option's terms are unchanged — only
/// the ticket's `p2_puzzle_hash` moves.
///
/// A [`Owner::Standard`] `owner` whose puzzle hash does not match the option's current
/// `p2_puzzle_hash` is rejected up front; a [`Owner::Custom`] owner cannot be checked here and
/// relies on the consensus to reject a wrong-party spend.
///
/// **Pure: does NOT sign or broadcast.** Returns [`OptionSpend`] with `created: Some(..)` — the
/// option in its NEW-owner state (its coin now lives at `new_owner_puzzle_hash`), so the caller
/// can chain further transfers or an exercise/clawback against the transferred singleton once
/// this spend is confirmed.