@orbs-network/twap 1.14.2 → 1.15.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.
Files changed (52) hide show
  1. package/dist/src/configs.d.ts +472 -1
  2. package/dist/src/configs.js +28 -2
  3. package/dist/src/lib.d.ts +2 -4
  4. package/dist/src/lib.js +8 -2
  5. package/dist/src/odos.js +1 -1
  6. package/package.json +3 -2
  7. package/dist/typechain-hardhat/contracts/IExchange.d.ts +0 -22
  8. package/dist/typechain-hardhat/contracts/IExchange.js +0 -5
  9. package/dist/typechain-hardhat/contracts/IWETH.d.ts +0 -21
  10. package/dist/typechain-hardhat/contracts/IWETH.js +0 -5
  11. package/dist/typechain-hardhat/contracts/TWAP.d.ts +0 -216
  12. package/dist/typechain-hardhat/contracts/TWAP.js +0 -5
  13. package/dist/typechain-hardhat/contracts/exchange/OdosExchange.d.ts +0 -23
  14. package/dist/typechain-hardhat/contracts/exchange/OdosExchange.js +0 -5
  15. package/dist/typechain-hardhat/contracts/exchange/OpenOceanExchange.d.ts +0 -23
  16. package/dist/typechain-hardhat/contracts/exchange/OpenOceanExchange.js +0 -5
  17. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/IPangolinDaas.d.ts +0 -35
  18. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/IPangolinDaas.js +0 -5
  19. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/PangolinDaasExchange.d.ts +0 -23
  20. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/PangolinDaasExchange.js +0 -5
  21. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/index.d.ts +0 -2
  22. package/dist/typechain-hardhat/contracts/exchange/PangolinDaasExchange.sol/index.js +0 -2
  23. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/IParaswap.d.ts +0 -20
  24. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/IParaswap.js +0 -5
  25. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/ParaswapExchange.d.ts +0 -23
  26. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/ParaswapExchange.js +0 -5
  27. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/index.d.ts +0 -2
  28. package/dist/typechain-hardhat/contracts/exchange/ParaswapExchange.sol/index.js +0 -2
  29. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/IUniswapV2.d.ts +0 -23
  30. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/IUniswapV2.js +0 -5
  31. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/UniswapV2Exchange.d.ts +0 -23
  32. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/UniswapV2Exchange.js +0 -5
  33. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/index.d.ts +0 -2
  34. package/dist/typechain-hardhat/contracts/exchange/UniswapV2Exchange.sol/index.js +0 -2
  35. package/dist/typechain-hardhat/contracts/exchange/index.d.ts +0 -8
  36. package/dist/typechain-hardhat/contracts/exchange/index.js +0 -2
  37. package/dist/typechain-hardhat/contracts/index.d.ts +0 -9
  38. package/dist/typechain-hardhat/contracts/index.js +0 -2
  39. package/dist/typechain-hardhat/contracts/periphery/Lens.d.ts +0 -106
  40. package/dist/typechain-hardhat/contracts/periphery/Lens.js +0 -5
  41. package/dist/typechain-hardhat/contracts/periphery/Taker.d.ts +0 -40
  42. package/dist/typechain-hardhat/contracts/periphery/Taker.js +0 -5
  43. package/dist/typechain-hardhat/contracts/periphery/index.d.ts +0 -2
  44. package/dist/typechain-hardhat/contracts/periphery/index.js +0 -2
  45. package/dist/typechain-hardhat/contracts/test/MockDeflationaryToken.d.ts +0 -55
  46. package/dist/typechain-hardhat/contracts/test/MockDeflationaryToken.js +0 -5
  47. package/dist/typechain-hardhat/contracts/test/MockExchange.d.ts +0 -24
  48. package/dist/typechain-hardhat/contracts/test/MockExchange.js +0 -5
  49. package/dist/typechain-hardhat/contracts/test/index.d.ts +0 -2
  50. package/dist/typechain-hardhat/contracts/test/index.js +0 -2
  51. package/dist/typechain-hardhat/types.d.ts +0 -54
  52. package/dist/typechain-hardhat/types.js +0 -5
