feat: remove default store from code
This commit is contained in:
parent
43255f2616
commit
b8171c5a53
|
@ -438,6 +438,11 @@ async function setupAuctionManagerInstructions(
|
|||
signers: Keypair[];
|
||||
auctionManager: PublicKey;
|
||||
}> {
|
||||
let store = programIds().store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
let signers: Keypair[] = [];
|
||||
let instructions: TransactionInstruction[] = [];
|
||||
|
||||
|
@ -457,7 +462,7 @@ async function setupAuctionManagerInstructions(
|
|||
wallet.publicKey,
|
||||
wallet.publicKey,
|
||||
acceptPayment,
|
||||
programIds().store,
|
||||
store,
|
||||
settings,
|
||||
instructions,
|
||||
);
|
||||
|
@ -492,6 +497,11 @@ async function validateParticipationHelper(
|
|||
participationSafetyDepositDraft: SafetyDepositDraft,
|
||||
accountRentExempt: number,
|
||||
): Promise<{ instructions: TransactionInstruction[]; signers: Keypair[] }> {
|
||||
const store = programIds().store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
let instructions: TransactionInstruction[] = [];
|
||||
let signers: Keypair[] = [];
|
||||
const whitelistedCreator = participationSafetyDepositDraft.metadata.info.data
|
||||
|
@ -521,7 +531,7 @@ async function validateParticipationHelper(
|
|||
printingTokenHoldingAccount,
|
||||
wallet.publicKey,
|
||||
whitelistedCreator,
|
||||
programIds().store,
|
||||
store,
|
||||
await getSafetyDepositBoxAddress(
|
||||
vault,
|
||||
participationSafetyDepositDraft.masterEdition.info
|
||||
|
@ -568,6 +578,11 @@ async function validateBoxes(
|
|||
instructions: TransactionInstruction[][];
|
||||
signers: Keypair[][];
|
||||
}> {
|
||||
const store = programIds().store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
let signers: Keypair[][] = [];
|
||||
let instructions: TransactionInstruction[][] = [];
|
||||
|
||||
|
@ -628,7 +643,7 @@ async function validateBoxes(
|
|||
tokenInstructions,
|
||||
edition,
|
||||
whitelistedCreator,
|
||||
programIds().store,
|
||||
store,
|
||||
safetyDeposits[i].draft.masterEdition?.info.printingMint,
|
||||
safetyDeposits[i].draft.masterEdition ? wallet.publicKey : undefined,
|
||||
);
|
||||
|
|
|
@ -2,14 +2,17 @@ import React, { useMemo } from 'react';
|
|||
import './index.less';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { Button, Dropdown, Menu } from 'antd';
|
||||
import { ConnectButton, CurrentUserBadge, useWallet } from '@oyster/common';
|
||||
import { ConnectButton, CurrentUserBadge, useConnection, useWallet } from '@oyster/common';
|
||||
import { Notifications } from '../Notifications';
|
||||
import useWindowDimensions from '../../utils/layout';
|
||||
import { MenuOutlined } from '@ant-design/icons';
|
||||
import { useMeta } from '../../contexts';
|
||||
import { saveAdmin } from '../../actions/saveAdmin';
|
||||
import { WhitelistedCreator } from '../../models/metaplex';
|
||||
|
||||
const UserActions = () => {
|
||||
const { wallet } = useWallet();
|
||||
const connection = useConnection();
|
||||
const { whitelistedCreatorsByCreator, store } = useMeta();
|
||||
const pubkey = wallet?.publicKey?.toBase58() || '';
|
||||
|
||||
|
@ -23,6 +26,19 @@ const UserActions = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
{!store?.info && wallet?.publicKey && <Button className="app-btn" onClick={async () => {
|
||||
if(!wallet?.publicKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
await saveAdmin(connection, wallet, false, [new WhitelistedCreator({
|
||||
address: wallet?.publicKey,
|
||||
activated: true,
|
||||
})]);
|
||||
|
||||
window.location.reload();
|
||||
}}>Init Store</Button>}
|
||||
|
||||
{/* <Link to={`#`}>
|
||||
<Button className="app-btn">Bids</Button>
|
||||
</Link> */}
|
||||
|
|
|
@ -645,7 +645,7 @@ const processMetaplexAccounts = async (
|
|||
if (a.account.owner.toBase58() != programIds().metaplex.toBase58()) return;
|
||||
|
||||
try {
|
||||
const STORE_ID = programIds().store.toBase58();
|
||||
const STORE_ID = programIds().store?.toBase58() || '';
|
||||
|
||||
if (
|
||||
a.account.data[0] === MetaplexKey.AuctionManagerV1 ||
|
||||
|
@ -692,7 +692,6 @@ const processMetaplexAccounts = async (
|
|||
}));
|
||||
} else if (a.account.data[0] === MetaplexKey.StoreV1) {
|
||||
const store = decodeStore(a.account.data);
|
||||
console.log('Found store', store);
|
||||
const account: ParsedAccount<Store> = {
|
||||
pubkey: a.pubkey,
|
||||
account: a.account,
|
||||
|
|
|
@ -17,6 +17,10 @@ export async function claimBid(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const { auctionKey, auctionManagerKey } = await getAuctionKeys(vault);
|
||||
|
||||
|
@ -72,7 +76,7 @@ export async function claimBid(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -26,6 +26,10 @@ export async function emptyPaymentAccount(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const value = new EmptyPaymentAccountArgs({
|
||||
winningConfigIndex,
|
||||
|
@ -83,7 +87,7 @@ export async function emptyPaymentAccount(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -690,12 +690,17 @@ export async function getOriginalAuthority(
|
|||
|
||||
export async function getWhitelistedCreator(creator: PublicKey) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
return (
|
||||
await PublicKey.findProgramAddress(
|
||||
[
|
||||
Buffer.from(METAPLEX_PREFIX),
|
||||
PROGRAM_IDS.metaplex.toBuffer(),
|
||||
PROGRAM_IDS.store.toBuffer(),
|
||||
store.toBuffer(),
|
||||
creator.toBuffer(),
|
||||
],
|
||||
PROGRAM_IDS.metaplex,
|
||||
|
|
|
@ -25,6 +25,10 @@ export async function populateParticipationPrintingAccount(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const transferAuthority: PublicKey = (
|
||||
await PublicKey.findProgramAddress(
|
||||
|
@ -115,7 +119,7 @@ export async function populateParticipationPrintingAccount(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -23,6 +23,10 @@ export async function redeemBid(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const { auctionKey, auctionManagerKey } = await getAuctionKeys(vault);
|
||||
|
||||
|
@ -116,7 +120,7 @@ export async function redeemBid(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -27,6 +27,10 @@ export async function redeemFullRightsTransferBid(
|
|||
newAuthority: PublicKey,
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const { auctionKey, auctionManagerKey } = await getAuctionKeys(vault);
|
||||
|
||||
|
@ -120,7 +124,7 @@ export async function redeemFullRightsTransferBid(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -30,6 +30,10 @@ export async function redeemParticipationBid(
|
|||
tokenPaymentAccount: PublicKey,
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const { auctionKey, auctionManagerKey } = await getAuctionKeys(vault);
|
||||
|
||||
|
@ -111,7 +115,7 @@ export async function redeemParticipationBid(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -15,13 +15,17 @@ export async function setStore(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const value = new SetStoreArgs({ public: isPublic });
|
||||
const data = Buffer.from(serialize(SCHEMA, value));
|
||||
|
||||
const keys = [
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: true,
|
||||
},
|
||||
|
|
|
@ -16,6 +16,10 @@ export async function setWhitelistedCreator(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const whitelistedCreatorPDAKey = await getWhitelistedCreator(creator);
|
||||
|
||||
|
@ -44,7 +48,7 @@ export async function setWhitelistedCreator(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -14,6 +14,10 @@ export async function startAuction(
|
|||
instructions: TransactionInstruction[],
|
||||
) {
|
||||
const PROGRAM_IDS = programIds();
|
||||
const store = PROGRAM_IDS.store;
|
||||
if (!store) {
|
||||
throw new Error('Store not initialized');
|
||||
}
|
||||
|
||||
const { auctionKey, auctionManagerKey } = await getAuctionKeys(vault);
|
||||
|
||||
|
@ -37,7 +41,7 @@ export async function startAuction(
|
|||
isWritable: false,
|
||||
},
|
||||
{
|
||||
pubkey: PROGRAM_IDS.store,
|
||||
pubkey: store,
|
||||
isSigner: false,
|
||||
isWritable: false,
|
||||
},
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
} from '@solana/web3.js';
|
||||
import { serialize } from 'borsh';
|
||||
|
||||
import { getAuctionKeys, SCHEMA, ValidateParticipationArgs } from '.';
|
||||
import { SCHEMA, ValidateParticipationArgs } from '.';
|
||||
|
||||
export async function validateParticipation(
|
||||
auctionManager: PublicKey,
|
||||
|
|
|
@ -9,7 +9,6 @@ import {
|
|||
Statistic,
|
||||
Progress,
|
||||
Spin,
|
||||
InputNumber,
|
||||
Radio,
|
||||
Card,
|
||||
Select,
|
||||
|
@ -42,7 +41,6 @@ import {
|
|||
WinningConstraint,
|
||||
ParticipationConfig,
|
||||
WinningConfigItem,
|
||||
WinningConfigState,
|
||||
} from '../../models/metaplex';
|
||||
import moment from 'moment';
|
||||
import {
|
||||
|
@ -59,7 +57,6 @@ import { PlusCircleOutlined } from '@ant-design/icons';
|
|||
|
||||
const { Option } = Select;
|
||||
const { Step } = Steps;
|
||||
const { TextArea } = Input;
|
||||
|
||||
export enum AuctionCategory {
|
||||
Limited,
|
||||
|
|
Loading…
Reference in New Issue