chia_sdk_driver/primitives/vault/
vault_launcher.rs1use chia_puzzle_types::{EveProof, Proof};
2use chia_sdk_types::Conditions;
3use clvm_traits::ToClvm;
4use clvm_utils::TreeHash;
5use clvmr::Allocator;
6
7use crate::{DriverError, Launcher, SpendContext};
8
9use super::Vault;
10
11impl Launcher {
12 pub fn mint_vault<M>(
13 self,
14 ctx: &mut SpendContext,
15 custody_hash: TreeHash,
16 memos: M,
17 ) -> Result<(Conditions, Vault), DriverError>
18 where
19 M: ToClvm<Allocator>,
20 {
21 let launcher_coin = self.coin();
22 let (conditions, coin) = self.spend(ctx, custody_hash.into(), memos)?;
23 let vault = Vault::new(
24 coin,
25 launcher_coin.coin_id(),
26 Proof::Eve(EveProof {
27 parent_parent_coin_info: launcher_coin.parent_coin_info,
28 parent_amount: launcher_coin.amount,
29 }),
30 custody_hash,
31 );
32 Ok((conditions, vault))
33 }
34}