@ark-us/wasmxjs 0.0.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.
Files changed (219) hide show
  1. package/LICENSE +3 -0
  2. package/README.md +280 -0
  3. package/main/codegen/cosmos/base/abci/v1beta1/abci.js +887 -0
  4. package/main/codegen/cosmos/base/kv/v1beta1/kv.js +139 -0
  5. package/main/codegen/cosmos/base/query/v1beta1/pagination.js +157 -0
  6. package/main/codegen/cosmos/base/reflection/v1beta1/reflection.js +231 -0
  7. package/main/codegen/cosmos/base/reflection/v2alpha1/reflection.js +1479 -0
  8. package/main/codegen/cosmos/base/snapshots/v1beta1/snapshot.js +478 -0
  9. package/main/codegen/cosmos/base/store/v1beta1/commit_info.js +207 -0
  10. package/main/codegen/cosmos/base/store/v1beta1/listening.js +89 -0
  11. package/main/codegen/cosmos/base/tendermint/v1beta1/query.js +951 -0
  12. package/main/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +117 -0
  13. package/main/codegen/cosmos/base/v1beta1/coin.js +223 -0
  14. package/main/codegen/cosmos/bundle.js +63 -0
  15. package/main/codegen/cosmos/rpc.query.js +55 -0
  16. package/main/codegen/extern.js +66 -0
  17. package/main/codegen/gogoproto/bundle.js +16 -0
  18. package/main/codegen/gogoproto/gogo.js +5 -0
  19. package/main/codegen/google/api/annotations.js +5 -0
  20. package/main/codegen/google/api/http.js +306 -0
  21. package/main/codegen/google/api/httpbody.js +102 -0
  22. package/main/codegen/google/bundle.js +26 -0
  23. package/main/codegen/google/protobuf/any.js +69 -0
  24. package/main/codegen/google/protobuf/descriptor.js +3429 -0
  25. package/main/codegen/google/protobuf/duration.js +69 -0
  26. package/main/codegen/google/protobuf/timestamp.js +69 -0
  27. package/main/codegen/helpers.js +170 -0
  28. package/main/codegen/index.js +93 -0
  29. package/main/codegen/tendermint/abci/types.js +3616 -0
  30. package/main/codegen/tendermint/bundle.js +37 -0
  31. package/main/codegen/tendermint/crypto/keys.js +69 -0
  32. package/main/codegen/tendermint/crypto/proof.js +372 -0
  33. package/main/codegen/tendermint/libs/bits/types.js +100 -0
  34. package/main/codegen/tendermint/p2p/types.js +322 -0
  35. package/main/codegen/tendermint/types/block.js +90 -0
  36. package/main/codegen/tendermint/types/evidence.js +335 -0
  37. package/main/codegen/tendermint/types/params.js +397 -0
  38. package/main/codegen/tendermint/types/types.js +1223 -0
  39. package/main/codegen/tendermint/types/validator.js +237 -0
  40. package/main/codegen/tendermint/version/types.js +126 -0
  41. package/main/codegen/wasmx/bundle.js +30 -0
  42. package/main/codegen/wasmx/client.js +65 -0
  43. package/main/codegen/wasmx/index.js +126 -0
  44. package/main/codegen/wasmx/rpc.query.js +65 -0
  45. package/main/codegen/wasmx/rpc.tx.js +44 -0
  46. package/main/codegen/wasmx/wasmx/contract.js +324 -0
  47. package/main/codegen/wasmx/wasmx/genesis.js +481 -0
  48. package/main/codegen/wasmx/wasmx/params.js +45 -0
  49. package/main/codegen/wasmx/wasmx/query.js +1187 -0
  50. package/main/codegen/wasmx/wasmx/query.rpc.Query.js +154 -0
  51. package/main/codegen/wasmx/wasmx/tx.amino.js +251 -0
  52. package/main/codegen/wasmx/wasmx/tx.js +937 -0
  53. package/main/codegen/wasmx/wasmx/tx.registry.js +213 -0
  54. package/main/codegen/wasmx/wasmx/tx.rpc.msg.js +85 -0
  55. package/main/index.js +16 -0
  56. package/module/codegen/cosmos/base/abci/v1beta1/abci.js +755 -0
  57. package/module/codegen/cosmos/base/kv/v1beta1/kv.js +110 -0
  58. package/module/codegen/cosmos/base/query/v1beta1/pagination.js +154 -0
  59. package/module/codegen/cosmos/base/reflection/v1beta1/reflection.js +183 -0
  60. package/module/codegen/cosmos/base/reflection/v2alpha1/reflection.js +1297 -0
  61. package/module/codegen/cosmos/base/snapshots/v1beta1/snapshot.js +439 -0
  62. package/module/codegen/cosmos/base/store/v1beta1/commit_info.js +179 -0
  63. package/module/codegen/cosmos/base/store/v1beta1/listening.js +86 -0
  64. package/module/codegen/cosmos/base/tendermint/v1beta1/query.js +866 -0
  65. package/module/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +74 -0
  66. package/module/codegen/cosmos/base/v1beta1/coin.js +213 -0
  67. package/module/codegen/cosmos/bundle.js +52 -0
  68. package/module/codegen/cosmos/rpc.query.js +17 -0
  69. package/module/codegen/extern.js +30 -0
  70. package/module/codegen/gogoproto/bundle.js +5 -0
  71. package/module/codegen/gogoproto/gogo.js +1 -0
  72. package/module/codegen/google/api/annotations.js +1 -0
  73. package/module/codegen/google/api/http.js +264 -0
  74. package/module/codegen/google/api/httpbody.js +115 -0
  75. package/module/codegen/google/bundle.js +15 -0
  76. package/module/codegen/google/protobuf/any.js +140 -0
  77. package/module/codegen/google/protobuf/descriptor.js +2801 -0
  78. package/module/codegen/google/protobuf/duration.js +119 -0
  79. package/module/codegen/google/protobuf/timestamp.js +143 -0
  80. package/module/codegen/helpers.js +140 -0
  81. package/module/codegen/index.js +14 -0
  82. package/module/codegen/tendermint/abci/types.js +3305 -0
  83. package/module/codegen/tendermint/bundle.js +26 -0
  84. package/module/codegen/tendermint/crypto/keys.js +60 -0
  85. package/module/codegen/tendermint/crypto/proof.js +320 -0
  86. package/module/codegen/tendermint/libs/bits/types.js +71 -0
  87. package/module/codegen/tendermint/p2p/types.js +305 -0
  88. package/module/codegen/tendermint/types/block.js +79 -0
  89. package/module/codegen/tendermint/types/evidence.js +285 -0
  90. package/module/codegen/tendermint/types/params.js +363 -0
  91. package/module/codegen/tendermint/types/types.js +1149 -0
  92. package/module/codegen/tendermint/types/validator.js +204 -0
  93. package/module/codegen/tendermint/version/types.js +119 -0
  94. package/module/codegen/wasmx/bundle.js +19 -0
  95. package/module/codegen/wasmx/client.js +36 -0
  96. package/module/codegen/wasmx/index.js +11 -0
  97. package/module/codegen/wasmx/rpc.query.js +20 -0
  98. package/module/codegen/wasmx/rpc.tx.js +7 -0
  99. package/module/codegen/wasmx/wasmx/contract.js +291 -0
  100. package/module/codegen/wasmx/wasmx/genesis.js +386 -0
  101. package/module/codegen/wasmx/wasmx/params.js +36 -0
  102. package/module/codegen/wasmx/wasmx/query.js +1052 -0
  103. package/module/codegen/wasmx/wasmx/query.rpc.Query.js +101 -0
  104. package/module/codegen/wasmx/wasmx/tx.amino.js +236 -0
  105. package/module/codegen/wasmx/wasmx/tx.js +815 -0
  106. package/module/codegen/wasmx/wasmx/tx.registry.js +199 -0
  107. package/module/codegen/wasmx/wasmx/tx.rpc.msg.js +47 -0
  108. package/module/index.js +1 -0
  109. package/package.json +88 -0
  110. package/src/codegen/cosmos/base/abci/v1beta1/abci.ts +1254 -0
  111. package/src/codegen/cosmos/base/kv/v1beta1/kv.ts +156 -0
  112. package/src/codegen/cosmos/base/query/v1beta1/pagination.ts +314 -0
  113. package/src/codegen/cosmos/base/reflection/v1beta1/reflection.ts +280 -0
  114. package/src/codegen/cosmos/base/reflection/v2alpha1/reflection.ts +2079 -0
  115. package/src/codegen/cosmos/base/snapshots/v1beta1/snapshot.ts +641 -0
  116. package/src/codegen/cosmos/base/store/v1beta1/commit_info.ts +269 -0
  117. package/src/codegen/cosmos/base/store/v1beta1/listening.ts +129 -0
  118. package/src/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.ts +107 -0
  119. package/src/codegen/cosmos/base/tendermint/v1beta1/query.ts +1284 -0
  120. package/src/codegen/cosmos/base/v1beta1/coin.ts +318 -0
  121. package/src/codegen/cosmos/bundle.ts +52 -0
  122. package/src/codegen/cosmos/rpc.query.ts +19 -0
  123. package/src/codegen/extern.ts +33 -0
  124. package/src/codegen/gogoproto/bundle.ts +3 -0
  125. package/src/codegen/gogoproto/gogo.ts +1 -0
  126. package/src/codegen/google/api/annotations.ts +1 -0
  127. package/src/codegen/google/api/http.ts +945 -0
  128. package/src/codegen/google/api/httpbody.ts +200 -0
  129. package/src/codegen/google/bundle.ts +18 -0
  130. package/src/codegen/google/protobuf/any.ts +305 -0
  131. package/src/codegen/google/protobuf/descriptor.ts +5113 -0
  132. package/src/codegen/google/protobuf/duration.ts +229 -0
  133. package/src/codegen/google/protobuf/timestamp.ts +273 -0
  134. package/src/codegen/helpers.ts +240 -0
  135. package/src/codegen/index.ts +14 -0
  136. package/src/codegen/tendermint/abci/types.ts +4754 -0
  137. package/src/codegen/tendermint/bundle.ts +32 -0
  138. package/src/codegen/tendermint/crypto/keys.ts +83 -0
  139. package/src/codegen/tendermint/crypto/proof.ts +465 -0
  140. package/src/codegen/tendermint/libs/bits/types.ts +97 -0
  141. package/src/codegen/tendermint/p2p/types.ts +422 -0
  142. package/src/codegen/tendermint/types/block.ts +109 -0
  143. package/src/codegen/tendermint/types/evidence.ts +415 -0
  144. package/src/codegen/tendermint/types/params.ts +615 -0
  145. package/src/codegen/tendermint/types/types.ts +1663 -0
  146. package/src/codegen/tendermint/types/validator.ts +282 -0
  147. package/src/codegen/tendermint/version/types.ts +180 -0
  148. package/src/codegen/wasmx/bundle.ts +26 -0
  149. package/src/codegen/wasmx/client.ts +45 -0
  150. package/src/codegen/wasmx/index.ts +11 -0
  151. package/src/codegen/wasmx/rpc.query.ts +22 -0
  152. package/src/codegen/wasmx/rpc.tx.ts +10 -0
  153. package/src/codegen/wasmx/wasmx/contract.ts +470 -0
  154. package/src/codegen/wasmx/wasmx/genesis.ts +552 -0
  155. package/src/codegen/wasmx/wasmx/params.ts +50 -0
  156. package/src/codegen/wasmx/wasmx/query.rpc.Query.ts +149 -0
  157. package/src/codegen/wasmx/wasmx/query.ts +1668 -0
  158. package/src/codegen/wasmx/wasmx/tx.amino.ts +314 -0
  159. package/src/codegen/wasmx/wasmx/tx.registry.ts +230 -0
  160. package/src/codegen/wasmx/wasmx/tx.rpc.msg.ts +80 -0
  161. package/src/codegen/wasmx/wasmx/tx.ts +1331 -0
  162. package/src/index.ts +1 -0
  163. package/types/codegen/cosmos/base/abci/v1beta1/abci.d.ts +338 -0
  164. package/types/codegen/cosmos/base/kv/v1beta1/kv.d.ts +33 -0
  165. package/types/codegen/cosmos/base/query/v1beta1/pagination.d.ts +140 -0
  166. package/types/codegen/cosmos/base/reflection/v1beta1/reflection.d.ts +75 -0
  167. package/types/codegen/cosmos/base/reflection/v2alpha1/reflection.d.ts +565 -0
  168. package/types/codegen/cosmos/base/snapshots/v1beta1/snapshot.d.ts +135 -0
  169. package/types/codegen/cosmos/base/store/v1beta1/commit_info.d.ts +71 -0
  170. package/types/codegen/cosmos/base/store/v1beta1/listening.d.ts +38 -0
  171. package/types/codegen/cosmos/base/tendermint/v1beta1/query.d.ts +282 -0
  172. package/types/codegen/cosmos/base/tendermint/v1beta1/query.lcd.d.ts +14 -0
  173. package/types/codegen/cosmos/base/tendermint/v1beta1/query.rpc.Service.d.ts +36 -0
  174. package/types/codegen/cosmos/base/v1beta1/coin.d.ts +85 -0
  175. package/types/codegen/cosmos/bundle.d.ts +594 -0
  176. package/types/codegen/cosmos/lcd.d.ts +11 -0
  177. package/types/codegen/cosmos/rpc.query.d.ts +19 -0
  178. package/types/codegen/extern.d.ts +9 -0
  179. package/types/codegen/gogoproto/bundle.d.ts +1 -0
  180. package/types/codegen/gogoproto/gogo.d.ts +1 -0
  181. package/types/codegen/google/api/annotations.d.ts +1 -0
  182. package/types/codegen/google/api/http.d.ts +622 -0
  183. package/types/codegen/google/api/httpbody.d.ts +113 -0
  184. package/types/codegen/google/bundle.d.ts +274 -0
  185. package/types/codegen/google/protobuf/any.d.ts +238 -0
  186. package/types/codegen/google/protobuf/descriptor.d.ts +1835 -0
  187. package/types/codegen/google/protobuf/duration.d.ts +163 -0
  188. package/types/codegen/google/protobuf/timestamp.d.ts +207 -0
  189. package/types/codegen/helpers.d.ts +82 -0
  190. package/types/codegen/index.d.ts +13 -0
  191. package/types/codegen/tendermint/abci/types.d.ts +993 -0
  192. package/types/codegen/tendermint/bundle.d.ts +639 -0
  193. package/types/codegen/tendermint/crypto/keys.d.ts +18 -0
  194. package/types/codegen/tendermint/crypto/proof.d.ts +101 -0
  195. package/types/codegen/tendermint/libs/bits/types.d.ts +17 -0
  196. package/types/codegen/tendermint/p2p/types.d.ts +78 -0
  197. package/types/codegen/tendermint/types/block.d.ts +22 -0
  198. package/types/codegen/tendermint/types/evidence.d.ts +91 -0
  199. package/types/codegen/tendermint/types/params.d.ts +193 -0
  200. package/types/codegen/tendermint/types/types.d.ts +363 -0
  201. package/types/codegen/tendermint/types/validator.d.ts +54 -0
  202. package/types/codegen/tendermint/version/types.d.ts +52 -0
  203. package/types/codegen/wasmx/bundle.d.ts +614 -0
  204. package/types/codegen/wasmx/client.d.ts +151 -0
  205. package/types/codegen/wasmx/index.d.ts +11 -0
  206. package/types/codegen/wasmx/lcd.d.ts +14 -0
  207. package/types/codegen/wasmx/rpc.query.d.ts +32 -0
  208. package/types/codegen/wasmx/rpc.tx.d.ts +8 -0
  209. package/types/codegen/wasmx/wasmx/contract.d.ts +122 -0
  210. package/types/codegen/wasmx/wasmx/genesis.d.ts +107 -0
  211. package/types/codegen/wasmx/wasmx/params.d.ts +14 -0
  212. package/types/codegen/wasmx/wasmx/query.d.ts +451 -0
  213. package/types/codegen/wasmx/wasmx/query.lcd.d.ts +17 -0
  214. package/types/codegen/wasmx/wasmx/query.rpc.Query.d.ts +48 -0
  215. package/types/codegen/wasmx/wasmx/tx.amino.d.ts +110 -0
  216. package/types/codegen/wasmx/wasmx/tx.d.ts +332 -0
  217. package/types/codegen/wasmx/wasmx/tx.registry.d.ts +136 -0
  218. package/types/codegen/wasmx/wasmx/tx.rpc.msg.d.ts +33 -0
  219. package/types/index.d.ts +1 -0
