generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
5,459 additions
and
806 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
170 changes: 170 additions & 0 deletions
170
clients/js/src/generated/instructions/updateCollectionPluginV2.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,170 @@ | ||
/** | ||
* 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 { | ||
Context, | ||
Option, | ||
OptionOrNullable, | ||
Pda, | ||
PublicKey, | ||
Signer, | ||
TransactionBuilder, | ||
transactionBuilder, | ||
} from '@metaplex-foundation/umi'; | ||
import { | ||
Serializer, | ||
mapSerializer, | ||
option, | ||
struct, | ||
u8, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
import { | ||
ResolvedAccount, | ||
ResolvedAccountsWithIndices, | ||
getAccountMetasAndSigners, | ||
} from '../shared'; | ||
import { Plugin, PluginArgs, getPluginSerializer } from '../types'; | ||
|
||
// Accounts. | ||
export type UpdateCollectionPluginV2InstructionAccounts = { | ||
/** The address of the asset */ | ||
collection: PublicKey | Pda; | ||
/** The account paying for the storage fees */ | ||
payer?: Signer; | ||
/** The owner or delegate of the asset */ | ||
authority?: Signer; | ||
/** The system program */ | ||
systemProgram?: PublicKey | Pda; | ||
/** The SPL Noop Program */ | ||
logWrapper?: PublicKey | Pda; | ||
/** Optional buffer account containing plugin data */ | ||
bufferAccount?: PublicKey | Pda; | ||
}; | ||
|
||
// Data. | ||
export type UpdateCollectionPluginV2InstructionData = { | ||
discriminator: number; | ||
plugin: Option<Plugin>; | ||
}; | ||
|
||
export type UpdateCollectionPluginV2InstructionDataArgs = { | ||
plugin: OptionOrNullable<PluginArgs>; | ||
}; | ||
|
||
export function getUpdateCollectionPluginV2InstructionDataSerializer(): Serializer< | ||
UpdateCollectionPluginV2InstructionDataArgs, | ||
UpdateCollectionPluginV2InstructionData | ||
> { | ||
return mapSerializer< | ||
UpdateCollectionPluginV2InstructionDataArgs, | ||
any, | ||
UpdateCollectionPluginV2InstructionData | ||
>( | ||
struct<UpdateCollectionPluginV2InstructionData>( | ||
[ | ||
['discriminator', u8()], | ||
['plugin', option(getPluginSerializer())], | ||
], | ||
{ description: 'UpdateCollectionPluginV2InstructionData' } | ||
), | ||
(value) => ({ ...value, discriminator: 21 }) | ||
) as Serializer< | ||
UpdateCollectionPluginV2InstructionDataArgs, | ||
UpdateCollectionPluginV2InstructionData | ||
>; | ||
} | ||
|
||
// Args. | ||
export type UpdateCollectionPluginV2InstructionArgs = | ||
UpdateCollectionPluginV2InstructionDataArgs; | ||
|
||
// Instruction. | ||
export function updateCollectionPluginV2( | ||
context: Pick<Context, 'payer' | 'programs'>, | ||
input: UpdateCollectionPluginV2InstructionAccounts & | ||
UpdateCollectionPluginV2InstructionArgs | ||
): TransactionBuilder { | ||
// Program ID. | ||
const programId = context.programs.getPublicKey( | ||
'mplCore', | ||
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' | ||
); | ||
|
||
// Accounts. | ||
const resolvedAccounts = { | ||
collection: { | ||
index: 0, | ||
isWritable: true as boolean, | ||
value: input.collection ?? null, | ||
}, | ||
payer: { | ||
index: 1, | ||
isWritable: true as boolean, | ||
value: input.payer ?? null, | ||
}, | ||
authority: { | ||
index: 2, | ||
isWritable: false as boolean, | ||
value: input.authority ?? null, | ||
}, | ||
systemProgram: { | ||
index: 3, | ||
isWritable: false as boolean, | ||
value: input.systemProgram ?? null, | ||
}, | ||
logWrapper: { | ||
index: 4, | ||
isWritable: false as boolean, | ||
value: input.logWrapper ?? null, | ||
}, | ||
bufferAccount: { | ||
index: 5, | ||
isWritable: false as boolean, | ||
value: input.bufferAccount ?? null, | ||
}, | ||
} satisfies ResolvedAccountsWithIndices; | ||
|
||
// Arguments. | ||
const resolvedArgs: UpdateCollectionPluginV2InstructionArgs = { ...input }; | ||
|
||
// Default values. | ||
if (!resolvedAccounts.payer.value) { | ||
resolvedAccounts.payer.value = context.payer; | ||
} | ||
if (!resolvedAccounts.systemProgram.value) { | ||
resolvedAccounts.systemProgram.value = context.programs.getPublicKey( | ||
'splSystem', | ||
'11111111111111111111111111111111' | ||
); | ||
resolvedAccounts.systemProgram.isWritable = false; | ||
} | ||
|
||
// Accounts in order. | ||
const orderedAccounts: ResolvedAccount[] = Object.values( | ||
resolvedAccounts | ||
).sort((a, b) => a.index - b.index); | ||
|
||
// Keys and Signers. | ||
const [keys, signers] = getAccountMetasAndSigners( | ||
orderedAccounts, | ||
'programId', | ||
programId | ||
); | ||
|
||
// Data. | ||
const data = getUpdateCollectionPluginV2InstructionDataSerializer().serialize( | ||
resolvedArgs as UpdateCollectionPluginV2InstructionDataArgs | ||
); | ||
|
||
// Bytes Created On Chain. | ||
const bytesCreatedOnChain = 0; | ||
|
||
return transactionBuilder([ | ||
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, | ||
]); | ||
} |
175 changes: 175 additions & 0 deletions
175
clients/js/src/generated/instructions/updatePluginV2.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,175 @@ | ||
/** | ||
* 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 { | ||
Context, | ||
Option, | ||
OptionOrNullable, | ||
Pda, | ||
PublicKey, | ||
Signer, | ||
TransactionBuilder, | ||
transactionBuilder, | ||
} from '@metaplex-foundation/umi'; | ||
import { | ||
Serializer, | ||
mapSerializer, | ||
option, | ||
struct, | ||
u8, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
import { | ||
ResolvedAccount, | ||
ResolvedAccountsWithIndices, | ||
getAccountMetasAndSigners, | ||
} from '../shared'; | ||
import { Plugin, PluginArgs, getPluginSerializer } from '../types'; | ||
|
||
// Accounts. | ||
export type UpdatePluginV2InstructionAccounts = { | ||
/** The address of the asset */ | ||
asset: PublicKey | Pda; | ||
/** The collection to which the asset belongs */ | ||
collection?: PublicKey | Pda; | ||
/** The account paying for the storage fees */ | ||
payer?: Signer; | ||
/** The owner or delegate of the asset */ | ||
authority?: Signer; | ||
/** The system program */ | ||
systemProgram?: PublicKey | Pda; | ||
/** The SPL Noop Program */ | ||
logWrapper?: PublicKey | Pda; | ||
/** Optional buffer account containing plugin data */ | ||
bufferAccount?: PublicKey | Pda; | ||
}; | ||
|
||
// Data. | ||
export type UpdatePluginV2InstructionData = { | ||
discriminator: number; | ||
plugin: Option<Plugin>; | ||
}; | ||
|
||
export type UpdatePluginV2InstructionDataArgs = { | ||
plugin: OptionOrNullable<PluginArgs>; | ||
}; | ||
|
||
export function getUpdatePluginV2InstructionDataSerializer(): Serializer< | ||
UpdatePluginV2InstructionDataArgs, | ||
UpdatePluginV2InstructionData | ||
> { | ||
return mapSerializer< | ||
UpdatePluginV2InstructionDataArgs, | ||
any, | ||
UpdatePluginV2InstructionData | ||
>( | ||
struct<UpdatePluginV2InstructionData>( | ||
[ | ||
['discriminator', u8()], | ||
['plugin', option(getPluginSerializer())], | ||
], | ||
{ description: 'UpdatePluginV2InstructionData' } | ||
), | ||
(value) => ({ ...value, discriminator: 20 }) | ||
) as Serializer< | ||
UpdatePluginV2InstructionDataArgs, | ||
UpdatePluginV2InstructionData | ||
>; | ||
} | ||
|
||
// Args. | ||
export type UpdatePluginV2InstructionArgs = UpdatePluginV2InstructionDataArgs; | ||
|
||
// Instruction. | ||
export function updatePluginV2( | ||
context: Pick<Context, 'payer' | 'programs'>, | ||
input: UpdatePluginV2InstructionAccounts & UpdatePluginV2InstructionArgs | ||
): TransactionBuilder { | ||
// Program ID. | ||
const programId = context.programs.getPublicKey( | ||
'mplCore', | ||
'CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d' | ||
); | ||
|
||
// Accounts. | ||
const resolvedAccounts = { | ||
asset: { | ||
index: 0, | ||
isWritable: true as boolean, | ||
value: input.asset ?? null, | ||
}, | ||
collection: { | ||
index: 1, | ||
isWritable: true as boolean, | ||
value: input.collection ?? null, | ||
}, | ||
payer: { | ||
index: 2, | ||
isWritable: true as boolean, | ||
value: input.payer ?? null, | ||
}, | ||
authority: { | ||
index: 3, | ||
isWritable: false as boolean, | ||
value: input.authority ?? null, | ||
}, | ||
systemProgram: { | ||
index: 4, | ||
isWritable: false as boolean, | ||
value: input.systemProgram ?? null, | ||
}, | ||
logWrapper: { | ||
index: 5, | ||
isWritable: false as boolean, | ||
value: input.logWrapper ?? null, | ||
}, | ||
bufferAccount: { | ||
index: 6, | ||
isWritable: false as boolean, | ||
value: input.bufferAccount ?? null, | ||
}, | ||
} satisfies ResolvedAccountsWithIndices; | ||
|
||
// Arguments. | ||
const resolvedArgs: UpdatePluginV2InstructionArgs = { ...input }; | ||
|
||
// Default values. | ||
if (!resolvedAccounts.payer.value) { | ||
resolvedAccounts.payer.value = context.payer; | ||
} | ||
if (!resolvedAccounts.systemProgram.value) { | ||
resolvedAccounts.systemProgram.value = context.programs.getPublicKey( | ||
'splSystem', | ||
'11111111111111111111111111111111' | ||
); | ||
resolvedAccounts.systemProgram.isWritable = false; | ||
} | ||
|
||
// Accounts in order. | ||
const orderedAccounts: ResolvedAccount[] = Object.values( | ||
resolvedAccounts | ||
).sort((a, b) => a.index - b.index); | ||
|
||
// Keys and Signers. | ||
const [keys, signers] = getAccountMetasAndSigners( | ||
orderedAccounts, | ||
'programId', | ||
programId | ||
); | ||
|
||
// Data. | ||
const data = getUpdatePluginV2InstructionDataSerializer().serialize( | ||
resolvedArgs as UpdatePluginV2InstructionDataArgs | ||
); | ||
|
||
// Bytes Created On Chain. | ||
const bytesCreatedOnChain = 0; | ||
|
||
return transactionBuilder([ | ||
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain }, | ||
]); | ||
} |
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
Oops, something went wrong.