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.
CometaServiceCometaService is a client that interacts with the Cometa service. Cometa service is used to store contract metadata: source code, ABI, etc. CometaService
ExternalMessageEnvelopeThe envelope for an external message (a message sent by a user, a dApp, etc.)
FaucetThe Faucet is a special contract that is used to top up other contracts in the =nil; devnet.
FaucetClientFaucetClient is a client that interacts with the faucet api. It is used to get information about the faucet and to top up the account with custom currencies. FaucetClient
HttpTransportHttpTransport represents the HTTP transport for connecting to the network.
IntegerOutOfRangeErrorThe error class for 'integer out of range' errors. This error is thrown when the requested integer is out of range.
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.
ITransportThe transport interface.
LocalECDSAKeySignerThe LocalKeySigner is a class that allows for signing data with the private key. It uses the secp256k1 curve implementation by the @noble/curves/secp256k1 library.
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
AbiEventParametersToPrimitiveTypes-
AbiEventParameterToPrimitiveType-
AbiEventTopicToPrimitiveType-
AbiItem-
AbiItemArgs-
AbiItemName-
BlockThe block type. Type T determines whether the block contains processed messages or just message hashes.
BlockTagThe block tag type.
CallParamsRepresents the message call params.
CometaServiceConfigThe type representing the config for the Cometa service client.
CommonReadContractMethods-
CommonWriteContractMethods-
ContractConstructorArgs-
ContractDataContract data.
ContractErrorArgs-
ContractErrorName-
ContractEventArgs-
ContractEventArgsFromTopics-
ContractEventName-
ContractFunctionArgs-
ContractFunctionName-
ContractFunctionParameters-
ContractFunctionReturnType-
DeployParamsRepresents the params for deploying a smart contract.
EventDefinition-
ExternalMessageThe external message type.
ExtractAbiFunctionForArgs-
ExtractAbiItem-
ExtractAbiItemForArgs-
ExtractAbiItemNames-
FaucetClientConfigThe type representing the config for the faucet client.
GetContractParams-
GetEventArgs-
GetValue-
HexThe hex type.
IAddressIAddress type represents an address in hexadecimal format.
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.
LocationLocation.
LogTopic-
LogTopicType-
MaybeAbiEventName-
MaybeExtractEventArgsFromAbi-
ProcessedReceipt-
ReadContractParameters-
RequestParamsRepresents the params for making a request to the wallet.
SendAbiMessageParams-
SendBaseMessageParams-
SendDataMessageParams-
SendMessageParamsRepresents the params for sending a message.
SendSyncAbiMessageParams-
SendSyncBaseMessageParams-
SendSyncDataMessageParams-
SendSyncMessageParamsRepresents the params for sending a message synchronously.
TokenThe structure representing a custom currency.
TopUpParamsThe parameters for the top up request.
UnionEvaluate-
UnionWiden-
WalletV1ConfigRepresents the wallet configuration.
Widen-
WriteContractParameters-

Variables

VariableDescription
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
addHexPrefixAdd the hex prefix to the hex string.
bytesToHex-
bytesToStringConverts bytes to a string.
calculateAddressCalculates an address.
concatHexConcatenates an array of hex strings. The hex strings are concatenated without the "0x" prefix. The resulting hex string will have the "0x" prefix.
contractInteraction-
convertEthToWei-
externalDeploymentMessageCreates a new external deployment message.
externalMessageEncodeEncodes the given external message.
generateRandomKeyPairGenerate a new private key and its corresponding public key.
generateRandomPrivateKeyGenerate a new private key.
getAddressFromPublicKeyReturns the address from the public key.
getContract-
getPublicKeyReturns the public key from the private key using the secp256k1 curve.
getShardIdFromAddressReturns the ID of the shard containing the provided address.
hexToBigIntConverts a hex string to a bigint.
hexToBytesConverts a hex string to a byte array.
hexToNumberConverts a hex string to a number.
isAddressChecks if the value is an address. If the value is an address, returns true. Otherwise, returns false.
isHexStringChecks if the value is a hex string. If the value is a hex string, returns true. Otherwise, returns false.
isValidBlockChecks if the provided block is valid.
poseidonHash-
refineAddressRefines the address.
removeHexPrefixRemove the hex prefix from the hex string.
toHexConverts a string, number, bigint, boolean, or ByteArrayType to a hex string.
waitTillCompletedMakes it so that the client waits until the processing of the message whose hash is passed.
writeContract-