1.0.2 β€’ Published 10 months ago

@epicchain/epicvault-dappkit-types v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

EpicVault-DappKit

EpicVault-DappKit is an all-in-one, developer-friendly toolkit designed to simplify the process of building decentralized applications (dApps) on the EpicChain blockchain. Whether you're connecting Web Applications, managing Off-chain JS Servers, or creating React-Native Apps, EpicVault-DappKit seamlessly bridges your app to the powerful EpicChain ecosystem.

Why Choose EpicVault-DappKit?

  • Comprehensive & Flexible: Integrates seamlessly with existing projects using the WalletConnectSDK.
  • User-Centric: Simplified tools for dApp development without compromising functionality.
  • Scalable & Robust: Designed to support small projects and large-scale blockchain solutions alike.

πŸ›  Pro Tip: EpicVault-DappKit leverages types compatible with WalletConnectSDK, enabling you to alternate between implementations while reusing existing code. Check out the comprehensive WalletConnect Guide for more insights.


πŸš€ Installation

To get started with EpicVault-DappKit, install the core package using npm:

npm i @epicchain/epicvault-dappkit-types

To ensure compatibility with Vite, update your vite.config.ts file with the following snippet:

import { defineConfig } from 'vite';

export default defineConfig({
  // Custom configuration
  define: {
    global: 'globalThis',
    process: {
      version: 'globalThis',
    },
  },
});

πŸ“š Components Overview

EpicVault-DappKit comes packed with powerful modules tailored to streamline dApp development:

  1. EpicVaultInvoker
    A smart contract invocation tool for efficient blockchain interactions.

  2. EpicVaultParser
    A versatile parser for managing EpicChain-specific data types.

  3. EpicVaultSigner
    Handles cryptographic signing, verification, encryption, and decryption.

  4. EpicVaultEventListener
    A robust event listener to capture real-time blockchain updates.

πŸ—‚ Explore sample implementations in the examples folder.


πŸ›  Quick Start Guide

Here’s a simple example to illustrate how to interact with EpicChain using EpicVault-DappKit:

import { EpicVaultInvoker, EpicVaultParser, TypeChecker } from '@epicchain/epicvault-dappkit';
import { ContractInvocationMulti } from '@epicchain/epicvault-dappkit-types';

// Initialize the EpicVaultInvoker
const invoker = await EpicVaultInvoker.init({
  rpcAddress: EpicVaultInvoker.TESTNET,
});

// Define the contract invocation
const invocation: ContractInvocationMulti = {
  invocations: [
    {
      scriptHash: '0x309b6b2e0538fe4095ecc48e81bb4735388432b5',
      operation: 'getMetaData',
      args: [
        {
          type: 'Hash160',
          value: '0x6dc3bff7b2e6061f3cad5744edf307c14823328e',
        },
      ],
    },
  ],
};

// Test the invocation
const testInvokeResult = await invoker.testInvoke(invocation);

// Log results
console.log(`Invocation state returned: ${testInvokeResult.state}`);
console.log(`Estimated EpicPulse consumed: ${testInvokeResult.epicpulseconsumed} EpicPulse`);
console.log(`Returned a map? ${TypeChecker.isStackTypeMap(testInvokeResult.stack[0])}`);
console.log(`Parsed data: ${JSON.stringify(EpicVaultParser.parseRpcResponse(testInvokeResult.stack[0]), null, 2)}`);

🌟 Key Features at a Glance

  • Zero Gas Fee Testing: Use testInvoke to simulate smart contract calls without consuming EpicPulse.
  • Real-Time Parsing: Effortlessly convert blockchain data into developer-friendly formats.
  • Modular Architecture: Adapt components to fit specific project needs.
  • Cross-Platform Compatibility: Supports a wide range of environments including Web, Node.js, and React-Native.

Join the Revolution 🌐

Take your dApp development to the next level with EpicVault-DappKit. Visit our official repository to get started. Let's shape the future of blockchain technology together!