@@ -18,7 +18,8 @@ export declare enum ParaswapOnlyDex {
18
18
  Chronos = "Chronos"
19
19
  }
20
20
  export declare enum OdosOnlyDex {
21
- Chronos = "Chronos Stable,Chronos Volatile,Wrapped Ether"
21
+ Chronos = "Chronos Stable,Chronos Volatile,Wrapped Ether",
22
+ BaseSwap = "BaseSwap,BaseSwapX"
22
23
  }
23
24
  export declare enum OpenOceanOnlyDex {
24
25
  Thena = "43,47"
@@ -1453,6 +1454,241 @@ export declare const ChainConfigs: {
1453
1454
  logoUrl: string;
1454
1455
  };
1455
1456
  };
1457
+ base: {
1458
+ twapAbi: ({
1459
+ inputs: {
1460
+ internalType: string;
1461
+ name: string;
1462
+ type: string;
1463
+ }[];
1464
+ stateMutability: string;
1465
+ type: string;
1466
+ anonymous?: undefined;
1467
+ name?: undefined;
1468
+ outputs?: undefined;
1469
+ } | {
1470
+ anonymous: boolean;
1471
+ inputs: ({
1472
+ indexed: boolean;
1473
+ internalType: string;
1474
+ name: string;
1475
+ type: string;
1476
+ components?: undefined;
1477
+ } | {
1478
+ components: {
1479
+ internalType: string;
1480
+ name: string;
1481
+ type: string;
1482
+ }[];
1483
+ indexed: boolean;
1484
+ internalType: string;
1485
+ name: string;
1486
+ type: string;
1487
+ })[];
1488
+ name: string;
1489
+ type: string;
1490
+ stateMutability?: undefined;
1491
+ outputs?: undefined;
1492
+ } | {
1493
+ inputs: {
1494
+ components: {
1495
+ internalType: string;
1496
+ name: string;
1497
+ type: string;
1498
+ }[];
1499
+ internalType: string;
1500
+ name: string;
1501
+ type: string;
1502
+ }[];
1503
+ name: string;
1504
+ outputs: {
1505
+ internalType: string;
1506
+ name: string;
1507
+ type: string;
1508
+ }[];
1509
+ stateMutability: string;
1510
+ type: string;
1511
+ anonymous?: undefined;
1512
+ } | {
1513
+ inputs: {
1514
+ internalType: string;
1515
+ name: string;
1516
+ type: string;
1517
+ }[];
1518
+ name: string;
1519
+ outputs: ({
1520
+ internalType: string;
1521
+ name: string;
1522
+ type: string;
1523
+ components?: undefined;
1524
+ } | {
1525
+ components: {
1526
+ internalType: string;
1527
+ name: string;
1528
+ type: string;
1529
+ }[];
1530
+ internalType: string;
1531
+ name: string;
1532
+ type: string;
1533
+ })[];
1534
+ stateMutability: string;
1535
+ type: string;
1536
+ anonymous?: undefined;
1537
+ } | {
1538
+ inputs: {
1539
+ internalType: string;
1540
+ name: string;
1541
+ type: string;
1542
+ }[];
1543
+ name: string;
1544
+ outputs: {
1545
+ components: ({
1546
+ internalType: string;
1547
+ name: string;
1548
+ type: string;
1549
+ components?: undefined;
1550
+ } | {
1551
+ components: {
1552
+ internalType: string;
1553
+ name: string;
1554
+ type: string;
1555
+ }[];
1556
+ internalType: string;
1557
+ name: string;
1558
+ type: string;
1559
+ })[];
1560
+ internalType: string;
1561
+ name: string;
1562
+ type: string;
1563
+ }[];
1564
+ stateMutability: string;
1565
+ type: string;
1566
+ anonymous?: undefined;
1567
+ } | {
1568
+ stateMutability: string;
1569
+ type: string;
1570
+ inputs?: undefined;
1571
+ anonymous?: undefined;
1572
+ name?: undefined;
1573
+ outputs?: undefined;
1574
+ })[];
1575
+ lensAbi: ({
1576
+ inputs: {
1577
+ internalType: string;
1578
+ name: string;
1579
+ type: string;
1580
+ }[];
1581
+ stateMutability: string;
1582
+ type: string;
1583
+ name?: undefined;
1584
+ outputs?: undefined;
1585
+ } | {
1586
+ inputs: never[];
1587
+ name: string;
1588
+ outputs: {
1589
+ internalType: string;
1590
+ name: string;
1591
+ type: string;
1592
+ }[];
1593
+ stateMutability: string;
1594
+ type: string;
1595
+ } | {
1596
+ inputs: {
1597
+ internalType: string;
1598
+ name: string;
1599
+ type: string;
1600
+ }[];
1601
+ name: string;
1602
+ outputs: {
1603
+ components: ({
1604
+ internalType: string;
1605
+ name: string;
1606
+ type: string;
1607
+ components?: undefined;
1608
+ } | {
1609
+ components: {
1610
+ internalType: string;
1611
+ name: string;
1612
+ type: string;
1613
+ }[];
1614
+ internalType: string;
1615
+ name: string;
1616
+ type: string;
1617
+ })[];
1618
+ internalType: string;
1619
+ name: string;
1620
+ type: string;
1621
+ }[];
1622
+ stateMutability: string;
1623
+ type: string;
1624
+ })[];
1625
+ takerAbi: ({
1626
+ inputs: {
1627
+ internalType: string;
1628
+ name: string;
1629
+ type: string;
1630
+ }[];
1631
+ stateMutability: string;
1632
+ type: string;
1633
+ anonymous?: undefined;
1634
+ name?: undefined;
1635
+ outputs?: undefined;
1636
+ } | {
1637
+ anonymous: boolean;
1638
+ inputs: {
1639
+ indexed: boolean;
1640
+ internalType: string;
1641
+ name: string;
1642
+ type: string;
1643
+ }[];
1644
+ name: string;
1645
+ type: string;
1646
+ stateMutability?: undefined;
1647
+ outputs?: undefined;
1648
+ } | {
1649
+ inputs: {
1650
+ internalType: string;
1651
+ name: string;
1652
+ type: string;
1653
+ }[];
1654
+ name: string;
1655
+ outputs: {
1656
+ internalType: string;
1657
+ name: string;
1658
+ type: string;
1659
+ }[];
1660
+ stateMutability: string;
1661
+ type: string;
1662
+ anonymous?: undefined;
1663
+ } | {
1664
+ stateMutability: string;
1665
+ type: string;
1666
+ inputs?: undefined;
1667
+ anonymous?: undefined;
1668
+ name?: undefined;
1669
+ outputs?: undefined;
1670
+ })[];
1671
+ chainName: string;
1672
+ chainId: number;
1673
+ twapVersion: number;
1674
+ twapAddress: string;
1675
+ lensAddress: string;
1676
+ bidDelaySeconds: number;
1677
+ minChunkSizeUsd: number;
1678
+ nativeToken: {
1679
+ address: string;
1680
+ symbol: string;
1681
+ decimals: number;
1682
+ logoUrl: string;
1683
+ };
1684
+ wToken: {
1685
+ symbol: string;
1686
+ address: string;
1687
+ decimals: number;
1688
+ weth: boolean;
1689
+ logoUrl: string;
1690
+ };
1691
+ };
1456
1692
  };