@@ -0,0 +1,229 @@
1
+ import * as _m0 from "protobufjs/minimal";
2
+ import { Long, isSet } from "../../helpers";
3
+ /**
4
+ * A Duration represents a signed, fixed-length span of time represented
5
+ * as a count of seconds and fractions of seconds at nanosecond
6
+ * resolution. It is independent of any calendar and concepts like "day"
7
+ * or "month". It is related to Timestamp in that the difference between
8
+ * two Timestamp values is a Duration and it can be added or subtracted
9
+ * from a Timestamp. Range is approximately +-10,000 years.
10
+ *
11
+ * # Examples
12
+ *
13
+ * Example 1: Compute Duration from two Timestamps in pseudo code.
14
+ *
15
+ * Timestamp start = ...;
16
+ * Timestamp end = ...;
17
+ * Duration duration = ...;
18
+ *
19
+ * duration.seconds = end.seconds - start.seconds;
20
+ * duration.nanos = end.nanos - start.nanos;
21
+ *
22
+ * if (duration.seconds < 0 && duration.nanos > 0) {
23
+ * duration.seconds += 1;
24
+ * duration.nanos -= 1000000000;
25
+ * } else if (durations.seconds > 0 && duration.nanos < 0) {
26
+ * duration.seconds -= 1;
27
+ * duration.nanos += 1000000000;
28
+ * }
29
+ *
30
+ * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
31
+ *
32
+ * Timestamp start = ...;
33
+ * Duration duration = ...;
34
+ * Timestamp end = ...;
35
+ *
36
+ * end.seconds = start.seconds + duration.seconds;
37
+ * end.nanos = start.nanos + duration.nanos;
38
+ *
39
+ * if (end.nanos < 0) {
40
+ * end.seconds -= 1;
41
+ * end.nanos += 1000000000;
42
+ * } else if (end.nanos >= 1000000000) {
43
+ * end.seconds += 1;
44
+ * end.nanos -= 1000000000;
45
+ * }
46
+ *
47
+ * Example 3: Compute Duration from datetime.timedelta in Python.
48
+ *
49
+ * td = datetime.timedelta(days=3, minutes=10)
50
+ * duration = Duration()
51
+ * duration.FromTimedelta(td)
52
+ *
53
+ * # JSON Mapping
54
+ *
55
+ * In JSON format, the Duration type is encoded as a string rather than an
56
+ * object, where the string ends in the suffix "s" (indicating seconds) and
57
+ * is preceded by the number of seconds, with nanoseconds expressed as
58
+ * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
59
+ * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
60
+ * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
61
+ * microsecond should be expressed in JSON format as "3.000001s".
62
+ */
63
+
64
+ export interface Duration {
65
+ /**
66
+ * Signed seconds of the span of time. Must be from -315,576,000,000
67
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
68
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
69
+ */
70
+ seconds: Long;
71
+ /**
72
+ * Signed fractions of a second at nanosecond resolution of the span
73
+ * of time. Durations less than one second are represented with a 0
74
+ * `seconds` field and a positive or negative `nanos` field. For durations
75
+ * of one second or more, a non-zero value for the `nanos` field must be
76
+ * of the same sign as the `seconds` field. Must be from -999,999,999
77
+ * to +999,999,999 inclusive.
78
+ */
79
+
80
+ nanos: number;
81
+ }
82
+ /**
83
+ * A Duration represents a signed, fixed-length span of time represented
84
+ * as a count of seconds and fractions of seconds at nanosecond
85
+ * resolution. It is independent of any calendar and concepts like "day"
86
+ * or "month". It is related to Timestamp in that the difference between
87
+ * two Timestamp values is a Duration and it can be added or subtracted
88
+ * from a Timestamp. Range is approximately +-10,000 years.
89
+ *
90
+ * # Examples
91
+ *
92
+ * Example 1: Compute Duration from two Timestamps in pseudo code.
93
+ *
94
+ * Timestamp start = ...;
95
+ * Timestamp end = ...;
96
+ * Duration duration = ...;
97
+ *
98
+ * duration.seconds = end.seconds - start.seconds;
99
+ * duration.nanos = end.nanos - start.nanos;
100
+ *
101
+ * if (duration.seconds < 0 && duration.nanos > 0) {
102
+ * duration.seconds += 1;
103
+ * duration.nanos -= 1000000000;
104
+ * } else if (durations.seconds > 0 && duration.nanos < 0) {
105
+ * duration.seconds -= 1;
106
+ * duration.nanos += 1000000000;
107
+ * }
108
+ *
109
+ * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
110
+ *
111
+ * Timestamp start = ...;
112
+ * Duration duration = ...;
113
+ * Timestamp end = ...;
114
+ *
115
+ * end.seconds = start.seconds + duration.seconds;
116
+ * end.nanos = start.nanos + duration.nanos;
117
+ *
118
+ * if (end.nanos < 0) {
119
+ * end.seconds -= 1;
120
+ * end.nanos += 1000000000;
121
+ * } else if (end.nanos >= 1000000000) {
122
+ * end.seconds += 1;
123
+ * end.nanos -= 1000000000;
124
+ * }
125
+ *
126
+ * Example 3: Compute Duration from datetime.timedelta in Python.
127
+ *
128
+ * td = datetime.timedelta(days=3, minutes=10)
129
+ * duration = Duration()
130
+ * duration.FromTimedelta(td)
131
+ *
132
+ * # JSON Mapping
133
+ *
134
+ * In JSON format, the Duration type is encoded as a string rather than an
135
+ * object, where the string ends in the suffix "s" (indicating seconds) and
136
+ * is preceded by the number of seconds, with nanoseconds expressed as
137
+ * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
138
+ * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
139
+ * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
140
+ * microsecond should be expressed in JSON format as "3.000001s".
141
+ */
142
+
143
+ export interface DurationSDKType {
144
+ /**
145
+ * Signed seconds of the span of time. Must be from -315,576,000,000
146
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
147
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
148
+ */
149
+ seconds: Long;
150
+ /**
151
+ * Signed fractions of a second at nanosecond resolution of the span
152
+ * of time. Durations less than one second are represented with a 0
153
+ * `seconds` field and a positive or negative `nanos` field. For durations
154
+ * of one second or more, a non-zero value for the `nanos` field must be
155
+ * of the same sign as the `seconds` field. Must be from -999,999,999
156
+ * to +999,999,999 inclusive.
157
+ */
158
+
159
+ nanos: number;
160
+ }
161
+
162
+ function createBaseDuration(): Duration {
163
+ return {
164
+ seconds: Long.ZERO,
165
+ nanos: 0
166
+ };
167
+ }
168
+
169
+ export const Duration = {
170
+ encode(message: Duration, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
171
+ if (!message.seconds.isZero()) {
172
+ writer.uint32(8).int64(message.seconds);
173
+ }
174
+
175
+ if (message.nanos !== 0) {
176
+ writer.uint32(16).int32(message.nanos);
177
+ }
178
+
179
+ return writer;
180
+ },
181
+
182
+ decode(input: _m0.Reader | Uint8Array, length?: number): Duration {
183
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
184
+ let end = length === undefined ? reader.len : reader.pos + length;
185
+ const message = createBaseDuration();
186
+
187
+ while (reader.pos < end) {
188
+ const tag = reader.uint32();
189
+
190
+ switch (tag >>> 3) {
191
+ case 1:
192
+ message.seconds = (reader.int64() as Long);
193
+ break;
194
+
195
+ case 2:
196
+ message.nanos = reader.int32();
197
+ break;
198
+
199
+ default:
200
+ reader.skipType(tag & 7);
201
+ break;
202
+ }
203
+ }
204
+
205
+ return message;
206
+ },
207
+
208
+ fromJSON(object: any): Duration {
209
+ return {
210
+ seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,
211
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0
212
+ };
213
+ },
214
+
215
+ toJSON(message: Duration): unknown {
216
+ const obj: any = {};
217
+ message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString());
218
+ message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
219
+ return obj;
220
+ },
221
+
222
+ fromPartial(object: Partial<Duration>): Duration {
223
+ const message = createBaseDuration();
224
+ message.seconds = object.seconds !== undefined && object.seconds !== null ? Long.fromValue(object.seconds) : Long.ZERO;
225
+ message.nanos = object.nanos ?? 0;
226
+ return message;
227
+ }
228
+
229
+ };
@@ -0,0 +1,273 @@
1
+ import * as _m0 from "protobufjs/minimal";
2
+ import { Long, isSet } from "../../helpers";
3
+ /**
4
+ * A Timestamp represents a point in time independent of any time zone or local
5
+ * calendar, encoded as a count of seconds and fractions of seconds at
6
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
7
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
8
+ * Gregorian calendar backwards to year one.
9
+ *
10
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
11
+ * second table is needed for interpretation, using a [24-hour linear
12
+ * smear](https://developers.google.com/time/smear).
13
+ *
14
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
15
+ * restricting to that range, we ensure that we can convert to and from [RFC
16
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
17
+ *
18
+ * # Examples
19
+ *
20
+ * Example 1: Compute Timestamp from POSIX `time()`.
21
+ *
22
+ * Timestamp timestamp;
23
+ * timestamp.set_seconds(time(NULL));
24
+ * timestamp.set_nanos(0);
25
+ *
26
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
27
+ *
28
+ * struct timeval tv;
29
+ * gettimeofday(&tv, NULL);
30
+ *
31
+ * Timestamp timestamp;
32
+ * timestamp.set_seconds(tv.tv_sec);
33
+ * timestamp.set_nanos(tv.tv_usec * 1000);
34
+ *
35
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
36
+ *
37
+ * FILETIME ft;
38
+ * GetSystemTimeAsFileTime(&ft);
39
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
40
+ *
41
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
42
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
43
+ * Timestamp timestamp;
44
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
45
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
46
+ *
47
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
48
+ *
49
+ * long millis = System.currentTimeMillis();
50
+ *
51
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
52
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
53
+ *
54
+ *
55
+ * Example 5: Compute Timestamp from current time in Python.
56
+ *
57
+ * timestamp = Timestamp()
58
+ * timestamp.GetCurrentTime()
59
+ *
60
+ * # JSON Mapping
61
+ *
62
+ * In JSON format, the Timestamp type is encoded as a string in the
63
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
64
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
65
+ * where {year} is always expressed using four digits while {month}, {day},
66
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
67
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
68
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
69
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
70
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
71
+ * able to accept both UTC and other timezones (as indicated by an offset).
72
+ *
73
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
74
+ * 01:30 UTC on January 15, 2017.
75
+ *
76
+ * In JavaScript, one can convert a Date object to this format using the
77
+ * standard
78
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
79
+ * method. In Python, a standard `datetime.datetime` object can be converted
80
+ * to this format using
81
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
82
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
83
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
84
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
85
+ * ) to obtain a formatter capable of generating timestamps in this format.
86
+ */
87
+
88
+ export interface Timestamp {
89
+ /**
90
+ * Represents seconds of UTC time since Unix epoch
91
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
92
+ * 9999-12-31T23:59:59Z inclusive.
93
+ */
94
+ seconds: Long;
95
+ /**
96
+ * Non-negative fractions of a second at nanosecond resolution. Negative
97
+ * second values with fractions must still have non-negative nanos values
98
+ * that count forward in time. Must be from 0 to 999,999,999
99
+ * inclusive.
100
+ */
101
+
102
+ nanos: number;
103
+ }
104
+ /**
105
+ * A Timestamp represents a point in time independent of any time zone or local
106
+ * calendar, encoded as a count of seconds and fractions of seconds at
107
+ * nanosecond resolution. The count is relative to an epoch at UTC midnight on
108
+ * January 1, 1970, in the proleptic Gregorian calendar which extends the
109
+ * Gregorian calendar backwards to year one.
110
+ *
111
+ * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
112
+ * second table is needed for interpretation, using a [24-hour linear
113
+ * smear](https://developers.google.com/time/smear).
114
+ *
115
+ * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
116
+ * restricting to that range, we ensure that we can convert to and from [RFC
117
+ * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
118
+ *
119
+ * # Examples
120
+ *
121
+ * Example 1: Compute Timestamp from POSIX `time()`.
122
+ *
123
+ * Timestamp timestamp;
124
+ * timestamp.set_seconds(time(NULL));
125
+ * timestamp.set_nanos(0);
126
+ *
127
+ * Example 2: Compute Timestamp from POSIX `gettimeofday()`.
128
+ *
129
+ * struct timeval tv;
130
+ * gettimeofday(&tv, NULL);
131
+ *
132
+ * Timestamp timestamp;
133
+ * timestamp.set_seconds(tv.tv_sec);
134
+ * timestamp.set_nanos(tv.tv_usec * 1000);
135
+ *
136
+ * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
137
+ *
138
+ * FILETIME ft;
139
+ * GetSystemTimeAsFileTime(&ft);
140
+ * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
141
+ *
142
+ * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
143
+ * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
144
+ * Timestamp timestamp;
145
+ * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
146
+ * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
147
+ *
148
+ * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
149
+ *
150
+ * long millis = System.currentTimeMillis();
151
+ *
152
+ * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
153
+ * .setNanos((int) ((millis % 1000) * 1000000)).build();
154
+ *
155
+ *
156
+ * Example 5: Compute Timestamp from current time in Python.
157
+ *
158
+ * timestamp = Timestamp()
159
+ * timestamp.GetCurrentTime()
160
+ *
161
+ * # JSON Mapping
162
+ *
163
+ * In JSON format, the Timestamp type is encoded as a string in the
164
+ * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
165
+ * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
166
+ * where {year} is always expressed using four digits while {month}, {day},
167
+ * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
168
+ * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
169
+ * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
170
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
171
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
172
+ * able to accept both UTC and other timezones (as indicated by an offset).
173
+ *
174
+ * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
175
+ * 01:30 UTC on January 15, 2017.
176
+ *
177
+ * In JavaScript, one can convert a Date object to this format using the
178
+ * standard
179
+ * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
180
+ * method. In Python, a standard `datetime.datetime` object can be converted
181
+ * to this format using
182
+ * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
183
+ * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
184
+ * the Joda Time's [`ISODateTimeFormat.dateTime()`](
185
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
186
+ * ) to obtain a formatter capable of generating timestamps in this format.
187
+ */
188
+
189
+ export interface TimestampSDKType {
190
+ /**
191
+ * Represents seconds of UTC time since Unix epoch
192
+ * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
193
+ * 9999-12-31T23:59:59Z inclusive.
194
+ */
195
+ seconds: Long;
196
+ /**
197
+ * Non-negative fractions of a second at nanosecond resolution. Negative
198
+ * second values with fractions must still have non-negative nanos values
199
+ * that count forward in time. Must be from 0 to 999,999,999
200
+ * inclusive.
201
+ */
202
+
203
+ nanos: number;
204
+ }
205
+
206
+ function createBaseTimestamp(): Timestamp {
207
+ return {
208
+ seconds: Long.ZERO,
209
+ nanos: 0
210
+ };
211
+ }
212
+
213
+ export const Timestamp = {
214
+ encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
215
+ if (!message.seconds.isZero()) {
216
+ writer.uint32(8).int64(message.seconds);
217
+ }
218
+
219
+ if (message.nanos !== 0) {
220
+ writer.uint32(16).int32(message.nanos);
221
+ }
222
+
223
+ return writer;
224
+ },
225
+
226
+ decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
227
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
228
+ let end = length === undefined ? reader.len : reader.pos + length;
229
+ const message = createBaseTimestamp();
230
+
231
+ while (reader.pos < end) {
232
+ const tag = reader.uint32();
233
+
234
+ switch (tag >>> 3) {
235
+ case 1:
236
+ message.seconds = (reader.int64() as Long);
237
+ break;
238
+
239
+ case 2:
240
+ message.nanos = reader.int32();
241
+ break;
242
+
243
+ default:
244
+ reader.skipType(tag & 7);
245
+ break;
246
+ }
247
+ }
248
+
249
+ return message;
250
+ },
251
+
252
+ fromJSON(object: any): Timestamp {
253
+ return {
254
+ seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,
255
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0
256
+ };
257
+ },
258
+
259
+ toJSON(message: Timestamp): unknown {
260
+ const obj: any = {};
261
+ message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString());
262
+ message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
263
+ return obj;
264
+ },
265
+
266
+ fromPartial(object: Partial<Timestamp>): Timestamp {
267
+ const message = createBaseTimestamp();
268
+ message.seconds = object.seconds !== undefined && object.seconds !== null ? Long.fromValue(object.seconds) : Long.ZERO;
269
+ message.nanos = object.nanos ?? 0;
270
+ return message;
271
+ }
272
+
273
+ };