UNPKG

@tatumio/tatum-v1

Version:

Tatum API client allows browsers and Node.js clients to interact with Tatum API.

194 lines (193 loc) 12.8 kB
import { ApproveErc20, ApproveNftTransfer, CreateAuction, Currency, DeployNftAuction, InvokeAuctionOperation, UpdateAuctionFee, UpdateMarketplaceFeeRecipient } from '../../model'; export interface Auction { seller: string; nftAddress: string; tokenId: string; isErc721: boolean; endedAt: string; startedAt: string; erc20Address?: string; amount: string; endingPrice: string; bidder?: string; highestBid?: string; } /** * For more details, see <a href="https://apidoc.tatum.io/#operation/MPAuctionFee" target="_blank">Tatum API documentation</a> */ export declare const getAuctionFee: (chain: Currency, contractAddress: string) => Promise<number>; /** * For more details, see <a href="https://apidoc.tatum.io/#operation/MPAuction" target="_blank">Tatum API documentation</a> */ export declare const getAuction: (chain: Currency, contractAddress: string, auctionId: string) => Promise<Auction>; /** * For more details, see <a href="https://apidoc.tatum.io/#operation/MPAuctionRecipient" target="_blank">Tatum API documentation</a> */ export declare const getAuctionFeeRecipient: (chain: Currency, contractAddress: string) => Promise<{ address: string; }>; /** * Deploy new smart contract for NFT auction logic. Smart contract enables auction operator to create new auction for NFT (ERC-721/1155). * Operator can set a fee in percentage, which will be paid on top of the price of the asset. * can be offered for native asset - ETH, BSC, etc. - or any ERC20 token - this is configurable during auction creation. * Before auction is created, seller must approve transfer of the NFT to the auction contract. * Buyer will bid for the asset from the auction using native asset - send assets along the gid() smart contract call, or via ERC20 token. * Buyer of the auction must perform approval for the smart contract to access ERC20 token, before the actual bid() method is called. * Once there is higher bid than the actual one, the previous bidder's funds will be returned to him and new bidder will be the current winning one. * When auction ends, anyone can settle the auction - NFT will be sent to the bidder, assets to the seller and fee 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 deployAuction: (testnet: boolean, body: DeployNftAuction, provider?: string | undefined) => Promise<unknown>; /** * Prepare signed transaction for NFT auction logic. Smart contract enables auction operator to create new auction for NFT (ERC-721/1155). * Operator can set a fee in percentage, which will be paid on top of the price of the asset. * can be offered for native asset - ETH, BSC, etc. - or any ERC20 token - this is configurable during auction creation. * Before auction is created, seller must approve transfer of the NFT to the auction contract. * Buyer will bid for the asset from the auction using native asset - send assets along the gid() smart contract call, or via ERC20 token. * Buyer of the auction must perform approval for the smart contract to access ERC20 token, before the actual bid() method is called. * Once there is higher bid than the actual one, the previous bidder's funds will be returned to him and new bidder will be the current winning one. * When auction ends, anyone can settle the auction - NFT will be sent to the bidder, assets to the seller and fee 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 prepareDeployAuction: (testnet: boolean, body: DeployNftAuction, provider?: string | undefined) => Promise<string>; /** * Update auction 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 prepareAuctionUpdateFee: (testnet: boolean, body: UpdateAuctionFee, provider?: string | undefined) => Promise<string>; /** * Update auction 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 prepareAuctionUpdateFeeRecipient: (testnet: boolean, body: UpdateMarketplaceFeeRecipient, provider?: string | undefined) => Promise<string>; /** * Approve NFT transfer for auction to perform listing of the 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 prepareAuctionApproveNftTransfer: (testnet: boolean, body: ApproveNftTransfer, provider?: string | undefined) => Promise<string>; /** * Approve ERC20 transfer for auction to perform bidding on the asset in the auction. * @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 prepareAuctionApproveErc20Transfer: (testnet: boolean, body: ApproveErc20, provider?: string | undefined) => Promise<string>; /** * Create new auction on the auction contract. Before auction, seller must approve spending of the NFT token for the Auction contract. * After auction is created, auction contract transfers the asset to the auction smart contract. * Only auction 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 prepareAuctionCreate: (testnet: boolean, body: CreateAuction, provider?: string | undefined) => Promise<string>; export declare const existsAuction: (testnet: boolean, chain: Currency, id: string, contractAddress: string, provider?: string | undefined) => Promise<boolean>; /** * Bid on the auction. Buyer must either send native assets with this operation, or approve ERC20 token spending before. * After auction is sold, it's in a pending state to be processed by the auction. Noone receives the assets unless the auction 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 prepareAuctionBid: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<string>; /** * Cancel auction on the auction. Only possible for the seller or the operator. There must be no buyer present for that auction. 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 prepareAuctionCancel: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<string>; /** * Settle auction. There must be buyer present for that auction. NFT will be sent to the bidder, assets to the seller and fee 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 prepareAuctionSettle: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<string>; /** * Update auction 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 sendAuctionUpdateFee: (testnet: boolean, body: UpdateAuctionFee, provider?: string | undefined) => Promise<unknown>; /** * Update auction 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 sendAuctionUpdateFeeRecipient: (testnet: boolean, body: UpdateMarketplaceFeeRecipient, provider?: string | undefined) => Promise<unknown>; /** * Approve NFT transfer for auction to perform listing of the 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 sendAuctionApproveNftTransfer: (testnet: boolean, body: ApproveNftTransfer, provider?: string | undefined) => Promise<unknown>; /** * Approve ERC20 transfer for auction to perform bidding on the asset in the auction. * @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 sendAuctionApproveErc20Transfer: (testnet: boolean, body: ApproveErc20, provider?: string | undefined) => Promise<unknown>; /** * Create new auction on the auction contract. Before auction, seller must approve spending of the NFT token for the Auction contract. * After auction is created, auction contract transfers the asset to the auction smart contract. * Only auction 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 sendAuctionCreate: (testnet: boolean, body: CreateAuction, provider?: string | undefined) => Promise<unknown>; /** * Bid auction on the auction. Buyer must either send native assets with this operation, or approve ERC20 token spending before. * After auction is sold, it's in a pending state to be processed by the auction. Noone receives the assets unless the auction 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 sendAuctionBid: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<unknown>; /** * Cancel auction on the auction. Only possible for the seller or the operator. There must be no buyer present for that auction. 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 sendAuctionCancel: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<unknown>; /** * Settle auction. There must be buyer present for that auction. NFT will be sent to the bidder, assets to the seller and fee 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 sendAuctionSettle: (testnet: boolean, body: InvokeAuctionOperation, provider?: string | undefined) => Promise<unknown>;