@optimex-xyz/market-maker-sdk 0.8.0 → 0.9.0-dev-3e9bb0c

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/dist/index.mjs CHANGED
@@ -12,6 +12,9 @@ var environments = {
12
12
  protocolFetcherProxyAddress: "0x0267Fc04eE866b31907dEe123aBdCdB67d03B297",
13
13
  paymentAddressMap: {
14
14
  ethereum_sepolia: "0x1d8b58438D5Ccc8Fcb4b738C89078f7b4168C9c0"
15
+ },
16
+ liquidationAddressMap: {
17
+ ethereum_sepolia: "0x63f56c6e602f288821bea31ccdd9b1e189305f38"
15
18
  }
16
19
  },
17
20
  staging: {
@@ -20,7 +23,8 @@ var environments = {
20
23
  protocolFetcherProxyAddress: "0x7c07151ca4DFd93F352Ab9B132A95866697c38c2",
21
24
  paymentAddressMap: {
22
25
  ethereum_sepolia: "0x7387DcCfE2f1D5F80b4ECDF91eF58541517e90D2"
23
- }
26
+ },
27
+ liquidationAddressMap: {}
24
28
  },
25
29
  prelive: {
26
30
  backendUrl: "https://pre-api.optimex.xyz",
@@ -28,7 +32,8 @@ var environments = {
28
32
  protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
29
33
  paymentAddressMap: {
30
34
  ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
31
- }
35
+ },
36
+ liquidationAddressMap: {}
32
37
  },
33
38
  production: {
34
39
  backendUrl: "https://api.optimex.xyz",
@@ -36,7 +41,8 @@ var environments = {
36
41
  protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
37
42
  paymentAddressMap: {
38
43
  ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
39
- }
44
+ },
45
+ liquidationAddressMap: {}
40
46
  }
41
47
  };
