mcp-server-tld 1.0.0
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/LICENSE +21 -0
- package/README.md +285 -0
- package/bin/cli.js +25 -0
- package/build/core/abis.d.ts +101 -0
- package/build/core/abis.d.ts.map +1 -0
- package/build/core/abis.js +152 -0
- package/build/core/abis.js.map +1 -0
- package/build/core/chains.d.ts +54 -0
- package/build/core/chains.d.ts.map +1 -0
- package/build/core/chains.js +149 -0
- package/build/core/chains.js.map +1 -0
- package/build/core/prompts.d.ts +8 -0
- package/build/core/prompts.d.ts.map +1 -0
- package/build/core/prompts.js +271 -0
- package/build/core/prompts.js.map +1 -0
- package/build/core/resources.d.ts +6 -0
- package/build/core/resources.d.ts.map +1 -0
- package/build/core/resources.js +47 -0
- package/build/core/resources.js.map +1 -0
- package/build/core/services/account.d.ts +65 -0
- package/build/core/services/account.d.ts.map +1 -0
- package/build/core/services/account.js +157 -0
- package/build/core/services/account.js.map +1 -0
- package/build/core/services/address.d.ts +24 -0
- package/build/core/services/address.d.ts.map +1 -0
- package/build/core/services/address.js +56 -0
- package/build/core/services/address.js.map +1 -0
- package/build/core/services/balance.d.ts +28 -0
- package/build/core/services/balance.d.ts.map +1 -0
- package/build/core/services/balance.js +59 -0
- package/build/core/services/balance.js.map +1 -0
- package/build/core/services/blocks.d.ts +24 -0
- package/build/core/services/blocks.d.ts.map +1 -0
- package/build/core/services/blocks.js +43 -0
- package/build/core/services/blocks.js.map +1 -0
- package/build/core/services/clients.d.ts +11 -0
- package/build/core/services/clients.d.ts.map +1 -0
- package/build/core/services/clients.js +40 -0
- package/build/core/services/clients.js.map +1 -0
- package/build/core/services/contracts.d.ts +82 -0
- package/build/core/services/contracts.d.ts.map +1 -0
- package/build/core/services/contracts.js +300 -0
- package/build/core/services/contracts.js.map +1 -0
- package/build/core/services/index.d.ts +16 -0
- package/build/core/services/index.d.ts.map +1 -0
- package/build/core/services/index.js +18 -0
- package/build/core/services/index.js.map +1 -0
- package/build/core/services/lending.d.ts +96 -0
- package/build/core/services/lending.d.ts.map +1 -0
- package/build/core/services/lending.js +203 -0
- package/build/core/services/lending.js.map +1 -0
- package/build/core/services/markets.d.ts +42 -0
- package/build/core/services/markets.d.ts.map +1 -0
- package/build/core/services/markets.js +134 -0
- package/build/core/services/markets.js.map +1 -0
- package/build/core/services/multicall-abi.d.ts +56 -0
- package/build/core/services/multicall-abi.d.ts.map +1 -0
- package/build/core/services/multicall-abi.js +61 -0
- package/build/core/services/multicall-abi.js.map +1 -0
- package/build/core/services/staking.d.ts +20 -0
- package/build/core/services/staking.d.ts.map +1 -0
- package/build/core/services/staking.js +60 -0
- package/build/core/services/staking.js.map +1 -0
- package/build/core/services/tokens.d.ts +23 -0
- package/build/core/services/tokens.d.ts.map +1 -0
- package/build/core/services/tokens.js +63 -0
- package/build/core/services/tokens.js.map +1 -0
- package/build/core/services/transactions.d.ts +19 -0
- package/build/core/services/transactions.d.ts.map +1 -0
- package/build/core/services/transactions.js +39 -0
- package/build/core/services/transactions.js.map +1 -0
- package/build/core/services/transfer.d.ts +26 -0
- package/build/core/services/transfer.d.ts.map +1 -0
- package/build/core/services/transfer.js +58 -0
- package/build/core/services/transfer.js.map +1 -0
- package/build/core/services/utils.d.ts +23 -0
- package/build/core/services/utils.d.ts.map +1 -0
- package/build/core/services/utils.js +28 -0
- package/build/core/services/utils.js.map +1 -0
- package/build/core/services/wallet.d.ts +25 -0
- package/build/core/services/wallet.d.ts.map +1 -0
- package/build/core/services/wallet.js +82 -0
- package/build/core/services/wallet.js.map +1 -0
- package/build/core/tools.d.ts +9 -0
- package/build/core/tools.d.ts.map +1 -0
- package/build/core/tools.js +388 -0
- package/build/core/tools.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +19 -0
- package/build/index.js.map +1 -0
- package/build/server/http-server.d.ts +2 -0
- package/build/server/http-server.d.ts.map +1 -0
- package/build/server/http-server.js +41 -0
- package/build/server/http-server.js.map +1 -0
- package/build/server/server.d.ts +4 -0
- package/build/server/server.d.ts.map +1 -0
- package/build/server/server.js +33 -0
- package/build/server/server.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TRON Network Definitions + JustLend Protocol Addresses
|
|
3
|
+
*
|
|
4
|
+
* JustLend DAO is a Compound V2-fork lending protocol on TRON.
|
|
5
|
+
* Core contracts: Comptroller, jTokens, PriceOracle, Lens.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TronNetwork {
|
|
8
|
+
Mainnet = "mainnet",
|
|
9
|
+
Nile = "nile"
|
|
10
|
+
}
|
|
11
|
+
export interface NetworkConfig {
|
|
12
|
+
name: string;
|
|
13
|
+
fullNode: string;
|
|
14
|
+
solidityNode: string;
|
|
15
|
+
eventServer: string;
|
|
16
|
+
explorer: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* JustLend core contract addresses per network.
|
|
20
|
+
*
|
|
21
|
+
* NOTE: These addresses are based on publicly known deployments.
|
|
22
|
+
* Always verify against https://justlend.org and on-chain data.
|
|
23
|
+
*/
|
|
24
|
+
export interface JustLendAddresses {
|
|
25
|
+
comptroller: string;
|
|
26
|
+
priceOracle: string;
|
|
27
|
+
lens: string;
|
|
28
|
+
maximillion: string;
|
|
29
|
+
/** Map of symbol → jToken address */
|
|
30
|
+
jTokens: Record<string, JTokenInfo>;
|
|
31
|
+
}
|
|
32
|
+
export interface JTokenInfo {
|
|
33
|
+
address: string;
|
|
34
|
+
underlying: string;
|
|
35
|
+
symbol: string;
|
|
36
|
+
underlyingSymbol: string;
|
|
37
|
+
decimals: number;
|
|
38
|
+
underlyingDecimals: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const NETWORKS: Record<TronNetwork, NetworkConfig>;
|
|
41
|
+
/**
|
|
42
|
+
* JustLend mainnet contract addresses.
|
|
43
|
+
*
|
|
44
|
+
* jToken list sourced from JustLend official docs & TronScan verified contracts.
|
|
45
|
+
* Only the most common markets are included; more can be added.
|
|
46
|
+
*/
|
|
47
|
+
export declare const JUSTLEND_ADDRESSES: Record<TronNetwork, JustLendAddresses>;
|
|
48
|
+
export declare const DEFAULT_NETWORK = TronNetwork.Mainnet;
|
|
49
|
+
export declare function getNetworkConfig(network?: string): NetworkConfig;
|
|
50
|
+
export declare function getJustLendAddresses(network?: string): JustLendAddresses;
|
|
51
|
+
export declare function getSupportedNetworks(): string[];
|
|
52
|
+
export declare function getJTokenInfo(symbolOrAddress: string, network?: string): JTokenInfo | undefined;
|
|
53
|
+
export declare function getAllJTokens(network?: string): JTokenInfo[];
|
|
54
|
+
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/core/chains.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,aAAa,CAevD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,WAAW,EAAE,iBAAiB,CAiFrE,CAAC;AAEF,eAAO,MAAM,eAAe,sBAAsB,CAAC;AAEnD,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,MAAwB,GAAG,aAAa,CAKjF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAwB,GAAG,iBAAiB,CAKzF;AAED,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED,wBAAgB,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,GAAE,MAAwB,GAAG,UAAU,GAAG,SAAS,CAShH;AAED,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAAwB,GAAG,UAAU,EAAE,CAG7E"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TRON Network Definitions + JustLend Protocol Addresses
|
|
3
|
+
*
|
|
4
|
+
* JustLend DAO is a Compound V2-fork lending protocol on TRON.
|
|
5
|
+
* Core contracts: Comptroller, jTokens, PriceOracle, Lens.
|
|
6
|
+
*/
|
|
7
|
+
export var TronNetwork;
|
|
8
|
+
(function (TronNetwork) {
|
|
9
|
+
TronNetwork["Mainnet"] = "mainnet";
|
|
10
|
+
TronNetwork["Nile"] = "nile";
|
|
11
|
+
})(TronNetwork || (TronNetwork = {}));
|
|
12
|
+
export const NETWORKS = {
|
|
13
|
+
[TronNetwork.Mainnet]: {
|
|
14
|
+
name: "Mainnet",
|
|
15
|
+
fullNode: "https://api.trongrid.io",
|
|
16
|
+
solidityNode: "https://api.trongrid.io",
|
|
17
|
+
eventServer: "https://api.trongrid.io",
|
|
18
|
+
explorer: "https://tronscan.org",
|
|
19
|
+
},
|
|
20
|
+
[TronNetwork.Nile]: {
|
|
21
|
+
name: "Nile Testnet",
|
|
22
|
+
fullNode: "https://nile.trongrid.io",
|
|
23
|
+
solidityNode: "https://nile.trongrid.io",
|
|
24
|
+
eventServer: "https://nile.trongrid.io",
|
|
25
|
+
explorer: "https://nile.tronscan.org",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* JustLend mainnet contract addresses.
|
|
30
|
+
*
|
|
31
|
+
* jToken list sourced from JustLend official docs & TronScan verified contracts.
|
|
32
|
+
* Only the most common markets are included; more can be added.
|
|
33
|
+
*/
|
|
34
|
+
export const JUSTLEND_ADDRESSES = {
|
|
35
|
+
[TronNetwork.Mainnet]: {
|
|
36
|
+
comptroller: "TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7",
|
|
37
|
+
priceOracle: "TXjzHPaDeR2KYXQ3Gfwj82PQ2qHaGThFhi",
|
|
38
|
+
lens: "TFTBTMrrMDBbAGrFQzsSiMdoTSMvkung8V",
|
|
39
|
+
maximillion: "T9gCxZ3YpmGftPmGPUNTFfMX7pJNPob4s1",
|
|
40
|
+
jTokens: {
|
|
41
|
+
jTRX: {
|
|
42
|
+
address: "TLeEu311Mgm2Kft9XAUhc5hdiXpQgPBMmP",
|
|
43
|
+
underlying: "", // native TRX
|
|
44
|
+
symbol: "jTRX",
|
|
45
|
+
underlyingSymbol: "TRX",
|
|
46
|
+
decimals: 8,
|
|
47
|
+
underlyingDecimals: 6,
|
|
48
|
+
},
|
|
49
|
+
jUSDT: {
|
|
50
|
+
address: "TXJgMdjVX5dKiQaUi9QobR2d1pTdip5xG3",
|
|
51
|
+
underlying: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
|
52
|
+
symbol: "jUSDT",
|
|
53
|
+
underlyingSymbol: "USDT",
|
|
54
|
+
decimals: 8,
|
|
55
|
+
underlyingDecimals: 6,
|
|
56
|
+
},
|
|
57
|
+
jSUN: {
|
|
58
|
+
address: "TGBr8uh9JBQ2cjWpPEjDHMhkwCBBKaP84K",
|
|
59
|
+
underlying: "TKkeiboTkxXKJpbmVFbv4a8ov5rAfRDMf9",
|
|
60
|
+
symbol: "jSUN",
|
|
61
|
+
underlyingSymbol: "SUN",
|
|
62
|
+
decimals: 8,
|
|
63
|
+
underlyingDecimals: 18,
|
|
64
|
+
},
|
|
65
|
+
jWIN: {
|
|
66
|
+
address: "TRg6MnpsFXc82ymUFgHTRDiVfCJXVbCqGy",
|
|
67
|
+
underlying: "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
|
|
68
|
+
symbol: "jWIN",
|
|
69
|
+
underlyingSymbol: "WIN",
|
|
70
|
+
decimals: 8,
|
|
71
|
+
underlyingDecimals: 6,
|
|
72
|
+
},
|
|
73
|
+
jBTC: {
|
|
74
|
+
address: "TLeEu311Mgm2Kft9XAUhc5hdiXpQgPBMmP",
|
|
75
|
+
underlying: "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
|
|
76
|
+
symbol: "jBTC",
|
|
77
|
+
underlyingSymbol: "BTC",
|
|
78
|
+
decimals: 8,
|
|
79
|
+
underlyingDecimals: 8,
|
|
80
|
+
},
|
|
81
|
+
jETH: {
|
|
82
|
+
address: "THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF",
|
|
83
|
+
underlying: "THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF",
|
|
84
|
+
symbol: "jETH",
|
|
85
|
+
underlyingSymbol: "ETH",
|
|
86
|
+
decimals: 8,
|
|
87
|
+
underlyingDecimals: 18,
|
|
88
|
+
},
|
|
89
|
+
jUSDC: {
|
|
90
|
+
address: "TXMSMnSxCUgr8FYhQK8bfjRhBJGMSrc1iF",
|
|
91
|
+
underlying: "TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8",
|
|
92
|
+
symbol: "jUSDC",
|
|
93
|
+
underlyingSymbol: "USDC",
|
|
94
|
+
decimals: 8,
|
|
95
|
+
underlyingDecimals: 6,
|
|
96
|
+
},
|
|
97
|
+
jTUSD: {
|
|
98
|
+
address: "TEMBnEbKFPA1GJwkJEMfBHkMqXgMnCbzE1",
|
|
99
|
+
underlying: "TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4",
|
|
100
|
+
symbol: "jTUSD",
|
|
101
|
+
underlyingSymbol: "TUSD",
|
|
102
|
+
decimals: 8,
|
|
103
|
+
underlyingDecimals: 18,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
[TronNetwork.Nile]: {
|
|
108
|
+
// Nile testnet addresses — placeholders, replace with actual testnet deployments
|
|
109
|
+
comptroller: "TTestComptrollerNileXXXXXXXXXXXXXX",
|
|
110
|
+
priceOracle: "TTestPriceOracleNileXXXXXXXXXXXXXX",
|
|
111
|
+
lens: "TTestLensNileXXXXXXXXXXXXXXXXXXXXX",
|
|
112
|
+
maximillion: "TTestMaximillionNileXXXXXXXXXXXXXX",
|
|
113
|
+
jTokens: {},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
export const DEFAULT_NETWORK = TronNetwork.Mainnet;
|
|
117
|
+
export function getNetworkConfig(network = DEFAULT_NETWORK) {
|
|
118
|
+
const n = network.toLowerCase();
|
|
119
|
+
if (n === "mainnet" || n === "tron" || n === "trx")
|
|
120
|
+
return NETWORKS[TronNetwork.Mainnet];
|
|
121
|
+
if (n === "nile" || n === "testnet")
|
|
122
|
+
return NETWORKS[TronNetwork.Nile];
|
|
123
|
+
throw new Error(`Unsupported network: ${network}. Supported: mainnet, nile`);
|
|
124
|
+
}
|
|
125
|
+
export function getJustLendAddresses(network = DEFAULT_NETWORK) {
|
|
126
|
+
const n = network.toLowerCase();
|
|
127
|
+
if (n === "mainnet" || n === "tron" || n === "trx")
|
|
128
|
+
return JUSTLEND_ADDRESSES[TronNetwork.Mainnet];
|
|
129
|
+
if (n === "nile" || n === "testnet")
|
|
130
|
+
return JUSTLEND_ADDRESSES[TronNetwork.Nile];
|
|
131
|
+
throw new Error(`Unsupported network: ${network}`);
|
|
132
|
+
}
|
|
133
|
+
export function getSupportedNetworks() {
|
|
134
|
+
return Object.values(TronNetwork);
|
|
135
|
+
}
|
|
136
|
+
export function getJTokenInfo(symbolOrAddress, network = DEFAULT_NETWORK) {
|
|
137
|
+
const addresses = getJustLendAddresses(network);
|
|
138
|
+
// Search by symbol first
|
|
139
|
+
const bySymbol = addresses.jTokens[symbolOrAddress] || addresses.jTokens[symbolOrAddress.toUpperCase()];
|
|
140
|
+
if (bySymbol)
|
|
141
|
+
return bySymbol;
|
|
142
|
+
// Search by address
|
|
143
|
+
return Object.values(addresses.jTokens).find((t) => t.address.toLowerCase() === symbolOrAddress.toLowerCase());
|
|
144
|
+
}
|
|
145
|
+
export function getAllJTokens(network = DEFAULT_NETWORK) {
|
|
146
|
+
const addresses = getJustLendAddresses(network);
|
|
147
|
+
return Object.values(addresses.jTokens);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=chains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../../src/core/chains.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,4BAAa,CAAA;AACf,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAkCD,MAAM,CAAC,MAAM,QAAQ,GAAuC;IAC1D,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE;QACrB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,yBAAyB;QACnC,YAAY,EAAE,yBAAyB;QACvC,WAAW,EAAE,yBAAyB;QACtC,QAAQ,EAAE,sBAAsB;KACjC;IACD,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QAClB,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,0BAA0B;QACpC,YAAY,EAAE,0BAA0B;QACxC,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,2BAA2B;KACtC;CACF,CAAC;AAEF;;;;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
+
* Register JustLend task-oriented prompts.
|
|
4
|
+
*
|
|
5
|
+
* Each prompt guides the AI through a multi-step workflow with safety checks.
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerJustLendPrompts(server: McpServer): void;
|
|
8
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,QAgSxD"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Register JustLend task-oriented prompts.
|
|
4
|
+
*
|
|
5
|
+
* Each prompt guides the AI through a multi-step workflow with safety checks.
|
|
6
|
+
*/
|
|
7
|
+
export function registerJustLendPrompts(server) {
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// SUPPLY WORKFLOW
|
|
10
|
+
// ============================================================================
|
|
11
|
+
server.registerPrompt("supply_assets", {
|
|
12
|
+
description: "Step-by-step guide to safely supply assets into JustLend to earn interest",
|
|
13
|
+
argsSchema: {
|
|
14
|
+
market: z.string().describe("jToken symbol (e.g. 'jUSDT', 'jTRX')"),
|
|
15
|
+
amount: z.string().describe("Amount of underlying to supply"),
|
|
16
|
+
network: z.string().optional().describe("Network (default: mainnet)"),
|
|
17
|
+
},
|
|
18
|
+
}, ({ market, amount, network = "mainnet" }) => ({
|
|
19
|
+
messages: [{
|
|
20
|
+
role: "user",
|
|
21
|
+
content: {
|
|
22
|
+
type: "text",
|
|
23
|
+
text: `# Supply Assets to JustLend
|
|
24
|
+
|
|
25
|
+
**Objective**: Supply ${amount} into the ${market} market on ${network} to earn interest.
|
|
26
|
+
|
|
27
|
+
## Pre-flight Checks
|
|
28
|
+
1. **Wallet**: Call \`get_wallet_address\` to confirm the active wallet.
|
|
29
|
+
2. **Balance Check**:
|
|
30
|
+
- If ${market} is jTRX: Call \`get_trx_balance\` to verify sufficient TRX.
|
|
31
|
+
- If TRC20 (jUSDT, jSUN, etc.): Call \`get_token_balance\` with the underlying token address to verify balance.
|
|
32
|
+
3. **Market Status**: Call \`get_market_data\` for ${market} to check:
|
|
33
|
+
- Is \`mintPaused\` false? (supply must be enabled)
|
|
34
|
+
- What is the current \`supplyAPY\`?
|
|
35
|
+
- What is the \`collateralFactor\`?
|
|
36
|
+
|
|
37
|
+
## Approval (TRC20 only, skip for jTRX)
|
|
38
|
+
4. Call \`check_allowance\` for ${market}.
|
|
39
|
+
5. If allowance is insufficient, call \`approve_underlying\` for ${market} with amount='max'.
|
|
40
|
+
|
|
41
|
+
## Execute Supply
|
|
42
|
+
6. Call \`supply\` with market='${market}', amount='${amount}'.
|
|
43
|
+
|
|
44
|
+
## Post-Supply Verification
|
|
45
|
+
7. Call \`get_account_summary\` to verify:
|
|
46
|
+
- New supply balance in ${market}
|
|
47
|
+
- Updated health factor
|
|
48
|
+
|
|
49
|
+
## Report
|
|
50
|
+
Provide a summary:
|
|
51
|
+
- Amount supplied and estimated annual interest
|
|
52
|
+
- New total supply value
|
|
53
|
+
- Whether this market is being used as collateral
|
|
54
|
+
- Health factor status
|
|
55
|
+
|
|
56
|
+
**Safety**: If at any step an error occurs, STOP and report the issue. Never proceed blindly.`,
|
|
57
|
+
},
|
|
58
|
+
}],
|
|
59
|
+
}));
|
|
60
|
+
// ============================================================================
|
|
61
|
+
// BORROW WORKFLOW
|
|
62
|
+
// ============================================================================
|
|
63
|
+
server.registerPrompt("borrow_assets", {
|
|
64
|
+
description: "Step-by-step guide to safely borrow assets from JustLend against collateral",
|
|
65
|
+
argsSchema: {
|
|
66
|
+
market: z.string().describe("jToken market to borrow from (e.g. 'jUSDT')"),
|
|
67
|
+
amount: z.string().describe("Amount to borrow"),
|
|
68
|
+
network: z.string().optional().describe("Network (default: mainnet)"),
|
|
69
|
+
},
|
|
70
|
+
}, ({ market, amount, network = "mainnet" }) => ({
|
|
71
|
+
messages: [{
|
|
72
|
+
role: "user",
|
|
73
|
+
content: {
|
|
74
|
+
type: "text",
|
|
75
|
+
text: `# Borrow Assets from JustLend
|
|
76
|
+
|
|
77
|
+
**Objective**: Borrow ${amount} from the ${market} market on ${network}.
|
|
78
|
+
|
|
79
|
+
## Risk Assessment (CRITICAL)
|
|
80
|
+
1. Call \`get_account_summary\` to check current position:
|
|
81
|
+
- Current collateral value (totalSupplyUSD)
|
|
82
|
+
- Current borrows (totalBorrowUSD)
|
|
83
|
+
- Health factor — must be > 1.0
|
|
84
|
+
- Liquidity available
|
|
85
|
+
2. Call \`get_market_data\` for ${market} to check:
|
|
86
|
+
- Is \`borrowPaused\` false?
|
|
87
|
+
- Current \`borrowAPY\` (cost of borrowing)
|
|
88
|
+
- Available liquidity (can the market fulfill this borrow?)
|
|
89
|
+
|
|
90
|
+
## Collateral Verification
|
|
91
|
+
3. Ensure at least one market is entered as collateral.
|
|
92
|
+
- Check \`collateralMarkets\` from account summary.
|
|
93
|
+
- If none: guide user to \`enter_market\` first.
|
|
94
|
+
4. Calculate projected health factor after borrow:
|
|
95
|
+
- New borrow = current borrow + ${amount} * price
|
|
96
|
+
- New health = collateral / new borrow
|
|
97
|
+
- **WARN if health factor would drop below 1.25** (liquidation risk)
|
|
98
|
+
- **REFUSE if health factor would drop below 1.05** (too dangerous)
|
|
99
|
+
|
|
100
|
+
## Execute Borrow
|
|
101
|
+
5. Call \`borrow\` with market='${market}', amount='${amount}'.
|
|
102
|
+
|
|
103
|
+
## Post-Borrow Verification
|
|
104
|
+
6. Call \`get_account_summary\` to confirm:
|
|
105
|
+
- New borrow balance
|
|
106
|
+
- Updated health factor
|
|
107
|
+
- Remaining borrowing capacity
|
|
108
|
+
|
|
109
|
+
## Report
|
|
110
|
+
- Amount borrowed and annual interest cost
|
|
111
|
+
- Updated health factor with risk assessment
|
|
112
|
+
- Distance to liquidation threshold
|
|
113
|
+
- Recommendation: safe range for additional borrows
|
|
114
|
+
|
|
115
|
+
**WARNING**: Borrowing reduces your health factor. If it drops below 1.0, your collateral can be liquidated.`,
|
|
116
|
+
},
|
|
117
|
+
}],
|
|
118
|
+
}));
|
|
119
|
+
// ============================================================================
|
|
120
|
+
// REPAY WORKFLOW
|
|
121
|
+
// ============================================================================
|
|
122
|
+
server.registerPrompt("repay_borrow", {
|
|
123
|
+
description: "Step-by-step guide to repay borrowed assets on JustLend",
|
|
124
|
+
argsSchema: {
|
|
125
|
+
market: z.string().describe("jToken market to repay (e.g. 'jUSDT')"),
|
|
126
|
+
amount: z.string().describe("Amount to repay, or 'max' for full repayment"),
|
|
127
|
+
network: z.string().optional().describe("Network (default: mainnet)"),
|
|
128
|
+
},
|
|
129
|
+
}, ({ market, amount, network = "mainnet" }) => ({
|
|
130
|
+
messages: [{
|
|
131
|
+
role: "user",
|
|
132
|
+
content: {
|
|
133
|
+
type: "text",
|
|
134
|
+
text: `# Repay Borrow on JustLend
|
|
135
|
+
|
|
136
|
+
**Objective**: Repay ${amount} to the ${market} market on ${network}.
|
|
137
|
+
|
|
138
|
+
## Pre-flight Checks
|
|
139
|
+
1. Call \`get_account_summary\` to see current borrow balance in ${market}.
|
|
140
|
+
2. Verify wallet has enough tokens to repay:
|
|
141
|
+
- jTRX: Call \`get_trx_balance\`
|
|
142
|
+
- TRC20: Call \`get_token_balance\` for the underlying
|
|
143
|
+
|
|
144
|
+
## Approval (TRC20 only, skip for jTRX)
|
|
145
|
+
3. Call \`check_allowance\` for ${market}.
|
|
146
|
+
4. If insufficient, call \`approve_underlying\` for ${market}.
|
|
147
|
+
|
|
148
|
+
## Execute Repay
|
|
149
|
+
5. Call \`repay\` with market='${market}', amount='${amount}'.
|
|
150
|
+
|
|
151
|
+
## Verification
|
|
152
|
+
6. Call \`get_account_summary\` to confirm:
|
|
153
|
+
- Reduced borrow balance
|
|
154
|
+
- Improved health factor
|
|
155
|
+
|
|
156
|
+
## Report
|
|
157
|
+
- Amount repaid
|
|
158
|
+
- Remaining borrow balance
|
|
159
|
+
- New health factor
|
|
160
|
+
- Estimated remaining interest cost`,
|
|
161
|
+
},
|
|
162
|
+
}],
|
|
163
|
+
}));
|
|
164
|
+
// ============================================================================
|
|
165
|
+
// PORTFOLIO ANALYSIS
|
|
166
|
+
// ============================================================================
|
|
167
|
+
server.registerPrompt("analyze_portfolio", {
|
|
168
|
+
description: "Comprehensive analysis of a user's JustLend portfolio with risk assessment and optimization suggestions",
|
|
169
|
+
argsSchema: {
|
|
170
|
+
address: z.string().optional().describe("Address to analyze. Default: configured wallet"),
|
|
171
|
+
network: z.string().optional().describe("Network (default: mainnet)"),
|
|
172
|
+
},
|
|
173
|
+
}, ({ address, network = "mainnet" }) => ({
|
|
174
|
+
messages: [{
|
|
175
|
+
role: "user",
|
|
176
|
+
content: {
|
|
177
|
+
type: "text",
|
|
178
|
+
text: `# JustLend Portfolio Analysis
|
|
179
|
+
|
|
180
|
+
**Objective**: Provide a comprehensive analysis of the lending portfolio${address ? ` for ${address}` : ""} on ${network}.
|
|
181
|
+
|
|
182
|
+
## Data Collection
|
|
183
|
+
1. Call \`get_account_summary\`${address ? ` with address='${address}'` : ""} to get all positions.
|
|
184
|
+
2. Call \`get_all_markets\` to get current market conditions.
|
|
185
|
+
3. Call \`get_protocol_summary\` for protocol parameters.
|
|
186
|
+
|
|
187
|
+
## Analysis Points
|
|
188
|
+
|
|
189
|
+
### Position Overview
|
|
190
|
+
- List all supply positions with USD values and APYs
|
|
191
|
+
- List all borrow positions with USD values and APYs
|
|
192
|
+
- Net position (supply - borrow)
|
|
193
|
+
- Estimated net APY (weighted supply APY - weighted borrow APY)
|
|
194
|
+
|
|
195
|
+
### Risk Assessment
|
|
196
|
+
- Health factor analysis:
|
|
197
|
+
- > 2.0: Very safe
|
|
198
|
+
- 1.5 - 2.0: Safe
|
|
199
|
+
- 1.2 - 1.5: Moderate risk
|
|
200
|
+
- 1.0 - 1.2: High risk — recommend repaying
|
|
201
|
+
- < 1.0: LIQUIDATION RISK — urgent action needed
|
|
202
|
+
- Collateral factor analysis: which markets are enabled as collateral?
|
|
203
|
+
- Concentration risk: is most collateral in a single asset?
|
|
204
|
+
|
|
205
|
+
### Optimization Suggestions
|
|
206
|
+
- Are there higher-APY markets the user could supply to?
|
|
207
|
+
- Could the user reduce borrow costs by switching markets?
|
|
208
|
+
- Is the collateral factor optimal? (e.g., disabling low-factor collateral)
|
|
209
|
+
- Unclaimed rewards?
|
|
210
|
+
|
|
211
|
+
### Liquidation Scenario
|
|
212
|
+
- How much would asset prices need to drop for liquidation?
|
|
213
|
+
- Which collateral would be seized first?
|
|
214
|
+
|
|
215
|
+
## Final Report Format
|
|
216
|
+
Present as a structured portfolio report with clear sections, numbers, and actionable recommendations.`,
|
|
217
|
+
},
|
|
218
|
+
}],
|
|
219
|
+
}));
|
|
220
|
+
// ============================================================================
|
|
221
|
+
// MARKET COMPARISON
|
|
222
|
+
// ============================================================================
|
|
223
|
+
server.registerPrompt("compare_markets", {
|
|
224
|
+
description: "Compare JustLend markets to find the best opportunities for supply or borrow",
|
|
225
|
+
argsSchema: {
|
|
226
|
+
action: z.enum(["supply", "borrow"]).describe("Whether looking to supply or borrow"),
|
|
227
|
+
network: z.string().optional().describe("Network (default: mainnet)"),
|
|
228
|
+
},
|
|
229
|
+
}, ({ action, network = "mainnet" }) => ({
|
|
230
|
+
messages: [{
|
|
231
|
+
role: "user",
|
|
232
|
+
content: {
|
|
233
|
+
type: "text",
|
|
234
|
+
text: `# JustLend Market Comparison — Best ${action === "supply" ? "Supply" : "Borrow"} Opportunities
|
|
235
|
+
|
|
236
|
+
**Objective**: Compare all JustLend markets to find the best ${action} opportunities on ${network}.
|
|
237
|
+
|
|
238
|
+
## Data Collection
|
|
239
|
+
1. Call \`get_all_markets\` to get all market data.
|
|
240
|
+
|
|
241
|
+
## Analysis
|
|
242
|
+
${action === "supply" ? `
|
|
243
|
+
### Best Supply Opportunities (sorted by APY)
|
|
244
|
+
- Rank markets by supplyAPY (highest first)
|
|
245
|
+
- For each market show: symbol, APY, TVL, utilization, collateral factor
|
|
246
|
+
- Flag any paused markets
|
|
247
|
+
- Note: higher utilization often means more volatile APY
|
|
248
|
+
|
|
249
|
+
### Considerations
|
|
250
|
+
- Collateral factor: higher = more borrowing power if used as collateral
|
|
251
|
+
- Utilization rate: very high (>90%) may cause withdrawal delays
|
|
252
|
+
- TVL: larger markets are generally more stable
|
|
253
|
+
` : `
|
|
254
|
+
### Best Borrow Opportunities (sorted by APY)
|
|
255
|
+
- Rank markets by borrowAPY (lowest first — cheapest to borrow)
|
|
256
|
+
- For each market show: symbol, APY, available liquidity, collateral factor
|
|
257
|
+
- Flag any paused markets
|
|
258
|
+
|
|
259
|
+
### Considerations
|
|
260
|
+
- Available liquidity: ensure enough exists for your borrow size
|
|
261
|
+
- Borrow APY: lower is better (less interest cost)
|
|
262
|
+
- Utilization: if near kink, rates may jump suddenly
|
|
263
|
+
`}
|
|
264
|
+
|
|
265
|
+
## Recommendation
|
|
266
|
+
Provide a top-3 recommendation with reasoning.`,
|
|
267
|
+
},
|
|
268
|
+
}],
|
|
269
|
+
}));
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAiB;IAEvD,+EAA+E;IAC/E,kBAAkB;IAClB,+EAA+E;IAC/E,MAAM,CAAC,cAAc,CACnB,eAAe,EACf;QACE,WAAW,EAAE,2EAA2E;QACxF,UAAU,EAAE;YACV,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;YACnE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/core/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,QA+C1D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getJustLendAddresses, getAllJTokens, getSupportedNetworks } from "./chains.js";
|
|
2
|
+
/**
|
|
3
|
+
* Register static resources that MCP clients can read.
|
|
4
|
+
*/
|
|
5
|
+
export function registerJustLendResources(server) {
|
|
6
|
+
server.registerResource("justlend://protocol-info", "justlend://protocol-info", {
|
|
7
|
+
description: "JustLend DAO protocol information and contract addresses",
|
|
8
|
+
mimeType: "application/json",
|
|
9
|
+
}, async () => {
|
|
10
|
+
const networks = getSupportedNetworks();
|
|
11
|
+
const info = {};
|
|
12
|
+
for (const network of networks) {
|
|
13
|
+
try {
|
|
14
|
+
const addresses = getJustLendAddresses(network);
|
|
15
|
+
const tokens = getAllJTokens(network);
|
|
16
|
+
info[network] = {
|
|
17
|
+
comptroller: addresses.comptroller,
|
|
18
|
+
priceOracle: addresses.priceOracle,
|
|
19
|
+
lens: addresses.lens,
|
|
20
|
+
markets: tokens.map((t) => ({
|
|
21
|
+
symbol: t.symbol,
|
|
22
|
+
underlyingSymbol: t.underlyingSymbol,
|
|
23
|
+
address: t.address,
|
|
24
|
+
underlying: t.underlying || "native TRX",
|
|
25
|
+
})),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
info[network] = { error: "Not configured" };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
contents: [{
|
|
34
|
+
uri: "justlend://protocol-info",
|
|
35
|
+
mimeType: "application/json",
|
|
36
|
+
text: JSON.stringify({
|
|
37
|
+
protocol: "JustLend DAO",
|
|
38
|
+
description: "Decentralized lending protocol on TRON (Compound V2 fork)",
|
|
39
|
+
website: "https://justlend.org",
|
|
40
|
+
docs: "https://docs.justlend.org",
|
|
41
|
+
networks: info,
|
|
42
|
+
}, null, 2),
|
|
43
|
+
}],
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/core/resources.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExF;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,gBAAgB,CACrB,0BAA0B,EAC1B,0BAA0B,EAC1B;QACE,WAAW,EAAE,0DAA0D;QACvE,QAAQ,EAAE,kBAAkB;KAC7B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,oBAAoB,EAAE,CAAC;QACxC,MAAM,IAAI,GAAwB,EAAE,CAAC;QAErC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;gBAChD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;gBACtC,IAAI,CAAC,OAAO,CAAC,GAAG;oBACd,WAAW,EAAE,SAAS,CAAC,WAAW;oBAClC,WAAW,EAAE,SAAS,CAAC,WAAW;oBAClC,IAAI,EAAE,SAAS,CAAC,IAAI;oBACpB,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;wBAC1B,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;wBACpC,OAAO,EAAE,CAAC,CAAC,OAAO;wBAClB,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,YAAY;qBACzC,CAAC,CAAC;iBACJ,CAAC;YACJ,CAAC;YAAC,MAAM,CAAC;gBACP,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,OAAO;YACL,QAAQ,EAAE,CAAC;oBACT,GAAG,EAAE,0BAA0B;oBAC/B,QAAQ,EAAE,kBAAkB;oBAC5B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,QAAQ,EAAE,cAAc;wBACxB,WAAW,EAAE,2DAA2D;wBACxE,OAAO,EAAE,sBAAsB;wBAC/B,IAAI,EAAE,2BAA2B;wBACjC,QAAQ,EAAE,IAAI;qBACf,EAAE,IAAI,EAAE,CAAC,CAAC;iBACZ,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface AccountPosition {
|
|
2
|
+
jTokenAddress: string;
|
|
3
|
+
symbol: string;
|
|
4
|
+
underlyingSymbol: string;
|
|
5
|
+
/** jToken balance (raw) */
|
|
6
|
+
jTokenBalance: string;
|
|
7
|
+
/** Supply balance in underlying token units */
|
|
8
|
+
supplyBalance: string;
|
|
9
|
+
/** Borrow balance in underlying token units */
|
|
10
|
+
borrowBalance: string;
|
|
11
|
+
/** Whether this market is used as collateral */
|
|
12
|
+
isCollateral: boolean;
|
|
13
|
+
/** Exchange rate at time of query */
|
|
14
|
+
exchangeRate: string;
|
|
15
|
+
/** Underlying price in USD */
|
|
16
|
+
underlyingPriceUSD: string;
|
|
17
|
+
/** Supply value in USD */
|
|
18
|
+
supplyValueUSD: string;
|
|
19
|
+
/** Borrow value in USD */
|
|
20
|
+
borrowValueUSD: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AccountSummary {
|
|
23
|
+
address: string;
|
|
24
|
+
network: string;
|
|
25
|
+
positions: AccountPosition[];
|
|
26
|
+
/** Total supply value across all markets (USD) */
|
|
27
|
+
totalSupplyUSD: string;
|
|
28
|
+
/** Total borrow value across all markets (USD) */
|
|
29
|
+
totalBorrowUSD: string;
|
|
30
|
+
/** Available liquidity before liquidation (USD) — 0 means at risk */
|
|
31
|
+
liquidityUSD: string;
|
|
32
|
+
/** Shortfall — if > 0, account is undercollateralized and can be liquidated */
|
|
33
|
+
shortfallUSD: string;
|
|
34
|
+
/** Health factor: liquidity ratio. >1 = safe, <1 = liquidatable */
|
|
35
|
+
healthFactor: string;
|
|
36
|
+
/** Net APY estimate (weighted average of supply APY minus borrow APY) */
|
|
37
|
+
collateralMarkets: string[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get a user's full position across all JustLend markets.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAccountSummary(userAddress: string, network?: string): Promise<AccountSummary>;
|
|
43
|
+
/**
|
|
44
|
+
* Check if user has approved enough underlying tokens for a jToken market.
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkAllowance(userAddress: string, jTokenSymbol: string, network?: string): Promise<{
|
|
47
|
+
allowance: string;
|
|
48
|
+
hasApproval: boolean;
|
|
49
|
+
underlyingAddress: string;
|
|
50
|
+
jTokenAddress: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Get TRX balance for an address as a formatted string (TRX units).
|
|
54
|
+
* For a richer return value use getTRXBalance from balance.ts.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getAccountTRXBalance(address: string, network?: string): Promise<string>;
|
|
57
|
+
/**
|
|
58
|
+
* Get TRC20 token balance for an address.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getTokenBalance(address: string, tokenAddress: string, network?: string): Promise<{
|
|
61
|
+
balance: string;
|
|
62
|
+
symbol: string;
|
|
63
|
+
decimals: number;
|
|
64
|
+
}>;
|
|
65
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../src/core/services/account.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