@vocdoni/proto 1.15.1 → 1.15.2

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.
@@ -5,6 +5,7 @@ on:
5
5
  push:
6
6
  branches:
7
7
  - master
8
+ pull_request:
8
9
 
9
10
  jobs:
10
11
  protobuf-build:
@@ -14,17 +15,16 @@ jobs:
14
15
  uses: actions/checkout@v3
15
16
  - uses: actions/setup-node@v3
16
17
  with:
17
- node-version: "14"
18
+ node-version: "18"
18
19
  - uses: actions/setup-go@v3
19
20
  - name: Build
20
21
  run: |
22
+ make clean
21
23
  make init
22
- make golang
23
- make ts
24
+ make all
24
25
  - name: Commit changes
25
- uses: stefanzweifel/git-auto-commit-action@v2.3.0
26
+ uses: stefanzweifel/git-auto-commit-action@v4
26
27
  with:
27
- commit_message: Auto build commit
28
- branch: master
28
+ commit_message: auto build commit
29
29
  env:
30
30
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/DEVELOPING.md ADDED
@@ -0,0 +1,86 @@
1
+ # Developing
2
+
3
+ ## Introduce changes in dvote-protobuf
4
+
5
+ Do whatever changes you need to do in the `src/**/*.proto` files, and commit them.
6
+
7
+ For example:
8
+
9
+ ```sh
10
+ git clone git@github.com:vocdoni/dvote-protobuf.git && cd dvote-protobuf
11
+ git checkout -b feat-add-DummyMessage # don't use slashes (/)
12
+ cat >> src/vochain/vochain.proto << EOF
13
+ message DummyMessage {
14
+ bytes payload = 1;
15
+ }
16
+ EOF
17
+ git commit . -m "add DummyMessage"
18
+ git push --set-upstream origin feat-add-DummyMessage
19
+ ```
20
+
21
+ if you use slashes in the branch name (say, `example/branch-name`), you won't be able to `go get go.vocdoni.io/proto@example/branch-name` in the next step due to https://github.com/golang/go/issues/32955
22
+
23
+ You don't need to `make all`, just open a PR (see next step) and a github action will do the `make all` for you and autocommit the changes in your PR branch.
24
+
25
+ ## Stage them in a PR of dvote-protobuf
26
+
27
+ Now create a PR:
28
+
29
+ https://github.com/vocdoni/dvote-protobuf/pull/new/feat-add-DummyMessage
30
+
31
+ and wait a minute for the CI to run, it will auto commit the build changes
32
+ ("auto build commit" is pushed to the PR automatically)
33
+
34
+ Don't merge the PR, leave it "staged" (open) because you might want to introduce more changes while developing the other components.
35
+
36
+ ## Use that "staged" dvote-protobuf in vocdoni-node
37
+
38
+ ```sh
39
+ git clone git@github.com:vocdoni/vocdoni-node.git && cd vocdoni-node
40
+ git checkout -b wonderful-feature # here it doesn't matter if you use slashes (/)
41
+ go get go.vocdoni.io/proto@feat-add-DummyMessage # this will pull the code from your PR
42
+ go mod tidy
43
+ git add go.mod go.sum
44
+ git commit -m "bump go.vocdoni.io/proto@feat-add-DummyMessage"
45
+ git push --set-upstream origin wonderful-feature
46
+ ```
47
+
48
+ Now if you create a PR in vocdoni-node with your `wonderful-feature` branch, you'll see the CI of vocdoni-node pulls the dvote-protobuf from `feat-add-DummyMessage`
49
+
50
+ ## Use that "staged" dvote-protobuf in vocdoni-sdk
51
+
52
+ ```sh
53
+ git clone git@github.com:vocdoni/vocdoni-sdk.git && cd vocdoni-sdk
54
+ git checkout -b wonderful-feature # here it doesn't matter if you use slashes (/)
55
+ # edit package.json, so that @vocdoni/proto is pulled from github repo
56
+ # "@vocdoni/proto": "vocdoni/dvote-protobuf#feat-add-DummyMessage"
57
+ git add package.json
58
+ git commit -m "pull @vocdoni/proto from branch feat-add-DummyMessage"
59
+ git push --set-upstream origin wonderful-feature
60
+ ```
61
+
62
+ Now if you create a PR in vocdoni-sdk with your `wonderful-feature` branch, you'll see the CI of vocdoni-sdk pulls the dvote-protobuf from `feat-add-DummyMessage`
63
+
64
+ # Merging
65
+
66
+ When the feature is ready to be merged in all 3 repos (dvote-protobuf, vocdoni-node and vocdoni-sdk), you will:
67
+
68
+ * First, merge the PR in dvote-protobuf, bump the version (say, `1.2.3`) and publish a release (see next step)
69
+ * Then, in vocdoni-node: `go get go.vocdoni.io/proto@v1.2.3` and `go mod tidy`, commit those changes and squash them in the `wonderful-feature` PR, before merging.
70
+ * Then, in vocdoni-sdk, edit `package.json` to point to the release `"@vocdoni/proto": "1.2.3"`, commit those changes an squash them in the `wonderful-feature` PR, before merging.
71
+
72
+ # Release
73
+
74
+ For publishing a new release, a github action has been created in
75
+ order to minimize the work. Just follow these steps:
76
+
77
+ - Checkout `master` branch: `git checkout master`
78
+ - Update the version (say, `1.2.3`) in the `package.json` file
79
+ - Commit the changes: `git commit package.json -m "@vocdoni/proto 1.2.3"`
80
+ - Tag the commit: `git tag v1.2.3`
81
+ - Push the ref and the tag: `git push origin master v1.2.3`
82
+ - Create a new github release: https://github.com/vocdoni/dvote-protobuf/releases/new?tag=v1.2.3
83
+
84
+ As soon as the github release is done, the github action will take care of the rest automatically: build the npm package and publish it on https://www.npmjs.com/package/@vocdoni/proto
85
+
86
+ TODO(gui): automate the release creation step, using the github action, triggered by the push of a tag
package/Makefile CHANGED
@@ -61,7 +61,7 @@ init: protoc $(PROTOC_TS_PLUGIN) protoc-go-plugin
61
61
 
