@arcblock/forge-proto
Advanced tools
Comparing version 0.20.1 to 0.20.5
45
init.js
@@ -0,1 +1,6 @@ | ||
/** | ||
* @fileOverview Contains all static generated javascript files from forge-abi and forge-core-protocols | ||
* @module @arcblock/forge-proto | ||
*/ | ||
const get = require('lodash.get'); | ||
@@ -113,3 +118,9 @@ const json = require('./lib/spec.json'); | ||
// Search for a type and its fields descriptor | ||
// | ||
/** | ||
* Search for a type and its fields descriptor, then the result can be used to create a protobuf message | ||
* | ||
* @param {string} type - such as `Transaction`, or `TransferTx` | ||
* @returns {object} | ||
*/ | ||
function getMessageType(type) { | ||
@@ -124,2 +135,12 @@ const { fields, oneofs } = get(spec, type) || get(spec, `abci_vendor.${type}`) || {}; | ||
/** | ||
* Convert type name to typeUrl, return input when no match found | ||
* | ||
* ```javascript | ||
* toTypeUrl('StakeTx') // 'fg:t:stake' | ||
* ``` | ||
* | ||
* @param {string} type | ||
* @returns {string} | ||
*/ | ||
function toTypeUrl(type) { | ||
@@ -129,2 +150,12 @@ return get(typeUrls, type) || type; | ||
/** | ||
* Convert typeUrl string to type constructor name, return input when no match found | ||
* | ||
* ```javascript | ||
* fromTypeUrl('fg:t:stake') // StakeTx | ||
* ``` | ||
* | ||
* @param {string} url | ||
* @returns {string} | ||
*/ | ||
function fromTypeUrl(url) { | ||
@@ -140,4 +171,16 @@ const found = Object.entries(typeUrls).find(([, value]) => value === url); | ||
return { | ||
/** | ||
* All enum types and its values (number format), can be accessed from width: enums.KEY_TYPE.ED25519 | ||
* | ||
* @member | ||
*/ | ||
enums, | ||
/** | ||
* All enum types and its values (human readable string format), can be accessed from width: messages.KEY_TYPE.ED25519 | ||
* | ||
* @member | ||
*/ | ||
messages, | ||
transactions: enums.SupportedTxs, | ||
@@ -144,0 +187,0 @@ stakes: enums.SupportedStakes, |
{ | ||
"name": "@arcblock/forge-proto", | ||
"description": "Static modules generated from forge-sdk protobuf files", | ||
"version": "0.20.1", | ||
"version": "0.20.5", | ||
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)", | ||
@@ -62,3 +62,3 @@ "engines": { | ||
}, | ||
"gitHead": "081809219385c09c6198bde48f9200eac107412b" | ||
"gitHead": "b8526f942e8a04bcbeb47b0d6e1bd77570a29dd2" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1701193
48889