Package Installation

Install the AttestProtocol SDK using your preferred package manager:
npm install @attestprotocol/sdk

Peer Dependencies

Install blockchain-specific dependencies based on your target chains:
npm install @stellar/stellar-sdk
Installing all dependencies is recommended if you plan to support multiple blockchains or are unsure which chain you’ll use.

Requirements

RequirementVersion
Node.js>= 16.0
TypeScript>= 4.5
npm/pnpm/yarnLatest stable

Module Formats

The SDK supports multiple module formats for different environments:
import { AttestSDK } from '@attestprotocol/sdk';

TypeScript Configuration

TypeScript is recommended for better type safety and developer experience.
Add these settings to your tsconfig.json:
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["ES2020", "DOM"],
    "module": "ESNext",
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true
  }
}

Browser Configuration

Browser environments require polyfills for Node.js crypto and buffer modules.
// next.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (config) => {
    config.resolve.fallback = {
      ...config.resolve.fallback,
      crypto: false,
      stream: false,
      buffer: false,
    };
    return config;
  },
};

module.exports = nextConfig;

Verification

Verify your installation is working correctly:
import { AttestSDK } from '@attestprotocol/sdk';

// Should log without errors
console.log('SDK loaded successfully');

// Check version
console.log('SDK version:', AttestSDK.VERSION);
Check installed version via CLI:
npm list @attestprotocol/sdk

Build Outputs

The SDK provides multiple build outputs for different use cases:
FormatPathUsage
CommonJSdist/main/index.jsNode.js applications
ES Modulesdist/module/index.jsModern bundlers
UMDdist/umd/attestprotocol.jsBrowser/CDN usage
TypeScriptdist/index.d.tsType definitions

Troubleshooting

Version Compatibility

SDK VersionStellar SDKAnchorNode.js
1.x^12.0.0^0.30.0>=16
2.x^13.0.0^0.30.0>=18
Always use the latest stable version for the best performance and security updates.

Next Steps