@andrewkimjoseph/celina 0.3.6 → 0.4.1
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/bin/wrapper.js +2 -0
- package/package.json +5 -49
- package/LICENSE +0 -21
- package/README.md +0 -292
- package/assets/logo-black.png +0 -0
- package/assets/logo-yellow.png +0 -0
- package/assets/logo.png +0 -0
- package/bin/cli.js +0 -2
- package/build/abis/aave-pool.d.ts +0 -37
- package/build/abis/aave-pool.js +0 -26
- package/build/abis/aave-pool.js.map +0 -1
- package/build/abis/gooddollar-identity.d.ts +0 -61
- package/build/abis/gooddollar-identity.js +0 -38
- package/build/abis/gooddollar-identity.js.map +0 -1
- package/build/abis/self-registry.d.ts +0 -194
- package/build/abis/self-registry.js +0 -120
- package/build/abis/self-registry.js.map +0 -1
- package/build/clients/celo-client.d.ts +0 -14
- package/build/clients/celo-client.js +0 -58
- package/build/clients/celo-client.js.map +0 -1
- package/build/clients/ens-client.d.ts +0 -10
- package/build/clients/ens-client.js +0 -23
- package/build/clients/ens-client.js.map +0 -1
- package/build/clients/mento-sdk.d.ts +0 -2
- package/build/clients/mento-sdk.js +0 -9
- package/build/clients/mento-sdk.js.map +0 -1
- package/build/clients/self-api.d.ts +0 -82
- package/build/clients/self-api.js +0 -242
- package/build/clients/self-api.js.map +0 -1
- package/build/config/aave.d.ts +0 -5
- package/build/config/aave.js +0 -6
- package/build/config/aave.js.map +0 -1
- package/build/config/celina-tag.d.ts +0 -1
- package/build/config/celina-tag.js +0 -3
- package/build/config/celina-tag.js.map +0 -1
- package/build/config/chains.d.ts +0 -935
- package/build/config/chains.js +0 -244
- package/build/config/chains.js.map +0 -1
- package/build/config/env.d.ts +0 -7
- package/build/config/env.js +0 -9
- package/build/config/env.js.map +0 -1
- package/build/config/gooddollar.d.ts +0 -1
- package/build/config/gooddollar.js +0 -2
- package/build/config/gooddollar.js.map +0 -1
- package/build/config/load-env.d.ts +0 -1
- package/build/config/load-env.js +0 -4
- package/build/config/load-env.js.map +0 -1
- package/build/config/self.d.ts +0 -22
- package/build/config/self.js +0 -27
- package/build/config/self.js.map +0 -1
- package/build/context/app-context.d.ts +0 -28
- package/build/context/app-context.js +0 -28
- package/build/context/app-context.js.map +0 -1
- package/build/crypto/wallet-key-crypto.d.ts +0 -11
- package/build/crypto/wallet-key-crypto.js +0 -57
- package/build/crypto/wallet-key-crypto.js.map +0 -1
- package/build/http.d.ts +0 -2
- package/build/http.js +0 -15
- package/build/http.js.map +0 -1
- package/build/index.d.ts +0 -2
- package/build/index.js +0 -17
- package/build/index.js.map +0 -1
- package/build/schemas/common.d.ts +0 -6
- package/build/schemas/common.js +0 -24
- package/build/schemas/common.js.map +0 -1
- package/build/server/create-http-app.d.ts +0 -1
- package/build/server/create-http-app.js +0 -147
- package/build/server/create-http-app.js.map +0 -1
- package/build/server/create-server.d.ts +0 -2
- package/build/server/create-server.js +0 -23
- package/build/server/create-server.js.map +0 -1
- package/build/server/instructions.d.ts +0 -1
- package/build/server/instructions.js +0 -22
- package/build/server/instructions.js.map +0 -1
- package/build/services/aave.service.d.ts +0 -29
- package/build/services/aave.service.js +0 -166
- package/build/services/aave.service.js.map +0 -1
- package/build/services/account.service.d.ts +0 -13
- package/build/services/account.service.js +0 -23
- package/build/services/account.service.js.map +0 -1
- package/build/services/blockchain.service.d.ts +0 -40
- package/build/services/blockchain.service.js +0 -81
- package/build/services/blockchain.service.js.map +0 -1
- package/build/services/ens.service.d.ts +0 -30
- package/build/services/ens.service.js +0 -78
- package/build/services/ens.service.js.map +0 -1
- package/build/services/gooddollar.service.d.ts +0 -38
- package/build/services/gooddollar.service.js +0 -127
- package/build/services/gooddollar.service.js.map +0 -1
- package/build/services/mento-fx.service.d.ts +0 -72
- package/build/services/mento-fx.service.js +0 -266
- package/build/services/mento-fx.service.js.map +0 -1
- package/build/services/self-session-store.d.ts +0 -19
- package/build/services/self-session-store.js +0 -28
- package/build/services/self-session-store.js.map +0 -1
- package/build/services/self.service.d.ts +0 -250
- package/build/services/self.service.js +0 -689
- package/build/services/self.service.js.map +0 -1
- package/build/services/token.service.d.ts +0 -54
- package/build/services/token.service.js +0 -147
- package/build/services/token.service.js.map +0 -1
- package/build/services/transaction.service.d.ts +0 -24
- package/build/services/transaction.service.js +0 -117
- package/build/services/transaction.service.js.map +0 -1
- package/build/tools/aave.tools.d.ts +0 -2
- package/build/tools/aave.tools.js +0 -56
- package/build/tools/aave.tools.js.map +0 -1
- package/build/tools/blockchain.tools.d.ts +0 -3
- package/build/tools/blockchain.tools.js +0 -88
- package/build/tools/blockchain.tools.js.map +0 -1
- package/build/tools/ens.tools.d.ts +0 -2
- package/build/tools/ens.tools.js +0 -27
- package/build/tools/ens.tools.js.map +0 -1
- package/build/tools/gooddollar.tools.d.ts +0 -2
- package/build/tools/gooddollar.tools.js +0 -23
- package/build/tools/gooddollar.tools.js.map +0 -1
- package/build/tools/helpers.d.ts +0 -3
- package/build/tools/helpers.js +0 -16
- package/build/tools/helpers.js.map +0 -1
- package/build/tools/index.d.ts +0 -5
- package/build/tools/index.js +0 -25
- package/build/tools/index.js.map +0 -1
- package/build/tools/mento-fx.tools.d.ts +0 -2
- package/build/tools/mento-fx.tools.js +0 -87
- package/build/tools/mento-fx.tools.js.map +0 -1
- package/build/tools/self.tools.d.ts +0 -2
- package/build/tools/self.tools.js +0 -256
- package/build/tools/self.tools.js.map +0 -1
- package/build/tools/token.tools.d.ts +0 -2
- package/build/tools/token.tools.js +0 -62
- package/build/tools/token.tools.js.map +0 -1
- package/build/tools/transaction.tools.d.ts +0 -2
- package/build/tools/transaction.tools.js +0 -55
- package/build/tools/transaction.tools.js.map +0 -1
- package/build/tools/types.d.ts +0 -5
- package/build/tools/types.js +0 -2
- package/build/tools/types.js.map +0 -1
- package/build/utils/erc20-allowance-storage.d.ts +0 -7
- package/build/utils/erc20-allowance-storage.js +0 -44
- package/build/utils/erc20-allowance-storage.js.map +0 -1
- package/build/utils/format-date.d.ts +0 -1
- package/build/utils/format-date.js +0 -12
- package/build/utils/format-date.js.map +0 -1
- package/build/utils/self-format.d.ts +0 -16
- package/build/utils/self-format.js +0 -59
- package/build/utils/self-format.js.map +0 -1
- package/build/utils/self-signing.d.ts +0 -4
- package/build/utils/self-signing.js +0 -38
- package/build/utils/self-signing.js.map +0 -1
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
3
|
-
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
4
|
-
import { getEncryptionInfo, isWalletEncryptionConfigured, } from "../crypto/wallet-key-crypto.js";
|
|
5
|
-
import { createServer } from "./create-server.js";
|
|
6
|
-
function getAllowedHosts() {
|
|
7
|
-
const hosts = new Set();
|
|
8
|
-
if (process.env.RENDER_EXTERNAL_HOSTNAME) {
|
|
9
|
-
hosts.add(process.env.RENDER_EXTERNAL_HOSTNAME);
|
|
10
|
-
}
|
|
11
|
-
const extra = process.env.ALLOWED_HOSTS;
|
|
12
|
-
if (extra) {
|
|
13
|
-
for (const host of extra.split(",")) {
|
|
14
|
-
const trimmed = host.trim();
|
|
15
|
-
if (trimmed) {
|
|
16
|
-
hosts.add(trimmed);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return hosts.size > 0 ? [...hosts] : undefined;
|
|
21
|
-
}
|
|
22
|
-
export const app = createMcpExpressApp({
|
|
23
|
-
host: "0.0.0.0",
|
|
24
|
-
allowedHosts: getAllowedHosts(),
|
|
25
|
-
});
|
|
26
|
-
const transports = new Map();
|
|
27
|
-
function isInitializeRequest(body) {
|
|
28
|
-
if (Array.isArray(body)) {
|
|
29
|
-
return body.some(isInitializeRequest);
|
|
30
|
-
}
|
|
31
|
-
if (!body || typeof body !== "object") {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
return body.method === "initialize";
|
|
35
|
-
}
|
|
36
|
-
app.get("/health", (_req, res) => {
|
|
37
|
-
res.json({ status: "ok" });
|
|
38
|
-
});
|
|
39
|
-
app.get("/public-key", (_req, res) => {
|
|
40
|
-
if (!isWalletEncryptionConfigured()) {
|
|
41
|
-
res.status(503).json({
|
|
42
|
-
error: "Wallet encryption is not configured on this server.",
|
|
43
|
-
});
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const { publicKey, algorithm, hash, encoding } = getEncryptionInfo();
|
|
47
|
-
res.json({ publicKey, algorithm, hash, encoding });
|
|
48
|
-
});
|
|
49
|
-
app.post("/mcp", async (req, res) => {
|
|
50
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
51
|
-
try {
|
|
52
|
-
let transport;
|
|
53
|
-
if (sessionId && transports.has(sessionId)) {
|
|
54
|
-
transport = transports.get(sessionId);
|
|
55
|
-
}
|
|
56
|
-
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
57
|
-
transport = new StreamableHTTPServerTransport({
|
|
58
|
-
sessionIdGenerator: () => randomUUID(),
|
|
59
|
-
onsessioninitialized: (id) => {
|
|
60
|
-
if (transport) {
|
|
61
|
-
transports.set(id, transport);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
transport.onclose = () => {
|
|
66
|
-
const id = transport?.sessionId;
|
|
67
|
-
if (id) {
|
|
68
|
-
transports.delete(id);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const server = createServer();
|
|
72
|
-
await server.connect(transport);
|
|
73
|
-
await transport.handleRequest(req, res, req.body);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
else if (sessionId) {
|
|
77
|
-
res.status(404).json({
|
|
78
|
-
jsonrpc: "2.0",
|
|
79
|
-
error: { code: -32001, message: "Session not found" },
|
|
80
|
-
id: null,
|
|
81
|
-
});
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
res.status(400).json({
|
|
86
|
-
jsonrpc: "2.0",
|
|
87
|
-
error: { code: -32000, message: "Bad Request: Session ID required" },
|
|
88
|
-
id: null,
|
|
89
|
-
});
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
await transport.handleRequest(req, res, req.body);
|
|
93
|
-
}
|
|
94
|
-
catch (error) {
|
|
95
|
-
console.error("Error handling MCP request:", error);
|
|
96
|
-
if (!res.headersSent) {
|
|
97
|
-
res.status(500).json({
|
|
98
|
-
jsonrpc: "2.0",
|
|
99
|
-
error: { code: -32603, message: "Internal server error" },
|
|
100
|
-
id: null,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
app.get("/mcp", async (req, res) => {
|
|
106
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
107
|
-
if (!sessionId) {
|
|
108
|
-
res.status(400).send("Missing session ID");
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const transport = transports.get(sessionId);
|
|
112
|
-
if (!transport) {
|
|
113
|
-
res.status(404).send("Session not found");
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
await transport.handleRequest(req, res);
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
console.error("Error handling MCP SSE request:", error);
|
|
121
|
-
if (!res.headersSent) {
|
|
122
|
-
res.status(500).send("Error processing SSE stream");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
app.delete("/mcp", async (req, res) => {
|
|
127
|
-
const sessionId = req.headers["mcp-session-id"];
|
|
128
|
-
if (!sessionId) {
|
|
129
|
-
res.status(400).send("Missing session ID");
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
const transport = transports.get(sessionId);
|
|
133
|
-
if (!transport) {
|
|
134
|
-
res.status(404).send("Session not found");
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
try {
|
|
138
|
-
await transport.handleRequest(req, res);
|
|
139
|
-
}
|
|
140
|
-
catch (error) {
|
|
141
|
-
console.error("Error handling MCP session termination:", error);
|
|
142
|
-
if (!res.headersSent) {
|
|
143
|
-
res.status(500).send("Error processing session termination");
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
//# sourceMappingURL=create-http-app.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-http-app.js","sourceRoot":"","sources":["../../src/server/create-http-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,SAAS,eAAe;IACtB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,CAAC;QACzC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACxC,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,OAAO,EAAE,CAAC;gBACZ,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AA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AAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { loadConfig } from "../config/env.js";
|
|
3
|
-
import { CeloClientFactory } from "../clients/celo-client.js";
|
|
4
|
-
import { EnsClientFactory } from "../clients/ens-client.js";
|
|
5
|
-
import { createAppContext } from "../context/app-context.js";
|
|
6
|
-
import { registerAllTools } from "../tools/index.js";
|
|
7
|
-
import { SERVER_INSTRUCTIONS } from "./instructions.js";
|
|
8
|
-
export function createServer() {
|
|
9
|
-
const config = loadConfig();
|
|
10
|
-
const clientFactory = new CeloClientFactory(config);
|
|
11
|
-
const ensClientFactory = new EnsClientFactory(config);
|
|
12
|
-
const clients = clientFactory.getClients();
|
|
13
|
-
const server = new McpServer({ name: "celina", version: "0.2.0" }, {
|
|
14
|
-
instructions: SERVER_INSTRUCTIONS,
|
|
15
|
-
capabilities: {
|
|
16
|
-
tools: { listChanged: true },
|
|
17
|
-
logging: {},
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
registerAllTools(server, createAppContext(clientFactory, ensClientFactory, clients.accountAddress, config.selfAgentPrivateKey));
|
|
21
|
-
return server;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=create-server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-server.js","sourceRoot":"","sources":["../../src/server/create-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,MAAM,aAAa,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,EAAE,CAAC;IAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EACpC;QACE,YAAY,EAAE,mBAAmB;QACjC,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;YAC5B,OAAO,EAAE,EAAE;SACZ;KACF,CACF,CAAC;IAEF,gBAAgB,CACd,MAAM,EACN,gBAAgB,CACd,aAAa,EACb,gBAAgB,EAChB,OAAO,CAAC,cAAc,EACtB,MAAM,CAAC,mBAAmB,CAC3B,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const SERVER_INSTRUCTIONS: string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const SERVER_INSTRUCTIONS = `
|
|
2
|
-
You are connected to Celina, the Celo MCP server (mainnet only).
|
|
3
|
-
|
|
4
|
-
Guidelines:
|
|
5
|
-
- Prefer read-only tools (get_*, resolve_ens) before any write operation.
|
|
6
|
-
- send_token and estimate_send accept ENS names (e.g. andrewkimjoseph.celo.eth) directly; use resolve_ens for standalone lookups.
|
|
7
|
-
- Always call estimate_send before send_token when possible.
|
|
8
|
-
- For Mento FX conversions, call get_mento_fx_quote and estimate_mento_fx before execute_mento_fx.
|
|
9
|
-
- Write tools require CELO_PRIVATE_KEY in the server environment.
|
|
10
|
-
- Known tokens are defined in a single registry: CELO (native), mainnet stablecoins (USDm, EURm, USDC, USDT, etc.), and GoodDollar.
|
|
11
|
-
- Use get_stablecoin_balances to scan all stablecoins at once; use get_celo_balances with a tokens list for specific symbols.
|
|
12
|
-
- Use get_gooddollar_whitelisting_info to check GoodDollar IdentityV4 whitelist status, whitelisting date, and reverification progress for a wallet.
|
|
13
|
-
- Mento FX tools (get_mento_fx_quote, estimate_mento_fx, execute_mento_fx) convert between Mento oracle-priced tokens (USDm, EURm, CELO, etc.). They are unavailable when the Mento FX market is closed.
|
|
14
|
-
- Aave tools (supply_aave_usdt, withdraw_aave_usdt) supply and withdraw USDT on Aave V3 Celo. Use get_celo_balances with tokens ["USDT"] before supplying; use withdrawMax on withdraw to redeem the full supplied balance.
|
|
15
|
-
- Self Agent ID tools (ai.self.xyz on Celo mainnet):
|
|
16
|
-
- Read: verify_self_agent, lookup_self_agent, verify_self_request, get_self_identity
|
|
17
|
-
- Register: register_self_agent → human scans QR → check_self_registration (returns private_key_hex on success)
|
|
18
|
-
- Lifecycle: refresh_self_proof (only after on-chain proof expiry), deregister_self_agent (poll with check_self_registration)
|
|
19
|
-
- Auth: sign_self_request, authenticated_self_fetch (require SELF_AGENT_PRIVATE_KEY or encryptedSelfAgentPrivateKey). For Self demo/gated APIs use ?network=celo-mainnet (not mainnet), e.g. POST https://app.ai.self.xyz/api/demo/verify?network=celo-mainnet
|
|
20
|
-
- Self agent keys are separate from CELO_PRIVATE_KEY. Registration sessions are in-memory (~10 min TTL); HTTP multi-instance hosting may require sticky sessions.
|
|
21
|
-
`.trim();
|
|
22
|
-
//# sourceMappingURL=instructions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/server/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;CAoBlC,CAAC,IAAI,EAAE,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { CeloClientFactory } from "../clients/celo-client.js";
|
|
2
|
-
export declare class AaveService {
|
|
3
|
-
private readonly clientFactory;
|
|
4
|
-
private readonly tokenService;
|
|
5
|
-
constructor(clientFactory: CeloClientFactory);
|
|
6
|
-
private resolveClients;
|
|
7
|
-
private requireWallet;
|
|
8
|
-
private assertUsdtBalance;
|
|
9
|
-
private assertSuppliedBalance;
|
|
10
|
-
private ensureUsdtAllowance;
|
|
11
|
-
supplyUsdt(amount: string, encryptedPrivateKey?: string): Promise<{
|
|
12
|
-
from: `0x${string}`;
|
|
13
|
-
amount: string;
|
|
14
|
-
token: string;
|
|
15
|
-
market: "0x3E59A31363E2ad014dcbc521c4a0d5757d9f3402";
|
|
16
|
-
hash: `0x${string}`;
|
|
17
|
-
approvalHash: `0x${string}` | undefined;
|
|
18
|
-
operation: string;
|
|
19
|
-
}>;
|
|
20
|
-
withdrawUsdt(amount: string | undefined, encryptedPrivateKey?: string, withdrawMax?: boolean): Promise<{
|
|
21
|
-
from: `0x${string}`;
|
|
22
|
-
amount: string;
|
|
23
|
-
token: string;
|
|
24
|
-
market: "0x3E59A31363E2ad014dcbc521c4a0d5757d9f3402";
|
|
25
|
-
hash: `0x${string}`;
|
|
26
|
-
operation: string;
|
|
27
|
-
withdrawMax: boolean;
|
|
28
|
-
}>;
|
|
29
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { erc20Abi } from "viem";
|
|
2
|
-
import { aavePoolAbi } from "../abis/aave-pool.js";
|
|
3
|
-
import { AAVE_POOL, AAVE_USDT, AAVE_USDT_A_TOKEN } from "../config/aave.js";
|
|
4
|
-
import { CELINA_DATA_SUFFIX } from "../config/celina-tag.js";
|
|
5
|
-
import { decryptPrivateKey } from "../crypto/wallet-key-crypto.js";
|
|
6
|
-
import { TokenService } from "./token.service.js";
|
|
7
|
-
export class AaveService {
|
|
8
|
-
clientFactory;
|
|
9
|
-
tokenService;
|
|
10
|
-
constructor(clientFactory) {
|
|
11
|
-
this.clientFactory = clientFactory;
|
|
12
|
-
this.tokenService = new TokenService(clientFactory);
|
|
13
|
-
}
|
|
14
|
-
resolveClients(encryptedPrivateKey) {
|
|
15
|
-
if (encryptedPrivateKey) {
|
|
16
|
-
const privateKey = decryptPrivateKey(encryptedPrivateKey);
|
|
17
|
-
return this.clientFactory.getClientsForAccount(privateKey);
|
|
18
|
-
}
|
|
19
|
-
const clients = this.clientFactory.getClients();
|
|
20
|
-
if (!clients.wallet || !clients.accountAddress) {
|
|
21
|
-
throw new Error("No wallet configured. Set CELO_PRIVATE_KEY in the MCP server env.");
|
|
22
|
-
}
|
|
23
|
-
return clients;
|
|
24
|
-
}
|
|
25
|
-
requireWallet(clients) {
|
|
26
|
-
const { public: publicClient, wallet, accountAddress: from } = clients;
|
|
27
|
-
if (!wallet || !from) {
|
|
28
|
-
throw new Error("Wallet client unavailable. Set CELO_PRIVATE_KEY in the MCP server env.");
|
|
29
|
-
}
|
|
30
|
-
const account = wallet.account;
|
|
31
|
-
if (!account) {
|
|
32
|
-
throw new Error("Wallet account unavailable.");
|
|
33
|
-
}
|
|
34
|
-
const chain = publicClient.chain;
|
|
35
|
-
if (!chain) {
|
|
36
|
-
throw new Error("Chain configuration missing.");
|
|
37
|
-
}
|
|
38
|
-
return { publicClient, wallet, from, account, chain };
|
|
39
|
-
}
|
|
40
|
-
async assertUsdtBalance(publicClient, owner, amount) {
|
|
41
|
-
const usdt = this.tokenService.resolveToken("USDT");
|
|
42
|
-
const required = this.tokenService.parseAmount(amount, usdt.decimals);
|
|
43
|
-
const balance = await publicClient.readContract({
|
|
44
|
-
address: AAVE_USDT,
|
|
45
|
-
abi: erc20Abi,
|
|
46
|
-
functionName: "balanceOf",
|
|
47
|
-
args: [owner],
|
|
48
|
-
});
|
|
49
|
-
if (balance < required) {
|
|
50
|
-
throw new Error(`Insufficient USDT balance. Required ${amount} USDT, available ${balance.toString()} raw units.`);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async assertSuppliedBalance(publicClient, owner, amount) {
|
|
54
|
-
const usdt = this.tokenService.resolveToken("USDT");
|
|
55
|
-
const required = this.tokenService.parseAmount(amount, usdt.decimals);
|
|
56
|
-
const balance = await publicClient.readContract({
|
|
57
|
-
address: AAVE_USDT_A_TOKEN,
|
|
58
|
-
abi: erc20Abi,
|
|
59
|
-
functionName: "balanceOf",
|
|
60
|
-
args: [owner],
|
|
61
|
-
});
|
|
62
|
-
if (balance < required) {
|
|
63
|
-
throw new Error(`Insufficient Aave USDT supply balance. Required ${amount} USDT, available ${balance.toString()} raw aToken units.`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async ensureUsdtAllowance(publicClient, wallet, from, account, chain, amountWei) {
|
|
67
|
-
const allowance = await publicClient.readContract({
|
|
68
|
-
address: AAVE_USDT,
|
|
69
|
-
abi: erc20Abi,
|
|
70
|
-
functionName: "allowance",
|
|
71
|
-
args: [from, AAVE_POOL],
|
|
72
|
-
});
|
|
73
|
-
if (allowance >= amountWei) {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
const approvalHash = await wallet.writeContract({
|
|
77
|
-
chain,
|
|
78
|
-
account,
|
|
79
|
-
address: AAVE_USDT,
|
|
80
|
-
abi: erc20Abi,
|
|
81
|
-
functionName: "approve",
|
|
82
|
-
args: [AAVE_POOL, amountWei],
|
|
83
|
-
dataSuffix: CELINA_DATA_SUFFIX,
|
|
84
|
-
});
|
|
85
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash: approvalHash });
|
|
86
|
-
if (receipt.status === "reverted") {
|
|
87
|
-
throw new Error(`USDT approval reverted: ${approvalHash}`);
|
|
88
|
-
}
|
|
89
|
-
return approvalHash;
|
|
90
|
-
}
|
|
91
|
-
async supplyUsdt(amount, encryptedPrivateKey) {
|
|
92
|
-
const clients = this.resolveClients(encryptedPrivateKey);
|
|
93
|
-
const { publicClient, wallet, from, account, chain } = this.requireWallet(clients);
|
|
94
|
-
await this.assertUsdtBalance(publicClient, from, amount);
|
|
95
|
-
const usdt = this.tokenService.resolveToken("USDT");
|
|
96
|
-
const amountWei = this.tokenService.parseAmount(amount, usdt.decimals);
|
|
97
|
-
const approvalHash = await this.ensureUsdtAllowance(publicClient, wallet, from, account, chain, amountWei);
|
|
98
|
-
const hash = await wallet.writeContract({
|
|
99
|
-
chain,
|
|
100
|
-
account,
|
|
101
|
-
address: AAVE_POOL,
|
|
102
|
-
abi: aavePoolAbi,
|
|
103
|
-
functionName: "supply",
|
|
104
|
-
args: [AAVE_USDT, amountWei, from, 0],
|
|
105
|
-
dataSuffix: CELINA_DATA_SUFFIX,
|
|
106
|
-
});
|
|
107
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
108
|
-
if (receipt.status === "reverted") {
|
|
109
|
-
throw new Error(`Aave supply reverted: ${hash}`);
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
from,
|
|
113
|
-
amount,
|
|
114
|
-
token: "USDT",
|
|
115
|
-
market: AAVE_POOL,
|
|
116
|
-
hash,
|
|
117
|
-
approvalHash,
|
|
118
|
-
operation: "SUPPLY",
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
async withdrawUsdt(amount, encryptedPrivateKey, withdrawMax) {
|
|
122
|
-
const clients = this.resolveClients(encryptedPrivateKey);
|
|
123
|
-
const { publicClient, wallet, from, account, chain } = this.requireWallet(clients);
|
|
124
|
-
if (!withdrawMax && !amount) {
|
|
125
|
-
throw new Error("Provide amount or set withdrawMax to true.");
|
|
126
|
-
}
|
|
127
|
-
if (!withdrawMax && amount) {
|
|
128
|
-
await this.assertSuppliedBalance(publicClient, from, amount);
|
|
129
|
-
}
|
|
130
|
-
const usdt = this.tokenService.resolveToken("USDT");
|
|
131
|
-
const amountWei = withdrawMax
|
|
132
|
-
? await publicClient.readContract({
|
|
133
|
-
address: AAVE_USDT_A_TOKEN,
|
|
134
|
-
abi: erc20Abi,
|
|
135
|
-
functionName: "balanceOf",
|
|
136
|
-
args: [from],
|
|
137
|
-
})
|
|
138
|
-
: this.tokenService.parseAmount(amount, usdt.decimals);
|
|
139
|
-
if (amountWei === 0n) {
|
|
140
|
-
throw new Error("No supplied USDT balance to withdraw.");
|
|
141
|
-
}
|
|
142
|
-
const hash = await wallet.writeContract({
|
|
143
|
-
chain,
|
|
144
|
-
account,
|
|
145
|
-
address: AAVE_POOL,
|
|
146
|
-
abi: aavePoolAbi,
|
|
147
|
-
functionName: "withdraw",
|
|
148
|
-
args: [AAVE_USDT, amountWei, from],
|
|
149
|
-
dataSuffix: CELINA_DATA_SUFFIX,
|
|
150
|
-
});
|
|
151
|
-
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
152
|
-
if (receipt.status === "reverted") {
|
|
153
|
-
throw new Error(`Aave withdraw reverted: ${hash}`);
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
from,
|
|
157
|
-
amount: withdrawMax ? "max" : amount,
|
|
158
|
-
token: "USDT",
|
|
159
|
-
market: AAVE_POOL,
|
|
160
|
-
hash,
|
|
161
|
-
operation: "WITHDRAW",
|
|
162
|
-
withdrawMax: Boolean(withdrawMax),
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=aave.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aave.service.js","sourceRoot":"","sources":["../../src/services/aave.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,WAAW;I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K,EAAE,MAAM;YACb,MAAM,EAAE,SAAS;YACjB,IAAI;YACJ,SAAS,EAAE,UAAU;YACrB,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC;SAClC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { CeloClientFactory } from "../clients/celo-client.js";
|
|
2
|
-
export declare class AccountService {
|
|
3
|
-
private readonly clientFactory;
|
|
4
|
-
constructor(clientFactory: CeloClientFactory);
|
|
5
|
-
getAccount(address: `0x${string}`): Promise<{
|
|
6
|
-
address: `0x${string}`;
|
|
7
|
-
network: string;
|
|
8
|
-
balanceWei: string;
|
|
9
|
-
balanceCelo: number;
|
|
10
|
-
nonce: number;
|
|
11
|
-
isContract: boolean;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export class AccountService {
|
|
2
|
-
clientFactory;
|
|
3
|
-
constructor(clientFactory) {
|
|
4
|
-
this.clientFactory = clientFactory;
|
|
5
|
-
}
|
|
6
|
-
async getAccount(address) {
|
|
7
|
-
const { public: client } = this.clientFactory.getClients();
|
|
8
|
-
const [balance, nonce, bytecode] = await Promise.all([
|
|
9
|
-
client.getBalance({ address }),
|
|
10
|
-
client.getTransactionCount({ address }),
|
|
11
|
-
client.getCode({ address }),
|
|
12
|
-
]);
|
|
13
|
-
return {
|
|
14
|
-
address,
|
|
15
|
-
network: "mainnet",
|
|
16
|
-
balanceWei: balance.toString(),
|
|
17
|
-
balanceCelo: Number(balance) / 1e18,
|
|
18
|
-
nonce,
|
|
19
|
-
isContract: bytecode !== undefined && bytecode !== "0x",
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=account.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"account.service.js","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,aAAgC;QAAhC,kBAAa,GAAb,aAAa,CAAmB;IAAG,CAAC;IAEjE,KAAK,CAAC,UAAU,CAAC,OAAsB;QACrC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3D,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACnD,MAAM,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;YAC9B,MAAM,CAAC,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC;YACvC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;SAC5B,CAAC,CAAC;QAEH,OAAO;YACL,OAAO;YACP,OAAO,EAAE,SAAS;YAClB,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE;YAC9B,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI;YACnC,KAAK;YACL,UAAU,EAAE,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;SACxD,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { CeloClientFactory } from "../clients/celo-client.js";
|
|
2
|
-
export declare class BlockchainService {
|
|
3
|
-
private readonly clientFactory;
|
|
4
|
-
constructor(clientFactory: CeloClientFactory);
|
|
5
|
-
getNetworkStatus(): Promise<{
|
|
6
|
-
network: string;
|
|
7
|
-
chainId: number;
|
|
8
|
-
blockNumber: string;
|
|
9
|
-
gasPriceWei: string;
|
|
10
|
-
}>;
|
|
11
|
-
getBlock(blockId: number | string | "latest" | "pending"): Promise<{
|
|
12
|
-
number: string | undefined;
|
|
13
|
-
hash: `0x${string}` | null;
|
|
14
|
-
timestamp: string;
|
|
15
|
-
parentHash: `0x${string}`;
|
|
16
|
-
gasUsed: string;
|
|
17
|
-
gasLimit: string;
|
|
18
|
-
miner: `0x${string}`;
|
|
19
|
-
transactionCount: number;
|
|
20
|
-
}>;
|
|
21
|
-
getLatestBlocks(count?: number): Promise<{
|
|
22
|
-
number: string;
|
|
23
|
-
hash: `0x${string}`;
|
|
24
|
-
timestamp: string;
|
|
25
|
-
transactionCount: number;
|
|
26
|
-
}[]>;
|
|
27
|
-
getTransaction(hash: `0x${string}`): Promise<{
|
|
28
|
-
hash: `0x${string}`;
|
|
29
|
-
from: `0x${string}`;
|
|
30
|
-
to: `0x${string}` | null;
|
|
31
|
-
value: string;
|
|
32
|
-
nonce: number;
|
|
33
|
-
gas: string;
|
|
34
|
-
gasPrice: string | undefined;
|
|
35
|
-
input: `0x${string}`;
|
|
36
|
-
blockNumber: string;
|
|
37
|
-
status: "success" | "reverted";
|
|
38
|
-
gasUsed: string;
|
|
39
|
-
}>;
|
|
40
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
export class BlockchainService {
|
|
2
|
-
clientFactory;
|
|
3
|
-
constructor(clientFactory) {
|
|
4
|
-
this.clientFactory = clientFactory;
|
|
5
|
-
}
|
|
6
|
-
async getNetworkStatus() {
|
|
7
|
-
const { public: client } = this.clientFactory.getClients();
|
|
8
|
-
const [chainId, blockNumber, gasPrice] = await Promise.all([
|
|
9
|
-
client.getChainId(),
|
|
10
|
-
client.getBlockNumber(),
|
|
11
|
-
client.getGasPrice(),
|
|
12
|
-
]);
|
|
13
|
-
return {
|
|
14
|
-
network: "mainnet",
|
|
15
|
-
chainId,
|
|
16
|
-
blockNumber: blockNumber.toString(),
|
|
17
|
-
gasPriceWei: gasPrice.toString(),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async getBlock(blockId) {
|
|
21
|
-
const { public: client } = this.clientFactory.getClients();
|
|
22
|
-
const blockParams = typeof blockId === "number"
|
|
23
|
-
? { blockNumber: BigInt(blockId), includeTransactions: false }
|
|
24
|
-
: blockId === "latest" || blockId === "pending"
|
|
25
|
-
? {
|
|
26
|
-
blockTag: blockId,
|
|
27
|
-
includeTransactions: false,
|
|
28
|
-
}
|
|
29
|
-
: { blockHash: blockId, includeTransactions: false };
|
|
30
|
-
const block = await client.getBlock(blockParams);
|
|
31
|
-
if (!block) {
|
|
32
|
-
throw new Error(`Block not found: ${blockId}`);
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
number: block.number?.toString(),
|
|
36
|
-
hash: block.hash,
|
|
37
|
-
timestamp: block.timestamp.toString(),
|
|
38
|
-
parentHash: block.parentHash,
|
|
39
|
-
gasUsed: block.gasUsed.toString(),
|
|
40
|
-
gasLimit: block.gasLimit.toString(),
|
|
41
|
-
miner: block.miner,
|
|
42
|
-
transactionCount: block.transactions.length,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async getLatestBlocks(count = 5) {
|
|
46
|
-
const { public: client } = this.clientFactory.getClients();
|
|
47
|
-
const latest = await client.getBlockNumber();
|
|
48
|
-
const start = latest - BigInt(Math.max(count - 1, 0));
|
|
49
|
-
const blocks = await Promise.all(Array.from({ length: count }, (_, index) => client.getBlock({ blockNumber: start + BigInt(index) })));
|
|
50
|
-
return blocks.filter(Boolean).map((block) => ({
|
|
51
|
-
number: block.number?.toString(),
|
|
52
|
-
hash: block.hash,
|
|
53
|
-
timestamp: block.timestamp.toString(),
|
|
54
|
-
transactionCount: block.transactions.length,
|
|
55
|
-
}));
|
|
56
|
-
}
|
|
57
|
-
async getTransaction(hash) {
|
|
58
|
-
const { public: client } = this.clientFactory.getClients();
|
|
59
|
-
const [tx, receipt] = await Promise.all([
|
|
60
|
-
client.getTransaction({ hash }),
|
|
61
|
-
client.getTransactionReceipt({ hash }),
|
|
62
|
-
]);
|
|
63
|
-
if (!tx) {
|
|
64
|
-
throw new Error(`Transaction not found: ${hash}`);
|
|
65
|
-
}
|
|
66
|
-
return {
|
|
67
|
-
hash: tx.hash,
|
|
68
|
-
from: tx.from,
|
|
69
|
-
to: tx.to,
|
|
70
|
-
value: tx.value.toString(),
|
|
71
|
-
nonce: tx.nonce,
|
|
72
|
-
gas: tx.gas.toString(),
|
|
73
|
-
gasPrice: tx.gasPrice?.toString(),
|
|
74
|
-
input: tx.input,
|
|
75
|
-
blockNumber: tx.blockNumber?.toString(),
|
|
76
|
-
status: receipt?.status,
|
|
77
|
-
gasUsed: receipt?.gasUsed.toString(),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=blockchain.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blockchain.service.js","sourceRoot":"","sources":["../../src/services/blockchain.service.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,aAAgC;QAAhC,kBAAa,GAAb,aAAa,CAAmB;IAAG,CAAC;IAEjE,KAAK,CAAC,gBAAgB;QACpB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3D,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACzD,MAAM,CAAC,UAAU,EAAE;YACnB,MAAM,CAAC,cAAc,EAAE;YACvB,MAAM,CAAC,WAAW,EAAE;SACrB,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,SAAS;YAClB,OAAO;YACP,WAAW,EAAE,WAAW,CAAC,QAAQ,EAAE;YACnC,WAAW,EAAE,QAAQ,CAAC,QAAQ,EAAE;SACjC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAA+C;QAC5D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QAC3D,MAAM,WAAW,GACf,OAAO,OAAO,KAAK,QAAQ;YACzB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,EAAE,KAAc,EAAE;YACvE,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,EAAE,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE;YACjC,KAAK,EAAE,EAAE,CAAC,KAAK;YACf,WAAW,EAAE,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE;YACvC,MAAM,EAAE,OAAO,EAAE,MAAM;YACvB,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,EAAE;SACrC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type EnsClientFactory } from "../clients/ens-client.js";
|
|
2
|
-
export type EnsResolveChain = "celo" | "ethereum";
|
|
3
|
-
export type ResolvedRecipient = {
|
|
4
|
-
address: `0x${string}`;
|
|
5
|
-
ens?: {
|
|
6
|
-
name: string;
|
|
7
|
-
normalizedName: string;
|
|
8
|
-
resolvedVia?: "celo" | "ethereum";
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export declare class EnsService {
|
|
12
|
-
private readonly ensClientFactory;
|
|
13
|
-
constructor(ensClientFactory: EnsClientFactory);
|
|
14
|
-
resolveEns(name: string, chain?: EnsResolveChain): Promise<{
|
|
15
|
-
name: string;
|
|
16
|
-
normalizedName: string;
|
|
17
|
-
address: `0x${string}`;
|
|
18
|
-
coinType: string;
|
|
19
|
-
chain: "ethereum";
|
|
20
|
-
resolvedVia?: undefined;
|
|
21
|
-
} | {
|
|
22
|
-
name: string;
|
|
23
|
-
normalizedName: string;
|
|
24
|
-
address: `0x${string}`;
|
|
25
|
-
coinType: string;
|
|
26
|
-
chain: "celo";
|
|
27
|
-
resolvedVia: "celo" | "ethereum";
|
|
28
|
-
}>;
|
|
29
|
-
resolveAddressOrEns(input: string): Promise<ResolvedRecipient>;
|
|
30
|
-
}
|