Hooks
Acciones del Marketplace
Los hooks de acción son esenciales para interactuar con el Marketplace en su aplicación. Son útiles para crear listados, hacer ofertas y realizar acciones de compra y venta.
¿Esta página le ayudó?
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Los hooks de acción son esenciales para interactuar con el Marketplace en su aplicación. Son útiles para crear listados, hacer ofertas y realizar acciones de compra y venta.
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>
Mostrar atributos secundarios
interface useCreateListingModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
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>
Mostrar atributos secundarios
interface useBuyModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
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>
Mostrar atributos secundarios
interface useMakeOfferModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
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>
Mostrar atributos secundarios
interface useSellModal {
onSuccess?: ({ hash, orderId }: {
hash?: Hash;
orderId?: string;
}) => void;
onError?: (error: Error) => void;
}
¿Esta página le ayudó?