# Example wallet

One wallet: the code below is the keyed call a distributor makes, and the example beneath it shows what Yutai answered for the wallet named in that code. This page reads that answer without a key, so a signed-out visitor sees it too.

## The call

The printed call is the keyed call a distributor makes: it connects the SDK's client and asks the eligibility read for one wallet, with a placeholder where the key stands. This page's own live read does not use that key: it asks Yutai's keyless documentation read for the same wallet, so the example below draws without a key being set. The key never reaches your browser.

The keyed call a distributor makes

```
import { connectDistributorApi } from "@yutai/sdk-web/client";

const client = connectDistributorApi({ base: "https://api.yutai.com", key: "ytk_your-key" });

const answer = await client.askEligibility(["0xcd8a4c3f9d3ab5c8817729a4d1420b95869b5928"]);
```

- `GET /v1/eligibility` the tokens a wallet holds and the benefits they reach: the keyed call the printed snippet makes; the page's own answer and the paste box's read ask the docs route's keyless twin of the same answer
- `POST /v1/claims/challenge` the words the wallet signs, before the claim is asked
- `POST /v1/claims` the claim, recorded on the proof the wallet signed
- `GET /v1/claims/{id}` the claim's own state, in the words the read answers

## The example

The live figures are not drawn in this copy: the page asks Yutai for them when a visitor opens it, and this copy is built without that read. Open the example wallet page to see its holdings.

## The claim flow

A benefit the wallet reaches is one its holder can claim. The claim flow is the wallet's own: its wallet signs the one message Yutai asks for, Yutai records the claim on that proof, and the read answers the state the claim stands in. Each press names the way its own benefit reaches the holder: a code reaches the holder in their own Yutai app, and the answers Yutai hands back carry the claim's facts alone, never the holder's code. The presses still use the docs demo key held in the serving environment, because a claim is a write behind the keyed API; when that key is not set, a press answers that the example is not wired.

The flow's own code, the order the presses run it in: the two asks the SDK's client carries, then the read, the calls the panel above names.

The flow the example runs

```
import { connectDistributorApi, refusedSentenceOf } from "@yutai/sdk-web/client";

const key = "ytk_your-key";
const client = connectDistributorApi({ base: "https://api.yutai.com", key });
const headers = { Authorization: `Bearer ${key}`, Accept: "application/json" };

// The words the wallet signs, before the claim is asked.
const challenge = await client.askClaimChallenge(benefitId, [wallet]);
const signature = await wallet.signMessage(challenge.message);

// The claim, recorded on that proof.
const answer = await client.askClaim({ benefitId, wallet, nonce: challenge.nonce, signature });
if (answer.status !== "claimed") throw new Error(refusedSentenceOf(answer.reason));

// The claim's own state, in the words the read answers.
const claim = await fetch(`https://api.yutai.com/v1/claims/${answer.claimId}`, { headers }).then((read) => read.json());
```

## Try an address

The paste box takes one address and asks the same keyless read for it: the answer draws the way the example above does, and an address of a chain Yutai carries no wallet on is refused before anything is sent. The box answers six pastes a minute; a seventh in the same minute reads nothing and answers once the minute is up. One pasted address also asks the API at most once a minute, because the read keeps its own one-minute window.

Wallet address
