@xoxno/types 1.0.387 → 1.0.389

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.
@@ -31,7 +31,7 @@ export declare class LendingAccountProfileDoc {
31
31
  _ts: number;
32
32
  constructor(props?: Partial<LendingAccountProfileDoc>);
33
33
  }
34
- declare const selectFields: readonly ["token", "name", "supplyApy", "borrowApy", "decimals", "reserves", "supplyCap", "borrowCap", "supplyAmount", "supplyAmountScaled", "borrowAmountScaled", "ltv", "liquidationThreshold", "liquidationBonus", "liquidationFee", "siloed", "rewardsReserve", "maxDebtUsd", "debtCeiling", "isolated", "canBeCollateral", "timestamp", "canBeBorrowed", "canBorrowInIsolation", "extraApy", "flashLoanFee", "utilizationRate", "borrowAmount", "optimalUsageRate", "slopeRate1", "slopeRate2", "slopeRate3", "midUsageRate", "baseRate", "maxBorrowRate", "reserveFactor", "address", "flashLoan", "oracleProvider", "indexes"];
34
+ declare const selectFields: readonly ["token", "name", "supplyApy", "borrowApy", "decimals", "reserves", "supplyCap", "borrowCap", "supplyAmount", "supplyAmountScaled", "borrowAmountScaled", "ltv", "liquidationThreshold", "liquidationBonus", "liquidationFee", "siloed", "rewardsReserve", "maxDebtUsd", "debtCeiling", "isolated", "canBeCollateral", "timestamp", "canBeBorrowed", "canBorrowInIsolation", "extraApy", "flashLoanFee", "utilizationRate", "borrowAmount", "optimalUsageRate", "slopeRate1", "slopeRate2", "slopeRate3", "midUsageRate", "baseRate", "maxBorrowRate", "reserveFactor", "address", "flashLoan", "oracleProvider", "indexes", "chain"];
35
35
  export declare class LendingAccountProfile extends LendingAccountProfileDoc {
36
36
  supplyAmount: string;
37
37
  borrowAmount: string;
@@ -240,6 +240,13 @@ const selectFields = [
240
240
  'flashLoan',
241
241
  'oracleProvider',
242
242
  'indexes',
243
+ // `chain` must be in the projection so manage-flow chain resolution
244
+ // (resolveLendingManageChain in xoxno-ui) can tell a Stellar position
245
+ // from an MVX one. Without it, every position's marketProfile.chain is
246
+ // stripped by PickType serialization, normalizeLendingChain defaults
247
+ // to MVX, and Stellar users get the "Switch your Wallet" modal on
248
+ // Remove / Withdraw / Repay / Borrow / Swap / Liquidate.
249
+ 'chain',
243
250
  ];
244
251
  class LendingAccountProfile extends LendingAccountProfileDoc {
245
252
  }
package/dist/index.d.ts CHANGED
@@ -184,6 +184,7 @@ export * from './entities/web2user-data/web2user-wallet';
184
184
  export * from './entities/web2user-data/web2user.doc';
185
185
  export * from './entities/xoxno-liquid-egld-sc/provider.dto';
186
186
  export * from './requests/aggregator/arda-swap-result.dto';
187
+ export * from './requests/aggregator/soroswap-quote.dto';
187
188
  export * from './requests/aggregator/swap';
188
189
  export * from './requests/bober-battle/analytics';
189
190
  export * from './requests/chat/chat-token';
package/dist/index.js CHANGED
@@ -273,6 +273,7 @@ __exportStar(require("./enums/xoxno-egld-liquid-sc.enum"), exports);
273
273
  __exportStar(require("./enums/xoxno-egld-ls-activity.enum"), exports);
274
274
  __exportStar(require("./enums/xoxno-ls-activity.enum"), exports);
275
275
  __exportStar(require("./requests/aggregator/arda-swap-result.dto"), exports);
276
+ __exportStar(require("./requests/aggregator/soroswap-quote.dto"), exports);
276
277
  __exportStar(require("./requests/aggregator/swap"), exports);
277
278
  __exportStar(require("./requests/bober-battle/analytics"), exports);
278
279
  __exportStar(require("./requests/chat/chat-token"), exports);
@@ -0,0 +1,56 @@
1
+ /**
2
+ * One leg of a split route returned by the Soroswap aggregator.
3
+ *
4
+ * The shape mirrors the Soroban lending contract's `DexDistribution`
5
+ * (see rs-lending-xlm common/src/types.rs) so the backend can forward
6
+ * this vector verbatim into `SwapSteps.distribution`. `protocolId`
7
+ * is the u32 enum discriminant:
8
+ * Soroswap = 0, Phoenix = 1, Aqua = 2, Comet = 3
9
+ */
10
+ export declare class StellarSwapDistributionDto {
11
+ protocolId: number;
12
+ path: string[];
13
+ parts: number;
14
+ bytes?: string[] | null;
15
+ }
16
+ /**
17
+ * Pre-mapped `SwapSteps` ready to be handed to `buildStellarLendingTx`.
18
+ * Backend shapes this from the Soroswap `/quote` response so the UI
19
+ * never deals with the protocol-id string -> u32 enum mapping.
20
+ */
21
+ export declare class StellarSwapStepsDto {
22
+ amountOutMin: string;
23
+ distribution: StellarSwapDistributionDto[];
24
+ }
25
+ /**
26
+ * Query DTO for `GET /stellar/aggregator/quote`. Mirrors the subset of
27
+ * Soroswap `/quote` parameters that are meaningful for lending actions.
28
+ * `sdex` is intentionally excluded from `protocols` server-side because
29
+ * SDEX cannot be routed through the Soroban aggregator CPI.
30
+ */
31
+ export declare class SoroswapQuoteRequestDto {
32
+ assetIn: string;
33
+ assetOut: string;
34
+ amount: string;
35
+ tradeType: 'EXACT_IN' | 'EXACT_OUT';
36
+ network: 'mainnet' | 'testnet';
37
+ slippageBps?: number;
38
+ parts?: number;
39
+ maxHops?: number;
40
+ }
41
+ /**
42
+ * Response DTO for `GET /stellar/aggregator/quote`. Carries the raw
43
+ * quote metadata plus the pre-mapped `steps` value the UI can forward
44
+ * verbatim into `buildStellarLendingTx({ action, args: { steps } })`.
45
+ */
46
+ export declare class SoroswapQuoteResponseDto {
47
+ assetIn: string;
48
+ assetOut: string;
49
+ amountIn: string;
50
+ amountOut: string;
51
+ amountOutMin: string;
52
+ tradeType: 'EXACT_IN' | 'EXACT_OUT';
53
+ priceImpactPct: string;
54
+ platform: 'router' | 'aggregator' | 'sdex';
55
+ steps: StellarSwapStepsDto;
56
+ }
@@ -0,0 +1,253 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SoroswapQuoteResponseDto = exports.SoroswapQuoteRequestDto = exports.StellarSwapStepsDto = exports.StellarSwapDistributionDto = void 0;
13
+ const swagger_1 = require("@nestjs/swagger");
14
+ const class_validator_1 = require("class-validator");
15
+ const class_transformer_1 = require("class-transformer");
16
+ /**
17
+ * One leg of a split route returned by the Soroswap aggregator.
18
+ *
19
+ * The shape mirrors the Soroban lending contract's `DexDistribution`
20
+ * (see rs-lending-xlm common/src/types.rs) so the backend can forward
21
+ * this vector verbatim into `SwapSteps.distribution`. `protocolId`
22
+ * is the u32 enum discriminant:
23
+ * Soroswap = 0, Phoenix = 1, Aqua = 2, Comet = 3
24
+ */
25
+ class StellarSwapDistributionDto {
26
+ }
27
+ exports.StellarSwapDistributionDto = StellarSwapDistributionDto;
28
+ __decorate([
29
+ (0, swagger_1.ApiProperty)({
30
+ description: 'Protocol enum discriminant matching the Soroban `Protocol` enum: Soroswap=0, Phoenix=1, Aqua=2, Comet=3',
31
+ example: 0,
32
+ }),
33
+ (0, class_validator_1.IsInt)(),
34
+ (0, class_validator_1.IsIn)([0, 1, 2, 3]),
35
+ __metadata("design:type", Number)
36
+ ], StellarSwapDistributionDto.prototype, "protocolId", void 0);
37
+ __decorate([
38
+ (0, swagger_1.ApiProperty)({
39
+ description: 'Ordered list of Soroban contract addresses describing the swap path (length >= 2)',
40
+ example: [
41
+ 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
42
+ 'CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV',
43
+ ],
44
+ isArray: true,
45
+ type: String,
46
+ }),
47
+ (0, class_validator_1.IsArray)(),
48
+ (0, class_validator_1.IsString)({ each: true }),
49
+ __metadata("design:type", Array)
50
+ ], StellarSwapDistributionDto.prototype, "path", void 0);
51
+ __decorate([
52
+ (0, swagger_1.ApiProperty)({
53
+ description: 'Split weight for this leg (> 0)',
54
+ example: 10,
55
+ }),
56
+ (0, class_validator_1.IsInt)(),
57
+ (0, class_validator_1.Min)(1),
58
+ __metadata("design:type", Number)
59
+ ], StellarSwapDistributionDto.prototype, "parts", void 0);
60
+ __decorate([
61
+ (0, swagger_1.ApiProperty)({
62
+ description: 'Optional 32-byte hints forwarded to the aggregator, base64-encoded. `null` or omitted for Soroswap / Phoenix / Aqua.',
63
+ required: false,
64
+ nullable: true,
65
+ isArray: true,
66
+ type: String,
67
+ }),
68
+ (0, class_validator_1.IsOptional)(),
69
+ (0, class_validator_1.IsArray)(),
70
+ (0, class_validator_1.IsString)({ each: true }),
71
+ __metadata("design:type", Object)
72
+ ], StellarSwapDistributionDto.prototype, "bytes", void 0);
73
+ /**
74
+ * Pre-mapped `SwapSteps` ready to be handed to `buildStellarLendingTx`.
75
+ * Backend shapes this from the Soroswap `/quote` response so the UI
76
+ * never deals with the protocol-id string -> u32 enum mapping.
77
+ */
78
+ class StellarSwapStepsDto {
79
+ }
80
+ exports.StellarSwapStepsDto = StellarSwapStepsDto;
81
+ __decorate([
82
+ (0, swagger_1.ApiProperty)({
83
+ description: 'Minimum amount of output token the router must return, as an i128 decimal string in base units',
84
+ example: '9067253',
85
+ }),
86
+ (0, class_validator_1.IsString)(),
87
+ __metadata("design:type", String)
88
+ ], StellarSwapStepsDto.prototype, "amountOutMin", void 0);
89
+ __decorate([
90
+ (0, swagger_1.ApiProperty)({
91
+ description: 'Split route across one or more AMMs',
92
+ type: () => StellarSwapDistributionDto,
93
+ isArray: true,
94
+ }),
95
+ (0, class_validator_1.IsArray)(),
96
+ (0, class_validator_1.ValidateNested)({ each: true }),
97
+ (0, class_transformer_1.Type)(() => StellarSwapDistributionDto),
98
+ __metadata("design:type", Array)
99
+ ], StellarSwapStepsDto.prototype, "distribution", void 0);
100
+ /**
101
+ * Query DTO for `GET /stellar/aggregator/quote`. Mirrors the subset of
102
+ * Soroswap `/quote` parameters that are meaningful for lending actions.
103
+ * `sdex` is intentionally excluded from `protocols` server-side because
104
+ * SDEX cannot be routed through the Soroban aggregator CPI.
105
+ */
106
+ class SoroswapQuoteRequestDto {
107
+ }
108
+ exports.SoroswapQuoteRequestDto = SoroswapQuoteRequestDto;
109
+ __decorate([
110
+ (0, swagger_1.ApiProperty)({
111
+ description: 'Input asset Soroban contract address',
112
+ example: 'CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA',
113
+ }),
114
+ (0, class_validator_1.IsString)(),
115
+ __metadata("design:type", String)
116
+ ], SoroswapQuoteRequestDto.prototype, "assetIn", void 0);
117
+ __decorate([
118
+ (0, swagger_1.ApiProperty)({
119
+ description: 'Output asset Soroban contract address',
120
+ example: 'CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75',
121
+ }),
122
+ (0, class_validator_1.IsString)(),
123
+ __metadata("design:type", String)
124
+ ], SoroswapQuoteRequestDto.prototype, "assetOut", void 0);
125
+ __decorate([
126
+ (0, swagger_1.ApiProperty)({
127
+ description: 'Amount as an i128 decimal string in base units',
128
+ example: '10000000',
129
+ }),
130
+ (0, class_validator_1.IsString)(),
131
+ __metadata("design:type", String)
132
+ ], SoroswapQuoteRequestDto.prototype, "amount", void 0);
133
+ __decorate([
134
+ (0, swagger_1.ApiProperty)({
135
+ description: 'Trade type. Stellar lending actions only support EXACT_IN in v1; EXACT_OUT is reserved for future use.',
136
+ enum: ['EXACT_IN', 'EXACT_OUT'],
137
+ example: 'EXACT_IN',
138
+ }),
139
+ (0, class_validator_1.IsIn)(['EXACT_IN', 'EXACT_OUT']),
140
+ __metadata("design:type", String)
141
+ ], SoroswapQuoteRequestDto.prototype, "tradeType", void 0);
142
+ __decorate([
143
+ (0, swagger_1.ApiProperty)({
144
+ description: 'Soroswap network',
145
+ enum: ['mainnet', 'testnet'],
146
+ example: 'testnet',
147
+ }),
148
+ (0, class_validator_1.IsIn)(['mainnet', 'testnet']),
149
+ __metadata("design:type", String)
150
+ ], SoroswapQuoteRequestDto.prototype, "network", void 0);
151
+ __decorate([
152
+ (0, swagger_1.ApiProperty)({
153
+ description: 'Slippage tolerance in basis points. Defaults to 50 (= 0.5%) server-side when omitted.',
154
+ required: false,
155
+ example: 50,
156
+ }),
157
+ (0, class_validator_1.IsOptional)(),
158
+ (0, class_validator_1.IsNumber)(),
159
+ __metadata("design:type", Number)
160
+ ], SoroswapQuoteRequestDto.prototype, "slippageBps", void 0);
161
+ __decorate([
162
+ (0, swagger_1.ApiProperty)({
163
+ description: 'Number of split routes for optimisation. Defaults to 10 server-side when omitted.',
164
+ required: false,
165
+ example: 10,
166
+ }),
167
+ (0, class_validator_1.IsOptional)(),
168
+ (0, class_validator_1.IsInt)(),
169
+ (0, class_validator_1.Min)(1),
170
+ __metadata("design:type", Number)
171
+ ], SoroswapQuoteRequestDto.prototype, "parts", void 0);
172
+ __decorate([
173
+ (0, swagger_1.ApiProperty)({
174
+ description: 'Maximum number of hops per route. Defaults to 2 server-side when omitted.',
175
+ required: false,
176
+ example: 2,
177
+ }),
178
+ (0, class_validator_1.IsOptional)(),
179
+ (0, class_validator_1.IsInt)(),
180
+ (0, class_validator_1.Min)(1),
181
+ __metadata("design:type", Number)
182
+ ], SoroswapQuoteRequestDto.prototype, "maxHops", void 0);
183
+ /**
184
+ * Response DTO for `GET /stellar/aggregator/quote`. Carries the raw
185
+ * quote metadata plus the pre-mapped `steps` value the UI can forward
186
+ * verbatim into `buildStellarLendingTx({ action, args: { steps } })`.
187
+ */
188
+ class SoroswapQuoteResponseDto {
189
+ }
190
+ exports.SoroswapQuoteResponseDto = SoroswapQuoteResponseDto;
191
+ __decorate([
192
+ (0, swagger_1.ApiProperty)({ description: 'Input asset Soroban contract address' }),
193
+ (0, class_validator_1.IsString)(),
194
+ __metadata("design:type", String)
195
+ ], SoroswapQuoteResponseDto.prototype, "assetIn", void 0);
196
+ __decorate([
197
+ (0, swagger_1.ApiProperty)({ description: 'Output asset Soroban contract address' }),
198
+ (0, class_validator_1.IsString)(),
199
+ __metadata("design:type", String)
200
+ ], SoroswapQuoteResponseDto.prototype, "assetOut", void 0);
201
+ __decorate([
202
+ (0, swagger_1.ApiProperty)({
203
+ description: 'Input amount as an i128 decimal string in base units',
204
+ }),
205
+ (0, class_validator_1.IsString)(),
206
+ __metadata("design:type", String)
207
+ ], SoroswapQuoteResponseDto.prototype, "amountIn", void 0);
208
+ __decorate([
209
+ (0, swagger_1.ApiProperty)({
210
+ description: 'Expected output amount as an i128 decimal string',
211
+ }),
212
+ (0, class_validator_1.IsString)(),
213
+ __metadata("design:type", String)
214
+ ], SoroswapQuoteResponseDto.prototype, "amountOut", void 0);
215
+ __decorate([
216
+ (0, swagger_1.ApiProperty)({
217
+ description: 'Minimum output (EXACT_IN) or maximum input (EXACT_OUT) after slippage',
218
+ }),
219
+ (0, class_validator_1.IsString)(),
220
+ __metadata("design:type", String)
221
+ ], SoroswapQuoteResponseDto.prototype, "amountOutMin", void 0);
222
+ __decorate([
223
+ (0, swagger_1.ApiProperty)({
224
+ enum: ['EXACT_IN', 'EXACT_OUT'],
225
+ }),
226
+ (0, class_validator_1.IsIn)(['EXACT_IN', 'EXACT_OUT']),
227
+ __metadata("design:type", String)
228
+ ], SoroswapQuoteResponseDto.prototype, "tradeType", void 0);
229
+ __decorate([
230
+ (0, swagger_1.ApiProperty)({
231
+ description: 'Estimated price impact as a percentage string',
232
+ example: '0.50',
233
+ }),
234
+ (0, class_validator_1.IsString)(),
235
+ __metadata("design:type", String)
236
+ ], SoroswapQuoteResponseDto.prototype, "priceImpactPct", void 0);
237
+ __decorate([
238
+ (0, swagger_1.ApiProperty)({
239
+ description: 'Which Soroswap execution surface served the quote. Stellar lending actions only accept `router` or `aggregator`.',
240
+ enum: ['router', 'aggregator', 'sdex'],
241
+ }),
242
+ (0, class_validator_1.IsIn)(['router', 'aggregator', 'sdex']),
243
+ __metadata("design:type", String)
244
+ ], SoroswapQuoteResponseDto.prototype, "platform", void 0);
245
+ __decorate([
246
+ (0, swagger_1.ApiProperty)({
247
+ description: 'Pre-mapped SwapSteps ready to forward into the Soroban lending contract',
248
+ type: () => StellarSwapStepsDto,
249
+ }),
250
+ (0, class_validator_1.ValidateNested)(),
251
+ (0, class_transformer_1.Type)(() => StellarSwapStepsDto),
252
+ __metadata("design:type", StellarSwapStepsDto)
253
+ ], SoroswapQuoteResponseDto.prototype, "steps", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/types",
3
- "version": "1.0.387",
3
+ "version": "1.0.389",
4
4
  "description": "Shared types and utilities for XOXNO API.",
5
5
  "exports": {
6
6
  ".": {