generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from samwise2/samwise2/updatable-metadata
Updatable Metadata
- Loading branch information
Showing
22 changed files
with
4,257 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
171 changes: 171 additions & 0 deletions
171
clients/js-solita/src/generated/instructions/updateMetadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
/** | ||
* 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: beet.COption<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', beet.coption(metadataArgsBeet)], | ||
['updateArgs', updateArgsBeet], | ||
], | ||
'UpdateMetadataInstructionArgs', | ||
); | ||
/** | ||
* Accounts required by the _updateMetadata_ instruction | ||
* | ||
* @property [] metadataBuffer (optional) | ||
* @property [] treeAuthority | ||
* @property [**signer**] treeDelegate | ||
* @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 = { | ||
metadataBuffer?: web3.PublicKey; | ||
treeAuthority: web3.PublicKey; | ||
treeDelegate: 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.metadataBuffer ?? programId, | ||
isWritable: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
pubkey: accounts.treeAuthority, | ||
isWritable: false, | ||
isSigner: false, | ||
}, | ||
{ | ||
pubkey: accounts.treeDelegate, | ||
isWritable: false, | ||
isSigner: true, | ||
}, | ||
{ | ||
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; | ||
} |
Oops, something went wrong.