@rootfor/lightsaber-js
v1.0.0
Published
Used as SDK for all root contract related operations
Downloads
38
Readme
Introduction
Used as SDK for all root contract related operations. The SDK allows you to perform operations like mint, approve, list & buy
Usage
Everything is available in a simple interface named LightSaber
Initialization
Needs to done before doing anything esle
const lightSaber = await LightSaber.init({
serverBaseUrl: <Server Uri>,
authHeader: {
}
} as SaberSettings)
Mint
Mint to an existing collection
lightSaber.mintToCollection({
tokenAddress: string;
userAddress: string;
chainId: string;
editions: number;
tokenUri: string;
tokenType: TokenType;
onSignatureRequest: (method: any, params: any) => Promise<string>;
}) => Promise<void>
Create a new collection & mint
lightSaber.createCollectionAndMint({
collectionName: string;
userAddress: string;
chainId: string;
editions: number;
tokenUri: string;
royalty: number | null;
tokenType: TokenType;
onSignatureRequest: (method: any, params: any) => Promise<string>;
}) => Promise<void>
Create a new collection, mint & approve the collection
lightSaber.createCollectionMintAndApprove({
collectionName: string;
userAddress: string;
chainId: string;
editions: number;
tokenUri: string;
tokenType: TokenType;
royalty: number | null;
approvalType: ApprovalTypes;
onSignatureRequest: (method: any, params: any) => Promise<string>;
}) => Promise<void>
Approve
Approve for a contract type
lightSaber.approve({
userAddress: string;
tokenAddress: string;
chainId: string;
approvalType: ApprovalTypes;
onSignatureRequest: (method: any, params: any) => Promise<string>;
}) => Promise<void>
List
List the contract to be listed for referral (Returns ref codes)
lightSaber.listApprovedReferral({
userAddress: string;
tokenAddress: string;
tokenId: string;
nftId: number;
count: number;
chainId: string;
onSignatureRequest: (method: any, params: any) => Promise<any>;
skipApproval: boolean;
}) => Promise<any>
List the contract to be listed for seaport
lightSaber.listApprovedSeaport({
offerer: string;
tokenAddress: string;
nftId: number;
tokenType: TokenType;
tokenId: string;
qty: number;
pricePerItem: number;
startTime: number;
chainId: string;
onApprovalSignatureRequest: (method: any, params: any) => Promise<any>;
onSeaportSignatureRequest: (parameters: any) => Promise<string>;
skipApproval: boolean;
}) => Promise<void>
List the contract to be listed for free claim
lightSaber.listApprovedClaim: ({
userAddress: string;
tokenAddress: string;
nftId: number;
chainId: string;
onSignatureRequest: (method: any, params: any) => Promise<any>;
skipApproval: boolean;
}) => Promise<void>
Claim or Buy
Claim the token using refcode
lightSaber.claimWithReferenceCode: ({
userAddress: string;
tokenAddress: string;
tokenOwner: string;
tokenId: string;
leaves: string;
refCode: string;
chainId: string;
onSignatureRequest: (method: any, params: any) => Promise<string>;
}) => Promise<void>
Claim the token for free
lightSaber.claimForFree: ({
userAddress: string;
tokenAddress: string;
tokenOwner: string;
qty: number;
chainId: string;
onSignatureRequest: (method: any, params: any) => Promise<string>;
};) => Promise<void>
Buy the token from seaport
lightSaber.buyFromSeaport: ({
order: any;
onSeaportSignatureRequest: (order: any) => Promise<any>;
}) => Promise<void>