@wireio/opp-solidity-models 1.0.0 → 1.0.7

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.
@@ -4,7 +4,7 @@ pragma solidity >=0.8.0 <0.9.0;
4
4
  // Auto-generated by protoc-gen-solidity from sysio/opp/types/types.proto
5
5
  // DO NOT EDIT
6
6
 
7
- import {ProtobufRuntime} from "./ProtobufRuntime.sol";
7
+ import {ProtobufRuntime} from "../../../ProtobufRuntime.sol";
8
8
 
9
9
  struct ChainId {
10
10
  uint64 kind;
@@ -13,7 +13,7 @@ struct ChainId {
13
13
 
14
14
  struct ChainAddress {
15
15
  uint64 kind;
16
- bytes address;
16
+ bytes address_;
17
17
  }
18
18
 
19
19
  struct ChainSignature {
@@ -35,21 +35,21 @@ struct EncodingFlags {
35
35
 
36
36
  library ChainIdCodec {
37
37
 
38
- function encode(ChainId memory msg) internal pure returns (bytes memory) {
38
+ function encode(ChainId memory chainId) internal pure returns (bytes memory) {
39
39
  bytes memory buf = "";
40
40
 
41
41
  // field 1: kind
42
42
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
43
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
43
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(chainId.kind));
44
44
 
45
45
  // field 2: id
46
46
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
47
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.id));
47
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(chainId.id));
48
48
 
49
49
  return buf;
50
50
  }
51
51
 
52
- function decode(bytes memory data) internal pure returns (ChainId memory msg) {
52
+ function decode(bytes memory data) internal pure returns (ChainId memory chainId) {
53
53
  uint256 pos = 0;
54
54
  uint256 end = data.length;
55
55
 
@@ -57,17 +57,14 @@ library ChainIdCodec {
57
57
  uint64 tag;
58
58
  (tag, pos) = ProtobufRuntime._decode_key(data, pos);
59
59
 
60
- // solhint-disable-next-line no-empty-blocks
61
- switch (tag) {
62
- case 8:
63
- (msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
64
- break;
65
- case 16:
66
- (msg.id, pos) = ProtobufRuntime._decode_varint(data, pos);
67
- break;
68
- default:
69
- pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
70
- break;
60
+ if (tag == 8) {
61
+ (chainId.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
62
+ } else if (tag == 16) {
63
+ { uint64 _v;
64
+ (_v, pos) = ProtobufRuntime._decode_varint(data, pos);
65
+ chainId.id = uint32(_v); }
66
+ } else {
67
+ pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
71
68
  }
72
69
  }
73
70
  }
@@ -75,21 +72,21 @@ library ChainIdCodec {
75
72
 
76
73
  library ChainAddressCodec {
77
74
 
78
- function encode(ChainAddress memory msg) internal pure returns (bytes memory) {
75
+ function encode(ChainAddress memory chainAddress) internal pure returns (bytes memory) {
79
76
  bytes memory buf = "";
80
77
 
81
78
  // field 1: kind
82
79
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
83
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
80
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(chainAddress.kind));
84
81
 
85
82
  // field 2: address
86
83
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x12));
87
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.address));
84
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(chainAddress.address_));
88
85
 
89
86
  return buf;
90
87
  }
91
88
 
92
- function decode(bytes memory data) internal pure returns (ChainAddress memory msg) {
89
+ function decode(bytes memory data) internal pure returns (ChainAddress memory chainAddress) {
93
90
  uint256 pos = 0;
94
91
  uint256 end = data.length;
95
92
 
@@ -97,17 +94,12 @@ library ChainAddressCodec {
97
94
  uint64 tag;
98
95
  (tag, pos) = ProtobufRuntime._decode_key(data, pos);
99
96
 
100
- // solhint-disable-next-line no-empty-blocks
101
- switch (tag) {
102
- case 8:
103
- (msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
104
- break;
105
- case 18:
106
- (msg.address, pos) = ProtobufRuntime._decode_bytes(data, pos);
107
- break;
108
- default:
109
- pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
110
- break;
97
+ if (tag == 8) {
98
+ (chainAddress.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
99
+ } else if (tag == 18) {
100
+ (chainAddress.address_, pos) = ProtobufRuntime._decode_bytes(data, pos);
101
+ } else {
102
+ pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
111
103
  }
112
104
  }
113
105
  }
@@ -115,27 +107,27 @@ library ChainAddressCodec {
115
107
 
116
108
  library ChainSignatureCodec {
117
109
 
118
- function encode(ChainSignature memory msg) internal pure returns (bytes memory) {
110
+ function encode(ChainSignature memory chainSignature) internal pure returns (bytes memory) {
119
111
  bytes memory buf = "";
120
112
 
121
113
  // field 1: actor
122
114
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0xa));
123
- bytes memory actor_encoded = ChainAddressCodec.encode(msg.actor);
115
+ bytes memory actor_encoded = ChainAddressCodec.encode(chainSignature.actor);
124
116
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(actor_encoded.length)));
125
117
  buf = abi.encodePacked(buf, actor_encoded);
126
118
 
127
119
  // field 2: key_type
128
120
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
129
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.keyType));
121
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(chainSignature.keyType));
130
122
 
131
123
  // field 3: signature
132
124
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x1a));
133
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(msg.signature));
125
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_bytes(chainSignature.signature));
134
126
 
