@efe136/legacychain-sdk
v1.1.2
Published
Official SDK for interacting with LegacyChain smart contracts and APIs
Maintainers
Readme
LegacyChain SDK
Official TypeScript SDK for interacting with LegacyChain smart contracts and services.
🚀 Version History
🧠 zkML Capsules (Coming in v2.0.0)
Zero-knowledge machine learning integration for privacy-preserving AI:
- 🔬 AI-Powered Verification - On-chain proof verification for ML models
- 📊 ONNX Model Support - Upload and run ONNX models with privacy
- 🔐 Privacy-Preserving ML - Execute ML inference without revealing data
- 🌐 EZKL Hub Integration - Cloud-based model compilation and proof generation
- 🖥️ CLI Tools - Command-line interface for zkML operations
- 📈 Performance Analytics - Detailed metrics for ML model performance
v1.1.1 (Current) - Specialized Capsules
- 🎨 10 Specialized NFT Capsules - Film, Creator Message, Mystery Trait, VIP Access, Art Provenance, Voting, Music, Achievement, Educational, Memory
- ✨ Multi-signature support - Collaborative capsule management with threshold-based signing
- 🪝 Webhooks - Real-time event notifications for all capsule activities
- 📊 Advanced Analytics - AI-powered insights, custom dashboards, retention analytics (Pro+)
- 🎨 Custom Branding - White-label your integration with custom logos and colors (Pro+)
- 🎯 Priority Support - Tiered support with SLA guarantees for Enterprise
- 🏢 Enterprise License - Professional licensing with custom terms and SLA
v1.0.0 - Foundation
- 📦 Time Capsules - Basic time-locked content storage
- 💰 Payment Capsules - Time-locked cryptocurrency payments
- 📄 Legal Documents - Multi-signature legal document management
- 🔐 Encryption - End-to-end encryption for all content
- 🌐 IPFS Integration - Decentralized storage
Installation
npm install @efe136/legacychain-sdk
# or
yarn add @efe136/legacychain-sdkQuick Start
import { LegacyChainClient } from '@efe136/legacychain-sdk';
// Initialize the SDK
const client = new LegacyChainClient({
apiKey: 'your-api-key',
network: 'mainnet' // or 'testnet'
});
// Create a time capsule
const capsule = await client.timeCapsules.create({
title: 'My Time Capsule',
description: 'A message to the future',
content: 'Hello from 2024!',
unlockTime: new Date('2025-01-01'),
encrypt: true
});
// Set up webhooks for notifications
const webhook = await client.webhooks.create({
url: 'https://your-app.com/webhook',
events: ['capsule.created', 'capsule.unlocked']
});Features
📦 Time Capsules
Create and manage time-locked digital content:
// Create a capsule
const capsule = await client.timeCapsules.create({
title: 'Future Message',
content: 'Secret message',
unlockTime: new Date('2030-01-01'),
authorizedAddresses: ['0x...'], // Optional: specific addresses that can unlock
encrypt: true,
password: 'optional-password'
});
// List your capsules
const myCapsules = await client.timeCapsules.list({
owner: '0xYourAddress'
});
// Unlock a capsule (when time has passed)
const unlockedContent = await client.timeCapsules.unlock(capsuleId);💰 Payment Capsules
Send time-locked payments:
const payment = await client.payments.create({
recipient: '0xRecipientAddress',
amount: '1.5', // ETH
token: 'ETH', // or 'USDC', 'USDT', 'DAI'
unlockTime: new Date('2025-01-01'),
message: 'Happy New Year!'
});📄 Legal Documents
Create legally binding documents with multi-signature:
const document = await client.legalDocuments.create({
file: documentFile,
documentType: 'CONTRACT',
signers: ['0xSigner1', '0xSigner2'],
requiredSignatures: 2,
selfDestruct: {
type: 'time',
value: new Date('2026-01-01')
}
});🎨 Specialized NFT Capsules (New!)
Create advanced NFT capsules with unique unlocking mechanisms:
🎬 Film Capsules
Time-locked exclusive films and video content:
const filmCapsule = await client.specializedCapsules.createFilmCapsule({
recipient: '0xRecipient',
title: 'The Lost Chapter',
director: 'Christopher Nolan',
premiereDate: new Date('2025-12-25'),
trailerURI: 'ipfs://QmTrailer',
encryptedFilmURI: 'ipfs://QmEncryptedFilm'
});📝 Creator Message Capsules
Hidden messages from creators revealed to NFT buyers:
const messageCapsule = await client.specializedCapsules.createCreatorMessageCapsule({
recipient: '0xCollector',
creator: 'Banksy',
message: 'The story behind this piece...',
publicTeaser: 'What inspired this artwork?',
revealTime: new Date('2024-12-01'),
encrypt: true
});🧬 Mystery Trait Capsules
NFTs with evolving traits that unlock over time:
const traitCapsule = await client.specializedCapsules.createMysteryTraitCapsule({
recipient: '0xPlayer',
name: 'Shadow Warrior',
hiddenTraits: ['Legendary Sword', 'Dragon Armor', 'Phoenix Pet'],
unlockTimes: [
new Date('2024-02-01'),
new Date('2024-03-01'),
new Date('2024-04-01')
]
});💎 VIP Access Capsules
NFTs granting exclusive access to events and content:
const vipCapsule = await client.specializedCapsules.createVIPAccessCapsule({
recipient: '0xFan',
eventId: 'metaverse-concert-2024',
description: 'Backstage access to Travis Scott concert',
encryptedAccessData: 'encrypted-url-and-code',
expiryTime: new Date('2024-12-31'),
usageLimit: 1
});📜 Art Provenance Capsules
Artwork that reveals new layers over time:
const artCapsule = await client.specializedCapsules.createArtProvenanceCapsule({
recipient: '0xCollector',
artist: 'Digital Picasso',
baseArtworkURI: 'ipfs://QmBaseArt',
layerURIs: ['ipfs://QmLayer1', 'ipfs://QmLayer2'],
layerDescriptions: ['The beginning...', 'The revelation...'],
revealTimes: [new Date('2024-06-01'), new Date('2024-12-01')]
});More Capsule Types
- 🗳️ Voting Capsules: DAO governance with time-based voting
- 🎵 Music Capsules: Exclusive tracks unlocking on special dates
- 🏆 Achievement Capsules: Gaming achievements that evolve
- 📚 Educational Capsules: Progressive learning content
- 🌟 Memory Capsules: Multi-generational family messages
🔐 Multi-Signature (New in v1.1.0)
Create proposals requiring multiple signatures:
// Create a multi-sig proposal
const proposal = await client.multiSig.createProposal({
capsuleId: 'capsule-id',
signers: ['0xAddr1', '0xAddr2', '0xAddr3'],
requiredSignatures: 2,
action: 'unlock',
duration: 72 // hours
});
// Sign the proposal
await client.multiSig.signProposal(proposal.id);
// Check proposal status
const status = await client.multiSig.getProposal(proposal.id);🪝 Webhooks (New in v1.1.0)
Receive real-time notifications:
// Register webhook endpoint
const webhook = await client.webhooks.create({
url: 'https://your-app.com/webhook',
events: [
'capsule.created',
'capsule.unlocked',
'payment.claimed',
'document.signed'
],
secret: 'your-webhook-secret'
});
// Verify incoming webhooks
const isValid = client.webhooks.verifySignature(
payload,
signature,
secret
);📊 Analytics
Track usage and get insights:
// Basic analytics (Starter+)
const overview = await client.analytics.getOverview();
// Advanced analytics (Pro+)
const insights = await client.analytics.getInsights({
focus: 'retention',
timeframe: 'month'
});
// Custom dashboards (Pro+)
const dashboard = await client.analytics.createCustomDashboard({
name: 'Executive Overview',
widgets: [/* widget configs */]
});Rate Limits & Plans
| Plan | Rate Limit | Capsules/Month | Storage | Price | |------|------------|----------------|---------|--------| | Free | 10 req/min | 5 | 50MB | $0 | | Starter | 30 req/min | 50 | 500MB | $29/mo | | Pro | 100 req/min | 500 | 5GB | $99/mo | | Enterprise | Unlimited | Unlimited | Unlimited | Custom |
Configuration
API Keys
Get your API key from the LegacyChain Dashboard.
Networks
mainnet: Production networktestnet: Sepolia testnet for developmentlocalhost: Local development
Contract Addresses (Mainnet)
- LegacyNFT:
0x1CDccb98155c963152C1C36Dd9d4B73A13ae5A17 - LegacyPayments:
0xaBb7673d8DeD965545FF2d9437Bbc393dfa880b1 - LegacyLegalDocs:
0x90B0fb2f0f6c637077b4e0fc69b14221e72094c9 - LegacyMultiSig:
0xcb481E0Df628eEe515768Ae8B2B83Aa0B6d4Cc9b✨
Advanced Usage
Connect Wallet
// For browser environments
await client.connectWallet(window.ethereum);
// Sign messages
const signature = await client.getSigner().signMessage('Hello');Custom RPC
const client = new LegacyChainClient({
apiKey: 'your-api-key',
network: 'mainnet',
rpcUrl: 'https://your-custom-rpc.com'
});Error Handling
try {
await client.timeCapsules.create({...});
} catch (error) {
if (error.code === 'RATE_LIMIT_EXCEEDED') {
console.log('Please upgrade your plan');
}
}Support
- Documentation: https://docs.legacychain.net
- Discord: https://discord.gg/legacychain
- Email: [email protected]
- Enterprise Sales: [email protected]
License
This software is licensed under the LegacyChain SDK Enterprise License Agreement.
For licensing inquiries, please contact [email protected] or visit https://legacychain.net/enterprise
See LICENSE for the full license terms.
