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

eos-wallet-js

v1.0.26

Published

js wallet sdk for eos

Downloads

8

Readme

[TOC]

eos-wallet-js

简介

eos-wallet-js是一个适配了多款钱包的JS-SDK,为了方便DApp开发者快速开发DApp并上线多款主流钱包,本项目采用统一的API接口。

目前已经对接的钱包应用包括: Scatter、TokenPacket、MeetOne、麦子钱包、比特派、EOSToken

未来我们希望能够将本项目做成一套通用的标准协议,正在与各大钱包厂商协商

如果您的钱包项目愿意添加到本项目中,请联系我们:

微信:

telegram: https://t.me/eoswalletjs

示例程序

注意

如果在chrome浏览器打开,请先配置好Scatter钱包 chrome插件的主网信息为:api.eosbeijing.one节点的信息

git clone https://github.com/yuanjunliang/eos-wallet-js.git
cd eos-wallet-js
git checkout -b test origin/test
yarn install
npm start

API接口

用法

  • 安装钱包
npm install eos-wallet-js --save
或
yarn add eos-wallet-js
  • 使用
const network = {
    blockchain:'eos',
    protocol:'https',
    host:'api.eosbeijing.one',
    port:443,
    chainId:"aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906"
}

const config = {
    dappName:"dapp",        // required:true
    initTimeout:5000,       // required:false default:5000 connect to scatter timeout
    to:"yuanjunliang"
}

import EOSWallet from 'eos-wallet-js'
// create wallet
const Wallet = EOSWallet(network,config)

注:

以下所有接口都支持Promise和async/await的方式调用

  • connect
// connect to wallet
Wallet.connect((connected)=>{})
  • getIdentity
// get account identity
Wallet.getIdentity((error,account)=>{
	console.log(error,account)
})
  • forgetIdentity
// forget account identity
Wallet.forgetIdentity()
  • getBalance
// get account current balance
let params = {
    accountName:"",
    code:"",    // default "eosio.token"
    symbol:""   // default "EOS"
}
Wallet.getBalance(params,(error,response)=>{})
  • getAccount
// get account info
Wallet.getAccount(accountName,(error,response)=>{})
  • transfer
// transfer
let params = {
    from: string,
    to: string,
    count: number|string,
    precision: number|string,  // default:4
    memo: string
}
Wallet.transfer(params,(error,response)=>{
	console.log(error,response)
})
  • pushTransaction
// pushTransaction : call contract method
// 该方法用于调用一些智能合约接口
let action = {
    actions: [{
      account: 'eosio.token',
      name: 'transfer',
      authorization: [{
        actor: 'useraaaaaaaa',
        permission: 'active',
      }],
      data: {
        from: 'useraaaaaaaa',
        to: 'useraaaaaaab',
        quantity: '0.0001 SYS',
        memo: '',
      },
    }]
}

let blocksBehind = {
    blocksBehind: 3,
    expireSeconds: 30,
}

let params = [action,blocksBehind]
Wallet.pushTransaction(params,(error,response)=>{})
  • eosjs api
// 其他eosjs api方法,查看eos模块
Wallet.eos

eosjs api 接口调用方法请参考:https://eosio.github.io/eosjs/