
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@openzeppelin/contract-loader
Advanced tools
Load contract ABIs from built artifacts and return contract objects
https://www.npmjs.org/package/@openzeppelin/contract-loader[image:https://img.shields.io/npm/v/@openzeppelin/contract-loader.svg[NPM]] https://circleci.com/gh/OpenZeppelin/openzeppelin-contract-loader[image:https://circleci.com/gh/OpenZeppelin/openzeppelin-contract-loader.svg?style=shield[CircleCI]]
= Contract Loader
Load contract objects from built artifacts or ABIs. Includes support for both web3-eth-contract and @truffle/contract objects.
== Overview
=== Installation
npm install @openzeppelin/contract-loader
You may also need to install https://www.npmjs.com/package/web3-eth-contract[`web3-eth-contract`] or https://www.npmjs.com/package/@truffle/contract[`@truffle/contract`], depending on which abstractions you want to be able to load.
=== Usage
Create a loader object:
const { setupLoader } = require('@openzeppelin/contract-loader');
const loader = setupLoader({
provider, // either a web3 provider or a web3 instance
defaultSender, // optional
defaultGas, // optional, defaults to 8 million
});
Load web3 contracts:
const ERC20 = loader.web3.fromArtifact('ERC20');
// Deploy contract
const token = await ERC20.deploy().send();
// Send transactions and query state
const balance = await token.methods.balanceOf(sender).call();
await token.methods.transfer(receiver, balance).send({ from: sender });
Load Truffle contracts:
const ERC20 = loader.truffle.fromArtifact('ERC20');
// Deploy contract
const token = await ERC20.new();
// Send transactions and query state
const balance = await token.balanceOf(sender);
await token.transfer(receiver, balance, { from: sender });
== Learn More
== License
link:LICENSE[MIT].
FAQs
Load contract ABIs from built artifacts and return contract objects
The npm package @openzeppelin/contract-loader receives a total of 12,271 weekly downloads. As such, @openzeppelin/contract-loader popularity was classified as popular.
We found that @openzeppelin/contract-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.