pub type OptionContract = Singleton<OptionInfo>;
Aliased Type§
pub struct OptionContract {
pub coin: Coin,
pub proof: Proof,
pub info: OptionInfo,
}
Fields§
§coin: Coin
The coin that this Singleton
represents. Its puzzle hash should match the singleton outer puzzle hash.
proof: Proof
The proof is needed by the singleton puzzle to prove that this coin is a legitimate singleton. It’s typically obtained by looking up and parsing the parent coin.
Note that while the proof will be a LineageProof
for most coins,
for the first singleton in the lineage it will be an EveProof
instead.
However, the eve coin is typically unhinted and spent in the same transaction as it was created,
so this is not relevant for database storage or syncing unspent coins.
info: OptionInfo
The information needed to construct the outer puzzle.
Implementations§
Source§impl OptionContract
impl OptionContract
pub fn parse_child( allocator: &mut Allocator, parent_coin: Coin, parent_puzzle: Puzzle, parent_solution: NodePtr, ) -> Result<Option<Self>, DriverError>
Sourcepub fn parse(
allocator: &Allocator,
coin: Coin,
puzzle: Puzzle,
solution: NodePtr,
) -> Result<Option<(Self, Puzzle, NodePtr)>, DriverError>
pub fn parse( allocator: &Allocator, coin: Coin, puzzle: Puzzle, solution: NodePtr, ) -> Result<Option<(Self, Puzzle, NodePtr)>, DriverError>
Parses an OptionContract
and its p2 spend from a coin spend.
If the puzzle is not an option contract, this will return None
instead of an error.
However, if the puzzle should have been an option contract but had a parsing error, this will return an error.