Skip to main content

@nilfoundation/niljs

Classes

ClassDescription
BaseClientBaseClient is the base class for any client tasked with interacting with =nil; BaseClient
BaseErrorThe base class for custom errors.
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
ExternalTransactionEnvelopeThe envelope for an external transaction (a transaction sent by a user, a dApp, etc.)
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 tokens. 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.
InternalTransactionEnvelopeThe envelope for an internal transaction (a transaction 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).
SmartAccountV1SmartAccountV1 is a class used for performing operations on the cluster that require authentication.

Interfaces

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

Type Aliases

Type aliasDescription
AbiCallArgsThe args for peforming a call with the specified ABI and function name.
AbiEventParametersToPrimitiveTypes-
AbiEventParameterToPrimitiveType-
AbiEventTopicToPrimitiveType-
AbiItem-
AbiItemArgs-
AbiItemName-
ArrayToObject-
BaseCallArgsThe args for performing a call to a smart contract.
BlockThe block type. Type T determines whether the block contains processed transactions or just transaction hashes.
BlockTagThe block tag type.
CallArgsThe args for performing either a call with embedded data or a call with a specific ABI and function name.
CallParamsRepresents the transaction call params.
CallResThe structure representing the results of a call.
CometaServiceConfigThe type representing the config for the Cometa service client.
CommonReadContractMethods-
CommonWriteContractMethods-
ContractConstructorArgs-
ContractDataContract data.
ContractErrorArgs-
ContractErrorName-
ContractEventArgs-
ContractEventArgsFromTopics-
ContractEventName-
ContractFunctionArgs-
ContractFunctionName-
ContractFunctionParameters-
ContractFunctionReturnType-
ContractOverrideThe structure for overriding certain contract params.
DataCallArgsThe args for performing a call with some embedded data.
DeployParamsRepresents the params for deploying a smart contract.
EstimateFeeResult-
EventDefinition-
ExternalContractsMethod-
ExternalTransactionThe external transaction type.
ExtractAbiFunctionForArgs-
ExtractAbiItem-
ExtractAbiItemForArgs-
ExtractAbiItemNames-
FaucetClientConfigThe type representing the config for the faucet client.
FilterFilters out all members of T that are not P
GetContractParams-
GetEventArgs-
GetValue-
HexThe hex type.
IAddressIAddress type represents an address in hexadecimal format.
IBaseErrorParametersThe interface for the parameters of the BaseError constructor.
IClientBaseConfigThe client configuration that is shared between public and private clients.
IDeployContractOptionsThe options for deploying a contract.
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.
ISendTransactionOptionsThe options for sending a transaction.
ISignTransactionOptionsThe options for signing a transaction.
ISmartAccountClientConfigThe type representing the config for the basic smart account.
IsNarrowable-
IsUnion-
LocationLocation.
LogTopic-
LogTopicType-
MaybeAbiEventName-
MaybeExtractEventArgsFromAbi-
MaybeRequired-
OutTransactionThe structure representing an outgoing transaction (a transaction created by a smart contract after another transaction triggers its execution).
ProcessedReceipt-
ProcessedTransactionThe structure representing a processed transaction.
ReadContractParameters-
ReadContractReturnType-
ReadContractsMethod-
ReceiptThe receipt interface.
RequestParamsRepresents the params for making a request to the smart account.
SendAbiTransactionParams-
SendBaseTransactionParams-
SendDataTransactionParams-
SendSyncAbiTransactionParams-
SendSyncBaseTransactionParams-
SendSyncDataTransactionParams-
SendSyncTransactionParamsRepresents the params for sending a transaction synchronously.
SendTransactionParamsRepresents the params for sending a transaction.
SmartAccountV1ConfigRepresents the smart account configuration.
TokenThe structure representing a custom token.
TopUpParamsThe parameters for the top up request.
UnionEvaluate-
UnionToTuple-
UnionWiden-
Widen-
WriteContractParameters-
WriteContractsMethod-
WriteOptions-

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-
externalDeploymentTransactionCreates a new external deployment transaction.
externalTransactionEncodeEncodes the given external transaction.
generateRandomKeyPairGenerate a new private key and its corresponding public key.
generateRandomPrivateKeyGenerate a new private key.
generateSmartAccount-
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.
mapReceipt-
poseidonHash-
prepareDeployPartRefines the provided salt and generates the full bytecode for deployment. Returns the bytecode and the deployment address.
privateKeyFromPhraseGenerate the private key from the mnemonic phrase.
refineAddressRefines the address.
removeHexPrefixRemove the hex prefix from the hex string.
toHexConverts a string, number, bigint, boolean, or ByteArrayType to a hex string.
topUp-
waitTillCompletedMakes it so that the client waits until the processing of the transaction whose hash is passed.
writeContract-
writeExternalContract-