npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@white-matrix/nft-vspark-sdk

v1.1.0

Published

## how to use

Downloads

38

Readme

Solidity SDK Seed

how to use

sample example

const provider = new ethers.providers.Web3Provider(window.ethereum);
const singer = provider.getSigner();
const network = '';
const vspark = new EtherVSParkClient();
vspark.connectProvider(DeploymentInfo[network].vspark.proxyAddress, provider);
vspark.connectSigner(singer);
vspark.setWaitConfirmations(1);

const BUSDAddress = await vspark.BUSD();
const BUSD = new EtherERC20Client();
BUSD.connectProvider(BUSDAddress, provider);
BUSD.connectSigner(singer);
BUSD.setWaitConfirmations(1);

remind

approve BUSD before buy vspark

if(BUSD.allowance(user.address,vspark.address)<balance){
    await BUSD.approve(vspark.address,balance)
}

interface

export interface VSParkClient extends ERC721Client {
    connectProvider(address: string, provider: Provider): VSParkClient;
    connectSigner(signer: Signer): VSParkClient;
    /*======== VSParkClient specific ======*/
    BUSD(): Promise<string>;
    /* view */
    /**
     * Check current stock
     */
    stock(): Promise<BigNumber>;
    /**
     * Get tokenCount
     */
    tokenCount(): Promise<BigNumber>;
    /**
     * Return on current box price
     */
    boxPrice(): Promise<BigNumber>;
    /**
     * Return the series
     * @param seriesId
     * @param config ethers PayableOverrides
     */
    series(seriesId: BigNumber): Promise<VSParkSeries>;
    /**
     * Return on chain item detail information
     * @param tokenId
     * @param config ethers PayableOverrides
     * @returns produceDetail on chain item detail data structure
     */
    tokenDetail(tokenId: BigNumber): Promise<[BigNumber, BigNumber]>;
    /**
     * Verify the recycle transaction
     * @param tokenIds the tokens needs to be recycled
     * @param seriesId used to verify the recycle
     * @return true if the recycle will success and the recycle price; or false if recycle will fail
     */
    verifyRecycle(tokenIds: BigNumber[], seriesId: BigNumber): Promise<[boolean, BigNumber]>;
    /* transactions */
    /**
     * Buy N boxes (N <= 10 for current setup)
     * @param quantity number of boxes, will trigger Web3Provider to send transaction in browser
     * @param config ethers PayableOverrides
     * @return BuyResult including transactionHash and a list of awarded tokenIds
     */
    buy(quantity: BigNumber, config?: PayableOverrides): Promise<ContractBuyResult>;
    /**
     * Recycle the attached tokens
     * @param tokenIds the tokens needs to be recycled
     * @param seriesId
     * @return ContractRecycleResult indicates the success or failure of this recycle transaction
     */
    recycle(tokenIds: BigNumber[], seriesId: BigNumber, config?: PayableOverrides): Promise<ContractRecycleResult>;
    tokenOfOwnerByIndex(owner: string, index: BigNumber): Promise<BigNumber>;
    totalSupply(): Promise<BigNumber>;
    tokenByIndex(index: BigNumber): Promise<BigNumber>;
    /* test function */
    mint(categoryIds: BigNumber[], config?: PayableOverrides): Promise<ContractBuyResult>;
}

export interface ERC20Client {
    connectProvider(address: string, provider: Provider): ERC20Client;

    connectSigner(signer: Signer): ERC20Client;

    setWaitConfirmations(num: number): void;

    /*======== ERC20 standard API ======*/
    /* view function */
    balanceOf(owner: string): Promise<BigNumber>;
    name(): Promise<string>;
    symbol(): Promise<string>;
    decimals(): Promise<number>;
    allowance(owner: string, spender: string): Promise<BigNumber>;
    transfer(recipient: string, tokenId: BigNumber, config?: PayableOverrides): Promise<string>;
    transferFrom(from: string, to: string, tokenId: BigNumber, config?: PayableOverrides): Promise<string>;
    approve(spender:string, amount: BigNumber, config?: PayableOverrides): Promise<string>;
    
}