@portal-hq/web 3.4.2-beta.2 → 3.5.0-alpha

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.
@@ -197,6 +197,25 @@ describe('Mpc', () => {
197
197
  done();
198
198
  });
199
199
  });
200
+ it('should error out if backupMethod is invalid', (done) => {
201
+ mpc
202
+ .backup({
203
+ backupMethod: 'INVALID_METHOD',
204
+ backupConfigs: {},
205
+ host: 'web.portalhq.io',
206
+ mpcVersion: 'v6',
207
+ featureFlags: {},
208
+ })
209
+ .then(() => {
210
+ expect(0).toEqual(1);
211
+ done();
212
+ })
213
+ .catch((e) => {
214
+ expect(e).toBeInstanceOf(Error);
215
+ expect(e.message).toEqual('Invalid backup method: INVALID_METHOD. Valid methods are: GDRIVE, PASSWORD, PASSKEY, UNKNOWN');
216
+ done();
217
+ });
218
+ });
200
219
  });
201
220
  describe('clearLocalWallet', () => {
202
221
  it('should clear local wallet', (done) => {
@@ -1699,4 +1718,524 @@ describe('Mpc', () => {
1699
1718
  });
1700
1719
  });
1701
1720
  });
1721
+ describe('getYieldXyzYields', () => {
1722
+ const args = constants_1.mockYieldXyzGetYieldsRequest;
1723
+ const res = constants_1.mockYieldXyzGetYieldsResponse;
1724
+ it('should successfully return the yields', (done) => {
1725
+ var _a;
1726
+ jest
1727
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1728
+ .mockImplementation((message, origin) => {
1729
+ const { type, data } = message;
1730
+ expect(type).toEqual('portal:yieldxyz:discover');
1731
+ expect(data).toEqual(args);
1732
+ expect(origin).toEqual(mockHostOrigin);
1733
+ window.dispatchEvent(new MessageEvent('message', {
1734
+ origin: mockHostOrigin,
1735
+ data: {
1736
+ type: 'portal:yieldxyz:discoverResult',
1737
+ data: res,
1738
+ },
1739
+ }));
1740
+ });
1741
+ mpc
1742
+ .getYieldXyzYields(args)
1743
+ .then((data) => {
1744
+ expect(data).toEqual(res);
1745
+ done();
1746
+ })
1747
+ .catch((_) => {
1748
+ expect(0).toEqual(1);
1749
+ done();
1750
+ });
1751
+ });
1752
+ it('should error out if the iframe sends an error message', (done) => {
1753
+ var _a;
1754
+ jest
1755
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1756
+ .mockImplementationOnce((message, origin) => {
1757
+ const { type, data } = message;
1758
+ expect(type).toEqual('portal:yieldxyz:discover');
1759
+ expect(data).toEqual(args);
1760
+ expect(origin).toEqual(mockHostOrigin);
1761
+ window.dispatchEvent(new MessageEvent('message', {
1762
+ origin: mockHostOrigin,
1763
+ data: {
1764
+ type: 'portal:yieldxyz:discoverError',
1765
+ data: {
1766
+ code: 1,
1767
+ message: 'test',
1768
+ },
1769
+ },
1770
+ }));
1771
+ });
1772
+ mpc
1773
+ .getYieldXyzYields(args)
1774
+ .then(() => {
1775
+ expect(0).toEqual(1);
1776
+ done();
1777
+ })
1778
+ .catch((e) => {
1779
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
1780
+ expect(e.message).toEqual('test');
1781
+ expect(e.code).toEqual(1);
1782
+ done();
1783
+ });
1784
+ });
1785
+ });
1786
+ describe('enterYieldXyzYield', () => {
1787
+ const args = constants_1.mockYieldXyzEnterRequest;
1788
+ const res = constants_1.mockYieldXyzEnterResponse;
1789
+ it('should successfully enter the yield', (done) => {
1790
+ var _a;
1791
+ jest
1792
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1793
+ .mockImplementation((message, origin) => {
1794
+ const { type, data } = message;
1795
+ expect(type).toEqual('portal:yieldxyz:enter');
1796
+ expect(data).toEqual(args);
1797
+ expect(origin).toEqual(mockHostOrigin);
1798
+ window.dispatchEvent(new MessageEvent('message', {
1799
+ origin: mockHostOrigin,
1800
+ data: {
1801
+ type: 'portal:yieldxyz:enterResult',
1802
+ data: res,
1803
+ },
1804
+ }));
1805
+ });
1806
+ mpc
1807
+ .enterYieldXyzYield(args)
1808
+ .then((data) => {
1809
+ expect(data).toEqual(res);
1810
+ done();
1811
+ })
1812
+ .catch((_) => {
1813
+ expect(0).toEqual(1);
1814
+ done();
1815
+ });
1816
+ });
1817
+ it('should error out if the iframe sends an error message', (done) => {
1818
+ var _a;
1819
+ jest
1820
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1821
+ .mockImplementationOnce((message, origin) => {
1822
+ const { type, data } = message;
1823
+ expect(type).toEqual('portal:yieldxyz:enter');
1824
+ expect(data).toEqual(args);
1825
+ expect(origin).toEqual(mockHostOrigin);
1826
+ window.dispatchEvent(new MessageEvent('message', {
1827
+ origin: mockHostOrigin,
1828
+ data: {
1829
+ type: 'portal:yieldxyz:enterError',
1830
+ data: {
1831
+ code: 1,
1832
+ message: 'test',
1833
+ },
1834
+ },
1835
+ }));
1836
+ });
1837
+ mpc
1838
+ .enterYieldXyzYield(args)
1839
+ .then(() => {
1840
+ expect(0).toEqual(1);
1841
+ done();
1842
+ })
1843
+ .catch((e) => {
1844
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
1845
+ expect(e.message).toEqual('test');
1846
+ expect(e.code).toEqual(1);
1847
+ done();
1848
+ });
1849
+ });
1850
+ });
1851
+ describe('exitYieldXyzYield', () => {
1852
+ const args = constants_1.mockYieldXyzExitRequest;
1853
+ const res = constants_1.mockYieldXyzExitResponse;
1854
+ it('should successfully exit the yield', (done) => {
1855
+ var _a;
1856
+ jest
1857
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1858
+ .mockImplementation((message, origin) => {
1859
+ const { type, data } = message;
1860
+ expect(type).toEqual('portal:yieldxyz:exit');
1861
+ expect(data).toEqual(args);
1862
+ expect(origin).toEqual(mockHostOrigin);
1863
+ window.dispatchEvent(new MessageEvent('message', {
1864
+ origin: mockHostOrigin,
1865
+ data: {
1866
+ type: 'portal:yieldxyz:exitResult',
1867
+ data: res,
1868
+ },
1869
+ }));
1870
+ });
1871
+ mpc
1872
+ .exitYieldXyzYield(args)
1873
+ .then((data) => {
1874
+ expect(data).toEqual(res);
1875
+ done();
1876
+ })
1877
+ .catch((_) => {
1878
+ expect(0).toEqual(1);
1879
+ done();
1880
+ });
1881
+ });
1882
+ it('should error out if the iframe sends an error message', (done) => {
1883
+ var _a;
1884
+ jest
1885
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1886
+ .mockImplementationOnce((message, origin) => {
1887
+ const { type, data } = message;
1888
+ expect(type).toEqual('portal:yieldxyz:exit');
1889
+ expect(data).toEqual(args);
1890
+ expect(origin).toEqual(mockHostOrigin);
1891
+ window.dispatchEvent(new MessageEvent('message', {
1892
+ origin: mockHostOrigin,
1893
+ data: {
1894
+ type: 'portal:yieldxyz:exitError',
1895
+ data: {
1896
+ code: 1,
1897
+ message: 'test',
1898
+ },
1899
+ },
1900
+ }));
1901
+ });
1902
+ mpc
1903
+ .exitYieldXyzYield(args)
1904
+ .then(() => {
1905
+ expect(0).toEqual(1);
1906
+ done();
1907
+ })
1908
+ .catch((e) => {
1909
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
1910
+ expect(e.message).toEqual('test');
1911
+ expect(e.code).toEqual(1);
1912
+ done();
1913
+ });
1914
+ });
1915
+ });
1916
+ describe('getYieldXyzBalances', () => {
1917
+ const args = constants_1.mockYieldXyzGetBalancesRequest;
1918
+ const res = constants_1.mockYieldXyzGetBalancesResponse;
1919
+ it('should successfully return the balances', (done) => {
1920
+ var _a;
1921
+ jest
1922
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1923
+ .mockImplementation((message, origin) => {
1924
+ const { type, data } = message;
1925
+ expect(type).toEqual('portal:yieldxyz:getBalances');
1926
+ expect(data).toEqual(args);
1927
+ expect(origin).toEqual(mockHostOrigin);
1928
+ window.dispatchEvent(new MessageEvent('message', {
1929
+ origin: mockHostOrigin,
1930
+ data: {
1931
+ type: 'portal:yieldxyz:getBalancesResult',
1932
+ data: res,
1933
+ },
1934
+ }));
1935
+ });
1936
+ mpc
1937
+ .getYieldXyzBalances(args)
1938
+ .then((data) => {
1939
+ expect(data).toEqual(res);
1940
+ done();
1941
+ })
1942
+ .catch((_) => {
1943
+ expect(0).toEqual(1);
1944
+ done();
1945
+ });
1946
+ });
1947
+ it('should error out if the iframe sends an error message', (done) => {
1948
+ var _a;
1949
+ jest
1950
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1951
+ .mockImplementationOnce((message, origin) => {
1952
+ const { type, data } = message;
1953
+ expect(type).toEqual('portal:yieldxyz:getBalances');
1954
+ expect(data).toEqual(args);
1955
+ expect(origin).toEqual(mockHostOrigin);
1956
+ window.dispatchEvent(new MessageEvent('message', {
1957
+ origin: mockHostOrigin,
1958
+ data: {
1959
+ type: 'portal:yieldxyz:getBalancesError',
1960
+ data: {
1961
+ code: 1,
1962
+ message: 'test',
1963
+ },
1964
+ },
1965
+ }));
1966
+ });
1967
+ mpc
1968
+ .getYieldXyzBalances(args)
1969
+ .then(() => {
1970
+ expect(0).toEqual(1);
1971
+ done();
1972
+ })
1973
+ .catch((e) => {
1974
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
1975
+ expect(e.message).toEqual('test');
1976
+ expect(e.code).toEqual(1);
1977
+ done();
1978
+ });
1979
+ });
1980
+ });
1981
+ describe('getYieldXyzHistoricalActions', () => {
1982
+ const args = constants_1.mockYieldXyzGetHistoricalActionsRequest;
1983
+ const res = constants_1.mockYieldXyzGetHistoricalActionsResponse;
1984
+ it('should successfully return the historical actions', (done) => {
1985
+ var _a;
1986
+ jest
1987
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
1988
+ .mockImplementation((message, origin) => {
1989
+ const { type, data } = message;
1990
+ expect(type).toEqual('portal:yieldxyz:getHistoricalActions');
1991
+ expect(data).toEqual(args);
1992
+ expect(origin).toEqual(mockHostOrigin);
1993
+ window.dispatchEvent(new MessageEvent('message', {
1994
+ origin: mockHostOrigin,
1995
+ data: {
1996
+ type: 'portal:yieldxyz:getHistoricalActionsResult',
1997
+ data: res,
1998
+ },
1999
+ }));
2000
+ });
2001
+ mpc
2002
+ .getYieldXyzHistoricalActions(args)
2003
+ .then((data) => {
2004
+ expect(data).toEqual(res);
2005
+ done();
2006
+ })
2007
+ .catch((_) => {
2008
+ expect(0).toEqual(1);
2009
+ done();
2010
+ });
2011
+ });
2012
+ it('should error out if the iframe sends an error message', (done) => {
2013
+ var _a;
2014
+ jest
2015
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2016
+ .mockImplementationOnce((message, origin) => {
2017
+ const { type, data } = message;
2018
+ expect(type).toEqual('portal:yieldxyz:getHistoricalActions');
2019
+ expect(data).toEqual(args);
2020
+ expect(origin).toEqual(mockHostOrigin);
2021
+ window.dispatchEvent(new MessageEvent('message', {
2022
+ origin: mockHostOrigin,
2023
+ data: {
2024
+ type: 'portal:yieldxyz:getHistoricalActionsError',
2025
+ data: {
2026
+ code: 1,
2027
+ message: 'test',
2028
+ },
2029
+ },
2030
+ }));
2031
+ });
2032
+ mpc
2033
+ .getYieldXyzHistoricalActions(args)
2034
+ .then(() => {
2035
+ expect(0).toEqual(1);
2036
+ done();
2037
+ })
2038
+ .catch((e) => {
2039
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
2040
+ expect(e.message).toEqual('test');
2041
+ expect(e.code).toEqual(1);
2042
+ done();
2043
+ });
2044
+ });
2045
+ });
2046
+ describe('manageYieldXyzYield', () => {
2047
+ const args = constants_1.mockYieldXyzManageYieldRequest;
2048
+ const res = constants_1.mockYieldXyzManageYieldResponse;
2049
+ it('should successfully manage the yield', (done) => {
2050
+ var _a;
2051
+ jest
2052
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2053
+ .mockImplementation((message, origin) => {
2054
+ const { type, data } = message;
2055
+ expect(type).toEqual('portal:yieldxyz:manage');
2056
+ expect(data).toEqual(args);
2057
+ expect(origin).toEqual(mockHostOrigin);
2058
+ window.dispatchEvent(new MessageEvent('message', {
2059
+ origin: mockHostOrigin,
2060
+ data: {
2061
+ type: 'portal:yieldxyz:manageYieldResult',
2062
+ data: res,
2063
+ },
2064
+ }));
2065
+ });
2066
+ mpc
2067
+ .manageYieldXyzYield(args)
2068
+ .then((data) => {
2069
+ expect(data).toEqual(res);
2070
+ done();
2071
+ })
2072
+ .catch((_) => {
2073
+ expect(0).toEqual(1);
2074
+ done();
2075
+ });
2076
+ });
2077
+ it('should error out if the iframe sends an error message', (done) => {
2078
+ var _a;
2079
+ jest
2080
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2081
+ .mockImplementationOnce((message, origin) => {
2082
+ const { type, data } = message;
2083
+ expect(type).toEqual('portal:yieldxyz:manage');
2084
+ expect(data).toEqual(args);
2085
+ expect(origin).toEqual(mockHostOrigin);
2086
+ window.dispatchEvent(new MessageEvent('message', {
2087
+ origin: mockHostOrigin,
2088
+ data: {
2089
+ type: 'portal:yieldxyz:manageYieldError',
2090
+ data: {
2091
+ code: 1,
2092
+ message: 'test',
2093
+ },
2094
+ },
2095
+ }));
2096
+ });
2097
+ mpc
2098
+ .manageYieldXyzYield(args)
2099
+ .then(() => {
2100
+ expect(0).toEqual(1);
2101
+ done();
2102
+ })
2103
+ .catch((e) => {
2104
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
2105
+ expect(e.message).toEqual('test');
2106
+ expect(e.code).toEqual(1);
2107
+ done();
2108
+ });
2109
+ });
2110
+ });
2111
+ describe('trackYieldXyzTransaction', () => {
2112
+ const args = constants_1.mockYieldXyzTrackTransactionRequest;
2113
+ const res = constants_1.mockYieldXyzTrackTransactionResponse;
2114
+ it('should successfully track the transaction', (done) => {
2115
+ var _a;
2116
+ jest
2117
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2118
+ .mockImplementation((message, origin) => {
2119
+ const { type, data } = message;
2120
+ expect(type).toEqual('portal:yieldxyz:track');
2121
+ expect(data).toEqual(args);
2122
+ expect(origin).toEqual(mockHostOrigin);
2123
+ window.dispatchEvent(new MessageEvent('message', {
2124
+ origin: mockHostOrigin,
2125
+ data: {
2126
+ type: 'portal:yieldxyz:trackResult',
2127
+ data: res,
2128
+ },
2129
+ }));
2130
+ });
2131
+ mpc
2132
+ .trackYieldXyzTransaction(args)
2133
+ .then((data) => {
2134
+ expect(data).toEqual(res);
2135
+ done();
2136
+ })
2137
+ .catch((_) => {
2138
+ expect(0).toEqual(1);
2139
+ done();
2140
+ });
2141
+ });
2142
+ it('should error out if the iframe sends an error message', (done) => {
2143
+ var _a;
2144
+ jest
2145
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2146
+ .mockImplementationOnce((message, origin) => {
2147
+ const { type, data } = message;
2148
+ expect(type).toEqual('portal:yieldxyz:track');
2149
+ expect(data).toEqual(args);
2150
+ expect(origin).toEqual(mockHostOrigin);
2151
+ window.dispatchEvent(new MessageEvent('message', {
2152
+ origin: mockHostOrigin,
2153
+ data: {
2154
+ type: 'portal:yieldxyz:trackError',
2155
+ data: {
2156
+ code: 1,
2157
+ message: 'test',
2158
+ },
2159
+ },
2160
+ }));
2161
+ });
2162
+ mpc
2163
+ .trackYieldXyzTransaction(args)
2164
+ .then(() => {
2165
+ expect(0).toEqual(1);
2166
+ done();
2167
+ })
2168
+ .catch((e) => {
2169
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
2170
+ expect(e.message).toEqual('test');
2171
+ expect(e.code).toEqual(1);
2172
+ done();
2173
+ });
2174
+ });
2175
+ });
2176
+ describe('getYieldXyzTransaction', () => {
2177
+ const args = 'test-tx-id';
2178
+ const res = constants_1.mockYieldXyzGetTransactionResponse;
2179
+ it('should successfully return the transaction', (done) => {
2180
+ var _a;
2181
+ jest
2182
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2183
+ .mockImplementation((message, origin) => {
2184
+ const { type, data } = message;
2185
+ expect(type).toEqual('portal:yieldxyz:getTransaction');
2186
+ expect(data).toEqual(args);
2187
+ expect(origin).toEqual(mockHostOrigin);
2188
+ window.dispatchEvent(new MessageEvent('message', {
2189
+ origin: mockHostOrigin,
2190
+ data: {
2191
+ type: 'portal:yieldxyz:getTransactionResult',
2192
+ data: res,
2193
+ },
2194
+ }));
2195
+ });
2196
+ mpc
2197
+ .getYieldXyzTransaction(args)
2198
+ .then((data) => {
2199
+ expect(data).toEqual(res);
2200
+ done();
2201
+ })
2202
+ .catch((_) => {
2203
+ expect(0).toEqual(1);
2204
+ done();
2205
+ });
2206
+ });
2207
+ it('should error out if the iframe sends an error message', (done) => {
2208
+ var _a;
2209
+ jest
2210
+ .spyOn((_a = mpc.iframe) === null || _a === void 0 ? void 0 : _a.contentWindow, 'postMessage')
2211
+ .mockImplementationOnce((message, origin) => {
2212
+ const { type, data } = message;
2213
+ expect(type).toEqual('portal:yieldxyz:getTransaction');
2214
+ expect(data).toEqual(args);
2215
+ expect(origin).toEqual(mockHostOrigin);
2216
+ window.dispatchEvent(new MessageEvent('message', {
2217
+ origin: mockHostOrigin,
2218
+ data: {
2219
+ type: 'portal:yieldxyz:getTransactionError',
2220
+ data: {
2221
+ code: 1,
2222
+ message: 'test',
2223
+ },
2224
+ },
2225
+ }));
2226
+ });
2227
+ mpc
2228
+ .getYieldXyzTransaction(args)
2229
+ .then(() => {
2230
+ expect(0).toEqual(1);
2231
+ done();
2232
+ })
2233
+ .catch((e) => {
2234
+ expect(e).toBeInstanceOf(errors_1.PortalMpcError);
2235
+ expect(e.message).toEqual('test');
2236
+ expect(e.code).toEqual(1);
2237
+ done();
2238
+ });
2239
+ });
2240
+ });
1702
2241
  });
