@ottochain/sdk 2.0.0 → 2.1.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.
Files changed (142) hide show
  1. package/dist/cjs/apps/contracts/index.js +1 -1
  2. package/dist/cjs/apps/contracts/state-machines/contract-agreement.js +272 -0
  3. package/dist/cjs/apps/contracts/state-machines/contract-escrow.js +284 -0
  4. package/dist/cjs/apps/contracts/state-machines/contract-universal.js +93 -0
  5. package/dist/cjs/apps/contracts/state-machines/index.js +177 -1
  6. package/dist/cjs/apps/corporate/state-machines/corp-board.js +1022 -0
  7. package/dist/cjs/apps/corporate/state-machines/corp-entity.js +671 -0
  8. package/dist/cjs/apps/corporate/state-machines/corp-securities.js +998 -0
  9. package/dist/cjs/apps/corporate/state-machines/corp-shareholders.js +1102 -0
  10. package/dist/cjs/apps/corporate/state-machines/index.js +20 -4440
  11. package/dist/cjs/apps/governance/index.js +7 -7
  12. package/dist/cjs/apps/governance/state-machines/dao-multisig.js +467 -0
  13. package/dist/cjs/apps/governance/state-machines/dao-reputation.js +458 -0
  14. package/dist/cjs/apps/governance/state-machines/dao-single.js +199 -0
  15. package/dist/cjs/apps/governance/state-machines/dao-token.js +503 -0
  16. package/dist/cjs/apps/governance/state-machines/governance-simple.js +482 -0
  17. package/dist/cjs/apps/governance/state-machines/governance-universal.js +138 -0
  18. package/dist/cjs/apps/governance/state-machines/index.js +16 -2934
  19. package/dist/cjs/apps/identity/constants.js +28 -14
  20. package/dist/cjs/apps/identity/index.js +27 -12
  21. package/dist/cjs/apps/identity/state-machines/identity-agent.js +256 -0
  22. package/dist/cjs/apps/identity/state-machines/identity-oracle.js +321 -0
  23. package/dist/cjs/apps/identity/state-machines/identity-universal.js +106 -0
  24. package/dist/cjs/apps/identity/state-machines/index.js +15 -784
  25. package/dist/cjs/apps/markets/index.js +1 -1
  26. package/dist/cjs/apps/markets/state-machines/index.js +14 -2298
  27. package/dist/cjs/apps/markets/state-machines/market-auction.js +283 -0
  28. package/dist/cjs/apps/markets/state-machines/market-crowdfund.js +312 -0
  29. package/dist/cjs/apps/markets/state-machines/market-group-buy.js +407 -0
  30. package/dist/cjs/apps/markets/state-machines/market-prediction.js +485 -0
  31. package/dist/cjs/apps/markets/state-machines/market-universal.js +129 -0
  32. package/dist/cjs/apps/oracles/index.js +36 -0
  33. package/dist/cjs/generated/google/protobuf/struct.js +1 -1
  34. package/dist/cjs/generated/google/protobuf/timestamp.js +1 -1
  35. package/dist/cjs/generated/index.js +26 -22
  36. package/dist/cjs/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  37. package/dist/cjs/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  38. package/dist/cjs/generated/ottochain/apps/governance/v1/governance.js +1 -1
  39. package/dist/cjs/generated/ottochain/apps/identity/v1/attestation.js +12 -12
  40. package/dist/cjs/generated/ottochain/apps/identity/v1/identity.js +1688 -0
  41. package/dist/cjs/generated/ottochain/apps/markets/v1/market.js +1 -1
  42. package/dist/cjs/generated/ottochain/v1/common.js +1 -1
  43. package/dist/cjs/generated/ottochain/v1/fiber.js +1 -1
  44. package/dist/cjs/generated/ottochain/v1/messages.js +1 -1
  45. package/dist/cjs/generated/ottochain/v1/records.js +1 -1
  46. package/dist/cjs/schema/fiber-app.js +55 -0
  47. package/dist/cjs/schema/index.js +20 -0
  48. package/dist/esm/apps/contracts/index.js +3 -3
  49. package/dist/esm/apps/contracts/state-machines/contract-agreement.js +269 -0
  50. package/dist/esm/apps/contracts/state-machines/contract-escrow.js +281 -0
  51. package/dist/esm/apps/contracts/state-machines/contract-universal.js +90 -0
  52. package/dist/esm/apps/contracts/state-machines/index.js +177 -1
  53. package/dist/esm/apps/corporate/index.js +3 -3
  54. package/dist/esm/apps/corporate/state-machines/corp-board.js +1019 -0
  55. package/dist/esm/apps/corporate/state-machines/corp-entity.js +668 -0
  56. package/dist/esm/apps/corporate/state-machines/corp-securities.js +995 -0
  57. package/dist/esm/apps/corporate/state-machines/corp-shareholders.js +1099 -0
  58. package/dist/esm/apps/corporate/state-machines/index.js +15 -4439
  59. package/dist/esm/apps/governance/index.js +9 -9
  60. package/dist/esm/apps/governance/state-machines/dao-multisig.js +464 -0
  61. package/dist/esm/apps/governance/state-machines/dao-reputation.js +455 -0
  62. package/dist/esm/apps/governance/state-machines/dao-single.js +196 -0
  63. package/dist/esm/apps/governance/state-machines/dao-token.js +500 -0
  64. package/dist/esm/apps/governance/state-machines/governance-simple.js +479 -0
  65. package/dist/esm/apps/governance/state-machines/governance-universal.js +135 -0
  66. package/dist/esm/apps/governance/state-machines/index.js +9 -2933
  67. package/dist/esm/apps/identity/constants.js +28 -14
  68. package/dist/esm/apps/identity/index.js +7 -5
  69. package/dist/esm/apps/identity/state-machines/identity-agent.js +253 -0
  70. package/dist/esm/apps/identity/state-machines/identity-oracle.js +318 -0
  71. package/dist/esm/apps/identity/state-machines/identity-universal.js +103 -0
  72. package/dist/esm/apps/identity/state-machines/index.js +11 -783
  73. package/dist/esm/apps/index.js +5 -5
  74. package/dist/esm/apps/markets/index.js +3 -3
  75. package/dist/esm/apps/markets/state-machines/index.js +8 -2297
  76. package/dist/esm/apps/markets/state-machines/market-auction.js +280 -0
  77. package/dist/esm/apps/markets/state-machines/market-crowdfund.js +309 -0
  78. package/dist/esm/apps/markets/state-machines/market-group-buy.js +404 -0
  79. package/dist/esm/apps/markets/state-machines/market-prediction.js +482 -0
  80. package/dist/esm/apps/markets/state-machines/market-universal.js +126 -0
  81. package/dist/esm/apps/oracles/index.js +21 -0
  82. package/dist/esm/generated/google/protobuf/struct.js +1 -1
  83. package/dist/esm/generated/google/protobuf/timestamp.js +1 -1
  84. package/dist/esm/generated/index.js +8 -4
  85. package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +1 -1
  86. package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +1 -1
  87. package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +1 -1
  88. package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +2 -2
  89. package/dist/esm/generated/ottochain/apps/identity/v1/identity.js +1676 -0
  90. package/dist/esm/generated/ottochain/apps/markets/v1/market.js +1 -1
  91. package/dist/esm/generated/ottochain/v1/common.js +1 -1
  92. package/dist/esm/generated/ottochain/v1/fiber.js +1 -1
  93. package/dist/esm/generated/ottochain/v1/messages.js +1 -1
  94. package/dist/esm/generated/ottochain/v1/records.js +1 -1
  95. package/dist/esm/schema/fiber-app.js +47 -0
  96. package/dist/esm/schema/index.js +4 -0
  97. package/dist/types/apps/contracts/index.d.ts +151 -2
  98. package/dist/types/apps/contracts/state-machines/contract-agreement.d.ts +462 -0
  99. package/dist/types/apps/contracts/state-machines/contract-escrow.d.ts +511 -0
  100. package/dist/types/apps/contracts/state-machines/contract-universal.d.ts +147 -0
  101. package/dist/types/apps/contracts/state-machines/index.d.ts +149 -0
  102. package/dist/types/apps/corporate/index.d.ts +5263 -3825
  103. package/dist/types/apps/corporate/state-machines/corp-board.d.ts +1479 -0
  104. package/dist/types/apps/corporate/state-machines/corp-entity.d.ts +970 -0
  105. package/dist/types/apps/corporate/state-machines/corp-securities.d.ts +1381 -0
  106. package/dist/types/apps/corporate/state-machines/corp-shareholders.d.ts +1631 -0
  107. package/dist/types/apps/corporate/state-machines/index.d.ts +5245 -3802
  108. package/dist/types/apps/governance/index.d.ts +875 -37
  109. package/dist/types/apps/governance/state-machines/dao-multisig.d.ts +644 -0
  110. package/dist/types/apps/governance/state-machines/dao-reputation.d.ts +610 -0
  111. package/dist/types/apps/governance/state-machines/dao-single.d.ts +276 -0
  112. package/dist/types/apps/governance/state-machines/dao-token.d.ts +601 -0
  113. package/dist/types/apps/governance/state-machines/governance-simple.d.ts +652 -0
  114. package/dist/types/apps/governance/state-machines/governance-universal.d.ts +181 -0
  115. package/dist/types/apps/governance/state-machines/index.d.ts +9 -2136
  116. package/dist/types/apps/identity/constants.d.ts +8 -6
  117. package/dist/types/apps/identity/index.d.ts +1078 -577
  118. package/dist/types/apps/identity/state-machines/identity-agent.d.ts +401 -0
  119. package/dist/types/apps/identity/state-machines/identity-oracle.d.ts +550 -0
  120. package/dist/types/apps/identity/state-machines/identity-universal.d.ts +151 -0
  121. package/dist/types/apps/identity/state-machines/index.d.ts +1069 -567
  122. package/dist/types/apps/index.d.ts +5 -5
  123. package/dist/types/apps/markets/index.d.ts +535 -7
  124. package/dist/types/apps/markets/state-machines/index.d.ts +8 -1678
  125. package/dist/types/apps/markets/state-machines/market-auction.d.ts +392 -0
  126. package/dist/types/apps/markets/state-machines/market-crowdfund.d.ts +443 -0
  127. package/dist/types/apps/markets/state-machines/market-group-buy.d.ts +539 -0
  128. package/dist/types/apps/markets/state-machines/market-prediction.d.ts +651 -0
  129. package/dist/types/apps/markets/state-machines/market-universal.d.ts +191 -0
  130. package/dist/types/apps/oracles/index.d.ts +18 -0
  131. package/dist/types/generated/index.d.ts +3 -2
  132. package/dist/types/generated/ottochain/apps/identity/v1/attestation.d.ts +1 -1
  133. package/dist/types/generated/ottochain/apps/identity/v1/identity.d.ts +187 -0
  134. package/dist/types/schema/fiber-app.d.ts +139 -0
  135. package/dist/types/schema/index.d.ts +4 -0
  136. package/package.json +1 -1
  137. package/dist/cjs/generated/ottochain/apps/identity/v1/agent.js +0 -619
  138. package/dist/cjs/generated/ottochain/apps/oracles/v1/oracle.js +0 -1223
  139. package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +0 -610
  140. package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +0 -1217
  141. package/dist/types/generated/ottochain/apps/identity/v1/agent.d.ts +0 -94
  142. package/dist/types/generated/ottochain/apps/oracles/v1/oracle.d.ts +0 -150
