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