Marketplaces can create an on-chain abstraction that allows them to host NFT listings and collects fees from sales.
import { NftClient } from '../src';
import { PACKAGE_OBJECT_ID, signer } from './common';
export const createFee = async () => {
const transaction = NftClient.buildCreateFlatFee({
packageObjectId: PACKAGE_OBJECT_ID,
rate: 1000,
});
const createFeeResult = await signer.executeMoveCall(transaction);
console.log('createFeeResult', JSON.stringify(createFeeResult));
};
createFee();
import { NftClient } from '../src';
import { FEE_OBJECT_ID, PACKAGE_OBJECT_ID, signer } from './common';
export const initLaunchpad = async () => {
const pubKey = await signer.getAddress();
const transaction = NftClient.buildInitLaunchpad({
packageObjectId: PACKAGE_OBJECT_ID,
admin: `0x${pubKey}`, // launchpad admin,
receiver: `0x${pubKey}`, // launchpad receiver
defaultFee: FEE_OBJECT_ID,
autoApprove: true,
});
const initLaunchpadResult = await signer.executeMoveCall(transaction);
console.log('initLaunchpadResult', JSON.stringify(initLaunchpadResult));
};
initLaunchpad();