@talismn/token-rates 2.0.0 → 2.0.1
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.
@@ -4,8 +4,9 @@ export declare class TokenRatesError extends Error {
|
|
4
4
|
response?: Response;
|
5
5
|
constructor(message: string, response?: Response);
|
6
6
|
}
|
7
|
+
export declare const ALL_CURRENCY_IDS: TokenRateCurrency[];
|
7
8
|
export type CoinsApiConfig = {
|
8
9
|
apiUrl: string;
|
9
10
|
};
|
10
|
-
export declare const
|
11
|
+
export declare const DEFAULT_COINSAPI_CONFIG: CoinsApiConfig;
|
11
12
|
export declare function fetchTokenRates(tokens: Record<TokenId, Token>, currencyIds?: TokenRateCurrency[], config?: CoinsApiConfig): Promise<TokenRatesList>;
|
@@ -136,10 +136,10 @@ class TokenRatesError extends Error {
|
|
136
136
|
}
|
137
137
|
}
|
138
138
|
const ALL_CURRENCY_IDS = Object.keys(SUPPORTED_CURRENCIES);
|
139
|
-
const
|
139
|
+
const DEFAULT_COINSAPI_CONFIG = {
|
140
140
|
apiUrl: "https://coins.talisman.xyz"
|
141
141
|
};
|
142
|
-
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config =
|
142
|
+
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config = DEFAULT_COINSAPI_CONFIG) {
|
143
143
|
// create a map from `coingeckoId` -> `tokenId` for each token
|
144
144
|
const coingeckoIdToTokenIds = Object.values(tokens)
|
145
145
|
// ignore testnet tokens
|
@@ -223,7 +223,8 @@ const parseTokenRatesFromApi = (rawTokenRates, coingeckoIds, currencyIds) => {
|
|
223
223
|
}));
|
224
224
|
};
|
225
225
|
|
226
|
-
exports.
|
226
|
+
exports.ALL_CURRENCY_IDS = ALL_CURRENCY_IDS;
|
227
|
+
exports.DEFAULT_COINSAPI_CONFIG = DEFAULT_COINSAPI_CONFIG;
|
227
228
|
exports.SUPPORTED_CURRENCIES = SUPPORTED_CURRENCIES;
|
228
229
|
exports.TalismanTokenRatesDatabase = TalismanTokenRatesDatabase;
|
229
230
|
exports.TokenRatesError = TokenRatesError;
|
@@ -136,10 +136,10 @@ class TokenRatesError extends Error {
|
|
136
136
|
}
|
137
137
|
}
|
138
138
|
const ALL_CURRENCY_IDS = Object.keys(SUPPORTED_CURRENCIES);
|
139
|
-
const
|
139
|
+
const DEFAULT_COINSAPI_CONFIG = {
|
140
140
|
apiUrl: "https://coins.talisman.xyz"
|
141
141
|
};
|
142
|
-
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config =
|
142
|
+
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config = DEFAULT_COINSAPI_CONFIG) {
|
143
143
|
// create a map from `coingeckoId` -> `tokenId` for each token
|
144
144
|
const coingeckoIdToTokenIds = Object.values(tokens)
|
145
145
|
// ignore testnet tokens
|
@@ -223,7 +223,8 @@ const parseTokenRatesFromApi = (rawTokenRates, coingeckoIds, currencyIds) => {
|
|
223
223
|
}));
|
224
224
|
};
|
225
225
|
|
226
|
-
exports.
|
226
|
+
exports.ALL_CURRENCY_IDS = ALL_CURRENCY_IDS;
|
227
|
+
exports.DEFAULT_COINSAPI_CONFIG = DEFAULT_COINSAPI_CONFIG;
|
227
228
|
exports.SUPPORTED_CURRENCIES = SUPPORTED_CURRENCIES;
|
228
229
|
exports.TalismanTokenRatesDatabase = TalismanTokenRatesDatabase;
|
229
230
|
exports.TokenRatesError = TokenRatesError;
|
@@ -134,10 +134,10 @@ class TokenRatesError extends Error {
|
|
134
134
|
}
|
135
135
|
}
|
136
136
|
const ALL_CURRENCY_IDS = Object.keys(SUPPORTED_CURRENCIES);
|
137
|
-
const
|
137
|
+
const DEFAULT_COINSAPI_CONFIG = {
|
138
138
|
apiUrl: "https://coins.talisman.xyz"
|
139
139
|
};
|
140
|
-
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config =
|
140
|
+
async function fetchTokenRates(tokens, currencyIds = ALL_CURRENCY_IDS, config = DEFAULT_COINSAPI_CONFIG) {
|
141
141
|
// create a map from `coingeckoId` -> `tokenId` for each token
|
142
142
|
const coingeckoIdToTokenIds = Object.values(tokens)
|
143
143
|
// ignore testnet tokens
|
@@ -221,4 +221,4 @@ const parseTokenRatesFromApi = (rawTokenRates, coingeckoIds, currencyIds) => {
|
|
221
221
|
}));
|
222
222
|
};
|
223
223
|
|
224
|
-
export {
|
224
|
+
export { ALL_CURRENCY_IDS, DEFAULT_COINSAPI_CONFIG, SUPPORTED_CURRENCIES, TalismanTokenRatesDatabase, TokenRatesError, db, fetchTokenRates, newTokenRates };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@talismn/token-rates",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"author": "Talisman",
|
5
5
|
"homepage": "https://talisman.xyz",
|
6
6
|
"license": "GPL-3.0-or-later",
|
@@ -22,7 +22,7 @@
|
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
24
|
"dexie": "^4.0.9",
|
25
|
-
"@talismn/chaindata-provider": "0.
|
25
|
+
"@talismn/chaindata-provider": "0.10.0"
|
26
26
|
},
|
27
27
|
"devDependencies": {
|
28
28
|
"@types/jest": "^29.5.14",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"jest": "^29.7.0",
|
31
31
|
"ts-jest": "^29.2.5",
|
32
32
|
"typescript": "^5.6.3",
|
33
|
-
"@talismn/
|
34
|
-
"@talismn/
|
33
|
+
"@talismn/tsconfig": "0.0.2",
|
34
|
+
"@talismn/eslint-config": "0.0.3"
|
35
35
|
},
|
36
36
|
"eslintConfig": {
|
37
37
|
"root": true,
|