diff --git a/clients/js/test/create.test.ts b/clients/js/test/create.test.ts index 5d4c2596..3405c9c9 100644 --- a/clients/js/test/create.test.ts +++ b/clients/js/test/create.test.ts @@ -1,6 +1,7 @@ -import { generateSigner, publicKey } from '@metaplex-foundation/umi'; +import { generateSigner, publicKey, sol } from '@metaplex-foundation/umi'; import test from 'ava'; // import { base58 } from '@metaplex-foundation/umi/serializers'; +import { generateSignerWithSol } from '@metaplex-foundation/umi-bundle-tests'; import { Asset, AssetWithPlugins, @@ -40,6 +41,35 @@ test('it can create a new asset in account state', async (t) => { }); }); +test('it can create a new asset with a different payer', async (t) => { + // Given a Umi instance and a new signer. + const umi = await createUmi(); + const payer = await generateSignerWithSol(umi, sol(1)); + const assetAddress = generateSigner(umi); + + // When we create a new account. + await create(umi, { + owner: umi.identity.publicKey, + payer, + dataState: DataState.AccountState, + assetAddress, + name: 'Test Bread', + uri: 'https://example.com/bread', + plugins: [], + }).sendAndConfirm(umi); + + // Then an account was created with the correct data. + const asset = await fetchAsset(umi, assetAddress.publicKey); + // console.log("Account State:", asset); + t.like(asset, { + publicKey: assetAddress.publicKey, + updateAuthority: updateAuthority("Address", [payer.publicKey]), + owner: umi.identity.publicKey, + name: 'Test Bread', + uri: 'https://example.com/bread', + }); +}); + test('it can create a new asset in ledger state', async (t) => { // Given a Umi instance and a new signer. const umi = await createUmi(); diff --git a/clients/js/test/plugins/collection/collectionUpdateDelegate.test.ts b/clients/js/test/plugins/collection/collectionUpdateDelegate.test.ts index acbc049e..8649667e 100644 --- a/clients/js/test/plugins/collection/collectionUpdateDelegate.test.ts +++ b/clients/js/test/plugins/collection/collectionUpdateDelegate.test.ts @@ -1,5 +1,6 @@ import { generateSigner } from '@metaplex-foundation/umi'; import test from 'ava'; +import { generateSignerWithSol } from '@metaplex-foundation/umi-bundle-tests'; import { AssetWithPlugins, CollectionWithPlugins, @@ -20,7 +21,7 @@ test('it can create a new asset with a collection if it is the collection update const umi = await createUmi(); const collectionAddress = generateSigner(umi); const assetAddress = generateSigner(umi); - const updateDelegate = generateSigner(umi); + const updateDelegate = await generateSignerWithSol(umi); // When we create a new account. await createCollection(umi, { @@ -90,8 +91,12 @@ test('it can create a new asset with a collection if it is the collection update ], }); + umi.identity = updateDelegate; + umi.payer = updateDelegate; + const owner = generateSigner(umi); // When we create a new account. await create(umi, { + owner: owner.publicKey, dataState: DataState.AccountState, assetAddress, name: 'Test Bread', @@ -107,7 +112,7 @@ test('it can create a new asset with a collection if it is the collection update updateAuthority: updateAuthority('Collection', [ collectionAddress.publicKey, ]), - owner: umi.identity.publicKey, + owner: owner.publicKey, name: 'Test Bread', uri: 'https://example.com/bread', pluginHeader: {