42
48
  var Config = class {
@@ -91,6 +97,9 @@ var Config = class {
91
97
  getPaymentAddress(networkId) {
92
98
  return this.config.paymentAddressMap[networkId];
93
99
  }
100
+ getLiquidationAddress(networkId) {
101
+ return this.config.liquidationAddressMap[networkId];
102
+ }
94
103
  getProtocolFetcherAddress() {
95
104
  return this.config.protocolFetcherProxyAddress;
96
105
  }
@@ -120,6 +129,7 @@ var sdk = new SDK();
120
129
  var factories_exports = {};
121
130
  __export(factories_exports, {
122
131
  ERC20__factory: () => ERC20__factory,
132
+ LendingLiquidation__factory: () => LendingLiquidation__factory,
123
133
  Payment__factory: () => Payment__factory,
124
134
  ProtocolFetcherProxy__factory: () => ProtocolFetcherProxy__factory,
125
135
  Router__factory: () => Router__factory,
@@ -1526,9 +1536,440 @@ var ERC20__factory = class {
1526
1536
  };
1527
1537
  ERC20__factory.abi = _abi;
1528
1538
 
1529
- // src/contracts/contracts/factories/Payment__factory.ts
1539
+ // src/contracts/contracts/factories/LendingLiquidation__factory.ts
1530
1540
  import { Contract as Contract2, Interface as Interface2 } from "ethers";
1531
1541
  var _abi2 = [
1542
+ {
1543
+ inputs: [
1544
+ {
1545
+ internalType: "address",
1546
+ name: "_owBtc",
1547
+ type: "address"
1548
+ },
1549
+ {
1550
+ internalType: "address",
1551
+ name: "_morpho",
1552
+ type: "address"
1553
+ },
1554
+ {
1555
+ internalType: "address",
1556
+ name: "_lendingManagement",
1557
+ type: "address"
1558
+ },
1559
+ {
1560
+ internalType: "string",
1561
+ name: "name",
1562
+ type: "string"
1563
+ },
1564
+ {
1565
+ internalType: "string",
1566
+ name: "version",
1567
+ type: "string"
1568
+ }
1569
+ ],
1570
+ stateMutability: "nonpayable",
1571
+ type: "constructor"
1572
+ },
1573
+ {
1574
+ inputs: [],
1575
+ name: "ECDSAInvalidSignature",
1576
+ type: "error"
1577
+ },
1578
+ {
1579
+ inputs: [
1580
+ {
1581
+ internalType: "uint256",
1582
+ name: "length",
1583
+ type: "uint256"
1584
+ }
1585
+ ],
1586
+ name: "ECDSAInvalidSignatureLength",
1587
+ type: "error"
1588
+ },
1589
+ {
1590
+ inputs: [
1591
+ {
1592
+ internalType: "bytes32",
1593
+ name: "s",
1594
+ type: "bytes32"
1595
+ }
1596
+ ],
1597
+ name: "ECDSAInvalidSignatureS",
1598
+ type: "error"
1599
+ },
1600
+ {
1601
+ inputs: [],
1602
+ name: "InvalidMorpho",
1603
+ type: "error"
1604
+ },
1605
+ {
1606
+ inputs: [],
1607
+ name: "InvalidShortString",
1608
+ type: "error"
1609
+ },
1610
+ {
1611
+ inputs: [
1612
+ {
1613
+ internalType: "address",
1614
+ name: "validator",
1615
+ type: "address"
1616
+ }
1617
+ ],
1618
+ name: "NotAuthorizedValidator",
1619
+ type: "error"
1620
+ },
1621
+ {
1622
+ inputs: [],
1623
+ name: "NotEnoughPaymentAmount",
1624
+ type: "error"
1625
+ },
1626
+ {
1627
+ inputs: [
1628
+ {
1629
+ internalType: "string",
1630
+ name: "str",
1631
+ type: "string"
1632
+ }
1633
+ ],
1634
+ name: "StringTooLong",
1635
+ type: "error"
1636
+ },
1637
+ {
1638
+ anonymous: false,
1639
+ inputs: [],
1640
+ name: "EIP712DomainChanged",
1641
+ type: "event"
1642
+ },
1643
+ {
1644
+ anonymous: false,
1645
+ inputs: [
1646
+ {
1647
+ indexed: true,
1648
+ internalType: "address",
1649
+ name: "positionManager",
1650
+ type: "address"
1651
+ },
1652
+ {
1653
+ indexed: true,
1654
+ internalType: "bytes32",
1655
+ name: "positionId",
1656
+ type: "bytes32"
1657
+ },
1658
+ {
1659
+ indexed: true,
1660
+ internalType: "bytes32",
1661
+ name: "tradeId",
1662
+ type: "bytes32"
1663
+ },
1664
+ {
1665
+ indexed: false,
1666
+ internalType: "bytes32",
1667
+ name: "marketId",
1668
+ type: "bytes32"
1669
+ },
1670
+ {
1671
+ indexed: false,
1672
+ internalType: "uint256",
1673
+ name: "repaidLoan",
1674
+ type: "uint256"
1675
+ },
1676
+ {
1677
+ indexed: false,
1678
+ internalType: "uint256",
1679
+ name: "userRefund",
1680
+ type: "uint256"
1681
+ }
1682
+ ],
1683
+ name: "ForceClose",
1684
+ type: "event"
1685
+ },
1686
+ {
1687
+ anonymous: false,
1688
+ inputs: [
1689
+ {
1690
+ indexed: true,
1691
+ internalType: "address",
1692
+ name: "positionManager",
1693
+ type: "address"
1694
+ },
1695
+ {
1696
+ indexed: true,
1697
+ internalType: "bytes32",
1698
+ name: "positionId",
1699
+ type: "bytes32"
1700
+ },
1701
+ {
1702
+ indexed: true,
1703
+ internalType: "bytes32",
1704
+ name: "tradeId",
1705
+ type: "bytes32"
1706
+ },
1707
+ {
1708
+ indexed: false,
1709
+ internalType: "bytes32",
1710
+ name: "marketId",
1711
+ type: "bytes32"
1712
+ },
1713
+ {
1714
+ indexed: false,
1715
+ internalType: "uint256",
1716
+ name: "seizedCollateral",
1717
+ type: "uint256"
1718
+ },
1719
+ {
1720
+ indexed: false,
1721
+ internalType: "uint256",
1722
+ name: "remainingCollateral",
1723
+ type: "uint256"
1724
+ },
1725
+ {
1726
+ indexed: false,
1727
+ internalType: "uint256",
1728
+ name: "repaidLoan",
1729
+ type: "uint256"
1730
+ },
1731
+ {
1732
+ indexed: false,
1733
+ internalType: "uint256",
1734
+ name: "bonusLoan",
1735
+ type: "uint256"
1736
+ }
1737
+ ],
1738
+ name: "Liquidate",
1739
+ type: "event"
1740
+ },
1741
+ {
1742
+ anonymous: false,
1743
+ inputs: [
1744
+ {
1745
+ indexed: true,
1746
+ internalType: "address",
1747
+ name: "positionManager",
1748
+ type: "address"
1749
+ },
1750
+ {
1751
+ indexed: true,
1752
+ internalType: "bytes32",
1753
+ name: "positionId",
1754
+ type: "bytes32"
1755
+ },
1756
+ {
1757
+ indexed: true,
1758
+ internalType: "bytes32",
1759
+ name: "tradeId",
1760
+ type: "bytes32"
1761
+ },
1762
+ {
1763
+ indexed: false,
1764
+ internalType: "address",
1765
+ name: "sender",
1766
+ type: "address"
1767
+ },
1768
+ {
1769
+ indexed: false,
1770
+ internalType: "bytes32",
1771
+ name: "marketId",
1772
+ type: "bytes32"
1773
+ },
1774
+ {
1775
+ indexed: false,
1776
+ internalType: "uint256",
1777
+ name: "amount",
1778
+ type: "uint256"
1779
+ },
1780
+ {
1781
+ indexed: false,
1782
+ internalType: "uint256",
1783
+ name: "collateral",
1784
+ type: "uint256"
1785
+ }
1786
+ ],
1787
+ name: "Payment",
1788
+ type: "event"
1789
+ },
1790
+ {
1791
+ inputs: [],
1792
+ name: "LENDING_MANAGEMENT",
1793
+ outputs: [
1794
+ {
1795
+ internalType: "contract ILendingManagement",
1796
+ name: "",
1797
+ type: "address"
1798
+ }
1799
+ ],
1800
+ stateMutability: "view",
1801
+ type: "function"
1802
+ },
1803
+ {
1804
+ inputs: [],
1805
+ name: "MORPHO",
1806
+ outputs: [
1807
+ {
1808
+ internalType: "contract IMorpho",
1809
+ name: "",
1810
+ type: "address"
1811
+ }
1812
+ ],
1813
+ stateMutability: "view",
1814
+ type: "function"
1815
+ },
1816
+ {
1817
+ inputs: [],
1818
+ name: "VALIDATOR_FORCE_CLOSE_TYPEHASH",
1819
+ outputs: [
1820
+ {
1821
+ internalType: "bytes32",
1822
+ name: "",
1823
+ type: "bytes32"
1824
+ }
1825
+ ],
1826
+ stateMutability: "view",
1827
+ type: "function"
1828
+ },
1829
+ {
1830
+ inputs: [],
1831
+ name: "eip712Domain",
1832
+ outputs: [
1833
+ {
1834
+ internalType: "bytes1",
1835
+ name: "fields",
1836
+ type: "bytes1"
1837
+ },
1838
+ {
1839
+ internalType: "string",
1840
+ name: "name",
1841
+ type: "string"
1842
+ },
1843
+ {
1844
+ internalType: "string",
1845
+ name: "version",
1846
+ type: "string"
1847
+ },
1848
+ {
1849
+ internalType: "uint256",
1850
+ name: "chainId",
1851
+ type: "uint256"
1852
+ },
1853
+ {
1854
+ internalType: "address",
1855
+ name: "verifyingContract",
1856
+ type: "address"
1857
+ },
1858
+ {
1859
+ internalType: "bytes32",
1860
+ name: "salt",
1861
+ type: "bytes32"
1862
+ },
1863
+ {
1864
+ internalType: "uint256[]",
1865
+ name: "extensions",
1866
+ type: "uint256[]"
1867
+ }
1868
+ ],
1869
+ stateMutability: "view",
1870
+ type: "function"
1871
+ },
1872
+ {
1873
+ inputs: [
1874
+ {
1875
+ internalType: "uint256",
1876
+ name: "repaidAssets",
1877
+ type: "uint256"
1878
+ },
1879
+ {
1880
+ internalType: "bytes",
1881
+ name: "data",
1882
+ type: "bytes"
1883
+ }
1884
+ ],
1885
+ name: "onMorphoLiquidate",
1886
+ outputs: [],
1887
+ stateMutability: "nonpayable",
1888
+ type: "function"
1889
+ },
1890
+ {
1891
+ inputs: [],
1892
+ name: "optimexDomain",
1893
+ outputs: [
1894
+ {
1895
+ internalType: "string",
1896
+ name: "name",
1897
+ type: "string"
1898
+ },
1899
+ {
1900
+ internalType: "string",
1901
+ name: "version",
1902
+ type: "string"
1903
+ }
1904
+ ],
1905
+ stateMutability: "view",
1906
+ type: "function"
1907
+ },
1908
+ {
1909
+ inputs: [],
1910
+ name: "owBtc",
1911
+ outputs: [
1912
+ {
1913
+ internalType: "contract OW_BTC",
1914
+ name: "",
1915
+ type: "address"
1916
+ }
1917
+ ],
1918
+ stateMutability: "view",
1919
+ type: "function"
1920
+ },
1921
+ {
1922
+ inputs: [
1923
+ {
1924
+ internalType: "bytes32",
1925
+ name: "tradeId",
1926
+ type: "bytes32"
1927
+ },
1928
+ {
1929
+ internalType: "contract IAccountPositionManager",
1930
+ name: "positionManager",
1931
+ type: "address"
1932
+ },
1933
+ {
1934
+ internalType: "uint256",
1935
+ name: "amount",
1936
+ type: "uint256"
1937
+ },
1938
+ {
1939
+ internalType: "bytes32",
1940
+ name: "positionId",
1941
+ type: "bytes32"
1942
+ },
1943
+ {
1944
+ internalType: "bool",
1945
+ name: "isLiquidate",
1946
+ type: "bool"
1947
+ },
1948
+ {
1949
+ internalType: "bytes",
1950
+ name: "validatorSignature",
1951
+ type: "bytes"
1952
+ }
1953
+ ],
1954
+ name: "payment",
1955
+ outputs: [],
1956
+ stateMutability: "nonpayable",
1957
+ type: "function"
1958
+ }
1959
+ ];
1960
+ var LendingLiquidation__factory = class {
1961
+ static createInterface() {
1962
+ return new Interface2(_abi2);
1963
+ }
1964
+ static connect(address, runner) {
1965
+ return new Contract2(address, _abi2, runner);
1966
+ }
1967
+ };
1968
+ LendingLiquidation__factory.abi = _abi2;
1969
+
1970
+ // src/contracts/contracts/factories/Payment__factory.ts
1971
+ import { Contract as Contract3, Interface as Interface3 } from "ethers";
1972
+ var _abi3 = [
1532
1973
  {
1533
1974
  inputs: [
1534
1975
  {
@@ -1737,17 +2178,17 @@ var _abi2 = [
1737
2178
  ];
1738
2179
  var Payment__factory = class {
1739
2180
  static createInterface() {
1740
- return new Interface2(_abi2);
2181
+ return new Interface3(_abi3);
1741
2182
  }
1742
2183
  static connect(address, runner) {
1743
- return new Contract2(address, _abi2, runner);
2184
+ return new Contract3(address, _abi3, runner);
1744
2185
  }
1745
2186
  };
1746
- Payment__factory.abi = _abi2;
2187
+ Payment__factory.abi = _abi3;
1747
2188
 
1748
2189
  // src/contracts/contracts/factories/ProtocolFetcherProxy__factory.ts
1749
- import { Contract as Contract3, Interface as Interface3 } from "ethers";
1750
- var _abi3 = [
2190
+ import { Contract as Contract4, Interface as Interface4 } from "ethers";
2191
+ var _abi4 = [
1751
2192
  {
1752
2193
  inputs: [
1753
2194
  {
@@ -2292,21 +2733,21 @@ var _abi3 = [
2292
2733
  ];
2293
2734
  var ProtocolFetcherProxy__factory = class {
2294
2735
  static createInterface() {
2295
- return new Interface3(_abi3);
2736
+ return new Interface4(_abi4);
2296
2737
  }
2297
2738
  static connect(address, runner) {
2298
- return new Contract3(
2739
+ return new Contract4(
2299
2740
  address,
2300
- _abi3,
2741
+ _abi4,
2301
2742
  runner
2302
2743
  );
2303
2744
  }
2304
2745
  };
2305
- ProtocolFetcherProxy__factory.abi = _abi3;
2746
+ ProtocolFetcherProxy__factory.abi = _abi4;
2306
2747
 
2307
2748
  // src/contracts/contracts/factories/Router__factory.ts
2308
- import { Contract as Contract4, Interface as Interface4 } from "ethers";
2309
- var _abi4 = [
2749
+ import { Contract as Contract5, Interface as Interface5 } from "ethers";
2750
+ var _abi5 = [
2310
2751
  {
2311
2752
  inputs: [
2312
2753
  {
@@ -3805,17 +4246,17 @@ var _abi4 = [
3805
4246
  ];
3806
4247
  var Router__factory = class {
3807
4248
  static createInterface() {
3808
- return new Interface4(_abi4);
4249
+ return new Interface5(_abi5);
3809
4250
  }
3810
4251
  static connect(address, runner) {
3811
- return new Contract4(address, _abi4, runner);
4252
+ return new Contract5(address, _abi5, runner);
3812
4253
  }
3813
4254
  };
3814
- Router__factory.abi = _abi4;
4255
+ Router__factory.abi = _abi5;
3815
4256
 
3816
4257
  // src/contracts/contracts/factories/Signer__factory.ts
3817
- import { Contract as Contract5, Interface as Interface5 } from "ethers";
3818
- var _abi5 = [
4258
+ import { Contract as Contract6, Interface as Interface6 } from "ethers";
4259
+ var _abi6 = [
3819
4260
  {
3820
4261
  inputs: [],
3821
4262
  stateMutability: "nonpayable",
@@ -4143,16 +4584,13 @@ var _abi5 = [
4143
4584
  ];
4144
4585
  var Signer__factory = class {
4145
4586
  static createInterface() {
4146
- return new Interface5(_abi5);
4587
+ return new Interface6(_abi6);
4147
4588
  }
4148
4589
  static connect(address, runner) {
4149
- return new Contract5(address, _abi5, runner);
4590
+ return new Contract6(address, _abi6, runner);
4150
4591
  }
4151
4592
  };
4152
- Signer__factory.abi = _abi5;
4153
-
4154
- // src/services/router.service.ts
4155
- import { JsonRpcProvider as JsonRpcProvider2 } from "ethers";
4593
+ Signer__factory.abi = _abi6;
4156
4594
 
4157
4595
  // src/services/protocol.service.ts
4158
4596
  import { ethers, JsonRpcProvider } from "ethers";
@@ -4194,6 +4632,7 @@ var ProtocolService = class {
4194
4632
  var protocolService = new ProtocolService();
4195
4633
 
4196
4634
  // src/services/router.service.ts
4635
+ import { JsonRpcProvider as JsonRpcProvider2 } from "ethers";
4197
4636
  var RouterService = class {
4198
4637
  constructor() {
4199
4638
  this.contract = null;
@@ -4707,8 +5146,10 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
4707
5146
  }
4708
5147
  export {
4709
5148
  ERC20__factory,
5149
+ LendingLiquidation__factory,
4710
5150
  Payment__factory,
4711
5151
  ProtocolFetcherProxy__factory,
5152
+ ProtocolService,
4712
5153
  RouterService,
4713
5154
  Router__factory,
4714
5155
  SDK,
@@ -4734,6 +5175,7 @@ export {
4734
5175
  getTradeIdsHash,
4735
5176
  makePaymentType,
4736
5177
  presignType,
5178
+ protocolService,
4737
5179
  removeHexPrefix,
4738
5180
  rfqAuthenticationTypes,
4739
5181
  routerService,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimex-xyz/market-maker-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0-dev-3e9bb0c",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"