
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@knine-sdk/contracts
Advanced tools
Contracts for Knine projects. Part of Knine JS SDK
A Contract is an abstraction of code that has been deployed to the blockchain. A Contract may be sent transactions, which will trigger its code to be run with the input of the transaction data. More details in the ethers docs.
It uses TypeChain under the hood to generate TypeScript typings for contacts.
yarn add @knine-sdk/contracts
Each getter returns a cached Contract instance with an attached Provider and an ABI. The Provider is required to work with the network and sign transactions and the ABI contains information about methods of the contract on the ethereum side. So, the resulting instance contains all the methods supported by the contract and allows you to call them.
If a contract method requires signing a transaction, then you need a provider with Signer
Returns an instance of Contract based on ERC20 standard contract ABI.
import { getERC20Contract } from '@knine-sdk/contracts';
import { JsonRpcProvider } from '@ethersproject/providers';
const provider = new JsonRpcProvider('http://localhost:8545');
const contract = getERC20Contract(
'0xae7ab96520de3a18e5e111b5eaab095312d7fe84',
provider,
);
const symbol = await contract.symbol();
const decimals = await contract.decimals();
Returns an instance of Contract based on stETH contract ABI.
Returns an instance of Contract based on WithdrawalQueue contract ABI.
Returns an instance of Contract based on ChainLink USD/ETH price oracle ABI.
To get another contract instance, getters have a third optional parameter cacheSeed.
Calls without cacheSeed or with the same cacheSeed return the same contracts:
const contractFirst = getERC20Contract('0x0...', provider, 1);
const contractSecond = getERC20Contract('0x0...', provider, 1);
contractFirst === contractSecond; // true
Calls with different cacheSeed return different contracts:
const contractFirst = getERC20Contract('0x0...', provider, 1);
const contractSecond = getERC20Contract('0x0...', provider, 2);
contractFirst !== contractSecond; // true
Of course, if the cacheSeed is the same, but address or provider are different the result contracts will also be different:
const contractFirst = getERC20Contract('0x1...', provider, 1);
const contractSecond = getERC20Contract('0x0...', provider, 1);
contractFirst !== contractSecond; // true, because the addresses are different
FAQs
Contracts for Knine projects. Part of Knine JS SDK
The npm package @knine-sdk/contracts receives a total of 2 weekly downloads. As such, @knine-sdk/contracts popularity was classified as not popular.
We found that @knine-sdk/contracts 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.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.