1.0.0 • Published 8 months ago

@rootfor/lightsaber-js v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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>
1.0.0

8 months ago

0.1.0

8 months ago

0.0.9-dev1

1 year ago

0.0.9

1 year ago

0.0.7-dev3

1 year ago

0.0.7-dev4

1 year ago

0.0.7-dev1

1 year ago

0.0.7-dev2

1 year ago

0.0.8-dev1

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4-dev0

1 year ago

0.0.4

1 year ago

0.0.3-dev12

1 year ago

0.0.3-dev11

1 year ago

0.0.3-dev10

1 year ago

0.0.3-dev9

1 year ago

0.0.3-dev8

1 year ago

0.0.3-dev7

1 year ago

0.0.3-dev6

1 year ago

0.0.3-dev5

1 year ago

0.0.3-dev4

1 year ago

0.0.3-dev3

1 year ago

0.0.3-dev2

1 year ago

0.0.3-dev1

1 year ago

0.0.3-dev0

1 year ago

0.0.3

1 year ago

0.0.2-dev1

1 year ago

0.0.2-dev0

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago