Web3JS Online
Viem Online
Webhooks, Alerts, and a simple API.
The padRight function is a utility method provided by the web3.utils module that adds a padding to the right of a string. The function takes three parameters: value, characterAmount, and sign.
The value parameter is the string or number that will be padded. If value is a integer or bigInt, it will be converted to a hex string before padding.
The characterAmount parameter is the number of characters that the resulting string should have.
The sign parameter is an optional string that specifies the character to be added to the right of the string. The default value of sign is '0'.
The function returns a string that has been padded to the right with the specified number of characters. If value is a string, the padding will be added to the right of the string. If value is a integer or bigInt, the hex string representation of the number will be padded to the right with the specified number of characters.
Here are some examples of how the padRight function can be used:
In the first example, the padRight function takes the string '0x123' as the value parameter, 10 as the characterAmount parameter, and the default value of sign is '0'. The function returns a string that has been padded to the right with 10 characters, resulting in the string '0x1230000000'. In the second example, the padRight function takes the string '0x123' as the value parameter, 10 as the characterAmount parameter, and the value '1' as the sign parameter. The function returns a string that has been padded to the right with 10 characters, resulting in the string '0x1231111111'.