Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@unfinishedlabs/contracts
Advanced tools
The official DSNP interface and implementations.
$ npm install @unfinishedlabs/contracts
const announcer = require("@unfinishedlabs/contracts/abi/Announcer.json");
const annoucerABI = announcer.abi;
// Requires "resolveJsonModule": true in [tsconfig](https://www.typescriptlang.org/tsconfig#resolveJsonModule)
import { abi as announcerABI } from "@unfinishedlabs/contracts/abi/Announcer.json";
To maintain types, it is suggested to use TypeChain.
"postinstall": "typechain --target=(ethers-v5|web3-v1|other...) node_modules/@unfinishedlabs/contracts/**/*.json --outDir ./types/typechain"
"build:web3types": "typechain --target=web3-v1 node_modules/@unfinishedlabs/contracts/**/*.json --outDir ./types/typechain"
--outDir
is in tsconfig typeRoots.// web3 example
import web3 from "web3";
import { Announcer } from "./types/typechain/Announcer";
import { abi as announcerABI } from "@unfinishedlabs/contracts/abi/Announcer.json";
const getAnnouncerContract = (contractAddress: string) => {
// web3 requires the type cast
return new web3.eth.Contract(announcerABI, contractAddress) as Announcer;
}
// ethersjsv5 example
import { Provider } from "@ethersproject/providers";
import { Announcer } from "./types/typechain/Announcer";
const getAnnouncerContract = (contractAddress: string, provider: Provider) => {
// TypeChain for Ethers provides factories
return Announcer__factory.connect(contractAddress, provider);
}
Once installed, you can use the contracts in the library by importing them:
pragma solidity ^0.8.0;
import "@unfinishedlabs/contracts/IAnnounce.sol";
contract MyAnnouncer is IAnnounce {
// ...
}
We are using hardhat to compile and deploy the contracts
Basic Command List:
npm install
npm run clean
- clears the cache and deletes all artifactsnpm run compile
- compiles the entire project, building all artifactsnpm run console
- opens a hardhat consolenpm run test
- runs mocha testsnpm run lint
- to run the linternpm run format
- to trigger formattingnpm run deploy:testnet
- deploys our deploy.ts
script to our POA testnet defined in the hardhat.config.ts
Environment Variables
.env
file and set values for all variables in .env.sample
Env Variable Name | Description |
---|---|
LOCAL_NETWORK_PRIVATE_KEY | private key for an account we have on our local network that has eth. |
TESTNET_ACCOUNT_PRIVATE_KEY | private key for an account we have on our test network that has eth. |
TESTNET_CHAIN_URL | Url to connect to tesnet |
VALIDATOR1 | hex prefixed address for validator running on node called liberty-chain |
VALIDATOR2 | hex prefixed address for validator running on node called liberty-chain1 |
BOOTNODE | enode address of the node our node would like to connect to |
FAQs
Official DSNP Interfaces, Contracts, and ABIs
The npm package @unfinishedlabs/contracts receives a total of 2 weekly downloads. As such, @unfinishedlabs/contracts popularity was classified as not popular.
We found that @unfinishedlabs/contracts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.