package/lib/esm/index.js CHANGED
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { Connection, PublicKey, Transaction as SolanaTransaction, SystemProgram, } from '@solana/web3.js';
11
11
  import Mpc from './mpc';
12
12
  import Provider, { RequestMethod } from './provider';
13
+ import Yield from './integrations/yield';
13
14
  class Portal {
14
15
  get ready() {
15
16
  return this.mpc.ready;
@@ -52,6 +53,7 @@ class Portal {
52
53
  this.mpc = new Mpc({
53
54
  portal: this,
54
55
  });
56
+ this.yield = new Yield({ mpc: this.mpc });
55
57
  this.provider = new Provider({
56
58
  portal: this,
57
59
  chainId: chainId ? Number(chainId) : undefined,
@@ -0,0 +1,10 @@
1
+ import YieldXyz from './yieldxyz';
2
+ /**
3
+ * This class is a container for the YieldXyz class.
4
+ * In the future, Yield domain logic should be here.
5
+ */
6
+ export default class Yield {
7
+ constructor({ mpc }) {
8
+ this.yieldXyz = new YieldXyz({ mpc });
9
+ }
10
+ }
@@ -0,0 +1,112 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export default class YieldXyz {
11
+ constructor({ mpc }) {
12
+ this.mpc = mpc;
13
+ }
14
+ /**
15
+ * Retrieves yield balances for specified addresses and networks.
16
+ * @param data - The parameters for the yield balances request.
17
+ * @returns A `YieldXyzGetBalancesResponse` promise, resolving to balance information.
18
+ * @throws An error if the operation fails.
19
+ */
20
+ getBalances(data) {
21
+ var _a;
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.getYieldXyzBalances(data);
24
+ });
25
+ }
26
+ /**
27
+ * Retrieves historical yield actions with optional filtering.
28
+ * @param data - The parameters for the historical yield actions request.
29
+ * @returns A `YieldXyzGetHistoricalActionsResponse` promise, resolving to historical actions.
30
+ * @throws An error if the operation fails.
31
+ */
32
+ getHistoricalActions(data) {
33
+ var _a;
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.getYieldXyzHistoricalActions(data);
36
+ });
37
+ }
38
+ /**
39
+ * Manages a yield opportunity with the specified parameters.
40
+ * @param data - The parameters for managing a yield opportunity.
41
+ * @returns A `YieldXyzManageYieldResponse` promise, resolving to the action details.
42
+ * @throws An error if the operation fails.
43
+ */
44
+ manage(data) {
45
+ var _a;
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.manageYieldXyzYield(data);
48
+ });
49
+ }
50
+ /**
51
+ * Enters a yield opportunity with the specified parameters.
52
+ * @param data - The parameters for entering a yield opportunity.
53
+ * @returns A `YieldXyzEnterYieldResponse` promise, resolving to the action details.
54
+ * @throws An error if the operation fails.
55
+ */
56
+ enter(data) {
57
+ var _a;
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.enterYieldXyzYield(data);
60
+ });
61
+ }
62
+ /**
63
+ * Exits a yield opportunity with the specified parameters.
64
+ * @param data - The parameters for exiting a yield opportunity.
65
+ * @returns A `YieldXyzExitResponse` promise, resolving to the action details.
66
+ * @throws An error if the operation fails.
67
+ */
68
+ exit(data) {
69
+ var _a;
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.exitYieldXyzYield(data);
72
+ });
73
+ }
74
+ /**
75
+ * Discovers yield opportunities based on the provided parameters.
76
+ * @param data - Optional parameters for yield discovery. If undefined, uses default parameters.
77
+ * @returns A `YieldXyzGetYieldsResponse` promise, resolving to available yield opportunities.
78
+ * @throws An error if the operation fails.
79
+ */
80
+ discover(data) {
81
+ var _a;
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.getYieldXyzYields(data);
84
+ });
85
+ }
86
+ /**
87
+ * Tracks a transaction by submitting its hash to the Yield.xyz integration.
88
+ * @param data - The parameters for tracking a transaction:
89
+ * - transactionId: The ID of the transaction to track.
90
+ * - txHash: The hash of the transaction to submit.
91
+ * @returns A `YieldXyzTrackTransactionResponse` promise.
92
+ * @throws An error if the operation fails.
93
+ */
94
+ track(data) {
95
+ var _a;
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.trackYieldXyzTransaction(data);
98
+ });
99
+ }
100
+ /**
101
+ * Retrieves a single yield action transaction by its ID.
102
+ * @param transactionId - The ID of the transaction to retrieve.
103
+ * @returns A `YieldXyzGetTransactionResponse` promise, resolving to transaction details.
104
+ * @throws An error if the operation fails.
105
+ */
106
+ getTransaction(transactionId) {
107
+ var _a;
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return (_a = this.mpc) === null || _a === void 0 ? void 0 : _a.getYieldXyzTransaction(transactionId);
110
+ });
111
+ }
112
+ }