contract-store
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.1 • Public • Published

Contract Store

⚠️ The package is quite recent, any contributions, issues or feedbacks are welcome ⚠️

Get started

The recommended way to use Contract-Store with an application is to install it as a dependency:

Using npm

npm install contract-store@alpha --save-dev

Or using yarn

yarn add contract-store@alpha --dev

Then, one can start storing and using the needed ABIs or deployments

import { ContractStore } from 'contract-store';

// Store is for Mainnet wich chain ID 1
const store = new ContractStore(1);

const MY_ABI = [...];
// Register the ABI and the deployment at key 'FOO'
store.registerContract('FOO', {
    address: '0xCe6afb858673550635b49F8Ffb855b20334228dF',
    abi: MY_ABI
});

// Register a deployment at key 'BAR' with the default ERC20 ABI
store.registerDeployment('BAR', {
    address: '0x5A22EA0DC6553267bDB273eB55Ccb40EFA78F804',
    // ERC20, ERC721 and ERC1155 abis are by default included in the store
    abiKey: 'ERC20'
});

...
// ABI and deployment address can then be retrieved anywhere
const tokenArtifacts = store.getContract('BAR');
const token = buildContract(tokenArtifacts.address, tokenArtifacts.abi);

const myContractArtifacts = store.getContract('FOO');
const myContract = buildContract(myContractArtifacts.address, myContractArtifacts.abi);

Contributing 🚀

Contributions are welcome! Please follow the guidelines in the contributing document.

Readme

Keywords

Package Sidebar

Install

npm i contract-store

Weekly Downloads

4

Version

1.0.0-alpha.1

License

MIT

Unpacked Size

61.4 kB

Total Files

19

Last publish

Collaborators

  • vincentgenod