- Coin: Zano → Lethean, ticker: ZAN/ZANO → LTHN - Ports: 11211 → 36941 (mainnet RPC), 46941 (testnet RPC) - Wallet: 11212 → 36944/46944 - Address prefix: iTHN - URLs: zano.org → lethean.io - Explorer links: explorer.lthn.io Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
47 lines
No EOL
1.2 KiB
TypeScript
47 lines
No EOL
1.2 KiB
TypeScript
import { config } from "../utils/utils";
|
|
|
|
export interface AliasDetails {
|
|
address: string;
|
|
alias: string;
|
|
comment: string;
|
|
tracking_key: string;
|
|
}
|
|
|
|
class RPCService {
|
|
|
|
private async fetchDaemon(method: string, params: object) {
|
|
const result = await fetch(config.api, {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
"id": 0,
|
|
"jsonrpc": "2.0",
|
|
"method": method,
|
|
"params": params
|
|
})
|
|
}).then(res => res.json()).catch(err => {
|
|
console.log(err);
|
|
return null;
|
|
});
|
|
|
|
return result?.result;
|
|
}
|
|
|
|
async getAllAliasesDetails() {
|
|
const allAliases = await this.fetchDaemon("get_all_alias_details", {});
|
|
|
|
if (!allAliases?.aliases || !Array.isArray(allAliases.aliases)) {
|
|
console.log("No aliases found on chain (this is normal for new chains)");
|
|
return [] as AliasDetails[];
|
|
}
|
|
|
|
return allAliases.aliases as AliasDetails[];
|
|
|
|
}
|
|
}
|
|
|
|
const rpcService = new RPCService();
|
|
|
|
export default rpcService; |