0.1.0 • Published 1 year ago

@geminilight/multichain-sdk v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Multichain SDK

We plan to unify various SDKs/ APIs of blockchains in this library following the structure of ethers.js and provide a multichain SDK for cross-chain application development. IParticularly, we simplify the management process of smart contracts by integrating common operations, enabling the minting, transferring, etc., of NFT with low code.

Currently Supported Blockchain

  • Ethereum (Based on ethers.js)
  • Conflux (Based on js-conflux-sdk.js)

Basic Structure

Unified Chain" SDK
{
    providers: {
        BaseProvider,
        Web3Provider,
        JsonRpcProvider
    },
    Signer,
    VoidSigner,
    Wallet,
    Contract
    ContractFactory,
    ContractClient
}

Installation

npm install

Quick Start

Run an example of the NFT Kit

npx ts-node main.ts

Simple Example

import { createMultichainSDK } from "./multichain";

const cfx_sdk = createMultichainSDK("Conflux")
const eth_sdk = createMultichainSDK("Ethereum")

// provider (JsonRpcProvider/ Web3Provider)
cfx_privider = new cfx_sdk.providers.Web3Provider(windows.conflux);
eth_privider = new eth_sdk.providers.Web3Provider(windows.ethereum);


// signer (JsonRpcSigner/ Wallet)

cfx_signer = cfx_privider.getSigner();
eth_signer = eth_privider.getSigner();

cfx_PK = "******"
eth_PK = "******"

cfx_wallet = new cfx_sdk.Wallet(cfx_PK, cfx_privider);
eth_wallet = new eth_sdk.Wallet(eth_PK, eth_privider);

// contract
cfx_abi, cfx_adress = "*", "*"
eth_abi, eth_adress = "*", "*"

cfx_contract = new cfx_sdk.Contract(cfx_adress, cfx_abi, cfx_signer)
eth_contract = new eth_sdk.Contract(eth_adress, eth_abi, eth_signer)