diff --git a/clients/js/src/generated/instructions/create.ts b/clients/js/src/generated/instructions/create.ts index 5083e8c2..e1a6ab3e 100644 --- a/clients/js/src/generated/instructions/create.ts +++ b/clients/js/src/generated/instructions/create.ts @@ -69,7 +69,7 @@ export type CreateInstructionDataArgs = { dataState: DataStateArgs; name: string; uri: string; - plugins: Array; + plugins?: Array; }; export function getCreateInstructionDataSerializer(): Serializer< @@ -87,7 +87,7 @@ export function getCreateInstructionDataSerializer(): Serializer< ], { description: 'CreateInstructionData' } ), - (value) => ({ ...value, discriminator: 0 }) + (value) => ({ ...value, discriminator: 0, plugins: value.plugins ?? [] }) ) as Serializer; } diff --git a/clients/js/src/generated/instructions/createCollection.ts b/clients/js/src/generated/instructions/createCollection.ts index a17c064b..0c6b48bd 100644 --- a/clients/js/src/generated/instructions/createCollection.ts +++ b/clients/js/src/generated/instructions/createCollection.ts @@ -56,7 +56,7 @@ export type CreateCollectionInstructionData = { export type CreateCollectionInstructionDataArgs = { name: string; uri: string; - plugins: Array; + plugins?: Array; }; export function getCreateCollectionInstructionDataSerializer(): Serializer< @@ -77,7 +77,7 @@ export function getCreateCollectionInstructionDataSerializer(): Serializer< ], { description: 'CreateCollectionInstructionData' } ), - (value) => ({ ...value, discriminator: 1 }) + (value) => ({ ...value, discriminator: 1, plugins: value.plugins ?? [] }) ) as Serializer< CreateCollectionInstructionDataArgs, CreateCollectionInstructionData diff --git a/clients/js/src/hooked/types.ts b/clients/js/src/hooked/types.ts index c6b002a6..e616282a 100644 --- a/clients/js/src/hooked/types.ts +++ b/clients/js/src/hooked/types.ts @@ -17,7 +17,7 @@ export type BaseAuthority = { address?: PublicKey; }; -export type PluginAuthorityType = Pick['__kind']; +export type PluginAuthorityType = Authority['__kind']; export type BasePlugin = { authority: BaseAuthority; diff --git a/clients/js/test/_setup.ts b/clients/js/test/_setup.ts index eb12243d..02d4a641 100644 --- a/clients/js/test/_setup.ts +++ b/clients/js/test/_setup.ts @@ -49,7 +49,7 @@ export const DEFAULT_COLLECTION = { uri: 'https://example.com/collection', }; -export const createAsset = async (umi: Umi, input: CreateAssetHelperArgs) => { +export const createAsset = async (umi: Umi, input: CreateAssetHelperArgs = {}) => { const payer = input.payer || umi.identity; const owner = publicKey(input.owner || input.payer || umi.identity); const asset = input.asset || generateSigner(umi); diff --git a/clients/js/test/addPlugin.test.ts b/clients/js/test/addPlugin.test.ts index 43720f7f..919b97d9 100644 --- a/clients/js/test/addPlugin.test.ts +++ b/clients/js/test/addPlugin.test.ts @@ -23,7 +23,7 @@ test('it can add a plugin to an asset', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); // Then an account was created with the correct data. await assertAsset(t, umi, { @@ -57,7 +57,7 @@ test('it can add a plugin to an asset with a different authority than the defaul const umi = await createUmi(); const delegateAddress = generateSigner(umi); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await assertAsset(t, umi, { ...DEFAULT_ASSET, diff --git a/clients/js/test/approveAuthority.test.ts b/clients/js/test/approveAuthority.test.ts index a58e6225..1b3ebcb8 100644 --- a/clients/js/test/approveAuthority.test.ts +++ b/clients/js/test/approveAuthority.test.ts @@ -15,7 +15,7 @@ test('it can add an authority to a plugin', async (t) => { const umi = await createUmi(); const delegateAddress = generateSigner(umi); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await assertAsset(t, umi, { asset: asset.publicKey, diff --git a/clients/js/test/burn.test.ts b/clients/js/test/burn.test.ts index f5213783..8ce370d7 100644 --- a/clients/js/test/burn.test.ts +++ b/clients/js/test/burn.test.ts @@ -11,7 +11,7 @@ import { DEFAULT_ASSET, assertAsset, createAsset, createUmi } from './_setup'; test('it can burn an asset as the owner', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, @@ -37,7 +37,7 @@ test('it cannot burn an asset if not the owner', async (t) => { const umi = await createUmi(); const attacker = generateSigner(umi); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await assertAsset(t, umi, { ...DEFAULT_ASSET, asset: asset.publicKey, diff --git a/clients/js/test/collect.test.ts b/clients/js/test/collect.test.ts index 03fcb9f6..c2e4c617 100644 --- a/clients/js/test/collect.test.ts +++ b/clients/js/test/collect.test.ts @@ -17,7 +17,7 @@ const hasCollectAmount = async (umi: Umi, address: PublicKey) => { test('it can create a new asset with collect amount', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); t.assert( await hasCollectAmount(umi, asset.publicKey), @@ -28,7 +28,7 @@ test('it can create a new asset with collect amount', async (t) => { test('it can add asset plugin with collect amount', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await addPlugin(umi, { asset: asset.publicKey, diff --git a/clients/js/test/compress.test.ts b/clients/js/test/compress.test.ts index 34cfe894..eddf9dd7 100644 --- a/clients/js/test/compress.test.ts +++ b/clients/js/test/compress.test.ts @@ -18,7 +18,7 @@ import { createAsset, createUmi } from './_setup'; test.skip('it can compress an asset without any plugins as the owner', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); // And when we compress the asset. await compress(umi, { @@ -56,7 +56,6 @@ test.skip('it cannot compress an asset if not the owner', async (t) => { asset: assetAddress, name: 'Test Bread', uri: 'https://example.com/bread', - plugins: [], }).sendAndConfirm(umi); // Then an account was created with the correct data. @@ -99,7 +98,6 @@ test('it cannot compress an asset because it is not available', async (t) => { asset: assetAddress, name: 'Test Bread', uri: 'https://example.com/bread', - plugins: [], }).sendAndConfirm(umi); // Then an account was created with the correct data. diff --git a/clients/js/test/create.test.ts b/clients/js/test/create.test.ts index c9fb0fcf..451ffc39 100644 --- a/clients/js/test/create.test.ts +++ b/clients/js/test/create.test.ts @@ -41,7 +41,6 @@ test('it can create a new asset with a different payer', async (t) => { dataState: DataState.AccountState, asset: assetAddress, payer, - plugins: [], }).sendAndConfirm(umi); const asset = await createAsset(umi, { @@ -69,7 +68,6 @@ test.skip('it can create a new asset in ledger state', async (t) => { name: 'Test Bread', uri: 'https://example.com/bread', logWrapper: publicKey('noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV'), - plugins: [], }).sendAndConfirm(umi); // Then an account was created with the correct data. @@ -107,7 +105,6 @@ test('it cannot create a new asset in ledger state because it is not available', name: 'Test Bread', uri: 'https://example.com/bread', logWrapper: publicKey('noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV'), - plugins: [], }).sendAndConfirm(umi); await t.throwsAsync(result, { name: 'NotAvailable' }); @@ -208,7 +205,6 @@ test('it cannot create a new asset if the address is already in use', async (t) asset: assetAddress, name: DEFAULT_ASSET.name, uri: DEFAULT_ASSET.uri, - plugins: [], }).sendAndConfirm(umi); await t.throwsAsync(result, { name: 'InvalidSystemProgram' }); diff --git a/clients/js/test/decompress.test.ts b/clients/js/test/decompress.test.ts index 82e6a65e..51c5074d 100644 --- a/clients/js/test/decompress.test.ts +++ b/clients/js/test/decompress.test.ts @@ -27,7 +27,6 @@ test.skip('it can decompress a previously compressed asset as the owner', async asset: assetAddress, name: 'Test Bread', uri: 'https://example.com/bread', - plugins: [], }).sendAndConfirm(umi); // Then an account was created with the correct data. diff --git a/clients/js/test/info.test.ts b/clients/js/test/info.test.ts index 6004209d..eca9b50d 100644 --- a/clients/js/test/info.test.ts +++ b/clients/js/test/info.test.ts @@ -14,7 +14,6 @@ test('fetch account info for account state', async (t) => { asset: assetAddress, name: 'Test Bread', uri: 'https://example.com/bread', - plugins: [], }).sendAndConfirm(umi); // Print the size of the account. @@ -42,7 +41,6 @@ test.skip('fetch account info for ledger state', async (t) => { name: 'Test Bread', uri: 'https://example.com/bread', logWrapper: publicKey('noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV'), - plugins: [], }).sendAndConfirm(umi); // Print the size of the account. diff --git a/clients/js/test/plugins/asset/freeze.test.ts b/clients/js/test/plugins/asset/freeze.test.ts index f7d98db9..e52ffaee 100644 --- a/clients/js/test/plugins/asset/freeze.test.ts +++ b/clients/js/test/plugins/asset/freeze.test.ts @@ -11,7 +11,7 @@ test('it can freeze and unfreeze an asset', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const asset = await createAsset(umi, {}); + const asset = await createAsset(umi); await addPlugin(umi, { asset: asset.publicKey, diff --git a/clients/js/test/plugins/asset/royalties.test.ts b/clients/js/test/plugins/asset/royalties.test.ts index 502021c9..fb458aeb 100644 --- a/clients/js/test/plugins/asset/royalties.test.ts +++ b/clients/js/test/plugins/asset/royalties.test.ts @@ -37,7 +37,7 @@ test('it can transfer an asset with royalties', async (t) => { }); // Here we're creating a new owner that's program owned, so we're just going to use another asset. - const programOwned = await createAsset(umi, {}); + const programOwned = await createAsset(umi); // Then an account was created with the correct data. await assertAsset(t, umi, { @@ -87,7 +87,7 @@ test('it can transfer an asset with royalties to an allowlisted program address' }); // Here we're creating a new owner that's program owned, so we're just going to use another asset. - const programOwned = await createAsset(umi, {}); + const programOwned = await createAsset(umi); // Then an account was created with the correct data. await assertAsset(t, umi, { @@ -128,7 +128,7 @@ test('it cannot transfer an asset with royalties to a program address not on the }); // Create a second one because allowlist needs both to be off the allowlist. - const programOwned2 = await createAsset(umi, {}); + const programOwned2 = await createAsset(umi); // Creating a new asset to transfer. const asset = await createAsset(umi, { @@ -172,7 +172,7 @@ test('it can transfer an asset with royalties to a program address not on the de const umi = await createUmi(); // Here we're creating a new owner that's program owned, so we're just going to use another asset. - const programOwned = await createAsset(umi, {}); + const programOwned = await createAsset(umi); // Creating a new asset to transfer. const asset = await createAsset(umi, { @@ -214,7 +214,7 @@ test('it cannot transfer an asset with royalties to a denylisted program', async const umi = await createUmi(); // Here we're creating a new owner that's program owned, so we're just going to use another asset. - const programOwned = await createAsset(umi, {}); + const programOwned = await createAsset(umi); // Creating a new asset to transfer. const asset = await createAsset(umi, { diff --git a/clients/js/test/transfer.test.ts b/clients/js/test/transfer.test.ts index 763621e1..688d3b69 100644 --- a/clients/js/test/transfer.test.ts +++ b/clients/js/test/transfer.test.ts @@ -1,102 +1,55 @@ import { generateSigner } from '@metaplex-foundation/umi'; import test from 'ava'; -// import { base58 } from '@metaplex-foundation/umi/serializers'; + import { - Asset, - DataState, - create, - fetchAsset, transfer, updateAuthority, } from '../src'; -import { createUmi } from './_setup'; +import { assertAsset, createAsset, createUmi } from './_setup'; test('it can transfer an asset as the owner', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); const newOwner = generateSigner(umi); - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); - - // Then an account was created with the correct data. - const beforeAsset = await fetchAsset(umi, assetAddress.publicKey); - // console.log("Account State:", beforeAsset); - t.like(beforeAsset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + const asset = await createAsset(umi) + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, - name: 'Test Bread', - uri: 'https://example.com/bread', + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), }); await transfer(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newOwner: newOwner.publicKey, - compressionProof: null, }).sendAndConfirm(umi); - const afterAsset = await fetchAsset(umi, assetAddress.publicKey); - // console.log("Account State:", afterAsset); - t.like(afterAsset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: newOwner.publicKey, - name: 'Test Bread', - uri: 'https://example.com/bread', + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), }); }); test('it cannot transfer an asset if not the owner', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); const newOwner = generateSigner(umi); const attacker = generateSigner(umi); - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); - - // Then an account was created with the correct data. - const beforeAsset = await fetchAsset(umi, assetAddress.publicKey); - // console.log("Account State:", beforeAsset); - t.like(beforeAsset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), - owner: umi.identity.publicKey, - name: 'Test Bread', - uri: 'https://example.com/bread', - }); + const asset = await createAsset(umi) const result = transfer(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newOwner: newOwner.publicKey, - compressionProof: null, authority: attacker, }).sendAndConfirm(umi); await t.throwsAsync(result, { name: 'InvalidAuthority' }); - const afterAsset = await fetchAsset(umi, assetAddress.publicKey); - // console.log("Account State:", afterAsset); - t.like(afterAsset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, - name: 'Test Bread', - uri: 'https://example.com/bread', + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), }); }); diff --git a/clients/js/test/update.test.ts b/clients/js/test/update.test.ts index 4fff1841..7d78cd44 100644 --- a/clients/js/test/update.test.ts +++ b/clients/js/test/update.test.ts @@ -1,46 +1,27 @@ -import { generateSigner } from '@metaplex-foundation/umi'; import test from 'ava'; -// import { base58 } from '@metaplex-foundation/umi/serializers'; + import { - AssetWithPlugins, - DataState, - Key, - addPlugin, - create, - fetchAssetWithPlugins, update, updateAuthority, plugin, - formPluginHeader, } from '../src'; -import { createUmi } from './_setup'; +import { assertAsset, createAsset, createUmi } from './_setup'; test('it can update an asset to be larger', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); - - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); + const asset = await createAsset(umi); await update(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newName: 'Test Bread 2', newUri: 'https://example.com/bread2', }).sendAndConfirm(umi); - // Then an account was created with the correct data. - const asset = await fetchAssetWithPlugins(umi, assetAddress.publicKey); - t.like(asset, { - key: Key.Asset, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), name: 'Test Bread 2', uri: 'https://example.com/bread2', }); @@ -49,29 +30,18 @@ test('it can update an asset to be larger', async (t) => { test('it can update an asset to be smaller', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); - - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); + const asset = await createAsset(umi); await update(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newName: '', newUri: '', }).sendAndConfirm(umi); - // Then an account was created with the correct data. - const asset = await fetchAssetWithPlugins(umi, assetAddress.publicKey); - t.like(asset, { - key: Key.Asset, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), name: '', uri: '', }); @@ -80,44 +50,40 @@ test('it can update an asset to be smaller', async (t) => { test('it can update an asset with plugins to be larger', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); - - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); + const asset = await createAsset(umi, { + name: 'short', + uri: 'https://short.com', + plugins: [{ + plugin: plugin('Freeze', [{ frozen: false }]), + authority: null, + }], + }); - await addPlugin(umi, { - asset: assetAddress.publicKey, - plugin: plugin('Freeze', [{ frozen: false }]), - initAuthority: null, - }).sendAndConfirm(umi); + // const asset = await createAsset(umi, { + // name: 'Test Bread', + // uri: 'https://example.com/bread', + // plugins: [{ + // plugin: plugin('Freeze', [{ frozen: false }]), + // authority: null, + // }], + // }); await update(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newName: 'Test Bread 2', newUri: 'https://example.com/bread2', }).sendAndConfirm(umi); - // Then an account was created with the correct data. - const asset = await fetchAssetWithPlugins(umi, assetAddress.publicKey); - // console.log(JSON.stringify(asset, (_, v) => typeof v === 'bigint' ? v.toString() : v, 2)); - t.like(asset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), name: 'Test Bread 2', uri: 'https://example.com/bread2', - pluginHeader: formPluginHeader(BigInt(124)), freeze: { authority: { type: 'Owner', }, - offset: BigInt(122), frozen: false, }, }); @@ -126,43 +92,31 @@ test('it can update an asset with plugins to be larger', async (t) => { test('it can update an asset with plugins to be smaller', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); - const assetAddress = generateSigner(umi); - - // When we create a new account. - await create(umi, { - dataState: DataState.AccountState, - asset: assetAddress, - name: 'Test Bread', - uri: 'https://example.com/bread', - plugins: [], - }).sendAndConfirm(umi); - - await addPlugin(umi, { - asset: assetAddress.publicKey, - plugin: plugin('Freeze', [{ frozen: false }]), - initAuthority: null, - }).sendAndConfirm(umi); + const asset = await createAsset(umi, { + name: 'Test Bread 2', + uri: 'https://example.com/bread2', + plugins: [{ + plugin: plugin('Freeze', [{ frozen: false }]), + authority: null, + }], + }); await update(umi, { - asset: assetAddress.publicKey, + asset: asset.publicKey, newName: '', newUri: '', }).sendAndConfirm(umi); - // Then an account was created with the correct data. - const asset = await fetchAssetWithPlugins(umi, assetAddress.publicKey); - t.like(asset, { - publicKey: assetAddress.publicKey, - updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), + await assertAsset(t, umi, { + asset: asset.publicKey, owner: umi.identity.publicKey, + updateAuthority: updateAuthority('Address', [umi.identity.publicKey]), name: '', uri: '', - pluginHeader: formPluginHeader(BigInt(86)), freeze: { authority: { type: 'Owner', }, - offset: BigInt(84), frozen: false, }, }); diff --git a/clients/rust/src/generated/instructions/create.rs b/clients/rust/src/generated/instructions/create.rs index 48a272a0..fe65c356 100644 --- a/clients/rust/src/generated/instructions/create.rs +++ b/clients/rust/src/generated/instructions/create.rs @@ -247,6 +247,7 @@ impl CreateBuilder { self.uri = Some(uri); self } + /// `[optional argument, defaults to '[]']` #[inline(always)] pub fn plugins(&mut self, plugins: Vec) -> &mut Self { self.plugins = Some(plugins); @@ -288,7 +289,7 @@ impl CreateBuilder { data_state: self.data_state.clone().expect("data_state is not set"), name: self.name.clone().expect("name is not set"), uri: self.uri.clone().expect("uri is not set"), - plugins: self.plugins.clone().expect("plugins is not set"), + plugins: self.plugins.clone().unwrap_or([]), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -628,6 +629,7 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { self.instruction.uri = Some(uri); self } + /// `[optional argument, defaults to '[]']` #[inline(always)] pub fn plugins(&mut self, plugins: Vec) -> &mut Self { self.instruction.plugins = Some(plugins); @@ -682,11 +684,7 @@ impl<'a, 'b> CreateCpiBuilder<'a, 'b> { .expect("data_state is not set"), name: self.instruction.name.clone().expect("name is not set"), uri: self.instruction.uri.clone().expect("uri is not set"), - plugins: self - .instruction - .plugins - .clone() - .expect("plugins is not set"), + plugins: self.instruction.plugins.clone().unwrap_or([]), }; let instruction = CreateCpi { __program: self.instruction.__program, diff --git a/clients/rust/src/generated/instructions/create_collection.rs b/clients/rust/src/generated/instructions/create_collection.rs index 29bf177a..61b0c5e1 100644 --- a/clients/rust/src/generated/instructions/create_collection.rs +++ b/clients/rust/src/generated/instructions/create_collection.rs @@ -152,6 +152,7 @@ impl CreateCollectionBuilder { self.uri = Some(uri); self } + /// `[optional argument, defaults to '[]']` #[inline(always)] pub fn plugins(&mut self, plugins: Vec) -> &mut Self { self.plugins = Some(plugins); @@ -188,7 +189,7 @@ impl CreateCollectionBuilder { let args = CreateCollectionInstructionArgs { name: self.name.clone().expect("name is not set"), uri: self.uri.clone().expect("uri is not set"), - plugins: self.plugins.clone().expect("plugins is not set"), + plugins: self.plugins.clone().unwrap_or([]), }; accounts.instruction_with_remaining_accounts(args, &self.__remaining_accounts) @@ -402,6 +403,7 @@ impl<'a, 'b> CreateCollectionCpiBuilder<'a, 'b> { self.instruction.uri = Some(uri); self } + /// `[optional argument, defaults to '[]']` #[inline(always)] pub fn plugins(&mut self, plugins: Vec) -> &mut Self { self.instruction.plugins = Some(plugins); @@ -451,11 +453,7 @@ impl<'a, 'b> CreateCollectionCpiBuilder<'a, 'b> { let args = CreateCollectionInstructionArgs { name: self.instruction.name.clone().expect("name is not set"), uri: self.instruction.uri.clone().expect("uri is not set"), - plugins: self - .instruction - .plugins - .clone() - .expect("plugins is not set"), + plugins: self.instruction.plugins.clone().unwrap_or([]), }; let instruction = CreateCollectionCpi { __program: self.instruction.__program, diff --git a/configs/kinobi.cjs b/configs/kinobi.cjs index 5bc853f3..a96d6518 100755 --- a/configs/kinobi.cjs +++ b/configs/kinobi.cjs @@ -78,6 +78,21 @@ kinobi.update( defaultValue: k.noneValueNode() } } + }, + create: { + arguments: { + plugins: { + defaultValue: k.arrayValueNode([]) + } + } + }, + createCollection: { + arguments: { + plugins: { + defaultValue: k.arrayValueNode([]) + + } + } } }) );