@arcblock/did-util
Advanced tools
Comparing version 0.28.4 to 0.29.0
@@ -27,5 +27,7 @@ // Generate by [js2dts@0.3.3](https://github.com/whxaxes/js2dts#readme) | ||
* @param {object} itx - an object of forge supported itx | ||
* @param {string} type - itx type string | ||
* @param {enum} [role=types.RoleType.ROLE_TX] - role type | ||
* @returns {string} itx address without `did:abt:` prefix | ||
*/ | ||
declare function toItxAddress(itx: any, type: any): string; | ||
declare function toItxAddress(itx: any, type: string, role?: any): string; | ||
/** | ||
@@ -60,2 +62,11 @@ * Create an itx did | ||
declare function toStakeDid(sender: string, receiver: string): string; | ||
/** | ||
* Generate a tether address from the deposit tether tx hash | ||
* | ||
* @public | ||
* @static | ||
* @param {string} hash - DepositTetherTx hash | ||
* @returns {string} stake address without `did:abt:` prefix | ||
*/ | ||
declare function toTetherAddress(hash: string): string; | ||
declare const _Lib: _Lib.T100; | ||
@@ -70,4 +81,5 @@ declare namespace _Lib { | ||
toStakeDid: typeof toStakeDid; | ||
toTetherAddress: typeof toTetherAddress; | ||
} | ||
} | ||
export = _Lib; |
@@ -87,5 +87,3 @@ /** | ||
const receiverBuffer = Buffer.from(receiver); | ||
const buffer = Buffer.concat( | ||
sender < receiver ? [senderBuffer, receiverBuffer] : [receiverBuffer, senderBuffer] | ||
); | ||
const buffer = Buffer.concat([senderBuffer, receiverBuffer]); | ||
const hash = Hasher.SHA3.hash256(buffer); | ||
@@ -96,2 +94,14 @@ return fromHash(hash, types.RoleType.ROLE_STAKE); | ||
/** | ||
* Generate a tether address from the deposit tether tx hash | ||
* | ||
* @public | ||
* @static | ||
* @param {string} hash - DepositTetherTx hash | ||
* @returns {string} stake address without `did:abt:` prefix | ||
*/ | ||
function toTetherAddress(hash) { | ||
return fromHash(hash, types.RoleType.ROLE_TETHER); | ||
} | ||
/** | ||
* Generate an stake address, eg: the did of the stake | ||
@@ -116,2 +126,3 @@ * | ||
toStakeDid, | ||
toTetherAddress, | ||
}; |
{ | ||
"name": "@arcblock/did-util", | ||
"description": "Helper function to calculate did", | ||
"version": "0.28.4", | ||
"version": "0.29.0", | ||
"author": { | ||
@@ -21,8 +21,8 @@ "name": "wangshijun", | ||
"dependencies": { | ||
"@arcblock/did": "^0.28.1", | ||
"@arcblock/forge-message": "^0.28.4", | ||
"@arcblock/forge-proto": "^0.28.3", | ||
"@arcblock/forge-util": "^0.28.0", | ||
"@arcblock/forge-wallet": "^0.28.4", | ||
"@arcblock/mcrypto": "^0.28.0" | ||
"@arcblock/did": "^0.29.0", | ||
"@arcblock/forge-message": "^0.29.0", | ||
"@arcblock/forge-proto": "^0.29.0", | ||
"@arcblock/forge-util": "^0.29.0", | ||
"@arcblock/forge-wallet": "^0.29.0", | ||
"@arcblock/mcrypto": "^0.29.0" | ||
}, | ||
@@ -73,3 +73,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "fd0ce7603b7b16f7fd2a6b550e35518909f10a6e" | ||
"gitHead": "6e922db0d834db071d8208d56cbf46175192e301" | ||
} |
@@ -7,10 +7,10 @@ # [**@arcblock/did-util**](https://github.com/arcblock/forge-js) | ||
## Table of Contents | ||
- [**@arcblock/did-util**](#arcblockdid-util) | ||
- [Table of Contents](#table-of-contents) | ||
- [Install](#install) | ||
- [Usage](#usage) | ||
- [Documentation](#documentation) | ||
* [Install](#install) | ||
* [Usage](#usage) | ||
* [Documentation](#documentation) | ||
## Install | ||
@@ -24,2 +24,3 @@ | ||
## Usage | ||
@@ -59,4 +60,12 @@ | ||
## Documentation | ||
For full documentation, checkout [README.md](./docs/README.md). | ||
## Contributors | ||
| Name | Website | | ||
| -------------- | -------------------------- | | ||
| **wangshijun** | <https://ocap.arcblock.io> | |
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
9709
197
69
+ Added@arcblock/did@0.29.3(transitive)
+ Added@arcblock/forge-message@0.29.3(transitive)
+ Added@arcblock/forge-proto@0.29.0(transitive)
+ Added@arcblock/forge-util@0.29.3(transitive)
+ Added@arcblock/forge-wallet@0.29.3(transitive)
+ Added@arcblock/mcrypto@0.29.3(transitive)
- Removed@arcblock/did@0.28.1(transitive)
- Removed@arcblock/forge-message@0.28.4(transitive)
- Removed@arcblock/forge-proto@0.28.3(transitive)
- Removed@arcblock/forge-util@0.28.0(transitive)
- Removed@arcblock/forge-wallet@0.28.4(transitive)
- Removed@arcblock/mcrypto@0.28.0(transitive)
- Removedbase64-url@2.3.3(transitive)
- Removedcall-bind@1.0.8(transitive)
- Removedcall-bind-apply-helpers@1.0.1(transitive)
- Removedcall-bound@1.0.3(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.6(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedisarray@2.0.5(transitive)
- Removedjson-stable-stringify@1.2.1(transitive)
- Removedjsonify@0.0.1(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedobject-keys@1.1.1(transitive)
- Removedset-function-length@1.2.2(transitive)
Updated@arcblock/did@^0.29.0
Updated@arcblock/forge-util@^0.29.0
Updated@arcblock/mcrypto@^0.29.0