0.2.20 • Published 3 years ago

cbwclient v0.2.20

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

cbwclient

使用流程

app 接入

  • 从 cbw 申请租户,获取到 tenantKey
  • 导入 SDK, 初始化配置,设置 tenantKey
  • 在使用转账等功能时调用 SDK 的方法即可

用户使用

  • 用户连接钱包时,选择CBW,否则弹出用户自己安装的钱包列表
  • 用户输入手机号登录/注册,创建钱包
  • 然后授权钱包,后续确认是否允许转账等操作

技术体系

  • 最终生成 vue 组件,在 uniapp 或者其他 vue项目中可直接引用的方式
  • 发布到 npm

发布

npm run lib

npm login

npm publish

Project setup

yarn add cbwclient

出现错误时:

unable to access 'https://github.com/ethereumjs/ethereumjs-abi.git/': Failed to connect to github.com port 443: Timed out

即网络问题,可以使用代理方式下载, 如

yarn config set proxy http://127.0.0.1:7890

完成后还原

yarn config delete proxy

How to use

// main.js
import cbwclient from 'cbwclient'
// 内部使用了 IViewUI 的组件
import 'view-design/dist/styles/iview.css'

Vue.use(cbwclient);
    function showWallet() {
      this.$connBtn.show()
      this.$connBtn.init({
         tenantKey: 'rOPTYYRwvxlEVZaf9mzkk',
         bridge: 'http://localhost:9060',
         infuraId: '3a605cb9422947458b71fecdcf1ac2ab',
         env: 'ropsten'
      })
      this.$connBtn.open()
    }
    function hideWallet() {
      this.$connBtn.hide()
    }
    function transfer() {
      let orderId = 'SXQ12397bk'
      this.$connBtn.transfer(orderId, this.symbol, this.address, this.amount).then(res => {
        console.log('转账成功', res)
      }).catch(err => {
        console.log('转账失败', err)
      })
    }

env 可选值:

  • 'ropsten'
  • 'mainnet'
0.2.16

3 years ago

0.2.15

3 years ago

0.2.20

3 years ago

0.2.17

3 years ago

0.2.13

3 years ago

0.2.11

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.10

3 years ago

0.2.5

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago