@ottochain/sdk 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/apps/contracts/index.js +10 -28
- package/dist/esm/apps/corporate/index.js +24 -79
- package/dist/esm/apps/governance/index.js +36 -85
- package/dist/esm/apps/identity/constants.js +22 -27
- package/dist/esm/apps/identity/index.js +7 -35
- package/dist/esm/apps/index.js +6 -32
- package/dist/esm/apps/markets/index.js +6 -27
- package/dist/esm/apps/oracles/index.js +7 -27
- package/dist/esm/errors.js +9 -19
- package/dist/esm/generated/google/protobuf/struct.js +33 -39
- package/dist/esm/generated/google/protobuf/timestamp.js +6 -9
- package/dist/esm/generated/index.js +10 -134
- package/dist/esm/generated/ottochain/apps/contracts/v1/contract.js +48 -54
- package/dist/esm/generated/ottochain/apps/corporate/v1/corporate.js +335 -357
- package/dist/esm/generated/ottochain/apps/governance/v1/governance.js +284 -299
- package/dist/esm/generated/ottochain/apps/identity/v1/agent.js +38 -47
- package/dist/esm/generated/ottochain/apps/identity/v1/attestation.js +44 -50
- package/dist/esm/generated/ottochain/apps/markets/v1/market.js +77 -86
- package/dist/esm/generated/ottochain/apps/oracles/v1/oracle.js +66 -72
- package/dist/esm/generated/ottochain/v1/common.js +1 -4
- package/dist/esm/generated/ottochain/v1/fiber.js +90 -96
- package/dist/esm/generated/ottochain/v1/messages.js +79 -82
- package/dist/esm/generated/ottochain/v1/records.js +137 -140
- package/dist/esm/index.js +13 -70
- package/dist/esm/ottochain/drop-nulls.js +1 -5
- package/dist/esm/ottochain/index.js +6 -54
- package/dist/esm/ottochain/metagraph-client.js +12 -16
- package/dist/esm/ottochain/normalize.js +4 -11
- package/dist/esm/ottochain/snapshot.js +10 -20
- package/dist/esm/ottochain/transaction.js +13 -25
- package/dist/esm/ottochain/types.js +1 -2
- package/dist/esm/types.js +2 -7
- package/dist/esm/validation.js +65 -76
- package/dist/esm/verify.js +3 -7
- package/package.json +1 -1
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
2
|
// versions:
|
|
4
3
|
// protoc-gen-ts_proto v2.11.2
|
|
5
4
|
// protoc unknown
|
|
6
5
|
// source: ottochain/apps/markets/v1/market.proto
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.MarketDefinition = exports.CancelMarketRequest = exports.SubmitResolutionRequest = exports.CommitToMarketRequest = exports.CreateMarketRequest = exports.Market = exports.Resolution = exports.Commitment = exports.marketStateToNumber = exports.marketStateToJSON = exports.marketStateFromJSON = exports.MarketState = exports.marketTypeToNumber = exports.marketTypeToJSON = exports.marketTypeFromJSON = exports.MarketType = exports.protobufPackage = void 0;
|
|
9
6
|
/* eslint-disable */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
8
|
+
import { Struct } from "../../../../google/protobuf/struct.js";
|
|
9
|
+
import { Timestamp } from "../../../../google/protobuf/timestamp.js";
|
|
10
|
+
export const protobufPackage = "ottochain.apps.markets.v1";
|
|
14
11
|
/** Type of market mechanism */
|
|
15
|
-
var MarketType;
|
|
12
|
+
export var MarketType;
|
|
16
13
|
(function (MarketType) {
|
|
17
14
|
MarketType["MARKET_TYPE_UNSPECIFIED"] = "MARKET_TYPE_UNSPECIFIED";
|
|
18
15
|
/** MARKET_TYPE_PREDICTION - Prediction market for future outcomes */
|
|
@@ -24,8 +21,8 @@ var MarketType;
|
|
|
24
21
|
/** MARKET_TYPE_GROUP_BUY - Group purchasing coordination */
|
|
25
22
|
MarketType["MARKET_TYPE_GROUP_BUY"] = "MARKET_TYPE_GROUP_BUY";
|
|
26
23
|
MarketType["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
27
|
-
})(MarketType || (
|
|
28
|
-
function marketTypeFromJSON(object) {
|
|
24
|
+
})(MarketType || (MarketType = {}));
|
|
25
|
+
export function marketTypeFromJSON(object) {
|
|
29
26
|
switch (object) {
|
|
30
27
|
case 0:
|
|
31
28
|
case "MARKET_TYPE_UNSPECIFIED":
|
|
@@ -48,8 +45,7 @@ function marketTypeFromJSON(object) {
|
|
|
48
45
|
return MarketType.UNRECOGNIZED;
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
|
-
|
|
52
|
-
function marketTypeToJSON(object) {
|
|
48
|
+
export function marketTypeToJSON(object) {
|
|
53
49
|
switch (object) {
|
|
54
50
|
case MarketType.MARKET_TYPE_UNSPECIFIED:
|
|
55
51
|
return "MARKET_TYPE_UNSPECIFIED";
|
|
@@ -66,8 +62,7 @@ function marketTypeToJSON(object) {
|
|
|
66
62
|
return "UNRECOGNIZED";
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
|
-
|
|
70
|
-
function marketTypeToNumber(object) {
|
|
65
|
+
export function marketTypeToNumber(object) {
|
|
71
66
|
switch (object) {
|
|
72
67
|
case MarketType.MARKET_TYPE_UNSPECIFIED:
|
|
73
68
|
return 0;
|
|
@@ -84,9 +79,8 @@ function marketTypeToNumber(object) {
|
|
|
84
79
|
return -1;
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
|
-
exports.marketTypeToNumber = marketTypeToNumber;
|
|
88
82
|
/** Market lifecycle states */
|
|
89
|
-
var MarketState;
|
|
83
|
+
export var MarketState;
|
|
90
84
|
(function (MarketState) {
|
|
91
85
|
MarketState["MARKET_STATE_UNSPECIFIED"] = "MARKET_STATE_UNSPECIFIED";
|
|
92
86
|
/** MARKET_STATE_PROPOSED - Market created, awaiting activation */
|
|
@@ -104,8 +98,8 @@ var MarketState;
|
|
|
104
98
|
/** MARKET_STATE_CANCELLED - Market cancelled by creator (terminal) */
|
|
105
99
|
MarketState["MARKET_STATE_CANCELLED"] = "MARKET_STATE_CANCELLED";
|
|
106
100
|
MarketState["UNRECOGNIZED"] = "UNRECOGNIZED";
|
|
107
|
-
})(MarketState || (
|
|
108
|
-
function marketStateFromJSON(object) {
|
|
101
|
+
})(MarketState || (MarketState = {}));
|
|
102
|
+
export function marketStateFromJSON(object) {
|
|
109
103
|
switch (object) {
|
|
110
104
|
case 0:
|
|
111
105
|
case "MARKET_STATE_UNSPECIFIED":
|
|
@@ -137,8 +131,7 @@ function marketStateFromJSON(object) {
|
|
|
137
131
|
return MarketState.UNRECOGNIZED;
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
|
-
|
|
141
|
-
function marketStateToJSON(object) {
|
|
134
|
+
export function marketStateToJSON(object) {
|
|
142
135
|
switch (object) {
|
|
143
136
|
case MarketState.MARKET_STATE_UNSPECIFIED:
|
|
144
137
|
return "MARKET_STATE_UNSPECIFIED";
|
|
@@ -161,8 +154,7 @@ function marketStateToJSON(object) {
|
|
|
161
154
|
return "UNRECOGNIZED";
|
|
162
155
|
}
|
|
163
156
|
}
|
|
164
|
-
|
|
165
|
-
function marketStateToNumber(object) {
|
|
157
|
+
export function marketStateToNumber(object) {
|
|
166
158
|
switch (object) {
|
|
167
159
|
case MarketState.MARKET_STATE_UNSPECIFIED:
|
|
168
160
|
return 0;
|
|
@@ -185,12 +177,11 @@ function marketStateToNumber(object) {
|
|
|
185
177
|
return -1;
|
|
186
178
|
}
|
|
187
179
|
}
|
|
188
|
-
exports.marketStateToNumber = marketStateToNumber;
|
|
189
180
|
function createBaseCommitment() {
|
|
190
181
|
return { agent: "", amount: 0, data: undefined, timestamp: undefined };
|
|
191
182
|
}
|
|
192
|
-
|
|
193
|
-
encode(message, writer = new
|
|
183
|
+
export const Commitment = {
|
|
184
|
+
encode(message, writer = new BinaryWriter()) {
|
|
194
185
|
if (message.agent !== "") {
|
|
195
186
|
writer.uint32(10).string(message.agent);
|
|
196
187
|
}
|
|
@@ -198,15 +189,15 @@ exports.Commitment = {
|
|
|
198
189
|
writer.uint32(16).int64(message.amount);
|
|
199
190
|
}
|
|
200
191
|
if (message.data !== undefined) {
|
|
201
|
-
|
|
192
|
+
Struct.encode(Struct.wrap(message.data), writer.uint32(26).fork()).join();
|
|
202
193
|
}
|
|
203
194
|
if (message.timestamp !== undefined) {
|
|
204
|
-
|
|
195
|
+
Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(34).fork()).join();
|
|
205
196
|
}
|
|
206
197
|
return writer;
|
|
207
198
|
},
|
|
208
199
|
decode(input, length) {
|
|
209
|
-
const reader = input instanceof
|
|
200
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
210
201
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
211
202
|
const message = createBaseCommitment();
|
|
212
203
|
while (reader.pos < end) {
|
|
@@ -230,14 +221,14 @@ exports.Commitment = {
|
|
|
230
221
|
if (tag !== 26) {
|
|
231
222
|
break;
|
|
232
223
|
}
|
|
233
|
-
message.data =
|
|
224
|
+
message.data = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
234
225
|
continue;
|
|
235
226
|
}
|
|
236
227
|
case 4: {
|
|
237
228
|
if (tag !== 34) {
|
|
238
229
|
break;
|
|
239
230
|
}
|
|
240
|
-
message.timestamp = fromTimestamp(
|
|
231
|
+
message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
241
232
|
continue;
|
|
242
233
|
}
|
|
243
234
|
}
|
|
@@ -273,7 +264,7 @@ exports.Commitment = {
|
|
|
273
264
|
return obj;
|
|
274
265
|
},
|
|
275
266
|
create(base) {
|
|
276
|
-
return
|
|
267
|
+
return Commitment.fromPartial(base ?? {});
|
|
277
268
|
},
|
|
278
269
|
fromPartial(object) {
|
|
279
270
|
const message = createBaseCommitment();
|
|
@@ -287,8 +278,8 @@ exports.Commitment = {
|
|
|
287
278
|
function createBaseResolution() {
|
|
288
279
|
return { oracle: "", outcome: "", proof: "", timestamp: undefined };
|
|
289
280
|
}
|
|
290
|
-
|
|
291
|
-
encode(message, writer = new
|
|
281
|
+
export const Resolution = {
|
|
282
|
+
encode(message, writer = new BinaryWriter()) {
|
|
292
283
|
if (message.oracle !== "") {
|
|
293
284
|
writer.uint32(10).string(message.oracle);
|
|
294
285
|
}
|
|
@@ -299,12 +290,12 @@ exports.Resolution = {
|
|
|
299
290
|
writer.uint32(26).string(message.proof);
|
|
300
291
|
}
|
|
301
292
|
if (message.timestamp !== undefined) {
|
|
302
|
-
|
|
293
|
+
Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(34).fork()).join();
|
|
303
294
|
}
|
|
304
295
|
return writer;
|
|
305
296
|
},
|
|
306
297
|
decode(input, length) {
|
|
307
|
-
const reader = input instanceof
|
|
298
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
308
299
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
309
300
|
const message = createBaseResolution();
|
|
310
301
|
while (reader.pos < end) {
|
|
@@ -335,7 +326,7 @@ exports.Resolution = {
|
|
|
335
326
|
if (tag !== 34) {
|
|
336
327
|
break;
|
|
337
328
|
}
|
|
338
|
-
message.timestamp = fromTimestamp(
|
|
329
|
+
message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
339
330
|
continue;
|
|
340
331
|
}
|
|
341
332
|
}
|
|
@@ -371,7 +362,7 @@ exports.Resolution = {
|
|
|
371
362
|
return obj;
|
|
372
363
|
},
|
|
373
364
|
create(base) {
|
|
374
|
-
return
|
|
365
|
+
return Resolution.fromPartial(base ?? {});
|
|
375
366
|
},
|
|
376
367
|
fromPartial(object) {
|
|
377
368
|
const message = createBaseResolution();
|
|
@@ -400,8 +391,8 @@ function createBaseMarket() {
|
|
|
400
391
|
updatedAt: undefined,
|
|
401
392
|
};
|
|
402
393
|
}
|
|
403
|
-
|
|
404
|
-
encode(message, writer = new
|
|
394
|
+
export const Market = {
|
|
395
|
+
encode(message, writer = new BinaryWriter()) {
|
|
405
396
|
if (message.id !== "") {
|
|
406
397
|
writer.uint32(10).string(message.id);
|
|
407
398
|
}
|
|
@@ -415,16 +406,16 @@ exports.Market = {
|
|
|
415
406
|
writer.uint32(34).string(message.title);
|
|
416
407
|
}
|
|
417
408
|
if (message.terms !== undefined) {
|
|
418
|
-
|
|
409
|
+
Struct.encode(Struct.wrap(message.terms), writer.uint32(42).fork()).join();
|
|
419
410
|
}
|
|
420
411
|
if (message.deadline !== undefined) {
|
|
421
|
-
|
|
412
|
+
Timestamp.encode(toTimestamp(message.deadline), writer.uint32(50).fork()).join();
|
|
422
413
|
}
|
|
423
414
|
if (message.threshold !== 0) {
|
|
424
415
|
writer.uint32(56).int64(message.threshold);
|
|
425
416
|
}
|
|
426
417
|
for (const v of message.commitments) {
|
|
427
|
-
|
|
418
|
+
Commitment.encode(v, writer.uint32(66).fork()).join();
|
|
428
419
|
}
|
|
429
420
|
for (const v of message.oracles) {
|
|
430
421
|
writer.uint32(74).string(v);
|
|
@@ -433,21 +424,21 @@ exports.Market = {
|
|
|
433
424
|
writer.uint32(80).int32(message.quorum);
|
|
434
425
|
}
|
|
435
426
|
for (const v of message.resolutions) {
|
|
436
|
-
|
|
427
|
+
Resolution.encode(v, writer.uint32(90).fork()).join();
|
|
437
428
|
}
|
|
438
429
|
if (message.status !== MarketState.MARKET_STATE_UNSPECIFIED) {
|
|
439
430
|
writer.uint32(96).int32(marketStateToNumber(message.status));
|
|
440
431
|
}
|
|
441
432
|
if (message.createdAt !== undefined) {
|
|
442
|
-
|
|
433
|
+
Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(106).fork()).join();
|
|
443
434
|
}
|
|
444
435
|
if (message.updatedAt !== undefined) {
|
|
445
|
-
|
|
436
|
+
Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(114).fork()).join();
|
|
446
437
|
}
|
|
447
438
|
return writer;
|
|
448
439
|
},
|
|
449
440
|
decode(input, length) {
|
|
450
|
-
const reader = input instanceof
|
|
441
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
451
442
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
452
443
|
const message = createBaseMarket();
|
|
453
444
|
while (reader.pos < end) {
|
|
@@ -485,14 +476,14 @@ exports.Market = {
|
|
|
485
476
|
if (tag !== 42) {
|
|
486
477
|
break;
|
|
487
478
|
}
|
|
488
|
-
message.terms =
|
|
479
|
+
message.terms = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
489
480
|
continue;
|
|
490
481
|
}
|
|
491
482
|
case 6: {
|
|
492
483
|
if (tag !== 50) {
|
|
493
484
|
break;
|
|
494
485
|
}
|
|
495
|
-
message.deadline = fromTimestamp(
|
|
486
|
+
message.deadline = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
496
487
|
continue;
|
|
497
488
|
}
|
|
498
489
|
case 7: {
|
|
@@ -506,7 +497,7 @@ exports.Market = {
|
|
|
506
497
|
if (tag !== 66) {
|
|
507
498
|
break;
|
|
508
499
|
}
|
|
509
|
-
message.commitments.push(
|
|
500
|
+
message.commitments.push(Commitment.decode(reader, reader.uint32()));
|
|
510
501
|
continue;
|
|
511
502
|
}
|
|
512
503
|
case 9: {
|
|
@@ -527,7 +518,7 @@ exports.Market = {
|
|
|
527
518
|
if (tag !== 90) {
|
|
528
519
|
break;
|
|
529
520
|
}
|
|
530
|
-
message.resolutions.push(
|
|
521
|
+
message.resolutions.push(Resolution.decode(reader, reader.uint32()));
|
|
531
522
|
continue;
|
|
532
523
|
}
|
|
533
524
|
case 12: {
|
|
@@ -541,14 +532,14 @@ exports.Market = {
|
|
|
541
532
|
if (tag !== 106) {
|
|
542
533
|
break;
|
|
543
534
|
}
|
|
544
|
-
message.createdAt = fromTimestamp(
|
|
535
|
+
message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
545
536
|
continue;
|
|
546
537
|
}
|
|
547
538
|
case 14: {
|
|
548
539
|
if (tag !== 114) {
|
|
549
540
|
break;
|
|
550
541
|
}
|
|
551
|
-
message.updatedAt = fromTimestamp(
|
|
542
|
+
message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
552
543
|
continue;
|
|
553
544
|
}
|
|
554
545
|
}
|
|
@@ -573,12 +564,12 @@ exports.Market = {
|
|
|
573
564
|
deadline: isSet(object.deadline) ? fromJsonTimestamp(object.deadline) : undefined,
|
|
574
565
|
threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0,
|
|
575
566
|
commitments: globalThis.Array.isArray(object?.commitments)
|
|
576
|
-
? object.commitments.map((e) =>
|
|
567
|
+
? object.commitments.map((e) => Commitment.fromJSON(e))
|
|
577
568
|
: [],
|
|
578
569
|
oracles: globalThis.Array.isArray(object?.oracles) ? object.oracles.map((e) => globalThis.String(e)) : [],
|
|
579
570
|
quorum: isSet(object.quorum) ? globalThis.Number(object.quorum) : 0,
|
|
580
571
|
resolutions: globalThis.Array.isArray(object?.resolutions)
|
|
581
|
-
? object.resolutions.map((e) =>
|
|
572
|
+
? object.resolutions.map((e) => Resolution.fromJSON(e))
|
|
582
573
|
: [],
|
|
583
574
|
status: isSet(object.status) ? marketStateFromJSON(object.status) : MarketState.MARKET_STATE_UNSPECIFIED,
|
|
584
575
|
createdAt: isSet(object.createdAt)
|
|
@@ -617,7 +608,7 @@ exports.Market = {
|
|
|
617
608
|
obj.threshold = Math.round(message.threshold);
|
|
618
609
|
}
|
|
619
610
|
if (message.commitments?.length) {
|
|
620
|
-
obj.commitments = message.commitments.map((e) =>
|
|
611
|
+
obj.commitments = message.commitments.map((e) => Commitment.toJSON(e));
|
|
621
612
|
}
|
|
622
613
|
if (message.oracles?.length) {
|
|
623
614
|
obj.oracles = message.oracles;
|
|
@@ -626,7 +617,7 @@ exports.Market = {
|
|
|
626
617
|
obj.quorum = Math.round(message.quorum);
|
|
627
618
|
}
|
|
628
619
|
if (message.resolutions?.length) {
|
|
629
|
-
obj.resolutions = message.resolutions.map((e) =>
|
|
620
|
+
obj.resolutions = message.resolutions.map((e) => Resolution.toJSON(e));
|
|
630
621
|
}
|
|
631
622
|
if (message.status !== MarketState.MARKET_STATE_UNSPECIFIED) {
|
|
632
623
|
obj.status = marketStateToJSON(message.status);
|
|
@@ -640,7 +631,7 @@ exports.Market = {
|
|
|
640
631
|
return obj;
|
|
641
632
|
},
|
|
642
633
|
create(base) {
|
|
643
|
-
return
|
|
634
|
+
return Market.fromPartial(base ?? {});
|
|
644
635
|
},
|
|
645
636
|
fromPartial(object) {
|
|
646
637
|
const message = createBaseMarket();
|
|
@@ -651,10 +642,10 @@ exports.Market = {
|
|
|
651
642
|
message.terms = object.terms ?? undefined;
|
|
652
643
|
message.deadline = object.deadline ?? undefined;
|
|
653
644
|
message.threshold = object.threshold ?? 0;
|
|
654
|
-
message.commitments = object.commitments?.map((e) =>
|
|
645
|
+
message.commitments = object.commitments?.map((e) => Commitment.fromPartial(e)) || [];
|
|
655
646
|
message.oracles = object.oracles?.map((e) => e) || [];
|
|
656
647
|
message.quorum = object.quorum ?? 0;
|
|
657
|
-
message.resolutions = object.resolutions?.map((e) =>
|
|
648
|
+
message.resolutions = object.resolutions?.map((e) => Resolution.fromPartial(e)) || [];
|
|
658
649
|
message.status = object.status ?? MarketState.MARKET_STATE_UNSPECIFIED;
|
|
659
650
|
message.createdAt = object.createdAt ?? undefined;
|
|
660
651
|
message.updatedAt = object.updatedAt ?? undefined;
|
|
@@ -673,8 +664,8 @@ function createBaseCreateMarketRequest() {
|
|
|
673
664
|
quorum: 0,
|
|
674
665
|
};
|
|
675
666
|
}
|
|
676
|
-
|
|
677
|
-
encode(message, writer = new
|
|
667
|
+
export const CreateMarketRequest = {
|
|
668
|
+
encode(message, writer = new BinaryWriter()) {
|
|
678
669
|
if (message.marketType !== MarketType.MARKET_TYPE_UNSPECIFIED) {
|
|
679
670
|
writer.uint32(8).int32(marketTypeToNumber(message.marketType));
|
|
680
671
|
}
|
|
@@ -685,10 +676,10 @@ exports.CreateMarketRequest = {
|
|
|
685
676
|
writer.uint32(26).string(message.title);
|
|
686
677
|
}
|
|
687
678
|
if (message.terms !== undefined) {
|
|
688
|
-
|
|
679
|
+
Struct.encode(Struct.wrap(message.terms), writer.uint32(34).fork()).join();
|
|
689
680
|
}
|
|
690
681
|
if (message.deadline !== undefined) {
|
|
691
|
-
|
|
682
|
+
Timestamp.encode(toTimestamp(message.deadline), writer.uint32(42).fork()).join();
|
|
692
683
|
}
|
|
693
684
|
if (message.threshold !== 0) {
|
|
694
685
|
writer.uint32(48).int64(message.threshold);
|
|
@@ -702,7 +693,7 @@ exports.CreateMarketRequest = {
|
|
|
702
693
|
return writer;
|
|
703
694
|
},
|
|
704
695
|
decode(input, length) {
|
|
705
|
-
const reader = input instanceof
|
|
696
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
706
697
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
707
698
|
const message = createBaseCreateMarketRequest();
|
|
708
699
|
while (reader.pos < end) {
|
|
@@ -733,14 +724,14 @@ exports.CreateMarketRequest = {
|
|
|
733
724
|
if (tag !== 34) {
|
|
734
725
|
break;
|
|
735
726
|
}
|
|
736
|
-
message.terms =
|
|
727
|
+
message.terms = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
737
728
|
continue;
|
|
738
729
|
}
|
|
739
730
|
case 5: {
|
|
740
731
|
if (tag !== 42) {
|
|
741
732
|
break;
|
|
742
733
|
}
|
|
743
|
-
message.deadline = fromTimestamp(
|
|
734
|
+
message.deadline = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
744
735
|
continue;
|
|
745
736
|
}
|
|
746
737
|
case 6: {
|
|
@@ -817,7 +808,7 @@ exports.CreateMarketRequest = {
|
|
|
817
808
|
return obj;
|
|
818
809
|
},
|
|
819
810
|
create(base) {
|
|
820
|
-
return
|
|
811
|
+
return CreateMarketRequest.fromPartial(base ?? {});
|
|
821
812
|
},
|
|
822
813
|
fromPartial(object) {
|
|
823
814
|
const message = createBaseCreateMarketRequest();
|
|
@@ -835,8 +826,8 @@ exports.CreateMarketRequest = {
|
|
|
835
826
|
function createBaseCommitToMarketRequest() {
|
|
836
827
|
return { marketId: "", agent: "", amount: 0, positionData: undefined };
|
|
837
828
|
}
|
|
838
|
-
|
|
839
|
-
encode(message, writer = new
|
|
829
|
+
export const CommitToMarketRequest = {
|
|
830
|
+
encode(message, writer = new BinaryWriter()) {
|
|
840
831
|
if (message.marketId !== "") {
|
|
841
832
|
writer.uint32(10).string(message.marketId);
|
|
842
833
|
}
|
|
@@ -847,12 +838,12 @@ exports.CommitToMarketRequest = {
|
|
|
847
838
|
writer.uint32(24).int64(message.amount);
|
|
848
839
|
}
|
|
849
840
|
if (message.positionData !== undefined) {
|
|
850
|
-
|
|
841
|
+
Struct.encode(Struct.wrap(message.positionData), writer.uint32(34).fork()).join();
|
|
851
842
|
}
|
|
852
843
|
return writer;
|
|
853
844
|
},
|
|
854
845
|
decode(input, length) {
|
|
855
|
-
const reader = input instanceof
|
|
846
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
856
847
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
857
848
|
const message = createBaseCommitToMarketRequest();
|
|
858
849
|
while (reader.pos < end) {
|
|
@@ -883,7 +874,7 @@ exports.CommitToMarketRequest = {
|
|
|
883
874
|
if (tag !== 34) {
|
|
884
875
|
break;
|
|
885
876
|
}
|
|
886
|
-
message.positionData =
|
|
877
|
+
message.positionData = Struct.unwrap(Struct.decode(reader, reader.uint32()));
|
|
887
878
|
continue;
|
|
888
879
|
}
|
|
889
880
|
}
|
|
@@ -927,7 +918,7 @@ exports.CommitToMarketRequest = {
|
|
|
927
918
|
return obj;
|
|
928
919
|
},
|
|
929
920
|
create(base) {
|
|
930
|
-
return
|
|
921
|
+
return CommitToMarketRequest.fromPartial(base ?? {});
|
|
931
922
|
},
|
|
932
923
|
fromPartial(object) {
|
|
933
924
|
const message = createBaseCommitToMarketRequest();
|
|
@@ -941,8 +932,8 @@ exports.CommitToMarketRequest = {
|
|
|
941
932
|
function createBaseSubmitResolutionRequest() {
|
|
942
933
|
return { marketId: "", oracle: "", outcome: "", proof: "" };
|
|
943
934
|
}
|
|
944
|
-
|
|
945
|
-
encode(message, writer = new
|
|
935
|
+
export const SubmitResolutionRequest = {
|
|
936
|
+
encode(message, writer = new BinaryWriter()) {
|
|
946
937
|
if (message.marketId !== "") {
|
|
947
938
|
writer.uint32(10).string(message.marketId);
|
|
948
939
|
}
|
|
@@ -958,7 +949,7 @@ exports.SubmitResolutionRequest = {
|
|
|
958
949
|
return writer;
|
|
959
950
|
},
|
|
960
951
|
decode(input, length) {
|
|
961
|
-
const reader = input instanceof
|
|
952
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
962
953
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
963
954
|
const message = createBaseSubmitResolutionRequest();
|
|
964
955
|
while (reader.pos < end) {
|
|
@@ -1029,7 +1020,7 @@ exports.SubmitResolutionRequest = {
|
|
|
1029
1020
|
return obj;
|
|
1030
1021
|
},
|
|
1031
1022
|
create(base) {
|
|
1032
|
-
return
|
|
1023
|
+
return SubmitResolutionRequest.fromPartial(base ?? {});
|
|
1033
1024
|
},
|
|
1034
1025
|
fromPartial(object) {
|
|
1035
1026
|
const message = createBaseSubmitResolutionRequest();
|
|
@@ -1043,8 +1034,8 @@ exports.SubmitResolutionRequest = {
|
|
|
1043
1034
|
function createBaseCancelMarketRequest() {
|
|
1044
1035
|
return { marketId: "", creator: "", reason: "" };
|
|
1045
1036
|
}
|
|
1046
|
-
|
|
1047
|
-
encode(message, writer = new
|
|
1037
|
+
export const CancelMarketRequest = {
|
|
1038
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1048
1039
|
if (message.marketId !== "") {
|
|
1049
1040
|
writer.uint32(10).string(message.marketId);
|
|
1050
1041
|
}
|
|
@@ -1057,7 +1048,7 @@ exports.CancelMarketRequest = {
|
|
|
1057
1048
|
return writer;
|
|
1058
1049
|
},
|
|
1059
1050
|
decode(input, length) {
|
|
1060
|
-
const reader = input instanceof
|
|
1051
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1061
1052
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1062
1053
|
const message = createBaseCancelMarketRequest();
|
|
1063
1054
|
while (reader.pos < end) {
|
|
@@ -1117,7 +1108,7 @@ exports.CancelMarketRequest = {
|
|
|
1117
1108
|
return obj;
|
|
1118
1109
|
},
|
|
1119
1110
|
create(base) {
|
|
1120
|
-
return
|
|
1111
|
+
return CancelMarketRequest.fromPartial(base ?? {});
|
|
1121
1112
|
},
|
|
1122
1113
|
fromPartial(object) {
|
|
1123
1114
|
const message = createBaseCancelMarketRequest();
|
|
@@ -1130,8 +1121,8 @@ exports.CancelMarketRequest = {
|
|
|
1130
1121
|
function createBaseMarketDefinition() {
|
|
1131
1122
|
return { minOracles: 0, resolutionTimeoutEpochs: 0, allowPartialRefund: false };
|
|
1132
1123
|
}
|
|
1133
|
-
|
|
1134
|
-
encode(message, writer = new
|
|
1124
|
+
export const MarketDefinition = {
|
|
1125
|
+
encode(message, writer = new BinaryWriter()) {
|
|
1135
1126
|
if (message.minOracles !== 0) {
|
|
1136
1127
|
writer.uint32(8).int32(message.minOracles);
|
|
1137
1128
|
}
|
|
@@ -1144,7 +1135,7 @@ exports.MarketDefinition = {
|
|
|
1144
1135
|
return writer;
|
|
1145
1136
|
},
|
|
1146
1137
|
decode(input, length) {
|
|
1147
|
-
const reader = input instanceof
|
|
1138
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1148
1139
|
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1149
1140
|
const message = createBaseMarketDefinition();
|
|
1150
1141
|
while (reader.pos < end) {
|
|
@@ -1212,7 +1203,7 @@ exports.MarketDefinition = {
|
|
|
1212
1203
|
return obj;
|
|
1213
1204
|
},
|
|
1214
1205
|
create(base) {
|
|
1215
|
-
return
|
|
1206
|
+
return MarketDefinition.fromPartial(base ?? {});
|
|
1216
1207
|
},
|
|
1217
1208
|
fromPartial(object) {
|
|
1218
1209
|
const message = createBaseMarketDefinition();
|
|
@@ -1240,7 +1231,7 @@ function fromJsonTimestamp(o) {
|
|
|
1240
1231
|
return new globalThis.Date(o);
|
|
1241
1232
|
}
|
|
1242
1233
|
else {
|
|
1243
|
-
return fromTimestamp(
|
|
1234
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
1244
1235
|
}
|
|
1245
1236
|
}
|
|
1246
1237
|
function longToNumber(int64) {
|