Installation & Setup - Emblem Vault SDK
Get the Emblem Vault SDK up and running in your project. The SDK supports both Node.js environments and browser usage with multiple installation options.
๐ฆ Installation Methods
NPM Package (Recommended)
Install the SDK as a dependency in your Node.js or modern web project:
โ Best for React, Vue, Angular, and Node.js projects
Yarn Package Manager
For projects using Yarn:
PNPM Package Manager
For projects using PNPM:
Browser Script (Direct Include)
Include the bundled script directly in HTML pages:
โ ๏ธ Good for quick prototyping, but NPM is recommended for production
โ๏ธ Basic Setup
ES Modules (Modern JavaScript)
CommonJS (Node.js)
TypeScript Setup
๐ Environment Configuration
SDK Environment Options
The SDK constructor accepts different environment configurations:
Development/Testing
const sdk = new EmblemVaultSDK('demo');โข Uses demo/testnet endpoints
โข Safe for experimentation
โข No real assets at risk
Production
const sdk = new EmblemVaultSDK('production');โข Uses mainnet endpoints
โข Real assets and transactions
โข Requires proper security measures
Custom Environment
โข Custom API endpoints
โข Specific chain configurations
โข Advanced use cases
๐ง Web3 Integration
Setting up Web3 Provider
Most SDK operations require a Web3 provider for blockchain interactions:
Browser with MetaMask
Node.js with Infura/Alchemy
Using the SDK's Web3 Helper
๐ Quick Start Example
Complete Setup Example
๐ ๏ธ Framework-Specific Setup
React Setup
Vue.js Setup
Next.js Setup
๐งช Verification & Testing
Test Your Installation
Run this simple test to verify everything is working:
import EmblemVaultSDK from 'emblem-vault-sdk';
async function testInstallation() {
console.log('Testing Emblem Vault SDK installation...');
try {
// Test 1: SDK initialization
const sdk = new EmblemVaultSDK('demo');
console.log('โ
SDK initialization successful');
// Test 2: Fetch contracts
const contracts = await sdk.fetchCuratedContracts(false);
console.log(`โ
Fetched ${contracts.length} curated contracts`);
// Test 3: Utility functions
const uploadUrl = sdk.generateUploadUrl();
console.log('โ
Utility functions working:', !!uploadUrl);
console.log('๐ Installation test completed successfully!');
return true;
} catch (error) {
console.error('โ Installation test failed:', error.message);
return false;
}
}
// Run the test
testInstallation();โ Installation Checklist
- โข SDK Installed: Package installed via NPM/Yarn/PNPM
- โข Import Working: Can import EmblemVaultSDK without errors
- โข Web3 Provider: Web3 provider available (MetaMask, Infura, etc.)
- โข Environment Set: Correct environment ('demo' for testing)
- โข Test Passed: Basic functionality test completes successfully
โ ๏ธ Troubleshooting
Make sure you're using the correct import syntax for your environment (ES6 vs CommonJS)
Install web3: npm install web3
Ensure MetaMask is installed and you've connected your wallet