1457
1693
  export declare const Configs: {
1458
1694
  SpiritSwap: Config;
@@ -1461,6 +1697,7 @@ export declare const Configs: {
1461
1697
  PangolinDaas: Config;
1462
1698
  QuickSwap: Config;
1463
1699
  Chronos: Config;
1700
+ BaseSwap: Config;
1464
1701
  Thena: Config;
1465
1702
  PancakeSwap: Config;
1466
1703
  };
@@ -2868,4 +3105,238 @@ export declare const chainConfig: (chainId: number) => {
2868
3105
  weth: boolean;
2869
3106
  logoUrl: string;
2870
3107
  };
3108
+ } | {
3109
+ twapAbi: ({
3110
+ inputs: {
3111
+ internalType: string;
3112
+ name: string;
3113
+ type: string;
3114
+ }[];
3115
+ stateMutability: string;
3116
+ type: string;
3117
+ anonymous?: undefined;
3118
+ name?: undefined;
3119
+ outputs?: undefined;
3120
+ } | {
3121
+ anonymous: boolean;
3122
+ inputs: ({
3123
+ indexed: boolean;
3124
+ internalType: string;
3125
+ name: string;
3126
+ type: string;
3127
+ components?: undefined;
3128
+ } | {
3129
+ components: {
3130
+ internalType: string;
3131
+ name: string;
3132
+ type: string;
3133
+ }[];
3134
+ indexed: boolean;
3135
+ internalType: string;
3136
+ name: string;
3137
+ type: string;
3138
+ })[];
3139
+ name: string;
3140
+ type: string;
3141
+ stateMutability?: undefined;
3142
+ outputs?: undefined;
3143
+ } | {
3144
+ inputs: {
3145
+ components: {
3146
+ internalType: string;
3147
+ name: string;
3148
+ type: string;
3149
+ }[];
3150
+ internalType: string;
3151
+ name: string;
3152
+ type: string;
3153
+ }[];
3154
+ name: string;
3155
+ outputs: {
3156
+ internalType: string;
3157
+ name: string;
3158
+ type: string;
3159
+ }[];
3160
+ stateMutability: string;
3161
+ type: string;
3162
+ anonymous?: undefined;
3163
+ } | {
3164
+ inputs: {
3165
+ internalType: string;
3166
+ name: string;
3167
+ type: string;
3168
+ }[];
3169
+ name: string;
3170
+ outputs: ({
3171
+ internalType: string;
3172
+ name: string;
3173
+ type: string;
3174
+ components?: undefined;
3175
+ } | {
3176
+ components: {
3177
+ internalType: string;
3178
+ name: string;
3179
+ type: string;
3180
+ }[];
3181
+ internalType: string;
3182
+ name: string;
3183
+ type: string;
3184
+ })[];
3185
+ stateMutability: string;
3186
+ type: string;
3187
+ anonymous?: undefined;
3188
+ } | {
3189
+ inputs: {
3190
+ internalType: string;
3191
+ name: string;
3192
+ type: string;
3193
+ }[];
3194
+ name: string;
3195
+ outputs: {
3196
+ components: ({
3197
+ internalType: string;
3198
+ name: string;
3199
+ type: string;
3200
+ components?: undefined;
3201
+ } | {
3202
+ components: {
3203
+ internalType: string;
3204
+ name: string;
3205
+ type: string;
3206
+ }[];
3207
+ internalType: string;
3208
+ name: string;
3209
+ type: string;
3210
+ })[];
3211
+ internalType: string;
3212
+ name: string;
3213
+ type: string;
3214
+ }[];
3215
+ stateMutability: string;
3216
+ type: string;
3217
+ anonymous?: undefined;
3218
+ } | {
3219
+ stateMutability: string;
3220
+ type: string;
3221
+ inputs?: undefined;
3222
+ anonymous?: undefined;
3223
+ name?: undefined;
3224
+ outputs?: undefined;
3225
+ })[];
3226
+ lensAbi: ({
3227
+ inputs: {
3228
+ internalType: string;
3229
+ name: string;
3230
+ type: string;
3231
+ }[];
3232
+ stateMutability: string;
3233
+ type: string;
3234
+ name?: undefined;
3235
+ outputs?: undefined;
3236
+ } | {
3237
+ inputs: never[];
3238
+ name: string;
3239
+ outputs: {
3240
+ internalType: string;
3241
+ name: string;
3242
+ type: string;
3243
+ }[];
3244
+ stateMutability: string;
3245
+ type: string;
3246
+ } | {
3247
+ inputs: {
3248
+ internalType: string;
3249
+ name: string;
3250
+ type: string;
3251
+ }[];
3252
+ name: string;
3253
+ outputs: {
3254
+ components: ({
3255
+ internalType: string;
3256
+ name: string;
3257
+ type: string;
3258
+ components?: undefined;
3259
+ } | {
3260
+ components: {
3261
+ internalType: string;
3262
+ name: string;
3263
+ type: string;
3264
+ }[];
3265
+ internalType: string;
3266
+ name: string;
3267
+ type: string;
3268
+ })[];
3269
+ internalType: string;
3270
+ name: string;
3271
+ type: string;
3272
+ }[];
3273
+ stateMutability: string;
3274
+ type: string;
3275
+ })[];
3276
+ takerAbi: ({
3277
+ inputs: {
3278
+ internalType: string;
3279
+ name: string;
3280
+ type: string;
3281
+ }[];
3282
+ stateMutability: string;
3283
+ type: string;
3284
+ anonymous?: undefined;
3285
+ name?: undefined;
3286
+ outputs?: undefined;
3287
+ } | {
3288
+ anonymous: boolean;
3289
+ inputs: {
3290
+ indexed: boolean;
3291
+ internalType: string;
3292
+ name: string;
3293
+ type: string;
3294
+ }[];
3295
+ name: string;
3296
+ type: string;
3297
+ stateMutability?: undefined;
3298
+ outputs?: undefined;
3299
+ } | {
3300
+ inputs: {
3301
+ internalType: string;
3302
+ name: string;
3303
+ type: string;
3304
+ }[];
3305
+ name: string;
3306
+ outputs: {
3307
+ internalType: string;
3308
+ name: string;
3309
+ type: string;
3310
+ }[];
3311
+ stateMutability: string;
3312
+ type: string;
3313
+ anonymous?: undefined;
3314
+ } | {
3315
+ stateMutability: string;
3316
+ type: string;
3317
+ inputs?: undefined;
3318
+ anonymous?: undefined;
3319
+ name?: undefined;
3320
+ outputs?: undefined;
3321
+ })[];
3322
+ chainName: string;
3323
+ chainId: number;
3324
+ twapVersion: number;
3325
+ twapAddress: string;
3326
+ lensAddress: string;
3327
+ bidDelaySeconds: number;
3328
+ minChunkSizeUsd: number;
3329
+ nativeToken: {
3330
+ address: string;
3331
+ symbol: string;
3332
+ decimals: number;
3333
+ logoUrl: string;
3334
+ };
3335
+ wToken: {
3336
+ symbol: string;
3337
+ address: string;
3338
+ decimals: number;
3339
+ weth: boolean;
3340
+ logoUrl: string;
3341
+ };
2871
3342
  };
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -9,7 +32,7 @@ const lodash_1 = __importDefault(require("lodash"));
9
32
  const TWAP_json_1 = __importDefault(require("../artifacts/contracts/TWAP.sol/TWAP.json"));
