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:

JA
create-vault.js
Loading...

Contract Template Structure

Understanding the contract template format:

Required Fields

FieldTypeDescription
fromAddressstringSource wallet address
toAddressstringDestination wallet address
chainIdnumberBlockchain network ID (1 = Ethereum mainnet)
targetContractobjectContract configuration with addresses per network

Target Asset Properties

JA
target-asset-structure.js
Loading...

🔄 Refreshing Vault Balance

Balance Refresh Operation

Update vault balance to reflect current asset holdings:

JA
refresh-balance.js
Loading...

💡 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:

JA
validate-mintability.js
Loading...

⚠️ 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:

JA
perform-mint.js
Loading...

✅ 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:

JA
complete-workflow.js
Loading...

🔍 Fetching Curated Contracts

Contract Discovery

Find and explore available curated contracts:

JA
contract-discovery.js
Loading...

⚠️ Error Handling

Insufficient Gas:

Ensure sufficient ETH balance for transaction fees

Network Mismatch:

Verify chainId matches your Web3 provider network

Invalid Template:

Check all required fields are properly set in contract template

Mint Requirements:

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