uniderp-mcp
Version:
> A plug-and-play MCP tool server to **send ETH**, **transfer ERC-20 tokens**, **deploy tokens**, and **interact with smart contracts** on the **UNICHAIN** — built for **Claude Desktop**, **AI agents**, and **developers.**
63 lines (62 loc) • 2.19 kB
JavaScript
import { UNIDERP_DOMAINS } from "../functions/uniderpCreateMeme.js";
import { supportedChain } from "../chains/index.js";
let uniderpToken = null;
export async function uniderpLogin(account) {
if (uniderpToken) {
return uniderpToken;
}
const domain = UNIDERP_DOMAINS[supportedChain.id];
// Get Nonce
const msgToSign = await fetch(`https://${domain}/v1/users/sign-in`, {
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
walletAddress: account.address.toString(),
}),
method: "POST",
}).then((res) => res.json());
if (!msgToSign.data) {
throw new Error("Login to uniderp platform failed");
}
// Login
const signature = await account.signMessage({ message: msgToSign.data });
const loginRes = await fetch(`https://${domain}/v1/users/sign-in/verify`, {
headers: {
"content-type": "application/json",
},
body: JSON.stringify({
signature,
walletAddress: account.address,
chain: 1,
publicKey: account.address,
}),
method: "POST",
}).then((res) => res.json());
uniderpToken = loginRes.data;
setTimeout(() => {
uniderpToken = null;
}, 1000 * 60 * 60 * 24); // 1 day
return uniderpToken;
}
export async function uniderpListMeme() {
const domain = UNIDERP_DOMAINS[supportedChain.id];
const response = await fetch(`https://${domain}/v1/projects?limit=10&sort=createdAt:desc&page=1`).then((res) => res.json());
return response.data.map((project) => {
const { walletAddress, tokenName, tokenSymbol, tokenAddress, imageUrl, totalTransaction, tvl, totalHolders, totalMarketCap, totalVolume, marketCap24hChanged, volume24hChanged, } = project;
return {
creatorAddress: walletAddress,
tokenName,
tokenSymbol,
tokenAddress,
imageUrl,
totalTransaction,
tvl,
totalHolders,
totalMarketCap,
totalVolume,
marketCap24hChanged,
volume24hChanged,
};
});
}