@nilfoundation/niljs
Classes
| Class | Description |
|---|---|
| BlockNotFoundError | The error class for 'block not found' errors. This error is thrown when the requested block is not found. |
| ExternalMessageEnvelope | The envelope for an external message (a message sent by a user, a dApp, etc.) |
| Faucet | The Faucet is a special contract that is used to top up other contracts in the =nil; devnet. |
| HttpTransport | HttpTransport represents the HTTP transport for connecting to the network. |
| IntegerOutOfRangeError | The error class for 'integer out of range' errors. This error is thrown when the requested integer is out of range. |
| InternalMessageEnvelope | The envelope for an internal message (a message sent by a smart contract to another smart contract). |
| InvalidShardIdError | The error class for invalid shard ID. This error is thrown when the provided shard ID is invalid. |
| ITransport | The transport interface. |
| LocalECDSAKeySigner | The 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. |
| MetaMaskSigner | The MetaMaskSigner is a class that allows for signing data using MetaMask. This signer can only be used inside a browser. |
| MetaMaskTransport | MetaMask transport represents the MetaMask transport for connecting to the network. MetaMask transport can be used in browser only. MetaMaskTransport |
| PublicClient | PublicClient 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). |
| WalletV1 | WalletV1 is a class used for performing operations on the cluster that require authentication. |
Interfaces
| Interface | Description |
|---|---|
| IMessage | The 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. |
| ISigner | The interface for the Signer class |
Type Aliases
| Type alias | Description |
|---|---|
| Block | The block type. Type T determines whether the block contains processed messages or just message hashes. |
| BlockTag | The block tag type. |
| CallParams | Represents the message call params. |
| DeployParams | Represents the params for deploying a smart contract. |
| ExternalMessage | The external message type. |
| Hex | The hex type. |
| IClientBaseConfig | The client configuration that is shared between public and private clients. |
| IDeployData | - |
| IHttpTransportConfig | The interface representing the configuration of the HTTP transport. |
| ILocalKeySignerConfig | The interface for the configuration object of LocalKeySigner. |
| ILog | The log interface. |
| IPrivateKey | IPrivateKey represents a private key in hexadecimal format. |
| IPublicClientConfig | The type representing the config for the public client. |
| IReceipt | The receipt interface. |
| ISendMessageOptions | The options for sending a message. |
| ISignature | The interface for the signature. It contains the r, s, and yParity values. |
| ISignedMessage | The signed message interface. |
| IWalletClientConfig | The type representing the config for the basic wallet. |
| ProcessedReceipt | - |
| RequestParams | Represents the params for making a request to the wallet. |
| SendAbiMessageParams | - |
| SendBaseMessageParams | - |
| SendDataMessageParams | - |
| SendMessageParams | Represents the params for sending a message. |
| SendSyncAbiMessageParams | - |
| SendSyncBaseMessageParams | - |
| SendSyncDataMessageParams | - |
| SendSyncMessageParams | Represents the params for sending a message synchronously. |
| WalletV1Config | Represents the wallet configuration. |
Variables
| Variable | Description |
|---|---|
| SszMessageSchema | The SSZ schema for a message object. |
| SszSignedMessageSchema | SSZ schema for a signed message object. Includes auth data in addition to all other message fields. |
Functions
| Function | Description |
|---|---|
| addHexPrefix | Add the hex prefix to the hex string. |
| bytesToHex | - |
| bytesToString | Converts bytes to a string. |
| calculateAddress | Calculates an address. |
| concatHex | Concatenates an array of hex strings. The hex strings are concatenated without the "0x" prefix. The resulting hex string will have the "0x" prefix. |
| convertEthToWei | - |
| externalDeploymentMessage | Creates a new external deployment message. |
| externalMessageEncode | Encodes the given external message. |
| generateRandomPrivateKey | Generate a new private key. |
| getAddressFromPublicKey | Returns the address from the public key. |
| getPublicKey | Returns the public key from the private key using the secp256k1 curve. |
| getShardIdFromAddress | Returns the ID of the shard containing the provided address. |
| hexToBigInt | Converts a hex string to a bigint. |
| hexToBytes | Converts a hex string to a byte array. |
| hexToNumber | Converts a hex string to a number. |
| isAddress | Checks if the value is an address. If the value is an address, returns true. Otherwise, returns false. |
| isHexString | Checks if the value is a hex string. If the value is a hex string, returns true. Otherwise, returns false. |
| isValidBlock | Checks if the provided block is valid. |
| poseidonHash | Creates the Poseidon hash of the given bytes. |
| refineAddress | Refines the address. |
| removeHexPrefix | Remove the hex prefix from the hex string. |
| toHex | Converts a string, number, bigint, boolean, or ByteArrayType to a hex string. |
| waitTillCompleted | Makes it so that the client waits until the processing of the message whose hash is passed. |