mirror of https://github.com/certusone/oyster.git
Can create auction managers
This commit is contained in:
parent
4c89a1667c
commit
2f036f7009
|
@ -132,8 +132,8 @@ export enum WinnerLimitType {
|
|||
|
||||
export class WinnerLimit {
|
||||
type: WinnerLimitType;
|
||||
usize?: BN;
|
||||
constructor(args: { type: WinnerLimitType; usize?: BN }) {
|
||||
usize: BN;
|
||||
constructor(args: { type: WinnerLimitType; usize: BN }) {
|
||||
this.type = args.type;
|
||||
this.usize = args.usize;
|
||||
}
|
||||
|
@ -142,10 +142,7 @@ export class WinnerLimit {
|
|||
class CreateAuctionArgs {
|
||||
instruction: number = 0;
|
||||
/// How many winners are allowed for this auction. See AuctionData.
|
||||
winnerType: number;
|
||||
winnerAmount: BN | null;
|
||||
/// The resource being auctioned. See AuctionData.
|
||||
resource: PublicKey;
|
||||
winners: WinnerLimit;
|
||||
/// End time is the cut-off point that the auction is forced to end by. See AuctionData.
|
||||
endAuctionAt: BN | null;
|
||||
/// Gap time is how much time after the previous bid where the auction ends. See AuctionData.
|
||||
|
@ -154,23 +151,23 @@ class CreateAuctionArgs {
|
|||
tokenMint: PublicKey;
|
||||
/// Authority
|
||||
authority: PublicKey;
|
||||
/// The resource being auctioned. See AuctionData.
|
||||
resource: PublicKey;
|
||||
|
||||
constructor(args: {
|
||||
winnerType: number;
|
||||
winnerAmount: BN | null;
|
||||
resource: PublicKey;
|
||||
winners: WinnerLimit;
|
||||
endAuctionAt: BN | null;
|
||||
endAuctionGap: BN | null;
|
||||
tokenMint: PublicKey;
|
||||
authority: PublicKey;
|
||||
resource: PublicKey;
|
||||
}) {
|
||||
this.winnerType = args.winnerType;
|
||||
this.winnerAmount = args.winnerAmount;
|
||||
this.resource = args.resource;
|
||||
this.winners = args.winners;
|
||||
this.endAuctionAt = args.endAuctionAt;
|
||||
this.endAuctionGap = args.endAuctionGap;
|
||||
this.tokenMint = args.tokenMint;
|
||||
this.authority = args.authority;
|
||||
this.resource = args.resource;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,13 +198,22 @@ export const AUCTION_SCHEMA = new Map<any, any>([
|
|||
kind: 'struct',
|
||||
fields: [
|
||||
['instruction', 'u8'],
|
||||
['winnerType', 'u8'],
|
||||
['winnerAmount', { kind: 'option', type: 'u64' }],
|
||||
['resource', 'pubkey'],
|
||||
['winners', WinnerLimit],
|
||||
['endAuctionAt', { kind: 'option', type: 'u64' }],
|
||||
['endAuctionGap', { kind: 'option', type: 'u64' }],
|
||||
['tokenMint', 'pubkey'],
|
||||
['authority', 'pubkey'],
|
||||
['resource', 'pubkey'],
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
WinnerLimit,
|
||||
{
|
||||
kind: 'struct',
|
||||
fields: [
|
||||
['type', 'u8'],
|
||||
['usize', 'u64'],
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -312,8 +318,7 @@ export async function createAuction(
|
|||
serialize(
|
||||
AUCTION_SCHEMA,
|
||||
new CreateAuctionArgs({
|
||||
winnerType: winners.type,
|
||||
winnerAmount: winners.usize == undefined ? null : winners.usize,
|
||||
winners,
|
||||
resource,
|
||||
endAuctionAt,
|
||||
endAuctionGap,
|
||||
|
@ -323,10 +328,6 @@ export async function createAuction(
|
|||
),
|
||||
);
|
||||
|
||||
console.log('Winner', winners);
|
||||
|
||||
console.log('Data', data);
|
||||
|
||||
const auctionKey: PublicKey = (
|
||||
await PublicKey.findProgramAddress(
|
||||
[
|
||||
|
@ -354,6 +355,11 @@ export async function createAuction(
|
|||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: SystemProgram.programId,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
];
|
||||
instructions.push(
|
||||
new TransactionInstruction({
|
||||
|
|
|
@ -166,7 +166,16 @@ export async function createAuctionManager(
|
|||
signers: auctionManagerSigners,
|
||||
},
|
||||
startAuction: await setupStartAuction(wallet, vault),
|
||||
validateBoxes: await validateBoxes(wallet, vault, safetyDeposits, stores),
|
||||
validateBoxes: await validateBoxes(
|
||||
wallet,
|
||||
vault,
|
||||
// No need to validate open edition, it's already been during init
|
||||
safetyDeposits.filter(
|
||||
(_, i) =>
|
||||
settings.openEditionConfig != null && i != settings.openEditionConfig,
|
||||
),
|
||||
stores,
|
||||
),
|
||||
};
|
||||
|
||||
let signers: Account[][] = [
|
||||
|
|
|
@ -91,7 +91,7 @@ export async function initAuctionManager(
|
|||
{
|
||||
pubkey: openEditionMasterMint || SystemProgram.programId, // Won't actually be used if openEditionConfig is null
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
isWritable: true,
|
||||
},
|
||||
{
|
||||
pubkey: openEditionMasterMintAuthority || SystemProgram.programId, // Won't actually be used if openEditionConfig is null
|
||||
|
|
|
@ -152,7 +152,10 @@ export const AuctionCreateView = () => {
|
|||
openEditionFixedPrice: null,
|
||||
});
|
||||
|
||||
winnerLimit = new WinnerLimit({ type: WinnerLimitType.Unlimited });
|
||||
winnerLimit = new WinnerLimit({
|
||||
type: WinnerLimitType.Unlimited,
|
||||
usize: new BN(0),
|
||||
});
|
||||
} else if (attributes.category == AuctionCategory.Single) {
|
||||
settings = new AuctionManagerSettings({
|
||||
openEditionWinnerConstraint: WinningConstraint.NoOpenEdition,
|
||||
|
@ -186,7 +189,7 @@ export const AuctionCreateView = () => {
|
|||
new BN((attributes.auctionDuration || 1) * 60),
|
||||
new BN((attributes.gapTime || 1) * 60),
|
||||
[items[0]],
|
||||
new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'),
|
||||
new PublicKey('4XEUcBjLyBHuMDKTARycf4VXqpsAsDcThMbhWgFuDGsC'),
|
||||
);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue