nftstarsdk
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

NftStarSdk

nftstarsdk

使用方法

  1. Install nftstarsdk NPM package
npm install --save nftstarsdk

# OR

yarn add nftstarsdk
  1. Then you can add nftstarsdk to your Dapp as follows
import NftStarSdk from "nftstarsdk";

/**
* 
* @param {option} SdkOption
*
*/
const option = {site:''}

const sdk = new NftStarSdk(option);

/**
* @description 监听链接状态
* @param {connect:string,callback:(status:string)=>void}
*/

 sdk.on('connect',(status:string)=>{
      switch (status) {
        case 'connect':
          console.log('已链接')
          break;
        case 'disconnect':
          console.log('断开链接')
           break;
        default:
          break;
      }  
}) 
/**
* @description 移出监听链接状态
* @param {connect:string,callback:()=>void}
*/
 sdk.off('connect',()=>{}) 

/**
* @description 链接钱包
* @memberof NftStarSdk
* @returns {Promise<ConnectResult>}
*/
const result = await sdk.connectWallet()

/**
* @description 断开钱包
* @memberof NftStarSdk
*/
const result = await sdk.resetApp()
/**
* @param   {(data:ResultData)=>void} callback  轮询结果回调 code 为0 成功,否则失败
* @param  {number} total startCoin
* @memberof NftStarSdk
* @member  {number} buyStartCoin
* @returns {Promise<TransactionResponse>}
* 
*/

// 提交到链上初始状态
const tx = await sdk.buyStartCoin(1000,(data)=>{})
// 等待链上结果
const receipt = await tx.wait()

Package Sidebar

Install

npm i nftstarsdk

Weekly Downloads

0

Version

1.0.5

License

MIT

Unpacked Size

11 MB

Total Files

53

Last publish

Collaborators

  • shenhaoguangguang