@sui-tracker/shared 1.0.79 → 1.0.81
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/modules/grpc-services/aggregator-route-grpc.service.d.ts +9 -0
- package/dist/modules/grpc-services/aggregator-route-grpc.service.js +56 -0
- package/dist/modules/grpc-services/aggregator-route-grpc.service.js.map +1 -0
- package/dist/modules/grpc-services/index.d.ts +1 -0
- package/dist/modules/grpc-services/index.js +1 -0
- package/dist/modules/grpc-services/index.js.map +1 -1
- package/dist/modules/grpc-services/token-grpc.service.d.ts +2 -1
- package/dist/modules/grpc-services/token-grpc.service.js +13 -0
- package/dist/modules/grpc-services/token-grpc.service.js.map +1 -1
- package/dist/modules/interfaces/aggregator-route.interface.d.ts +76 -0
- package/dist/modules/interfaces/aggregator-route.interface.js +3 -0
- package/dist/modules/interfaces/aggregator-route.interface.js.map +1 -0
- package/dist/modules/interfaces/index.d.ts +1 -0
- package/dist/modules/interfaces/index.js +1 -0
- package/dist/modules/interfaces/index.js.map +1 -1
- package/dist/modules/interfaces/sui-data-center.interface.d.ts +1 -0
- package/dist/modules/interfaces/swap-order.interface.d.ts +9 -0
- package/dist/modules/shared.module.js +10 -0
- package/dist/modules/shared.module.js.map +1 -1
- package/dist/protos/aggregator-route.proto +104 -0
- package/dist/protos/sui-data-center.proto +1 -0
- package/dist/protos/swap-order.proto +13 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ClientGrpc } from '@nestjs/microservices';
|
|
2
|
+
import { FindRoutesRequest, FindRoutesResponse, FindMultiRouteRequest, FindMultiRouteResponse } from '../interfaces/aggregator-route.interface';
|
|
3
|
+
export declare class AggregatorRouteGrpcService {
|
|
4
|
+
private grpcClient;
|
|
5
|
+
private readonly logger;
|
|
6
|
+
constructor(grpcClient: ClientGrpc);
|
|
7
|
+
findRoutes(data: FindRoutesRequest): Promise<FindRoutesResponse>;
|
|
8
|
+
findMultiRoute(data: FindMultiRouteRequest): Promise<FindMultiRouteResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var AggregatorRouteGrpcService_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AggregatorRouteGrpcService = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
let AggregatorRouteGrpcService = AggregatorRouteGrpcService_1 = class AggregatorRouteGrpcService {
|
|
19
|
+
constructor(grpcClient) {
|
|
20
|
+
this.grpcClient = grpcClient;
|
|
21
|
+
this.logger = new common_1.Logger(AggregatorRouteGrpcService_1.name);
|
|
22
|
+
}
|
|
23
|
+
async findRoutes(data) {
|
|
24
|
+
const aggregatorRouteService = this.grpcClient.getService('AggregatorRouteService');
|
|
25
|
+
const res = await new Promise((resolve, reject) => {
|
|
26
|
+
aggregatorRouteService.findRoutes(data).subscribe({
|
|
27
|
+
next: (response) => resolve(response),
|
|
28
|
+
error: (error) => reject(error),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
if (!res.success) {
|
|
32
|
+
throw new Error(res.message);
|
|
33
|
+
}
|
|
34
|
+
return res;
|
|
35
|
+
}
|
|
36
|
+
async findMultiRoute(data) {
|
|
37
|
+
const aggregatorRouteService = this.grpcClient.getService('AggregatorRouteService');
|
|
38
|
+
const res = await new Promise((resolve, reject) => {
|
|
39
|
+
aggregatorRouteService.findMultiRoute(data).subscribe({
|
|
40
|
+
next: (response) => resolve(response),
|
|
41
|
+
error: (error) => reject(error),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
if (!res.success) {
|
|
45
|
+
throw new Error(res.message);
|
|
46
|
+
}
|
|
47
|
+
return res;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.AggregatorRouteGrpcService = AggregatorRouteGrpcService;
|
|
51
|
+
exports.AggregatorRouteGrpcService = AggregatorRouteGrpcService = AggregatorRouteGrpcService_1 = __decorate([
|
|
52
|
+
(0, common_1.Injectable)(),
|
|
53
|
+
__param(0, (0, common_1.Inject)('AGGREGATOR_ROUTE')),
|
|
54
|
+
__metadata("design:paramtypes", [Object])
|
|
55
|
+
], AggregatorRouteGrpcService);
|
|
56
|
+
//# sourceMappingURL=aggregator-route-grpc.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregator-route-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/aggregator-route-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA4D;AAWrD,IAAM,0BAA0B,kCAAhC,MAAM,0BAA0B;IAGrC,YAC8B,UAA8B;QAAtB,eAAU,GAAV,UAAU,CAAY;QAH3C,WAAM,GAAG,IAAI,eAAM,CAAC,4BAA0B,CAAC,IAAI,CAAC,CAAC;IAInE,CAAC;IAKJ,KAAK,CAAC,UAAU,CACd,IAAuB;QAEvB,MAAM,sBAAsB,GA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AU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;;GAJlB,0BAA0B,CAwDtC"}
|
|
@@ -21,4 +21,5 @@ __exportStar(require("./swap-order-grpc.service"), exports);
|
|
|
21
21
|
__exportStar(require("./price-grpc.service"), exports);
|
|
22
22
|
__exportStar(require("./data-center-grpc.service"), exports);
|
|
23
23
|
__exportStar(require("./token-grpc.service"), exports);
|
|
24
|
+
__exportStar(require("./aggregator-route-grpc.service"), exports);
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,uDAAqC;AACrC,4DAA0C;AAC1C,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAuC;AACvC,4DAA0C;AAC1C,uDAAqC;AACrC,4DAA0C;AAC1C,uDAAqC;AACrC,6DAA2C;AAC3C,uDAAqC;AACrC,kEAAgD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClientGrpc } from "@nestjs/microservices";
|
|
2
|
-
import { GetTrendingTokensRequest, GetTrendingTokensResponse, GetTopVolumeTokensRequest, GetTopVolumeTokensResponse, GetTokensRequest, GetTokensResponse } from "../interfaces/swap-order.interface";
|
|
2
|
+
import { GetTrendingTokensRequest, GetTrendingTokensResponse, GetTopVolumeTokensRequest, GetTopVolumeTokensResponse, GetTokensRequest, GetTokensResponse, SearchTokensRequest, SearchTokensResponse } from "../interfaces/swap-order.interface";
|
|
3
3
|
export declare class TokenGrpcService {
|
|
4
4
|
private grpcClient;
|
|
5
5
|
private readonly logger;
|
|
@@ -7,4 +7,5 @@ export declare class TokenGrpcService {
|
|
|
7
7
|
getTrendingTokens(data: GetTrendingTokensRequest): Promise<GetTrendingTokensResponse>;
|
|
8
8
|
getTopVolumeTokens(data: GetTopVolumeTokensRequest): Promise<GetTopVolumeTokensResponse>;
|
|
9
9
|
getTokens(data: GetTokensRequest): Promise<GetTokensResponse>;
|
|
10
|
+
searchTokens(data: SearchTokensRequest): Promise<SearchTokensResponse>;
|
|
10
11
|
}
|
|
@@ -59,6 +59,19 @@ let TokenGrpcService = TokenGrpcService_1 = class TokenGrpcService {
|
|
|
59
59
|
}
|
|
60
60
|
return res;
|
|
61
61
|
}
|
|
62
|
+
async searchTokens(data) {
|
|
63
|
+
const swapOrderService = this.grpcClient.getService("SwapOrderService");
|
|
64
|
+
const res = await new Promise((resolve, reject) => {
|
|
65
|
+
swapOrderService.searchTokens(data).subscribe({
|
|
66
|
+
next: (response) => resolve(response),
|
|
67
|
+
error: (error) => reject(error),
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
if (!res.success) {
|
|
71
|
+
throw new Error(res.message);
|
|
72
|
+
}
|
|
73
|
+
return res;
|
|
74
|
+
}
|
|
62
75
|
};
|
|
63
76
|
exports.TokenGrpcService = TokenGrpcService;
|
|
64
77
|
exports.TokenGrpcService = TokenGrpcService = TokenGrpcService_1 = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/token-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;
|
|
1
|
+
{"version":3,"file":"token-grpc.service.js","sourceRoot":"","sources":["../../../src/modules/grpc-services/token-grpc.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA0E;AAgBnE,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAG3B,YAAkC,UAA8B;QAAtB,eAAU,GAAV,UAAU,CAAY;QAF/C,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,C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/B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AA3FY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,eAAM,EAAC,YAAY,CAAC,CAAA;;GAHtB,gBAAgB,CA2F5B"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { BaseResponse } from './base-request.interface';
|
|
3
|
+
export interface RouteHop {
|
|
4
|
+
poolAddress: string;
|
|
5
|
+
dex: string;
|
|
6
|
+
ammType: string;
|
|
7
|
+
tokenIn: string;
|
|
8
|
+
tokenOut: string;
|
|
9
|
+
amountIn: string;
|
|
10
|
+
amountOut: string;
|
|
11
|
+
feeBps: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Route {
|
|
14
|
+
hops: RouteHop[];
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
tokenOut: string;
|
|
17
|
+
amountIn: string;
|
|
18
|
+
amountOut: string;
|
|
19
|
+
hopCount: number;
|
|
20
|
+
totalFeeBps: number;
|
|
21
|
+
priceImpact: number;
|
|
22
|
+
dexPath: string[];
|
|
23
|
+
}
|
|
24
|
+
export interface RouteSplit {
|
|
25
|
+
routeIndex: number;
|
|
26
|
+
amountIn: string;
|
|
27
|
+
amountOut: string;
|
|
28
|
+
percentage: number;
|
|
29
|
+
hops: RouteHop[];
|
|
30
|
+
dexPath: string[];
|
|
31
|
+
totalFeeBps: number;
|
|
32
|
+
priceImpact: number;
|
|
33
|
+
}
|
|
34
|
+
export interface FindRoutesRequest {
|
|
35
|
+
tokenIn: string;
|
|
36
|
+
tokenOut: string;
|
|
37
|
+
amountIn: string;
|
|
38
|
+
maxHop?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface FindRoutesResponse extends BaseResponse {
|
|
41
|
+
data: {
|
|
42
|
+
tokenIn: string;
|
|
43
|
+
tokenOut: string;
|
|
44
|
+
amountIn: string;
|
|
45
|
+
routes: Route[];
|
|
46
|
+
totalRoutes: number;
|
|
47
|
+
bestRoute?: Route;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export interface FindMultiRouteRequest {
|
|
51
|
+
tokenIn: string;
|
|
52
|
+
tokenOut: string;
|
|
53
|
+
amountIn: string;
|
|
54
|
+
maxHop?: number;
|
|
55
|
+
maxRoutes?: number;
|
|
56
|
+
splitSteps?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface FindMultiRouteResponse extends BaseResponse {
|
|
59
|
+
data: {
|
|
60
|
+
tokenIn: string;
|
|
61
|
+
tokenOut: string;
|
|
62
|
+
totalAmountIn: string;
|
|
63
|
+
totalAmountOut: string;
|
|
64
|
+
splits: RouteSplit[];
|
|
65
|
+
routeCount: number;
|
|
66
|
+
averagePriceImpact: number;
|
|
67
|
+
method: 'dynamic_programming' | 'greedy' | 'sequential' | 'single_route';
|
|
68
|
+
improvementPercent: number;
|
|
69
|
+
availableRoutes: number;
|
|
70
|
+
executionTimeMs: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface AggregatorRouteService {
|
|
74
|
+
findRoutes(request: FindRoutesRequest): Observable<FindRoutesResponse>;
|
|
75
|
+
findMultiRoute(request: FindMultiRouteRequest): Observable<FindMultiRouteResponse>;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregator-route.interface.js","sourceRoot":"","sources":["../../../src/modules/interfaces/aggregator-route.interface.ts"],"names":[],"mappings":""}
|
|
@@ -20,4 +20,5 @@ __exportStar(require("./proxy.interface"), exports);
|
|
|
20
20
|
__exportStar(require("./swap-order.interface"), exports);
|
|
21
21
|
__exportStar(require("./price.interface"), exports);
|
|
22
22
|
__exportStar(require("./sui-data-center.interface"), exports);
|
|
23
|
+
__exportStar(require("./aggregator-route.interface"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,yDAAsC;AACtC,oDAAiC;AACjC,yDAAsC;AACtC,oDAAiC;AACjC,8DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/interfaces/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,yDAAsC;AACtC,oDAAiC;AACjC,yDAAsC;AACtC,oDAAiC;AACjC,8DAA2C;AAC3C,+DAA4C"}
|
|
@@ -238,6 +238,14 @@ export interface SearchPoolRequest {
|
|
|
238
238
|
export interface SearchPoolResponse extends BaseResponse {
|
|
239
239
|
data: ListPool;
|
|
240
240
|
}
|
|
241
|
+
export interface SearchTokensRequest {
|
|
242
|
+
query: string;
|
|
243
|
+
limit?: number;
|
|
244
|
+
}
|
|
245
|
+
export interface SearchTokensResponse extends BaseResponse {
|
|
246
|
+
data: TokenData[];
|
|
247
|
+
count: number;
|
|
248
|
+
}
|
|
241
249
|
export interface SwapOrderService {
|
|
242
250
|
GetListPools(request: GetListPoolsRequest): Observable<GetListPoolsResponse>;
|
|
243
251
|
getPool(request: GetPoolRequest): Observable<GetPoolResponse>;
|
|
@@ -250,4 +258,5 @@ export interface SwapOrderService {
|
|
|
250
258
|
getTopTradersByPool(request: GetTopTradersByPoolRequest): Observable<GetTopTradersByPoolResponse>;
|
|
251
259
|
calculateUsdValue(request: CalculateUsdValueRequest): Observable<CalculateUsdValueResponse>;
|
|
252
260
|
searchPool(request: SearchPoolRequest): Observable<SearchPoolResponse>;
|
|
261
|
+
searchTokens(request: SearchTokensRequest): Observable<SearchTokensResponse>;
|
|
253
262
|
}
|
|
@@ -35,6 +35,7 @@ const providers = [
|
|
|
35
35
|
core_1.Reflector,
|
|
36
36
|
grpc_metadata_service_1.GrpcMetadataService,
|
|
37
37
|
grpc_services_1.TokenGrpcService,
|
|
38
|
+
grpc_services_1.AggregatorRouteGrpcService,
|
|
38
39
|
];
|
|
39
40
|
let SharedModule = class SharedModule {
|
|
40
41
|
};
|
|
@@ -96,6 +97,15 @@ exports.SharedModule = SharedModule = __decorate([
|
|
|
96
97
|
url: process.env.PRICE_SERVICE_URL || "localhost:50055",
|
|
97
98
|
},
|
|
98
99
|
},
|
|
100
|
+
{
|
|
101
|
+
name: 'AGGREGATOR_ROUTE',
|
|
102
|
+
transport: microservices_1.Transport.GRPC,
|
|
103
|
+
options: {
|
|
104
|
+
package: 'aggregator_route',
|
|
105
|
+
protoPath: (0, path_1.join)(__dirname, "../protos/aggregator-route.proto"),
|
|
106
|
+
url: process.env.AGGREGATOR_ROUTE_SERVICE_URL || "localhost:50059",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
99
109
|
]),
|
|
100
110
|
],
|
|
101
111
|
providers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/modules/shared.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsD;AAEtD,6DAAuD;AACvD,+EAAyE;AACzE,2EAAqE;AACrE,qFAA+E;AAC/E,qFAA8E;AAC9E,yDAAgE;AAChE,+BAA2B;AAC3B,2EAAqE;AACrE,uFAAgF;AAChF,mCAAgC;AAChC,oFAA8E;AAC9E,uCAAwC;AACxC,iFAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"shared.module.js","sourceRoot":"","sources":["../../src/modules/shared.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAsD;AAEtD,6DAAuD;AACvD,+EAAyE;AACzE,2EAAqE;AACrE,qFAA+E;AAC/E,qFAA8E;AAC9E,yDAAgE;AAChE,+BAA2B;AAC3B,2EAAqE;AACrE,uFAAgF;AAChF,mCAAgC;AAChC,oFAA8E;AAC9E,uCAAwC;AACxC,iFAA2E;AAC3E,mDAA8E;AAE9E,IAAA,eAAM,GAAE,CAAC;AAET,MAAM,SAAS,GAAe;IAC5B,qCAAgB;IAChB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,EAAC,SAAS,EAAE,4BAA4B,CAAC;wBACxD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;qBAC7D;iBACF;gBACD;oBACE,IAAI,EAAE,YAAY;oBAClB,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,YAAY;wBACrB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,4BAA4B,CAAC;wBACxD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,iBAAiB;qBAC7D;iBACF;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,OAAO;wBAChB,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,uBAAuB,CAAC;wBACnD,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,iBAAiB;qBACxD;iBACF;gBACD;oBACE,IAAI,EAAE,kBAAkB;oBACxB,SAAS,EAAE,yBAAS,CAAC,IAAI;oBACzB,OAAO,EAAE;wBACP,OAAO,EAAE,kBAAkB;wBAC3B,SAAS,EAAE,IAAA,WAAI,EAAC,SAAS,EAAE,kCAAkC,CAAC;wBAC9D,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,iBAAiB;qBACnE;iBACF;aACF,CAAC;SACH;QACD,SAAS;QACT,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC;KACxB,CAAC;GACW,YAAY,CAAI"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package aggregator_route;
|
|
4
|
+
|
|
5
|
+
// AggregatorRouteService defines all available RPC endpoints for route finding and optimization.
|
|
6
|
+
service AggregatorRouteService {
|
|
7
|
+
// Find all routes from tokenIn to tokenOut
|
|
8
|
+
rpc FindRoutes (FindRoutesRequest) returns (FindRoutesResponse);
|
|
9
|
+
// Find optimal multi-route split using Dynamic Programming
|
|
10
|
+
rpc FindMultiRoute (FindMultiRouteRequest) returns (FindMultiRouteResponse);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Request message for finding routes
|
|
14
|
+
message FindRoutesRequest {
|
|
15
|
+
string tokenIn = 1;
|
|
16
|
+
string tokenOut = 2;
|
|
17
|
+
string amountIn = 3;
|
|
18
|
+
optional int32 maxHop = 4;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Response message for finding routes
|
|
22
|
+
message FindRoutesResponse {
|
|
23
|
+
bool success = 1;
|
|
24
|
+
string message = 2;
|
|
25
|
+
FindRoutesData data = 3;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
message FindRoutesData {
|
|
29
|
+
string tokenIn = 1;
|
|
30
|
+
string tokenOut = 2;
|
|
31
|
+
string amountIn = 3;
|
|
32
|
+
repeated Route routes = 4;
|
|
33
|
+
int32 totalRoutes = 5;
|
|
34
|
+
optional Route bestRoute = 6;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Route hop information
|
|
38
|
+
message RouteHop {
|
|
39
|
+
string poolAddress = 1;
|
|
40
|
+
string dex = 2;
|
|
41
|
+
string ammType = 3;
|
|
42
|
+
string tokenIn = 4;
|
|
43
|
+
string tokenOut = 5;
|
|
44
|
+
string amountIn = 6;
|
|
45
|
+
string amountOut = 7;
|
|
46
|
+
int32 feeBps = 8;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Complete route from tokenIn to tokenOut
|
|
50
|
+
message Route {
|
|
51
|
+
repeated RouteHop hops = 1;
|
|
52
|
+
string tokenIn = 2;
|
|
53
|
+
string tokenOut = 3;
|
|
54
|
+
string amountIn = 4;
|
|
55
|
+
string amountOut = 5;
|
|
56
|
+
int32 hopCount = 6;
|
|
57
|
+
int32 totalFeeBps = 7;
|
|
58
|
+
double priceImpact = 8;
|
|
59
|
+
repeated string dexPath = 9;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Request message for finding multi-route
|
|
63
|
+
message FindMultiRouteRequest {
|
|
64
|
+
string tokenIn = 1;
|
|
65
|
+
string tokenOut = 2;
|
|
66
|
+
string amountIn = 3;
|
|
67
|
+
optional int32 maxHop = 4;
|
|
68
|
+
optional int32 maxRoutes = 5;
|
|
69
|
+
optional int32 splitSteps = 6;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Response message for finding multi-route
|
|
73
|
+
message FindMultiRouteResponse {
|
|
74
|
+
bool success = 1;
|
|
75
|
+
string message = 2;
|
|
76
|
+
FindMultiRouteData data = 3;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message FindMultiRouteData {
|
|
80
|
+
string tokenIn = 1;
|
|
81
|
+
string tokenOut = 2;
|
|
82
|
+
string totalAmountIn = 3;
|
|
83
|
+
string totalAmountOut = 4;
|
|
84
|
+
repeated RouteSplit splits = 5;
|
|
85
|
+
int32 routeCount = 6;
|
|
86
|
+
double averagePriceImpact = 7;
|
|
87
|
+
string method = 8; // 'dynamic_programming' | 'greedy' | 'sequential' | 'single_route'
|
|
88
|
+
double improvementPercent = 9;
|
|
89
|
+
int32 availableRoutes = 10;
|
|
90
|
+
int64 executionTimeMs = 11;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Route split allocation
|
|
94
|
+
message RouteSplit {
|
|
95
|
+
int32 routeIndex = 1;
|
|
96
|
+
string amountIn = 2;
|
|
97
|
+
string amountOut = 3;
|
|
98
|
+
double percentage = 4;
|
|
99
|
+
repeated RouteHop hops = 5;
|
|
100
|
+
repeated string dexPath = 6;
|
|
101
|
+
int32 totalFeeBps = 7;
|
|
102
|
+
double priceImpact = 8;
|
|
103
|
+
}
|
|
104
|
+
|
|
@@ -16,6 +16,7 @@ service SwapOrderService {
|
|
|
16
16
|
rpc GetTopTradersByPool (GetTopTradersByPoolRequest) returns (GetTopTradersByPoolResponse);
|
|
17
17
|
rpc CalculateUsdValue (CalculateUsdValueRequest) returns (CalculateUsdValueResponse);
|
|
18
18
|
rpc SearchPool (SearchPoolRequest) returns (SearchPoolResponse);
|
|
19
|
+
rpc SearchTokens (SearchTokensRequest) returns (SearchTokensResponse);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// Token data structure matching TokenData interface
|
|
@@ -249,6 +250,11 @@ message SearchPoolRequest {
|
|
|
249
250
|
string text = 1;
|
|
250
251
|
}
|
|
251
252
|
|
|
253
|
+
message SearchTokensRequest {
|
|
254
|
+
string query = 1;
|
|
255
|
+
optional int32 limit = 2;
|
|
256
|
+
}
|
|
257
|
+
|
|
252
258
|
// Pool trader stats data structure matching PoolTraderStatsData interface
|
|
253
259
|
message PoolTraderStatsData {
|
|
254
260
|
string trader = 1;
|
|
@@ -333,4 +339,11 @@ message SearchPoolResponse {
|
|
|
333
339
|
bool success = 1;
|
|
334
340
|
string message = 2;
|
|
335
341
|
repeated ListPool data = 3;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
message SearchTokensResponse {
|
|
345
|
+
bool success = 1;
|
|
346
|
+
string message = 2;
|
|
347
|
+
repeated TokenData data = 3;
|
|
348
|
+
int32 count = 4;
|
|
336
349
|
}
|