From 7a7746b7f4559bb7b2f038d9c018f4e0046b784c Mon Sep 17 00:00:00 2001 From: Michael Yu Date: Mon, 11 Sep 2023 22:41:16 -0700 Subject: [PATCH] Add compute ix to migrate mpl command (#82) * Add compute ix to migrate mpl command * Update version * fix tests --- package-lock.json | 42 ++++++++++++++++++++---------------------- sdk/package-lock.json | 4 ++-- sdk/package.json | 4 ++-- sdk/src/cli.ts | 3 ++- tests/utils.ts | 17 +++++++++++------ 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 24b0a1a..defc417 100644 --- a/package-lock.json +++ b/package-lock.json @@ -942,8 +942,24 @@ "peer": true }, "node_modules/@magiceden-oss/mmm": { - "resolved": "sdk", - "link": true + "name": "@magiceden-oss/open_creator_protocol", + "version": "0.3.5", + "resolved": "file:sdk", + "dev": true, + "license": "Apache 2.0", + "dependencies": { + "@metaplex-foundation/beet": "^0.7.1", + "@metaplex-foundation/beet-solana": "^0.3.1", + "@metaplex-foundation/js": "^0.16.1", + "@metaplex-foundation/mpl-token-metadata": "^2.5.1", + "@metaplex-foundation/rustbin": "^0.3.1", + "@metaplex-foundation/solita": "^0.12.2", + "@project-serum/anchor": "^0.25.0", + "@project-serum/serum": "^0.13.58", + "@solana/spl-token": "^0.3.5", + "@solana/web3.js": "^1.65.0", + "borsh": "^0.7.0" + } }, "node_modules/@metaplex-foundation/beet": { "version": "0.7.1", @@ -6591,25 +6607,6 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } - }, - "sdk": { - "name": "@magiceden-oss/open_creator_protocol", - "version": "0.3.5", - "dev": true, - "license": "Apache 2.0", - "dependencies": { - "@metaplex-foundation/beet": "^0.7.1", - "@metaplex-foundation/beet-solana": "^0.3.1", - "@metaplex-foundation/js": "^0.16.1", - "@metaplex-foundation/mpl-token-metadata": "^2.5.1", - "@metaplex-foundation/rustbin": "^0.3.1", - "@metaplex-foundation/solita": "^0.12.2", - "@project-serum/anchor": "^0.25.0", - "@project-serum/serum": "^0.13.58", - "@solana/spl-token": "^0.3.5", - "@solana/web3.js": "^1.65.0", - "borsh": "^0.7.0" - } } }, "dependencies": { @@ -7142,7 +7139,8 @@ "peer": true }, "@magiceden-oss/mmm": { - "version": "file:sdk", + "version": "npm:@magiceden-oss/open_creator_protocol@0.3.5", + "dev": true, "requires": { "@metaplex-foundation/beet": "^0.7.1", "@metaplex-foundation/beet-solana": "^0.3.1", diff --git a/sdk/package-lock.json b/sdk/package-lock.json index 0f29974..62c06d5 100644 --- a/sdk/package-lock.json +++ b/sdk/package-lock.json @@ -1,12 +1,12 @@ { "name": "@magiceden-oss/open_creator_protocol", - "version": "0.3.5", + "version": "0.3.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@magiceden-oss/open_creator_protocol", - "version": "0.3.5", + "version": "0.3.6", "license": "Apache 2.0", "dependencies": { "@metaplex-foundation/beet": "^0.7.1", diff --git a/sdk/package.json b/sdk/package.json index 869f2f9..0427d6a 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@magiceden-oss/open_creator_protocol", - "version": "0.3.5", + "version": "0.3.6", "description": "SDK for open_creator_protocol", "scripts": { "build": "tsc" @@ -24,4 +24,4 @@ "@solana/web3.js": "^1.65.0", "borsh": "^0.7.0" } -} \ No newline at end of file +} diff --git a/sdk/src/cli.ts b/sdk/src/cli.ts index e15d0b8..be18fe1 100644 --- a/sdk/src/cli.ts +++ b/sdk/src/cli.ts @@ -11,6 +11,7 @@ import { } from "./generated"; import { CMT_PROGRAM, + computeBudgetIx, findFreezeAuthorityPk, findMintStatePk, findPolicyPk, @@ -118,7 +119,7 @@ async function migrate_to_mpl() { metadataProgram: TokenMetadataProgram.publicKey, payer: CLI_UPDATE_AUTHORITY.publicKey, }); - await process_tx(conn, [ix], [CLI_UPDATE_AUTHORITY]); + await process_tx(conn, [computeBudgetIx, ix], [CLI_UPDATE_AUTHORITY]); console.log("migrated to mpl, mint: ", CLI_MINT.toBase58()); } diff --git a/tests/utils.ts b/tests/utils.ts index 126cfd1..918914e 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -4,7 +4,7 @@ import { walletAdapterIdentity, } from "@metaplex-foundation/js"; import { - createCreateMetadataAccountV2Instruction, + createCreateMetadataAccountV3Instruction, DataV2, } from "@metaplex-foundation/mpl-token-metadata"; import * as anchor from "@project-serum/anchor"; @@ -172,7 +172,7 @@ const createNewMintTransaction = async ( freezeAuthority, //Freeze Authority TOKEN_PROGRAM_ID ), - createCreateMetadataAccountV2Instruction( + createCreateMetadataAccountV3Instruction( { metadata: metadataPDA, mint: mintKeypair.publicKey, @@ -181,9 +181,10 @@ const createNewMintTransaction = async ( updateAuthority: mintAuthority, }, { - createMetadataAccountArgsV2: { + createMetadataAccountArgsV3: { data: ON_CHAIN_METADATA, isMutable: true, + collectionDetails: null, }, } ) @@ -214,9 +215,13 @@ export const createPolicyFixture = async (conn: Connection, payer: Keypair) => { { and: [ { - field: "program_ids", - operator: "string_does_not_contain_any", - value: ["aaaa111111111111111111111111", "bbbb111111111111111111111111", "cccc111111111111111111111111"], + field: "program_ids", + operator: "string_does_not_contain_any", + value: [ + "aaaa111111111111111111111111", + "bbbb111111111111111111111111", + "cccc111111111111111111111111", + ], }, { or: [