@arcblock/did-util 1.18.121 → 1.18.122

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export declare function toRollupAddress(itx: Partial<TCreateRollupTx>): string;
22
22
  /**
23
23
  * Generate an stake address, eg: the did of the stake
24
24
  */
25
- export declare function toStakeAddress(sender: string, receiver: string): string;
25
+ export declare function toStakeAddress(sender: string, receiver: string, nonce?: string): string;
26
26
  /**
27
27
  * Generate an delegate address, eg: the did of the delegation
28
28
  */
package/lib/index.js CHANGED
@@ -52,8 +52,8 @@ exports.toRollupAddress = toRollupAddress;
52
52
  /**
53
53
  * Generate an stake address, eg: the did of the stake
54
54
  */
55
- function toStakeAddress(sender, receiver) {
56
- const buffer = Buffer.concat([Buffer.from(sender), Buffer.from(receiver)]);
55
+ function toStakeAddress(sender, receiver, nonce) {
56
+ const buffer = Buffer.concat([sender, receiver, nonce].filter(Boolean).map(Buffer.from));
57
57
  const hash = mcrypto_1.Hasher.SHA3.hash256(buffer);
58
58
  return (0, did_1.fromHash)(hash, mcrypto_1.types.RoleType.ROLE_STAKE);
59
59
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcblock/did-util",
3
3
  "description": "Helper function to calculate did",
4
- "version": "1.18.121",
4
+ "version": "1.18.122",
5
5
  "author": {
6
6
  "name": "wangshijun",
7
7
  "email": "shijun@arcblock.io",
@@ -18,13 +18,13 @@
18
18
  "wangshijun <shijun@arcblock.io> (https://github.com/wangshijun)"
19
19
  ],
20
20
  "dependencies": {
21
- "@arcblock/did": "1.18.121",
22
- "@ocap/mcrypto": "1.18.121",
23
- "@ocap/message": "1.18.121",
24
- "@ocap/proto": "1.18.121",
25
- "@ocap/types": "1.18.121",
26
- "@ocap/util": "1.18.121",
27
- "@ocap/wallet": "1.18.121"
21
+ "@arcblock/did": "1.18.122",
22
+ "@ocap/mcrypto": "1.18.122",
23
+ "@ocap/message": "1.18.122",
24
+ "@ocap/proto": "1.18.122",
25
+ "@ocap/types": "1.18.122",
26
+ "@ocap/util": "1.18.122",
27
+ "@ocap/wallet": "1.18.122"
28
28
  },
29
29
  "main": "lib/index.js",
30
30
  "typings": "lib/index.d.ts",
@@ -59,5 +59,5 @@
59
59
  "build": "tsc",
60
60
  "build:watch": "npm run build -- -w"
61
61
  },
62
- "gitHead": "eaf67cc724b5642ad29c441fac3891186013e27c"
62
+ "gitHead": "1d522587088f88d0b6f710e89fa18d5d7acbd61f"
63
63
  }