Skip to content

Conversation

@wwills2
Copy link
Collaborator

@wwills2 wwills2 commented Oct 15, 2025

This PR adds driver functions related to creation, retrieval, and spend of store collateral coins locking $DIG

let p2_parent_hash = P2ParentCoin::inner_puzzle_hash(Some(DIG_COIN_ASSET_ID));
let p2_parent_puzzle_hash = P2ParentCoin::puzzle_hash(Some(DIG_COIN_ASSET_ID));

let mut ctx = SpendContext::new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have Vec, don't you already have a ctx? If so, pass it to the function (ctx: &mut SpendContext) to avoid weird allocator errors. You can then return Result<(), WalletError> and just keep the spends in the context (you'd call ctx.take() when you need it).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, in the current use case for this function, the calling function does not have a ctx. My plan here is to have the driver encapsulate the logic to create the coin spends then return them to the caller. in this case the caller will create, sign and broadcast the spend bundle,

src/wallet.rs Outdated

pub async fn prove_dig_cat_coin(
peer: &Peer,
allocator: &mut Allocator,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to take a ctx: &mut SpendContext here? SpendContext is essentially Allocator + a lot of utilities

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can make that change but, this function isn't actually specifically for use when spending. I use it for that, but i also use it for non-spending purposes, like getting the wallet $DIG balance.

its just a generic utility to answer the question "is this coin a $DIG CAT"

i should probably move the allocator instantiation into the function. that would make more sense

@wwills2 wwills2 merged commit 29aa4a1 into main Nov 2, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants