Skip to main content

@nilfoundation/niljs

Classes

ClassDescription
BlockNotFoundErrorThe error class for 'block not found' errors. This error is thrown when the requested block is not found.
ExternalMessageEnvelopeThe envelope for an external message (a message sent by a user, a dApp, etc.)
FaucetFaucet is a special contract that is used to top up other contracts in the =nil; devnet.
HttpTransportHttpTransport represents the HTTP transport for connecting to the network.
ITransportThe transport interface.
InternalMessageEnvelopeThe envelope for an internal message (a message sent by a smart contract to another smart contract).
InvalidShardIdErrorThe error class for invalid shard ID. This error is thrown when the provided shard ID is invalid.
LocalECDSAKeySignerLocalKeySigner is a class that allows for signing data with the private key. It uses the secp256k1 curve implementation by the @noble/curves/secp256k1 library.
MetaMaskSignerMetaMaskSigner is a class that allows for signing data using MetaMask. This signer can only be used inside a browser.
MetaMaskTransportMetaMask transport represents the MetaMask transport for connecting to the network. MetaMask transport can be used in browser only. MetaMaskTransport
PublicClientPublicClient is a class that allows for interacting with the network via the JSON-RPC API. It provides an abstraction of the connection to =nil;. PublicClient enables using API requests that do not require signing data (or otherwise using one's private key).
WalletV1WalletV1 is a class used for performing operations on the cluster that require authentication.

Interfaces

InterfaceDescription
IMessageThe interface for the message object. This object is used to represent a message in the client code. It may differ from the actual message object used inside the network.
ISignerThe interface for the Signer class

Type Aliases

Type aliasDescription
BlockThe block type.
BlockTagThe block tag type.
CallParamsRepresents the message call params.
DeployParamsRepresents the params for deploying a smart contract.
ExternalMessageThe external message type.
HexThe hex type.
IClientBaseConfigThe client configuration that is shared between public and private clients.
IDeployData-
IHttpTransportConfigThe interface representing the configuration of the HTTP transport.
ILocalKeySignerConfigThe interface for the configuration object of LocalKeySigner.
ILogThe log interface.
IPrivateKeyIPrivateKey represents a private key in hexadecimal format.
IPublicClientConfigThe type representing the config for the public client.
IReceiptThe receipt interface.
ISendMessageOptionsThe options for sending a message.
ISignatureThe interface for the signature. It contains the r, s, and yParity values.
ISignedMessageThe signed message interface.
IWalletClientConfigThe type representing the config for the basic wallet.
RequestParamsRepresents the params for making a request to the wallet.
SendMessageParamsRepresents the params for sending a message.
SendSyncMessageParamsRepresents the params for sending a message synchronously.
WalletV1ConfigRepresents the wallet configuration.

Variables

VariableDescription
MINTER_ABIThe ABI of the minter contract.
MINTER_ADDRESSThe address of the minter contract.
SszMessageSchemaThe SSZ schema for a message object.
SszSignedMessageSchemaSSZ schema for a signed message object. Includes auth data in addition to all other message fields.

Functions

FunctionDescription
addHexPrefix-
bytesToString-
calculateAddress-
convertEthToWei-
externalDeploymentMessage-
externalMessageEncode-
generateRandomPrivateKey-
getAddressFromPublicKey-
getPublicKey-
getShardIdFromAddress-
hexToBigInt-
hexToNumber-
isAddress-
isHexString-
isValidBlock-
poseidonHash-
refineAddress-
removeHexPrefix-
toHex-
waitTillCompleted-