> ## Documentation Index
> Fetch the complete documentation index at: https://sigil-10dddbf2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# SigilClient

> The single entry point for all Sigil program interactions.

`SigilClient` wraps both the Credential and Registry Anchor programs. Construct one client per wallet and reuse it across calls.

## Constructor

```ts theme={null}
import { SigilClient } from '@sigil-xyz/sdk'

const client = new SigilClient(config: SigilClientConfig)
```

### SigilClientConfig

```ts theme={null}
interface SigilClientConfig {
  connection: Connection           // @solana/web3.js Connection
  wallet: AnchorProvider['wallet'] // must be able to sign transactions
}
```

The `wallet` field expects an object implementing:

```ts theme={null}
{
  publicKey: PublicKey
  signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>
  signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>
}
```

This matches the `AnchorProvider["wallet"]` interface. Wallet adapters from `@solana/wallet-adapter-react` satisfy it directly.

## PDA helpers

Use these to derive addresses without making RPC calls.

### sigilPda

```ts theme={null}
client.sigilPda(agent: PublicKey, principal: PublicKey): [PublicKey, number]
```

Returns `[pda, bump]` for the Sigil credential issued by a principal to a given agent. Derived from `["sigil", principalPubkey, agentPubkey]` on the credential program.

### listingPda

```ts theme={null}
client.listingPda(sigil: PublicKey): [PublicKey, number]
```

Returns `[pda, bump]` for the Registry listing of a given Sigil PDA. Derived from `["listing", sigilPda]` on the registry program.

## Example setup

```ts theme={null}
import { SigilClient } from '@sigil-xyz/sdk'
import { Connection, Keypair } from '@solana/web3.js'
import { readFileSync } from 'fs'

const connection = new Connection(
  process.env.SOLANA_RPC_URL ?? 'https://api.devnet.solana.com',
  'confirmed'
)

const keypair = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(readFileSync(process.env.KEYPAIR_PATH!, 'utf-8')))
)

const client = new SigilClient({
  connection,
  wallet: {
    publicKey: keypair.publicKey,
    signTransaction: async (tx) => { tx.sign(keypair); return tx },
    signAllTransactions: async (txs) => { txs.forEach(tx => tx.sign(keypair)); return txs },
  },
})
```
