@oobe-protocol-labs/sap-mcp-server 0.9.36 → 0.9.38
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/.env.example +14 -0
- package/CHANGELOG.md +101 -0
- package/README.md +3 -3
- package/USER_DOCS/01_HOSTED_REMOTE_MCP.md +1 -1
- package/USER_DOCS/04_CLIENT_CONFIGS.md +3 -3
- package/USER_DOCS/06_DESKTOP_GUI_WIZARD.md +5 -5
- package/dist/config/env.d.ts +32 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +24 -1
- package/dist/config/env.js.map +1 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/constants.js +1 -1
- package/dist/core/logger.js +1 -1
- package/dist/payments/monetization-gate.d.ts.map +1 -1
- package/dist/payments/monetization-gate.js +4 -0
- package/dist/payments/monetization-gate.js.map +1 -1
- package/dist/payments/pricing.d.ts.map +1 -1
- package/dist/payments/pricing.js +39 -1
- package/dist/payments/pricing.js.map +1 -1
- package/dist/perps/adrena/adrena-builder.d.ts +301 -0
- package/dist/perps/adrena/adrena-builder.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder.js +1148 -0
- package/dist/perps/adrena/adrena-builder.js.map +1 -0
- package/dist/perps/adrena/adrena-constants.d.ts +135 -0
- package/dist/perps/adrena/adrena-constants.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-constants.js +100 -0
- package/dist/perps/adrena/adrena-constants.js.map +1 -0
- package/dist/perps/adrena/adrena-data-api.d.ts +180 -0
- package/dist/perps/adrena/adrena-data-api.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-data-api.js +169 -0
- package/dist/perps/adrena/adrena-data-api.js.map +1 -0
- package/dist/perps/adrena/adrena-pda.d.ts +146 -0
- package/dist/perps/adrena/adrena-pda.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-pda.js +215 -0
- package/dist/perps/adrena/adrena-pda.js.map +1 -0
- package/dist/perps/adrena/index.d.ts +11 -0
- package/dist/perps/adrena/index.d.ts.map +1 -0
- package/dist/perps/adrena/index.js +11 -0
- package/dist/perps/adrena/index.js.map +1 -0
- package/dist/server/server-metadata.d.ts +2 -0
- package/dist/server/server-metadata.d.ts.map +1 -1
- package/dist/server/server-metadata.js +3 -1
- package/dist/server/server-metadata.js.map +1 -1
- package/dist/tools/adrena-tools.d.ts +67 -0
- package/dist/tools/adrena-tools.d.ts.map +1 -0
- package/dist/tools/adrena-tools.js +1062 -0
- package/dist/tools/adrena-tools.js.map +1 -0
- package/dist/tools/client-sdk-tools.d.ts +15 -0
- package/dist/tools/client-sdk-tools.d.ts.map +1 -1
- package/dist/tools/client-sdk-tools.js +63 -8
- package/dist/tools/client-sdk-tools.js.map +1 -1
- package/dist/tools/estimate-tool-cost.d.ts.map +1 -1
- package/dist/tools/estimate-tool-cost.js +16 -61
- package/dist/tools/estimate-tool-cost.js.map +1 -1
- package/dist/tools/perp-tools.d.ts +150 -7
- package/dist/tools/perp-tools.d.ts.map +1 -1
- package/dist/tools/perp-tools.js +787 -212
- package/dist/tools/perp-tools.js.map +1 -1
- package/dist/tools/quick-context-tool.js +1 -0
- package/dist/tools/quick-context-tool.js.map +1 -1
- package/dist/tools/register-tools.d.ts.map +1 -1
- package/dist/tools/register-tools.js +4 -0
- package/dist/tools/register-tools.js.map +1 -1
- package/docs/07_ENDPOINTS_AND_CLIENTS.md +1 -1
- package/docs/10_OPERATIONS_RELEASE_AND_PM2.md +54 -6
- package/docs/14_DESKTOP_WIZARD_RELEASE.md +3 -3
- package/docs/BRANCH_AND_CI.md +2 -2
- package/package.json +3 -3
- package/server.json +3 -3
- package/skills/sap-defi/SKILL.md +93 -22
- package/skills/sap-mcp/TOOL_REFERENCE.md +39 -4
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/adrena-data-api
|
|
3
|
+
* @description REST client for the Adrena Data API (datapi.adrena.trade).
|
|
4
|
+
*
|
|
5
|
+
* Provides off-chain analytics: position history, pool statistics, custody
|
|
6
|
+
* stats, trader leaderboards, mutagen points, and oracle prices.
|
|
7
|
+
*
|
|
8
|
+
* This is a pure REST client — no SDK runtime dependency required.
|
|
9
|
+
*
|
|
10
|
+
* @module perps/adrena/adrena-data-api
|
|
11
|
+
*/
|
|
12
|
+
import { ADRENA_DATA_API_BASE_URL } from './adrena-constants.js';
|
|
13
|
+
/** Fetch timeout for Adrena Data API calls (ms). */
|
|
14
|
+
const DATA_API_TIMEOUT_MS = 10_000;
|
|
15
|
+
// ─── Client ──────────────────────────────────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* Adrena Data API client.
|
|
18
|
+
* Wraps the REST endpoints at datapi.adrena.trade.
|
|
19
|
+
*/
|
|
20
|
+
export class AdrenaDataApiClient {
|
|
21
|
+
baseUrl;
|
|
22
|
+
/**
|
|
23
|
+
* @param baseUrl — Base URL for the Adrena Data API. Defaults to datapi.adrena.trade.
|
|
24
|
+
*/
|
|
25
|
+
constructor(baseUrl = ADRENA_DATA_API_BASE_URL) {
|
|
26
|
+
this.baseUrl = baseUrl.replace(/\/$/, '');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fetch JSON from the Adrena Data API with timeout.
|
|
30
|
+
* @param path — API path (e.g. "/positions").
|
|
31
|
+
* @param params — Query parameters.
|
|
32
|
+
* @returns Parsed JSON response or null on error.
|
|
33
|
+
*/
|
|
34
|
+
async fetchJson(path, params) {
|
|
35
|
+
try {
|
|
36
|
+
const url = new URL(this.baseUrl + path);
|
|
37
|
+
if (params) {
|
|
38
|
+
for (const [key, value] of Object.entries(params)) {
|
|
39
|
+
if (value)
|
|
40
|
+
url.searchParams.set(key, value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const controller = new AbortController();
|
|
44
|
+
const timeout = setTimeout(() => controller.abort(), DATA_API_TIMEOUT_MS);
|
|
45
|
+
const response = await fetch(url.toString(), {
|
|
46
|
+
signal: controller.signal,
|
|
47
|
+
headers: { Accept: 'application/json' },
|
|
48
|
+
});
|
|
49
|
+
clearTimeout(timeout);
|
|
50
|
+
if (!response.ok)
|
|
51
|
+
return null;
|
|
52
|
+
return await response.json();
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get position history for a wallet.
|
|
60
|
+
* @param userWallet — Wallet public key.
|
|
61
|
+
* @returns Array of position records.
|
|
62
|
+
*/
|
|
63
|
+
async getPositions(userWallet) {
|
|
64
|
+
return this.fetchJson('/positions', { userWallet });
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get latest pool statistics.
|
|
68
|
+
* @param poolName — Optional pool name filter.
|
|
69
|
+
* @returns Pool info object.
|
|
70
|
+
*/
|
|
71
|
+
async getPoolInfo(poolName) {
|
|
72
|
+
return this.fetchJson('/pool-info', poolName ? { poolName } : undefined);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get hourly pool statistics.
|
|
76
|
+
* @returns Array of hourly pool info.
|
|
77
|
+
*/
|
|
78
|
+
async getHourlyPoolInfo() {
|
|
79
|
+
return this.fetchJson('/pool-info/hourly');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get daily pool statistics.
|
|
83
|
+
* @returns Array of daily pool info.
|
|
84
|
+
*/
|
|
85
|
+
async getDailyPoolInfo() {
|
|
86
|
+
return this.fetchJson('/pool-info/daily');
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get per-asset custody statistics.
|
|
90
|
+
* @param symbol — Optional symbol filter.
|
|
91
|
+
* @returns Array of custody info.
|
|
92
|
+
*/
|
|
93
|
+
async getCustodyInfo(symbol) {
|
|
94
|
+
return this.fetchJson('/custody-info', symbol ? { symbol } : undefined);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get hourly custody statistics.
|
|
98
|
+
* @returns Array of hourly custody info.
|
|
99
|
+
*/
|
|
100
|
+
async getHourlyCustodyInfo() {
|
|
101
|
+
return this.fetchJson('/custody-info/hourly');
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get daily custody statistics.
|
|
105
|
+
* @returns Array of daily custody info.
|
|
106
|
+
*/
|
|
107
|
+
async getDailyCustodyInfo() {
|
|
108
|
+
return this.fetchJson('/custody-info/daily');
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Get trader info for a wallet.
|
|
112
|
+
* @param userPubkey — Trader wallet public key.
|
|
113
|
+
* @returns Trader info object.
|
|
114
|
+
*/
|
|
115
|
+
async getTraderInfo(userPubkey) {
|
|
116
|
+
return this.fetchJson('/trader-info', { userPubkey });
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get trader leaderboard.
|
|
120
|
+
* @param limit — Optional limit.
|
|
121
|
+
* @returns Array of trader profiles.
|
|
122
|
+
*/
|
|
123
|
+
async getTraderProfiles(limit) {
|
|
124
|
+
return this.fetchJson('/trader-profiles', limit ? { limit: String(limit) } : undefined);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get trader volume history.
|
|
128
|
+
* @param userWallet — Trader wallet public key.
|
|
129
|
+
* @returns Volume data.
|
|
130
|
+
*/
|
|
131
|
+
async getTraderVolume(userWallet) {
|
|
132
|
+
return this.fetchJson('/trader-volume', { userWallet });
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Get mutagen points for a wallet.
|
|
136
|
+
* @param userWallet — Wallet public key.
|
|
137
|
+
* @returns Mutagen info.
|
|
138
|
+
*/
|
|
139
|
+
async getMutagen(userWallet) {
|
|
140
|
+
return this.fetchJson('/mutagen', { userWallet });
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get mutagen leaderboard.
|
|
144
|
+
* @param limit — Optional limit.
|
|
145
|
+
* @returns Array of mutagen entries.
|
|
146
|
+
*/
|
|
147
|
+
async getMutagenLeaderboard(limit) {
|
|
148
|
+
return this.fetchJson('/mutagen/leaderboard', limit ? { limit: String(limit) } : undefined);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get ADX and ALP token prices.
|
|
152
|
+
* @returns Price info.
|
|
153
|
+
*/
|
|
154
|
+
async getPrice() {
|
|
155
|
+
return this.fetchJson('/price');
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get latest oracle trading prices for all assets.
|
|
159
|
+
* @returns Array of trading prices.
|
|
160
|
+
*/
|
|
161
|
+
async getLastTradingPrices() {
|
|
162
|
+
return this.fetchJson('/last-trading-prices');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Default Adrena Data API client instance.
|
|
167
|
+
*/
|
|
168
|
+
export const adrenaDataApi = new AdrenaDataApiClient();
|
|
169
|
+
//# sourceMappingURL=adrena-data-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrena-data-api.js","sourceRoot":"","sources":["../../../src/perps/adrena/adrena-data-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,oDAAoD;AACpD,MAAM,mBAAmB,GAAG,MAAM,CAAC;AA+EnC,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IACb,OAAO,CAAS;IAEjC;;OAEG;IACH,YAAY,UAAkB,wBAAwB;QACpD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,SAAS,CAAI,IAAY,EAAE,MAA2C;QAClF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACzC,IAAI,MAAM,EAAE,CAAC;gBACX,KAAK,MAAM,CAAC,GAAG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B,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACnH,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,SAAS,CAAkB,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,oBAAoB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAuB,sBAAsB,CAAC,CAAC;IACtE,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/adrena-pda
|
|
3
|
+
* @description PDA derivation helpers for the Adrena protocol on Solana.
|
|
4
|
+
*
|
|
5
|
+
* All PDAs are derived from the official Adrena release/39 ABI layout using
|
|
6
|
+
* `@solana/web3.js` `PublicKey.findProgramAddressSync`.
|
|
7
|
+
*
|
|
8
|
+
* @module perps/adrena/adrena-pda
|
|
9
|
+
*/
|
|
10
|
+
import { PublicKey } from '@solana/web3.js';
|
|
11
|
+
/**
|
|
12
|
+
* Derive the Cortex PDA: [Buffer.from("cortex")].
|
|
13
|
+
* @returns Cortex public key.
|
|
14
|
+
*/
|
|
15
|
+
export declare function deriveCortexPda(): PublicKey;
|
|
16
|
+
/**
|
|
17
|
+
* Derive a Pool PDA from a pool address: [Buffer.from("pool"), poolAddress].
|
|
18
|
+
* Note: Adrena pools are existing accounts, not PDAs in most instructions.
|
|
19
|
+
* The Pool PDA is used for named pools where the seed is the pool name.
|
|
20
|
+
* @param poolName — Pool name bytes (e.g. "main-pool").
|
|
21
|
+
* @returns Pool PDA public key.
|
|
22
|
+
*/
|
|
23
|
+
export declare function derivePoolPdaFromName(poolName: string): PublicKey;
|
|
24
|
+
/**
|
|
25
|
+
* Derive a Custody PDA: [Buffer.from("custody"), pool, seed].
|
|
26
|
+
* @param pool — Pool public key.
|
|
27
|
+
* @param seed — Custody seed (u32 little-endian, 4 bytes).
|
|
28
|
+
* @returns Custody PDA public key.
|
|
29
|
+
*/
|
|
30
|
+
export declare function deriveCustodyPda(pool: PublicKey, seed: Buffer): PublicKey;
|
|
31
|
+
/**
|
|
32
|
+
* Derive a custody token account PDA: [Buffer.from("custody_token_account"), custody].
|
|
33
|
+
* @param custody — Custody public key.
|
|
34
|
+
* @returns Custody token account public key.
|
|
35
|
+
*/
|
|
36
|
+
export declare function deriveCustodyTokenAccountPda(custody: PublicKey): PublicKey;
|
|
37
|
+
/**
|
|
38
|
+
* Derive the Oracle PDA: [Buffer.from("oracle")].
|
|
39
|
+
* @returns Oracle public key.
|
|
40
|
+
*/
|
|
41
|
+
export declare function deriveOraclePda(): PublicKey;
|
|
42
|
+
/**
|
|
43
|
+
* Derive the transfer authority PDA: [Buffer.from("transfer_authority")].
|
|
44
|
+
* @returns Transfer authority public key.
|
|
45
|
+
*/
|
|
46
|
+
export declare function deriveTransferAuthorityPda(): PublicKey;
|
|
47
|
+
/**
|
|
48
|
+
* Derive a user profile PDA: [Buffer.from("user_profile"), owner].
|
|
49
|
+
* @param owner — Owner wallet public key.
|
|
50
|
+
* @returns User profile PDA public key.
|
|
51
|
+
*/
|
|
52
|
+
export declare function deriveUserProfilePda(owner: PublicKey): PublicKey;
|
|
53
|
+
/**
|
|
54
|
+
* Derive a Position PDA: [Buffer.from("position"), owner, pool, custody, side].
|
|
55
|
+
* The side byte is 0 for long, 1 for short.
|
|
56
|
+
* @param owner — Owner wallet public key.
|
|
57
|
+
* @param pool — Pool public key.
|
|
58
|
+
* @param custody — Custody (principal) public key.
|
|
59
|
+
* @param side — Position side: 'long' | 'short'.
|
|
60
|
+
* @returns Position PDA public key.
|
|
61
|
+
*/
|
|
62
|
+
export declare function derivePositionPda(owner: PublicKey, pool: PublicKey, custody: PublicKey, side: 'long' | 'short'): PublicKey;
|
|
63
|
+
/**
|
|
64
|
+
* Derive a limit order book PDA: [Buffer.from("limit_order_book"), owner, pool].
|
|
65
|
+
* @param owner — Owner wallet public key.
|
|
66
|
+
* @param pool — Pool public key.
|
|
67
|
+
* @returns Limit order book PDA public key.
|
|
68
|
+
*/
|
|
69
|
+
export declare function deriveLimitOrderBookPda(owner: PublicKey, pool: PublicKey): PublicKey;
|
|
70
|
+
/**
|
|
71
|
+
* Derive a collateral escrow PDA: [Buffer.from("escrow_account"), owner, pool, collateralCustody].
|
|
72
|
+
* @param owner — Owner wallet public key.
|
|
73
|
+
* @param pool — Pool public key.
|
|
74
|
+
* @param collateralCustody — Collateral custody public key.
|
|
75
|
+
* @returns Collateral escrow PDA public key.
|
|
76
|
+
*/
|
|
77
|
+
export declare function deriveCollateralEscrowPda(owner: PublicKey, pool: PublicKey, collateralCustody: PublicKey): PublicKey;
|
|
78
|
+
/**
|
|
79
|
+
* Derive LP token mint PDA: [Buffer.from("lp_token_mint"), pool].
|
|
80
|
+
* @param pool — Pool public key.
|
|
81
|
+
* @returns LP token mint PDA public key.
|
|
82
|
+
*/
|
|
83
|
+
export declare function deriveLpTokenMintPda(pool: PublicKey): PublicKey;
|
|
84
|
+
/**
|
|
85
|
+
* Derive staking PDA: [Buffer.from("staking"), stakingSeed].
|
|
86
|
+
* The staking seed is the LP token mint for LP staking, or the governance token mint for ADX staking.
|
|
87
|
+
* @param stakingSeed — Staking seed public key (e.g. LP token mint).
|
|
88
|
+
* @returns Staking PDA public key.
|
|
89
|
+
*/
|
|
90
|
+
export declare function deriveStakingPda(stakingSeed: PublicKey): PublicKey;
|
|
91
|
+
/**
|
|
92
|
+
* Derive user staking PDA: [Buffer.from("user_staking"), owner, staking].
|
|
93
|
+
* @param owner — Owner wallet public key.
|
|
94
|
+
* @param staking — Staking PDA public key.
|
|
95
|
+
* @returns User staking PDA public key.
|
|
96
|
+
*/
|
|
97
|
+
export declare function deriveUserStakingPda(owner: PublicKey, staking: PublicKey): PublicKey;
|
|
98
|
+
/**
|
|
99
|
+
* Derive genesis lock PDA: [Buffer.from("genesis_lock"), pool].
|
|
100
|
+
* @param pool — Pool public key.
|
|
101
|
+
* @returns Genesis lock PDA public key.
|
|
102
|
+
*/
|
|
103
|
+
export declare function deriveGenesisLockPda(pool: PublicKey): PublicKey;
|
|
104
|
+
/**
|
|
105
|
+
* Derive LM token treasury PDA: [Buffer.from("lm_token_treasury"), cortex].
|
|
106
|
+
* @param cortex — Cortex PDA public key.
|
|
107
|
+
* @returns LM token treasury PDA public key.
|
|
108
|
+
*/
|
|
109
|
+
export declare function deriveLmTokenTreasuryPda(cortex: PublicKey): PublicKey;
|
|
110
|
+
/**
|
|
111
|
+
* Derive LM token mint PDA: [Buffer.from("lm_token_mint")].
|
|
112
|
+
* @returns LM token mint PDA public key.
|
|
113
|
+
*/
|
|
114
|
+
export declare function deriveLmTokenMintPda(): PublicKey;
|
|
115
|
+
/**
|
|
116
|
+
* Derive governance token mint PDA: [Buffer.from("governance_token_mint")].
|
|
117
|
+
* @returns Governance token mint PDA public key.
|
|
118
|
+
*/
|
|
119
|
+
export declare function deriveGovernanceTokenMintPda(): PublicKey;
|
|
120
|
+
/**
|
|
121
|
+
* Derive staking staked token vault PDA: [Buffer.from("staking_staked_token_vault"), staking].
|
|
122
|
+
* @param staking — Staking PDA public key.
|
|
123
|
+
* @returns Staking staked token vault PDA public key.
|
|
124
|
+
*/
|
|
125
|
+
export declare function deriveStakingStakedTokenVaultPda(staking: PublicKey): PublicKey;
|
|
126
|
+
/**
|
|
127
|
+
* Derive staking reward token vault PDA: [Buffer.from("staking_reward_token_vault"), staking].
|
|
128
|
+
* @param staking — Staking PDA public key.
|
|
129
|
+
* @returns Staking reward token vault PDA public key.
|
|
130
|
+
*/
|
|
131
|
+
export declare function deriveStakingRewardTokenVaultPda(staking: PublicKey): PublicKey;
|
|
132
|
+
/**
|
|
133
|
+
* Derive staking LM reward token vault PDA: [Buffer.from("staking_lm_reward_token_vault"), staking].
|
|
134
|
+
* @param staking — Staking PDA public key.
|
|
135
|
+
* @returns Staking LM reward token vault PDA public key.
|
|
136
|
+
*/
|
|
137
|
+
export declare function deriveStakingLmRewardTokenVaultPda(staking: PublicKey): PublicKey;
|
|
138
|
+
/**
|
|
139
|
+
* Derive the associated token account address for a wallet and mint.
|
|
140
|
+
* Uses the SPL Associated Token Account program.
|
|
141
|
+
* @param owner — Wallet public key.
|
|
142
|
+
* @param mint — Token mint public key.
|
|
143
|
+
* @returns ATA public key.
|
|
144
|
+
*/
|
|
145
|
+
export declare function deriveAta(owner: PublicKey, mint: PublicKey): PublicKey;
|
|
146
|
+
//# sourceMappingURL=adrena-pda.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrena-pda.d.ts","sourceRoot":"","sources":["../../../src/perps/adrena/adrena-pda.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA2B5C;;;GAGG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAG3C;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAG1E;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,SAAS,CAG3C;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,SAAS,CAGtD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAGhE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,SAAS,EAClB,IAAI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|
3
|
+
* @description PDA derivation helpers for the Adrena protocol on Solana.
|
|
4
|
+
*
|
|
5
|
+
* All PDAs are derived from the official Adrena release/39 ABI layout using
|
|
6
|
+
* `@solana/web3.js` `PublicKey.findProgramAddressSync`.
|
|
7
|
+
*
|
|
8
|
+
* @module perps/adrena/adrena-pda
|
|
9
|
+
*/
|
|
10
|
+
import { PublicKey } from '@solana/web3.js';
|
|
11
|
+
import { ADRENA_PROGRAM_ID, CORTEX_SEED, POOL_SEED, CUSTODY_SEED, CUSTODY_TOKEN_ACCOUNT_SEED, ORACLE_SEED, TRANSFER_AUTHORITY_SEED, USER_PROFILE_SEED, LIMIT_ORDER_BOOK_SEED, ESCROW_ACCOUNT_SEED, LP_TOKEN_MINT_SEED, STAKING_SEED, USER_STAKING_SEED, GENESIS_LOCK_SEED, LM_TOKEN_TREASURY_SEED, LM_TOKEN_MINT_SEED, GOVERNANCE_TOKEN_MINT_SEED, STAKING_STAKED_TOKEN_VAULT_SEED, STAKING_REWARD_TOKEN_VAULT_SEED, STAKING_LM_REWARD_TOKEN_VAULT_SEED, } from './adrena-constants.js';
|
|
12
|
+
/** Adrena program public key. */
|
|
13
|
+
const PROGRAM = new PublicKey(ADRENA_PROGRAM_ID);
|
|
14
|
+
/**
|
|
15
|
+
* Derive the Cortex PDA: [Buffer.from("cortex")].
|
|
16
|
+
* @returns Cortex public key.
|
|
17
|
+
*/
|
|
18
|
+
export function deriveCortexPda() {
|
|
19
|
+
const [pda] = PublicKey.findProgramAddressSync([CORTEX_SEED], PROGRAM);
|
|
20
|
+
return pda;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Derive a Pool PDA from a pool address: [Buffer.from("pool"), poolAddress].
|
|
24
|
+
* Note: Adrena pools are existing accounts, not PDAs in most instructions.
|
|
25
|
+
* The Pool PDA is used for named pools where the seed is the pool name.
|
|
26
|
+
* @param poolName — Pool name bytes (e.g. "main-pool").
|
|
27
|
+
* @returns Pool PDA public key.
|
|
28
|
+
*/
|
|
29
|
+
export function derivePoolPdaFromName(poolName) {
|
|
30
|
+
const [pda] = PublicKey.findProgramAddressSync([POOL_SEED, Buffer.from(poolName, 'utf8')], PROGRAM);
|
|
31
|
+
return pda;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Derive a Custody PDA: [Buffer.from("custody"), pool, seed].
|
|
35
|
+
* @param pool — Pool public key.
|
|
36
|
+
* @param seed — Custody seed (u32 little-endian, 4 bytes).
|
|
37
|
+
* @returns Custody PDA public key.
|
|
38
|
+
*/
|
|
39
|
+
export function deriveCustodyPda(pool, seed) {
|
|
40
|
+
const [pda] = PublicKey.findProgramAddressSync([CUSTODY_SEED, pool.toBuffer(), seed], PROGRAM);
|
|
41
|
+
return pda;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Derive a custody token account PDA: [Buffer.from("custody_token_account"), custody].
|
|
45
|
+
* @param custody — Custody public key.
|
|
46
|
+
* @returns Custody token account public key.
|
|
47
|
+
*/
|
|
48
|
+
export function deriveCustodyTokenAccountPda(custody) {
|
|
49
|
+
const [pda] = PublicKey.findProgramAddressSync([CUSTODY_TOKEN_ACCOUNT_SEED, custody.toBuffer()], PROGRAM);
|
|
50
|
+
return pda;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Derive the Oracle PDA: [Buffer.from("oracle")].
|
|
54
|
+
* @returns Oracle public key.
|
|
55
|
+
*/
|
|
56
|
+
export function deriveOraclePda() {
|
|
57
|
+
const [pda] = PublicKey.findProgramAddressSync([ORACLE_SEED], PROGRAM);
|
|
58
|
+
return pda;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Derive the transfer authority PDA: [Buffer.from("transfer_authority")].
|
|
62
|
+
* @returns Transfer authority public key.
|
|
63
|
+
*/
|
|
64
|
+
export function deriveTransferAuthorityPda() {
|
|
65
|
+
const [pda] = PublicKey.findProgramAddressSync([TRANSFER_AUTHORITY_SEED], PROGRAM);
|
|
66
|
+
return pda;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Derive a user profile PDA: [Buffer.from("user_profile"), owner].
|
|
70
|
+
* @param owner — Owner wallet public key.
|
|
71
|
+
* @returns User profile PDA public key.
|
|
72
|
+
*/
|
|
73
|
+
export function deriveUserProfilePda(owner) {
|
|
74
|
+
const [pda] = PublicKey.findProgramAddressSync([USER_PROFILE_SEED, owner.toBuffer()], PROGRAM);
|
|
75
|
+
return pda;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Derive a Position PDA: [Buffer.from("position"), owner, pool, custody, side].
|
|
79
|
+
* The side byte is 0 for long, 1 for short.
|
|
80
|
+
* @param owner — Owner wallet public key.
|
|
81
|
+
* @param pool — Pool public key.
|
|
82
|
+
* @param custody — Custody (principal) public key.
|
|
83
|
+
* @param side — Position side: 'long' | 'short'.
|
|
84
|
+
* @returns Position PDA public key.
|
|
85
|
+
*/
|
|
86
|
+
export function derivePositionPda(owner, pool, custody, side) {
|
|
87
|
+
const sideByte = Buffer.from([side === 'long' ? 0 : 1]);
|
|
88
|
+
const [pda] = PublicKey.findProgramAddressSync([Buffer.from('position', 'ascii'), owner.toBuffer(), pool.toBuffer(), custody.toBuffer(), sideByte], PROGRAM);
|
|
89
|
+
return pda;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Derive a limit order book PDA: [Buffer.from("limit_order_book"), owner, pool].
|
|
93
|
+
* @param owner — Owner wallet public key.
|
|
94
|
+
* @param pool — Pool public key.
|
|
95
|
+
* @returns Limit order book PDA public key.
|
|
96
|
+
*/
|
|
97
|
+
export function deriveLimitOrderBookPda(owner, pool) {
|
|
98
|
+
const [pda] = PublicKey.findProgramAddressSync([LIMIT_ORDER_BOOK_SEED, owner.toBuffer(), pool.toBuffer()], PROGRAM);
|
|
99
|
+
return pda;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Derive a collateral escrow PDA: [Buffer.from("escrow_account"), owner, pool, collateralCustody].
|
|
103
|
+
* @param owner — Owner wallet public key.
|
|
104
|
+
* @param pool — Pool public key.
|
|
105
|
+
* @param collateralCustody — Collateral custody public key.
|
|
106
|
+
* @returns Collateral escrow PDA public key.
|
|
107
|
+
*/
|
|
108
|
+
export function deriveCollateralEscrowPda(owner, pool, collateralCustody) {
|
|
109
|
+
const [pda] = PublicKey.findProgramAddressSync([ESCROW_ACCOUNT_SEED, owner.toBuffer(), pool.toBuffer(), collateralCustody.toBuffer()], PROGRAM);
|
|
110
|
+
return pda;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Derive LP token mint PDA: [Buffer.from("lp_token_mint"), pool].
|
|
114
|
+
* @param pool — Pool public key.
|
|
115
|
+
* @returns LP token mint PDA public key.
|
|
116
|
+
*/
|
|
117
|
+
export function deriveLpTokenMintPda(pool) {
|
|
118
|
+
const [pda] = PublicKey.findProgramAddressSync([LP_TOKEN_MINT_SEED, pool.toBuffer()], PROGRAM);
|
|
119
|
+
return pda;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Derive staking PDA: [Buffer.from("staking"), stakingSeed].
|
|
123
|
+
* The staking seed is the LP token mint for LP staking, or the governance token mint for ADX staking.
|
|
124
|
+
* @param stakingSeed — Staking seed public key (e.g. LP token mint).
|
|
125
|
+
* @returns Staking PDA public key.
|
|
126
|
+
*/
|
|
127
|
+
export function deriveStakingPda(stakingSeed) {
|
|
128
|
+
const [pda] = PublicKey.findProgramAddressSync([STAKING_SEED, stakingSeed.toBuffer()], PROGRAM);
|
|
129
|
+
return pda;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Derive user staking PDA: [Buffer.from("user_staking"), owner, staking].
|
|
133
|
+
* @param owner — Owner wallet public key.
|
|
134
|
+
* @param staking — Staking PDA public key.
|
|
135
|
+
* @returns User staking PDA public key.
|
|
136
|
+
*/
|
|
137
|
+
export function deriveUserStakingPda(owner, staking) {
|
|
138
|
+
const [pda] = PublicKey.findProgramAddressSync([USER_STAKING_SEED, owner.toBuffer(), staking.toBuffer()], PROGRAM);
|
|
139
|
+
return pda;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Derive genesis lock PDA: [Buffer.from("genesis_lock"), pool].
|
|
143
|
+
* @param pool — Pool public key.
|
|
144
|
+
* @returns Genesis lock PDA public key.
|
|
145
|
+
*/
|
|
146
|
+
export function deriveGenesisLockPda(pool) {
|
|
147
|
+
const [pda] = PublicKey.findProgramAddressSync([GENESIS_LOCK_SEED, pool.toBuffer()], PROGRAM);
|
|
148
|
+
return pda;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Derive LM token treasury PDA: [Buffer.from("lm_token_treasury"), cortex].
|
|
152
|
+
* @param cortex — Cortex PDA public key.
|
|
153
|
+
* @returns LM token treasury PDA public key.
|
|
154
|
+
*/
|
|
155
|
+
export function deriveLmTokenTreasuryPda(cortex) {
|
|
156
|
+
const [pda] = PublicKey.findProgramAddressSync([LM_TOKEN_TREASURY_SEED, cortex.toBuffer()], PROGRAM);
|
|
157
|
+
return pda;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Derive LM token mint PDA: [Buffer.from("lm_token_mint")].
|
|
161
|
+
* @returns LM token mint PDA public key.
|
|
162
|
+
*/
|
|
163
|
+
export function deriveLmTokenMintPda() {
|
|
164
|
+
const [pda] = PublicKey.findProgramAddressSync([LM_TOKEN_MINT_SEED], PROGRAM);
|
|
165
|
+
return pda;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Derive governance token mint PDA: [Buffer.from("governance_token_mint")].
|
|
169
|
+
* @returns Governance token mint PDA public key.
|
|
170
|
+
*/
|
|
171
|
+
export function deriveGovernanceTokenMintPda() {
|
|
172
|
+
const [pda] = PublicKey.findProgramAddressSync([GOVERNANCE_TOKEN_MINT_SEED], PROGRAM);
|
|
173
|
+
return pda;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Derive staking staked token vault PDA: [Buffer.from("staking_staked_token_vault"), staking].
|
|
177
|
+
* @param staking — Staking PDA public key.
|
|
178
|
+
* @returns Staking staked token vault PDA public key.
|
|
179
|
+
*/
|
|
180
|
+
export function deriveStakingStakedTokenVaultPda(staking) {
|
|
181
|
+
const [pda] = PublicKey.findProgramAddressSync([STAKING_STAKED_TOKEN_VAULT_SEED, staking.toBuffer()], PROGRAM);
|
|
182
|
+
return pda;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Derive staking reward token vault PDA: [Buffer.from("staking_reward_token_vault"), staking].
|
|
186
|
+
* @param staking — Staking PDA public key.
|
|
187
|
+
* @returns Staking reward token vault PDA public key.
|
|
188
|
+
*/
|
|
189
|
+
export function deriveStakingRewardTokenVaultPda(staking) {
|
|
190
|
+
const [pda] = PublicKey.findProgramAddressSync([STAKING_REWARD_TOKEN_VAULT_SEED, staking.toBuffer()], PROGRAM);
|
|
191
|
+
return pda;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Derive staking LM reward token vault PDA: [Buffer.from("staking_lm_reward_token_vault"), staking].
|
|
195
|
+
* @param staking — Staking PDA public key.
|
|
196
|
+
* @returns Staking LM reward token vault PDA public key.
|
|
197
|
+
*/
|
|
198
|
+
export function deriveStakingLmRewardTokenVaultPda(staking) {
|
|
199
|
+
const [pda] = PublicKey.findProgramAddressSync([STAKING_LM_REWARD_TOKEN_VAULT_SEED, staking.toBuffer()], PROGRAM);
|
|
200
|
+
return pda;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Derive the associated token account address for a wallet and mint.
|
|
204
|
+
* Uses the SPL Associated Token Account program.
|
|
205
|
+
* @param owner — Wallet public key.
|
|
206
|
+
* @param mint — Token mint public key.
|
|
207
|
+
* @returns ATA public key.
|
|
208
|
+
*/
|
|
209
|
+
export function deriveAta(owner, mint) {
|
|
210
|
+
const ASSOCIATED_TOKEN_PROGRAM = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
|
|
211
|
+
const TOKEN_PROGRAM = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA');
|
|
212
|
+
const [pda] = PublicKey.findProgramAddressSync([Buffer.from('AssociatedTokenAddress', 'ascii'), owner.toBuffer(), TOKEN_PROGRAM.toBuffer(), mint.toBuffer()], ASSOCIATED_TOKEN_PROGRAM);
|
|
213
|
+
return pda;
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=adrena-pda.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrena-pda.js","sourceRoot":"","sources":["../../../src/perps/adrena/adrena-pda.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,YAAY,EACZ,0BAA0B,EAC1B,WAAW,EACX,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,EAC/B,kCAAkC,GACnC,MAAM,uBAAuB,CAAC;AAE/B,iCAAiC;AACjC,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IACvE,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAgB;IACpD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,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AAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/index
|
|
3
|
+
* @description Barrel export for the Adrena perps integration module.
|
|
4
|
+
*
|
|
5
|
+
* @module perps/adrena/index
|
|
6
|
+
*/
|
|
7
|
+
export * from './adrena-constants.js';
|
|
8
|
+
export * from './adrena-pda.js';
|
|
9
|
+
export * from './adrena-builder.js';
|
|
10
|
+
export * from './adrena-data-api.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/perps/adrena/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/index
|
|
3
|
+
* @description Barrel export for the Adrena perps integration module.
|
|
4
|
+
*
|
|
5
|
+
* @module perps/adrena/index
|
|
6
|
+
*/
|
|
7
|
+
export * from './adrena-constants.js';
|
|
8
|
+
export * from './adrena-pda.js';
|
|
9
|
+
export * from './adrena-builder.js';
|
|
10
|
+
export * from './adrena-data-api.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/perps/adrena/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-metadata.d.ts","sourceRoot":"","sources":["../../src/server/server-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;CAW3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"server-metadata.d.ts","sourceRoot":"","sources":["../../src/server/server-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;CAW3B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;CAmBxB,CAAC"}
|
|
@@ -48,7 +48,7 @@ export const SERVER_METADATA = {
|
|
|
48
48
|
*/
|
|
49
49
|
export const CAPABILITIES = {
|
|
50
50
|
tools: {
|
|
51
|
-
count:
|
|
51
|
+
count: 361,
|
|
52
52
|
categories: {
|
|
53
53
|
sap: 75,
|
|
54
54
|
sns: 13,
|
|
@@ -61,6 +61,8 @@ export const CAPABILITIES = {
|
|
|
61
61
|
chat: 8,
|
|
62
62
|
premium: 17,
|
|
63
63
|
quickContext: 1,
|
|
64
|
+
perps: 9,
|
|
65
|
+
adrena: 32,
|
|
64
66
|
},
|
|
65
67
|
},
|
|
66
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-metadata.js","sourceRoot":"","sources":["../../src/server/server-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;IACvB,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EAAE,sBAAsB;IACnC,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,sBAAsB;IAChC,UAAU,EAAE,0CAA0C;IACtD,IAAI,EAAE,iDAAiD;IACvD,IAAI,EAAE,mBAAmB;CAC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK,EAAE;QACL,KAAK,EAAE,GAAG;QACV,UAAU,EAAE;YACV,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;YACP,QAAQ,EAAE,GAAG;YACb,gBAAgB,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"server-metadata.js","sourceRoot":"","sources":["../../src/server/server-metadata.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,gBAAgB;IACvB,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EAAE,sBAAsB;IACnC,MAAM,EAAE,oBAAoB;IAC5B,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,sBAAsB;IAChC,UAAU,EAAE,0CAA0C;IACtD,IAAI,EAAE,iDAAiD;IACvD,IAAI,EAAE,mBAAmB;CAC1B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,KAAK,EAAE;QACL,KAAK,EAAE,GAAG;QACV,UAAU,EAAE;YACV,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,EAAE;YACP,QAAQ,EAAE,GAAG;YACb,gBAAgB,EAAE,CAAC;YACnB,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,CAAC;YACf,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,EAAE;SACX;KACF;CACF,CAAC"}
|