@optimex-xyz/market-maker-sdk 0.8.0 → 0.9.0-dev-cb35949
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/README.md +10 -6
- package/dist/index.d.mts +620 -2
- package/dist/index.d.ts +620 -2
- package/dist/index.js +489 -47
- package/dist/index.mjs +465 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,8 +31,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
ERC20__factory: () => ERC20__factory,
|
|
34
|
+
LendingLiquidation__factory: () => LendingLiquidation__factory,
|
|
34
35
|
Payment__factory: () => Payment__factory,
|
|
35
36
|
ProtocolFetcherProxy__factory: () => ProtocolFetcherProxy__factory,
|
|
37
|
+
ProtocolService: () => ProtocolService,
|
|
36
38
|
RouterService: () => RouterService,
|
|
37
39
|
Router__factory: () => Router__factory,
|
|
38
40
|
SDK: () => SDK,
|
|
@@ -58,6 +60,7 @@ __export(index_exports, {
|
|
|
58
60
|
getTradeIdsHash: () => getTradeIdsHash,
|
|
59
61
|
makePaymentType: () => makePaymentType,
|
|
60
62
|
presignType: () => presignType,
|
|
63
|
+
protocolService: () => protocolService,
|
|
61
64
|
removeHexPrefix: () => removeHexPrefix,
|
|
62
65
|
rfqAuthenticationTypes: () => rfqAuthenticationTypes,
|
|
63
66
|
routerService: () => routerService,
|
|
@@ -78,6 +81,9 @@ var environments = {
|
|
|
78
81
|
protocolFetcherProxyAddress: "0x0267Fc04eE866b31907dEe123aBdCdB67d03B297",
|
|
79
82
|
paymentAddressMap: {
|
|
80
83
|
ethereum_sepolia: "0x1d8b58438D5Ccc8Fcb4b738C89078f7b4168C9c0"
|
|
84
|
+
},
|
|
85
|
+
liquidationAddressMap: {
|
|
86
|
+
ethereum_sepolia: "0x63f56c6e602f288821bea31ccdd9b1e189305f38"
|
|
81
87
|
}
|
|
82
88
|
},
|
|
83
89
|
staging: {
|
|
@@ -86,7 +92,8 @@ var environments = {
|
|
|
86
92
|
protocolFetcherProxyAddress: "0x7c07151ca4DFd93F352Ab9B132A95866697c38c2",
|
|
87
93
|
paymentAddressMap: {
|
|
88
94
|
ethereum_sepolia: "0x7387DcCfE2f1D5F80b4ECDF91eF58541517e90D2"
|
|
89
|
-
}
|
|
95
|
+
},
|
|
96
|
+
liquidationAddressMap: {}
|
|
90
97
|
},
|
|
91
98
|
prelive: {
|
|
92
99
|
backendUrl: "https://pre-api.optimex.xyz",
|
|
@@ -94,7 +101,8 @@ var environments = {
|
|
|
94
101
|
protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
|
|
95
102
|
paymentAddressMap: {
|
|
96
103
|
ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
|
|
97
|
-
}
|
|
104
|
+
},
|
|
105
|
+
liquidationAddressMap: {}
|
|
98
106
|
},
|
|
99
107
|
production: {
|
|
100
108
|
backendUrl: "https://api.optimex.xyz",
|
|
@@ -102,7 +110,8 @@ var environments = {
|
|
|
102
110
|
protocolFetcherProxyAddress: "0xFDEd4CEf9aE1E03D0BeF161262a266c1c157a32b",
|
|
103
111
|
paymentAddressMap: {
|
|
104
112
|
ethereum: "0x0A497AC4261E37FA4062762C23Cf3cB642C839b8"
|
|
105
|
-
}
|
|
113
|
+
},
|
|
114
|
+
liquidationAddressMap: {}
|
|
106
115
|
}
|
|
107
116
|
};
|
|
108
117
|
var Config = class {
|
|
@@ -186,6 +195,7 @@ var sdk = new SDK();
|
|
|
186
195
|
var factories_exports = {};
|
|
187
196
|
__export(factories_exports, {
|
|
188
197
|
ERC20__factory: () => ERC20__factory,
|
|
198
|
+
LendingLiquidation__factory: () => LendingLiquidation__factory,
|
|
189
199
|
Payment__factory: () => Payment__factory,
|
|
190
200
|
ProtocolFetcherProxy__factory: () => ProtocolFetcherProxy__factory,
|
|
191
201
|
Router__factory: () => Router__factory,
|
|
@@ -1592,9 +1602,440 @@ var ERC20__factory = class {
|
|
|
1592
1602
|
};
|
|
1593
1603
|
ERC20__factory.abi = _abi;
|
|
1594
1604
|
|
|
1595
|
-
// src/contracts/contracts/factories/
|
|
1605
|
+
// src/contracts/contracts/factories/LendingLiquidation__factory.ts
|
|
1596
1606
|
var import_ethers2 = require("ethers");
|
|
1597
1607
|
var _abi2 = [
|
|
1608
|
+
{
|
|
1609
|
+
inputs: [
|
|
1610
|
+
{
|
|
1611
|
+
internalType: "address",
|
|
1612
|
+
name: "_owBtc",
|
|
1613
|
+
type: "address"
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
internalType: "address",
|
|
1617
|
+
name: "_morpho",
|
|
1618
|
+
type: "address"
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
internalType: "address",
|
|
1622
|
+
name: "_lendingManagement",
|
|
1623
|
+
type: "address"
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
internalType: "string",
|
|
1627
|
+
name: "name",
|
|
1628
|
+
type: "string"
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
internalType: "string",
|
|
1632
|
+
name: "version",
|
|
1633
|
+
type: "string"
|
|
1634
|
+
}
|
|
1635
|
+
],
|
|
1636
|
+
stateMutability: "nonpayable",
|
|
1637
|
+
type: "constructor"
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
inputs: [],
|
|
1641
|
+
name: "ECDSAInvalidSignature",
|
|
1642
|
+
type: "error"
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
inputs: [
|
|
1646
|
+
{
|
|
1647
|
+
internalType: "uint256",
|
|
1648
|
+
name: "length",
|
|
1649
|
+
type: "uint256"
|
|
1650
|
+
}
|
|
1651
|
+
],
|
|
1652
|
+
name: "ECDSAInvalidSignatureLength",
|
|
1653
|
+
type: "error"
|
|
1654
|
+
},
|
|
1655
|
+
{
|
|
1656
|
+
inputs: [
|
|
1657
|
+
{
|
|
1658
|
+
internalType: "bytes32",
|
|
1659
|
+
name: "s",
|
|
1660
|
+
type: "bytes32"
|
|
1661
|
+
}
|
|
1662
|
+
],
|
|
1663
|
+
name: "ECDSAInvalidSignatureS",
|
|
1664
|
+
type: "error"
|
|
1665
|
+
},
|
|
1666
|
+
{
|
|
1667
|
+
inputs: [],
|
|
1668
|
+
name: "InvalidMorpho",
|
|
1669
|
+
type: "error"
|
|
1670
|
+
},
|
|
1671
|
+
{
|
|
1672
|
+
inputs: [],
|
|
1673
|
+
name: "InvalidShortString",
|
|
1674
|
+
type: "error"
|
|
1675
|
+
},
|
|
1676
|
+
{
|
|
1677
|
+
inputs: [
|
|
1678
|
+
{
|
|
1679
|
+
internalType: "address",
|
|
1680
|
+
name: "validator",
|
|
1681
|
+
type: "address"
|
|
1682
|
+
}
|
|
1683
|
+
],
|
|
1684
|
+
name: "NotAuthorizedValidator",
|
|
1685
|
+
type: "error"
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
inputs: [],
|
|
1689
|
+
name: "NotEnoughPaymentAmount",
|
|
1690
|
+
type: "error"
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
inputs: [
|
|
1694
|
+
{
|
|
1695
|
+
internalType: "string",
|
|
1696
|
+
name: "str",
|
|
1697
|
+
type: "string"
|
|
1698
|
+
}
|
|
1699
|
+
],
|
|
1700
|
+
name: "StringTooLong",
|
|
1701
|
+
type: "error"
|
|
1702
|
+
},
|
|
1703
|
+
{
|
|
1704
|
+
anonymous: false,
|
|
1705
|
+
inputs: [],
|
|
1706
|
+
name: "EIP712DomainChanged",
|
|
1707
|
+
type: "event"
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
anonymous: false,
|
|
1711
|
+
inputs: [
|
|
1712
|
+
{
|
|
1713
|
+
indexed: true,
|
|
1714
|
+
internalType: "address",
|
|
1715
|
+
name: "positionManager",
|
|
1716
|
+
type: "address"
|
|
1717
|
+
},
|
|
1718
|
+
{
|
|
1719
|
+
indexed: true,
|
|
1720
|
+
internalType: "bytes32",
|
|
1721
|
+
name: "positionId",
|
|
1722
|
+
type: "bytes32"
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
indexed: true,
|
|
1726
|
+
internalType: "bytes32",
|
|
1727
|
+
name: "tradeId",
|
|
1728
|
+
type: "bytes32"
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
indexed: false,
|
|
1732
|
+
internalType: "bytes32",
|
|
1733
|
+
name: "marketId",
|
|
1734
|
+
type: "bytes32"
|
|
1735
|
+
},
|
|
1736
|
+
{
|
|
1737
|
+
indexed: false,
|
|
1738
|
+
internalType: "uint256",
|
|
1739
|
+
name: "repaidLoan",
|
|
1740
|
+
type: "uint256"
|
|
1741
|
+
},
|
|
1742
|
+
{
|
|
1743
|
+
indexed: false,
|
|
1744
|
+
internalType: "uint256",
|
|
1745
|
+
name: "userRefund",
|
|
1746
|
+
type: "uint256"
|
|
1747
|
+
}
|
|
1748
|
+
],
|
|
1749
|
+
name: "ForceClose",
|
|
1750
|
+
type: "event"
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
anonymous: false,
|
|
1754
|
+
inputs: [
|
|
1755
|
+
{
|
|
1756
|
+
indexed: true,
|
|
1757
|
+
internalType: "address",
|
|
1758
|
+
name: "positionManager",
|
|
1759
|
+
type: "address"
|
|
1760
|
+
},
|
|
1761
|
+
{
|
|
1762
|
+
indexed: true,
|
|
1763
|
+
internalType: "bytes32",
|
|
1764
|
+
name: "positionId",
|
|
1765
|
+
type: "bytes32"
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
indexed: true,
|
|
1769
|
+
internalType: "bytes32",
|
|
1770
|
+
name: "tradeId",
|
|
1771
|
+
type: "bytes32"
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
indexed: false,
|
|
1775
|
+
internalType: "bytes32",
|
|
1776
|
+
name: "marketId",
|
|
1777
|
+
type: "bytes32"
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
indexed: false,
|
|
1781
|
+
internalType: "uint256",
|
|
1782
|
+
name: "seizedCollateral",
|
|
1783
|
+
type: "uint256"
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
indexed: false,
|
|
1787
|
+
internalType: "uint256",
|
|
1788
|
+
name: "remainingCollateral",
|
|
1789
|
+
type: "uint256"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
indexed: false,
|
|
1793
|
+
internalType: "uint256",
|
|
1794
|
+
name: "repaidLoan",
|
|
1795
|
+
type: "uint256"
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
indexed: false,
|
|
1799
|
+
internalType: "uint256",
|
|
1800
|
+
name: "bonusLoan",
|
|
1801
|
+
type: "uint256"
|
|
1802
|
+
}
|
|
1803
|
+
],
|
|
1804
|
+
name: "Liquidate",
|
|
1805
|
+
type: "event"
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
anonymous: false,
|
|
1809
|
+
inputs: [
|
|
1810
|
+
{
|
|
1811
|
+
indexed: true,
|
|
1812
|
+
internalType: "address",
|
|
1813
|
+
name: "positionManager",
|
|
1814
|
+
type: "address"
|
|
1815
|
+
},
|
|
1816
|
+
{
|
|
1817
|
+
indexed: true,
|
|
1818
|
+
internalType: "bytes32",
|
|
1819
|
+
name: "positionId",
|
|
1820
|
+
type: "bytes32"
|
|
1821
|
+
},
|
|
1822
|
+
{
|
|
1823
|
+
indexed: true,
|
|
1824
|
+
internalType: "bytes32",
|
|
1825
|
+
name: "tradeId",
|
|
1826
|
+
type: "bytes32"
|
|
1827
|
+
},
|
|
1828
|
+
{
|
|
1829
|
+
indexed: false,
|
|
1830
|
+
internalType: "address",
|
|
1831
|
+
name: "sender",
|
|
1832
|
+
type: "address"
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
indexed: false,
|
|
1836
|
+
internalType: "bytes32",
|
|
1837
|
+
name: "marketId",
|
|
1838
|
+
type: "bytes32"
|
|
1839
|
+
},
|
|
1840
|
+
{
|
|
1841
|
+
indexed: false,
|
|
1842
|
+
internalType: "uint256",
|
|
1843
|
+
name: "amount",
|
|
1844
|
+
type: "uint256"
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
indexed: false,
|
|
1848
|
+
internalType: "uint256",
|
|
1849
|
+
name: "collateral",
|
|
1850
|
+
type: "uint256"
|
|
1851
|
+
}
|
|
1852
|
+
],
|
|
1853
|
+
name: "Payment",
|
|
1854
|
+
type: "event"
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
inputs: [],
|
|
1858
|
+
name: "LENDING_MANAGEMENT",
|
|
1859
|
+
outputs: [
|
|
1860
|
+
{
|
|
1861
|
+
internalType: "contract ILendingManagement",
|
|
1862
|
+
name: "",
|
|
1863
|
+
type: "address"
|
|
1864
|
+
}
|
|
1865
|
+
],
|
|
1866
|
+
stateMutability: "view",
|
|
1867
|
+
type: "function"
|
|
1868
|
+
},
|
|
1869
|
+
{
|
|
1870
|
+
inputs: [],
|
|
1871
|
+
name: "MORPHO",
|
|
1872
|
+
outputs: [
|
|
1873
|
+
{
|
|
1874
|
+
internalType: "contract IMorpho",
|
|
1875
|
+
name: "",
|
|
1876
|
+
type: "address"
|
|
1877
|
+
}
|
|
1878
|
+
],
|
|
1879
|
+
stateMutability: "view",
|
|
1880
|
+
type: "function"
|
|
1881
|
+
},
|
|
1882
|
+
{
|
|
1883
|
+
inputs: [],
|
|
1884
|
+
name: "VALIDATOR_FORCE_CLOSE_TYPEHASH",
|
|
1885
|
+
outputs: [
|
|
1886
|
+
{
|
|
1887
|
+
internalType: "bytes32",
|
|
1888
|
+
name: "",
|
|
1889
|
+
type: "bytes32"
|
|
1890
|
+
}
|
|
1891
|
+
],
|
|
1892
|
+
stateMutability: "view",
|
|
1893
|
+
type: "function"
|
|
1894
|
+
},
|
|
1895
|
+
{
|
|
1896
|
+
inputs: [],
|
|
1897
|
+
name: "eip712Domain",
|
|
1898
|
+
outputs: [
|
|
1899
|
+
{
|
|
1900
|
+
internalType: "bytes1",
|
|
1901
|
+
name: "fields",
|
|
1902
|
+
type: "bytes1"
|
|
1903
|
+
},
|
|
1904
|
+
{
|
|
1905
|
+
internalType: "string",
|
|
1906
|
+
name: "name",
|
|
1907
|
+
type: "string"
|
|
1908
|
+
},
|
|
1909
|
+
{
|
|
1910
|
+
internalType: "string",
|
|
1911
|
+
name: "version",
|
|
1912
|
+
type: "string"
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
internalType: "uint256",
|
|
1916
|
+
name: "chainId",
|
|
1917
|
+
type: "uint256"
|
|
1918
|
+
},
|
|
1919
|
+
{
|
|
1920
|
+
internalType: "address",
|
|
1921
|
+
name: "verifyingContract",
|
|
1922
|
+
type: "address"
|
|
1923
|
+
},
|
|
1924
|
+
{
|
|
1925
|
+
internalType: "bytes32",
|
|
1926
|
+
name: "salt",
|
|
1927
|
+
type: "bytes32"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
internalType: "uint256[]",
|
|
1931
|
+
name: "extensions",
|
|
1932
|
+
type: "uint256[]"
|
|
1933
|
+
}
|
|
1934
|
+
],
|
|
1935
|
+
stateMutability: "view",
|
|
1936
|
+
type: "function"
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
inputs: [
|
|
1940
|
+
{
|
|
1941
|
+
internalType: "uint256",
|
|
1942
|
+
name: "repaidAssets",
|
|
1943
|
+
type: "uint256"
|
|
1944
|
+
},
|
|
1945
|
+
{
|
|
1946
|
+
internalType: "bytes",
|
|
1947
|
+
name: "data",
|
|
1948
|
+
type: "bytes"
|
|
1949
|
+
}
|
|
1950
|
+
],
|
|
1951
|
+
name: "onMorphoLiquidate",
|
|
1952
|
+
outputs: [],
|
|
1953
|
+
stateMutability: "nonpayable",
|
|
1954
|
+
type: "function"
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
inputs: [],
|
|
1958
|
+
name: "optimexDomain",
|
|
1959
|
+
outputs: [
|
|
1960
|
+
{
|
|
1961
|
+
internalType: "string",
|
|
1962
|
+
name: "name",
|
|
1963
|
+
type: "string"
|
|
1964
|
+
},
|
|
1965
|
+
{
|
|
1966
|
+
internalType: "string",
|
|
1967
|
+
name: "version",
|
|
1968
|
+
type: "string"
|
|
1969
|
+
}
|
|
1970
|
+
],
|
|
1971
|
+
stateMutability: "view",
|
|
1972
|
+
type: "function"
|
|
1973
|
+
},
|
|
1974
|
+
{
|
|
1975
|
+
inputs: [],
|
|
1976
|
+
name: "owBtc",
|
|
1977
|
+
outputs: [
|
|
1978
|
+
{
|
|
1979
|
+
internalType: "contract OW_BTC",
|
|
1980
|
+
name: "",
|
|
1981
|
+
type: "address"
|
|
1982
|
+
}
|
|
1983
|
+
],
|
|
1984
|
+
stateMutability: "view",
|
|
1985
|
+
type: "function"
|
|
1986
|
+
},
|
|
1987
|
+
{
|
|
1988
|
+
inputs: [
|
|
1989
|
+
{
|
|
1990
|
+
internalType: "bytes32",
|
|
1991
|
+
name: "tradeId",
|
|
1992
|
+
type: "bytes32"
|
|
1993
|
+
},
|
|
1994
|
+
{
|
|
1995
|
+
internalType: "contract IAccountPositionManager",
|
|
1996
|
+
name: "positionManager",
|
|
1997
|
+
type: "address"
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
internalType: "uint256",
|
|
2001
|
+
name: "amount",
|
|
2002
|
+
type: "uint256"
|
|
2003
|
+
},
|
|
2004
|
+
{
|
|
2005
|
+
internalType: "bytes32",
|
|
2006
|
+
name: "positionId",
|
|
2007
|
+
type: "bytes32"
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
internalType: "bool",
|
|
2011
|
+
name: "isLiquidate",
|
|
2012
|
+
type: "bool"
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
internalType: "bytes",
|
|
2016
|
+
name: "validatorSignature",
|
|
2017
|
+
type: "bytes"
|
|
2018
|
+
}
|
|
2019
|
+
],
|
|
2020
|
+
name: "payment",
|
|
2021
|
+
outputs: [],
|
|
2022
|
+
stateMutability: "nonpayable",
|
|
2023
|
+
type: "function"
|
|
2024
|
+
}
|
|
2025
|
+
];
|
|
2026
|
+
var LendingLiquidation__factory = class {
|
|
2027
|
+
static createInterface() {
|
|
2028
|
+
return new import_ethers2.Interface(_abi2);
|
|
2029
|
+
}
|
|
2030
|
+
static connect(address, runner) {
|
|
2031
|
+
return new import_ethers2.Contract(address, _abi2, runner);
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
LendingLiquidation__factory.abi = _abi2;
|
|
2035
|
+
|
|
2036
|
+
// src/contracts/contracts/factories/Payment__factory.ts
|
|
2037
|
+
var import_ethers3 = require("ethers");
|
|
2038
|
+
var _abi3 = [
|
|
1598
2039
|
{
|
|
1599
2040
|
inputs: [
|
|
1600
2041
|
{
|
|
@@ -1803,17 +2244,17 @@ var _abi2 = [
|
|
|
1803
2244
|
];
|
|
1804
2245
|
var Payment__factory = class {
|
|
1805
2246
|
static createInterface() {
|
|
1806
|
-
return new
|
|
2247
|
+
return new import_ethers3.Interface(_abi3);
|
|
1807
2248
|
}
|
|
1808
2249
|
static connect(address, runner) {
|
|
1809
|
-
return new
|
|
2250
|
+
return new import_ethers3.Contract(address, _abi3, runner);
|
|
1810
2251
|
}
|
|
1811
2252
|
};
|
|
1812
|
-
Payment__factory.abi =
|
|
2253
|
+
Payment__factory.abi = _abi3;
|
|
1813
2254
|
|
|
1814
2255
|
// src/contracts/contracts/factories/ProtocolFetcherProxy__factory.ts
|
|
1815
|
-
var
|
|
1816
|
-
var
|
|
2256
|
+
var import_ethers4 = require("ethers");
|
|
2257
|
+
var _abi4 = [
|
|
1817
2258
|
{
|
|
1818
2259
|
inputs: [
|
|
1819
2260
|
{
|
|
@@ -2358,21 +2799,21 @@ var _abi3 = [
|
|
|
2358
2799
|
];
|
|
2359
2800
|
var ProtocolFetcherProxy__factory = class {
|
|
2360
2801
|
static createInterface() {
|
|
2361
|
-
return new
|
|
2802
|
+
return new import_ethers4.Interface(_abi4);
|
|
2362
2803
|
}
|
|
2363
2804
|
static connect(address, runner) {
|
|
2364
|
-
return new
|
|
2805
|
+
return new import_ethers4.Contract(
|
|
2365
2806
|
address,
|
|
2366
|
-
|
|
2807
|
+
_abi4,
|
|
2367
2808
|
runner
|
|
2368
2809
|
);
|
|
2369
2810
|
}
|
|
2370
2811
|
};
|
|
2371
|
-
ProtocolFetcherProxy__factory.abi =
|
|
2812
|
+
ProtocolFetcherProxy__factory.abi = _abi4;
|
|
2372
2813
|
|
|
2373
2814
|
// src/contracts/contracts/factories/Router__factory.ts
|
|
2374
|
-
var
|
|
2375
|
-
var
|
|
2815
|
+
var import_ethers5 = require("ethers");
|
|
2816
|
+
var _abi5 = [
|
|
2376
2817
|
{
|
|
2377
2818
|
inputs: [
|
|
2378
2819
|
{
|
|
@@ -3871,17 +4312,17 @@ var _abi4 = [
|
|
|
3871
4312
|
];
|
|
3872
4313
|
var Router__factory = class {
|
|
3873
4314
|
static createInterface() {
|
|
3874
|
-
return new
|
|
4315
|
+
return new import_ethers5.Interface(_abi5);
|
|
3875
4316
|
}
|
|
3876
4317
|
static connect(address, runner) {
|
|
3877
|
-
return new
|
|
4318
|
+
return new import_ethers5.Contract(address, _abi5, runner);
|
|
3878
4319
|
}
|
|
3879
4320
|
};
|
|
3880
|
-
Router__factory.abi =
|
|
4321
|
+
Router__factory.abi = _abi5;
|
|
3881
4322
|
|
|
3882
4323
|
// src/contracts/contracts/factories/Signer__factory.ts
|
|
3883
|
-
var
|
|
3884
|
-
var
|
|
4324
|
+
var import_ethers6 = require("ethers");
|
|
4325
|
+
var _abi6 = [
|
|
3885
4326
|
{
|
|
3886
4327
|
inputs: [],
|
|
3887
4328
|
stateMutability: "nonpayable",
|
|
@@ -4209,22 +4650,19 @@ var _abi5 = [
|
|
|
4209
4650
|
];
|
|
4210
4651
|
var Signer__factory = class {
|
|
4211
4652
|
static createInterface() {
|
|
4212
|
-
return new
|
|
4653
|
+
return new import_ethers6.Interface(_abi6);
|
|
4213
4654
|
}
|
|
4214
4655
|
static connect(address, runner) {
|
|
4215
|
-
return new
|
|
4656
|
+
return new import_ethers6.Contract(address, _abi6, runner);
|
|
4216
4657
|
}
|
|
4217
4658
|
};
|
|
4218
|
-
Signer__factory.abi =
|
|
4219
|
-
|
|
4220
|
-
// src/services/router.service.ts
|
|
4221
|
-
var import_ethers7 = require("ethers");
|
|
4659
|
+
Signer__factory.abi = _abi6;
|
|
4222
4660
|
|
|
4223
4661
|
// src/services/protocol.service.ts
|
|
4224
|
-
var
|
|
4662
|
+
var import_ethers7 = require("ethers");
|
|
4225
4663
|
var ProtocolService = class {
|
|
4226
4664
|
constructor() {
|
|
4227
|
-
this.provider = new
|
|
4665
|
+
this.provider = new import_ethers7.JsonRpcProvider(config.getRpcUrl());
|
|
4228
4666
|
this.contract = ProtocolFetcherProxy__factory.connect(config.getProtocolFetcherAddress(), this.provider);
|
|
4229
4667
|
config.registerObserver(this);
|
|
4230
4668
|
}
|
|
@@ -4233,11 +4671,11 @@ var ProtocolService = class {
|
|
|
4233
4671
|
* Updates service when config changes
|
|
4234
4672
|
*/
|
|
4235
4673
|
onConfigUpdate(newConfig) {
|
|
4236
|
-
this.provider = new
|
|
4674
|
+
this.provider = new import_ethers7.JsonRpcProvider(newConfig.rpcUrl);
|
|
4237
4675
|
this.contract = ProtocolFetcherProxy__factory.connect(newConfig.protocolFetcherProxyAddress, this.provider);
|
|
4238
4676
|
}
|
|
4239
4677
|
async getCurrentPubkey(network) {
|
|
4240
|
-
return this.contract.getLatestMPCInfo(
|
|
4678
|
+
return this.contract.getLatestMPCInfo(import_ethers7.ethers.toUtf8Bytes(network));
|
|
4241
4679
|
}
|
|
4242
4680
|
async getPFeeRate({
|
|
4243
4681
|
fromNetworkId,
|
|
@@ -4246,10 +4684,10 @@ var ProtocolService = class {
|
|
|
4246
4684
|
toTokenId
|
|
4247
4685
|
}) {
|
|
4248
4686
|
const feeRate = await this.contract.getPFeeRate([
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4687
|
+
import_ethers7.ethers.toUtf8Bytes(fromNetworkId),
|
|
4688
|
+
import_ethers7.ethers.toUtf8Bytes(fromTokenId),
|
|
4689
|
+
import_ethers7.ethers.toUtf8Bytes(toNetworkId),
|
|
4690
|
+
import_ethers7.ethers.toUtf8Bytes(toTokenId)
|
|
4253
4691
|
]);
|
|
4254
4692
|
return Number(feeRate.toString());
|
|
4255
4693
|
}
|
|
@@ -4260,14 +4698,15 @@ var ProtocolService = class {
|
|
|
4260
4698
|
var protocolService = new ProtocolService();
|
|
4261
4699
|
|
|
4262
4700
|
// src/services/router.service.ts
|
|
4701
|
+
var import_ethers8 = require("ethers");
|
|
4263
4702
|
var RouterService = class {
|
|
4264
4703
|
constructor() {
|
|
4265
4704
|
this.contract = null;
|
|
4266
|
-
this.provider = new
|
|
4705
|
+
this.provider = new import_ethers8.JsonRpcProvider(config.getRpcUrl());
|
|
4267
4706
|
config.registerObserver(this);
|
|
4268
4707
|
}
|
|
4269
4708
|
onConfigUpdate(newConfig) {
|
|
4270
|
-
this.provider = new
|
|
4709
|
+
this.provider = new import_ethers8.JsonRpcProvider(newConfig.rpcUrl);
|
|
4271
4710
|
this.contract = null;
|
|
4272
4711
|
}
|
|
4273
4712
|
/**
|
|
@@ -4316,11 +4755,11 @@ var RouterService = class {
|
|
|
4316
4755
|
var routerService = new RouterService();
|
|
4317
4756
|
|
|
4318
4757
|
// src/services/signer.service.ts
|
|
4319
|
-
var
|
|
4758
|
+
var import_ethers9 = require("ethers");
|
|
4320
4759
|
var SignerService = class {
|
|
4321
4760
|
constructor() {
|
|
4322
4761
|
this.routerService = routerService;
|
|
4323
|
-
this.provider = new
|
|
4762
|
+
this.provider = new import_ethers9.JsonRpcProvider(config.getRpcUrl());
|
|
4324
4763
|
config.registerObserver(this);
|
|
4325
4764
|
}
|
|
4326
4765
|
/**
|
|
@@ -4328,7 +4767,7 @@ var SignerService = class {
|
|
|
4328
4767
|
* Updates service when config changes
|
|
4329
4768
|
*/
|
|
4330
4769
|
onConfigUpdate(newConfig) {
|
|
4331
|
-
this.provider = new
|
|
4770
|
+
this.provider = new import_ethers9.JsonRpcProvider(newConfig.rpcUrl);
|
|
4332
4771
|
}
|
|
4333
4772
|
async getDomain() {
|
|
4334
4773
|
const signerAddress = await this.routerService.getSigner();
|
|
@@ -4672,20 +5111,20 @@ async function defaultDomain(signerHelper, provider) {
|
|
|
4672
5111
|
}
|
|
4673
5112
|
|
|
4674
5113
|
// src/signatures/getInfoHash.ts
|
|
4675
|
-
var
|
|
4676
|
-
var abiCoder =
|
|
5114
|
+
var import_ethers10 = require("ethers");
|
|
5115
|
+
var abiCoder = import_ethers10.AbiCoder.defaultAbiCoder();
|
|
4677
5116
|
function getTradeIdsHash(tradeIds) {
|
|
4678
|
-
return (0,
|
|
5117
|
+
return (0, import_ethers10.keccak256)(abiCoder.encode(["bytes32[]"], [tradeIds]));
|
|
4679
5118
|
}
|
|
4680
5119
|
function getMakePaymentHash(tradeIds, signedAt, startIdx, paymentTxId) {
|
|
4681
|
-
const bundlerHash = (0,
|
|
4682
|
-
const infoHash = (0,
|
|
5120
|
+
const bundlerHash = (0, import_ethers10.keccak256)(abiCoder.encode(["bytes32[]"], [tradeIds]));
|
|
5121
|
+
const infoHash = (0, import_ethers10.keccak256)(
|
|
4683
5122
|
abiCoder.encode(["uint64", "uint256", "bytes32", "bytes"], [signedAt, startIdx, bundlerHash, paymentTxId])
|
|
4684
5123
|
);
|
|
4685
5124
|
return infoHash;
|
|
4686
5125
|
}
|
|
4687
5126
|
function getCommitInfoHash(pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry) {
|
|
4688
|
-
const infoHash = (0,
|
|
5127
|
+
const infoHash = (0, import_ethers10.keccak256)(
|
|
4689
5128
|
abiCoder.encode(
|
|
4690
5129
|
["bytes32", "bytes", "bytes", "bytes", "uint256", "uint64"],
|
|
4691
5130
|
[pmmId, pmmRecvAddr, toChain, toToken, amountOut, expiry]
|
|
@@ -4695,7 +5134,7 @@ function getCommitInfoHash(pmmId, pmmRecvAddr, toChain, toToken, amountOut, expi
|
|
|
4695
5134
|
}
|
|
4696
5135
|
|
|
4697
5136
|
// src/signatures/getSignature.ts
|
|
4698
|
-
var
|
|
5137
|
+
var import_ethers11 = require("ethers");
|
|
4699
5138
|
|
|
4700
5139
|
// src/signatures/types.ts
|
|
4701
5140
|
var presignType = {
|
|
@@ -4762,7 +5201,7 @@ function getSignatureType(type) {
|
|
|
4762
5201
|
async function getSigner(provider, signerHelper, tradeId, infoHash, type, signature) {
|
|
4763
5202
|
const values = { tradeId, infoHash };
|
|
4764
5203
|
const contractDomain = await defaultDomain(signerHelper, provider);
|
|
4765
|
-
return (0,
|
|
5204
|
+
return (0, import_ethers11.verifyTypedData)(contractDomain, getSignatureType(type), values, signature);
|
|
4766
5205
|
}
|
|
4767
5206
|
async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash, type, domain) {
|
|
4768
5207
|
const contractDomain = await defaultDomain(signerHelper, provider);
|
|
@@ -4774,8 +5213,10 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
|
|
|
4774
5213
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4775
5214
|
0 && (module.exports = {
|
|
4776
5215
|
ERC20__factory,
|
|
5216
|
+
LendingLiquidation__factory,
|
|
4777
5217
|
Payment__factory,
|
|
4778
5218
|
ProtocolFetcherProxy__factory,
|
|
5219
|
+
ProtocolService,
|
|
4779
5220
|
RouterService,
|
|
4780
5221
|
Router__factory,
|
|
4781
5222
|
SDK,
|
|
@@ -4801,6 +5242,7 @@ async function getSignature(Signer2, provider, signerHelper, tradeId, infoHash,
|
|
|
4801
5242
|
getTradeIdsHash,
|
|
4802
5243
|
makePaymentType,
|
|
4803
5244
|
presignType,
|
|
5245
|
+
protocolService,
|
|
4804
5246
|
removeHexPrefix,
|
|
4805
5247
|
rfqAuthenticationTypes,
|
|
4806
5248
|
routerService,
|