New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@acala-network/bodhi

Package Overview
Dependencies
Maintainers
4
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acala-network/bodhi

bodhi.js SDK implements a web3 provider to allow existing Ethereum dApp to be able to interact with [Acala EVM](https://github.com/AcalaNetwork/Acala/tree/master/modules/evm).

  • 0.2.2-2
  • npm
  • Socket score

Version published
Weekly downloads
30
decreased by-69.7%
Maintainers
4
Weekly downloads
 
Created
Source

@acala-network/bodhi.js

bodhi.js SDK implements a web3 provider to allow existing Ethereum dApp to be able to interact with Acala EVM.

Getting Started

  • Install dependencies
yarn

Documentation

Most of the api of bodhi.js is compatible with ethers.js. If you are not familiar with ethers.js, you can start by looking at its documentation

Provider

The Provider provides some api for interacting with nodes and is an instance of ethers.js AbstractProvider.

Creating Instances

new Provider( apiOptions )

apiOptions has the same parameters as when creating an instance of apiPromise for polkadot.js

import { options } from "@acala-network/api";
import { Provider } from "@acala-network/bodhi";
import { WsProvider } from "@polkadot/api";

const evmprovider = new Provider(
  options({
    provider: new WsProvider("ws://localhost:9944")
  })
);

Wallet

The Wallet class inherits Signer and can sign transactions and messages using a private key.

Creating Instances

new Wallet( privateKey , provider? , keyringPair? )

"privateKey" is the private key of evm's account. "provider" is an instance of Provider. "keyringPair" is a key pair for polkadot. If the "keyringPair" is empty, a key pair will be generated from the "privateKey".

import { Wallet } from "@acala-network/bodhi";
const wallet = new Wallet("0xaa397267eaee48b2262a973fdcab384a758f39a3ad8708025cfb675bb9effc20", provider)

Wallet.claimEvmAccounts()

Use "keyringpair" to bind an evm account generated by "privateKey".

wallet.claimEvmAccounts()

Examples

deploy a contract

import { deployContract } from "ethereum-waffle";
import ERC20Abi from "../build/ERC20Abi.json";
import { Wallet } from "@acala-network/bodhi";
import { WsProvider, options } from "@acala-network/api";
import { Provider } from "@acala-network/bodhi";

const evmprovider = new Provider(
  options({
    provider: new WsProvider("ws://localhost:9944")
  })
);

const master = new Wallet("0xaa397267eaee48b2262a973fdcab384a758f39a3ad8708025cfb675bb9effc20", evmprovider)

const tokenInstance = await deployContract(master, ERC20Abi);

FAQs

Package last updated on 19 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc