Skip to content

Class: Node

Rocket Pool Node Manager

Constructors

constructor

new Node(web3, contracts)

Create a new Node instance.

Parameters

NameTypeDescription
web3defaultA valid Web3 instance
contractsContractsA Rocket Pool contract manager instance

Defined in

rocketpool/node/node.ts:25

Accessors

rocketNodeDeposit

Private get rocketNodeDeposit(): Promise<Contract>

Private accessor use to retrieve the related contract

Returns

Promise<Contract>

a Promise<Contract> with a web3.eth.contract instance of the rocketNodeDeposit contract

Defined in

rocketpool/node/node.ts:31


rocketNodeManager

Private get rocketNodeManager(): Promise<Contract>

Private accessor use to retrieve the related contract

Returns

Promise<Contract>

a Promise<Contract> with a web3.eth.contract instance of the rocketNodeManager contract

Defined in

rocketpool/node/node.ts:39


rocketNodeStaking

Private get rocketNodeStaking(): Promise<Contract>

Private accessor use to retrieve the related contract

Returns

Promise<Contract>

a Promise<Contract> with a web3.eth.contract instance of the rocketNodeStaking contract

Defined in

rocketpool/node/node.ts:47


rocketStorage

Private get rocketStorage(): Promise<Contract>

Private accessor use to retrieve the related contract

Returns

Promise<Contract>

a Promise<Contract> with a web3.eth.contract instance of the rocketStorage contract

Defined in

rocketpool/node/node.ts:55

Methods

getNodes

getNodes(): Promise<NodeDetails[]>

Get an array of Node Details

example using Typescript

