アテステーション

アテステーションは、Solanaアテステーションシステムにおける検証済みのクレームまたはステートメントを表します。アテステーションは、クレデンシャルの下で承認された署名者によって作成され、特定のスキーマに従います。各アテステーションには、クレームの実際のデータと、その作成および有効性に関するメタデータが含まれています。

構造

Attestation構造体は、Solanaアテステーションシステムにおけるアテステーションを表します。各アテステーションは、クレデンシャルとスキーマにリンクされており、証明されたデータとその作成および有効期間に関するメタデータを含んでいます。

型定義

Attestation

export type Attestation = {
discriminator: number; // Internal discriminator
nonce: Address; // Unique identifier for the attestation
credential: Address; // Associated credential address
schema: Address; // Associated schema address
data: ReadonlyUint8Array; // Attestation data
signer: Address; // Address of the signer who created the attestation
expiry: bigint; // Expiration timestamp
tokenAccount: Address; // Associated token account
};

AttestationArgs

export type AttestationArgs = {
discriminator: number;
nonce: Address;
credential: Address;
schema: Address;
data: ReadonlyUint8Array;
signer: Address;
expiry: number | bigint; // Can be either number or bigint
tokenAccount: Address;
};

メソッド

アテステーションの取得

メソッド説明パラメータ戻り値
fetchAttestationアドレスによって単一のアテステーションを取得rpc: RPCコンテキスト、address: アテステーションのアドレス、config?: 取得設定Promise<Account<Attestation>>
fetchMaybeAttestationアテステーションを安全に取得し、見つからない場合はnullを返すrpc: RPCコンテキスト、address: アテステーションのアドレス、config?: 取得設定Promise<MaybeAccount<Attestation>>
fetchAllAttestationアドレスによって複数のアテステーションを取得rpc: RPCコンテキスト、addresses: アテステーションアドレスの配列、config?: 取得設定Promise<Account<Attestation>[]>
fetchAllMaybeAttestation複数のアテステーションを安全に取得し、見つからないものはスキップrpc: RPCコンテキスト、addresses: アテステーションアドレスの配列、config?: 取得設定Promise<MaybeAccount<Attestation>[]>

シリアライゼーション

メソッド説明パラメータ戻り値
getAttestationEncoderアテステーションデータのエンコーダーを取得なしEncoder<AttestationArgs>
getAttestationDecoderアテステーションデータのデコーダーを取得なしDecoder<Attestation>
getAttestationCodecアテステーションデータのコーデックを取得なしCodec<AttestationArgs, Attestation>

使用例

単一のアテステーションの取得

const attestation = await fetchAttestation(rpc, attestationAddress);
console.log("Attestation nonce:", attestation.nonce);

複数のアテステーションの取得

const attestations = await fetchAllAttestation(rpc, [
attestation1Address,
attestation2Address
]);
attestations.forEach((attestation) =>
console.log("Attestation:", attestation.nonce)
);

安全な取得

const attestation = await fetchMaybeAttestation(rpc, attestationAddress);
if (attestation) {
console.log("Attestation found:", attestation.nonce);
} else {
console.log("Attestation not found");
}

重要な注意事項

  • discriminatorフィールドは内部的に使用されるため、変更しないでください
  • nonceは各アテステーションの一意の識別子を提供します
  • credentialおよびschemaフィールドは、アテステーションを関連するクレデンシャルおよびスキーマにリンクします
  • dataフィールドには実際のアテステーションデータが含まれており、スキーマに従って適切にエンコード/デコードする必要があります
  • signerは、関連するクレデンシャルの認可された署名者の1人である必要があります
  • expiryは、アテステーションが無効になる時点を決定します
  • tokenAccountは、アテステーションを特定のトークンアカウントにリンクします
  • アテステーションは、関連するクレデンシャルの認可された署名者によってのみ作成できます
  • アテステーションデータは、関連するスキーマで定義された構造に準拠する必要があります

Is this page helpful?

目次

ページを編集
© 2026 Solana Foundation. 無断転載を禁じます。