
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
This package is intended to simplify interaction with Nil blockchain during its DevNet phase and will probably be deprecated with the evolution of Nil.js
Ensure you have Yarn installed. Then, install the package using Yarn:
yarn add simple-nil
This package relies on the following peer dependencies. Ensure they are installed in your project:
Install them using Yarn:
yarn add @nilfoundation/niljs viem
The XClient class manages blockchain communications, handles external calls, and interacts with the underlying blockchain network. It serves as the bridge between your wallet and the blockchain, facilitating message sending and currency management.
import { XClient } from "simple-nil";
const client = new XClient({
shardId: 1,
rpc: "https://rpc.endpoint.com",
signerOrPrivateKey:
"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
});
If you need to connect the client with a different signer (private key), shardId or rpc, you can use the connect
method:
const newSignerPrivateKey =
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef";
const newClient = client.connect({
signerOrPrivateKey: newSignerPrivateKey
});
The XWallet class provides functionalities to manage and interact with an XWallet instance on the blockchain. It allows for deploying contracts, approving spenders, creating currencies, and more.
import { XWallet } from "simple-nil";
import { XWalletConfig } from "simple-nil/types";
const wallet = await XWallet.init({
address: "0x0000167890abcdef1234567890abcdef12345678",
rpc: "https://rpc.endpoint.com",
signerOrPrivateKey:
"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
});
console.log("Initialized XWallet:", wallet.address);
import { XWallet, XClient } from "simple-nil";
const deployedWallet = await XWallet.deploy({
shardId: 1,
rpc: "https://rpc.endpoint.com",
signerOrPrivateKey:
"0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
});
console.log("Deployed XWallet Address:", deployedWallet.address);
The XContract class provides functionalities to interact with deployed smart contracts. It allows connecting to existing contracts, deploying new ones, and invoking contract methods.
import { XContract, XWallet } from "simple-nil";
// Assuming you have an initialized XWallet instance
const wallet = await XWallet.init(options);
// Define the ABI of your contract
const abi = [
/* Your Contract ABI */
];
// Address of the deployed contract
const contractAddress = "0xabcdef1234567890abcdef1234567890abcdef12";
// Connect to the contract
const contract = XContract.connect(wallet, abi, contractAddress);
import { XContract, XWallet } from "simple-nil";
// Assuming you have an initialized XWallet instance
const wallet = await XWallet.init(options);
// Define the ABI and bytecode of your contract
const artifact = {
abi: [
/* Your Contract ABI */
],
bytecode: "0x6001600101", // Replace with your contract's bytecode
};
// Constructor arguments for your contract
const args = [
/* Constructor Arguments */
];
const shardId = 1;
const salt = BigInt(Date.now());
const newContract = await XContract.deploy(
wallet,
artifact,
args,
shardId,
salt,
);
console.log("Deployed Contract Address:", newContract.address);
0.1.3
FAQs
nil-chain client side utils
The npm package simple-nil receives a total of 0 weekly downloads. As such, simple-nil popularity was classified as not popular.
We found that simple-nil demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.