@arcblock/did-util
Advanced tools
Comparing version 0.27.10 to 0.27.11
@@ -13,4 +13,4 @@ /** | ||
const { fromHash, toDid } = require('@arcblock/did'); | ||
const { createMessage } = require('@arcblock/forge-message/lite'); | ||
const { transactions } = require('@arcblock/forge-proto/lite'); | ||
const { createMessage } = require('@arcblock/forge-message'); | ||
const { transactions } = require('@arcblock/forge-proto'); | ||
@@ -26,3 +26,3 @@ /** | ||
function toAssetAddress(itx) { | ||
return toItxAddress(itx, 'CreateAssetTx'); | ||
return toItxAddress(itx, 'CreateAssetTx', types.RoleType.ROLE_ASSET); | ||
} | ||
@@ -48,5 +48,7 @@ | ||
* @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 | ||
*/ | ||
function toItxAddress(itx, type) { | ||
function toItxAddress(itx, type, role = types.RoleType.ROLE_TX) { | ||
if (transactions.indexOf(type) === -1) { | ||
@@ -57,5 +59,6 @@ throw new Error(`Unsupported itx type ${type}`); | ||
const message = createMessage(type, itx); | ||
// console.log({ message: message.toObject(), itx }); | ||
const itxBytes = message.serializeBinary(); | ||
const hash = Hasher.SHA3.hash256(itxBytes); | ||
const address = fromHash(hash, types.RoleType.ROLE_ASSET); | ||
const address = fromHash(hash, role); | ||
return address; | ||
@@ -62,0 +65,0 @@ } |
{ | ||
"name": "@arcblock/did-util", | ||
"description": "Helper function to calculate did", | ||
"version": "0.27.10", | ||
"version": "0.27.11", | ||
"author": { | ||
@@ -21,7 +21,7 @@ "name": "wangshijun", | ||
"dependencies": { | ||
"@arcblock/did": "^0.27.10", | ||
"@arcblock/forge-message": "^0.27.0", | ||
"@arcblock/did": "^0.27.11", | ||
"@arcblock/forge-message": "^0.27.11", | ||
"@arcblock/forge-util": "^0.27.0", | ||
"@arcblock/forge-wallet": "^0.27.10", | ||
"@arcblock/mcrypto": "^0.27.10" | ||
"@arcblock/forge-wallet": "^0.27.11", | ||
"@arcblock/mcrypto": "^0.27.11" | ||
}, | ||
@@ -71,3 +71,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "21a4ed3390beb480e028962773e3eb3c5feccc33" | ||
"gitHead": "2f8546fd7257926b7452e2be68d0485e6b4ffdd1" | ||
} |
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
8883
175
Updated@arcblock/did@^0.27.11
Updated@arcblock/mcrypto@^0.27.11