useCreateListingModal
useCreateListingModalフックは、マーケットプレイスでアイテムを出品する際に使用します。新しい出品を作成・管理するために必要な機能を提供します。
import { useCreateListingModal } from "@0xsequence/marketplace-sdk/react";
## Into your React component:
const { show: showListModal } = useCreateListingModal({ onError });
const onClickList = () => {
showListModal({
collectionAddress,
chainId,
collectibleId,
orderbookKind,
});
};
return <button onClick={onClickList}>List</button>
interface useCreateListingModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
show
(args: ShowCreateListingModalArgs) => void
interface ShowCreateListingModalArgs {
collectionAddress: Hex;
chainId: string;
collectibleId: string;
orderbookKind?: OrderbookKind;
callbacks?: ModalCallbacks;
}
useBuyModal
useBuyModalフックは、マーケットプレイスで販売中のNFTを購入するためのものです。購入手続きやトランザクションの実行を担当します。
import { useBuyModal } from "@0xsequence/marketplace-sdk/react";
## Into your React component:
const { show: showBuyModal } = useBuyModal({
onSuccess(hash) {
console.log("Buy transaction sent with hash: ", hash);
},
onError,
});
const onClickBuy = () => {
showBuyModal({
chainId,
collectionAddress,
tokenId,
order,
});
};
return <button onClick={onClickBuy}>Buy</button>
interface useBuyModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
show
(args: ShowBuyModalArgs) => void
interface ShowBuyModalArgs {
chainId: string;
collectionAddress: Hex;
tokenId: string;
order: Order;
}
useMakeOfferModal
useMakeOfferModalフックは、ユーザーがNFTに対してオファーを出すことを可能にします。マーケットプレイス内でオファーの作成と送信をサポートします。
import { useMakeOfferModal } from "@0xsequence/marketplace-sdk/react";
## Into your React component:
const { show: showOfferModal } = useMakeOfferModal({
onError,
});
const onClickOffer = () => {
showOfferModal({
collectionAddress,
chainId,
collectibleId,
orderbookKind,
});
};
return <button onClick={onClickOffer}>Make Offer</button>
interface useMakeOfferModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
show
(args: ShowMakeOfferModalArgs) => void
interface ShowMakeOfferModalArgs {
collectionAddress: Hex;
chainId: string;
collectibleId: string;
orderbookKind?: OrderbookKind;
callbacks?: ModalCallbacks;
}
useSellModal
useSellModalフックは、既存のオファーを受け入れてNFTを販売する際に使用します。販売手続きを完了するための機能を提供します。
import { useSellModal } from "@0xsequence/marketplace-sdk/react";
## Into your React component:
const { show: showSellModal } = useSellModal({ onError });
const onAcceptOffer = () => {
showSellModal({
collectionAddress,
chainId,
tokenId,
order,
});
};
return <button onClick={onAcceptOffer}>Accept Offer</button>
interface useSellModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
show
(args: ShowSellModalArgs) => void
interface ShowSellModalArgs {
collectionAddress: Hex;
chainId: string;
tokenId: string;
order: Order;
callbacks?: ModalCallbacks;
}