10
33
  const Lens_json_1 = __importDefault(require("../artifacts/contracts/periphery/Lens.sol/Lens.json"));
11
34
  const Taker_json_1 = __importDefault(require("../artifacts/contracts/periphery/Taker.sol/Taker.json"));
12
- const legacy_abi_1 = require("./legacy-abi");
35
+ const legacyAbis = __importStar(require("./legacy-abi"));
13
36
  var web3_candies_2 = require("@defi.org/web3-candies");
14
37
  Object.defineProperty(exports, "nativeTokenAddresses", { enumerable: true, get: function () { return web3_candies_2.nativeTokenAddresses; } });
15
38
  Object.defineProperty(exports, "zeroAddress", { enumerable: true, get: function () { return web3_candies_2.zeroAddress; } });
@@ -29,6 +52,7 @@ var ParaswapOnlyDex;
29
52
  var OdosOnlyDex;
30
53
  (function (OdosOnlyDex) {
31
54
  OdosOnlyDex["Chronos"] = "Chronos Stable,Chronos Volatile,Wrapped Ether";
55
+ OdosOnlyDex["BaseSwap"] = "BaseSwap,BaseSwapX";
32
56
  })(OdosOnlyDex = exports.OdosOnlyDex || (exports.OdosOnlyDex = {}));
