Skip to content

Conversation

grod220
Copy link
Member

@grod220 grod220 commented Mar 25, 2025

A CLI command to help derive the PDAs for the program. Example:

# spl-token-wrap pdas <UNWRAPPED_MINT> <WRAPPED_TOKEN_PROGRAM>

❯ cargo run --bin spl-token-wrap find-pdas FSi5sv14NFh71zDpBx1Ee1EFtDYRnN2fNYu7ixsPKNzJ TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb --output json

# {
#   "wrappedMintAddress": "Afj26Cfy2j7YfjUuYd8kSNXLMBGP6guVBvjbB17PQtCJ",
#   "wrappedMintAuthority": "DDifZ5AkKUVNhhtAPwTrgWsFYYywC4p4JkdYEuNj5Uma",
#   "wrappedBackpointerAddress": "P2FXC3AtiZNfktHHZNdXmKv5jVa8iyVBvgodDL2VxHu"
# }

Copy link
Contributor

@joncinque joncinque left a comment

Choose a reason for hiding this comment

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

Just a couple of nits, looks great to me otherwise!

pub enum Command {
/// Create a wrapped mint for a given SPL Token
CreateMint(CreateMintArgs),
Pdas(PdasArgs),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I lean towards being explicit here, and calling it find-program-derived-addresses

Choose a reason for hiding this comment

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

Agreed, but I am also okay with find-pdas.

Comment on lines 49 to 53
writeln_name_value(
f,
"Wrapped mint authority:",
&self.wrapped_mint_authority.to_string(),
)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe we should make it clear that this is also the holder of unwrapped tokens? ie "Wrapped mint authority / unwrapped token holder"? Or is that too verbose?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd say the escrow account would fulfill the role of "unwrapped token holder"

Copy link
Contributor

@joncinque joncinque Mar 25, 2025

Choose a reason for hiding this comment

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

I meant it as "address that owns the unwrapped token accounts". But I guess this shows why we never came up with a better name than "token account" 😅 we can just leave it as is

Copy link

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Lgtm! Nice idea!!

Will stamp after the command name change.

pub enum Command {
/// Create a wrapped mint for a given SPL Token
CreateMint(CreateMintArgs),
Pdas(PdasArgs),

Choose a reason for hiding this comment

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

Agreed, but I am also okay with find-pdas.

@grod220 grod220 merged commit 3529058 into main Mar 25, 2025
10 checks passed
@grod220 grod220 deleted the pda-utils branch March 25, 2025 18:22
@grod220 grod220 mentioned this pull request Mar 25, 2025
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