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 metadata into main #68

Merged
merged 43 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c38a238
Update metadata (#44)
danenbm Oct 4, 2023
b157ed9
Avoid inlining UpdateArgs (#50)
febo Oct 4, 2023
ebc25e6
Merge pull request #51 from metaplex-foundation/main
danenbm Oct 4, 2023
3cfbe6b
Adding LeafSchemaEvent struct to Rust client
danenbm Oct 4, 2023
77debad
Merge pull request #52 from metaplex-foundation/danenbm/leaf-schema-e…
danenbm Oct 4, 2023
e804b70
Add leaf schema accessors to program and Rust client
danenbm Oct 5, 2023
c03745b
Add InstructionName::UpdateMetadata to Rust client
danenbm Oct 5, 2023
1923f83
Merge pull request #53 from metaplex-foundation/danenbm/accessors
danenbm Oct 5, 2023
3276724
chore: Release mpl-bubblegum version 1.0.1-beta.1
febo Oct 5, 2023
d58bd7d
Add borsh version range (#54)
febo Oct 9, 2023
d44ab17
chore: Release mpl-bubblegum version 1.0.1-beta.2
febo Oct 9, 2023
c6d0936
Remove optional metadata buffer account from update_metadata
danenbm Oct 11, 2023
a16a739
Update Rust and Umi JS clients, update IDL
danenbm Oct 11, 2023
c7623d1
Update js-solita client
danenbm Oct 11, 2023
99ff6f3
Fixing rust client cargo lock after release downgrades it
danenbm Oct 11, 2023
9400147
Merge pull request #55 from metaplex-foundation/danenbm/remove-buffer
danenbm Oct 12, 2023
cc58a6d
chore: Release mpl-bubblegum version 1.0.1-beta.3
danenbm Oct 12, 2023
5de8301
Merge branch 'main' into update-metadata-staging
danenbm Oct 26, 2023
3cbd263
Delete and regenerate rust client Cargo.lock after release downgrades…
danenbm Oct 26, 2023
32c9330
Merge pull request #57 from metaplex-foundation/danenbm/rust-client-c…
danenbm Oct 26, 2023
71a7f3b
Add update_metadata_collection_nft
danenbm Nov 14, 2023
cbbdff1
Regenerate clients
danenbm Nov 14, 2023
6f5c3e1
Regenerate Solita JS client
danenbm Nov 14, 2023
4eb4a0b
update Solita tests
danenbm Nov 14, 2023
71acb6b
Fix path to js test script
danenbm Nov 14, 2023
61a9a78
Remove signer req for tree delegate on update_metadata_collection_nft
danenbm Nov 15, 2023
9f64fbf
Regenerate Solita JS client
danenbm Nov 15, 2023
5016b42
Add tests for using correct ix based on if item is in collection
danenbm Nov 15, 2023
bbb552a
Combine update_metadata and update_metadata_collection_nft
danenbm Nov 15, 2023
64cca58
Regenerate JS and Rust clients
danenbm Nov 15, 2023
bc446d2
Regenerate Solita JS client
danenbm Nov 15, 2023
7bf1a47
Update Solita tests
danenbm Nov 16, 2023
0ee68cf
Removed unneeded instruction name
danenbm Nov 17, 2023
61b5627
Regenerate IDL
danenbm Nov 17, 2023
9fd3416
Merge pull request #59 from metaplex-foundation/danenbm/update-metada…
danenbm Nov 18, 2023
3cfd18e
Merge branch 'main' into danenbm/tm-client-crate
danenbm Dec 20, 2023
b551562
Merge pull request #61 from metaplex-foundation/danenbm/tm-client-crate
danenbm Dec 27, 2023
bc52ef7
Clean up README and add update_metadata
danenbm Dec 27, 2023
82bf192
Add updateArgs and fix links
danenbm Dec 27, 2023
9359b2e
Remove redundancies and clarify
danenbm Dec 27, 2023
3c45689
Merge pull request #63 from metaplex-foundation/danenbm/update-metada…
danenbm Dec 27, 2023
5a6c765
chore: Release mpl-bubblegum version 1.0.1-beta.4
danenbm Dec 29, 2023
80fea2c
Merge branch 'main' into update-metadata-staging
danenbm Jan 12, 2024
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
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

env:
CACHE: true
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ You will then have access to the following commands.
- `pnpm programs:test` - Runs BPF tests for all programs (logs disabled).
- `pnpm programs:debug` - Runs BPF tests for all programs.
- `pnpm programs:clean` - Deletes all generated program binaries.
- `clients:rust:test` - Runs BPF tests for the Rust client SDK.
- `clients:js:test` - Runs the JavaScript tests (you must first start the local validator `pnpm validator`).
- `pnpm clients:rust:test` - Runs BPF tests for the Rust client SDK.
- `pnpm clients:js:test` - Runs the JavaScript tests (you must first start the local validator `pnpm validator`).
- `pnpm generate` - Shortcut for `pnpm generate:idls && pnpm generate:clients`.
- `pnpm generate:idls` - Generate IDLs for all programs, as configured in the `configs/shank.cjs` file.
- `pnpm generate:clients` - Generate clients using Kinobi, as configured in the `configs/kinobi.cjs` file.
Expand Down
5 changes: 3 additions & 2 deletions clients/js-solita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"run-tests": "jest tests --detectOpenHandles",
"test": "start-server-and-test start-validator http://localhost:8899/health run-tests",
"api:gen": "DEBUG='(solita|rustbin):(info|error)' solita",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"lint": "eslint \"{src,tests}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
"prettier": "prettier \"{src,test}/**/*.ts\" --check",
"fix:prettier": "prettier --write src/",
Expand Down Expand Up @@ -54,12 +54,13 @@
"@metaplex-foundation/amman": "0.12.1",
"@metaplex-foundation/rustbin": "^0.3.5",
"@metaplex-foundation/solita": "0.20.0",
"@metaplex-foundation/js": "^0.19.4",
"@solana/spl-account-compression": "^0.1.4",
"@types/bn.js": "^5.1.1",
"@types/chai": "^4.3.0",
"@types/jest": "^29.1.1",
"@types/mocha": "^9.0.0",
"@types/tape": "^4.13.2",
"@types/bn.js": "^5.1.1",
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"chai": "^4.3.4",
Expand Down
129 changes: 129 additions & 0 deletions clients/js-solita/src/generated/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,135 @@ export class DecompressionDisabledError extends Error {
createErrorFromCodeLookup.set(0x1791, () => new DecompressionDisabledError());
createErrorFromNameLookup.set('DecompressionDisabled', () => new DecompressionDisabledError());

/**
* MissingCollectionMintAccount: 'Missing collection mint account'
*
* @category Errors
* @category generated
*/
export class MissingCollectionMintAccountError extends Error {
readonly code: number = 0x1792;
readonly name: string = 'MissingCollectionMintAccount';
constructor() {
super('Missing collection mint account');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, MissingCollectionMintAccountError);
}
}
}

createErrorFromCodeLookup.set(0x1792, () => new MissingCollectionMintAccountError());
createErrorFromNameLookup.set(
'MissingCollectionMintAccount',
() => new MissingCollectionMintAccountError(),
);

/**
* MissingCollectionMetadataAccount: 'Missing collection metadata account'
*
* @category Errors
* @category generated
*/
export class MissingCollectionMetadataAccountError extends Error {
readonly code: number = 0x1793;
readonly name: string = 'MissingCollectionMetadataAccount';
constructor() {
super('Missing collection metadata account');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, MissingCollectionMetadataAccountError);
}
}
}

