@tatumio/tatum-v1
Version:
Tatum API client allows browsers and Node.js clients to interact with Tatum API.
196 lines (195 loc) • 11.9 kB
TypeScript
import { ApproveErc20, CreateMarketplaceListing, CreateTronMarketplaceListing, Currency, DeployMarketplaceListing, DeployTronMarketplaceListing, InvokeMarketplaceListingOperation, InvokeTronMarketplaceListingOperation, UpdateMarketplaceFee, UpdateMarketplaceFeeRecipient, UpdateTronMarketplaceFee, UpdateTronMarketplaceFeeRecipient } from '../../model';
declare enum ListingState {
INITIATED = "0",
SOLD = "1",
CANCELLED = "2"
}
export interface MarketplaceListing {
/**
* ID of the listing
*/
listingId: string;
/**
* whether listing is for ERC721 or ERC1155
*/
isErc721: boolean;
/**
* State of the listing,
*/
state: ListingState;
/**
* Address of the NFT asset contract
*/
nftAddress: string;
/**
* Address of the seller
*/
seller: string;
/**
* Address of the ERC20 token, which will be used for paying. 0x0 if native asset is used
*/
erc20Address: string;
/**
* TokenID to sell
*/
tokenId: string;
/**
* Amount of assets to sell. Valid only for ERC1155.
*/
amount: string;
/**
* Price to sell asset for.
*/
price: string;
/**
* Address of the buyer, if already exists.
*/
buyer: string;
}
/**
* For more details, see <a href="https://apidoc.tatum.io/#operation/GetMarketplaceFee" target="_blank">Tatum API documentation</a>
*/
export declare const getMarketplaceFee: (chain: Currency, contractAddress: string) => Promise<number>;
/**
* For more details, see <a href="https://apidoc.tatum.io/#operation/GetMarketplaceListing" target="_blank">Tatum API documentation</a>
*/
export declare const getMarketplaceListing: (chain: Currency, contractAddress: string, listingId: string) => Promise<MarketplaceListing>;
/**
* For more details, see <a href="https://apidoc.tatum.io/#operation/GetMarketplaceFeeRecipient" target="_blank">Tatum API documentation</a>
*/
export declare const getMarketplaceFeeRecipient: (chain: Currency, contractAddress: string) => Promise<{
address: string;
}>;
/**
* Deploy new smart contract for NFT marketplace logic. Smart contract enables marketplace operator to create new listing for NFT (ERC-721/1155).
* Operator can set a fee in percentage, which will be paid on top of the price of the asset.
* Listing can be offered for native asset - ETH, BSC, etc. - or any ERC20 token - this is configurable during listing creation.
* Once the listing is created, seller must send the NFT asset to the smart contract.
* Buyer will buy the asset from the listing using native asset - send assets along the buyAssetFromListing() smart contract call, or via ERC20 token.
* Buyer of the listing must perform approval for the smart contract to access ERC20 token, before the actual buyAssetFromListing() method is called.
* Once both assets - from buyer and seller - are in the smart contract, NFT is sent to the buyer, price is sent to the seller
* and marketplace fee is set to the operator.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const deployMarketplaceListing: (testnet: boolean, body: DeployMarketplaceListing | DeployTronMarketplaceListing, provider?: string | undefined) => Promise<import("../../model").TransactionHash>;
/**
* Prepare signed transaction for deploy new smart contract for NFT marketplace logic. Smart contract enables marketplace operator to create new listing for NFT (ERC-721/1155).
* Operator can set a fee in percentage, which will be paid on top of the price of the asset.
* Listing can be offered for native asset - ETH, BSC, etc. - or any ERC20 token - this is configurable during listing creation.
* Once the listing is created, seller must send the NFT asset to the smart contract.
* Buyer will buy the asset from the listing using native asset - send assets along the buyAssetFromListing() smart contract call, or via ERC20 token.
* Buyer of the listing must perform approval for the smart contract to access ERC20 token, before the actual buyAssetFromListing() method is called.
* Once both assets - from buyer and seller - are in the smart contract, NFT is sent to the buyer, price is sent to the seller
* and marketplace fee is set to the operator.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareDeployMarketplaceListing: (testnet: boolean, body: DeployMarketplaceListing | DeployTronMarketplaceListing, provider?: string | undefined) => Promise<string>;
/**
* Update marketplace fee.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceUpdateFee: (testnet: boolean, body: UpdateMarketplaceFee | UpdateTronMarketplaceFee, provider?: string | undefined) => Promise<string>;
/**
* Update marketplace fee recipient.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceUpdateFeeRecipient: (testnet: boolean, body: UpdateMarketplaceFeeRecipient | UpdateTronMarketplaceFeeRecipient, provider?: string | undefined) => Promise<string>;
/**
* Approve ERC20 spending for marketplace to perform buy with ERC20 token.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceApproveErc20Spending: (testnet: boolean, body: ApproveErc20, provider?: string | undefined) => Promise<string>;
/**
* Create new listing on the marketplace.
* After listing is created, seller must send the asset to the marketplace smart contract.
* Only listing for existing NFTs can be created - seller must be owner of the NFT asset.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceCreateListing: (testnet: boolean, body: CreateMarketplaceListing | CreateTronMarketplaceListing, provider?: string | undefined) => Promise<string>;
/**
* Buy listing on the marketplace. Buyer must either send native assets with this operation, or approve ERC20 token spending before.
* After listing is sold, it's in a pending state to be processed by the marketplace. Noone receives the assets unless the marketplace operator processes that.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceBuyListing: (testnet: boolean, body: InvokeMarketplaceListingOperation | InvokeTronMarketplaceListingOperation, provider?: string | undefined) => Promise<string>;
/**
* Cancel listing on the marketplace. Only possible for the seller or the operator. There must be no buyer present for that listing. NFT asset is sent back to the seller.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const prepareMarketplaceCancelListing: (testnet: boolean, body: InvokeMarketplaceListingOperation | InvokeTronMarketplaceListingOperation, provider?: string | undefined) => Promise<string>;
/**
* Update marketplace fee.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceUpdateFee: (testnet: boolean, body: UpdateMarketplaceFee | UpdateTronMarketplaceFee, provider?: string | undefined) => Promise<unknown>;
/**
* Update marketplace fee recipient.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceUpdateFeeRecipient: (testnet: boolean, body: UpdateMarketplaceFeeRecipient | UpdateTronMarketplaceFeeRecipient, provider?: string | undefined) => Promise<unknown>;
/**
* Approve ERC20 spending for marketplace to perform buy with ERC20 token.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceApproveErc20Spending: (testnet: boolean, body: ApproveErc20, provider?: string | undefined) => Promise<unknown>;
/**
* Create new listing on the marketplace.
* After listing is created, seller must send the asset to the marketplace smart contract.
* Only listing for existing NFTs can be created - seller must be owner of the NFT asset.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceCreateListing: (testnet: boolean, body: CreateMarketplaceListing | CreateTronMarketplaceListing, provider?: string | undefined) => Promise<unknown>;
/**
* Buy listing on the marketplace. Buyer must either send native assets with this operation, or approve ERC20 token spending before.
* After listing is sold, it's in a pending state to be processed by the marketplace. Noone receives the assets unless the marketplace operator processes that.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceBuyListing: (testnet: boolean, body: InvokeMarketplaceListingOperation | InvokeTronMarketplaceListingOperation, provider?: string | undefined) => Promise<unknown>;
/**
* Cancel listing on the marketplace. Only possible for the seller or the operator. There must be no buyer present for that listing. NFT asset is sent back to the seller.
* @param testnet chain to work with
* @param body request data
* @param provider optional provider to enter. if not present, Tatum Web3 will be used.
* @returns {txId: string} Transaction ID of the operation, or signatureID in case of Tatum KMS
*/
export declare const sendMarketplaceCancelListing: (testnet: boolean, body: InvokeMarketplaceListingOperation | InvokeTronMarketplaceListingOperation, provider?: string | undefined) => Promise<unknown>;
export {};