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

dplatformos-transactionparser

v1.0.5

Published

解析交易

Downloads

9

Readme

解析交易的行为和含义

使用方法:

npm install @33cn/chain33-transaction-parser
import { txParser, txInWords, parseTransferNote } from '@33cn/chain33-transaction-parser'

确定交易的含义,主要由执行器execer的类别,以及传参payload来确定

txmap.ts 文件中包含对execer的翻译以及payload中代表价值的字段判断

栗子

const execer = 'ticket'
const payload = {
    "miner": {
        "bits": 508549505,
        "reward": "1800000000",
        "ticketId": "1bgg6HwQretMiVcSWvayPRvVtwjyKfz1J:0x5b7a322ab74e65d7482ad1d6877a23de98e0f6b5c15d5d92bb3dcbfed5be89f5:0000000000",
        "modify": "0x307837306161376436623761326335646362376366643438316464383065663838323437616338656564326135383233636139613862663763633562376238633130",
        "privHash": null
    },
    "ty": 16
}
//  解析交易内容
const { execerName, action } = txParser(execer, payload, 'cn')
// execerName -> 购票
// action -> {"name":"挖矿","amount":1800000000,"coin":"BTY"}
// 解析交易内容并以字符串形式输出

var words = txInWords(execer, payload, 'cn')
// words -> '购票 {"name":"挖矿","amount":1800000000,"coin":"BTY"}'

6.0.2开始 转账的相关交易中note字段底层在处理时会以 byte[] 形式储存

展示时一般需要转换为utf8

parseTransferNote('0xe5ae89e585a8e694afe587bae8b4b9e794a83a20313030303030')
// 安全支出费用: 100000

tools.ts 中提供了各种格式字符串的转换

//  16进制字符串转unicode字符串
var hex2str = hex2str(hex)
//  unicode字符串转16进制字符串
var str2hex = str2hex(str)
// ... 等等 详情参见tools.ts