33
57
  var OpenOceanOnlyDex;
34
58
  (function (OpenOceanOnlyDex) {
@@ -46,14 +70,16 @@ exports.ChainConfigs = {
46
70
  ftm: Object.assign({ chainName: "ftm", chainId: 250, twapVersion: 4, twapAddress: "0xdb55107c17Cb433D322052BFA36069fDf7Cb1031", lensAddress: "0x6E78fA5d48aedF302e48ef3fbD97FD11b4e98d8B", bidDelaySeconds: 60, minChunkSizeUsd: 10, nativeToken: web3_candies_1.networks.ftm.native, wToken: web3_candies_1.networks.ftm.wToken }, defaultAbis),
47
71
  poly: Object.assign({ chainName: "poly", chainId: 137, twapVersion: 4, twapAddress: "0xceFf098C9199c5d9cf24078dc14Eb8F787631cC0", lensAddress: "0x8ffde23Fba2d7Aea9C3CBf2d5B7B533BB46754a8", bidDelaySeconds: 60, minChunkSizeUsd: 10, nativeToken: web3_candies_1.networks.poly.native, wToken: web3_candies_1.networks.poly.wToken }, defaultAbis),
48
72
  avax: Object.assign({ chainName: "avax", chainId: 43114, twapVersion: 4, twapAddress: "0xF2687e119B0A4aB00bED9c9F425403566D605020", lensAddress: "0xfA1e5Da0Cbb780b891Cd635264354a9F4d3A726E", bidDelaySeconds: 60, minChunkSizeUsd: 10, nativeToken: web3_candies_1.networks.avax.native, wToken: web3_candies_1.networks.avax.wToken }, defaultAbis),
73
+ base: Object.assign({ chainName: "base", chainId: 8453, twapVersion: 4, twapAddress: "0x25a0A78f5ad07b2474D3D42F1c1432178465936d", lensAddress: "0x3b7C090857a4068e16396550423ebadae502768F", bidDelaySeconds: 60, minChunkSizeUsd: 10, nativeToken: web3_candies_1.networks.base.native, wToken: web3_candies_1.networks.base.wToken }, defaultAbis),
49
74
  };
50
75
  exports.Configs = {
51
- SpiritSwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { twapVersion: 3, twapAddress: "0xBb9F828E34A1327607c3e4eA3dD35891398DD5EE", lensAddress: "0x042799657E971855eD619046aeDf7F30DB56d2D6", twapAbi: legacy_abi_1.twapAbiV3, lensAbi: legacy_abi_1.lensAbiV3, takerAbi: legacy_abi_1.takerAbiV3, name: "SpiritSwap", partner: "Orbs:TWAP:SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404", exchangeType: "ParaswapExchange", pathfinderKey: ParaswapOnlyDex.SpiritSwap }),
76
+ SpiritSwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { twapVersion: 3, twapAddress: "0xBb9F828E34A1327607c3e4eA3dD35891398DD5EE", lensAddress: "0x042799657E971855eD619046aeDf7F30DB56d2D6", twapAbi: legacyAbis.twapAbiV3, lensAbi: legacyAbis.lensAbiV3, takerAbi: legacyAbis.takerAbiV3, name: "SpiritSwap", partner: "Orbs:TWAP:SpiritSwap", exchangeAddress: "0xAd19179201be5A51D1cBd3bB2fC651BB05822404", exchangeType: "ParaswapExchange", pathfinderKey: ParaswapOnlyDex.SpiritSwap }),
52
77
  SpookySwap: Object.assign(Object.assign({}, exports.ChainConfigs.ftm), { name: "SpookySwap", partner: "Orbs:TWAP:SpookySwap", exchangeAddress: "0x704b9764cb36B8856f3097845dcc594d82192638", exchangeType: "UniswapV2Exchange", pathfinderKey: ParaswapOnlyDex.SpookySwap }),
53
78
  Pangolin: Object.assign(Object.assign({}, exports.ChainConfigs.avax), { name: "Pangolin", partner: "Orbs:TWAP:Pangolin", exchangeAddress: "0xf2d96E7BE676153d202e1453804E2749923C7c5b", exchangeType: "UniswapV2Exchange", pathfinderKey: ParaswapOnlyDex.Pangolin }),
54
79
  PangolinDaas: Object.assign(Object.assign({}, exports.ChainConfigs.avax), { name: "PangolinDaas", partner: "Orbs:TWAP:PangolinDaas", exchangeAddress: "0x1579EED0527781B1A748043AA1f59a3858Ace4a7", exchangeType: "PangolinDaasExchange", pathfinderKey: ParaswapOnlyDex.Pangolin }),
55
80
  QuickSwap: Object.assign(Object.assign({}, exports.ChainConfigs.poly), { name: "QuickSwap", partner: "Orbs:TWAP:QuickSwap", exchangeAddress: "0x26D0ec4Be402BCE03AAa8aAf0CF67e9428ba54eF", exchangeType: "ParaswapExchange", pathfinderKey: ParaswapOnlyDex.QuickSwap }),
56
81
  Chronos: Object.assign(Object.assign({}, exports.ChainConfigs.arb), { name: "Chronos", partner: "Orbs:TWAP:Chronos", exchangeAddress: "0xA0b07F9a11dFb01388149abBdbc5B4f2196600AB", exchangeType: "OdosExchange", pathfinderKey: OdosOnlyDex.Chronos }),
82
+ BaseSwap: Object.assign(Object.assign({}, exports.ChainConfigs.base), { name: "BaseSwap", partner: "Orbs:TWAP:BaseSwap", exchangeAddress: "0xD13609A8ace04D11Ea2FFE176B69dF77C6d9375E", exchangeType: "OdosExchange", pathfinderKey: OdosOnlyDex.BaseSwap }),
57
83
  Thena: Object.assign(Object.assign({}, exports.ChainConfigs.bsc), { name: "Thena", partner: "Orbs:TWAP:Thena", exchangeAddress: "0xD63430c74C8E70D9dbdCA04C6a9E6E9E929028DA", exchangeType: "ParaswapExchange", pathfinderKey: ParaswapOnlyDex.Thena }),
58
84
  PancakeSwap: Object.assign(Object.assign({}, exports.ChainConfigs.bsc), { name: "PancakeSwap", partner: "Orbs:TWAP:PancakeSwap", exchangeAddress: "0x3dD428151c697Aa1a3E5d0ee6A52768E70D85daE", exchangeType: "ParaswapExchange", pathfinderKey: ParaswapOnlyDex.PancakeSwap }),
59
85
  };
