@metamask-previews/assets-controllers 19.0.0-preview.eb58a59 → 20.0.0-preview.3fbb6b41
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/CHANGELOG.md +47 -1
- package/dist/AccountTrackerController.d.ts +2 -2
- package/dist/AccountTrackerController.d.ts.map +1 -1
- package/dist/AccountTrackerController.js +1 -1
- package/dist/AccountTrackerController.js.map +1 -1
- package/dist/AssetsContractController.d.ts +5 -5
- package/dist/AssetsContractController.d.ts.map +1 -1
- package/dist/AssetsContractController.js +6 -4
- package/dist/AssetsContractController.js.map +1 -1
- package/dist/NftController.d.ts +2 -2
- package/dist/NftController.d.ts.map +1 -1
- package/dist/NftController.js +1 -1
- package/dist/NftController.js.map +1 -1
- package/dist/TokenBalancesController.d.ts +2 -2
- package/dist/TokenBalancesController.d.ts.map +1 -1
- package/dist/TokenBalancesController.js +1 -1
- package/dist/TokenBalancesController.js.map +1 -1
- package/dist/TokenRatesController.d.ts +59 -58
- package/dist/TokenRatesController.d.ts.map +1 -1
- package/dist/TokenRatesController.js +151 -156
- package/dist/TokenRatesController.js.map +1 -1
- package/dist/TokensController.d.ts +5 -5
- package/dist/TokensController.d.ts.map +1 -1
- package/dist/TokensController.js +4 -4
- package/dist/TokensController.js.map +1 -1
- package/dist/assetsUtil.d.ts +3 -1
- package/dist/assetsUtil.d.ts.map +1 -1
- package/dist/assetsUtil.js +2 -0
- package/dist/assetsUtil.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/token-prices-service/abstract-token-prices-service.d.ts +63 -0
- package/dist/token-prices-service/abstract-token-prices-service.d.ts.map +1 -0
- package/dist/token-prices-service/abstract-token-prices-service.js +3 -0
- package/dist/token-prices-service/abstract-token-prices-service.js.map +1 -0
- package/dist/token-prices-service/codefi-v2.d.ts +31 -0
- package/dist/token-prices-service/codefi-v2.d.ts.map +1 -0
- package/dist/token-prices-service/codefi-v2.js +286 -0
- package/dist/token-prices-service/codefi-v2.js.map +1 -0
- package/dist/token-prices-service/index.d.ts +3 -0
- package/dist/token-prices-service/index.d.ts.map +1 -0
- package/dist/token-prices-service/index.js +6 -0
- package/dist/token-prices-service/index.js.map +1 -0
- package/package.json +11 -11
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Hex } from '@metamask/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the price of a token in a currency.
|
|
4
|
+
*/
|
|
5
|
+
export declare type TokenPrice<TokenContractAddress extends Hex, Currency extends string> = {
|
|
6
|
+
tokenContractAddress: TokenContractAddress;
|
|
7
|
+
value: number;
|
|
8
|
+
currency: Currency;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A map of token contract address to its price.
|
|
12
|
+
*/
|
|
13
|
+
export declare type TokenPricesByTokenContractAddress<TokenContractAddress extends Hex, Currency extends string> = {
|
|
14
|
+
[A in TokenContractAddress]: TokenPrice<A, Currency>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* An ideal token prices service. All implementations must confirm to this
|
|
18
|
+
* interface.
|
|
19
|
+
*
|
|
20
|
+
* @template ChainId - A type union of valid arguments for the `chainId`
|
|
21
|
+
* argument to `fetchTokenPrices`.
|
|
22
|
+
* @template TokenContractAddress - A type union of all token contract
|
|
23
|
+
* addresses. The reason this type parameter exists is so that we can guarantee
|
|
24
|
+
* that same addresses that `fetchTokenPrices` receives are the same addresses
|
|
25
|
+
* that shown up in the return value.
|
|
26
|
+
* @template Currency - A type union of valid arguments for the `currency`
|
|
27
|
+
* argument to `fetchTokenPrices`.
|
|
28
|
+
*/
|
|
29
|
+
export declare type AbstractTokenPricesService<ChainId extends Hex = Hex, TokenContractAddress extends Hex = Hex, Currency extends string = string> = {
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves prices in the given currency for the tokens identified by the
|
|
32
|
+
* given contract addresses which are expected to live on the given chain.
|
|
33
|
+
*
|
|
34
|
+
* @param args - The arguments to this function.
|
|
35
|
+
* @param args.chainId - An EIP-155 chain ID.
|
|
36
|
+
* @param args.tokenContractAddresses - Contract addresses for tokens that
|
|
37
|
+
* live on the chain.
|
|
38
|
+
* @param args.currency - The desired currency of the token prices.
|
|
39
|
+
* @returns The prices for the requested tokens.
|
|
40
|
+
*/
|
|
41
|
+
fetchTokenPrices({ chainId, tokenContractAddresses, currency, }: {
|
|
42
|
+
chainId: ChainId;
|
|
43
|
+
tokenContractAddresses: TokenContractAddress[];
|
|
44
|
+
currency: Currency;
|
|
45
|
+
}): Promise<TokenPricesByTokenContractAddress<TokenContractAddress, Currency>>;
|
|
46
|
+
/**
|
|
47
|
+
* Type guard for whether the API can return token prices for the given chain
|
|
48
|
+
* ID.
|
|
49
|
+
*
|
|
50
|
+
* @param chainId - The chain ID to check.
|
|
51
|
+
* @returns True if the API supports the chain ID, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
validateChainIdSupported(chainId: unknown): chainId is ChainId;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard for whether the API can return token prices in the given
|
|
56
|
+
* currency.
|
|
57
|
+
*
|
|
58
|
+
* @param currency - The currency to check.
|
|
59
|
+
* @returns True if the API supports the currency, false otherwise.
|
|
60
|
+
*/
|
|
61
|
+
validateCurrencySupported(currency: unknown): currency is Currency;
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=abstract-token-prices-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-token-prices-service.d.ts","sourceRoot":"","sources":["../../src/token-prices-service/abstract-token-prices-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C;;GAEG;AACH,oBAAY,UAAU,CACpB,oBAAoB,SAAS,GAAG,EAChC,QAAQ,SAAS,MAAM,IACrB;IACF,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,oBAAY,iCAAiC,CAC3C,oBAAoB,SAAS,GAAG,EAChC,QAAQ,SAAS,MAAM,IACrB;KACD,CAAC,IAAI,oBAAoB,GAAG,UAAU,CAAC,CAAC,EAAE,QAAQ,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,oBAAY,0BAA0B,CACpC,OAAO,SAAS,GAAG,GAAG,GAAG,EACzB,oBAAoB,SAAS,GAAG,GAAG,GAAG,EACtC,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC9B;IACF;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EACf,OAAO,EACP,sBAAsB,EACtB,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,OAAO,CAAC;QACjB,sBAAsB,EAAE,oBAAoB,EAAE,CAAC;QAC/C,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CACT,iCAAiC,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAClE,CAAC;IAEF;;;;;;OAMG;IACH,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,OAAO,CAAC;IAE/D;;;;;;OAMG;IACH,yBAAyB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,QAAQ,CAAC;CACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-token-prices-service.js","sourceRoot":"","sources":["../../src/token-prices-service/abstract-token-prices-service.ts"],"names":[],"mappings":"","sourcesContent":["import type { Hex } from '@metamask/utils';\n\n/**\n * Represents the price of a token in a currency.\n */\nexport type TokenPrice<\n TokenContractAddress extends Hex,\n Currency extends string,\n> = {\n tokenContractAddress: TokenContractAddress;\n value: number;\n currency: Currency;\n};\n\n/**\n * A map of token contract address to its price.\n */\nexport type TokenPricesByTokenContractAddress<\n TokenContractAddress extends Hex,\n Currency extends string,\n> = {\n [A in TokenContractAddress]: TokenPrice<A, Currency>;\n};\n\n/**\n * An ideal token prices service. All implementations must confirm to this\n * interface.\n *\n * @template ChainId - A type union of valid arguments for the `chainId`\n * argument to `fetchTokenPrices`.\n * @template TokenContractAddress - A type union of all token contract\n * addresses. The reason this type parameter exists is so that we can guarantee\n * that same addresses that `fetchTokenPrices` receives are the same addresses\n * that shown up in the return value.\n * @template Currency - A type union of valid arguments for the `currency`\n * argument to `fetchTokenPrices`.\n */\nexport type AbstractTokenPricesService<\n ChainId extends Hex = Hex,\n TokenContractAddress extends Hex = Hex,\n Currency extends string = string,\n> = {\n /**\n * Retrieves prices in the given currency for the tokens identified by the\n * given contract addresses which are expected to live on the given chain.\n *\n * @param args - The arguments to this function.\n * @param args.chainId - An EIP-155 chain ID.\n * @param args.tokenContractAddresses - Contract addresses for tokens that\n * live on the chain.\n * @param args.currency - The desired currency of the token prices.\n * @returns The prices for the requested tokens.\n */\n fetchTokenPrices({\n chainId,\n tokenContractAddresses,\n currency,\n }: {\n chainId: ChainId;\n tokenContractAddresses: TokenContractAddress[];\n currency: Currency;\n }): Promise<\n TokenPricesByTokenContractAddress<TokenContractAddress, Currency>\n >;\n\n /**\n * Type guard for whether the API can return token prices for the given chain\n * ID.\n *\n * @param chainId - The chain ID to check.\n * @returns True if the API supports the chain ID, false otherwise.\n */\n validateChainIdSupported(chainId: unknown): chainId is ChainId;\n\n /**\n * Type guard for whether the API can return token prices in the given\n * currency.\n *\n * @param currency - The currency to check.\n * @returns True if the API supports the currency, false otherwise.\n */\n validateCurrencySupported(currency: unknown): currency is Currency;\n};\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Hex } from '@metamask/utils';
|
|
2
|
+
import type { AbstractTokenPricesService } from './abstract-token-prices-service';
|
|
3
|
+
/**
|
|
4
|
+
* The list of currencies that can be supplied as the `vsCurrency` parameter to
|
|
5
|
+
* the `/spot-prices` endpoint, in lowercase form.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SUPPORTED_CURRENCIES: readonly ["btc", "eth", "ltc", "bch", "bnb", "eos", "xrp", "xlm", "link", "dot", "yfi", "usd", "aed", "ars", "aud", "bdt", "bhd", "bmd", "brl", "cad", "chf", "clp", "cny", "czk", "dkk", "eur", "gbp", "hkd", "huf", "idr", "ils", "inr", "jpy", "krw", "kwd", "lkr", "mmk", "mxn", "myr", "ngn", "nok", "nzd", "php", "pkr", "pln", "rub", "sar", "sek", "sgd", "thb", "try", "twd", "uah", "vef", "vnd", "zar", "xdr", "xag", "xau", "bits", "sats"];
|
|
8
|
+
/**
|
|
9
|
+
* A currency that can be supplied as the `vsCurrency` parameter to
|
|
10
|
+
* the `/spot-prices` endpoint. Covers both uppercase and lowercase versions.
|
|
11
|
+
*/
|
|
12
|
+
declare type SupportedCurrency = (typeof SUPPORTED_CURRENCIES)[number] | Uppercase<(typeof SUPPORTED_CURRENCIES)[number]>;
|
|
13
|
+
/**
|
|
14
|
+
* The list of chain IDs that can be supplied in the URL for the `/spot-prices`
|
|
15
|
+
* endpoint, but in hexadecimal form (for consistency with how we represent
|
|
16
|
+
* chain IDs in other places).
|
|
17
|
+
*/
|
|
18
|
+
export declare const SUPPORTED_CHAIN_IDS: readonly ["0x1", "0xa", "0x19", "0x38", "0x39", "0x42", "0x46", "0x52", "0x58", "0x64", "0x6a", "0x7a", "0x80", "0x89", "0xfa", "0x120", "0x141", "0x144", "0x169", "0x440", "0x504", "0x505", "0x2105", "0x2107", "0x2710", "0xa4b1", "0xa4ec", "0xa516", "0xa86a", "0x518af", "0x4e454152", "0x63564c40"];
|
|
19
|
+
/**
|
|
20
|
+
* A chain ID that can be supplied in the URL for the `/spot-prices` endpoint,
|
|
21
|
+
* but in hexadecimal form (for consistency with how we represent chain IDs in
|
|
22
|
+
* other places).
|
|
23
|
+
*/
|
|
24
|
+
declare type SupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
25
|
+
/**
|
|
26
|
+
* This version of the token prices service uses V2 of the Codefi Price API to
|
|
27
|
+
* fetch token prices.
|
|
28
|
+
*/
|
|
29
|
+
export declare const codefiTokenPricesServiceV2: AbstractTokenPricesService<SupportedChainId, Hex, SupportedCurrency>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=codefi-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codefi-v2.d.ts","sourceRoot":"","sources":["../../src/token-prices-service/codefi-v2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG3C,OAAO,KAAK,EACV,0BAA0B,EAG3B,MAAM,iCAAiC,CAAC;AAUzC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,ybA2HvB,CAAC;AAEX;;;GAGG;AACH,aAAK,iBAAiB,GAClB,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,GACrC,SAAS,CAAC,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,6SAkEtB,CAAC;AAEX;;;;GAIG;AACH,aAAK,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAO7D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,0BAA0B,CACjE,gBAAgB,EAChB,GAAG,EACH,iBAAiB,CAiGlB,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.codefiTokenPricesServiceV2 = exports.SUPPORTED_CHAIN_IDS = exports.SUPPORTED_CURRENCIES = void 0;
|
|
13
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
|
14
|
+
const utils_1 = require("@metamask/utils");
|
|
15
|
+
/**
|
|
16
|
+
* The list of currencies that can be supplied as the `vsCurrency` parameter to
|
|
17
|
+
* the `/spot-prices` endpoint, in lowercase form.
|
|
18
|
+
*/
|
|
19
|
+
exports.SUPPORTED_CURRENCIES = [
|
|
20
|
+
// Bitcoin
|
|
21
|
+
'btc',
|
|
22
|
+
// Ether
|
|
23
|
+
'eth',
|
|
24
|
+
// Litecoin
|
|
25
|
+
'ltc',
|
|
26
|
+
// Bitcoin Cash
|
|
27
|
+
'bch',
|
|
28
|
+
// Binance Coin
|
|
29
|
+
'bnb',
|
|
30
|
+
// EOS
|
|
31
|
+
'eos',
|
|
32
|
+
// XRP
|
|
33
|
+
'xrp',
|
|
34
|
+
// Lumens
|
|
35
|
+
'xlm',
|
|
36
|
+
// Chainlink
|
|
37
|
+
'link',
|
|
38
|
+
// Polkadot
|
|
39
|
+
'dot',
|
|
40
|
+
// Yearn.finance
|
|
41
|
+
'yfi',
|
|
42
|
+
// US Dollar
|
|
43
|
+
'usd',
|
|
44
|
+
// United Arab Emirates Dirham
|
|
45
|
+
'aed',
|
|
46
|
+
// Argentine Peso
|
|
47
|
+
'ars',
|
|
48
|
+
// Australian Dollar
|
|
49
|
+
'aud',
|
|
50
|
+
// Bangladeshi Taka
|
|
51
|
+
'bdt',
|
|
52
|
+
// Bahraini Dinar
|
|
53
|
+
'bhd',
|
|
54
|
+
// Bermudian Dollar
|
|
55
|
+
'bmd',
|
|
56
|
+
// Brazil Real
|
|
57
|
+
'brl',
|
|
58
|
+
// Canadian Dollar
|
|
59
|
+
'cad',
|
|
60
|
+
// Swiss Franc
|
|
61
|
+
'chf',
|
|
62
|
+
// Chilean Peso
|
|
63
|
+
'clp',
|
|
64
|
+
// Chinese Yuan
|
|
65
|
+
'cny',
|
|
66
|
+
// Czech Koruna
|
|
67
|
+
'czk',
|
|
68
|
+
// Danish Krone
|
|
69
|
+
'dkk',
|
|
70
|
+
// Euro
|
|
71
|
+
'eur',
|
|
72
|
+
// British Pound Sterling
|
|
73
|
+
'gbp',
|
|
74
|
+
// Hong Kong Dollar
|
|
75
|
+
'hkd',
|
|
76
|
+
// Hungarian Forint
|
|
77
|
+
'huf',
|
|
78
|
+
// Indonesian Rupiah
|
|
79
|
+
'idr',
|
|
80
|
+
// Israeli New Shekel
|
|
81
|
+
'ils',
|
|
82
|
+
// Indian Rupee
|
|
83
|
+
'inr',
|
|
84
|
+
// Japanese Yen
|
|
85
|
+
'jpy',
|
|
86
|
+
// South Korean Won
|
|
87
|
+
'krw',
|
|
88
|
+
// Kuwaiti Dinar
|
|
89
|
+
'kwd',
|
|
90
|
+
// Sri Lankan Rupee
|
|
91
|
+
'lkr',
|
|
92
|
+
// Burmese Kyat
|
|
93
|
+
'mmk',
|
|
94
|
+
// Mexican Peso
|
|
95
|
+
'mxn',
|
|
96
|
+
// Malaysian Ringgit
|
|
97
|
+
'myr',
|
|
98
|
+
// Nigerian Naira
|
|
99
|
+
'ngn',
|
|
100
|
+
// Norwegian Krone
|
|
101
|
+
'nok',
|
|
102
|
+
// New Zealand Dollar
|
|
103
|
+
'nzd',
|
|
104
|
+
// Philippine Peso
|
|
105
|
+
'php',
|
|
106
|
+
// Pakistani Rupee
|
|
107
|
+
'pkr',
|
|
108
|
+
// Polish Zloty
|
|
109
|
+
'pln',
|
|
110
|
+
// Russian Ruble
|
|
111
|
+
'rub',
|
|
112
|
+
// Saudi Riyal
|
|
113
|
+
'sar',
|
|
114
|
+
// Swedish Krona
|
|
115
|
+
'sek',
|
|
116
|
+
// Singapore Dollar
|
|
117
|
+
'sgd',
|
|
118
|
+
// Thai Baht
|
|
119
|
+
'thb',
|
|
120
|
+
// Turkish Lira
|
|
121
|
+
'try',
|
|
122
|
+
// New Taiwan Dollar
|
|
123
|
+
'twd',
|
|
124
|
+
// Ukrainian hryvnia
|
|
125
|
+
'uah',
|
|
126
|
+
// Venezuelan bolívar fuerte
|
|
127
|
+
'vef',
|
|
128
|
+
// Vietnamese đồng
|
|
129
|
+
'vnd',
|
|
130
|
+
// South African Rand
|
|
131
|
+
'zar',
|
|
132
|
+
// IMF Special Drawing Rights
|
|
133
|
+
'xdr',
|
|
134
|
+
// Silver - Troy Ounce
|
|
135
|
+
'xag',
|
|
136
|
+
// Gold - Troy Ounce
|
|
137
|
+
'xau',
|
|
138
|
+
// Bits
|
|
139
|
+
'bits',
|
|
140
|
+
// Satoshi
|
|
141
|
+
'sats',
|
|
142
|
+
];
|
|
143
|
+
/**
|
|
144
|
+
* The list of chain IDs that can be supplied in the URL for the `/spot-prices`
|
|
145
|
+
* endpoint, but in hexadecimal form (for consistency with how we represent
|
|
146
|
+
* chain IDs in other places).
|
|
147
|
+
*/
|
|
148
|
+
exports.SUPPORTED_CHAIN_IDS = [
|
|
149
|
+
// Ethereum Mainnet
|
|
150
|
+
'0x1',
|
|
151
|
+
// OP Mainnet
|
|
152
|
+
'0xa',
|
|
153
|
+
// Cronos Mainnet
|
|
154
|
+
'0x19',
|
|
155
|
+
// BNB Smart Chain Mainnet
|
|
156
|
+
'0x38',
|
|
157
|
+
// Syscoin Mainnet
|
|
158
|
+
'0x39',
|
|
159
|
+
// OKXChain Mainnet
|
|
160
|
+
'0x42',
|
|
161
|
+
// Hoo Smart Chain
|
|
162
|
+
'0x46',
|
|
163
|
+
// Meter Mainnet
|
|
164
|
+
'0x52',
|
|
165
|
+
// TomoChain
|
|
166
|
+
'0x58',
|
|
167
|
+
// Gnosis
|
|
168
|
+
'0x64',
|
|
169
|
+
// Velas EVM Mainnet
|
|
170
|
+
'0x6a',
|
|
171
|
+
// Fuse Mainnet
|
|
172
|
+
'0x7a',
|
|
173
|
+
// Huobi ECO Chain Mainnet
|
|
174
|
+
'0x80',
|
|
175
|
+
// Polygon Mainnet
|
|
176
|
+
'0x89',
|
|
177
|
+
// Fantom Opera
|
|
178
|
+
'0xfa',
|
|
179
|
+
// Boba Network
|
|
180
|
+
'0x120',
|
|
181
|
+
// KCC Mainnet
|
|
182
|
+
'0x141',
|
|
183
|
+
// zkSync Era Mainnet
|
|
184
|
+
'0x144',
|
|
185
|
+
// Theta Mainnet
|
|
186
|
+
'0x169',
|
|
187
|
+
// Metis Andromeda Mainnet
|
|
188
|
+
'0x440',
|
|
189
|
+
// Moonbeam
|
|
190
|
+
'0x504',
|
|
191
|
+
// Moonriver
|
|
192
|
+
'0x505',
|
|
193
|
+
// Base
|
|
194
|
+
'0x2105',
|
|
195
|
+
// Shiden
|
|
196
|
+
// NOTE: This is the wrong chain ID, this should be 0x150
|
|
197
|
+
'0x2107',
|
|
198
|
+
// Smart Bitcoin Cash
|
|
199
|
+
'0x2710',
|
|
200
|
+
// Arbitrum One
|
|
201
|
+
'0xa4b1',
|
|
202
|
+
// Celo Mainnet
|
|
203
|
+
'0xa4ec',
|
|
204
|
+
// Oasis Emerald
|
|
205
|
+
'0xa516',
|
|
206
|
+
// Avalanche C-Chain
|
|
207
|
+
'0xa86a',
|
|
208
|
+
// Polis Mainnet
|
|
209
|
+
'0x518af',
|
|
210
|
+
// Aurora Mainnet
|
|
211
|
+
'0x4e454152',
|
|
212
|
+
// Harmony Mainnet Shard 0
|
|
213
|
+
'0x63564c40',
|
|
214
|
+
];
|
|
215
|
+
/**
|
|
216
|
+
* All requests to V2 of the Price API start with this.
|
|
217
|
+
*/
|
|
218
|
+
const BASE_URL = 'https://price-api.metafi.codefi.network/v2';
|
|
219
|
+
/**
|
|
220
|
+
* This version of the token prices service uses V2 of the Codefi Price API to
|
|
221
|
+
* fetch token prices.
|
|
222
|
+
*/
|
|
223
|
+
exports.codefiTokenPricesServiceV2 = {
|
|
224
|
+
/**
|
|
225
|
+
* Retrieves prices in the given currency for the tokens identified by the
|
|
226
|
+
* given contract addresses which are expected to live on the given chain.
|
|
227
|
+
*
|
|
228
|
+
* @param args - The arguments to function.
|
|
229
|
+
* @param args.chainId - An EIP-155 chain ID.
|
|
230
|
+
* @param args.tokenContractAddresses - Contract addresses for tokens that
|
|
231
|
+
* live on the chain.
|
|
232
|
+
* @param args.currency - The desired currency of the token prices.
|
|
233
|
+
* @returns The prices for the requested tokens.
|
|
234
|
+
*/
|
|
235
|
+
fetchTokenPrices({ chainId, tokenContractAddresses, currency, }) {
|
|
236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
const chainIdAsNumber = (0, utils_1.hexToNumber)(chainId);
|
|
238
|
+
const url = new URL(`${BASE_URL}/chains/${chainIdAsNumber}/spot-prices`);
|
|
239
|
+
url.searchParams.append('tokenAddresses', tokenContractAddresses.join(','));
|
|
240
|
+
url.searchParams.append('vsCurrency', currency);
|
|
241
|
+
const pricesByCurrencyByTokenContractAddress = yield (0, controller_utils_1.handleFetch)(url);
|
|
242
|
+
return tokenContractAddresses.reduce((obj, tokenContractAddress) => {
|
|
243
|
+
var _a;
|
|
244
|
+
// The Price API lowercases both currency and token addresses, so we have
|
|
245
|
+
// to keep track of them and make sure we return the original versions.
|
|
246
|
+
const lowercasedTokenContractAddress = tokenContractAddress.toLowerCase();
|
|
247
|
+
const lowercasedCurrency = currency.toLowerCase();
|
|
248
|
+
const price = (_a = pricesByCurrencyByTokenContractAddress[lowercasedTokenContractAddress]) === null || _a === void 0 ? void 0 : _a[lowercasedCurrency];
|
|
249
|
+
if (!price) {
|
|
250
|
+
throw new Error(`Could not find price for "${tokenContractAddress}" in "${currency}"`);
|
|
251
|
+
}
|
|
252
|
+
const tokenPrice = {
|
|
253
|
+
tokenContractAddress,
|
|
254
|
+
value: price,
|
|
255
|
+
currency,
|
|
256
|
+
};
|
|
257
|
+
return Object.assign(Object.assign({}, obj), { [tokenContractAddress]: tokenPrice });
|
|
258
|
+
}, {});
|
|
259
|
+
});
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* Type guard for whether the API can return token prices for the given chain
|
|
263
|
+
* ID.
|
|
264
|
+
*
|
|
265
|
+
* @param chainId - The chain ID to check.
|
|
266
|
+
* @returns True if the API supports the chain ID, false otherwise.
|
|
267
|
+
*/
|
|
268
|
+
validateChainIdSupported(chainId) {
|
|
269
|
+
const supportedChainIds = exports.SUPPORTED_CHAIN_IDS;
|
|
270
|
+
return typeof chainId === 'string' && supportedChainIds.includes(chainId);
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
* Type guard for whether the API can return token prices in the given
|
|
274
|
+
* currency.
|
|
275
|
+
*
|
|
276
|
+
* @param currency - The currency to check. If a string, can be either
|
|
277
|
+
* lowercase or uppercase.
|
|
278
|
+
* @returns True if the API supports the currency, false otherwise.
|
|
279
|
+
*/
|
|
280
|
+
validateCurrencySupported(currency) {
|
|
281
|
+
const supportedCurrencies = exports.SUPPORTED_CURRENCIES;
|
|
282
|
+
return (typeof currency === 'string' &&
|
|
283
|
+
supportedCurrencies.includes(currency.toLowerCase()));
|
|
284
|
+
},
|
|
285
|
+
};
|
|
286
|
+
//# sourceMappingURL=codefi-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codefi-v2.js","sourceRoot":"","sources":["../../src/token-prices-service/codefi-v2.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iEAAyD;AAEzD,2CAA8C;AAgB9C;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,UAAU;IACV,KAAK;IACL,QAAQ;IACR,KAAK;IACL,WAAW;IACX,KAAK;IACL,eAAe;IACf,KAAK;IACL,eAAe;IACf,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,SAAS;IACT,KAAK;IACL,YAAY;IACZ,MAAM;IACN,WAAW;I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,CAAC,CACrD,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { handleFetch } from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { hexToNumber } from '@metamask/utils';\n\nimport type {\n AbstractTokenPricesService,\n TokenPrice,\n TokenPricesByTokenContractAddress,\n} from './abstract-token-prices-service';\n\n/**\n * The shape of the data that the /spot-prices endpoint returns.\n */\ntype SpotPricesEndpointData<\n TokenContractAddress extends Hex,\n Currency extends string,\n> = Record<TokenContractAddress, Record<Currency, number>>;\n\n/**\n * The list of currencies that can be supplied as the `vsCurrency` parameter to\n * the `/spot-prices` endpoint, in lowercase form.\n */\nexport const SUPPORTED_CURRENCIES = [\n // Bitcoin\n 'btc',\n // Ether\n 'eth',\n // Litecoin\n 'ltc',\n // Bitcoin Cash\n 'bch',\n // Binance Coin\n 'bnb',\n // EOS\n 'eos',\n // XRP\n 'xrp',\n // Lumens\n 'xlm',\n // Chainlink\n 'link',\n // Polkadot\n 'dot',\n // Yearn.finance\n 'yfi',\n // US Dollar\n 'usd',\n // United Arab Emirates Dirham\n 'aed',\n // Argentine Peso\n 'ars',\n // Australian Dollar\n 'aud',\n // Bangladeshi Taka\n 'bdt',\n // Bahraini Dinar\n 'bhd',\n // Bermudian Dollar\n 'bmd',\n // Brazil Real\n 'brl',\n // Canadian Dollar\n 'cad',\n // Swiss Franc\n 'chf',\n // Chilean Peso\n 'clp',\n // Chinese Yuan\n 'cny',\n // Czech Koruna\n 'czk',\n // Danish Krone\n 'dkk',\n // Euro\n 'eur',\n // British Pound Sterling\n 'gbp',\n // Hong Kong Dollar\n 'hkd',\n // Hungarian Forint\n 'huf',\n // Indonesian Rupiah\n 'idr',\n // Israeli New Shekel\n 'ils',\n // Indian Rupee\n 'inr',\n // Japanese Yen\n 'jpy',\n // South Korean Won\n 'krw',\n // Kuwaiti Dinar\n 'kwd',\n // Sri Lankan Rupee\n 'lkr',\n // Burmese Kyat\n 'mmk',\n // Mexican Peso\n 'mxn',\n // Malaysian Ringgit\n 'myr',\n // Nigerian Naira\n 'ngn',\n // Norwegian Krone\n 'nok',\n // New Zealand Dollar\n 'nzd',\n // Philippine Peso\n 'php',\n // Pakistani Rupee\n 'pkr',\n // Polish Zloty\n 'pln',\n // Russian Ruble\n 'rub',\n // Saudi Riyal\n 'sar',\n // Swedish Krona\n 'sek',\n // Singapore Dollar\n 'sgd',\n // Thai Baht\n 'thb',\n // Turkish Lira\n 'try',\n // New Taiwan Dollar\n 'twd',\n // Ukrainian hryvnia\n 'uah',\n // Venezuelan bolívar fuerte\n 'vef',\n // Vietnamese đồng\n 'vnd',\n // South African Rand\n 'zar',\n // IMF Special Drawing Rights\n 'xdr',\n // Silver - Troy Ounce\n 'xag',\n // Gold - Troy Ounce\n 'xau',\n // Bits\n 'bits',\n // Satoshi\n 'sats',\n] as const;\n\n/**\n * A currency that can be supplied as the `vsCurrency` parameter to\n * the `/spot-prices` endpoint. Covers both uppercase and lowercase versions.\n */\ntype SupportedCurrency =\n | (typeof SUPPORTED_CURRENCIES)[number]\n | Uppercase<(typeof SUPPORTED_CURRENCIES)[number]>;\n\n/**\n * The list of chain IDs that can be supplied in the URL for the `/spot-prices`\n * endpoint, but in hexadecimal form (for consistency with how we represent\n * chain IDs in other places).\n */\nexport const SUPPORTED_CHAIN_IDS = [\n // Ethereum Mainnet\n '0x1',\n // OP Mainnet\n '0xa',\n // Cronos Mainnet\n '0x19',\n // BNB Smart Chain Mainnet\n '0x38',\n // Syscoin Mainnet\n '0x39',\n // OKXChain Mainnet\n '0x42',\n // Hoo Smart Chain\n '0x46',\n // Meter Mainnet\n '0x52',\n // TomoChain\n '0x58',\n // Gnosis\n '0x64',\n // Velas EVM Mainnet\n '0x6a',\n // Fuse Mainnet\n '0x7a',\n // Huobi ECO Chain Mainnet\n '0x80',\n // Polygon Mainnet\n '0x89',\n // Fantom Opera\n '0xfa',\n // Boba Network\n '0x120',\n // KCC Mainnet\n '0x141',\n // zkSync Era Mainnet\n '0x144',\n // Theta Mainnet\n '0x169',\n // Metis Andromeda Mainnet\n '0x440',\n // Moonbeam\n '0x504',\n // Moonriver\n '0x505',\n // Base\n '0x2105',\n // Shiden\n // NOTE: This is the wrong chain ID, this should be 0x150\n '0x2107',\n // Smart Bitcoin Cash\n '0x2710',\n // Arbitrum One\n '0xa4b1',\n // Celo Mainnet\n '0xa4ec',\n // Oasis Emerald\n '0xa516',\n // Avalanche C-Chain\n '0xa86a',\n // Polis Mainnet\n '0x518af',\n // Aurora Mainnet\n '0x4e454152',\n // Harmony Mainnet Shard 0\n '0x63564c40',\n] as const;\n\n/**\n * A chain ID that can be supplied in the URL for the `/spot-prices` endpoint,\n * but in hexadecimal form (for consistency with how we represent chain IDs in\n * other places).\n */\ntype SupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];\n\n/**\n * All requests to V2 of the Price API start with this.\n */\nconst BASE_URL = 'https://price-api.metafi.codefi.network/v2';\n\n/**\n * This version of the token prices service uses V2 of the Codefi Price API to\n * fetch token prices.\n */\nexport const codefiTokenPricesServiceV2: AbstractTokenPricesService<\n SupportedChainId,\n Hex,\n SupportedCurrency\n> = {\n /**\n * Retrieves prices in the given currency for the tokens identified by the\n * given contract addresses which are expected to live on the given chain.\n *\n * @param args - The arguments to function.\n * @param args.chainId - An EIP-155 chain ID.\n * @param args.tokenContractAddresses - Contract addresses for tokens that\n * live on the chain.\n * @param args.currency - The desired currency of the token prices.\n * @returns The prices for the requested tokens.\n */\n async fetchTokenPrices({\n chainId,\n tokenContractAddresses,\n currency,\n }: {\n chainId: SupportedChainId;\n tokenContractAddresses: Hex[];\n currency: SupportedCurrency;\n }): Promise<TokenPricesByTokenContractAddress<Hex, SupportedCurrency>> {\n const chainIdAsNumber = hexToNumber(chainId);\n\n const url = new URL(`${BASE_URL}/chains/${chainIdAsNumber}/spot-prices`);\n url.searchParams.append('tokenAddresses', tokenContractAddresses.join(','));\n url.searchParams.append('vsCurrency', currency);\n\n const pricesByCurrencyByTokenContractAddress: SpotPricesEndpointData<\n Lowercase<Hex>,\n Lowercase<SupportedCurrency>\n > = await handleFetch(url);\n\n return tokenContractAddresses.reduce(\n (\n obj: Partial<TokenPricesByTokenContractAddress<Hex, SupportedCurrency>>,\n tokenContractAddress,\n ) => {\n // The Price API lowercases both currency and token addresses, so we have\n // to keep track of them and make sure we return the original versions.\n const lowercasedTokenContractAddress =\n tokenContractAddress.toLowerCase() as Lowercase<Hex>;\n const lowercasedCurrency =\n currency.toLowerCase() as Lowercase<SupportedCurrency>;\n\n const price =\n pricesByCurrencyByTokenContractAddress[\n lowercasedTokenContractAddress\n ]?.[lowercasedCurrency];\n\n if (!price) {\n throw new Error(\n `Could not find price for \"${tokenContractAddress}\" in \"${currency}\"`,\n );\n }\n\n const tokenPrice: TokenPrice<Hex, SupportedCurrency> = {\n tokenContractAddress,\n value: price,\n currency,\n };\n return {\n ...obj,\n [tokenContractAddress]: tokenPrice,\n };\n },\n {},\n ) as TokenPricesByTokenContractAddress<Hex, SupportedCurrency>;\n },\n\n /**\n * Type guard for whether the API can return token prices for the given chain\n * ID.\n *\n * @param chainId - The chain ID to check.\n * @returns True if the API supports the chain ID, false otherwise.\n */\n validateChainIdSupported(chainId: unknown): chainId is SupportedChainId {\n const supportedChainIds: readonly string[] = SUPPORTED_CHAIN_IDS;\n return typeof chainId === 'string' && supportedChainIds.includes(chainId);\n },\n\n /**\n * Type guard for whether the API can return token prices in the given\n * currency.\n *\n * @param currency - The currency to check. If a string, can be either\n * lowercase or uppercase.\n * @returns True if the API supports the currency, false otherwise.\n */\n validateCurrencySupported(currency: unknown): currency is SupportedCurrency {\n const supportedCurrencies: readonly string[] = SUPPORTED_CURRENCIES;\n return (\n typeof currency === 'string' &&\n supportedCurrencies.includes(currency.toLowerCase())\n );\n },\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/token-prices-service/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.codefiTokenPricesServiceV2 = void 0;
|
|
4
|
+
var codefi_v2_1 = require("./codefi-v2");
|
|
5
|
+
Object.defineProperty(exports, "codefiTokenPricesServiceV2", { enumerable: true, get: function () { return codefi_v2_1.codefiTokenPricesServiceV2; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/token-prices-service/index.ts"],"names":[],"mappings":";;;AACA,yCAAyD;AAAhD,uHAAA,0BAA0B,OAAA","sourcesContent":["export type { AbstractTokenPricesService } from './abstract-token-prices-service';\nexport { codefiTokenPricesServiceV2 } from './codefi-v2';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/assets-controllers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0-preview.3fbb6b41",
|
|
4
4
|
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"@ethersproject/contracts": "^5.7.0",
|
|
36
36
|
"@ethersproject/providers": "^5.7.0",
|
|
37
37
|
"@metamask/abi-utils": "^2.0.2",
|
|
38
|
-
"@metamask/approval-controller": "^
|
|
39
|
-
"@metamask/base-controller": "^
|
|
38
|
+
"@metamask/approval-controller": "^5.0.0",
|
|
39
|
+
"@metamask/base-controller": "^4.0.0",
|
|
40
40
|
"@metamask/contract-metadata": "^2.4.0",
|
|
41
|
-
"@metamask/controller-utils": "^
|
|
41
|
+
"@metamask/controller-utils": "^6.1.0",
|
|
42
42
|
"@metamask/eth-query": "^4.0.0",
|
|
43
43
|
"@metamask/metamask-eth-abis": "3.0.0",
|
|
44
|
-
"@metamask/network-controller": "^
|
|
45
|
-
"@metamask/polling-controller": "^
|
|
46
|
-
"@metamask/preferences-controller": "^
|
|
44
|
+
"@metamask/network-controller": "^17.0.0",
|
|
45
|
+
"@metamask/polling-controller": "^2.0.0",
|
|
46
|
+
"@metamask/preferences-controller": "^5.0.0",
|
|
47
47
|
"@metamask/rpc-errors": "^6.1.0",
|
|
48
48
|
"@metamask/utils": "^8.2.0",
|
|
49
49
|
"@types/uuid": "^8.3.0",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@metamask/auto-changelog": "^3.4.3",
|
|
58
|
+
"@metamask/ethjs-provider-http": "^0.2.0",
|
|
58
59
|
"@types/jest": "^27.4.1",
|
|
59
60
|
"@types/node": "^16.18.54",
|
|
60
61
|
"deepmerge": "^4.2.2",
|
|
61
|
-
"ethjs-provider-http": "^0.1.6",
|
|
62
62
|
"jest": "^27.5.1",
|
|
63
63
|
"jest-environment-jsdom": "^27.5.1",
|
|
64
64
|
"nock": "^13.3.1",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"typescript": "~4.8.4"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@metamask/approval-controller": "^
|
|
73
|
-
"@metamask/network-controller": "^
|
|
74
|
-
"@metamask/preferences-controller": "^
|
|
72
|
+
"@metamask/approval-controller": "^5.0.0",
|
|
73
|
+
"@metamask/network-controller": "^17.0.0",
|
|
74
|
+
"@metamask/preferences-controller": "^5.0.0"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=16.0.0"
|