Skip to content

Commit

Permalink
Goodbye migrate, we hardly knew you.
Browse files Browse the repository at this point in the history
  • Loading branch information
blockiosaurus committed Feb 20, 2024
1 parent 1a3891d commit 0b21745
Show file tree
Hide file tree
Showing 23 changed files with 775 additions and 1,518 deletions.
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function getDelegateInstructionDataSerializer(): Serializer<
struct<DelegateInstructionData>([['discriminator', u8()]], {
description: 'DelegateInstructionData',
}),
(value) => ({ ...value, discriminator: 2 })
(value) => ({ ...value, discriminator: 1 })
) as Serializer<DelegateInstructionDataArgs, DelegateInstructionData>;
}

Expand Down
2 changes: 1 addition & 1 deletion clients/js/src/generated/instructions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export * from './create';
export * from './decompress';
export * from './delegate';
export * from './freeze';
export * from './migrate';
export * from './revoke';
export * from './thaw';
export * from './transfer';
export * from './update';
217 changes: 0 additions & 217 deletions clients/js/src/generated/instructions/migrate.ts

This file was deleted.

132 changes: 132 additions & 0 deletions clients/js/src/generated/instructions/revoke.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* 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,
Pda,
PublicKey,
Signer,
TransactionBuilder,
transactionBuilder,
} from '@metaplex-foundation/umi';
import {
Serializer,
mapSerializer,
struct,
u8,
} from '@metaplex-foundation/umi/serializers';
import {
ResolvedAccount,
ResolvedAccountsWithIndices,
getAccountMetasAndSigners,
} from '../shared';

// Accounts.
export type RevokeInstructionAccounts = {
/** The address of the asset */
assetAddress: PublicKey | Pda;
/** The collection to which the asset belongs */
collection?: PublicKey | Pda;
/** The owner of the asset */
owner: Signer;
/** The account paying for the storage fees */
payer?: Signer;
/** The delegate to be revoked for the asset */
delegate: PublicKey | Pda;
/** The system program */
systemProgram?: PublicKey | Pda;
/** The SPL Noop Program */
logWrapper?: PublicKey | Pda;
};

// Data.
export type RevokeInstructionData = { discriminator: number };

export type RevokeInstructionDataArgs = {};

export function getRevokeInstructionDataSerializer(): Serializer<
RevokeInstructionDataArgs,
RevokeInstructionData
> {
return mapSerializer<RevokeInstructionDataArgs, any, RevokeInstructionData>(
struct<RevokeInstructionData>([['discriminator', u8()]], {
description: 'RevokeInstructionData',
}),
(value) => ({ ...value, discriminator: 2 })
) as Serializer<RevokeInstructionDataArgs, RevokeInstructionData>;
}

// Instruction.
export function revoke(
context: Pick<Context, 'programs'>,
input: RevokeInstructionAccounts
): TransactionBuilder {
// Program ID.
const programId = context.programs.getPublicKey(
'mplAsset',
'ASSETp3DinZKfiAyvdQG16YWWLJ2X3ZKjg9zku7n1sZD'
);

// Accounts.
const resolvedAccounts: ResolvedAccountsWithIndices = {
assetAddress: {
index: 0,
isWritable: true,
value: input.assetAddress ?? null,
},
collection: {
index: 1,
isWritable: false,
value: input.collection ?? null,
},
owner: { index: 2, isWritable: true, value: input.owner ?? null },
payer: { index: 3, isWritable: true, value: input.payer ?? null },
delegate: { index: 4, isWritable: false, value: input.delegate ?? null },
systemProgram: {
index: 5,
isWritable: false,
value: input.systemProgram ?? null,
},
logWrapper: {
index: 6,
isWritable: false,
value: input.logWrapper ?? null,
},
};

// Default values.
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 = getRevokeInstructionDataSerializer().serialize({});

// Bytes Created On Chain.
const bytesCreatedOnChain = 0;

return transactionBuilder([
{ instruction: { keys, programId, data }, signers, bytesCreatedOnChain },
]);
}
1 change: 0 additions & 1 deletion clients/js/src/generated/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export * from './delegate';
export * from './externalPluginRecord';
export * from './extraAccounts';
export * from './key';
export * from './legacyMetadata';
export * from './migrationLevel';
export * from './plugin';
export * from './pluginType';
Expand Down
Loading

0 comments on commit 0b21745

Please sign in to comment.