Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update attributes #99

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export * from './revokeCollectionPluginAuthorityV1';
export * from './revokePluginAuthorityV1';
export * from './transferV1';
export * from './updateCollectionPluginV1';
export * from './updateCollectionPluginV2';
export * from './updateCollectionV1';
export * from './updatePluginV1';
export * from './updatePluginV2';
export * from './updateV1';
170 changes: 170 additions & 0 deletions clients/js/src/generated/instructions/updateCollectionPluginV2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/metaplex-foundation/kinobi
*/

import {
Context,
Option,
OptionOrNullable,
Pda,
PublicKey,
Signer,
TransactionBuilder,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Serializer,
mapSerializer,
option,
struct,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';
import { Plugin, PluginArgs, getPluginSerializer } from '../types';

// Accounts.
export type UpdateCollectionPluginV2InstructionAccounts = {
/** The address of the asset */
collection: PublicKey | Pda;
/** The account paying for the storage fees */
payer?: Signer;
/** The owner or delegate of the asset */
authority?: Signer;
/** The system program */
systemProgram?: PublicKey | Pda;
/** The SPL Noop Program */
logWrapper?: PublicKey | Pda;
/** Optional buffer account containing plugin data */
bufferAccount?: PublicKey | Pda;
};

// Data.
export type UpdateCollectionPluginV2InstructionData = {
discriminator: number;
plugin: Option<Plugin>;
};

export type UpdateCollectionPluginV2InstructionDataArgs = {
plugin: OptionOrNullable<PluginArgs>;
};

export function getUpdateCollectionPluginV2InstructionDataSerializer(): Serializer<
UpdateCollectionPluginV2InstructionDataArgs,
UpdateCollectionPluginV2InstructionData
> {
return mapSerializer<
UpdateCollectionPluginV2InstructionDataArgs,
any,
UpdateCollectionPluginV2InstructionData
>(
struct<UpdateCollectionPluginV2InstructionData>(
[
['discriminator', u8()],
['plugin', option(getPluginSerializer())],
],
{ description: 'UpdateCollectionPluginV2InstructionData' }
),
(value) => ({ ...value, discriminator: 21 })
) as Serializer<
UpdateCollectionPluginV2InstructionDataArgs,
UpdateCollectionPluginV2InstructionData
>;
}

// Args.
export type UpdateCollectionPluginV2InstructionArgs =
UpdateCollectionPluginV2InstructionDataArgs;

// Instruction.
export function updateCollectionPluginV2(
context: Pick<Context, 'payer' | 'programs'>,
input: UpdateCollectionPluginV2InstructionAccounts &
UpdateCollectionPluginV2InstructionArgs
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCore',
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'
);

// Accounts.
const resolvedAccounts = {
collection: {
index: 0,
isWritable: true as boolean,
value: input.collection ?? null,
},
payer: {
index: 1,
isWritable: true as boolean,
value: input.payer ?? null,
},
authority: {
index: 2,
isWritable: false as boolean,
value: input.authority ?? null,
},
systemProgram: {
index: 3,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
logWrapper: {
index: 4,
isWritable: false as boolean,
value: input.logWrapper ?? null,
},
bufferAccount: {
index: 5,
isWritable: false as boolean,
value: input.bufferAccount ?? null,
},
} satisfies ResolvedAccountsWithIndices;

// Arguments.
const resolvedArgs: UpdateCollectionPluginV2InstructionArgs = { ...input };

// Default values.
if (!resolvedAccounts.payer.value) {
resolvedAccounts.payer.value = context.payer;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
'splSystem',
'11111111111111111111111111111111'
);
resolvedAccounts.systemProgram.isWritable = false;
}

// Accounts in order.
const orderedAccounts: ResolvedAccount[] = Object.values(
resolvedAccounts
).sort((a, b) => a.index - b.index);

// Keys and Signers.
const [keys, signers] = getAccountMetasAndSigners(
orderedAccounts,
'programId',
programId
);

// Data.
const data = getUpdateCollectionPluginV2InstructionDataSerializer().serialize(
resolvedArgs as UpdateCollectionPluginV2InstructionDataArgs
);

// Bytes Created On Chain.
const bytesCreatedOnChain = 0;

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
175 changes: 175 additions & 0 deletions clients/js/src/generated/instructions/updatePluginV2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
/**
* This code was AUTOGENERATED using the kinobi library.
* Please DO NOT EDIT THIS FILE, instead use visitors
* to add features, then rerun kinobi to update it.
*
* @see https://github.com/metaplex-foundation/kinobi
*/

import {
Context,
Option,
OptionOrNullable,
Pda,
PublicKey,
Signer,
TransactionBuilder,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Serializer,
mapSerializer,
option,
struct,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';
import { Plugin, PluginArgs, getPluginSerializer } from '../types';

// Accounts.
export type UpdatePluginV2InstructionAccounts = {
/** The address of the asset */
asset: PublicKey | Pda;
/** The collection to which the asset belongs */
collection?: PublicKey | Pda;
/** The account paying for the storage fees */
payer?: Signer;
/** The owner or delegate of the asset */
authority?: Signer;
/** The system program */
systemProgram?: PublicKey | Pda;
/** The SPL Noop Program */
logWrapper?: PublicKey | Pda;
/** Optional buffer account containing plugin data */
bufferAccount?: PublicKey | Pda;
};

// Data.
export type UpdatePluginV2InstructionData = {
discriminator: number;
plugin: Option<Plugin>;
};

export type UpdatePluginV2InstructionDataArgs = {
plugin: OptionOrNullable<PluginArgs>;
};

export function getUpdatePluginV2InstructionDataSerializer(): Serializer<
UpdatePluginV2InstructionDataArgs,
UpdatePluginV2InstructionData
> {
return mapSerializer<
UpdatePluginV2InstructionDataArgs,
any,
UpdatePluginV2InstructionData
>(
struct<UpdatePluginV2InstructionData>(
[
['discriminator', u8()],
['plugin', option(getPluginSerializer())],
],
{ description: 'UpdatePluginV2InstructionData' }
),
(value) => ({ ...value, discriminator: 20 })
) as Serializer<
UpdatePluginV2InstructionDataArgs,
UpdatePluginV2InstructionData
>;
}

// Args.
export type UpdatePluginV2InstructionArgs = UpdatePluginV2InstructionDataArgs;

// Instruction.
export function updatePluginV2(
context: Pick<Context, 'payer' | 'programs'>,
input: UpdatePluginV2InstructionAccounts & UpdatePluginV2InstructionArgs
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplCore',
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'
);

// Accounts.
const resolvedAccounts = {
asset: {
index: 0,
isWritable: true as boolean,
value: input.asset ?? null,
},
collection: {
index: 1,
isWritable: true as boolean,
value: input.collection ?? null,
},
payer: {
index: 2,
isWritable: true as boolean,
value: input.payer ?? null,
},
authority: {
index: 3,
isWritable: false as boolean,
value: input.authority ?? null,
},
systemProgram: {
index: 4,
isWritable: false as boolean,
value: input.systemProgram ?? null,
},
logWrapper: {
index: 5,
isWritable: false as boolean,
value: input.logWrapper ?? null,
},
bufferAccount: {
index: 6,
isWritable: false as boolean,
value: input.bufferAccount ?? null,
},
} satisfies ResolvedAccountsWithIndices;

// Arguments.
const resolvedArgs: UpdatePluginV2InstructionArgs = { ...input };

// Default values.
if (!resolvedAccounts.payer.value) {
resolvedAccounts.payer.value = context.payer;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
'splSystem',
'11111111111111111111111111111111'
);
resolvedAccounts.systemProgram.isWritable = false;
}

// Accounts in order.
const orderedAccounts: ResolvedAccount[] = Object.values(
resolvedAccounts
).sort((a, b) => a.index - b.index);

// Keys and Signers.
const [keys, signers] = getAccountMetasAndSigners(
orderedAccounts,
'programId',
programId
);

// Data.
const data = getUpdatePluginV2InstructionDataSerializer().serialize(
resolvedArgs as UpdatePluginV2InstructionDataArgs
);

// Bytes Created On Chain.
const bytesCreatedOnChain = 0;

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
6 changes: 3 additions & 3 deletions clients/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ num-derive = "^0.3"
num-traits = "^0.2"
serde = { version = "^1.0", features = ["derive"], optional = true }
serde_with = { version = "^3.0", optional = true }
solana-program = "> 1.14, < 1.18"
solana-program = "> 1.14, < 1.19"
thiserror = "^1.0"
base64 = "0.22.0"

[dev-dependencies]
assert_matches = "1.5.0"
solana-program-test = "> 1.14, < 1.18"
solana-sdk = "> 1.14, < 1.18"
solana-program-test = "> 1.14, < 1.19"
solana-sdk = "> 1.14, < 1.19"
4 changes: 4 additions & 0 deletions clients/rust/src/generated/instructions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ pub(crate) mod r#revoke_collection_plugin_authority_v1;
pub(crate) mod r#revoke_plugin_authority_v1;
pub(crate) mod r#transfer_v1;
pub(crate) mod r#update_collection_plugin_v1;
pub(crate) mod r#update_collection_plugin_v2;
pub(crate) mod r#update_collection_v1;
pub(crate) mod r#update_plugin_v1;
pub(crate) mod r#update_plugin_v2;
pub(crate) mod r#update_v1;

pub use self::r#add_collection_plugin_v1::*;
Expand All @@ -43,6 +45,8 @@ pub use self::r#revoke_collection_plugin_authority_v1::*;
pub use self::r#revoke_plugin_authority_v1::*;
pub use self::r#transfer_v1::*;
pub use self::r#update_collection_plugin_v1::*;
pub use self::r#update_collection_plugin_v2::*;
pub use self::r#update_collection_v1::*;
pub use self::r#update_plugin_v1::*;
pub use self::r#update_plugin_v2::*;
pub use self::r#update_v1::*;
Loading
Loading