@xchainjs/xchain-util
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -218,4 +218,8 @@ import BigNumber from 'bignumber.js'; | ||
*/ | ||
export declare const assetFromString: (s: string) => Asset; | ||
export declare const assetFromString: (s: string) => Asset | null; | ||
/** | ||
* Similar to an `assetFromString`, but throws an exception for invalid asset strings | ||
*/ | ||
export declare const assetFromStringEx: (s: string) => Asset; | ||
/** | ||
* Returns an `Asset` as a string using following naming convention: | ||
@@ -222,0 +226,0 @@ * |
@@ -490,3 +490,3 @@ import BigNumber from 'bignumber.js'; | ||
if (data.length <= 1 || ((_a = data[1]) === null || _a === void 0 ? void 0 : _a.length) < 1) { | ||
throw Error('assest string not correct'); | ||
return null; | ||
} | ||
@@ -496,3 +496,3 @@ const chain = data[0]; | ||
if (!chain || !isChain(chain)) | ||
throw Error('assest string not correct'); | ||
return null; | ||
const symbol = data[1]; | ||
@@ -503,2 +503,11 @@ const ticker = symbol.split('-')[0]; | ||
/** | ||
* Similar to an `assetFromString`, but throws an exception for invalid asset strings | ||
*/ | ||
const assetFromStringEx = (s) => { | ||
const asset = assetFromString(s); | ||
if (!asset) | ||
throw Error('asset string not correct'); | ||
return asset; | ||
}; | ||
/** | ||
* Returns an `Asset` as a string using following naming convention: | ||
@@ -632,3 +641,3 @@ * | ||
export { AVAXChain, AssetAVAX, AssetAtom, AssetBCH, AssetBNB, AssetBTC, AssetCurrencySymbol, AssetDOGE, AssetETH, AssetLTC, AssetLUNA, AssetRune67C, AssetRuneB1A, AssetRuneERC20, AssetRuneERC20Testnet, AssetRuneNative, AvalancheChain, BCHChain, BNBChain, BTCChain, Chain, CosmosChain, DOGEChain, Denomination, ETHChain, LTCChain, RUNE_TICKER, THORChain, TerraChain, assetAmount, assetFromString, assetToBase, assetToString, baseAmount, baseToAsset, bn, bnOrZero, chainToString, currencySymbolByAsset, delay, eqAsset, eqChain, fixedBN, formatAssetAmount, formatAssetAmountCurrency, formatBN, formatBNCurrency, formatBaseAmount, formatBaseAsAssetAmount, getContractAddressFromAsset, isAssetAmount, isAssetRuneNative, isBaseAmount, isBchChain, isBigNumberValue, isBnbChain, isBtcChain, isChain, isDogeChain, isEnabledChain, isEthChain, isLtcChain, isSynthAsset, isTerraChain, isThorChain, isValidAsset, isValidBN, strip0x, trimZeros, validBNOrZero }; | ||
export { AVAXChain, AssetAVAX, AssetAtom, AssetBCH, AssetBNB, AssetBTC, AssetCurrencySymbol, AssetDOGE, AssetETH, AssetLTC, AssetLUNA, AssetRune67C, AssetRuneB1A, AssetRuneERC20, AssetRuneERC20Testnet, AssetRuneNative, AvalancheChain, BCHChain, BNBChain, BTCChain, Chain, CosmosChain, DOGEChain, Denomination, ETHChain, LTCChain, RUNE_TICKER, THORChain, TerraChain, assetAmount, assetFromString, assetFromStringEx, assetToBase, assetToString, baseAmount, baseToAsset, bn, bnOrZero, chainToString, currencySymbolByAsset, delay, eqAsset, eqChain, fixedBN, formatAssetAmount, formatAssetAmountCurrency, formatBN, formatBNCurrency, formatBaseAmount, formatBaseAsAssetAmount, getContractAddressFromAsset, isAssetAmount, isAssetRuneNative, isBaseAmount, isBchChain, isBigNumberValue, isBnbChain, isBtcChain, isChain, isDogeChain, isEnabledChain, isEthChain, isLtcChain, isSynthAsset, isTerraChain, isThorChain, isValidAsset, isValidBN, strip0x, trimZeros, validBNOrZero }; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -496,3 +496,3 @@ 'use strict'; | ||
if (data.length <= 1 || ((_a = data[1]) === null || _a === void 0 ? void 0 : _a.length) < 1) { | ||
throw Error('assest string not correct'); | ||
return null; | ||
} | ||
@@ -502,3 +502,3 @@ const chain = data[0]; | ||
if (!chain || !isChain(chain)) | ||
throw Error('assest string not correct'); | ||
return null; | ||
const symbol = data[1]; | ||
@@ -509,2 +509,11 @@ const ticker = symbol.split('-')[0]; | ||
/** | ||
* Similar to an `assetFromString`, but throws an exception for invalid asset strings | ||
*/ | ||
const assetFromStringEx = (s) => { | ||
const asset = assetFromString(s); | ||
if (!asset) | ||
throw Error('asset string not correct'); | ||
return asset; | ||
}; | ||
/** | ||
* Returns an `Asset` as a string using following naming convention: | ||
@@ -662,2 +671,3 @@ * | ||
exports.assetFromString = assetFromString; | ||
exports.assetFromStringEx = assetFromStringEx; | ||
exports.assetToBase = assetToBase; | ||
@@ -664,0 +674,0 @@ exports.assetToString = assetToString; |
{ | ||
"name": "@xchainjs/xchain-util", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Helper utilities for XChain clients", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
148495
1861