mirror of https://github.com/certusone/oyster.git
feat: add metaplex state
This commit is contained in:
parent
894a13af66
commit
24bbabb09c
|
@ -0,0 +1,3 @@
|
||||||
|
export const createAuction = () => {
|
||||||
|
// TODO:
|
||||||
|
};
|
|
@ -1 +1,3 @@
|
||||||
export const nop = () => {};
|
export * from './nft';
|
||||||
|
export * from './vault';
|
||||||
|
export * from './auction';
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
export const createVault = () => {
|
||||||
|
// TODO:
|
||||||
|
};
|
|
@ -1,2 +1 @@
|
||||||
export * from './dex';
|
export * from './dex';
|
||||||
export * from './nft';
|
|
||||||
|
|
|
@ -0,0 +1,173 @@
|
||||||
|
import { PublicKey } from '@solana/web3.js';
|
||||||
|
|
||||||
|
export * from './initAuctionManager';
|
||||||
|
export * from './redeemBid';
|
||||||
|
export * from './redeemLimitedEditionBid';
|
||||||
|
export * from './redeemMasterEditionBid';
|
||||||
|
export * from './redeemOpenEditionBid';
|
||||||
|
export * from './startAuction';
|
||||||
|
export * from './validateSafetyDepositBox';
|
||||||
|
|
||||||
|
export class AuctionManager {
|
||||||
|
key: number;
|
||||||
|
authority: PublicKey;
|
||||||
|
auction: PublicKey;
|
||||||
|
vault: PublicKey;
|
||||||
|
auctionProgram: PublicKey;
|
||||||
|
tokenVaultProgram: PublicKey;
|
||||||
|
tokenMetadataProgram: PublicKey;
|
||||||
|
tokenProgram: PublicKey;
|
||||||
|
state: AuctionManagerState;
|
||||||
|
settings: AuctionManagerSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AuctionManagerSettings {
|
||||||
|
openEditionWinnerConstraint: WinningConstraint;
|
||||||
|
openEditionNonWinningConstraint: NonWinningConstraint;
|
||||||
|
winningConfigs: WinningConfig[];
|
||||||
|
openEditionConfig?: number;
|
||||||
|
openEditionFixedPrice?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum WinningConstraint {
|
||||||
|
NoOpenEdition,
|
||||||
|
OpenEditionGiven,
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum NonWinningConstraint {
|
||||||
|
NoOpenEdition,
|
||||||
|
GivenForFixedPrice,
|
||||||
|
GivenForBidPrice,
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum EditionType {
|
||||||
|
// Not an edition
|
||||||
|
NA,
|
||||||
|
/// Means you are auctioning off the master edition record
|
||||||
|
MasterEdition,
|
||||||
|
/// Means you are using the master edition to print off new editions during the auction (limited or open edition)
|
||||||
|
LimitedEdition,
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WinningConfig {
|
||||||
|
safetyDepositBoxIndex: number;
|
||||||
|
amount: number;
|
||||||
|
hasAuthority: boolean;
|
||||||
|
editionType: EditionType;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class WinningConfigState {
|
||||||
|
/// Used for cases of minting Limited Editions and keeping track of how many have been made so far.
|
||||||
|
amountMinted: number;
|
||||||
|
/// Each safety deposit box needs to be validated via endpoint before auction manager will agree to let auction begin.
|
||||||
|
validated: boolean;
|
||||||
|
/// Ticked to true when a prize is claimed
|
||||||
|
claimed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AuctionManagerState {
|
||||||
|
status: AuctionManagerStatus;
|
||||||
|
/// When all configs are validated the auction is started and auction manager moves to Running
|
||||||
|
winningConfigsValidated: number;
|
||||||
|
|
||||||
|
/// Each master edition used as a template has to grant it's authority to the auction manager.
|
||||||
|
/// This counter is incremented by one each time this is done. At the end of the auction; this is decremented
|
||||||
|
/// each time authority is delegated back to the owner or the new owner and when it hits 0 another condition
|
||||||
|
/// is met for going to Finished state.
|
||||||
|
masterEditionsWithAuthoritiesRemainingToReturn: number;
|
||||||
|
|
||||||
|
winningConfigStates: WinningConfigState[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum AuctionManagerStatus {
|
||||||
|
Initialized,
|
||||||
|
Validated,
|
||||||
|
Running,
|
||||||
|
Disbursing,
|
||||||
|
Finished,
|
||||||
|
}
|
||||||
|
|
||||||
|
export class BidRedemptionTicket {
|
||||||
|
openEditionRedeemed: boolean;
|
||||||
|
bidRedeemed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SCHEMA = new Map<any, any>([
|
||||||
|
[
|
||||||
|
AuctionManager,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
['key', 'u8'],
|
||||||
|
['authority', 'u32'],
|
||||||
|
['auction', 'u32'],
|
||||||
|
['vault', 'u32'],
|
||||||
|
['auctionProgram', 'u32'],
|
||||||
|
['tokenVaultProgram', 'u32'],
|
||||||
|
['tokenMetadataProgram', 'u32'],
|
||||||
|
['tokenProgram', 'u32'],
|
||||||
|
['state', AuctionManagerState],
|
||||||
|
['settings', AuctionManagerSettings],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AuctionManagerSettings,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
['openEditionWinnerConstraint', { kind: 'enum' }], // TODO:
|
||||||
|
['openEditionNonWinningConstraint', { kind: 'enum' }], // TODO:
|
||||||
|
['winningConfigs', [WinningConfig]], // TODO: check
|
||||||
|
['openEditionConfig', { kind: 'option', type: 'u8' }],
|
||||||
|
['openEditionFixedPrice', { kind: 'option', type: 'u8' }],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
WinningConfig,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
['safetyDepositBoxIndex', 'u8'],
|
||||||
|
['amount', 'u8'],
|
||||||
|
['hasAuthority', 'u8'], // bool
|
||||||
|
['editionType', { kind: 'enum' }], // TODO:
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
WinningConfigState,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
['amountMinted', 'u8'],
|
||||||
|
['validated', 'u8'], // bool
|
||||||
|
['claimed', 'u8'], // bool
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AuctionManagerState,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
// TODO: fix enum
|
||||||
|
['status', { kind: 'enum' }],
|
||||||
|
['winningConfigsValidated', 'u8'],
|
||||||
|
['masterEditionsWithAuthoritiesRemainingToReturn', 'u8'],
|
||||||
|
['winningConfigStates', [WinningConfigState]],
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
BidRedemptionTicket,
|
||||||
|
{
|
||||||
|
kind: 'struct',
|
||||||
|
fields: [
|
||||||
|
['openEditionRedeemed', 'u8'], // bool
|
||||||
|
['bidRedeemed', 'u8'], // bool
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
]);
|
|
@ -0,0 +1 @@
|
||||||
|
export const initAuctionManager = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const redeemBid = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const redeemLimitedEditionBid = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const redeemMasterEditionBid = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const redeemOpenEditionBid = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const startAuction = () => {};
|
|
@ -0,0 +1 @@
|
||||||
|
export const validateSafetyDepositBox = () => {};
|
|
@ -1,9 +1,18 @@
|
||||||
import { PublicKey } from '@solana/web3.js';
|
import { PublicKey } from '@solana/web3.js';
|
||||||
|
|
||||||
export const WORMHOLE_PROGRAM_ID = new PublicKey(
|
export const AUCTION_PROGRAM_ID = new PublicKey(
|
||||||
'WormT3McKhFJ2RkiGpdw9GKvNCrB2aB54gb2uV9MfQC',
|
'aucPpK6yb5MpEHDwyp3Kg79McUoKVqTMeum7iJ9syeH',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const VAULT_PROGRAM_ID = new PublicKey(
|
||||||
|
'vauLTA73sFPqA8whreUbBsbn3SLJH2vhrW9fP5dmfdC',
|
||||||
|
);
|
||||||
|
|
||||||
|
export const METAPLEX_PROGRAM_ID = new PublicKey(
|
||||||
|
'HvwC9QSAzvGXhhVrgPmauVwFWcYZhne3hVot9EbHuFTm',
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: generate key ---
|
||||||
export const AR_SOL_HOLDER_ID = new PublicKey(
|
export const AR_SOL_HOLDER_ID = new PublicKey(
|
||||||
'HvwC9QSAzvGXhhVrgPmauVwFWcYZhne3hVot9EbHuFTm',
|
'HvwC9QSAzvGXhhVrgPmauVwFWcYZhne3hVot9EbHuFTm',
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { ArtCard } from './../../components/ArtCard';
|
||||||
import { UserSearch, UserValue } from './../../components/UserSearch';
|
import { UserSearch, UserValue } from './../../components/UserSearch';
|
||||||
import { Confetti } from './../../components/Confetti';
|
import { Confetti } from './../../components/Confetti';
|
||||||
import './../styles.less';
|
import './../styles.less';
|
||||||
import { mintNFT } from '../../models';
|
import { mintNFT } from '../../actions';
|
||||||
import {
|
import {
|
||||||
MAX_METADATA_LEN,
|
MAX_METADATA_LEN,
|
||||||
MAX_OWNER_LEN,
|
MAX_OWNER_LEN,
|
||||||
|
|
|
@ -321,6 +321,8 @@ const TermsStep = (props: {
|
||||||
}) => {
|
}) => {
|
||||||
const [creators, setCreators] = useState<Array<UserValue>>([]);
|
const [creators, setCreators] = useState<Array<UserValue>>([]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Row className="call-to-action">
|
<Row className="call-to-action">
|
||||||
|
@ -331,6 +333,22 @@ const TermsStep = (props: {
|
||||||
</Row>
|
</Row>
|
||||||
<Row className="content-action">
|
<Row className="content-action">
|
||||||
<Col className="section" xl={24}>
|
<Col className="section" xl={24}>
|
||||||
|
<label className="action-field">
|
||||||
|
<span className="field-title">Number of copies</span>
|
||||||
|
<Input
|
||||||
|
autoFocus
|
||||||
|
className="input"
|
||||||
|
placeholder="Enter reservation price"
|
||||||
|
allowClear
|
||||||
|
onChange={info =>
|
||||||
|
props.setAttributes({
|
||||||
|
...props.attributes,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<span className="field-info">= ◎ 4.84</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<label className="action-field">
|
<label className="action-field">
|
||||||
<span className="field-title">Price Floor (USD)</span>
|
<span className="field-title">Price Floor (USD)</span>
|
||||||
<Input
|
<Input
|
||||||
|
|
Loading…
Reference in New Issue