-
-
Notifications
You must be signed in to change notification settings - Fork 2
API Reference
This section provides a complete technical reference for the @GitDigital-Products/solana-kyc-compliance-sdk library.
- Core Class: ComplianceSDK The main class used to initialize the client and interact with both the KYC Provider and the Solana network. new ComplianceSDK(connection, config) The constructor initializes the SDK, setting up the Solana connection and the specific KYC/AML provider interface.
| Parameter | Type | Description |
|---|---|---|
| connection | Connection (from @solana/web3.js) | The active Solana RPC connection object. |
| config | KYCProviderConfig | Configuration object for the chosen external KYC provider (See Data Types below). |
Example: import { ComplianceSDK } from '@GitDigital-Products/solana-kyc-compliance-sdk'; import { Connection } from '@solana/web3.js';
const connection = new Connection(process.env.SOLANA_RPC!); const sdk = new ComplianceSDK(connection, { providerName: 'InternalKYCService', apiUrl: 'https://api.internal-kyc.com/v1', apiKey: 'my-secure-key', });
- Core Methods sdk.getComplianceStatus(walletAddress) Queries the configured external KYC/AML provider's API to retrieve the current compliance status for a wallet.
| Parameter | Type | Description |
|---|---|---|
| walletAddress | PublicKey | The public key of the user's wallet to be screened. |
| Returns | Type | Description |
| --- | --- | --- |
| Promise | The aggregated compliance report from the provider (See Data Types). |
sdk.createAttestationInstruction(params) Generates the necessary Solana TransactionInstruction to update a user's on-chain compliance status. This instruction must be signed by the Program Issuer.
| Parameter | Type | Description |
|---|---|---|
| params.userKey | PublicKey | The wallet key of the user receiving the attestation. |
| params.kycLevel | string | The desired KYC classification (e.g., 'Tier1', 'AccreditedInvestor'). |
| params.jurisdiction | string | The user's verified jurisdiction (e.g., 'US', 'EU', 'CA'). |
| params.issuerSigner | Keypair | The full Keypair of the entity authorized to issue compliance status on-chain. |
| Returns | Type | Description |
| --- | --- | --- |
| Promise | The instruction ready to be added to a transaction and sent to the Solana program. | |
| sdk.verifyTokenCompliance(tokenAccount) | ||
| A utility method to quickly check the on-chain compliance status by reading data from a specialized SPL Token account (e.g., a Gatekeeper Token or an account updated via a Transfer Hook). |
| Parameter | Type | Description |
|---|---|---|
| tokenAccount | PublicKey | The SPL Token account to inspect for compliance status. |
| Returns | Type | Description |
| --- | --- | --- |
| Promise | true if the account holds the required compliance proof; false otherwise. |
- Data Types KYCProviderConfig The configuration object passed to the ComplianceSDK constructor.
| Field | Type | Description |
|---|---|---|
| providerName | 'Civic' | 'Solid' |
| apiUrl | string | The base URL for the provider's API. |
| apiKey | string | The API key or credential required for provider authentication. |
ComplianceStatus The standardized output structure from the external KYC/AML providers.
| Field | Type | Description |
|---|---|---|
| isKYCVerified | boolean | True if the user has passed the identity verification check. |
| isSanctioned | boolean | True if the user's address is flagged by AML/Sanctions lists. |
| jurisdiction | string | The verified country code (ISO 3166-1 alpha-2) of the user. |
| kycTier | string | The compliance level achieved (e.g., 'Tier1', 'Tier2'). |
"actionButtons": { "commands": [ { "name": "$(key) Generate Dev Keypair", "color": "green", "command": "terminal.sendSequence", "args": { "text": "solana-keygen new --outfile ./temp-dev-keypair.json\n" } } ] }