@arcblock/did-util 1.18.121 → 1.18.123

Sign up to get free protection for your applications and to get access to all the features.
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.123",
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.123",
22
+ "@ocap/mcrypto": "1.18.123",
23
+ "@ocap/message": "1.18.123",
24
+ "@ocap/proto": "1.18.123",
25
+ "@ocap/types": "1.18.123",
26
+ "@ocap/util": "1.18.123",
27
+ "@ocap/wallet": "1.18.123"
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": "fa235d164885434399fafe96860d8e5c137bce3b"
63
63
  }