@dc3-network/dc3js 0.2.0 → 0.3.0
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 +16 -0
- package/index.js +6 -22
- package/package.json +1 -1
- package/query/index.js +4 -7
- package/query/v1/index.js +9 -4
- package/tx/index.js +4 -7
- package/tx/v1/index.js +10 -5
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
# @dc3-network/dc3js
|
|
2
2
|
|
|
3
3
|
Javascript SDK for the DC3 blockchain
|
|
4
|
+
|
|
5
|
+
## Package Structure
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
dc3js/ # main entry point
|
|
9
|
+
|- client/
|
|
10
|
+
|- config/ # import to customize chain configuration
|
|
11
|
+
|- query/ # import to access query message types and encoders
|
|
12
|
+
|- tx/ # import to access transaction message types and encoders
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## License
|
|
16
|
+
|
|
17
|
+
MIT
|
|
18
|
+
|
|
19
|
+
See [LICENSE](LICENSE) file for details.
|
package/index.js
CHANGED
|
@@ -20,29 +20,13 @@ export const testAssetLists = testnet.assetLists();
|
|
|
20
20
|
export const devAssetLists = devnet.assetLists();
|
|
21
21
|
|
|
22
22
|
export const encoders = [
|
|
23
|
-
...query.
|
|
24
|
-
...tx.
|
|
23
|
+
...query.encoders,
|
|
24
|
+
...tx.encoders
|
|
25
25
|
];
|
|
26
26
|
|
|
27
27
|
export const versionedEncoders = {
|
|
28
|
-
v1:
|
|
29
|
-
...query.v1,
|
|
30
|
-
...tx.v1
|
|
31
|
-
|
|
28
|
+
v1: [
|
|
29
|
+
...query.v1.encoders,
|
|
30
|
+
...tx.v1.encoders
|
|
31
|
+
]
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
const ex = {
|
|
35
|
-
query: {
|
|
36
|
-
v1: query.v1,
|
|
37
|
-
...query.default
|
|
38
|
-
},
|
|
39
|
-
tx: {
|
|
40
|
-
v1: tx.v1,
|
|
41
|
-
...tx.default
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const {
|
|
46
|
-
query,
|
|
47
|
-
tx
|
|
48
|
-
} = ex;
|
package/package.json
CHANGED
package/query/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {messages as v1} from './v1/index.js';
|
|
3
|
+
import * as v1 from './v1/index.js';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
// export default version
|
|
6
|
+
export * from './v1/index.js';
|
|
7
7
|
|
|
8
|
+
// export all versions
|
|
8
9
|
export {
|
|
9
|
-
// default version
|
|
10
|
-
v1 as default,
|
|
11
|
-
|
|
12
|
-
// all versions
|
|
13
10
|
v1
|
|
14
11
|
};
|
package/query/v1/index.js
CHANGED
|
@@ -7,9 +7,14 @@ import * as nodeMsgPkg from '@dc3-network/x-node-types/v1/query';
|
|
|
7
7
|
import * as orgMsgPkg from '@dc3-network/x-org-types/v1/query';
|
|
8
8
|
import * as jobMsgPkg from '@dc3-network/x-job-types/v1/query';
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
// export all dc3 chain messages
|
|
11
|
+
export * from '@dc3-network/x-node-types/v1/query';
|
|
12
|
+
export * from '@dc3-network/x-org-types/v1/query';
|
|
13
|
+
export * from '@dc3-network/x-job-types/v1/query';
|
|
11
14
|
|
|
12
|
-
const
|
|
15
|
+
export const encoders = [];
|
|
16
|
+
|
|
17
|
+
const registerEncoders = (pkg) => {
|
|
13
18
|
if (!pkg || !pkg.protobufPackage) {
|
|
14
19
|
return;
|
|
15
20
|
}
|
|
@@ -29,8 +34,8 @@ const registerMessages = (pkg) => {
|
|
|
29
34
|
v.typeUrl = '/' + protoPkg + '.' + k;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
encoders.push(v);
|
|
33
38
|
});
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
forEach([nodeMsgPkg, orgMsgPkg, jobMsgPkg],
|
|
41
|
+
forEach([nodeMsgPkg, orgMsgPkg, jobMsgPkg], registerEncoders);
|
package/tx/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {messages as v1} from './v1/index.js';
|
|
3
|
+
import * as v1 from './v1/index.js';
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
// export default version
|
|
6
|
+
export * from './v1/index.js';
|
|
7
7
|
|
|
8
|
+
// export all versions
|
|
8
9
|
export {
|
|
9
|
-
// default version
|
|
10
|
-
v1 as default,
|
|
11
|
-
|
|
12
|
-
// all versions
|
|
13
10
|
v1
|
|
14
11
|
};
|
package/tx/v1/index.js
CHANGED
|
@@ -7,9 +7,14 @@ import * as nodeMsgPkg from '@dc3-network/x-node-types/v1/tx';
|
|
|
7
7
|
import * as orgMsgPkg from '@dc3-network/x-org-types/v1/tx';
|
|
8
8
|
import * as jobMsgPkg from '@dc3-network/x-job-types/v1/tx';
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
// export all dc3 chain messages
|
|
11
|
+
export * from '@dc3-network/x-node-types/v1/tx';
|
|
12
|
+
export * from '@dc3-network/x-org-types/v1/tx';
|
|
13
|
+
export * from '@dc3-network/x-job-types/v1/tx';
|
|
11
14
|
|
|
12
|
-
const
|
|
15
|
+
export const encoders = [];
|
|
16
|
+
|
|
17
|
+
const registerEncoders = (pkg) => {
|
|
13
18
|
if (!pkg || !pkg.protobufPackage) {
|
|
14
19
|
return;
|
|
15
20
|
}
|
|
@@ -21,7 +26,7 @@ const registerMessages = (pkg) => {
|
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
forEach(pkg, (v, k) => {
|
|
24
|
-
if (k.substring(
|
|
29
|
+
if (k.substring(-7) !== 'Request' && k.substring(-8) !== 'Response') {
|
|
25
30
|
return;
|
|
26
31
|
}
|
|
27
32
|
|
|
@@ -29,8 +34,8 @@ const registerMessages = (pkg) => {
|
|
|
29
34
|
v.typeUrl = '/' + protoPkg + '.' + k;
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
encoders.push(v);
|
|
33
38
|
});
|
|
34
39
|
};
|
|
35
40
|
|
|
36
|
-
forEach([nodeMsgPkg, orgMsgPkg, jobMsgPkg],
|
|
41
|
+
forEach([nodeMsgPkg, orgMsgPkg, jobMsgPkg], registerEncoders);
|