Skip to content

Conversation

grod220
Copy link
Member

@grod220 grod220 commented Apr 7, 2025

The final javascript helper for the Token Wrap program. Mirrors the Rust work done in #47.

Logic largely follows Wrapping work: #53

@grod220 grod220 force-pushed the js-client-wrap-multisig branch 2 times, most recently from a740634 to 63fb236 Compare April 23, 2025 07:57
Base automatically changed from js-client-wrap-multisig to main April 23, 2025 10:19
}
return getTokenDecoder().decode(account.data).mint;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Everything below this comment was moved from src/wrap.ts given combinedMultisigTx is a shared function between both wrap and unwrap helpers.

@grod220 grod220 requested a review from mcintyre94 April 23, 2025 19:49
Copy link
Member

@mcintyre94 mcintyre94 left a comment

Choose a reason for hiding this comment

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

Looks good!

Comment on lines +20 to +36
export interface SingleSignerUnwrapArgs {
rpc: Rpc<GetAccountInfoApi>;
blockhash: {
blockhash: Blockhash;
lastValidBlockHeight: bigint;
};
payer: TransactionSigner; // Fee payer and default transfer authority
wrappedTokenAccount: Address;
unwrappedEscrow: Address;
amount: bigint | number;
recipientUnwrappedToken: Address;
// Optional arguments below (will be derived/defaulted if not provided)
transferAuthority?: Address | TransactionSigner; // Defaults to payer
unwrappedMint?: Address; // Will derive from unwrappedEscrow if not provided
wrappedTokenProgram?: Address; // Will derive from wrappedTokenAccount if not provided
unwrappedTokenProgram?: Address; // Will derive from unwrappedEscrow if not provided
}
Copy link
Member

Choose a reason for hiding this comment

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

Optional for a follow up PR - it might be worth using TSDoc here: https://tsdoc.org

The benefit would be that this param documentation will show inline in the editor for someone creating this, while these comments typically won't

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good to know!

@grod220 grod220 merged commit a5dd2dc into main Apr 24, 2025
10 checks passed
@grod220 grod220 deleted the js-client-unwrap branch April 24, 2025 14:17
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.

2 participants