![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@acala-network/bodhi
Advanced tools
bodhi.js SDK provides utils for interaction with Acala EVM+:
yarn add @acala-network/bodhi
# or
npm install @acala-network/bodhi
import { WsProvider } from "@polkadot/api";
import { createTestPairs } from "@polkadot/keyring/testingPairs";
import { SubstrateSigner, BodhiProvider, BodhiSigner } from "@acala-network/bodhi";
const provider = new BodhiProvider({
provider: new WsProvider("ws://localhost:9944")
});
// create a substrate payload signer, dapps will use an extension signer
const { alice } = createTestPairs();
const signer = new SubstrateSigner(provider.api.registry, alice);
const wallet = new BodhiSigner(provider, alice.address, signer);
// or from pair
const wallet = BodhiSigner.fromPair(provider, alice);
alternatively, for a quick testing setup, we can use the getTestUtils
helper, which basically encapsulates the above setup.
import { getTestUtils } from '@acala-network/bodhi';
const { wallets, provider, pairs } = await getTestUtils('ws://localhost:9944');
const alice = pairs[0];
const wallet = wallets[0];
now that we have an eth compatible wallet (signer), we can use it with any eth toolings.
For example we can use it with waffle
to deploy a contract
import { deployContract } from "ethereum-waffle";
const instance = await deployContract(wallet, contractAbi, params);
or use with ethers
to interact with existing contracts
const instance = new ethers.Contract(address, contractAbi, wallet);
await instance.callSomeFunction();
You may notice there are so many "providers" and "signers", basically there are two from substrate world (WsProvider
, SubstrateSigner
), and two from traditional eth world (Signer
, Provider
).
Here is a brief hierachy of how they work together:
BodhiSigner
: top level eth signer (wallet), compatible with ethers.js AbstractSigner, can be directly used by any eth toolings, such as ethers, waffle, etc.
SubstrateSigner
: substrate payload signer, usually from keyring pair or an extension wallet, such as polkadotjs or talismanProvider
(BodhiProvider): eth provider for eth related communications, mostly compatible with ethers.js AbstractProvider
WsProvider
: provides websocket connection with substrate based chains, used by BodhiProvider internallyTODO: maybe a graph is better.
besides classic signer methods, we have some additional features available only for Evm+. For a comprehensive list please checkout here
await wallet.claimEvmAccounts(evmAddress); // bind an evm address to the signer substrate address
await wallet.claimDefaultAccount(); // bind default evm address to the signer substrate address
wallet.computeDefaultEvmAddress(); // you know it
await wallet.queryEvmAddress(); // Get the signers EVM address if it has claimed one.
Checkout bodhi-examples for some real apps that integrate bodhi signers, with some extra cool features (such as batch transactions).
FAQs
Unknown package
The npm package @acala-network/bodhi receives a total of 76 weekly downloads. As such, @acala-network/bodhi popularity was classified as not popular.
We found that @acala-network/bodhi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.