createErrorFromCodeLookup.set(0x1793, () => new MissingCollectionMetadataAccountError());
createErrorFromNameLookup.set(
'MissingCollectionMetadataAccount',
() => new MissingCollectionMetadataAccountError(),
);

/**
* CollectionMismatch: 'Collection mismatch'
*
* @category Errors
* @category generated
*/
export class CollectionMismatchError extends Error {
readonly code: number = 0x1794;
readonly name: string = 'CollectionMismatch';
constructor() {
super('Collection mismatch');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, CollectionMismatchError);
}
}
}

createErrorFromCodeLookup.set(0x1794, () => new CollectionMismatchError());
createErrorFromNameLookup.set('CollectionMismatch', () => new CollectionMismatchError());

/**
* MetadataImmutable: 'Metadata not mutable'
*
* @category Errors
* @category generated
*/
export class MetadataImmutableError extends Error {
readonly code: number = 0x1795;
readonly name: string = 'MetadataImmutable';
constructor() {
super('Metadata not mutable');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, MetadataImmutableError);
}
}
}

createErrorFromCodeLookup.set(0x1795, () => new MetadataImmutableError());
createErrorFromNameLookup.set('MetadataImmutable', () => new MetadataImmutableError());

/**
* PrimarySaleCanOnlyBeFlippedToTrue: 'Can only update primary sale to true'
*
* @category Errors
* @category generated
*/
export class PrimarySaleCanOnlyBeFlippedToTrueError extends Error {
readonly code: number = 0x1796;
readonly name: string = 'PrimarySaleCanOnlyBeFlippedToTrue';
constructor() {
super('Can only update primary sale to true');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, PrimarySaleCanOnlyBeFlippedToTrueError);
}
}
}

createErrorFromCodeLookup.set(0x1796, () => new PrimarySaleCanOnlyBeFlippedToTrueError());
createErrorFromNameLookup.set(
'PrimarySaleCanOnlyBeFlippedToTrue',
() => new PrimarySaleCanOnlyBeFlippedToTrueError(),
);

/**
* CreatorDidNotUnverify: 'Creator did not unverify the metadata'
*
* @category Errors
* @category generated
*/
export class CreatorDidNotUnverifyError extends Error {
readonly code: number = 0x1797;
readonly name: string = 'CreatorDidNotUnverify';
constructor() {
super('Creator did not unverify the metadata');
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, CreatorDidNotUnverifyError);
}
}
}

