Vault Operations - Emblem Vault SDK
Learn how to perform core vault operations including creating vaults, refreshing balances, validating mintability, and executing mints. These operations form the foundation of any Emblem Vault integration.
🏦 Creating a Vault
Basic Vault Creation
Create a vault using a curated contract template:
Contract Template Structure
Understanding the contract template format:
Required Fields
| Field | Type | Description |
|---|---|---|
| fromAddress | string | Source wallet address |
| toAddress | string | Destination wallet address |
| chainId | number | Blockchain network ID (1 = Ethereum mainnet) |
| targetContract | object | Contract configuration with addresses per network |
Target Asset Properties
🔄 Refreshing Vault Balance
Balance Refresh Operation
Update vault balance to reflect current asset holdings:
💡 When to Refresh Balance
- • After depositing assets to a vault address
- • Before validating mintability
- • When checking vault contents
- • After any external asset transfers
✅ Validating Mintability
Mintability Check
Verify if a vault meets the requirements for minting:
⚠️ Common Mintability Requirements
- • Minimum asset balance thresholds
- • Specific token types or collections
- • Time-based conditions
- • Whitelist requirements
- • Custom validation logic
🎨 Performing a Mint
Mint Execution
Execute the minting process once validation passes:
✅ Mint Success Indicators
- • Transaction hash returned
- • No error exceptions thrown
- • Progress callback shows completion
- • NFT appears in wallet
🔄 Complete Workflow Example
End-to-End Process
Complete example combining all vault operations:
🔍 Fetching Curated Contracts
Contract Discovery
Find and explore available curated contracts:
⚠️ Error Handling
Ensure sufficient ETH balance for transaction fees
Verify chainId matches your Web3 provider network
Check all required fields are properly set in contract template
Ensure vault balance meets contract requirements before minting
💡 Best Practices
- • Always validate: Check mintability before attempting to mint
- • Handle errors gracefully: Implement proper error handling for all operations
- • Use callbacks: Track progress with logging callbacks
- • Test thoroughly: Use demo environment before production
- • Monitor transactions: Track transaction hashes and confirmations