135
127
  return buf;
136
128
  }
137
129
 
138
- function decode(bytes memory data) internal pure returns (ChainSignature memory msg) {
130
+ function decode(bytes memory data) internal pure returns (ChainSignature memory chainSignature) {
139
131
  uint256 pos = 0;
140
132
  uint256 end = data.length;
141
133
 
@@ -143,26 +135,18 @@ library ChainSignatureCodec {
143
135
  uint64 tag;
144
136
  (tag, pos) = ProtobufRuntime._decode_key(data, pos);
145
137
 
146
- // solhint-disable-next-line no-empty-blocks
147
- switch (tag) {
148
- case 10:
149
- {
150
- uint64 _len;
151
- (_len, pos) = ProtobufRuntime._decode_varint(data, pos);
152
- bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
153
- msg.actor = ChainAddressCodec.decode(_sub);
154
- pos += uint256(_len);
155
- }
156
- break;
157
- case 16:
158
- (msg.keyType, pos) = ProtobufRuntime._decode_varint(data, pos);
159
- break;
160
- case 26:
161
- (msg.signature, pos) = ProtobufRuntime._decode_bytes(data, pos);
162
- break;
163
- default:
164
- pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
165
- break;
138
+ if (tag == 10) {
139
+ uint64 _len;
140
+ (_len, pos) = ProtobufRuntime._decode_varint(data, pos);
141
+ bytes memory _sub = ProtobufRuntime._slice(data, pos, pos + uint256(_len));
142
+ chainSignature.actor = ChainAddressCodec.decode(_sub);
143
+ pos += uint256(_len);
144
+ } else if (tag == 16) {
145
+ (chainSignature.keyType, pos) = ProtobufRuntime._decode_varint(data, pos);
146
+ } else if (tag == 26) {
147
+ (chainSignature.signature, pos) = ProtobufRuntime._decode_bytes(data, pos);
148
+ } else {
149
+ pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
166
150
  }
167
151
  }
168
152
  }
@@ -170,21 +154,21 @@ library ChainSignatureCodec {
170
154
 
171
155
  library TokenAmountCodec {
172
156
 
173
- function encode(TokenAmount memory msg) internal pure returns (bytes memory) {
157
+ function encode(TokenAmount memory tokenAmount) internal pure returns (bytes memory) {
174
158
  bytes memory buf = "";
175
159
 
176
160
  // field 1: kind
177
161
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
178
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.kind));
162
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(tokenAmount.kind));
179
163
 
180
164
  // field 2: amount
181
165
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
182
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.amount));
166
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(uint64(tokenAmount.amount)));
183
167
 
184
168
  return buf;
185
169
  }
186
170
 
187
- function decode(bytes memory data) internal pure returns (TokenAmount memory msg) {
171
+ function decode(bytes memory data) internal pure returns (TokenAmount memory tokenAmount) {
188
172
  uint256 pos = 0;
189
173
  uint256 end = data.length;
190
174
 
@@ -192,17 +176,14 @@ library TokenAmountCodec {
192
176
  uint64 tag;
193
177
  (tag, pos) = ProtobufRuntime._decode_key(data, pos);
194
178
 
195
- // solhint-disable-next-line no-empty-blocks
196
- switch (tag) {
197
- case 8:
198
- (msg.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
199
- break;
200
- case 16:
201
- (msg.amount, pos) = ProtobufRuntime._decode_varint(data, pos);
202
- break;
203
- default:
204
- pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
205
- break;
179
+ if (tag == 8) {
180
+ (tokenAmount.kind, pos) = ProtobufRuntime._decode_varint(data, pos);
181
+ } else if (tag == 16) {
182
+ { uint64 _v;
183
+ (_v, pos) = ProtobufRuntime._decode_varint(data, pos);
184
+ tokenAmount.amount = int64(_v); }
185
+ } else {
186
+ pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
206
187
  }
207
188
  }
208
189
  }
@@ -210,25 +191,25 @@ library TokenAmountCodec {
210
191
 
211
192
  library EncodingFlagsCodec {
212
193
 
213
- function encode(EncodingFlags memory msg) internal pure returns (bytes memory) {
194
+ function encode(EncodingFlags memory encodingFlags) internal pure returns (bytes memory) {
214
195
  bytes memory buf = "";
215
196
 
216
197
  // field 1: endianness
217
198
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x8));
218
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.endianness));
199
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(encodingFlags.endianness));
219
200
 
220
201
  // field 2: hash_algorithm
221
202
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x10));
222
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.hashAlgorithm));
203
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(encodingFlags.hashAlgorithm));
223
204
 
