@xoxno/types 1.0.482 → 1.0.484

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.
Files changed (41) hide show
  1. package/dist/cache/cache-keys.d.ts +16 -15
  2. package/dist/cache/cache-keys.js +30 -30
  3. package/dist/cosmos-db/documents/lending/lending-account-profile.d.ts +3 -1
  4. package/dist/cosmos-db/documents/lending/lending-account-profile.js +15 -2
  5. package/dist/cosmos-db/documents/lending/lending-governance-proposal.doc.d.ts +2 -0
  6. package/dist/cosmos-db/documents/lending/lending-governance-proposal.doc.js +7 -2
  7. package/dist/cosmos-db/documents/lending/lending-market-profile.doc.d.ts +2 -0
  8. package/dist/cosmos-db/documents/lending/lending-market-profile.doc.js +14 -2
  9. package/dist/requests/lending/lending-governance-proposal.filter.d.ts +3 -0
  10. package/dist/requests/lending/lending-market-profile.filter.d.ts +3 -0
  11. package/dist/stellar-lending/documents/account-delegate.doc.d.ts +2 -0
  12. package/dist/stellar-lending/documents/account-delegate.doc.js +2 -1
  13. package/dist/stellar-lending/documents/account-position.doc.d.ts +2 -0
  14. package/dist/stellar-lending/documents/account-position.doc.js +2 -1
  15. package/dist/stellar-lending/documents/asset.doc.d.ts +2 -0
  16. package/dist/stellar-lending/documents/asset.doc.js +2 -1
  17. package/dist/stellar-lending/documents/blend-pool.doc.d.ts +2 -0
  18. package/dist/stellar-lending/documents/blend-pool.doc.js +2 -1
  19. package/dist/stellar-lending/documents/contract-config.doc.d.ts +2 -0
  20. package/dist/stellar-lending/documents/contract-config.doc.js +2 -1
  21. package/dist/stellar-lending/documents/contract-role.doc.d.ts +2 -0
  22. package/dist/stellar-lending/documents/contract-role.doc.js +2 -1
  23. package/dist/stellar-lending/documents/cursor.doc.d.ts +2 -0
  24. package/dist/stellar-lending/documents/cursor.doc.js +2 -1
  25. package/dist/stellar-lending/documents/governance-proposal.doc.d.ts +2 -0
  26. package/dist/stellar-lending/documents/governance-proposal.doc.js +2 -1
  27. package/dist/stellar-lending/documents/hub-asset.doc.d.ts +2 -0
  28. package/dist/stellar-lending/documents/hub-asset.doc.js +2 -1
  29. package/dist/stellar-lending/documents/hub.doc.d.ts +2 -0
  30. package/dist/stellar-lending/documents/hub.doc.js +2 -1
  31. package/dist/stellar-lending/documents/spoke-asset.doc.d.ts +2 -0
  32. package/dist/stellar-lending/documents/spoke-asset.doc.js +2 -1
  33. package/dist/stellar-lending/documents/spoke.doc.d.ts +2 -0
  34. package/dist/stellar-lending/documents/spoke.doc.js +2 -1
  35. package/dist/stellar-lending/index.d.ts +1 -0
  36. package/dist/stellar-lending/index.js +1 -0
  37. package/dist/stellar-lending/kusto/activity-data.d.ts +14 -0
  38. package/dist/stellar-lending/kusto/market-state-data.d.ts +2 -0
  39. package/dist/stellar-lending/network.d.ts +4 -0
  40. package/dist/stellar-lending/network.js +10 -0
  41. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import type { StellarNetwork } from '../stellar-lending/network';
