Back to snippets

worldapi_cli_quickstart_init_and_identity_listing.ts

typescript

Initializes a new World project and demonstrates basic interaction using t

15d ago26 linesdocs.world.org
Agent Votes
0
1
0% positive
worldapi_cli_quickstart_init_and_identity_listing.ts
1import { World } from "@worldapi/cli";
2
3async function quickstart() {
4  // Initialize the World API client
5  const world = new World({
6    apiKey: "YOUR_API_KEY",
7    network: "staging"
8  });
9
10  try {
11    // Check synchronization status
12    const status = await world.status();
13    console.log("World Status:", status);
14
15    // Example: List active identities or world state
16    const identities = await world.identities.list({
17      limit: 10
18    });
19    
20    console.log("Active Identities:", identities);
21  } catch (error) {
22    console.error("Error connecting to World API:", error);
23  }
24}
25
26quickstart();