Build on AfterCrypt Protocol
Add conditional transfers, time-locks, and automated release mechanisms to your Web3 application with just 3 lines of code.
Quick Start
1. Install the SDK
npm install @aftercrypt/sdk # or pnpm add @aftercrypt/sdk # or yarn add @aftercrypt/sdk
2. Initialize the SDK
import { AfterCryptProtocol } from '@aftercrypt/sdk';
const sdk = new AfterCryptProtocol({
chain: 'bsc',
mode: 'mainnet',
apiKey: 'your_api_key_here' // optional
});3. Create Your First Vault
const vault = await sdk.vaults.create({
beneficiaries: [
'0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
'0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199'
],
shares: [70, 30], // 70% / 30% split
checkInIntervalDays: 90,
gracePeriodDays: 30
});
console.log('Vault created:', vault.id);4. Monitor Vault Status
// Check vault status
const status = await sdk.vaults.get(vault.id);
console.log('Status:', status.status);
// Listen for attestation events
sdk.events.onAttestation(vault.id, (attestation) => {
console.log('New attestation:', attestation);
});
// Perform regular check-ins
await sdk.vaults.checkIn(vault.id);Developer Features
TypeScript SDK
Fully typed SDK with IntelliSense support. Works with React, Vue, Angular, and vanilla JavaScript.
SDK ReferenceSmart Contracts
Deploy vaults directly from your contracts. Solidity interfaces included.
Contract DocsREST & GraphQL APIs
Query vault data, monitor attestations, and subscribe to real-time events.
API ReferenceDocumentation
Supported Chains
Deploy vaults on any of these chains with the same unified API. Cross-chain synchronization via LayerZero V2.
56
BNB Chain
1
Ethereum
137
Polygon
42161
Arbitrum
10
Optimism
8453
Base
43114
Avalanche
204
opBNB
Common Use Cases
Wallet Integration
// Add vault creation to your wallet
import { AfterCryptProtocol } from '@aftercrypt/sdk';
async function createTransferVault(
wallet: WalletClient
) {
const sdk = new AfterCryptProtocol({
chain: 'ethereum',
mode: 'mainnet'
});
const vault = await sdk.vaults.create({
beneficiaries: wallet.beneficiaries,
shares: wallet.beneficiaryShares,
checkInIntervalDays: 90
});
return vault;
}DeFi Protocol Integration
// Add time-locked rewards
import { AfterCryptProtocol } from '@aftercrypt/sdk';
async function lockRewards(
user: Address,
amount: bigint
) {
const vault = await sdk.vaults.create({
beneficiaries: [user],
shares: [100],
checkInIntervalDays: 0, // Time-lock only
gracePeriodDays: 365 // 1-year lock
});
// Transfer tokens to vault
await sdk.assets.deposit(vault.id, {
token: rewardToken,
amount
});
}Cross-Chain Vault
// Deploy vault to multiple chains
const vault = await sdk.vaults.create({
beneficiaries: ['0xAlice', '0xBob'],
shares: [50, 50]
});
// Deploy to other chains
await sdk.crossChain.deployToChain(
vault.id,
137 // Polygon
);
await sdk.crossChain.deployToChain(
vault.id,
42161 // Arbitrum
);
// Sync state across chains
await sdk.crossChain.sync(vault.id);Event Monitoring
// Subscribe to vault events
sdk.events.onVaultCreated((vault) => {
console.log('Vault created:', vault.id);
});
sdk.events.onAttestation(vaultId, (att) => {
console.log('Attestation received:', att);
});
sdk.events.onConsensusReached(vaultId, () => {
console.log('Consensus reached!');
});
sdk.events.onVaultReleased(vaultId, () => {
console.log('Assets released');
});Developer Resources
Ready to Start Building?
Join our developer community and get help from the AfterCrypt Protocol team.