@arcblock/did-util 1.28.9 → 1.29.1
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/README.md +0 -1
- package/esm/index.d.mts +3 -3
- package/esm/index.mjs +2 -2
- package/lib/index.cjs +2 -2
- package/lib/index.d.cts +3 -3
- package/package.json +9 -10
package/README.md
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
[](https://github.com/prettier/prettier)
|
|
4
3
|
[](https://docs.arcblock.io)
|
|
5
4
|
[](https://gitter.im/ArcBlock/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
|
6
5
|
|
package/esm/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TCreateAssetTx, TCreateFactoryTx, TCreateRollupTx, TCreateTokenFactoryTx, TCreateTokenTx } from "@ocap/types";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create an itx address
|
|
7
7
|
*/
|
|
8
|
-
declare function toItxAddress(itx:
|
|
8
|
+
declare function toItxAddress(itx: Record<string, unknown>, type: string, role?: number): string;
|
|
9
9
|
/**
|
|
10
10
|
* Create an asset address
|
|
11
11
|
*/
|
|
@@ -21,7 +21,7 @@ declare function toTokenAddress(itx: Partial<TCreateTokenTx>): string;
|
|
|
21
21
|
/**
|
|
22
22
|
* Create a token factory address
|
|
23
23
|
*/
|
|
24
|
-
declare function toTokenFactoryAddress(itx: Partial<
|
|
24
|
+
declare function toTokenFactoryAddress(itx: Partial<TCreateTokenFactoryTx>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Create an rollup address
|
|
27
27
|
*/
|
package/esm/index.mjs
CHANGED
|
@@ -51,14 +51,14 @@ function toStakeAddress(sender, receiver, nonce) {
|
|
|
51
51
|
sender,
|
|
52
52
|
receiver,
|
|
53
53
|
nonce
|
|
54
|
-
].filter(Boolean).map((x) => Buffer.from(x)));
|
|
54
|
+
].filter((x) => Boolean(x)).map((x) => Uint8Array.from(Buffer.from(x))));
|
|
55
55
|
return fromHash(Hasher.SHA3.hash256(buffer), types.RoleType.ROLE_STAKE);
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
58
|
* Generate an delegate address, eg: the did of the delegation
|
|
59
59
|
*/
|
|
60
60
|
function toDelegateAddress(delegator, delegatee) {
|
|
61
|
-
const buffer = Buffer.concat([Buffer.from(delegator), Buffer.from(delegatee)]);
|
|
61
|
+
const buffer = Buffer.concat([Uint8Array.from(Buffer.from(delegator)), Uint8Array.from(Buffer.from(delegatee))]);
|
|
62
62
|
return fromHash(Hasher.SHA3.hash256(buffer), types.RoleType.ROLE_DELEGATION);
|
|
63
63
|
}
|
|
64
64
|
|
package/lib/index.cjs
CHANGED
|
@@ -53,14 +53,14 @@ function toStakeAddress(sender, receiver, nonce) {
|
|
|
53
53
|
sender,
|
|
54
54
|
receiver,
|
|
55
55
|
nonce
|
|
56
|
-
].filter(Boolean).map((x) => Buffer.from(x)));
|
|
56
|
+
].filter((x) => Boolean(x)).map((x) => Uint8Array.from(Buffer.from(x))));
|
|
57
57
|
return (0, _arcblock_did.fromHash)(_ocap_mcrypto.Hasher.SHA3.hash256(buffer), _ocap_mcrypto.types.RoleType.ROLE_STAKE);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Generate an delegate address, eg: the did of the delegation
|
|
61
61
|
*/
|
|
62
62
|
function toDelegateAddress(delegator, delegatee) {
|
|
63
|
-
const buffer = Buffer.concat([Buffer.from(delegator), Buffer.from(delegatee)]);
|
|
63
|
+
const buffer = Buffer.concat([Uint8Array.from(Buffer.from(delegator)), Uint8Array.from(Buffer.from(delegatee))]);
|
|
64
64
|
return (0, _arcblock_did.fromHash)(_ocap_mcrypto.Hasher.SHA3.hash256(buffer), _ocap_mcrypto.types.RoleType.ROLE_DELEGATION);
|
|
65
65
|
}
|
|
66
66
|
|
package/lib/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TCreateAssetTx, TCreateFactoryTx, TCreateRollupTx, TCreateTokenFactoryTx, TCreateTokenTx } from "@ocap/types";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Create an itx address
|
|
7
7
|
*/
|
|
8
|
-
declare function toItxAddress(itx:
|
|
8
|
+
declare function toItxAddress(itx: Record<string, unknown>, type: string, role?: number): string;
|
|
9
9
|
/**
|
|
10
10
|
* Create an asset address
|
|
11
11
|
*/
|
|
@@ -21,7 +21,7 @@ declare function toTokenAddress(itx: Partial<TCreateTokenTx>): string;
|
|
|
21
21
|
/**
|
|
22
22
|
* Create a token factory address
|
|
23
23
|
*/
|
|
24
|
-
declare function toTokenFactoryAddress(itx: Partial<
|
|
24
|
+
declare function toTokenFactoryAddress(itx: Partial<TCreateTokenFactoryTx>): string;
|
|
25
25
|
/**
|
|
26
26
|
* Create an rollup address
|
|
27
27
|
*/
|
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.
|
|
4
|
+
"version": "1.29.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "wangshijun",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"wangshijun <shijun@arcblock.io> (https://github.com/wangshijun)"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcblock/did": "1.
|
|
23
|
-
"@ocap/mcrypto": "1.
|
|
24
|
-
"@ocap/message": "1.
|
|
25
|
-
"@ocap/proto": "1.
|
|
26
|
-
"@ocap/types": "1.
|
|
27
|
-
"@ocap/util": "1.
|
|
28
|
-
"@ocap/wallet": "1.
|
|
22
|
+
"@arcblock/did": "1.29.1",
|
|
23
|
+
"@ocap/mcrypto": "1.29.1",
|
|
24
|
+
"@ocap/message": "1.29.1",
|
|
25
|
+
"@ocap/proto": "1.29.1",
|
|
26
|
+
"@ocap/types": "1.29.1",
|
|
27
|
+
"@ocap/util": "1.29.1",
|
|
28
|
+
"@ocap/wallet": "1.29.1"
|
|
29
29
|
},
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"main": "./lib/index.cjs",
|
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.7.5",
|
|
47
|
-
"tsdown": "^0.18.4"
|
|
48
|
-
"typescript": "^5.6.2"
|
|
47
|
+
"tsdown": "^0.18.4"
|
|
49
48
|
},
|
|
50
49
|
"homepage": "https://github.com/ArcBlock/blockchain/tree/master/did/did-util",
|
|
51
50
|
"keywords": [
|