
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@elrondnetwork/dapp-utils
Advanced tools
This module contains a collection of react components and helper functions commonly used when developing DApps.
Installation:
npm i @elrondnetwork/dapp-utils
Denominate Displays a denominated value along with its label
Usage:
import { UI } from "@elrondnetwork/dapp-utils";
const yourComponent = () => {
return (
<>
...
<UI.Denominate ...params />
</>
)
}
Params:
Name | type | required | default | Description |
---|---|---|---|---|
value | string | yes | - | Value that needs to be denominated |
showLastNonZeroDecimal | boolean | no | false | Shows the last non zero decimal |
showLabel | boolean | no | true | Shows the default label |
erdLabel | string | no | EGLD | Overrides the default label |
token | string | no | - | Overrides the erdLabel, used for ESDT Tokens |
decimals | number | no | 4 | Specifies how many decimals should be displayed |
denomination | number | no | 18 | Specifies how much to denominate by |
stringIsFloat Checks if a string is float.
Usage:
import { validation } from "@elrondnetwork/dapp-utils";
validation.stringIsFloat("100.3423");
Params:
Name | type | required | default | Description |
---|---|---|---|---|
amount | string | yes | - | Amount that needs to be checked |
Returns boolean
stringIsInteger Checks if a string is integer
Usage:
import { validation } from "@elrondnetwork/dapp-utils";
validation.stringIsInteger("100");
Params:
Name | type | required | default | Description |
---|---|---|---|---|
amount | string | yes | - | Amount that needs to be checked |
Returns boolean
nominate(input, customDenomination) Nominates a provided value
Usage:
import { operations } from "@elrondnetwork/dapp-utils";
operations.nominate("10");
Params:
Name | type | required | default | Description |
---|---|---|---|---|
input | string | yes | - | Value that needs to be nominated |
customDenomination | number | no | 18 | Custom denomination value |
Returns string
denominate(input, denomination, decimals, showLastNonZeroDecimals) Denominates a provided value
Usage:
import { operations } from "@elrondnetwork/dapp-utils";
operations.denominate({input: "10000000000000000000000", decimals: 4});
Params:
Name | type | required | default | Description |
---|---|---|---|---|
input | string | yes | - | Value that needs to be denominated |
denomination | number | yes | - | Denomination value |
decimals | number | yes | - | Specifies how many decimals should be displayed |
showLastNonZeroDecimals | boolean | no | false | Shows the last non zero decimal |
addCommas | boolean | no | true | Formats the number with commas |
Returns string
getTokenFromData(data) Nominates a provided value
Usage:
import { operations } from "@elrondnetwork/dapp-utils";
operations.getTokenFromData("ESDTTransfer@425553442d663361616361@0de0b6b3a7640000");
Params:
Name | type | required | default | Description |
---|---|---|---|---|
data | string | yes | - | string representing operation and Hex ecoded values of token and amount |
Returns data { tokenId: string; nominatedTokenAmount: string }
FAQs
Elrond Dapp Utils
We found that @elrondnetwork/dapp-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.