ts
const nodes = rp.node.getNodes().then((val: string) => { val };

Returns

Promise<NodeDetails[]>

a Promise<NodeDetails[]> that resolves to an array of NodeDetails

Defined in

rocketpool/node/node.ts:68


getNodeAddresses

getNodeAddresses(): Promise<string[]>

Get an array of node addresses

example using Typescript

ts
const addresses = rp.node.getNodesAddresses().then((val: string[]) => { val };

Returns

Promise<string[]>

a Promise<string[]> that resolves to an array of node addresses

Defined in

rocketpool/node/node.ts:87


getNodeDetails

getNodeDetails(address): Promise<NodeDetails>

Get a node's details

example using Typescript

ts
const nodeDetail = rp.node.getNodeDetails("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: NodeDetails) => { val }

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<NodeDetails>

a Promise<NodeDetails> that resolves to a NodeDetails object

Defined in

rocketpool/node/node.ts:107


getNodeCount

getNodeCount(): Promise<number>

Get the total node count

example using Typescript

ts
const nodeCount = rp.node.getNodeCount().then((val: number) => { val };

Returns

Promise<number>

a Promise<number> that resolves to a number representing the quantity of total nodes

Defined in

rocketpool/node/node.ts:126


getNodeAt

getNodeAt(index): Promise<string>

Get a node address by index

example using Typescript

ts
const nodeAddress = rp.node.getNodeAt(5).then((val: string) => { val };

Parameters

NameTypeDescription
indexnumberA number representing the index of the node

Returns

Promise<string>

a Promise<string> that resolves to a string representing a node address

Defined in

rocketpool/node/node.ts:144


getNodeExists

getNodeExists(address): Promise<boolean>

Check whether a node exists

example using Typescript

ts
const exists = rp.node.getNodeExists("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: boolean) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<boolean>

a Promise<boolean> that resolves to a boolean representing whether the node exists or not

Defined in

rocketpool/node/node.ts:160


getNodeTimezoneLocation

getNodeTimezoneLocation(address): Promise<string>

Get a node's timezone location

example using Typescript

ts
const tz = rp.node.getNodeTimezoneLocation("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's timezone

Defined in

rocketpool/node/node.ts:176


getNodeWithdrawalAddress

getNodeWithdrawalAddress(address): Promise<string>

Get a node's withdrawal address

example using Typescript

ts
const withdrawalAddress = rp.node.getNodeWithdrawalAddress("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's withdrawal address

Defined in

rocketpool/node/node.ts:192


getNodeRPLStake

getNodeRPLStake(address): Promise<string>

Get a node's RPL stake

example using Typescript

ts
const nodeRPLStake = rp.node.getNodeRPLStake("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's RPL stake

Defined in

rocketpool/node/node.ts:208


getNodeEffectiveRPLStake

getNodeEffectiveRPLStake(address): Promise<string>

Get a node's effective RPL stake

example using Typescript

ts
const nodeEffectiveRPLStake = rp.node.getNodeEffectiveRPLStake("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's effective RPL stake

Defined in

rocketpool/node/node.ts:224


getNodeMinipoolLimit

getNodeMinipoolLimit(address): Promise<string>

Get the node minipool limit

example using Typescript

ts
const nodeMinipoolLimit = rp.node.getNodeMinipoolLimit("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node minipool limit

Defined in

rocketpool/node/node.ts:240


getNodeTotalEffectiveRPLStake

getNodeTotalEffectiveRPLStake(): Promise<string>

Get a node's total effective RPL stake

example using Typescript

ts
const nodeTotalEffectiveRPLStake = rp.node.getNodeTotalEffectiveRPLStake("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's RPL stake

Defined in

rocketpool/node/node.ts:256


getNodeMinimumRPLStake

getNodeMinimumRPLStake(address): Promise<string>

Get a node's minimum RPL stake

example using Typescript

ts
const nodeRPLStake = rp.node.getNodeRPLStake("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's minimum RPL stake

Defined in

rocketpool/node/node.ts:272


getNodePendingWithdrawalAddress

getNodePendingWithdrawalAddress(address): Promise<string>

Get a node's pending withdrawal address

example using Typescript

ts
const pendingWithdrawalAddress = rp.node.getNodePendingWithdrawalAddress("0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294").then((val: string) => { val };

Parameters

NameTypeDescription
addressstringA string representing a node address

Returns

Promise<string>

a Promise<string> that resolves to a string representing the node's pending withdrawal address

Defined in

rocketpool/node/node.ts:288


getTotalEffectiveRPLStake

getTotalEffectiveRPLStake(): Promise<string>

Get the total effective RPL stake

example using Typescript

ts
const totalEffectiveRPLStake = rp.node.getTotalEffectiveRPLStake().then((val: string) => { val };

Returns

Promise<string>

a Promise<string> that resolves to a string representing the total effective rpl stake

Defined in

rocketpool/node/node.ts:303


getTotalRPLStake

getTotalRPLStake(): Promise<string>

Get the total RPL stake

example using Typescript

ts
const totalRPLStake = rp.node.getTotalRPLStake().then((val: string) => { val };

Returns

Promise<string>

a Promise<string> that resolves to a string representing the total rpl stake

Defined in

rocketpool/node/node.ts:318


calculateTotalEffectiveRPLStake

calculateTotalEffectiveRPLStake(offset, limit, rplPrice): Promise<string>

Calculate the total effective RPL stake provided inputs

params offset a number representing the offset

params limit a number representing the limit

params rplPrice a string representing the rplPrice

example using Typescript

ts
const calculatedTotalEffectiveRPLStake = rp.node.calculateTotalEffectiveRPLStake(offset, limit, rplPrice).then((val: string) => { val };

Parameters

NameType
offsetnumber
limitnumber
rplPricestring

Returns

Promise<string>

a Promise<string> that resolves to a string representing the calculated RPL stake given inputs

Defined in

rocketpool/node/node.ts:336


getNodeCountPerTimezone

getNodeCountPerTimezone(offset, limit): Promise<object>

Get a breakdown of the number of nodes per timezone

params offset a number representing the offset

params limit a number representing the limit

example using Typescript

ts
const nodeCountPerTimezone = rp.node.getNodeCountPerTimezone(offset, limit).then((val: object) => { val };

Parameters

NameType
offsetnumber
limitnumber

Returns

Promise<object>

a Promise<object> that resolves to an object node counts per timezone

Defined in

rocketpool/node/node.ts:353


getDepositType

getDepositType(amount): Promise<number>

Get the deposit type

params amount a number representing the deposit amount

example using Typescript

ts
const nodeCountPerTimezone = rp.node.getNodeCountPerTimezone(offset, limit).then((val: object) => { val };

Parameters

NameType
amountstring

Returns

Promise<number>

a Promise<number> that resolves to a number representing the minipool deposit enum value type

Defined in

rocketpool/node/node.ts:369


registerNode

registerNode(timezoneLocation, options?, onConfirmation?): Promise<TransactionReceipt>

Register a node

example using Typescript

ts
const timezoneLocation = "Australia/Brisbane";
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.registerNode(timezoneLocation, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
timezoneLocationstringA string representing the timezone location
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:393


setWithdrawalAddress

setWithdrawalAddress(nodeAddress, withdrawalAddress, confirm, options?, onConfirmation?): Promise<TransactionReceipt>

Set a node's withdrawal address

example using Typescript

ts
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const withdrawalAddress = "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7";
const confirm = false; // will set the withdrawalAddress to pending
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.setWithdrawalAddress(nodeAddress, withdrawalAddress, confirm, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
nodeAddressstringA string representing the node's address
withdrawalAddressstringA string representing the withdrawalAddress
confirmbooleanA boolean representing as to whether you which to auto confirm, true will auto confirm (negating the need to prove your ownership of the withdrawal address), false will set the withdrawal address to pending and will require an additional transaction (see confirmWithdrawalAddress) signed by the withdrawalAddress to prove ownership.
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:422


stakeRPL

stakeRPL(amount, options?, onConfirmation?): Promise<TransactionReceipt>

Stake RPL for a node address

example using Typescript

ts
const amount = web3.utils.toWei("5000", "ether");
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.stakeRPL(nodeAddress, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
amountstringA string representing the amount in Wei
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:452


confirmWithdrawalAddress

confirmWithdrawalAddress(nodeAddress, options?, onConfirmation?): Promise<TransactionReceipt>

Confirm a node's withdrawal address

example using Typescript

ts
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const withdrawalAddress = "0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7";
const options = {
		from: withdrawalAddress,
		gas: 1000000
}
const txReceipt = rp.node.confirmWithdrawalAddress(nodeAddress, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
nodeAddressstringA string representing the node's address
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:476


withdrawRPL

withdrawRPL(amount, options?, onConfirmation?): Promise<TransactionReceipt>

Withdraw RPL for a node address

example using Typescript

ts
const amount = web3.utils.toWei("5000", "ether");
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.withdrawRPL(nodeAddress, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
amountstringA string representing the amount in Wei
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:500


setTimezoneLocation

setTimezoneLocation(timezoneLocation, options?, onConfirmation?): Promise<TransactionReceipt>

Set the node's timezone location

example using Typescript

ts
const timezoneLocation = "Brisbane/Australia";
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.setTimezoneLocation(nodeAddress, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
timezoneLocationstringA string representing the timezone location
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:524


deposit

deposit(minimumNodeFee, validatorPubKey, validatorSignature, depositDataRoot, salt, expectedMinipoolAddress, options?, onConfirmation?): Promise<TransactionReceipt>

Make a node deposit

example using Typescript

ts
const minimumNodeFee = web3.utils.toWei("0", "ether");
const nodeAddress = "0x24fBeD7Ecd625D3f0FD19a6c9113DEd436172294";
const options = {
		from: nodeAddress,
		gas: 1000000
}
const txReceipt = rp.node.deposit(minimumNodeFee, depositData.pubkey, depositData.signature, depositDataRoot, salt, minipoolAddress, options).then((txReceipt: TransactionReceipt) => { txReceipt };

Parameters

NameTypeDescription
minimumNodeFeestringA string representing the minimumNodeFee in Wei
validatorPubKeyBufferA buffer representing the validator pub key
validatorSignatureBufferA buffer representing the validator signature
depositDataRootBufferA buffer representing the deposit data root
saltnumberA number representing the salt
expectedMinipoolAddressstringA string representing the expected minipool address
options?SendOptionsAn optional object of web3.eth.Contract SendOptions
onConfirmation?ConfirmationHandlerAn optional confirmation handler object

Returns

Promise<TransactionReceipt>

a Promise<TransactionReceipt> that resolves to a TransactionReceipt object representing the receipt of the transaction

Defined in

rocketpool/node/node.ts:553