@kresuslabs/marketplace v0.4.2-alpha.0
Kresus Marketplace
Name
kresus-marketplace
Installation
install with npm:
npm install @kresuslabs/marketplace --save
install with yarn:
yarn add @kresuslabs/marketplace
Usage For Marketplace
import {NFTPartner} from '@kresuslabs/marketplace';
const config = {
auctionAddress: "0x42219Ead844eda260F2c1Fe750e370537AEEB725",
proxyAddress: "0xA0bcB37189Ad4232387f537a60073fBeb85B4dbD",
provider: provider,
erc20TransferProxy: "0x6a169F4d8Fb90CC2c777d0BA4723076C06A0d0CC",
transferProxy: "0xD077e1ED9457D8bde1FFBAe253491C3c078c4F09", //optional
nftAddress: "0x163a5DfF3480321D224b7f5Cdab6cFed743bF259", //optional
}
const nftPartner = new NFTPartner(config);
Usage For Factory
import {Factory} from '@kresuslabs/marketplace';
Create Store Front:
const newDefaultFeeReceiver = "0xa6D1741395Fe9378630931A2775F0Cea595F46E6";
const newProtocolFee = "250";
const minimalStepBasePoint = "50";
const defaultAdmin = "0xa6D1741395Fe9378630931A2775F0Cea595F46E6";
await Factory.createStoreFront(newDefaultFeeReceiver, newProtocolFee, minimalStepBasePoint, defaultAdmin, wallet); //wallet of super admin of Kresus
Transfer Ownerships:
const transferProxyAddress = "0xD077e1ED9457D8bde1FFBAe253491C3c078c4F09";
const erc20ProxyAddress = "0x6a169F4d8Fb90CC2c777d0BA4723076C06A0d0CC";
const auctionHouseAddress = "0x42219Ead844eda260F2c1Fe750e370537AEEB725";
const defaultAdmin = "0xa6D1741395Fe9378630931A2775F0Cea595F46E6";
await Factory.transferOwnerships(transferProxyAddress, erc20ProxyAddress, auctionHouseAddressHouse, defaultAdmin, wallet);//wallet of super admin of Kresus
Usage For Proxy
Bulk Mint:
const amounts = ["10", "30", "50"];
const data = "0x";
const assetIds = ["1", "2", "3"];
const tokenURIs = ["https://ipfs.io/ipfs/QmP9h59UNm6YiYEwkxzd5U9ChFiqciNnq7QPvK4a3KkHNk", "https://ipfs.io/ipfs/QmP9h59UNm6YiYEwkxzd5U9ChFiqciNnq7QPvK4a3KkHNk", "https://ipfs.io/ipfs/QmP9h59UNm6YiYEwkxzd5U9ChFiqciNnq7QPvK4a3KkHNk"];
await nftPartner.bulkMint(to, amounts, data, maxsupplies, assetIds, tokenURIs);
Burn Batch Token:
const from = "0xA0bcB37189Ad4232387f537a60073fBeb85B4dbD";
const ids = ["1", "2", "3"];
const amounts = ["10", "30", "50"];
await nftPartner.burnBatchToken(from, ids, amounts);
Burn Token:
const from = "0xA0bcB37189Ad4232387f537a60073fBeb85B4dbD";
const id = "1";
const amount = "10";
Finish Auction From Proxy:
const auctionId = "1";
await nftPartner.finishAuctionFromProxy(auctionId);
Get List of Minted Asset IDs:
await nftPartner.getMintedAssets();
Grant Sub Admin Role:
const newSubadmin = "0xA0bcB37189Ad4232387f537a60073fBeb85B4dbD";
await nftPartner.grantRole(newSubadmin);
Mint:
const amount = "10";
const data = "0x";
const tokenURI = "https://ipfs.io/ipfs/QmP9h59UNm6YiYEwkxzd5U9ChFiqciNnq7QPvK4a3KkHNk";
const assetId = "1";
await nftPartner.mint(amount, data, tokenURI, assetId);
Revoke Sub Admin Role:
const subadmin = "0xA0bcB37189Ad4232387f537a60073fBeb85B4dbD";
await nftPartner.revokeRole(newSubadmin);
Start Auction:
const sellToken = "0x274c4e305A5cFF337d6833aE51339bbf86FA60c8";
const sellTokenValue = "10";
const sellTokenId = "1";
const buyAsset = "0x0000000000000000000000000000000000000000";//if buy asset is ETH, else ERC20 address
const minimalPrice = "1000000000000000"; // (0.001ETH) in basic unit of the buying asset
const duration = "1000"; //in seconds
const buyOutPrice = "200000000000000000"; // (0.2ETH) in basic unit of the buying asset
await nftPartner.startAuction(sellToken, sellTokenValue, sellTokenId, buyAsset, minimalPrice, duration, buyOutPrice, provider)
Withdraw ERC20 From Proxy:
const tokenAddress = "0x274c4e305A5cFF337d6833aE51339bbf86FA60c8";
const transferTo = "0xa6D1741395Fe9378630931A2775F0Cea595F46E6";
const amount = "1000000000000000";
await nftPartner.withdrawERC20(tokenAddress, transferTo, amount);
Withdraw Matic From Proxy:
const transferTo = "0xa6D1741395Fe9378630931A2775F0Cea595F46E6";
const amount = "1000000000000000";
await nftPartner.withdrawETH(transferTo, amount);
Usage For Auction
Cancel Auction:
const auctionId = "1";
await nftPartner.cancel(auctionId);
Buyout Auction using ERC20:
const auctionId = "1";
const bidAmount = "200000000000000000"; // (0.2 for ERC20 Token with 18 decimals) in basic unit of the buying asset
await auction.buyOut(auctionId, bidAmount);
Bid on an Auction Item using ERC20:
const auctionId = "1";
const bidAmount = "1000000000000000"; // (0.001 for ERC20 Token with 18 decimals) in basic unit of the buying asset
await auction.bid(auctionId, bidAmount);
Buyout Auction using ETH:
const auctionId = "1";
const bidAmount = "200000000000000000"; // 0.2ETH in Wei
await auction.buyOutWithETH(auctionId, bidAmount);
Bid on an Auction Item using ETH:
const auctionId = "1";
const bidAmount = "1000000000000000"; // 0.001ETH in Wei
await auction.bidWithEth(auctionId, bidAmount);
Finish an auction:
const auctionId = "1";
await auction.finishAuction(auctionId);
Get Next Minimal Bid for an Auction:
const auctionId = "1";
await auction.getMinimalNextBid(auctionId);
Get Auction by Id:
const auctionId = "1";
await auction.getAuctionById(auctionId);
Check Auction Existence:
const auctionId = "1";
await auction.checkAuctionExistence(auctionId);
Check Auction Range Time:
const auctionId = "1";
await auction.checkAuctionRangeTime(auctionId);
Get Protocol Fee:
await auction.getProtocolFee();
Get current buyer:
const auctionId = "1";
await auction.getCurrentBuyer(auctionId);
Get Minimal Duration:
await nftPartner.getMinimalDuration();
Get Active Marketplace Items:
await nftPartner.getMarketplaceItemList();
Get current Auction Id:
await nftPartner.getCurrentAuctionId();
License
MIT
4 months ago
4 months ago
1 year ago
10 months ago
10 months ago
1 year ago
10 months ago
1 year ago
1 year ago
10 months ago
10 months ago
1 year ago
10 months ago
6 months ago
9 months ago
9 months ago
9 months ago
10 months ago
1 year ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago