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:

BA
terminal
Loading...

โœ… Best for React, Vue, Angular, and Node.js projects

Yarn Package Manager

For projects using Yarn:

BA
terminal
Loading...

PNPM Package Manager

For projects using PNPM:

BA
terminal
Loading...

Browser Script (Direct Include)

Include the bundled script directly in HTML pages:

HT
index.html
Loading...

โš ๏ธ Good for quick prototyping, but NPM is recommended for production

โš™๏ธ Basic Setup

ES Modules (Modern JavaScript)

JA
es-modules.js
Loading...

CommonJS (Node.js)

JA
commonjs.js
Loading...

TypeScript Setup

TY
setup.ts
Loading...

๐ŸŒ 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

JA
custom-config.js
Loading...

โ€ข 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

JA
browser-metamask.js
Loading...

Node.js with Infura/Alchemy

JA
nodejs-infura.js
Loading...

Using the SDK's Web3 Helper

JA
sdk-web3-helper.js
Loading...

๐Ÿš€ Quick Start Example

Complete Setup Example

JA
complete-setup.js
Loading...

๐Ÿ› ๏ธ Framework-Specific Setup

React Setup

JA
react-hook.js
Loading...

Vue.js Setup

JA
vue-composable.js
Loading...

Next.js Setup

JA
nextjs-api-route.js
Loading...

๐Ÿงช 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

Import errors:

Make sure you're using the correct import syntax for your environment (ES6 vs CommonJS)

Web3 not found:

Install web3: npm install web3

MetaMask issues:

Ensure MetaMask is installed and you've connected your wallet