@pancakeswap/token-lists 0.0.2

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.
@@ -0,0 +1,22 @@
1
+ warning package.json: No license field
2
+ $ tsup
3
+ CLI Building entry: {"index":"./src/index.ts","react":"./react/index.ts"}
4
+ CLI Using tsconfig: tsconfig.json
5
+ CLI tsup v6.2.3
6
+ CLI Using tsup config: /home/runner/work/pancake-frontend/pancake-frontend/packages/token-lists/tsup.config.ts
7
+ CLI Target: node14
8
+ ESM Build start
9
+ CJS Build start
10
+ ESM dist/index.mjs 208.00 B
11
+ ESM dist/react.mjs 7.70 KB
12
+ ESM dist/chunk-YBVZDUCZ.mjs 1.92 KB
13
+ ESM dist/getTokenList-T45DK2AY.mjs 13.04 KB
14
+ ESM ⚡️ Build success in 111ms
15
+ CJS dist/index.js 3.11 KB
16
+ CJS dist/react.js 25.22 KB
17
+ CJS ⚡️ Build success in 104ms
18
+ DTS Build start
19
+ DTS ⚡️ Build success in 9781ms
20
+ DTS dist/index.d.ts 1.54 KB
21
+ DTS dist/react.d.ts 2.63 KB
22
+ DTS dist/types-b620c9be.d.ts 1.03 KB
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # @pancakeswap/token-lists
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 68440160d: ## PancakeSwap version spec
8
+ Add `schema` aptos to indentify aptos version of token list
9
+ without schema will default be uniswap version evm validation
@@ -0,0 +1,70 @@
1
+ // src/wrappedTokenInfo.ts
2
+ import { Token } from "@pancakeswap/swap-sdk-core";
3
+ var WrappedTokenInfo = class extends Token {
4
+ constructor(tokenInfo) {
5
+ super(tokenInfo.chainId, tokenInfo.address, tokenInfo.decimals, tokenInfo.symbol, tokenInfo.name);
6
+ this.logoURI = tokenInfo.logoURI;
7
+ }
8
+ get serialize() {
9
+ return {
10
+ address: this.address,
11
+ chainId: this.chainId,
12
+ decimals: this.decimals,
13
+ symbol: this.symbol,
14
+ name: this.name,
15
+ projectLink: this.projectLink,
16
+ logoURI: this.logoURI
17
+ };
18
+ }
19
+ };
20
+ function deserializeToken(serializedToken) {
21
+ if (serializedToken.logoURI) {
22
+ return new WrappedTokenInfo({
23
+ chainId: serializedToken.chainId,
24
+ address: serializedToken.address,
25
+ decimals: serializedToken.decimals,
26
+ symbol: serializedToken.symbol || "Unknown",
27
+ name: serializedToken.name || "Unknown",
28
+ logoURI: serializedToken.logoURI
29
+ });
30
+ }
31
+ return new Token(
32
+ serializedToken.chainId,
33
+ serializedToken.address,
34
+ serializedToken.decimals,
35
+ serializedToken.symbol,
36
+ serializedToken.name,
37
+ serializedToken.projectLink
38
+ );
39
+ }
40
+
41
+ // src/getVersionUpgrade.ts
42
+ var VersionUpgrade = /* @__PURE__ */ ((VersionUpgrade2) => {
43
+ VersionUpgrade2[VersionUpgrade2["NONE"] = 0] = "NONE";
44
+ VersionUpgrade2[VersionUpgrade2["PATCH"] = 1] = "PATCH";
45
+ VersionUpgrade2[VersionUpgrade2["MINOR"] = 2] = "MINOR";
46
+ VersionUpgrade2[VersionUpgrade2["MAJOR"] = 3] = "MAJOR";
47
+ return VersionUpgrade2;
48
+ })(VersionUpgrade || {});
49
+ function getVersionUpgrade(base, update) {
50
+ if (update.major > base.major) {
51
+ return 3 /* MAJOR */;
52
+ }
53
+ if (update.major < base.major) {
54
+ return 0 /* NONE */;
55
+ }
56
+ if (update.minor > base.minor) {
57
+ return 2 /* MINOR */;
58
+ }
59
+ if (update.minor < base.minor) {
60
+ return 0 /* NONE */;
61
+ }
62
+ return update.patch > base.patch ? 1 /* PATCH */ : 0 /* NONE */;
63
+ }
64
+
65
+ export {
66
+ WrappedTokenInfo,
67
+ deserializeToken,
68
+ VersionUpgrade,
69
+ getVersionUpgrade
70
+ };
@@ -0,0 +1,455 @@
1
+ // ../utils/uriToHttp.ts
2
+ function uriToHttp(uri) {
3
+ var _a, _b;
4
+ const protocol = uri.split(":")[0].toLowerCase();
5
+ switch (protocol) {
6
+ case "https":
7
+ return [uri];
8
+ case "http":
9
+ return [`https${uri.substring(4)}`, uri];
10
+ case "ipfs":
11
+ const hash = (_a = uri.match(/^ipfs:(\/\/)?(.*)$/i)) == null ? void 0 : _a[2];
12
+ return [`https://cloudflare-ipfs.com/ipfs/${hash}/`, `https://ipfs.io/ipfs/${hash}/`];
13
+ case "ipns":
14
+ const name = (_b = uri.match(/^ipns:(\/\/)?(.*)$/i)) == null ? void 0 : _b[2];
15
+ return [`https://cloudflare-ipfs.com/ipns/${name}/`, `https://ipfs.io/ipns/${name}/`];
16
+ default:
17
+ return [];
18
+ }
19
+ }
20
+
21
+ // react/getTokenList.ts
22
+ import Ajv from "ajv";
23
+
24
+ // schema/pancakeswap.json
25
+ var pancakeswap_default = {
26
+ $schema: "http://json-schema.org/draft-07/schema#",
27
+ $id: "pancakeswap",
28
+ title: "PancakeSwap Token List",
29
+ description: "Schema for lists of tokens compatible with the PancakeSwap Interface, including Uniswap standard and PancakeSwap Aptos",
30
+ definitions: {
31
+ Version: {
32
+ type: "object",
33
+ description: "The version of the list, used in change detection",
34
+ examples: [
35
+ {
36
+ major: 1,
37
+ minor: 0,
38
+ patch: 0
39
+ }
40
+ ],
41
+ additionalProperties: false,
42
+ properties: {
43
+ major: {
44
+ type: "integer",
45
+ description: "The major version of the list. Must be incremented when tokens are removed from the list or token addresses are changed.",
46
+ minimum: 0,
47
+ examples: [1, 2]
48
+ },
49
+ minor: {
50
+ type: "integer",
51
+ description: "The minor version of the list. Must be incremented when tokens are added to the list.",
52
+ minimum: 0,
53
+ examples: [0, 1]
54
+ },
55
+ patch: {
56
+ type: "integer",
57
+ description: "The patch version of the list. Must be incremented for any changes to the list.",
58
+ minimum: 0,
59
+ examples: [0, 1]
60
+ }
61
+ },
62
+ required: ["major", "minor", "patch"]
63
+ },
64
+ TagIdentifier: {
65
+ type: "string",
66
+ description: "The unique identifier of a tag",
67
+ minLength: 1,
68
+ maxLength: 10,
69
+ pattern: "^[\\w]+$",
70
+ examples: ["compound", "stablecoin"]
71
+ },
72
+ ExtensionIdentifier: {
73
+ type: "string",
74
+ description: "The name of a token extension property",
75
+ minLength: 1,
76
+ maxLength: 40,
77
+ pattern: "^[\\w]+$",
78
+ examples: ["color", "is_fee_on_transfer", "aliases"]
79
+ },
80
+ ExtensionMap: {
81
+ type: "object",
82
+ description: "An object containing any arbitrary or vendor-specific token metadata",
83
+ maxProperties: 10,
84
+ propertyNames: {
85
+ $ref: "#/definitions/ExtensionIdentifier"
86
+ },
87
+ additionalProperties: {
88
+ $ref: "#/definitions/ExtensionValue"
89
+ },
90
+ examples: [
91
+ {
92
+ color: "#000000",
93
+ is_verified_by_me: true
94
+ },
95
+ {
96
+ "x-bridged-addresses-by-chain": {
97
+ "1": {
98
+ bridgeAddress: "0x4200000000000000000000000000000000000010",
99
+ tokenAddress: "0x4200000000000000000000000000000000000010"
100
+ }
101
+ }
102
+ }
103
+ ]
104
+ },
105
+ ExtensionPrimitiveValue: {
106
+ anyOf: [
107
+ {
108
+ type: "string",
109
+ minLength: 1,
110
+ maxLength: 42,
111
+ examples: ["#00000"]
112
+ },
113
+ {
114
+ type: "boolean",
115
+ examples: [true]
116
+ },
117
+ {
118
+ type: "number",
119
+ examples: [15]
120
+ },
121
+ {
122
+ type: "null"
123
+ }
124
+ ]
125
+ },
126
+ ExtensionValue: {
127
+ anyOf: [
128
+ {
129
+ $ref: "#/definitions/ExtensionPrimitiveValue"
130
+ },
131
+ {
132
+ type: "object",
133
+ maxProperties: 10,
134
+ propertyNames: {
135
+ $ref: "#/definitions/ExtensionIdentifier"
136
+ },
137
+ additionalProperties: {
138
+ $ref: "#/definitions/ExtensionValueInner0"
139
+ }
140
+ }
141
+ ]
142
+ },
143
+ ExtensionValueInner0: {
144
+ anyOf: [
145
+ {
146
+ $ref: "#/definitions/ExtensionPrimitiveValue"
147
+ },
148
+ {
149
+ type: "object",
150
+ maxProperties: 10,
151
+ propertyNames: {
152
+ $ref: "#/definitions/ExtensionIdentifier"
153
+ },
154
+ additionalProperties: {
155
+ $ref: "#/definitions/ExtensionValueInner1"
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ ExtensionValueInner1: {
161
+ anyOf: [
162
+ {
163
+ $ref: "#/definitions/ExtensionPrimitiveValue"
164
+ }
165
+ ]
166
+ },
167
+ TagDefinition: {
168
+ type: "object",
169
+ description: "Definition of a tag that can be associated with a token via its identifier",
170
+ additionalProperties: false,
171
+ properties: {
172
+ name: {
173
+ type: "string",
174
+ description: "The name of the tag",
175
+ pattern: "^[ \\w]+$",
176
+ minLength: 1,
177
+ maxLength: 20
178
+ },
179
+ description: {
180
+ type: "string",
181
+ description: "A user-friendly description of the tag",
182
+ pattern: "^[ \\w\\.,:]+$",
183
+ minLength: 1,
184
+ maxLength: 200
185
+ }
186
+ },
187
+ required: ["name", "description"],
188
+ examples: [
189
+ {
190
+ name: "Stablecoin",
191
+ description: "A token with value pegged to another asset"
192
+ }
193
+ ]
194
+ },
195
+ TokenInfo: {
196
+ type: "object",
197
+ description: "Metadata for a single token in a token list",
198
+ additionalProperties: false,
199
+ properties: {
200
+ chainId: {
201
+ type: "integer",
202
+ description: "The chain ID of the Ethereum network where this token is deployed",
203
+ minimum: 1,
204
+ examples: [1, 42]
205
+ },
206
+ address: {
207
+ type: "string",
208
+ description: "The checksummed address of the token on the specified chain ID",
209
+ pattern: "^0x[a-fA-F0-9]{40}$",
210
+ examples: ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"]
211
+ },
212
+ decimals: {
213
+ type: "integer",
214
+ description: "The number of decimals for the token balance",
215
+ minimum: 0,
216
+ maximum: 255,
217
+ examples: [18]
218
+ },
219
+ name: {
220
+ type: "string",
221
+ description: "The name of the token",
222
+ minLength: 1,
223
+ maxLength: 40,
224
+ pattern: "^[ \\w.'+\\-%/\xC0-\xD6\xD8-\xF6\xF8-\xFF:&\\[\\]\\(\\)]+$",
225
+ examples: ["USD Coin"]
226
+ },
227
+ symbol: {
228
+ type: "string",
229
+ description: "The symbol for the token; must be alphanumeric",
230
+ pattern: "^[a-zA-Z0-9+\\-%/$.]+$",
231
+ minLength: 1,
232
+ maxLength: 20,
233
+ examples: ["USDC"]
234
+ },
235
+ logoURI: {
236
+ type: "string",
237
+ description: "A URI to the token logo asset; if not set, interface will attempt to find a logo based on the token address; suggest SVG or PNG of size 64x64",
238
+ format: "uri",
239
+ examples: ["ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM"]
240
+ },
241
+ tags: {
242
+ type: "array",
243
+ description: "An array of tag identifiers associated with the token; tags are defined at the list level",
244
+ items: {
245
+ $ref: "#/definitions/TagIdentifier"
246
+ },
247
+ maxItems: 10,
248
+ examples: ["stablecoin", "compound"]
249
+ },
250
+ extensions: {
251
+ $ref: "#/definitions/ExtensionMap"
252
+ }
253
+ },
254
+ required: ["chainId", "address", "decimals", "name", "symbol"]
255
+ },
256
+ AptosTokenInfo: {
257
+ type: "object",
258
+ description: "Metadata for a single token in a token list",
259
+ additionalProperties: false,
260
+ properties: {
261
+ chainId: {
262
+ type: "integer",
263
+ description: "The chain ID of the Aptos network where this token is deployed, 0 is devent",
264
+ minimum: 0,
265
+ examples: [1, 42]
266
+ },
267
+ address: {
268
+ type: "string",
269
+ description: "The address of the coin on the specified chain ID",
270
+ examples: ["0x1::aptos_coin::AptosCoin"]
271
+ },
272
+ decimals: {
273
+ type: "integer",
274
+ description: "The number of decimals for the token balance",
275
+ minimum: 0,
276
+ maximum: 255,
277
+ examples: [18]
278
+ },
279
+ name: {
280
+ type: "string",
281
+ description: "The name of the token",
282
+ minLength: 1,
283
+ maxLength: 40,
284
+ pattern: "^[ \\w.'+\\-%/\xC0-\xD6\xD8-\xF6\xF8-\xFF:&\\[\\]\\(\\)]+$",
285
+ examples: ["USD Coin"]
286
+ },
287
+ symbol: {
288
+ type: "string",
289
+ description: "The symbol for the token; must be alphanumeric",
290
+ pattern: "^[a-zA-Z0-9+\\-%/$.]+$",
291
+ minLength: 1,
292
+ maxLength: 20,
293
+ examples: ["USDC"]
294
+ },
295
+ logoURI: {
296
+ type: "string",
297
+ description: "A URI to the token logo asset; if not set, interface will attempt to find a logo based on the token address; suggest SVG or PNG of size 64x64",
298
+ format: "uri",
299
+ examples: ["ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM"]
300
+ },
301
+ tags: {
302
+ type: "array",
303
+ description: "An array of tag identifiers associated with the token; tags are defined at the list level",
304
+ items: {
305
+ $ref: "#/definitions/TagIdentifier"
306
+ },
307
+ maxItems: 10,
308
+ examples: ["stablecoin", "compound"]
309
+ },
310
+ extensions: {
311
+ $ref: "#/definitions/ExtensionMap"
312
+ }
313
+ },
314
+ required: ["chainId", "address", "decimals", "name", "symbol"]
315
+ }
316
+ },
317
+ type: "object",
318
+ additionalProperties: false,
319
+ properties: {
320
+ name: {
321
+ type: "string",
322
+ description: "The name of the token list",
323
+ minLength: 1,
324
+ maxLength: 30,
325
+ pattern: "^[\\w ]+$",
326
+ examples: ["My Token List"]
327
+ },
328
+ timestamp: {
329
+ type: "string",
330
+ format: "date-time",
331
+ description: "The timestamp of this list version; i.e. when this immutable version of the list was created"
332
+ },
333
+ schema: {
334
+ type: "string"
335
+ },
336
+ version: {
337
+ $ref: "#/definitions/Version"
338
+ },
339
+ tokens: {
340
+ type: "array",
341
+ description: "The list of tokens included in the list",
342
+ minItems: 1,
343
+ maxItems: 1e4
344
+ },
345
+ keywords: {
346
+ type: "array",
347
+ description: "Keywords associated with the contents of the list; may be used in list discoverability",
348
+ items: {
349
+ type: "string",
350
+ description: "A keyword to describe the contents of the list",
351
+ minLength: 1,
352
+ maxLength: 20,
353
+ pattern: "^[\\w ]+$",
354
+ examples: ["compound", "lending", "personal tokens"]
355
+ },
356
+ maxItems: 20,
357
+ uniqueItems: true
358
+ },
359
+ tags: {
360
+ type: "object",
361
+ description: "A mapping of tag identifiers to their name and description",
362
+ propertyNames: {
363
+ $ref: "#/definitions/TagIdentifier"
364
+ },
365
+ additionalProperties: {
366
+ $ref: "#/definitions/TagDefinition"
367
+ },
368
+ maxProperties: 20,
369
+ examples: [
370
+ {
371
+ stablecoin: {
372
+ name: "Stablecoin",
373
+ description: "A token with value pegged to another asset"
374
+ }
375
+ }
376
+ ]
377
+ },
378
+ logoURI: {
379
+ type: "string",
380
+ description: "A URI for the logo of the token list; prefer SVG or PNG of size 256x256",
381
+ format: "uri",
382
+ examples: ["ipfs://QmXfzKRvjZz3u5JRgC4v5mGVbm9ahrUiB4DgzHBsnWbTMM"]
383
+ }
384
+ },
385
+ if: {
386
+ properties: { schema: { const: "aptos" } },
387
+ required: ["name", "timestamp", "version", "tokens", "schema"]
388
+ },
389
+ then: {
390
+ properties: {
391
+ tokens: {
392
+ items: {
393
+ $ref: "#/definitions/AptosTokenInfo"
394
+ },
395
+ type: "array",
396
+ description: "The list of tokens included in the list",
397
+ minItems: 1,
398
+ maxItems: 1e4
399
+ }
400
+ }
401
+ },
402
+ else: {
403
+ properties: {
404
+ tokens: {
405
+ items: {
406
+ $ref: "#/definitions/TokenInfo"
407
+ },
408
+ type: "array",
409
+ description: "The list of tokens included in the list",
410
+ minItems: 1,
411
+ maxItems: 1e4
412
+ }
413
+ }
414
+ },
415
+ required: ["name", "timestamp", "version", "tokens"]
416
+ };
417
+
418
+ // react/getTokenList.ts
419
+ var tokenListValidator = new Ajv({ allErrors: true }).compile(pancakeswap_default);
420
+ async function getTokenList(listUrl) {
421
+ var _a;
422
+ const urls = uriToHttp(listUrl);
423
+ for (let i = 0; i < urls.length; i++) {
424
+ const url = urls[i];
425
+ const isLast = i === urls.length - 1;
426
+ let response;
427
+ try {
428
+ response = await fetch(url);
429
+ } catch (error) {
430
+ console.error("Failed to fetch list", listUrl, error);
431
+ if (isLast)
432
+ throw new Error(`Failed to download list ${listUrl}`);
433
+ continue;
434
+ }
435
+ if (!response.ok) {
436
+ if (isLast)
437
+ throw new Error(`Failed to download list ${listUrl}`);
438
+ continue;
439
+ }
440
+ const json = await response.json();
441
+ if (!tokenListValidator(json)) {
442
+ const validationErrors = ((_a = tokenListValidator.errors) == null ? void 0 : _a.reduce((memo, error) => {
443
+ const add = `${error.dataPath} ${error.message ?? ""}`;
444
+ return memo.length > 0 ? `${memo}; ${add}` : `${add}`;
445
+ }, "")) ?? "unknown error";
446
+ throw new Error(`Token list failed validation: ${validationErrors}`);
447
+ }
448
+ return json;
449
+ }
450
+ throw new Error("Unrecognized list URL protocol.");
451
+ }
452
+ export {
453
+ getTokenList as default,
454
+ tokenListValidator
455
+ };
@@ -0,0 +1,50 @@
1
+ import { SerializedToken, Token } from '@pancakeswap/swap-sdk-core';
2
+ import { T as TokenInfo, a as TokenList, V as Version } from './types-b620c9be.js';
3
+ export { b as Tags, T as TokenInfo, a as TokenList, V as Version } from './types-b620c9be.js';
4
+
5
+ interface SerializedWrappedToken extends SerializedToken {
6
+ chainId: number;
7
+ address: string;
8
+ decimals: number;
9
+ symbol: string;
10
+ name?: string;
11
+ projectLink?: string;
12
+ logoURI?: string;
13
+ }
14
+ /**
15
+ * Token instances created from token info.
16
+ */
17
+ declare class WrappedTokenInfo extends Token {
18
+ readonly logoURI: string | undefined;
19
+ constructor(tokenInfo: TokenInfo);
20
+ get serialize(): SerializedWrappedToken;
21
+ }
22
+ declare type TokenAddressMap<TChainId extends number> = Readonly<{
23
+ [chainId in TChainId]: Readonly<{
24
+ [tokenAddress: string]: {
25
+ token: WrappedTokenInfo;
26
+ list: TokenList;
27
+ };
28
+ }>;
29
+ }>;
30
+ declare function deserializeToken(serializedToken: SerializedWrappedToken): Token;
31
+
32
+ /**
33
+ * Enum describing types of version differences
34
+ */
35
+
36
+ declare enum VersionUpgrade {
37
+ NONE = 0,
38
+ PATCH = 1,
39
+ MINOR = 2,
40
+ MAJOR = 3
41
+ }
42
+ /**
43
+ * Return the upgrade type from the base version to the update version.
44
+ * Note that downgrades and equivalent versions are both treated as `NONE`.
45
+ * @param base base list
46
+ * @param update update to the list
47
+ */
48
+ declare function getVersionUpgrade(base: Version, update: Version): VersionUpgrade;
49
+
50
+ export { SerializedWrappedToken, TokenAddressMap, VersionUpgrade, WrappedTokenInfo, deserializeToken, getVersionUpgrade };
package/dist/index.js ADDED
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ VersionUpgrade: () => VersionUpgrade,
24
+ WrappedTokenInfo: () => WrappedTokenInfo,
25
+ deserializeToken: () => deserializeToken,
26
+ getVersionUpgrade: () => getVersionUpgrade
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+
30
+ // src/wrappedTokenInfo.ts
31
+ var import_swap_sdk_core = require("@pancakeswap/swap-sdk-core");
32
+ var WrappedTokenInfo = class extends import_swap_sdk_core.Token {
33
+ constructor(tokenInfo) {
34
+ super(tokenInfo.chainId, tokenInfo.address, tokenInfo.decimals, tokenInfo.symbol, tokenInfo.name);
35
+ this.logoURI = tokenInfo.logoURI;
36
+ }
37
+ get serialize() {
38
+ return {
39
+ address: this.address,
40
+ chainId: this.chainId,
41
+ decimals: this.decimals,
42
+ symbol: this.symbol,
43
+ name: this.name,
44
+ projectLink: this.projectLink,
45
+ logoURI: this.logoURI
46
+ };
47
+ }
48
+ };
49
+ function deserializeToken(serializedToken) {
50
+ if (serializedToken.logoURI) {
51
+ return new WrappedTokenInfo({
52
+ chainId: serializedToken.chainId,
53
+ address: serializedToken.address,
54
+ decimals: serializedToken.decimals,
55
+ symbol: serializedToken.symbol || "Unknown",
56
+ name: serializedToken.name || "Unknown",
57
+ logoURI: serializedToken.logoURI
58
+ });
59
+ }
60
+ return new import_swap_sdk_core.Token(
61
+ serializedToken.chainId,
62
+ serializedToken.address,
63
+ serializedToken.decimals,
64
+ serializedToken.symbol,
65
+ serializedToken.name,
66
+ serializedToken.projectLink
67
+ );
68
+ }
69
+
70
+ // src/getVersionUpgrade.ts
71
+ var VersionUpgrade = /* @__PURE__ */ ((VersionUpgrade2) => {
72
+ VersionUpgrade2[VersionUpgrade2["NONE"] = 0] = "NONE";
73
+ VersionUpgrade2[VersionUpgrade2["PATCH"] = 1] = "PATCH";
74
+ VersionUpgrade2[VersionUpgrade2["MINOR"] = 2] = "MINOR";
75
+ VersionUpgrade2[VersionUpgrade2["MAJOR"] = 3] = "MAJOR";
76
+ return VersionUpgrade2;
77
+ })(VersionUpgrade || {});
78
+ function getVersionUpgrade(base, update) {
79
+ if (update.major > base.major) {
80
+ return 3 /* MAJOR */;
81
+ }
82
+ if (update.major < base.major) {
83
+ return 0 /* NONE */;
84
+ }
85
+ if (update.minor > base.minor) {
86
+ return 2 /* MINOR */;
87
+ }
88
+ if (update.minor < base.minor) {
89
+ return 0 /* NONE */;
90
+ }
91
+ return update.patch > base.patch ? 1 /* PATCH */ : 0 /* NONE */;
92
+ }
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ VersionUpgrade,
96
+ WrappedTokenInfo,
97
+ deserializeToken,
98
+ getVersionUpgrade
99
+ });