62
62
  ## clean: Remove the build artifacts
63
63
  clean:
64
- rm -Rf build include dist
64
+ rm -Rf build include
65
65
 
66
66
  ## :
67
67
 
@@ -71,7 +71,7 @@ clean:
71
71
 
72
72
 
73
73
  ## all: Generate the source code for all supported languages
74
- all: protoc build/ts build/go/models
74
+ all: golang js
75
75
 
76
76
  ## golang: Generate the Golang protobuf artifacts
77
77
  golang: protoc protoc-go-plugin build/go/models
@@ -97,9 +97,8 @@ build/dart: $(CLIENT_STORE_SOURCES) $(METADATA_SOURCES) $(VOCHAIN_SOURCES)
97
97
  done
98
98
  @touch $@
99
99
 
100
- ## js: Generate the TypeScript protobuf artifacts
101
- js: protoc $(PROTOC_TS_PLUGIN) build/ts
102
- ts: js
100
+ ## ts: Generate the TypeScript protobuf artifacts
101
+ ts: protoc $(PROTOC_TS_PLUGIN) build/ts
103
102
 
104
103
  build/ts: $(VOCHAIN_SOURCES) $(CLIENT_STORE_SOURCES) $(METADATA_SOURCES)
105
104
  mkdir -p build
@@ -111,6 +110,13 @@ build/ts: $(VOCHAIN_SOURCES) $(CLIENT_STORE_SOURCES) $(METADATA_SOURCES)
111
110
  @touch $@
112
111
  npm i --no-package-lock
113
112
 
113
+ ## js: Generate the JavaScript bundle
114
+ js: ts build/js
115
+
116
+ build/js:
117
+ yarn
118
+ yarn build
119
+
114
120
  #-----------------------------------------------------------------------
115
121
  # COMPILERS
116
122
  #-----------------------------------------------------------------------