@@ -1,610 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v2.11.2
4
- // protoc unknown
5
- // source: ottochain/apps/identity/v1/agent.proto
6
- /* eslint-disable */
7
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
- import { Timestamp } from "../../../../google/protobuf/timestamp.js";
9
- export const protobufPackage = "ottochain.apps.identity.v1";
10
- /** Agent lifecycle states in the identity state machine */
11
- export var AgentState;
12
- (function (AgentState) {
13
- AgentState["AGENT_STATE_UNSPECIFIED"] = "AGENT_STATE_UNSPECIFIED";
14
- /** AGENT_STATE_REGISTERED - Initial state after registration */
15
- AgentState["AGENT_STATE_REGISTERED"] = "AGENT_STATE_REGISTERED";
16
- /** AGENT_STATE_ACTIVE - Activated and participating */
17
- AgentState["AGENT_STATE_ACTIVE"] = "AGENT_STATE_ACTIVE";
18
- /** AGENT_STATE_CHALLENGED - Under dispute/challenge */
19
- AgentState["AGENT_STATE_CHALLENGED"] = "AGENT_STATE_CHALLENGED";
20
- /** AGENT_STATE_SUSPENDED - Challenge upheld, temporarily suspended */
21
- AgentState["AGENT_STATE_SUSPENDED"] = "AGENT_STATE_SUSPENDED";
22
- /** AGENT_STATE_PROBATION - Recovering from suspension */
23
- AgentState["AGENT_STATE_PROBATION"] = "AGENT_STATE_PROBATION";
24
- /** AGENT_STATE_WITHDRAWN - Voluntarily exited (terminal) */
25
- AgentState["AGENT_STATE_WITHDRAWN"] = "AGENT_STATE_WITHDRAWN";
26
- AgentState["UNRECOGNIZED"] = "UNRECOGNIZED";
27
- })(AgentState || (AgentState = {}));
28
- export function agentStateFromJSON(object) {
29
- switch (object) {
30
- case 0:
31
- case "AGENT_STATE_UNSPECIFIED":
32
- return AgentState.AGENT_STATE_UNSPECIFIED;
33
- case 1:
34
- case "AGENT_STATE_REGISTERED":
35
- return AgentState.AGENT_STATE_REGISTERED;
36
- case 2:
37
- case "AGENT_STATE_ACTIVE":
38
- return AgentState.AGENT_STATE_ACTIVE;
39
- case 3:
40
- case "AGENT_STATE_CHALLENGED":
41
- return AgentState.AGENT_STATE_CHALLENGED;
42
- case 4:
43
- case "AGENT_STATE_SUSPENDED":
44
- return AgentState.AGENT_STATE_SUSPENDED;
45
- case 5:
46
- case "AGENT_STATE_PROBATION":
47
- return AgentState.AGENT_STATE_PROBATION;
48
- case 6:
49
- case "AGENT_STATE_WITHDRAWN":
50
- return AgentState.AGENT_STATE_WITHDRAWN;
51
- case -1:
52
- case "UNRECOGNIZED":
53
- default:
54
- return AgentState.UNRECOGNIZED;
55
- }
56
- }
57
- export function agentStateToJSON(object) {
58
- switch (object) {
59
- case AgentState.AGENT_STATE_UNSPECIFIED:
60
- return "AGENT_STATE_UNSPECIFIED";
61
- case AgentState.AGENT_STATE_REGISTERED:
62
- return "AGENT_STATE_REGISTERED";
63
- case AgentState.AGENT_STATE_ACTIVE:
64
- return "AGENT_STATE_ACTIVE";
65
- case AgentState.AGENT_STATE_CHALLENGED:
66
- return "AGENT_STATE_CHALLENGED";
67
- case AgentState.AGENT_STATE_SUSPENDED:
68
- return "AGENT_STATE_SUSPENDED";
69
- case AgentState.AGENT_STATE_PROBATION:
70
- return "AGENT_STATE_PROBATION";
71
- case AgentState.AGENT_STATE_WITHDRAWN:
72
- return "AGENT_STATE_WITHDRAWN";
73
- case AgentState.UNRECOGNIZED:
74
- default:
75
- return "UNRECOGNIZED";
76
- }
77
- }
78
- export function agentStateToNumber(object) {
79
- switch (object) {
80
- case AgentState.AGENT_STATE_UNSPECIFIED:
81
- return 0;
82
- case AgentState.AGENT_STATE_REGISTERED:
83
- return 1;
84
- case AgentState.AGENT_STATE_ACTIVE:
85
- return 2;
86
- case AgentState.AGENT_STATE_CHALLENGED:
87
- return 3;
88
- case AgentState.AGENT_STATE_SUSPENDED:
89
- return 4;
90
- case AgentState.AGENT_STATE_PROBATION:
91
- return 5;
92
- case AgentState.AGENT_STATE_WITHDRAWN:
93
- return 6;
94
- case AgentState.UNRECOGNIZED:
95
- default:
96
- return -1;
97
- }
98
- }
99
- /** Platform where agent identity is linked */
100
- export var Platform;
101
- (function (Platform) {
102
- Platform["PLATFORM_UNSPECIFIED"] = "PLATFORM_UNSPECIFIED";
103
- Platform["PLATFORM_DISCORD"] = "PLATFORM_DISCORD";
104
- Platform["PLATFORM_TELEGRAM"] = "PLATFORM_TELEGRAM";
105
- Platform["PLATFORM_TWITTER"] = "PLATFORM_TWITTER";
106
- Platform["PLATFORM_GITHUB"] = "PLATFORM_GITHUB";
107
- Platform["PLATFORM_CUSTOM"] = "PLATFORM_CUSTOM";
108
- Platform["UNRECOGNIZED"] = "UNRECOGNIZED";
109
- })(Platform || (Platform = {}));
110
- export function platformFromJSON(object) {
111
- switch (object) {
112
- case 0:
113
- case "PLATFORM_UNSPECIFIED":
114
- return Platform.PLATFORM_UNSPECIFIED;
115
- case 1:
116
- case "PLATFORM_DISCORD":
117
- return Platform.PLATFORM_DISCORD;
118
- case 2:
119
- case "PLATFORM_TELEGRAM":
120
- return Platform.PLATFORM_TELEGRAM;
121
- case 3:
122
- case "PLATFORM_TWITTER":
123
- return Platform.PLATFORM_TWITTER;
124
- case 4:
125
- case "PLATFORM_GITHUB":
126
- return Platform.PLATFORM_GITHUB;
127
- case 5:
128
- case "PLATFORM_CUSTOM":
129
- return Platform.PLATFORM_CUSTOM;
130
- case -1:
131
- case "UNRECOGNIZED":
132
- default:
133
- return Platform.UNRECOGNIZED;
134
- }
135
- }
136
- export function platformToJSON(object) {
137
- switch (object) {
138
- case Platform.PLATFORM_UNSPECIFIED:
139
- return "PLATFORM_UNSPECIFIED";
140
- case Platform.PLATFORM_DISCORD:
141
- return "PLATFORM_DISCORD";
142
- case Platform.PLATFORM_TELEGRAM:
143
- return "PLATFORM_TELEGRAM";
144
- case Platform.PLATFORM_TWITTER:
145
- return "PLATFORM_TWITTER";
146
- case Platform.PLATFORM_GITHUB:
147
- return "PLATFORM_GITHUB";
148
- case Platform.PLATFORM_CUSTOM:
149
- return "PLATFORM_CUSTOM";
150
- case Platform.UNRECOGNIZED:
151
- default:
152
- return "UNRECOGNIZED";
153
- }
154
- }
155
- export function platformToNumber(object) {
156
- switch (object) {
157
- case Platform.PLATFORM_UNSPECIFIED:
158
- return 0;
159
- case Platform.PLATFORM_DISCORD:
160
- return 1;
161
- case Platform.PLATFORM_TELEGRAM:
162
- return 2;
163
- case Platform.PLATFORM_TWITTER:
164
- return 3;
165
- case Platform.PLATFORM_GITHUB:
166
- return 4;
167
- case Platform.PLATFORM_CUSTOM:
168
- return 5;
169
- case Platform.UNRECOGNIZED:
170
- default:
171
- return -1;
172
- }
173
- }
174
- function createBasePlatformLink() {
175
- return {
176
- platform: Platform.PLATFORM_UNSPECIFIED,
177
- platformUserId: "",
178
- platformUsername: "",
179
- linkedAt: undefined,
180
- verified: false,
181
- };
182
- }
183
- export const PlatformLink = {
184
- encode(message, writer = new BinaryWriter()) {
185
- if (message.platform !== Platform.PLATFORM_UNSPECIFIED) {
186
- writer.uint32(8).int32(platformToNumber(message.platform));
187
- }
188
- if (message.platformUserId !== "") {
189
- writer.uint32(18).string(message.platformUserId);
190
- }
191
- if (message.platformUsername !== "") {
192
- writer.uint32(26).string(message.platformUsername);
193
- }
194
- if (message.linkedAt !== undefined) {
195
- Timestamp.encode(toTimestamp(message.linkedAt), writer.uint32(34).fork()).join();
196
- }
197
- if (message.verified !== false) {
198
- writer.uint32(40).bool(message.verified);
199
- }
200
- return writer;
201
- },
202
- decode(input, length) {
203
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
204
- const end = length === undefined ? reader.len : reader.pos + length;
205
- const message = createBasePlatformLink();
206
- while (reader.pos < end) {
207
- const tag = reader.uint32();
208
- switch (tag >>> 3) {
209
- case 1: {
210
- if (tag !== 8) {
211
- break;
212
- }
213
- message.platform = platformFromJSON(reader.int32());
214
- continue;
215
- }
216
- case 2: {
217
- if (tag !== 18) {
218
- break;
219
- }
220
- message.platformUserId = reader.string();
221
- continue;
222
- }
223
- case 3: {
224
- if (tag !== 26) {
225
- break;
226
- }
227
- message.platformUsername = reader.string();
228
- continue;
229
- }
230
- case 4: {
231
- if (tag !== 34) {
232
- break;
233
- }
234
- message.linkedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
235
- continue;
236
- }
237
- case 5: {
238
- if (tag !== 40) {
239
- break;
240
- }
241
- message.verified = reader.bool();
242
- continue;
243
- }
244
- }
245
- if ((tag & 7) === 4 || tag === 0) {
246
- break;
247
- }
248
- reader.skip(tag & 7);
249
- }
250
- return message;
251
- },
252
- fromJSON(object) {
253
- return {
254
- platform: isSet(object.platform) ? platformFromJSON(object.platform) : Platform.PLATFORM_UNSPECIFIED,
255
- platformUserId: isSet(object.platformUserId)
256
- ? globalThis.String(object.platformUserId)
257
- : isSet(object.platform_user_id)
258
- ? globalThis.String(object.platform_user_id)
259
- : "",
260
- platformUsername: isSet(object.platformUsername)
261
- ? globalThis.String(object.platformUsername)
262
- : isSet(object.platform_username)
263
- ? globalThis.String(object.platform_username)
264
- : "",
265
- linkedAt: isSet(object.linkedAt)
266
- ? fromJsonTimestamp(object.linkedAt)
267
- : isSet(object.linked_at)
268
- ? fromJsonTimestamp(object.linked_at)
269
- : undefined,
270
- verified: isSet(object.verified) ? globalThis.Boolean(object.verified) : false,
271
- };
272
- },
273
- toJSON(message) {
274
- const obj = {};
275
- if (message.platform !== Platform.PLATFORM_UNSPECIFIED) {
276
- obj.platform = platformToJSON(message.platform);
277
- }
278
- if (message.platformUserId !== "") {
279
- obj.platformUserId = message.platformUserId;
280
- }
281
- if (message.platformUsername !== "") {
282
- obj.platformUsername = message.platformUsername;
283
- }
284
- if (message.linkedAt !== undefined) {
285
- obj.linkedAt = message.linkedAt.toISOString();
286
- }
287
- if (message.verified !== false) {
288
- obj.verified = message.verified;
289
- }
290
- return obj;
291
- },
292
- create(base) {
293
- return PlatformLink.fromPartial(base ?? {});
294
- },
295
- fromPartial(object) {
296
- const message = createBasePlatformLink();
297
- message.platform = object.platform ?? Platform.PLATFORM_UNSPECIFIED;
298
- message.platformUserId = object.platformUserId ?? "";
299
- message.platformUsername = object.platformUsername ?? "";
300
- message.linkedAt = object.linkedAt ?? undefined;
301
- message.verified = object.verified ?? false;
302
- return message;
303
- },
304
- };
305
- function createBaseAgentIdentity() {
306
- return {
307
- address: "",
308
- publicKey: "",
309
- displayName: "",
310
- reputation: 0,
311
- state: AgentState.AGENT_STATE_UNSPECIFIED,
312
- platformLinks: [],
313
- createdAt: undefined,
314
- updatedAt: undefined,
315
- };
316
- }
317
- export const AgentIdentity = {
318
- encode(message, writer = new BinaryWriter()) {
319
- if (message.address !== "") {
320
- writer.uint32(10).string(message.address);
321
- }
322
- if (message.publicKey !== "") {
323
- writer.uint32(18).string(message.publicKey);
324
- }
325
- if (message.displayName !== "") {
326
- writer.uint32(26).string(message.displayName);
327
- }
328
- if (message.reputation !== 0) {
329
- writer.uint32(32).int32(message.reputation);
330
- }
331
- if (message.state !== AgentState.AGENT_STATE_UNSPECIFIED) {
332
- writer.uint32(40).int32(agentStateToNumber(message.state));
333
- }
334
- for (const v of message.platformLinks) {
335
- PlatformLink.encode(v, writer.uint32(50).fork()).join();
336
- }
337
- if (message.createdAt !== undefined) {
338
- Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
339
- }
340
- if (message.updatedAt !== undefined) {
341
- Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
342
- }
343
- return writer;
344
- },
345
- decode(input, length) {
346
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
347
- const end = length === undefined ? reader.len : reader.pos + length;
348
- const message = createBaseAgentIdentity();
349
- while (reader.pos < end) {
350
- const tag = reader.uint32();
351
- switch (tag >>> 3) {
352
- case 1: {
353
- if (tag !== 10) {
354
- break;
355
- }
356
- message.address = reader.string();
357
- continue;
358
- }
359
- case 2: {
360
- if (tag !== 18) {
361
- break;
362
- }
363
- message.publicKey = reader.string();
364
- continue;
365
- }
366
- case 3: {
367
- if (tag !== 26) {
368
- break;
369
- }
370
- message.displayName = reader.string();
371
- continue;
372
- }
373
- case 4: {
374
- if (tag !== 32) {
375
- break;
376
- }
377
- message.reputation = reader.int32();
378
- continue;
379
- }
380
- case 5: {
381
- if (tag !== 40) {
382
- break;
383
- }
384
- message.state = agentStateFromJSON(reader.int32());
385
- continue;
386
- }
387
- case 6: {
388
- if (tag !== 50) {
389
- break;
390
- }
391
- message.platformLinks.push(PlatformLink.decode(reader, reader.uint32()));
392
- continue;
393
- }
394
- case 7: {
395
- if (tag !== 58) {
396
- break;
397
- }
398
- message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
399
- continue;
400
- }
401
- case 8: {
402
- if (tag !== 66) {
403
- break;
404
- }
405
- message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
406
- continue;
407
- }
408
- }
409
- if ((tag & 7) === 4 || tag === 0) {
410
- break;
411
- }
412
- reader.skip(tag & 7);
413
- }
414
- return message;
415
- },
416
- fromJSON(object) {
417
- return {
418
- address: isSet(object.address) ? globalThis.String(object.address) : "",
419
- publicKey: isSet(object.publicKey)
420
- ? globalThis.String(object.publicKey)
421
- : isSet(object.public_key)
422
- ? globalThis.String(object.public_key)
423
- : "",
424
- displayName: isSet(object.displayName)
425
- ? globalThis.String(object.displayName)
426
- : isSet(object.display_name)
427
- ? globalThis.String(object.display_name)
428
- : "",
429
- reputation: isSet(object.reputation) ? globalThis.Number(object.reputation) : 0,
430
- state: isSet(object.state) ? agentStateFromJSON(object.state) : AgentState.AGENT_STATE_UNSPECIFIED,
431
- platformLinks: globalThis.Array.isArray(object?.platformLinks)
432
- ? object.platformLinks.map((e) => PlatformLink.fromJSON(e))
433
- : globalThis.Array.isArray(object?.platform_links)
434
- ? object.platform_links.map((e) => PlatformLink.fromJSON(e))
435
- : [],
436
- createdAt: isSet(object.createdAt)
437
- ? fromJsonTimestamp(object.createdAt)
438
- : isSet(object.created_at)
439
- ? fromJsonTimestamp(object.created_at)
440
- : undefined,
441
- updatedAt: isSet(object.updatedAt)
442
- ? fromJsonTimestamp(object.updatedAt)
443
- : isSet(object.updated_at)
444
- ? fromJsonTimestamp(object.updated_at)
445
- : undefined,
446
- };
447
- },
448
- toJSON(message) {
449
- const obj = {};
450
- if (message.address !== "") {
451
- obj.address = message.address;
452
- }
453
- if (message.publicKey !== "") {
454
- obj.publicKey = message.publicKey;
455
- }
456
- if (message.displayName !== "") {
457
- obj.displayName = message.displayName;
458
- }
459
- if (message.reputation !== 0) {
460
- obj.reputation = Math.round(message.reputation);
461
- }
462
- if (message.state !== AgentState.AGENT_STATE_UNSPECIFIED) {
463
- obj.state = agentStateToJSON(message.state);
464
- }
465
- if (message.platformLinks?.length) {
466
- obj.platformLinks = message.platformLinks.map((e) => PlatformLink.toJSON(e));
467
- }
468
- if (message.createdAt !== undefined) {
469
- obj.createdAt = message.createdAt.toISOString();
470
- }
471
- if (message.updatedAt !== undefined) {
472
- obj.updatedAt = message.updatedAt.toISOString();
473
- }
474
- return obj;
475
- },
476
- create(base) {
477
- return AgentIdentity.fromPartial(base ?? {});
478
- },
479
- fromPartial(object) {
480
- const message = createBaseAgentIdentity();
481
- message.address = object.address ?? "";
482
- message.publicKey = object.publicKey ?? "";
483
- message.displayName = object.displayName ?? "";
484
- message.reputation = object.reputation ?? 0;
485
- message.state = object.state ?? AgentState.AGENT_STATE_UNSPECIFIED;
486
- message.platformLinks = object.platformLinks?.map((e) => PlatformLink.fromPartial(e)) || [];
487
- message.createdAt = object.createdAt ?? undefined;
488
- message.updatedAt = object.updatedAt ?? undefined;
489
- return message;
490
- },
491
- };
492
- function createBaseAgentIdentityDefinition() {
493
- return { initialReputation: 0, activationThreshold: 0, suspensionDurationEpochs: 0 };
494
- }
495
- export const AgentIdentityDefinition = {
496
- encode(message, writer = new BinaryWriter()) {
497
- if (message.initialReputation !== 0) {
498
- writer.uint32(8).int32(message.initialReputation);
499
- }
500
- if (message.activationThreshold !== 0) {
501
- writer.uint32(16).int32(message.activationThreshold);
502
- }
503
- if (message.suspensionDurationEpochs !== 0) {
504
- writer.uint32(24).int32(message.suspensionDurationEpochs);
505
- }
506
- return writer;
507
- },
508
- decode(input, length) {
509
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
510
- const end = length === undefined ? reader.len : reader.pos + length;
511
- const message = createBaseAgentIdentityDefinition();
512
- while (reader.pos < end) {
513
- const tag = reader.uint32();
514
- switch (tag >>> 3) {
515
- case 1: {
516
- if (tag !== 8) {
517
- break;
518
- }
519
- message.initialReputation = reader.int32();
520
- continue;
521
- }
522
- case 2: {
523
- if (tag !== 16) {
524
- break;
525
- }
526
- message.activationThreshold = reader.int32();
527
- continue;
528
- }
529
- case 3: {
530
- if (tag !== 24) {
531
- break;
532
- }
533
- message.suspensionDurationEpochs = reader.int32();
534
- continue;
535
- }
536
- }
537
- if ((tag & 7) === 4 || tag === 0) {
538
- break;
539
- }
540
- reader.skip(tag & 7);
541
- }
542
- return message;
543
- },
544
- fromJSON(object) {
545
- return {
546
- initialReputation: isSet(object.initialReputation)
547
- ? globalThis.Number(object.initialReputation)
548
- : isSet(object.initial_reputation)
549
- ? globalThis.Number(object.initial_reputation)
550
- : 0,
551
- activationThreshold: isSet(object.activationThreshold)
552
- ? globalThis.Number(object.activationThreshold)
553
- : isSet(object.activation_threshold)
554
- ? globalThis.Number(object.activation_threshold)
555
- : 0,
556
- suspensionDurationEpochs: isSet(object.suspensionDurationEpochs)
557
- ? globalThis.Number(object.suspensionDurationEpochs)
558
- : isSet(object.suspension_duration_epochs)
559
- ? globalThis.Number(object.suspension_duration_epochs)
560
- : 0,
561
- };
562
- },
563
- toJSON(message) {
564
- const obj = {};
565
- if (message.initialReputation !== 0) {
566
- obj.initialReputation = Math.round(message.initialReputation);
567
- }
568
- if (message.activationThreshold !== 0) {
569
- obj.activationThreshold = Math.round(message.activationThreshold);
570
- }
571
- if (message.suspensionDurationEpochs !== 0) {
572
- obj.suspensionDurationEpochs = Math.round(message.suspensionDurationEpochs);
573
- }
574
- return obj;
575
- },
576
- create(base) {
577
- return AgentIdentityDefinition.fromPartial(base ?? {});
578
- },
579
- fromPartial(object) {
580
- const message = createBaseAgentIdentityDefinition();
581
- message.initialReputation = object.initialReputation ?? 0;
582
- message.activationThreshold = object.activationThreshold ?? 0;
583
- message.suspensionDurationEpochs = object.suspensionDurationEpochs ?? 0;
584
- return message;
585
- },
586
- };
587
- function toTimestamp(date) {
588
- const seconds = Math.trunc(date.getTime() / 1000);
589
- const nanos = (date.getTime() % 1000) * 1000000;
590
- return { seconds, nanos };
591
- }
592
- function fromTimestamp(t) {
593
- let millis = (t.seconds || 0) * 1000;
594
- millis += (t.nanos || 0) / 1000000;
595
- return new globalThis.Date(millis);
596
- }
597
- function fromJsonTimestamp(o) {
598
- if (o instanceof globalThis.Date) {
599
- return o;
600
- }
601
- else if (typeof o === "string") {
602
- return new globalThis.Date(o);
603
- }
604
- else {
605
- return fromTimestamp(Timestamp.fromJSON(o));
606
- }
607
- }
608
- function isSet(value) {
609
- return value !== null && value !== undefined;
610
- }