@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
|
@@ -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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
(0, core_1.compareAddresses)(fetchedToken.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
}
|