Skip to content

Commit

Permalink
chore(kinobi): migrate to Kinobi 0.17.0 (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
shotgunofdeath authored Feb 29, 2024
1 parent 5df7027 commit 6f5dbcb
Show file tree
Hide file tree
Showing 29 changed files with 686 additions and 487 deletions.
34 changes: 16 additions & 18 deletions clients/js/src/generated/instructions/createV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ export type CreateV1InstructionDataArgs = {
creators: OptionOrNullable<Array<CreatorArgs>>;
primarySaleHappened?: boolean;
isMutable?: boolean;
tokenStandard: TokenStandardArgs;
tokenStandard?: TokenStandardArgs;
collection?: OptionOrNullable<CollectionArgs>;
uses?: OptionOrNullable<UsesArgs>;
collectionDetails?: OptionOrNullable<CollectionDetailsArgs>;
collectionDetails: OptionOrNullable<CollectionDetailsArgs>;
ruleSet?: OptionOrNullable<PublicKey>;
decimals?: OptionOrNullable<number>;
printSupply?: OptionOrNullable<PrintSupplyArgs>;
decimals: OptionOrNullable<number>;
printSupply: OptionOrNullable<PrintSupplyArgs>;
};

export function getCreateV1InstructionDataSerializer(): Serializer<
Expand Down Expand Up @@ -167,28 +167,26 @@ export function getCreateV1InstructionDataSerializer(): Serializer<
symbol: value.symbol ?? '',
primarySaleHappened: value.primarySaleHappened ?? false,
isMutable: value.isMutable ?? true,
tokenStandard: value.tokenStandard ?? TokenStandard.NonFungible,
collection: value.collection ?? none(),
uses: value.uses ?? none(),
collectionDetails: value.collectionDetails ?? none(),
ruleSet: value.ruleSet ?? none(),
decimals: value.decimals ?? none(),
printSupply: value.printSupply ?? none(),
})
) as Serializer<CreateV1InstructionDataArgs, CreateV1InstructionData>;
}

// Extra Args.
export type CreateV1InstructionExtraArgs = { isCollection: boolean };
export type CreateV1InstructionExtraArgs = { isCollection?: boolean };

// Args.
export type CreateV1InstructionArgs = PickPartial<
CreateV1InstructionDataArgs & CreateV1InstructionExtraArgs,
| 'tokenStandard'
| 'creators'
| 'isCollection'
| 'collectionDetails'
| 'decimals'
| 'printSupply'
| 'creators'
>;

// Instruction.
Expand Down Expand Up @@ -314,6 +312,15 @@ export function createV1(
resolvedAccounts.splTokenProgram.isWritable = false;
}
}
if (!resolvedArgs.creators) {
resolvedArgs.creators = resolveCreators(
context,
resolvedAccounts,
resolvedArgs,
programId,
false
);
}
if (!resolvedArgs.isCollection) {
resolvedArgs.isCollection = false;
}
Expand Down Expand Up @@ -344,15 +351,6 @@ export function createV1(
false
);
}
if (!resolvedArgs.creators) {
resolvedArgs.creators = resolveCreators(
context,
resolvedAccounts,
resolvedArgs,
programId,
false
);
}

