Overview of the Faucet contract class
Faucet class represents a special contract used to top up other contracts within the =nil; devnet.website·Indexed 34 days ago
https://docs.nil.foundation/Documentation for NIL, featuring technical specifications on finality, sequencing, and data availability, as well as developer tools including a Hardhat plugin, block explorer, NIL CLI, and a Solidity library with pre-compiled contracts and function modifiers. Includes a comprehensive client reference for @nilfoundation/niljs with type aliases for message parameters and wallet configurations.
Faucet class represents a special contract used to top up other contracts within the =nil; devnet.getBlockByHash method retrieves information about a block using its hash. It allows specifying whether to return full transaction information and requires the shardId where the block was generated.import { PublicClient, HttpTransport } from '@nilfoundation/niljs';
const client = new PublicClient({
transport: new HttpTransport({
endpoint: RPC_ENDPOINT,
}),
shardId: 1,
});
const block = await client.getBlockByHash(HASH);=nil; provides a default currency distributed by the Faucet contract. Additionally, it supports a multi-currency mechanism where any account (smart contract) can be paid in arbitrary currencies.
Key constraints:
Minter.In nil, every message uses two fields to handle gas and value:
FeeCredit: The amount of nil base tokens allocated for message execution. Unlike Ethereum, there is no base or premium fee; FeeCredit is the gas limit (maximum gas the sender is willing to pay) multiplied by the gas price of the specific shard. It is an estimate, not a precise fee.Value: The amount of tokens transferred directly to the receiving address. These tokens are debited to the receiver and are not used for execution.Caveat: If a message is sent to a non-payable function with a non-zero Value, the execution will revert because the contract cannot accept the tokens.
MetaMaskSigner class allows for signing data using a MetaMask wallet. This signer is only compatible with browser environments and implements the ISigner interface.import { MetaMaskSigner } from '@nilfoundation/niljs';
const signer = new MetaMaskSigner();IReceipt interface represents a transaction receipt in the NIL ecosystem. It contains metadata about the block, gas usage, execution success, and associated logs and messages.type IReceipt = {
blockHash: string;
blockNumber: number;
bloom: string;
contractAddress: string;
gasPrice?: string; // optional
gasUsed: string;
includedInMain: boolean;
logs: ILog[];
messageHash: Hex;
msgIndex: number;
outMessages: Hex[] | null;
outputReceipts: (IReceipt | null)[] | null;
shardId: number;
success: boolean;
};ISigner interface defines the standard set of methods required for a Signer class in the niljs library. It provides functionality to retrieve the account address, the public key, and to cryptographically sign data.