TypeScript
Install
npm install antdConnect to the daemon
import { RestClient, createClient, type RestClientOptions } from "antd";
const client = createClient();
const options: RestClientOptions = {
baseUrl: "http://localhost:8082",
timeout: 60_000,
};
const directClient = new RestClient(options);Store and retrieve data
import { createClient, type PutResult } from "antd";
async function main(): Promise<void> {
const client = createClient();
const result: PutResult = await client.dataPutPublic(Buffer.from("Hello from TypeScript!"));
console.log(result.address);
const data: Buffer = await client.dataGetPublic(result.address);
console.log(data.toString());
}
main().catch((error) => {
console.error(error);
process.exit(1);
});Type mappings
Autonomi type
TypeScript type
Error handling
Full API reference
Last updated