@ottochain/sdk 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/dist/cjs/index.js +34 -15
- package/dist/cjs/ottochain/index.js +20 -1
- package/dist/cjs/ottochain/metagraph-client.js +7 -8
- package/dist/cjs/ottochain/snapshot.js +3 -3
- package/dist/cjs/{metakit → ottochain}/transaction.js +4 -5
- package/dist/cjs/verify.js +17 -0
- package/dist/esm/apps/contracts/index.js +28 -10
- package/dist/esm/apps/corporate/index.js +79 -24
- package/dist/esm/apps/governance/index.js +85 -36
- package/dist/esm/apps/identity/constants.js +27 -22
- package/dist/esm/apps/identity/index.js +35 -7
- package/dist/esm/apps/index.js +32 -6
- package/dist/esm/apps/markets/index.js +27 -6
- package/dist/esm/apps/oracles/index.js +27 -7
- package/dist/esm/errors.js +19 -9
- package/dist/esm/generated/google/protobuf/struct.js +39 -33
- package/dist/esm/generated/google/protobuf/timestamp.js +9 -6
- package/dist/esm/generated/index.js +134 -10
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +54 -48
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +357 -335
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +299 -284
- package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +47 -38
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +50 -44
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +86 -77
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +72 -66
- package/dist/esm/generated/ottochain/v1/common.js +4 -1
- package/dist/esm/generated/ottochain/v1/fiber.js +96 -90
- package/dist/esm/generated/ottochain/v1/messages.js +82 -79
- package/dist/esm/generated/ottochain/v1/records.js +140 -137
- package/dist/esm/index.js +86 -20
- package/dist/esm/{metakit → ottochain}/drop-nulls.js +5 -1
- package/dist/esm/ottochain/index.js +56 -3
- package/dist/esm/ottochain/metagraph-client.js +16 -13
- package/dist/esm/{metakit → ottochain}/normalize.js +11 -4
- package/dist/esm/ottochain/snapshot.js +20 -10
- package/dist/esm/{metakit → ottochain}/transaction.js +25 -14
- package/dist/esm/ottochain/types.js +2 -1
- package/dist/esm/types.js +7 -2
- package/dist/esm/validation.js +76 -65
- package/dist/esm/verify.js +17 -0
- package/dist/types/index.d.ts +14 -7
- package/dist/types/ottochain/index.d.ts +4 -0
- package/dist/types/ottochain/metagraph-client.d.ts +1 -1
- package/dist/types/{metakit → ottochain}/transaction.d.ts +1 -1
- package/dist/types/validation.d.ts +8 -8
- package/dist/types/verify.d.ts +9 -0
- package/package.json +5 -3
- package/dist/cjs/metakit/binary.js +0 -58
- package/dist/cjs/metakit/canonicalize.js +0 -40
- package/dist/cjs/metakit/codec.js +0 -45
- package/dist/cjs/metakit/currency-transaction.js +0 -319
- package/dist/cjs/metakit/currency-types.js +0 -13
- package/dist/cjs/metakit/hash.js +0 -84
- package/dist/cjs/metakit/index.js +0 -86
- package/dist/cjs/metakit/network/client.js +0 -78
- package/dist/cjs/metakit/network/currency-l1-client.js +0 -101
- package/dist/cjs/metakit/network/data-l1-client.js +0 -76
- package/dist/cjs/metakit/network/index.js +0 -16
- package/dist/cjs/metakit/network/types.js +0 -20
- package/dist/cjs/metakit/sign.js +0 -120
- package/dist/cjs/metakit/signed-object.js +0 -100
- package/dist/cjs/metakit/types.js +0 -14
- package/dist/cjs/metakit/verify.js +0 -217
- package/dist/cjs/metakit/wallet.js +0 -127
- package/dist/esm/metakit/binary.js +0 -53
- package/dist/esm/metakit/canonicalize.js +0 -33
- package/dist/esm/metakit/codec.js +0 -38
- package/dist/esm/metakit/currency-transaction.js +0 -306
- package/dist/esm/metakit/currency-types.js +0 -10
- package/dist/esm/metakit/hash.js +0 -77
- package/dist/esm/metakit/index.js +0 -33
- package/dist/esm/metakit/network/client.js +0 -74
- package/dist/esm/metakit/network/currency-l1-client.js +0 -97
- package/dist/esm/metakit/network/data-l1-client.js +0 -72
- package/dist/esm/metakit/network/index.js +0 -9
- package/dist/esm/metakit/network/types.js +0 -16
- package/dist/esm/metakit/sign.js +0 -114
- package/dist/esm/metakit/signed-object.js +0 -94
- package/dist/esm/metakit/types.js +0 -11
- package/dist/esm/metakit/verify.js +0 -210
- package/dist/esm/metakit/wallet.js +0 -117
- package/dist/types/metakit/binary.d.ts +0 -38
- package/dist/types/metakit/canonicalize.d.ts +0 -26
- package/dist/types/metakit/codec.d.ts +0 -16
- package/dist/types/metakit/currency-transaction.d.ts +0 -157
- package/dist/types/metakit/currency-types.d.ts +0 -55
- package/dist/types/metakit/hash.d.ts +0 -50
- package/dist/types/metakit/index.d.ts +0 -26
- package/dist/types/metakit/network/client.d.ts +0 -23
- package/dist/types/metakit/network/currency-l1-client.d.ts +0 -71
- package/dist/types/metakit/network/data-l1-client.d.ts +0 -57
- package/dist/types/metakit/network/index.d.ts +0 -10
- package/dist/types/metakit/network/types.d.ts +0 -74
- package/dist/types/metakit/sign.d.ts +0 -65
- package/dist/types/metakit/signed-object.d.ts +0 -66
- package/dist/types/metakit/types.d.ts +0 -67
- package/dist/types/metakit/verify.d.ts +0 -55
- package/dist/types/metakit/wallet.d.ts +0 -70
- /package/dist/cjs/{metakit → ottochain}/drop-nulls.js +0 -0
- /package/dist/cjs/{metakit → ottochain}/normalize.js +0 -0
- /package/dist/types/{metakit → ottochain}/drop-nulls.d.ts +0 -0
- /package/dist/types/{metakit → ottochain}/normalize.d.ts +0 -0
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
3
|
// versions:
|
|
3
4
|
// protoc-gen-ts_proto v2.11.2
|
|
4
5
|
// protoc unknown
|
|
5
6
|
// source: ottochain/apps/identity/v1/agent.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AgentIdentityDefinition = exports.AgentIdentity = exports.PlatformLink = exports.platformToNumber = exports.platformToJSON = exports.platformFromJSON = exports.Platform = exports.agentStateToNumber = exports.agentStateToJSON = exports.agentStateFromJSON = exports.AgentState = exports.protobufPackage = void 0;
|
|
6
9
|
/* eslint-disable */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const timestamp_js_1 = require("../../../../google/protobuf/timestamp.js");
|
|
12
|
+
exports.protobufPackage = "ottochain.apps.identity.v1";
|
|
10
13
|
/** Agent lifecycle states in the identity state machine */
|
|
11
|
-
|
|
14
|
+
var AgentState;
|
|
12
15
|
(function (AgentState) {
|
|
13
16
|
AgentState["AGENT_STATE_UNSPECIFIED"] = "AGENT_STATE_UNSPECIFIED";
|
|
14
17
|
/** AGENT_STATE_REGISTERED - Initial state after registration */
|
|
@@ -24,8 +27,8 @@ export var AgentState;
|
|
|
24
27
|
/** AGENT_STATE_WITHDRAWN - Voluntarily exited (terminal) */
|
|
25
28
|
AgentState["AGENT_STATE_WITHDRAWN"] = "AGENT_STATE_WITHDRAWN";
|
|
26
29
|
AgentState["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
27
|
-
})(AgentState || (AgentState = {}));
|
|
28
|
-
|
|
30
|
+
})(AgentState || (exports.AgentState = AgentState = {}));
|
|
31
|
+
function agentStateFromJSON(object) {
|
|
29
32
|
switch (object) {
|
|
30
33
|
case 0:
|
|
31
34
|
case "AGENT_STATE_UNSPECIFIED":
|
|
@@ -54,7 +57,8 @@ export function agentStateFromJSON(object) {
|
|
|
54
57
|
return AgentState.UNRECOGNIZED;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
|
-
|
|
60
|
+
exports.agentStateFromJSON = agentStateFromJSON;
|
|
61
|
+
function agentStateToJSON(object) {
|
|
58
62
|
switch (object) {
|
|
59
63
|
case AgentState.AGENT_STATE_UNSPECIFIED:
|
|
60
64
|
return "AGENT_STATE_UNSPECIFIED";
|
|
@@ -75,7 +79,8 @@ export function agentStateToJSON(object) {
|
|
|
75
79
|
return "UNRECOGNIZED";
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
|
-
|
|
82
|
+
exports.agentStateToJSON = agentStateToJSON;
|
|
83
|
+
function agentStateToNumber(object) {
|
|
79
84
|
switch (object) {
|
|
80
85
|
case AgentState.AGENT_STATE_UNSPECIFIED:
|
|
81
86
|
return 0;
|
|
@@ -96,8 +101,9 @@ export function agentStateToNumber(object) {
|
|
|
96
101
|
return -1;
|
|
97
102
|
}
|
|
98
103
|
}
|
|
104
|
+
exports.agentStateToNumber = agentStateToNumber;
|
|
99
105
|
/** Platform where agent identity is linked */
|
|
100
|
-
|
|
106
|
+
var Platform;
|
|
101
107
|
(function (Platform) {
|
|
102
108
|
Platform["PLATFORM_UNSPECIFIED"] = "PLATFORM_UNSPECIFIED";
|
|
103
109
|
Platform["PLATFORM_DISCORD"] = "PLATFORM_DISCORD";
|
|
@@ -106,8 +112,8 @@ export var Platform;
|
|
|
106
112
|
Platform["PLATFORM_GITHUB"] = "PLATFORM_GITHUB";
|
|
107
113
|
Platform["PLATFORM_CUSTOM"] = "PLATFORM_CUSTOM";
|
|
108
114
|
Platform["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
109
|
-
})(Platform || (Platform = {}));
|
|
110
|
-
|
|
115
|
+
})(Platform || (exports.Platform = Platform = {}));
|
|
116
|
+
function platformFromJSON(object) {
|
|
111
117
|
switch (object) {
|
|
112
118
|
case 0:
|
|
113
119
|
case "PLATFORM_UNSPECIFIED":
|
|
@@ -133,7 +139,8 @@ export function platformFromJSON(object) {
|
|
|
133
139
|
return Platform.UNRECOGNIZED;
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
|
-
|
|
142
|
+
exports.platformFromJSON = platformFromJSON;
|
|
143
|
+
function platformToJSON(object) {
|
|
137
144
|
switch (object) {
|
|
138
145
|
case Platform.PLATFORM_UNSPECIFIED:
|
|
139
146
|
return "PLATFORM_UNSPECIFIED";
|
|
@@ -152,7 +159,8 @@ export function platformToJSON(object) {
|
|
|
152
159
|
return "UNRECOGNIZED";
|
|
153
160
|
}
|
|
154
161
|
}
|
|
155
|
-
|
|
162
|
+
exports.platformToJSON = platformToJSON;
|
|
163
|
+
function platformToNumber(object) {
|
|
156
164
|
switch (object) {
|
|
157
165
|
case Platform.PLATFORM_UNSPECIFIED:
|
|
158
166
|
return 0;
|
|
@@ -171,6 +179,7 @@ export function platformToNumber(object) {
|
|
|
171
179
|
return -1;
|
|
172
180
|
}
|
|
173
181
|
}
|
|
182
|
+
exports.platformToNumber = platformToNumber;
|
|
174
183
|
function createBasePlatformLink() {
|
|
175
184
|
return {
|
|
176
185
|
platform: Platform.PLATFORM_UNSPECIFIED,
|
|
@@ -180,8 +189,8 @@ function createBasePlatformLink() {
|
|
|
180
189
|
verified: false,
|
|
181
190
|
};
|
|
182
191
|
}
|
|
183
|
-
|
|
184
|
-
encode(message, writer = new BinaryWriter()) {
|
|
192
|
+
exports.PlatformLink = {
|
|
193
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
185
194
|
if (message.platform !== Platform.PLATFORM_UNSPECIFIED) {
|
|
186
195
|
writer.uint32(8).int32(platformToNumber(message.platform));
|
|
187
196
|
}
|
|
@@ -192,7 +201,7 @@ export const PlatformLink = {
|
|
|
192
201
|
writer.uint32(26).string(message.platformUsername);
|
|
193
202
|
}
|
|
194
203
|
if (message.linkedAt !== undefined) {
|
|
195
|
-
Timestamp.encode(toTimestamp(message.linkedAt), writer.uint32(34).fork()).join();
|
|
204
|
+
timestamp_js_1.Timestamp.encode(toTimestamp(message.linkedAt), writer.uint32(34).fork()).join();
|
|
196
205
|
}
|
|
197
206
|
if (message.verified !== false) {
|
|
198
207
|
writer.uint32(40).bool(message.verified);
|
|
@@ -200,7 +209,7 @@ export const PlatformLink = {
|
|
|
200
209
|
return writer;
|
|
201
210
|
},
|
|
202
211
|
decode(input, length) {
|
|
203
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
212
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
204
213
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
205
214
|
const message = createBasePlatformLink();
|
|
206
215
|
while (reader.pos < end) {
|
|
@@ -231,7 +240,7 @@ export const PlatformLink = {
|
|
|
231
240
|
if (tag !== 34) {
|
|
232
241
|
break;
|
|
233
242
|
}
|
|
234
|
-
message.linkedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
243
|
+
message.linkedAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
|
|
235
244
|
continue;
|
|
236
245
|
}
|
|
237
246
|
case 5: {
|
|
@@ -290,7 +299,7 @@ export const PlatformLink = {
|
|
|
290
299
|
return obj;
|
|
291
300
|
},
|
|
292
301
|
create(base) {
|
|
293
|
-
return PlatformLink.fromPartial(base ?? {});
|
|
302
|
+
return exports.PlatformLink.fromPartial(base ?? {});
|
|
294
303
|
},
|
|
295
304
|
fromPartial(object) {
|
|
296
305
|
const message = createBasePlatformLink();
|
|
@@ -314,8 +323,8 @@ function createBaseAgentIdentity() {
|
|
|
314
323
|
updatedAt: undefined,
|
|
315
324
|
};
|
|
316
325
|
}
|
|
317
|
-
|
|
318
|
-
encode(message, writer = new BinaryWriter()) {
|
|
326
|
+
exports.AgentIdentity = {
|
|
327
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
319
328
|
if (message.address !== "") {
|
|
320
329
|
writer.uint32(10).string(message.address);
|
|
321
330
|
}
|
|
@@ -332,18 +341,18 @@ export const AgentIdentity = {
|
|
|
332
341
|
writer.uint32(40).int32(agentStateToNumber(message.state));
|
|
333
342
|
}
|
|
334
343
|
for (const v of message.platformLinks) {
|
|
335
|
-
PlatformLink.encode(v, writer.uint32(50).fork()).join();
|
|
344
|
+
exports.PlatformLink.encode(v, writer.uint32(50).fork()).join();
|
|
336
345
|
}
|
|
337
346
|
if (message.createdAt !== undefined) {
|
|
338
|
-
Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
|
|
347
|
+
timestamp_js_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).join();
|
|
339
348
|
}
|
|
340
349
|
if (message.updatedAt !== undefined) {
|
|
341
|
-
Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
|
|
350
|
+
timestamp_js_1.Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
|
|
342
351
|
}
|
|
343
352
|
return writer;
|
|
344
353
|
},
|
|
345
354
|
decode(input, length) {
|
|
346
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
355
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
347
356
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
348
357
|
const message = createBaseAgentIdentity();
|
|
349
358
|
while (reader.pos < end) {
|
|
@@ -388,21 +397,21 @@ export const AgentIdentity = {
|
|
|
388
397
|
if (tag !== 50) {
|
|
389
398
|
break;
|
|
390
399
|
}
|
|
391
|
-
message.platformLinks.push(PlatformLink.decode(reader, reader.uint32()));
|
|
400
|
+
message.platformLinks.push(exports.PlatformLink.decode(reader, reader.uint32()));
|
|
392
401
|
continue;
|
|
393
402
|
}
|
|
394
403
|
case 7: {
|
|
395
404
|
if (tag !== 58) {
|
|
396
405
|
break;
|
|
397
406
|
}
|
|
398
|
-
message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
407
|
+
message.createdAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
|
|
399
408
|
continue;
|
|
400
409
|
}
|
|
401
410
|
case 8: {
|
|
402
411
|
if (tag !== 66) {
|
|
403
412
|
break;
|
|
404
413
|
}
|
|
405
|
-
message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
414
|
+
message.updatedAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
|
|
406
415
|
continue;
|
|
407
416
|
}
|
|
408
417
|
}
|
|
@@ -429,9 +438,9 @@ export const AgentIdentity = {
|
|
|
429
438
|
reputation: isSet(object.reputation) ? globalThis.Number(object.reputation) : 0,
|
|
430
439
|
state: isSet(object.state) ? agentStateFromJSON(object.state) : AgentState.AGENT_STATE_UNSPECIFIED,
|
|
431
440
|
platformLinks: globalThis.Array.isArray(object?.platformLinks)
|
|
432
|
-
? object.platformLinks.map((e) => PlatformLink.fromJSON(e))
|
|
441
|
+
? object.platformLinks.map((e) => exports.PlatformLink.fromJSON(e))
|
|
433
442
|
: globalThis.Array.isArray(object?.platform_links)
|
|
434
|
-
? object.platform_links.map((e) => PlatformLink.fromJSON(e))
|
|
443
|
+
? object.platform_links.map((e) => exports.PlatformLink.fromJSON(e))
|
|
435
444
|
: [],
|
|
436
445
|
createdAt: isSet(object.createdAt)
|
|
437
446
|
? fromJsonTimestamp(object.createdAt)
|
|
@@ -463,7 +472,7 @@ export const AgentIdentity = {
|
|
|
463
472
|
obj.state = agentStateToJSON(message.state);
|
|
464
473
|
}
|
|
465
474
|
if (message.platformLinks?.length) {
|
|
466
|
-
obj.platformLinks = message.platformLinks.map((e) => PlatformLink.toJSON(e));
|
|
475
|
+
obj.platformLinks = message.platformLinks.map((e) => exports.PlatformLink.toJSON(e));
|
|
467
476
|
}
|
|
468
477
|
if (message.createdAt !== undefined) {
|
|
469
478
|
obj.createdAt = message.createdAt.toISOString();
|
|
@@ -474,7 +483,7 @@ export const AgentIdentity = {
|
|
|
474
483
|
return obj;
|
|
475
484
|
},
|
|
476
485
|
create(base) {
|
|
477
|
-
return AgentIdentity.fromPartial(base ?? {});
|
|
486
|
+
return exports.AgentIdentity.fromPartial(base ?? {});
|
|
478
487
|
},
|
|
479
488
|
fromPartial(object) {
|
|
480
489
|
const message = createBaseAgentIdentity();
|
|
@@ -483,7 +492,7 @@ export const AgentIdentity = {
|
|
|
483
492
|
message.displayName = object.displayName ?? "";
|
|
484
493
|
message.reputation = object.reputation ?? 0;
|
|
485
494
|
message.state = object.state ?? AgentState.AGENT_STATE_UNSPECIFIED;
|
|
486
|
-
message.platformLinks = object.platformLinks?.map((e) => PlatformLink.fromPartial(e)) || [];
|
|
495
|
+
message.platformLinks = object.platformLinks?.map((e) => exports.PlatformLink.fromPartial(e)) || [];
|
|
487
496
|
message.createdAt = object.createdAt ?? undefined;
|
|
488
497
|
message.updatedAt = object.updatedAt ?? undefined;
|
|
489
498
|
return message;
|
|
@@ -492,8 +501,8 @@ export const AgentIdentity = {
|
|
|
492
501
|
function createBaseAgentIdentityDefinition() {
|
|
493
502
|
return { initialReputation: 0, activationThreshold: 0, suspensionDurationEpochs: 0 };
|
|
494
503
|
}
|
|
495
|
-
|
|
496
|
-
encode(message, writer = new BinaryWriter()) {
|
|
504
|
+
exports.AgentIdentityDefinition = {
|
|
505
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
497
506
|
if (message.initialReputation !== 0) {
|
|
498
507
|
writer.uint32(8).int32(message.initialReputation);
|
|
499
508
|
}
|
|
@@ -506,7 +515,7 @@ export const AgentIdentityDefinition = {
|
|
|
506
515
|
return writer;
|
|
507
516
|
},
|
|
508
517
|
decode(input, length) {
|
|
509
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
518
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
510
519
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
511
520
|
const message = createBaseAgentIdentityDefinition();
|
|
512
521
|
while (reader.pos < end) {
|
|
@@ -574,7 +583,7 @@ export const AgentIdentityDefinition = {
|
|
|
574
583
|
return obj;
|
|
575
584
|
},
|
|
576
585
|
create(base) {
|
|
577
|
-
return AgentIdentityDefinition.fromPartial(base ?? {});
|
|
586
|
+
return exports.AgentIdentityDefinition.fromPartial(base ?? {});
|
|
578
587
|
},
|
|
579
588
|
fromPartial(object) {
|
|
580
589
|
const message = createBaseAgentIdentityDefinition();
|
|
@@ -602,7 +611,7 @@ function fromJsonTimestamp(o) {
|
|
|
602
611
|
return new globalThis.Date(o);
|
|
603
612
|
}
|
|
604
613
|
else {
|
|
605
|
-
return fromTimestamp(Timestamp.fromJSON(o));
|
|
614
|
+
return fromTimestamp(timestamp_js_1.Timestamp.fromJSON(o));
|
|
606
615
|
}
|
|
607
616
|
}
|
|
608
617
|
function isSet(value) {
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
3
|
// versions:
|
|
3
4
|
// protoc-gen-ts_proto v2.11.2
|
|
4
5
|
// protoc unknown
|
|
5
6
|
// source: ottochain/apps/identity/v1/attestation.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ReputationConfig = exports.ChallengeRequest = exports.VouchRequest = exports.Attestation = exports.ReputationDelta = exports.attestationTypeToNumber = exports.attestationTypeToJSON = exports.attestationTypeFromJSON = exports.AttestationType = exports.protobufPackage = void 0;
|
|
6
9
|
/* eslint-disable */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
const timestamp_js_1 = require("../../../../google/protobuf/timestamp.js");
|
|
12
|
+
const agent_js_1 = require("./agent.js");
|
|
13
|
+
exports.protobufPackage = "ottochain.apps.identity.v1";
|
|
11
14
|
/** Types of attestations that affect reputation */
|
|
12
|
-
|
|
15
|
+
var AttestationType;
|
|
13
16
|
(function (AttestationType) {
|
|
14
17
|
AttestationType["ATTESTATION_TYPE_UNSPECIFIED"] = "ATTESTATION_TYPE_UNSPECIFIED";
|
|
15
18
|
/** ATTESTATION_TYPE_COMPLETION - Contract completed successfully (+5) */
|
|
@@ -21,8 +24,8 @@ export var AttestationType;
|
|
|
21
24
|
/** ATTESTATION_TYPE_BEHAVIORAL - Positive behavioral signal (+3) */
|
|
22
25
|
AttestationType["ATTESTATION_TYPE_BEHAVIORAL"] = "ATTESTATION_TYPE_BEHAVIORAL";
|
|
23
26
|
AttestationType["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
24
|
-
})(AttestationType || (AttestationType = {}));
|
|
25
|
-
|
|
27
|
+
})(AttestationType || (exports.AttestationType = AttestationType = {}));
|
|
28
|
+
function attestationTypeFromJSON(object) {
|
|
26
29
|
switch (object) {
|
|
27
30
|
case 0:
|
|
28
31
|
case "ATTESTATION_TYPE_UNSPECIFIED":
|
|
@@ -45,7 +48,8 @@ export function attestationTypeFromJSON(object) {
|
|
|
45
48
|
return AttestationType.UNRECOGNIZED;
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
exports.attestationTypeFromJSON = attestationTypeFromJSON;
|
|
52
|
+
function attestationTypeToJSON(object) {
|
|
49
53
|
switch (object) {
|
|
50
54
|
case AttestationType.ATTESTATION_TYPE_UNSPECIFIED:
|
|
51
55
|
return "ATTESTATION_TYPE_UNSPECIFIED";
|
|
@@ -62,7 +66,8 @@ export function attestationTypeToJSON(object) {
|
|
|
62
66
|
return "UNRECOGNIZED";
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
|
-
|
|
69
|
+
exports.attestationTypeToJSON = attestationTypeToJSON;
|
|
70
|
+
function attestationTypeToNumber(object) {
|
|
66
71
|
switch (object) {
|
|
67
72
|
case AttestationType.ATTESTATION_TYPE_UNSPECIFIED:
|
|
68
73
|
return 0;
|
|
@@ -79,11 +84,12 @@ export function attestationTypeToNumber(object) {
|
|
|
79
84
|
return -1;
|
|
80
85
|
}
|
|
81
86
|
}
|
|
87
|
+
exports.attestationTypeToNumber = attestationTypeToNumber;
|
|
82
88
|
function createBaseReputationDelta() {
|
|
83
89
|
return { attestationType: AttestationType.ATTESTATION_TYPE_UNSPECIFIED, delta: 0, reason: "", recordedAt: undefined };
|
|
84
90
|
}
|
|
85
|
-
|
|
86
|
-
encode(message, writer = new BinaryWriter()) {
|
|
91
|
+
exports.ReputationDelta = {
|
|
92
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
87
93
|
if (message.attestationType !== AttestationType.ATTESTATION_TYPE_UNSPECIFIED) {
|
|
88
94
|
writer.uint32(8).int32(attestationTypeToNumber(message.attestationType));
|
|
89
95
|
}
|
|
@@ -94,12 +100,12 @@ export const ReputationDelta = {
|
|
|
94
100
|
writer.uint32(26).string(message.reason);
|
|
95
101
|
}
|
|
96
102
|
if (message.recordedAt !== undefined) {
|
|
97
|
-
Timestamp.encode(toTimestamp(message.recordedAt), writer.uint32(34).fork()).join();
|
|
103
|
+
timestamp_js_1.Timestamp.encode(toTimestamp(message.recordedAt), writer.uint32(34).fork()).join();
|
|
98
104
|
}
|
|
99
105
|
return writer;
|
|
100
106
|
},
|
|
101
107
|
decode(input, length) {
|
|
102
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
108
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
103
109
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
104
110
|
const message = createBaseReputationDelta();
|
|
105
111
|
while (reader.pos < end) {
|
|
@@ -130,7 +136,7 @@ export const ReputationDelta = {
|
|
|
130
136
|
if (tag !== 34) {
|
|
131
137
|
break;
|
|
132
138
|
}
|
|
133
|
-
message.recordedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
139
|
+
message.recordedAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
|
|
134
140
|
continue;
|
|
135
141
|
}
|
|
136
142
|
}
|
|
@@ -174,7 +180,7 @@ export const ReputationDelta = {
|
|
|
174
180
|
return obj;
|
|
175
181
|
},
|
|
176
182
|
create(base) {
|
|
177
|
-
return ReputationDelta.fromPartial(base ?? {});
|
|
183
|
+
return exports.ReputationDelta.fromPartial(base ?? {});
|
|
178
184
|
},
|
|
179
185
|
fromPartial(object) {
|
|
180
186
|
const message = createBaseReputationDelta();
|
|
@@ -191,15 +197,15 @@ function createBaseAttestation() {
|
|
|
191
197
|
type: AttestationType.ATTESTATION_TYPE_UNSPECIFIED,
|
|
192
198
|
subject: "",
|
|
193
199
|
issuer: "",
|
|
194
|
-
issuerPlatform: Platform.PLATFORM_UNSPECIFIED,
|
|
200
|
+
issuerPlatform: agent_js_1.Platform.PLATFORM_UNSPECIFIED,
|
|
195
201
|
delta: 0,
|
|
196
202
|
reason: "",
|
|
197
203
|
txHash: "",
|
|
198
204
|
createdAt: undefined,
|
|
199
205
|
};
|
|
200
206
|
}
|
|
201
|
-
|
|
202
|
-
encode(message, writer = new BinaryWriter()) {
|
|
207
|
+
exports.Attestation = {
|
|
208
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
203
209
|
if (message.id !== "") {
|
|
204
210
|
writer.uint32(10).string(message.id);
|
|
205
211
|
}
|
|
@@ -212,8 +218,8 @@ export const Attestation = {
|
|
|
212
218
|
if (message.issuer !== "") {
|
|
213
219
|
writer.uint32(34).string(message.issuer);
|
|
214
220
|
}
|
|
215
|
-
if (message.issuerPlatform !== Platform.PLATFORM_UNSPECIFIED) {
|
|
216
|
-
writer.uint32(40).int32(platformToNumber(message.issuerPlatform));
|
|
221
|
+
if (message.issuerPlatform !== agent_js_1.Platform.PLATFORM_UNSPECIFIED) {
|
|
222
|
+
writer.uint32(40).int32((0, agent_js_1.platformToNumber)(message.issuerPlatform));
|
|
217
223
|
}
|
|
218
224
|
if (message.delta !== 0) {
|
|
219
225
|
writer.uint32(48).int32(message.delta);
|
|
@@ -225,12 +231,12 @@ export const Attestation = {
|
|
|
225
231
|
writer.uint32(66).string(message.txHash);
|
|
226
232
|
}
|
|
227
233
|
if (message.createdAt !== undefined) {
|
|
228
|
-
Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
|
|
234
|
+
timestamp_js_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(74).fork()).join();
|
|
229
235
|
}
|
|
230
236
|
return writer;
|
|
231
237
|
},
|
|
232
238
|
decode(input, length) {
|
|
233
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
239
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
234
240
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
235
241
|
const message = createBaseAttestation();
|
|
236
242
|
while (reader.pos < end) {
|
|
@@ -268,7 +274,7 @@ export const Attestation = {
|
|
|
268
274
|
if (tag !== 40) {
|
|
269
275
|
break;
|
|
270
276
|
}
|
|
271
|
-
message.issuerPlatform = platformFromJSON(reader.int32());
|
|
277
|
+
message.issuerPlatform = (0, agent_js_1.platformFromJSON)(reader.int32());
|
|
272
278
|
continue;
|
|
273
279
|
}
|
|
274
280
|
case 6: {
|
|
@@ -296,7 +302,7 @@ export const Attestation = {
|
|
|
296
302
|
if (tag !== 74) {
|
|
297
303
|
break;
|
|
298
304
|
}
|
|
299
|
-
message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
305
|
+
message.createdAt = fromTimestamp(timestamp_js_1.Timestamp.decode(reader, reader.uint32()));
|
|
300
306
|
continue;
|
|
301
307
|
}
|
|
302
308
|
}
|
|
@@ -314,10 +320,10 @@ export const Attestation = {
|
|
|
314
320
|
subject: isSet(object.subject) ? globalThis.String(object.subject) : "",
|
|
315
321
|
issuer: isSet(object.issuer) ? globalThis.String(object.issuer) : "",
|
|
316
322
|
issuerPlatform: isSet(object.issuerPlatform)
|
|
317
|
-
? platformFromJSON(object.issuerPlatform)
|
|
323
|
+
? (0, agent_js_1.platformFromJSON)(object.issuerPlatform)
|
|
318
324
|
: isSet(object.issuer_platform)
|
|
319
|
-
? platformFromJSON(object.issuer_platform)
|
|
320
|
-
: Platform.PLATFORM_UNSPECIFIED,
|
|
325
|
+
? (0, agent_js_1.platformFromJSON)(object.issuer_platform)
|
|
326
|
+
: agent_js_1.Platform.PLATFORM_UNSPECIFIED,
|
|
321
327
|
delta: isSet(object.delta) ? globalThis.Number(object.delta) : 0,
|
|
322
328
|
reason: isSet(object.reason) ? globalThis.String(object.reason) : "",
|
|
323
329
|
txHash: isSet(object.txHash)
|
|
@@ -346,8 +352,8 @@ export const Attestation = {
|
|
|
346
352
|
if (message.issuer !== "") {
|
|
347
353
|
obj.issuer = message.issuer;
|
|
348
354
|
}
|
|
349
|
-
if (message.issuerPlatform !== Platform.PLATFORM_UNSPECIFIED) {
|
|
350
|
-
obj.issuerPlatform = platformToJSON(message.issuerPlatform);
|
|
355
|
+
if (message.issuerPlatform !== agent_js_1.Platform.PLATFORM_UNSPECIFIED) {
|
|
356
|
+
obj.issuerPlatform = (0, agent_js_1.platformToJSON)(message.issuerPlatform);
|
|
351
357
|
}
|
|
352
358
|
if (message.delta !== 0) {
|
|
353
359
|
obj.delta = Math.round(message.delta);
|
|
@@ -364,7 +370,7 @@ export const Attestation = {
|
|
|
364
370
|
return obj;
|
|
365
371
|
},
|
|
366
372
|
create(base) {
|
|
367
|
-
return Attestation.fromPartial(base ?? {});
|
|
373
|
+
return exports.Attestation.fromPartial(base ?? {});
|
|
368
374
|
},
|
|
369
375
|
fromPartial(object) {
|
|
370
376
|
const message = createBaseAttestation();
|
|
@@ -372,7 +378,7 @@ export const Attestation = {
|
|
|
372
378
|
message.type = object.type ?? AttestationType.ATTESTATION_TYPE_UNSPECIFIED;
|
|
373
379
|
message.subject = object.subject ?? "";
|
|
374
380
|
message.issuer = object.issuer ?? "";
|
|
375
|
-
message.issuerPlatform = object.issuerPlatform ?? Platform.PLATFORM_UNSPECIFIED;
|
|
381
|
+
message.issuerPlatform = object.issuerPlatform ?? agent_js_1.Platform.PLATFORM_UNSPECIFIED;
|
|
376
382
|
message.delta = object.delta ?? 0;
|
|
377
383
|
message.reason = object.reason ?? "";
|
|
378
384
|
message.txHash = object.txHash ?? "";
|
|
@@ -383,8 +389,8 @@ export const Attestation = {
|
|
|
383
389
|
function createBaseVouchRequest() {
|
|
384
390
|
return { fromAddress: "", toAddress: "", reason: "" };
|
|
385
391
|
}
|
|
386
|
-
|
|
387
|
-
encode(message, writer = new BinaryWriter()) {
|
|
392
|
+
exports.VouchRequest = {
|
|
393
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
388
394
|
if (message.fromAddress !== "") {
|
|
389
395
|
writer.uint32(10).string(message.fromAddress);
|
|
390
396
|
}
|
|
@@ -397,7 +403,7 @@ export const VouchRequest = {
|
|
|
397
403
|
return writer;
|
|
398
404
|
},
|
|
399
405
|
decode(input, length) {
|
|
400
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
406
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
401
407
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
402
408
|
const message = createBaseVouchRequest();
|
|
403
409
|
while (reader.pos < end) {
|
|
@@ -461,7 +467,7 @@ export const VouchRequest = {
|
|
|
461
467
|
return obj;
|
|
462
468
|
},
|
|
463
469
|
create(base) {
|
|
464
|
-
return VouchRequest.fromPartial(base ?? {});
|
|
470
|
+
return exports.VouchRequest.fromPartial(base ?? {});
|
|
465
471
|
},
|
|
466
472
|
fromPartial(object) {
|
|
467
473
|
const message = createBaseVouchRequest();
|
|
@@ -474,8 +480,8 @@ export const VouchRequest = {
|
|
|
474
480
|
function createBaseChallengeRequest() {
|
|
475
481
|
return { challenger: "", challenged: "", evidence: "", reason: "" };
|
|
476
482
|
}
|
|
477
|
-
|
|
478
|
-
encode(message, writer = new BinaryWriter()) {
|
|
483
|
+
exports.ChallengeRequest = {
|
|
484
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
479
485
|
if (message.challenger !== "") {
|
|
480
486
|
writer.uint32(10).string(message.challenger);
|
|
481
487
|
}
|
|
@@ -491,7 +497,7 @@ export const ChallengeRequest = {
|
|
|
491
497
|
return writer;
|
|
492
498
|
},
|
|
493
499
|
decode(input, length) {
|
|
494
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
500
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
495
501
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
496
502
|
const message = createBaseChallengeRequest();
|
|
497
503
|
while (reader.pos < end) {
|
|
@@ -558,7 +564,7 @@ export const ChallengeRequest = {
|
|
|
558
564
|
return obj;
|
|
559
565
|
},
|
|
560
566
|
create(base) {
|
|
561
|
-
return ChallengeRequest.fromPartial(base ?? {});
|
|
567
|
+
return exports.ChallengeRequest.fromPartial(base ?? {});
|
|
562
568
|
},
|
|
563
569
|
fromPartial(object) {
|
|
564
570
|
const message = createBaseChallengeRequest();
|
|
@@ -580,8 +586,8 @@ function createBaseReputationConfig() {
|
|
|
580
586
|
challengeThreshold: 0,
|
|
581
587
|
};
|
|
582
588
|
}
|
|
583
|
-
|
|
584
|
-
encode(message, writer = new BinaryWriter()) {
|
|
589
|
+
exports.ReputationConfig = {
|
|
590
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
585
591
|
if (message.baseReputation !== 0) {
|
|
586
592
|
writer.uint32(8).int32(message.baseReputation);
|
|
587
593
|
}
|
|
@@ -606,7 +612,7 @@ export const ReputationConfig = {
|
|
|
606
612
|
return writer;
|
|
607
613
|
},
|
|
608
614
|
decode(input, length) {
|
|
609
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
615
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
610
616
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
611
617
|
const message = createBaseReputationConfig();
|
|
612
618
|
while (reader.pos < end) {
|
|
@@ -734,7 +740,7 @@ export const ReputationConfig = {
|
|
|
734
740
|
return obj;
|
|
735
741
|
},
|
|
736
742
|
create(base) {
|
|
737
|
-
return ReputationConfig.fromPartial(base ?? {});
|
|
743
|
+
return exports.ReputationConfig.fromPartial(base ?? {});
|
|
738
744
|
},
|
|
739
745
|
fromPartial(object) {
|
|
740
746
|
const message = createBaseReputationConfig();
|
|
@@ -766,7 +772,7 @@ function fromJsonTimestamp(o) {
|
|
|
766
772
|
return new globalThis.Date(o);
|
|
767
773
|
}
|
|
768
774
|
else {
|
|
769
|
-
return fromTimestamp(Timestamp.fromJSON(o));
|
|
775
|
+
return fromTimestamp(timestamp_js_1.Timestamp.fromJSON(o));
|
|
770
776
|
}
|
|
771
777
|
}
|
|
772
778
|
function isSet(value) {
|