New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elrondnetwork/dapp-utils

Package Overview
Dependencies
Maintainers
8
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elrondnetwork/dapp-utils

Elrond Dapp Utils

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

@elrondnetwork/dapp-utils react package

This module contains a collection of react components and helper functions commonly used when developing DApps.

Installation:

npm i @elrondnetwork/dapp-utils

Components

Denominate Displays a denominated value along with its label

Usage:

import { UI } from  "@elrondnetwork/dapp-utils";
const yourComponent = () => {
	
	return (
	<>
		...
		<UI.Denominate ...params />
	</>
	)
}

Params:

NametyperequireddefaultDescription
valuestringyes-Value that needs to be denominated
showLastNonZeroDecimalbooleannofalseShows the last non zero decimal
showLabelbooleannotrueShows the default label
erdLabelstringnoEGLDOverrides the default label
tokenstringno-Overrides the erdLabel, used for ESDT Tokens
decimalsnumberno4Specifies how many decimals should be displayed
denominationnumberno18Specifies how much to denominate by

Validations

stringIsFloat Checks if a string is float.

Usage:

import { validation } from  "@elrondnetwork/dapp-utils";

validation.stringIsFloat("100.3423");

Params:

NametyperequireddefaultDescription
amountstringyes-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:

NametyperequireddefaultDescription
amountstringyes-Amount that needs to be checked

Returns boolean

Operations

nominate(input, customDenomination) Nominates a provided value

Usage:

import { operations } from  "@elrondnetwork/dapp-utils";

operations.nominate("10");

Params:

NametyperequireddefaultDescription
inputstringyes-Value that needs to be nominated
customDenominationnumberno18Custom 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:

NametyperequireddefaultDescription
inputstringyes-Value that needs to be denominated
denominationnumberyes-Denomination value
decimalsnumberyes-Specifies how many decimals should be displayed
showLastNonZeroDecimalsbooleannofalseShows the last non zero decimal
addCommasbooleannotrueFormats 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:

NametyperequireddefaultDescription
datastringyes-string representing operation and Hex ecoded values of token and amount

Returns data { tokenId: string; nominatedTokenAmount: string }




FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc