import { IN3 } from '../../in3/sdk-wasm.js'; export declare class Nodelist { in3: IN3; /** initialiazes the Nodelist API * @param in3 - the incubed Client */ constructor(in3: IN3); /** fetches and verifies the nodeList from a node * @param limit - if the number is defined and >0 this method will return a partial nodeList limited to the given number. * @param seed - this 32byte hex integer is used to calculate the indexes of the partial nodeList. It is expected to be a random value choosen by the client in order to make the result deterministic. * @param addresses - a optional array of addresses of signers the nodeList must include. * @return the current nodelist * * **Example** * * ```js * let result = await sdk.nodelist.nodes(2, "0xe9c15c3b26342e3287bb069e433de48ac3fa4ddd32a31b48e426d19d761d7e9b", []) * // result = * // totalServers: 5 * // contract: "0x64abe24afbba64cae47e3dc3ced0fcab95e4edd5" * // registryId: "0x423dd84f33a44f60e5d58090dcdcc1c047f57be895415822f211b8cd1fd692e3" * // lastBlockNumber: 8669495 * // nodes: * // - url: https://in3-v2.slock.it/mainnet/nd-3 * // address: "0x945F75c0408C0026a3CD204d36f5e47745182fd4" * // index: 2 * // deposit: "10000000000000000" * // props: 29 * // timeout: 3600 * // registerTime: 1570109570 * // weight: 2000 * // proofHash: "0x27ffb9b7dc2c5f800c13731e7c1e43fb438928dd5d69aaa8159c21fb13180a4c" * // - url: https://in3-v2.slock.it/mainnet/nd-5 * // address: "0xbcdF4E3e90cc7288b578329efd7bcC90655148d2" * // index: 4 * // deposit: "10000000000000000" * // props: 29 * // timeout: 3600 * // registerTime: 1570109690 * // weight: 2000 * // proofHash: "0xd0dbb6f1e28a8b90761b973e678cf8ecd6b5b3a9d61fb9797d187be011ee9ec7" * ``` * */ nodes(limit?: number, seed?: string, addresses?: string[]): Promise; /** requests a signed blockhash from the node. * In most cases these requests will come from other nodes, because the client simply adds the addresses of the requested signers * and the processising nodes will then aquire the signatures with this method from the other nodes. * * Since each node has a risk of signing a wrong blockhash and getting convicted and losing its deposit, * per default nodes will and should not sign blockHash of the last `minBlockHeight` (default: 6) blocks! * * @param blocks - array of requested blocks. * @return the Array with signatures of all the requires blocks. * * **Example** * * ```js * let result = await sdk.nodelist.signBlockHash(NodelistBlocks(blockNumber: 8770580)) * // result = * // - blockHash: "0xd8189793f64567992eaadefc51834f3d787b03e9a6850b8b9b8003d8d84a76c8" * // block: 8770580 * // r: "0x954ed45416e97387a55b2231bff5dd72e822e4a5d60fa43bc9f9e49402019337" * // s: "0x277163f586585092d146d0d6885095c35c02b360e4125730c52332cf6b99e596" * // v: 28 * // msgHash: "0x40c23a32947f40a2560fcb633ab7fa4f3a96e33653096b17ec613fbf41f946ef" * ``` * */ signBlockHash(blocks: NodelistBlocks): Promise; /** Returns whitelisted in3-nodes addresses. The whitelist addressed are accquired from whitelist contract that user can specify in request params. * @param address - address of whitelist contract * @return the whitelisted addresses * * **Example** * * ```js * let result = await sdk.nodelist.whitelist("0x08e97ef0a92EB502a1D7574913E2a6636BeC557b") * // result = * // totalServers: 2 * // contract: "0x08e97ef0a92EB502a1D7574913E2a6636BeC557b" * // lastBlockNumber: 1546354 * // nodes: * // - "0x1fe2e9bf29aa1938859af64c413361227d04059a" * // - "0x45d45e6ff99e6c34a235d263965910298985fcfe" * ``` * */ whitelist(address: string): Promise; } /** the current nodelist */ export interface NodeListDefinition { /** a array of node definitions. */ nodes: Node[]; /** the address of the Incubed-storage-contract. The client may use this information to verify that we are talking about the same contract or throw an exception otherwise. */ contract: string; /** the registryId (32 bytes) of the contract, which is there to verify the correct contract. */ registryId: string; /** the blockNumber of the last change of the list (usually the last event). */ lastBlockNumber: number; /** the total numbers of nodes. */ totalServer: number; } /** a array of node definitions. */ export interface Node { /** the url of the node. Currently only http/https is supported, but in the future this may even support onion-routing or any other protocols. */ url: string; /** the address of the signer */ address: string; /** the index within the nodeList of the contract */ index: number; /** the stored deposit */ deposit: bigint; /** the bitset of capabilities as described in the [Node Structure](spec.html#node-structure) */ props: string; /** the time in seconds describing how long the deposit would be locked when trying to unregister a node. */ timeout: number; /** unix timestamp in seconds when the node has registered. */ registerTime: number; /** the weight of a node ( not used yet ) describing the amount of request-points it can handle per second. */ weight: number; /** a hash value containing the above values. * This hash is explicitly stored in the contract, which enables the client to have only one merkle proof * per node instead of verifying each property as its own storage value. * The proof hash is build `keccak256( abi.encodePacked( deposit, timeout, registerTime, props, signer, url ))` * */ proofHash: string; } /** array of requested blocks. */ export interface NodelistBlocks { /** the blockNumber to sign */ blockNumber: number; /** the expected hash. This is optional and can be used to check if the expected hash is correct, but as a client you should not rely on it, but only on the hash in the signature. */ hash: string; } /** the Array with signatures of all the requires blocks. */ export interface NodelistSignBlockHash { /** the blockhash which was signed. */ blockHash: string; /** the blocknumber */ block: number; /** r-value of the signature */ r: string; /** s-value of the signature */ s: string; /** v-value of the signature */ v: string; /** the msgHash signed. This Hash is created with `keccak256( abi.encodePacked( _blockhash, _blockNumber, registryId ))` */ msgHash: string; } /** the whitelisted addresses */ export interface NodelistWhitelist { /** array of whitelisted nodes addresses. */ nodes: string; /** the blockNumber of the last change of the in3 white list event. */ lastWhiteList: number; /** whitelist contract address. */ contract: string; /** the blockNumber of the last change of the list (usually the last event). */ lastBlockNumber: number; /** the total numbers of whitelist nodes. */ totalServer: number; } export default Nodelist;