Skip to content

Commit

Permalink
Fixing optional signer.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Aug 10, 2024
1 parent 61bb5fc commit cbb888c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 34 deletions.
4 changes: 2 additions & 2 deletions clients/js/src/generated/instructions/captureV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
// Accounts.
export type CaptureV1InstructionAccounts = {
owner: Signer;
authority?: PublicKey | Pda;
authority?: PublicKey | Pda | Signer;
escrow: PublicKey | Pda;
asset: PublicKey | Pda;
collection: PublicKey | Pda;
Expand Down Expand Up @@ -172,7 +172,7 @@ export function captureV1(

// Default values.
if (!resolvedAccounts.authority.value) {
resolvedAccounts.authority.value = context.identity.publicKey;
resolvedAccounts.authority.value = context.identity;
}
if (!resolvedAccounts.userTokenAccount.value) {
resolvedAccounts.userTokenAccount.value = findAssociatedTokenPda(context, {
Expand Down
4 changes: 2 additions & 2 deletions clients/js/src/generated/instructions/releaseV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
// Accounts.
export type ReleaseV1InstructionAccounts = {
owner: Signer;
authority?: PublicKey | Pda;
authority?: PublicKey | Pda | Signer;
escrow: PublicKey | Pda;
asset: PublicKey | Pda;
collection: PublicKey | Pda;
Expand Down Expand Up @@ -172,7 +172,7 @@ export function releaseV1(

// Default values.
if (!resolvedAccounts.authority.value) {
resolvedAccounts.authority.value = context.identity.publicKey;
resolvedAccounts.authority.value = context.identity;
}
if (!resolvedAccounts.userTokenAccount.value) {
resolvedAccounts.userTokenAccount.value = findAssociatedTokenPda(context, {
Expand Down
35 changes: 20 additions & 15 deletions clients/rust/src/generated/instructions/capture_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use borsh::{BorshDeserialize, BorshSerialize};
pub struct CaptureV1 {
pub owner: solana_program::pubkey::Pubkey,

pub authority: solana_program::pubkey::Pubkey,
pub authority: (solana_program::pubkey::Pubkey, bool),

pub escrow: solana_program::pubkey::Pubkey,

Expand Down Expand Up @@ -59,8 +59,8 @@ impl CaptureV1 {
self.owner, true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.authority,
false,
self.authority.0,
self.authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.escrow,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl CaptureV1InstructionData {
/// ### Accounts:
///
/// 0. `[writable, signer]` owner
/// 1. `[writable]` authority
/// 1. `[writable, signer]` authority
/// 2. `[writable]` escrow
/// 3. `[writable]` asset
/// 4. `[writable]` collection
Expand All @@ -164,7 +164,7 @@ impl CaptureV1InstructionData {
#[derive(Default)]
pub struct CaptureV1Builder {
owner: Option<solana_program::pubkey::Pubkey>,
authority: Option<solana_program::pubkey::Pubkey>,
authority: Option<(solana_program::pubkey::Pubkey, bool)>,
escrow: Option<solana_program::pubkey::Pubkey>,
asset: Option<solana_program::pubkey::Pubkey>,
collection: Option<solana_program::pubkey::Pubkey>,
Expand Down Expand Up @@ -192,8 +192,12 @@ impl CaptureV1Builder {
self
}
#[inline(always)]
pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
self.authority = Some(authority);
pub fn authority(
&mut self,
authority: solana_program::pubkey::Pubkey,
as_signer: bool,
) -> &mut Self {
self.authority = Some((authority, as_signer));
self
}
#[inline(always)]
Expand Down Expand Up @@ -360,7 +364,7 @@ impl CaptureV1Builder {
pub struct CaptureV1CpiAccounts<'a, 'b> {
pub owner: &'b solana_program::account_info::AccountInfo<'a>,

pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),

pub escrow: &'b solana_program::account_info::AccountInfo<'a>,

Expand Down Expand Up @@ -398,7 +402,7 @@ pub struct CaptureV1Cpi<'a, 'b> {

pub owner: &'b solana_program::account_info::AccountInfo<'a>,

pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),

pub escrow: &'b solana_program::account_info::AccountInfo<'a>,

Expand Down Expand Up @@ -493,8 +497,8 @@ impl<'a, 'b> CaptureV1Cpi<'a, 'b> {
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.authority.key,
false,
*self.authority.0.key,
self.authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.escrow.key,
Expand Down Expand Up @@ -569,7 +573,7 @@ impl<'a, 'b> CaptureV1Cpi<'a, 'b> {
let mut account_infos = Vec::with_capacity(16 + 1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.owner.clone());
account_infos.push(self.authority.clone());
account_infos.push(self.authority.0.clone());
account_infos.push(self.escrow.clone());
account_infos.push(self.asset.clone());
account_infos.push(self.collection.clone());
Expand Down Expand Up @@ -601,7 +605,7 @@ impl<'a, 'b> CaptureV1Cpi<'a, 'b> {
/// ### Accounts:
///
/// 0. `[writable, signer]` owner
/// 1. `[writable]` authority
/// 1. `[writable, signer]` authority
/// 2. `[writable]` escrow
/// 3. `[writable]` asset
/// 4. `[writable]` collection
Expand Down Expand Up @@ -653,8 +657,9 @@ impl<'a, 'b> CaptureV1CpiBuilder<'a, 'b> {
pub fn authority(
&mut self,
authority: &'b solana_program::account_info::AccountInfo<'a>,
as_signer: bool,
) -> &mut Self {
self.instruction.authority = Some(authority);
self.instruction.authority = Some((authority, as_signer));
self
}
#[inline(always)]
Expand Down Expand Up @@ -876,7 +881,7 @@ impl<'a, 'b> CaptureV1CpiBuilder<'a, 'b> {
struct CaptureV1CpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
authority: Option<(&'b solana_program::account_info::AccountInfo<'a>, bool)>,
escrow: Option<&'b solana_program::account_info::AccountInfo<'a>>,
asset: Option<&'b solana_program::account_info::AccountInfo<'a>>,
collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
Expand Down
35 changes: 20 additions & 15 deletions clients/rust/src/generated/instructions/release_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use borsh::{BorshDeserialize, BorshSerialize};
pub struct ReleaseV1 {
pub owner: solana_program::pubkey::Pubkey,

pub authority: solana_program::pubkey::Pubkey,
pub authority: (solana_program::pubkey::Pubkey, bool),

pub escrow: solana_program::pubkey::Pubkey,

Expand Down Expand Up @@ -59,8 +59,8 @@ impl ReleaseV1 {
self.owner, true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.authority,
false,
self.authority.0,
self.authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new(
self.escrow,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl ReleaseV1InstructionData {
/// ### Accounts:
///
/// 0. `[writable, signer]` owner
/// 1. `[writable]` authority
/// 1. `[writable, signer]` authority
/// 2. `[writable]` escrow
/// 3. `[writable]` asset
/// 4. `[writable]` collection
Expand All @@ -164,7 +164,7 @@ impl ReleaseV1InstructionData {
#[derive(Default)]
pub struct ReleaseV1Builder {
owner: Option<solana_program::pubkey::Pubkey>,
authority: Option<solana_program::pubkey::Pubkey>,
authority: Option<(solana_program::pubkey::Pubkey, bool)>,
escrow: Option<solana_program::pubkey::Pubkey>,
asset: Option<solana_program::pubkey::Pubkey>,
collection: Option<solana_program::pubkey::Pubkey>,
Expand Down Expand Up @@ -192,8 +192,12 @@ impl ReleaseV1Builder {
self
}
#[inline(always)]
pub fn authority(&mut self, authority: solana_program::pubkey::Pubkey) -> &mut Self {
self.authority = Some(authority);
pub fn authority(
&mut self,
authority: solana_program::pubkey::Pubkey,
as_signer: bool,
) -> &mut Self {
self.authority = Some((authority, as_signer));
self
}
#[inline(always)]
Expand Down Expand Up @@ -360,7 +364,7 @@ impl ReleaseV1Builder {
pub struct ReleaseV1CpiAccounts<'a, 'b> {
pub owner: &'b solana_program::account_info::AccountInfo<'a>,

pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),

pub escrow: &'b solana_program::account_info::AccountInfo<'a>,

Expand Down Expand Up @@ -398,7 +402,7 @@ pub struct ReleaseV1Cpi<'a, 'b> {

pub owner: &'b solana_program::account_info::AccountInfo<'a>,

pub authority: &'b solana_program::account_info::AccountInfo<'a>,
pub authority: (&'b solana_program::account_info::AccountInfo<'a>, bool),

pub escrow: &'b solana_program::account_info::AccountInfo<'a>,

Expand Down Expand Up @@ -493,8 +497,8 @@ impl<'a, 'b> ReleaseV1Cpi<'a, 'b> {
true,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.authority.key,
false,
*self.authority.0.key,
self.authority.1,
));
accounts.push(solana_program::instruction::AccountMeta::new(
*self.escrow.key,
Expand Down Expand Up @@ -569,7 +573,7 @@ impl<'a, 'b> ReleaseV1Cpi<'a, 'b> {
let mut account_infos = Vec::with_capacity(16 + 1 + remaining_accounts.len());
account_infos.push(self.__program.clone());
account_infos.push(self.owner.clone());
account_infos.push(self.authority.clone());
account_infos.push(self.authority.0.clone());
account_infos.push(self.escrow.clone());
account_infos.push(self.asset.clone());
account_infos.push(self.collection.clone());
Expand Down Expand Up @@ -601,7 +605,7 @@ impl<'a, 'b> ReleaseV1Cpi<'a, 'b> {
/// ### Accounts:
///
/// 0. `[writable, signer]` owner
/// 1. `[writable]` authority
/// 1. `[writable, signer]` authority
/// 2. `[writable]` escrow
/// 3. `[writable]` asset
/// 4. `[writable]` collection
Expand Down Expand Up @@ -653,8 +657,9 @@ impl<'a, 'b> ReleaseV1CpiBuilder<'a, 'b> {
pub fn authority(
&mut self,
authority: &'b solana_program::account_info::AccountInfo<'a>,
as_signer: bool,
) -> &mut Self {
self.instruction.authority = Some(authority);
self.instruction.authority = Some((authority, as_signer));
self
}
#[inline(always)]
Expand Down Expand Up @@ -876,7 +881,7 @@ impl<'a, 'b> ReleaseV1CpiBuilder<'a, 'b> {
struct ReleaseV1CpiBuilderInstruction<'a, 'b> {
__program: &'b solana_program::account_info::AccountInfo<'a>,
owner: Option<&'b solana_program::account_info::AccountInfo<'a>>,
authority: Option<&'b solana_program::account_info::AccountInfo<'a>>,
authority: Option<(&'b solana_program::account_info::AccountInfo<'a>, bool)>,
escrow: Option<&'b solana_program::account_info::AccountInfo<'a>>,
asset: Option<&'b solana_program::account_info::AccountInfo<'a>>,
collection: Option<&'b solana_program::account_info::AccountInfo<'a>>,
Expand Down
2 changes: 2 additions & 0 deletions configs/kinobi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ kinobi.update(
},
captureV1: {
accounts: {
authority: { isSigner: 'either' },
feeTokenAccount: { defaultValue: ataPdaDefault("token", "feeProjectAccount") },
escrowTokenAccount: { defaultValue: ataPdaDefault("token", "escrow") },
userTokenAccount: { defaultValue: ataPdaDefault("token", "owner") },
Expand All @@ -49,6 +50,7 @@ kinobi.update(
},
releaseV1: {
accounts: {
authority: { isSigner: 'either' },
feeTokenAccount: { defaultValue: ataPdaDefault("token", "feeProjectAccount") },
escrowTokenAccount: { defaultValue: ataPdaDefault("token", "escrow") },
userTokenAccount: { defaultValue: ataPdaDefault("token", "owner") },
Expand Down

0 comments on commit cbb888c

Please sign in to comment.