package/README.md CHANGED
@@ -55,17 +55,9 @@ Then, run `make all` to build all the targets
55
55
  + Build JS/TS models: `make ts`
56
56
  + Build GoLang models: `make golang`
57
57
 
58
- ### Publishing a new npmjs version (ts/js)
58
+ ## Develop / Release
59
59
 
60
- For publishing a new release into npmjs, a github action has been created in
61
- order to minimize the work. Just follow these steps:
62
-
63
- - Do whatever changes you need to do in the `proto` files
64
- - Update the version in the `package.json` file
65
- - Commit the changes
66
- - Create a new release & tag with the version number you used in `package.json`
67
-
68
- The github action will take care of the rest.
60
+ See [DEVELOPING.md]
69
61
 
70
62
  ## Artifacts
71
63
 
@@ -122,3 +114,4 @@ This SDK is licensed under the [GNU Affero General Public License v3.0][license]
122
114
  along with this program. If not, see <https://www.gnu.org/licenses/>.
123
115
 
124
116
  [license]: ./LICENSE
117
+ [DEVELOPING.md]: ./DEVELOPING.md
@@ -8004,7 +8004,8 @@ function createBaseSetProcessTx() {
8004
8004
  censusRoot: void 0,
8005
8005
  censusURI: void 0,
8006
8006
  proof: void 0,
8007
- results: void 0
8007
+ results: void 0,
8008
+ tempSIKs: void 0
8008
8009
  };
8009
8010
  }
