
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
@playmint/hardhat-starknetjs
Advanced tools
Hardhat plugin for integration with StarkNet.js.
This plugin brings to Hardhat the StarkNet library StarkNet.js
, which allows you to interact with StarkNet via javascript in a simple way.
NOTE: This plugin doesn't compile your StarkNet contracts or manage artifacts, it's intended to be used in conjunction with another plugin such as hardhat-starknet-compile.
npm install --save-dev @playmint/hardhat-starknetjs starknet
And add the following to your hardhat.config.ts
:
import "@playmint/hardhat-starknetjs";
Or if you're using Javascript, add this to hardhat.config.js
:
require("@playmint/hardhat-starknetjs");
This plugin adds a field starknetArtifacts
to ProjectPathsConfig
which contains the path to where the plugin should look for artifacts (compiled StarkNet contracts). This defaults to artifacts-starknet
.
It also adds a starknetjs
object to HardhatConfig
which contains networks
, a mapping of network name to network config (as defined by the constructor of StarkNet.js's Provider
object). The default networks populated are goerli-alpha
and mainnet-alpha
, you can add any additional ones you need or change the default networks as you see fit.
const config: HardhatUserConfig = {
paths: {
starknetArtifacts: "artifacts-starknet"
},
starknetjs: {
networks: {
"goerli-alpha": { network: "goerli-alpha" },
"mainnet-alpha": { network: "mainnet-alpha" },
"devnet": { baseUrl: "http://localhost:5000" }
}
}
};
You can select the network you want by either:
STARKNETJS_NETWORK
, or--starknetjs-network
argument when running a script or test, e.g. npx hardhat run scripts/deploy.ts --starknetjs-network devnet
This plugin adds an object called starknetjs
to the Hardhat Runtime Environment.
A networkId
field is added to starknetjs
which is a string, and contains the key of the selected network from hre.config.starknetjs.networks
.
A provider
field is added to starknetjs
, which is a StarkNet.js Provider
automatically connected to the selected network.
function getContractFactory(
contractName: string,
providerOrAccount?: Provider | Account | undefined,
abi?: Abi | undefined): Promise<ContractFactory>;
function getContractFactoryFromArtifact(
artifact: CompiledContract,
providerOrAccount?: Provider | Account | undefined,
abi?: Abi | undefined): ContractFactory;
function getContractAt(
contractName: string,
address: string,
providerOrAccount?: Provider | Account | undefined,
abi?: Abi | undefined): Promise<Contract>;
function getContractAtFromArtifact(
artifact: CompiledContract,
address: string,
providerOrAccount?: Provider | Account | undefined,
abi?: Abi | undefined): Contract;
function getAccount(
address: string,
keyPairOrSigner: KeyPair | SignerInterface,
provider?: Provider): Account;
function readArtifact(searchPath: string): Promise<CompiledContract>;
Example deploy.ts:
import hre from "hardhat";
async function main() {
// these paths will all resolve to the same artifact
let factory = await hre.starknetjs.getContractFactory("test");
factory = await hre.starknetjs.getContractFactory("artifacts-starknet/test");
factory = await hre.starknetjs.getContractFactory("test.cairo");
factory = await hre.starknetjs.getContractFactory("test.cairo/test.json");
const instance = await factory.deploy();
await instance.invoke_some_func(42);
console.log(await instance.get_some_value());
}
main().catch(err => console.error(err));
FAQs
Hardhat plugin to integrate StarkNet.js
The npm package @playmint/hardhat-starknetjs receives a total of 0 weekly downloads. As such, @playmint/hardhat-starknetjs popularity was classified as not popular.
We found that @playmint/hardhat-starknetjs 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 pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.