Install
yarn add @matrix-labs/matrix-storefront-sdk
/**
* first step
*
* @async
* @param fcl: import * as fcl from "@onflow/fcl"
* @param env: import FlowEnv from "@matrix-labs/matrix-marketplace-nft-sdk"
* @param config: optional
export interface IBindConfigs {
fungibleTokenAddress?:string;
fusdAddress?:string;
flowTokenAddress?:string;
nftStorefront?:string;
nonFungibleTokenAddress?:string;
}
* @example import * as fcl from "@onflow/fcl"; const client = new MatrixMarketplaceNFTClient(); client.bindFcl(fcl, FlowEnv.flowTestnet);
*/
bindFcl(fcl: any, env: FlowEnv, config?: IBindConfigs): Promise<void>;
/**
* setup for fcl
* @async
* @param key: fcl config, keyword must start with '0x'
*/
setupFcl(key: string, value: string): Promise<void>;
/**
* before createList or removeList
* @async
* @param address: account's address
*/
checkStorefront(address: string): Promise<boolean>
/**
* if checkStorefront return false
* @async
*/
initStorefront(): Promise<string>;
/**
* @async
* @param supportedNFTName: NFT collection name
* @param supportedNFTAddress: NFT collection contract address
* @param royaltyReceivers: [royaltyReceivers addresses]
* @param royaltyMount: [mounts]
* @param nftId: import * as fcl from "@onflow/fcl"
* @param price: import * as fcl from "@onflow/fcl"
* @example createList("MatrixMarketplaceNFT", "0x7f3812b53dd4de20", 3, 3.14)
*/
createList(supportedNFTName: string, supportedNFTAddress: string, royaltyReceivers: [string], royaltyMount: [string], nftId: number, price: string): Promise<string>;
/**
* @async
* @param supportedNFTName: NFT collection name
* @param supportedNFTAddress: NFT collection contract address
* @param listingResourceId: listing id
* @param sellerAddress: seller's address
* @example purchaseList("MatrixMarketplaceNFT", "0x7f3812b53dd4de20", 31425, "0x9a0766d93b6608b7")
*/
purchaseList(supportedNFTName: string, supportedNFTAddress: string, listingResourceId: number, sellerAddress: string): Promise<string>;
/**
* @async invoke by listing owner
* @param listingResourceId: listing id
* @example removeList(31425)
*/
removeList(listingResourceID: number): Promise<string>;
/**
* @async
* @param account: account's address
* @example getListingIds("0x9a0766d93b6608b7")
*/
getListingIds(account: string): Promise<[number]>;