@rabbitio/ui-kit 1.0.0-beta.28 → 1.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +37 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +20 -0
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +37 -0
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +37 -0
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/swaps-lib/services/publicSwapService.js +25 -0
package/dist/index.modern.js
CHANGED
|
@@ -3741,6 +3741,26 @@ class PublicSwapService {
|
|
|
3741
3741
|
improveAndRethrow(e, "isAddressValidForAsset");
|
|
3742
3742
|
}
|
|
3743
3743
|
}
|
|
3744
|
+
|
|
3745
|
+
/**
|
|
3746
|
+
* Retrieves token by contract address.
|
|
3747
|
+
*
|
|
3748
|
+
* @param addressString {string}
|
|
3749
|
+
* @return {Promise<Coin|null>}
|
|
3750
|
+
*/
|
|
3751
|
+
async getTokenByContractAddress(addressString) {
|
|
3752
|
+
try {
|
|
3753
|
+
if (!addressString) return null;
|
|
3754
|
+
const addressLowerCase = addressString.toLowerCase();
|
|
3755
|
+
const allCoins = await this._swapProvider.getAllSupportedCurrencies();
|
|
3756
|
+
if (allCoins.result) {
|
|
3757
|
+
return allCoins.coins.find(coin => coin.tokenAddress && coin.tokenAddress.toLowerCase() === addressLowerCase);
|
|
3758
|
+
}
|
|
3759
|
+
} catch (e) {
|
|
3760
|
+
Logger.logError(e, "getTokenByContractAddress");
|
|
3761
|
+
}
|
|
3762
|
+
return null;
|
|
3763
|
+
}
|
|
3744
3764
|
}
|
|
3745
3765
|
PublicSwapService.PUBLIC_SWAP_CREATED_EVENT = "publicSwapCreatedEvent";
|
|
3746
3766
|
PublicSwapService.PUBLIC_SWAPS_COMMON_ERRORS = {
|