224
205
  // field 3: length_encoding
225
206
  buf = abi.encodePacked(buf, ProtobufRuntime._encode_key(0x18));
226
- buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(msg.lengthEncoding));
207
+ buf = abi.encodePacked(buf, ProtobufRuntime._encode_varint(encodingFlags.lengthEncoding));
227
208
 
228
209
  return buf;
229
210
  }
230
211
 
231
- function decode(bytes memory data) internal pure returns (EncodingFlags memory msg) {
212
+ function decode(bytes memory data) internal pure returns (EncodingFlags memory encodingFlags) {
232
213
  uint256 pos = 0;
233
214
  uint256 end = data.length;
234
215
 
@@ -236,20 +217,14 @@ library EncodingFlagsCodec {
236
217
  uint64 tag;
237
218
  (tag, pos) = ProtobufRuntime._decode_key(data, pos);
238
219
 
239
- // solhint-disable-next-line no-empty-blocks
240
- switch (tag) {
241
- case 8:
242
- (msg.endianness, pos) = ProtobufRuntime._decode_varint(data, pos);
243
- break;
244
- case 16:
245
- (msg.hashAlgorithm, pos) = ProtobufRuntime._decode_varint(data, pos);
246
- break;
247
- case 24:
248
- (msg.lengthEncoding, pos) = ProtobufRuntime._decode_varint(data, pos);
249
- break;
250
- default:
251
- pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
252
- break;
220
+ if (tag == 8) {
221
+ (encodingFlags.endianness, pos) = ProtobufRuntime._decode_varint(data, pos);
222
+ } else if (tag == 16) {
223
+ (encodingFlags.hashAlgorithm, pos) = ProtobufRuntime._decode_varint(data, pos);
224
+ } else if (tag == 24) {
225
+ (encodingFlags.lengthEncoding, pos) = ProtobufRuntime._decode_varint(data, pos);
226
+ } else {
227
+ pos = ProtobufRuntime._skip_field(data, pos, tag & 0x07);
253
228
  }
254
229
  }
255
230
  }
package/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./sysio/opp/attestations/attestations.js";
2
+ export * from "./sysio/opp/opp.js";
3
+ export * from "./sysio/opp/types/types.js";
4
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,cAAc,0CAA0C,CAAC;AACzD,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC"}
package/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // Auto-generated by protobuf-bundler — do not edit
2
+ export * from "./sysio/opp/attestations/attestations.js";
3
+ export * from "./sysio/opp/opp.js";
4
+ export * from "./sysio/opp/types/types.js";
package/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ // Auto-generated by protobuf-bundler — do not edit
2
+
3
+ export * from "./sysio/opp/attestations/attestations.js";
4
+ export * from "./sysio/opp/opp.js";
5
+ export * from "./sysio/opp/types/types.js";
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
- {
2
- "name": "@wireio/opp-solidity-models",
3
- "version": "1.0.0",
4
- "description": "Auto-generated protobuf types for Solidity",
5
- "type": "module",
6
- "main": "index.mjs",
7
- "files": [
8
- "contracts",
9
- "index.mjs",
10
- "README.md"
11
- ]}
1
+ {
2
+ "name": "@wireio/opp-solidity-models",
3
+ "version": "1.0.7",
4
+ "description": "Auto-generated protobuf types for Solidity",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "types": "index.d.ts",
8
+ "files": [
9
+ "contracts",
10
+ "**/*.ts",
11
+ "**/*.js",
12
+ "**/*.d.ts",
13
+ "**/*.d.ts.map",
14
+ "*.js",
15
+ "README.md"
16
+ ],
17
+ "dependencies": {
18
+ "@protobuf-ts/runtime": "^2.9.4"
19
+ }}