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

Removing the setCollectionSize CPI to Token Metadata #92

Merged
merged 1 commit into from
Apr 9, 2024
Merged
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
8 changes: 3 additions & 5 deletions clients/js/src/generated/instructions/mintToCollectionV1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export function mintToCollectionV1(
}
if (!resolvedAccounts.bubblegumSigner.value) {
resolvedAccounts.bubblegumSigner.value = publicKey(
'4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK'
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
}
if (!resolvedAccounts.logWrapper.value) {
Expand All @@ -238,11 +238,9 @@ export function mintToCollectionV1(
resolvedAccounts.compressionProgram.isWritable = false;
}
if (!resolvedAccounts.tokenMetadataProgram.value) {
resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
resolvedAccounts.tokenMetadataProgram.value = publicKey(
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
resolvedAccounts.tokenMetadataProgram.isWritable = false;
blockiosaurus marked this conversation as resolved.
Show resolved Hide resolved
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ export function setAndVerifyCollection(
}
if (!resolvedAccounts.bubblegumSigner.value) {
resolvedAccounts.bubblegumSigner.value = publicKey(
'4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK'
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
}
if (!resolvedAccounts.logWrapper.value) {
Expand All @@ -280,11 +280,9 @@ export function setAndVerifyCollection(
resolvedAccounts.compressionProgram.isWritable = false;
}
if (!resolvedAccounts.tokenMetadataProgram.value) {
resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
resolvedAccounts.tokenMetadataProgram.value = publicKey(
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
resolvedAccounts.tokenMetadataProgram.isWritable = false;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
Expand Down
8 changes: 3 additions & 5 deletions clients/js/src/generated/instructions/unverifyCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export function unverifyCollection(
}
if (!resolvedAccounts.bubblegumSigner.value) {
resolvedAccounts.bubblegumSigner.value = publicKey(
'4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK'
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
}
if (!resolvedAccounts.logWrapper.value) {
Expand All @@ -276,11 +276,9 @@ export function unverifyCollection(
resolvedAccounts.compressionProgram.isWritable = false;
}
if (!resolvedAccounts.tokenMetadataProgram.value) {
resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
resolvedAccounts.tokenMetadataProgram.value = publicKey(
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
resolvedAccounts.tokenMetadataProgram.isWritable = false;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
Expand Down
7 changes: 3 additions & 4 deletions clients/js/src/generated/instructions/updateMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
PublicKey,
Signer,
TransactionBuilder,
publicKey,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Expand Down Expand Up @@ -230,11 +231,9 @@ export function updateMetadata(
resolvedAccounts.compressionProgram.isWritable = false;
}
if (!resolvedAccounts.tokenMetadataProgram.value) {
resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
resolvedAccounts.tokenMetadataProgram.value = publicKey(
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
resolvedAccounts.tokenMetadataProgram.isWritable = false;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
Expand Down
8 changes: 3 additions & 5 deletions clients/js/src/generated/instructions/verifyCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export function verifyCollection(
}
if (!resolvedAccounts.bubblegumSigner.value) {
resolvedAccounts.bubblegumSigner.value = publicKey(
'4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK'
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
}
if (!resolvedAccounts.logWrapper.value) {
Expand All @@ -272,11 +272,9 @@ export function verifyCollection(
resolvedAccounts.compressionProgram.isWritable = false;
}
if (!resolvedAccounts.tokenMetadataProgram.value) {
resolvedAccounts.tokenMetadataProgram.value = context.programs.getPublicKey(
'mplTokenMetadata',
'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s'
resolvedAccounts.tokenMetadataProgram.value = publicKey(
'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'
);
resolvedAccounts.tokenMetadataProgram.isWritable = false;
}
if (!resolvedAccounts.systemProgram.value) {
resolvedAccounts.systemProgram.value = context.programs.getPublicKey(
Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/leafAssetId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function parseLeafFromMintToCollectionV1Transaction(

blockiosaurus marked this conversation as resolved.
Show resolved Hide resolved
if (innerInstructions) {
const leaf = getLeafSchemaSerializer().deserialize(
innerInstructions[0].instructions[1].data.slice(8)
innerInstructions[0].instructions[0].data.slice(8)
);
return leaf[0];
}
Expand Down
5 changes: 3 additions & 2 deletions clients/js/test/parseMintV1.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-await-in-loop */
import {
defaultPublicKey,
generateSigner,
Expand All @@ -22,7 +23,7 @@ test('it can parse the leaf from mint instructions', async (t) => {
const umi = await createUmi();
const merkleTree = await createTree(umi);
const leafOwner = generateSigner(umi).publicKey;
let merkleTreeAccount = await fetchMerkleTree(umi, merkleTree);
const merkleTreeAccount = await fetchMerkleTree(umi, merkleTree);
t.is(merkleTreeAccount.tree.sequenceNumber, 0n);
t.is(merkleTreeAccount.tree.activeIndex, 0n);
t.is(merkleTreeAccount.tree.bufferSize, 1n);
Expand Down Expand Up @@ -59,7 +60,7 @@ test('it can parse the leaf from mintToCollection instructions)', async (t) => {
const umi = await createUmi();
const merkleTree = await createTree(umi);
const leafOwner = generateSigner(umi).publicKey;
let merkleTreeAccount = await fetchMerkleTree(umi, merkleTree);
const merkleTreeAccount = await fetchMerkleTree(umi, merkleTree);
t.is(merkleTreeAccount.tree.sequenceNumber, 0n);
t.is(merkleTreeAccount.tree.activeIndex, 0n);
t.is(merkleTreeAccount.tree.bufferSize, 1n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl MintToCollectionV1Builder {
self.collection_edition = Some(collection_edition);
self
}
/// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn bubblegum_signer(
&mut self,
Expand All @@ -290,7 +290,7 @@ impl MintToCollectionV1Builder {
self.compression_program = Some(compression_program);
self
}
/// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn token_metadata_program(
&mut self,
Expand Down Expand Up @@ -352,7 +352,7 @@ impl MintToCollectionV1Builder {
.collection_edition
.expect("collection_edition is not set"),
bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!(
"4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"
"BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
)),
log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
Expand All @@ -361,7 +361,7 @@ impl MintToCollectionV1Builder {
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
)),
token_metadata_program: self.token_metadata_program.unwrap_or(
solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
),
system_program: self
.system_program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl SetAndVerifyCollectionBuilder {
self.collection_edition = Some(collection_edition);
self
}
/// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn bubblegum_signer(
&mut self,
Expand All @@ -309,7 +309,7 @@ impl SetAndVerifyCollectionBuilder {
self.compression_program = Some(compression_program);
self
}
/// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn token_metadata_program(
&mut self,
Expand Down Expand Up @@ -401,7 +401,7 @@ impl SetAndVerifyCollectionBuilder {
.collection_edition
.expect("collection_edition is not set"),
bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!(
"4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"
"BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
)),
log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
Expand All @@ -410,7 +410,7 @@ impl SetAndVerifyCollectionBuilder {
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
)),
token_metadata_program: self.token_metadata_program.unwrap_or(
solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
),
system_program: self
.system_program
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl UnverifyCollectionBuilder {
self.collection_edition = Some(collection_edition);
self
}
/// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn bubblegum_signer(
&mut self,
Expand All @@ -305,7 +305,7 @@ impl UnverifyCollectionBuilder {
self.compression_program = Some(compression_program);
self
}
/// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn token_metadata_program(
&mut self,
Expand Down Expand Up @@ -392,7 +392,7 @@ impl UnverifyCollectionBuilder {
.collection_edition
.expect("collection_edition is not set"),
bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!(
"4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"
"BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
)),
log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
Expand All @@ -401,7 +401,7 @@ impl UnverifyCollectionBuilder {
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
)),
token_metadata_program: self.token_metadata_program.unwrap_or(
solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
),
system_program: self
.system_program
Expand Down
4 changes: 2 additions & 2 deletions clients/rust/src/generated/instructions/update_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl UpdateMetadataBuilder {
self.compression_program = Some(compression_program);
self
}
/// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn token_metadata_program(
&mut self,
Expand Down Expand Up @@ -344,7 +344,7 @@ impl UpdateMetadataBuilder {
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
)),
token_metadata_program: self.token_metadata_program.unwrap_or(
solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
),
system_program: self
.system_program
Expand Down
8 changes: 4 additions & 4 deletions clients/rust/src/generated/instructions/verify_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl VerifyCollectionBuilder {
self.collection_edition = Some(collection_edition);
self
}
/// `[optional account, default to '4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn bubblegum_signer(
&mut self,
Expand All @@ -303,7 +303,7 @@ impl VerifyCollectionBuilder {
self.compression_program = Some(compression_program);
self
}
/// `[optional account, default to 'metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s']`
/// `[optional account, default to 'BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY']`
#[inline(always)]
pub fn token_metadata_program(
&mut self,
Expand Down Expand Up @@ -390,7 +390,7 @@ impl VerifyCollectionBuilder {
.collection_edition
.expect("collection_edition is not set"),
bubblegum_signer: self.bubblegum_signer.unwrap_or(solana_program::pubkey!(
"4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"
"BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"
)),
log_wrapper: self.log_wrapper.unwrap_or(solana_program::pubkey!(
"noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV"
Expand All @@ -399,7 +399,7 @@ impl VerifyCollectionBuilder {
"cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK"
)),
token_metadata_program: self.token_metadata_program.unwrap_or(
solana_program::pubkey!("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"),
solana_program::pubkey!("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
),
system_program: self
.system_program
Expand Down
24 changes: 21 additions & 3 deletions configs/kinobi.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const k = require("@metaplex-foundation/kinobi");
const clientDir = path.join(__dirname, "..", "clients");
const idlDir = path.join(__dirname, "..", "idls");

// Instanciate Kinobi withtout DefaultVisitor.
// Instantiate Kinobi without DefaultVisitor.
const kinobi = k.createFromIdls(
[
path.join(idlDir, "bubblegum.json"),
Expand Down Expand Up @@ -148,7 +148,24 @@ kinobi.update(
])
);

// Set default account values accross multiple instructions.
const deprecatedTmIxes = [
"mintToCollectionV1",
"setAndVerifyCollection",
"unverifyCollection",
"updateMetadata",
"verifyCollection",
];
let deprecatedIxUpdaters = [];
for (let ix of deprecatedTmIxes) {
deprecatedIxUpdaters.push(
{
account: "tokenMetadataProgram",
instruction: ix,
...k.publicKeyDefault("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
})
}

// Set default account values across multiple instructions.
kinobi.update(
new k.SetInstructionAccountDefaultValuesVisitor([
{
Expand Down Expand Up @@ -198,7 +215,7 @@ kinobi.update(
{
account: "bubblegumSigner",
ignoreIfOptional: true,
...k.publicKeyDefault("4ewWZC5gT6TGpm5LZNDs9wVonfUT2q5PP5sc9kVbwMAK"),
...k.publicKeyDefault("BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY"),
},
{
account: "collectionMetadata",
Expand Down Expand Up @@ -226,6 +243,7 @@ kinobi.update(
ignoreIfOptional: true,
...k.identityDefault(),
},
...deprecatedIxUpdaters,
])
);

Expand Down
Loading
Loading