1
2
  /**
2
3
  * Shared cache key definitions for use across xoxno-api-v2 and xoxno-az-functions.
3
4
  * This ensures consistent cache keys and TTLs across all repositories.
@@ -102,21 +103,21 @@ export declare const CacheKeys: {
102
103
  LendingMarketAverageGraphData: (token: string) => CacheKeyConfig;
103
104
  LendingMarketQuery: (filterHash: string) => CacheKeyConfig;
104
105
  UserLendingPositions: (address: string, token?: string) => CacheKeyConfig;
105
- StellarLendingContext: () => CacheKeyConfig;
106
- StellarLendingAssetsList: () => CacheKeyConfig;
107
- StellarLendingHubsList: () => CacheKeyConfig;
108
- StellarLendingSpokesList: () => CacheKeyConfig;
109
- StellarLendingReservesList: (hubId?: string | number | null, spokeId?: string | number | null, asset?: string | null) => CacheKeyConfig;
110
- StellarLendingReserve: (spokeId: number, hubId: number, asset: string) => CacheKeyConfig;
111
- StellarLendingAsset: (asset: string) => CacheKeyConfig;
112
- StellarLendingAssetPageBase: (asset: string) => CacheKeyConfig;
113
- StellarLendingAssetMarkets: (asset: string, side: string) => CacheKeyConfig;
114
- StellarLendingHub: (hubId: number) => CacheKeyConfig;
115
- StellarLendingSpoke: (spokeId: number) => CacheKeyConfig;
116
- StellarLendingUserPositions: (owner: string) => CacheKeyConfig;
117
- StellarLendingAccountPositions: (accountId: string) => CacheKeyConfig;
118
- StellarLendingGovernanceProposals: (top: number, continuationToken?: string | null) => CacheKeyConfig;
119
- StellarLendingLiveIndexes: (hash: string) => CacheKeyConfig;
106
+ StellarLendingContext: (network: StellarNetwork) => CacheKeyConfig;
107
+ StellarLendingAssetsList: (network: StellarNetwork) => CacheKeyConfig;
108
+ StellarLendingHubsList: (network: StellarNetwork) => CacheKeyConfig;
109
+ StellarLendingSpokesList: (network: StellarNetwork) => CacheKeyConfig;
110
+ StellarLendingReservesList: (network: StellarNetwork, hubId?: string | number | null, spokeId?: string | number | null, asset?: string | null) => CacheKeyConfig;
111
+ StellarLendingReserve: (network: StellarNetwork, spokeId: number, hubId: number, asset: string) => CacheKeyConfig;
112
+ StellarLendingAsset: (network: StellarNetwork, asset: string) => CacheKeyConfig;
113
+ StellarLendingAssetPageBase: (network: StellarNetwork, asset: string) => CacheKeyConfig;
114
+ StellarLendingAssetMarkets: (network: StellarNetwork, asset: string, side: string) => CacheKeyConfig;
115
+ StellarLendingHub: (network: StellarNetwork, hubId: number) => CacheKeyConfig;
116
+ StellarLendingSpoke: (network: StellarNetwork, spokeId: number) => CacheKeyConfig;
117
+ StellarLendingUserPositions: (network: StellarNetwork, owner: string) => CacheKeyConfig;
118
+ StellarLendingAccountPositions: (network: StellarNetwork, accountId: string) => CacheKeyConfig;
119
+ StellarLendingGovernanceProposals: (network: StellarNetwork, top: number, continuationToken?: string | null) => CacheKeyConfig;
120
+ StellarLendingLiveIndexes: (network: StellarNetwork, hash: string) => CacheKeyConfig;
120
121
  HatomUserInfo: (address: string) => CacheKeyConfig;
121
122
  UserUnreadNotificationCount: (address: string) => CacheKeyConfig;
122
123
  EventProfileDoc: (eventId: string) => CacheKeyConfig;
@@ -383,64 +383,64 @@ exports.CacheKeys = {
383
383
  key: `user:${address}:lending:positions${token ? `:${token}` : ''}`,
384
384
  ttl: ttl_1.TTLS.ONE_MINUTE / 2, // 30 seconds
385
385
  }),
386
- StellarLendingContext: () => ({
387
- key: 'sl:context',
386
+ StellarLendingContext: (network) => ({
387
+ key: `sl:${network}:context`,
388
388
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
389
389
  }),
390
- StellarLendingAssetsList: () => ({
391
- key: 'sl:list:assets',
390
+ StellarLendingAssetsList: (network) => ({
391
+ key: `sl:${network}:list:assets`,
392
392
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
393
393
  }),
394
- StellarLendingHubsList: () => ({
395
- key: 'sl:list:hubs',
394
+ StellarLendingHubsList: (network) => ({
395
+ key: `sl:${network}:list:hubs`,
396
396
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
397
397
  }),
398
- StellarLendingSpokesList: () => ({
399
- key: 'sl:list:spokes',
398
+ StellarLendingSpokesList: (network) => ({
399
+ key: `sl:${network}:list:spokes`,
400
400
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
401
401
  }),
402
- StellarLendingReservesList: (hubId, spokeId, asset) => ({
403
- key: `sl:list:reserves:${serializeStellarFilter(hubId)}:${serializeStellarFilter(spokeId)}:${serializeStellarFilter(asset)}`,
402
+ StellarLendingReservesList: (network, hubId, spokeId, asset) => ({
403
+ key: `sl:${network}:list:reserves:${serializeStellarFilter(hubId)}:${serializeStellarFilter(spokeId)}:${serializeStellarFilter(asset)}`,
404
404
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
405
405
  }),
406
- StellarLendingReserve: (spokeId, hubId, asset) => ({
407
- key: `sl:reserve:${spokeId}:${hubId}:${asset}`,
406
+ StellarLendingReserve: (network, spokeId, hubId, asset) => ({
407
+ key: `sl:${network}:reserve:${spokeId}:${hubId}:${asset}`,
408
408
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
409
409
  }),
410
- StellarLendingAsset: (asset) => ({
411
- key: `sl:asset:${asset}`,
410
+ StellarLendingAsset: (network, asset) => ({
411
+ key: `sl:${network}:asset:${asset}`,
412
412
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
413
413
  }),
414
- StellarLendingAssetPageBase: (asset) => ({
415
- key: `sl:asset-page-base:${asset}`,
414
+ StellarLendingAssetPageBase: (network, asset) => ({
415
+ key: `sl:${network}:asset-page-base:${asset}`,
416
416
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
417
417
  }),
418
- StellarLendingAssetMarkets: (asset, side) => ({
419
- key: `sl:asset-markets:${asset}:${side}`,
418
+ StellarLendingAssetMarkets: (network, asset, side) => ({
419
+ key: `sl:${network}:asset-markets:${asset}:${side}`,
420
420
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
421
421
  }),
422
- StellarLendingHub: (hubId) => ({
423
- key: `sl:hub:${hubId}`,
422
+ StellarLendingHub: (network, hubId) => ({
423
+ key: `sl:${network}:hub:${hubId}`,
424
424
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
425
425
  }),
426
- StellarLendingSpoke: (spokeId) => ({
427
- key: `sl:spoke:${spokeId}`,
426
+ StellarLendingSpoke: (network, spokeId) => ({
427
+ key: `sl:${network}:spoke:${spokeId}`,
428
428
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
429
429
  }),
430
- StellarLendingUserPositions: (owner) => ({
431
- key: `sl:user-positions:${owner}`,
430
+ StellarLendingUserPositions: (network, owner) => ({
431
+ key: `sl:${network}:user-positions:${owner}`,
432
432
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
433
433
  }),
434
- StellarLendingAccountPositions: (accountId) => ({
435
- key: `sl:account-positions:${accountId}`,
434
+ StellarLendingAccountPositions: (network, accountId) => ({
435
+ key: `sl:${network}:account-positions:${accountId}`,
436
436
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
437
437
  }),
438
- StellarLendingGovernanceProposals: (top, continuationToken) => ({
439
- key: `sl:gov-proposals:${top}:${continuationToken ?? ''}`,
438
+ StellarLendingGovernanceProposals: (network, top, continuationToken) => ({
439
+ key: `sl:${network}:gov-proposals:${top}:${continuationToken ?? ''}`,
440
440
  ttl: ttl_1.TTLS.ONE_MINUTE / 2,
441
441
  }),
442
- StellarLendingLiveIndexes: (hash) => ({
443
- key: `sl:live-indexes:${hash}`,
442
+ StellarLendingLiveIndexes: (network, hash) => ({
443
+ key: `sl:${network}:live-indexes:${hash}`,
444
444
  ttl: ttl_1.TTLS.ONE_SECOND * 3,
445
445
  }),
446
446
  HatomUserInfo: (address) => ({
@@ -3,6 +3,7 @@ import { PositionMode } from '../../../enums/lending.enum';
3
3
  import { LendingEModeCategoryProfileDoc } from './lending-emode-category-profile.doc';
4
4
  import { LendingMarketProfile } from './lending-market-profile.doc';
5
5
  import { ActivityChain } from '../../../enums/common.enum';
6
+ import { type StellarNetwork } from '../../../stellar-lending/network';
6
7
  export declare class InitialPaymentMultiplier {
7
8
  initialPaymentAmount: string;
8
9
  initialPaymentToken: string;
@@ -26,13 +27,14 @@ export declare class LendingAccountProfileDoc {
26
27
  initialPaymentMultiplier?: InitialPaymentMultiplier;
27
28
  isClassic?: boolean;
28
29
  chain: ActivityChain;
30
+ network?: StellarNetwork;
29
31
  spokeId?: number;
30
32
  id: string;
31
33
  pk: string;
32
34
  _ts: number;
33
35
  constructor(props?: Partial<LendingAccountProfileDoc>);
34
36
  }
35
- 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", "maxUtilizationRay", "address", "flashLoan", "oracleProvider", "indexes", "chain"];
37
+ 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", "maxUtilizationRay", "address", "flashLoan", "oracleProvider", "indexes", "chain", "network"];
36
38
  export declare class LendingAccountProfile extends LendingAccountProfileDoc {
37
39
  supplyAmount: string;
38
40
  borrowAmount: string;
@@ -17,6 +17,7 @@ const lending_emode_category_profile_doc_1 = require("./lending-emode-category-p
17
17
  const lending_market_profile_doc_1 = require("./lending-market-profile.doc");
18
18
  const common_enum_1 = require("../../../enums/common.enum");
19
19
  const lending_chain_1 = require("./lending-chain");
20
+ const network_1 = require("../../../stellar-lending/network");
20
21
  class InitialPaymentMultiplier {
21
22
  }
22
23
  exports.InitialPaymentMultiplier = InitialPaymentMultiplier;
@@ -48,9 +49,12 @@ class LendingAccountProfileDoc {
48
49
  this.borrowAmountScaled = '0';
49
50
  this.chain = common_enum_1.ActivityChain.MVX;
50
51
  Object.assign(this, props);
51
- this.pk = this.dataType;
52
- this.id = `${this.identifier}_${this.token}`;
53
52
  this.chain = (0, lending_chain_1.normalizeLendingChain)(this.chain);
53
+ this.pk =
54
+ this.chain === common_enum_1.ActivityChain.STELLAR
55
+ ? (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType)
56
+ : this.dataType;
57
+ this.id = `${this.identifier}_${this.token}`;
54
58
  }
55
59
  }
56
60
  exports.LendingAccountProfileDoc = LendingAccountProfileDoc;
@@ -178,6 +182,14 @@ __decorate([
178
182
  }),
179
183
  __metadata("design:type", String)
180
184
  ], LendingAccountProfileDoc.prototype, "chain", void 0);
185
+ __decorate([
186
+ (0, swagger_1.ApiProperty)({
187
+ description: 'Stellar network discriminator; required for Stellar rows',
188
+ required: false,
189
+ enum: ['mainnet', 'testnet'],
190
+ }),
191
+ __metadata("design:type", String)
192
+ ], LendingAccountProfileDoc.prototype, "network", void 0);
181
193
  __decorate([
182
194
  (0, swagger_1.ApiProperty)({
183
195
  description: 'Stellar spoke the account belongs to (rs-lending-xlm `AccountMeta.spoke_id`). Always 0 for MVX.',
@@ -256,6 +268,7 @@ const selectFields = [
256
268
  // to MVX, and Stellar users get the "Switch your Wallet" modal on
257
269
  // Remove / Withdraw / Repay / Borrow / Swap / Liquidate.
258
270
  'chain',
271
+ 'network',
259
272
  ];
260
273
  class LendingAccountProfile extends LendingAccountProfileDoc {
261
274
  }
@@ -1,5 +1,6 @@
1
1
  import { LendingDataType } from '../../../enums/lending-data-type.enum';
2
2
  import { GovernanceProposalKind, GovernanceProposalStatus, GovernanceProposalTarget } from '../../../enums/lending-governance.enum';
3
+ import { type StellarNetwork } from '../../../stellar-lending/network';
3
4
  /**
4
5
  * One decoded "what will change" row for a governance proposal, rendered as a
5
6
  * label/value pair. The indexer formats these from the decoded operation args
@@ -25,6 +26,7 @@ export declare class GovernanceProposalField {
25
26
  */
