generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Goodbye migrate, we hardly knew you.
- Loading branch information
1 parent
1a3891d
commit 0b21745
Showing
23 changed files
with
775 additions
and
1,518 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 was deleted.
Oops, something went wrong.
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,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 }, | ||
]); | ||
} |
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.