1.0.17 • Published 4 years ago

jbb-sdk v1.0.17

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

#jbb-sdk

连接Jbb桌面端的sdk

浏览器:谷歌浏览器、Safari

1.0.15版本加入了wss连接。这个是为了支持ios的

##使用

import {JbbSdk} from 'jbb-sdk';


this.jbbSdk = new JbbSdk();

 this.jbbSdk.enable().then((result: boolean) => {
      console.log('enable', result);
    }).catch((err: any) => {
      console.log('enable err', err);
    })

##类 JbbSdk

提供的方法:

/**
   * 用户授权,是否允许后续操作
   * 等待上一次调用完成后,再进行下一次调用。否则直接异常给出。
   *
   * @return Promise<boolean>
   */
  public enable(): Promise<boolean>


  /**
   * 获取钱包列表
   * @return Promise<Array<JbbWallet>>
   */
  public getWallets(): Promise<Array<JbbWallet>>



  /**
   * 获取当前正在使用的EOS钱包信息
   * @return Promise<JbbWallet|null>
   */
  public getUseEosWallet(): Promise<JbbWallet | null>


  /**
   * 获取当前正在使用的ETH钱包信息
   * @return Promise<JbbWallet|null>
   */
  public getUseEthWallet(): Promise<JbbWallet | null>



  /**
   * eos兑换BBC
   * @param quantity
   * @return Promise<Object> 返回的对象{tx:'交易hashId',orderId:'这次兑换的订单id'}
   */
  public eosConvertBBC(quantity: any): Promise<any>


  /**
   * 客户端跳转到买EOS页面
   * @param from 'DesktopReader'
   * @return Promise<boolean>
   */
  public gotoBuyEos(from: string): Promise<boolean>

  /**
   * 客户端跳转到钱包列表页面
   * @param from 'DesktopReader'
   * @return Promise<boolean>
   */
  public gotoWalletList(from: string): Promise<boolean>

   /**
   * 客户端跳转到创建区块链账号
   * @param from 'DesktopReader'
   * @return Promise<boolean>
   */
  public gotoCreateChainAccount(from: string): Promise<boolean>

  /**
   * 客户端最大化
   */
  public maximize(): Promise<boolean>


  /**
   * 返回原来的大小
   */
  public unmaximize(): Promise<boolean>

##错误异常

如果返回的error的code为下面几种类型。

export const ErrorCodes = {

  NO_AUTHORITY: 500,//没有权限
   NO_CONNECT: 501,//没有连接成功
  NO_INIT_WALLET: 505,//钱包没有初始化
  NO_WALLET: 510,//没有钱包
  REJECT_UNLOCK: 520,//拒绝解锁
  CALL_MUCH:530,//调用太频繁
  REJECT:540,//被拒绝
  AMOUNT_INVALID:550,//金额有误
  OPERATE_INVALID:560,//操作不合规
}
1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago