0.2.0 • Published 5 years ago
@drizzle-utils/get-contract-instance v0.2.0
@drizzle-utils/get-contract-instance
Retrieves a Web3.js contract instance.
You can pass in a contract artifact JSON generated by Truffle (i.e. truffle compile
and truffle migrate
), or you can pass in the contract ABI and address.
A warning will let you know if a deployed address is not supplied, to suppress the warning, pass in suppressWarnings: true
into the options object.
Usage
Import the helper function:
import getContractInstance from "@drizzle-utils/get-contract-instance";
With Truffle artifact
import SimpleStorage from "./SimpleStorage.json";
const instance = await getContractInstance({
web3,
artifact: SimpleStorage,
});
With ABI and contract address
const instance = await getContractInstance({
web3,
abi: contractAbi,
address: "0x..."
});
With ABI only
const instance = await getContractInstance({
web3,
abi: contractAbi,
});
Note that this instance will not have a contract address attached to it.
0.2.0
5 years ago
0.1.7-alpha.0
5 years ago
0.1.6-alpha.0
5 years ago
0.1.4-alpha.0
5 years ago
0.1.3-alpha.0
5 years ago
0.1.2-alpha.0
5 years ago