Structure
The Attestation struct represents an attestation in the Solana Attestation System. Each attestation links to a credential, schema, and contains the attested data along with metadata about its creation and validity period.Type Definitions
Attestation
AttestationArgs
Methods
Fetching Attestations
| Method | Description | Parameters | Returns |
|---|---|---|---|
fetchAttestation | Fetches a single attestation by its address | rpc: RPC context, address: Attestation’s address, config?: Fetch config | Promise<Account<Attestation>> |
fetchMaybeAttestation | Safely fetches an attestation, returns null if not found | rpc: RPC context, address: Attestation’s address, config?: Fetch config | Promise<MaybeAccount<Attestation>> |
fetchAllAttestation | Fetches multiple attestations by their addresses | rpc: RPC context, addresses: Array of attestation addresses, config?: Fetch config | Promise<Account<Attestation>[]> |
fetchAllMaybeAttestation | Safely fetches multiple attestations, skips not found | rpc: RPC context, addresses: Array of attestation addresses, config?: Fetch config | Promise<MaybeAccount<Attestation>[]> |
Serialization
| Method | Description | Parameters | Returns |
|---|---|---|---|
getAttestationEncoder | Gets the encoder for attestation data | None | Encoder<AttestationArgs> |
getAttestationDecoder | Gets the decoder for attestation data | None | Decoder<Attestation> |
getAttestationCodec | Gets the codec for attestation data | None | Codec<AttestationArgs, Attestation> |
Usage Examples
The examples use therpc from Create a Client.
Fetching a Single Attestation
Fetching Multiple Attestations
Safe Fetching
Important Notes
- The
discriminatorfield is used internally and should not be modified - The
nonceprovides a unique identifier for each attestation credentialandschemafields link the attestation to its associated credential and schema- The
datafield contains the actual attestation data and should be properly encoded/decoded according to the schema signermust be one of the authorized signers of the associated credentialexpirydetermines when the attestation becomes invalidtokenAccountlinks the attestation to a specific token account- Attestations can only be created by authorized signers of the associated credential
- The attestation data must conform to the structure defined by the associated schema