@arcblock/did-util
Advanced tools
Comparing version 0.34.0 to 0.35.0
@@ -52,2 +52,12 @@ // Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme) | ||
/** | ||
* Generate an delegate address, eg: the did of the delegation | ||
* | ||
* @public | ||
* @static | ||
* @param {string} addr1 - delegator address | ||
* @param {string} addr2 - delegatee address | ||
* @returns {string} delegation address that can be used to retrieve delegation state | ||
*/ | ||
declare function toDelegateAddress(addr1: string, addr2: string): string; | ||
/** | ||
* Generate an stake address, eg: the did of the stake | ||
@@ -71,2 +81,11 @@ * | ||
declare function toTetherAddress(hash: string): string; | ||
/** | ||
* Generate a swap address from the setup swap tx hash | ||
* | ||
* @public | ||
* @static | ||
* @param {string} hash - SetupSwapTx hash | ||
* @returns {string} swap address without `did:abt:` prefix | ||
*/ | ||
declare function toSwapAddress(hash: string): string; | ||
declare const _Lib: _Lib.T100; | ||
@@ -80,6 +99,8 @@ declare namespace _Lib { | ||
toStakeAddress: typeof toStakeAddress; | ||
toDelegateAddress: typeof toDelegateAddress; | ||
toStakeDid: typeof toStakeDid; | ||
toTetherAddress: typeof toTetherAddress; | ||
toSwapAddress: typeof toSwapAddress; | ||
} | ||
} | ||
export = _Lib; |
@@ -93,2 +93,19 @@ /** | ||
/** | ||
* Generate an delegate address, eg: the did of the delegation | ||
* | ||
* @public | ||
* @static | ||
* @param {string} addr1 - delegator address | ||
* @param {string} addr2 - delegatee address | ||
* @returns {string} delegation address that can be used to retrieve delegation state | ||
*/ | ||
function toDelegateAddress(addr1, addr2) { | ||
const addr1Buffer = Buffer.from(addr1); | ||
const addr2Buffer = Buffer.from(addr2); | ||
const buffer = Buffer.concat([addr1Buffer, addr2Buffer]); | ||
const hash = Hasher.SHA3.hash256(buffer); | ||
return fromHash(hash, types.RoleType.ROLE_DELEGATE); | ||
} | ||
/** | ||
* Generate a tether address from the deposit tether tx hash | ||
@@ -106,2 +123,14 @@ * | ||
/** | ||
* Generate a swap address from the setup swap tx hash | ||
* | ||
* @public | ||
* @static | ||
* @param {string} hash - SetupSwapTx hash | ||
* @returns {string} swap address without `did:abt:` prefix | ||
*/ | ||
function toSwapAddress(hash) { | ||
return fromHash(hash, types.RoleType.ROLE_SWAP); | ||
} | ||
/** | ||
* Generate an stake address, eg: the did of the stake | ||
@@ -125,4 +154,6 @@ * | ||
toStakeAddress, | ||
toDelegateAddress, | ||
toStakeDid, | ||
toTetherAddress, | ||
toSwapAddress, | ||
}; |
{ | ||
"name": "@arcblock/did-util", | ||
"description": "Helper function to calculate did", | ||
"version": "0.34.0", | ||
"version": "0.35.0", | ||
"author": { | ||
@@ -21,8 +21,8 @@ "name": "wangshijun", | ||
"dependencies": { | ||
"@arcblock/did": "^0.34.0", | ||
"@arcblock/forge-message": "^0.34.0", | ||
"@arcblock/forge-proto": "^0.34.0", | ||
"@arcblock/forge-util": "^0.34.0", | ||
"@arcblock/forge-wallet": "^0.34.0", | ||
"@arcblock/mcrypto": "^0.34.0" | ||
"@arcblock/did": "^0.35.0", | ||
"@arcblock/forge-message": "^0.35.0", | ||
"@arcblock/forge-proto": "^0.35.0", | ||
"@arcblock/forge-util": "^0.35.0", | ||
"@arcblock/forge-wallet": "^0.35.0", | ||
"@arcblock/mcrypto": "^0.35.0" | ||
}, | ||
@@ -67,2 +67,3 @@ "devDependencies": { | ||
"prepush": "CI=1 yarn test", | ||
"upgrade": "yarn generate-dts && yarn generate-docs && yarn format-docs", | ||
"generate-docs": "jsdoc2md lib/index.js > docs/README.md", | ||
@@ -74,3 +75,3 @@ "generate-dts": "j2d lib/index.js", | ||
}, | ||
"gitHead": "e2b48a5c0a28d6b9b2f2948935319365bbcf7dba" | ||
"gitHead": "57a6fb9db075c208775443657fa78c12cfcafc0e" | ||
} |
@@ -9,9 +9,9 @@ ![did-util](https://www.arcblock.io/.netlify/functions/badge/?text=did-util) | ||
## Table of Contents | ||
- [Table of Contents](#Table-of-Contents) | ||
- [Install](#Install) | ||
- [Usage](#Usage) | ||
- [Documentation](#Documentation) | ||
- [Contributors](#Contributors) | ||
* [Install](#install) | ||
* [Usage](#usage) | ||
* [Documentation](#documentation) | ||
* [Contributors](#contributors) | ||
@@ -18,0 +18,0 @@ |
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
11640
247
+ Added@arcblock/did@0.35.2(transitive)
+ Added@arcblock/forge-message@0.35.1(transitive)
+ Added@arcblock/forge-proto@0.35.1(transitive)
+ Added@arcblock/forge-util@0.35.1(transitive)
+ Added@arcblock/forge-wallet@0.35.2(transitive)
+ Added@arcblock/mcrypto@0.35.1(transitive)
- Removed@arcblock/did@0.34.0(transitive)
- Removed@arcblock/forge-message@0.34.0(transitive)
- Removed@arcblock/forge-proto@0.34.0(transitive)
- Removed@arcblock/forge-util@0.34.0(transitive)
- Removed@arcblock/forge-wallet@0.34.0(transitive)
- Removed@arcblock/mcrypto@0.34.0(transitive)
Updated@arcblock/did@^0.35.0
Updated@arcblock/forge-util@^0.35.0
Updated@arcblock/mcrypto@^0.35.0