@ciganov/contracts 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gen/balance.d.ts +1 -0
- package/dist/gen/odd.d.ts +139 -0
- package/dist/gen/odd.js +49 -0
- package/dist/proto/contracts/balance.proto +5 -4
- package/dist/proto/contracts/odd.proto +153 -0
- package/dist/proto/paths.d.ts +1 -0
- package/dist/proto/paths.js +2 -1
- package/package.json +1 -1
package/dist/gen/balance.d.ts
CHANGED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
import { Empty } from "./google/protobuf/empty";
|
|
3
|
+
import { Timestamp } from "./google/protobuf/timestamp";
|
|
4
|
+
export declare const protobufPackage = "odd.v1";
|
|
5
|
+
export declare enum EventStatus {
|
|
6
|
+
UPCOMING = 0,
|
|
7
|
+
LIVE = 1,
|
|
8
|
+
FINISHED = 2,
|
|
9
|
+
RESOLVED = 3,
|
|
10
|
+
CANCELLED = 4,
|
|
11
|
+
UNRECOGNIZED = -1
|
|
12
|
+
}
|
|
13
|
+
export interface CreateCategoryRequest {
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
}
|
|
17
|
+
export interface CreateCategoryResponse {
|
|
18
|
+
ok: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface GetCategoryRequest {
|
|
21
|
+
id: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GetCategoryResponse {
|
|
24
|
+
category: Category | undefined;
|
|
25
|
+
}
|
|
26
|
+
export interface GetCategoriesResponse {
|
|
27
|
+
categories: Category[];
|
|
28
|
+
}
|
|
29
|
+
export interface CreateEventRequest {
|
|
30
|
+
name: string;
|
|
31
|
+
status: EventStatus;
|
|
32
|
+
categoryId: string;
|
|
33
|
+
start: Timestamp | undefined;
|
|
34
|
+
end: Timestamp | undefined;
|
|
35
|
+
}
|
|
36
|
+
export interface CreateEventResponse {
|
|
37
|
+
ok: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface GetEventRequest {
|
|
40
|
+
id: string;
|
|
41
|
+
}
|
|
42
|
+
export interface GetEventResponse {
|
|
43
|
+
event: Event | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface GetEventsByCategoryRequest {
|
|
46
|
+
categoryId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface GetEventsByCategoryResponse {
|
|
49
|
+
events: Event[];
|
|
50
|
+
}
|
|
51
|
+
export interface SwitchEventLiveStateRequest {
|
|
52
|
+
id: string;
|
|
53
|
+
}
|
|
54
|
+
export interface SwitchEventLiveStateResponse {
|
|
55
|
+
ok: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface GetOutcomeByEventRequest {
|
|
58
|
+
eventId: string;
|
|
59
|
+
}
|
|
60
|
+
export interface GetOutcomeByEventResponse {
|
|
61
|
+
outcomes: Outcome[];
|
|
62
|
+
}
|
|
63
|
+
export interface ChangeCoefficientRequest {
|
|
64
|
+
outcomeId: string;
|
|
65
|
+
coefficient: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ChangeCoefficientResponse {
|
|
68
|
+
ok: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface CreateOutcomeRequest {
|
|
71
|
+
eventId: string;
|
|
72
|
+
name: string;
|
|
73
|
+
coefficient: number;
|
|
74
|
+
}
|
|
75
|
+
export interface CreateOutcomeResponse {
|
|
76
|
+
ok: boolean;
|
|
77
|
+
}
|
|
78
|
+
export interface ValidateOutcomeRequest {
|
|
79
|
+
outcomeId: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ValidateOutcomeResponse {
|
|
82
|
+
isValid: boolean;
|
|
83
|
+
coefficient: string;
|
|
84
|
+
eventId: string;
|
|
85
|
+
eventName: string;
|
|
86
|
+
outcomeName: string;
|
|
87
|
+
}
|
|
88
|
+
export interface Category {
|
|
89
|
+
id: string;
|
|
90
|
+
name: string;
|
|
91
|
+
slug: string;
|
|
92
|
+
isActive: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface Outcome {
|
|
95
|
+
id: string;
|
|
96
|
+
eventId: string;
|
|
97
|
+
name: string;
|
|
98
|
+
coefficient: number;
|
|
99
|
+
isActive: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface Event {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
status: EventStatus;
|
|
105
|
+
categoryId: string;
|
|
106
|
+
start: Timestamp | undefined;
|
|
107
|
+
end: Timestamp | undefined;
|
|
108
|
+
isLive: boolean;
|
|
109
|
+
outcomes: Outcome[];
|
|
110
|
+
}
|
|
111
|
+
export declare const ODD_V1_PACKAGE_NAME = "odd.v1";
|
|
112
|
+
export interface OddServiceClient {
|
|
113
|
+
createCategory(request: CreateCategoryRequest): Observable<CreateCategoryResponse>;
|
|
114
|
+
getCategory(request: GetCategoryRequest): Observable<GetCategoryResponse>;
|
|
115
|
+
getCategories(request: Empty): Observable<GetCategoriesResponse>;
|
|
116
|
+
createEvent(request: CreateEventRequest): Observable<CreateEventResponse>;
|
|
117
|
+
getEvent(request: GetEventRequest): Observable<GetEventResponse>;
|
|
118
|
+
getEventsByCategory(request: GetEventsByCategoryRequest): Observable<GetEventsByCategoryResponse>;
|
|
119
|
+
switchEventLiveState(request: SwitchEventLiveStateRequest): Observable<SwitchEventLiveStateResponse>;
|
|
120
|
+
createOutcome(request: CreateOutcomeRequest): Observable<CreateOutcomeResponse>;
|
|
121
|
+
getOutcomeByEvent(request: GetOutcomeByEventRequest): Observable<GetOutcomeByEventResponse>;
|
|
122
|
+
changeCoefficient(request: ChangeCoefficientRequest): Observable<ChangeCoefficientResponse>;
|
|
123
|
+
validateOutcome(request: ValidateOutcomeRequest): Observable<ValidateOutcomeResponse>;
|
|
124
|
+
}
|
|
125
|
+
export interface OddServiceController {
|
|
126
|
+
createCategory(request: CreateCategoryRequest): Promise<CreateCategoryResponse> | Observable<CreateCategoryResponse> | CreateCategoryResponse;
|
|
127
|
+
getCategory(request: GetCategoryRequest): Promise<GetCategoryResponse> | Observable<GetCategoryResponse> | GetCategoryResponse;
|
|
128
|
+
getCategories(request: Empty): Promise<GetCategoriesResponse> | Observable<GetCategoriesResponse> | GetCategoriesResponse;
|
|
129
|
+
createEvent(request: CreateEventRequest): Promise<CreateEventResponse> | Observable<CreateEventResponse> | CreateEventResponse;
|
|
130
|
+
getEvent(request: GetEventRequest): Promise<GetEventResponse> | Observable<GetEventResponse> | GetEventResponse;
|
|
131
|
+
getEventsByCategory(request: GetEventsByCategoryRequest): Promise<GetEventsByCategoryResponse> | Observable<GetEventsByCategoryResponse> | GetEventsByCategoryResponse;
|
|
132
|
+
switchEventLiveState(request: SwitchEventLiveStateRequest): Promise<SwitchEventLiveStateResponse> | Observable<SwitchEventLiveStateResponse> | SwitchEventLiveStateResponse;
|
|
133
|
+
createOutcome(request: CreateOutcomeRequest): Promise<CreateOutcomeResponse> | Observable<CreateOutcomeResponse> | CreateOutcomeResponse;
|
|
134
|
+
getOutcomeByEvent(request: GetOutcomeByEventRequest): Promise<GetOutcomeByEventResponse> | Observable<GetOutcomeByEventResponse> | GetOutcomeByEventResponse;
|
|
135
|
+
changeCoefficient(request: ChangeCoefficientRequest): Promise<ChangeCoefficientResponse> | Observable<ChangeCoefficientResponse> | ChangeCoefficientResponse;
|
|
136
|
+
validateOutcome(request: ValidateOutcomeRequest): Promise<ValidateOutcomeResponse> | Observable<ValidateOutcomeResponse> | ValidateOutcomeResponse;
|
|
137
|
+
}
|
|
138
|
+
export declare function OddServiceControllerMethods(): (constructor: Function) => void;
|
|
139
|
+
export declare const ODD_SERVICE_NAME = "OddService";
|
package/dist/gen/odd.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.6
|
|
5
|
+
// protoc v3.21.12
|
|
6
|
+
// source: odd.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.ODD_SERVICE_NAME = exports.ODD_V1_PACKAGE_NAME = exports.EventStatus = exports.protobufPackage = void 0;
|
|
9
|
+
exports.OddServiceControllerMethods = OddServiceControllerMethods;
|
|
10
|
+
/* eslint-disable */
|
|
11
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
12
|
+
exports.protobufPackage = "odd.v1";
|
|
13
|
+
var EventStatus;
|
|
14
|
+
(function (EventStatus) {
|
|
15
|
+
EventStatus[EventStatus["UPCOMING"] = 0] = "UPCOMING";
|
|
16
|
+
EventStatus[EventStatus["LIVE"] = 1] = "LIVE";
|
|
17
|
+
EventStatus[EventStatus["FINISHED"] = 2] = "FINISHED";
|
|
18
|
+
EventStatus[EventStatus["RESOLVED"] = 3] = "RESOLVED";
|
|
19
|
+
EventStatus[EventStatus["CANCELLED"] = 4] = "CANCELLED";
|
|
20
|
+
EventStatus[EventStatus["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
21
|
+
})(EventStatus || (exports.EventStatus = EventStatus = {}));
|
|
22
|
+
exports.ODD_V1_PACKAGE_NAME = "odd.v1";
|
|
23
|
+
function OddServiceControllerMethods() {
|
|
24
|
+
return function (constructor) {
|
|
25
|
+
const grpcMethods = [
|
|
26
|
+
"createCategory",
|
|
27
|
+
"getCategory",
|
|
28
|
+
"getCategories",
|
|
29
|
+
"createEvent",
|
|
30
|
+
"getEvent",
|
|
31
|
+
"getEventsByCategory",
|
|
32
|
+
"switchEventLiveState",
|
|
33
|
+
"createOutcome",
|
|
34
|
+
"getOutcomeByEvent",
|
|
35
|
+
"changeCoefficient",
|
|
36
|
+
"validateOutcome",
|
|
37
|
+
];
|
|
38
|
+
for (const method of grpcMethods) {
|
|
39
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
40
|
+
(0, microservices_1.GrpcMethod)("OddService", method)(constructor.prototype[method], method, descriptor);
|
|
41
|
+
}
|
|
42
|
+
const grpcStreamMethods = [];
|
|
43
|
+
for (const method of grpcStreamMethods) {
|
|
44
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
45
|
+
(0, microservices_1.GrpcStreamMethod)("OddService", method)(constructor.prototype[method], method, descriptor);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exports.ODD_SERVICE_NAME = "OddService";
|
|
@@ -27,10 +27,11 @@ message GetUserTransactionsResponse {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
message AddTransactionRequest {
|
|
30
|
-
TransactionType type
|
|
31
|
-
float amount
|
|
32
|
-
optional string eventId
|
|
33
|
-
string userId
|
|
30
|
+
TransactionType type = 1;
|
|
31
|
+
float amount = 2;
|
|
32
|
+
optional string eventId = 3;
|
|
33
|
+
string userId = 4;
|
|
34
|
+
optional float multiplier = 5;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
message AddTransactionResponse {
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package odd.v1;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/timestamp.proto";
|
|
6
|
+
import "google/protobuf/empty.proto";
|
|
7
|
+
|
|
8
|
+
service OddService {
|
|
9
|
+
rpc CreateCategory(CreateCategoryRequest) returns (CreateCategoryResponse);
|
|
10
|
+
rpc GetCategory(GetCategoryRequest) returns (GetCategoryResponse);
|
|
11
|
+
rpc GetCategories(google.protobuf.Empty) returns (GetCategoriesResponse);
|
|
12
|
+
rpc CreateEvent(CreateEventRequest) returns (CreateEventResponse);
|
|
13
|
+
rpc GetEvent(GetEventRequest) returns (GetEventResponse);
|
|
14
|
+
rpc GetEventsByCategory(GetEventsByCategoryRequest) returns (GetEventsByCategoryResponse);
|
|
15
|
+
rpc SwitchEventLiveState(SwitchEventLiveStateRequest) returns (SwitchEventLiveStateResponse);
|
|
16
|
+
rpc CreateOutcome(CreateOutcomeRequest) returns (CreateOutcomeResponse);
|
|
17
|
+
rpc GetOutcomeByEvent(GetOutcomeByEventRequest) returns (GetOutcomeByEventResponse);
|
|
18
|
+
rpc ChangeCoefficient(ChangeCoefficientRequest) returns (ChangeCoefficientResponse);
|
|
19
|
+
rpc ValidateOutcome(ValidateOutcomeRequest) returns (ValidateOutcomeResponse);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
message CreateCategoryRequest {
|
|
23
|
+
string name = 1;
|
|
24
|
+
string slug = 2;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
message CreateCategoryResponse {
|
|
28
|
+
bool ok = 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
message GetCategoryRequest {
|
|
32
|
+
string id = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message GetCategoryResponse {
|
|
36
|
+
Category category = 1;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message GetCategoriesResponse {
|
|
40
|
+
repeated Category categories = 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
message CreateEventRequest {
|
|
44
|
+
string name = 1;
|
|
45
|
+
EventStatus status = 2;
|
|
46
|
+
string category_id = 3;
|
|
47
|
+
google.protobuf.Timestamp start = 4;
|
|
48
|
+
google.protobuf.Timestamp end = 5;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
message CreateEventResponse {
|
|
52
|
+
bool ok = 1;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message GetEventRequest {
|
|
56
|
+
string id = 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message GetEventResponse {
|
|
60
|
+
Event event = 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message GetEventsByCategoryRequest {
|
|
64
|
+
string category_id = 1;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
message GetEventsByCategoryResponse {
|
|
68
|
+
repeated Event events = 1;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message SwitchEventLiveStateRequest {
|
|
72
|
+
string id = 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message SwitchEventLiveStateResponse {
|
|
76
|
+
bool ok = 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message GetOutcomeByEventRequest {
|
|
80
|
+
string event_id = 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
message GetOutcomeByEventResponse {
|
|
84
|
+
repeated Outcome outcomes = 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
message ChangeCoefficientRequest {
|
|
88
|
+
string outcome_id = 1;
|
|
89
|
+
float coefficient = 2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message ChangeCoefficientResponse {
|
|
93
|
+
bool ok = 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message CreateOutcomeRequest {
|
|
97
|
+
string event_id = 1;
|
|
98
|
+
string name = 2;
|
|
99
|
+
float coefficient = 3;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
message CreateOutcomeResponse {
|
|
103
|
+
bool ok = 1;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
message ValidateOutcomeRequest {
|
|
107
|
+
string outcome_id = 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
message ValidateOutcomeResponse {
|
|
111
|
+
bool is_valid = 1;
|
|
112
|
+
string coefficient = 2;
|
|
113
|
+
string event_id = 3;
|
|
114
|
+
string event_name = 4;
|
|
115
|
+
string outcome_name = 5;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
message Category {
|
|
122
|
+
string id = 1;
|
|
123
|
+
string name = 2;
|
|
124
|
+
string slug = 3;
|
|
125
|
+
bool is_active = 4;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
message Outcome {
|
|
129
|
+
string id = 1;
|
|
130
|
+
string event_id = 2;
|
|
131
|
+
string name = 3;
|
|
132
|
+
float coefficient = 4;
|
|
133
|
+
bool is_active = 5;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
message Event {
|
|
137
|
+
string id = 1;
|
|
138
|
+
string name = 2;
|
|
139
|
+
EventStatus status = 3;
|
|
140
|
+
string category_id = 4;
|
|
141
|
+
google.protobuf.Timestamp start = 5;
|
|
142
|
+
google.protobuf.Timestamp end = 6;
|
|
143
|
+
bool is_live = 7;
|
|
144
|
+
repeated Outcome outcomes = 8;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
enum EventStatus {
|
|
148
|
+
UPCOMING = 0;
|
|
149
|
+
LIVE = 1;
|
|
150
|
+
FINISHED = 2;
|
|
151
|
+
RESOLVED = 3;
|
|
152
|
+
CANCELLED = 4;
|
|
153
|
+
}
|
package/dist/proto/paths.d.ts
CHANGED
package/dist/proto/paths.js
CHANGED
|
@@ -6,5 +6,6 @@ exports.PROTO_PATHS = {
|
|
|
6
6
|
AUTH: (0, node_path_1.join)(__dirname, './contracts/auth.proto'),
|
|
7
7
|
ACCOUNT: (0, node_path_1.join)(__dirname, './contracts/account.proto'),
|
|
8
8
|
USER: (0, node_path_1.join)(__dirname, './contracts/user.proto'),
|
|
9
|
-
BALANCE: (0, node_path_1.join)(__dirname, './contracts/balance.proto')
|
|
9
|
+
BALANCE: (0, node_path_1.join)(__dirname, './contracts/balance.proto'),
|
|
10
|
+
ODD: (0, node_path_1.join)(__dirname, './contracts/odd.proto')
|
|
10
11
|
};
|