26
27
  export declare class LendingGovernanceProposalDoc {
27
28
  dataType: LendingDataType;
29
+ network: StellarNetwork;
28
30
  operationId: string;
29
31
  kind: GovernanceProposalKind;
30
32
  status: GovernanceProposalStatus;
@@ -13,6 +13,7 @@ exports.LendingGovernanceProposalQuery = exports.LendingGovernanceProposalDoc =
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const lending_data_type_enum_1 = require("../../../enums/lending-data-type.enum");
15
15
  const lending_governance_enum_1 = require("../../../enums/lending-governance.enum");
16
+ const network_1 = require("../../../stellar-lending/network");
16
17
  const cosmos_db_paginated_response_dto_1 = require("../../cosmos-db-paginated-response.dto");
17
18
  /**
18
19
  * One decoded "what will change" row for a governance proposal, rendered as a
@@ -49,7 +50,7 @@ class LendingGovernanceProposalDoc {
49
50
  this.dataType = lending_data_type_enum_1.LendingDataType.GOVERNANCE_PROPOSAL;
50
51
  this.fields = [];
51
52
  Object.assign(this, props);
52
- this.pk = this.dataType;
53
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
53
54
  this.id = this.operationId;
54
55
  }
55
56
  }
@@ -62,6 +63,10 @@ __decorate([
62
63
  }),
63
64
  __metadata("design:type", Object)
64
65
  ], LendingGovernanceProposalDoc.prototype, "dataType", void 0);
66
+ __decorate([
67
+ (0, swagger_1.ApiProperty)({ enum: ['mainnet', 'testnet'] }),
68
+ __metadata("design:type", String)
69
+ ], LendingGovernanceProposalDoc.prototype, "network", void 0);
65
70
  __decorate([
66
71
  (0, swagger_1.ApiProperty)({
67
72
  description: 'Operation id (keccak256 content hash), hex string',
@@ -266,7 +271,7 @@ __decorate([
266
271
  __decorate([
267
272
  (0, swagger_1.ApiProperty)({
268
273
  description: 'Cosmos DB partition key',
269
- example: 'governanceProposal',
274
+ example: 'mainnet:governanceProposal',
270
275
  }),
271
276
  __metadata("design:type", String)
272
277
  ], LendingGovernanceProposalDoc.prototype, "pk", void 0);
@@ -5,6 +5,7 @@ import { LendingOracleProvider } from './lending-oracle';
5
5
  import { LendingIndexesDto } from '../../../requests/lending/lending-indexes.dto';
6
6
  import { ActivityChain } from '../../../enums/common.enum';
7
7
  import { MarketStatus } from '../../../enums/lending.enum';
8
+ import { type StellarNetwork } from '../../../stellar-lending/network';
8
9
  export declare class LendingMarketProfileDoc {
9
10
  dataType: LendingDataType;
10
11
  token: string;
@@ -56,6 +57,7 @@ export declare class LendingMarketProfileDoc {
56
57
  canBorrowInIsolation: boolean;
57
58
  oracleProvider: LendingOracleProvider;
58
59
  chain: ActivityChain;
60
+ network?: StellarNetwork;
59
61
  id: string;
60
62
  pk: string;
61
63
  _ts: number;
@@ -20,6 +20,7 @@ const lending_indexes_dto_1 = require("../../../requests/lending/lending-indexes
20
20
  const common_enum_1 = require("../../../enums/common.enum");
21
21
  const lending_enum_1 = require("../../../enums/lending.enum");
22
22
  const lending_chain_1 = require("./lending-chain");
23
+ const network_1 = require("../../../stellar-lending/network");
23
24
  let LendingMarketProfileDoc = class LendingMarketProfileDoc {
24
25
  constructor(props) {
25
26
  this.dataType = lending_data_type_enum_1.LendingDataType.MARKET_PROFILE;
@@ -46,9 +47,12 @@ let LendingMarketProfileDoc = class LendingMarketProfileDoc {
46
47
  this.debtCeilingShort = 0;
47
48
  this.chain = common_enum_1.ActivityChain.MVX;
48
49
  Object.assign(this, props);
49
- this.pk = this.dataType;
50
- this.id = `${this.token}_${this.dataType}`;
51
50
  this.chain = (0, lending_chain_1.normalizeLendingChain)(this.chain);
51
+ this.pk =
52
+ this.chain === common_enum_1.ActivityChain.STELLAR
53
+ ? (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType)
54
+ : this.dataType;
55
+ this.id = `${this.token}_${this.dataType}`;
52
56
  }
53
57
  };
54
58
  exports.LendingMarketProfileDoc = LendingMarketProfileDoc;
@@ -313,6 +317,14 @@ __decorate([
313
317
  }),
314
318
  __metadata("design:type", String)
315
319
  ], LendingMarketProfileDoc.prototype, "chain", void 0);
320
+ __decorate([
321
+ (0, swagger_1.ApiProperty)({
322
+ description: 'Stellar network discriminator; required for Stellar rows',
323
+ required: false,
324
+ enum: ['mainnet', 'testnet'],
325
+ }),
326
+ __metadata("design:type", String)
327
+ ], LendingMarketProfileDoc.prototype, "network", void 0);
316
328
  __decorate([
317
329
  (0, swagger_1.ApiProperty)({
318
330
  description: 'Cosmos DB document identifier',
@@ -1,5 +1,6 @@
1
1
  import { CosmosDbGenericFilter } from '../../cosmos-db/cosmos-db-generic-filter';
2
2
  import { GovernanceProposalKind, GovernanceProposalStatus } from '../../enums/lending-governance.enum';
3
+ import type { StellarNetwork } from '../../stellar-lending/network';
3
4
  import { LendingGovernanceProposalDoc } from '../../cosmos-db/documents/lending/lending-governance-proposal.doc';
4
5
  export declare class LendingGovernanceProposalFilterCriteriaDto {
5
6
  status?: GovernanceProposalStatus[];
@@ -13,6 +14,8 @@ export declare class LendingGovernanceProposalFilter extends CosmosDbGenericFilt
13
14
  kind?: GovernanceProposalKind[];
14
15
  proposer?: string[];
15
16
  assetAddress?: string[];
17
+ /** Server-owned isolation field; API callers must not choose it. */
18
+ network?: StellarNetwork;
16
19
  pk?: string;
17
20
  };