createErrorFromCodeLookup.set(0x1797, () => new CreatorDidNotUnverifyError());
createErrorFromNameLookup.set('CreatorDidNotUnverify', () => new CreatorDidNotUnverifyError());

/**
* Attempts to resolve a custom program error from the provided error code.
* @category Errors
Expand Down
1 change: 1 addition & 0 deletions clients/js-solita/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export * from './setTreeDelegate';
export * from './transfer';
export * from './unverifyCollection';
export * from './unverifyCreator';
export * from './updateMetadata';
export * from './verifyCollection';
export * from './verifyCreator';
185 changes: 185 additions & 0 deletions clients/js-solita/src/generated/instructions/updateMetadata.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/**
* This code was GENERATED using the solita package.
* Please DO NOT EDIT THIS FILE, instead rerun solita to update it or write a wrapper to add functionality.
*
* See: https://github.com/metaplex-foundation/solita
*/

import * as beet from '@metaplex-foundation/beet';
import * as web3 from '@solana/web3.js';
import { MetadataArgs, metadataArgsBeet } from '../types/MetadataArgs';
import { UpdateArgs, updateArgsBeet } from '../types/UpdateArgs';

/**
* @category Instructions
* @category UpdateMetadata
* @category generated
*/
export type UpdateMetadataInstructionArgs = {
root: number[] /* size: 32 */;
nonce: beet.bignum;
index: number;
currentMetadata: MetadataArgs;
updateArgs: UpdateArgs;
};
/**
* @category Instructions
* @category UpdateMetadata
* @category generated
*/
export const updateMetadataStruct = new beet.FixableBeetArgsStruct<
UpdateMetadataInstructionArgs & {
instructionDiscriminator: number[] /* size: 8 */;
}
>(
[
['instructionDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['root', beet.uniformFixedSizeArray(beet.u8, 32)],
['nonce', beet.u64],
['index', beet.u32],
['currentMetadata', metadataArgsBeet],
['updateArgs', updateArgsBeet],
],
'UpdateMetadataInstructionArgs',
);
/**
* Accounts required by the _updateMetadata_ instruction
*
* @property [] treeAuthority
* @property [**signer**] authority
* @property [] collectionMint (optional)
* @property [] collectionMetadata (optional)
* @property [] collectionAuthorityRecordPda (optional)
* @property [] leafOwner
* @property [] leafDelegate
* @property [**signer**] payer
* @property [_writable_] merkleTree
* @property [] logWrapper
* @property [] compressionProgram
* @property [] tokenMetadataProgram
* @category Instructions
* @category UpdateMetadata
* @category generated
*/
export type UpdateMetadataInstructionAccounts = {
treeAuthority: web3.PublicKey;
authority: web3.PublicKey;
collectionMint?: web3.PublicKey;
collectionMetadata?: web3.PublicKey;
collectionAuthorityRecordPda?: web3.PublicKey;
leafOwner: web3.PublicKey;
leafDelegate: web3.PublicKey;
payer: web3.PublicKey;
merkleTree: web3.PublicKey;
logWrapper: web3.PublicKey;
compressionProgram: web3.PublicKey;
tokenMetadataProgram: web3.PublicKey;
systemProgram?: web3.PublicKey;
anchorRemainingAccounts?: web3.AccountMeta[];
};

export const updateMetadataInstructionDiscriminator = [170, 182, 43, 239, 97, 78, 225, 186];

/**
* Creates a _UpdateMetadata_ instruction.
*
* Optional accounts that are not provided default to the program ID since
* this was indicated in the IDL from which this instruction was generated.
*
* @param accounts that will be accessed while the instruction is processed
* @param args to provide as instruction data to the program
*
* @category Instructions
* @category UpdateMetadata
* @category generated
*/
export function createUpdateMetadataInstruction(
accounts: UpdateMetadataInstructionAccounts,
args: UpdateMetadataInstructionArgs,
programId = new web3.PublicKey('BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY'),
) {
const [data] = updateMetadataStruct.serialize({
instructionDiscriminator: updateMetadataInstructionDiscriminator,
...args,
});
const keys: web3.AccountMeta[] = [
{
pubkey: accounts.treeAuthority,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.authority,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.collectionMint ?? programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionMetadata ?? programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.collectionAuthorityRecordPda ?? programId,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.leafOwner,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.leafDelegate,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.payer,
isWritable: false,
isSigner: true,
},
{
pubkey: accounts.merkleTree,
isWritable: true,
isSigner: false,
},
{
pubkey: accounts.logWrapper,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.compressionProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.tokenMetadataProgram,
isWritable: false,
isSigner: false,
},
{
pubkey: accounts.systemProgram ?? web3.SystemProgram.programId,
isWritable: false,
isSigner: false,
},
];

if (accounts.anchorRemainingAccounts != null) {
for (const acc of accounts.anchorRemainingAccounts) {
keys.push(acc);
}
}

const ix = new web3.TransactionInstruction({
programId,
keys,
data,
});
return ix;
}
Loading
Loading