// Accounts in order.
const orderedAccounts: ResolvedAccount[] = Object.values(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export function delegateAuthorityItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.AuthorityItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export function delegateCollectionItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.CollectionItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export function delegateCollectionV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.Collection,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ export function delegateDataItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.DataItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/delegateDataV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ export function delegateDataV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.Data,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ export function delegateProgrammableConfigItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.ProgrammableConfigItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ export function delegateProgrammableConfigV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.ProgrammableConfig,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export function revokeAuthorityItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.AuthorityItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export function revokeCollectionItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.CollectionItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export function revokeCollectionV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.Collection,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeDataItemV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ export function revokeDataItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.DataItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/revokeDataV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ export function revokeDataV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.Data,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ export function revokeProgrammableConfigItemV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.ProgrammableConfigItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export function revokeProgrammableConfigV1(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.ProgrammableConfig,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
mint: expectPublicKey(resolvedAccounts.mint.value),
delegate: expectPublicKey(resolvedAccounts.delegate.value),
}
);
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/transferV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ export function transferV1(
resolvedAccounts.destinationTokenRecord.value = findTokenRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
token: expectPublicKey(resolvedAccounts.destinationToken.value),
mint: expectPublicKey(resolvedAccounts.mint.value),
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ export function updateAsAuthorityItemDelegateV2(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.AuthorityItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
delegate: expectPublicKey(resolvedAccounts.authority.value),
mint: expectPublicKey(resolvedAccounts.mint.value),
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ export function updateAsCollectionItemDelegateV2(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.CollectionItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
delegate: expectPublicKey(resolvedAccounts.authority.value),
mint: expectPublicKey(resolvedAccounts.mint.value),
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ export function updateAsDataItemDelegateV2(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.DataItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
delegate: expectPublicKey(resolvedAccounts.authority.value),
mint: expectPublicKey(resolvedAccounts.mint.value),
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ export function updateAsProgrammableConfigItemDelegateV2(
resolvedAccounts.delegateRecord.value = findMetadataDelegateRecordPda(
context,
{
mint: expectPublicKey(resolvedAccounts.mint.value),
delegateRole: MetadataDelegateRole.ProgrammableConfigItem,
updateAuthority: expectSome(resolvedArgs.updateAuthority),
delegate: expectPublicKey(resolvedAccounts.authority.value),
mint: expectPublicKey(resolvedAccounts.mint.value),
}
);
}
Expand Down
1 change: 1 addition & 0 deletions clients/rust/src/generated/accounts/edition_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct EditionMarker {

impl EditionMarker {
pub const LEN: usize = 32;

/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct HolderDelegateRecord {

impl HolderDelegateRecord {
pub const LEN: usize = 98;

/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub struct MetadataDelegateRecord {

impl MetadataDelegateRecord {
pub const LEN: usize = 98;

/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
Expand Down
1 change: 1 addition & 0 deletions clients/rust/src/generated/accounts/token_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct TokenRecord {

impl TokenRecord {
pub const LEN: usize = 80;

/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct UseAuthorityRecord {

impl UseAuthorityRecord {
pub const LEN: usize = 10;

/// Prefix values used to generate a PDA for this account.
///
/// Values are positional and appear in the following order:
Expand Down
6 changes: 4 additions & 2 deletions clients/rust/src/generated/instructions/create_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ impl CreateV1Builder {
self.is_mutable = Some(is_mutable);
self
}
/// `[optional argument, defaults to 'TokenStandard::NonFungible']`
#[inline(always)]
pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self {
self.token_standard = Some(token_standard);
Expand Down Expand Up @@ -392,7 +393,7 @@ impl CreateV1Builder {
token_standard: self
.token_standard
.clone()
.expect("token_standard is not set"),
.unwrap_or(TokenStandard::NonFungible),
collection: self.collection.clone(),
uses: self.uses.clone(),
collection_details: self.collection_details.clone(),
Expand Down Expand Up @@ -769,6 +770,7 @@ impl<'a, 'b> CreateV1CpiBuilder<'a, 'b> {
self.instruction.is_mutable = Some(is_mutable);
self
}
/// `[optional argument, defaults to 'TokenStandard::NonFungible']`
#[inline(always)]
pub fn token_standard(&mut self, token_standard: TokenStandard) -> &mut Self {
self.instruction.token_standard = Some(token_standard);
Expand Down Expand Up @@ -871,7 +873,7 @@ impl<'a, 'b> CreateV1CpiBuilder<'a, 'b> {
.instruction
.token_standard
.clone()
.expect("token_standard is not set"),
.unwrap_or(TokenStandard::NonFungible),
collection: self.instruction.collection.clone(),
uses: self.instruction.uses.clone(),
collection_details: self.instruction.collection_details.clone(),
Expand Down
Loading

0 comments on commit 6f5dbcb

Please sign in to comment.