18
21
  includeCount?: boolean;
@@ -1,6 +1,7 @@
1
1
  import { RangeFilter, CosmosDbGenericFilter } from '../../cosmos-db/cosmos-db-generic-filter';
2
2
  import { LendingMarketProfileDoc } from '../../cosmos-db/documents/lending/lending-market-profile.doc';
3
3
  import { ActivityChain } from '../../enums/common.enum';
4
+ import type { StellarNetwork } from '../../stellar-lending/network';
4
5
  export declare class LendingMarketProfileFilterCriteriaDto {
5
6
  token?: string[];
6
7
  range?: RangeFilter<LendingMarketProfileDoc>[];
@@ -33,6 +34,8 @@ export declare class LendingMarketProfileFilter extends CosmosDbGenericFilter<Le
33
34
  isDebtCeilingReached?: boolean;
34
35
  pk?: string;
35
36
  chain?: ActivityChain[];
37
+ /** Server-owned isolation field; API callers must not choose it. */
38
+ network?: StellarNetwork;
36
39
  };
37
40
  strictSelect?: boolean;
38
41
  includeCount?: boolean;
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * One position-authorization grant, event-sourced from `account:delegate`.
4
5
  *
@@ -12,6 +13,7 @@ import { StellarLendingDataType } from '../enums';
12
13
  */
