From 10aba18b6745bc826b6a0ab8ef068869d85e45e5 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:34:51 -0800 Subject: [PATCH 1/6] Update to latest shank and set program and IDL name for shank generation --- Cargo.lock | 16 ++++++++-------- configs/shank.cjs | 3 ++- package.json | 2 +- pnpm-lock.yaml | 9 +++++---- programs/mpl-core/Cargo.toml | 2 +- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d86e46f..b0bf905e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3299,18 +3299,18 @@ dependencies = [ [[package]] name = "shank" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c9395612d493b69a522725eef78a095f199d43eeb847f4a4b77ec0cacab535" +checksum = "97165354028449fd6922f5816e0a9e0258be3c70eb660a2b80721663e7980258" dependencies = [ "shank_macro", ] [[package]] name = "shank_macro" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8abef069c02e15f62233679b1e71f3152fac10f90b3ff89ebbad6a25b7497754" +checksum = "49ea586e1e985093c819dbf8c8a1c29c2658c944e89df107cecd4eea90053e3f" dependencies = [ "proc-macro2 1.0.76", "quote 1.0.35", @@ -3321,9 +3321,9 @@ dependencies = [ [[package]] name = "shank_macro_impl" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d3d92bfcc6e08f882f2264d774d1a2f46dc36122adc1b76416ba6405a29a9c" +checksum = "5edf22135c79499e1514c4320cac8ae9e24c1ca7c69b9975289f050caa83fff3" dependencies = [ "anyhow", "proc-macro2 1.0.76", @@ -3334,9 +3334,9 @@ dependencies = [ [[package]] name = "shank_render" -version = "0.3.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a2ea9c6dd95ea311b3b81e63cf4e9c808ed04b098819e6d2c4b1a467d587203" +checksum = "db1d87876cb6c517e7917778e1176a392bb3369095b0b20ed3c8bfaf6eabb308" dependencies = [ "proc-macro2 1.0.76", "quote 1.0.35", diff --git a/configs/shank.cjs b/configs/shank.cjs index f287f3ef..d92b70cb 100644 --- a/configs/shank.cjs +++ b/configs/shank.cjs @@ -7,9 +7,10 @@ const programDir = path.join(__dirname, "..", "programs"); generateIdl({ generator: "shank", - programName: "mpl_core_program", + programName: "mpl_core", programId: "CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL", idlDir, + idlName: "mpl_core", binaryInstallDir, programDir: path.join(programDir, "mpl-core"), }); diff --git a/package.json b/package.json index e4324932..551954b4 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ }, "devDependencies": { "@metaplex-foundation/kinobi": "^0.16.0", - "@metaplex-foundation/shank-js": "^0.1.0", + "@metaplex-foundation/shank-js": "^0.1.7", "@metaplex-foundation/amman": "^0.12.1", "typescript": "^4.9.4" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bb7e8ac6..9b82d4f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ devDependencies: specifier: ^0.16.0 version: 0.16.0 '@metaplex-foundation/shank-js': - specifier: ^0.1.0 - version: 0.1.0 + specifier: ^0.1.7 + version: 0.1.7 typescript: specifier: ^4.9.4 version: 4.9.4 @@ -111,8 +111,8 @@ packages: - supports-color dev: true - /@metaplex-foundation/shank-js@0.1.0: - resolution: {integrity: sha512-ExTOIIZFJw8WNHfv+anJifP6/Al9gcWJaUXMifGOB6BxV/J0+jfMg13sm0uMlovU7/tiZSPboS09HXnKaykETg==} + /@metaplex-foundation/shank-js@0.1.7: + resolution: {integrity: sha512-tSAipn8Ho1UxlMC3jwJ5Opl+Y3lRm60VTkgRDfvzydb57lXW5G+K5MrZhEmhrFUuRYziV+e34CTo+ybpMp1Eqg==} dependencies: '@metaplex-foundation/rustbin': 0.3.5 ansi-colors: 4.1.3 @@ -822,6 +822,7 @@ packages: /node-gyp-build@4.8.0: resolution: {integrity: sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og==} hasBin: true + requiresBuild: true dev: true /npm-run-path@4.0.1: diff --git a/programs/mpl-core/Cargo.toml b/programs/mpl-core/Cargo.toml index d1c4682c..ddd194e7 100644 --- a/programs/mpl-core/Cargo.toml +++ b/programs/mpl-core/Cargo.toml @@ -11,7 +11,7 @@ crate-type = ["cdylib", "lib"] [dependencies] borsh = "^0.10" -shank = "0.3.0" +shank = "0.4.1" num-derive = "^0.3" num-traits = "^0.2" solana-program = "^1.16" From 5989864ba5ca6e016ba861aa9883b70687167a01 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:37:48 -0800 Subject: [PATCH 2/6] Regenerate IDL with new name --- configs/kinobi.cjs | 2 +- idls/{mpl_core_program.json => mpl_core.json} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename idls/{mpl_core_program.json => mpl_core.json} (99%) diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index c66e56b8..dacbd82a 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -6,7 +6,7 @@ const clientDir = path.join(__dirname, "..", "clients"); const idlDir = path.join(__dirname, "..", "idls"); // Instanciate Kinobi. -const kinobi = k.createFromIdls([path.join(idlDir, "mpl_core_program.json")]); +const kinobi = k.createFromIdls([path.join(idlDir, "mpl_core.json")]); // Update programs. kinobi.update( diff --git a/idls/mpl_core_program.json b/idls/mpl_core.json similarity index 99% rename from idls/mpl_core_program.json rename to idls/mpl_core.json index d58070fc..027bfc9d 100644 --- a/idls/mpl_core_program.json +++ b/idls/mpl_core.json @@ -1692,7 +1692,7 @@ "metadata": { "origin": "shank", "address": "CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL", - "binaryVersion": "0.3.0", - "libVersion": "0.3.0" + "binaryVersion": "0.4.1", + "libVersion": "0.4.1" } } \ No newline at end of file From 68e679de8cb0592f2f279cc90b41046a15e612f8 Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:36:05 -0800 Subject: [PATCH 3/6] Change to basic compression schema --- .../mpl-core/src/plugins/plugin_registry.rs | 8 ++++++ programs/mpl-core/src/processor/compress.rs | 27 ++++++++++--------- .../mpl-core/src/state/hashed_asset_schema.rs | 25 +++++++++++------ programs/mpl-core/src/state/mod.rs | 4 --- 4 files changed, 40 insertions(+), 24 deletions(-) diff --git a/programs/mpl-core/src/plugins/plugin_registry.rs b/programs/mpl-core/src/plugins/plugin_registry.rs index 480ffd3e..9241d6dc 100644 --- a/programs/mpl-core/src/plugins/plugin_registry.rs +++ b/programs/mpl-core/src/plugins/plugin_registry.rs @@ -1,5 +1,6 @@ use borsh::{BorshDeserialize, BorshSerialize}; use shank::ShankAccount; +use std::cmp::Ordering; use crate::state::{Authority, DataBlob, Key, SolanaAccount}; @@ -45,6 +46,13 @@ pub struct RegistryRecord { pub offset: usize, } +impl RegistryRecord { + /// Associated function for sorting `RegistryRecords` by offset. + pub fn compare_offsets(a: &RegistryRecord, b: &RegistryRecord) -> Ordering { + a.offset.cmp(&b.offset) + } +} + /// A simple type to store the mapping of external Plugin authority to Plugin data. #[repr(C)] #[derive(Clone, BorshSerialize, BorshDeserialize, Debug)] diff --git a/programs/mpl-core/src/processor/compress.rs b/programs/mpl-core/src/processor/compress.rs index 9109d6d8..3c81e2cb 100644 --- a/programs/mpl-core/src/processor/compress.rs +++ b/programs/mpl-core/src/processor/compress.rs @@ -8,10 +8,10 @@ use solana_program::{ use crate::{ error::MplCoreError, instruction::accounts::CompressAccounts, - plugins::{fetch_plugins, Plugin}, + plugins::{fetch_plugins, Plugin, RegistryRecord}, state::{ - Asset, AuthorityVec, Compressible, DataBlob, HashedAsset, HashedAssetSchema, Key, - PluginHash, SolanaAccount, + Asset, Compressible, DataBlob, HashablePluginSchema, HashedAsset, HashedAssetSchema, Key, + SolanaAccount, }, utils::load_key, }; @@ -45,21 +45,24 @@ pub(crate) fn compress<'a>(accounts: &'a [AccountInfo<'a>], _args: CompressArgs) let mut plugin_hashes = vec![]; if asset.get_size() != ctx.accounts.asset_address.data_len() { - let registry_records = fetch_plugins(ctx.accounts.asset_address)?; + let mut registry_records = fetch_plugins(ctx.accounts.asset_address)?; - for record in registry_records { - let authorities: AuthorityVec = record.authorities; - let plugin_authorities_hash = authorities.hash()?; + // It should already be sorted but we just want to make sure. + registry_records.sort_by(RegistryRecord::compare_offsets); + for (i, record) in registry_records.into_iter().enumerate() { let plugin = Plugin::deserialize( &mut &(*ctx.accounts.asset_address.data).borrow()[record.offset..], )?; - let plugin_hash = plugin.hash()?; - plugin_hashes.push(PluginHash { - plugin_authorities_hash, - plugin_hash, - }); + let hashable_plugin_schema = HashablePluginSchema { + index: i, + authorities: record.authorities, + plugin, + }; + + let plugin_hash = hashable_plugin_schema.hash()?; + plugin_hashes.push(plugin_hash); } } diff --git a/programs/mpl-core/src/state/hashed_asset_schema.rs b/programs/mpl-core/src/state/hashed_asset_schema.rs index 05430e2c..17259f9f 100644 --- a/programs/mpl-core/src/state/hashed_asset_schema.rs +++ b/programs/mpl-core/src/state/hashed_asset_schema.rs @@ -1,22 +1,31 @@ -use crate::state::Compressible; +use crate::{ + plugins::Plugin, + state::{Authority, Compressible}, +}; use borsh::{BorshDeserialize, BorshSerialize}; -/// The plugin hash is a hash of the plugin authority and the plugin itself. +/// A type that stores a plugin's authorities and deserialized data into a +/// schema that will be later hashed into a hashed asset. #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] -pub struct PluginHash { - /// The hash of the plugin authorities. - pub plugin_authorities_hash: [u8; 32], - /// The hash of the plugin. - pub plugin_hash: [u8; 32], +pub struct HashablePluginSchema { + /// This is the order the plugins are stored in the account, allowing us + /// to keep track of their order in the hashing. + pub index: usize, + /// The authorities who have permission to utilize a plugin. + pub authorities: Vec, + /// The deserialized plugin. + pub plugin: Plugin, } +impl Compressible for HashablePluginSchema {} + /// The hashed asset schema is a schema that contains a hash of the asset and a vec of plugin hashes. #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] pub struct HashedAssetSchema { /// The hash of the asset. pub asset_hash: [u8; 32], /// A vec of plugin hashes. - pub plugin_hashes: Vec, + pub plugin_hashes: Vec<[u8; 32]>, } impl Compressible for HashedAssetSchema {} diff --git a/programs/mpl-core/src/state/mod.rs b/programs/mpl-core/src/state/mod.rs index 6fcbd419..8b298b70 100644 --- a/programs/mpl-core/src/state/mod.rs +++ b/programs/mpl-core/src/state/mod.rs @@ -52,10 +52,6 @@ pub enum Authority { }, } -/// A vector of authorities. -pub type AuthorityVec = Vec; -impl Compressible for AuthorityVec {} - /// Different types of extra accounts that can be passed in for lifecycle hooks. #[repr(C)] #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, Eq, PartialEq)] From eaf2fdcf64a4158604bb955abf44979b9c22eb4a Mon Sep 17 00:00:00 2001 From: Michael Danenberg <56533526+danenbm@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:40:53 -0800 Subject: [PATCH 4/6] Regenerate IDL and clients --- .../generated/types/hashablePluginSchema.ts | 48 +++++++++++++++++++ .../src/generated/types/hashedAssetSchema.ts | 10 ++-- clients/js/src/generated/types/index.ts | 2 +- clients/js/src/generated/types/pluginHash.ts | 33 ------------- ...ugin_hash.rs => hashable_plugin_schema.rs} | 9 ++-- .../generated/types/hashed_asset_schema.rs | 3 +- clients/rust/src/generated/types/mod.rs | 4 +- idls/mpl_core.json | 27 ++++++----- 8 files changed, 76 insertions(+), 60 deletions(-) create mode 100644 clients/js/src/generated/types/hashablePluginSchema.ts delete mode 100644 clients/js/src/generated/types/pluginHash.ts rename clients/rust/src/generated/types/{plugin_hash.rs => hashable_plugin_schema.rs} (69%) diff --git a/clients/js/src/generated/types/hashablePluginSchema.ts b/clients/js/src/generated/types/hashablePluginSchema.ts new file mode 100644 index 00000000..cfdd5cf0 --- /dev/null +++ b/clients/js/src/generated/types/hashablePluginSchema.ts @@ -0,0 +1,48 @@ +/** + * 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 { + Serializer, + array, + struct, + u64, +} from '@metaplex-foundation/umi/serializers'; +import { + Authority, + AuthorityArgs, + Plugin, + PluginArgs, + getAuthoritySerializer, + getPluginSerializer, +} from '.'; + +export type HashablePluginSchema = { + index: bigint; + authorities: Array; + plugin: Plugin; +}; + +export type HashablePluginSchemaArgs = { + index: number | bigint; + authorities: Array; + plugin: PluginArgs; +}; + +export function getHashablePluginSchemaSerializer(): Serializer< + HashablePluginSchemaArgs, + HashablePluginSchema +> { + return struct( + [ + ['index', u64()], + ['authorities', array(getAuthoritySerializer())], + ['plugin', getPluginSerializer()], + ], + { description: 'HashablePluginSchema' } + ) as Serializer; +} diff --git a/clients/js/src/generated/types/hashedAssetSchema.ts b/clients/js/src/generated/types/hashedAssetSchema.ts index 2ac4339f..0937ab87 100644 --- a/clients/js/src/generated/types/hashedAssetSchema.ts +++ b/clients/js/src/generated/types/hashedAssetSchema.ts @@ -12,17 +12,13 @@ import { bytes, struct, } from '@metaplex-foundation/umi/serializers'; -import { PluginHash, PluginHashArgs, getPluginHashSerializer } from '.'; export type HashedAssetSchema = { assetHash: Uint8Array; - pluginHashes: Array; + pluginHashes: Array; }; -export type HashedAssetSchemaArgs = { - assetHash: Uint8Array; - pluginHashes: Array; -}; +export type HashedAssetSchemaArgs = HashedAssetSchema; export function getHashedAssetSchemaSerializer(): Serializer< HashedAssetSchemaArgs, @@ -31,7 +27,7 @@ export function getHashedAssetSchemaSerializer(): Serializer< return struct( [ ['assetHash', bytes({ size: 32 })], - ['pluginHashes', array(getPluginHashSerializer())], + ['pluginHashes', array(bytes({ size: 32 }))], ], { description: 'HashedAssetSchema' } ) as Serializer; diff --git a/clients/js/src/generated/types/index.ts b/clients/js/src/generated/types/index.ts index 98a18533..49d32f65 100644 --- a/clients/js/src/generated/types/index.ts +++ b/clients/js/src/generated/types/index.ts @@ -14,10 +14,10 @@ export * from './dataState'; export * from './externalPluginRecord'; export * from './extraAccounts'; export * from './freeze'; +export * from './hashablePluginSchema'; export * from './hashedAssetSchema'; export * from './key'; export * from './plugin'; -export * from './pluginHash'; export * from './pluginType'; export * from './registryRecord'; export * from './royalties'; diff --git a/clients/js/src/generated/types/pluginHash.ts b/clients/js/src/generated/types/pluginHash.ts deleted file mode 100644 index 6a458792..00000000 --- a/clients/js/src/generated/types/pluginHash.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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 { - Serializer, - bytes, - struct, -} from '@metaplex-foundation/umi/serializers'; - -export type PluginHash = { - pluginAuthoritiesHash: Uint8Array; - pluginHash: Uint8Array; -}; - -export type PluginHashArgs = PluginHash; - -export function getPluginHashSerializer(): Serializer< - PluginHashArgs, - PluginHash -> { - return struct( - [ - ['pluginAuthoritiesHash', bytes({ size: 32 })], - ['pluginHash', bytes({ size: 32 })], - ], - { description: 'PluginHash' } - ) as Serializer; -} diff --git a/clients/rust/src/generated/types/plugin_hash.rs b/clients/rust/src/generated/types/hashable_plugin_schema.rs similarity index 69% rename from clients/rust/src/generated/types/plugin_hash.rs rename to clients/rust/src/generated/types/hashable_plugin_schema.rs index 2d03a632..ab50285c 100644 --- a/clients/rust/src/generated/types/plugin_hash.rs +++ b/clients/rust/src/generated/types/hashable_plugin_schema.rs @@ -5,12 +5,15 @@ //! [https://github.com/metaplex-foundation/kinobi] //! +use crate::generated::types::Authority; +use crate::generated::types::Plugin; use borsh::BorshDeserialize; use borsh::BorshSerialize; #[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct PluginHash { - pub plugin_authorities_hash: [u8; 32], - pub plugin_hash: [u8; 32], +pub struct HashablePluginSchema { + pub index: u64, + pub authorities: Vec, + pub plugin: Plugin, } diff --git a/clients/rust/src/generated/types/hashed_asset_schema.rs b/clients/rust/src/generated/types/hashed_asset_schema.rs index f282fa66..2bc0f967 100644 --- a/clients/rust/src/generated/types/hashed_asset_schema.rs +++ b/clients/rust/src/generated/types/hashed_asset_schema.rs @@ -5,7 +5,6 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -use crate::generated::types::PluginHash; use borsh::BorshDeserialize; use borsh::BorshSerialize; @@ -13,5 +12,5 @@ use borsh::BorshSerialize; #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct HashedAssetSchema { pub asset_hash: [u8; 32], - pub plugin_hashes: Vec, + pub plugin_hashes: Vec<[u8; 32]>, } diff --git a/clients/rust/src/generated/types/mod.rs b/clients/rust/src/generated/types/mod.rs index 29fa601c..b76d7f39 100644 --- a/clients/rust/src/generated/types/mod.rs +++ b/clients/rust/src/generated/types/mod.rs @@ -13,10 +13,10 @@ pub(crate) mod data_state; pub(crate) mod external_plugin_record; pub(crate) mod extra_accounts; pub(crate) mod freeze; +pub(crate) mod hashable_plugin_schema; pub(crate) mod hashed_asset_schema; pub(crate) mod key; pub(crate) mod plugin; -pub(crate) mod plugin_hash; pub(crate) mod plugin_type; pub(crate) mod registry_record; pub(crate) mod royalties; @@ -33,10 +33,10 @@ pub use self::data_state::*; pub use self::external_plugin_record::*; pub use self::extra_accounts::*; pub use self::freeze::*; +pub use self::hashable_plugin_schema::*; pub use self::hashed_asset_schema::*; pub use self::key::*; pub use self::plugin::*; -pub use self::plugin_hash::*; pub use self::plugin_type::*; pub use self::registry_record::*; pub use self::royalties::*; diff --git a/idls/mpl_core.json b/idls/mpl_core.json index 027bfc9d..8b1a9656 100644 --- a/idls/mpl_core.json +++ b/idls/mpl_core.json @@ -1294,26 +1294,26 @@ } }, { - "name": "PluginHash", + "name": "HashablePluginSchema", "type": { "kind": "struct", "fields": [ { - "name": "pluginAuthoritiesHash", + "name": "index", + "type": "u64" + }, + { + "name": "authorities", "type": { - "array": [ - "u8", - 32 - ] + "vec": { + "defined": "Authority" + } } }, { - "name": "pluginHash", + "name": "plugin", "type": { - "array": [ - "u8", - 32 - ] + "defined": "Plugin" } } ] @@ -1337,7 +1337,10 @@ "name": "pluginHashes", "type": { "vec": { - "defined": "PluginHash" + "array": [ + "u8", + 32 + ] } } } From 390bc3d2555752c892512255d7bf723f4b80ea33 Mon Sep 17 00:00:00 2001 From: Nhan Phan Date: Wed, 28 Feb 2024 16:41:29 -0800 Subject: [PATCH 5/6] fix ts program name type generation --- clients/js/src/generated/accounts/asset.ts | 2 +- .../src/generated/accounts/collectionData.ts | 2 +- .../js/src/generated/accounts/hashedAsset.ts | 2 +- .../js/src/generated/accounts/pluginHeader.ts | 2 +- .../src/generated/accounts/pluginRegistry.ts | 2 +- clients/js/src/generated/errors/index.ts | 2 +- .../errors/{mplCoreProgram.ts => mplCore.ts} | 4 +-- .../generated/instructions/addAuthority.ts | 2 +- .../src/generated/instructions/addPlugin.ts | 2 +- clients/js/src/generated/instructions/burn.ts | 2 +- .../js/src/generated/instructions/compress.ts | 2 +- .../js/src/generated/instructions/create.ts | 2 +- .../instructions/createCollection.ts | 2 +- .../src/generated/instructions/decompress.ts | 2 +- .../generated/instructions/removeAuthority.ts | 2 +- .../generated/instructions/removePlugin.ts | 2 +- .../js/src/generated/instructions/transfer.ts | 2 +- .../js/src/generated/instructions/update.ts | 2 +- .../generated/instructions/updatePlugin.ts | 2 +- clients/js/src/generated/programs/index.ts | 2 +- .../{mplCoreProgram.ts => mplCore.ts} | 27 +++++++++---------- clients/js/src/plugin.ts | 4 +-- clients/js/test/getProgram.test.ts | 4 +-- clients/rust/src/generated/errors/mod.rs | 4 +-- .../{mpl_core_program.rs => mpl_core.rs} | 4 +-- .../generated/instructions/add_authority.rs | 16 +++++------ .../src/generated/instructions/add_plugin.rs | 16 +++++------ .../rust/src/generated/instructions/burn.rs | 16 +++++------ .../src/generated/instructions/compress.rs | 12 ++++----- .../rust/src/generated/instructions/create.rs | 20 +++++++------- .../instructions/create_collection.rs | 12 ++++----- .../src/generated/instructions/decompress.rs | 12 ++++----- .../instructions/remove_authority.rs | 16 +++++------ .../generated/instructions/remove_plugin.rs | 16 +++++------ .../src/generated/instructions/transfer.rs | 16 +++++------ .../rust/src/generated/instructions/update.rs | 16 +++++------ .../generated/instructions/update_plugin.rs | 16 +++++------ clients/rust/src/generated/programs.rs | 4 +-- configs/kinobi.cjs | 2 +- 39 files changed, 136 insertions(+), 139 deletions(-) rename clients/js/src/generated/errors/{mplCoreProgram.ts => mplCore.ts} (99%) rename clients/js/src/generated/programs/{mplCoreProgram.ts => mplCore.ts} (57%) rename clients/rust/src/generated/errors/{mpl_core_program.rs => mpl_core.rs} (98%) diff --git a/clients/js/src/generated/accounts/asset.ts b/clients/js/src/generated/accounts/asset.ts index a3379eda..2b076bd1 100644 --- a/clients/js/src/generated/accounts/asset.ts +++ b/clients/js/src/generated/accounts/asset.ts @@ -131,7 +131,7 @@ export async function safeFetchAllAsset( export function getAssetGpaBuilder(context: Pick) { const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); return gpaBuilder(context, programId) diff --git a/clients/js/src/generated/accounts/collectionData.ts b/clients/js/src/generated/accounts/collectionData.ts index 1c5815ac..bd220422 100644 --- a/clients/js/src/generated/accounts/collectionData.ts +++ b/clients/js/src/generated/accounts/collectionData.ts @@ -134,7 +134,7 @@ export function getCollectionDataGpaBuilder( context: Pick ) { const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); return gpaBuilder(context, programId) diff --git a/clients/js/src/generated/accounts/hashedAsset.ts b/clients/js/src/generated/accounts/hashedAsset.ts index 46b3e5d1..a5a24006 100644 --- a/clients/js/src/generated/accounts/hashedAsset.ts +++ b/clients/js/src/generated/accounts/hashedAsset.ts @@ -107,7 +107,7 @@ export function getHashedAssetGpaBuilder( context: Pick ) { const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); return gpaBuilder(context, programId) diff --git a/clients/js/src/generated/accounts/pluginHeader.ts b/clients/js/src/generated/accounts/pluginHeader.ts index 97814bc5..90096e1c 100644 --- a/clients/js/src/generated/accounts/pluginHeader.ts +++ b/clients/js/src/generated/accounts/pluginHeader.ts @@ -109,7 +109,7 @@ export function getPluginHeaderGpaBuilder( context: Pick ) { const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); return gpaBuilder(context, programId) diff --git a/clients/js/src/generated/accounts/pluginRegistry.ts b/clients/js/src/generated/accounts/pluginRegistry.ts index 9e351b81..1e7ca74e 100644 --- a/clients/js/src/generated/accounts/pluginRegistry.ts +++ b/clients/js/src/generated/accounts/pluginRegistry.ts @@ -133,7 +133,7 @@ export function getPluginRegistryGpaBuilder( context: Pick ) { const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); return gpaBuilder(context, programId) diff --git a/clients/js/src/generated/errors/index.ts b/clients/js/src/generated/errors/index.ts index 781842fa..48640f16 100644 --- a/clients/js/src/generated/errors/index.ts +++ b/clients/js/src/generated/errors/index.ts @@ -6,4 +6,4 @@ * @see https://github.com/metaplex-foundation/kinobi */ -export * from './mplCoreProgram'; +export * from './mplCore'; diff --git a/clients/js/src/generated/errors/mplCoreProgram.ts b/clients/js/src/generated/errors/mplCore.ts similarity index 99% rename from clients/js/src/generated/errors/mplCoreProgram.ts rename to clients/js/src/generated/errors/mplCore.ts index 57963158..06364184 100644 --- a/clients/js/src/generated/errors/mplCoreProgram.ts +++ b/clients/js/src/generated/errors/mplCore.ts @@ -282,7 +282,7 @@ nameToErrorMap.set('InvalidCollection', InvalidCollectionError); * Attempts to resolve a custom program error from the provided error code. * @category Errors */ -export function getMplCoreProgramErrorFromCode( +export function getMplCoreErrorFromCode( code: number, program: Program, cause?: Error @@ -295,7 +295,7 @@ export function getMplCoreProgramErrorFromCode( * Attempts to resolve a custom program error from the provided error name, i.e. 'Unauthorized'. * @category Errors */ -export function getMplCoreProgramErrorFromName( +export function getMplCoreErrorFromName( name: string, program: Program, cause?: Error diff --git a/clients/js/src/generated/instructions/addAuthority.ts b/clients/js/src/generated/instructions/addAuthority.ts index bc191a4c..d0b24de4 100644 --- a/clients/js/src/generated/instructions/addAuthority.ts +++ b/clients/js/src/generated/instructions/addAuthority.ts @@ -93,7 +93,7 @@ export function addAuthority( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/addPlugin.ts b/clients/js/src/generated/instructions/addPlugin.ts index 7b78a10b..99473650 100644 --- a/clients/js/src/generated/instructions/addPlugin.ts +++ b/clients/js/src/generated/instructions/addPlugin.ts @@ -81,7 +81,7 @@ export function addPlugin( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/burn.ts b/clients/js/src/generated/instructions/burn.ts index 0bc71039..3d496347 100644 --- a/clients/js/src/generated/instructions/burn.ts +++ b/clients/js/src/generated/instructions/burn.ts @@ -84,7 +84,7 @@ export function burn( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/compress.ts b/clients/js/src/generated/instructions/compress.ts index 5185a42a..c52618fb 100644 --- a/clients/js/src/generated/instructions/compress.ts +++ b/clients/js/src/generated/instructions/compress.ts @@ -68,7 +68,7 @@ export function compress( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/create.ts b/clients/js/src/generated/instructions/create.ts index a2bb664c..3068c560 100644 --- a/clients/js/src/generated/instructions/create.ts +++ b/clients/js/src/generated/instructions/create.ts @@ -99,7 +99,7 @@ export function create( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/createCollection.ts b/clients/js/src/generated/instructions/createCollection.ts index 693bd49b..9c524633 100644 --- a/clients/js/src/generated/instructions/createCollection.ts +++ b/clients/js/src/generated/instructions/createCollection.ts @@ -93,7 +93,7 @@ export function createCollection( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/decompress.ts b/clients/js/src/generated/instructions/decompress.ts index d9b736db..a27493e1 100644 --- a/clients/js/src/generated/instructions/decompress.ts +++ b/clients/js/src/generated/instructions/decompress.ts @@ -85,7 +85,7 @@ export function decompress( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/removeAuthority.ts b/clients/js/src/generated/instructions/removeAuthority.ts index e6513009..e5584f0e 100644 --- a/clients/js/src/generated/instructions/removeAuthority.ts +++ b/clients/js/src/generated/instructions/removeAuthority.ts @@ -96,7 +96,7 @@ export function removeAuthority( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/removePlugin.ts b/clients/js/src/generated/instructions/removePlugin.ts index 8abf7c75..3b6b6f9b 100644 --- a/clients/js/src/generated/instructions/removePlugin.ts +++ b/clients/js/src/generated/instructions/removePlugin.ts @@ -81,7 +81,7 @@ export function removePlugin( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/transfer.ts b/clients/js/src/generated/instructions/transfer.ts index 6bf594c4..f4ce0b21 100644 --- a/clients/js/src/generated/instructions/transfer.ts +++ b/clients/js/src/generated/instructions/transfer.ts @@ -90,7 +90,7 @@ export function transfer( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/update.ts b/clients/js/src/generated/instructions/update.ts index 3ddfab56..819fd690 100644 --- a/clients/js/src/generated/instructions/update.ts +++ b/clients/js/src/generated/instructions/update.ts @@ -85,7 +85,7 @@ export function update( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/instructions/updatePlugin.ts b/clients/js/src/generated/instructions/updatePlugin.ts index 7339068e..f6be4094 100644 --- a/clients/js/src/generated/instructions/updatePlugin.ts +++ b/clients/js/src/generated/instructions/updatePlugin.ts @@ -81,7 +81,7 @@ export function updatePlugin( ): TransactionBuilder { // Program ID. const programId = context.programs.getPublicKey( - 'mplCoreProgram', + 'mplCore', 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' ); diff --git a/clients/js/src/generated/programs/index.ts b/clients/js/src/generated/programs/index.ts index 781842fa..48640f16 100644 --- a/clients/js/src/generated/programs/index.ts +++ b/clients/js/src/generated/programs/index.ts @@ -6,4 +6,4 @@ * @see https://github.com/metaplex-foundation/kinobi */ -export * from './mplCoreProgram'; +export * from './mplCore'; diff --git a/clients/js/src/generated/programs/mplCoreProgram.ts b/clients/js/src/generated/programs/mplCore.ts similarity index 57% rename from clients/js/src/generated/programs/mplCoreProgram.ts rename to clients/js/src/generated/programs/mplCore.ts index 3b112a4d..a70f89b8 100644 --- a/clients/js/src/generated/programs/mplCoreProgram.ts +++ b/clients/js/src/generated/programs/mplCore.ts @@ -12,23 +12,20 @@ import { Program, PublicKey, } from '@metaplex-foundation/umi'; -import { - getMplCoreProgramErrorFromCode, - getMplCoreProgramErrorFromName, -} from '../errors'; +import { getMplCoreErrorFromCode, getMplCoreErrorFromName } from '../errors'; -export const MPL_CORE_PROGRAM_PROGRAM_ID = +export const MPL_CORE_PROGRAM_ID = 'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL' as PublicKey<'CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL'>; -export function createMplCoreProgramProgram(): Program { +export function createMplCoreProgram(): Program { return { - name: 'mplCoreProgram', - publicKey: MPL_CORE_PROGRAM_PROGRAM_ID, + name: 'mplCore', + publicKey: MPL_CORE_PROGRAM_ID, getErrorFromCode(code: number, cause?: Error) { - return getMplCoreProgramErrorFromCode(code, this, cause); + return getMplCoreErrorFromCode(code, this, cause); }, getErrorFromName(name: string, cause?: Error) { - return getMplCoreProgramErrorFromName(name, this, cause); + return getMplCoreErrorFromName(name, this, cause); }, isOnCluster() { return true; @@ -36,20 +33,20 @@ export function createMplCoreProgramProgram(): Program { }; } -export function getMplCoreProgramProgram( +export function getMplCoreProgram( context: Pick, clusterFilter?: ClusterFilter ): T { - return context.programs.get('mplCoreProgram', clusterFilter); + return context.programs.get('mplCore', clusterFilter); } -export function getMplCoreProgramProgramId( +export function getMplCoreProgramId( context: Pick, clusterFilter?: ClusterFilter ): PublicKey { return context.programs.getPublicKey( - 'mplCoreProgram', - MPL_CORE_PROGRAM_PROGRAM_ID, + 'mplCore', + MPL_CORE_PROGRAM_ID, clusterFilter ); } diff --git a/clients/js/src/plugin.ts b/clients/js/src/plugin.ts index 1ff046f9..d77f6c34 100644 --- a/clients/js/src/plugin.ts +++ b/clients/js/src/plugin.ts @@ -1,8 +1,8 @@ import { UmiPlugin } from '@metaplex-foundation/umi'; -import { createMplCoreProgramProgram } from './generated'; +import { createMplCoreProgram } from './generated'; export const mplCore = (): UmiPlugin => ({ install(umi) { - umi.programs.add(createMplCoreProgramProgram(), false); + umi.programs.add(createMplCoreProgram(), false); }, }); diff --git a/clients/js/test/getProgram.test.ts b/clients/js/test/getProgram.test.ts index 257f38c9..7010b7a5 100644 --- a/clients/js/test/getProgram.test.ts +++ b/clients/js/test/getProgram.test.ts @@ -1,5 +1,5 @@ import test from 'ava'; -import { MPL_CORE_PROGRAM_PROGRAM_ID } from '../src'; +import { MPL_CORE_PROGRAM_ID } from '../src'; import { createUmi } from './_setup'; test('it registers the program', async (t) => { @@ -10,5 +10,5 @@ test('it registers the program', async (t) => { const program = umi.programs.get('mplCoreProgram'); // Then we expect it to be the same as the program ID constant. - t.true(program.publicKey === MPL_CORE_PROGRAM_PROGRAM_ID); + t.true(program.publicKey === MPL_CORE_PROGRAM_ID); }); diff --git a/clients/rust/src/generated/errors/mod.rs b/clients/rust/src/generated/errors/mod.rs index c453a713..b0c32e75 100644 --- a/clients/rust/src/generated/errors/mod.rs +++ b/clients/rust/src/generated/errors/mod.rs @@ -5,6 +5,6 @@ //! [https://github.com/metaplex-foundation/kinobi] //! -pub(crate) mod mpl_core_program; +pub(crate) mod mpl_core; -pub use self::mpl_core_program::MplCoreProgramError; +pub use self::mpl_core::MplCoreError; diff --git a/clients/rust/src/generated/errors/mpl_core_program.rs b/clients/rust/src/generated/errors/mpl_core.rs similarity index 98% rename from clients/rust/src/generated/errors/mpl_core_program.rs rename to clients/rust/src/generated/errors/mpl_core.rs index b4fe9f7d..ab8bfa89 100644 --- a/clients/rust/src/generated/errors/mpl_core_program.rs +++ b/clients/rust/src/generated/errors/mpl_core.rs @@ -9,7 +9,7 @@ use num_derive::FromPrimitive; use thiserror::Error; #[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)] -pub enum MplCoreProgramError { +pub enum MplCoreError { /// 0 (0x0) - Invalid System Program #[error("Invalid System Program")] InvalidSystemProgram, @@ -72,7 +72,7 @@ pub enum MplCoreProgramError { InvalidCollection, } -impl solana_program::program_error::PrintProgramError for MplCoreProgramError { +impl solana_program::program_error::PrintProgramError for MplCoreError { fn print(&self) { solana_program::msg!(&self.to_string()); } diff --git a/clients/rust/src/generated/instructions/add_authority.rs b/clients/rust/src/generated/instructions/add_authority.rs index cff4c423..c6d0b649 100644 --- a/clients/rust/src/generated/instructions/add_authority.rs +++ b/clients/rust/src/generated/instructions/add_authority.rs @@ -50,7 +50,7 @@ impl AddAuthority { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -62,7 +62,7 @@ impl AddAuthority { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -77,7 +77,7 @@ impl AddAuthority { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -87,7 +87,7 @@ impl AddAuthority { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -323,7 +323,7 @@ impl<'a, 'b> AddAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -337,7 +337,7 @@ impl<'a, 'b> AddAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -352,7 +352,7 @@ impl<'a, 'b> AddAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -368,7 +368,7 @@ impl<'a, 'b> AddAuthorityCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/add_plugin.rs b/clients/rust/src/generated/instructions/add_plugin.rs index 0604bf83..a3028c42 100644 --- a/clients/rust/src/generated/instructions/add_plugin.rs +++ b/clients/rust/src/generated/instructions/add_plugin.rs @@ -49,7 +49,7 @@ impl AddPlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl AddPlugin { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl AddPlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -86,7 +86,7 @@ impl AddPlugin { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -311,7 +311,7 @@ impl<'a, 'b> AddPluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -325,7 +325,7 @@ impl<'a, 'b> AddPluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -340,7 +340,7 @@ impl<'a, 'b> AddPluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -356,7 +356,7 @@ impl<'a, 'b> AddPluginCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/burn.rs b/clients/rust/src/generated/instructions/burn.rs index 57d21b8e..7fdca68c 100644 --- a/clients/rust/src/generated/instructions/burn.rs +++ b/clients/rust/src/generated/instructions/burn.rs @@ -47,7 +47,7 @@ impl Burn { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -59,7 +59,7 @@ impl Burn { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -70,7 +70,7 @@ impl Burn { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -80,7 +80,7 @@ impl Burn { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -290,7 +290,7 @@ impl<'a, 'b> BurnCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -304,7 +304,7 @@ impl<'a, 'b> BurnCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -315,7 +315,7 @@ impl<'a, 'b> BurnCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -331,7 +331,7 @@ impl<'a, 'b> BurnCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/compress.rs b/clients/rust/src/generated/instructions/compress.rs index 332ddfcd..1ccec469 100644 --- a/clients/rust/src/generated/instructions/compress.rs +++ b/clients/rust/src/generated/instructions/compress.rs @@ -43,7 +43,7 @@ impl Compress { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -58,7 +58,7 @@ impl Compress { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -66,7 +66,7 @@ impl Compress { let data = CompressInstructionData::new().try_to_vec().unwrap(); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -261,7 +261,7 @@ impl<'a, 'b> CompressCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -276,7 +276,7 @@ impl<'a, 'b> CompressCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -290,7 +290,7 @@ impl<'a, 'b> CompressCpi<'a, 'b> { let data = CompressInstructionData::new().try_to_vec().unwrap(); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/create.rs b/clients/rust/src/generated/instructions/create.rs index 0b9d5bde..5609c021 100644 --- a/clients/rust/src/generated/instructions/create.rs +++ b/clients/rust/src/generated/instructions/create.rs @@ -52,7 +52,7 @@ impl Create { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -63,7 +63,7 @@ impl Create { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl Create { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -91,7 +91,7 @@ impl Create { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -101,7 +101,7 @@ impl Create { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -367,7 +367,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -378,7 +378,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -392,7 +392,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -407,7 +407,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -423,7 +423,7 @@ impl<'a, 'b> CreateCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/create_collection.rs b/clients/rust/src/generated/instructions/create_collection.rs index ff43c470..0b3eea46 100644 --- a/clients/rust/src/generated/instructions/create_collection.rs +++ b/clients/rust/src/generated/instructions/create_collection.rs @@ -48,7 +48,7 @@ impl CreateCollection { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl CreateCollection { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -75,7 +75,7 @@ impl CreateCollection { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -307,7 +307,7 @@ impl<'a, 'b> CreateCollectionCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -321,7 +321,7 @@ impl<'a, 'b> CreateCollectionCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -341,7 +341,7 @@ impl<'a, 'b> CreateCollectionCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/decompress.rs b/clients/rust/src/generated/instructions/decompress.rs index 6935fb1c..f6fba2af 100644 --- a/clients/rust/src/generated/instructions/decompress.rs +++ b/clients/rust/src/generated/instructions/decompress.rs @@ -48,7 +48,7 @@ impl Decompress { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -63,7 +63,7 @@ impl Decompress { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -73,7 +73,7 @@ impl Decompress { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -290,7 +290,7 @@ impl<'a, 'b> DecompressCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -305,7 +305,7 @@ impl<'a, 'b> DecompressCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -321,7 +321,7 @@ impl<'a, 'b> DecompressCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/remove_authority.rs b/clients/rust/src/generated/instructions/remove_authority.rs index e838249a..cd5b9d63 100644 --- a/clients/rust/src/generated/instructions/remove_authority.rs +++ b/clients/rust/src/generated/instructions/remove_authority.rs @@ -50,7 +50,7 @@ impl RemoveAuthority { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -62,7 +62,7 @@ impl RemoveAuthority { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -77,7 +77,7 @@ impl RemoveAuthority { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -87,7 +87,7 @@ impl RemoveAuthority { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -323,7 +323,7 @@ impl<'a, 'b> RemoveAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -337,7 +337,7 @@ impl<'a, 'b> RemoveAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -352,7 +352,7 @@ impl<'a, 'b> RemoveAuthorityCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -368,7 +368,7 @@ impl<'a, 'b> RemoveAuthorityCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/remove_plugin.rs b/clients/rust/src/generated/instructions/remove_plugin.rs index 0fbba0c3..b75bbd42 100644 --- a/clients/rust/src/generated/instructions/remove_plugin.rs +++ b/clients/rust/src/generated/instructions/remove_plugin.rs @@ -49,7 +49,7 @@ impl RemovePlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl RemovePlugin { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl RemovePlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -86,7 +86,7 @@ impl RemovePlugin { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -311,7 +311,7 @@ impl<'a, 'b> RemovePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -325,7 +325,7 @@ impl<'a, 'b> RemovePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -340,7 +340,7 @@ impl<'a, 'b> RemovePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -356,7 +356,7 @@ impl<'a, 'b> RemovePluginCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/transfer.rs b/clients/rust/src/generated/instructions/transfer.rs index c3520dce..4da6fa15 100644 --- a/clients/rust/src/generated/instructions/transfer.rs +++ b/clients/rust/src/generated/instructions/transfer.rs @@ -49,7 +49,7 @@ impl Transfer { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl Transfer { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl Transfer { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -86,7 +86,7 @@ impl Transfer { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -309,7 +309,7 @@ impl<'a, 'b> TransferCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -323,7 +323,7 @@ impl<'a, 'b> TransferCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -338,7 +338,7 @@ impl<'a, 'b> TransferCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -354,7 +354,7 @@ impl<'a, 'b> TransferCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/update.rs b/clients/rust/src/generated/instructions/update.rs index 9f188bea..440db973 100644 --- a/clients/rust/src/generated/instructions/update.rs +++ b/clients/rust/src/generated/instructions/update.rs @@ -50,7 +50,7 @@ impl Update { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl Update { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl Update { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -86,7 +86,7 @@ impl Update { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -327,7 +327,7 @@ impl<'a, 'b> UpdateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -338,7 +338,7 @@ impl<'a, 'b> UpdateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -353,7 +353,7 @@ impl<'a, 'b> UpdateCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -369,7 +369,7 @@ impl<'a, 'b> UpdateCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/instructions/update_plugin.rs b/clients/rust/src/generated/instructions/update_plugin.rs index c15d1892..f8aecfb7 100644 --- a/clients/rust/src/generated/instructions/update_plugin.rs +++ b/clients/rust/src/generated/instructions/update_plugin.rs @@ -49,7 +49,7 @@ impl UpdatePlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -61,7 +61,7 @@ impl UpdatePlugin { accounts.push(solana_program::instruction::AccountMeta::new(payer, true)); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -76,7 +76,7 @@ impl UpdatePlugin { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -86,7 +86,7 @@ impl UpdatePlugin { data.append(&mut args); solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, } @@ -311,7 +311,7 @@ impl<'a, 'b> UpdatePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -325,7 +325,7 @@ impl<'a, 'b> UpdatePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -340,7 +340,7 @@ impl<'a, 'b> UpdatePluginCpi<'a, 'b> { )); } else { accounts.push(solana_program::instruction::AccountMeta::new_readonly( - crate::MPL_CORE_PROGRAM_ID, + crate::MPL_CORE_ID, false, )); } @@ -356,7 +356,7 @@ impl<'a, 'b> UpdatePluginCpi<'a, 'b> { data.append(&mut args); let instruction = solana_program::instruction::Instruction { - program_id: crate::MPL_CORE_PROGRAM_ID, + program_id: crate::MPL_CORE_ID, accounts, data, }; diff --git a/clients/rust/src/generated/programs.rs b/clients/rust/src/generated/programs.rs index 526fb102..7c9c6def 100644 --- a/clients/rust/src/generated/programs.rs +++ b/clients/rust/src/generated/programs.rs @@ -7,5 +7,5 @@ use solana_program::{pubkey, pubkey::Pubkey}; -/// `mpl_core_program` program ID. -pub const MPL_CORE_PROGRAM_ID: Pubkey = pubkey!("CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL"); +/// `mpl_core` program ID. +pub const MPL_CORE_ID: Pubkey = pubkey!("CoREzp6dAdLVRKf3EM5tWrsXM2jQwRFeu5uhzsAyjYXL"); diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index dacbd82a..23897103 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -11,7 +11,7 @@ const kinobi = k.createFromIdls([path.join(idlDir, "mpl_core.json")]); // Update programs. kinobi.update( new k.UpdateProgramsVisitor({ - mplAssetProgram: { name: "mplAsset" }, + mplCoreProgram: { name: "mplCore" }, }) ); From 4bfae022d46a329a2a0133495f41f90fc041f7dc Mon Sep 17 00:00:00 2001 From: Nhan Phan Date: Wed, 28 Feb 2024 16:59:43 -0800 Subject: [PATCH 6/6] fix rust client id import --- clients/rust/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/rust/src/lib.rs b/clients/rust/src/lib.rs index e5560d6f..0c31c26c 100644 --- a/clients/rust/src/lib.rs +++ b/clients/rust/src/lib.rs @@ -1,4 +1,4 @@ mod generated; -pub use generated::programs::MPL_CORE_PROGRAM_ID as ID; +pub use generated::programs::MPL_CORE_ID as ID; pub use generated::*;