@pioneer-platform/uniswap-client 0.0.28 → 0.1.0
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 +16 -0
- package/lib/constants/chainInfo.d.ts +2 -2
- package/lib/constants/chainInfo.js +40 -43
- package/lib/constants/chains.d.ts +20 -20
- package/lib/constants/chains.js +25 -26
- package/lib/constants/governance.js +13 -14
- package/lib/constants/lists.js +20 -28
- package/lib/constants/misc.d.ts +4 -5
- package/lib/constants/misc.js +2 -2
- package/lib/constants/networks.js +45 -46
- package/lib/constants/proposals/uniswap_grants_proposal_description.js +106 -1
- package/lib/constants/providers.d.ts +16 -15
- package/lib/constants/providers.js +23 -24
- package/lib/constants/routing.js +44 -61
- package/lib/constants/tokens.d.ts +49 -49
- package/lib/constants/tokens.js +133 -170
- package/lib/index.js +556 -877
- package/lib/routing/clientSideSmartOrderRouter.js +72 -121
- package/lib/routing/gas.js +63 -150
- package/lib/routing/types.d.ts +7 -7
- package/lib/routing/types.js +160 -264
- package/lib/routing/utils.js +141 -196
- package/lib/rpc/AppJsonRpcProvider.js +40 -131
- package/lib/rpc/ConfiguredJsonRpcProvider.d.ts +1 -1
- package/lib/rpc/ConfiguredJsonRpcProvider.js +8 -27
- package/lib/utils/contracts/getContract.js +6 -7
- package/lib/utils/transformSwapRouteToGetQuoteResult.js +24 -27
- package/lib/utils/uniswapData.d.ts +6 -6
- package/lib/utils/uniswapData.js +64 -142
- package/package.json +19 -19
- package/tsconfig.json +27 -8
- package/lib/constants/chains.test.d.ts +0 -1
- package/lib/constants/chains.test.js +0 -26
- package/lib/constants/localCurrencies.d.ts +0 -6
- package/lib/constants/localCurrencies.js +0 -94
- package/lib/constants/localCurrencyIcons.d.ts +0 -18
- package/lib/constants/localCurrencyIcons.js +0 -298
- package/lib/constants/routing.test.d.ts +0 -1
- package/lib/constants/routing.test.js +0 -32
- package/lib/constants/tokenLists/broken.tokenlist.json +0 -22
- package/lib/constants/tokenLogoLookup.d.ts +0 -8
- package/lib/constants/tokenLogoLookup.js +0 -48
- package/lib/constants/tokenSafety.js +0 -129
- package/lib/constants/tokenSafetyLookup.d.ts +0 -18
- package/lib/constants/tokenSafetyLookup.js +0 -66
- package/lib/constants/tokenSaftey.test.d.ts +0 -1
- package/lib/constants/tokenSaftey.test.js +0 -31
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ListsState } from 'state/lists/types';
|
|
2
|
-
export declare enum TOKEN_LIST_TYPES {
|
|
3
|
-
UNI_DEFAULT = 1,
|
|
4
|
-
UNI_EXTENDED = 2,
|
|
5
|
-
UNKNOWN = 3,
|
|
6
|
-
BLOCKED = 4,
|
|
7
|
-
BROKEN = 5
|
|
8
|
-
}
|
|
9
|
-
declare class TokenSafetyLookupTable {
|
|
10
|
-
initialized: boolean;
|
|
11
|
-
dict: {
|
|
12
|
-
[key: string]: TOKEN_LIST_TYPES;
|
|
13
|
-
};
|
|
14
|
-
update(lists: ListsState): void;
|
|
15
|
-
checkToken(address: string, chainId?: number | null): TOKEN_LIST_TYPES;
|
|
16
|
-
}
|
|
17
|
-
declare const _default: TokenSafetyLookupTable;
|
|
18
|
-
export default _default;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TOKEN_LIST_TYPES = void 0;
|
|
7
|
-
var state_1 = __importDefault(require("../state"));
|
|
8
|
-
var lists_1 = require("./lists");
|
|
9
|
-
var routing_1 = require("./routing");
|
|
10
|
-
var broken_tokenlist_json_1 = __importDefault(require("./tokenLists/broken.tokenlist.json"));
|
|
11
|
-
var tokens_1 = require("./tokens");
|
|
12
|
-
var TOKEN_LIST_TYPES;
|
|
13
|
-
(function (TOKEN_LIST_TYPES) {
|
|
14
|
-
TOKEN_LIST_TYPES[TOKEN_LIST_TYPES["UNI_DEFAULT"] = 1] = "UNI_DEFAULT";
|
|
15
|
-
TOKEN_LIST_TYPES[TOKEN_LIST_TYPES["UNI_EXTENDED"] = 2] = "UNI_EXTENDED";
|
|
16
|
-
TOKEN_LIST_TYPES[TOKEN_LIST_TYPES["UNKNOWN"] = 3] = "UNKNOWN";
|
|
17
|
-
TOKEN_LIST_TYPES[TOKEN_LIST_TYPES["BLOCKED"] = 4] = "BLOCKED";
|
|
18
|
-
TOKEN_LIST_TYPES[TOKEN_LIST_TYPES["BROKEN"] = 5] = "BROKEN";
|
|
19
|
-
})(TOKEN_LIST_TYPES || (exports.TOKEN_LIST_TYPES = TOKEN_LIST_TYPES = {}));
|
|
20
|
-
var TokenSafetyLookupTable = /** @class */ (function () {
|
|
21
|
-
function TokenSafetyLookupTable() {
|
|
22
|
-
this.initialized = false;
|
|
23
|
-
this.dict = {};
|
|
24
|
-
}
|
|
25
|
-
// TODO(WEB-2488): Index lookups by chainId
|
|
26
|
-
TokenSafetyLookupTable.prototype.update = function (lists) {
|
|
27
|
-
var _this = this;
|
|
28
|
-
var _a, _b, _c, _d;
|
|
29
|
-
this.initialized = true;
|
|
30
|
-
// Initialize extended tokens first
|
|
31
|
-
(_b = (_a = lists.byUrl[lists_1.UNI_EXTENDED_LIST]) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.tokens.forEach(function (token) {
|
|
32
|
-
_this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.UNI_EXTENDED;
|
|
33
|
-
});
|
|
34
|
-
// Initialize default tokens second, so that any tokens on both default and extended will display as default (no warning)
|
|
35
|
-
(_d = (_c = lists.byUrl[lists_1.UNI_LIST]) === null || _c === void 0 ? void 0 : _c.current) === null || _d === void 0 ? void 0 : _d.tokens.forEach(function (token) {
|
|
36
|
-
_this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.UNI_DEFAULT;
|
|
37
|
-
});
|
|
38
|
-
// TODO: Figure out if this list is still relevant
|
|
39
|
-
broken_tokenlist_json_1.default.tokens.forEach(function (token) {
|
|
40
|
-
_this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BROKEN;
|
|
41
|
-
});
|
|
42
|
-
// Initialize blocked tokens from all urls included
|
|
43
|
-
lists_1.UNSUPPORTED_LIST_URLS.map(function (url) { var _a, _b; return (_b = (_a = lists.byUrl[url]) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.tokens; })
|
|
44
|
-
.filter(function (x) { return !!x; })
|
|
45
|
-
.flat(1)
|
|
46
|
-
.forEach(function (token) {
|
|
47
|
-
_this.dict[token.address.toLowerCase()] = TOKEN_LIST_TYPES.BLOCKED;
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
TokenSafetyLookupTable.prototype.checkToken = function (address, chainId) {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
if (!this.initialized)
|
|
53
|
-
this.update(state_1.default.getState().lists);
|
|
54
|
-
if (address === tokens_1.NATIVE_CHAIN_ID.toLowerCase()) {
|
|
55
|
-
return TOKEN_LIST_TYPES.UNI_DEFAULT;
|
|
56
|
-
}
|
|
57
|
-
else if (chainId && ((_a = routing_1.COMMON_BASES[chainId]) === null || _a === void 0 ? void 0 : _a.some(function (base) { return address === base.wrapped.address.toLowerCase(); }))) {
|
|
58
|
-
return TOKEN_LIST_TYPES.UNI_DEFAULT;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
return (_b = this.dict[address]) !== null && _b !== void 0 ? _b : TOKEN_LIST_TYPES.UNKNOWN;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
return TokenSafetyLookupTable;
|
|
65
|
-
}());
|
|
66
|
-
exports.default = new TokenSafetyLookupTable();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tokenSafety_1 = require("./tokenSafety");
|
|
4
|
-
describe('getPriorityWarning', function () {
|
|
5
|
-
it('returns token1Warning when both warnings exist and token1Warning is BLOCKED', function () {
|
|
6
|
-
var token0Warning = tokenSafety_1.StrongWarning;
|
|
7
|
-
var token1Warning = tokenSafety_1.BlockedWarning;
|
|
8
|
-
expect((0, tokenSafety_1.getPriorityWarning)(token0Warning, token1Warning)).toBe(token1Warning);
|
|
9
|
-
});
|
|
10
|
-
it('returns token1Warning when both warnings exist, token1Warning is UNKNOWN, and token0Warning is not BLOCKED', function () {
|
|
11
|
-
var token0Warning = tokenSafety_1.StrongWarning;
|
|
12
|
-
var token1Warning = tokenSafety_1.StrongWarning;
|
|
13
|
-
expect((0, tokenSafety_1.getPriorityWarning)(token0Warning, token1Warning)).toBe(token1Warning);
|
|
14
|
-
});
|
|
15
|
-
it('returns token0Warning when both warnings exist and token1Warning is not BLOCKED or UNKNOWN', function () {
|
|
16
|
-
var token0Warning = tokenSafety_1.StrongWarning;
|
|
17
|
-
var token1Warning = tokenSafety_1.MediumWarning;
|
|
18
|
-
expect((0, tokenSafety_1.getPriorityWarning)(token0Warning, token1Warning)).toBe(token0Warning);
|
|
19
|
-
});
|
|
20
|
-
it('returns token0Warning when only token0Warning exists', function () {
|
|
21
|
-
var token0Warning = tokenSafety_1.StrongWarning;
|
|
22
|
-
expect((0, tokenSafety_1.getPriorityWarning)(token0Warning, undefined)).toBe(token0Warning);
|
|
23
|
-
});
|
|
24
|
-
it('returns token1Warning when only token1Warning exists', function () {
|
|
25
|
-
var token1Warning = tokenSafety_1.BlockedWarning;
|
|
26
|
-
expect((0, tokenSafety_1.getPriorityWarning)(undefined, token1Warning)).toBe(token1Warning);
|
|
27
|
-
});
|
|
28
|
-
it('returns undefined when both warnings are undefined', function () {
|
|
29
|
-
expect((0, tokenSafety_1.getPriorityWarning)(undefined, undefined)).toBeUndefined();
|
|
30
|
-
});
|
|
31
|
-
});
|