@cryptorubic/web3 1.1.0-alpha-stellar.44 → 1.1.0-alpha-stellar.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "1.1.0-alpha-stellar.44",
3
+ "version": "1.1.0-alpha-stellar.45",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -78,18 +78,27 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
78
78
  parseFloat(fetchedToken.balances.authorized) > 0);
79
79
  if (fetchedToken && 'toml' in fetchedToken._links) {
80
80
  const { href } = fetchedToken._links.toml;
81
- const tomlTokens = await stellar_sdk_1.StellarToml.Resolver.resolve(new URL(href).hostname, { allowHttp: true });
82
- if (tomlTokens.CURRENCIES) {
83
- const tomlToken = tomlTokens.CURRENCIES.find((currency) => (0, core_1.compareAddresses)(fetchedToken.asset_code, currency.code) &&
84
- (0, core_1.compareAddresses)(fetchedToken.asset_issuer, currency.issuer));
85
- return new core_1.Token({
86
- name: tomlToken.name || tomlToken.code,
87
- symbol: tomlToken.code,
88
- decimals: tomlToken.display_decimals || this.CLASSIC_TOKEN_DECIMALS,
89
- blockchain: core_1.BLOCKCHAIN_NAME.STELLAR,
90
- address: `${tomlToken.code}-${tomlToken.issuer}`
91
- });
81
+ if (href) {
82
+ const { CURRENCIES } = await stellar_sdk_1.StellarToml.Resolver.resolve(new URL(href).hostname, { allowHttp: true }).catch(() => ({}));
83
+ if (CURRENCIES) {
84
+ const tomlToken = CURRENCIES.find((currency) => (0, core_1.compareAddresses)(fetchedToken.asset_code, currency.code) &&
85
+ (0, core_1.compareAddresses)(fetchedToken.asset_issuer, currency.issuer));
86
+ return new core_1.Token({
87
+ name: tomlToken.name || tomlToken.code,
88
+ symbol: tomlToken.code,
89
+ decimals: tomlToken.display_decimals || this.CLASSIC_TOKEN_DECIMALS,
90
+ blockchain: core_1.BLOCKCHAIN_NAME.STELLAR,
91
+ address: `${tomlToken.code}-${tomlToken.issuer}`
92
+ });
93
+ }
92
94
  }
95
+ return new core_1.Token({
96
+ name: fetchedToken.asset_code,
97
+ symbol: fetchedToken.asset_code,
98
+ decimals: this.CLASSIC_TOKEN_DECIMALS,
99
+ blockchain: core_1.BLOCKCHAIN_NAME.STELLAR,
100
+ address: `${fetchedToken.asset_code}-${fetchedToken.asset_issuer}`
101
+ });
93
102
  }
94
103
  throw new Error('Token not found');
95
104
  }