Merge pull request #15 from metaplex-foundation/various-patches

Allow for new safety deposit validation
This commit is contained in:
Jordan Prince 2021-06-03 17:08:50 -05:00 committed by GitHub
commit 385389fa80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -700,6 +700,24 @@ export async function getWhitelistedCreator(creator: PublicKey) {
)[0];
}
export async function getSafetyDepositBoxValidationTicket(
auctionManager: PublicKey,
safetyDepositBox: PublicKey,
) {
const PROGRAM_IDS = programIds();
return (
await PublicKey.findProgramAddress(
[
Buffer.from(METAPLEX_PREFIX),
PROGRAM_IDS.metaplex.toBuffer(),
auctionManager.toBuffer(),
safetyDepositBox.toBuffer(),
],
PROGRAM_IDS.metaplex,
)
)[0];
}
export async function getPayoutTicket(
auctionManager: PublicKey,
winnerConfigIndex: number | null | undefined,

View File

@ -10,6 +10,7 @@ import { serialize } from 'borsh';
import {
getAuctionKeys,
getOriginalAuthority,
getSafetyDepositBoxValidationTicket,
SCHEMA,
ValidateSafetyDepositBoxArgs,
} from '.';
@ -43,6 +44,14 @@ export async function validateSafetyDepositBox(
const data = Buffer.from(serialize(SCHEMA, value));
const keys = [
{
pubkey: await getSafetyDepositBoxValidationTicket(
auctionManagerKey,
safetyDepositBox,
),
isSigner: false,
isWritable: true,
},
{
pubkey: auctionManagerKey,
isSigner: false,