13
14
  export declare class StellarAccountDelegateDoc {
14
15
  dataType: StellarLendingDataType;
16
+ network: StellarNetwork;
15
17
  /** On-chain numeric account id the delegation applies to. */
16
18
  accountId: number;
17
19
  /** Wallet that owns the account. */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarAccountDelegateDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * One position-authorization grant, event-sourced from `account:delegate`.
7
8
  *
@@ -20,7 +21,7 @@ class StellarAccountDelegateDoc {
20
21
  this.updatedAt = 0;
21
22
  this.ledger = 0;
22
23
  Object.assign(this, props);
23
- this.pk = this.dataType;
24
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
24
25
  this.id = `accountDelegate:${this.accountId}:${this.delegate}`;
25
26
  }
26
27
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  export interface StellarInitialPaymentMultiplier {
3
4
  initialPaymentAmount: string;
4
5
  initialPaymentToken: string;
@@ -11,6 +12,7 @@ export interface StellarInitialPaymentMultiplier {
11
12
  */
12
13
  export declare class StellarAccountPositionDoc {
13
14
  dataType: StellarLendingDataType;
15
+ network: StellarNetwork;
14
16
  accountId: string;
15
17
  owner: string;
16
18
  spokeId: number;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarAccountPositionDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * One account's position in one reserve (`account:{accountId}:{hubId}:{asset}`).
7
8
  * Partitioned by `accountId` so a full account loads single-partition. Entry
@@ -24,7 +25,7 @@ class StellarAccountPositionDoc {
24
25
  this.updatedAt = 0;
25
26
  this.ledger = 0;
26
27
  Object.assign(this, props);
27
- this.pk = this.accountId;
28
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.accountId);
28
29
  this.id = `account:${this.accountId}:${this.hubId}:${this.asset}`;
29
30
  }
30
31
  }
@@ -1,7 +1,9 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  import type { StellarAssetOracle } from '../oracle-provider';
3
4
  export declare class StellarAssetDoc {
4
5
  dataType: StellarLendingDataType;
6
+ network: StellarNetwork;
5
7
  asset: string;
6
8
  symbol: string;
7
9
  name: string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarAssetDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  class StellarAssetDoc {
6
7
  constructor(props) {
7
8
  this.dataType = enums_1.StellarLendingDataType.ASSET;
@@ -15,7 +16,7 @@ class StellarAssetDoc {
15
16
  this.updatedAt = 0;
16
17
  this.ledger = 0;
17
18
  Object.assign(this, props);
18
- this.pk = this.dataType;
19
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
19
20
  this.id = `asset:${this.asset}`;
20
21
  }
21
22
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * Approval state for one Blend pool, event-sourced from
4
5
  * `config:approve_blend_pool`.
@@ -10,6 +11,7 @@ import { StellarLendingDataType } from '../enums';
10
11
  */
11
12
  export declare class StellarBlendPoolDoc {
12
13
  dataType: StellarLendingDataType;
14
+ network: StellarNetwork;
13
15
  /** Blend pool contract address. Also the `id` suffix. */
14
16
  pool: string;
15
17
  approved: boolean;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarBlendPoolDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * Approval state for one Blend pool, event-sourced from
7
8
  * `config:approve_blend_pool`.
@@ -18,7 +19,7 @@ class StellarBlendPoolDoc {
18
19
  this.updatedAt = 0;
19
20
  this.ledger = 0;
20
21
  Object.assign(this, props);
21
- this.pk = this.dataType;
22
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
22
23
  this.id = `blendPool:${this.pool}`;
23
24
  }
24
25
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * Config and admin state for one deployed contract, event-sourced from that
4
5
  * contract's own `config:*`, pause, ownership and admin events.
@@ -15,6 +16,7 @@ import { StellarLendingDataType } from '../enums';
15
16
  */
16
17
  export declare class StellarContractConfigDoc {
17
18
  dataType: StellarLendingDataType;
19
+ network: StellarNetwork;
18
20
  /** Contract this row describes. Also the `id` suffix. */
19
21
  contractAddress: string;
20
22
  /** Set when the deploy was observed via `governance:deploy_*`. */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarContractConfigDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * Config and admin state for one deployed contract, event-sourced from that
7
8
  * contract's own `config:*`, pause, ownership and admin events.
@@ -46,7 +47,7 @@ class StellarContractConfigDoc {
46
47
  this.updatedAt = 0;
47
48
  this.ledger = 0;
48
49
  Object.assign(this, props);
49
- this.pk = this.dataType;
50
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
50
51
  this.id = `contractConfig:${this.contractAddress}`;
51
52
  }
52
53
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * One access-control grant, event-sourced from `role_granted` / `role_revoked`.
4
5
  *
@@ -14,6 +15,7 @@ import { StellarLendingDataType } from '../enums';
14
15
  */
15
16
  export declare class StellarContractRoleDoc {
16
17
  dataType: StellarLendingDataType;
18
+ network: StellarNetwork;
17
19
  /** Contract whose access control this grant belongs to. */
18
20
  contractAddress: string;
19
21
  /** On-chain role symbol, e.g. `ORACLE`, `PROPOSER`. */
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarContractRoleDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * One access-control grant, event-sourced from `role_granted` / `role_revoked`.
7
8
  *
@@ -24,7 +25,7 @@ class StellarContractRoleDoc {
24
25
  this.updatedAt = 0;
25
26
  this.ledger = 0;
26
27
  Object.assign(this, props);
27
- this.pk = this.dataType;
28
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
28
29
  this.id = `contractRole:${this.contractAddress}:${this.role}:${this.account}`;
29
30
  }
30
31
  }
@@ -1,6 +1,8 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  export declare class StellarLendingCursorDoc {
3
4
  dataType: StellarLendingDataType;
5
+ network: StellarNetwork;
4
6
  lastLedger: number;
5
7
  lastPagingToken: string | null;
6
8
  /**
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarLendingCursorDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  class StellarLendingCursorDoc {
6
7
  constructor(props) {
7
8
  this.dataType = enums_1.StellarLendingDataType.CURSOR;
@@ -29,7 +30,7 @@ class StellarLendingCursorDoc {
29
30
  this.indexerVersion = null;
30
31
  this.updatedAt = 0;
31
32
  Object.assign(this, props);
32
- this.pk = this.dataType;
33
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
33
34
  this.id = 'cursor:stellar-lending';
34
35
  }
35
36
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarGovernanceProposalKind, StellarGovernanceProposalStatus, StellarGovernanceProposalTarget, StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * One decoded "what will change" row for a governance proposal, rendered as a
4
5
  * label/value pair by the indexer.
@@ -16,6 +17,7 @@ export interface StellarGovernanceProposalField {
16
17
  */
17
18
  export declare class StellarGovernanceProposalDoc {
18
19
  dataType: StellarLendingDataType;
20
+ network: StellarNetwork;
19
21
  operationId: string;
20
22
  kind: StellarGovernanceProposalKind;
21
23
  status: StellarGovernanceProposalStatus;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarGovernanceProposalDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * A timelock proposal on the Stellar lending governance contract. Persistence
7
8
  * shape (no swagger decorators); api-v2 owns the response DTO.
@@ -15,7 +16,7 @@ class StellarGovernanceProposalDoc {
15
16
  this.argsXdr = [];
16
17
  this.fields = [];
17
18
  Object.assign(this, props);
18
- this.pk = this.dataType;
19
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
19
20
  this.id = this.operationId;
20
21
  }
21
22
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * Liquidity truth for one asset on one hub (`hubAsset:{hubId}:{asset}`). IRM +
4
5
  * state + derived APY/utilization are event-sourced from the pool contract.
@@ -9,6 +10,7 @@ import { StellarLendingDataType } from '../enums';
9
10
  */
10
11
  export declare class StellarHubAssetDoc {
11
12
  dataType: StellarLendingDataType;
13
+ network: StellarNetwork;
12
14
  hubId: number;
13
15
  asset: string;
14
16
  assetDecimals: number;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarHubAssetDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * Liquidity truth for one asset on one hub (`hubAsset:{hubId}:{asset}`). IRM +
7
8
  * state + derived APY/utilization are event-sourced from the pool contract.
@@ -38,7 +39,7 @@ class StellarHubAssetDoc {
38
39
  this.updatedAt = 0;
39
40
  this.ledger = 0;
40
41
  Object.assign(this, props);
41
- this.pk = this.dataType;
42
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
42
43
  this.id = `hubAsset:${this.hubId}:${this.asset}`;
43
44
  }
44
45
  }
@@ -1,6 +1,8 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  export declare class StellarHubDoc {
3
4
  dataType: StellarLendingDataType;
5
+ network: StellarNetwork;
4
6
  hubId: number;
5
7
  isActive: boolean;
6
8
  name: string | null;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarHubDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  class StellarHubDoc {
6
7
  constructor(props) {
7
8
  this.dataType = enums_1.StellarLendingDataType.HUB;
@@ -11,7 +12,7 @@ class StellarHubDoc {
11
12
  this.updatedAt = 0;
12
13
  this.ledger = 0;
13
14
  Object.assign(this, props);
14
- this.pk = this.dataType;
15
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
15
16
  this.id = `hub:${this.hubId}`;
16
17
  }
17
18
  }
@@ -1,4 +1,5 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * Risk truth for one asset in one spoke on one hub
4
5
  * (`spokeAsset:{spokeId}:{hubId}:{asset}`). LTV, liquidation params, flags, and
@@ -8,6 +9,7 @@ import { StellarLendingDataType } from '../enums';
8
9
  */
9
10
  export declare class StellarSpokeAssetDoc {
10
11
  dataType: StellarLendingDataType;
12
+ network: StellarNetwork;
11
13
  spokeId: number;
12
14
  hubId: number;
13
15
  asset: string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarSpokeAssetDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  /**
6
7
  * Risk truth for one asset in one spoke on one hub
7
8
  * (`spokeAsset:{spokeId}:{hubId}:{asset}`). LTV, liquidation params, flags, and
@@ -29,7 +30,7 @@ class StellarSpokeAssetDoc {
29
30
  this.updatedAt = 0;
30
31
  this.ledger = 0;
31
32
  Object.assign(this, props);
32
- this.pk = this.dataType;
33
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
33
34
  this.id = `spokeAsset:${this.spokeId}:${this.hubId}:${this.asset}`;
34
35
  }
35
36
  }
@@ -1,6 +1,8 @@
1
1
  import { StellarLendingDataType } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  export declare class StellarSpokeDoc {
3
4
  dataType: StellarLendingDataType;
5
+ network: StellarNetwork;
4
6
  spokeId: number;
5
7
  isDeprecated: boolean;
6
8
  name: string | null;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StellarSpokeDoc = void 0;
4
4
  const enums_1 = require("../enums");
5
+ const network_1 = require("../network");
5
6
  class StellarSpokeDoc {
6
7
  constructor(props) {
7
8
  this.dataType = enums_1.StellarLendingDataType.SPOKE;
@@ -15,7 +16,7 @@ class StellarSpokeDoc {
15
16
  this.updatedAt = 0;
16
17
  this.ledger = 0;
17
18
  Object.assign(this, props);
18
- this.pk = this.dataType;
19
+ this.pk = (0, network_1.stellarLendingPartitionKey)(this.network, this.dataType);
19
20
  this.id = `spoke:${this.spokeId}`;
20
21
  }
21
22
  }
@@ -1,4 +1,5 @@
1
1
  export * from './enums';
2
+ export * from './network';
2
3
  export * from './oracle-provider';
3
4
  export * from './documents';
4
5
  export * from './list';
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./enums"), exports);
18
+ __exportStar(require("./network"), exports);
18
19
  __exportStar(require("./oracle-provider"), exports);
19
20
  __exportStar(require("./documents"), exports);
20
21
  __exportStar(require("./list"), exports);
@@ -1,10 +1,12 @@
1
1
  import type { StellarLendingActivity } from '../enums';
2
+ import type { StellarNetwork } from '../network';
2
3
  /**
3
4
  * Dynamic JSON written into the existing `NftActivityData.ActivityData` column
4
5
  * for Stellar-lending activity (`Source='xoxnoLending'`, `Chain='STELLAR'`).
5
6
  * Not a Cosmos document — rides the existing activity → Kusto change-feed.
6
7
  */
7
8
  export interface StellarLendingActivityData {
9
+ network: StellarNetwork;
8
10
  action: StellarLendingActivity;
9
11
  hubId: number;
10
12
  spokeId: number | null;
@@ -21,7 +23,19 @@ export interface StellarLendingActivityData {
21
23
  amountShort: number | null;
22
24
  oraclePrice: number | null;
23
25
  usd: number | null;
26
+ /**
27
+ * Fee in display units on rows where `amount` is a gross principal rather
28
+ * than the fee itself (`position:flash_loan`, `strategy:fee`). Omitted when
29
+ * the asset decimals are unknown — never a fabricated zero.
30
+ */
24
31
  feeShort?: number;
32
+ /**
33
+ * `feeShort` valued at the same `oraclePrice` as `usd`. On a `strategyFee`
34
+ * row `usd` is the strategy's gross principal, NOT protocol revenue — sum
35
+ * `feeUsd` for revenue. Omitted when the asset is unpriced or its decimals
36
+ * are unknown.
37
+ */
38
+ feeUsd?: number;
25
39
  /**
26
40
  * Which side of the position this row mutated (`null` for non-position
27
41
  * events: flash loan, strategy fee, bad-debt header).
@@ -1,3 +1,4 @@
1
+ import type { StellarNetwork } from '../network';
1
2
  /**
2
3
  * ActivityType for Stellar-lending market-state activity rows. Deliberately
3
4
  * DISTINCT from the MVX `lendingUpdateMarketState` so the existing MVX Kusto
@@ -16,6 +17,7 @@ export declare const STELLAR_LENDING_MARKET_STATE_ACTIVITY = "stellarLendingUpda
16
17
  * 27-dec RAY big-int strings.
17
18
  */
18
19
  export interface StellarLendingMarketStateData {
20
+ network: StellarNetwork;
19
21
  hubId: number;
20
22
  spokeId: number | null;
21
23
  token: string;
@@ -0,0 +1,4 @@
1
+ /** Stellar network persisted on every lending document and activity payload. */
2
+ export type StellarNetwork = 'mainnet' | 'testnet';
3
+ /** Scope a shared Cosmos partition to one Stellar network. */
4
+ export declare function stellarLendingPartitionKey(network: StellarNetwork, key: string | number): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stellarLendingPartitionKey = stellarLendingPartitionKey;
4
+ /** Scope a shared Cosmos partition to one Stellar network. */
5
+ function stellarLendingPartitionKey(network, key) {
6
+ if (network !== 'mainnet' && network !== 'testnet') {
7
+ throw new Error('Invalid Stellar network');
8
+ }
9
+ return `${network}:${key}`;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xoxno/types",
3
- "version": "1.0.482",
3
+ "version": "1.0.484",
4
4
  "description": "Shared types and utilities for XOXNO API.",
5
5
  "exports": {
6
6
  ".": {