@sui-tracker/shared 1.0.80 → 1.0.82
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/interfaces/ISwapOrder.type.d.ts +12 -1
- package/dist/interfaces/ISwapOrder.type.js +11 -0
- package/dist/interfaces/ISwapOrder.type.js.map +1 -1
- 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/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/shared.module.js +10 -0
- package/dist/modules/shared.module.js.map +1 -1
- package/dist/protos/aggregator-route.proto +104 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -7,7 +7,18 @@ export declare enum DexType {
|
|
|
7
7
|
STEAMM = "steamm",
|
|
8
8
|
MAGMA = "magma",
|
|
9
9
|
FULLSAIL = "fullsail",
|
|
10
|
-
AFTERMATH = "aftermath"
|
|
10
|
+
AFTERMATH = "aftermath",
|
|
11
|
+
FLOWX = "flowx",
|
|
12
|
+
FLOWX_V3 = "flowx_v3",
|
|
13
|
+
KRIYA = "kriya",
|
|
14
|
+
FERRACLMM = "ferraclmm",
|
|
15
|
+
KRIYA_V3 = "kriya_v3",
|
|
16
|
+
FERRADLMM = "ferradlmm",
|
|
17
|
+
K7 = "k7",
|
|
18
|
+
HAEDAL_HMM = "haedal_hmm",
|
|
19
|
+
CETUS_DLMM = "cetus_dlmm",
|
|
20
|
+
AFSUI = "afsui",
|
|
21
|
+
SPRINGSUI = "springsui"
|
|
11
22
|
}
|
|
12
23
|
export declare enum TradeType {
|
|
13
24
|
SWAP = "swap",
|
|
@@ -12,6 +12,17 @@ var DexType;
|
|
|
12
12
|
DexType["MAGMA"] = "magma";
|
|
13
13
|
DexType["FULLSAIL"] = "fullsail";
|
|
14
14
|
DexType["AFTERMATH"] = "aftermath";
|
|
15
|
+
DexType["FLOWX"] = "flowx";
|
|
16
|
+
DexType["FLOWX_V3"] = "flowx_v3";
|
|
17
|
+
DexType["KRIYA"] = "kriya";
|
|
18
|
+
DexType["FERRACLMM"] = "ferraclmm";
|
|
19
|
+
DexType["KRIYA_V3"] = "kriya_v3";
|
|
20
|
+
DexType["FERRADLMM"] = "ferradlmm";
|
|
21
|
+
DexType["K7"] = "k7";
|
|
22
|
+
DexType["HAEDAL_HMM"] = "haedal_hmm";
|
|
23
|
+
DexType["CETUS_DLMM"] = "cetus_dlmm";
|
|
24
|
+
DexType["AFSUI"] = "afsui";
|
|
25
|
+
DexType["SPRINGSUI"] = "springsui";
|
|
15
26
|
})(DexType || (exports.DexType = DexType = {}));
|
|
16
27
|
var TradeType;
|
|
17
28
|
(function (TradeType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ISwapOrder.type.js","sourceRoot":"","sources":["../../src/interfaces/ISwapOrder.type.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"ISwapOrder.type.js","sourceRoot":"","sources":["../../src/interfaces/ISwapOrder.type.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAqBX;AArBD,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,8BAAmB,CAAA;IACnB,gCAAqB,CAAA;IACrB,4BAAiB,CAAA;IACjB,gCAAqB,CAAA;IACrB,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,gCAAqB,CAAA;IACrB,kCAAuB,CAAA;IACvB,0BAAe,CAAA;IACf,gCAAqB,CAAA;IACrB,0BAAe,CAAA;IACf,kCAAuB,CAAA;IACvB,gCAAqB,CAAA;IACrB,kCAAuB,CAAA;IACvB,oBAAS,CAAA;IACT,oCAAyB,CAAA;IACzB,oCAAyB,CAAA;IACzB,0BAAe,CAAA;IACf,kCAAuB,CAAA;AACzB,CAAC,EArBW,OAAO,uBAAP,OAAO,QAqBlB;AAED,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,2CAA8B,CAAA;IAC9B,iDAAoC,CAAA;IACpC,uCAA0B,CAAA;AAC5B,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB"}
|
|
@@ -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,GAC1B,IAAI,CAAC,UAAU,CAAC,UAAU,CACxB,wBAAwB,CACzB,CAAC;QAEJ,MAAM,GAAG,GAAG,MAAM,IAAI,OAAO,CAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACpE,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;gBAChD,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACrC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;aAChC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;IAKD,KAAK,CAAC,cAAc,CAClB,IAA2B;QAE3B,MAAM,sBAAsB,GAC1B,IAAI,CAAC,UAAU,CAAC,UAAU,CACxB,wBAAwB,CACzB,CAAC;QAEJ,MAAM,GAAG,GAAG,MAAM,IAAI,OAAO,CAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACxE,sBAAsB,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC;gBACpD,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACrC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;aAChC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF,CAAA;AAxDY,gEAA0B;qCAA1B,0BAA0B;IADtC,IAAA,mBAAU,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"}
|
|
@@ -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"}
|
|
@@ -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":"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"}
|
|
@@ -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
|
+
|