# `OpenPayments.Types.WalletAddress`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/wallet_address.ex#L1)

Public wallet information returned by the wallet address server.

`from_map/1` decodes and validates a JSON object using the bundled wallet-address
schema. Known fields use snake_case in Elixir and their protocol names in JSON.
Additional fields are preserved in `extensions`.

An omitted `publicName` becomes `public_name: nil` and is omitted on encoding.
An explicit JSON null is rejected because the schema requires a string when
this optional field is present.

URI fields follow the shared schema's `uri` format and are preserved without
rewriting paths, ports, queries, or fragments. This response type follows the
Node SDK's separation between response data and request handling. HTTP and HTTPS
data, including local development endpoints, can be decoded without an option.

Decoding a response does not verify that its URIs are safe or suitable request
targets. HTTPS policy and wallet discovery URL rules belong to the client. This
type makes no requests.

These fields describe a server response and require absolute URIs. Payment-pointer
shorthand such as `$wallet.example/alice` belongs to discovery input and must
be converted to a URL before requesting wallet information.

Struct literals can bypass constructor checks. Call `validate/1` before using
a manually constructed or modified wallet; `to_map/1` only converts its shape.

# `t`

```elixir
@type t() :: %OpenPayments.Types.WalletAddress{
  asset_code: String.t(),
  asset_scale: 0..255,
  auth_server: String.t(),
  extensions: %{optional(String.t()) =&gt; term()},
  id: String.t(),
  public_name: String.t() | nil,
  resource_server: String.t()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}
```

Decodes a wallet-address JSON object and validates its required fields.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Converts a wallet to JSON field names without validating it.

# `validate`

```elixir
@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}
```

Validates a struct, treating a nil public name as omitted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