package/dist/src/lib.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Config } from "./configs";
2
2
  import BN from "bignumber.js";
3
3
  import { TokenData } from "@defi.org/web3-candies";
4
- import type { TWAP } from "../typechain-hardhat/contracts";
5
- import type { Lens } from "../typechain-hardhat/contracts/periphery";
6
4
  import { Paraswap } from "./paraswap";
7
5
  import { Odos } from "./odos";
8
6
  import { OpenOcean } from "./openocean";
@@ -11,8 +9,8 @@ export declare class TWAPLib {
11
9
  maker: string;
12
10
  provider?: any;
13
11
  static VERSION: number;
14
- twap: TWAP;
15
- lens: Lens;
12
+ twap: import("@defi.org/web3-candies").Contract;
13
+ lens: import("@defi.org/web3-candies").Contract;
16
14
  constructor(config: Config, maker: string, provider?: any);
17
15
  dstAmount: (srcToken: TokenData, dstToken: TokenData, srcAmount: BN.Value, srcUsdMarket: BN.Value, dstUsdMarket: BN.Value, limitDstPriceFor1Src: BN.Value, isMarketOrder: boolean) => BN;
18
16
  isNativeToken: (token: TokenData) => boolean;
package/dist/src/lib.js CHANGED
@@ -244,8 +244,14 @@ class TWAPLib {
244
244
  priceUsd(token) {
245
245
  return __awaiter(this, void 0, void 0, function* () {
246
246
  token = (0, web3_candies_1.isNativeAddress)(token.address) ? this.config.wToken : token;
247
- const r = yield paraswap_1.Paraswap.findRoute(this.config.chainId, token, { address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", symbol: "NATIVE", decimals: 18 }, (0, bignumber_js_1.default)(10).pow(token.decimals));
248
- return r.srcUsd.toNumber();
247
+ try {
248
+ const r = yield paraswap_1.Paraswap.findRoute(this.config.chainId, token, { address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", symbol: "NATIVE", decimals: 18 }, (0, bignumber_js_1.default)(10).pow(token.decimals));
249
+ return r.srcUsd.toNumber();
250
+ }
251
+ catch (e) {
252
+ const r = yield odos_1.Odos.findRoute(this.config.chainId, token, this.config.nativeToken, (0, bignumber_js_1.default)(10).pow(token.decimals));
253
+ return r.srcUsd.toNumber();
254
+ }
249
255
  });
250
256
  }
251
257
  findRoute(srcToken, dstToken, srcAmount) {
package/dist/src/odos.js CHANGED
@@ -16,7 +16,7 @@ var Odos;
16
16
  const URL = "https://api.odos.xyz";
17
17
  function findRoute(chainId, src, dst, amountIn, exchangeAdapter = web3_candies_1.zeroAddress, onlyDex, partner) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const response = yield fetch(`${URL}/sor/quote`, {
19
+ const response = yield fetch(`${URL}/sor/quote/v2`, {
20
20
  method: "POST",
21
21
  headers: { "Content-Type": "application/json", accept: "application/json" },
22
22
  body: JSON.stringify({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbs-network/twap",
3
- "version": "1.14.2",
3
+ "version": "1.15.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/orbs-network/twap.git"
@@ -33,7 +33,8 @@
33
33
  "test:avax": "NETWORK=AVAX hardhat test",
34
34
  "test:arb": "NETWORK=ARB hardhat test",
35
35
  "test:bsc": "NETWORK=BSC hardhat test",
36
- "test:glmr": "NETWORK=GLMR hardhat test"
36
+ "test:glmr": "NETWORK=GLMR hardhat test",
37
+ "test:base": "NETWORK=BASE hardhat test"
37
38
  },
38
39
  "prettier": {
39
40
  "printWidth": 120
@@ -1,22 +0,0 @@
1
- /// <reference types="node" />
2
- import type BigNumber from "bignumber.js";
3
- import type { ContractOptions } from "web3-eth-contract";
4
- import type { EventLog } from "web3-core";
5
- import type { EventEmitter } from "events";
6
- import type { Callback, NonPayableTransactionObject, BlockType, BaseContract } from "../types";
7
- export interface EventOptions {
8
- filter?: object;
9
- fromBlock?: BlockType;
10
- topics?: string[];
11
- }
12
- export interface IExchange extends BaseContract {
13
- constructor(jsonInterface: any[], address?: string, options?: ContractOptions): IExchange;
14
- clone(): IExchange;
15
- methods: {
16
- getAmountOut(srcToken: string, dstToken: string, amountIn: number | string | BigNumber, askData: string | number[], bidData: string | number[]): NonPayableTransactionObject<string>;
17
- swap(srcToken: string, dstToken: string, amountIn: number | string | BigNumber, amountOutMin: number | string | BigNumber, askData: string | number[], bidData: string | number[]): NonPayableTransactionObject<void>;
18
- };
19
- events: {
20
- allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
21
- };
22
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /* Autogenerated file. Do not edit manually. */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,21 +0,0 @@
1
- /// <reference types="node" />
2
- import type BigNumber from "bignumber.js";
3
- import type { ContractOptions } from "web3-eth-contract";
4
- import type { EventLog } from "web3-core";
5
- import type { EventEmitter } from "events";
6
- import type { Callback, NonPayableTransactionObject, BlockType, BaseContract } from "../types";
7
- export interface EventOptions {
8
- filter?: object;
9
- fromBlock?: BlockType;
10
- topics?: string[];
11
- }
12
- export interface IWETH extends BaseContract {
13
- constructor(jsonInterface: any[], address?: string, options?: ContractOptions): IWETH;
14
- clone(): IWETH;
15
- methods: {
16
- withdraw(wad: number | string | BigNumber): NonPayableTransactionObject<void>;
17
- };
18
- events: {
19
- allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
20
- };
21
- }
@@ -1,5 +0,0 @@
1
- "use strict";
2
- /* Autogenerated file. Do not edit manually. */
3
- /* tslint:disable */
4
- /* eslint-disable */
5
- Object.defineProperty(exports, "__esModule", { value: true });