|
@@ -104,6 +104,21 @@ pub fn approve<'a, 'b, 'c, 'info>(
|
|
|
.map_err(Into::into)
|
|
|
}
|
|
|
|
|
|
+pub fn revoke<'a, 'b, 'c, 'info>(ctx: CpiContext<'a, 'b, 'c, 'info, Revoke<'info>>) -> Result<()> {
|
|
|
+ let ix = spl_token::instruction::revoke(
|
|
|
+ &spl_token::ID,
|
|
|
+ ctx.accounts.source.key,
|
|
|
+ ctx.accounts.authority.key,
|
|
|
+ &[],
|
|
|
+ )?;
|
|
|
+ solana_program::program::invoke_signed(
|
|
|
+ &ix,
|
|
|
+ &[ctx.accounts.source.clone(), ctx.accounts.authority.clone()],
|
|
|
+ ctx.signer_seeds,
|
|
|
+ )
|
|
|
+ .map_err(Into::into)
|
|
|
+}
|
|
|
+
|
|
|
pub fn initialize_account<'a, 'b, 'c, 'info>(
|
|
|
ctx: CpiContext<'a, 'b, 'c, 'info, InitializeAccount<'info>>,
|
|
|
) -> Result<()> {
|
|
@@ -270,6 +285,12 @@ pub struct Approve<'info> {
|
|
|
pub authority: AccountInfo<'info>,
|
|
|
}
|
|
|
|
|
|
+#[derive(Accounts)]
|
|
|
+pub struct Revoke<'info> {
|
|
|
+ pub source: AccountInfo<'info>,
|
|
|
+ pub authority: AccountInfo<'info>,
|
|
|
+}
|
|
|
+
|
|
|
#[derive(Accounts)]
|
|
|
pub struct InitializeAccount<'info> {
|
|
|
pub account: AccountInfo<'info>,
|