8010
8011
  var SetProcessTx = {
@@ -8036,6 +8037,9 @@ var SetProcessTx = {
8036
8037
  if (message.results !== void 0) {
8037
8038
  ProcessResult.encode(message.results, writer.uint32(74).fork()).ldelim();
8038
8039
  }
8040
+ if (message.tempSIKs !== void 0) {
8041
+ writer.uint32(80).bool(message.tempSIKs);
8042
+ }
8039
8043
  return writer;
8040
8044
  },
8041
8045
  decode(input, length) {
@@ -8099,6 +8103,12 @@ var SetProcessTx = {
8099
8103
  }
8100
8104
  message.results = ProcessResult.decode(reader, reader.uint32());
8101
8105
  continue;
8106
+ case 10:
8107
+ if (tag !== 80) {
8108
+ break;
8109
+ }
8110
+ message.tempSIKs = reader.bool();
8111
+ continue;
8102
8112
  }
8103
8113
  if ((tag & 7) === 4 || tag === 0) {
8104
8114
  break;
@@ -8117,7 +8127,8 @@ var SetProcessTx = {
8117
8127
  censusRoot: isSet8(object.censusRoot) ? bytesFromBase643(object.censusRoot) : void 0,
8118
8128
  censusURI: isSet8(object.censusURI) ? String(object.censusURI) : void 0,
8119
8129
  proof: isSet8(object.proof) ? Proof.fromJSON(object.proof) : void 0,
8120
- results: isSet8(object.results) ? ProcessResult.fromJSON(object.results) : void 0
8130
+ results: isSet8(object.results) ? ProcessResult.fromJSON(object.results) : void 0,
8131
+ tempSIKs: isSet8(object.tempSIKs) ? Boolean(object.tempSIKs) : void 0
8121
8132
  };
8122
8133
  },
8123
8134
  toJSON(message) {
@@ -8149,6 +8160,9 @@ var SetProcessTx = {
8149
8160
  if (message.results !== void 0) {
8150
8161
  obj.results = ProcessResult.toJSON(message.results);
8151
8162
  }
8163
+ if (message.tempSIKs !== void 0) {
8164
+ obj.tempSIKs = message.tempSIKs;
8165
+ }
8152
8166
  return obj;
8153
8167
  },
8154
8168
  create(base) {
@@ -8165,6 +8179,7 @@ var SetProcessTx = {
8165
8179
  message.censusURI = object.censusURI ?? void 0;
8166
8180
  message.proof = object.proof !== void 0 && object.proof !== null ? Proof.fromPartial(object.proof) : void 0;
8167
8181
  message.results = object.results !== void 0 && object.results !== null ? ProcessResult.fromPartial(object.results) : void 0;
8182
+ message.tempSIKs = object.tempSIKs ?? void 0;
8168
8183
  return message;
8169
8184
  }
8170
8185
  };
@@ -9359,7 +9374,8 @@ function createBaseProcess() {
9359
9374
  rollingCensusSize: void 0,
9360
9375
  nullifiersRoot: void 0,
9361
9376
  sourceNetworkContractAddr: void 0,
9362
- tokenDecimals: void 0
9377
+ tokenDecimals: void 0,
9378
+ tempSIKs: void 0
9363
9379
  };
9364
9380
  }
9365
9381
  var Process = {
@@ -9454,6 +9470,9 @@ var Process = {
9454
9470
  if (message.tokenDecimals !== void 0) {
9455
9471
  writer.uint32(264).uint32(message.tokenDecimals);
9456
9472
  }
9473
+ if (message.tempSIKs !== void 0) {
9474
+ writer.uint32(272).bool(message.tempSIKs);
9475
+ }
9457
9476
  return writer;
9458
9477
  },
9459
9478
  decode(input, length) {
@@ -9643,6 +9662,12 @@ var Process = {
9643
9662
  }
9644
9663
  message.tokenDecimals = reader.uint32();
9645
9664
  continue;
9665
+ case 34:
9666
+ if (tag !== 272) {
9667
+ break;
9668
+ }
9669
+ message.tempSIKs = reader.bool();
9670
+ continue;
9646
9671
  }
9647
9672
  if ((tag & 7) === 4 || tag === 0) {
9648
9673
  break;
@@ -9682,7 +9707,8 @@ var Process = {
9682
9707
  rollingCensusSize: isSet8(object.rollingCensusSize) ? Number(object.rollingCensusSize) : void 0,
9683
9708
  nullifiersRoot: isSet8(object.nullifiersRoot) ? bytesFromBase643(object.nullifiersRoot) : void 0,
9684
9709
  sourceNetworkContractAddr: isSet8(object.sourceNetworkContractAddr) ? bytesFromBase643(object.sourceNetworkContractAddr) : void 0,
9685
- tokenDecimals: isSet8(object.tokenDecimals) ? Number(object.tokenDecimals) : void 0
9710
+ tokenDecimals: isSet8(object.tokenDecimals) ? Number(object.tokenDecimals) : void 0,
9711
+ tempSIKs: isSet8(object.tempSIKs) ? Boolean(object.tempSIKs) : void 0
9686
9712
  };
9687
9713
  },
9688
9714
  toJSON(message) {
@@ -9777,6 +9803,9 @@ var Process = {
9777
9803
  if (message.tokenDecimals !== void 0) {
9778
9804
  obj.tokenDecimals = Math.round(message.tokenDecimals);
9779
9805
  }
9806
+ if (message.tempSIKs !== void 0) {
9807
+ obj.tempSIKs = message.tempSIKs;
9808
+ }
9780
9809
  return obj;
9781
9810
  },
9782
9811
  create(base) {
@@ -9814,6 +9843,7 @@ var Process = {
9814
9843
  message.nullifiersRoot = object.nullifiersRoot ?? void 0;
9815
9844
  message.sourceNetworkContractAddr = object.sourceNetworkContractAddr ?? void 0;
9816
9845
  message.tokenDecimals = object.tokenDecimals ?? void 0;
9846
+ message.tempSIKs = object.tempSIKs ?? void 0;
9817
9847
  return message;
9818
9848
  }
9819
9849
  };
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
1
  {
2
- "name": "@vocdoni/proto",
3
- "version": "1.15.1",
4
- "devDependencies": {
5
- "ts-node": "^9.1.1",
6
- "ts-proto": "^1.156.1",
7
- "tsup": "^6.5.0",
8
- "typescript": "^4.2.4"
2
+ "name": "@vocdoni/proto",
3
+ "version": "1.15.2",
4
+ "devDependencies": {
5
+ "ts-node": "^9.1.1",
6
+ "ts-proto": "^1.156.2",
7
+ "tsup": "^6.5.0",
8
+ "typescript": "^4.2.4"
9
+ },
10
+ "dependencies": {
11
+ "long": "^5.2.1",
12
+ "protobufjs": "^7.1.2"
13
+ },
14
+ "main": "build/js/index.js",
15
+ "types": "build/js/index.d.ts",
16
+ "module": "build/js/index.mjs",
17
+ "exports": {
18
+ ".": {
19
+ "import": "./build/js/index.mjs",
20
+ "require": "./build/js/index.js",
21
+ "types": "./build/js/index.d.ts"
9
22
  },
10
- "dependencies": {
11
- "long": "^5.2.1",
12
- "protobufjs": "^7.1.2"
23
+ "./client-store": {
24
+ "import": "./build/js/client-store/index.mjs",
25
+ "require": "./build/js/client-store/index.js",
26
+ "types": "./build/js/client-store/index.d.ts"
13
27
  },
14
- "main": "dist/index.js",
15
- "types": "dist/index.d.ts",
16
- "module": "dist/index.mjs",
17
- "exports": {
18
- ".": {
19
- "import": "./dist/index.mjs",
20
- "require": "./dist/index.js",
21
- "types": "./dist/index.d.ts"
22
- },
23
- "./client-store": {
24
- "import": "./dist/client-store/index.mjs",
25
- "require": "./dist/client-store/index.js",
26
- "types": "./dist/client-store/index.d.ts"
27
- },
28
- "./metadata": {
29
- "import": "./dist/metadata/index.mjs",
30
- "require": "./dist/metadata/index.js",
31
- "types": "./dist/metadata/index.d.ts"
32
- },
33
- "./vochain": {
34
- "import": "./dist/vochain/index.mjs",
35
- "require": "./dist/vochain/index.js",
36
- "types": "./dist/vochain/index.d.ts"
37
- },
38
- "./package.json": "./package.json"
28
+ "./metadata": {
29
+ "import": "./build/js/metadata/index.mjs",
30
+ "require": "./build/js/metadata/index.js",
31
+ "types": "./build/js/metadata/index.d.ts"
39
32
  },
40
- "scripts": {
41
- "build": "make ts && tsup --dts",
42
- "clean": "rm -Rf dist build/ts"
43
- }
33
+ "./vochain": {
34
+ "import": "./build/js/vochain/index.mjs",
35
+ "require": "./build/js/vochain/index.js",
36
+ "types": "./build/js/vochain/index.d.ts"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "scripts": {
41
+ "build": "make ts && tsup --dts --out-dir ./build/js",
42
+ "clean": "rm -Rf build/ts build/js"
43
+ }
44
44
  }
@@ -222,6 +222,9 @@ message SetProcessTx {
222
222
  optional string censusURI = 7;
223
223
  optional Proof proof = 8;
224
224
  optional ProcessResult results = 9;
225
+ // tempSIKs flag decides if when the process has finished, the SIKs related
226
+ // to it will be removed or not
227
+ optional bool tempSIKs = 10;
225
228
  }
226
229
 
227
230
  message AdminTx {
@@ -362,6 +365,9 @@ message Process {
362
365
  // tokenDecimals represents the number of decimals of the token (i.e ERC20) used for voting.
363
366
  // It is normally used for processes with on-chain census
364
367
  optional uint32 tokenDecimals = 33;
368
+ // tempSIKs flag decides if when the process has finished, the SIKs related
369
+ // to it will be removed or not
370
+ optional bool tempSIKs = 34;
365
371
  }
366
372
 
367
373
  enum ProcessStatus {
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/dvote-protobuf.iml" filepath="$PROJECT_DIR$/.idea/dvote-protobuf.iml" />
6
- </modules>
7
- </component>
8
- </project>
package/.idea/vcs.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
@@ -1,3 +0,0 @@
1
- export { a as Account, b as Backup, g as Gateway, w as Wallet } from '../index-d457aeb5.js';
2
- import 'protobufjs/minimal';
3
- import '../entity-e8dfcd83.js';