Releases: TrueFiEng/useDApp
@usedapp/[email protected]
Patch Changes
- 41988ec: 🥔 Fix call reducer
@usedapp/[email protected]
Patch Changes
-
a9768c8: * Add tests for useTokenBalance
-
Add tests for multicall
-
Fix front running in renderWeb3Hook
-
-
Updated dependencies [4ba5235]
-
Updated dependencies [a9768c8]
- @usedapp/[email protected]
@usedapp/[email protected]
Minor Changes
-
4ba5235: Currency
Update the
Currency
class. It is now tasked with representing the individual currencies as well as handling formatting.The base
Currency
class is constructed with the following parameters:name
- name of the currencyticker
- e.g. USD, EUR, BTCdecimals
- number of decimal places (e.g. 2 for USD, 18 for ETH)formattingOptions
- define how the currency values are formatted
The following formatting options are supported:
decimals
- Defaults to the decimals of the currency.thousandSeparator
- Defaults to ','. Used for separating thousands.decimalSeparator
- Defaults to '.'. Used for separating the integer part from the decimal part.significantDigits
- Defaults to Infinity. Can limit the number of digits on the decimal part, such that either the total number of displayed digits is equal to this parameter or more digits are displayed, but the decimal part is missing.useFixedPrecision
- Defaults to false. Switches from using significant digits to fixed precision digits.fixedPrecisionDigits
- Defaults to 0. Can specify the number of digits on the decimal part.prefix
- Defaults to ''. Prepended to the result.suffix
- Defaults to ''. Appended to the result.
Other variants of
Currency
includeFiatCurrency
,NativeCurrency
andToken
.FiatCurrency
takes the same parameters asCurrency
but uses fixed precision digits by default.NativeCurrency
additionally takes achainId
parameter. The format function is configured with the ticker prefix and 6 significant digits by default.Token
additionally takes achainId
parameter as well as anaddress
parameter. The format function is configured with the ticker prefix and 6 significant digits by default.CurrencyValue
Introduces the
CurrencyValue
class. This class represents a value tied to a currency. The methods include:static fromString(currency, value)
- creates a new CurrencyValue from string.static zero(currency)
- creates a new CurrencyValue equal to 0.toString()
- returns the value of the CurrencyValue as a decimal string with no formatting.format(overrideOptions?)
- formats the value according to the currency. The caller can override the formatting options.map(fn)
- returns a new CurrencyValue with value transformed by the callback.add(other)
- returns a new CurrencyValue with value being the sum of this value and other value. The argument must be a CurrencyValue with the same Currency.sub(other)
- returns a new CurrencyValue with value being the difference of this value and other value. The argument must be a CurrencyValue with the same Currency.mul(value)
- returns a new CurrencyValue with value multiplied by the argument.div(value)
- returns a new CurrencyValue with value divided by the argument.mod(value)
- returns a new CurrencyValue with value modulo the argument.equals(other)
- performs an equality check on the currencies and the values of both objects.lt(other)
- checks if this value is less than the other value. The argument must be a CurrencyValue with the same Currency.lte(other)
- checks if this value is less than or equal to the other value. The argument must be a CurrencyValue with the same Currency.gt(other)
- checks if this value is greater than the other value. The argument must be a CurrencyValue with the same Currency.gte(other)
- checks if this value is greater than or equal to the other value. The argument must be a CurrencyValue with the same Currency.isZero()
- returns true if the value is zero.
Patch Changes
-
a9768c8: Add more tests
-
Add tests for useTokenBalance
-
Add tests for multicall
-
Fix front running in renderWeb3Hook
-
@usedapp/[email protected]
Patch Changes
- 88dfc4e: Added useContractCall.
@usedapp/[email protected]
@usedapp/[email protected]
Patch Changes
- 5dae580: Added a missing dependency.
@usedapp/[email protected]
Patch Changes
-
8b8fb81: 🧹 General clean-up
- Introduce EthersProvider and activateBrowserWallet
- Introduce Config, ConfigProvider and useConfig
- Fix Goerli name
- Add missing MULTICALL_ADDRESSES
- Update docs structure and README
-
9506ad8: Add ability to specify a background chain that will be used before wallet is connected.
@usedapp/[email protected]
Patch Changes
-
56c0156: 📢 Set publishing access to public
(Test of publishing)
-
Updated dependencies [56c0156]
- @usedapp/[email protected]
@usedapp/[email protected]
Patch Changes
-
56c0156: 📢 Set publishing access to public
(Test of publishing)